Commit 3ef2227a authored by Gildas Bazin's avatar Gildas Bazin

* src/stream_output/stream_output.c: small sout_cfg_parser() changes.

* modules/stream_out/duplicate.c: small coding style changes.
* modules/stream_out/transcode.c:
  + Forward the aopts{foo=bar,etc..} and vopts={foo=bar,etc...} options to the encoders.
  + Got rid of the ffmpeg encoder specific options.
* modules/codec/ffmpeg/*:
  + Changed the encoder options to normal config options.
  + Parse the options forwarded by transcode.
* include/vlc_codec.h:
  + encoder_t cleanup.
  + include a "sout_cfg_t *" in encoder_t to allow passing options.
parent 3100140e
...@@ -111,24 +111,11 @@ struct encoder_t ...@@ -111,24 +111,11 @@ struct encoder_t
/* Properties of the output of the encoder */ /* Properties of the output of the encoder */
es_format_t fmt_out; es_format_t fmt_out;
/* FIXME: move these to the ffmpeg encoder */ /* Number of threads to use during encoding */
int i_key_int;
int i_b_frames;
int i_vtolerance;
int i_qmin;
int i_qmax;
int i_hq;
vlc_bool_t b_strict_rc;
vlc_bool_t b_pre_me;
vlc_bool_t b_hurry_up;
vlc_bool_t b_interlace;
int i_rc_buffer_size;
float f_rc_buffer_aggressivity;
float f_i_quant_factor;
int i_noise_reduction;
vlc_bool_t b_mpeg4_matrix;
int i_threads; int i_threads;
vlc_bool_t b_trellis;
/* Encoder config */
sout_cfg_t *p_cfg;
}; };
/** /**
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@videolan.org>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/vout.h> #include <vlc/vout.h>
#include <vlc/aout.h> #include <vlc/aout.h>
#include <vlc/sout.h>
#include <vlc/decoder.h> #include <vlc/decoder.h>
/* ffmpeg header */ /* ffmpeg header */
...@@ -115,6 +116,31 @@ struct encoder_sys_t ...@@ -115,6 +116,31 @@ struct encoder_sys_t
int i_frame_size; int i_frame_size;
int i_samples_delay; int i_samples_delay;
mtime_t i_pts; mtime_t i_pts;
/* Encoding settings */
int i_key_int;
int i_b_frames;
int i_vtolerance;
int i_qmin;
int i_qmax;
int i_hq;
vlc_bool_t b_strict_rc;
int i_rc_buffer_size;
float f_rc_buffer_aggressivity;
vlc_bool_t b_pre_me;
vlc_bool_t b_hurry_up;
vlc_bool_t b_interlace;
float f_i_quant_factor;
int i_noise_reduction;
vlc_bool_t b_mpeg4_matrix;
vlc_bool_t b_trellis;
};
static const char *ppsz_enc_options[] = {
"keyint", "bframes", "vt", "qmin", "qmax", "hq", "strict_rc",
"rc_buffer_size", "rc_buffer_aggressivity", "pre_me", "hurry_up",
"interlace", "i_quant_factor", "noise_reduction", "mpeg4_matrix",
"trellis", NULL
}; };
/***************************************************************************** /*****************************************************************************
...@@ -131,6 +157,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -131,6 +157,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
AVCodec *p_codec; AVCodec *p_codec;
int i_codec_id, i_cat; int i_codec_id, i_cat;
char *psz_namecodec; char *psz_namecodec;
vlc_value_t val;
if( !E_(GetFfmpegCodec)( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id, if( !E_(GetFfmpegCodec)( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
&psz_namecodec ) ) &psz_namecodec ) )
...@@ -206,6 +233,68 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -206,6 +233,68 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
p_context->dsp_mask |= FF_MM_SSE2; p_context->dsp_mask |= FF_MM_SSE2;
} }
sout_ParseCfg( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
var_Get( p_enc, ENC_CFG_PREFIX "keyint", &val );
p_sys->i_key_int = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "bframes", &val );
p_sys->i_b_frames = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "vt", &val );
p_sys->i_vtolerance = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "interlace", &val );
p_sys->b_interlace = val.b_bool;
var_Get( p_enc, ENC_CFG_PREFIX "pre_me", &val );
p_sys->b_pre_me = val.b_bool;
var_Get( p_enc, ENC_CFG_PREFIX "hurry_up", &val );
p_sys->b_hurry_up = val.b_bool;
if( p_sys->b_hurry_up )
{
/* hurry up mode needs noise reduction, even small */
p_sys->i_noise_reduction = 1;
}
var_Get( p_enc, ENC_CFG_PREFIX "strict_rc", &val );
p_sys->b_strict_rc = val.b_bool;
var_Get( p_enc, ENC_CFG_PREFIX "rc_buffer_size", &val );
p_sys->i_rc_buffer_size = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "rc_buffer_aggressivity", &val );
p_sys->f_rc_buffer_aggressivity = val.f_float;
var_Get( p_enc, ENC_CFG_PREFIX "i_quant_factor", &val );
p_sys->f_i_quant_factor = val.f_float;
var_Get( p_enc, ENC_CFG_PREFIX "noise_reduction", &val );
p_sys->i_noise_reduction = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "mpeg4_matrix", &val );
p_sys->b_mpeg4_matrix = val.b_bool;
var_Get( p_enc, ENC_CFG_PREFIX "hq", &val );
if( val.psz_string && *val.psz_string )
{
if( !strcmp( val.psz_string, "rd" ) )
p_sys->i_hq = FF_MB_DECISION_RD;
else if( !strcmp( val.psz_string, "bits" ) )
p_sys->i_hq = FF_MB_DECISION_BITS;
else if( !strcmp( val.psz_string, "simple" ) )
p_sys->i_hq = FF_MB_DECISION_SIMPLE;
else
p_sys->i_hq = FF_MB_DECISION_RD;
}
if( val.psz_string ) free( val.psz_string );
var_Get( p_enc, ENC_CFG_PREFIX "qmin", &val );
p_sys->i_qmin = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "qmax", &val );
p_sys->i_qmax = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "trellis", &val );
p_sys->b_trellis = val.b_bool;
if( p_enc->fmt_in.i_cat == VIDEO_ES ) if( p_enc->fmt_in.i_cat == VIDEO_ES )
{ {
if( !p_enc->fmt_in.video.i_width || !p_enc->fmt_in.video.i_height ) if( !p_enc->fmt_in.video.i_width || !p_enc->fmt_in.video.i_height )
...@@ -230,9 +319,9 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -230,9 +319,9 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
p_context->i_quant_offset = 0.0; p_context->i_quant_offset = 0.0;
p_context->i_quant_factor = -0.8; p_context->i_quant_factor = -0.8;
p_context->gop_size = p_enc->i_key_int > 0 ? p_enc->i_key_int : 50; p_context->gop_size = p_sys->i_key_int > 0 ? p_sys->i_key_int : 50;
p_context->max_b_frames = p_context->max_b_frames =
__MIN( p_enc->i_b_frames, FF_MAX_B_FRAMES ); __MIN( p_sys->i_b_frames, FF_MAX_B_FRAMES );
p_context->b_frame_strategy = 0; p_context->b_frame_strategy = 0;
#if LIBAVCODEC_BUILD >= 4687 #if LIBAVCODEC_BUILD >= 4687
...@@ -249,35 +338,33 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -249,35 +338,33 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0'); p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
if ( p_enc->b_strict_rc ) if ( p_sys->b_strict_rc )
{ {
p_context->rc_max_rate = p_enc->fmt_out.i_bitrate; p_context->rc_max_rate = p_enc->fmt_out.i_bitrate;
p_context->rc_buffer_size = p_enc->i_rc_buffer_size; p_context->rc_buffer_size = p_sys->i_rc_buffer_size;
p_context->rc_buffer_aggressivity = p_enc->f_rc_buffer_aggressivity; p_context->rc_buffer_aggressivity = p_sys->f_rc_buffer_aggressivity;
} }
if ( p_enc->f_i_quant_factor != 0.0 ) if ( p_sys->f_i_quant_factor != 0.0 )
{ p_context->i_quant_factor = p_sys->f_i_quant_factor;
p_context->i_quant_factor = p_enc->f_i_quant_factor;
}
#if LIBAVCODEC_BUILD >= 4690 #if LIBAVCODEC_BUILD >= 4690
p_context->noise_reduction = p_enc->i_noise_reduction; p_context->noise_reduction = p_sys->i_noise_reduction;
#endif #endif
if ( p_enc->b_mpeg4_matrix ) if ( p_sys->b_mpeg4_matrix )
{ {
p_context->intra_matrix = ff_mpeg4_default_intra_matrix; p_context->intra_matrix = ff_mpeg4_default_intra_matrix;
p_context->inter_matrix = ff_mpeg4_default_non_intra_matrix; p_context->inter_matrix = ff_mpeg4_default_non_intra_matrix;
} }
if ( p_enc->b_pre_me ) if ( p_sys->b_pre_me )
{ {
p_context->pre_me = 1; p_context->pre_me = 1;
p_context->me_pre_cmp = FF_CMP_CHROMA; p_context->me_pre_cmp = FF_CMP_CHROMA;
} }
if ( p_enc->b_interlace ) if ( p_sys->b_interlace )
{ {
p_context->flags |= CODEC_FLAG_INTERLACED_DCT; p_context->flags |= CODEC_FLAG_INTERLACED_DCT;
#if LIBAVCODEC_BUILD >= 4698 #if LIBAVCODEC_BUILD >= 4698
...@@ -285,28 +372,24 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) ...@@ -285,28 +372,24 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
#endif #endif
} }
if ( p_enc->b_trellis ) if ( p_sys->b_trellis )
{
p_context->flags |= CODEC_FLAG_TRELLIS_QUANT; p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
}
#if LIBAVCODEC_BUILD >= 4702 #if LIBAVCODEC_BUILD >= 4702
if ( p_enc->i_threads >= 1 ) if ( p_enc->i_threads >= 1 )
{
p_context->thread_count = p_enc->i_threads; p_context->thread_count = p_enc->i_threads;
}
#endif #endif
if( p_enc->i_vtolerance > 0 ) if( p_sys->i_vtolerance > 0 )
{ p_context->bit_rate_tolerance = p_sys->i_vtolerance;
p_context->bit_rate_tolerance = p_enc->i_vtolerance;
}
p_context->mb_qmin = p_context->qmin = p_enc->i_qmin; if( p_sys->i_qmin > 0 )
p_context->mb_qmax = p_context->qmax = p_enc->i_qmax; p_context->mb_qmin = p_context->qmin = p_sys->i_qmin;
if( p_sys->i_qmax > 0 )
p_context->mb_qmax = p_context->qmax = p_sys->i_qmax;
p_context->max_qdiff = 3; p_context->max_qdiff = 3;
p_context->mb_decision = p_enc->i_hq; p_context->mb_decision = p_sys->i_hq;
} }
else if( p_enc->fmt_in.i_cat == AUDIO_ES ) else if( p_enc->fmt_in.i_cat == AUDIO_ES )
{ {
...@@ -517,7 +600,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict ) ...@@ -517,7 +600,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
{ {
frame.pts = p_pict->date ? p_pict->date : AV_NOPTS_VALUE; frame.pts = p_pict->date ? p_pict->date : AV_NOPTS_VALUE;
if ( p_enc->b_hurry_up && frame.pts != AV_NOPTS_VALUE ) if ( p_sys->b_hurry_up && frame.pts != AV_NOPTS_VALUE )
{ {
mtime_t current_date = mdate(); mtime_t current_date = mdate();
...@@ -529,24 +612,24 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict ) ...@@ -529,24 +612,24 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
} }
else else
{ {
p_sys->p_context->mb_decision = p_enc->i_hq; p_sys->p_context->mb_decision = p_sys->i_hq;
if ( current_date + HURRY_UP_GUARD2 > frame.pts ) if ( current_date + HURRY_UP_GUARD2 > frame.pts )
{ {
p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT; p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
#if LIBAVCODEC_BUILD >= 4690 #if LIBAVCODEC_BUILD >= 4690
p_sys->p_context->noise_reduction = p_enc->i_noise_reduction p_sys->p_context->noise_reduction = p_sys->i_noise_reduction
+ (HURRY_UP_GUARD2 + current_date - frame.pts) / 500; + (HURRY_UP_GUARD2 + current_date - frame.pts) / 500;
#endif #endif
msg_Dbg( p_enc, "hurry up mode 2" ); msg_Dbg( p_enc, "hurry up mode 2" );
} }
else else
{ {
if ( p_enc->b_trellis ) if ( p_sys->b_trellis )
p_sys->p_context->flags |= CODEC_FLAG_TRELLIS_QUANT; p_sys->p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
#if LIBAVCODEC_BUILD >= 4690 #if LIBAVCODEC_BUILD >= 4690
p_sys->p_context->noise_reduction = p_sys->p_context->noise_reduction =
p_enc->i_noise_reduction; p_sys->i_noise_reduction;
#endif #endif
} }
} }
......
...@@ -70,6 +70,8 @@ struct decoder_sys_t ...@@ -70,6 +70,8 @@ struct decoder_sys_t
static int OpenDecoder( vlc_object_t * ); static int OpenDecoder( vlc_object_t * );
static void CloseDecoder( vlc_object_t * ); static void CloseDecoder( vlc_object_t * );
static char *enc_hq_list[] = { "rd", "bits", "simple" };
static char *enc_hq_list_text[] = { N_("rd"), N_("bits"), N_("simple") };
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -93,7 +95,8 @@ vlc_module_begin(); ...@@ -93,7 +95,8 @@ vlc_module_begin();
add_string( "ffmpeg-pp-name", "default", NULL, LIBAVCODEC_PP_TEXT, add_string( "ffmpeg-pp-name", "default", NULL, LIBAVCODEC_PP_TEXT,
LIBAVCODEC_PP_LONGTEXT, VLC_TRUE ); LIBAVCODEC_PP_LONGTEXT, VLC_TRUE );
#endif #endif
add_integer( "ffmpeg-debug", 0, NULL, DEBUG_TEST, DEBUG_LONGTEST, VLC_TRUE ); add_integer( "ffmpeg-debug", 0, NULL, DEBUG_TEXT, DEBUG_LONGTEXT,
VLC_TRUE );
/* chroma conversion submodule */ /* chroma conversion submodule */
add_submodule(); add_submodule();
...@@ -107,6 +110,40 @@ vlc_module_begin(); ...@@ -107,6 +110,40 @@ vlc_module_begin();
set_capability( "encoder", 100 ); set_capability( "encoder", 100 );
set_callbacks( E_(OpenEncoder), E_(CloseEncoder) ); set_callbacks( E_(OpenEncoder), E_(CloseEncoder) );
add_string( ENC_CFG_PREFIX "hq", "simple", NULL, ENC_HQ_TEXT,
ENC_HQ_LONGTEXT, VLC_FALSE );
change_string_list( enc_hq_list, enc_hq_list_text, 0 );
add_integer( ENC_CFG_PREFIX "keyint", 0, NULL, ENC_KEYINT_TEXT,
ENC_KEYINT_LONGTEXT, VLC_FALSE );
add_integer( ENC_CFG_PREFIX "bframes", 0, NULL, ENC_BFRAMES_TEXT,
ENC_BFRAMES_LONGTEXT, VLC_FALSE );
add_bool( ENC_CFG_PREFIX "hurry_up", 0, NULL, ENC_HURRYUP_TEXT,
ENC_HURRYUP_LONGTEXT, VLC_FALSE );
add_bool( ENC_CFG_PREFIX "interlace", 0, NULL, ENC_INTERLACE_TEXT,
ENC_INTERLACE_LONGTEXT, VLC_TRUE );
add_integer( ENC_CFG_PREFIX "vt", 0, NULL, ENC_VT_TEXT,
ENC_VT_LONGTEXT, VLC_TRUE );
add_bool( ENC_CFG_PREFIX "pre_me", 0, NULL, ENC_PRE_ME_TEXT,
ENC_PRE_ME_LONGTEXT, VLC_TRUE );
add_bool( ENC_CFG_PREFIX "strict_rc", 0, NULL, ENC_RC_STRICT_TEXT,
ENC_RC_STRICT_LONGTEXT, VLC_TRUE );
add_integer( ENC_CFG_PREFIX "rc_buffer_size", 224*1024*8 * 3/2, NULL,
ENC_RC_BUF_TEXT, ENC_RC_BUF_LONGTEXT, VLC_TRUE );
add_float( ENC_CFG_PREFIX "rc_buffer_aggressivity", 0.1, NULL,
ENC_RC_BUF_AGGR_TEXT, ENC_RC_BUF_AGGR_LONGTEXT, VLC_TRUE );
add_float( ENC_CFG_PREFIX "i_quant_factor", 0, NULL,
ENC_QUANT_FACTOR_TEXT, ENC_QUANT_FACTOR_LONGTEXT, VLC_TRUE );
add_integer( ENC_CFG_PREFIX "noise_reduction", 0, NULL,
ENC_NOISE_RED_TEXT, ENC_NOISE_RED_LONGTEXT, VLC_TRUE );
add_bool( ENC_CFG_PREFIX "mpeg4_matrix", 0, NULL,
ENC_MPEG4_MATRIX_TEXT, ENC_MPEG4_MATRIX_LONGTEXT, VLC_TRUE );
add_integer( ENC_CFG_PREFIX "qmin", 0, NULL,
ENC_QMIN_TEXT, ENC_QMIN_LONGTEXT, VLC_TRUE );
add_integer( ENC_CFG_PREFIX "qmax", 0, NULL,
ENC_QMAX_TEXT, ENC_QMAX_LONGTEXT, VLC_TRUE );
add_bool( ENC_CFG_PREFIX "trellis", 0, NULL,
ENC_TRELLIS_TEXT, ENC_TRELLIS_LONGTEXT, VLC_TRUE );
/* demux submodule */ /* demux submodule */
add_submodule(); add_submodule();
set_description( _("ffmpeg demuxer" ) ); set_description( _("ffmpeg demuxer" ) );
......
...@@ -108,8 +108,8 @@ void E_(ClosePostproc)( decoder_t *, void * ); ...@@ -108,8 +108,8 @@ void E_(ClosePostproc)( decoder_t *, void * );
"Higher levels require considerable more CPU power, but produce " \ "Higher levels require considerable more CPU power, but produce " \
"better looking pictures." ) "better looking pictures." )
#define DEBUG_TEST N_( "Debug mask" ) #define DEBUG_TEXT N_( "Debug mask" )
#define DEBUG_LONGTEST N_( "Set ffmpeg debug mask" ) #define DEBUG_LONGTEXT N_( "Set ffmpeg debug mask" )
#define LIBAVCODEC_PP_TEXT N_("ffmpeg postproc filter chains") #define LIBAVCODEC_PP_TEXT N_("ffmpeg postproc filter chains")
/* FIXME (cut/past from ffmpeg */ /* FIXME (cut/past from ffmpeg */
...@@ -147,3 +147,73 @@ void E_(ClosePostproc)( decoder_t *, void * ); ...@@ -147,3 +147,73 @@ void E_(ClosePostproc)( decoder_t *, void * );
"tn tmpnoise (3 Thresholds) Temporal Noise Reducer\n" \ "tn tmpnoise (3 Thresholds) Temporal Noise Reducer\n" \
" 1. <= 2. <= 3. larger -> stronger filtering\n" \ " 1. <= 2. <= 3. larger -> stronger filtering\n" \
"fq forceQuant <quantizer> Force quantizer\n" "fq forceQuant <quantizer> Force quantizer\n"
/*
* Encoder options
*/
#define ENC_CFG_PREFIX "sout-ffmpeg-"
#define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
#define ENC_KEYINT_LONGTEXT N_( "Allows you to specify the number of frames " \
"that will be coded for one key frame." )
#define ENC_BFRAMES_TEXT N_( "Ratio of B frames" )
#define ENC_BFRAMES_LONGTEXT N_( "Allows you to specify the number of " \
"B frames that will be coded between two reference frames." )
#define ENC_VT_TEXT N_( "Video bitrate tolerance" )
#define ENC_VT_LONGTEXT N_( "Allows you to specify the video bitrate " \
"tolerance in kbit/s." )
#define ENC_INTERLACE_TEXT N_( "Enable interlaced encoding" )
#define ENC_INTERLACE_LONGTEXT N_( "Allows you to enable interlaced " \
"encoding." )
#define ENC_PRE_ME_TEXT N_( "Enable pre motion estimation" )
#define ENC_PRE_ME_LONGTEXT N_( "Allows you to enable the pre motion " \
"estimation." )
#define ENC_RC_STRICT_TEXT N_( "Enable strict rate control" )
#define ENC_RC_STRICT_LONGTEXT N_( "Allows you to enable the strict rate " \
"control algorithm." )
#define ENC_RC_BUF_TEXT N_( "Rate control buffer size" )
#define ENC_RC_BUF_LONGTEXT N_( "Allows you to specify the rate control " \
"buffer size." )
#define ENC_RC_BUF_AGGR_TEXT N_( "Rate control buffer aggressivity" )
#define ENC_RC_BUF_AGGR_LONGTEXT N_( "Allows you to specify the rate control "\
"buffer agressivity." )
#define ENC_QUANT_FACTOR_TEXT N_( "Quantization factor" )
#define ENC_QUANT_FACTOR_LONGTEXT N_( "Allows you to specify the " \
"quantization factor." )
#define ENC_NOISE_RED_TEXT N_( "Noise reduction" )
#define ENC_NOISE_RED_LONGTEXT N_( "Allows you to specify the noise " \
"reduction." )
#define ENC_MPEG4_MATRIX_TEXT N_( "Enable mpeg4 quantization matrix" )
#define ENC_MPEG4_MATRIX_LONGTEXT N_( "Allows you to use the mpeg4 " \
"quantization matrix for mpeg2 encoding." )
#define ENC_HQ_TEXT N_( "Quality level" )
#define ENC_HQ_LONGTEXT N_( "Allows you to specify the quality level " \
"for the encoding." )
#define ENC_HURRYUP_TEXT N_( "Hurry up" )
#define ENC_HURRYUP_LONGTEXT N_( "Allows you to specify if the encoder " \
"should make on-the-fly quality tradeoffs if your CPU can't keep up with " \
"the encoding rate." )
#define ENC_QMIN_TEXT N_( "Minimum video quantizer scale" )
#define ENC_QMIN_LONGTEXT N_( "Allows you to specify the minimum video " \
"quantizer scale." )
#define ENC_QMAX_TEXT N_( "Maximum video quantizer scale" )
#define ENC_QMAX_LONGTEXT N_( "Allows you to specify the maximum video " \
"quantizer scale." )
#define ENC_TRELLIS_TEXT N_( "Enable trellis quantization" )
#define ENC_TRELLIS_LONGTEXT N_( "Allows you to enable trellis " \
"quantization." )
...@@ -400,6 +400,9 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block ) ...@@ -400,6 +400,9 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
p_sys->i_buffer = 0; p_sys->i_buffer = 0;
p_sys->i_pts = 0; /* To make sure we recover properly */ p_sys->i_pts = 0; /* To make sure we recover properly */
p_sys->input_pts = p_sys->input_dts = 0;
p_sys->i_late_frames = 0;
block_Release( p_block ); block_Release( p_block );
return NULL; return NULL;
} }
......
...@@ -141,7 +141,7 @@ static void Close( vlc_object_t * p_this ) ...@@ -141,7 +141,7 @@ static void Close( vlc_object_t * p_this )
int i; int i;
msg_Dbg( p_stream, "closing a duplication"); msg_Dbg( p_stream, "closing a duplication" );
for( i = 0; i < p_sys->i_nb_streams; i++ ) for( i = 0; i < p_sys->i_nb_streams; i++ )
{ {
sout_stream_delete( p_sys->pp_streams[i] ); sout_stream_delete( p_sys->pp_streams[i] );
...@@ -176,9 +176,8 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -176,9 +176,8 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
id->pp_ids = NULL; id->pp_ids = NULL;
msg_Dbg( p_stream, "duplicated a new stream codec=%4.4s (es=%d group=%d)", msg_Dbg( p_stream, "duplicated a new stream codec=%4.4s (es=%d group=%d)",
(char*)&p_fmt->i_codec, (char*)&p_fmt->i_codec, p_fmt->i_id, p_fmt->i_group );
p_fmt->i_id,
p_fmt->i_group );
for( i_stream = 0; i_stream < p_sys->i_nb_streams; i_stream++ ) for( i_stream = 0; i_stream < p_sys->i_nb_streams; i_stream++ )
{ {
void *id_new = NULL; void *id_new = NULL;
......
This diff is collapsed.
...@@ -704,17 +704,6 @@ static void mrl_Clean( mrl_t *p_mrl ) ...@@ -704,17 +704,6 @@ static void mrl_Clean( mrl_t *p_mrl )
module{option=*:option=*}[:module{option=*:...}] module{option=*:option=*}[:module{option=*:...}]
*/ */
static char *_strndup( char *str, int i_len )
{
char *p;
p = malloc( i_len + 1 );
strncpy( p, str, i_len );
p[i_len] = '\0';
return( p );
}
/* /*
* parse module{options=str, option="str "}: * parse module{options=str, option="str "}:
* return a pointer on the rest * return a pointer on the rest
...@@ -778,7 +767,7 @@ static char *_get_chain_end( char *str ) ...@@ -778,7 +767,7 @@ static char *_get_chain_end( char *str )
} }
} }
char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain ) char *sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain )
{ {
sout_cfg_t *p_cfg = NULL; sout_cfg_t *p_cfg = NULL;
char *p = psz_chain; char *p = psz_chain;
...@@ -786,24 +775,15 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain ) ...@@ -786,24 +775,15 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain )
*ppsz_name = NULL; *ppsz_name = NULL;
*pp_cfg = NULL; *pp_cfg = NULL;
if( p == NULL ) if( !p ) return NULL;
{
return NULL;
}
SKIPSPACE( p ); SKIPSPACE( p );
while( *p && *p != '{' && *p != ':' && *p != ' ' && *p != '\t' ) while( *p && *p != '{' && *p != ':' && *p != ' ' && *p != '\t' ) p++;
{
p++;
}
if( p == psz_chain ) if( p == psz_chain ) return NULL;
{
return NULL;
}
*ppsz_name = _strndup( psz_chain, p - psz_chain ); *ppsz_name = strndup( psz_chain, p - psz_chain );
SKIPSPACE( p ); SKIPSPACE( p );
...@@ -821,11 +801,8 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain ) ...@@ -821,11 +801,8 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain )
psz_name = p; psz_name = p;
while( *p && *p != '=' && *p != ',' && *p != '}' && while( *p && *p != '=' && *p != ',' && *p != '{' && *p != '}' &&
*p != ' ' && *p != '\t' ) *p != ' ' && *p != '\t' ) p++;
{
p++;
}
/* fprintf( stderr, "name=%s - rest=%s\n", psz_name, p ); */ /* fprintf( stderr, "name=%s - rest=%s\n", psz_name, p ); */
if( p == psz_name ) if( p == psz_name )
...@@ -834,15 +811,16 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain ) ...@@ -834,15 +811,16 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain )
break; break;
} }
cfg.psz_name = _strndup( psz_name, p - psz_name ); cfg.psz_name = strndup( psz_name, p - psz_name );
SKIPSPACE( p ); SKIPSPACE( p );
if( *p == '=' ) if( *p == '=' || *p == '{' )
{ {
char *end; char *end;
vlc_bool_t b_keep_brackets = (*p == '{');
p++; if( *p == '=' ) p++;
end = _get_chain_end( p ); end = _get_chain_end( p );
if( end <= p ) if( end <= p )
...@@ -851,19 +829,14 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain ) ...@@ -851,19 +829,14 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain )
} }
else else
{ {
if( *p == '\'' || *p =='"' || *p == '{' ) if( *p == '\'' || *p =='"' ||
( !b_keep_brackets && *p == '{' ) )
{ {
p++; p++;
end--; end--;
} }
if( end <= p ) if( end <= p ) cfg.psz_value = NULL;
{ else cfg.psz_value = strndup( p, end - p );
cfg.psz_value = NULL;
}
else
{
cfg.psz_value = _strndup( p, end - p );
}
} }
p = end; p = end;
...@@ -890,26 +863,19 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain ) ...@@ -890,26 +863,19 @@ char * sout_cfg_parser( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain )
*pp_cfg = p_cfg; *pp_cfg = p_cfg;
} }
if( *p == ',' ) if( *p == ',' ) p++;
{
p++;
}
if( *p == '}' ) if( *p == '}' )
{ {
p++; p++;
break; break;
} }
} }
} }
if( *p == ':' ) if( *p == ':' ) return( strdup( p + 1 ) );
{
return( strdup( p + 1 ) );
}
return( NULL ); return NULL;
} }
static void sout_cfg_free( sout_cfg_t *p_cfg ) static void sout_cfg_free( sout_cfg_t *p_cfg )
......
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