Commit 006127ff authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

lua: Propagate meta_changed events.

Fixes #5026
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent d8a7e2d1
...@@ -76,8 +76,9 @@ enum ...@@ -76,8 +76,9 @@ enum
EXTENSION_TRIGGER_ONLY, /**< arg1: extension_t*, arg2: bool* */ EXTENSION_TRIGGER_ONLY, /**< arg1: extension_t*, arg2: bool* */
EXTENSION_TRIGGER, /**< arg1: extension_t* */ EXTENSION_TRIGGER, /**< arg1: extension_t* */
EXTENSION_TRIGGER_MENU, /**< arg1: extension_t*, int (uint16_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_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, ...@@ -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 ); 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? /** Can this extension only be triggered but not activated?
Not compatible with HasMenu */ Not compatible with HasMenu */
#define extension_TriggerOnly( mgr, ext ) \ #define extension_TriggerOnly( mgr, ext ) \
......
...@@ -51,6 +51,8 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent ) ...@@ -51,6 +51,8 @@ ExtensionsManager::ExtensionsManager( intf_thread_t *_p_intf, QObject *parent )
CONNECT( THEMIM->getIM(), playingStatusChanged( int ), this, playingChanged( int ) ); CONNECT( THEMIM->getIM(), playingStatusChanged( int ), this, playingChanged( int ) );
DCONNECT( THEMIM, inputChanged( input_thread_t* ), DCONNECT( THEMIM, inputChanged( input_thread_t* ),
this, 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_unloading = false;
b_failed = false; b_failed = false;
} }
...@@ -297,3 +299,21 @@ void ExtensionsManager::playingChanged( int state ) ...@@ -297,3 +299,21 @@ void ExtensionsManager::playingChanged( int state )
vlc_mutex_unlock( &p_extensions_manager->lock ); 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 );
}
...@@ -80,6 +80,7 @@ private slots: ...@@ -80,6 +80,7 @@ private slots:
void triggerMenu( int id ); void triggerMenu( int id );
void inputChanged( input_thread_t *p_input ); void inputChanged( input_thread_t *p_input );
void playingChanged( int ); void playingChanged( int );
void metaChanged( input_item_t *p_input );
private: private:
static ExtensionsManager* instance; static ExtensionsManager* instance;
......
...@@ -622,6 +622,13 @@ static int Control( extensions_manager_t *p_mgr, int i_control, va_list args ) ...@@ -622,6 +622,13 @@ static int Control( extensions_manager_t *p_mgr, int i_control, va_list args )
} }
break; 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: default:
msg_Warn( p_mgr, "Control '%d' not yet implemented in Extension", msg_Warn( p_mgr, "Control '%d' not yet implemented in Extension",
i_control ); i_control );
......
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