---
libavcodec/avcodec.h | 6 +++---
libavcodec/pthread.c | 44 ++++++++++++++++++++++----------------------
libavcodec/thread.h | 4 ++--
3 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index dd26ca4..15b3e29 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -770,14 +770,14 @@ typedef struct AVPanScan{
int8_t *ref_index[2];\
\
/**\
- * context owning the internal buffers\
+ * the AVCodecContext owning the internal buffers\
* - encoding: Set by libavcodec.\
* - decoding: Set by libavcodec.\
*/\
- struct AVCodecContext *avctx;\
+ struct AVCodecContext *owner;\
\
/**\
- * Can be used by multithreading to track frames\
+ * used by multithreading to track frames\
* - encoding: Set by libavcodec.\
* - decoding: Set by libavcodec.\
*/\
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 2acb3ff..14b4a15 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -51,7 +51,7 @@ typedef struct PerThreadContext {
pthread_cond_t input_cond, progress_cond, output_cond;
pthread_mutex_t mutex, progress_mutex, buffer_mutex;
- AVCodecContext *context;
+ AVCodecContext *avctx;
uint8_t *buf;
int buf_size, allocated_buf_size;
@@ -214,7 +214,7 @@ static int ff_thread_init(AVCodecContext *avctx, int thread_count)
static attribute_align_arg void *decode_frame_thread(void *arg)
{
PerThreadContext * volatile p = arg;
- AVCodecContext *avctx = p->context;
+ AVCodecContext *avctx = p->avctx;
FrameThreadContext * volatile fctx = p->parent;
AVCodec *codec = avctx->codec;
@@ -271,7 +271,7 @@ static int ff_frame_thread_init(AVCodecContext *avctx)
pthread_cond_init(&p->output_cond, NULL);
p->parent = fctx;
- p->context = copy;
+ p->avctx = copy;
*copy = *src;
copy->thread_opaque = p;
@@ -372,13 +372,13 @@ static int submit_frame(PerThreadContext * volatile p, const uint8_t *buf, int b
{
FrameThreadContext *fctx = p->parent;
PerThreadContext *prev_thread = fctx->prev_thread;
- AVCodec *codec = p->context->codec;
+ AVCodec *codec = p->avctx->codec;
int err = 0;
if (!buf_size && !(codec->capabilities & CODEC_CAP_DELAY)) return 0;
pthread_mutex_lock(&p->mutex);
- if (prev_thread) err = update_context_from_copy(p->context, prev_thread->context, 0);
+ if (prev_thread) err = update_context_from_copy(p->avctx, prev_thread->avctx, 0);
if (err) return err;
p->buf = av_fast_realloc(p->buf, &p->allocated_buf_size, buf_size);
@@ -413,7 +413,7 @@ int ff_decode_frame_threaded(AVCodecContext *avctx,
fctx = avctx->thread_opaque;
p = &fctx->threads[fctx->next_available];
- update_context_from_user(p->context, avctx);
+ update_context_from_user(p->avctx, avctx);
err = submit_frame(p, buf, buf_size);
if (err) return err;
@@ -433,7 +433,7 @@ int ff_decode_frame_threaded(AVCodecContext *avctx,
while (p->state != STATE_INPUT_READY) pthread_cond_wait(&p->output_cond, &p->progress_mutex);
pthread_mutex_unlock(&p->progress_mutex);
- err = update_context_from_copy(avctx, p->context, 1);
+ err = update_context_from_copy(avctx, p->avctx, 1);
if (err) return err;
*(AVFrame*)data = p->picture;
@@ -447,7 +447,7 @@ int ff_decode_frame_threaded(AVCodecContext *avctx,
void ff_report_decode_progress(AVFrame *f, int n)
{
- PerThreadContext *p = f->avctx->thread_opaque;
+ PerThreadContext *p = f->owner->thread_opaque;
int *progress = f->thread_opaque;
if (*progress >= n) return;
@@ -460,7 +460,7 @@ void ff_report_decode_progress(AVFrame *f, int n)
void ff_await_decode_progress(AVFrame *f, int n)
{
- PerThreadContext *p = f->avctx->thread_opaque;
+ PerThreadContext *p = f->owner->thread_opaque;
int * volatile progress = f->thread_opaque;
if (*progress >= n) return;
@@ -506,7 +506,7 @@ static void ff_frame_thread_free(AVCodecContext *avctx)
park_frame_decode_threads(fctx, avctx->thread_count);
if (fctx->prev_thread != fctx->threads)
- update_context_from_copy(fctx->threads->context, fctx->prev_thread->context, 0);
+ update_context_from_copy(fctx->threads->avctx, fctx->prev_thread->avctx, 0);
fctx->die = 1;
@@ -521,7 +521,7 @@ static void ff_frame_thread_free(AVCodecContext *avctx)
pthread_join(p->thread, NULL);
if (codec->close)
- codec->close(p->context);
+ codec->close(p->avctx);
handle_delayed_releases(p);
}
@@ -529,7 +529,7 @@ static void ff_frame_thread_free(AVCodecContext *avctx)
for (i = 0; i < avctx->thread_count; i++) {
PerThreadContext *p = &fctx->threads[i];
- avcodec_default_free_buffers(p->context);
+ avcodec_default_free_buffers(p->avctx);
pthread_mutex_destroy(&p->mutex);
pthread_mutex_destroy(&p->progress_mutex);
@@ -540,9 +540,9 @@ static void ff_frame_thread_free(AVCodecContext *avctx)
av_freep(&p->buf);
if (i)
- av_freep(&p->context->priv_data);
+ av_freep(&p->avctx->priv_data);
- av_freep(&p->context);
+ av_freep(&p->avctx);
}
av_freep(&fctx->threads);
@@ -559,7 +559,7 @@ void ff_frame_thread_flush(AVCodecContext *avctx)
park_frame_decode_threads(fctx, avctx->thread_count);
if (fctx->prev_thread != fctx->threads)
- update_context_from_copy(fctx->threads->context, fctx->prev_thread->context, 0);
+ update_context_from_copy(fctx->threads->avctx, fctx->prev_thread->avctx, 0);
for (i = 0; i < avctx->thread_count; i++) {
PerThreadContext *p = &fctx->threads[i];
@@ -580,7 +580,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *f)
int ret, *progress;
PerThreadContext *p = avctx->thread_opaque;
- f->avctx = avctx;
+ f->owner = avctx;
f->thread_opaque = progress = av_malloc(sizeof(int));
if (!USE_FRAME_THREADING(avctx)) {
@@ -599,17 +599,17 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *f)
void ff_release_buffer(AVFrame *f)
{
- PerThreadContext *p = f->avctx->thread_opaque;
+ PerThreadContext *p = f->owner->thread_opaque;
av_freep(&f->thread_opaque);
- if (!USE_FRAME_THREADING(f->avctx)) {
- f->avctx->release_buffer(f->avctx, f);
+ if (!USE_FRAME_THREADING(f->owner)) {
+ f->owner->release_buffer(f->owner, f);
return;
}
pthread_mutex_lock(&p->buffer_mutex);
- f->avctx->release_buffer(f->avctx, f);
+ f->owner->release_buffer(f->owner, f);
pthread_mutex_unlock(&p->buffer_mutex);
}
@@ -623,13 +623,13 @@ void ff_delayed_release_buffer(AVCodecContext *avctx, AVFrame *f)
}
if (p->nb_released_buffers >= MAX_DELAYED_RELEASED_BUFFERS) {
- av_log(p->context, AV_LOG_ERROR, "too many delayed release_buffer calls!\n");
+ av_log(p->avctx, AV_LOG_ERROR, "too many delayed release_buffer calls!\n");
return;
}
if(avctx->debug & FF_DEBUG_BUFFERS)
av_log(avctx, AV_LOG_DEBUG, "delayed_release_buffer called on pic %p, %d buffers used\n",
- f, f->avctx->internal_buffer_count);
+ f, f->owner->internal_buffer_count);
p->released_buffers[p->nb_released_buffers++] = *f;
memset(f->data, 0, sizeof(f->data));
diff --git a/libavcodec/thread.h b/libavcodec/thread.h
index 17d1953..7badd16 100644
--- a/libavcodec/thread.h
+++ b/libavcodec/thread.h
@@ -108,13 +108,13 @@ static inline int ff_get_buffer(AVCodecContext *avctx, AVFrame *f)
{
int ret = avctx->get_buffer(avctx, f);
- f->avctx = avctx;
+ f->owner = avctx;
return ret;
}
static inline void ff_release_buffer(AVFrame *f)
{
- f->avctx->release_buffer(f->avctx, f);
+ f->owner->release_buffer(f->owner, f);
}
static inline void ff_delayed_release_buffer(AVCodecContext *avctx, AVFrame *f)
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc