Commit 8aa29f06 authored by Reimar Döffinger's avatar Reimar Döffinger

atrac3: do not use init_static_data to init VLC data.

It would be called while registering the codec, which means
it needlessly wastes memory when it is never used.
Instead do the work when first opening the codec.
Signed-off-by: 's avatarReimar Döffinger <Reimar.Doeffinger@gmx.de>
parent 23101cea
...@@ -837,7 +837,7 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data, ...@@ -837,7 +837,7 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
return avctx->block_align; return avctx->block_align;
} }
static void atrac3_init_static_data(AVCodec *codec) static void atrac3_init_static_data(void)
{ {
int i; int i;
...@@ -864,6 +864,7 @@ static void atrac3_init_static_data(AVCodec *codec) ...@@ -864,6 +864,7 @@ static void atrac3_init_static_data(AVCodec *codec)
static av_cold int atrac3_decode_init(AVCodecContext *avctx) static av_cold int atrac3_decode_init(AVCodecContext *avctx)
{ {
static int static_init_done;
int i, ret; int i, ret;
int version, delay, samples_per_frame, frame_factor; int version, delay, samples_per_frame, frame_factor;
const uint8_t *edata_ptr = avctx->extradata; const uint8_t *edata_ptr = avctx->extradata;
...@@ -874,6 +875,10 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) ...@@ -874,6 +875,10 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (!static_init_done)
atrac3_init_static_data();
static_init_done = 1;
/* Take care of the codec-specific extradata. */ /* Take care of the codec-specific extradata. */
if (avctx->extradata_size == 14) { if (avctx->extradata_size == 14) {
/* Parse the extradata, WAV format */ /* Parse the extradata, WAV format */
...@@ -1003,7 +1008,6 @@ AVCodec ff_atrac3_decoder = { ...@@ -1003,7 +1008,6 @@ AVCodec ff_atrac3_decoder = {
.id = AV_CODEC_ID_ATRAC3, .id = AV_CODEC_ID_ATRAC3,
.priv_data_size = sizeof(ATRAC3Context), .priv_data_size = sizeof(ATRAC3Context),
.init = atrac3_decode_init, .init = atrac3_decode_init,
.init_static_data = atrac3_init_static_data,
.close = atrac3_decode_close, .close = atrac3_decode_close,
.decode = atrac3_decode_frame, .decode = atrac3_decode_frame,
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1, .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment