const char *,
libvlc_exception_t * );
+enum libvlc_video_logo_option_t {
+ libvlc_logo_enable,
+ libvlc_logo_file, /**< string argument, "file,d,t;file,d,t;..." */
+ libvlc_logo_x,
+ libvlc_logo_y,
+ libvlc_logo_delay,
+ libvlc_logo_repeat,
+ libvlc_logo_opacity,
+ libvlc_logo_position,
+};
+
+/**
+ * Get integer logo option.
+ *
+ * \param p_mi libvlc media player instance
+ * \param option logo option to get, values of libvlc_video_logo_option_t
+ * \param p_e an pointer to an initialized exception object
+ */
+VLC_PUBLIC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
+ unsigned option, libvlc_exception_t *p_e );
+
+/**
+ * Set logo option as integer. Options that take a different type value
+ * cause an invalid argument exception.
+ * Passing libvlc_logo_enable as option value has the side effect of
+ * starting (arg !0) or stopping (arg 0) the logo filter.
+ *
+ * \param p_mi libvlc media player instance
+ * \param option logo option to set, values of libvlc_video_logo_option_t
+ * \param value logo option value
+ * \param p_e an pointer to an initialized exception object
+ */
+VLC_PUBLIC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
+ unsigned option, int value, libvlc_exception_t *p_e );
+
+/**
+ * Set logo option as string. Options that take a different type value
+ * cause an invalid argument exception.
+ *
+ * \param p_mi libvlc media player instance
+ * \param option logo option to set, values of libvlc_video_logo_option_t
+ * \param psz_value logo option value
+ * \param p_e an pointer to an initialized exception object
+ */
+VLC_PUBLIC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
+ unsigned option, const char *psz_value, libvlc_exception_t *p_e );
+
/** @} video */
/** \defgroup libvlc_audio libvlc_audio
#define POSY_TEXT N_("Y coordinate")
#define POSY_LONGTEXT N_("Y coordinate of the logo. You can move the logo " \
"by left-clicking it." )
-#define TRANS_TEXT N_("Transparency of the logo")
-#define TRANS_LONGTEXT N_("Logo transparency value " \
+#define OPACITY_TEXT N_("Opacity of the logo")
+#define OPACITY_LONGTEXT N_("Logo opacity value " \
"(from 0 for full transparency to 255 for full opacity)." )
#define POS_TEXT N_("Logo position")
#define POS_LONGTEXT N_( \
/* default to 1000 ms per image, continuously cycle through them */
add_integer( CFG_PREFIX "delay", 1000, NULL, DELAY_TEXT, DELAY_LONGTEXT, true )
add_integer( CFG_PREFIX "repeat", -1, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, true )
- add_integer_with_range( CFG_PREFIX "transparency", 255, 0, 255, NULL,
- TRANS_TEXT, TRANS_LONGTEXT, false )
+ add_integer_with_range( CFG_PREFIX "opacity", 255, 0, 255, NULL,
+ OPACITY_TEXT, OPACITY_LONGTEXT, false )
add_integer( CFG_PREFIX "position", -1, NULL, POS_TEXT, POS_LONGTEXT, false )
change_integer_list( pi_pos_values, ppsz_pos_descriptions, NULL )
};
static const char *const ppsz_filter_options[] = {
- "file", "x", "y", "delay", "repeat", "transparency", "position", NULL
+ "file", "x", "y", "delay", "repeat", "opacity", "position", NULL
};
static const char *const ppsz_filter_callbacks[] = {
"logo-x",
"logo-y",
"logo-position",
- "logo-transparency",
+ "logo-opacity",
"logo-repeat",
NULL
};
if( *psz_filename == '\0' )
msg_Warn( p_this, "no logo file specified" );
- p_list->i_alpha = var_CreateGetIntegerCommand( p_filter,
- "logo-transparency");
+ p_list->i_alpha = var_CreateGetIntegerCommand( p_filter, "logo-opacity");
p_list->i_alpha = __MAX( __MIN( p_list->i_alpha, 255 ), 0 );
- p_list->i_delay =
- var_CreateGetIntegerCommand( p_filter, "logo-delay" );
- p_list->i_repeat =
- var_CreateGetIntegerCommand( p_filter, "logo-repeat" );
+ p_list->i_delay = var_CreateGetIntegerCommand( p_filter, "logo-delay" );
+ p_list->i_repeat = var_CreateGetIntegerCommand( p_filter, "logo-repeat" );
p_sys->i_pos = var_CreateGetIntegerCommand( p_filter, "logo-position" );
p_sys->i_pos_x = var_CreateGetIntegerCommand( p_filter, "logo-x" );
{
p_sys->i_pos = newval.i_int;
}
- else if ( !strcmp( psz_var, "logo-transparency" ) )
+ else if ( !strcmp( psz_var, "logo-opacity" ) )
{
p_list->i_alpha = __MAX( __MIN( newval.i_int, 255 ), 0 );
}
/**
* It loads the logo images into memory.
*
- * Read the logo-file input switch, obtaining a list of images and associated
- * durations and transparencies. Store the image(s), and times. An image
- * without a stated time or transparency will use the logo-delay and
- * logo-transparency values.
+ * Read the logo-file input switch, obtaining a list of images and
+ * associated durations and transparencies. Store the image(s), and
+ * times. An image without a stated time or opacity will use the
+ * logo-delay and logo-opacity values.
*/
static void LogoListLoad( vlc_object_t *p_this, logo_list_t *p_logo_list,
const char *psz_filename )
/*****************************************************************************
* video.c: libvlc new API video functions
*****************************************************************************
- * Copyright (C) 2005 the VideoLAN team
+ * Copyright (C) 2005-2010 the VideoLAN team
*
* $Id$
*
* libvlc_video_get_marquee_option_as_int : get a marq option value
*****************************************************************************/
int libvlc_video_get_marquee_option_as_int( libvlc_media_player_t *p_mi,
- libvlc_video_marquee_int_option_t option,
- libvlc_exception_t *p_e )
+ libvlc_video_marquee_int_option_t option,
+ libvlc_exception_t *p_e )
{
const char * identifier = get_marquee_int_option_identifier(option);
if(!identifier)
* libvlc_video_get_marquee_option_as_string : get a marq option value
*****************************************************************************/
char * libvlc_video_get_marquee_option_as_string( libvlc_media_player_t *p_mi,
- libvlc_video_marquee_string_option_t option,
+ libvlc_video_marquee_string_option_t option,
libvlc_exception_t *p_e )
{
const char * identifier = get_marquee_string_option_identifier(option);
* libvlc_video_set_marquee_option_as_int: enable, disable or set an int option
*****************************************************************************/
void libvlc_video_set_marquee_option_as_int( libvlc_media_player_t *p_mi,
- libvlc_video_marquee_int_option_t option,
- int value, libvlc_exception_t *p_e )
+ libvlc_video_marquee_int_option_t option,
+ int value, libvlc_exception_t *p_e )
{
const char * identifier = get_marquee_int_option_identifier(option);
if(!identifier)
* libvlc_video_set_marquee_option_as_string: set a string option
*****************************************************************************/
void libvlc_video_set_marquee_option_as_string( libvlc_media_player_t *p_mi,
- libvlc_video_marquee_string_option_t option,
- const char * value,
- libvlc_exception_t *p_e )
+ libvlc_video_marquee_string_option_t option,
+ const char * value, libvlc_exception_t *p_e )
{
const char * identifier = get_marquee_string_option_identifier(option);
if(!identifier)
var_SetString(marquee, identifier, value);
vlc_object_release(marquee);
}
+
+
+/* logo module support */
+
+static vlc_object_t *get_logo_object( libvlc_media_player_t * p_mi,
+ libvlc_exception_t *p_e )
+{
+ vlc_object_t *object = NULL;
+ vout_thread_t *vout = GetVout( p_mi, p_e );
+ libvlc_exception_clear( p_e );
+ if( vout )
+ {
+ object = vlc_object_find_name( vout, "logo", FIND_CHILD );
+ vlc_object_release(vout);
+ }
+ if( !object )
+ {
+ libvlc_exception_raise( p_e );
+ libvlc_printerr( "Logo not enabled" );
+ }
+ return object;
+}
+
+
+typedef const struct vlogo_opt {
+ const char name[16];
+ unsigned type;
+} vlogo_opt_t;
+
+
+static vlogo_opt_t *
+logo_option_bynumber( unsigned option, libvlc_exception_t *p_e )
+{
+# define CFG_PREFIX "logo-"
+ vlogo_opt_t vlogo_optlist[] = /* depends on libvlc_video_logo_option_t */
+ {
+ { "logo", 0 },
+ { "logo-file", VLC_VAR_STRING },
+ { "logo-x", VLC_VAR_INTEGER },
+ { "logo-y", VLC_VAR_INTEGER },
+ { "logo-delay", VLC_VAR_INTEGER },
+ { "logo-repeat", VLC_VAR_INTEGER },
+ { "logo-opacity", VLC_VAR_INTEGER },
+ { "logo-position", VLC_VAR_INTEGER },
+ };
+# undef CFG_PREFIX
+ enum { num_vlogo_opts = sizeof(vlogo_optlist) / sizeof(*vlogo_optlist) };
+
+ vlogo_opt_t *r = option < num_vlogo_opts ? vlogo_optlist+option : NULL;
+ if( !r )
+ {
+ libvlc_exception_raise( p_e );
+ libvlc_printerr( "Unknown marquee option" );
+ }
+ return r;
+}
+
+
+void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
+ unsigned option, const char *psz_value,
+ libvlc_exception_t *p_e )
+{
+ vlogo_opt_t *opt = logo_option_bynumber( option, p_e );
+ printf("logo set string (%u)%s = %s.\n", option,
+ (opt?(opt->name):"<unkn>"),(psz_value?psz_value:"<null>"));
+ if( !opt ) return;
+ vlc_object_t *logo = get_logo_object( p_mi, p_e );
+ if( !logo ) return;
+
+ switch( opt->type )
+ {
+ case VLC_VAR_STRING:
+ var_SetString( logo, opt->name, psz_value );
+ break;
+ default:
+ libvlc_exception_raise( p_e );
+ libvlc_printerr( "Invalid argument" );
+ break;
+ }
+ vlc_object_release(logo);
+}
+
+
+void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
+ unsigned option, int value,
+ libvlc_exception_t *p_e )
+{
+ vlogo_opt_t *opt = logo_option_bynumber( option, p_e );
+ printf("logo set integer (%u)%s = %i.\n",
+ option, (opt?(opt->name):"<unkn>"),value);
+ if( !opt ) return;
+
+ if( !opt->type ) /* libvlc_logo_enable */
+ {
+ vout_thread_t *vout = GetVout( p_mi, p_e );
+ libvlc_exception_clear( p_e );
+ if (vout)
+ {
+ vout_EnableFilter(vout, opt->name, value, false);
+ vlc_object_release(vout);
+ }
+ return;
+ }
+
+ vlc_object_t *logo = get_logo_object( p_mi, p_e );
+ if( !logo ) return;
+
+ switch( opt->type )
+ {
+ case VLC_VAR_INTEGER:
+ var_SetInteger(logo, opt->name, value);
+ break;
+ default:
+ libvlc_exception_raise( p_e );
+ libvlc_printerr( "Invalid argument" );
+ break;
+ }
+ vlc_object_release(logo);
+}
+
+
+int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
+ unsigned option, libvlc_exception_t *p_e )
+{
+ vlogo_opt_t *opt = logo_option_bynumber( option, p_e );
+ printf("logo get integer (%u)%s.\n", option, opt?opt->name:"<unkn>");
+ if( !opt ) return 0;
+
+ vlc_object_t *logo = get_logo_object( p_mi, p_e );
+ if( !logo ) return 0;
+
+ int ret;
+ switch( opt->type )
+ {
+ case 0: /* libvlc_logo_enable */
+ ret = NULL != logo;
+ break;
+ case VLC_VAR_INTEGER:
+ ret = var_GetInteger(logo, opt->name);
+ break;
+ default:
+ libvlc_exception_raise( p_e );
+ libvlc_printerr( "Invalid argument" );
+ ret = 0;
+ break;
+ }
+ vlc_object_release(logo);
+ return ret;
+}