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/avc.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/avc.c')
-rw-r--r-- | libavformat/avc.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libavformat/avc.c b/libavformat/avc.c index df95bd0633..def08ba5e9 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -60,15 +60,11 @@ const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end) return end + 3; } -int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size) +void ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size) { - ByteIOContext *pb; const uint8_t *p = buf_in; - const uint8_t *end = p + *size; + const uint8_t *end = p + size; const uint8_t *nal_start, *nal_end; - int ret = url_open_dyn_buf(&pb); - if(ret < 0) - return ret; nal_start = ff_avc_find_startcode(p, end); while (nal_start < end) { @@ -78,6 +74,17 @@ int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size) put_buffer(pb, nal_start, nal_end - nal_start); nal_start = nal_end; } +} + +static int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) +{ + ByteIOContext *pb; + int ret = url_open_dyn_buf(&pb); + if(ret < 0) + return ret; + + ff_avc_parse_nal_units(pb, buf_in, *size); + av_freep(buf); *size = url_close_dyn_buf(pb, buf); return 0; @@ -92,7 +99,7 @@ int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len) uint32_t sps_size=0, pps_size=0; uint8_t *sps=0, *pps=0; - int ret = ff_avc_parse_nal_units(data, &buf, &len); + int ret = ff_avc_parse_nal_units_buf(data, &buf, &len); if (ret < 0) return ret; start = buf; |