mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lavc: copy AVCodecContext for threads
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
c112e36d41
commit
ff0bdf9375
@ -621,6 +621,7 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
|
||||
static int init_thread_copy(AVCodecContext *avctx)
|
||||
{
|
||||
ALACContext *alac = avctx->priv_data;
|
||||
alac->avctx = avctx;
|
||||
return allocate_buffers(alac);
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,6 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int ret;
|
||||
|
||||
*got_frame_ptr = 0;
|
||||
s->avctx = avctx;
|
||||
|
||||
if (s->max_framesize == 0) {
|
||||
s->max_framesize =
|
||||
@ -575,6 +574,7 @@ static int init_thread_copy(AVCodecContext *avctx)
|
||||
FLACContext *s = avctx->priv_data;
|
||||
s->decoded_buffer = NULL;
|
||||
s->decoded_buffer_size = 0;
|
||||
s->avctx = avctx;
|
||||
if (s->max_blocksize)
|
||||
return allocate_buffers(s);
|
||||
return 0;
|
||||
|
@ -902,6 +902,13 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return pkt->size;
|
||||
}
|
||||
|
||||
static int init_thread_copy(AVCodecContext *avctx)
|
||||
{
|
||||
TAKDecContext *s = avctx->priv_data;
|
||||
s->avctx = avctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int update_thread_context(AVCodecContext *dst,
|
||||
const AVCodecContext *src)
|
||||
{
|
||||
@ -931,6 +938,7 @@ AVCodec ff_tak_decoder = {
|
||||
.init = tak_decode_init,
|
||||
.close = tak_decode_close,
|
||||
.decode = tak_decode_frame,
|
||||
.init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
|
||||
.update_thread_context = ONLY_IF_THREADS_ENABLED(update_thread_context),
|
||||
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"),
|
||||
|
@ -410,6 +410,8 @@ error:
|
||||
|
||||
static int init_thread_copy(AVCodecContext *avctx)
|
||||
{
|
||||
TTAContext *s = avctx->priv_data;
|
||||
s->avctx = avctx;
|
||||
return allocate_buffers(avctx);
|
||||
}
|
||||
|
||||
|
@ -728,6 +728,13 @@ static av_cold int wv_alloc_frame_context(WavpackContext *c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init_thread_copy(AVCodecContext *avctx)
|
||||
{
|
||||
WavpackContext *s = avctx->priv_data;
|
||||
s->avctx = avctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold int wavpack_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
WavpackContext *s = avctx->priv_data;
|
||||
@ -1238,6 +1245,7 @@ AVCodec ff_wavpack_decoder = {
|
||||
.close = wavpack_decode_end,
|
||||
.decode = wavpack_decode_frame,
|
||||
.flush = wavpack_decode_flush,
|
||||
.init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
|
||||
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("WavPack"),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user