[vlc-commits] skins: add input/vout/aout callback classes

Rémi Denis-Courmont git at videolan.org
Fri Mar 15 02:28:19 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Mar 15 02:28:44 2019 +0200| [980ec111de9e5ce93c20d1b6a65f1d91713bfee1] | committer: Rémi Denis-Courmont

skins: add input/vout/aout callback classes

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=980ec111de9e5ce93c20d1b6a65f1d91713bfee1
---

 modules/gui/skins2/commands/cmd_callbacks.hpp | 72 +++++++++++++++++++++++++++
 modules/gui/skins2/src/vlcproc.cpp            | 15 +++---
 2 files changed, 81 insertions(+), 6 deletions(-)

diff --git a/modules/gui/skins2/commands/cmd_callbacks.hpp b/modules/gui/skins2/commands/cmd_callbacks.hpp
index bdcad233c5..8598ea7fc7 100644
--- a/modules/gui/skins2/commands/cmd_callbacks.hpp
+++ b/modules/gui/skins2/commands/cmd_callbacks.hpp
@@ -61,6 +61,78 @@ private:
     void (VlcProc::*m_pfExecute)(vlc_object_t *,vlc_value_t);
 };
 
+class CmdInputCallback : public CmdCallback
+{
+public:
+    CmdInputCallback( intf_thread_t *pIntf, input_thread_t *pInput,
+                      vlc_value_t newVal,
+                      void (VlcProc::*func)(vlc_object_t *,vlc_value_t),
+                      std::string label )
+        : CmdCallback( pIntf, VLC_OBJECT(pInput), newVal, func, label ),
+          m_pInput( pInput )
+    {
+        if( m_pInput )
+            input_Hold( m_pInput );
+    }
+
+    virtual ~CmdInputCallback()
+    {
+        if( m_pInput )
+            input_Release( m_pInput );
+    }
+
+private:
+    input_thread_t *m_pInput;
+};
+
+class CmdVoutCallback : public CmdCallback
+{
+public:
+    CmdVoutCallback( intf_thread_t *pIntf, vout_thread_t *pVout,
+                     vlc_value_t newVal,
+                     void (VlcProc::*func)(vlc_object_t *,vlc_value_t),
+                     std::string label )
+        : CmdCallback( pIntf, VLC_OBJECT(pVout), newVal, func, label ),
+          m_pVout( pVout )
+    {
+        if( m_pVout )
+            vout_Hold( m_pVout );
+    }
+
+    virtual ~CmdVoutCallback()
+    {
+        if( m_pVout )
+            vout_Release( m_pVout );
+    }
+
+private:
+    vout_thread_t *m_pVout;
+};
+
+class CmdAoutCallback : public CmdCallback
+{
+public:
+    CmdAoutCallback( intf_thread_t *pIntf, audio_output_t *pAout,
+                     vlc_value_t newVal,
+                     void (VlcProc::*func)(vlc_object_t *,vlc_value_t),
+                     std::string label )
+        : CmdCallback( pIntf, VLC_OBJECT(pAout), newVal, func, label ),
+          m_pAout( pAout )
+    {
+        if( m_pAout )
+            aout_Hold( m_pAout );
+    }
+
+    virtual ~CmdAoutCallback()
+    {
+        if( m_pAout )
+            aout_Release( m_pAout );
+    }
+
+private:
+    audio_output_t *m_pAout;
+};
+
 
 class CmdExecuteBlock : public CmdGeneric
 {
diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index 76b735dce9..360ae91f12 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -366,6 +366,7 @@ int VlcProc::onInputCallback( vlc_object_t *pObj, const char *pVariable,
                               void *pParam )
 {
     (void)oldVal;
+    input_thread_t *pInput = (input_thread_t *)pObj;
     VlcProc *pThis = (VlcProc*)pParam;
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
     std::string label = pVariable;
@@ -376,8 +377,8 @@ int VlcProc::onInputCallback( vlc_object_t *pObj, const char *pVariable,
     ADD_CALLBACK_ENTRY( "can-record", on_can_record_changed, false )
         vlc_assert_unreachable();
 
-    CmdGeneric *pCmd = new CmdCallback( pThis->getIntf(), pObj, newVal, cb,
-                                        label );
+    CmdGeneric *pCmd = new CmdInputCallback( pThis->getIntf(), pInput, newVal,
+                                             cb, label );
     if( pCmd )
         pQueue->push( CmdGenericPtr( pCmd ), remove );
 
@@ -389,6 +390,7 @@ int VlcProc::onVoutCallback( vlc_object_t *pObj, const char *pVariable,
                                 void *pParam )
 {
     (void)oldVal;
+    vout_thread_t *pVout = (vout_thread_t *)pObj;
     VlcProc *pThis = (VlcProc*)pParam;
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
     std::string label = pVariable;
@@ -397,8 +399,8 @@ int VlcProc::onVoutCallback( vlc_object_t *pObj, const char *pVariable,
     ADD_CALLBACK_ENTRY( "mouse-moved", on_mouse_moved_changed, false )
         vlc_assert_unreachable();
 
-    CmdGeneric *pCmd = new CmdCallback( pThis->getIntf(), pObj, newVal, cb,
-                                        label );
+    CmdGeneric *pCmd = new CmdVoutCallback( pThis->getIntf(), pVout, newVal,
+                                            cb, label );
     if( pCmd )
         pQueue->push( CmdGenericPtr( pCmd ), remove );
 
@@ -410,6 +412,7 @@ int VlcProc::onAoutCallback( vlc_object_t *pObj, const char *pVariable,
                                 void *pParam )
 {
     (void)oldVal;
+    audio_output_t *pAout = (audio_output_t *)pObj;
     VlcProc *pThis = (VlcProc*)pParam;
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
     std::string label = pVariable;
@@ -418,8 +421,8 @@ int VlcProc::onAoutCallback( vlc_object_t *pObj, const char *pVariable,
     ADD_CALLBACK_ENTRY( "audio-filter", on_audio_filter_changed, false )
         vlc_assert_unreachable();
 
-    CmdGeneric *pCmd = new CmdCallback( pThis->getIntf(), pObj, newVal, cb,
-                                        label );
+    CmdGeneric *pCmd = new CmdAoutCallback( pThis->getIntf(), pAout, newVal,
+                                            cb, label );
     if( pCmd )
         pQueue->push( CmdGenericPtr( pCmd ), remove );
 



More information about the vlc-commits mailing list