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;
262 #define copy_fields(s, e) memcpy(&dst->s, &src->s, (char*)&dst->e - (char*)&dst->s);
267 #if FF_API_GET_BUFFER
337 if (prev_thread->
state == STATE_SETTING_UP) {
339 while (prev_thread->
state == STATE_SETTING_UP)
354 p->
state = STATE_SETTING_UP;
372 while (p->
state != STATE_SETUP_FINISHED && p->
state != STATE_INPUT_READY) {
375 while (p->
state == STATE_SETTING_UP)
379 case STATE_GET_BUFFER:
382 case STATE_GET_FORMAT:
390 p->
state = STATE_SETTING_UP;
404 AVFrame *picture,
int *got_picture_ptr,
443 p = &fctx->
threads[finished++];
445 if (p->
state != STATE_INPUT_READY) {
447 while (p->
state != STATE_INPUT_READY)
482 if (!progress || progress[field] >= n)
return;
500 if (!progress || progress[field] >= n)
return;
508 while (progress[field] < n)
518 if(p->
state == STATE_SETUP_FINISHED){
523 p->
state = STATE_SETUP_FINISHED;
533 for (i = 0; i < thread_count; i++) {
536 if (p->
state != STATE_INPUT_READY) {
538 while (p->
state != STATE_INPUT_READY)
563 for (i = 0; i < thread_count; i++) {
583 for (i = 0; i < thread_count; i++) {
631 if (thread_count <= 1) {
642 for (i = 0; i < thread_count; i++) {
682 err = codec->
init(copy);
765 if (p->
state != STATE_SETTING_UP &&
767 av_log(avctx,
AV_LOG_ERROR,
"get_buffer() cannot be called after ff_thread_finish_setup()\n");
779 progress[0] = progress[1] = -1;
795 p->
state = STATE_GET_BUFFER;
798 while (p->
state != STATE_SETTING_UP)
824 if (p->
state != STATE_SETTING_UP) {
825 av_log(avctx,
AV_LOG_ERROR,
"get_format() cannot be called after ff_thread_finish_setup()\n");
830 p->
state = STATE_GET_FORMAT;
833 while (p->
state != STATE_SETTING_UP)
866 if (!f->
f || !f->
f->
buf[0])
875 if (can_direct_free) {