147 #define MAX_AUTO_THREADS 16
154 int last_execute = 0;
178 c->
func2(avctx, c->
args, our_job, self_id);
234 c->
rets = &dummy_ret;
269 if (thread_count <= 1) {
293 for (i=0; i<thread_count; i++) {
309 #define THREAD_SAFE_CALLBACKS(avctx) \
310 ((avctx)->thread_safe_callbacks || (!(avctx)->get_buffer && (avctx)->get_buffer2 == avcodec_default_get_buffer2))
328 while (p->
state == STATE_INPUT_READY && !fctx->
die)
331 if (fctx->
die)
break;
348 for (i = 0; i < MAX_BUFFERS; i++)
350 p->progress[i][0] = INT_MAX;
351 p->progress[i][1] = INT_MAX;
354 p->
state = STATE_INPUT_READY;
433 #define copy_fields(s, e) memcpy(&dst->s, &src->s, (char*)&dst->e - (char*)&dst->s);
438 #if FF_API_GET_BUFFER
439 dst->get_buffer = src->get_buffer;
440 dst->release_buffer = src->release_buffer;
509 if (prev_thread->
state == STATE_SETTING_UP) {
511 while (prev_thread->
state == STATE_SETTING_UP)
534 p->
state = STATE_SETTING_UP;
547 p->
avctx->get_buffer ||
550 while (p->
state != STATE_SETUP_FINISHED && p->
state != STATE_INPUT_READY) {
553 while (p->
state == STATE_SETTING_UP)
557 case STATE_GET_BUFFER:
560 case STATE_GET_FORMAT:
568 p->
state = STATE_SETTING_UP;
582 AVFrame *picture,
int *got_picture_ptr,
621 p = &fctx->
threads[finished++];
623 if (p->
state != STATE_INPUT_READY) {
625 while (p->
state != STATE_INPUT_READY)
660 if (!progress || progress[field] >= n)
return;
678 if (!progress || progress[field] >= n)
return;
686 while (progress[field] < n)
696 if(p->
state == STATE_SETUP_FINISHED){
701 p->
state = STATE_SETUP_FINISHED;
711 for (i = 0; i < thread_count; i++) {
714 if (p->
state != STATE_INPUT_READY) {
716 while (p->
state != STATE_INPUT_READY)
741 for (i = 0; i < thread_count; i++) {
761 for (i = 0; i < thread_count; i++) {
806 if (thread_count <= 1) {
817 for (i = 0; i < thread_count; i++) {
843 err = codec->
init(copy);
931 if (p->
state != STATE_SETTING_UP &&
933 av_log(avctx,
AV_LOG_ERROR,
"get_buffer() cannot be called after ff_thread_finish_setup()\n");
945 progress[0] = progress[1] = -1;
952 !avctx->get_buffer &&
960 p->
state = STATE_GET_BUFFER;
963 while (p->
state != STATE_SETTING_UP)
989 if (p->
state != STATE_SETTING_UP) {
990 av_log(avctx,
AV_LOG_ERROR,
"get_format() cannot be called after ff_thread_finish_setup()\n");
995 p->
state = STATE_GET_FORMAT;
998 while (p->
state != STATE_SETTING_UP)
1025 !avctx->get_buffer &&
1038 if (can_direct_free) {
1093 "Application has requested %d threads. Using a thread count greater than %d is not recommended.\n",