Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
657c8a43 by Steve Lhomme at 2024-04-09T07:14:12+00:00
zvbi: regroup text/non-text subpicture init values

No functional changes.

- - - - -
2d91db34 by Steve Lhomme at 2024-04-09T07:14:12+00:00
zvbi: initialize the position for picture regions

The default alignment is centered horizontally.
It was done that way before b16c3726520d651c41f07efd400b466a8d94a4f0.

- - - - -
dc6eb5e7 by Steve Lhomme at 2024-04-09T07:14:12+00:00
video_text: only init i_x/i_y once

No need for extra math.

- - - - -
b92c25d0 by Steve Lhomme at 2024-04-09T07:14:12+00:00
subpicture: init the position of the PIP region

It's positioned at the center of the display by default as the PIP 
doesn't set any
alignment or set the absolute flag.

It was the value set by the calloc before 
4f0d7e7731854c5ab6ac6a338867c27745b8ad3d.

- - - - -
4300e9f0 by Steve Lhomme at 2024-04-09T07:14:12+00:00
subsuf: init the position of picture regions

The default alignment is centered horizontally and vertically unless
it sets a margin.
It was done that way before b16c3726520d651c41f07efd400b466a8d94a4f0.

- - - - -
fafe68aa by Steve Lhomme at 2024-04-09T07:14:12+00:00
kate: init the position of bitmap regions

The default alignment is centered horizontally and aligned to the bottom.
It was initialized that way before b16c3726520d651c41f07efd400b466a8d94a4f0.

- - - - -
a6d4ca5a by Steve Lhomme at 2024-04-09T07:14:12+00:00
bluray: init new regions to the top/left of the video

The subpicture is set to absolute so it corresponds to an absolute location in 
the video.
It was initialized that way before b16c3726520d651c41f07efd400b466a8d94a4f0.

- - - - -
296b3365 by Steve Lhomme at 2024-04-09T07:14:12+00:00
substext: set the margin to 0 when settling the fixed position

If it's aligned to the center vertically/horitonzally, the margin to the 
center wasn't set.

- - - - -
d060e36f by Steve Lhomme at 2024-04-09T07:14:12+00:00
test: input_decoder: init the position of bitmap regions

The default alignment is centered horizontally and aligned to the bottom.
It was initialized that way before b16c3726520d651c41f07efd400b466a8d94a4f0.

- - - - -
7735e2b2 by Steve Lhomme at 2024-04-09T07:14:12+00:00
vout_subpictures: check the region position is set before rendering text

It's also checked when the rendered region is placed, but it's better 
if we check
before rendering to identify if the initialization is missing from the text 
rendering or
the text source.

- - - - -


9 changed files:

- modules/access/bluray.c
- modules/codec/kate.c
- modules/codec/substext.h
- modules/codec/subsusf.c
- modules/codec/zvbi.c
- src/misc/subpicture.c
- src/video_output/video_text.c
- src/video_output/vout_subpictures.c
- test/src/input/decoder/input_decoder_scenarios.c


Changes:

=====================================
modules/access/bluray.c
=====================================
@@ -2044,6 +2044,8 @@ static void blurayDrawArgbOverlay(demux_t *p_demux, const 
BD_ARGB_OVERLAY* const
             return;
         }
         p_reg->b_absolute = true;
+        p_reg->i_x = 0;
+        p_reg->i_y = 0;
         vlc_spu_regions_push(&ov->regions, p_reg);
     }
 


=====================================
modules/codec/kate.c
=====================================
@@ -1162,6 +1162,8 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t 
*p_dec, subpicture_t *p_spu,
     if (p_bitmap_region)
     {
         p_bitmap_region->i_align = SUBPICTURE_ALIGN_BOTTOM;
+        p_bitmap_region->i_x = 0;
+        p_bitmap_region->i_y = 0;
     }
     p_region->i_x = 0;
     p_region->i_y = 10;


=====================================
modules/codec/substext.h
=====================================
@@ -193,11 +193,15 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
                 r->i_x = margin_h + fmt_dst->i_x_offset;
             else if (r->i_align & SUBPICTURE_ALIGN_RIGHT)
                 r->i_x = margin_h + outerright_h;
+            else
+                r->i_x = 0;
 
             if (r->i_align & SUBPICTURE_ALIGN_TOP )
                 r->i_y = margin_v + fmt_dst->i_y_offset;
             else if (r->i_align & SUBPICTURE_ALIGN_BOTTOM )
                 r->i_y = margin_v + outerbottom_v;
+            else
+                r->i_y = 0;
 
             if( update_region->flags & UPDT_REGION_ORIGIN_X_IS_RATIO )
                 r->i_x += update_region->origin.x * inner_w;


=====================================
modules/codec/subsusf.c
=====================================
@@ -1092,6 +1092,8 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t 
*p_dec,
         msg_Err( p_dec, "cannot allocate SPU region" );
         return NULL;
     }
+    p_region->i_x = 0;
+    p_region->i_y = 0;
     assert( p_pic->format.i_chroma == VLC_CODEC_YUVA );
     /* FIXME the copy is probably not needed anymore */
     picture_CopyPixels( p_region->p_picture, p_pic );


=====================================
modules/codec/zvbi.c
=====================================
@@ -573,22 +573,25 @@ static subpicture_t *Subpicture( decoder_t *p_dec,
         return NULL;
     }
     vlc_spu_regions_push(&p_spu->regions, p_region);
+
+    p_spu->i_start = i_pts;
     if ( b_text )
     {
+        p_spu->i_stop = i_pts + VLC_TICK_FROM_SEC(10);
         p_region->b_absolute = false;
     }
     else
     {
+        p_spu->i_stop = 0;
         p_region->b_absolute = true;
+        p_region->i_align = i_align;
+        // bottom center based on "vbi-position"
+        p_region->i_x = 0;
+        p_region->i_y = 0;
     }
 
-    p_spu->i_start = i_pts;
-    p_spu->i_stop = b_text ? i_pts + VLC_TICK_FROM_SEC(10): 0;
     p_spu->b_ephemer = true;
 
-    if( !b_text )
-        p_region->i_align = i_align;
-
     return p_spu;
 }
 


=====================================
src/misc/subpicture.c
=====================================
@@ -164,6 +164,9 @@ subpicture_t *subpicture_NewFromPicture( vlc_object_t 
*p_obj,
     p_region->fmt.i_sar_num =
     p_region->fmt.i_sar_den = 0;
 
+    // margin to the center or to the top/left if the subpicture is absolute
+    p_region->i_x = 0;
+    p_region->i_y = 0;
 
     vlc_spu_regions_push( &p_subpic->regions, p_region );
     return p_subpic;


=====================================
src/video_output/video_text.c
=====================================
@@ -72,17 +72,19 @@ static void OSDTextUpdate(subpicture_t *subpic,
     r->text_flags |= sys->position;
     r->b_absolute = false;
     r->i_align = sys->position;
-    r->i_x = 0;
     if (r->i_align & SUBPICTURE_ALIGN_LEFT)
-        r->i_x += margin_h + fmt_dst->i_x_offset;
+        r->i_x = margin_h + fmt_dst->i_x_offset;
     else if (r->i_align & SUBPICTURE_ALIGN_RIGHT)
-        r->i_x += margin_h - fmt_dst->i_x_offset;
+        r->i_x = margin_h - fmt_dst->i_x_offset;
+    else
+        r->i_x = 0;
 
-    r->i_y = 0;
     if (r->i_align & SUBPICTURE_ALIGN_TOP )
-        r->i_y += margin_v + fmt_dst->i_y_offset;
+        r->i_y = margin_v + fmt_dst->i_y_offset;
     else if (r->i_align & SUBPICTURE_ALIGN_BOTTOM )
-        r->i_y += margin_v - fmt_dst->i_y_offset;
+        r->i_y = margin_v - fmt_dst->i_y_offset;
+    else
+        r->i_y = 0;
 }
 
 static void OSDTextDestroy(subpicture_t *subpic)


=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -428,6 +428,7 @@ static subpicture_region_t *SpuRenderText(spu_t *spu,
 
     text->fmt_out.video.i_height =
     text->fmt_out.video.i_visible_height = output_height;
+    assert(region->i_x != INT_MAX && region->i_y != INT_MAX);
 
     subpicture_region_t *rendered_region = text->ops->render(text, region, 
chroma_list);
     assert(rendered_region == NULL || 
!subpicture_region_IsText(rendered_region));


=====================================
test/src/input/decoder/input_decoder_scenarios.c
=====================================
@@ -487,6 +487,8 @@ static int cc_decoder_decode_common(decoder_t *dec, 
vlc_frame_t *in,
     vlc_spu_regions_push( &subpic->regions, p_region );
 
     p_region->b_absolute = true;
+    p_region->i_x = 0;
+    p_region->i_y = 0;
     p_region->p_text = text_segment_New(text);
     assert(p_region->p_text != NULL);
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0587956a91a017bc739f9f930375bc664a6c10e9...7735e2b2facb0b93b4709507a9e1316836e32084

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0587956a91a017bc739f9f930375bc664a6c10e9...7735e2b2facb0b93b4709507a9e1316836e32084
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to