diff options
author | Benoit Fouet <benoit.fouet@free.fr> | 2014-07-31 15:32:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-05 04:14:02 +0200 |
commit | cf41ff488978738f2718ab02e940925dd3576134 (patch) | |
tree | 452faf729988c6d8e578b0c524eb1e7d3973835e /libavcodec | |
parent | 6120ad315bc3289d7f2f67f8944f044e5aa86c91 (diff) | |
download | ffmpeg-cf41ff488978738f2718ab02e940925dd3576134.tar.gz |
h264_mp4toannexb_bsf: account for consecutive IDR pictures.
If there are consecutive IDR pictures, then SPS/PPS should be prepended
to all of them, not only the first one.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bf428bb3145c4f0eef32f8ef00de0ee222b3e414)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h264_mp4toannexb_bsf.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index a7b4f4158e..a003a1df1d 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -179,6 +179,11 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, if (ctx->first_idr && (unit_type == 7 || unit_type == 8)) ctx->idr_sps_pps_seen = 1; + /* if this is a new IDR picture following an IDR picture, reset the idr flag. + * Just check first_mb_in_slice to be 0 as this is the simplest solution. + * This could be checking idr_pic_id instead, but would complexify the parsing. */ + if (!ctx->first_idr && unit_type == 5 && (buf[1] & 0x80)) + ctx->first_idr = 1; /* prepend only to the first type 5 NAL unit of an IDR picture, if no sps/pps are already present */ if (ctx->first_idr && unit_type == 5 && !ctx->idr_sps_pps_seen) { |