#include "internal.h"
#include "pthread_internal.h"
#include "thread.h"
+#include "version.h"
#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/common.h"
#include "libavutil/cpu.h"
#include "libavutil/frame.h"
+#include "libavutil/internal.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
AVCodecContext *avctx; ///< Context used to decode packets passed to this thread.
AVPacket avpkt; ///< Input packet (for decoding) or output (for encoding).
- uint8_t *buf; ///< backup storage for packet data when the input packet is not refcounted
- int allocated_buf_size; ///< Size allocated for buf
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.
if (dst != src) {
dst->time_base = src->time_base;
+ dst->framerate = src->framerate;
dst->width = src->width;
dst->height = src->height;
dst->pix_fmt = src->pix_fmt;
dst->bits_per_coded_sample = src->bits_per_coded_sample;
dst->sample_aspect_ratio = src->sample_aspect_ratio;
+#if FF_API_AFD
+FF_DISABLE_DEPRECATION_WARNINGS
dst->dtg_active_format = src->dtg_active_format;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_AFD */
dst->profile = src->profile;
dst->level = src->level;
}
if (for_user) {
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
dst->coded_frame = src->coded_frame;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
} else {
if (dst->codec->update_thread_context)
err = dst->codec->update_thread_context(dst, src);
}
}
- av_buffer_unref(&p->avpkt.buf);
- p->avpkt = *avpkt;
- if (avpkt->buf)
- p->avpkt.buf = av_buffer_ref(avpkt->buf);
- else {
- av_fast_malloc(&p->buf, &p->allocated_buf_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
- p->avpkt.data = p->buf;
- memcpy(p->buf, avpkt->data, avpkt->size);
- memset(p->buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- }
+ av_packet_unref(&p->avpkt);
+ av_packet_ref(&p->avpkt, avpkt);
p->state = STATE_SETTING_UP;
pthread_cond_signal(&p->input_cond);
pthread_cond_destroy(&p->input_cond);
pthread_cond_destroy(&p->progress_cond);
pthread_cond_destroy(&p->output_cond);
- av_buffer_unref(&p->avpkt.buf);
- av_freep(&p->buf);
+ av_packet_unref(&p->avpkt);
av_freep(&p->released_buffers);
if (i) {
}
avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext));
+ if (!fctx)
+ return AVERROR(ENOMEM);
fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count);
+ if (!fctx->threads) {
+ av_freep(&avctx->internal->thread_ctx);
+ return AVERROR(ENOMEM);
+ }
+
pthread_mutex_init(&fctx->buffer_mutex, NULL);
fctx->delaying = 1;
p->frame = av_frame_alloc();
if (!p->frame) {
+ av_freep(©);
err = AVERROR(ENOMEM);
goto error;
}