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

Rémi Denis-Courmont remi at remlab.net
Tue Dec 17 19:20:12 CET 2013


On Tue, 17 Dec 2013 09:38:26 +0100, Gilles Chanteperdrix
<gilles.chanteperdrix at xenomai.org> wrote:
> by parsing the "a=lang:" attribute.
> ---
>  modules/access/live555.cpp | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
> index b9ed723..c226b90 100644
> --- a/modules/access/live555.cpp
> +++ b/modules/access/live555.cpp
> @@ -685,6 +685,7 @@ 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     *lang;
>  
>      b_rtsp_tcp    = var_CreateGetBool( p_demux, "rtsp-tcp" ) ||
>                      var_GetBool( p_demux, "rtsp-http" );
> @@ -1090,6 +1091,20 @@ static int SessionsSetup( demux_t *p_demux )
>                  }
>              }
>  
> +            /* Try and parse a=lang: attribute */
> +            lang = strstr(sub->savedSDPLines(), "a=lang:");

Isn't there a nice getter for SDP attributes? Also, is lang only a media
attribute, or should it be inherited from the session where applicable?

> +            if (lang) {
> +                unsigned sz;
> +                    
> +                for (lang += 7, sz = 0; !isspace(lang[sz]); sz++)

isspace() is subject to localization. Here, you should rather hard-code
the set of characters and use strcspn().

> +                    ;
> +                tk->fmt.psz_language = (char *)malloc(sz + 1);
> +                if (tk->fmt.psz_language) {
> +                    memcpy(tk->fmt.psz_language, lang, sz);
> +                    tk->fmt.psz_language[sz] = '\0';
> +                }

strndup() ?

> +            }
> +
>              if( !tk->b_quicktime && !tk->b_muxed && !tk->b_asf )
>              {
>                  tk->p_es = es_out_Add( p_demux->out, &tk->fmt );

-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list