[FFmpeg-cvslog] h264_mp4toannexb_bsf: support 24bit lengths

gs_gail git at videolan.org
Wed Mar 21 22:04:53 CET 2012


ffmpeg | branch: master | gs_gail <guisheng315 at gmail.com> | Wed Mar 21 21:35:37 2012 +0100| [361c4cdca9c761a4f582830a9d53080ccc52dc94] | committer: Michael Niedermayer

h264_mp4toannexb_bsf: support 24bit lengths

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=361c4cdca9c761a4f582830a9d53080ccc52dc94
---

 libavcodec/h264_mp4toannexb_bsf.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c
index 48e085e..62f9cb0 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -82,8 +82,6 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
 
         /* retrieve length coded size */
         ctx->length_size = (*extradata++ & 0x3) + 1;
-        if (ctx->length_size == 3)
-            return AVERROR(EINVAL);
 
         /* retrieve sps and pps unit(s) */
         unit_nb = *extradata++ & 0x1f; /* number of sps unit(s) */
@@ -142,12 +140,8 @@ pps:
         if (buf + ctx->length_size > buf_end)
             goto fail;
 
-        if (ctx->length_size == 1) {
-            nal_size = buf[0];
-        } else if (ctx->length_size == 2) {
-            nal_size = AV_RB16(buf);
-        } else
-            nal_size = AV_RB32(buf);
+        for(nal_size = 0, unit_type = 0; unit_type<ctx->length_size; unit_type++)
+            nal_size = (nal_size << 8) | buf[unit_type];
 
         buf += ctx->length_size;
         unit_type = *buf & 0x1f;



More information about the ffmpeg-cvslog mailing list