Useful for choosing e.g. between chains that contain scalers versus not,
and then later also deinterlacers.
+int LiveInputWrapper_get_width(lua_State* L)
+{
+ assert(lua_gettop(L) == 1);
+ LiveInputWrapper *input = (LiveInputWrapper *)luaL_checkudata(L, 1, "LiveInputWrapper");
+ lua_pushnumber(L, input->get_width());
+ return 1;
+}
+
+int LiveInputWrapper_get_height(lua_State* L)
+{
+ assert(lua_gettop(L) == 1);
+ LiveInputWrapper *input = (LiveInputWrapper *)luaL_checkudata(L, 1, "LiveInputWrapper");
+ lua_pushnumber(L, input->get_height());
+ return 1;
+}
+
int ImageInput_new(lua_State* L)
{
assert(lua_gettop(L) == 1);
int ImageInput_new(lua_State* L)
{
assert(lua_gettop(L) == 1);
const luaL_Reg LiveInputWrapper_funcs[] = {
{ "connect_signal", LiveInputWrapper_connect_signal },
const luaL_Reg LiveInputWrapper_funcs[] = {
{ "connect_signal", LiveInputWrapper_connect_signal },
+ // These are only valid during calls to get_chain and the setup chain callback.
+ { "get_width", LiveInputWrapper_get_width },
+ { "get_height", LiveInputWrapper_get_height },
input->set_height(userdata->last_height[frame.field_number]);
}
input->set_height(userdata->last_height[frame.field_number]);
}
+unsigned LiveInputWrapper::get_width() const
+{
+ if (last_connected_signal_num == -1) {
+ return 0;
+ }
+ BufferedFrame frame = theme->input_state->buffered_frames[last_connected_signal_num][0];
+ const PBOFrameAllocator::Userdata *userdata = (const PBOFrameAllocator::Userdata *)frame.frame->userdata;
+ return userdata->last_width[frame.field_number];
+}
+
+unsigned LiveInputWrapper::get_height() const
+{
+ if (last_connected_signal_num == -1) {
+ return 0;
+ }
+ BufferedFrame frame = theme->input_state->buffered_frames[last_connected_signal_num][0];
+ const PBOFrameAllocator::Userdata *userdata = (const PBOFrameAllocator::Userdata *)frame.frame->userdata;
+ return userdata->last_height[frame.field_number];
+}
+
Theme::Theme(const char *filename, ResourcePool *resource_pool, unsigned num_cards)
: resource_pool(resource_pool), num_cards(num_cards)
{
Theme::Theme(const char *filename, ResourcePool *resource_pool, unsigned num_cards)
: resource_pool(resource_pool), num_cards(num_cards)
{
lua_pushnumber(L, width);
lua_pushnumber(L, height);
lua_pushnumber(L, width);
lua_pushnumber(L, height);
+ this->input_state = &input_state;
if (lua_pcall(L, 4, 2, 0) != 0) {
fprintf(stderr, "error running function `get_chain': %s\n", lua_tostring(L, -1));
exit(1);
if (lua_pcall(L, 4, 2, 0) != 0) {
fprintf(stderr, "error running function `get_chain': %s\n", lua_tostring(L, -1));
exit(1);
+ // Of last connected signal number (see connect_signal()).
+ // Only valid during get_chain() or the setup callback.
+ unsigned get_width() const;
+ unsigned get_height() const;
+
private:
Theme *theme; // Not owned by us.
movit::YCbCrInput *input; // Owned by the chain.
private:
Theme *theme; // Not owned by us.
movit::YCbCrInput *input; // Owned by the chain.
+ int last_connected_signal_num = -1;
};
#endif // !defined(_THEME_H)
};
#endif // !defined(_THEME_H)