summaryrefslogtreecommitdiffstats
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-11-15 15:34:50 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2011-11-19 10:01:05 -0500
commitf3a29b750a5979ae6847879fba758faf1fae88d0 (patch)
tree0a5bf0e6822f0adf284a76c5d28ce55e3ad21d24 /libavcodec/pthread.c
parent513b6919555b9e2b0c1f86fd5f02caaa14bcbe69 (diff)
downloadffmpeg-streaming-f3a29b750a5979ae6847879fba758faf1fae88d0.zip
ffmpeg-streaming-f3a29b750a5979ae6847879fba758faf1fae88d0.tar.gz
avcodec: move some AVCodecContext fields to an internal struct.
A new field, AVCodecContext.internal is used to hold a new struct AVCodecInternal, which has private fields that are not codec-specific and are used by general libavcodec functions. Moved internal_buffer, internal_buffer_count, and is_copy.
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 7557e68..9fe9b8d 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -31,6 +31,7 @@
#include "config.h"
#include "avcodec.h"
+#include "internal.h"
#include "thread.h"
#if HAVE_PTHREADS
@@ -672,8 +673,10 @@ static void frame_thread_free(AVCodecContext *avctx, int thread_count)
pthread_cond_destroy(&p->output_cond);
av_freep(&p->avpkt.data);
- if (i)
+ if (i) {
av_freep(&p->avctx->priv_data);
+ av_freep(&p->avctx->internal);
+ }
av_freep(&p->avctx);
}
@@ -728,9 +731,15 @@ static int frame_thread_init(AVCodecContext *avctx)
update_context_from_thread(avctx, copy, 1);
} else {
- copy->is_copy = 1;
copy->priv_data = av_malloc(codec->priv_data_size);
memcpy(copy->priv_data, src->priv_data, codec->priv_data_size);
+ copy->internal = av_malloc(sizeof(AVCodecInternal));
+ if (!copy->internal) {
+ err = AVERROR(ENOMEM);
+ goto error;
+ }
+ *(copy->internal) = *(src->internal);
+ copy->internal->is_copy = 1;
if (codec->init_thread_copy)
err = codec->init_thread_copy(copy);
@@ -862,8 +871,7 @@ void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
}
if(avctx->debug & FF_DEBUG_BUFFERS)
- av_log(avctx, AV_LOG_DEBUG, "thread_release_buffer called on pic %p, %d buffers used\n",
- f, f->owner->internal_buffer_count);
+ av_log(avctx, AV_LOG_DEBUG, "thread_release_buffer called on pic %p\n", f);
fctx = p->parent;
pthread_mutex_lock(&fctx->buffer_mutex);
OpenPOWER on IntegriCloud