<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>SFR (french) provider have developped its own version of VLC (version 1.x) in order to play crypted ts stream (source codes are available). Here i have modified the code to play the same stream but with version 2.0.5.</div><br>The first modification is at line 550 of httplive.c file where <br>char    *path_end = strrchr(psz_url, '/');<br>is replaced by<br>    char *path_end;<br>    if (psz_path[0]=='/')<br>    {<br>    //If the psz path contains all the subpaths and the file name but not the URL<br>        path_end = strstr(psz_url,"//");<br>        path_end = strchr(path_end+2, '/')-1;<br>    }<br>    else<br>    {<br>   
 //If the psz path only contains the file name <br>        path_end = strrchr(psz_url, '/');<br>    }<br><br>because otherwise the subpath after the main internet adress was repeated twice.<br><br>Also, I prefer to start with the best image quality, i.e., the flux with the maximum bandwidth<br><br>so I replaced in Open function (line 1949 of httplive.c)<br><br>int current = p_sys->playback.stream = 0;<br><br>by <br><br>int current = p_sys->playback.stream = p_sys->hls_stream->i_count-1;<br><br>Now in file http.c<br>In function "cookie_get_domain" <br>I cha<span class="tab">nged (line 1681)<br></span>if( !strncmp( str, domain, sizeof(domain) - 1 /* minus \0 */ ) )<br>into <br>if( !strncasemp( str, domain, sizeof(domain) - 1 /* minus \0 */ ) )<br> <br>because in order to be case insensitive. Indeed for my application, the served send "Domain = " instead of "domain="<br><br>Ok now, the main
 modification consists of restoring the cookie jar approach that is used in vlc 1.x.<br>Indeed, for SFR streaming,  I need to send all the cookies during all the streaming session (i.e., between several http sessions). But because it appears in the 2.x vlc version, the cookies are lost between  http vlc sessions, so we need to keep the cookies even if a http session is closed. The method is directly inspired from the vlc 1.x version<br>In http.c function Open <br>I add<br>    vlc_array_t *p_jar;<br>    p_jar = (vlc_array_t *)var_GetAddress( p_this->p_libvlc, "http-cookie-jar" );<br>    if ( p_jar == NULL )<br>    {<br>        p_jar =  (vlc_array_t *) vlc_array_new(); <br>        var_Create( p_this->p_libvlc, "http-cookie-jar", VLC_VAR_ADDRESS );<br>        var_SetAddress(
 p_this->p_libvlc, "http-cookie-jar", p_jar );<br>    }<br>    return OpenWithCookies( p_this, p_access->psz_access, 5, p_jar );<br><br><br>Then if I want to keep the cookies with the http-forward-cookies flag I do not anymore delete it<br><br>at line 691<br>I modified the function OpenWithCookies <br> if (!(b_forward_cookies)||( p_sys->cookies ))<br>    {<br>        int i;<br>        for( i = 0; i < vlc_array_count( p_sys->cookies ); i++ )<br>            free(vlc_array_item_at_index( p_sys->cookies, i ));<br>        vlc_array_destroy( p_sys->cookies );<br>        p_sys->cookies=NULL;<br>    }<br> <br>Line 733 same modifications<br>    if ((
 p_sys->cookies )&&(!var_InheritBool( p_access, "http-forward-cookies" )))<br>    {<br>        int i;<br>        for( i = 0; i < vlc_array_count( p_sys->cookies ); i++ )<br>            free(vlc_array_item_at_index( p_sys->cookies, i ));<br>        vlc_array_destroy( p_sys->cookies );<br>        p_sys->cookies=NULL;<br>   } <br><br>Now with these modifications, I successfully play with vlc the streams.<br><br>But with this approach I think the cookie array is never destroyed. Should I destroyed it in libvlc_InternalCleanup function or not?<br>More generally do you think the code is ok to be added to vlc?<br><br>juju27<br><br></div></body></html>