[vlc-devel] [PATCH 2/2] http: use the i_update flag to request a meta update (fixes #9960 #11796 #12850)
Ludovic Fauvet
etix at videolan.org
Fri Nov 28 16:20:04 CET 2014
---
modules/access/http.c | 43 +++++++++++++++++++------------------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/modules/access/http.c b/modules/access/http.c
index 6148b95..b627d8f 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -169,6 +169,7 @@ struct access_sys_t
bool b_chunked;
int64_t i_chunk;
+ vlc_meta_t *p_meta;
int i_icy_meta;
uint64_t i_icy_offset;
char *psz_icy_name;
@@ -276,6 +277,7 @@ static int OpenRedirected( vlc_object_t *p_this, const char *psz_access,
p_sys->size = 0;
p_access->info.i_pos = 0;
p_access->info.b_eof = false;
+ p_sys->p_meta = vlc_meta_New();
/* Only forward an store cookies if the corresponding option is activated */
if( var_CreateGetBool( p_access, "http-forward-cookies" ) )
@@ -619,6 +621,7 @@ static void Close( vlc_object_t *p_this )
free( p_sys->psz_pragma );
free( p_sys->psz_location );
+ vlc_meta_Delete( p_sys->p_meta );
free( p_sys->psz_icy_name );
free( p_sys->psz_icy_genre );
free( p_sys->psz_icy_title );
@@ -850,14 +853,8 @@ static int ReadICYMeta( access_t *p_access )
free( psz_tmp );
msg_Dbg( p_access, "New Icy-Title=%s", p_sys->psz_icy_title );
- input_thread_t *p_input = access_GetParentInput( p_access );
- if( p_input )
- {
- input_item_t *p_input_item = input_GetItem( p_access->p_input );
- if( p_input_item )
- input_item_SetMeta( p_input_item, vlc_meta_NowPlaying, p_sys->psz_icy_title );
- vlc_object_release( p_input );
- }
+ vlc_meta_SetNowPlaying( p_sys->p_meta, p_sys->psz_icy_title );
+ p_access->info.i_update |= ACCESS_UPDATE_META;
}
}
free( psz_meta );
@@ -940,6 +937,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
access_sys_t *p_sys = p_access->p_sys;
bool *pb_bool;
int64_t *pi_64;
+ vlc_meta_t *p_meta;
switch( i_query )
{
@@ -984,6 +982,11 @@ static int Control( access_t *p_access, int i_query, va_list args )
p_sys->psz_mime ? strdup( p_sys->psz_mime ) : NULL;
break;
+ case ACCESS_GET_META:
+ p_meta = va_arg( args, vlc_meta_t* );
+ vlc_meta_Merge( p_meta, p_sys->p_meta );
+ break;
+
default:
return VLC_EGENERIC;
@@ -1008,6 +1011,10 @@ static int Connect( access_t *p_access, uint64_t i_tell )
free( p_sys->psz_icy_name );
free( p_sys->psz_icy_title );
+ vlc_meta_SetNowPlaying( p_sys->p_meta, NULL );
+ vlc_meta_SetTitle( p_sys->p_meta, NULL );
+ vlc_meta_SetGenre( p_sys->p_meta, NULL );
+ p_access->info.i_update |= ACCESS_UPDATE_META;
p_sys->psz_location = NULL;
p_sys->psz_mime = NULL;
@@ -1426,14 +1433,8 @@ static int Request( access_t *p_access, uint64_t i_tell )
if( !p_sys->psz_icy_name )
free( psz_tmp );
msg_Dbg( p_access, "Icy-Name: %s", p_sys->psz_icy_name );
- input_thread_t *p_input = access_GetParentInput( p_access );
- if ( p_input )
- {
- input_item_t *p_input_item = input_GetItem( p_access->p_input );
- if ( p_input_item )
- input_item_SetMeta( p_input_item, vlc_meta_Title, p_sys->psz_icy_name );
- vlc_object_release( p_input );
- }
+ vlc_meta_SetTitle( p_sys->p_meta, p_sys->psz_icy_name );
+ p_access->info.i_update |= ACCESS_UPDATE_META;
p_sys->b_icecast = true; /* be on the safeside. set it here as well. */
p_sys->b_reconnect = true;
@@ -1447,14 +1448,8 @@ static int Request( access_t *p_access, uint64_t i_tell )
if( !p_sys->psz_icy_genre )
free( psz_tmp );
msg_Dbg( p_access, "Icy-Genre: %s", p_sys->psz_icy_genre );
- input_thread_t *p_input = access_GetParentInput( p_access );
- if( p_input )
- {
- input_item_t *p_input_item = input_GetItem( p_access->p_input );
- if( p_input_item )
- input_item_SetMeta( p_input_item, vlc_meta_Genre, p_sys->psz_icy_genre );
- vlc_object_release( p_input );
- }
+ vlc_meta_SetGenre( p_sys->p_meta, p_sys->psz_icy_genre );
+ p_access->info.i_update |= ACCESS_UPDATE_META;
}
else if( !strncasecmp( psz, "Icy-Notice", 10 ) )
{
--
2.1.3
More information about the vlc-devel
mailing list