Commit 2f64eb29 authored by Christophe Massiot's avatar Christophe Massiot

* Fixed a bug in the frame rate handling ;

* Fixed a bug in the DTS/PTS ordering.
Our pts are _at last_ accurate.
parent 3a3f1725
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vpar_synchro.h : video parser blocks management * vpar_synchro.h : video parser blocks management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_synchro.h,v 1.5 2001/01/15 18:02:49 massiot Exp $ * $Id: vpar_synchro.h,v 1.6 2001/01/15 19:54:34 massiot Exp $
* *
* Author: Christophe Massiot <massiot@via.ecp.fr> * Author: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -64,7 +64,9 @@ typedef struct video_synchro_s ...@@ -64,7 +64,9 @@ typedef struct video_synchro_s
unsigned int i_eta_p, i_eta_b; unsigned int i_eta_p, i_eta_b;
boolean_t b_dropped_last; /* for special synchros below */ boolean_t b_dropped_last; /* for special synchros below */
mtime_t backward_pts, current_pts; mtime_t backward_pts, current_pts;
mtime_t next_period; /* period to add to the next picture */ mtime_t current_period; /* period to add to the next picture */
mtime_t backward_period; /* period to add after the next
* reference picture */
#ifdef STATS #ifdef STATS
unsigned int i_trashed_pic, i_not_chosen_pic, i_pic; unsigned int i_trashed_pic, i_not_chosen_pic, i_pic;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing * vpar_headers.c : headers parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_headers.c,v 1.69 2001/01/15 18:02:49 massiot Exp $ * $Id: vpar_headers.c,v 1.70 2001/01/15 19:54:34 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -565,7 +565,8 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -565,7 +565,8 @@ static void PictureHeader( vpar_thread_t * p_vpar )
p_vpar->picture.b_q_scale_type = 0; p_vpar->picture.b_q_scale_type = 0;
p_vpar->picture.b_intra_vlc_format = 0; p_vpar->picture.b_intra_vlc_format = 0;
p_vpar->picture.b_alternate_scan = 0; /* zigzag */ p_vpar->picture.b_alternate_scan = 0; /* zigzag */
p_vpar->picture.b_repeat_first_field = 1; p_vpar->picture.b_repeat_first_field = 1; /* FIXME! this contradicts
* ISO/IEC */
p_vpar->picture.b_progressive = 1; p_vpar->picture.b_progressive = 1;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vpar_synchro.c : frame dropping routines * vpar_synchro.c : frame dropping routines
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_synchro.c,v 1.73 2001/01/15 18:02:49 massiot Exp $ * $Id: vpar_synchro.c,v 1.74 2001/01/15 19:54:34 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -150,7 +150,8 @@ void vpar_SynchroInit( vpar_thread_t * p_vpar ) ...@@ -150,7 +150,8 @@ void vpar_SynchroInit( vpar_thread_t * p_vpar )
memset( p_vpar->synchro.pi_meaningful, 0, 4 * sizeof(unsigned int) ); memset( p_vpar->synchro.pi_meaningful, 0, 4 * sizeof(unsigned int) );
p_vpar->synchro.b_dropped_last = 0; p_vpar->synchro.b_dropped_last = 0;
p_vpar->synchro.current_pts = mdate() + DEFAULT_PTS_DELAY; p_vpar->synchro.current_pts = mdate() + DEFAULT_PTS_DELAY;
p_vpar->synchro.backward_pts = p_vpar->synchro.next_period = 0; p_vpar->synchro.backward_pts = p_vpar->synchro.current_period =
p_vpar->synchro.backward_period = 0;
#ifdef STATS #ifdef STATS
p_vpar->synchro.i_trashed_pic = p_vpar->synchro.i_not_chosen_pic = p_vpar->synchro.i_trashed_pic = p_vpar->synchro.i_not_chosen_pic =
p_vpar->synchro.i_pic = 0; p_vpar->synchro.i_pic = 0;
...@@ -228,7 +229,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -228,7 +229,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
#endif #endif
now = mdate(); now = mdate();
period = 1000000 / (p_vpar->sequence.i_frame_rate) * 1001; period = 1000000 * 1001 / p_vpar->sequence.i_frame_rate;
vlc_mutex_lock( &p_vpar->p_vout->change_lock ); vlc_mutex_lock( &p_vpar->p_vout->change_lock );
tau_yuv = p_vpar->p_vout->render_time; tau_yuv = p_vpar->p_vout->render_time;
...@@ -420,7 +421,7 @@ mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar ) ...@@ -420,7 +421,7 @@ mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type, void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
int i_repeat_field ) int i_repeat_field )
{ {
mtime_t period = 1000000 / (p_vpar->sequence.i_frame_rate) * 1001; mtime_t period = 1000000 * 1001 / p_vpar->sequence.i_frame_rate;
switch( i_coding_type ) switch( i_coding_type )
{ {
...@@ -468,16 +469,16 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -468,16 +469,16 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
break; break;
} }
p_vpar->synchro.current_pts += p_vpar->synchro.next_period; p_vpar->synchro.current_pts += p_vpar->synchro.current_period;
/* A video frame can be displayed 1, 2 or 3 times, according to
* repeat_first_field, top_field_first, progressive_sequence and
* progressive_frame. */
p_vpar->synchro.next_period = i_repeat_field * (period >> 1);
#define PTS_THRESHOLD (period >> 2) #define PTS_THRESHOLD (period >> 2)
if( i_coding_type == B_CODING_TYPE ) if( i_coding_type == B_CODING_TYPE )
{ {
/* A video frame can be displayed 1, 2 or 3 times, according to
* repeat_first_field, top_field_first, progressive_sequence and
* progressive_frame. */
p_vpar->synchro.current_period = i_repeat_field * (period >> 1);
if( p_vpar->sequence.next_pts ) if( p_vpar->sequence.next_pts )
{ {
if( p_vpar->sequence.next_pts - p_vpar->synchro.current_pts if( p_vpar->sequence.next_pts - p_vpar->synchro.current_pts
...@@ -496,6 +497,9 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -496,6 +497,9 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
} }
else else
{ {
p_vpar->synchro.current_period = p_vpar->synchro.backward_period;
p_vpar->synchro.backward_period = i_repeat_field * (period >> 1);
if( p_vpar->synchro.backward_pts ) if( p_vpar->synchro.backward_pts )
{ {
if( p_vpar->sequence.next_dts && if( p_vpar->sequence.next_dts &&
...@@ -506,10 +510,9 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type, ...@@ -506,10 +510,9 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
{ {
intf_WarnMsg( 2, intf_WarnMsg( 2,
"vpar synchro warning: backward_pts != dts (%lld)", "vpar synchro warning: backward_pts != dts (%lld)",
p_vpar->synchro.backward_pts p_vpar->sequence.next_dts
- p_vpar->sequence.next_dts ); - p_vpar->synchro.backward_pts );
} }
if( p_vpar->synchro.backward_pts - p_vpar->synchro.current_pts if( p_vpar->synchro.backward_pts - p_vpar->synchro.current_pts
> PTS_THRESHOLD > PTS_THRESHOLD
|| p_vpar->synchro.current_pts - p_vpar->synchro.backward_pts || p_vpar->synchro.current_pts - p_vpar->synchro.backward_pts
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment