]> git.sesse.net Git - vlc/commitdiff
* modules/packetizer/mpeg4video.c: remove the VOL from the packetized stream and...
authorGildas Bazin <gbazin@videolan.org>
Wed, 1 Jun 2005 10:59:51 +0000 (10:59 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 1 Jun 2005 10:59:51 +0000 (10:59 +0000)
modules/packetizer/mpeg4video.c

index cd23db2a167cf1a3936de8c979e9a050a997a710..2a3bccdae6f3e8d511ae41d8004838209b25d4f9 100644 (file)
@@ -235,13 +235,23 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
 
         if( p_vol )
         {
-            /* Copy the complete VOL */
-            p_dec->fmt_out.i_extra = p_start - p_vol;
-            p_dec->fmt_out.p_extra =
-                realloc( p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra );
-            memcpy( p_dec->fmt_out.p_extra, p_vol, p_dec->fmt_out.i_extra );
-            m4v_VOLParse( p_dec, &p_dec->fmt_out,
-                          p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra );
+            if( !p_dec->fmt_out.i_extra )
+            {
+                /* Copy the complete VOL */
+                p_dec->fmt_out.i_extra = p_start - p_vol;
+                p_dec->fmt_out.p_extra =
+                    realloc( p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra );
+                memcpy( p_dec->fmt_out.p_extra, p_vol,
+                        p_dec->fmt_out.i_extra );
+                m4v_VOLParse( p_dec, &p_dec->fmt_out,
+                              p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra );
+            }
+
+            /* Remove VOL from the original stream */
+            memmove( p_vol, p_start,
+                     p_sys->i_buffer - (p_start - p_sys->p_buffer) );
+            p_sys->i_buffer -= p_dec->fmt_out.i_extra;
+            p_start = p_vol;
 
             p_vol = NULL;
         }