[vlc-commits] hxxx_helper: refactor h264_helper_get_annexb_config

Francois Cartegnie git at videolan.org
Fri Nov 24 13:11:51 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Nov 17 16:08:12 2017 +0100| [e4a180cd4823e4cd737b9cbd277940f28bde9644] | committer: Thomas Guillem

hxxx_helper: refactor h264_helper_get_annexb_config

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/codec/hxxx_helper.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index 47aa9dbcf6..26384ad3d3 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -632,21 +632,16 @@ hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
     return VLC_SUCCESS;;
 }
 
-block_t *
-h264_helper_get_annexb_config(const struct hxxx_helper *hh)
+static block_t *
+hxxx_helper_get_annexb_config( const struct hxxx_helper_nal *pp_nal_lists[],
+                               const size_t p_nal_counts[],
+                               const size_t p_nal_maxs[],
+                               size_t i_lists_size )
 {
     static const uint8_t annexb_startcode[] = { 0x00, 0x00, 0x00, 0x01 };
 
-    if (hh->h264.i_sps_count == 0 || hh->h264.i_pps_count == 0)
-        return NULL;
-
-    const struct hxxx_helper_nal *pp_nal_lists[] = {
-        hh->h264.sps_list, hh->h264.pps_list };
-    const size_t p_nal_counts[] = { hh->h264.i_sps_count, hh->h264.i_pps_count };
-    const size_t p_nal_maxs[] = { H264_SPS_ID_MAX+1, H264_PPS_ID_MAX+1 };
-
     block_t *p_block_list = NULL;
-    for (size_t i = 0; i < 2; ++i)
+    for (size_t i = 0; i < i_lists_size; ++i)
     {
         size_t i_nals_size = 0;
         const struct hxxx_helper_nal *p_nal;
@@ -683,6 +678,20 @@ h264_helper_get_annexb_config(const struct hxxx_helper *hh)
 }
 
 block_t *
+h264_helper_get_annexb_config(const struct hxxx_helper *hh)
+{
+    if (hh->h264.i_sps_count == 0 || hh->h264.i_pps_count == 0)
+        return NULL;
+
+    const struct hxxx_helper_nal *pp_nal_lists[] = {
+        hh->h264.sps_list, hh->h264.pps_list };
+    const size_t p_nal_counts[] = { hh->h264.i_sps_count, hh->h264.i_pps_count };
+    const size_t p_nal_maxs[] = { H264_SPS_ID_MAX+1, H264_PPS_ID_MAX+1 };
+
+    return hxxx_helper_get_annexb_config( pp_nal_lists, p_nal_counts, p_nal_maxs, 2 );
+}
+
+block_t *
 h264_helper_get_avcc_config(const struct hxxx_helper *hh)
 {
     const struct hxxx_helper_nal *p_nal;



More information about the vlc-commits mailing list