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

Gilles Chanteperdrix gilles.chanteperdrix at xenomai.org
Tue Dec 17 01:55:40 CET 2013


by parsing the "a=lang:" attribute.
---
 modules/access/live555.cpp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 8662aee..0e83d22 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" );
@@ -1086,6 +1087,20 @@ static int SessionsSetup( demux_t *p_demux )
                 }
             }
 
+            /* Try and parse a=lang: attribute */
+            lang = strstr(sub->savedSDPLines(), "a=lang:");
+            if (lang) {
+                    unsigned sz;
+                    
+                    for (lang += 7, sz = 0; !isspace(lang[sz]); sz++)
+                            ;
+                    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';
+                    }
+            }
+
             if( !tk->b_quicktime && !tk->b_muxed && !tk->b_asf )
             {
                 tk->p_es = es_out_Add( p_demux->out, &tk->fmt );
@@ -1108,7 +1123,7 @@ static int SessionsSetup( demux_t *p_demux )
                 es_format_Clean( &tk->fmt );
                 free( tk );
             }
-	    
+            
         }
     }
     delete iter;
-- 
1.8.4.rc3




More information about the vlc-devel mailing list