Commit 9b7cb023 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'efc7df6c'

* commit 'efc7df6c':
  lavc: preserve the original private data in avcodec_copy_context()
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents f478e850 efc7df6c
...@@ -156,6 +156,9 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) ...@@ -156,6 +156,9 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) 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 if (avcodec_is_open(dest)) { // check that the dest context is uninitialized
av_log(dest, AV_LOG_ERROR, av_log(dest, AV_LOG_ERROR,
"Tried to copy AVCodecContext %p into already-initialized %p\n", "Tried to copy AVCodecContext %p into already-initialized %p\n",
...@@ -168,9 +171,10 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) ...@@ -168,9 +171,10 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
memcpy(dest, src, sizeof(*dest)); 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 */ /* set values specific to opened codecs back to their default state */
dest->priv_data = NULL;
dest->codec = NULL;
dest->slice_offset = NULL; dest->slice_offset = NULL;
dest->hwaccel = NULL; dest->hwaccel = NULL;
dest->internal = NULL; dest->internal = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment