[vlc-devel] [PATCH 01/10] vout: define crop configuration as a type

remi at remlab.net remi at remlab.net
Sat Feb 6 16:27:23 UTC 2021


From: RĂ©mi Denis-Courmont <remi at remlab.net>

This creates a separate structure type for the crop configuration.
No functional changes.
---
 src/video_output/video_output.c  | 22 +---------------------
 src/video_output/vout_internal.h | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 323b40c084..d01bf880d6 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -82,27 +82,7 @@ typedef struct vout_thread_sys_t
     /* */
     struct {
         vlc_rational_t dar;
-        struct {
-            enum vout_crop_mode mode;
-            union {
-                struct {
-                    unsigned num;
-                    unsigned den;
-                } ratio;
-                struct {
-                    unsigned x;
-                    unsigned y;
-                    unsigned width;
-                    unsigned height;
-                } window;
-                struct {
-                    unsigned left;
-                    unsigned right;
-                    unsigned top;
-                    unsigned bottom;
-                } border;
-            };
-        } crop;
+        struct vout_crop crop;
     } source;
 
     /* Snapshot interface */
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index ef92f1c889..a351106224 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -103,6 +103,29 @@ int vout_ChangeSource( vout_thread_t *p_vout, const video_format_t *fmt );
 enum vout_crop_mode {
     VOUT_CROP_NONE, VOUT_CROP_RATIO, VOUT_CROP_WINDOW, VOUT_CROP_BORDER,
 };
+
+struct vout_crop {
+    enum vout_crop_mode mode;
+    union {
+        struct {
+            unsigned num;
+            unsigned den;
+        } ratio;
+        struct {
+            unsigned x;
+            unsigned y;
+            unsigned width;
+            unsigned height;
+        } window;
+        struct {
+            unsigned left;
+            unsigned right;
+            unsigned top;
+            unsigned bottom;
+        } border;
+    };
+};
+
 bool GetCropMode(const char *crop_str, enum vout_crop_mode *mode,
                         unsigned *num, unsigned *den,
                         unsigned *x, unsigned *y,
-- 
2.30.0



More information about the vlc-devel mailing list