Commit fcb440b4 authored by Mark Moriarty's avatar Mark Moriarty

Make logo-x, logo-y operate relative to upper left corner. ...

Make logo-x, logo-y operate relative to upper left corner.  logo-x/-y/-position/-transparency accessible via rc
parent 7a38b5e0
......@@ -418,6 +418,17 @@ static void Run( intf_thread_t *p_intf )
var_Create( p_intf, "time-size", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "time-size", Other, NULL );
/* logo on the fly items */
var_Create( p_intf, "logo-x", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "logo-x", Other, NULL );
var_Create( p_intf, "logo-y", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "logo-y", Other, NULL );
var_Create( p_intf, "logo-position", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "logo-position", Other, NULL );
var_Create( p_intf, "logo-transparency", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "logo-transparency", Other, NULL );
var_Create( p_intf, "pause", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "pause", Input, NULL );
var_Create( p_intf, "seek", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
......@@ -709,21 +720,26 @@ static void Run( intf_thread_t *p_intf )
if (p_intf->p_sys->b_extend)
{
msg_rc(_("| marq-marquee STRING . . overlay STRING in video\n"));
msg_rc(_("| marq-x X . . . . . offset of marquee, from left\n"));
msg_rc(_("| marq-y Y . . . . . . offset of marquee, from top\n"));
msg_rc(_("| marq-x X . . . . . . . . . . . .offset from left\n"));
msg_rc(_("| marq-y Y . . . . . . . . . . . . offset from top\n"));
msg_rc(_("| marq-position #. . . .relative position control\n"));
msg_rc(_("| marq-color # . . . . font color of marquee, RGB\n"));
msg_rc(_("| marq-opacity # . . . . . . . .opacity of marquee\n"));
msg_rc(_("| marq-timeout T. . . . timeout of marquee, in ms\n"));
msg_rc(_("| marq-size # . . . font size of marquee, in pixels\n"));
msg_rc(_("| marq-color # . . . . . . . . . . font color, RGB\n"));
msg_rc(_("| marq-opacity # . . . . . . . . . . . . . opacity\n"));
msg_rc(_("| marq-timeout T. . . . . . . . . . timeout, in ms\n"));
msg_rc(_("| marq-size # . . . . . . . . font size, in pixels\n"));
msg_rc( "| \n");
msg_rc(_("| time-format STRING . . . overlay STRING in video\n"));
msg_rc(_("| time-x X . . . . .offset of timestamp, from left\n"));
msg_rc(_("| time-y Y . . . . . offset of timestamp, from top\n"));
msg_rc(_("| time-position #. . . .relative position control\n"));
msg_rc(_("| time-color # . . . font color of timestamp, RGB\n"));
msg_rc(_("| time-opacity # . . . . . . .opacity of timestamp\n"));
msg_rc(_("| time-size # . .font size of timestamp, in pixels\n"));
msg_rc(_("| time-x X . . . . . . . . . . . .offset from left\n"));
msg_rc(_("| time-y Y . . . . . . . . . . . . offset from top\n"));
msg_rc(_("| time-position #. . . . . . . . relative position\n"));
msg_rc(_("| time-color # . . . . . . . . . . font color, RGB\n"));
msg_rc(_("| time-opacity # . . . . . . . . . . . . . opacity\n"));
msg_rc(_("| time-size # . . . . . . . . font size, in pixels\n"));
msg_rc( "| \n");
msg_rc(_("| logo-x X . . . . . . . . . . . .offset from left\n"));
msg_rc(_("| logo-y Y . . . . . . . . . . . . offset from top\n"));
msg_rc(_("| logo-position #. . . . . . . . relative position\n"));
msg_rc(_("| logo-transparency #. . . . . . . . .transparency\n"));
msg_rc( "| \n");
}
msg_rc(_("| help . . . . . . . . . . . . . this help message\n"));
......@@ -1216,6 +1232,38 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd,
var_Set( p_inp->p_libvlc, "time-size", val );
}
}
else if( !strcmp( psz_cmd, "logo-x" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_inp->p_libvlc, "logo-x", val );
}
}
else if( !strcmp( psz_cmd, "logo-y" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_inp->p_libvlc, "logo-y", val );
}
}
else if( !strcmp( psz_cmd, "logo-position" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_inp->p_libvlc, "logo-position", val );
}
}
else if( !strcmp( psz_cmd, "logo-transparency" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_inp->p_libvlc, "logo-transparency", val );
}
}
/*
* sanity check
......
......@@ -34,6 +34,7 @@
#include "vlc_filter.h"
#include "filter_common.h"
#include "vlc_image.h"
#include "osd.h"
#ifdef LoadImage
# undef LoadImage
......@@ -95,7 +96,7 @@ vlc_module_begin();
add_file( "logo-file", NULL, NULL, FILE_TEXT, FILE_LONGTEXT, VLC_FALSE );
add_integer( "logo-x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_FALSE );
add_integer( "logo-y", -1, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_FALSE );
add_integer( "logo-y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_FALSE );
add_integer_with_range( "logo-transparency", 255, 0, 255, NULL,
TRANS_TEXT, TRANS_LONGTEXT, VLC_FALSE );
add_integer( "logo-position", 6, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
......@@ -522,13 +523,6 @@ static int CreateFilter( vlc_object_t *p_this )
var_AddCallback( p_input->p_libvlc, "logo-transparency", LogoCallback, p_sys );
vlc_object_release( p_input );
p_sys->b_absolute = VLC_TRUE;
if( p_sys->posx < 0 || p_sys->posy < 0 )
{
p_sys->b_absolute = VLC_FALSE;
p_sys->posx = 0; p_sys->posy = 0;
}
p_sys->p_pic = LoadImage( p_this, p_sys->psz_filename );
if( !p_sys->p_pic )
{
......@@ -637,11 +631,23 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
}
vout_CopyPicture( p_filter, &p_region->picture, p_sys->p_pic );
p_region->i_x = 0;
p_region->i_y = 0;
/* where to locate the logo: */
if( p_sys->posx < 0 || p_sys->posy < 0 )
{ /* set to one of the 9 relative locations */
p_spu->i_flags = p_sys->pos;
p_spu->i_x = 0;
p_spu->i_y = 0;
p_spu->b_absolute = VLC_FALSE;
}
else
{ /* set to an absolute xy, referenced to upper left corner */
p_spu->i_flags = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
p_spu->i_x = p_sys->posx;
p_spu->i_y = p_sys->posy;
p_spu->i_flags = p_sys->pos;
p_spu->b_absolute = VLC_TRUE;
}
p_spu->p_region = p_region;
p_spu->i_alpha = p_sys->i_trans;
......
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