[vlc-commits] [Git][videolan/vlc][master] 2 commits: modules: use actual alignment values in parameter lists

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Mar 5 14:06:40 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
339b320d by Steve Lhomme at 2024-03-05T13:46:45+00:00
modules: use actual alignment values in parameter lists

- - - - -
50486d21 by Steve Lhomme at 2024-03-05T13:46:45+00:00
subtitles: use more const region in SPU encoders

- - - - -


7 changed files:

- modules/codec/dvbsub.c
- modules/codec/subsdec.c
- modules/codec/webvtt/encvtt.c
- modules/codec/zvbi.c
- modules/spu/common.h
- modules/spu/logo.c
- modules/spu/mosaic.c


Changes:

=====================================
modules/codec/dvbsub.c
=====================================
@@ -99,7 +99,17 @@
 #define ENC_POSY_TEXT N_("Encoding Y coordinate")
 #define ENC_POSY_LONGTEXT N_("Y coordinate of the encoded subtitle" )
 
-static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
+static const int pi_pos_values[] = {
+    0,
+    SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_TOP,
+    SUBPICTURE_ALIGN_BOTTOM,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_RIGHT,
+};
 static const char *const ppsz_pos_descriptions[] =
 { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
   N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
@@ -1682,10 +1692,10 @@ typedef struct
 } encoder_sys_t;
 
 #ifdef ENABLE_SOUT
-static void encode_page_composition( encoder_t *, bs_t *, subpicture_t * );
+static void encode_page_composition( encoder_t *, bs_t *, const subpicture_t * );
 static void encode_clut( encoder_t *, bs_t *, subpicture_region_t * );
-static void encode_region_composition( encoder_t *, bs_t *, subpicture_t * );
-static void encode_object( encoder_t *, bs_t *, subpicture_t * );
+static void encode_region_composition( encoder_t *, bs_t *, const subpicture_t * );
+static void encode_object( encoder_t *, bs_t *, const subpicture_t * );
 
 /*****************************************************************************
  * OpenEncoder: probe the encoder and return score
@@ -1736,9 +1746,9 @@ static int OpenEncoder( vlc_object_t *p_this )
  */
 static void YuvaYuvp( subpicture_t *p_subpic )
 {
-    subpicture_region_t *p_region = NULL;
+    const subpicture_region_t *p_region;
 
-    vlc_spu_regions_foreach(p_region, &p_subpic->regions)
+    vlc_spu_regions_foreach_const(p_region, &p_subpic->regions)
     {
         video_format_t *p_fmt = &p_region->p_picture->format;
         int i = 0, j = 0, n = 0, p = 0;
@@ -2043,10 +2053,10 @@ static void CloseEncoder( encoder_t *p_enc )
 }
 
 static void encode_page_composition( encoder_t *p_enc, bs_t *s,
-                                     subpicture_t *p_subpic )
+                                     const subpicture_t *p_subpic )
 {
     encoder_sys_t *p_sys = p_enc->p_sys;
-    subpicture_region_t *p_region;
+    const subpicture_region_t *p_region;
     bool b_mode_change = false;
     unsigned int i_regions;
     int i_timeout;
@@ -2057,7 +2067,7 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
 
     i_regions = 0;
     if (p_subpic)
-    vlc_spu_regions_foreach(p_region, &p_subpic->regions)
+    vlc_spu_regions_foreach_const(p_region, &p_subpic->regions)
     {
         if( i_regions >= p_sys->i_regions )
         {
@@ -2110,7 +2120,7 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
 
     i_regions = 0;
     if (p_subpic)
-    vlc_spu_regions_foreach(p_region, &p_subpic->regions)
+    vlc_spu_regions_foreach_const(p_region, &p_subpic->regions)
     {
         bs_write( s, 8, i_regions );
         bs_write( s, 8, 0 ); /* Reserved */
@@ -2169,14 +2179,14 @@ static void encode_clut( encoder_t *p_enc, bs_t *s, subpicture_region_t *p_regio
 }
 
 static void encode_region_composition( encoder_t *p_enc, bs_t *s,
-                                       subpicture_t *p_subpic )
+                                       const subpicture_t *p_subpic )
 {
     encoder_sys_t *p_sys = p_enc->p_sys;
-    subpicture_region_t *p_region;
+    const subpicture_region_t *p_region;
     unsigned int i_region;
 
     i_region = 0;
-    vlc_spu_regions_foreach(p_region, &p_subpic->regions)
+    vlc_spu_regions_foreach_const(p_region, &p_subpic->regions)
     {
         int i_entries = 4, i_depth = 0x1, i_bg = 0;
         bool b_text = subpicture_region_IsText( p_region );
@@ -2240,19 +2250,19 @@ static void encode_region_composition( encoder_t *p_enc, bs_t *s,
 }
 
 static void encode_pixel_data( encoder_t *p_enc, bs_t *s,
-                               subpicture_region_t *p_region,
+                               const subpicture_region_t *p_region,
                                bool b_top );
 
-static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic )
+static void encode_object( encoder_t *p_enc, bs_t *s, const subpicture_t *p_subpic )
 {
     encoder_sys_t *p_sys = p_enc->p_sys;
-    subpicture_region_t *p_region;
+    const subpicture_region_t *p_region;
     int i_region;
 
     int i_length_pos, i_update_pos, i_pixel_data_pos;
 
     i_region = 0;
-    vlc_spu_regions_foreach(p_region, &p_subpic->regions)
+    vlc_spu_regions_foreach_const(p_region, &p_subpic->regions)
     {
         bs_write( s, 8, 0x0f ); /* Sync byte */
         bs_write( s, 8, DVBSUB_ST_OBJECT_DATA ); /* Segment type */
@@ -2331,14 +2341,14 @@ static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic )
     }
 }
 
-static void encode_pixel_line_2bp( bs_t *s, subpicture_region_t *p_region,
+static void encode_pixel_line_2bp( bs_t *s, const subpicture_region_t *p_region,
                                    int i_line );
-static void encode_pixel_line_4bp( bs_t *s, subpicture_region_t *p_region,
+static void encode_pixel_line_4bp( bs_t *s, const subpicture_region_t *p_region,
                                    int i_line );
-static void encode_pixel_line_8bp( bs_t *s, subpicture_region_t *p_region,
+static void encode_pixel_line_8bp( bs_t *s, const subpicture_region_t *p_region,
                                    int i_line );
 static void encode_pixel_data( encoder_t *p_enc, bs_t *s,
-                               subpicture_region_t *p_region,
+                               const subpicture_region_t *p_region,
                                bool b_top )
 {
     unsigned int i_line;
@@ -2377,7 +2387,7 @@ static void encode_pixel_data( encoder_t *p_enc, bs_t *s,
     }
 }
 
-static void encode_pixel_line_2bp( bs_t *s, subpicture_region_t *p_region,
+static void encode_pixel_line_2bp( bs_t *s, const subpicture_region_t *p_region,
                                    int i_line )
 {
     unsigned int i, i_length = 0;
@@ -2468,7 +2478,7 @@ static void encode_pixel_line_2bp( bs_t *s, subpicture_region_t *p_region,
     bs_align_0( s );
 }
 
-static void encode_pixel_line_4bp( bs_t *s, subpicture_region_t *p_region,
+static void encode_pixel_line_4bp( bs_t *s, const subpicture_region_t *p_region,
                                    int i_line )
 {
     unsigned int i, i_length = 0;
@@ -2566,7 +2576,7 @@ static void encode_pixel_line_4bp( bs_t *s, subpicture_region_t *p_region,
     bs_align_0( s );
 }
 
-static void encode_pixel_line_8bp( bs_t *s, subpicture_region_t *p_region,
+static void encode_pixel_line_8bp( bs_t *s, const subpicture_region_t *p_region,
                                    int i_line )
 {
     unsigned int i, i_length = 0;


=====================================
modules/codec/subsdec.c
=====================================
@@ -161,7 +161,7 @@ static const char *const ppsz_encoding_names[] = {
     N_("Vietnamese (Windows-1258)"),
 };
 
-static const int  pi_justification[] = { -1, 0, 1, 2 };
+static const int  pi_justification[] = { -1, 0, SUBPICTURE_ALIGN_LEFT, SUBPICTURE_ALIGN_RIGHT };
 static const char *const ppsz_justification_text[] = {
     N_("Auto"),N_("Center"),N_("Left"),N_("Right")
 };


=====================================
modules/codec/webvtt/encvtt.c
=====================================
@@ -113,8 +113,8 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
     if( !bo_init( &box, 8 ) )
         return NULL;
 
-    subpicture_region_t *p_region;
-    vlc_spu_regions_foreach(p_region, &p_spu->regions)
+    const subpicture_region_t *p_region;
+    vlc_spu_regions_foreach_const(p_region, &p_spu->regions)
     {
         if(!subpicture_region_IsText( p_region )||
             p_region->p_text == NULL ||


=====================================
modules/codec/zvbi.c
=====================================
@@ -77,7 +77,17 @@ static void Close( vlc_object_t * );
 
 #define LEVEL_TEXT N_("Presentation Level")
 
-static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
+static const int pi_pos_values[] = {
+    0,
+    SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_TOP,
+    SUBPICTURE_ALIGN_BOTTOM,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_RIGHT,
+};
 static const char *const ppsz_pos_descriptions[] =
 { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
   N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
@@ -101,7 +111,7 @@ vlc_module_begin ()
                  PAGE_TEXT, PAGE_LONGTEXT )
     add_bool( "vbi-opaque", true,
                  OPAQUE_TEXT, OPAQUE_LONGTEXT )
-    add_integer( "vbi-position", 8, POS_TEXT, POS_LONGTEXT )
+    add_integer( "vbi-position", SUBPICTURE_ALIGN_BOTTOM, POS_TEXT, POS_LONGTEXT )
         change_integer_list( pi_pos_values, ppsz_pos_descriptions )
     add_bool( "vbi-text", false,
               TELX_TEXT, TELX_LONGTEXT )


=====================================
modules/spu/common.h
=====================================
@@ -18,6 +18,8 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include <vlc_subpicture.h>
+
 #define OPACITY_TEXT N_("Opacity")
 #define OPACITY_LONGTEXT N_("Opacity (inverse of transparency), " \
   "from 0 for fully transparent to 255 for fully opaque." )
@@ -34,7 +36,18 @@
   "also use combinations of these values, e.g. 6 = top-right).")
 
 /* Excluding absolute, these values correspond to SUBPICTURE_ALIGN_* flags */
-static const int pi_pos_values[] = { -1, 0, 1, 2, 4, 8, 5, 6, 9, 10 };
+static const int pi_pos_values[] = {
+    -1,
+    0,
+    SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_TOP,
+    SUBPICTURE_ALIGN_BOTTOM,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_RIGHT,
+};
 static const char *const ppsz_pos_descriptions[] =
 { N_("Absolute"),
   N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),


=====================================
modules/spu/logo.c
=====================================
@@ -703,4 +703,3 @@ static logo_t *LogoListCurrent( logo_list_t *p_list )
 {
     return &p_list->p_logo[p_list->i_counter];
 }
-


=====================================
modules/spu/mosaic.c
=====================================
@@ -166,7 +166,17 @@ static const int pi_pos_values[] = { 0, 1, 2 };
 static const char *const ppsz_pos_descriptions[] =
     { N_("auto"), N_("fixed"), N_("offsets") };
 
-static const int pi_align_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
+static const int pi_align_values[] = {
+    0,
+    SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_TOP,
+    SUBPICTURE_ALIGN_BOTTOM,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_RIGHT,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_LEFT,
+    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_RIGHT,
+};
 static const char *const ppsz_align_descriptions[] =
      { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
      N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a3896968128d16df4e279af8003b5a8f4bcc6bc0...50486d21523b5fc0e5dcd1a5348a1aac43f0d821

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a3896968128d16df4e279af8003b5a8f4bcc6bc0...50486d21523b5fc0e5dcd1a5348a1aac43f0d821
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