[vlc-commits] [Git][videolan/vlc][master] 4 commits: vout_subpictures: only set the region placement area once
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Jan 15 09:08:58 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
16d6d357 by Steve Lhomme at 2025-01-15T08:56:33+00:00
vout_subpictures: only set the region placement area once
So we can tell right away where the values come from.
- - - - -
20714238 by Steve Lhomme at 2025-01-15T08:56:33+00:00
vout_subpictures: fix bogus SPU scale check
- - - - -
6f3a0585 by Steve Lhomme at 2025-01-15T08:56:33+00:00
vout_subpictures: rename force_crop to crop_highlight
It's the only reason it exists.
- - - - -
53aa031e by Steve Lhomme at 2025-01-15T08:56:33+00:00
vout_subpictures: rename UpdateSPU to SetHighlights
It's less vague.
- - - - -
1 changed file:
- src/video_output/vout_subpictures.c
Changes:
=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -95,7 +95,7 @@ struct spu_private_t {
vlc_mutex_t textlock;
filter_t *scale_yuvp; /**< scaling module for YUVP */
filter_t *scale; /**< scaling module (all but YUVP) */
- bool force_crop; /**< force cropping of subpicture */
+ bool crop_highlight; /**< force cropping of subpicture */
struct {
int x;
int y;
@@ -968,12 +968,12 @@ static struct subpicture_region_rendered *SpuRenderRegion(spu_t *spu,
picture_t *region_picture;
/* Force palette if requested
- * FIXME b_force_palette and force_crop are applied to all subpictures using palette
+ * FIXME b_force_palette and crop_highlight are applied to all subpictures using palette
* instead of only the right one (being the dvd spu).
*/
const bool using_palette = region->p_picture->format.i_chroma == VLC_CODEC_YUVP;
const bool force_palette = using_palette && sys->palette.i_entries > 0;
- const bool crop_requested = (force_palette && sys->force_crop) ||
+ const bool crop_requested = (force_palette && sys->crop_highlight) ||
region->i_max_width || region->i_max_height;
bool changed_palette = false;
@@ -1210,7 +1210,7 @@ static struct subpicture_region_rendered *SpuRenderRegion(spu_t *spu,
/* Force cropping if requested */
if (crop_requested) {
int crop_x, crop_y, crop_width, crop_height;
- if(sys->force_crop){
+ if(sys->crop_highlight){
crop_x = apply_scale ? spu_scale_w(sys->crop.x, scale_size) : sys->crop.x;
crop_y = apply_scale ? spu_scale_h(sys->crop.y, scale_size) : sys->crop.y;
crop_width = apply_scale ? spu_scale_w(sys->crop.width, scale_size) : sys->crop.width;
@@ -1269,10 +1269,26 @@ static struct subpicture_region_rendered *SpuRenderRegion(spu_t *spu,
dst->p_picture->format.i_y_offset = region_fmt.i_y_offset;
dst->p_picture->format.i_visible_width = region_fmt.i_visible_width;
dst->p_picture->format.i_visible_height = region_fmt.i_visible_height;
- dst->place.x = x_offset;
- dst->place.y = y_offset;
- dst->place.width = region_fmt.i_visible_width;
- dst->place.height = region_fmt.i_visible_height;
+ if (!apply_scale && scale_size.w != SCALE_UNIT)
+ {
+ dst->place.x = spu_scale_w(x_offset, scale_size);
+ dst->place.width = spu_scale_w(region_fmt.i_visible_width, scale_size);
+ }
+ else
+ {
+ dst->place.x = x_offset;
+ dst->place.width = region_fmt.i_visible_width;
+ }
+ if (!apply_scale && scale_size.h != SCALE_UNIT)
+ {
+ dst->place.y = spu_scale_h(y_offset, scale_size);
+ dst->place.height = spu_scale_h(region_fmt.i_visible_height, scale_size);
+ }
+ else
+ {
+ dst->place.y = y_offset;
+ dst->place.height = region_fmt.i_visible_height;
+ }
int fade_alpha = 255;
if (subpic->b_fade) {
assert(subpic->i_stop != VLC_TICK_INVALID);
@@ -1285,16 +1301,6 @@ static struct subpicture_region_rendered *SpuRenderRegion(spu_t *spu,
}
dst->i_alpha = fade_alpha * subpic->i_alpha * region->i_alpha / (255 * 255);
- if (!apply_scale && scale_size.h != SCALE_UNIT)
- {
- dst->place.x = spu_scale_w(dst->place.x, scale_size);
- dst->place.width = spu_scale_w(dst->place.width, scale_size);
- }
- if (!apply_scale && scale_size.w != SCALE_UNIT)
- {
- dst->place.y = spu_scale_h(dst->place.y, scale_size);
- dst->place.height = spu_scale_h(dst->place.height, scale_size);
- }
return dst;
}
@@ -1523,21 +1529,21 @@ static vlc_render_subpicture *SpuRenderSubpictures(spu_t *spu,
*****************************************************************************/
/*****************************************************************************
- * UpdateSPU: update subpicture settings
+ * SetHighlights: update subpicture settings
*****************************************************************************/
-static void UpdateSPU(spu_t *spu, const vlc_spu_highlight_t *hl)
+static void SetHighlights(spu_t *spu, const vlc_spu_highlight_t *hl)
{
spu_private_t *sys = spu->p;
vlc_mutex_assert(&sys->lock);
sys->palette.i_entries = 0;
- sys->force_crop = false;
+ sys->crop_highlight = false;
if (hl == NULL)
return;
- sys->force_crop = true;
+ sys->crop_highlight = true;
sys->crop.x = hl->x_start;
sys->crop.y = hl->y_start;
sys->crop.width = hl->x_end - sys->crop.x;
@@ -1971,7 +1977,7 @@ void spu_Attach(spu_t *spu, input_thread_t *input)
{
vlc_mutex_lock(&spu->p->lock);
if (spu->p->input != input) {
- UpdateSPU(spu, NULL);
+ SetHighlights(spu, NULL);
spu->p->input = input;
@@ -2437,6 +2443,6 @@ void spu_ChangeChannelOrderMargin(spu_t *spu, enum vlc_vout_order order,
void spu_SetHighlight(spu_t *spu, const vlc_spu_highlight_t *hl)
{
vlc_mutex_lock(&spu->p->lock);
- UpdateSPU(spu, hl);
+ SetHighlights(spu, hl);
vlc_mutex_unlock(&spu->p->lock);
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6f9e5e559e20828c94b1a72acfb5c961ba0759d7...53aa031ec8caf2a4bb38f4afaa5febcd43fdab26
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6f9e5e559e20828c94b1a72acfb5c961ba0759d7...53aa031ec8caf2a4bb38f4afaa5febcd43fdab26
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list