122 #if FF_API_GET_BUFFER
123 #define THREAD_SAFE_CALLBACKS(avctx) \
124 ((avctx)->thread_safe_callbacks || (!(avctx)->get_buffer && (avctx)->get_buffer2 == avcodec_default_get_buffer2))
126 #define THREAD_SAFE_CALLBACKS(avctx) \
127 ((avctx)->thread_safe_callbacks || (avctx)->get_buffer2 == avcodec_default_get_buffer2)
146 while (p->
state == STATE_INPUT_READY && !fctx->
die)
149 if (fctx->
die)
break;
161 "free the frame on failure. This is a bug, please report it.\n");
169 for (i = 0; i < MAX_BUFFERS; i++)
171 p->progress[i][0] = INT_MAX;
172 p->progress[i][1] = INT_MAX;
175 p->
state = STATE_INPUT_READY;
255 #define copy_fields(s, e) memcpy(&dst->s, &src->s, (char*)&dst->e - (char*)&dst->s);
260 #if FF_API_GET_BUFFER
333 if (prev_thread->
state == STATE_SETTING_UP) {
335 while (prev_thread->
state == STATE_SETTING_UP)
350 p->
state = STATE_SETTING_UP;
368 while (p->
state != STATE_SETUP_FINISHED && p->
state != STATE_INPUT_READY) {
371 while (p->
state == STATE_SETTING_UP)
375 case STATE_GET_BUFFER:
378 case STATE_GET_FORMAT:
386 p->
state = STATE_SETTING_UP;
400 AVFrame *picture,
int *got_picture_ptr,
439 p = &fctx->
threads[finished++];
441 if (p->
state != STATE_INPUT_READY) {
443 while (p->
state != STATE_INPUT_READY)
478 if (!progress || progress[field] >= n)
return;
496 if (!progress || progress[field] >= n)
return;
504 while (progress[field] < n)
514 if(p->
state == STATE_SETUP_FINISHED){
519 p->
state = STATE_SETUP_FINISHED;
529 for (i = 0; i < thread_count; i++) {
532 if (p->
state != STATE_INPUT_READY) {
534 while (p->
state != STATE_INPUT_READY)
559 for (i = 0; i < thread_count; i++) {
579 for (i = 0; i < thread_count; i++) {
627 if (thread_count <= 1) {
638 for (i = 0; i < thread_count; i++) {
678 err = codec->
init(copy);
761 if (p->
state != STATE_SETTING_UP &&
763 av_log(avctx,
AV_LOG_ERROR,
"get_buffer() cannot be called after ff_thread_finish_setup()\n");
775 progress[0] = progress[1] = -1;
791 p->
state = STATE_GET_BUFFER;
794 while (p->
state != STATE_SETTING_UP)
820 if (p->
state != STATE_SETTING_UP) {
821 av_log(avctx,
AV_LOG_ERROR,
"get_format() cannot be called after ff_thread_finish_setup()\n");
826 p->
state = STATE_GET_FORMAT;
829 while (p->
state != STATE_SETTING_UP)
862 if (!f->
f || !f->
f->
buf[0])
871 if (can_direct_free) {