[vlc-commits] videotoolbox: use nal length size parsed from avcC extradata

Thomas Guillem git at videolan.org
Fri Jul 31 15:43:09 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jul 30 16:45:36 2015 +0200| [91beec44d5efd7748a7d1cf729eee0eeda6bdc40] | committer: Felix Paul Kühne

videotoolbox: use nal length size parsed from avcC extradata

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

 modules/codec/videotoolbox.m |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index f2fba34..f67bca5 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -85,6 +85,7 @@ struct decoder_sys_t
     CMVideoCodecType            codec;
     size_t                      codec_profile;
     size_t                      codec_level;
+    uint32_t                    i_nal_length_size;
 
     bool                        b_started;
     bool                        b_is_avcc;
@@ -289,13 +290,14 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
                                     p_buf,
                                     buf_size,
                                     &size,
-                                    &i_nal_size);
+                                    &p_sys->i_nal_length_size);
             p_sys->b_is_avcc = i_ret == VLC_SUCCESS;
         } else {
             /* we are mid-stream, let's have the h264_get helper see if it
              * can find a NAL unit */
             size = p_block->i_buffer;
             p_buf = p_block->p_buffer;
+            p_sys->i_nal_length_size = 4; /* default to 4 bytes */
             i_ret = VLC_SUCCESS;
         }
 
@@ -347,7 +349,8 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
         p_sys->codec_level = sps_data.i_level;
 
         /* create avvC atom to forward to the HW decoder */
-        block_t *p_block = h264_create_avcdec_config_record(4,
+        block_t *p_block = h264_create_avcdec_config_record(
+                                p_sys->i_nal_length_size,
                                 &sps_data, p_sps_buf, i_sps_size,
                                 p_pps_buf, i_pps_size);
         free(p_alloc_buf);



More information about the vlc-commits mailing list