[vlc-commits] packetizer: hevc: add profile and level

Francois Cartegnie git at videolan.org
Tue Aug 2 20:45:54 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Aug  2 16:44:04 2016 +0200| [d011314437e08da2c4ecfe785f89a6712fe8e255] | committer: Francois Cartegnie

packetizer: hevc: add profile and level

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d011314437e08da2c4ecfe785f89a6712fe8e255
---

 modules/packetizer/hevc.c     | 10 ++++++++++
 modules/packetizer/hevc_nal.c | 12 ++++++++++++
 modules/packetizer/hevc_nal.h |  2 ++
 3 files changed, 24 insertions(+)

diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index e950763..9496d50 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -487,6 +487,16 @@ static block_t * ParseAUHead(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_na
                                                      &p_dec->fmt_out.video.space,
                                                      &p_dec->fmt_out.video.b_color_range_full);
                     }
+
+                    if(p_dec->fmt_out.i_profile == -1)
+                    {
+                        uint8_t i_profile, i_level;
+                        if( hevc_get_sps_profile_tier_level( p_sps, &i_profile, &i_level ) )
+                        {
+                            p_dec->fmt_out.i_profile = i_profile;
+                            p_dec->fmt_out.i_level = i_level;
+                        }
+                    }
                 }
             }
         }
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 5b26255..464c115 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1003,6 +1003,18 @@ uint8_t hevc_get_pps_sps_id( const hevc_picture_parameter_set_t *p_pps )
     return p_pps->pps_seq_parameter_set_id;
 }
 
+bool hevc_get_sps_profile_tier_level( const hevc_sequence_parameter_set_t *p_sps,
+                                      uint8_t *pi_profile, uint8_t *pi_level)
+{
+    if(p_sps->profile_tier_level.general.profile_idc)
+    {
+        *pi_profile = p_sps->profile_tier_level.general.profile_idc;
+        *pi_level = p_sps->profile_tier_level.general_level_idc;
+        return true;
+    }
+    return false;
+}
+
 bool hevc_get_picture_size( const hevc_sequence_parameter_set_t *p_sps,
                             unsigned *p_w, unsigned *p_h, unsigned *p_vw, unsigned *p_vh )
 {
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index 7be29f2..b180f12 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -174,6 +174,8 @@ uint8_t * hevc_hvcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
                                    size_t *pi_res, uint8_t *pi_nal_length_size );
 
 bool hevc_get_xps_id(const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id);
+bool hevc_get_sps_profile_tier_level( const hevc_sequence_parameter_set_t *,
+                                      uint8_t *pi_profile, uint8_t *pi_level );
 bool hevc_get_picture_size( const hevc_sequence_parameter_set_t *, unsigned *p_w, unsigned *p_h,
                             unsigned *p_vw, unsigned *p_vh );
 bool hevc_get_frame_rate( const hevc_sequence_parameter_set_t *,



More information about the vlc-commits mailing list