diff options
author | Luca Abeni <lucabe72@email.it> | 2009-01-15 14:03:07 +0000 |
---|---|---|
committer | Luca Abeni <lucabe72@email.it> | 2009-01-15 14:03:07 +0000 |
commit | 0a63a676ec5cc1e69768024df51ffca6a5cfbd08 (patch) | |
tree | 31b233b41814ec0604ebe429448fab5812c53fd8 /libavformat/movenc.c | |
parent | 2ea512a6c2ff3404563ad364a3e806a8630cdc84 (diff) | |
download | ffmpeg-0a63a676ec5cc1e69768024df51ffca6a5cfbd08.tar.gz |
Do not reallocate AVPacket's data when muxing a packet
Originally committed as revision 16616 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 7127cc4401..b357e8c85c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1732,15 +1732,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) 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 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) 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; |