[vlc-commits] hxxx_helper: add hevc_helper_get_hvcc_config

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


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Nov 20 16:49:09 2017 +0100| [c97ba5ded1538307572e6ada843e9598e1568f71] | committer: Thomas Guillem

hxxx_helper: add hevc_helper_get_hvcc_config

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

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

 modules/codec/hxxx_helper.c | 48 ++++++++++++++++++++++++++++++++++++++++++---
 modules/codec/hxxx_helper.h |  1 +
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index b250561c2e..69a031234a 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -627,7 +627,7 @@ hxxx_helper_get_annexb_config( const struct hxxx_helper_nal *pp_nal_lists[],
 {
     static const uint8_t annexb_startcode[] = { 0x00, 0x00, 0x00, 0x01 };
 
-    block_t *p_block_list = NULL;
+    block_t *p_block_list = NULL, *p_current;
     for (size_t i = 0; i < i_lists_size; ++i)
     {
         size_t i_nals_size = 0;
@@ -656,9 +656,12 @@ hxxx_helper_get_annexb_config( const struct hxxx_helper_nal *pp_nal_lists[],
             p_block->i_buffer += p_nal->b->i_buffer;
         }
         if (p_block_list == NULL)
-            p_block_list = p_block;
+            p_current = p_block_list = p_block;
         else
-            p_block_list->p_next = p_block;
+        {
+            p_current->p_next = p_block;
+            p_current = p_block;
+        }
     }
 
     return p_block_list;
@@ -723,6 +726,45 @@ h264_helper_get_avcc_config(const struct hxxx_helper *hh)
                             pp_pps_bufs, p_pps_sizes, hh->h264.i_pps_count);
 }
 
+block_t *
+hevc_helper_get_hvcc_config(const struct hxxx_helper *hh)
+{
+    struct hevc_dcr_params params = {};
+    const struct hxxx_helper_nal *p_nal;
+    size_t i = 0;
+
+    HELPER_FOREACH_NAL(p_nal, hh->hevc.vps_list, hh->hevc.i_vps_count,
+                       HEVC_VPS_ID_MAX+1)
+    {
+        params.p_vps[params.i_vps_count] = p_nal->b->p_buffer;
+        params.rgi_vps[params.i_vps_count++] = p_nal->b->i_buffer;
+        ++i;
+    }
+
+    HELPER_FOREACH_NAL(p_nal, hh->hevc.sps_list, hh->hevc.i_sps_count,
+                       HEVC_SPS_ID_MAX+1)
+    {
+        params.p_sps[params.i_sps_count] = p_nal->b->p_buffer;
+        params.rgi_sps[params.i_sps_count++] = p_nal->b->i_buffer;
+        ++i;
+    }
+
+    HELPER_FOREACH_NAL(p_nal, hh->hevc.pps_list, hh->hevc.i_pps_count,
+                       HEVC_PPS_ID_MAX+1)
+    {
+        params.p_pps[params.i_pps_count] = p_nal->b->p_buffer;
+        params.rgi_pps[params.i_pps_count++] = p_nal->b->i_buffer;
+        ++i;
+    }
+
+    size_t i_dcr;
+    uint8_t *p_dcr = hevc_create_dcr(&params, 4, true, &i_dcr);
+    if(p_dcr == NULL)
+        return NULL;
+
+    return block_heap_Alloc(p_dcr, i_dcr);
+}
+
 static const struct hxxx_helper_nal *
 h264_helper_get_current_sps(const struct hxxx_helper *hh)
 {
diff --git a/modules/codec/hxxx_helper.h b/modules/codec/hxxx_helper.h
index 026706b69e..c2b20ca230 100644
--- a/modules/codec/hxxx_helper.h
+++ b/modules/codec/hxxx_helper.h
@@ -87,6 +87,7 @@ block_t *h264_helper_get_annexb_config(const struct hxxx_helper *hh);
 block_t *hevc_helper_get_annexb_config(const struct hxxx_helper *hh);
 
 block_t *h264_helper_get_avcc_config(const struct hxxx_helper *hh);
+block_t *hevc_helper_get_hvcc_config(const struct hxxx_helper *hh);
 
 int hxxx_helper_get_current_picture_size(const struct hxxx_helper *hh,
                                          unsigned *p_w, unsigned *p_h,



More information about the vlc-commits mailing list