Commit 1cb0a680 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Suppress copy-cat code (more to come)

parent 96c71691
...@@ -1106,7 +1106,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, ...@@ -1106,7 +1106,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
if( strlen( newval.psz_string ) > 0 && if( strlen( newval.psz_string ) > 0 &&
newval.psz_string[strlen( newval.psz_string ) - 1] == '%' ) newval.psz_string[strlen( newval.psz_string ) - 1] == '%' )
{ {
val.f_float = (float)atoi( newval.psz_string ) / 100.0; val.f_float = (float)atof( newval.psz_string ) / 100.0;
var_Set( p_input, "position", val ); var_Set( p_input, "position", val );
} }
else else
...@@ -1520,233 +1520,148 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd, ...@@ -1520,233 +1520,148 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd,
/* Parse miscellaneous commands */ /* Parse miscellaneous commands */
if( !strcmp( psz_cmd, "marq-marquee" ) ) if( !strcmp( psz_cmd, "marq-marquee" ) )
{ {
if( strlen( newval.psz_string ) > 0 ) var_SetString( p_input->p_libvlc_global, "marq-marquee", newval.psz_string );
{
val.psz_string = newval.psz_string;
var_Set( p_input->p_libvlc_global, "marq-marquee", val );
} }
else else
if( strlen( newval.psz_string ) == 0)
{ {
val.psz_string = ""; /* All the variable above expects strlen > 0 */
var_Set( p_input->p_libvlc_global, "marq-marquee", val);
}
} }
else if( !strcmp( psz_cmd, "marq-x" ) ) else if( !strcmp( psz_cmd, "marq-x" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "marq-x", val ); var_Set( p_input->p_libvlc_global, "marq-x", val );
} }
}
else if( !strcmp( psz_cmd, "marq-y" ) ) else if( !strcmp( psz_cmd, "marq-y" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "marq-y", val ); var_Set( p_input->p_libvlc_global, "marq-y", val );
} }
}
else if( !strcmp( psz_cmd, "marq-position" ) ) else if( !strcmp( psz_cmd, "marq-position" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "marq-position", val ); var_Set( p_input->p_libvlc_global, "marq-position", val );
} }
}
else if( !strcmp( psz_cmd, "marq-color" ) ) else if( !strcmp( psz_cmd, "marq-color" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = strtol( newval.psz_string, NULL, 0 ); val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_input->p_libvlc_global, "marq-color", val ); var_Set( p_input->p_libvlc_global, "marq-color", val );
} }
}
else if( !strcmp( psz_cmd, "marq-opacity" ) ) else if( !strcmp( psz_cmd, "marq-opacity" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = strtol( newval.psz_string, NULL, 0 ); val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_input->p_libvlc_global, "marq-opacity", val ); var_Set( p_input->p_libvlc_global, "marq-opacity", val );
} }
}
else if( !strcmp( psz_cmd, "marq-size" ) ) else if( !strcmp( psz_cmd, "marq-size" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "marq-size", val ); var_Set( p_input->p_libvlc_global, "marq-size", val );
} }
}
else if( !strcmp( psz_cmd, "marq-timeout" ) ) else if( !strcmp( psz_cmd, "marq-timeout" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input, "marq-timeout", val ); var_Set( p_input, "marq-timeout", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-alpha" ) ) else if( !strcmp( psz_cmd, "mosaic-alpha" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-alpha", val ); var_Set( p_input->p_libvlc_global, "mosaic-alpha", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-height" ) ) else if( !strcmp( psz_cmd, "mosaic-height" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-height", val ); var_Set( p_input->p_libvlc_global, "mosaic-height", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-width" ) ) else if( !strcmp( psz_cmd, "mosaic-width" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-width", val ); var_Set( p_input->p_libvlc_global, "mosaic-width", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-xoffset" ) ) else if( !strcmp( psz_cmd, "mosaic-xoffset" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-xoffset", val ); var_Set( p_input->p_libvlc_global, "mosaic-xoffset", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-yoffset" ) ) else if( !strcmp( psz_cmd, "mosaic-yoffset" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-yoffset", val ); var_Set( p_input->p_libvlc_global, "mosaic-yoffset", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-align" ) ) else if( !strcmp( psz_cmd, "mosaic-align" ) )
{
if( strlen( newval.psz_string ) > 0 )
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-align", val ); var_Set( p_input->p_libvlc_global, "mosaic-align", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-vborder" ) ) else if( !strcmp( psz_cmd, "mosaic-vborder" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-vborder", val ); var_Set( p_input->p_libvlc_global, "mosaic-vborder", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-hborder" ) ) else if( !strcmp( psz_cmd, "mosaic-hborder" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-hborder", val ); var_Set( p_input->p_libvlc_global, "mosaic-hborder", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-position" ) ) else if( !strcmp( psz_cmd, "mosaic-position" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-position", val ); var_Set( p_input->p_libvlc_global, "mosaic-position", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-rows" ) ) else if( !strcmp( psz_cmd, "mosaic-rows" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-rows", val ); var_Set( p_input->p_libvlc_global, "mosaic-rows", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-cols" ) ) else if( !strcmp( psz_cmd, "mosaic-cols" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-cols", val ); var_Set( p_input->p_libvlc_global, "mosaic-cols", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-order" ) ) else if( !strcmp( psz_cmd, "mosaic-order" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.psz_string = newval.psz_string; val.psz_string = newval.psz_string;
var_Set( p_input->p_libvlc_global, "mosaic-order", val ); var_Set( p_input->p_libvlc_global, "mosaic-order", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-offsets" ) ) else if( !strcmp( psz_cmd, "mosaic-offsets" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.psz_string = newval.psz_string; val.psz_string = newval.psz_string;
var_Set( p_input->p_libvlc_global, "mosaic-offsets", val ); var_Set( p_input->p_libvlc_global, "mosaic-offsets", val );
} }
}
else if( !strcmp( psz_cmd, "mosaic-keep-aspect-ratio" ) ) else if( !strcmp( psz_cmd, "mosaic-keep-aspect-ratio" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "mosaic-keep-aspect-ratio", val ); var_Set( p_input->p_libvlc_global, "mosaic-keep-aspect-ratio", val );
} }
}
else if( !strcmp( psz_cmd, "logo-file" ) ) else if( !strcmp( psz_cmd, "logo-file" ) )
{
if( strlen( newval.psz_string ) > 0 )
{ {
val.psz_string = newval.psz_string; val.psz_string = newval.psz_string;
var_Set( p_input->p_libvlc_global, "logo-file", val ); var_Set( p_input->p_libvlc_global, "logo-file", val );
} }
}
else if( !strcmp( psz_cmd, "logo-x" ) ) else if( !strcmp( psz_cmd, "logo-x" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "logo-x", val ); var_Set( p_input->p_libvlc_global, "logo-x", val );
} }
}
else if( !strcmp( psz_cmd, "logo-y" ) ) else if( !strcmp( psz_cmd, "logo-y" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "logo-y", val ); var_Set( p_input->p_libvlc_global, "logo-y", val );
} }
}
else if( !strcmp( psz_cmd, "logo-position" ) ) else if( !strcmp( psz_cmd, "logo-position" ) )
{
if( strlen( newval.psz_string ) > 0)
{ {
val.i_int = atoi( newval.psz_string ); val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc_global, "logo-position", val ); var_Set( p_input->p_libvlc_global, "logo-position", val );
} }
}
else if( !strcmp( psz_cmd, "logo-transparency" ) ) else if( !strcmp( psz_cmd, "logo-transparency" ) )
{ {
if( strlen( newval.psz_string ) > 0) val.i_int = atoi( newval.psz_string );
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_input->p_libvlc_global, "logo-transparency", val ); var_Set( p_input->p_libvlc_global, "logo-transparency", val );
} }
}
/* /*
* sanity check * sanity check
*/ */
else else
{
msg_rc( "Unknown command!" ); msg_rc( "Unknown command!" );
}
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
vlc_object_release( p_input ); vlc_object_release( p_input );
......
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