[vlc-devel] [PATCH] vlc_common: rename vlc_rational_t to vlc_urational_t

Steve Lhomme robux4 at videolabs.io
Wed Apr 12 12:53:40 CEST 2017


Since it's always unsigned and matches var_InheritURational() better.
---
 include/vlc_common.h                   | 2 +-
 include/vlc_fourcc.h                   | 4 ++--
 include/vlc_vout_display.h             | 2 +-
 include/vlc_vout_wrapper.h             | 2 +-
 modules/codec/avcodec/avcommon.h       | 4 ++--
 modules/video_output/opengl/internal.h | 4 ++--
 src/misc/fourcc_gen.c                  | 2 +-
 src/video_output/display.c             | 6 +++---
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index a3663accdd..5cc0730879 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -838,7 +838,7 @@ static inline void SetQWLE (void *p, uint64_t qw)
 
 typedef struct {
     unsigned num, den;
-} vlc_rational_t;
+} vlc_urational_t;
 
 VLC_API bool vlc_ureduce( unsigned *, unsigned *, uint64_t, uint64_t, uint64_t );
 
diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
index b950b0622b..95d4403a6f 100644
--- a/include/vlc_fourcc.h
+++ b/include/vlc_fourcc.h
@@ -662,8 +662,8 @@ VLC_API bool vlc_fourcc_AreUVPlanesSwapped(vlc_fourcc_t , vlc_fourcc_t );
 typedef struct {
     unsigned plane_count;
     struct {
-        vlc_rational_t w;
-        vlc_rational_t h;
+        vlc_urational_t w;
+        vlc_urational_t h;
     } p[4];
     unsigned pixel_size;        /* Number of bytes per pixel for a plane */
     unsigned pixel_bits;        /* Number of bits actually used bits per pixel for a plane */
diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 7c16f0c992..816c1b4816 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -92,7 +92,7 @@ typedef struct {
         unsigned  height;
 
         /* Display SAR */
-        vlc_rational_t sar;
+        vlc_urational_t sar;
     } display;
 
     /* Alignment of the picture inside the display */
diff --git a/include/vlc_vout_wrapper.h b/include/vlc_vout_wrapper.h
index 8ad826f6cc..f49bdf608b 100644
--- a/include/vlc_vout_wrapper.h
+++ b/include/vlc_vout_wrapper.h
@@ -65,7 +65,7 @@ typedef struct {
 #if defined(_WIN32) || defined(__OS2__)
     unsigned wm_state;
 #endif
-    vlc_rational_t sar;
+    vlc_urational_t sar;
 } vout_display_state_t;
 
 /**
diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h
index 5b8deb19aa..6db2666653 100644
--- a/modules/codec/avcodec/avcommon.h
+++ b/modules/codec/avcodec/avcommon.h
@@ -115,9 +115,9 @@ static inline void vlc_init_avcodec(vlc_object_t *obj)
 }
 #endif
 
-static inline vlc_rational_t FromAVRational(const AVRational rat)
+static inline vlc_urational_t FromAVRational(const AVRational rat)
 {
-    return (vlc_rational_t){.num = rat.num, .den = rat.den};
+    return (vlc_urational_t){.num = rat.num, .den = rat.den};
 }
 
 #endif
diff --git a/modules/video_output/opengl/internal.h b/modules/video_output/opengl/internal.h
index b54f188a1b..c333dec7c7 100644
--- a/modules/video_output/opengl/internal.h
+++ b/modules/video_output/opengl/internal.h
@@ -194,8 +194,8 @@ struct opengl_tex_converter_t
 
     struct opengl_tex_cfg {
         /* Texture scale factor, cannot be 0 */
-        vlc_rational_t w;
-        vlc_rational_t h;
+        vlc_urational_t w;
+        vlc_urational_t h;
 
         /* The following is used and filled by the opengl_fragment_shader_init
          * function. */
diff --git a/src/misc/fourcc_gen.c b/src/misc/fourcc_gen.c
index 5f91783690..0d2fcd310c 100644
--- a/src/misc/fourcc_gen.c
+++ b/src/misc/fourcc_gen.c
@@ -31,7 +31,7 @@
 #define VLC_API
 #define VLC_USED
 typedef uint32_t vlc_fourcc_t;
-typedef struct { unsigned num, den; } vlc_rational_t;
+typedef struct { unsigned num, den; } vlc_urational_t;
 #include "../include/vlc_fourcc.h"
 
 #define VLC_FOURCC(a,b,c,d) { a, b, c, d }
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 63b94992cc..c8f0dee3de 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -337,7 +337,7 @@ typedef struct {
 
     /* */
     vout_display_cfg_t cfg;
-    vlc_rational_t sar_initial;
+    vlc_urational_t sar_initial;
 
     /* */
     unsigned width_saved;
@@ -348,14 +348,14 @@ typedef struct {
     bool is_display_filled;
 
     bool ch_zoom;
-    vlc_rational_t zoom;
+    vlc_urational_t zoom;
 #if defined(_WIN32) || defined(__OS2__)
     bool ch_wm_state;
     unsigned wm_state;
     unsigned wm_state_initial;
 #endif
     bool ch_sar;
-    vlc_rational_t sar;
+    vlc_urational_t sar;
 
     bool ch_crop;
     struct {
-- 
2.11.1



More information about the vlc-devel mailing list