aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-18 22:02:17 +0300
committerMartin Storsjö <martin@martin.st>2013-09-19 22:42:40 +0300
commit72fe16a13e3ebd5396ac173bf84c8b20085c16d5 (patch)
treec39c1acd057a8f5b7e648c3aab0ee884687beebd
parent3627ce2f1dab1d33b7f99d78907a3e4d86b7d847 (diff)
downloadffmpeg-72fe16a13e3ebd5396ac173bf84c8b20085c16d5.tar.gz
movenc: Use null buffers for measuring the amount of data to be written
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/movenc.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 7d634ad853..dbff36906b 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2443,13 +2443,11 @@ static int mov_write_moof_tag(AVIOContext *pb, MOVMuxContext *mov, int tracks)
{
AVIOContext *avio_buf;
int ret, moof_size;
- uint8_t *buf;
- if ((ret = avio_open_dyn_buf(&avio_buf)) < 0)
+ if ((ret = ffio_open_null_buf(&avio_buf)) < 0)
return ret;
mov_write_moof_tag_internal(avio_buf, mov, tracks, 0);
- moof_size = avio_close_dyn_buf(avio_buf, &buf);
- av_free(buf);
+ moof_size = ffio_close_null_buf(avio_buf);
return mov_write_moof_tag_internal(pb, mov, tracks, moof_size);
}
@@ -2738,11 +2736,10 @@ static int mov_flush_fragment(AVFormatContext *s)
if (i < mov->nb_streams)
return 0;
- if ((ret = avio_open_dyn_buf(&moov_buf)) < 0)
+ if ((ret = ffio_open_null_buf(&moov_buf)) < 0)
return ret;
mov_write_moov_tag(moov_buf, mov, s);
- buf_size = avio_close_dyn_buf(moov_buf, &buf);
- av_free(buf);
+ buf_size = ffio_close_null_buf(moov_buf);
for (i = 0; i < mov->nb_streams; i++)
mov->tracks[i].data_offset = pos + buf_size + 8;
@@ -3348,16 +3345,13 @@ static int mov_write_header(AVFormatContext *s)
static int get_moov_size(AVFormatContext *s)
{
int ret;
- uint8_t *buf;
AVIOContext *moov_buf;
MOVMuxContext *mov = s->priv_data;
- if ((ret = avio_open_dyn_buf(&moov_buf)) < 0)
+ if ((ret = ffio_open_null_buf(&moov_buf)) < 0)
return ret;
mov_write_moov_tag(moov_buf, mov, s);
- ret = avio_close_dyn_buf(moov_buf, &buf);
- av_free(buf);
- return ret;
+ return ffio_close_null_buf(moov_buf);
}
/*