#define VIDEO_ON_TOP_LONGTEXT N_("Always place the video window on top of " \
"other windows." )
-#define SPUMARGIN_TEXT N_("Force SPU position")
-#define SPUMARGIN_LONGTEXT N_( \
- "You can use this option to place the subtitles under the movie, " \
- "instead of over the movie. Try several positions.")
-
-#define OSD_TEXT N_("On Screen Display")
-#define OSD_LONGTEXT N_( \
- "VLC can display messages on the video. This is called OSD (On Screen " \
- "Display). You can disable this feature here.")
-
#define FILTER_TEXT N_("Video filter module")
#define FILTER_LONGTEXT N_( \
"This will allow you to add a post-processing filter to enhance the " \
#define INPUT_CHAN_TEXT N_("Choose audio channel")
#define INPUT_CHAN_LONGTEXT N_( \
"Give the stream number of the audio channel you want to use in a DVD " \
- "(from 1 to n).")
+ "(from 0 to n).")
-#define INPUT_SUBT_TEXT N_("Choose subtitle track")
-#define INPUT_SUBT_LONGTEXT N_( \
+#define INPUT_SUB_TEXT N_("Choose subtitle track")
+#define INPUT_SUB_LONGTEXT N_( \
"Give the stream number of the subtitle channel you want to use " \
- "(from 1 to n).")
+ "(from 0 to n).")
#define INPUT_REPEAT_TEXT N_("Number of time the same input will be repeated")
#define INPUT_REPEAT_LONGTEXT N_("Number of time the same input will be repeated")
"the form \"{name=bookmark-name,time=optional-time-offset," \
"bytes=optional-byte-offset},{etc...}\"")
+#define SUB_CAT_LONGTEXT N_( \
+ "These options allow you to modify the behavior of the subpictures " \
+ "subsystem. You can for example enable subpictures filters (logo, ...). " \
+ "Enable these filters here and configure them in the " \
+ "\"subpictures filters\" modules section. You can also set many " \
+ "miscellaneous subpictures options." )
+
+#define SPUMARGIN_TEXT N_("Force SPU position")
+#define SPUMARGIN_LONGTEXT N_( \
+ "You can use this option to place the subtitles under the movie, " \
+ "instead of over the movie. Try several positions.")
+
+#define OSD_TEXT N_("On Screen Display")
+#define OSD_LONGTEXT N_( \
+ "VLC can display messages on the video. This is called OSD (On Screen " \
+ "Display). You can disable this feature here.")
+
+#define SUB_FILTER_TEXT N_("Subpictures filter module")
+#define SUB_FILTER_LONGTEXT N_( \
+ "This will allow you to add a subpictures filter for instance to overlay "\
+ "a logo.")
+
#define SUB_AUTO_TEXT N_("Autodetect subtitle files")
#define SUB_AUTO_LONGTEXT \
N_("Automatically detect a subtitle file, if no subtitle filename is " \
add_integer_with_range( "saved-volume", AOUT_VOLUME_DEFAULT,
AOUT_VOLUME_MIN, AOUT_VOLUME_MAX, NULL,
VOLUME_SAVE_TEXT, VOLUME_SAVE_LONGTEXT, VLC_TRUE );
- add_integer( "aout-rate", -1, NULL, AOUT_RATE_TEXT, AOUT_RATE_LONGTEXT, VLC_TRUE );
+ add_integer( "aout-rate", -1, NULL, AOUT_RATE_TEXT,
+ AOUT_RATE_LONGTEXT, VLC_TRUE );
#if !defined( SYS_DARWIN )
- add_bool( "hq-resampling", 1, NULL, AOUT_RESAMP_TEXT, AOUT_RESAMP_LONGTEXT, VLC_TRUE );
+ add_bool( "hq-resampling", 1, NULL, AOUT_RESAMP_TEXT,
+ AOUT_RESAMP_LONGTEXT, VLC_TRUE );
#endif
add_bool( "spdif", 0, NULL, SPDIF_TEXT, SPDIF_LONGTEXT, VLC_FALSE );
- add_integer( "audio-desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT, VLC_TRUE );
- add_string("audio-filter",0,NULL,AUDIO_FILTER_TEXT,
- AUDIO_FILTER_LONGTEXT,VLC_FALSE);
+ add_integer( "audio-desync", 0, NULL, DESYNC_TEXT,
+ DESYNC_LONGTEXT, VLC_TRUE );
+ add_string( "audio-filter", 0, NULL,AUDIO_FILTER_TEXT,
+ AUDIO_FILTER_LONGTEXT, VLC_FALSE );
add_module( "audio-channel-mixer", "audio filter", NULL, NULL,
- AUDIO_CHANNEL_MIXER, AUDIO_CHANNEL_MIXER_LONGTEXT,
- VLC_FALSE );
+ AUDIO_CHANNEL_MIXER, AUDIO_CHANNEL_MIXER_LONGTEXT, VLC_FALSE );
/* Video options */
add_category_hint( N_("Video"), VOUT_CAT_LONGTEXT , VLC_FALSE );
add_integer( "align", 0, NULL, ALIGN_TEXT, ALIGN_LONGTEXT, VLC_TRUE );
change_integer_list( pi_align_values, ppsz_align_descriptions, 0 );
add_float( "zoom", 1, NULL, ZOOM_TEXT, ZOOM_LONGTEXT, VLC_TRUE );
- add_bool( "grayscale", 0, NULL, GRAYSCALE_TEXT, GRAYSCALE_LONGTEXT, VLC_TRUE );
+ add_bool( "grayscale", 0, NULL, GRAYSCALE_TEXT,
+ GRAYSCALE_LONGTEXT, VLC_TRUE );
add_bool( "fullscreen", 0, NULL, FULLSCREEN_TEXT,
- FULLSCREEN_LONGTEXT, VLC_FALSE );
+ FULLSCREEN_LONGTEXT, VLC_FALSE );
+ change_short('F');
#ifndef SYS_DARWIN
add_bool( "overlay", 1, NULL, OVERLAY_TEXT, OVERLAY_LONGTEXT, VLC_TRUE );
#endif
- add_bool( "video-on-top", 0, NULL, VIDEO_ON_TOP_TEXT, VIDEO_ON_TOP_LONGTEXT, VLC_FALSE );
- add_integer( "spumargin", -1, NULL, SPUMARGIN_TEXT,
- SPUMARGIN_LONGTEXT, VLC_TRUE );
- add_bool( "osd", 1, NULL, OSD_TEXT, OSD_LONGTEXT, VLC_FALSE );
+ add_bool( "video-on-top", 0, NULL, VIDEO_ON_TOP_TEXT,
+ VIDEO_ON_TOP_LONGTEXT, VLC_FALSE );
add_module( "filter", "video filter", NULL, NULL,
FILTER_TEXT, FILTER_LONGTEXT, VLC_FALSE );
add_string( "aspect-ratio", "", NULL,
add_string( "pixel-ratio", "1", NULL, PIXEL_RATIO_TEXT, PIXEL_RATIO_TEXT );
#endif
+ /* Subpictures options */
+ add_category_hint( N_("Subpictures"), SUB_CAT_LONGTEXT , VLC_FALSE );
+ add_bool( "osd", 1, NULL, OSD_TEXT, OSD_LONGTEXT, VLC_FALSE );
+ add_bool( "sub-autodetect-file", VLC_TRUE, NULL,
+ SUB_AUTO_TEXT, SUB_AUTO_LONGTEXT, VLC_FALSE );
+ add_integer( "sub-autodetect-fuzzy", 3, NULL,
+ SUB_FUZZY_TEXT, SUB_FUZZY_LONGTEXT, VLC_TRUE );
+#ifdef WIN32
+# define SUB_PATH ".\\subtitles"
+#else
+# define SUB_PATH "./Subtitles, ./subtitles"
+#endif
+ add_string( "sub-autodetect-path", SUB_PATH, NULL,
+ SUB_PATH_TEXT, SUB_PATH_LONGTEXT, VLC_TRUE );
+ add_file( "sub-file", NULL, NULL, SUB_FILE_TEXT,
+ SUB_FILE_LONGTEXT, VLC_TRUE );
+ add_integer( "spumargin", -1, NULL, SPUMARGIN_TEXT,
+ SPUMARGIN_LONGTEXT, VLC_TRUE );
+ add_module( "sub-filter", "subpicture filter", NULL, NULL,
+ SUB_FILTER_TEXT, SUB_FILTER_LONGTEXT, VLC_TRUE );
+
/* Input options */
add_category_hint( N_("Input"), INPUT_CAT_LONGTEXT , VLC_FALSE );
add_integer( "cr-average", 40, NULL, CR_AVERAGE_TEXT,
add_integer( "server-port", 1234, NULL,
SERVER_PORT_TEXT, SERVER_PORT_LONGTEXT, VLC_FALSE );
add_integer( "mtu", 1500, NULL, MTU_TEXT, MTU_LONGTEXT, VLC_TRUE );
- add_string( "iface-addr", "", NULL, IFACE_ADDR_TEXT, IFACE_ADDR_LONGTEXT, VLC_TRUE );
+ add_string( "iface-addr", "", NULL, IFACE_ADDR_TEXT,
+ IFACE_ADDR_LONGTEXT, VLC_TRUE );
add_integer( "program", 0, NULL,
INPUT_PROGRAM_TEXT, INPUT_PROGRAM_LONGTEXT, VLC_TRUE );
add_integer( "audio-channel", -1, NULL,
INPUT_CHAN_TEXT, INPUT_CHAN_LONGTEXT, VLC_FALSE );
add_integer( "spu-channel", -1, NULL,
- INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT, VLC_FALSE );
- add_bool( "sub-autodetect-file", VLC_TRUE, NULL,
- SUB_AUTO_TEXT, SUB_AUTO_LONGTEXT, VLC_FALSE );
- add_integer( "sub-autodetect-fuzzy", 3, NULL,
- SUB_FUZZY_TEXT, SUB_FUZZY_LONGTEXT, VLC_TRUE );
-#ifdef WIN32
-# define SUB_PATH ".\\subtitles"
-#else
-# define SUB_PATH "./Subtitles, ./subtitles"
-#endif
- add_string( "sub-autodetect-path", SUB_PATH, NULL,
- SUB_PATH_TEXT, SUB_PATH_LONGTEXT, VLC_TRUE );
- add_file( "sub-file", NULL, NULL,
- SUB_FILE_TEXT, SUB_FILE_LONGTEXT, VLC_TRUE );
+ INPUT_SUB_TEXT, INPUT_SUB_LONGTEXT, VLC_FALSE );
add_integer( "input-repeat", 0, NULL,
INPUT_REPEAT_TEXT, INPUT_REPEAT_LONGTEXT, VLC_TRUE );
add_integer( "start-time", 0, NULL,
/* Decoder options */
add_category_hint( N_("Decoders"), CODEC_CAT_LONGTEXT , VLC_TRUE );
- add_module( "codec", "decoder", NULL, NULL, CODEC_TEXT, CODEC_LONGTEXT, VLC_TRUE );
- add_module( "encoder", "encoder", NULL, NULL, ENCODER_TEXT, ENCODER_LONGTEXT, VLC_TRUE );
+ add_module( "codec", "decoder", NULL, NULL, CODEC_TEXT,
+ CODEC_LONGTEXT, VLC_TRUE );
+ add_module( "encoder", "encoder", NULL, NULL, ENCODER_TEXT,
+ ENCODER_LONGTEXT, VLC_TRUE );
/* Stream output options */
static int CropCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
+static subpicture_t *sub_new_buffer( filter_t * );
+static void sub_del_buffer( filter_t *, subpicture_t * );
static subpicture_t *spu_new_buffer( filter_t * );
static void spu_del_buffer( filter_t *, subpicture_t * );
static picture_t *spu_new_video_buffer( filter_t * );
static void spu_del_video_buffer( filter_t *, picture_t * );
/**
- * Initialise the subpicture unit
+ * Creates the subpicture unit
*
* \param p_this the parent object which creates the subpicture unit
*/
-spu_t *__spu_Init( vlc_object_t *p_this )
+spu_t *__spu_Create( vlc_object_t *p_this )
{
int i_index;
spu_t *p_spu = vlc_object_create( p_this, VLC_OBJECT_SPU );
p_spu->p_blend = NULL;
p_spu->p_text = NULL;
p_spu->p_scale = NULL;
+ p_spu->i_filter = 0;
/* Register the default subpicture channel */
p_spu->i_channel = 1;
vlc_object_attach( p_spu, p_this );
+ return p_spu;
+}
+
+/**
+ * Initialise the subpicture unit
+ *
+ * \param p_spu the subpicture unit object
+ */
+int spu_Init( spu_t *p_spu )
+{
+ char *psz_filter, *psz_filter_orig;
+ vlc_value_t val;
+
/* If the user requested an SPU margin, we force the position. */
- p_spu->i_margin = config_GetInt( p_spu, "spumargin" );
+ var_Create( p_spu, "spumargin", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+ var_Get( p_spu, "spumargin", &val );
+ p_spu->i_margin = val.i_int;
+
+ var_Create( p_spu, "sub-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+ var_Get( p_spu, "sub-filter", &val );
+ psz_filter = psz_filter_orig = val.psz_string;
+ if( psz_filter && *psz_filter )
+ {
+ p_spu->pp_filter[p_spu->i_filter] =
+ vlc_object_create( p_spu, VLC_OBJECT_FILTER );
+ vlc_object_attach( p_spu->pp_filter[p_spu->i_filter], p_spu );
+ p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_new = sub_new_buffer;
+ p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_del = sub_del_buffer;
+ p_spu->pp_filter[p_spu->i_filter]->p_owner =
+ (filter_owner_sys_t *)p_spu;
+ p_spu->pp_filter[p_spu->i_filter]->p_module =
+ module_Need( p_spu->pp_filter[p_spu->i_filter],
+ "subpicture filter", psz_filter, 0 );
+ if( p_spu->pp_filter[p_spu->i_filter]->p_module ) p_spu->i_filter++;
+ else
+ {
+ msg_Dbg( p_spu, "no subpicture filter found" );
+ vlc_object_detach( p_spu->pp_filter[p_spu->i_filter] );
+ vlc_object_destroy( p_spu->pp_filter[p_spu->i_filter] );
+ }
+ }
+ if( psz_filter_orig ) free( psz_filter_orig );
- return p_spu;
+ return VLC_EGENERIC;
}
/**
vlc_object_destroy( p_spu->p_scale );
}
+ while( p_spu->i_filter-- )
+ {
+ module_Unneed( p_spu->pp_filter[p_spu->i_filter],
+ p_spu->pp_filter[p_spu->i_filter]->p_module );
+ vlc_object_detach( p_spu->pp_filter[p_spu->i_filter] );
+ vlc_object_destroy( p_spu->pp_filter[p_spu->i_filter] );
+ }
+
vlc_mutex_destroy( &p_spu->subpicture_lock );
vlc_object_destroy( p_spu );
}
p_spu->p_text->fmt_out.video.i_visible_height =
p_fmt->i_height;
- p_spu->p_text->pf_spu_buffer_new = spu_new_buffer;
- p_spu->p_text->pf_spu_buffer_del = spu_del_buffer;
+ p_spu->p_text->pf_sub_buffer_new = spu_new_buffer;
+ p_spu->p_text->pf_sub_buffer_del = spu_del_buffer;
p_spu->p_text->p_module =
module_Need( p_spu->p_text, "text renderer", 0, 0 );
*p_region = *p_subpic_tmp->p_region;
p_region->p_next = tmp_region.p_next;
*p_subpic_tmp->p_region = tmp_region;
- p_spu->p_text->pf_spu_buffer_del( p_spu->p_text,
+ p_spu->p_text->pf_sub_buffer_del( p_spu->p_text,
p_subpic_tmp );
}
}
subpicture_t *p_ephemer = NULL;
mtime_t ephemer_date = 0;
+ /* Run subpicture filters */
+ for( i_index = 0; i_index < p_spu->i_filter; i_index++ )
+ {
+ subpicture_t *p_subpic_filter;
+ p_subpic_filter = p_spu->pp_filter[i_index]->
+ pf_sub_filter( p_spu->pp_filter[i_index], display_date );
+ if( p_subpic_filter )
+ {
+ spu_DisplaySubpicture( p_spu, p_subpic_filter );
+ }
+ }
+
/* We get an easily parsable chained list of subpictures which
* ends with NULL since p_subpic was initialized to NULL. */
for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++ )
/*****************************************************************************
* Buffers allocation callbacks for the filters
*****************************************************************************/
+static subpicture_t *sub_new_buffer( filter_t *p_filter )
+{
+ spu_t *p_spu = (spu_t *)p_filter->p_owner;
+ return spu_CreateSubpicture( p_spu );
+}
+
+static void sub_del_buffer( filter_t *p_filter, subpicture_t *p_subpic )
+{
+ spu_t *p_spu = (spu_t *)p_filter->p_owner;
+ spu_DestroySubpicture( p_spu, p_subpic );
+}
+
static subpicture_t *spu_new_buffer( filter_t *p_filter )
{
subpicture_t *p_subpic = (subpicture_t *)malloc(sizeof(subpicture_t));