[libav-devel] [PATCH 4/5] pthread: store thread contexts in AVCodecInternal instead of AVCodecContext

Vittorio Giovara vittorio.giovara at gmail.com
Sun Nov 3 12:23:12 CET 2013


On Sun, Oct 27, 2013 at 1:17 PM, Anton Khirnov <anton at khirnov.net> wrote:
> It's a private field, it should not be visible to callers.
>
> Deprecate AVCodecContext.thread_opaque
> ---
>  libavcodec/avcodec.h       |    8 ++++----
>  libavcodec/internal.h      |    2 ++
>  libavcodec/options.c       |    1 -
>  libavcodec/pthread_frame.c |   43 ++++++++++++++++++++++---------------------
>  libavcodec/pthread_slice.c |   12 ++++++------
>  libavcodec/utils.c         |    2 +-
>  libavcodec/version.h       |    3 +++
>  7 files changed, 38 insertions(+), 33 deletions(-)
>

I think this looks ok, maybe is it worth adding a note in APIchanges
or changelog about this?
Minor nits follow.
Vittorio

> @@ -654,9 +655,9 @@ error:
>  void ff_thread_flush(AVCodecContext *avctx)
>  {
>      int i;
> -    FrameThreadContext *fctx = avctx->thread_opaque;
> +    FrameThreadContext *fctx = avctx->internal->thread_ctx;
>
> -    if (!avctx->thread_opaque) return;
> +    if (!fctx) return;

newline

>
>      park_frame_worker_threads(fctx, avctx->thread_count);
>      if (fctx->prev_thread) {

> @@ -125,7 +125,7 @@ static av_always_inline void thread_park_workers(SliceThreadContext *c, int thre
>
>  static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size)
>  {
> -    SliceThreadContext *c= avctx->thread_opaque;
> +    SliceThreadContext *c= avctx->internal->thread_ctx;

space before =

>      int dummy_ret;
>
>      if (!(avctx->active_thread_type&FF_THREAD_SLICE) || avctx->thread_count <= 1)
> @@ -158,7 +158,7 @@ static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, i
>
>  static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count)
>  {
> -    SliceThreadContext *c= avctx->thread_opaque;
> +    SliceThreadContext *c= avctx->internal->thread_ctx;

space before =

>      c->func2 = func2;
>      return thread_execute(avctx, NULL, arg, ret, job_count, 0);
>  }


More information about the libav-devel mailing list