[vlc-devel] [PATCH 21/24] [packetizer/dirac] Stash a copy of the sequence header in p_es->p_extra

davidf+nntp at woaf.net davidf+nntp at woaf.net
Thu Oct 30 12:29:50 CET 2008


From: David Flynn <davidf at rd.bbc.co.uk>

Required for muxing ogg (where the first page contains a sequence header)

Signed-off-by: David Flynn <davidf at rd.bbc.co.uk>
---
 modules/packetizer/dirac.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/modules/packetizer/dirac.c b/modules/packetizer/dirac.c
index 3fe877e..67ef116 100644
--- a/modules/packetizer/dirac.c
+++ b/modules/packetizer/dirac.c
@@ -130,8 +130,6 @@ static int Open( vlc_object_t *p_this )
 
     if( p_dec->fmt_in.i_extra > 0 )
     {
-        msg_Err( p_dec, "i_extra > 0 -- no idea why" );
-#if 0
         block_t *p_init = block_New( p_dec, p_dec->fmt_in.i_extra );
         block_t *p_pic;
 
@@ -139,8 +137,7 @@ static int Open( vlc_object_t *p_this )
                 p_dec->fmt_in.i_extra );
 
         while( ( p_pic = Packetize( p_dec, &p_init ) ) )
-            block_Release( p_pic ); /* Should not happen (only sequence header) */
-#endif
+            block_Release( p_pic );
     }
 
     return VLC_SUCCESS;
@@ -226,10 +223,19 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
             return p_pic;
         }
         else if( 0 == p_pic->p_buffer[4] ) {
-            /* we should stash a copy of this -- it isn't allowed to change ever */
             dirac_UnpackSeqHdr(&p_sys->m_seq_hdr, p_pic);
 
             es_format_t *p_es = &p_dec->fmt_out;
+
+            /* stash a copy of the seqhdr
+             *  - useful for muxers
+             *  - useful for error checking
+             *  - it isn't allowed to change until an eos */
+            if( p_es->p_extra )
+                free( p_es->p_extra );
+            p_es->p_extra = malloc( p_pic->i_buffer );
+            memcpy( p_es->p_extra, p_pic->p_buffer, p_pic->i_buffer);
+            p_es->i_extra = p_pic->i_buffer;
 #if 0
             p_es->video.i_width  = p_sys->m_seq_hdr.u_width;
             p_es->video.i_height = p_sys->m_seq_hdr.u_height;
-- 
1.5.6.5




More information about the vlc-devel mailing list