]> git.sesse.net Git - vlc/blobdiff - modules/codec/libmpeg2.c
* block: added
[vlc] / modules / codec / libmpeg2.c
index 1fa676171d057e62cf331bfddceb6e5eea4376ca..167c754b22a2b4b9f4206261865079d6538d83ea 100644 (file)
@@ -65,6 +65,8 @@ struct decoder_sys_t
                                                * the sequence header ?    */
     vlc_bool_t       b_slice_i;             /* intra-slice refresh stream */
 
+    vlc_bool_t      b_preroll;
+
     /*
      * Output properties
      */
@@ -137,6 +139,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_sys->b_garbage_pic = 0;
     p_sys->b_slice_i  = 0;
     p_sys->b_skip     = 0;
+    p_sys->b_preroll = VLC_FALSE;
 
 #if defined( __i386__ )
     if( p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_MMX )
@@ -213,7 +216,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                 return NULL;
             }
 
-            if( (p_block->i_flags&BLOCK_FLAG_DISCONTINUITY) &&
+            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 )
@@ -244,6 +247,17 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                 }
             }
 
+            if( p_block->i_flags & BLOCK_FLAG_PREROLL )
+            {
+                p_sys->b_preroll = VLC_TRUE;
+            }
+            else if( p_sys->b_preroll )
+            {
+                p_sys->b_preroll = VLC_FALSE;
+                /* Reset synchro */
+                vout_SynchroReset( p_sys->p_synchro );
+            }
+
 #ifdef PIC_FLAG_PTS
             if( p_block->i_pts )
             {
@@ -432,7 +446,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                 p_sys->p_info->current_picture->nb_fields, i_pts, i_dts,
                 p_sys->i_current_rate );
 
-            if( !p_dec->b_pace_control &&
+            if( !p_dec->b_pace_control && !p_sys->b_preroll &&
                 !(p_sys->b_slice_i
                    && ((p_sys->p_info->current_picture->flags
                          & PIC_MASK_CODING_TYPE) == P_CODING_TYPE))