Commit 6546eb71 authored by Laurent Aimar's avatar Laurent Aimar

Moved vout_synchro to decoder_synchro.

parent 02d8f9e7
/***************************************************************************** /*****************************************************************************
* vout_synchro.h: frame-dropping structures * vlc_codec_synchro.h: frame-dropping structures
* Only used in libmpeg2 decoder at the moment
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team * Copyright (C) 1999-2005 the VideoLAN team
* $Id$ * $Id$
...@@ -29,9 +28,9 @@ ...@@ -29,9 +28,9 @@
#endif #endif
/***************************************************************************** /*****************************************************************************
* vout_synchro_t : timers for the video synchro * decoder_synchro_t : timers for the video synchro
*****************************************************************************/ *****************************************************************************/
/* Read the discussion on top of vout_synchro.c for more information. */ /* Read the discussion on top of decoder_synchro.c for more information. */
/* Pictures types */ /* Pictures types */
#define I_CODING_TYPE 1 #define I_CODING_TYPE 1
#define P_CODING_TYPE 2 #define P_CODING_TYPE 2
...@@ -42,14 +41,13 @@ ...@@ -42,14 +41,13 @@
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
#define vout_SynchroInit(a,b) __vout_SynchroInit(VLC_OBJECT(a),b) VLC_EXPORT( decoder_synchro_t *, decoder_SynchroInit, ( decoder_t *, int ) );
VLC_EXPORT( vout_synchro_t *, __vout_SynchroInit, ( vlc_object_t *, int ) ); VLC_EXPORT( void, decoder_SynchroRelease, ( decoder_synchro_t * ) );
VLC_EXPORT( void, vout_SynchroRelease, ( vout_synchro_t * ) ); VLC_EXPORT( void, decoder_SynchroReset, ( decoder_synchro_t * ) );
VLC_EXPORT( void, vout_SynchroReset, ( vout_synchro_t * ) ); VLC_EXPORT( vlc_bool_t, decoder_SynchroChoose, ( decoder_synchro_t *, int, int, vlc_bool_t ) );
VLC_EXPORT( vlc_bool_t, vout_SynchroChoose, ( vout_synchro_t *, int, int, vlc_bool_t ) ); VLC_EXPORT( void, decoder_SynchroTrash, ( decoder_synchro_t * ) );
VLC_EXPORT( void, vout_SynchroTrash, ( vout_synchro_t * ) ); VLC_EXPORT( void, decoder_SynchroDecode, ( decoder_synchro_t * ) );
VLC_EXPORT( void, vout_SynchroDecode, ( vout_synchro_t * ) ); VLC_EXPORT( void, decoder_SynchroEnd, ( decoder_synchro_t *, int, vlc_bool_t ) );
VLC_EXPORT( void, vout_SynchroEnd, ( vout_synchro_t *, int, vlc_bool_t ) ); VLC_EXPORT( mtime_t, decoder_SynchroDate, ( decoder_synchro_t * ) );
VLC_EXPORT( mtime_t, vout_SynchroDate, ( vout_synchro_t * ) ); VLC_EXPORT( void, decoder_SynchroNewPicture, ( decoder_synchro_t *, int, int, mtime_t, mtime_t, int, vlc_bool_t ) );
VLC_EXPORT( void, vout_SynchroNewPicture, ( vout_synchro_t *, int, int, mtime_t, mtime_t, int, vlc_bool_t ) );
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <mpeg2dec/mpeg2.h> #include <mpeg2dec/mpeg2.h>
#include <vlc_vout_synchro.h> #include <vlc_codec_synchro.h>
/* Aspect ratio (ISO/IEC 13818-2 section 6.3.3, table 6-3) */ /* Aspect ratio (ISO/IEC 13818-2 section 6.3.3, table 6-3) */
#define AR_SQUARE_PICTURE 1 /* square pixels */ #define AR_SQUARE_PICTURE 1 /* square pixels */
...@@ -71,7 +71,7 @@ struct decoder_sys_t ...@@ -71,7 +71,7 @@ struct decoder_sys_t
/* /*
* Output properties * Output properties
*/ */
vout_synchro_t *p_synchro; decoder_synchro_t *p_synchro;
int i_aspect; int i_aspect;
int i_sar_num; int i_sar_num;
int i_sar_den; int i_sar_den;
...@@ -228,7 +228,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -228,7 +228,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->p_info->sequence && p_sys->p_info->sequence &&
p_sys->p_info->sequence->width != (unsigned)-1 ) p_sys->p_info->sequence->width != (unsigned)-1 )
{ {
vout_SynchroReset( p_sys->p_synchro ); decoder_SynchroReset( p_sys->p_synchro );
if( p_sys->p_info->current_fbuf != NULL if( p_sys->p_info->current_fbuf != NULL
&& p_sys->p_info->current_fbuf->id != NULL ) && p_sys->p_info->current_fbuf->id != NULL )
{ {
...@@ -248,11 +248,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -248,11 +248,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if ( p_sys->b_slice_i ) if ( p_sys->b_slice_i )
{ {
vout_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
vout_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
} }
} }
...@@ -264,7 +264,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -264,7 +264,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
p_sys->b_preroll = VLC_FALSE; p_sys->b_preroll = VLC_FALSE;
/* Reset synchro */ /* Reset synchro */
vout_SynchroReset( p_sys->p_synchro ); decoder_SynchroReset( p_sys->p_synchro );
} }
#ifdef PIC_FLAG_PTS #ifdef PIC_FLAG_PTS
...@@ -333,9 +333,9 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -333,9 +333,9 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->p_synchro ) if( p_sys->p_synchro )
{ {
vout_SynchroRelease( p_sys->p_synchro ); decoder_SynchroRelease( p_sys->p_synchro );
} }
p_sys->p_synchro = vout_SynchroInit( p_dec, p_sys->p_synchro = decoder_SynchroInit( p_dec,
(uint32_t)((uint64_t)1001000000 * 27 / (uint32_t)((uint64_t)1001000000 * 27 /
p_sys->p_info->sequence->frame_period) ); p_sys->p_info->sequence->frame_period) );
p_sys->b_after_sequence_header = 1; p_sys->b_after_sequence_header = 1;
...@@ -358,11 +358,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -358,11 +358,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
/* Intra-slice refresh. Simulate a blank I picture. */ /* Intra-slice refresh. Simulate a blank I picture. */
msg_Dbg( p_dec, "intra-slice refresh stream" ); msg_Dbg( p_dec, "intra-slice refresh stream" );
vout_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
vout_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
p_sys->b_slice_i = 1; p_sys->b_slice_i = 1;
} }
p_sys->b_after_sequence_header = 0; p_sys->b_after_sequence_header = 0;
...@@ -401,11 +401,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -401,11 +401,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* If nb_fields == 1, it is a field picture, and it will be /* If nb_fields == 1, it is a field picture, and it will be
* followed by another field picture for which we won't call * followed by another field picture for which we won't call
* vout_SynchroNewPicture() because this would have other * decoder_SynchroNewPicture() because this would have other
* problems, so we take it into account here. * problems, so we take it into account here.
* This kind of sucks, but I didn't think better. --Meuuh * This kind of sucks, but I didn't think better. --Meuuh
*/ */
vout_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE, p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
p_sys->p_info->current_picture->nb_fields == 1 ? 2 : p_sys->p_info->current_picture->nb_fields == 1 ? 2 :
p_sys->p_info->current_picture->nb_fields, i_pts, i_dts, p_sys->p_info->current_picture->nb_fields, i_pts, i_dts,
...@@ -416,7 +416,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -416,7 +416,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
!(p_sys->b_slice_i !(p_sys->b_slice_i
&& ((p_sys->p_info->current_picture->flags && ((p_sys->p_info->current_picture->flags
& PIC_MASK_CODING_TYPE) == P_CODING_TYPE)) & PIC_MASK_CODING_TYPE) == P_CODING_TYPE))
&& !vout_SynchroChoose( p_sys->p_synchro, && !decoder_SynchroChoose( p_sys->p_synchro,
p_sys->p_info->current_picture->flags p_sys->p_info->current_picture->flags
& PIC_MASK_CODING_TYPE, & PIC_MASK_CODING_TYPE,
/*p_sys->p_vout->render_time*/ 0 /*FIXME*/, /*p_sys->p_vout->render_time*/ 0 /*FIXME*/,
...@@ -424,14 +424,14 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -424,14 +424,14 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
mpeg2_skip( p_sys->p_mpeg2dec, 1 ); mpeg2_skip( p_sys->p_mpeg2dec, 1 );
p_sys->b_skip = 1; p_sys->b_skip = 1;
vout_SynchroTrash( p_sys->p_synchro ); decoder_SynchroTrash( p_sys->p_synchro );
mpeg2_set_buf( p_sys->p_mpeg2dec, buf, NULL ); mpeg2_set_buf( p_sys->p_mpeg2dec, buf, NULL );
} }
else else
{ {
mpeg2_skip( p_sys->p_mpeg2dec, 0 ); mpeg2_skip( p_sys->p_mpeg2dec, 0 );
p_sys->b_skip = 0; p_sys->b_skip = 0;
vout_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
if( (p_pic = GetNewPicture( p_dec, buf )) == NULL ) if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
{ {
...@@ -453,7 +453,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -453,7 +453,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
p_pic = (picture_t *)p_sys->p_info->display_fbuf->id; p_pic = (picture_t *)p_sys->p_info->display_fbuf->id;
vout_SynchroEnd( p_sys->p_synchro, decoder_SynchroEnd( p_sys->p_synchro,
p_sys->p_info->display_picture->flags p_sys->p_info->display_picture->flags
& PIC_MASK_CODING_TYPE, & PIC_MASK_CODING_TYPE,
p_sys->b_garbage_pic ); p_sys->b_garbage_pic );
...@@ -461,7 +461,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -461,7 +461,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if ( p_sys->p_picture_to_destroy != p_pic ) if ( p_sys->p_picture_to_destroy != p_pic )
{ {
p_pic->date = vout_SynchroDate( p_sys->p_synchro ); p_pic->date = decoder_SynchroDate( p_sys->p_synchro );
} }
else else
{ {
...@@ -502,7 +502,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -502,7 +502,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
( ( p_sys->p_info->current_picture->flags & ( ( p_sys->p_info->current_picture->flags &
PIC_MASK_CODING_TYPE) != B_CODING_TYPE ) ) PIC_MASK_CODING_TYPE) != B_CODING_TYPE ) )
{ {
if( p_sys->p_synchro ) vout_SynchroReset( p_sys->p_synchro ); if( p_sys->p_synchro ) decoder_SynchroReset( p_sys->p_synchro );
} }
mpeg2_skip( p_sys->p_mpeg2dec, 1 ); mpeg2_skip( p_sys->p_mpeg2dec, 1 );
p_sys->b_skip = 1; p_sys->b_skip = 1;
...@@ -538,11 +538,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -538,11 +538,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->b_slice_i ) if( p_sys->b_slice_i )
{ {
vout_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
vout_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
} }
break; break;
} }
...@@ -564,7 +564,7 @@ static void CloseDecoder( vlc_object_t *p_this ) ...@@ -564,7 +564,7 @@ static void CloseDecoder( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t *)p_this; decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
if( p_sys->p_synchro ) vout_SynchroRelease( p_sys->p_synchro ); if( p_sys->p_synchro ) decoder_SynchroRelease( p_sys->p_synchro );
if( p_sys->p_mpeg2dec ) mpeg2_close( p_sys->p_mpeg2dec ); if( p_sys->p_mpeg2dec ) mpeg2_close( p_sys->p_mpeg2dec );
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_codec.h> #include <vlc_codec.h>
#include <vlc_vout_synchro.h> #include <vlc_codec_synchro.h>
#include <unistd.h> #include <unistd.h>
#include <mcheck.h> #include <mcheck.h>
...@@ -74,7 +74,7 @@ struct decoder_sys_t ...@@ -74,7 +74,7 @@ struct decoder_sys_t
/* /*
* Output properties * Output properties
*/ */
vout_synchro_t *p_synchro; decoder_synchro_t *p_synchro;
int i_aspect; int i_aspect;
mtime_t i_last_frame_pts; mtime_t i_last_frame_pts;
...@@ -251,7 +251,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -251,7 +251,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->p_info->sequence && p_sys->p_info->sequence &&
p_sys->p_info->sequence->width != (unsigned int)-1 ) p_sys->p_info->sequence->width != (unsigned int)-1 )
{ {
vout_SynchroReset( p_sys->p_synchro ); decoder_SynchroReset( p_sys->p_synchro );
if( p_sys->p_info->current_fbuf != NULL if( p_sys->p_info->current_fbuf != NULL
&& p_sys->p_info->current_fbuf->id != NULL ) && p_sys->p_info->current_fbuf->id != NULL )
{ {
...@@ -270,11 +270,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -270,11 +270,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if ( p_sys->b_slice_i ) if ( p_sys->b_slice_i )
{ {
vout_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
vout_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
} }
} }
...@@ -377,9 +377,9 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -377,9 +377,9 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->p_synchro ) if( p_sys->p_synchro )
{ {
vout_SynchroRelease( p_sys->p_synchro ); decoder_SynchroRelease( p_sys->p_synchro );
} }
p_sys->p_synchro = vout_SynchroInit( p_dec, p_sys->p_synchro = decoder_SynchroInit( p_dec,
(uint32_t)((uint64_t)1001000000 * 27 / (uint32_t)((uint64_t)1001000000 * 27 /
p_sys->p_info->sequence->frame_period) ); p_sys->p_info->sequence->frame_period) );
p_sys->b_after_sequence_header = 1; p_sys->b_after_sequence_header = 1;
...@@ -387,7 +387,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -387,7 +387,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
break; break;
case STATE_PICTURE_2ND: case STATE_PICTURE_2ND:
vout_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE, p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
p_sys->p_info->current_picture->nb_fields, p_sys->p_info->current_picture->nb_fields,
0, 0, p_sys->i_current_rate, 0, 0, p_sys->i_current_rate,
...@@ -395,11 +395,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -395,11 +395,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->b_skip ) if( p_sys->b_skip )
{ {
vout_SynchroTrash( p_sys->p_synchro ); decoder_SynchroTrash( p_sys->p_synchro );
} }
else else
{ {
vout_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
} }
break; break;
...@@ -415,11 +415,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -415,11 +415,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
/* Intra-slice refresh. Simulate a blank I picture. */ /* Intra-slice refresh. Simulate a blank I picture. */
msg_Dbg( p_dec, "intra-slice refresh stream" ); msg_Dbg( p_dec, "intra-slice refresh stream" );
vout_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
vout_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
p_sys->b_slice_i = 1; p_sys->b_slice_i = 1;
} }
p_sys->b_after_sequence_header = 0; p_sys->b_after_sequence_header = 0;
...@@ -448,7 +448,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -448,7 +448,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block->i_pts = p_block->i_dts = 0; p_block->i_pts = p_block->i_dts = 0;
/* End hack */ /* End hack */
vout_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE, p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
p_sys->p_info->current_picture->nb_fields, i_pts, p_sys->p_info->current_picture->nb_fields, i_pts,
0, p_sys->i_current_rate, 0, p_sys->i_current_rate,
...@@ -457,7 +457,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -457,7 +457,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if ( !(p_sys->b_slice_i if ( !(p_sys->b_slice_i
&& ((p_sys->p_info->current_picture->flags && ((p_sys->p_info->current_picture->flags
& PIC_MASK_CODING_TYPE) == P_CODING_TYPE)) & PIC_MASK_CODING_TYPE) == P_CODING_TYPE))
&& !vout_SynchroChoose( p_sys->p_synchro, && !decoder_SynchroChoose( p_sys->p_synchro,
p_sys->p_info->current_picture->flags p_sys->p_info->current_picture->flags
& PIC_MASK_CODING_TYPE, & PIC_MASK_CODING_TYPE,
/*FindVout(p_dec)->render_time*/ 0 /*FIXME*/, /*FindVout(p_dec)->render_time*/ 0 /*FIXME*/,
...@@ -465,14 +465,14 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -465,14 +465,14 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
mpeg2_skip( p_sys->p_mpeg2dec, 1 ); mpeg2_skip( p_sys->p_mpeg2dec, 1 );
p_sys->b_skip = 1; p_sys->b_skip = 1;
vout_SynchroTrash( p_sys->p_synchro ); decoder_SynchroTrash( p_sys->p_synchro );
mpeg2_set_buf( p_sys->p_mpeg2dec, buf, NULL ); mpeg2_set_buf( p_sys->p_mpeg2dec, buf, NULL );
} }
else else
{ {
mpeg2_skip( p_sys->p_mpeg2dec, 0 ); mpeg2_skip( p_sys->p_mpeg2dec, 0 );
p_sys->b_skip = 0; p_sys->b_skip = 0;
vout_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
if( (p_pic = GetNewPicture( p_dec, buf )) == NULL ) if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
{ {
...@@ -506,7 +506,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -506,7 +506,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
p_pic = (picture_t *)p_sys->p_info->display_fbuf->id; p_pic = (picture_t *)p_sys->p_info->display_fbuf->id;
vout_SynchroEnd( p_sys->p_synchro, decoder_SynchroEnd( p_sys->p_synchro,
p_sys->p_info->display_picture->flags p_sys->p_info->display_picture->flags
& PIC_MASK_CODING_TYPE, & PIC_MASK_CODING_TYPE,
p_sys->b_garbage_pic ); p_sys->b_garbage_pic );
...@@ -514,7 +514,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -514,7 +514,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if ( p_sys->p_picture_to_destroy != p_pic ) if ( p_sys->p_picture_to_destroy != p_pic )
{ {
p_pic->date = vout_SynchroDate( p_sys->p_synchro ); p_pic->date = decoder_SynchroDate( p_sys->p_synchro );
} }
else else
{ {
...@@ -553,7 +553,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -553,7 +553,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
( ( p_sys->p_info->current_picture->flags & ( ( p_sys->p_info->current_picture->flags &
PIC_MASK_CODING_TYPE) != B_CODING_TYPE ) ) PIC_MASK_CODING_TYPE) != B_CODING_TYPE ) )
{ {
if( p_sys->p_synchro ) vout_SynchroReset( p_sys->p_synchro ); if( p_sys->p_synchro ) decoder_SynchroReset( p_sys->p_synchro );
} }
mpeg2_skip( p_sys->p_mpeg2dec, 1 ); mpeg2_skip( p_sys->p_mpeg2dec, 1 );
p_sys->b_skip = 1; p_sys->b_skip = 1;
...@@ -588,11 +588,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -588,11 +588,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->b_slice_i ) if( p_sys->b_slice_i )
{ {
vout_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
vout_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
} }
break; break;
} }
...@@ -613,7 +613,7 @@ static void CloseDecoder( vlc_object_t *p_this ) ...@@ -613,7 +613,7 @@ static void CloseDecoder( vlc_object_t *p_this )
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
FILE *f_wd_dec; FILE *f_wd_dec;
if( p_sys->p_synchro ) vout_SynchroRelease( p_sys->p_synchro ); if( p_sys->p_synchro ) decoder_SynchroRelease( p_sys->p_synchro );
if( p_sys->p_mpeg2dec ) mpeg2_close( p_sys->p_mpeg2dec ); if( p_sys->p_mpeg2dec ) mpeg2_close( p_sys->p_mpeg2dec );
f_wd_dec = fopen("/vlc/dec_pid", "w"); f_wd_dec = fopen("/vlc/dec_pid", "w");
......
...@@ -39,6 +39,7 @@ HEADERS_include = \ ...@@ -39,6 +39,7 @@ HEADERS_include = \
../include/vlc_block_helper.h \ ../include/vlc_block_helper.h \
../include/vlc_charset.h \ ../include/vlc_charset.h \
../include/vlc_codec.h \ ../include/vlc_codec.h \
../include/vlc_codec_synchro.h \
../include/vlc_codecs.h \ ../include/vlc_codecs.h \
../include/vlc_common.h \ ../include/vlc_common.h \
../include/vlc_config.h \ ../include/vlc_config.h \
...@@ -82,7 +83,6 @@ HEADERS_include = \ ...@@ -82,7 +83,6 @@ HEADERS_include = \
../include/vlc_vlm.h \ ../include/vlc_vlm.h \
../include/vlc_vod.h \ ../include/vlc_vod.h \
../include/vlc_vout.h \ ../include/vlc_vout.h \
../include/vlc_vout_synchro.h \
../include/vlc_xml.h \ ../include/vlc_xml.h \
$(NULL) $(NULL)
...@@ -223,6 +223,7 @@ SOURCES_libvlc_common = \ ...@@ -223,6 +223,7 @@ SOURCES_libvlc_common = \
input/clock.c \ input/clock.c \
input/control.c \ input/control.c \
input/decoder.c \ input/decoder.c \
input/decoder_synchro.c \
input/demux.c \ input/demux.c \
input/es_out.c \ input/es_out.c \
input/input.c \ input/input.c \
...@@ -239,7 +240,6 @@ SOURCES_libvlc_common = \ ...@@ -239,7 +240,6 @@ SOURCES_libvlc_common = \
video_output/video_text.c \ video_output/video_text.c \
video_output/video_widgets.c \ video_output/video_widgets.c \
video_output/vout_subpictures.c \ video_output/vout_subpictures.c \
video_output/vout_synchro.c \
video_output/vout_intf.c \ video_output/vout_intf.c \
audio_output/aout_internal.h \ audio_output/aout_internal.h \
audio_output/common.c \ audio_output/common.c \
......
/***************************************************************************** /*****************************************************************************
* vout_synchro.c : frame dropping routines * decoder_synchro.c : frame dropping routines
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team * Copyright (C) 1999-2005 the VideoLAN team
* $Id$ * $Id$
...@@ -95,9 +95,8 @@ ...@@ -95,9 +95,8 @@
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc_vout.h>
#include <vlc_input.h> #include <vlc_input.h>
#include <vlc_vout_synchro.h> #include <vlc_codec_synchro.h>
/* /*
* Local prototypes * Local prototypes
...@@ -105,7 +104,7 @@ ...@@ -105,7 +104,7 @@
#define MAX_PIC_AVERAGE 8 #define MAX_PIC_AVERAGE 8
struct vout_synchro_t struct decoder_synchro_t
{ {
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
...@@ -152,22 +151,22 @@ struct vout_synchro_t ...@@ -152,22 +151,22 @@ struct vout_synchro_t
#define DEFAULT_NB_B 1 #define DEFAULT_NB_B 1
/***************************************************************************** /*****************************************************************************
* vout_SynchroInit : You know what ? * decoder_SynchroInit : You know what ?
*****************************************************************************/ *****************************************************************************/
vout_synchro_t * __vout_SynchroInit( vlc_object_t * p_object, decoder_synchro_t * decoder_SynchroInit( decoder_t *p_dec,
int i_frame_rate ) int i_frame_rate )
{ {
vout_synchro_t * p_synchro = vlc_object_create( p_object, decoder_synchro_t * p_synchro = vlc_object_create( p_dec,
sizeof(vout_synchro_t) ); sizeof(decoder_synchro_t) );
if ( p_synchro == NULL ) if ( p_synchro == NULL )
{ {
msg_Err( p_object, "out of memory" ); msg_Err( p_dec, "out of memory" );
return NULL; return NULL;
} }
vlc_object_attach( p_synchro, p_object ); vlc_object_attach( p_synchro, p_dec );
p_synchro->b_no_skip = !config_GetInt( p_object, "skip-frames" ); p_synchro->b_no_skip = !config_GetInt( p_dec, "skip-frames" );
p_synchro->b_quiet = config_GetInt( p_object, "quiet-synchro" ); p_synchro->b_quiet = config_GetInt( p_dec, "quiet-synchro" );
/* We use a fake stream pattern, which is often right. */ /* We use a fake stream pattern, which is often right. */
p_synchro->i_n_p = p_synchro->i_eta_p = DEFAULT_NB_P; p_synchro->i_n_p = p_synchro->i_eta_p = DEFAULT_NB_P;
...@@ -188,27 +187,27 @@ vout_synchro_t * __vout_SynchroInit( vlc_object_t * p_object, ...@@ -188,27 +187,27 @@ vout_synchro_t * __vout_SynchroInit( vlc_object_t * p_object,
} }
/***************************************************************************** /*****************************************************************************
* vout_SynchroRelease : You know what ? * decoder_SynchroRelease : You know what ?
*****************************************************************************/ *****************************************************************************/
void vout_SynchroRelease( vout_synchro_t * p_synchro ) void decoder_SynchroRelease( decoder_synchro_t * p_synchro )
{ {
vlc_object_detach( p_synchro ); vlc_object_detach( p_synchro );
vlc_object_destroy( p_synchro ); vlc_object_destroy( p_synchro );
} }
/***************************************************************************** /*****************************************************************************
* vout_SynchroReset : Reset the reference picture counter * decoder_SynchroReset : Reset the reference picture counter
*****************************************************************************/ *****************************************************************************/
void vout_SynchroReset( vout_synchro_t * p_synchro ) void decoder_SynchroReset( decoder_synchro_t * p_synchro )
{ {
p_synchro->i_nb_ref = 0; p_synchro->i_nb_ref = 0;
p_synchro->i_trash_nb_ref = p_synchro->i_dec_nb_ref = 0; p_synchro->i_trash_nb_ref = p_synchro->i_dec_nb_ref = 0;
} }
/***************************************************************************** /*****************************************************************************
* vout_SynchroChoose : Decide whether we will decode a picture or not * decoder_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 decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
int i_render_time, vlc_bool_t b_low_delay ) int i_render_time, vlc_bool_t b_low_delay )
{ {
#define TAU_PRIME( coding_type ) (p_synchro->p_tau[(coding_type)] \ #define TAU_PRIME( coding_type ) (p_synchro->p_tau[(coding_type)] \
...@@ -335,27 +334,27 @@ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type, ...@@ -335,27 +334,27 @@ vlc_bool_t vout_SynchroChoose( vout_synchro_t * p_synchro, int i_coding_type,
} }
/***************************************************************************** /*****************************************************************************
* vout_SynchroTrash : Update counters when we trash a picture * decoder_SynchroTrash : Update counters when we trash a picture
*****************************************************************************/ *****************************************************************************/
void vout_SynchroTrash( vout_synchro_t * p_synchro ) void decoder_SynchroTrash( decoder_synchro_t * p_synchro )
{ {
p_synchro->i_trashed_pic++; p_synchro->i_trashed_pic++;
p_synchro->i_nb_ref = p_synchro->i_trash_nb_ref; p_synchro->i_nb_ref = p_synchro->i_trash_nb_ref;
} }
/***************************************************************************** /*****************************************************************************
* vout_SynchroDecode : Update timers when we decide to decode a picture * decoder_SynchroDecode : Update timers when we decide to decode a picture
*****************************************************************************/ *****************************************************************************/
void vout_SynchroDecode( vout_synchro_t * p_synchro ) void decoder_SynchroDecode( decoder_synchro_t * p_synchro )
{ {
p_synchro->decoding_start = mdate(); p_synchro->decoding_start = mdate();
p_synchro->i_nb_ref = p_synchro->i_dec_nb_ref; p_synchro->i_nb_ref = p_synchro->i_dec_nb_ref;
} }
/***************************************************************************** /*****************************************************************************
* vout_SynchroEnd : Called when the image is totally decoded * decoder_SynchroEnd : Called when the image is totally decoded
*****************************************************************************/ *****************************************************************************/
void vout_SynchroEnd( vout_synchro_t * p_synchro, int i_coding_type, void decoder_SynchroEnd( decoder_synchro_t * p_synchro, int i_coding_type,
vlc_bool_t b_garbage ) vlc_bool_t b_garbage )
{ {
mtime_t tau; mtime_t tau;
...@@ -384,18 +383,18 @@ void vout_SynchroEnd( vout_synchro_t * p_synchro, int i_coding_type, ...@@ -384,18 +383,18 @@ void vout_SynchroEnd( vout_synchro_t * p_synchro, int i_coding_type,
} }
/***************************************************************************** /*****************************************************************************
* vout_SynchroDate : When an image has been decoded, ask for its date * decoder_SynchroDate : When an image has been decoded, ask for its date
*****************************************************************************/ *****************************************************************************/
mtime_t vout_SynchroDate( vout_synchro_t * p_synchro ) mtime_t decoder_SynchroDate( decoder_synchro_t * p_synchro )
{ {
/* No need to lock, since PTS are only used by the video parser. */ /* No need to lock, since PTS are only used by the video parser. */
return p_synchro->current_pts; return p_synchro->current_pts;
} }
/***************************************************************************** /*****************************************************************************
* vout_SynchroNewPicture: Update stream structure and PTS * decoder_SynchroNewPicture: Update stream structure and PTS
*****************************************************************************/ *****************************************************************************/
void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type, void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type,
int i_repeat_field, mtime_t next_pts, int i_repeat_field, mtime_t next_pts,
mtime_t next_dts, int i_current_rate, mtime_t next_dts, int i_current_rate,
vlc_bool_t b_low_delay ) vlc_bool_t b_low_delay )
...@@ -501,7 +500,7 @@ void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type, ...@@ -501,7 +500,7 @@ void vout_SynchroNewPicture( vout_synchro_t * p_synchro, int i_coding_type,
|| p_synchro->current_pts - next_pts || p_synchro->current_pts - next_pts
> PTS_THRESHOLD) && !p_synchro->b_quiet ) > PTS_THRESHOLD) && !p_synchro->b_quiet )
{ {
msg_Warn( p_synchro, "vout synchro warning: pts != " msg_Warn( p_synchro, "decoder synchro warning: pts != "
"current_date ("I64Fd")", "current_date ("I64Fd")",
p_synchro->current_pts p_synchro->current_pts
- next_pts ); - next_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