Commit 59144ef3 authored by Ilkka Ollakka's avatar Ilkka Ollakka

transcode: use var_Get(Int|Bool|String)

parent b874bf25
...@@ -254,7 +254,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -254,7 +254,7 @@ static int Open( vlc_object_t *p_this )
{ {
sout_stream_t *p_stream = (sout_stream_t*)p_this; sout_stream_t *p_stream = (sout_stream_t*)p_this;
sout_stream_sys_t *p_sys; sout_stream_sys_t *p_sys;
vlc_value_t val; char *psz_string;
p_sys = vlc_object_create( p_this, sizeof( sout_stream_sys_t ) ); p_sys = vlc_object_create( p_this, sizeof( sout_stream_sys_t ) );
...@@ -271,39 +271,36 @@ static int Open( vlc_object_t *p_this ) ...@@ -271,39 +271,36 @@ static int Open( vlc_object_t *p_this )
p_stream->p_cfg ); p_stream->p_cfg );
/* Audio transcoding parameters */ /* Audio transcoding parameters */
var_Get( p_stream, SOUT_CFG_PREFIX "aenc", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "aenc" );
p_sys->psz_aenc = NULL; p_sys->psz_aenc = NULL;
p_sys->p_audio_cfg = NULL; p_sys->p_audio_cfg = NULL;
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
{ {
char *psz_next; char *psz_next;
psz_next = config_ChainCreate( &p_sys->psz_aenc, &p_sys->p_audio_cfg, psz_next = config_ChainCreate( &p_sys->psz_aenc, &p_sys->p_audio_cfg,
val.psz_string ); psz_string );
free( psz_next ); free( psz_next );
} }
free( val.psz_string ); free( psz_string );
var_Get( p_stream, SOUT_CFG_PREFIX "acodec", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "acodec" );
p_sys->i_acodec = 0; p_sys->i_acodec = 0;
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
{ {
char fcc[4] = " "; char fcc[4] = " ";
memcpy( fcc, val.psz_string, __MIN( strlen( val.psz_string ), 4 ) ); memcpy( fcc, psz_string, __MIN( strlen( psz_string ), 4 ) );
p_sys->i_acodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] ); p_sys->i_acodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] );
} }
free( val.psz_string ); free( psz_string );
p_sys->psz_alang = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "alang" ); p_sys->psz_alang = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "alang" );
var_Get( p_stream, SOUT_CFG_PREFIX "ab", &val ); p_sys->i_abitrate = var_GetInteger( p_stream, SOUT_CFG_PREFIX "ab" );
p_sys->i_abitrate = val.i_int;
if( p_sys->i_abitrate < 4000 ) p_sys->i_abitrate *= 1000; if( p_sys->i_abitrate < 4000 ) p_sys->i_abitrate *= 1000;
var_Get( p_stream, SOUT_CFG_PREFIX "samplerate", &val ); p_sys->i_sample_rate = var_GetInteger( p_stream, SOUT_CFG_PREFIX "samplerate" );
p_sys->i_sample_rate = val.i_int;
var_Get( p_stream, SOUT_CFG_PREFIX "channels", &val ); p_sys->i_channels = var_GetInteger( p_stream, SOUT_CFG_PREFIX "channels" );
p_sys->i_channels = val.i_int;
if( p_sys->i_acodec ) if( p_sys->i_acodec )
{ {
...@@ -319,92 +316,77 @@ static int Open( vlc_object_t *p_this ) ...@@ -319,92 +316,77 @@ static int Open( vlc_object_t *p_this )
p_sys->i_channels, p_sys->i_abitrate / 1000 ); p_sys->i_channels, p_sys->i_abitrate / 1000 );
} }
var_Get( p_stream, SOUT_CFG_PREFIX "afilter", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "afilter" );
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
p_sys->psz_af = val.psz_string; p_sys->psz_af = strdup( psz_string );
else else
{
free( val.psz_string );
p_sys->psz_af = NULL; p_sys->psz_af = NULL;
} free( psz_string );
/* Video transcoding parameters */ /* Video transcoding parameters */
var_Get( p_stream, SOUT_CFG_PREFIX "venc", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "venc" );
p_sys->psz_venc = NULL; p_sys->psz_venc = NULL;
p_sys->p_video_cfg = NULL; p_sys->p_video_cfg = NULL;
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
{ {
char *psz_next; char *psz_next;
psz_next = config_ChainCreate( &p_sys->psz_venc, &p_sys->p_video_cfg, psz_next = config_ChainCreate( &p_sys->psz_venc, &p_sys->p_video_cfg,
val.psz_string ); psz_string );
free( psz_next ); free( psz_next );
} }
free( val.psz_string ); free( psz_string );
var_Get( p_stream, SOUT_CFG_PREFIX "vcodec", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "vcodec" );
p_sys->i_vcodec = 0; p_sys->i_vcodec = 0;
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
{ {
char fcc[4] = " "; char fcc[4] = " ";
memcpy( fcc, val.psz_string, __MIN( strlen( val.psz_string ), 4 ) ); memcpy( fcc, psz_string, __MIN( strlen( psz_string ), 4 ) );
p_sys->i_vcodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] ); p_sys->i_vcodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] );
} }
free( val.psz_string ); free( psz_string );
var_Get( p_stream, SOUT_CFG_PREFIX "vb", &val ); p_sys->i_vbitrate = var_GetInteger( p_stream, SOUT_CFG_PREFIX "vb" );
p_sys->i_vbitrate = val.i_int;
if( p_sys->i_vbitrate < 16000 ) p_sys->i_vbitrate *= 1000; if( p_sys->i_vbitrate < 16000 ) p_sys->i_vbitrate *= 1000;
var_Get( p_stream, SOUT_CFG_PREFIX "scale", &val ); p_sys->f_scale = var_GetFloat( p_stream, SOUT_CFG_PREFIX "scale" );
p_sys->f_scale = val.f_float;
var_Get( p_stream, SOUT_CFG_PREFIX "fps", &val ); p_sys->f_fps = var_GetFloat( p_stream, SOUT_CFG_PREFIX "fps" );
p_sys->f_fps = val.f_float;
var_Get( p_stream, SOUT_CFG_PREFIX "hurry-up", &val ); p_sys->b_hurry_up = var_GetBool( p_stream, SOUT_CFG_PREFIX "hurry-up" );
p_sys->b_hurry_up = val.b_bool;
var_Get( p_stream, SOUT_CFG_PREFIX "width", &val ); p_sys->i_width = var_GetInteger( p_stream, SOUT_CFG_PREFIX "width" );
p_sys->i_width = val.i_int;
var_Get( p_stream, SOUT_CFG_PREFIX "height", &val ); p_sys->i_height = var_GetInteger( p_stream, SOUT_CFG_PREFIX "height" );
p_sys->i_height = val.i_int;
var_Get( p_stream, SOUT_CFG_PREFIX "maxwidth", &val ); p_sys->i_maxwidth = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxwidth" );
p_sys->i_maxwidth = val.i_int;
var_Get( p_stream, SOUT_CFG_PREFIX "maxheight", &val ); p_sys->i_maxheight = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxheight" );
p_sys->i_maxheight = val.i_int;
var_Get( p_stream, SOUT_CFG_PREFIX "vfilter", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "vfilter" );
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
p_sys->psz_vf2 = val.psz_string; p_sys->psz_vf2 = strdup(psz_string );
else else
{
free( val.psz_string );
p_sys->psz_vf2 = NULL; p_sys->psz_vf2 = NULL;
} free( psz_string );
var_Get( p_stream, SOUT_CFG_PREFIX "deinterlace", &val ); p_sys->b_deinterlace = var_GetBool( p_stream, SOUT_CFG_PREFIX "deinterlace" );
p_sys->b_deinterlace = val.b_bool;
var_Get( p_stream, SOUT_CFG_PREFIX "deinterlace-module", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "deinterlace-module" );
p_sys->psz_deinterlace = NULL; p_sys->psz_deinterlace = NULL;
p_sys->p_deinterlace_cfg = NULL; p_sys->p_deinterlace_cfg = NULL;
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
{ {
char *psz_next; char *psz_next;
psz_next = config_ChainCreate( &p_sys->psz_deinterlace, psz_next = config_ChainCreate( &p_sys->psz_deinterlace,
&p_sys->p_deinterlace_cfg, &p_sys->p_deinterlace_cfg,
val.psz_string ); psz_string );
free( psz_next ); free( psz_next );
} }
free( val.psz_string ); free( psz_string );
var_Get( p_stream, SOUT_CFG_PREFIX "threads", &val ); p_sys->i_threads = var_GetInteger( p_stream, SOUT_CFG_PREFIX "threads" );
p_sys->i_threads = val.i_int; p_sys->b_high_priority = var_GetBool( p_stream, SOUT_CFG_PREFIX "high-priority" );
var_Get( p_stream, SOUT_CFG_PREFIX "high-priority", &val );
p_sys->b_high_priority = val.b_bool;
if( p_sys->i_vcodec ) if( p_sys->i_vcodec )
{ {
...@@ -419,50 +401,48 @@ static int Open( vlc_object_t *p_this ) ...@@ -419,50 +401,48 @@ static int Open( vlc_object_t *p_this )
p_sys->p_spu_cfg = NULL; p_sys->p_spu_cfg = NULL;
p_sys->i_scodec = 0; p_sys->i_scodec = 0;
var_Get( p_stream, SOUT_CFG_PREFIX "senc", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "senc" );
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
{ {
char *psz_next; char *psz_next;
psz_next = config_ChainCreate( &p_sys->psz_senc, &p_sys->p_spu_cfg, psz_next = config_ChainCreate( &p_sys->psz_senc, &p_sys->p_spu_cfg,
val.psz_string ); psz_string );
free( psz_next ); free( psz_next );
} }
free( val.psz_string ); free( psz_string );
var_Get( p_stream, SOUT_CFG_PREFIX "scodec", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "scodec" );
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
{ {
char fcc[4] = " "; char fcc[4] = " ";
memcpy( fcc, val.psz_string, __MIN( strlen( val.psz_string ), 4 ) ); memcpy( fcc, psz_string, __MIN( strlen( psz_string ), 4 ) );
p_sys->i_scodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] ); p_sys->i_scodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] );
} }
free( val.psz_string ); free( psz_string );
if( p_sys->i_scodec ) if( p_sys->i_scodec )
{ {
msg_Dbg( p_stream, "codec spu=%4.4s", (char *)&p_sys->i_scodec ); msg_Dbg( p_stream, "codec spu=%4.4s", (char *)&p_sys->i_scodec );
} }
var_Get( p_stream, SOUT_CFG_PREFIX "soverlay", &val ); p_sys->b_soverlay = var_GetBool( p_stream, SOUT_CFG_PREFIX "soverlay" );
p_sys->b_soverlay = val.b_bool;
var_Get( p_stream, SOUT_CFG_PREFIX "sfilter", &val ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "sfilter" );
if( val.psz_string && *val.psz_string ) if( psz_string && *psz_string )
{ {
p_sys->p_spu = spu_Create( p_stream ); p_sys->p_spu = spu_Create( p_stream );
if( p_sys->p_spu ) if( p_sys->p_spu )
spu_ChangeFilters( p_sys->p_spu, val.psz_string ); spu_ChangeFilters( p_sys->p_spu, psz_string );
} }
free( val.psz_string ); free( psz_string );
/* OSD menu transcoding parameters */ /* OSD menu transcoding parameters */
p_sys->psz_osdenc = NULL; p_sys->psz_osdenc = NULL;
p_sys->p_osd_cfg = NULL; p_sys->p_osd_cfg = NULL;
p_sys->i_osdcodec = 0; p_sys->i_osdcodec = 0;
p_sys->b_osd = false; p_sys->b_osd = var_GetBool( p_stream, SOUT_CFG_PREFIX "osd" );
var_Get( p_stream, SOUT_CFG_PREFIX "osd", &val ); if( p_sys->b_osd )
if( val.b_bool )
{ {
char *psz_next; char *psz_next;
...@@ -487,8 +467,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -487,8 +467,7 @@ static int Open( vlc_object_t *p_this )
} }
/* Audio settings */ /* Audio settings */
var_Get( p_stream, SOUT_CFG_PREFIX "audio-sync", &val ); p_sys->b_master_sync = var_GetBool( p_stream, SOUT_CFG_PREFIX "audio-sync" );
p_sys->b_master_sync = val.b_bool;
if( p_sys->f_fps > 0 ) p_sys->b_master_sync = true; if( p_sys->f_fps > 0 ) p_sys->b_master_sync = true;
p_stream->pf_add = Add; p_stream->pf_add = Add;
......
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