typedef int (action_func)(AVCodecContext *c, void *arg);
typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr);
-typedef struct ThreadContext {
+typedef struct SliceThreadContext {
pthread_t *workers;
action_func *func;
action_func2 *func2;
unsigned current_execute;
int current_job;
int done;
-} ThreadContext;
+} SliceThreadContext;
static void* attribute_align_arg worker(void *v)
{
AVCodecContext *avctx = v;
- ThreadContext *c = avctx->thread_opaque;
+ SliceThreadContext *c = avctx->internal->thread_ctx;
unsigned last_execute = 0;
int our_job = c->job_count;
int thread_count = avctx->thread_count;
void ff_slice_thread_free(AVCodecContext *avctx)
{
- ThreadContext *c = avctx->thread_opaque;
+ SliceThreadContext *c = avctx->internal->thread_ctx;
int i;
pthread_mutex_lock(&c->current_job_lock);
pthread_cond_destroy(&c->current_job_cond);
pthread_cond_destroy(&c->last_job_cond);
av_free(c->workers);
- av_freep(&avctx->thread_opaque);
+ av_freep(&avctx->internal->thread_ctx);
}
-static av_always_inline void thread_park_workers(ThreadContext *c, int thread_count)
+static av_always_inline void thread_park_workers(SliceThreadContext *c, int thread_count)
{
while (c->current_job != thread_count + c->job_count)
pthread_cond_wait(&c->last_job_cond, &c->current_job_lock);
static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size)
{
- ThreadContext *c= avctx->thread_opaque;
+ SliceThreadContext *c = avctx->internal->thread_ctx;
int dummy_ret;
if (!(avctx->active_thread_type&FF_THREAD_SLICE) || avctx->thread_count <= 1)
static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count)
{
- ThreadContext *c= avctx->thread_opaque;
+ SliceThreadContext *c = avctx->internal->thread_ctx;
c->func2 = func2;
return thread_execute(avctx, NULL, arg, ret, job_count, 0);
}
int ff_slice_thread_init(AVCodecContext *avctx)
{
int i;
- ThreadContext *c;
+ SliceThreadContext *c;
int thread_count = avctx->thread_count;
#if HAVE_W32THREADS
return 0;
}
- c = av_mallocz(sizeof(ThreadContext));
+ c = av_mallocz(sizeof(SliceThreadContext));
if (!c)
return -1;
return -1;
}
- avctx->thread_opaque = c;
+ avctx->internal->thread_ctx = c;
c->current_job = 0;
c->job_count = 0;
c->job_size = 0;