aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-06-13 21:49:18 +0000
committerPaul B Mahol <onemda@gmail.com>2013-06-13 21:49:18 +0000
commitff0bdf937568908a35d4091cb5c83a0155117ae6 (patch)
tree0a667b240470697645e22ec1289ee564cdb53501
parentc112e36d41da5eb25af3230e2365737759e75375 (diff)
downloadffmpeg-ff0bdf937568908a35d4091cb5c83a0155117ae6.tar.gz
lavc: copy AVCodecContext for threads
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavcodec/alac.c1
-rw-r--r--libavcodec/flacdec.c2
-rw-r--r--libavcodec/takdec.c8
-rw-r--r--libavcodec/tta.c2
-rw-r--r--libavcodec/wavpack.c8
5 files changed, 20 insertions, 1 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index c6f01b329f..6ffc00634f 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -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);
}
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index a0c950bdde..c5847e3cfc 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -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;
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index c9c861c6e3..9e01ee02d7 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -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)"),
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 710aa359d1..6697d84905 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -410,6 +410,8 @@ error:
static int init_thread_copy(AVCodecContext *avctx)
{
+ TTAContext *s = avctx->priv_data;
+ s->avctx = avctx;
return allocate_buffers(avctx);
}
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index de5bc6ca8c..47f598a6fe 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -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"),
};