[vlc-devel] [PATCH] live555: retrieve RTSP track languages from SDP

Jean-Baptiste Kempf jb at videolan.org
Wed Dec 25 20:21:16 CET 2013


Applied, with style fixes

On 18 Dec, Gilles Chanteperdrix wrote :
> First for the "a=lang:" session attribute, then for each subsession
> look for the same attribute, and use the session attribute if none
> was found.
> ---
>  modules/access/live555.cpp | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
> index b9ed723..869904e 100644
> --- a/modules/access/live555.cpp
> +++ b/modules/access/live555.cpp
> @@ -685,6 +685,8 @@ static int SessionsSetup( demux_t *p_demux )
>      unsigned int   i_receive_buffer = 0;
>      int            i_frame_buffer = DEFAULT_FRAME_BUFFER_SIZE;
>      unsigned const thresh = 200000; /* RTP reorder threshold .2 second (default .1) */
> +    const char     *p_sess_lang = NULL;
> +    const char     *p_lang;
>  
>      b_rtsp_tcp    = var_CreateGetBool( p_demux, "rtsp-tcp" ) ||
>                      var_GetBool( p_demux, "rtsp-http" );
> @@ -699,6 +701,19 @@ static int SessionsSetup( demux_t *p_demux )
>          return VLC_EGENERIC;
>      }
>  
> +    if (strcmp(p_sys->p_sdp, "m=") != 0) {
> +        const char *p_sess_attr_end;
> +
> +        p_sess_attr_end = strstr(p_sys->p_sdp, "\nm=");
> +        if (!p_sess_attr_end)
> +            p_sess_attr_end = strstr(p_sys->p_sdp, "\rm=");
> +
> +        p_sess_lang = p_sess_attr_end ? strstr(p_sys->p_sdp, "a=lang:") : NULL;
> +        if (p_sess_lang && 
> +            p_sess_lang - p_sys->p_sdp > p_sess_attr_end - p_sys->p_sdp)
> +            p_sess_lang = NULL;
> +    }
> +
>      /* Initialise each media subsession */
>      iter = new MediaSubsessionIterator( *p_sys->ms );
>      while( ( sub = iter->next() ) != NULL )
> @@ -1090,6 +1105,18 @@ static int SessionsSetup( demux_t *p_demux )
>                  }
>              }
>  
> +            /* Try and parse a=lang: attribute */
> +            p_lang = strstr(sub->savedSDPLines(), "a=lang:");
> +            if (!p_lang)
> +                p_lang = p_sess_lang;
> +            
> +            if (p_lang) {
> +                unsigned i_lang_len;
> +                p_lang += 7;
> +                i_lang_len = strcspn(p_lang, " \r\n");
> +                tk->fmt.psz_language = strndup(p_lang, i_lang_len);
> +            }
> +
>              if( !tk->b_quicktime && !tk->b_muxed && !tk->b_asf )
>              {
>                  tk->p_es = es_out_Add( p_demux->out, &tk->fmt );
> -- 
> 1.8.5.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
With my kindest 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