Path: blob/master/dep/ffmpeg/include/libavutil/executor.h
4216 views
/*1* Copyright (C) 2023 Nuo Mi2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920#ifndef AVUTIL_EXECUTOR_H21#define AVUTIL_EXECUTOR_H2223typedef struct AVExecutor AVExecutor;24typedef struct AVTask AVTask;2526struct AVTask {27AVTask *next;28};2930typedef struct AVTaskCallbacks {31void *user_data;3233int local_context_size;3435// return 1 if a's priority > b's priority36int (*priority_higher)(const AVTask *a, const AVTask *b);3738// task is ready for run39int (*ready)(const AVTask *t, void *user_data);4041// run the task42int (*run)(AVTask *t, void *local_context, void *user_data);43} AVTaskCallbacks;4445/**46* Alloc executor47* @param callbacks callback structure for executor48* @param thread_count worker thread number, 0 for run on caller's thread directly49* @return return the executor50*/51AVExecutor* av_executor_alloc(const AVTaskCallbacks *callbacks, int thread_count);5253/**54* Free executor55* @param e pointer to executor56*/57void av_executor_free(AVExecutor **e);5859/**60* Add task to executor61* @param e pointer to executor62* @param t pointer to task. If NULL, it will wakeup one work thread63*/64void av_executor_execute(AVExecutor *e, AVTask *t);6566#endif //AVUTIL_EXECUTOR_H676869