X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Faccess%2Fhttp.c;h=eaa703576e80bbd98367181183fa4099465228db;hb=f2b2e37c04b2921e29daa3260dc696646ad4f10c;hp=87bd3a183544f14fd425e67c91df29195fec6bbd;hpb=b674dab81ccd2a089896b26a2afc258118e6a990;p=vlc diff --git a/modules/access/http.c b/modules/access/http.c index 87bd3a1835..eaa703576e 100644 --- a/modules/access/http.c +++ b/modules/access/http.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -184,6 +185,7 @@ struct access_sys_t int64_t i_chunk; int i_icy_meta; + int64_t i_icy_offset; char *psz_icy_name; char *psz_icy_genre; char *psz_icy_title; @@ -276,6 +278,7 @@ static int OpenWithCookies( vlc_object_t *p_this, vlc_array_t *cookies ) p_sys->p_tls = NULL; p_sys->p_vs = NULL; p_sys->i_icy_meta = 0; + p_sys->i_icy_offset = 0; p_sys->psz_icy_name = NULL; p_sys->psz_icy_genre = NULL; p_sys->psz_icy_title = NULL; @@ -415,7 +418,7 @@ connect: p_sys->i_version = 0; p_sys->b_seekable = false; - if( p_access->b_die || Connect( p_access, 0 ) ) + if( !vlc_object_alive (p_access) || Connect( p_access, 0 ) ) goto error; #ifndef NDEBUG @@ -697,10 +700,10 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) } - if( p_sys->i_icy_meta > 0 && p_access->info.i_pos > 0 ) + if( p_sys->i_icy_meta > 0 && p_access->info.i_pos-p_sys->i_icy_offset > 0 ) { int64_t i_next = p_sys->i_icy_meta - - p_access->info.i_pos % p_sys->i_icy_meta; + (p_access->info.i_pos - p_sys->i_icy_offset ) % p_sys->i_icy_meta; if( i_next == p_sys->i_icy_meta ) { @@ -826,7 +829,7 @@ static int ReadICYMeta( access_t *p_access ) strcmp( p_sys->psz_icy_title, &p[1] ) ) { free( p_sys->psz_icy_title ); - p_sys->psz_icy_title = strdup( &p[1] ); + p_sys->psz_icy_title = EnsureUTF8( strdup( &p[1] )); p_access->info.i_update |= INPUT_UPDATE_META; msg_Dbg( p_access, "New Title=%s", p_sys->psz_icy_title ); @@ -1005,6 +1008,7 @@ static int Connect( access_t *p_access, int64_t i_tell ) p_sys->b_chunked = false; p_sys->i_chunk = 0; p_sys->i_icy_meta = 0; + p_sys->i_icy_offset = i_tell; p_sys->psz_icy_name = NULL; p_sys->psz_icy_genre = NULL; p_sys->psz_icy_title = NULL; @@ -1079,7 +1083,7 @@ static int Connect( access_t *p_access, int64_t i_tell ) free( psz ); - if( p_access->b_die || p_access->b_error ) + if( !vlc_object_alive (p_access) || p_access->b_error ) { Disconnect( p_access ); return -1; @@ -1109,7 +1113,6 @@ static int Request( access_t *p_access, int64_t i_tell ) access_sys_t *p_sys = p_access->p_sys; char *psz ; v_socket_t *pvs = p_sys->p_vs; - bool b_connection_close = false; p_sys->b_persist = false; p_sys->i_remaining = 0; @@ -1265,7 +1268,7 @@ static int Request( access_t *p_access, int64_t i_tell ) goto error; } - if( p_access->b_die || p_access->b_error ) + if( !vlc_object_alive (p_access) || p_access->b_error ) { free( psz ); goto error; @@ -1411,7 +1414,7 @@ static int Request( access_t *p_access, int64_t i_tell ) else if( !strcasecmp( psz, "Icy-Name" ) ) { free( p_sys->psz_icy_name ); - p_sys->psz_icy_name = strdup( p ); + p_sys->psz_icy_name = EnsureUTF8( strdup( p )); msg_Dbg( p_access, "Icy-Name: %s", p_sys->psz_icy_name ); p_sys->b_icecast = true; /* be on the safeside. set it here as well. */ @@ -1421,7 +1424,7 @@ static int Request( access_t *p_access, int64_t i_tell ) else if( !strcasecmp( psz, "Icy-Genre" ) ) { free( p_sys->psz_icy_genre ); - p_sys->psz_icy_genre = strdup( p ); + p_sys->psz_icy_genre = EnsureUTF8( strdup( p )); msg_Dbg( p_access, "Icy-Genre: %s", p_sys->psz_icy_genre ); } else if( !strncasecmp( psz, "Icy-Notice", 10 ) )