* video_parser.h : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_parser.h,v 1.3 2001/01/13 12:57:20 sam Exp $
+ * $Id: video_parser.h,v 1.4 2001/01/15 13:25:09 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
decoder_fifo_t * p_fifo; /* PES input fifo */
bit_stream_t bit_stream;
vdec_config_t * p_config;
- /* Bitstream context */
- mtime_t next_pts, next_dts;
/* Output properties */
vout_thread_t * p_vout; /* video output thread */
* vpar_headers.h : video parser : headers parsing
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: vpar_headers.h,v 1.1 2000/12/21 17:19:52 massiot Exp $
+ * $Id: vpar_headers.h,v 1.2 2001/01/15 13:25:09 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stéphane Borel <stef@via.ecp.fr>
/* Parser context */
picture_t * p_forward; /* current forward reference frame */
picture_t * p_backward; /* current backward reference frame */
+ mtime_t next_pts, next_dts;
/* Copyright extension */
boolean_t b_copyright_flag; /* Whether the following
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_parser.c,v 1.66 2001/01/13 12:57:21 sam Exp $
+ * $Id: video_parser.c,v 1.67 2001/01/15 13:25:09 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
static void RunThread ( vpar_thread_t *p_vpar );
static void ErrorThread ( vpar_thread_t *p_vpar );
static void EndThread ( vpar_thread_t *p_vpar );
-static void BitstreamCallback ( bit_stream_t *p_bit_stream );
+static void BitstreamCallback ( bit_stream_t *p_bit_stream,
+ boolean_t b_new_pes );
/*****************************************************************************
* vpar_CreateThread: create a generic parser thread
p_vpar->p_config->decoder_config.pf_init_bit_stream( &p_vpar->bit_stream,
p_vpar->p_config->decoder_config.p_decoder_fifo );
+ p_vpar->bit_stream.pf_bitstream_callback = BitstreamCallback;
+ p_vpar->bit_stream.p_callback_arg = (void *)p_vpar;
/* Initialize parsing data */
p_vpar->sequence.p_forward = NULL;
p_vpar->sequence.nonintra_quant.b_allocated = 0;
p_vpar->sequence.chroma_intra_quant.b_allocated = 0;
p_vpar->sequence.chroma_nonintra_quant.b_allocated = 0;
- /* FIXME : initialize matrix_coefficients, but to what value ? */
+ p_vpar->sequence.i_matrix_coefficients = 1;
+ p_vpar->sequence.next_pts = p_vpar->sequence.next_dts = 0;
/* Initialize copyright information */
p_vpar->sequence.b_copyright_flag = 0;
p_vpar->pp_vdec[0]->b_error = 0;
p_vpar->pp_vdec[0]->p_vpar = p_vpar;
+# if VDEC_NICE
/* Re-nice ourself */
if( nice(VDEC_NICE) == -1 )
{
intf_WarnMsg( 2, "vpar warning : couldn't nice() (%s)",
strerror(errno) );
}
+# endif
#endif
/* Initialize lookup tables */
/*****************************************************************************
* BitstreamCallback: Import parameters from the new data/PES packet
*****************************************************************************
- * This function is called when the thread ends after a sucessful
- * initialization.
+ * This function is called by input's NextDataPacket.
*****************************************************************************/
-static void BitstreamCallback ( bit_stream_t *p_bit_stream );
+static void BitstreamCallback ( bit_stream_t * p_bit_stream,
+ boolean_t b_new_pes )
+{
+ vpar_thread_t * p_vpar = (vpar_thread_t *)p_bit_stream->p_callback_arg;
+
+ if( b_new_pes )
+ {
+ p_vpar->sequence.next_pts =
+ DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->i_pts;
+ p_vpar->sequence.next_dts =
+ DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->i_dts;
+ }
+}
* vpar_synchro.c : frame dropping routines
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: vpar_synchro.c,v 1.71 2001/01/13 12:57:21 sam Exp $
+ * $Id: vpar_synchro.c,v 1.72 2001/01/15 13:25:09 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
boolean_t b_repeat_field )
{
- pes_packet_t * p_pes;
mtime_t period = 1000000 / (p_vpar->sequence.i_frame_rate) * 1001;
switch( i_coding_type )
break;
}
- /* FIXME: use decoder_fifo callback */
- p_pes = DECODER_FIFO_START( *p_vpar->bit_stream.p_decoder_fifo );
-
if( b_repeat_field )
{
/* MPEG-2 repeat_first_field */
if( i_coding_type == B_CODING_TYPE )
{
- if( p_pes->i_pts )
+ if( p_vpar->sequence.next_pts )
{
- if( p_pes->i_pts - p_vpar->synchro.current_pts > PTS_THRESHOLD
- || p_vpar->synchro.current_pts - p_pes->i_pts > PTS_THRESHOLD )
+ if( p_vpar->sequence.next_pts - p_vpar->synchro.current_pts
+ > PTS_THRESHOLD
+ || p_vpar->synchro.current_pts - p_vpar->sequence.next_pts
+ > PTS_THRESHOLD )
{
intf_WarnMsg( 2,
"vpar synchro warning: pts != current_date (%lld)",
- p_vpar->synchro.current_pts - p_pes->i_pts );
+ p_vpar->synchro.current_pts
+ - p_vpar->sequence.next_pts );
}
- p_vpar->synchro.current_pts = p_pes->i_pts;
- p_pes->i_pts = 0;
+ p_vpar->synchro.current_pts = p_vpar->sequence.next_pts;
+ p_vpar->sequence.next_pts = 0;
}
}
else
{
if( p_vpar->synchro.backward_pts )
{
- if( p_pes->i_dts &&
- (p_pes->i_dts - p_vpar->synchro.backward_pts > PTS_THRESHOLD
- || p_vpar->synchro.backward_pts - p_pes->i_dts > PTS_THRESHOLD) )
+ if( p_vpar->sequence.next_dts &&
+ (p_vpar->sequence.next_dts - p_vpar->synchro.backward_pts
+ > PTS_THRESHOLD
+ || p_vpar->synchro.backward_pts - p_vpar->sequence.next_dts
+ > PTS_THRESHOLD) )
{
intf_WarnMsg( 2,
"vpar synchro warning: backward_pts != dts (%lld)",
- p_vpar->synchro.backward_pts - p_pes->i_dts );
+ p_vpar->synchro.backward_pts
+ - p_vpar->sequence.next_dts );
}
if( p_vpar->synchro.backward_pts - p_vpar->synchro.current_pts
p_vpar->synchro.current_pts = p_vpar->synchro.backward_pts;
p_vpar->synchro.backward_pts = 0;
}
- else if( p_pes->i_dts )
+ else if( p_vpar->sequence.next_dts )
{
- if( p_pes->i_dts - p_vpar->synchro.current_pts > PTS_THRESHOLD
- || p_vpar->synchro.current_pts - p_pes->i_dts > PTS_THRESHOLD )
+ if( p_vpar->sequence.next_dts - p_vpar->synchro.current_pts
+ > PTS_THRESHOLD
+ || p_vpar->synchro.current_pts - p_vpar->sequence.next_dts
+ > PTS_THRESHOLD )
{
intf_WarnMsg( 2,
"vpar synchro warning: dts != current_pts (%lld)",
- p_vpar->synchro.current_pts - p_pes->i_dts );
+ p_vpar->synchro.current_pts
+ - p_vpar->sequence.next_dts );
}
/* By definition of a DTS. */
- p_vpar->synchro.current_pts = p_pes->i_dts;
- p_pes->i_dts = 0;
+ p_vpar->synchro.current_pts = p_vpar->sequence.next_dts;
+ p_vpar->sequence.next_dts = 0;
}
- if( p_pes->i_pts )
+ if( p_vpar->sequence.next_pts )
{
-#if 0
- int i_n_b;
-#endif
-
/* Store the PTS for the next time we have to date an I picture. */
- p_vpar->synchro.backward_pts = p_pes->i_pts;
- p_pes->i_pts = 0;
- /* FIXME : disabled because it conflicts with streams having
- * b_repeat_first_field */
-#if 0
- i_n_b = (p_vpar->synchro.backward_pts
- - p_vpar->synchro.current_pts) / period - 1;
- if( i_n_b != p_vpar->synchro.i_n_b )
- {
- intf_WarnMsg( 1,
- "Anticipating a stream periodicity change from"
- " B[%d] to B[%d]",
- p_vpar->synchro.i_n_b, i_n_b );
- p_vpar->synchro.i_n_b = i_n_b;
- }
-#endif
+ p_vpar->synchro.backward_pts = p_vpar->sequence.next_pts;
+ p_vpar->sequence.next_pts = 0;
}
}