mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +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)
|
static int init_thread_copy(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
ALACContext *alac = avctx->priv_data;
|
ALACContext *alac = avctx->priv_data;
|
||||||
|
alac->avctx = avctx;
|
||||||
return allocate_buffers(alac);
|
return allocate_buffers(alac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +498,6 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
*got_frame_ptr = 0;
|
*got_frame_ptr = 0;
|
||||||
s->avctx = avctx;
|
|
||||||
|
|
||||||
if (s->max_framesize == 0) {
|
if (s->max_framesize == 0) {
|
||||||
s->max_framesize =
|
s->max_framesize =
|
||||||
@ -575,6 +574,7 @@ static int init_thread_copy(AVCodecContext *avctx)
|
|||||||
FLACContext *s = avctx->priv_data;
|
FLACContext *s = avctx->priv_data;
|
||||||
s->decoded_buffer = NULL;
|
s->decoded_buffer = NULL;
|
||||||
s->decoded_buffer_size = 0;
|
s->decoded_buffer_size = 0;
|
||||||
|
s->avctx = avctx;
|
||||||
if (s->max_blocksize)
|
if (s->max_blocksize)
|
||||||
return allocate_buffers(s);
|
return allocate_buffers(s);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -902,6 +902,13 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
return pkt->size;
|
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,
|
static int update_thread_context(AVCodecContext *dst,
|
||||||
const AVCodecContext *src)
|
const AVCodecContext *src)
|
||||||
{
|
{
|
||||||
@ -931,6 +938,7 @@ AVCodec ff_tak_decoder = {
|
|||||||
.init = tak_decode_init,
|
.init = tak_decode_init,
|
||||||
.close = tak_decode_close,
|
.close = tak_decode_close,
|
||||||
.decode = tak_decode_frame,
|
.decode = tak_decode_frame,
|
||||||
|
.init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
|
||||||
.update_thread_context = ONLY_IF_THREADS_ENABLED(update_thread_context),
|
.update_thread_context = ONLY_IF_THREADS_ENABLED(update_thread_context),
|
||||||
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"),
|
.long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"),
|
||||||
|
@ -410,6 +410,8 @@ error:
|
|||||||
|
|
||||||
static int init_thread_copy(AVCodecContext *avctx)
|
static int init_thread_copy(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
|
TTAContext *s = avctx->priv_data;
|
||||||
|
s->avctx = avctx;
|
||||||
return allocate_buffers(avctx);
|
return allocate_buffers(avctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,6 +728,13 @@ static av_cold int wv_alloc_frame_context(WavpackContext *c)
|
|||||||
return 0;
|
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)
|
static av_cold int wavpack_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
WavpackContext *s = avctx->priv_data;
|
WavpackContext *s = avctx->priv_data;
|
||||||
@ -1238,6 +1245,7 @@ AVCodec ff_wavpack_decoder = {
|
|||||||
.close = wavpack_decode_end,
|
.close = wavpack_decode_end,
|
||||||
.decode = wavpack_decode_frame,
|
.decode = wavpack_decode_frame,
|
||||||
.flush = wavpack_decode_flush,
|
.flush = wavpack_decode_flush,
|
||||||
|
.init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
|
||||||
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("WavPack"),
|
.long_name = NULL_IF_CONFIG_SMALL("WavPack"),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user