[vlc-commits] [Git][videolan/vlc][master] codec: aribcaption: fix A/R

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Sat Sep 17 18:45:00 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
2b874a86 by Francois Cartegnie at 2022-09-17T18:26:31+00:00
codec: aribcaption: fix A/R

- - - - -


1 changed file:

- modules/codec/arib/libaribcaption.c


Changes:

=====================================
modules/codec/arib/libaribcaption.c
=====================================
@@ -69,6 +69,8 @@ typedef struct
 {
     decoder_sys_t         *p_dec_sys;
     vlc_tick_t             i_pts;
+    unsigned               i_render_area_width;
+    unsigned               i_render_area_height;
     aribcc_render_result_t render_result;
 } libaribcaption_spu_updater_sys_t;
 
@@ -102,14 +104,17 @@ static int SubpictureValidate(subpicture_t *p_subpic,
                               bool b_dst_changed, const video_format_t *p_dst_format,
                               vlc_tick_t i_ts)
 {
-    VLC_UNUSED(p_src_format);
-
     libaribcaption_spu_updater_sys_t *p_spusys = p_subpic->updater.p_sys;
     decoder_sys_t *p_sys = p_spusys->p_dec_sys;
 
     if (b_src_changed || b_dst_changed) {
         const video_format_t *fmt = p_dst_format;
-        aribcc_renderer_set_frame_size(p_sys->p_renderer, fmt->i_visible_width, fmt->i_visible_height);
+        /* don't let library freely scale using either the min of width or height ratio */
+        p_spusys->i_render_area_width = fmt->i_visible_width;
+        p_spusys->i_render_area_height = p_src_format->i_visible_height * fmt->i_visible_width /
+                                         p_src_format->i_visible_width;
+        aribcc_renderer_set_frame_size(p_sys->p_renderer, p_spusys->i_render_area_width,
+                                                          p_spusys->i_render_area_height);
     }
 
     const vlc_tick_t i_stream_date = p_spusys->i_pts + (i_ts - p_subpic->i_start);
@@ -166,8 +171,8 @@ static void SubpictureUpdate(subpicture_t *p_subpic,
     aribcc_image_t *p_images = p_spusys->render_result.images;
     uint32_t        i_image_count = p_spusys->render_result.image_count;
 
-    p_subpic->i_original_picture_width = fmt.i_visible_width;
-    p_subpic->i_original_picture_height = fmt.i_visible_height;
+    p_subpic->i_original_picture_width = p_spusys->i_render_area_width;
+    p_subpic->i_original_picture_height = p_spusys->i_render_area_height;
 
     if (!p_images || i_image_count == 0) {
         return;
@@ -184,6 +189,8 @@ static void SubpictureUpdate(subpicture_t *p_subpic,
         fmt_region.i_visible_width  = image->width;
         fmt_region.i_height =
         fmt_region.i_visible_height = image->height;
+        fmt_region.i_sar_num = 1;
+        fmt_region.i_sar_den = 1;
 
         subpicture_region_t *region = subpicture_region_New(&fmt_region);
         if (!region)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2b874a86c8ce5269ce569c2b2cd6152eb936d53e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2b874a86c8ce5269ce569c2b2cd6152eb936d53e
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