[vlc-commits] lua: Propagate meta_changed events.

Hugo Beauzée-Luyssen git at videolan.org
Fri Jul 8 16:34:49 CEST 2011


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

lua: Propagate meta_changed events.

Fixes #5026

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

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

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

diff --git a/include/vlc_extensions.h b/include/vlc_extensions.h
index 8fc9987..3bc4f44 100644
--- a/include/vlc_extensions.h
+++ b/include/vlc_extensions.h
@@ -76,8 +76,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*) */
 };
 
 /**
@@ -163,6 +164,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 0b6f057..29538dc 100644
--- a/modules/gui/qt4/extensions_manager.cpp
+++ b/modules/gui/qt4/extensions_manager.cpp
@@ -51,6 +51,8 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent )
     CONNECT( THEMIM->getIM(), playingStatusChanged( 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/lua/extension.c b/modules/lua/extension.c
index 25b6c34..5281f58 100644
--- a/modules/lua/extension.c
+++ b/modules/lua/extension.c
@@ -622,6 +622,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