[vlc-commits] demux: mock: Add orientation option

Tanguy Dubroca git at videolan.org
Mon Oct 5 20:45:23 CEST 2020


vlc | branch: master | Tanguy Dubroca <tanguy.dubroca at lse.epita.fr> | Mon Sep 21 16:59:05 2020 +0200| [ba96ac162322b9c280fc58fc1b8792743f8573b5] | committer: Alexandre Janniaux

demux: mock: Add orientation option

Usage: ./vlc 'mock://<mock options>;video_orientation=<orientation>'

The video_orientation option is an integer representing the raw
values of video_orientation_t. Thus the range of possible values
is ORIENT_TOP_LEFT = 0 -> ORIENT_RIGHT_BOTTOM = 7.

Fix #25054

Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ba96ac162322b9c280fc58fc1b8792743f8573b5
---

 modules/demux/mock.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mock.c b/modules/demux/mock.c
index aeb46f0d90..d645520ad0 100644
--- a/modules/demux/mock.c
+++ b/modules/demux/mock.c
@@ -136,7 +136,8 @@ var_Read_float(const char *psz)
     Y(video, width, unsigned, add_integer, Unsigned, 640) \
     Y(video, height, unsigned, add_integer, Unsigned, 480) \
     Y(video, frame_rate, unsigned, add_integer, Unsigned, 25) \
-    Y(video, frame_rate_base, unsigned, add_integer, Unsigned, 1)
+    Y(video, frame_rate_base, unsigned, add_integer, Unsigned, 1) \
+    Y(video, orientation, unsigned, add_integer, Unsigned, ORIENT_NORMAL)
 
 #define OPTIONS_SUB(Y) \
     Y(sub, packetized, bool, add_bool, Bool, true)\
@@ -647,12 +648,19 @@ ConfigureVideoTrack(demux_t *demux,
         return VLC_EGENERIC;
     }
 
+    if (options->orientation > ORIENT_RIGHT_BOTTOM)
+    {
+        msg_Err(demux, "Invalid orientation value %u", options->orientation);
+        return VLC_EGENERIC;
+    }
+
     fmt->i_codec = chroma;
     fmt->video.i_chroma = chroma;
     fmt->video.i_width = fmt->video.i_visible_width = options->width;
     fmt->video.i_height = fmt->video.i_visible_height = options->height;
     fmt->video.i_frame_rate = options->frame_rate;
     fmt->video.i_frame_rate_base = options->frame_rate_base;
+    fmt->video.orientation = options->orientation;
 
     fmt->b_packetized = options->packetized;
 



More information about the vlc-commits mailing list