codec: hxxx: parse nal only when asked for
authorThomas Guillem <thomas@gllm.fr>
Thu, 20 Apr 2017 09:10:04 +0000 (11:10 +0200)
committerThomas Guillem <thomas@gllm.fr>
Thu, 20 Apr 2017 13:06:12 +0000 (15:06 +0200)
modules/codec/hxxx_helper.c
modules/codec/hxxx_helper.h

index 8e907db..a7571e2 100644 (file)
@@ -358,7 +358,8 @@ helper_process_block_xvcc2annexb(struct hxxx_helper *hh, block_t *p_block,
                                  bool *p_config_changed)
 {
     assert(helper_nal_length_valid(hh));
-    *p_config_changed = false;
+    if (p_config_changed != NULL)
+        *p_config_changed = false;
     h264_AVC_to_AnnexB(p_block->p_buffer, p_block->i_buffer,
                        hh->i_nal_length_size);
     return p_block;
@@ -368,12 +369,15 @@ static block_t *
 helper_process_block_h264_annexb(struct hxxx_helper *hh, block_t *p_block,
                                  bool *p_config_changed)
 {
-    int i_ret = h264_helper_parse_nal(hh, p_block->p_buffer, p_block->i_buffer,
-                                      0, p_config_changed);
-    if (i_ret != VLC_SUCCESS)
+    if (p_config_changed != NULL)
     {
-        block_Release(p_block);
-        return NULL;
+        int i_ret = h264_helper_parse_nal(hh, p_block->p_buffer,
+                                          p_block->i_buffer, 0, p_config_changed);
+        if (i_ret != VLC_SUCCESS)
+        {
+            block_Release(p_block);
+            return NULL;
+        }
     }
     return p_block;
 }
index a83f455..44bb57a 100644 (file)
@@ -59,6 +59,10 @@ struct hxxx_helper
             size_t i_annexb_config_nal;
         } hevc;
     };
+
+    /* Process the block: do the AnnexB <-> xvcC conversion if needed. If
+     * p_config_changed is not NULL, parse nals to detect a SPS/PPS or a video
+     * size change. */
     block_t * (*pf_process_block)(struct hxxx_helper *hh, block_t *p_block,
                                   bool *p_config_changed);
 };