aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/oggparsecelt.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2013-10-14 05:15:26 -0300
committerMichael Niedermayer <michaelni@gmx.at>2013-10-14 13:01:42 +0200
commit00408f95e7fa3761180f95d89f39377c77a0252e (patch)
tree95674825ebf40e8e225137695dd82e877bccba0e /libavformat/oggparsecelt.c
parentaae8975ffbb536f18df51e8f00eaa7b0117d16c9 (diff)
downloadffmpeg-00408f95e7fa3761180f95d89f39377c77a0252e.tar.gz
oggparsecelt: use ff_alloc_extradata()
Signed-off-by: James Almer <jamrial@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggparsecelt.c')
-rw-r--r--libavformat/oggparsecelt.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/libavformat/oggparsecelt.c b/libavformat/oggparsecelt.c
index afc4392e2c..4b6233e0c7 100644
--- a/libavformat/oggparsecelt.c
+++ b/libavformat/oggparsecelt.c
@@ -44,16 +44,10 @@ static int celt_header(AVFormatContext *s, int idx)
uint32_t version, sample_rate, nb_channels, frame_size;
uint32_t overlap, extra_headers;
- uint8_t *extradata;
- extradata = av_malloc(2 * sizeof(uint32_t) +
- FF_INPUT_BUFFER_PADDING_SIZE);
priv = av_malloc(sizeof(struct oggcelt_private));
- if (!extradata || !priv) {
- av_free(extradata);
- av_free(priv);
+ if (!priv || ff_alloc_extradata(st->codec, 2 * sizeof(uint32_t)))
return AVERROR(ENOMEM);
- }
version = AV_RL32(p + 28);
/* unused header size field skipped */
sample_rate = AV_RL32(p + 36);
@@ -67,16 +61,13 @@ static int celt_header(AVFormatContext *s, int idx)
st->codec->sample_rate = sample_rate;
st->codec->channels = nb_channels;
st->codec->frame_size = frame_size;
- av_free(st->codec->extradata);
- st->codec->extradata = extradata;
- st->codec->extradata_size = 2 * sizeof(uint32_t);
if (sample_rate)
avpriv_set_pts_info(st, 64, 1, sample_rate);
priv->extra_headers_left = 1 + extra_headers;
av_free(os->private);
os->private = priv;
- AV_WL32(extradata + 0, overlap);
- AV_WL32(extradata + 4, version);
+ AV_WL32(st->codec->extradata + 0, overlap);
+ AV_WL32(st->codec->extradata + 4, version);
return 1;
} else if (priv && priv->extra_headers_left) {
/* Extra headers (vorbiscomment) */