[vlc-commits] codec: hxxx: pf_process_block is now mandatory

Thomas Guillem git at videolan.org
Thu Apr 20 15:09:52 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr 20 11:06:03 2017 +0200| [3d1b34a35ec6292cfa74d4772b8dc4e2786f22e9] | committer: Thomas Guillem

codec: hxxx: pf_process_block is now mandatory

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

 modules/codec/hxxx_helper.c      | 13 +++++++++++--
 modules/codec/omxil/mediacodec.c |  4 ++--
 modules/codec/videotoolbox.m     |  3 ++-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index 134d4bd442..8e907db46a 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -386,6 +386,15 @@ helper_process_block_h264_annexb2avcc(struct hxxx_helper *hh, block_t *p_block,
     return p_block ? hxxx_AnnexB_to_xVC(p_block, hh->i_nal_length_size) : NULL;
 }
 
+static block_t *
+helper_process_block_dummy(struct hxxx_helper *hh, block_t *p_block,
+                           bool *p_config_changed)
+{
+    (void) hh;
+    (void) p_config_changed;
+    return p_block;
+}
+
 int
 hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
                       size_t i_extra)
@@ -408,7 +417,7 @@ hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
     if (hh->b_is_xvcC)
     {
         if (hh->b_need_xvcC)
-            hh->pf_process_block = NULL;
+            hh->pf_process_block = helper_process_block_dummy;
         else
             hh->pf_process_block = helper_process_block_xvcc2annexb;
     }
@@ -426,7 +435,7 @@ hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
                 if (hh->b_need_xvcC)
                     return VLC_EGENERIC; /* TODO */
                 else
-                    hh->pf_process_block = NULL;
+                    hh->pf_process_block = helper_process_block_dummy;
                 break;
             default:
                 vlc_assert_unreachable();
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index c67278a2cf..9a557b6aa6 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -284,6 +284,7 @@ static int ParseVideoExtraH264(decoder_t *p_dec, uint8_t *p_extra, int i_extra)
     int i_ret = hxxx_helper_set_extra(hh, p_extra, i_extra);
     if (i_ret != VLC_SUCCESS)
         return i_ret;
+    assert(hh->pf_process_block != NULL);
 
     if (!hh->b_is_xvcC && p_sys->api.i_quirks & MC_API_VIDEO_QUIRKS_ADAPTIVE)
     {
@@ -291,7 +292,6 @@ static int ParseVideoExtraH264(decoder_t *p_dec, uint8_t *p_extra, int i_extra)
         return VLC_SUCCESS;
     }
 
-    assert(hh->pf_process_block != NULL);
     p_sys->pf_on_new_block = VideoHXXX_OnNewBlock;
 
     if (hh->h264.i_sps_count > 0 || hh->h264.i_pps_count > 0)
@@ -307,6 +307,7 @@ static int ParseVideoExtraHEVC(decoder_t *p_dec, uint8_t *p_extra, int i_extra)
     int i_ret = hxxx_helper_set_extra(hh, p_extra, i_extra);
     if (i_ret != VLC_SUCCESS)
         return i_ret;
+    assert(hh->pf_process_block != NULL);
 
     if (!hh->b_is_xvcC)
     {
@@ -319,7 +320,6 @@ static int ParseVideoExtraHEVC(decoder_t *p_dec, uint8_t *p_extra, int i_extra)
             return VLC_EGENERIC;
     }
 
-    assert(hh->pf_process_block != NULL);
     p_sys->pf_on_new_block = VideoHXXX_OnNewBlock;
 
     if (hh->hevc.i_annexb_config_nal > 0)
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 69f7530865..4cffee2d89 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -789,6 +789,7 @@ static int SetupDecoderExtradata(decoder_t *p_dec)
                                           p_dec->fmt_in.i_extra);
         if (i_ret != VLC_SUCCESS)
             return i_ret;
+        assert(p_sys->hh.pf_process_block != NULL);
 
         if (p_dec->fmt_in.p_extra)
         {
@@ -1284,7 +1285,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
     }
 
     bool b_config_changed = false;
-    if (p_sys->codec == kCMVideoCodecType_H264 && p_sys->hh.pf_process_block)
+    if (p_sys->codec == kCMVideoCodecType_H264)
     {
         p_block = p_sys->hh.pf_process_block(&p_sys->hh, p_block, &b_config_changed);
         if (!p_block)



More information about the vlc-commits mailing list