[vlc-commits] setid: do not clobber format

Rémi Denis-Courmont git at videolan.org
Sat Feb 21 11:24:22 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb 21 11:50:13 2015 +0200| [ebdb86c270f34bd5ac8b1baeb74c2219a039c162] | committer: Rémi Denis-Courmont

setid: do not clobber format

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ebdb86c270f34bd5ac8b1baeb74c2219a039c162
---

 modules/stream_out/setid.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/modules/stream_out/setid.c b/modules/stream_out/setid.c
index 1e8fae4..e42640e 100644
--- a/modules/stream_out/setid.c
+++ b/modules/stream_out/setid.c
@@ -188,30 +188,38 @@ static void Close( vlc_object_t * p_this )
 static sout_stream_id_sys_t * AddId( sout_stream_t *p_stream, es_format_t *p_fmt )
 {
     sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
+    es_format_t fmt;
 
     if ( p_fmt->i_id == p_sys->i_id )
     {
-        msg_Dbg( p_stream, "turning ID %d to %d",
-                 p_sys->i_id, p_sys->i_new_id );
-        p_fmt->i_id = p_sys->i_new_id;
+        msg_Dbg( p_stream, "turning ID %d to %d", p_sys->i_id,
+                 p_sys->i_new_id );
+
+        fmt = *p_fmt;
+        fmt.i_id = p_sys->i_new_id;
+        p_fmt = &fmt;
     }
 
-    return p_stream->p_next->pf_add( p_stream->p_next, p_fmt );
+    return sout_StreamIdAdd( p_stream->p_next, p_fmt );
 }
 
 static sout_stream_id_sys_t * AddLang( sout_stream_t *p_stream, es_format_t *p_fmt )
 {
     sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
+    es_format_t fmt;
 
     if ( p_fmt->i_id == p_sys->i_id )
     {
         msg_Dbg( p_stream, "turning language %s of ID %d to %s",
                  p_fmt->psz_language ? p_fmt->psz_language : "unk",
                  p_sys->i_id, p_sys->psz_language );
-        p_fmt->psz_language = strdup( p_sys->psz_language );
+
+        fmt = *p_fmt;
+        fmt.psz_language = p_sys->psz_language;
+        p_fmt = &fmt;
     }
 
-    return p_stream->p_next->pf_add( p_stream->p_next, p_fmt );
+    return sout_StreamIdAdd( p_stream->p_next, p_fmt );
 }
 
 static void Del( sout_stream_t *p_stream, sout_stream_id_sys_t *id )



More information about the vlc-commits mailing list