comparison h264_mp4toannexb_bsf.c @ 6134:6d0c5a68d559 libavcodec

Fix a bug causing the generated stream to be corrupt if the buffer contains NAL units previous to the IDR where the SPS/PPS was inserted. Ok:ed by Benoit on irc.
author andoma
date Wed, 09 Jan 2008 08:38:28 +0000
parents 679d6ccfffb0
children a5e7dbce5412
comparison
equal deleted inserted replaced
6133:5c485301f6f3 6134:6d0c5a68d559
39 memcpy(*poutbuf+offset, sps_pps, sps_pps_size); 39 memcpy(*poutbuf+offset, sps_pps, sps_pps_size);
40 memcpy(*poutbuf+sps_pps_size+nal_header_size+offset, in, in_size); 40 memcpy(*poutbuf+sps_pps_size+nal_header_size+offset, in, in_size);
41 if (!offset) 41 if (!offset)
42 AV_WB32(*poutbuf+sps_pps_size, 1); 42 AV_WB32(*poutbuf+sps_pps_size, 1);
43 else { 43 else {
44 (*poutbuf+offset)[0] = (*poutbuf+offset)[1] = 0; 44 (*poutbuf+offset+sps_pps_size)[0] = (*poutbuf+offset+sps_pps_size)[1] = 0;
45 (*poutbuf+offset)[2] = 1; 45 (*poutbuf+offset+sps_pps_size)[2] = 1;
46 } 46 }
47 } 47 }
48 48
49 static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, 49 static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
50 AVCodecContext *avctx, const char *args, 50 AVCodecContext *avctx, const char *args,