[vlc-devel] [PATCH 19/28] packetizer: h264: use a vlc_rational_t internally for the SAR

Steve Lhomme robux4 at videolabs.io
Mon Apr 3 10:22:07 CEST 2017


---
 modules/codec/hxxx_helper.c   | 4 ++--
 modules/packetizer/h264.c     | 6 +++---
 modules/packetizer/h264_nal.c | 8 ++++----
 modules/packetizer/h264_nal.h | 2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index 134d4bd442..fc3122bf8b 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -545,8 +545,8 @@ h264_helper_get_current_sar(struct hxxx_helper *hh, int *p_num, int *p_den)
     const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
     if (hsps == NULL)
         return VLC_EGENERIC;
-    *p_num = hsps->h264_sps->vui.i_sar_num;
-    *p_den = hsps->h264_sps->vui.i_sar_den;
+    *p_num = hsps->h264_sps->vui.sar.num;
+    *p_den = hsps->h264_sps->vui.sar.den;
     return VLC_SUCCESS;
 }
 
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index fcc2206fd1..37db73fe66 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -199,10 +199,10 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t
                                       &p_dec->fmt_out.video.i_visible_width,
                                       &p_dec->fmt_out.video.i_visible_height );
 
-        if( p_sps->vui.i_sar_num != 0 && p_sps->vui.i_sar_den != 0 )
+        if( p_sps->vui.sar.num != 0 && p_sps->vui.sar.den != 0 )
         {
-            p_dec->fmt_out.video.i_sar_num = p_sps->vui.i_sar_num;
-            p_dec->fmt_out.video.i_sar_den = p_sps->vui.i_sar_den;
+            p_dec->fmt_out.video.i_sar_num = p_sps->vui.sar.num;
+            p_dec->fmt_out.video.i_sar_den = p_sps->vui.sar.den;
         }
 
         if( p_sps->vui.b_valid )
diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index 0cf6b2c7d6..377209aee1 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -427,13 +427,13 @@ static bool h264_parse_sequence_parameter_set_rbsp( bs_t *p_bs,
 
             if( w != 0 && h != 0 )
             {
-                p_sps->vui.i_sar_num = w;
-                p_sps->vui.i_sar_den = h;
+                p_sps->vui.sar.num = w;
+                p_sps->vui.sar.den = h;
             }
             else
             {
-                p_sps->vui.i_sar_num = 1;
-                p_sps->vui.i_sar_den = 1;
+                p_sps->vui.sar.num = 1;
+                p_sps->vui.sar.den = 1;
             }
         }
 
diff --git a/modules/packetizer/h264_nal.h b/modules/packetizer/h264_nal.h
index c32610d6a7..3239a3709b 100644
--- a/modules/packetizer/h264_nal.h
+++ b/modules/packetizer/h264_nal.h
@@ -115,7 +115,7 @@ struct h264_sequence_parameter_set_t
 
     struct {
         bool b_valid;
-        int i_sar_num, i_sar_den;
+        vlc_rational_t sar;
         struct {
             bool b_full_range;
             uint8_t i_colour_primaries;
-- 
2.11.1



More information about the vlc-devel mailing list