]> git.sesse.net Git - vlc/commitdiff
* src/video_output/vout_synchro.c: Fixed synchro for low delay streams.
authorChristophe Massiot <massiot@videolan.org>
Fri, 20 May 2005 18:00:02 +0000 (18:00 +0000)
committerChristophe Massiot <massiot@videolan.org>
Fri, 20 May 2005 18:00:02 +0000 (18:00 +0000)
 * include/vlc_block.h: Removed BLOCK_FLAG_END_OF_GOP which I don't use
   any longer.

include/vlc_block.h
include/vout_synchro.h
modules/codec/libmpeg2.c
src/video_output/vout_synchro.c

index bb42d3e85c1052a8282d1985ed8f3c802861ee29..d673ce25f5a1ad949bdd941e325d60ea63435bfa 100644 (file)
@@ -62,8 +62,6 @@ typedef struct block_sys_t block_sys_t;
 #define BLOCK_FLAG_END_OF_FRAME  0x0040
 /** This is not a key frame for bitrate shaping */
 #define BLOCK_FLAG_NO_KEYFRAME   0x0080
-/** This is the last block of the GOP */
-#define BLOCK_FLAG_END_OF_GOP    0x0100
 /** This block contains a clock reference */
 #define BLOCK_FLAG_CLOCK         0x0200
 /** This block is scrambled */
index b4b6d470e392d93d56546325eeaed962064b684d..eb2a10e10bc2b5d4a6284b3547e8bbb8798e5927 100644 (file)
@@ -88,10 +88,10 @@ struct vout_synchro_t
 VLC_EXPORT( vout_synchro_t *, __vout_SynchroInit, ( vlc_object_t *, int ) );
 VLC_EXPORT( void, vout_SynchroRelease,        ( vout_synchro_t * ) );
 VLC_EXPORT( void, vout_SynchroReset,          ( vout_synchro_t * ) );
-VLC_EXPORT( vlc_bool_t, vout_SynchroChoose,   ( vout_synchro_t *, int, int ) );
+VLC_EXPORT( vlc_bool_t, vout_SynchroChoose,   ( vout_synchro_t *, int, int, vlc_bool_t ) );
 VLC_EXPORT( void, vout_SynchroTrash,          ( vout_synchro_t * ) );
 VLC_EXPORT( void, vout_SynchroDecode,         ( vout_synchro_t * ) );
 VLC_EXPORT( void, vout_SynchroEnd,            ( vout_synchro_t *, int, vlc_bool_t ) );
 VLC_EXPORT( mtime_t, vout_SynchroDate,        ( vout_synchro_t * ) );
-VLC_EXPORT( void, vout_SynchroNewPicture,     ( vout_synchro_t *, int, int, mtime_t, mtime_t, int ) );
+VLC_EXPORT( void, vout_SynchroNewPicture,     ( vout_synchro_t *, int, int, mtime_t, mtime_t, int, vlc_bool_t ) );
 
index bde31deb766fbd420063629afa83897d0dd1fff6..0675d185429c20e820de07bb785f6f52982bea4e 100644 (file)
@@ -216,7 +216,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                 return NULL;
             }
 
-            if( (p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) &&
+            if( (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY
+                                      | BLOCK_FLAG_CORRUPTED)) &&
                 p_sys->p_synchro &&
                 p_sys->p_info->sequence &&
                 p_sys->p_info->sequence->width != (unsigned)-1 )
@@ -241,7 +242,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                 if ( p_sys->b_slice_i )
                 {
                     vout_SynchroNewPicture( p_sys->p_synchro,
-                        I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate );
+                        I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
+                        p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
                     vout_SynchroDecode( p_sys->p_synchro );
                     vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
                 }
@@ -377,7 +379,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             vout_SynchroNewPicture( p_sys->p_synchro,
                 p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
                 p_sys->p_info->current_picture->nb_fields,
-                0, 0, p_sys->i_current_rate );
+                0, 0, p_sys->i_current_rate,
+                p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
 
             if( p_sys->b_skip )
             {
@@ -402,7 +405,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                 /* Intra-slice refresh. Simulate a blank I picture. */
                 msg_Dbg( p_dec, "intra-slice refresh stream" );
                 vout_SynchroNewPicture( p_sys->p_synchro,
-                    I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate );
+                    I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
+                    p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
                 vout_SynchroDecode( p_sys->p_synchro );
                 vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
                 p_sys->b_slice_i = 1;
@@ -444,7 +448,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             vout_SynchroNewPicture( p_sys->p_synchro,
                 p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
                 p_sys->p_info->current_picture->nb_fields, i_pts, i_dts,
-                p_sys->i_current_rate );
+                p_sys->i_current_rate,
+                p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
 
             if( !p_dec->b_pace_control && !p_sys->b_preroll &&
                 !(p_sys->b_slice_i
@@ -453,7 +458,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                    && !vout_SynchroChoose( p_sys->p_synchro,
                               p_sys->p_info->current_picture->flags
                                 & PIC_MASK_CODING_TYPE,
-                              /*p_sys->p_vout->render_time*/ 0 /*FIXME*/ ) )
+                              /*p_sys->p_vout->render_time*/ 0 /*FIXME*/,
+                              p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ) )
             {
                 mpeg2_skip( p_sys->p_mpeg2dec, 1 );
                 p_sys->b_skip = 1;
@@ -570,7 +576,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             if( p_sys->b_slice_i )
             {
                 vout_SynchroNewPicture( p_sys->p_synchro,
-                            I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate );
+                        I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
+                        p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
                 vout_SynchroDecode( p_sys->p_synchro );
                 vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
             }
index 6293b5e5d42536983d1383fbffbdf983a0b720f7..5f4497a4c33d444e703bcb3f8d29a27cd5614bcc 100644 (file)
@@ -172,7 +172,7 @@ void vout_SynchroReset( vout_synchro_t * p_synchro )
  * vout_SynchroChoose : Decide whether we will decode a picture or not
  *****************************************************************************/
 vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type,
-                               int i_render_time )
+                               int i_render_time, vlc_bool_t b_low_delay )
 {
 #define TAU_PRIME( coding_type )    (p_synchro->p_tau[(coding_type)] \
                                     + (p_synchro->p_tau[(coding_type)] >> 1) \
@@ -194,7 +194,11 @@ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type,
     switch( i_coding_type )
     {
     case I_CODING_TYPE:
-        if( S.backward_pts )
+        if( b_low_delay )
+        {
+            pts = S.current_pts;
+        }
+        else if( S.backward_pts )
         {
             pts = S.backward_pts;
         }
@@ -225,7 +229,11 @@ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type,
         break;
 
     case P_CODING_TYPE:
-        if( S.backward_pts )
+        if( b_low_delay )
+        {
+            pts = S.current_pts;
+        }
+        else if( S.backward_pts )
         {
             pts = S.backward_pts;
         }
@@ -352,7 +360,8 @@ mtime_t vout_SynchroDate( vout_synchro_t * p_synchro )
  *****************************************************************************/
 void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type,
                              int i_repeat_field, mtime_t next_pts,
-                             mtime_t next_dts, int i_current_rate )
+                             mtime_t next_dts, int i_current_rate,
+                             vlc_bool_t b_low_delay )
 {
     mtime_t         period = 1000000 * 1001 / p_synchro->i_frame_rate
                               * i_current_rate / INPUT_RATE_DEFAULT;
@@ -441,7 +450,7 @@ void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type,
                                         * (period >> 1);
 
 #define PTS_THRESHOLD   (period >> 2)
-    if( i_coding_type == B_CODING_TYPE )
+    if( i_coding_type == B_CODING_TYPE || b_low_delay )
     {
         /* A video frame can be displayed 1, 2 or 3 times, according to
          * repeat_first_field, top_field_first, progressive_sequence and