summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegvideo.h3
-rw-r--r--libavcodec/mpegvideo_dec.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 84d79d2e59..5e406b9a9c 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -84,6 +84,9 @@ typedef struct MpegEncContext {
* offsets used in ASM. */
struct AVCodecContext *avctx;
+ /* The following pointer is intended for codecs sharing code
+ * between decoder and encoder and in need of a common context to do so. */
+ void *private_ctx;
/* the following parameters must be initialized before encoding */
int width, height;///< picture size. must be a multiple of 16
int gop_size;
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 57465e41a0..bb581840ae 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -62,10 +62,12 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
// FIXME can parameters change on I-frames?
// in that case dst may need a reinit
if (!s->context_initialized) {
+ void *private_ctx = s->private_ctx;
int err;
memcpy(s, s1, sizeof(*s));
s->avctx = dst;
+ s->private_ctx = private_ctx;
s->bitstream_buffer = NULL;
s->bitstream_buffer_size = s->allocated_bitstream_buffer_size = 0;
@@ -76,6 +78,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
if ((err = ff_mpv_common_init(s)) < 0) {
memset(s, 0, sizeof(*s));
s->avctx = dst;
+ s->private_ctx = private_ctx;
return err;
}
}