From: Steinar H. Gunderson Date: Sat, 29 Apr 2017 21:21:30 +0000 (+0200) Subject: Expose the video input signals to the theme, so that they can ask for connection... X-Git-Tag: 1.6.0~38 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=5ac91302c4138f21989ce1103ff42a9209e2f90f Expose the video input signals to the theme, so that they can ask for connection status etc. --- diff --git a/theme.cpp b/theme.cpp index ec791d3..9cfcc87 100644 --- a/theme.cpp +++ b/theme.cpp @@ -369,6 +369,14 @@ int VideoInput_change_rate(lua_State* L) return 0; } +int VideoInput_get_signal_num(lua_State* L) +{ + assert(lua_gettop(L) == 1); + FFmpegCapture **video_input = (FFmpegCapture **)luaL_checkudata(L, 1, "VideoInput"); + lua_pushnumber(L, -1 - (*video_input)->get_card_index()); + return 1; +} + int WhiteBalanceEffect_new(lua_State* L) { assert(lua_gettop(L) == 0); @@ -572,6 +580,7 @@ const luaL_Reg VideoInput_funcs[] = { { "new", VideoInput_new }, { "rewind", VideoInput_rewind }, { "change_rate", VideoInput_change_rate }, + { "get_signal_num", VideoInput_get_signal_num }, { NULL, NULL } }; @@ -1084,6 +1093,11 @@ vector Theme::get_transition_names(float t) int Theme::map_signal(int signal_num) { + // Negative numbers map to raw signals. + if (signal_num < 0) { + return -1 - signal_num; + } + unique_lock lock(map_m); if (signal_to_card_mapping.count(signal_num)) { return signal_to_card_mapping[signal_num];