[vlc-commits] lua: Propagate meta_changed events.

Hugo Beauzée-Luyssen git at videolan.org
Sat Jul 9 17:09:11 CEST 2011


vlc/vlc-1.1 | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Jul  8 15:55:28 2011 +0200| [436d36ccdb6c3658eab34697ec8a3805ef243cbc] | committer: Jean-Baptiste Kempf

lua: Propagate meta_changed events.

Fixes #5026

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 006127ff5a7121e3faebf0d947f570713718ea9c)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=436d36ccdb6c3658eab34697ec8a3805ef243cbc
---

 include/vlc_extensions.h               |    9 ++++++++-
 modules/gui/qt4/extensions_manager.cpp |   20 ++++++++++++++++++++
 modules/gui/qt4/extensions_manager.hpp |    1 +
 modules/misc/lua/extension.c           |    7 +++++++
 4 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/include/vlc_extensions.h b/include/vlc_extensions.h
index a1325b5..fa193a0 100644
--- a/include/vlc_extensions.h
+++ b/include/vlc_extensions.h
@@ -74,8 +74,9 @@ enum
     EXTENSION_TRIGGER_ONLY,   /**< arg1: extension_t*, arg2: bool* */
     EXTENSION_TRIGGER,        /**< arg1: extension_t* */
     EXTENSION_TRIGGER_MENU,   /**< arg1: extension_t*, int (uint16_t) */
-    EXTENSION_SET_INPUT,      /**< arg1: extension_t*, arg2 (input_thread_t) */
+    EXTENSION_SET_INPUT,      /**< arg1: extension_t*, arg2 (input_thread_t*) */
     EXTENSION_PLAYING_CHANGED, /**< arg1: extension_t*, arg2 int( playing status ) */
+    EXTENSION_META_CHANGED,   /**< arg1: extension_t*, arg2 (input_item_t*) */
 };
 
 /**
@@ -161,6 +162,12 @@ static inline int extension_PlayingChanged( extensions_manager_t *p_mgr,
     return extension_Control( p_mgr, EXTENSION_PLAYING_CHANGED, p_ext, state );
 }
 
+static inline int extension_MetaChanged( extensions_manager_t *p_mgr,
+                                         extension_t *p_ext )
+{
+    return extension_Control( p_mgr, EXTENSION_META_CHANGED, p_ext );
+}
+
 /** Can this extension only be triggered but not activated?
     Not compatible with HasMenu */
 #define extension_TriggerOnly( mgr, ext ) \
diff --git a/modules/gui/qt4/extensions_manager.cpp b/modules/gui/qt4/extensions_manager.cpp
index 35589c8..8499b72 100644
--- a/modules/gui/qt4/extensions_manager.cpp
+++ b/modules/gui/qt4/extensions_manager.cpp
@@ -50,6 +50,8 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent )
     CONNECT( THEMIM->getIM(), statusChanged( int ), this, playingChanged( int ) );
     DCONNECT( THEMIM, inputChanged( input_thread_t* ),
               this, inputChanged( input_thread_t* ) );
+    CONNECT( THEMIM->getIM(), metaChanged( input_item_t* ),
+             this, metaChanged( input_item_t* ) );
     b_unloading = false;
     b_failed = false;
 }
@@ -297,3 +299,21 @@ void ExtensionsManager::playingChanged( int state )
 
     vlc_mutex_unlock( &p_extensions_manager->lock );
 }
+
+void ExtensionsManager::metaChanged( input_item_t* )
+{
+    //This is unlikely, but can happen if no extension modules can be loaded.
+    if ( p_extensions_manager == NULL )
+        return ;
+    vlc_mutex_lock( &p_extensions_manager->lock );
+    extension_t *p_ext;
+    FOREACH_ARRAY( p_ext, p_extensions_manager->extensions )
+    {
+        if( extension_IsActivated( p_extensions_manager, p_ext ) )
+        {
+            extension_MetaChanged( p_extensions_manager, p_ext );
+        }
+    }
+    FOREACH_END()
+    vlc_mutex_unlock( &p_extensions_manager->lock );
+}
diff --git a/modules/gui/qt4/extensions_manager.hpp b/modules/gui/qt4/extensions_manager.hpp
index 17f5af9..a2b38f7 100644
--- a/modules/gui/qt4/extensions_manager.hpp
+++ b/modules/gui/qt4/extensions_manager.hpp
@@ -80,6 +80,7 @@ private slots:
     void triggerMenu( int id );
     void inputChanged( input_thread_t *p_input );
     void playingChanged( int );
+    void metaChanged( input_item_t *p_input );
 
 private:
     static ExtensionsManager* instance;
diff --git a/modules/misc/lua/extension.c b/modules/misc/lua/extension.c
index 928eebf..bd9375a 100644
--- a/modules/misc/lua/extension.c
+++ b/modules/misc/lua/extension.c
@@ -558,6 +558,13 @@ static int Control( extensions_manager_t *p_mgr, int i_control, va_list args )
             }
             break;
         }
+        case EXTENSION_META_CHANGED:
+        {
+            extension_t *p_ext;
+            p_ext = ( extension_t* ) va_arg( args, extension_t* );
+            PushCommand( p_ext, CMD_UPDATE_META );
+            break;
+        }
         default:
             msg_Warn( p_mgr, "Control '%d' not yet implemented in Extension",
                       i_control );



More information about the vlc-commits mailing list