[vlc-devel] commit: Added a ES_OUT_SET_META to es_out. (Laurent Aimar )
git version control
git at videolan.org
Fri Oct 23 23:14:54 CEST 2009
vlc | branch: 1.0-bugfix | Laurent Aimar <fenrir at videolan.org> | Sun Jul 19 18:06:55 2009 +0200| [fb3f3de5092b017bb02ae71572c2f4bf68d027e2] | committer: Laurent Aimar
Added a ES_OUT_SET_META to es_out.
It will allows to control the moment at which the meta are updated
to fix the delay introduced by timeshift and buffering.
It will also simplify the way meta data are read by demuxers.
(cherry picked from commit ae780fe9874757c9c06c443e04ce613d875ab5ca)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fb3f3de5092b017bb02ae71572c2f4bf68d027e2
---
include/vlc_es_out.h | 8 +++++
src/input/es_out.c | 60 ++++++++++++++++++++++++++++++++++++++++++
src/input/es_out_timeshift.c | 11 ++++++-
src/input/input.c | 48 +--------------------------------
4 files changed, 78 insertions(+), 49 deletions(-)
diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index 043e557..fdde1c9 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -90,6 +90,9 @@ enum es_out_query_e
* XXX You SHALL call ES_OUT_RESET_PCR before any other es_out_Control/Send calls. */
ES_OUT_GET_EMPTY, /* arg1=bool* res=cannot fail */
+ /* Set global meta data (The vlc_meta_t is not modified nor released) */
+ ES_OUT_SET_META, /* arg1=const vlc_meta_t * */
+
/* First value usable for private control */
ES_OUT_PRIVATE_START = 0x10000,
};
@@ -145,6 +148,11 @@ static inline void es_out_Delete( es_out_t *p_out )
p_out->pf_destroy( p_out );
}
+static inline int es_out_ControlSetMeta( es_out_t *out, const vlc_meta_t *p_meta )
+{
+ return es_out_Control( out, ES_OUT_SET_META, p_meta );
+}
+
/**
* @}
*/
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 21865fa..6f12b18 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1385,6 +1385,58 @@ static void EsOutProgramUpdateScrambled( es_out_t *p_out, es_out_pgrm_t *p_pgrm
input_SendEventProgramScrambled( p_input, p_pgrm->i_id, b_scrambled );
}
+static void EsOutMeta( es_out_t *p_out, const vlc_meta_t *p_meta )
+{
+ es_out_sys_t *p_sys = p_out->p_sys;
+ input_thread_t *p_input = p_sys->p_input;
+
+ input_item_t *p_item = input_GetItem( p_input );
+
+ char *psz_title = NULL;
+ char *psz_arturl = input_item_GetArtURL( p_item );
+
+ vlc_mutex_lock( &p_item->lock );
+
+ if( vlc_meta_Get( p_meta, vlc_meta_Title ) && !p_item->b_fixed_name )
+ psz_title = strdup( vlc_meta_Get( p_meta, vlc_meta_Title ) );
+
+ vlc_meta_Merge( p_item->p_meta, p_meta );
+
+ if( !psz_arturl || *psz_arturl == '\0' )
+ {
+ const char *psz_tmp = vlc_meta_Get( p_item->p_meta, vlc_meta_ArtworkURL );
+ if( psz_tmp )
+ psz_arturl = strdup( psz_tmp );
+ }
+ vlc_mutex_unlock( &p_item->lock );
+
+ if( psz_arturl && *psz_arturl )
+ {
+ input_item_SetArtURL( p_item, psz_arturl );
+
+ if( !strncmp( psz_arturl, "attachment://", strlen("attachment") ) )
+ {
+ /* Don't look for art cover if sout
+ * XXX It can change when sout has meta data support */
+ if( p_out->b_sout && !p_input->b_preparsing )
+ input_item_SetArtURL( p_item, "" );
+ else
+ input_ExtractAttachmentAndCacheArt( p_input );
+ }
+ }
+ free( psz_arturl );
+
+ if( psz_title )
+ {
+ input_item_SetName( p_item, psz_title );
+ free( psz_title );
+ }
+ input_item_SetPreparsed( p_item, true );
+
+ input_SendEventMeta( p_input );
+ /* TODO handle sout meta ? */
+}
+
/* EsOutAdd:
* Add an es_out
*/
@@ -2415,6 +2467,14 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
return EsOutProgramDel( out, i_group );
}
+ case ES_OUT_SET_META:
+ {
+ const vlc_meta_t *p_meta = va_arg( args, const vlc_meta_t * );
+
+ EsOutMeta( out, p_meta );
+ return VLC_SUCCESS;
+ }
+
case ES_OUT_GET_WAKE_UP:
{
mtime_t *pi_wakeup = (mtime_t*)va_arg( args, mtime_t* );
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index a48d365..19f4d21 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -599,6 +599,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
case ES_OUT_SET_GROUP_EPG:
case ES_OUT_SET_ES_SCRAMBLED_STATE:
case ES_OUT_DEL_GROUP:
+ case ES_OUT_SET_META:
case ES_OUT_SET_ES:
case ES_OUT_RESTART_ES:
case ES_OUT_SET_ES_DEFAULT:
@@ -1315,9 +1316,11 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
case ES_OUT_RESET_PCR: /* no arg */
break;
+ case ES_OUT_SET_META: /* arg1=const vlc_meta_t* */
case ES_OUT_SET_GROUP_META: /* arg1=int i_group arg2=vlc_meta_t* */
{
- p_cmd->control.int_meta.i_int = (int)va_arg( args, int );
+ if( i_query == ES_OUT_SET_GROUP_META )
+ p_cmd->control.int_meta.i_int = (int)va_arg( args, int );
vlc_meta_t *p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t * );
if( b_copy )
@@ -1459,6 +1462,9 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
return es_out_Control( p_out, i_query, p_cmd->control.es_bool.p_es->p_es,
p_cmd->control.es_bool.b_bool );
+ case ES_OUT_SET_META: /* arg1=const vlc_meta_t* */
+ return es_out_Control( p_out, i_query, p_cmd->control.int_meta.p_meta );
+
/* Modified control */
case ES_OUT_SET_ES: /* arg1= es_out_id_t* */
case ES_OUT_RESTART_ES: /* arg1= es_out_id_t* */
@@ -1488,7 +1494,8 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
}
static void CmdCleanControl( ts_cmd_t *p_cmd )
{
- if( p_cmd->control.i_query == ES_OUT_SET_GROUP_META &&
+ if( ( p_cmd->control.i_query == ES_OUT_SET_GROUP_META ||
+ p_cmd->control.i_query == ES_OUT_SET_META ) &&
p_cmd->control.int_meta.p_meta )
{
vlc_meta_Delete( p_cmd->control.int_meta.p_meta );
diff --git a/src/input/input.c b/src/input/input.c
index 81759b1..d003625 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2881,54 +2881,8 @@ static void InputMetaUser( input_thread_t *p_input, vlc_meta_t *p_meta )
*****************************************************************************/
static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
{
- input_item_t *p_item = p_input->p->p_item;
-
- char *psz_title = NULL;
- char *psz_arturl = input_item_GetArtURL( p_item );
-
- vlc_mutex_lock( &p_item->lock );
-
- if( vlc_meta_Get( p_meta, vlc_meta_Title ) && !p_item->b_fixed_name )
- psz_title = strdup( vlc_meta_Get( p_meta, vlc_meta_Title ) );
-
- vlc_meta_Merge( p_item->p_meta, p_meta );
-
+ es_out_ControlSetMeta( p_input->p->p_es_out, p_meta );
vlc_meta_Delete( p_meta );
-
- if( !psz_arturl || *psz_arturl == '\0' )
- {
- const char *psz_tmp = vlc_meta_Get( p_item->p_meta, vlc_meta_ArtworkURL );
- if( psz_tmp )
- psz_arturl = strdup( psz_tmp );
- }
- vlc_mutex_unlock( &p_item->lock );
-
- if( psz_arturl && *psz_arturl )
- {
- input_item_SetArtURL( p_item, psz_arturl );
-
- if( !strncmp( psz_arturl, "attachment://", strlen("attachment") ) )
- {
- /* Don't look for art cover if sout
- * XXX It can change when sout has meta data support */
- if( p_input->p->p_sout && !p_input->b_preparsing )
- input_item_SetArtURL( p_item, "" );
- else
- input_ExtractAttachmentAndCacheArt( p_input );
- }
- }
- free( psz_arturl );
-
- if( psz_title )
- {
- input_item_SetName( p_item, psz_title );
- free( psz_title );
- }
- input_item_SetPreparsed( p_item, true );
-
- input_SendEventMeta( p_input );
-
- /** \todo handle sout meta */
}
static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_attachment,
More information about the vlc-devel
mailing list