Commit ed6c9819 authored by Gildas Bazin's avatar Gildas Bazin

* src/video_output/vout_synchro.c, include/vout_synchro.h: got rid of the dependency on the vout.
* modules/codec/libmpeg2.c: updated with the synchro api changes.
parent d9f10b40
......@@ -2,7 +2,7 @@
* vout_synchro.h: frame-dropping structures
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
* $Id: vout_synchro.h,v 1.2 2003/06/09 00:33:34 massiot Exp $
* $Id: vout_synchro.h,v 1.3 2003/11/04 17:46:18 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -46,7 +46,9 @@ struct vout_synchro_t
/* decoding values */
mtime_t p_tau[4]; /* average decoding durations */
unsigned int pi_meaningful[4]; /* number of durations read */
/* and p_vout->render_time (read with p_vout->change_lock) */
/* render_time filled by SynchroChoose() */
int i_render_time;
/* stream context */
int i_nb_ref; /* Number of reference pictures */
......@@ -80,11 +82,11 @@ struct vout_synchro_t
/*****************************************************************************
* Prototypes
*****************************************************************************/
#define vout_SynchroInit(a,b,c) __vout_SynchroInit(VLC_OBJECT(a),b,c)
VLC_EXPORT( vout_synchro_t *, __vout_SynchroInit, ( vlc_object_t *, vout_thread_t *, int ) );
#define vout_SynchroInit(a,b) __vout_SynchroInit(VLC_OBJECT(a),b)
VLC_EXPORT( vout_synchro_t *, __vout_SynchroInit, ( vlc_object_t *, int ) );
VLC_EXPORT( void, vout_SynchroRelease, ( vout_synchro_t * ) );
VLC_EXPORT( void, vout_SynchroReset, ( vout_synchro_t * ) );
VLC_EXPORT( vlc_bool_t, vout_SynchroChoose, ( vout_synchro_t *, int ) );
VLC_EXPORT( vlc_bool_t, vout_SynchroChoose, ( vout_synchro_t *, int, int ) );
VLC_EXPORT( void, vout_SynchroTrash, ( vout_synchro_t * ) );
VLC_EXPORT( void, vout_SynchroDecode, ( vout_synchro_t * ) );
VLC_EXPORT( void, vout_SynchroEnd, ( vout_synchro_t *, int, vlc_bool_t ) );
......
......@@ -2,7 +2,7 @@
* libmpeg2.c: mpeg2 video decoder module making use of libmpeg2.
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: libmpeg2.c,v 1.31 2003/10/25 00:49:13 sam Exp $
* $Id: libmpeg2.c,v 1.32 2003/11/04 17:46:17 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -352,7 +352,7 @@ static int RunDecoder( decoder_t *p_dec, block_t *p_block )
{
vout_SynchroRelease( p_sys->p_synchro );
}
p_sys->p_synchro = vout_SynchroInit( p_dec, p_sys->p_vout,
p_sys->p_synchro = vout_SynchroInit( p_dec,
(uint32_t)((uint64_t)1001000000 * 27 /
p_sys->p_info->sequence->frame_period) );
p_sys->b_after_sequence_header = 1;
......@@ -410,7 +410,8 @@ static int RunDecoder( decoder_t *p_dec, block_t *p_block )
& PIC_MASK_CODING_TYPE) == P_CODING_TYPE))
&& !vout_SynchroChoose( p_sys->p_synchro,
p_sys->p_info->current_picture->flags
& PIC_MASK_CODING_TYPE ) )
& PIC_MASK_CODING_TYPE,
p_sys->p_vout->render_time ) )
{
mpeg2_skip( p_sys->p_mpeg2dec, 1 );
p_sys->b_skip = 1;
......
......@@ -2,7 +2,7 @@
* vout_synchro.c : frame dropping routines
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vout_synchro.c,v 1.4 2003/10/17 18:38:47 gbazin Exp $
* $Id: vout_synchro.c,v 1.5 2003/11/04 17:46:18 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -118,7 +118,7 @@
* vout_SynchroInit : You know what ?
*****************************************************************************/
vout_synchro_t * __vout_SynchroInit( vlc_object_t * p_object,
vout_thread_t * p_vout, int i_frame_rate )
int i_frame_rate )
{
vout_synchro_t * p_synchro = vlc_object_create( p_object,
sizeof(vout_synchro_t) );
......@@ -143,7 +143,6 @@ vout_synchro_t * __vout_SynchroInit( vlc_object_t * p_object,
p_synchro->i_pic = 0;
p_synchro->i_frame_rate = i_frame_rate;
p_synchro->p_vout = p_vout;
return p_synchro;
}
......@@ -169,14 +168,15 @@ void vout_SynchroReset( vout_synchro_t * p_synchro )
/*****************************************************************************
* vout_SynchroChoose : Decide whether we will decode a picture or not
*****************************************************************************/
vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type )
vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type,
int i_render_time )
{
#define TAU_PRIME( coding_type ) (p_synchro->p_tau[(coding_type)] \
+ (p_synchro->p_tau[(coding_type)] >> 1) \
+ tau_yuv)
+ p_synchro->i_render_time)
#define S (*p_synchro)
/* VPAR_SYNCHRO_DEFAULT */
mtime_t now, period, tau_yuv;
mtime_t now, period;
mtime_t pts = 0;
vlc_bool_t b_decode = 0;
......@@ -184,9 +184,7 @@ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type )
period = 1000000 * 1001 / p_synchro->i_frame_rate
* p_synchro->i_current_rate / DEFAULT_RATE;
vlc_mutex_lock( &p_synchro->p_vout->change_lock );
tau_yuv = p_synchro->p_vout->render_time;
vlc_mutex_unlock( &p_synchro->p_vout->change_lock );
p_synchro->i_render_time = i_render_time;
switch( i_coding_type )
{
......@@ -384,7 +382,7 @@ void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type,
p_synchro->i_n_p,
p_synchro->p_tau[B_CODING_TYPE],
p_synchro->i_n_b,
p_synchro->p_vout->render_time,
p_synchro->i_render_time,
p_synchro->i_not_chosen_pic,
p_synchro->i_trashed_pic -
p_synchro->i_not_chosen_pic,
......
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