[vlc-commits] [Git][videolan/vlc][master] 12 commits: spu(audiobargraph_v, logo, marq, rss): fix missing choice list entry

Jean-Baptiste Kempf gitlab at videolan.org
Mon May 10 14:17:37 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
16a61233 by Lyndon Brown at 2021-05-10T11:59:09+00:00
spu(audiobargraph_v,logo,marq,rss): fix missing choice list entry

the default value (`-1`) did not correspond to any choice list entry,
thus causing buggy behaviour wrt. saving preferences. (which is very
noticeable in a new preferences interface i have built).

this adds the `-1` choice list entry for 'absolute' to fix that.

---

i questioned whether adding such an entry was correct in terms of it
possibly being redundant alongside top-left + offsets. i noted that
there is a specific code path for absolute mode involving marking the
spu as positioned absolutely. i am not certain whether or not this is
actually redundant for these plugins, and thus did not implement the
alternative solution of ripping out those absolute mode bits and
changing the default to `5` (top-left).

my understanding, from spending time researching git history and the
current codebase (without a great understanding of the spu code yet
though) is that the absolute property comes into play when there are
multiple spus, being to do with prevention of overlaps. absolute mode
forces position, whilst non-absolute allows moving spus to fix
overlap.

- - - - -
00fc2403 by Lyndon Brown at 2021-05-10T11:59:09+00:00
spu(audiobargraph_v,logo,marq,rss): fix poor positioning text/docs

 - offsets can be used for both absolute and relative positioning (except
   offsetting from center).
 - the `i_pos` attribute holds indication of absolute mode, not just
   relative, which was incorrectly stated in marq and rss. (note that
   logo and bargraph have an `i_absolute` attribute, but this is actually
   unneeded and can be removed later).

labels are synchronised across plugins to reduce translator burden and
improve consistency.

- - - - -
9ed2f419 by Lyndon Brown at 2021-05-10T11:59:09+00:00
spu(audiobargraph_v,logo,marq,rss): sync common option text

... bringing better consistency and reducing translator burden.

some simplified by removing unnecessary plugin name.

fixed typo of "eg" instead of "e.g.", and inconsistent use of ','
vs. ';' in same text.

- - - - -
701bb8a6 by Lyndon Brown at 2021-05-10T11:59:09+00:00
spu: move common defines to new shared header

note that in the logo case, an extra note is added to the end of the pos
x/y longtext, requiring an override.

position texts tweaked to make generic.

- - - - -
1482a9d0 by Lyndon Brown at 2021-05-10T11:59:09+00:00
audiobargraph_v: rename `transparency` option to `opacity`

for consistency with options of the other spu plugins. the meaning of the
range of values appears to be identical, the only difference was the
option name.

- - - - -
fb15e597 by Lyndon Brown at 2021-05-10T11:59:09+00:00
spu(audiobargraph,logo): fix redundant align attribute

i believe that this is an entirely non-functional change upon the
belief that this property is not used in absolute mode (and thus is
actually rather pointlessly being set). i'm just changing it out of
pedantic correctness.

the top-right setting did not match the positioning done by absolute
mode (see `SpuRegionPlace()` in vout_subpictures.c), and was
inconsistent with what was set in marq and rss plugins.

this originates for logo with 5a33cfd28d051ecd885bbcbee0e3465fba8ae1a7
whereby the author decided for no apparent reason to change the
property to reflect the previous position default of 6 (top-right).

this seems to have then been inherited through copy & paste i guess
into the creation of audiobargraph_v in 0e3ec2274b60aca41c60c2dc37d61e408be70236.

- - - - -
c8410c7d by Lyndon Brown at 2021-05-10T11:59:09+00:00
spu(audiobargraph,logo): remove useless var

in audiobargraph it's never even initialised.

it is unnecessary since `i_pos` being `-1` suffices to signal absolute
positioning mode within the module, and the copy into `p_spu->b_absolute`
gets overwritten a few lines further down.

- - - - -
6b3c3d33 by Lyndon Brown at 2021-05-10T11:59:09+00:00
spu(audiobargraph,logo): fix buggy positioning with video filtering

the condition check with the comment "Ignore aligment if a position is
given for video filter" is meant to force absolute mode if positive x/y
values are given (in video filtering mode), causing a separate condition
block to skip calculations for x/y. (it seems x/y offsets from relative
positions are not supported in video filtering mode).

problematically though, the condition check set the position value to
`0` instead of `-1`, and the x/y calculation block condition checked
for a non-zero value, which meant that:
 - center,center relative positioning was not possible (pos=0).
 - if position was set to `-1` (as per default) to signal absolute, and
   x/y were not both positive, the x/y calculation block would set about
   trying to calculate x/y based upon incorrectly reading alignment flags
   from the `-1` position value, thus calculating a bogus position.

this commit fixes these issues by correctly signalling and checking for
absolute mode.

- - - - -
26e31343 by Lyndon Brown at 2021-05-10T11:59:09+00:00
spu(audiobargraph,logo): simplification

(non-functional change)

flip of logic from a negative align-[top|left] check to a positive one,
duplicating order things are done in `SpuRegionPlace()`, for better
readability.

also, compacted the condition block in the logo case by dropping
unnecessary braces.

- - - - -
5fc1af11 by Lyndon Brown at 2021-05-10T11:59:09+00:00
audiobargraph_v: fix overwriting vfilter position

with the x/y defaults being zero, for video filtering, any specified
relative position would always be overwritten with absolute positioning
by a condition check.

this fixes the problem by using `-1` for defaults, as with the logo plugin.

- - - - -
08de6996 by Lyndon Brown at 2021-05-10T11:59:09+00:00
audiobargraph_v: catch negative vfilter x/y

... as done in logo.

- - - - -
ae406f9e by Lyndon Brown at 2021-05-10T11:59:09+00:00
spu: fix formatting

- - - - -


8 changed files:

- modules/spu/Makefile.am
- modules/spu/audiobargraph_v.c
- + modules/spu/common.h
- modules/spu/logo.c
- modules/spu/marq.c
- modules/spu/rss.c
- po/POTFILES.in
- src/video_output/vout_subpictures.c


Changes:

=====================================
modules/spu/Makefile.am
=====================================
@@ -1,5 +1,7 @@
 spudir = $(pluginsdir)/spu
 
+noinst_HEADERS += spu/common.h
+
 # sub filters
 libsubsdelay_plugin_la_SOURCES = spu/subsdelay.c
 spu_LTLIBRARIES = libsubsdelay_plugin.la


=====================================
modules/spu/audiobargraph_v.c
=====================================
@@ -31,6 +31,8 @@
 #include <string.h>
 #include <math.h>
 
+#include "common.h"
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
@@ -41,18 +43,6 @@
  * Module descriptor
  *****************************************************************************/
 
-#define POSX_TEXT N_("X coordinate")
-#define POSX_LONGTEXT N_("X coordinate of the bargraph.")
-#define POSY_TEXT N_("Y coordinate")
-#define POSY_LONGTEXT N_("Y coordinate of the bargraph.")
-#define TRANS_TEXT N_("Transparency of the bargraph")
-#define TRANS_LONGTEXT N_("Bargraph transparency value " \
-  "(from 0 for full transparency to 255 for full opacity).")
-#define POS_TEXT N_("Bargraph position")
-#define POS_LONGTEXT N_(\
-  "Enforce the bargraph position on the video " \
-  "(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
-  "also use combinations of these values, eg 6 = top-right).")
 #define BARWIDTH_TEXT N_("Bar width in pixel")
 #define BARWIDTH_LONGTEXT N_("Width in pixel of each bar in the BarGraph to be displayed." )
 #define BARHEIGHT_TEXT N_("Bar Height in pixel")
@@ -60,11 +50,6 @@
 
 #define CFG_PREFIX "audiobargraph_v-"
 
-static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
-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") };
-
 static int  OpenSub  (filter_t *);
 static int  OpenVideo(filter_t *);
 static void Close    (filter_t *);
@@ -80,10 +65,11 @@ vlc_module_begin ()
     add_shortcut("audiobargraph_v")
 
     add_obsolete_string(CFG_PREFIX "i_values")
-    add_integer(CFG_PREFIX "x", 0, POSX_TEXT, POSX_LONGTEXT, true)
-    add_integer(CFG_PREFIX "y", 0, POSY_TEXT, POSY_LONGTEXT, true)
-    add_integer_with_range(CFG_PREFIX "transparency", 255, 0, 255,
-        TRANS_TEXT, TRANS_LONGTEXT, false)
+    add_integer(CFG_PREFIX "x", -1, POSX_TEXT, POSX_LONGTEXT, true)
+    add_integer(CFG_PREFIX "y", -1, POSY_TEXT, POSY_LONGTEXT, true)
+    add_obsolete_integer(CFG_PREFIX "transparency") /* since 4.0.0 */
+    add_integer_with_range(CFG_PREFIX "opacity", 255, 0, 255,
+        OPACITY_TEXT, OPACITY_LONGTEXT, false)
     add_integer(CFG_PREFIX "position", -1, POS_TEXT, POS_LONGTEXT, false)
         change_integer_list(pi_pos_values, ppsz_pos_descriptions)
     add_obsolete_integer(CFG_PREFIX "alarm")
@@ -132,20 +118,19 @@ typedef struct
     int i_pos;
     int i_pos_x;
     int i_pos_y;
-    bool b_absolute;
 
     /* On the fly control variable */
     bool b_spu_update;
 } filter_sys_t;
 
 static const char *const ppsz_filter_options[] = {
-    "x", "y", "transparency", "position", "barWidth", "barHeight", NULL
+    "x", "y", "opacity", "position", "barWidth", "barHeight", NULL
 };
 
 static const char *const ppsz_filter_callbacks[] = {
     "audiobargraph_v-x",
     "audiobargraph_v-y",
-    "audiobargraph_v-transparency",
+    "audiobargraph_v-opacity",
     "audiobargraph_v-position",
     "audiobargraph_v-barWidth",
     "audiobargraph_v-barHeight",
@@ -330,7 +315,7 @@ static int BarGraphCallback(vlc_object_t *p_this, char const *psz_var,
         p_sys->i_pos_y = newval.i_int;
     else if (!strcmp(psz_var, CFG_PREFIX "position"))
         p_sys->i_pos = newval.i_int;
-    else if (!strcmp(psz_var, CFG_PREFIX "transparency"))
+    else if (!strcmp(psz_var, CFG_PREFIX "opacity"))
         p_BarGraph->i_alpha = VLC_CLIP(newval.i_int, 0, 255);
     else if (!strcmp(psz_var, CFG_PREFIX "i_values")) {
         if (newval.psz_string)
@@ -379,7 +364,6 @@ static subpicture_t *FilterSub(filter_t *p_filter, vlc_tick_t date)
     if (!p_spu)
         goto exit;
 
-    p_spu->b_absolute = p_sys->b_absolute;
     p_spu->i_start = date;
     p_spu->i_stop = 0;
     p_spu->b_ephemer = true;
@@ -407,15 +391,15 @@ static subpicture_t *FilterSub(filter_t *p_filter, vlc_tick_t date)
 
     /*  where to locate the bar graph: */
     if (p_sys->i_pos < 0) {   /*  set to an absolute xy */
-        p_region->i_align = SUBPICTURE_ALIGN_RIGHT | SUBPICTURE_ALIGN_TOP;
+        p_region->i_align = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
         p_spu->b_absolute = true;
     } else {   /* set to one of the 9 relative locations */
         p_region->i_align = p_sys->i_pos;
         p_spu->b_absolute = false;
     }
 
-    p_region->i_x = p_sys->i_pos_x;
-    p_region->i_y = p_sys->i_pos_y;
+    p_region->i_x = p_sys->i_pos_x > 0 ? p_sys->i_pos_x : 0;
+    p_region->i_y = p_sys->i_pos_y > 0 ? p_sys->i_pos_y : 0;
 
     p_spu->p_region = p_region;
 
@@ -455,20 +439,30 @@ static picture_t *FilterVideo(filter_t *p_filter, picture_t *p_src)
     const int i_dst_w = p_filter->fmt_out.video.i_visible_width;
     const int i_dst_h = p_filter->fmt_out.video.i_visible_height;
 
-    if (p_sys->i_pos) {
-        if (p_sys->i_pos & SUBPICTURE_ALIGN_BOTTOM)
+    if (p_sys->i_pos >= 0) {
+        if (p_sys->i_pos & SUBPICTURE_ALIGN_TOP)
+            p_sys->i_pos_y = 0;
+        else if (p_sys->i_pos & SUBPICTURE_ALIGN_BOTTOM)
             p_sys->i_pos_y = i_dst_h - p_fmt->i_visible_height;
-        else if (!(p_sys->i_pos & SUBPICTURE_ALIGN_TOP))
-            p_sys->i_pos_y = (i_dst_h - p_fmt->i_visible_height) / 2;
         else
-            p_sys->i_pos_y = 0;
+            p_sys->i_pos_y = (i_dst_h - p_fmt->i_visible_height) / 2;
 
-        if (p_sys->i_pos & SUBPICTURE_ALIGN_RIGHT)
+        if (p_sys->i_pos & SUBPICTURE_ALIGN_LEFT)
+            p_sys->i_pos_x = 0;
+        else if (p_sys->i_pos & SUBPICTURE_ALIGN_RIGHT)
             p_sys->i_pos_x = i_dst_w - p_fmt->i_visible_width;
-        else if (!(p_sys->i_pos & SUBPICTURE_ALIGN_LEFT))
-            p_sys->i_pos_x = (i_dst_w - p_fmt->i_visible_width) / 2;
         else
-            p_sys->i_pos_x = 0;
+            p_sys->i_pos_x = (i_dst_w - p_fmt->i_visible_width) / 2;
+    }
+
+    if( p_sys->i_pos_x < 0 || p_sys->i_pos_y < 0 )
+    {
+        msg_Warn( p_filter,
+            "bargraph(%ix%i) doesn't fit into video(%ix%i)",
+            p_fmt->i_visible_width, p_fmt->i_visible_height,
+            i_dst_w,i_dst_h );
+        p_sys->i_pos_x = (p_sys->i_pos_x > 0) ? p_sys->i_pos_x : 0;
+        p_sys->i_pos_y = (p_sys->i_pos_y > 0) ? p_sys->i_pos_y : 0;
     }
 
     /* */
@@ -533,7 +527,7 @@ static int OpenCommon(filter_t *p_filter, bool b_sub)
     p_sys->i_pos_y = var_CreateGetInteger(p_filter, CFG_PREFIX "y");
     BarGraph_t *p_BarGraph = &p_sys->p_BarGraph;
     p_BarGraph->p_pic = NULL;
-    p_BarGraph->i_alpha = var_CreateGetInteger(p_filter, CFG_PREFIX "transparency");
+    p_BarGraph->i_alpha = var_CreateGetInteger(p_filter, CFG_PREFIX "opacity");
     p_BarGraph->i_alpha = VLC_CLIP(p_BarGraph->i_alpha, 0, 255);
     p_BarGraph->i_values = NULL;
     parse_i_values(p_BarGraph, &(char){ 0 });
@@ -544,7 +538,7 @@ static int OpenCommon(filter_t *p_filter, bool b_sub)
 
     /* Ignore aligment if a position is given for video filter */
     if (!b_sub && p_sys->i_pos_x >= 0 && p_sys->i_pos_y >= 0)
-        p_sys->i_pos = 0;
+        p_sys->i_pos = -1;
 
     vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_filter));
 


=====================================
modules/spu/common.h
=====================================
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * common.h : common spu defines
+ *****************************************************************************
+ * Copyright (C) 2021 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#define OPACITY_TEXT N_("Opacity")
+#define OPACITY_LONGTEXT N_("Opacity (inverse of transparency), " \
+  "from 0 for fully transparent to 255 for fully opaque." )
+
+#define POSX_TEXT N_("X offset")
+#define POSY_TEXT N_("Y offset")
+#define POSX_LONGTEXT N_("X offset, from top-left, or from relative position." )
+#define POSY_LONGTEXT N_("Y offset, from top-left, or from relative position." )
+
+#define POS_TEXT N_("Position")
+#define POS_LONGTEXT N_( \
+  "Set the position on the video " \
+  "(-1=absolute, 0=center, 1=left, 2=right, 4=top, 8=bottom; you can " \
+  "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 char *const ppsz_pos_descriptions[] =
+{ N_("Absolute"),
+  N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
+  N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };


=====================================
modules/spu/logo.c
=====================================
@@ -30,6 +30,8 @@
 #endif
 #include <assert.h>
 
+#include "common.h"
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
@@ -49,36 +51,23 @@
 #define FILE_LONGTEXT N_("Full path of the image files to use. Format is " \
 "<image>[,<delay in ms>[,<alpha>]][;<image>[,<delay>[,<alpha>]]][;...]. " \
 "If you only have one file, simply enter its filename.")
-#define REPEAT_TEXT N_("Logo animation # of loops")
+#define REPEAT_TEXT N_("Animation loops")
 #define REPEAT_LONGTEXT N_("Number of loops for the logo animation. " \
         "-1 = continuous, 0 = disabled")
-#define DELAY_TEXT N_("Logo individual image time in ms")
+#define DELAY_TEXT N_("Display time in ms")
 #define DELAY_LONGTEXT N_("Individual image display time of 0 - 60000 ms.")
 
-#define POSX_TEXT N_("X coordinate")
-#define POSX_LONGTEXT N_("X coordinate of the logo. You can move the logo " \
-                "by left-clicking it." )
-#define POSY_TEXT N_("Y coordinate")
-#define POSY_LONGTEXT N_("Y coordinate of the logo. You can move the logo " \
-                "by left-clicking it." )
-#define OPACITY_TEXT N_("Opacity of the logo")
-#define OPACITY_LONGTEXT N_("Logo opacity value " \
-  "(from 0 for full transparency to 255 for full opacity)." )
-#define POS_TEXT N_("Logo position")
-#define POS_LONGTEXT N_( \
-  "Enforce the logo position on the video " \
-  "(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
-  "also use combinations of these values, eg 6 = top-right).")
+#undef POSX_LONGTEXT
+#undef POSY_LONGTEXT
+#define POSX_LONGTEXT N_("X offset, from top-left, or from relative position. " \
+                         "You can move the logo by left-clicking it." )
+#define POSY_LONGTEXT N_("Y offset, from top-left, or from relative position. " \
+                         "You can move the logo by left-clicking it." )
 
 #define LOGO_HELP N_("Use a local picture as logo on the video")
 
 #define CFG_PREFIX "logo-"
 
-static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
-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") };
-
 static int  OpenSub  ( filter_t * );
 static int  OpenVideo( filter_t * );
 static void Close    ( filter_t * );
@@ -159,7 +148,6 @@ typedef struct
     int i_pos;
     int i_pos_x;
     int i_pos_y;
-    bool b_absolute;
 
     /* On the fly control variable */
     bool b_spu_update;
@@ -283,11 +271,10 @@ static int OpenCommon( filter_t *p_filter, bool b_sub )
     p_sys->i_pos = var_CreateGetIntegerCommand( p_filter, "logo-position" );
     p_sys->i_pos_x = var_CreateGetIntegerCommand( p_filter, "logo-x" );
     p_sys->i_pos_y = var_CreateGetIntegerCommand( p_filter, "logo-y" );
-    p_sys->b_absolute = (p_sys->i_pos < 0);
 
     /* Ignore aligment if a position is given for video filter */
     if( !b_sub && p_sys->i_pos_x >= 0 && p_sys->i_pos_y >= 0 )
-        p_sys->i_pos = 0;
+        p_sys->i_pos = -1;
 
     vlc_mutex_init( &p_sys->lock );
     LogoListLoad( VLC_OBJECT(p_filter), p_list, psz_filename );
@@ -363,7 +350,6 @@ static subpicture_t *FilterSub( filter_t *p_filter, vlc_tick_t date )
     if( !p_spu )
         goto exit;
 
-    p_spu->b_absolute = p_sys->b_absolute;
     p_spu->i_start = date;
     p_spu->i_stop = 0;
     p_spu->b_ephemer = true;
@@ -404,7 +390,7 @@ static subpicture_t *FilterSub( filter_t *p_filter, vlc_tick_t date )
     /*  where to locate the logo: */
     if( p_sys->i_pos < 0 )
     {   /*  set to an absolute xy */
-        p_region->i_align = SUBPICTURE_ALIGN_RIGHT | SUBPICTURE_ALIGN_TOP;
+        p_region->i_align = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
         p_spu->b_absolute = true;
     }
     else
@@ -458,33 +444,21 @@ static picture_t *FilterVideo( filter_t *p_filter, picture_t *p_src )
         const int i_dst_w = p_filter->fmt_out.video.i_visible_width;
         const int i_dst_h = p_filter->fmt_out.video.i_visible_height;
 
-        if( p_sys->i_pos )
+        if( p_sys->i_pos >= 0 )
         {
-            if( p_sys->i_pos & SUBPICTURE_ALIGN_BOTTOM )
-            {
+            if( p_sys->i_pos & SUBPICTURE_ALIGN_TOP )
+                p_sys->i_pos_y = 0;
+            else if( p_sys->i_pos & SUBPICTURE_ALIGN_BOTTOM )
                 p_sys->i_pos_y = i_dst_h - p_fmt->i_visible_height;
-            }
-            else if ( !(p_sys->i_pos & SUBPICTURE_ALIGN_TOP) )
-            {
-                p_sys->i_pos_y = ( i_dst_h - p_fmt->i_visible_height ) / 2;
-            }
             else
-            {
-                p_sys->i_pos_y = 0;
-            }
+                p_sys->i_pos_y = ( i_dst_h - p_fmt->i_visible_height ) / 2;
 
-            if( p_sys->i_pos & SUBPICTURE_ALIGN_RIGHT )
-            {
+            if( p_sys->i_pos & SUBPICTURE_ALIGN_LEFT )
+                p_sys->i_pos_x = 0;
+            else if( p_sys->i_pos & SUBPICTURE_ALIGN_RIGHT )
                 p_sys->i_pos_x = i_dst_w - p_fmt->i_visible_width;
-            }
-            else if ( !(p_sys->i_pos & SUBPICTURE_ALIGN_LEFT) )
-            {
-                p_sys->i_pos_x = ( i_dst_w - p_fmt->i_visible_width ) / 2;
-            }
             else
-            {
-                p_sys->i_pos_x = 0;
-            }
+                p_sys->i_pos_x = ( i_dst_w - p_fmt->i_visible_width ) / 2;
         }
 
         if( p_sys->i_pos_x < 0 || p_sys->i_pos_y < 0 )


=====================================
modules/spu/marq.c
=====================================
@@ -32,6 +32,8 @@
 
 #include <errno.h>
 
+#include "common.h"
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
@@ -70,8 +72,9 @@ typedef struct
 {
     vlc_mutex_t lock;
 
-    int i_xoff, i_yoff;  /* offsets for the display string in the video window */
-    int i_pos; /* permit relative positioning (top, bottom, left, right, center) */
+    int i_xoff, i_yoff; /* positioning offsets */
+    int i_pos; /* positioning: absolute, or relative location (top, bottom, left, right, center) */
+
     vlc_tick_t i_timeout;
 
     char *format; /**< marquee text format */
@@ -92,10 +95,6 @@ typedef struct
     "%M = minute, %S = second, ...)" )
 #define FILE_TEXT N_("Text file")
 #define FILE_LONGTEXT N_("File to read the marquee text from.")
-#define POSX_TEXT N_("X offset")
-#define POSX_LONGTEXT N_("X offset, from the left screen edge." )
-#define POSY_TEXT N_("Y offset")
-#define POSY_LONGTEXT N_("Y offset, down from the top." )
 #define TIMEOUT_TEXT N_("Timeout")
 #define TIMEOUT_LONGTEXT N_("Number of milliseconds the marquee must remain " \
                             "displayed. Default value is " \
@@ -104,9 +103,6 @@ typedef struct
 #define REFRESH_LONGTEXT N_("Number of milliseconds between string updates. " \
                             "This is mainly useful when using meta data " \
                             "or time format string sequences.")
-#define OPACITY_TEXT N_("Opacity")
-#define OPACITY_LONGTEXT N_("Opacity (inverse of transparency) of " \
-    "overlayed text. 0 = transparent, 255 = totally opaque." )
 #define SIZE_TEXT N_("Font size, pixels")
 #define SIZE_LONGTEXT N_("Font size, in pixels. Default is 0 (use default " \
     "font size)." )
@@ -117,17 +113,6 @@ typedef struct
     "chars are for red, then green, then blue. #000000 = black, #FF0000 = red,"\
     " #00FF00 = green, #FFFF00 = yellow (red + green), #FFFFFF = white" )
 
-#define POS_TEXT N_("Marquee position")
-#define POS_LONGTEXT N_( \
-  "You can enforce the marquee position on the video " \
-  "(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
-  "also use combinations of these values, eg 6 = top-right).")
-
-static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
-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") };
-
 #define CFG_PREFIX "marq-"
 
 #define MARQUEE_HELP N_("Display text above the video")


=====================================
modules/spu/rss.c
=====================================
@@ -36,6 +36,8 @@
 
 #include <time.h>
 
+#include "common.h"
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
@@ -103,8 +105,9 @@ typedef struct
     vlc_timer_t timer;  /* Timer to refresh the rss feeds */
     bool b_fetched;
 
-    int i_xoff, i_yoff;  /* offsets for the display string in the video window */
-    int i_pos; /* permit relative positioning (top, bottom, left, right, center) */
+    int i_xoff, i_yoff; /* positioning offsets */
+    int i_pos; /* positioning: absolute, or relative location (top, bottom, left, right, center) */
+
     vlc_tick_t i_speed;
     int i_length;
 
@@ -138,14 +141,6 @@ typedef struct
 #define IMAGE_TEXT N_("Feed images")
 #define IMAGE_LONGTEXT N_("Display feed images if available.")
 
-#define POSX_TEXT N_("X offset")
-#define POSX_LONGTEXT N_("X offset, from the left screen edge." )
-#define POSY_TEXT N_("Y offset")
-#define POSY_LONGTEXT N_("Y offset, down from the top." )
-#define OPACITY_TEXT N_("Opacity")
-#define OPACITY_LONGTEXT N_("Opacity (inverse of transparency) of " \
-    "overlay text. 0 = transparent, 255 = totally opaque." )
-
 #define SIZE_TEXT N_("Font size, pixels")
 #define SIZE_LONGTEXT N_("Font size, in pixels. Default is 0 (use default " \
     "font size)." )
@@ -156,22 +151,11 @@ typedef struct
     "chars are for red, then green, then blue. #000000 = black, #FF0000 = red,"\
     " #00FF00 = green, #FFFF00 = yellow (red + green), #FFFFFF = white" )
 
-#define POS_TEXT N_("Text position")
-#define POS_LONGTEXT N_( \
-  "You can enforce the text position on the video " \
-  "(0=center, 1=left, 2=right, 4=top, 8=bottom; you can " \
-  "also use combinations of these values, eg 6 = top-right).")
-
 #define TITLE_TEXT N_("Title display mode")
 #define TITLE_LONGTEXT N_("Title display mode. Default is 0 (hidden) if the feed has an image and feed images are enabled, 1 otherwise.")
 
 #define RSS_HELP N_("Display a RSS or ATOM Feed on your video")
 
-static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
-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") };
-
 enum title_modes {
     default_title=-1,
     hide_title,


=====================================
po/POTFILES.in
=====================================
@@ -1176,6 +1176,7 @@ modules/services_discovery/upnp.cpp
 modules/services_discovery/windrive.c
 modules/services_discovery/xcb_apps.c
 modules/spu/audiobargraph_v.c
+modules/spu/common.h
 modules/spu/dynamicoverlay/dynamicoverlay.c
 modules/spu/logo.c
 modules/spu/marq.c


=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -1233,7 +1233,7 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
              * FIXME The current scaling ensure that the heights match, the width being
              * cropped.
              */
-            spu_scale_t scale = spu_scale_createq((int64_t)fmt_dst->i_visible_height                 * fmt_dst->i_sar_den * region_fmt.i_sar_num,
+            spu_scale_t scale = spu_scale_createq((int64_t)fmt_dst->i_visible_height         * fmt_dst->i_sar_den * region_fmt.i_sar_num,
                                                   (int64_t)subpic->i_original_picture_height * fmt_dst->i_sar_num * region_fmt.i_sar_den,
                                                   fmt_dst->i_visible_height,
                                                   subpic->i_original_picture_height);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c15e2691ef24b1eae01b29dca8fcbdfed64963ed...ae406f9e6be4eb0b7d6b8db6edd51005d5af546f

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




More information about the vlc-commits mailing list