]> git.sesse.net Git - vlc/commitdiff
skins2: implement recording and next-frame
authorErwan Tulou <erwan10@videolan.org>
Sat, 5 Sep 2009 15:12:07 +0000 (17:12 +0200)
committerErwan Tulou <erwan10@videolan.org>
Sat, 5 Sep 2009 19:09:00 +0000 (21:09 +0200)
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)

modules/gui/skins2/commands/cmd_callbacks.hpp
modules/gui/skins2/commands/cmd_snapshot.cpp
modules/gui/skins2/commands/cmd_snapshot.hpp
modules/gui/skins2/parser/interpreter.cpp
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vlcproc.hpp

index 78e2514efaa86f9c7367697f59f9272d83c36523..521002fc89831dc67868fc14bfe74efe9f2e3157 100644 (file)
@@ -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 )
index bc2b0208688c388d71344ae338f463c72ff807fa..43724ebd22be5906352f518bc66bd7c03c1b036a 100644 (file)
@@ -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" );
+}
+
+
index e96e7c8e711bade473f823361cabec55d22329f0..c8c5cb43d5c1a73d0586b5a145ddd5fd4cfd01be 100644 (file)
@@ -29,5 +29,7 @@
 
 /// Command to snapshot VLC
 DEFINE_COMMAND(Snapshot, "snapshot" )
+DEFINE_COMMAND(ToggleRecord, "togglerecord" )
+DEFINE_COMMAND(NextFrame, "nextframe" )
 
 #endif
index 56c9f11a85eac6da4b17f7f3ba69ffe4af1eeea5..9d5dc5317f08408301949b8810762b11b66b4c6e 100644 (file)
@@ -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 ) );
index c65510f42671d8828f71f8fa4a3efa922ce75185..b0ebc145f23f32c56cd94aee8d6364489e752346 100644 (file)
@@ -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;
index 6aa7f31aa0c4a517fe052c64effccf158095d552..b4b97fbb9bb6a995faf0afd909655adcc4988734 100644 (file)
@@ -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;