Commit 2613ac41 authored by Christophe Massiot's avatar Christophe Massiot

* input: new cr-average option, allowing to configure the

  CR_AVERAGE #define in input_clock.c (useful for PVR input)
* modules/codec/ffmpeg/encoder.c, modules/stream_out/transcode.c : fixes
  for older version of ffmpeg
* modules/stream_out/transrate/transrate.c : misc optimizations
parent 55bb1c7a
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.100 2003/11/24 00:39:00 fenrir Exp $
* $Id: input_ext-intf.h,v 1.101 2003/11/29 18:36:13 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -309,6 +309,7 @@ struct input_thread_t
access_sys_t * p_access_data;
size_t i_mtu;
int i_pts_delay; /* internal caching */
int i_cr_average;
/* Stream */
stream_t *s;
......
......@@ -2,7 +2,7 @@
* encoder.c: video and audio encoder using the ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: encoder.c,v 1.16 2003/11/29 18:06:12 fenrir Exp $
* $Id: encoder.c,v 1.17 2003/11/29 18:36:13 massiot Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -326,7 +326,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
frame.pict_type = 0;
frame.repeat_pict = p_pict->i_nb_fields;
#if LIBAVCODEC_BUILD >= 468
#if LIBAVCODEC_BUILD >= 4684
frame.interlaced_frame = !p_pict->b_progressive;
frame.top_field_first = p_pict->b_top_field_first;
#endif
......
......@@ -2,7 +2,7 @@
* transcode.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: transcode.c,v 1.55 2003/11/27 22:44:51 massiot Exp $
* $Id: transcode.c,v 1.56 2003/11/29 18:36:13 massiot Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -1383,7 +1383,9 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
pic.b_progressive = 1; /* ffmpeg doesn't support interlaced encoding */
pic.i_nb_fields = frame->repeat_pict;
#if LIBAVCODEC_BUILD >= 4684
pic.b_top_field_first = frame->top_field_first;
#endif
/* Interpolate the next PTS
* (needed by the mpeg video packetizer which can send pts <= 0 ) */
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: input.c,v 1.267 2003/11/28 17:04:31 fenrir Exp $
* $Id: input.c,v 1.268 2003/11/29 18:36:13 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -180,6 +180,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
p_input->pf_demux = NULL;
p_input->pf_rewind = NULL;
p_input->pf_demux_control = NULL;
p_input->i_cr_average = config_GetInt( p_input, "cr-average" );
/* Access */
p_input->p_access = NULL;
......
......@@ -2,7 +2,7 @@
* input_clock.c: Clock/System date convertions, stream management
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_clock.c,v 1.42 2003/09/07 22:51:11 fenrir Exp $
* $Id: input_clock.c,v 1.43 2003/11/29 18:36:13 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -61,6 +61,12 @@
* in all the FIFOs, but it may be not enough.
*/
/* p_input->i_cr_average : Maximum number of samples used to compute the
* dynamic average value.
* We use the following formula :
* new_average = (old_average * c_average + new_sample_value) / (c_average +1)
*/
static void ClockNewRef( pgrm_descriptor_t * p_pgrm,
mtime_t i_clock, mtime_t i_sysdate );
......@@ -68,12 +74,6 @@ static void ClockNewRef( pgrm_descriptor_t * p_pgrm,
* Constants
*****************************************************************************/
/* Maximum number of samples used to compute the dynamic average value.
* We use the following formula :
* new_average = (old_average * c_average + new_sample_value) / (c_average +1)
*/
#define CR_MAX_AVERAGE_COUNTER 40
/* Maximum gap allowed between two CRs. */
#define CR_MAX_GAP 2000000
......@@ -291,12 +291,12 @@ void input_ClockManageRef( input_thread_t * p_input,
mtime_t i_extrapoled_clock = ClockCurrent( p_input, p_pgrm );
/* Bresenham algorithm to smooth variations. */
if( p_pgrm->c_average_count == CR_MAX_AVERAGE_COUNTER )
if( p_pgrm->c_average_count == p_input->i_cr_average )
{
p_pgrm->delta_cr = ( p_pgrm->delta_cr
* (CR_MAX_AVERAGE_COUNTER - 1)
* (p_input->i_cr_average - 1)
+ ( i_extrapoled_clock - i_clock ) )
/ CR_MAX_AVERAGE_COUNTER;
/ p_input->i_cr_average;
}
else
{
......
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.109 2003/11/27 05:46:01 fenrir Exp $
* $Id: libvlc.h,v 1.110 2003/11/29 18:36:13 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -257,6 +257,11 @@ static char *ppsz_language_text[] =
#define INPUT_CAT_LONGTEXT N_( " " )
#define CR_AVERAGE_TEXT N_("Clock reference average counter")
#define CR_AVERAGE_LONGTEXT N_( \
"When using the PVR input (or a very irregular source), you should " \
"set this to 10000.")
#define SERVER_PORT_TEXT N_("Server port")
#define SERVER_PORT_LONGTEXT N_( \
"This is the port used for UDP streams. By default, we chose 1234.")
......@@ -669,6 +674,8 @@ vlc_module_begin();
/* Input options */
add_category_hint( N_("Input"), INPUT_CAT_LONGTEXT , VLC_FALSE );
add_integer( "cr-average", 40, NULL, CR_AVERAGE_TEXT,
CR_AVERAGE_LONGTEXT, VLC_FALSE );
add_integer( "server-port", 1234, NULL,
SERVER_PORT_TEXT, SERVER_PORT_LONGTEXT, VLC_FALSE );
add_integer( "mtu", 1500, NULL, MTU_TEXT, MTU_LONGTEXT, VLC_TRUE );
......
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