NB : b_has_pts has disappeared for brevity reasons, use i_pts != 0 instead.
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-dec.h,v 1.6 2000/12/26 19:14:46 massiot Exp $
+ * $Id: input_ext-dec.h,v 1.7 2000/12/27 18:35:45 massiot Exp $
boolean_t b_discontinuity; /* This packet doesn't follow the
* previous one */
boolean_t b_discontinuity; /* This packet doesn't follow the
* previous one */
- boolean_t b_has_pts; /* is the following field set ? */
- mtime_t i_pts; /* the PTS for this packet (if set above) */
+ mtime_t i_pts;/* the PTS for this packet (zero if unset) */
+ mtime_t i_dts;/* the DTS for this packet (zero if unset) */
int i_pes_size; /* size of the current PES packet */
int i_pes_size; /* size of the current PES packet */
* ac3_decoder_thread.c: ac3 decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* ac3_decoder_thread.c: ac3 decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_decoder_thread.c,v 1.21 2000/12/22 13:04:44 sam Exp $
+ * $Id: ac3_decoder_thread.c,v 1.22 2000/12/27 18:35:45 massiot Exp $
p_ac3dec->sync_ptr = 0;
}
p_ac3dec->sync_ptr = 0;
}
- if (DECODER_FIFO_START(*p_ac3dec->p_fifo)->b_has_pts)
+ if (DECODER_FIFO_START(*p_ac3dec->p_fifo)->i_pts)
{
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(*p_ac3dec->p_fifo)->i_pts;
{
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(*p_ac3dec->p_fifo)->i_pts;
- DECODER_FIFO_START(*p_ac3dec->p_fifo)->b_has_pts = 0;
+ DECODER_FIFO_START(*p_ac3dec->p_fifo)->i_pts = 0;
* audio_decoder.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* audio_decoder.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: audio_decoder.c,v 1.42 2000/12/22 13:04:44 sam Exp $
+ * $Id: audio_decoder.c,v 1.43 2000/12/27 18:35:45 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
- if( DECODER_FIFO_START( *p_adec->p_fifo)->b_has_pts )
+ if( DECODER_FIFO_START( *p_adec->p_fifo)->i_pts )
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] =
DECODER_FIFO_START( *p_adec->p_fifo )->i_pts;
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] =
DECODER_FIFO_START( *p_adec->p_fifo )->i_pts;
- DECODER_FIFO_START(*p_adec->p_fifo)->b_has_pts = 0;
+ DECODER_FIFO_START(*p_adec->p_fifo)->i_pts = 0;
* input_netlist.c: netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* input_netlist.c: netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_netlist.c,v 1.21 2000/12/22 13:04:45 sam Exp $
+ * $Id: input_netlist.c,v 1.22 2000/12/27 18:35:45 massiot Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
*
* Authors: Henri Fallon <henri@videolan.org>
*
p_return->b_messed_up =
p_return->b_data_alignment =
p_return->b_discontinuity =
p_return->b_messed_up =
p_return->b_data_alignment =
p_return->b_discontinuity =
- p_return->b_has_pts = 0;
+ p_return->i_pts = p_return->i_dts = 0;
p_return->i_pes_size = 0;
p_return->p_first = NULL;
p_return->i_pes_size = 0;
p_return->p_first = NULL;
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ps.c,v 1.14 2000/12/27 09:54:53 sam Exp $
+ * $Id: input_ps.c,v 1.15 2000/12/27 18:35:45 massiot Exp $
}
p_pes->b_messed_up = p_pes->b_data_alignment = p_pes->b_discontinuity =
}
p_pes->b_messed_up = p_pes->b_data_alignment = p_pes->b_discontinuity =
+ p_pes->i_pts = p_pes->i_dts = 0;
p_pes->i_pes_size = 0;
p_pes->p_first = NULL;
p_pes->i_pes_size = 0;
p_pes->p_first = NULL;
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: mpeg_system.c,v 1.19 2000/12/26 19:14:47 massiot Exp $
+ * $Id: mpeg_system.c,v 1.20 2000/12/27 18:35:45 massiot Exp $
{
/* MPEG-2 : the PES header contains at least 3 more bytes. */
size_t i_max_len;
{
/* MPEG-2 : the PES header contains at least 3 more bytes. */
size_t i_max_len;
+ boolean_t b_has_pts, b_has_dts;
+ byte_t p_full_header[12];
p_pes->b_data_alignment = p_header[6] & 0x04;
p_pes->b_data_alignment = p_header[6] & 0x04;
- /* Re-use p_header buffer now that we don't need it. */
- i_max_len = MoveChunk( p_header, &p_data, &p_byte, 7 );
+ i_max_len = MoveChunk( p_full_header, &p_data, &p_byte, 12 );
if( i_max_len < 2 )
{
intf_WarnMsg( 3,
if( i_max_len < 2 )
{
intf_WarnMsg( 3,
- p_pes->b_has_pts = p_header[0] & 0x80;
- i_pes_header_size = p_header[1] + 9;
+ b_has_pts = p_full_header[0] & 0x80;
+ b_has_dts = p_full_header[0] & 0x40;
+ i_pes_header_size = p_full_header[1] + 9;
/* Now parse the optional header extensions */
/* Now parse the optional header extensions */
- ( ((mtime_t)(p_header[2] & 0x0E) << 29) |
- (((mtime_t)U16_AT(p_header + 3) << 14) - (1 << 14)) |
- ((mtime_t)U16_AT(p_header + 5) >> 1) ) * 300;
+ ( ((mtime_t)(p_full_header[2] & 0x0E) << 29) |
+ (((mtime_t)U16_AT(p_full_header + 3) << 14) - (1 << 14)) |
+ ((mtime_t)U16_AT(p_full_header + 5) >> 1) ) * 300;
+
+ if( b_has_dts )
+ {
+ if( i_max_len < 12 )
+ {
+ intf_WarnMsg( 3,
+ "PES packet too short to have a MPEG-2 header" );
+ p_input->p_plugin->pf_delete_pes(
+ p_input->p_method_data,
+ p_pes );
+ p_pes = NULL;
+ return;
+ }
+ p_pes->i_dts =
+ ( ((mtime_t)(p_full_header[7] & 0x0E) << 29) |
+ (((mtime_t)U16_AT(p_full_header + 10) << 14)
+ - (1 << 14)) |
+ ((mtime_t)U16_AT(p_full_header + 12) >> 1) ) * 300;
+ p_pes->i_dts /= 27;
+ }
}
}
else
{
/* Probably MPEG-1 */
}
}
else
{
/* Probably MPEG-1 */
+ boolean_t b_has_pts, b_has_dts;
+
i_pes_header_size = 6;
p_data = p_pes->p_first;
p_byte = p_data->p_payload_start;
i_pes_header_size = 6;
p_data = p_pes->p_first;
p_byte = p_data->p_payload_start;
- if( *p_byte & 0x10 )
- {
- /* DTS */
- i_pes_header_size += 5;
- }
- if( (p_pes->b_has_pts = (*p_byte & 0x20)) )
+ b_has_pts = *p_byte & 0x20;
+ b_has_dts = *p_byte & 0x10;
+
+ if( b_has_pts )
- /* PTS */
- byte_t p_pts[5];
- if( MoveChunk( p_pts, &p_data, &p_byte, 5 ) != 5 )
+ if( MoveChunk( p_ts, &p_data, &p_byte, 5 ) != 5 )
{
intf_WarnMsg( 3,
"PES packet too short to have a MPEG-1 header" );
{
intf_WarnMsg( 3,
"PES packet too short to have a MPEG-1 header" );
- ( ((mtime_t)(p_pts[0] & 0x0E) << 29) |
- (((mtime_t)U16_AT(p_pts + 1) << 14) - (1 << 14)) |
- ((mtime_t)U16_AT(p_pts + 3) >> 1) ) * 300;
+ ( ((mtime_t)(p_ts[0] & 0x0E) << 29) |
+ (((mtime_t)U16_AT(p_ts + 1) << 14) - (1 << 14)) |
+ ((mtime_t)U16_AT(p_ts + 3) >> 1) ) * 300;
+
+ if( b_has_dts )
+ {
+ i_pes_header_size += 5;
+ if( MoveChunk( p_ts, &p_data, &p_byte, 5 ) != 5 )
+ {
+ intf_WarnMsg( 3,
+ "PES packet too short to have a MPEG-1 header" );
+ p_input->p_plugin->pf_delete_pes(
+ p_input->p_method_data, p_pes );
+ p_pes = NULL;
+ return;
+ }
+
+ p_pes->i_dts =
+ ( ((mtime_t)(p_ts[0] & 0x0E) << 29) |
+ (((mtime_t)U16_AT(p_ts + 1) << 14) - (1 << 14)) |
+ ((mtime_t)U16_AT(p_ts + 3) >> 1) ) * 300;
+ p_pes->i_dts /= 27;
+ }
{
//intf_Msg("%lld", p_pes->i_pts);
switch( p_es->p_pgrm->i_synchro_state )
{
case SYNCHRO_NOT_STARTED:
case SYNCHRO_START:
{
//intf_Msg("%lld", p_pes->i_pts);
switch( p_es->p_pgrm->i_synchro_state )
{
case SYNCHRO_NOT_STARTED:
case SYNCHRO_START:
+ p_pes->i_pts = p_pes->i_dts = 0;
break;
case SYNCHRO_REINIT: /* We skip a PES | Why ?? --Meuuh */
break;
case SYNCHRO_REINIT: /* We skip a PES | Why ?? --Meuuh */
+ p_pes->i_pts = p_pes->i_dts = 0;
p_es->p_pgrm->i_synchro_state = SYNCHRO_START;
break;
p_es->p_pgrm->i_synchro_state = SYNCHRO_START;
break;
p_pes->i_pts += p_es->p_pgrm->delta_cr
+ p_es->p_pgrm->delta_absolute
+ DEFAULT_PTS_DELAY;
p_pes->i_pts += p_es->p_pgrm->delta_cr
+ p_es->p_pgrm->delta_absolute
+ DEFAULT_PTS_DELAY;
+ p_pes->i_dts += p_es->p_pgrm->delta_cr
+ + p_es->p_pgrm->delta_absolute
+ + DEFAULT_PTS_DELAY;
* lpcm_decoder_thread.c: lpcm decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* lpcm_decoder_thread.c: lpcm decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: lpcm_decoder_thread.c,v 1.6 2000/12/22 13:04:45 sam Exp $
+ * $Id: lpcm_decoder_thread.c,v 1.7 2000/12/27 18:35:45 massiot Exp $
/* have to find a synchro point */
}
/* have to find a synchro point */
}
- if (DECODER_FIFO_START(*p_lpcmdec->p_fifo)->b_has_pts)
+ if (DECODER_FIFO_START(*p_lpcmdec->p_fifo)->i_pts)
{
p_lpcmdec->p_aout_fifo->date[p_lpcmdec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(*p_lpcmdec->p_fifo)->i_pts;
{
p_lpcmdec->p_aout_fifo->date[p_lpcmdec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(*p_lpcmdec->p_fifo)->i_pts;
- DECODER_FIFO_START(*p_lpcmdec->p_fifo)->b_has_pts = 0;
+ DECODER_FIFO_START(*p_lpcmdec->p_fifo)->i_pts = 0;
* vpar_synchro.c : frame dropping routines
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* vpar_synchro.c : frame dropping routines
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: vpar_synchro.c,v 1.65 2000/12/27 18:09:02 massiot Exp $
+ * $Id: vpar_synchro.c,v 1.66 2000/12/27 18:35:45 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
if( i_coding_type == B_CODING_TYPE )
{
if( i_coding_type == B_CODING_TYPE )
{
{
if( p_pes->i_pts < p_vpar->synchro.current_pts )
{
{
if( p_pes->i_pts < p_vpar->synchro.current_pts )
{
"vpar synchro warning: pts_date < current_date" );
}
p_vpar->synchro.current_pts = p_pes->i_pts;
"vpar synchro warning: pts_date < current_date" );
}
p_vpar->synchro.current_pts = p_pes->i_pts;
p_vpar->synchro.backward_pts = 0;
}
p_vpar->synchro.backward_pts = 0;
}
{
/* Store the PTS for the next time we have to date an I picture. */
p_vpar->synchro.backward_pts = p_pes->i_pts;
{
/* Store the PTS for the next time we have to date an I picture. */
p_vpar->synchro.backward_pts = p_pes->i_pts;