From patchwork Fri Feb 10 23:29:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 40363 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp1772847pzk; Fri, 10 Feb 2023 15:30:41 -0800 (PST) X-Google-Smtp-Source: AK7set8HvecH1KpmPbEYNMZhl/JIkvUK4cFNCYs5gUeZofOwUXDN8yC//QABwueXUBCJGP98isgx X-Received: by 2002:a17:906:757:b0:88f:7d3b:b90 with SMTP id z23-20020a170906075700b0088f7d3b0b90mr15277239ejb.42.1676071841622; Fri, 10 Feb 2023 15:30:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676071841; cv=none; d=google.com; s=arc-20160816; b=KkqcxDLlpG5gC3tkfPm9W1FqnBnRZBSOrWRR9oDtJs/2xrvUPn9yjaUhvc0U6Ty85z P8kx7Y5d/fL+J8FAQy9UxDs5MIjfVTgTcbt0ydlzGOMH7j2VOrH06U3QGTFxHdX1vaMf AWqs5ZcO9xxT8m461IpIrnXl2UmMAFOuGEmH6PcCl4W3GpYg6QwsewDZCyjanpJQJ04Y 1p7SBfbedoIakrAWz/uMmYD0NhhOkFpJmI8JJ6IuhDPxW9mnh683xyN+WRDGalGQaM2/ PxUeE2N9WZrmD1lh2w/Z2fTvDF5dG3/852K92DGEO+DmzJzm6FFgNwHkFt600SBcGXJ6 IvRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=T42x2IgFRyHZPYoj4hdJN963sPt8trhKK8qbsSUPFmc=; b=s1hz9MHsFx5+eTvglL5Ir9HkcMy9bEEMRkyZjdBCy3nwbInVMRnWm29CUmAkf+x/WO MbDRVZMoGcTNxnY4dC51mM+Wz085RagkPJwDXCLjKFNoQAwgJEAnrVr2EGlwHXg61Giu mFkzJMa6FLQcO4LXzxfvwvw4lPmfD7MEoUEXIv5wERI1JFQuT24daGpK0btK/x3PAkGD kOcOIqmNCtS/vzGEvLcGbIhCqx8V+kOYfL5KA9tabvx9gRjTPRjANwgMJXa2E62gm7Ud HC51S778fKzyHBNuaHsfLIqrkE3qhjGOuYW82+dGdcQpqFFBfodpnS3xSs1XozU2ZMjH A09A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y3-20020a170906518300b0086f3e470d23si8651671ejk.723.2023.02.10.15.30.41; Fri, 10 Feb 2023 15:30:41 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 48CA568BD6B; Sat, 11 Feb 2023 01:30:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ECD6868BD12 for ; Sat, 11 Feb 2023 01:30:04 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id D290BE87A4; Sat, 11 Feb 2023 00:30:03 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w2tVVOqq2rGo; Sat, 11 Feb 2023 00:30:01 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id E74B9E87A3; Sat, 11 Feb 2023 00:29:58 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 Feb 2023 00:29:13 +0100 Message-Id: <20230210232913.8763-4-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230210232913.8763-1-cus@passwd.hu> References: <20230128181523.9837-1-cus@passwd.hu> <20230210232913.8763-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/4] avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ujjNVp8n332/ Their usefulness is 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 --- 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 efaafbf864..9f37c870f1 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-xx-xx - xxxxxxxxxx - lavu 58.1.100 - frame.h + Deprecate AVFrame.coded_picture_number and display_picture_number. + Their usefulness are questionable and very few decoders set them. + 2023-02-xx - xxxxxxxxxx - lavc 60.1.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 f5ac5c1554..af927cb084 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2618,8 +2618,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 7a0c51e53d..522a0aada5 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 4d89c75dc8..9545477acc 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -294,8 +294,12 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif 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 e5c92a0ca8..2580269549 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 3ad38110c1..11b4387f64 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 58 -#define LIBAVUTIL_VERSION_MINOR 0 +#define LIBAVUTIL_VERSION_MINOR 1 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -112,6 +112,7 @@ #define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 59) #define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 59) #define FF_API_REORDERED_OPAQUE (LIBAVUTIL_VERSION_MAJOR < 59) +#define FF_API_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59) /** * @}