/*****************************************************************************
- * vout_synchro.h: frame-dropping structures
- * Only used in libmpeg2 decoder at the moment
+ * vlc_codec_synchro.h: frame-dropping structures
*****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team
* $Id$
#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 */
#define I_CODING_TYPE 1
#define P_CODING_TYPE 2
/*****************************************************************************
* Prototypes
*****************************************************************************/
-#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, int, vlc_bool_t ) );
-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 ) );
-VLC_EXPORT( mtime_t, vout_SynchroDate, ( vout_synchro_t * ) );
-VLC_EXPORT( void, vout_SynchroNewPicture, ( vout_synchro_t *, int, int, mtime_t, mtime_t, int, vlc_bool_t ) );
+VLC_EXPORT( decoder_synchro_t *, decoder_SynchroInit, ( decoder_t *, int ) );
+VLC_EXPORT( void, decoder_SynchroRelease, ( decoder_synchro_t * ) );
+VLC_EXPORT( void, decoder_SynchroReset, ( decoder_synchro_t * ) );
+VLC_EXPORT( vlc_bool_t, decoder_SynchroChoose, ( decoder_synchro_t *, int, int, vlc_bool_t ) );
+VLC_EXPORT( void, decoder_SynchroTrash, ( decoder_synchro_t * ) );
+VLC_EXPORT( void, decoder_SynchroDecode, ( decoder_synchro_t * ) );
+VLC_EXPORT( void, decoder_SynchroEnd, ( decoder_synchro_t *, int, vlc_bool_t ) );
+VLC_EXPORT( mtime_t, decoder_SynchroDate, ( decoder_synchro_t * ) );
+VLC_EXPORT( void, decoder_SynchroNewPicture, ( decoder_synchro_t *, int, int, mtime_t, mtime_t, int, vlc_bool_t ) );
#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) */
#define AR_SQUARE_PICTURE 1 /* square pixels */
/*
* Output properties
*/
- vout_synchro_t *p_synchro;
+ decoder_synchro_t *p_synchro;
int i_aspect;
int i_sar_num;
int i_sar_den;
p_sys->p_info->sequence &&
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
&& p_sys->p_info->current_fbuf->id != NULL )
{
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,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
- vout_SynchroDecode( p_sys->p_synchro );
- vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
+ decoder_SynchroDecode( p_sys->p_synchro );
+ decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
}
}
{
p_sys->b_preroll = VLC_FALSE;
/* Reset synchro */
- vout_SynchroReset( p_sys->p_synchro );
+ decoder_SynchroReset( p_sys->p_synchro );
}
#ifdef PIC_FLAG_PTS
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 /
p_sys->p_info->sequence->frame_period) );
p_sys->b_after_sequence_header = 1;
{
/* Intra-slice refresh. Simulate a blank I picture. */
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,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
- vout_SynchroDecode( p_sys->p_synchro );
- vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
+ decoder_SynchroDecode( p_sys->p_synchro );
+ decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
p_sys->b_slice_i = 1;
}
p_sys->b_after_sequence_header = 0;
/* If nb_fields == 1, it is a field picture, and it will be
* 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.
* 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->nb_fields == 1 ? 2 :
p_sys->p_info->current_picture->nb_fields, i_pts, i_dts,
!(p_sys->b_slice_i
&& ((p_sys->p_info->current_picture->flags
& 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
& PIC_MASK_CODING_TYPE,
/*p_sys->p_vout->render_time*/ 0 /*FIXME*/,
{
mpeg2_skip( p_sys->p_mpeg2dec, 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 );
}
else
{
mpeg2_skip( p_sys->p_mpeg2dec, 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 )
{
{
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
& PIC_MASK_CODING_TYPE,
p_sys->b_garbage_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
{
( ( p_sys->p_info->current_picture->flags &
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 );
p_sys->b_skip = 1;
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,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
- vout_SynchroDecode( p_sys->p_synchro );
- vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
+ decoder_SynchroDecode( p_sys->p_synchro );
+ decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
}
break;
}
decoder_t *p_dec = (decoder_t *)p_this;
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 );
#include <vlc/vlc.h>
#include <vlc_vout.h>
#include <vlc_codec.h>
-#include <vlc_vout_synchro.h>
+#include <vlc_codec_synchro.h>
#include <unistd.h>
#include <mcheck.h>
/*
* Output properties
*/
- vout_synchro_t *p_synchro;
+ decoder_synchro_t *p_synchro;
int i_aspect;
mtime_t i_last_frame_pts;
p_sys->p_info->sequence &&
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
&& p_sys->p_info->current_fbuf->id != NULL )
{
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,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
- vout_SynchroDecode( p_sys->p_synchro );
- vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
+ decoder_SynchroDecode( p_sys->p_synchro );
+ decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
}
}
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 /
p_sys->p_info->sequence->frame_period) );
p_sys->b_after_sequence_header = 1;
break;
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->nb_fields,
0, 0, p_sys->i_current_rate,
if( p_sys->b_skip )
{
- vout_SynchroTrash( p_sys->p_synchro );
+ decoder_SynchroTrash( p_sys->p_synchro );
}
else
{
- vout_SynchroDecode( p_sys->p_synchro );
+ decoder_SynchroDecode( p_sys->p_synchro );
}
break;
{
/* Intra-slice refresh. Simulate a blank I picture. */
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,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
- vout_SynchroDecode( p_sys->p_synchro );
- vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
+ decoder_SynchroDecode( p_sys->p_synchro );
+ decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
p_sys->b_slice_i = 1;
}
p_sys->b_after_sequence_header = 0;
p_block->i_pts = p_block->i_dts = 0;
/* 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->nb_fields, i_pts,
0, p_sys->i_current_rate,
if ( !(p_sys->b_slice_i
&& ((p_sys->p_info->current_picture->flags
& 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
& PIC_MASK_CODING_TYPE,
/*FindVout(p_dec)->render_time*/ 0 /*FIXME*/,
{
mpeg2_skip( p_sys->p_mpeg2dec, 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 );
}
else
{
mpeg2_skip( p_sys->p_mpeg2dec, 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 )
{
{
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
& PIC_MASK_CODING_TYPE,
p_sys->b_garbage_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
{
( ( p_sys->p_info->current_picture->flags &
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 );
p_sys->b_skip = 1;
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,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
- vout_SynchroDecode( p_sys->p_synchro );
- vout_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
+ decoder_SynchroDecode( p_sys->p_synchro );
+ decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
}
break;
}
decoder_sys_t *p_sys = p_dec->p_sys;
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 );
f_wd_dec = fopen("/vlc/dec_pid", "w");
../include/vlc_block_helper.h \
../include/vlc_charset.h \
../include/vlc_codec.h \
+ ../include/vlc_codec_synchro.h \
../include/vlc_codecs.h \
../include/vlc_common.h \
../include/vlc_config.h \
../include/vlc_vlm.h \
../include/vlc_vod.h \
../include/vlc_vout.h \
- ../include/vlc_vout_synchro.h \
../include/vlc_xml.h \
$(NULL)
input/clock.c \
input/control.c \
input/decoder.c \
+ input/decoder_synchro.c \
input/demux.c \
input/es_out.c \
input/input.c \
video_output/video_text.c \
video_output/video_widgets.c \
video_output/vout_subpictures.c \
- video_output/vout_synchro.c \
video_output/vout_intf.c \
audio_output/aout_internal.h \
audio_output/common.c \
/*****************************************************************************
- * vout_synchro.c : frame dropping routines
+ * decoder_synchro.c : frame dropping routines
*****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team
* $Id$
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
-#include <vlc_vout.h>
#include <vlc_input.h>
-#include <vlc_vout_synchro.h>
+#include <vlc_codec_synchro.h>
/*
* Local prototypes
#define MAX_PIC_AVERAGE 8
-struct vout_synchro_t
+struct decoder_synchro_t
{
VLC_COMMON_MEMBERS
#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 )
{
- vout_synchro_t * p_synchro = vlc_object_create( p_object,
- sizeof(vout_synchro_t) );
+ decoder_synchro_t * p_synchro = vlc_object_create( p_dec,
+ sizeof(decoder_synchro_t) );
if ( p_synchro == NULL )
{
- msg_Err( p_object, "out of memory" );
+ msg_Err( p_dec, "out of memory" );
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_quiet = config_GetInt( p_object, "quiet-synchro" );
+ p_synchro->b_no_skip = !config_GetInt( p_dec, "skip-frames" );
+ p_synchro->b_quiet = config_GetInt( p_dec, "quiet-synchro" );
/* We use a fake stream pattern, which is often right. */
p_synchro->i_n_p = p_synchro->i_eta_p = DEFAULT_NB_P;
}
/*****************************************************************************
- * 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_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_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 )
{
#define TAU_PRIME( coding_type ) (p_synchro->p_tau[(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_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->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 )
{
mtime_t tau;
}
/*****************************************************************************
- * 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. */
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,
mtime_t next_dts, int i_current_rate,
vlc_bool_t b_low_delay )
|| p_synchro->current_pts - next_pts
> 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")",
p_synchro->current_pts
- next_pts );