Commit 361c4cdc authored by gs_gail's avatar gs_gail Committed by Michael Niedermayer

h264_mp4toannexb_bsf: support 24bit lengths

parent 2a4f1d38
...@@ -82,8 +82,6 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, ...@@ -82,8 +82,6 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
/* retrieve length coded size */ /* retrieve length coded size */
ctx->length_size = (*extradata++ & 0x3) + 1; ctx->length_size = (*extradata++ & 0x3) + 1;
if (ctx->length_size == 3)
return AVERROR(EINVAL);
/* retrieve sps and pps unit(s) */ /* retrieve sps and pps unit(s) */
unit_nb = *extradata++ & 0x1f; /* number of sps unit(s) */ unit_nb = *extradata++ & 0x1f; /* number of sps unit(s) */
...@@ -142,12 +140,8 @@ pps: ...@@ -142,12 +140,8 @@ pps:
if (buf + ctx->length_size > buf_end) if (buf + ctx->length_size > buf_end)
goto fail; goto fail;
if (ctx->length_size == 1) { for(nal_size = 0, unit_type = 0; unit_type<ctx->length_size; unit_type++)
nal_size = buf[0]; nal_size = (nal_size << 8) | buf[unit_type];
} else if (ctx->length_size == 2) {
nal_size = AV_RB16(buf);
} else
nal_size = AV_RB32(buf);
buf += ctx->length_size; buf += ctx->length_size;
unit_type = *buf & 0x1f; unit_type = *buf & 0x1f;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment