[vlc-devel] [PATCH 04/24] [codec/dirac] initial pts_offset support

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


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

- retrieving pts_offset from encoder is commented out -- need a method
  for checking libdirac version

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

diff --git a/modules/codec/dirac.c b/modules/codec/dirac.c
index f238279..e0895ac 100644
--- a/modules/codec/dirac.c
+++ b/modules/codec/dirac.c
@@ -326,7 +326,6 @@ struct encoder_sys_t
     block_t *p_chain;
 
     struct picture_pts_t pts_tlb[PTS_TLB_SIZE];
-    mtime_t i_lastdts;
     mtime_t i_pts_offset;
 };
 
@@ -662,10 +661,16 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
 
     if( !p_sys->p_dirac )
     {
+        date_t m_date;
         /* Initialise the encoder with the encoder context */
         p_sys->p_dirac = dirac_encoder_init( &p_sys->ctx, 0 );
-        p_sys->i_lastdts = p_pic->date;
-        p_sys->i_pts_offset = 0;
+        date_Init( &m_date, p_enc->fmt_in.video.i_frame_rate, p_enc->fmt_in.video.i_frame_rate_base );
+#if 0
+        date_Increment( &m_date, dirac_encoder_ptsoffset( p_sys->p_dirac ) );
+#else
+        date_Increment( &m_date, 1 );
+#endif
+        p_sys->i_pts_offset = date_Get( &m_date );
     }
 
     /* Copy input picture into encoder input buffer (stride by stride) */
@@ -702,7 +707,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
     /* store dts in a queue, so that they appear in order in
      * coded order */
     p_block = block_New( p_enc, 1 );
-    p_block->i_dts = p_pic->date;
+    p_block->i_dts = p_pic->date - p_sys->i_pts_offset;
     block_FifoPut( p_sys->p_dts_fifo, p_block );
     p_block = NULL;
 
-- 
1.5.6.5




More information about the vlc-devel mailing list