/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h> /* malloc(), free() */
#include <vlc/vlc.h>
-#include <vlc/decoder.h>
-#include <vlc/sout.h>
-#include <vlc/input.h> /* hmmm, just for INPUT_RATE_DEFAULT */
+#include <vlc_sout.h>
+#include <vlc_codec.h>
+#include <vlc_block.h>
+#include <vlc_input.h> /* hmmm, just for INPUT_RATE_DEFAULT */
#include "vlc_bits.h"
#include "vlc_block_helper.h"
if( pp_block == NULL || *pp_block == NULL ) return NULL;
- if( (*pp_block)->i_flags & BLOCK_FLAG_DISCONTINUITY )
+ if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
- p_sys->i_state = STATE_NOSYNC;
- if( p_sys->p_frame ) block_ChainRelease( p_sys->p_frame );
- p_sys->p_frame = NULL;
- p_sys->pp_last = &p_sys->p_frame;
+ if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
+ {
+ p_sys->i_state = STATE_NOSYNC;
+ block_BytestreamFlush( &p_sys->bytestream );
+
+ if( p_sys->p_frame )
+ block_ChainRelease( p_sys->p_frame );
+ p_sys->p_frame = NULL;
+ p_sys->pp_last = &p_sys->p_frame;
+ }
+// p_sys->i_interpolated_pts =
+// p_sys->i_interpolated_dts =
+// p_sys->i_last_ref_pts =
+// p_sys->i_last_time_ref =
+// p_sys->i_time_ref =
+// p_sys->i_last_time =
+// p_sys->i_last_timeincr = 0;
+
block_Release( *pp_block );
return NULL;
}
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_pic = NULL;
- if( p_frag->p_buffer[3] == 0xB0 || p_frag->p_buffer[3] == 0xB1 )
- {
+ if( p_frag->p_buffer[3] == 0xB0 || p_frag->p_buffer[3] == 0xB1 || p_frag->p_buffer[3] == 0xB2 )
+ { /* VOS and USERDATA */
+#if 0
/* Remove VOS start/end code from the original stream */
block_Release( p_frag );
+#else
+ /* Append the block for now since ts/ps muxers rely on VOL
+ * being present in the stream */
+ block_ChainLastAppend( &p_sys->pp_last, p_frag );
+#endif
return NULL;
}
if( p_frag->p_buffer[3] >= 0x20 && p_frag->p_buffer[3] <= 0x2f )
{
/* Copy the complete VOL */
- p_dec->fmt_out.i_extra = p_frag->i_buffer;
- p_dec->fmt_out.p_extra =
- realloc( p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra );
+ if( p_dec->fmt_out.i_extra != p_frag->i_buffer )
+ {
+ p_dec->fmt_out.p_extra =
+ realloc( p_dec->fmt_out.p_extra, p_frag->i_buffer );
+ p_dec->fmt_out.i_extra = p_frag->i_buffer;
+ }
memcpy( p_dec->fmt_out.p_extra, p_frag->p_buffer, p_frag->i_buffer );
ParseVOL( p_dec, &p_dec->fmt_out,
p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra );
+#if 0
/* Remove from the original stream */
block_Release( p_frag );
+#else
+ /* Append the block for now since ts/ps muxers rely on VOL
+ * being present in the stream */
+ block_ChainLastAppend( &p_sys->pp_last, p_frag );
+#endif
return NULL;
}
else