Commit 6d5d33d4 authored by Rémi Duraffort's avatar Rémi Duraffort

codec: use var_Get(Integer|Float|String) when applicable.

parent 2987efc5
...@@ -202,7 +202,9 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -202,7 +202,9 @@ int OpenEncoder( vlc_object_t *p_this )
AVCodec *p_codec; AVCodec *p_codec;
int i_codec_id, i_cat; int i_codec_id, i_cat;
const char *psz_namecodec; const char *psz_namecodec;
vlc_value_t val; float f_val;
char *psz_val;
int i_val;
if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id, if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
&psz_namecodec ) ) &psz_namecodec ) )
...@@ -306,106 +308,77 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -306,106 +308,77 @@ int OpenEncoder( vlc_object_t *p_this )
config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); config_ChainParse( 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 = var_GetInteger( p_enc, ENC_CFG_PREFIX "keyint" );
p_sys->i_key_int = val.i_int; p_sys->i_b_frames = var_GetInteger( p_enc, ENC_CFG_PREFIX "bframes" );
p_sys->i_vtolerance = var_GetInteger( p_enc, ENC_CFG_PREFIX "vt" ) * 1000;
p_sys->b_interlace = var_GetBool( p_enc, ENC_CFG_PREFIX "interlace" );
p_sys->b_interlace_me = var_GetBool( p_enc, ENC_CFG_PREFIX "interlace-me" );
p_sys->b_pre_me = var_GetBool( p_enc, ENC_CFG_PREFIX "pre-me" );
p_sys->b_hurry_up = var_GetBool( p_enc, ENC_CFG_PREFIX "hurry-up" );
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 * 1000;
var_Get( p_enc, ENC_CFG_PREFIX "interlace", &val );
p_sys->b_interlace = val.b_bool;
var_Get( p_enc, ENC_CFG_PREFIX "interlace-me", &val );
p_sys->b_interlace_me = 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 ) if( p_sys->b_hurry_up )
{ {
/* hurry up mode needs noise reduction, even small */ /* hurry up mode needs noise reduction, even small */
p_sys->i_noise_reduction = 1; p_sys->i_noise_reduction = 1;
} }
var_Get( p_enc, ENC_CFG_PREFIX "rc-buffer-size", &val ); p_sys->i_rc_buffer_size = var_GetInteger( p_enc, ENC_CFG_PREFIX "rc-buffer-size" );
p_sys->i_rc_buffer_size = val.i_int; p_sys->f_rc_buffer_aggressivity = var_GetFloat( p_enc, ENC_CFG_PREFIX "rc-buffer-aggressivity" );
var_Get( p_enc, ENC_CFG_PREFIX "rc-buffer-aggressivity", &val ); p_sys->f_i_quant_factor = var_GetFloat( p_enc, ENC_CFG_PREFIX "i-quant-factor" );
p_sys->f_rc_buffer_aggressivity = val.f_float; p_sys->i_noise_reduction = var_GetInteger( p_enc, ENC_CFG_PREFIX "noise-reduction" );
p_sys->b_mpeg4_matrix = var_GetBool( p_enc, ENC_CFG_PREFIX "mpeg4-matrix" );
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 ); f_val = var_GetFloat( p_enc, ENC_CFG_PREFIX "qscale" );
p_sys->i_noise_reduction = val.i_int; if( f_val < 0.01 || f_val > 255.0 ) f_val = 0;
p_sys->i_quality = (int)(FF_QP2LAMBDA * f_val + 0.5);
var_Get( p_enc, ENC_CFG_PREFIX "mpeg4-matrix", &val ); psz_val = var_GetString( p_enc, ENC_CFG_PREFIX "hq" );
p_sys->b_mpeg4_matrix = val.b_bool;
var_Get( p_enc, ENC_CFG_PREFIX "qscale", &val );
if( val.f_float < 0.01 || val.f_float > 255.0 ) val.f_float = 0;
p_sys->i_quality = (int)(FF_QP2LAMBDA * val.f_float + 0.5);
var_Get( p_enc, ENC_CFG_PREFIX "hq", &val );
p_sys->i_hq = FF_MB_DECISION_RD; p_sys->i_hq = FF_MB_DECISION_RD;
if( val.psz_string && *val.psz_string ) if( psz_val && *psz_val )
{ {
if( !strcmp( val.psz_string, "rd" ) ) if( !strcmp( psz_val, "rd" ) )
p_sys->i_hq = FF_MB_DECISION_RD; p_sys->i_hq = FF_MB_DECISION_RD;
else if( !strcmp( val.psz_string, "bits" ) ) else if( !strcmp( psz_val, "bits" ) )
p_sys->i_hq = FF_MB_DECISION_BITS; p_sys->i_hq = FF_MB_DECISION_BITS;
else if( !strcmp( val.psz_string, "simple" ) ) else if( !strcmp( psz_val, "simple" ) )
p_sys->i_hq = FF_MB_DECISION_SIMPLE; p_sys->i_hq = FF_MB_DECISION_SIMPLE;
else else
p_sys->i_hq = FF_MB_DECISION_RD; p_sys->i_hq = FF_MB_DECISION_RD;
} }
else else
p_sys->i_hq = FF_MB_DECISION_RD; p_sys->i_hq = FF_MB_DECISION_RD;
free( val.psz_string ); free( psz_val );
var_Get( p_enc, ENC_CFG_PREFIX "qmin", &val ); p_sys->i_qmin = var_GetInteger( p_enc, ENC_CFG_PREFIX "qmin" );
p_sys->i_qmin = val.i_int; p_sys->i_qmax = var_GetInteger( p_enc, ENC_CFG_PREFIX "qmax" );
var_Get( p_enc, ENC_CFG_PREFIX "qmax", &val ); p_sys->b_trellis = var_GetBool( p_enc, ENC_CFG_PREFIX "trellis" );
p_sys->i_qmax = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "trellis", &val ); i_val = var_GetInteger( p_enc, ENC_CFG_PREFIX "strict" );
p_sys->b_trellis = val.b_bool; if( i_val < - 1 || i_val > 1 ) i_val = 0;
p_context->strict_std_compliance = i_val;
var_Get( p_enc, ENC_CFG_PREFIX "strict", &val );
if( val.i_int < - 1 || val.i_int > 1 ) val.i_int = 0; p_sys->f_lumi_masking = var_GetFloat( p_enc, ENC_CFG_PREFIX "lumi-masking" );
p_context->strict_std_compliance = val.i_int; p_sys->f_dark_masking = var_GetFloat( p_enc, ENC_CFG_PREFIX "dark-masking" );
p_sys->f_p_masking = var_GetFloat( p_enc, ENC_CFG_PREFIX "p-masking" );
var_Get( p_enc, ENC_CFG_PREFIX "lumi-masking", &val ); p_sys->f_border_masking = var_GetFloat( p_enc, ENC_CFG_PREFIX "border-masking" );
p_sys->f_lumi_masking = val.f_float; p_sys->i_luma_elim = var_GetInteger( p_enc, ENC_CFG_PREFIX "luma-elim-threshold" );
var_Get( p_enc, ENC_CFG_PREFIX "dark-masking", &val ); p_sys->i_chroma_elim = var_GetInteger( p_enc, ENC_CFG_PREFIX "chroma-elim-threshold" );
p_sys->f_dark_masking = val.f_float;
var_Get( p_enc, ENC_CFG_PREFIX "p-masking", &val ); psz_val = var_GetString( p_enc, ENC_CFG_PREFIX "aac-profile" );
p_sys->f_p_masking = val.f_float;
var_Get( p_enc, ENC_CFG_PREFIX "border-masking", &val );
p_sys->f_border_masking = val.f_float;
var_Get( p_enc, ENC_CFG_PREFIX "luma-elim-threshold", &val );
p_sys->i_luma_elim = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "chroma-elim-threshold", &val );
p_sys->i_chroma_elim = val.i_int;
var_Get( p_enc, ENC_CFG_PREFIX "aac-profile", &val );
/* ffmpeg uses faac encoder atm, and it has issues with /* ffmpeg uses faac encoder atm, and it has issues with
* other than low-complexity profile, so default to that */ * other than low-complexity profile, so default to that */
p_sys->i_aac_profile = FF_PROFILE_AAC_LOW; p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
if( val.psz_string && *val.psz_string ) if( psz_val && *psz_val )
{ {
if( !strncmp( val.psz_string, "main", 4 ) ) if( !strncmp( psz_val, "main", 4 ) )
p_sys->i_aac_profile = FF_PROFILE_AAC_MAIN; p_sys->i_aac_profile = FF_PROFILE_AAC_MAIN;
else if( !strncmp( val.psz_string, "low", 3 ) ) else if( !strncmp( psz_val, "low", 3 ) )
p_sys->i_aac_profile = FF_PROFILE_AAC_LOW; p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
#if 0 /* Not supported by FAAC encoder */ #if 0 /* Not supported by FAAC encoder */
else if( !strncmp( val.psz_string, "ssr", 3 ) ) else if( !strncmp( psz_val, "ssr", 3 ) )
p_sys->i_aac_profile = FF_PROFILE_AAC_SSR; p_sys->i_aac_profile = FF_PROFILE_AAC_SSR;
#endif #endif
else if( !strncmp( val.psz_string, "ltp", 3 ) ) else if( !strncmp( psz_val, "ltp", 3 ) )
p_sys->i_aac_profile = FF_PROFILE_AAC_LTP; p_sys->i_aac_profile = FF_PROFILE_AAC_LTP;
else else
{ {
...@@ -413,7 +386,7 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -413,7 +386,7 @@ int OpenEncoder( vlc_object_t *p_this )
p_sys->i_aac_profile = FF_PROFILE_AAC_LOW; p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
} }
} }
free( val.psz_string ); free( psz_val );
if( p_enc->fmt_in.i_cat == VIDEO_ES ) if( p_enc->fmt_in.i_cat == VIDEO_ES )
{ {
......
...@@ -323,7 +323,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -323,7 +323,6 @@ static int Open( 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; decoder_sys_t *p_sys;
vlc_value_t val;
int i_posx, i_posy; int i_posx, i_posy;
if( p_dec->fmt_in.i_codec != VLC_CODEC_DVBS ) if( p_dec->fmt_in.i_codec != VLC_CODEC_DVBS )
...@@ -332,10 +331,9 @@ static int Open( vlc_object_t *p_this ) ...@@ -332,10 +331,9 @@ static int Open( vlc_object_t *p_this )
} }
p_dec->pf_decode_sub = Decode; p_dec->pf_decode_sub = Decode;
p_sys = p_dec->p_sys = malloc( sizeof(decoder_sys_t) ); p_sys = p_dec->p_sys = calloc( 1, sizeof(decoder_sys_t) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
memset( p_sys, 0, sizeof(decoder_sys_t) );
p_sys->i_pts = (mtime_t) 0; p_sys->i_pts = (mtime_t) 0;
p_sys->i_id = p_dec->fmt_in.subs.dvb.i_id & 0xFFFF; p_sys->i_id = p_dec->fmt_in.subs.dvb.i_id & 0xFFFF;
...@@ -348,18 +346,10 @@ static int Open( vlc_object_t *p_this ) ...@@ -348,18 +346,10 @@ static int Open( vlc_object_t *p_this )
/* configure for SD res in case DDS is not present */ /* configure for SD res in case DDS is not present */
default_dds_init( p_dec ); default_dds_init( p_dec );
var_Create( p_this, DVBSUB_CFG_PREFIX "position", p_sys->i_spu_position = var_CreateGetInteger( p_this,
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); DVBSUB_CFG_PREFIX "position" );
var_Get( p_this, DVBSUB_CFG_PREFIX "position", &val ); i_posx = var_CreateGetInteger( p_this, DVBSUB_CFG_PREFIX "x" );
p_sys->i_spu_position = val.i_int; i_posy = var_CreateGetInteger( p_this, DVBSUB_CFG_PREFIX "y" );
var_Create( p_this, DVBSUB_CFG_PREFIX "x",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_this, DVBSUB_CFG_PREFIX "x", &val );
i_posx = val.i_int;
var_Create( p_this, DVBSUB_CFG_PREFIX "y",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_this, DVBSUB_CFG_PREFIX "y", &val );
i_posy = val.i_int;
/* Check if subpicture position was overridden */ /* Check if subpicture position was overridden */
p_sys->b_absolute = true; p_sys->b_absolute = true;
...@@ -876,10 +866,9 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s ) ...@@ -876,10 +866,9 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s )
#ifdef DEBUG_DVBSUB #ifdef DEBUG_DVBSUB
msg_Dbg( p_dec, "new region: %i", i_id ); msg_Dbg( p_dec, "new region: %i", i_id );
#endif #endif
p_region = *pp_region = malloc( sizeof(dvbsub_region_t) ); p_region = *pp_region = calloc( 1, sizeof(dvbsub_region_t) );
if( !p_region ) if( !p_region )
return; return;
memset( p_region, 0, sizeof(dvbsub_region_t) );
p_region->p_object_defs = NULL; p_region->p_object_defs = NULL;
p_region->p_pixbuf = NULL; p_region->p_pixbuf = NULL;
p_region->p_next = NULL; p_region->p_next = NULL;
...@@ -1708,7 +1697,6 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -1708,7 +1697,6 @@ static int OpenEncoder( vlc_object_t *p_this )
{ {
encoder_t *p_enc = (encoder_t *)p_this; encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys; encoder_sys_t *p_sys;
vlc_value_t val;
if( ( p_enc->fmt_out.i_codec != VLC_CODEC_DVBS ) && if( ( p_enc->fmt_out.i_codec != VLC_CODEC_DVBS ) &&
!p_enc->b_force ) !p_enc->b_force )
...@@ -1733,12 +1721,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -1733,12 +1721,8 @@ static int OpenEncoder( vlc_object_t *p_this )
p_sys->i_regions = 0; p_sys->i_regions = 0;
p_sys->p_regions = 0; p_sys->p_regions = 0;
var_Create( p_this, ENC_CFG_PREFIX "x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); p_sys->i_offset_x = var_CreateGetInteger( p_this, ENC_CFG_PREFIX "x" );
var_Get( p_this, ENC_CFG_PREFIX "x", &val ); p_sys->i_offset_y = var_CreateGetInteger( p_this, ENC_CFG_PREFIX "y" );
p_sys->i_offset_x = val.i_int;
var_Create( p_this, ENC_CFG_PREFIX "y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_this, ENC_CFG_PREFIX "y", &val );
p_sys->i_offset_y = val.i_int;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -228,7 +228,6 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -228,7 +228,6 @@ static int OpenDecoder( 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; decoder_sys_t *p_sys;
vlc_value_t val;
switch( p_dec->fmt_in.i_codec ) switch( p_dec->fmt_in.i_codec )
{ {
...@@ -312,9 +311,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -312,9 +311,7 @@ static int OpenDecoder( vlc_object_t *p_this )
} }
free (psz_charset); free (psz_charset);
var_Create( p_dec, "subsdec-align", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); p_sys->i_align = var_CreateGetInteger( p_dec, "subsdec-align" );
var_Get( p_dec, "subsdec-align", &val );
p_sys->i_align = val.i_int;
if( p_dec->fmt_in.i_codec == VLC_CODEC_SSA if( p_dec->fmt_in.i_codec == VLC_CODEC_SSA
&& var_CreateGetBool( p_dec, "subsdec-formatted" ) ) && var_CreateGetBool( p_dec, "subsdec-formatted" ) )
...@@ -685,6 +682,7 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle ) ...@@ -685,6 +682,7 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle )
psz_tag[ 0 ] = '\0'; psz_tag[ 0 ] = '\0';
/* */ /* */
//Oo + 100 ???
size_t i_buf_size = strlen( psz_subtitle ) + 100; size_t i_buf_size = strlen( psz_subtitle ) + 100;
char *psz_html_start = malloc( i_buf_size ); char *psz_html_start = malloc( i_buf_size );
char *psz_html = psz_html_start; char *psz_html = psz_html_start;
......
...@@ -171,8 +171,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -171,8 +171,8 @@ static int Open( 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 = NULL; decoder_sys_t *p_sys = NULL;
vlc_value_t val; int i_val;
int i;
if( p_dec->fmt_in.i_codec != VLC_CODEC_TELETEXT) if( p_dec->fmt_in.i_codec != VLC_CODEC_TELETEXT)
{ {
...@@ -187,25 +187,21 @@ static int Open( vlc_object_t *p_this ) ...@@ -187,25 +187,21 @@ static int Open( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = 0; p_dec->fmt_out.i_codec = 0;
p_sys->i_align = 0; p_sys->i_align = 0;
for ( i = 0; i < 9; i++ ) for ( int i = 0; i < 9; i++ )
p_sys->pi_active_national_set[i] = ppi_national_subsets[1]; p_sys->pi_active_national_set[i] = ppi_national_subsets[1];
var_Create( p_dec, "telx-override-page", i_val = var_CreateGetInteger( p_dec, "telx-override-page" );
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); if( i_val == -1 && p_dec->fmt_in.subs.teletext.i_magazine != -1 &&
var_Get( p_dec, "telx-override-page", &val );
if( val.i_int == -1 &&
p_dec->fmt_in.subs.teletext.i_magazine != -1 &&
( p_dec->fmt_in.subs.teletext.i_magazine != 1 || ( p_dec->fmt_in.subs.teletext.i_magazine != 1 ||
p_dec->fmt_in.subs.teletext.i_page != 0 ) ) /* ignore if TS demux wants page 100 (unlikely to be sub) */ p_dec->fmt_in.subs.teletext.i_page != 0 ) ) /* ignore if TS demux wants page 100 (unlikely to be sub) */
{ {
bool b_val;
p_sys->i_wanted_magazine = p_dec->fmt_in.subs.teletext.i_magazine; p_sys->i_wanted_magazine = p_dec->fmt_in.subs.teletext.i_magazine;
p_sys->i_wanted_page = p_dec->fmt_in.subs.teletext.i_page; p_sys->i_wanted_page = p_dec->fmt_in.subs.teletext.i_page;
var_Create( p_dec, "telx-french-workaround", b_val = var_CreateGetBool( p_dec, "telx-french-workaround" );
VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_dec, "telx-french-workaround", &val );
if( p_sys->i_wanted_page < 100 && if( p_sys->i_wanted_page < 100 &&
(val.b_bool || (p_sys->i_wanted_page % 16) >= 10)) (b_val || (p_sys->i_wanted_page % 16) >= 10))
{ {
/* See http://www.nada.kth.se/~ragge/vdr/ttxtsubs/TROUBLESHOOTING.txt /* See http://www.nada.kth.se/~ragge/vdr/ttxtsubs/TROUBLESHOOTING.txt
* paragraph about French channels - they mix up decimal and * paragraph about French channels - they mix up decimal and
...@@ -214,21 +210,19 @@ static int Open( vlc_object_t *p_this ) ...@@ -214,21 +210,19 @@ static int Open( vlc_object_t *p_this )
(p_sys->i_wanted_page % 10); (p_sys->i_wanted_page % 10);
} }
} }
else if( val.i_int <= 0 ) else if( i_val <= 0 )
{ {
p_sys->i_wanted_magazine = -1; p_sys->i_wanted_magazine = -1;
p_sys->i_wanted_page = -1; p_sys->i_wanted_page = -1;
} }
else else
{ {
p_sys->i_wanted_magazine = val.i_int / 100; p_sys->i_wanted_magazine = i_val / 100;
p_sys->i_wanted_page = (((val.i_int % 100) / 10) << 4) p_sys->i_wanted_page = (((i_val % 100) / 10) << 4)
| ((val.i_int % 100) % 10); |((i_val % 100) % 10);
} }
var_Create( p_dec, "telx-ignore-subtitle-flag", p_sys->b_ignore_sub_flag = var_CreateGetBool( p_dec,
VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); "telx-ignore-subtitle-flag" );
var_Get( p_dec, "telx-ignore-subtitle-flag", &val );
p_sys->b_ignore_sub_flag = val.b_bool;
msg_Dbg( p_dec, "starting telx on magazine %d page %02x flag %d", msg_Dbg( p_dec, "starting telx on magazine %d page %02x flag %d",
p_sys->i_wanted_magazine, p_sys->i_wanted_page, p_sys->i_wanted_magazine, p_sys->i_wanted_page,
......
...@@ -605,7 +605,6 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -605,7 +605,6 @@ static int OpenEncoder( vlc_object_t *p_this )
encoder_sys_t *p_sys; encoder_sys_t *p_sys;
ogg_packet header; ogg_packet header;
uint8_t *p_extra; uint8_t *p_extra;
vlc_value_t val;
int i_quality, i; int i_quality, i;
if( p_enc->fmt_out.i_codec != VLC_CODEC_THEORA && if( p_enc->fmt_out.i_codec != VLC_CODEC_THEORA &&
...@@ -625,8 +624,7 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -625,8 +624,7 @@ static int OpenEncoder( vlc_object_t *p_this )
config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
var_Get( p_enc, ENC_CFG_PREFIX "quality", &val ); i_quality = var_GetInteger( p_enc, ENC_CFG_PREFIX "quality" );
i_quality = val.i_int;
if( i_quality > 10 ) i_quality = 10; if( i_quality > 10 ) i_quality = 10;
if( i_quality < 0 ) i_quality = 0; if( i_quality < 0 ) i_quality = 0;
......
...@@ -129,7 +129,6 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -129,7 +129,6 @@ static int OpenEncoder( vlc_object_t *p_this )
{ {
encoder_t *p_enc = (encoder_t *)p_this; encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys; encoder_sys_t *p_sys;
vlc_value_t val;
int i_frequency; int i_frequency;
if( p_enc->fmt_out.i_codec != VLC_CODEC_MPGA && if( p_enc->fmt_out.i_codec != VLC_CODEC_MPGA &&
...@@ -216,8 +215,7 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -216,8 +215,7 @@ static int OpenEncoder( vlc_object_t *p_this )
else else
{ {
twolame_set_num_channels( p_sys->p_twolame, 2 ); twolame_set_num_channels( p_sys->p_twolame, 2 );
var_Get( p_enc, ENC_CFG_PREFIX "mode", &val ); switch( var_GetInteger( p_enc, ENC_CFG_PREFIX "mode" ) )
switch ( val.i_int )
{ {
case 1: case 1:
twolame_set_mode( p_sys->p_twolame, TWOLAME_DUAL_CHANNEL ); twolame_set_mode( p_sys->p_twolame, TWOLAME_DUAL_CHANNEL );
...@@ -232,8 +230,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -232,8 +230,8 @@ static int OpenEncoder( vlc_object_t *p_this )
} }
} }
var_Get( p_enc, ENC_CFG_PREFIX "psy", &val ); twolame_set_psymodel( p_sys->p_twolame,
twolame_set_psymodel( p_sys->p_twolame, val.i_int ); var_GetInteger( p_enc, ENC_CFG_PREFIX "psy" ) );
if ( twolame_init_params( p_sys->p_twolame ) ) if ( twolame_init_params( p_sys->p_twolame ) )
{ {
......
...@@ -786,7 +786,6 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -786,7 +786,6 @@ static int OpenEncoder( vlc_object_t *p_this )
encoder_sys_t *p_sys; encoder_sys_t *p_sys;
int i_quality, i_min_bitrate, i_max_bitrate, i; int i_quality, i_min_bitrate, i_max_bitrate, i;
ogg_packet header[3]; ogg_packet header[3];
vlc_value_t val;
uint8_t *p_extra; uint8_t *p_extra;
if( p_enc->fmt_out.i_codec != VLC_CODEC_VORBIS && if( p_enc->fmt_out.i_codec != VLC_CODEC_VORBIS &&
...@@ -806,16 +805,13 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -806,16 +805,13 @@ static int OpenEncoder( vlc_object_t *p_this )
config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
var_Get( p_enc, ENC_CFG_PREFIX "quality", &val ); i_quality = var_GetInteger( p_enc, ENC_CFG_PREFIX "quality" );
i_quality = val.i_int;
if( i_quality > 10 ) i_quality = 10; if( i_quality > 10 ) i_quality = 10;
if( i_quality < 0 ) i_quality = 0; if( i_quality < 0 ) i_quality = 0;
var_Get( p_enc, ENC_CFG_PREFIX "cbr", &val );
if( val.b_bool ) i_quality = 0; if( var_GetBool( p_enc, ENC_CFG_PREFIX "cbr" ) ) i_quality = 0;
var_Get( p_enc, ENC_CFG_PREFIX "max-bitrate", &val ); i_max_bitrate = var_GetInteger( p_enc, ENC_CFG_PREFIX "max-bitrate" );
i_max_bitrate = val.i_int; i_min_bitrate = var_GetInteger( p_enc, ENC_CFG_PREFIX "min-bitrate" );
var_Get( p_enc, ENC_CFG_PREFIX "min-bitrate", &val );
i_min_bitrate = val.i_int;
/* Initialize vorbis encoder */ /* Initialize vorbis encoder */
vorbis_info_init( &p_sys->vi ); vorbis_info_init( &p_sys->vi );
......
This diff is collapsed.
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