[vlc-devel] suggestion of modifications of 2.0.5 code for playing stream
Jean-Baptiste Kempf
jb at videolan.org
Sun May 19 11:03:49 CEST 2013
Salut Julien,
On 19 May, julien de ROSNY wrote :
> 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.
Indeed, and it is really cool that you've taken the time to do so.
Could you do the following:
- prepare properly formatted patches
- prepare them against 2.1.0 (soon out)
- send them here
?
> The first modification is at line 550 of httplive.c file where
Patch 1
> Also, I prefer to start with the best image quality, i.e., the flux with the maximum bandwidth
>
> so I replaced in Open function (line 1949 of httplive.c)
>
> int current = p_sys->playback.stream = 0;
>
> by
>
> int current = p_sys->playback.stream = p_sys->hls_stream->i_count-1;
This should be a preference.
> Now in file http.c
> In function "cookie_get_domain"
> I changed (line 1681)
> if( !strncmp( str, domain, sizeof(domain) - 1 /* minus \0 */ ) )
> into
> if( !strncasemp( str, domain, sizeof(domain) - 1 /* minus \0 */ ) )
>
> because in order to be case insensitive. Indeed for my application, the served send "Domain = " instead of "domain="
This should be a second patch.
> Ok now, the main modification consists of restoring the cookie jar approach that is used in vlc 1.x.
> 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
> In http.c function Open
> I add
> vlc_array_t *p_jar;
> p_jar = (vlc_array_t *)var_GetAddress( p_this->p_libvlc, "http-cookie-jar" );
> if ( p_jar == NULL )
> {
> p_jar = (vlc_array_t *) vlc_array_new();
> var_Create( p_this->p_libvlc, "http-cookie-jar", VLC_VAR_ADDRESS );
> var_SetAddress( p_this->p_libvlc, "http-cookie-jar", p_jar );
> }
> return OpenWithCookies( p_this, p_access->psz_access, 5, p_jar );
>
>
> Then if I want to keep the cookies with the http-forward-cookies flag I do not anymore delete it
>
> at line 691
> I modified the function OpenWithCookies
> if (!(b_forward_cookies)||( p_sys->cookies ))
> {
> int i;
> for( i = 0; i < vlc_array_count( p_sys->cookies ); i++ )
> free(vlc_array_item_at_index( p_sys->cookies, i ));
> vlc_array_destroy( p_sys->cookies );
> p_sys->cookies=NULL;
> }
>
> Line 733 same modifications
> if (( p_sys->cookies )&&(!var_InheritBool( p_access, "http-forward-cookies" )))
> {
> int i;
> for( i = 0; i < vlc_array_count( p_sys->cookies ); i++ )
> free(vlc_array_item_at_index( p_sys->cookies, i ));
> vlc_array_destroy( p_sys->cookies );
> p_sys->cookies=NULL;
> }
>
> Now with these modifications, I successfully play with vlc the streams.
And a third one.
> But with this approach I think the cookie array is never destroyed. Should I destroyed it in libvlc_InternalCleanup function or not?
It will be easier to tell you once you've done the patches.
> More generally do you think the code is ok to be added to vlc?
Once formatted correctly? Why not, it would be nice to have it in VLC.
Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the vlc-devel
mailing list