From: Marton Balint <cus@passwd.hu> To: ffmpeg-devel@ffmpeg.org Cc: Marton Balint <cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 4/4] avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number Date: Sat, 28 Jan 2023 19:15:23 +0100 Message-ID: <20230128181523.9837-4-cus@passwd.hu> (raw) In-Reply-To: <20230128181523.9837-1-cus@passwd.hu> Their usefulness are questionable, very few decoders set them, and their type should have been int64_t. A replacement field can be added later if a valid use case is found. Signed-off-by: Marton Balint <cus@passwd.hu> --- doc/APIchanges | 4 ++++ doc/examples/demuxing_decoding.c | 4 ++-- fftools/ffprobe.c | 4 ++++ libavcodec/diracdec.c | 12 ++++++++++++ libavcodec/h264_slice.c | 4 ++++ libavcodec/libuavs3d.c | 4 ++++ libavcodec/mpegvideo_dec.c | 4 ++++ libavutil/frame.c | 4 ++++ libavutil/frame.h | 4 ++++ libavutil/version.h | 3 ++- 10 files changed, 44 insertions(+), 3 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 2de7174556..191071b0ce 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,10 @@ libavutil: 2021-04-27 API changes, most recent first: +2023-xx-xx - xxxxxxxxxx - lavu 57.45.100 - frame.h + Deprecated AVFrame.coded_picture_number and display_picture_number. + Their usefulness are questionable and very few decoders set them. + 2023-xx-xx - xxxxxxxxxx - lavc 59.59.100 - avcodec.h Add AVCodecContext.frame_num as a 64bit version of frame_number. Deprecate AVCodecContext.frame_number. diff --git a/doc/examples/demuxing_decoding.c b/doc/examples/demuxing_decoding.c index 999a78db0d..54a82751e5 100644 --- a/doc/examples/demuxing_decoding.c +++ b/doc/examples/demuxing_decoding.c @@ -73,8 +73,8 @@ static int output_video_frame(AVFrame *frame) return -1; } - printf("video_frame n:%d coded_n:%d\n", - video_frame_count++, frame->coded_picture_number); + printf("video_frame n:%d\n", + video_frame_count++); /* copy decoded frame to destination buffer: * this is required since rawvideo expects non aligned data */ diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index dfa7ff1b24..d6740ae400 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2617,8 +2617,12 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, print_str_opt("sample_aspect_ratio", "N/A"); } print_fmt("pict_type", "%c", av_get_picture_type_char(frame->pict_type)); +#if LIBAVUTIL_VERSION_MAJOR < 59 + AV_NOWARN_DEPRECATED( print_int("coded_picture_number", frame->coded_picture_number); print_int("display_picture_number", frame->display_picture_number); + ) +#endif print_int("interlaced_frame", frame->interlaced_frame); print_int("top_field_first", frame->top_field_first); print_int("repeat_pict", frame->repeat_pict); diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 22a2925188..0ae582befe 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -2103,7 +2103,11 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame) out->reference ^= DELAYED_PIC_REF; if((ret = av_frame_ref(picture, out->avframe)) < 0) return ret; +#if FF_API_FRAME_PICTURE_NUMBER +FF_DISABLE_DEPRECATION_WARNINGS picture->display_picture_number = out->picture_number; +FF_ENABLE_DEPRECATION_WARNINGS +#endif *got_frame = 1; } @@ -2343,7 +2347,11 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture, if((ret = av_frame_ref(picture, delayed_frame->avframe)) < 0) return ret; s->frame_number = delayed_frame->picture_number + 1LL; +#if FF_API_FRAME_PICTURE_NUMBER +FF_DISABLE_DEPRECATION_WARNINGS picture->display_picture_number = delayed_frame->picture_number; +FF_ENABLE_DEPRECATION_WARNINGS +#endif *got_frame = 1; } } else if (s->current_picture->picture_number == s->frame_number) { @@ -2351,7 +2359,11 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture, if((ret = av_frame_ref(picture, s->current_picture->avframe)) < 0) return ret; s->frame_number = s->current_picture->picture_number + 1LL; +#if FF_API_FRAME_PICTURE_NUMBER +FF_DISABLE_DEPRECATION_WARNINGS picture->display_picture_number = s->current_picture->picture_number; +FF_ENABLE_DEPRECATION_WARNINGS +#endif *got_frame = 1; } diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 97e66a2907..7767e16cf1 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -489,7 +489,11 @@ static int h264_frame_start(H264Context *h) pic = &h->DPB[i]; pic->reference = h->droppable ? 0 : h->picture_structure; +#if FF_API_FRAME_PICTURE_NUMBER +FF_DISABLE_DEPRECATION_WARNINGS pic->f->coded_picture_number = h->coded_picture_number++; +FF_ENABLE_DEPRECATION_WARNINGS +#endif pic->field_picture = h->picture_structure != PICT_FRAME; pic->frame_num = h->poc.frame_num; /* diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c index f5a6e59496..b1ccb151e6 100644 --- a/libavcodec/libuavs3d.c +++ b/libavcodec/libuavs3d.c @@ -81,8 +81,12 @@ static void uavs3d_output_callback(uavs3d_io_frm_t *dec_frame) { frm->pkt_dts = dec_frame->dts; frm->pkt_pos = dec_frame->pkt_pos; frm->pkt_size = dec_frame->pkt_size; +#if FF_API_FRAME_PICTURE_NUMBER +FF_DISABLE_DEPRECATION_WARNINGS frm->coded_picture_number = dec_frame->dtr; frm->display_picture_number = dec_frame->ptr; +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (dec_frame->type < 0 || dec_frame->type >= FF_ARRAY_ELEMS(ff_avs3_image_type)) { av_log(NULL, AV_LOG_WARNING, "Error frame type in uavs3d: %d.\n", dec_frame->type); diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 12c7144ffb..7008a600a7 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -320,7 +320,11 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) pic->reference = 3; } +#if FF_API_FRAME_PICTURE_NUMBER +FF_DISABLE_DEPRECATION_WARNINGS pic->f->coded_picture_number = s->coded_picture_number++; +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (alloc_picture(s, pic) < 0) return -1; diff --git a/libavutil/frame.c b/libavutil/frame.c index fa9b11aa54..25f1f76bbc 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -307,8 +307,12 @@ FF_ENABLE_DEPRECATION_WARNINGS dst->reordered_opaque = src->reordered_opaque; dst->quality = src->quality; dst->best_effort_timestamp = src->best_effort_timestamp; +#if FF_API_FRAME_PICTURE_NUMBER +FF_DISABLE_DEPRECATION_WARNINGS dst->coded_picture_number = src->coded_picture_number; dst->display_picture_number = src->display_picture_number; +FF_ENABLE_DEPRECATION_WARNINGS +#endif dst->flags = src->flags; dst->decode_error_flags = src->decode_error_flags; dst->color_primaries = src->color_primaries; diff --git a/libavutil/frame.h b/libavutil/frame.h index bbe909ee2d..ca7fd680ac 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -451,14 +451,18 @@ typedef struct AVFrame { */ AVRational time_base; +#if FF_API_FRAME_PICTURE_NUMBER /** * picture number in bitstream order */ + attribute_deprecated int coded_picture_number; /** * picture number in display order */ + attribute_deprecated int display_picture_number; +#endif /** * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) diff --git a/libavutil/version.h b/libavutil/version.h index 60f96af5df..2ae4ce5683 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 44 +#define LIBAVUTIL_VERSION_MINOR 45 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -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_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59) /** * @} -- 2.35.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-01-28 18:16 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-28 18:15 [FFmpeg-devel] [PATCH 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Marton Balint 2023-01-28 18:15 ` [FFmpeg-devel] [PATCH 2/4] avcodec/diracdec: do not use AVFrame.display_picture_number for decoding Marton Balint 2023-01-28 18:15 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mpegvideo_enc: do not use AVFrame.*_picture_number for encoding Marton Balint 2023-01-28 18:15 ` Marton Balint [this message] 2023-02-10 23:29 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Marton Balint 2023-02-10 23:29 ` [FFmpeg-devel] [PATCH v2 2/4] avcodec/diracdec: do not use AVFrame.display_picture_number for decoding Marton Balint 2023-02-10 23:29 ` [FFmpeg-devel] [PATCH v2 3/4] avcodec/mpegvideo_enc: do not use AVFrame.*_picture_number for encoding Marton Balint 2023-02-10 23:29 ` [FFmpeg-devel] [PATCH v2 4/4] avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number Marton Balint 2023-02-10 23:38 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Marton Balint
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230128181523.9837-4-cus@passwd.hu \ --to=cus@passwd.hu \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git