Help to run routine button
Posted: 28 Feb 2008 17:44
Hi I am implementing a new button function. Thanks to the help of the forum's people I have been able to show the button beside the PLAY button. Now I was finding out how to run this funtion but I am not a so good programmer for this issues and I am not able to understand how is working. Looking around I saw some codes about the buttons and the change of variables.
Let me show what I´ve done and explain what I would like to do if anyone could help.
I have modified the file "ts.c" in /modules/mux/mpeg folder. In this file I have attached some funtions to stream a new PSI table and new boolean variables. Now I am trying to change the value of a boolean variable through the button before I have told:
add_bool( SOUT_CFG_PREFIX "enable-HAT", 0, NULL, HAT_TEXT, HAT_LONGTEXT, VLC_TRUE);
[...]
static const char *ppsz_sout_options[] = {
"pid-video", "pid-audio", "pid-spu", "pid-pmt", "tsid", "netid",
"es-id-pid", "shaping", "pcr", "bmin", "bmax", "use-key-frames",
"dts-delay", "csa-ck", "csa-pkt", "crypt-audio", "crypt-video",
"muxpmt", "sdtdesc", "program-pmt", "alignment", "enable-HAT",
"numpmt-f" , "pidpmt-f" , "numpmt-s" , "pidpmt-s",
NULL
};
The boolean "enable-Hat" appears in the MUX funtion in the file "ts.c". With the first two lines I want to receive the order from the button which I will explain afterwars his code:
sout_instance_t *pa_mux = (sout_instance_t *)p_mux->parent;
[...]
p_sys->enhat = var_CreateGetBool( pa_mux, SOUT_CFG_PREFIX "enable-HAT" );
if(p_sys->enhat)
{
GetHAT( p_mux, &chain_ts );
}
In the "interface.cpp" file in /modules/gui/wxwidgets I have modified the code to show the button and it´s done properly. The problem is the code to change the boolean said backwards. The code is the next:
void Interface::OnDecodeHAT( wxCommandEvent& WXUNUSED(event) )
{
DecodeHAT();
}
void Interface::DecodeHAT()
{
sout_instance_t *p_mux = (sout_instance_t *)vlc_object_find(p_intf, VLC_OBJECT_SOUT, FIND_ANYWHERE);
if( p_mux = NULL )
{
msg_Warn(p_intf, "Object not found");
return;
}
var_SetBool(p_mux, "enable-HAT", VLC_TRUE);
vlc_object_release( p_mux );
}
But the make give the error:interface.cpp:1095:error:invalid use of undefined type 'struct sout_instance_t', the line referred to varSetBool... And the same for the line 1097, the line vlc_object_release...
Now I don´t know what to do as I feel little lost. I'm aware the message is a little large but there is none who can help me aside the forum people. If anyone could aid me to learn how doing it I would be very grateful.
Thanks and regards
Let me show what I´ve done and explain what I would like to do if anyone could help.
I have modified the file "ts.c" in /modules/mux/mpeg folder. In this file I have attached some funtions to stream a new PSI table and new boolean variables. Now I am trying to change the value of a boolean variable through the button before I have told:
add_bool( SOUT_CFG_PREFIX "enable-HAT", 0, NULL, HAT_TEXT, HAT_LONGTEXT, VLC_TRUE);
[...]
static const char *ppsz_sout_options[] = {
"pid-video", "pid-audio", "pid-spu", "pid-pmt", "tsid", "netid",
"es-id-pid", "shaping", "pcr", "bmin", "bmax", "use-key-frames",
"dts-delay", "csa-ck", "csa-pkt", "crypt-audio", "crypt-video",
"muxpmt", "sdtdesc", "program-pmt", "alignment", "enable-HAT",
"numpmt-f" , "pidpmt-f" , "numpmt-s" , "pidpmt-s",
NULL
};
The boolean "enable-Hat" appears in the MUX funtion in the file "ts.c". With the first two lines I want to receive the order from the button which I will explain afterwars his code:
sout_instance_t *pa_mux = (sout_instance_t *)p_mux->parent;
[...]
p_sys->enhat = var_CreateGetBool( pa_mux, SOUT_CFG_PREFIX "enable-HAT" );
if(p_sys->enhat)
{
GetHAT( p_mux, &chain_ts );
}
In the "interface.cpp" file in /modules/gui/wxwidgets I have modified the code to show the button and it´s done properly. The problem is the code to change the boolean said backwards. The code is the next:
void Interface::OnDecodeHAT( wxCommandEvent& WXUNUSED(event) )
{
DecodeHAT();
}
void Interface::DecodeHAT()
{
sout_instance_t *p_mux = (sout_instance_t *)vlc_object_find(p_intf, VLC_OBJECT_SOUT, FIND_ANYWHERE);
if( p_mux = NULL )
{
msg_Warn(p_intf, "Object not found");
return;
}
var_SetBool(p_mux, "enable-HAT", VLC_TRUE);
vlc_object_release( p_mux );
}
But the make give the error:interface.cpp:1095:error:invalid use of undefined type 'struct sout_instance_t', the line referred to varSetBool... And the same for the line 1097, the line vlc_object_release...
Now I don´t know what to do as I feel little lost. I'm aware the message is a little large but there is none who can help me aside the forum people. If anyone could aid me to learn how doing it I would be very grateful.
Thanks and regards