AVCodecContext *avctx; ///< Context used to decode packets passed to this thread.
- AVPacket avpkt; ///< Input packet (for decoding) or output (for encoding).
+ AVPacket *avpkt; ///< Input packet (for decoding) or output (for encoding).
AVFrame *frame; ///< Output frame (for decoding) or input (for encoding).
int got_frame; ///< The output of got_picture_ptr from the last avcodec_decode_video() call.
av_frame_unref(p->frame);
p->got_frame = 0;
- p->result = codec->decode(avctx, p->frame, &p->got_frame, &p->avpkt);
+ p->result = codec->decode(avctx, p->frame, &p->got_frame, p->avpkt);
if ((p->result < 0 || !p->got_frame) && p->frame->buf[0]) {
if (avctx->codec->caps_internal & FF_CODEC_CAP_ALLOCATE_PROGRESS)
}
}
- av_packet_unref(&p->avpkt);
- ret = av_packet_ref(&p->avpkt, avpkt);
+ av_packet_unref(p->avpkt);
+ ret = av_packet_ref(p->avpkt, avpkt);
if (ret < 0) {
pthread_mutex_unlock(&p->mutex);
av_log(p->avctx, AV_LOG_ERROR, "av_packet_ref() failed in submit_packet()\n");
av_frame_move_ref(picture, p->frame);
*got_picture_ptr = p->got_frame;
- picture->pkt_dts = p->avpkt.dts;
+ picture->pkt_dts = p->avpkt->dts;
err = p->result;
/*
pthread_cond_destroy(&p->input_cond);
pthread_cond_destroy(&p->progress_cond);
pthread_cond_destroy(&p->output_cond);
- av_packet_unref(&p->avpkt);
+ av_packet_free(&p->avpkt);
#if FF_API_THREAD_SAFE_CALLBACKS
for (int j = 0; j < p->released_buffers_allocated; j++)
err = AVERROR(ENOMEM);
goto error;
}
+ p->avpkt = av_packet_alloc();
+ if (!p->avpkt) {
+ av_freep(©);
+ err = AVERROR(ENOMEM);
+ goto error;
+ }
p->parent = fctx;
p->avctx = copy;
}
*copy->internal = *src->internal;
copy->internal->thread_ctx = p;
- copy->internal->last_pkt_props = &p->avpkt;
+ copy->internal->last_pkt_props = p->avpkt;
copy->delay = avctx->delay;