[vlc-devel] [PATCH] Changes to libvlc required for plugin API improvement (input.meta method)
JM Lambert
jeanmichel.lambert7 at gmail.com
Thu Dec 22 09:40:53 CET 2011
---
include/vlc/libvlc_media_player.h | 8 ++++++++
include/vlc_input.h | 2 ++
lib/libvlc.sym | 1 +
lib/media_player.c | 19 +++++++++++++++++++
src/input/control.c | 12 ++++++++++++
5 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 152a95d..d361ce2 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -756,6 +756,14 @@ LIBVLC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float
LIBVLC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
/**
+ * Get media meta
+ *
+ * \param p_mi the Media Player
+ * \return ith elemet of meta structure
+ */
+LIBVLC_API char* libvlc_media_player_get_meta( libvlc_media_player_t *p_mi, int i);
+
+/**
* Get movie fps rate
*
* \param p_mi the Media Player
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 7d8320a..accb384 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -516,6 +516,8 @@ enum input_query_e
/* External clock managments */
INPUT_GET_PCR_SYSTEM, /* arg1=mtime_t *, arg2=mtime_t * res=can fail */
INPUT_MODIFY_PCR_SYSTEM,/* arg1=int absolute, arg2=mtime_t res=can fail */
+ INPUT_GET_META,/* arg1=vlc_meta_t * res=can fail */
+
};
/** @}*/
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 45327d5..2607f99 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -120,6 +120,7 @@ libvlc_media_player_get_agl
libvlc_media_player_get_chapter
libvlc_media_player_get_chapter_count
libvlc_media_player_get_chapter_count_for_title
+libvlc_media_player_get_meta
libvlc_media_player_get_fps
libvlc_media_player_get_hwnd
libvlc_media_player_get_length
diff --git a/lib/media_player.c b/lib/media_player.c
index b426637..1978e72 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1217,6 +1217,25 @@ void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi )
vlc_object_release( p_input_thread );
}
+char * libvlc_media_player_get_meta( libvlc_media_player_t *p_mi , int index)
+{
+ input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
+ vlc_meta_t *p_meta;
+
+ if( p_input_thread )
+ {
+ if( input_Control( p_input_thread, INPUT_GET_META, &p_meta ) )
+ vlc_meta_Set( p_meta, vlc_meta_Title, "unknown" );
+ vlc_object_release( p_input_thread );
+ if (vlc_meta_Get(p_meta,index)) return vlc_meta_Get(p_meta,index);
+ else return "";
+ }
+ else
+ {
+ return "";
+ }
+}
+
float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi )
{
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
diff --git a/src/input/control.c b/src/input/control.c
index d50ea97..4e95661 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -65,6 +65,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
seekpoint_t *p_bkmk, ***ppp_bkmk;
int i_bkmk = 0;
int *pi_bkmk;
+ vlc_meta_t ** p_meta;
+
int i_int, *pi_int;
bool b_bool, *pb_bool;
@@ -357,6 +359,16 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_SUCCESS;
+ case INPUT_GET_META:
+ p_meta = (vlc_meta_t **)va_arg( args, vlc_meta_t ** );
+
+ vlc_mutex_lock( &p_input->p->p_item->lock );
+ input_item_t *p_item = input_GetItem( p_input );
+ *p_meta = p_item->p_meta;
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
+ return VLC_SUCCESS;
+
+
case INPUT_ADD_SLAVE:
psz = (char*)va_arg( args, char * );
if( psz && *psz )
--
1.7.5.4
More information about the vlc-devel
mailing list