aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-15 19:31:32 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-15 19:32:44 +0200
commit9b7cb02319b65596b5ef106a830fd813248fb580 (patch)
tree24a33e256e7b272d75789a9b4642bd4128600c40 /libavcodec
parentf478e8500a3d1fb0c6014956de42d87e292b9e3b (diff)
parentefc7df6c1f11b20a48e60c3f743ce2331b661973 (diff)
downloadffmpeg-9b7cb02319b65596b5ef106a830fd813248fb580.tar.gz
Merge commit 'efc7df6c1f11b20a48e60c3f743ce2331b661973'
* commit 'efc7df6c1f11b20a48e60c3f743ce2331b661973': lavc: preserve the original private data in avcodec_copy_context() Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/options.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 5ee9d6bd73..204c12a3f2 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -156,6 +156,9 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
{
+ const AVCodec *orig_codec = dest->codec;
+ uint8_t *orig_priv_data = dest->priv_data;
+
if (avcodec_is_open(dest)) { // check that the dest context is uninitialized
av_log(dest, AV_LOG_ERROR,
"Tried to copy AVCodecContext %p into already-initialized %p\n",
@@ -168,9 +171,10 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
memcpy(dest, src, sizeof(*dest));
+ dest->priv_data = orig_priv_data;
+ dest->codec = orig_codec;
+
/* set values specific to opened codecs back to their default state */
- dest->priv_data = NULL;
- dest->codec = NULL;
dest->slice_offset = NULL;
dest->hwaccel = NULL;
dest->internal = NULL;