From 175bfc4e3e9f7aa39e084d3f1625347f1d5711ec Mon Sep 17 00:00:00 2001 From: jacqueline Date: Mon, 25 Mar 2024 17:34:41 +1100 Subject: WIP rewrie audio pipeline+fsm guts for more reliability --- src/lua/property.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/lua/property.cpp') diff --git a/src/lua/property.cpp b/src/lua/property.cpp index f721f9ce..200f4d5c 100644 --- a/src/lua/property.cpp +++ b/src/lua/property.cpp @@ -221,7 +221,7 @@ static auto pushTagValue(lua_State* L, const database::TagValue& val) -> void { val); } -static void pushTrack(lua_State* L, const audio::Track& track) { +static void pushTrack(lua_State* L, const audio::TrackInfo& track) { lua_newtable(L); for (const auto& tag : track.tags->allPresent()) { @@ -229,19 +229,18 @@ static void pushTrack(lua_State* L, const audio::Track& track) { pushTagValue(L, track.tags->get(tag)); lua_settable(L, -3); } - if (track.db_info) { - lua_pushliteral(L, "id"); - lua_pushinteger(L, track.db_info->id); + + if (track.duration) { + lua_pushliteral(L, "duration"); + lua_pushinteger(L, track.duration.value()); lua_settable(L, -3); } - lua_pushliteral(L, "duration"); - lua_pushinteger(L, track.duration); - lua_settable(L, -3); - - lua_pushliteral(L, "bitrate_kbps"); - lua_pushinteger(L, track.bitrate_kbps); - lua_settable(L, -3); + if (track.bitrate_kbps) { + lua_pushliteral(L, "bitrate_kbps"); + lua_pushinteger(L, track.bitrate_kbps.value()); + lua_settable(L, -3); + } lua_pushliteral(L, "encoding"); lua_pushstring(L, codecs::StreamTypeToString(track.encoding).c_str()); @@ -289,7 +288,7 @@ auto Property::PushValue(lua_State& s) -> int { lua_pushboolean(&s, arg); } else if constexpr (std::is_same_v) { lua_pushstring(&s, arg.c_str()); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { pushTrack(&s, arg); } else if constexpr (std::is_same_v) { pushDevice(&s, arg); -- cgit v1.2.3