oggparseopus: 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>
This commit is contained in:
parent
8d9f08ef32
commit
aae8975ffb
@ -41,7 +41,6 @@ static int opus_header(AVFormatContext *avf, int idx)
|
|||||||
AVStream *st = avf->streams[idx];
|
AVStream *st = avf->streams[idx];
|
||||||
struct oggopus_private *priv = os->private;
|
struct oggopus_private *priv = os->private;
|
||||||
uint8_t *packet = os->buf + os->pstart;
|
uint8_t *packet = os->buf + os->pstart;
|
||||||
uint8_t *extradata;
|
|
||||||
|
|
||||||
if (!priv) {
|
if (!priv) {
|
||||||
priv = os->private = av_mallocz(sizeof(*priv));
|
priv = os->private = av_mallocz(sizeof(*priv));
|
||||||
@ -60,13 +59,10 @@ static int opus_header(AVFormatContext *avf, int idx)
|
|||||||
/*gain = AV_RL16(packet + 16);*/
|
/*gain = AV_RL16(packet + 16);*/
|
||||||
/*channel_map = AV_RL8 (packet + 18);*/
|
/*channel_map = AV_RL8 (packet + 18);*/
|
||||||
|
|
||||||
extradata = av_malloc(os->psize + FF_INPUT_BUFFER_PADDING_SIZE);
|
if (ff_alloc_extradata(st->codec, os->psize))
|
||||||
if (!extradata)
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
memcpy(extradata, packet, os->psize);
|
memcpy(st->codec->extradata, packet, os->psize);
|
||||||
st->codec->extradata = extradata;
|
|
||||||
st->codec->extradata_size = os->psize;
|
|
||||||
|
|
||||||
st->codec->sample_rate = 48000;
|
st->codec->sample_rate = 48000;
|
||||||
avpriv_set_pts_info(st, 64, 1, 48000);
|
avpriv_set_pts_info(st, 64, 1, 48000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user