Just pass through the bitstream as is. This is the same as what is done
for HEVC already.
---
 libavcodec/h264_mp4toannexb_bsf.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_mp4toannexb_bsf.c 
b/libavcodec/h264_mp4toannexb_bsf.c
index c1e2a28..0446790 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -134,7 +134,12 @@ static int h264_mp4toannexb_init(AVBSFContext *ctx)
     int ret;
 
     /* retrieve sps and pps NAL units from extradata */
-    if (ctx->par_in->extradata_size >= 6) {
+    if (ctx->par_in->extradata_size < 6      ||
+        AV_RB24(ctx->par_in->extradata) == 1 ||
+        AV_RB32(ctx->par_in->extradata) == 1) {
+        av_log(ctx, AV_LOG_VERBOSE,
+               "The input looks like it is Annex B already\n");
+    } else {
         ret = h264_extradata_to_annexb(ctx, AV_INPUT_BUFFER_PADDING_SIZE);
         if (ret < 0)
             return ret;
-- 
2.0.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to