124 #if FF_API_GET_BUFFER
125 #define THREAD_SAFE_CALLBACKS(avctx) \
126 ((avctx)->thread_safe_callbacks || (!(avctx)->get_buffer && (avctx)->get_buffer2 == avcodec_default_get_buffer2))
128 #define THREAD_SAFE_CALLBACKS(avctx) \
129 ((avctx)->thread_safe_callbacks || (avctx)->get_buffer2 == avcodec_default_get_buffer2)
148 while (p->
state == STATE_INPUT_READY && !fctx->
die)
151 if (fctx->
die)
break;
163 "free the frame on failure. This is a bug, please report it.\n");
171 for (i = 0; i < MAX_BUFFERS; i++)
173 p->progress[i][0] = INT_MAX;
174 p->progress[i][1] = INT_MAX;
177 p->
state = STATE_INPUT_READY;
261 #define copy_fields(s, e) memcpy(&dst->s, &src->s, (char*)&dst->e - (char*)&dst->s);
266 #if FF_API_GET_BUFFER
339 if (prev_thread->
state == STATE_SETTING_UP) {
341 while (prev_thread->
state == STATE_SETTING_UP)
356 p->
state = STATE_SETTING_UP;
374 while (p->
state != STATE_SETUP_FINISHED && p->
state != STATE_INPUT_READY) {
377 while (p->
state == STATE_SETTING_UP)
381 case STATE_GET_BUFFER:
384 case STATE_GET_FORMAT:
392 p->
state = STATE_SETTING_UP;
406 AVFrame *picture,
int *got_picture_ptr,
445 p = &fctx->
threads[finished++];
447 if (p->
state != STATE_INPUT_READY) {
449 while (p->
state != STATE_INPUT_READY)
484 if (!progress || progress[field] >= n)
return;
502 if (!progress || progress[field] >= n)
return;
510 while (progress[field] < n)
520 if(p->
state == STATE_SETUP_FINISHED){
525 p->
state = STATE_SETUP_FINISHED;
535 for (i = 0; i < thread_count; i++) {
538 if (p->
state != STATE_INPUT_READY) {
540 while (p->
state != STATE_INPUT_READY)
565 for (i = 0; i < thread_count; i++) {
585 for (i = 0; i < thread_count; i++) {
633 if (thread_count <= 1) {
644 for (i = 0; i < thread_count; i++) {
684 err = codec->
init(copy);
767 if (p->
state != STATE_SETTING_UP &&
769 av_log(avctx,
AV_LOG_ERROR,
"get_buffer() cannot be called after ff_thread_finish_setup()\n");
781 progress[0] = progress[1] = -1;
797 p->
state = STATE_GET_BUFFER;
800 while (p->
state != STATE_SETTING_UP)
826 if (p->
state != STATE_SETTING_UP) {
827 av_log(avctx,
AV_LOG_ERROR,
"get_format() cannot be called after ff_thread_finish_setup()\n");
832 p->
state = STATE_GET_FORMAT;
835 while (p->
state != STATE_SETTING_UP)
868 if (!f->
f || !f->
f->
buf[0])
877 if (can_direct_free) {