[vlc-commits] extensions: extension_SetInput: use input_item_t
Thomas Guillem
git at videolan.org
Mon Jun 3 16:16:37 CEST 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri May 31 15:13:55 2019 +0200| [1cd778c1824c3500cd9b1ec14bc86fa6b8ce7155] | committer: Thomas Guillem
extensions: extension_SetInput: use input_item_t
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1cd778c1824c3500cd9b1ec14bc86fa6b8ce7155
---
include/vlc_extensions.h | 8 ++++----
modules/lua/extension.c | 32 +++++++++++++-------------------
modules/lua/extension.h | 4 ++--
3 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/include/vlc_extensions.h b/include/vlc_extensions.h
index 28937fc595..94af501728 100644
--- a/include/vlc_extensions.h
+++ b/include/vlc_extensions.h
@@ -75,7 +75,7 @@ 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_item_t*) */
EXTENSION_PLAYING_CHANGED, /**< arg1: extension_t*, arg2 int( playing status ) */
EXTENSION_META_CHANGED, /**< arg1: extension_t*, arg2 (input_item_t*) */
};
@@ -149,11 +149,11 @@ static inline int extension_TriggerMenu( extensions_manager_t *p_mgr,
}
/** Trigger an entry of the extension menu */
+/* TODO: use player */
static inline int extension_SetInput( extensions_manager_t *p_mgr,
- extension_t *p_ext,
- struct input_thread_t *p_input )
+ extension_t *p_ext, input_item_t *p_item )
{
- return extension_Control( p_mgr, EXTENSION_SET_INPUT, p_ext, p_input );
+ return extension_Control( p_mgr, EXTENSION_SET_INPUT, p_ext, p_item );
}
static inline int extension_PlayingChanged( extensions_manager_t *p_mgr,
diff --git a/modules/lua/extension.c b/modules/lua/extension.c
index 37e6073407..5ff93d142d 100644
--- a/modules/lua/extension.c
+++ b/modules/lua/extension.c
@@ -562,7 +562,7 @@ static int Control( extensions_manager_t *p_mgr, int i_control, va_list args )
case EXTENSION_SET_INPUT:
{
p_ext = va_arg( args, extension_t* );
- input_thread_t *p_input = va_arg( args, struct input_thread_t * );
+ input_item_t *p_item = va_arg( args, struct input_item_t * );
if( p_ext == NULL )
return VLC_EGENERIC;
@@ -577,24 +577,21 @@ static int Control( extensions_manager_t *p_mgr, int i_control, va_list args )
vlc_mutex_lock( &p_ext->p_sys->running_lock );
// Change input
- input_thread_t *old = p_ext->p_sys->p_input;
- input_item_t *p_item;
+ input_item_t *old = p_ext->p_sys->p_item;
if( old )
{
// Untrack meta fetched events
if( p_ext->p_sys->i_capabilities & EXT_META_LISTENER )
{
- p_item = input_GetItem( old );
- vlc_event_detach( &p_item->event_manager,
+ vlc_event_detach( &old->event_manager,
vlc_InputItemMetaChanged,
inputItemMetaChanged,
p_ext );
- input_item_Release( p_item );
}
- input_Release(old);
+ input_item_Release( old );
}
- p_ext->p_sys->p_input = p_input ? input_Hold(p_input) : NULL;
+ p_ext->p_sys->p_item = p_item ? input_item_Hold(p_item) : NULL;
// Tell the script the input changed
if( p_ext->p_sys->i_capabilities & EXT_INPUT_LISTENER )
@@ -603,11 +600,9 @@ static int Control( extensions_manager_t *p_mgr, int i_control, va_list args )
}
// Track meta fetched events
- if( p_ext->p_sys->p_input &&
+ if( p_ext->p_sys->p_item &&
p_ext->p_sys->i_capabilities & EXT_META_LISTENER )
{
- p_item = input_GetItem( p_ext->p_sys->p_input );
- input_item_Hold( p_item );
vlc_event_attach( &p_item->event_manager,
vlc_InputItemMetaChanged,
inputItemMetaChanged,
@@ -659,16 +654,15 @@ int lua_ExtensionDeactivate( extensions_manager_t *p_mgr, extension_t *p_ext )
vlclua_fd_interrupt( &p_ext->p_sys->dtable );
// Unset and release input objects
- if( p_ext->p_sys->p_input )
+ if( p_ext->p_sys->p_item )
{
if( p_ext->p_sys->i_capabilities & EXT_META_LISTENER )
- {
- // Release item
- input_item_t *p_item = input_GetItem( p_ext->p_sys->p_input );
- input_item_Release( p_item );
- }
- input_Release(p_ext->p_sys->p_input);
- p_ext->p_sys->p_input = NULL;
+ vlc_event_detach( &p_ext->p_sys->p_item->event_manager,
+ vlc_InputItemMetaChanged,
+ inputItemMetaChanged,
+ p_ext );
+ input_item_Release(p_ext->p_sys->p_item);
+ p_ext->p_sys->p_item = NULL;
}
int i_ret = lua_ExecuteFunction( p_mgr, p_ext, "deactivate", LUA_END );
diff --git a/modules/lua/extension.h b/modules/lua/extension.h
index 8e0e64f1bd..68e81fe66f 100644
--- a/modules/lua/extension.h
+++ b/modules/lua/extension.h
@@ -66,9 +66,9 @@ struct extension_sys_t
vlc_mutex_t running_lock;
vlc_cond_t wait;
- /* The input this extension should use for vlc.input
+ /* The item this extension should use for vlc.input
* or NULL if it should use playlist's current input */
- struct input_thread_t *p_input;
+ struct input_item_t *p_item;
extensions_manager_t *p_mgr; ///< Parent
/* Queue of commands to execute */
More information about the vlc-commits
mailing list