mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavu/frame: deprecate reordered_opaque
It is only used in libavcodec, where it's been superseded by AV_CODEC_CAP_COPY_OPAQUE.
This commit is contained in:
parent
d02340b9e3
commit
bdc76f467f
@ -1392,6 +1392,7 @@ typedef struct AVCodecContext {
|
||||
*/
|
||||
int err_recognition;
|
||||
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
/**
|
||||
* opaque 64-bit number (generally a PTS) that will be reordered and
|
||||
* output in AVFrame.reordered_opaque
|
||||
@ -1400,8 +1401,12 @@ typedef struct AVCodecContext {
|
||||
* supported by encoders with the
|
||||
* AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability.
|
||||
* - decoding: Set by user.
|
||||
*
|
||||
* @deprecated Use AV_CODEC_FLAG_COPY_OPAQUE instead
|
||||
*/
|
||||
attribute_deprecated
|
||||
int64_t reordered_opaque;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Hardware accelerator in use
|
||||
|
@ -169,9 +169,9 @@
|
||||
#define AV_CODEC_CAP_HYBRID (1 << 19)
|
||||
|
||||
/**
|
||||
* This codec takes the reordered_opaque field from input AVFrames
|
||||
* and returns it in the corresponding field in AVCodecContext after
|
||||
* encoding.
|
||||
* This encoder can reorder user opaque values from input AVFrames and return
|
||||
* them with corresponding output packets.
|
||||
* @see AV_CODEC_FLAG_COPY_OPAQUE
|
||||
*/
|
||||
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20)
|
||||
|
||||
|
@ -1357,7 +1357,11 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
|
||||
return ret;
|
||||
frame->pkt_size = (int)(intptr_t)pkt->opaque;
|
||||
}
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
frame->reordered_opaque = avctx->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED)
|
||||
frame->color_primaries = avctx->color_primaries;
|
||||
|
@ -193,7 +193,11 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||
int ff_encode_reordered_opaque(AVCodecContext *avctx,
|
||||
AVPacket *pkt, const AVFrame *frame)
|
||||
{
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->reordered_opaque = frame->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||
int ret = av_buffer_replace(&pkt->opaque_ref, frame->opaque_ref);
|
||||
|
@ -290,7 +290,9 @@ static void libdav1d_flush(AVCodecContext *c)
|
||||
|
||||
typedef struct OpaqueData {
|
||||
void *pkt_orig_opaque;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
int64_t reordered_opaque;
|
||||
#endif
|
||||
} OpaqueData;
|
||||
|
||||
static void libdav1d_data_free(const uint8_t *data, void *opaque) {
|
||||
@ -340,7 +342,11 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
|
||||
|
||||
pkt->buf = NULL;
|
||||
|
||||
if (c->reordered_opaque != AV_NOPTS_VALUE ||
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
c->reordered_opaque != AV_NOPTS_VALUE ||
|
||||
#endif
|
||||
(pkt->opaque && (c->flags & AV_CODEC_FLAG_COPY_OPAQUE))) {
|
||||
od = av_mallocz(sizeof(*od));
|
||||
if (!od) {
|
||||
@ -349,7 +355,10 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
od->pkt_orig_opaque = pkt->opaque;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
od->reordered_opaque = c->reordered_opaque;
|
||||
#endif
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
pkt->opaque = od;
|
||||
|
||||
@ -432,10 +441,14 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
|
||||
|
||||
pkt = (AVPacket *)p->m.user_data.data;
|
||||
od = pkt->opaque;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (od && od->reordered_opaque != AV_NOPTS_VALUE)
|
||||
frame->reordered_opaque = od->reordered_opaque;
|
||||
else
|
||||
frame->reordered_opaque = AV_NOPTS_VALUE;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
// restore the original user opaque value for
|
||||
// ff_decode_frame_props_from_pkt()
|
||||
|
@ -57,7 +57,9 @@ typedef struct librav1eContext {
|
||||
typedef struct FrameData {
|
||||
int64_t pts;
|
||||
int64_t duration;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
int64_t reordered_opaque;
|
||||
#endif
|
||||
|
||||
void *frame_opaque;
|
||||
AVBufferRef *frame_opaque_ref;
|
||||
@ -465,7 +467,11 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
|
||||
}
|
||||
fd->pts = frame->pts;
|
||||
fd->duration = frame->duration;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
fd->reordered_opaque = frame->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||
fd->frame_opaque = frame->opaque;
|
||||
@ -572,7 +578,11 @@ retry:
|
||||
fd = rpkt->opaque;
|
||||
pkt->pts = pkt->dts = fd->pts;
|
||||
pkt->duration = fd->duration;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->reordered_opaque = fd->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||
pkt->opaque = fd->frame_opaque;
|
||||
|
@ -39,7 +39,9 @@ typedef struct LibWebPAnimContext {
|
||||
int64_t first_frame_pts; // pts of the first encoded frame.
|
||||
int64_t end_pts; // pts + duration of the last frame
|
||||
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
int64_t reordered_opaque;
|
||||
#endif
|
||||
void *first_frame_opaque;
|
||||
AVBufferRef *first_frame_opaque_ref;
|
||||
|
||||
@ -90,7 +92,11 @@ static int libwebp_anim_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
if (pkt->pts != AV_NOPTS_VALUE && s->end_pts > pkt->pts)
|
||||
pkt->duration = s->end_pts - pkt->pts;
|
||||
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->reordered_opaque = s->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||
pkt->opaque = s->first_frame_opaque;
|
||||
pkt->opaque_ref = s->first_frame_opaque_ref;
|
||||
@ -128,7 +134,11 @@ static int libwebp_anim_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
|
||||
if (!avctx->frame_number) {
|
||||
s->first_frame_pts = frame->pts;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
s->reordered_opaque = frame->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||
s->first_frame_opaque = frame->opaque;
|
||||
|
@ -50,7 +50,9 @@
|
||||
#define MB_SIZE 16
|
||||
|
||||
typedef struct X264Opaque {
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
int64_t reordered_opaque;
|
||||
#endif
|
||||
int64_t wallclock;
|
||||
int64_t duration;
|
||||
|
||||
@ -459,7 +461,11 @@ static int setup_frame(AVCodecContext *ctx, const AVFrame *frame,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
opaque->reordered_opaque = frame->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
opaque->duration = frame->duration;
|
||||
opaque->wallclock = wallclock;
|
||||
if (ctx->export_side_data & AV_CODEC_EXPORT_DATA_PRFT)
|
||||
@ -612,7 +618,11 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
|
||||
out_opaque = pic_out.opaque;
|
||||
if (out_opaque >= x4->reordered_opaque &&
|
||||
out_opaque < &x4->reordered_opaque[x4->nb_reordered_opaque]) {
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
ctx->reordered_opaque = out_opaque->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
wallclock = out_opaque->wallclock;
|
||||
pkt->duration = out_opaque->duration;
|
||||
|
||||
@ -627,7 +637,11 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
|
||||
// Unexpected opaque pointer on picture output
|
||||
av_log(ctx, AV_LOG_ERROR, "Unexpected opaque pointer; "
|
||||
"this is a bug, please report it.\n");
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
ctx->reordered_opaque = 0;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (pic_out.i_type) {
|
||||
|
@ -42,7 +42,9 @@
|
||||
#include "sei.h"
|
||||
|
||||
typedef struct ReorderedData {
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
int64_t reordered_opaque;
|
||||
#endif
|
||||
int64_t duration;
|
||||
|
||||
void *frame_opaque;
|
||||
@ -618,7 +620,11 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
rd = &ctx->rd[rd_idx];
|
||||
|
||||
rd->duration = pic->duration;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
rd->reordered_opaque = pic->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||
rd->frame_opaque = pic->opaque;
|
||||
ret = av_buffer_replace(&rd->frame_opaque_ref, pic->opaque_ref);
|
||||
@ -756,7 +762,11 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
int idx = (int)(intptr_t)x265pic_out.userData - 1;
|
||||
ReorderedData *rd = &ctx->rd[idx];
|
||||
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->reordered_opaque = rd->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
pkt->duration = rd->duration;
|
||||
|
||||
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||
@ -766,8 +776,13 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
}
|
||||
|
||||
rd_release(ctx, idx);
|
||||
} else
|
||||
}
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
else
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->reordered_opaque = 0;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
*got_packet = 1;
|
||||
return 0;
|
||||
|
@ -166,7 +166,9 @@ static int nvenc_print_error(AVCodecContext *avctx, NVENCSTATUS err,
|
||||
typedef struct FrameData {
|
||||
int64_t pts;
|
||||
int64_t duration;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
int64_t reordered_opaque;
|
||||
#endif
|
||||
|
||||
void *frame_opaque;
|
||||
AVBufferRef *frame_opaque_ref;
|
||||
@ -2203,7 +2205,11 @@ static void reorder_queue_enqueue(AVFifo *queue, const AVCodecContext *avctx,
|
||||
|
||||
fd.pts = frame->pts;
|
||||
fd.duration = frame->duration;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
fd.reordered_opaque = frame->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
fd.frame_opaque = frame->opaque;
|
||||
fd.frame_opaque_ref = *opaque_ref;
|
||||
|
||||
@ -2222,7 +2228,11 @@ static int64_t reorder_queue_dequeue(AVFifo *queue, AVCodecContext *avctx,
|
||||
return AV_NOPTS_VALUE;
|
||||
|
||||
if (pkt) {
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->reordered_opaque = fd.reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
pkt->duration = fd.duration;
|
||||
|
||||
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||
|
@ -124,7 +124,11 @@ static int init_context_defaults(AVCodecContext *s, const AVCodec *codec)
|
||||
s->sw_pix_fmt = AV_PIX_FMT_NONE;
|
||||
s->sample_fmt = AV_SAMPLE_FMT_NONE;
|
||||
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
s->reordered_opaque = AV_NOPTS_VALUE;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
if(codec && codec2->priv_data_size){
|
||||
s->priv_data = av_mallocz(codec2->priv_data_size);
|
||||
if (!s->priv_data)
|
||||
|
@ -390,7 +390,11 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
|
||||
dst->skip_frame = src->skip_frame;
|
||||
|
||||
dst->frame_number = src->frame_number;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
dst->reordered_opaque = src->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
#if FF_API_THREAD_SAFE_CALLBACKS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
dst->thread_safe_callbacks = src->thread_safe_callbacks;
|
||||
|
@ -304,7 +304,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
dst->time_base = src->time_base;
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
dst->reordered_opaque = src->reordered_opaque;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
dst->quality = src->quality;
|
||||
dst->best_effort_timestamp = src->best_effort_timestamp;
|
||||
dst->coded_picture_number = src->coded_picture_number;
|
||||
|
@ -491,6 +491,7 @@ typedef struct AVFrame {
|
||||
*/
|
||||
int palette_has_changed;
|
||||
|
||||
#if FF_API_REORDERED_OPAQUE
|
||||
/**
|
||||
* reordered opaque 64 bits (generally an integer or a double precision float
|
||||
* PTS but can be anything).
|
||||
@ -498,8 +499,12 @@ typedef struct AVFrame {
|
||||
* that time,
|
||||
* the decoder reorders values as needed and sets AVFrame.reordered_opaque
|
||||
* to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
|
||||
*
|
||||
* @deprecated Use AV_CODEC_FLAG_COPY_OPAQUE instead
|
||||
*/
|
||||
attribute_deprecated
|
||||
int64_t reordered_opaque;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Sample rate of the audio data.
|
||||
|
@ -115,6 +115,7 @@
|
||||
#define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 58)
|
||||
#define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 58)
|
||||
#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 58)
|
||||
#define FF_API_REORDERED_OPAQUE (LIBAVUTIL_VERSION_MAJOR < 59)
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
Loading…
x
Reference in New Issue
Block a user