[vlc-devel] [PATCH 06/24] [codec/dirac] stash copy of sequence header in fmt_out.p_extra

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


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

 - OggDirac requires specific header information to be made avaliable
   for use in the BOS page.

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

diff --git a/modules/codec/dirac.c b/modules/codec/dirac.c
index 7885adb..3119947 100644
--- a/modules/codec/dirac.c
+++ b/modules/codec/dirac.c
@@ -754,9 +754,20 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
              block_ChainAppend( &p_sys->p_chain, p_block );
 
              /* Presence of a Sequence header indicates a seek point */
-             if( 0 == p_block->p_buffer[4] )
+             if( 0 == p_block->p_buffer[4] ) {
                  p_block->i_flags |= BLOCK_FLAG_TYPE_I;
 
+                 if( !p_enc->fmt_out.p_extra ) {
+                     uint32_t len = GetDWBE( p_block->p_buffer + 5 );
+                     /* if it hasn't been done so far, stash a copy of the
+                      * sequence header for muxers such as ogg */
+                     /* XXX, should this be done using the packetizer ? */
+                     p_enc->fmt_out.p_extra = malloc( len );
+                     memcpy( p_enc->fmt_out.p_extra, p_block->p_buffer, len);
+                     p_enc->fmt_out.i_extra = len;
+                 }
+             }
+
              if( ReadDiracPictureNumber( &pic_num, p_block ) ) {
                  /* Finding a picture terminates an ecapsulation unit, gather
                   * all data and output; use the next dts value queued up
-- 
1.5.6.5




More information about the vlc-devel mailing list