Mercurial > libavformat.hg
diff movenc.c @ 4222:0267c4299992 libavformat
Do not reallocate AVPacket's data when muxing a packet
author | lucabe |
---|---|
date | Thu, 15 Jan 2009 14:03:07 +0000 |
parents | c3102b189cb6 |
children | 8f2cb573b5b0 |
line wrap: on
line diff
--- a/movenc.c Thu Jan 15 12:23:03 2009 +0000 +++ b/movenc.c Thu Jan 15 14:03:07 2009 +0000 @@ -1732,15 +1732,7 @@ memcpy(trk->vosData, enc->extradata, trk->vosLen); } - if (enc->codec_id == CODEC_ID_H264 && trk->vosLen > 0 && *(uint8_t *)trk->vosData != 1) { - /* from x264 or from bytestream h264 */ - /* nal reformating needed */ - int ret = ff_avc_parse_nal_units(pkt->data, &pkt->data, &pkt->size); - if (ret < 0) - return ret; - assert(pkt->size); - size = pkt->size; - } else if ((enc->codec_id == CODEC_ID_DNXHD || + if ((enc->codec_id == CODEC_ID_DNXHD || enc->codec_id == CODEC_ID_AC3) && !trk->vosLen) { /* copy frame to create needed atoms */ trk->vosLen = size; @@ -1777,7 +1769,13 @@ trk->sampleCount += samplesInChunk; mov->mdat_size += size; + if (enc->codec_id == CODEC_ID_H264 && trk->vosLen > 0 && *(uint8_t *)trk->vosData != 1) { + /* from x264 or from bytestream h264 */ + /* nal reformating needed */ + ff_avc_parse_nal_units(pb, pkt->data, pkt->size); + } else { put_buffer(pb, pkt->data, size); + } put_flush_packet(pb); return 0;