Commit f755d520 authored by Erwan Tulou's avatar Erwan Tulou

skins2: implement recording and next-frame

This patch adds the following keywords for skins developpers :
      - vlc.canRecord      (boolean / refers to can-record)
      - vlc.isRecording    (boolean / refers to record)
      - vlc.toggleRecord() (function / toggle recording)
      - vlc.nextFrame()    (function / next frame)
parent ebd6d41f
......@@ -69,6 +69,7 @@ ADD_COMMAND( item_current_changed )
ADD_COMMAND( intf_event_changed )
ADD_COMMAND( bit_rate_changed )
ADD_COMMAND( sample_rate_changed )
ADD_COMMAND( can_record_changed )
ADD_COMMAND( random_changed )
ADD_COMMAND( loop_changed )
......
......@@ -39,3 +39,24 @@ void CmdSnapshot::execute()
}
}
void CmdToggleRecord::execute()
{
input_thread_t* pInput = getIntf()->p_sys->p_input;
if( !pInput )
return;
var_ToggleBool( pInput, "record" );
}
void CmdNextFrame::execute()
{
input_thread_t* pInput = getIntf()->p_sys->p_input;
if( !pInput )
return;
var_TriggerCallback( pInput, "frame-next" );
}
......@@ -29,5 +29,7 @@
/// Command to snapshot VLC
DEFINE_COMMAND(Snapshot, "snapshot" )
DEFINE_COMMAND(ToggleRecord, "togglerecord" )
DEFINE_COMMAND(NextFrame, "nextframe" )
#endif
......@@ -109,6 +109,8 @@ Interpreter::Interpreter( intf_thread_t *pIntf ): SkinObject( pIntf )
REGISTER_CMD( "vlc.minimize()", CmdMinimize )
REGISTER_CMD( "vlc.onTop()", CmdOnTop )
REGISTER_CMD( "vlc.snapshot()", CmdSnapshot )
REGISTER_CMD( "vlc.toggleRecord()", CmdToggleRecord )
REGISTER_CMD( "vlc.nextFrame()", CmdNextFrame )
REGISTER_CMD( "vlc.quit()", CmdQuit )
m_commandMap["equalizer.enable()"] =
CmdGenericPtr( new CmdSetEqualizer( getIntf(), true ) );
......
......@@ -105,6 +105,9 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
REGISTER_VAR( m_cVarSeekable, VarBoolImpl, "vlc.isSeekable" )
REGISTER_VAR( m_cVarDvdActive, VarBoolImpl, "dvd.isActive" )
REGISTER_VAR( m_cVarRecordable, VarBoolImpl, "vlc.canRecord" )
REGISTER_VAR( m_cVarRecording, VarBoolImpl, "vlc.isRecording" )
/* Vout variables */
REGISTER_VAR( m_cVarFullscreen, VarBoolImpl, "vlc.isFullscreen" )
REGISTER_VAR( m_cVarHasVout, VarBoolImpl, "vlc.hasVout" )
......@@ -205,6 +208,7 @@ VlcProc::~VlcProc()
var_DelCallback( pInput, "intf-event", onGenericCallback, this );
var_DelCallback( pInput, "bit-rate", onGenericCallback, this );
var_DelCallback( pInput, "sample-rate", onGenericCallback, this );
var_DelCallback( pInput, "can-Record", onGenericCallback, this );
vlc_object_release( pInput );
getIntf()->p_sys->p_input = NULL;
......@@ -480,6 +484,7 @@ int VlcProc::onGenericCallback( vlc_object_t *pObj, const char *pVariable,
ADD_CALLBACK_ENTRY( "intf-event", intf_event_changed )
ADD_CALLBACK_ENTRY( "bit-rate", bit_rate_changed )
ADD_CALLBACK_ENTRY( "sample-rate", sample_rate_changed )
ADD_CALLBACK_ENTRY( "can-record", can_record_changed )
ADD_CALLBACK_ENTRY( "random", random_changed )
ADD_CALLBACK_ENTRY( "loop", loop_changed )
......@@ -505,6 +510,7 @@ void VlcProc::on_item_current_changed( vlc_object_t* p_obj, vlc_value_t newVal )
var_DelCallback( pInput, "intf-event", onGenericCallback, this );
var_DelCallback( pInput, "bit-rate", onGenericCallback, this );
var_DelCallback( pInput, "sample-rate", onGenericCallback, this );
var_DelCallback( pInput, "can-record", onGenericCallback, this );
vlc_object_release( pInput );
pInput = getIntf()->p_sys->p_input = NULL;
}
......@@ -517,6 +523,7 @@ void VlcProc::on_item_current_changed( vlc_object_t* p_obj, vlc_value_t newVal )
var_AddCallback( pInput, "intf-event", onGenericCallback, this );
var_AddCallback( pInput, "bit-rate", onGenericCallback, this );
var_AddCallback( pInput, "sample-rate", onGenericCallback, this );
var_AddCallback( pInput, "can-record", onGenericCallback, this );
getIntf()->p_sys->p_input = pInput;
}
......@@ -638,6 +645,14 @@ void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
break;
}
case INPUT_EVENT_RECORD:
{
VarBoolImpl *pVarRecording =
(VarBoolImpl*)m_cVarRecording.get();
pVarRecording->set( var_GetBool( pInput, "record" ) );
break;
}
INPUT_EVENT_DEAD:
INPUT_EVENT_ABORT:
{
......@@ -647,6 +662,8 @@ void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
onGenericCallback, this );
var_DelCallback( pInput, "sample-rate",
onGenericCallback, this );
var_DelCallback( pInput, "can-record" ,
onGenericCallback, this );
vlc_object_release( pInput );
getIntf()->p_sys->p_input = NULL;
break;
......@@ -690,6 +707,14 @@ void VlcProc::on_sample_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal )
pSampleRate->set( UString::fromInt( getIntf(), sampleRate ) );
}
void VlcProc::on_can_record_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
input_thread_t* pInput = (input_thread_t*) p_obj;
VarBoolImpl *pVarRecordable = (VarBoolImpl*)m_cVarRecordable.get();
pVarRecordable->set( var_GetBool( pInput, "can-record" ) );
}
void VlcProc::on_random_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
playlist_t* pPlaylist = (playlist_t*) p_obj;
......
......@@ -91,6 +91,7 @@ class VlcProc: public SkinObject
void on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_bit_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_sample_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_can_record_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_random_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_loop_changed( vlc_object_t* p_obj, vlc_value_t newVal );
......@@ -128,6 +129,8 @@ class VlcProc: public SkinObject
VariablePtr m_cVarStopped;
VariablePtr m_cVarPaused;
VariablePtr m_cVarSeekable;
VariablePtr m_cVarRecordable;
VariablePtr m_cVarRecording;
/// Variables related to the vout
VariablePtr m_cVarFullscreen;
VarBox m_varVoutSize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment