X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fpcm-dvd.c;h=775d342eaa8a812377ca13673a17cf7e476ed63a;hb=cb9dbc60db1847fcb594684b92334da54ea8757e;hp=0a751a81916b71106c355e8c0071b6cad98d8e6a;hpb=4069096dd535ee99175c2a29c1a1f59c3fc110c1;p=ffmpeg diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c index 0a751a81916..775d342eaa8 100644 --- a/libavcodec/pcm-dvd.c +++ b/libavcodec/pcm-dvd.c @@ -34,8 +34,9 @@ typedef struct PCMDVDContext { int last_block_size; // Size of the last block of samples in bytes int samples_per_block; // Number of samples per channel per block int groups_per_block; // Number of 20/24-bit sample groups per block - uint8_t *extra_samples; // Pointer to leftover samples from a frame int extra_sample_count; // Number of leftover samples in the buffer + uint8_t extra_samples[8 * 3 * 4]; // Space for leftover samples from a frame + // (8 channels, 3B/sample, 4 samples/block) } PCMDVDContext; static av_cold int pcm_dvd_decode_init(AVCodecContext *avctx) @@ -44,18 +45,6 @@ static av_cold int pcm_dvd_decode_init(AVCodecContext *avctx) /* Invalid header to force parsing of the first header */ s->last_header = -1; - /* reserve space for 8 channels, 3 bytes/sample, 4 samples/block */ - if (!(s->extra_samples = av_malloc(8 * 3 * 4))) - return AVERROR(ENOMEM); - - return 0; -} - -static av_cold int pcm_dvd_decode_uninit(AVCodecContext *avctx) -{ - PCMDVDContext *s = avctx->priv_data; - - av_freep(&s->extra_samples); return 0; } @@ -302,7 +291,7 @@ static int pcm_dvd_decode_frame(AVCodecContext *avctx, void *data, return avpkt->size; } -AVCodec ff_pcm_dvd_decoder = { +const AVCodec ff_pcm_dvd_decoder = { .name = "pcm_dvd", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for DVD media"), .type = AVMEDIA_TYPE_AUDIO, @@ -310,9 +299,10 @@ AVCodec ff_pcm_dvd_decoder = { .priv_data_size = sizeof(PCMDVDContext), .init = pcm_dvd_decode_init, .decode = pcm_dvd_decode_frame, - .close = pcm_dvd_decode_uninit, - .capabilities = AV_CODEC_CAP_DR1, + .capabilities = AV_CODEC_CAP_CHANNEL_CONF | + AV_CODEC_CAP_DR1, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_NONE - } + }, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, };