1 /* 2 * This file is part of FFmpeg. 3 * 4 * FFmpeg is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * FFmpeg is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with FFmpeg; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #ifndef AVUTIL_SLICETHREAD_H 20 #define AVUTIL_SLICETHREAD_H 21 22 typedef struct AVSliceThread AVSliceThread; 23 24 /** 25 * Create slice threading context. 26 * @param pctx slice threading context returned here 27 * @param priv private pointer to be passed to callback function 28 * @param worker_func callback function to be executed 29 * @param main_func special callback function, called from main thread, may be NULL 30 * @param nb_threads number of threads, 0 for automatic, must be >= 0 31 * @return return number of threads or negative AVERROR on failure 32 */ 33 int avpriv_slicethread_create(AVSliceThread **pctx, void *priv, 34 void (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads), 35 void (*main_func)(void *priv), 36 int nb_threads); 37 38 /** 39 * Execute slice threading. 40 * @param ctx slice threading context 41 * @param nb_jobs number of jobs, must be > 0 42 * @param execute_main also execute main_func 43 */ 44 void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_main); 45 46 /** 47 * Destroy slice threading context. 48 * @param pctx pointer to context 49 */ 50 void avpriv_slicethread_free(AVSliceThread **pctx); 51 52 #endif 53