Commit 436d36cc 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>
(cherry picked from commit 006127ff5a7121e3faebf0d947f570713718ea9c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7045ed74
......@@ -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 ) \
......
......@@ -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 );
}
......@@ -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;
......
......@@ -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 );
......
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