[vlc-devel] [PATCH 26/28] packetizer: hevc: simplify hevc_get_frame_rate() using vlc_rational_t

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


---
 modules/packetizer/hevc.c     |  3 +--
 modules/packetizer/hevc_nal.c | 14 +++++++-------
 modules/packetizer/hevc_nal.h |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 451d3183bb..be209b949a 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -441,8 +441,7 @@ static void ActivateSets(decoder_t *p_dec,
         if(!p_dec->fmt_in.video.frame_rate.num)
         {
             (void) hevc_get_frame_rate( p_sps, p_dec->p_sys->rgi_p_decvps,
-                                        &p_dec->fmt_out.video.frame_rate.num,
-                                        &p_dec->fmt_out.video.frame_rate.den );
+                                        &p_dec->fmt_out.video.frame_rate );
         }
 
         if(p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF)
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 632ae7494c..54ed3b12eb 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1065,20 +1065,20 @@ static bool hevc_get_picture_CtbsYsize( const hevc_sequence_parameter_set_t *p_s
 
 bool hevc_get_frame_rate( const hevc_sequence_parameter_set_t *p_sps,
                           hevc_video_parameter_set_t **pp_vps,
-                          unsigned *pi_num, unsigned *pi_den )
+                          vlc_rational_t *p_rate )
 {
     if( p_sps->vui_parameters_present_flag && p_sps->vui.vui_timing_info_present_flag )
     {
-        *pi_den = p_sps->vui.timing.vui_num_units_in_tick;
-        *pi_num = p_sps->vui.timing.vui_time_scale;
-        return (*pi_den && *pi_num);
+        p_rate->den = p_sps->vui.timing.vui_num_units_in_tick;
+        p_rate->num = p_sps->vui.timing.vui_time_scale;
+        return (p_rate->den && p_rate->num);
     }
     else if( pp_vps && pp_vps[p_sps->sps_video_parameter_set_id] &&
              pp_vps[p_sps->sps_video_parameter_set_id]->vps_timing_info_present_flag )
     {
-        *pi_den = pp_vps[p_sps->sps_video_parameter_set_id]->vps_num_units_in_tick;
-        *pi_num = pp_vps[p_sps->sps_video_parameter_set_id]->vps_time_scale;
-        return (*pi_den && *pi_num);
+        p_rate->den = pp_vps[p_sps->sps_video_parameter_set_id]->vps_num_units_in_tick;
+        p_rate->num = pp_vps[p_sps->sps_video_parameter_set_id]->vps_time_scale;
+        return (p_rate->den && p_rate->num);
     }
     return false;
 }
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index cba43a826b..973b80302f 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -186,7 +186,7 @@ bool hevc_get_picture_size( const hevc_sequence_parameter_set_t *, unsigned *p_w
                             unsigned *p_vw, unsigned *p_vh );
 bool hevc_get_frame_rate( const hevc_sequence_parameter_set_t *,
                           hevc_video_parameter_set_t ** /* HEVC_MAX_VPS || NULL */,
-                          unsigned *pi_num, unsigned *pi_den );
+                          vlc_rational_t *p_rate );
 bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps,
                            video_color_primaries_t *p_primaries,
                            video_transfer_func_t *p_transfer,
-- 
2.11.1



More information about the vlc-devel mailing list