[vlc-commits] [Git][videolan/vlc][master] 2 commits: vout: turn the spu-fill option into an enum
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sun Nov 29 10:19:55 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
52c7eb02 by Steve Lhomme at 2026-11-29T11:05:56+01:00
vout: turn the spu-fill option into an enum
- - - - -
c5d6cdb8 by Steve Lhomme at 2026-11-29T11:05:56+01:00
vout: allow positioning subpictures in cropped video but not in black bars
Ref. #30224
- - - - -
6 changed files:
- include/vlc_vout_display.h
- lib/media_player.c
- modules/video_output/splitter.c
- src/libvlc-module.c
- src/video_output/video_output.c
- src/video_output/vout_intf.c
Changes:
=====================================
include/vlc_vout_display.h
=====================================
@@ -88,6 +88,15 @@ enum vlc_video_fitting {
VLC_VIDEO_FIT_HEIGHT /**< Fit to height */,
};
+/**
+ * Area to use to position subpictures that are not fixed within the video.
+ */
+enum vlc_subpicture_area {
+ VLC_SUBPICTURE_AREA_VIDEO = 0 /**< Use the video area to position subpictures */,
+ VLC_SUBPICTURE_AREA_WINDOW = 1 /**< Use the whole window area to position subpictures */,
+ VLC_SUBPICTURE_AREA_VIDEO_CROP = 2 /**< Use the cropped video area to position subpictures */,
+};
+
/**
* Display placement and zoom configuration.
*/
@@ -99,7 +108,7 @@ struct vout_display_placement {
vlc_video_align_t align; /**< Alignment within the window */
enum vlc_video_fitting fitting; /**< Scaling/fitting mode */
vlc_rational_t zoom; /**< Zoom ratio (if fitting is disabled) */
- bool full_fill; /**< whether the rendering will take the whole display */
+ enum vlc_subpicture_area full_fill; /**< whether the rendering will take the whole display */
};
/**
=====================================
lib/media_player.c
=====================================
@@ -765,7 +765,7 @@ libvlc_media_player_new( libvlc_instance_t *instance,
var_Create (mp, "sub-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
var_Create (mp, "osd", VLC_VAR_BOOL); // off
- var_Create (mp, "spu-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
+ var_Create (mp, "spu-fill", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
doinherit = module_exists("marq") ? VLC_VAR_DOINHERIT : 0;
var_Create(mp, "marq-marquee", VLC_VAR_STRING);
=====================================
modules/video_output/splitter.c
=====================================
@@ -271,7 +271,7 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
.align = { 0, 0 } /* TODO */,
.fitting = VLC_VIDEO_FIT_SMALLER,
.zoom = { 1, 1 },
- .full_fill = true,
+ .full_fill = VLC_SUBPICTURE_AREA_WINDOW,
},
};
const char *modname = output->psz_module;
=====================================
src/libvlc-module.c
=====================================
@@ -825,9 +825,15 @@ static const char* const ppsz_restore_playback_desc[] = {
#define SPU_LONGTEXT N_( \
"You can completely disable the sub-picture processing.")
-#define SPU_FULL_TEXT N_("Display sub-pictures on full window")
+#define SPU_FULL_TEXT N_("Sub-pictures display area")
#define SPU_FULL_LONGTEXT N_( \
- "It allows showing subtitles in black bars.")
+ "Area to use to position and scale sub-pictures.")
+static const int ppsz_spu_fill_mode[] = {
+ VLC_SUBPICTURE_AREA_VIDEO, VLC_SUBPICTURE_AREA_WINDOW, VLC_SUBPICTURE_AREA_VIDEO_CROP,
+};
+static const char * const ppsz_spu_fill_mode_text[] = {
+ N_("Inside Video"), N_("In Full Window"), N_("Inside Cropped Video"),
+};
#define SECONDARY_SUB_POSITION_TEXT N_("Position of secondary subtitles")
#define SECONDARY_SUB_POSITION_LONGTEXT N_( \
@@ -1803,7 +1809,8 @@ vlc_module_begin ()
add_bool( "spu", true, SPU_TEXT, SPU_LONGTEXT )
change_safe ()
- add_bool( "spu-fill", true, SPU_FULL_TEXT, SPU_FULL_LONGTEXT )
+ add_integer( "spu-fill", VLC_SUBPICTURE_AREA_WINDOW, SPU_FULL_TEXT, SPU_FULL_LONGTEXT )
+ change_integer_list( ppsz_spu_fill_mode, ppsz_spu_fill_mode_text )
change_safe ()
add_bool( "osd", true, OSD_TEXT, OSD_LONGTEXT )
add_module("text-renderer", "text renderer", "any",
=====================================
src/video_output/video_output.c
=====================================
@@ -744,7 +744,7 @@ static void VoutGetDisplayCfg(vout_thread_sys_t *p_vout, const video_format_t *f
const int display_height = var_GetInteger(vout, "height");
cfg->display.width = display_width > 0 ? display_width : 0;
cfg->display.height = display_height > 0 ? display_height : 0;
- cfg->display.full_fill = var_GetBool(vout, "spu-fill");
+ cfg->display.full_fill = var_GetInteger(vout, "spu-fill");
cfg->display.fitting = var_GetBool(vout, "autoscale")
? var_InheritFit(VLC_OBJECT(vout)) : VLC_VIDEO_FIT_NONE;
unsigned msar_num, msar_den;
@@ -1277,8 +1277,16 @@ static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
const bool vd_does_blending = !do_snapshot &&
vd->info.subpicture_chromas &&
*vd->info.subpicture_chromas != 0;
- const bool spu_in_full_window = vd->cfg->display.full_fill &&
- vd_does_blending;
+ const bool is_cropped =
+ // regular crop
+ vd->source->i_visible_width < vd->fmt->i_visible_width ||
+ vd->source->i_visible_height < vd->fmt->i_visible_height ||
+ // fit mode cropping
+ vd->place->x < 0 || vd->place->y < 0;
+ const bool spu_in_full_window =
+ (vd->cfg->display.full_fill == VLC_SUBPICTURE_AREA_WINDOW && vd_does_blending) ||
+ (vd->cfg->display.full_fill == VLC_SUBPICTURE_AREA_VIDEO_CROP && is_cropped);
+
//FIXME: Denying blending_before_converter if vd->source->orientation != ORIENT_NORMAL
//will have the effect that snapshots miss the subpictures. We do this
=====================================
src/video_output/vout_intf.c
=====================================
@@ -357,7 +357,7 @@ void vout_CreateVars( vout_thread_t *p_vout )
var_Create( p_vout, "viewpoint-changeable", VLC_VAR_BOOL );
/* SPU in full window */
- var_Create( p_vout, "spu-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
+ var_Create( p_vout, "spu-fill", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT
| VLC_VAR_ISCOMMAND );
var_Create(p_vout, "override-projection", VLC_VAR_BOOL);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2db16fa53d6662d1e9f12971c6573ffd234c3911...c5d6cdb85e28613d90b61c75d351c2066d8b3377
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2db16fa53d6662d1e9f12971c6573ffd234c3911...c5d6cdb85e28613d90b61c75d351c2066d8b3377
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list