[vlc-devel] [PATCH 23/28] access: dvdnav: use vlc_rational_t internally for the SAR

Steve Lhomme robux4 at videolabs.io
Fri Mar 31 18:14:38 CEST 2017


---
 modules/access/dvdnav.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 7b957849c4..e1e1051e8f 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -147,10 +147,7 @@ struct demux_sys_t
     bool b_spu_change;
 
     /* Aspect ration */
-    struct {
-        unsigned i_num;
-        unsigned i_den;
-    } sar;
+    vlc_rational_t sar;
 
     /* */
     int           i_title;
@@ -204,8 +201,8 @@ static int CommonOpen( vlc_object_t *p_this,
     p_sys->b_reset_pcr = false;
 
     ps_track_init( p_sys->tk );
-    p_sys->sar.i_num = 0;
-    p_sys->sar.i_den = 0;
+    p_sys->sar.num = 0;
+    p_sys->sar.den = 0;
     p_sys->i_mux_rate = 0;
     p_sys->i_pgc_length = 0;
     p_sys->b_spu_change = false;
@@ -957,16 +954,16 @@ static int Demux( demux_t *p_demux )
         switch( dvdnav_get_video_aspect( p_sys->dvdnav ) )
         {
         case 0:
-            p_sys->sar.i_num = 4 * i_height;
-            p_sys->sar.i_den = 3 * i_width;
+            p_sys->sar.num = 4 * i_height;
+            p_sys->sar.den = 3 * i_width;
             break;
         case 3:
-            p_sys->sar.i_num = 16 * i_height;
-            p_sys->sar.i_den =  9 * i_width;
+            p_sys->sar.num = 16 * i_height;
+            p_sys->sar.den =  9 * i_width;
             break;
         default:
-            p_sys->sar.i_num = 0;
-            p_sys->sar.i_den = 0;
+            p_sys->sar.num = 0;
+            p_sys->sar.den = 0;
             break;
         }
 
@@ -1450,8 +1447,8 @@ static void ESNew( demux_t *p_demux, int i_id )
     /* Add a new ES */
     if( tk->fmt.i_cat == VIDEO_ES )
     {
-        tk->fmt.video.sar.num = p_sys->sar.i_num;
-        tk->fmt.video.sar.den = p_sys->sar.i_den;
+        tk->fmt.video.sar.num = p_sys->sar.num;
+        tk->fmt.video.sar.den = p_sys->sar.den;
         b_select = true;
     }
     else if( tk->fmt.i_cat == AUDIO_ES )
-- 
2.11.1



More information about the vlc-devel mailing list