From patchwork Thu May 28 20:15:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19942 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id DB21944A30B for ; Thu, 28 May 2020 23:16:34 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BC73868ACD3; Thu, 28 May 2020 23:16:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8CF8468AD79 for ; Thu, 28 May 2020 23:16:25 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 103B228A6F1 for ; Thu, 28 May 2020 22:16:25 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 46CDnIndy_qc for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 8FA6728A6E0 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 2623D22F32 for ; Thu, 28 May 2020 22:16:17 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id pOpX8J0_o0Pq for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 7BDE420279 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 39EFA20E00E7; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:43 +0200 Message-Id: <20200528201559.22618-1-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/17] Remove unnecessary use of avcodec_close(). X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Replace it with avcodec_free_context() or drop it completely as appropriate. --- libavcodec/avrndec.c | 3 +-- libavcodec/smvjpegdec.c | 3 +-- libavcodec/tests/options.c | 1 - libavfilter/vf_subtitles.c | 1 - libavfilter/vf_uspp.c | 6 ++---- tests/api/api-band-test.c | 1 - tests/api/api-flac-test.c | 18 ++---------------- tests/api/api-h264-test.c | 1 - tests/api/api-seek-test.c | 1 - 9 files changed, 6 insertions(+), 29 deletions(-) diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c index 104ff2d904..a7bdab280d 100644 --- a/libavcodec/avrndec.c +++ b/libavcodec/avrndec.c @@ -91,8 +91,7 @@ static av_cold int end(AVCodecContext *avctx) { AVRnContext *a = avctx->priv_data; - avcodec_close(a->mjpeg_avctx); - av_freep(&a->mjpeg_avctx); + avcodec_free_context(&a->mjpeg_avctx); return 0; } diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c index 7ea82ebfee..209f3ff334 100644 --- a/libavcodec/smvjpegdec.c +++ b/libavcodec/smvjpegdec.c @@ -84,8 +84,7 @@ static av_cold int smvjpeg_decode_end(AVCodecContext *avctx) jpg->picture_ptr = NULL; av_frame_free(&s->picture[0]); av_frame_free(&s->picture[1]); - ret = avcodec_close(s->avctx); - av_freep(&s->avctx); + avcodec_free_context(&s->avctx); return ret; } diff --git a/libavcodec/tests/options.c b/libavcodec/tests/options.c index 2e19a6eac2..010e3c0145 100644 --- a/libavcodec/tests/options.c +++ b/libavcodec/tests/options.c @@ -167,7 +167,6 @@ static void test_copy(const AVCodec *c1, const AVCodec *c2) avcodec_copy_context(ctx2, ctx1); test_copy_print_codec(ctx1); test_copy_print_codec(ctx2); - avcodec_close(ctx1); } avcodec_free_context(&ctx1); avcodec_free_context(&ctx2); diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index a3b4029af4..1bd42391e0 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -478,7 +478,6 @@ static av_cold int init_subtitles(AVFilterContext *ctx) end: av_dict_free(&codec_opts); - avcodec_close(dec_ctx); avcodec_free_context(&dec_ctx); avformat_close_input(&fmt); return ret; diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c index da4029f4b2..f6fb193433 100644 --- a/libavfilter/vf_uspp.c +++ b/libavfilter/vf_uspp.c @@ -468,10 +468,8 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&uspp->src[i]); } - for (i = 0; i < (1 << uspp->log2_count); i++) { - avcodec_close(uspp->avctx_enc[i]); - av_freep(&uspp->avctx_enc[i]); - } + for (i = 0; i < (1 << uspp->log2_count); i++) + avcodec_free_context(&uspp->avctx_enc[i]); av_freep(&uspp->non_b_qp_table); av_freep(&uspp->outbuf); diff --git a/tests/api/api-band-test.c b/tests/api/api-band-test.c index a84f6b7e55..257e741694 100644 --- a/tests/api/api-band-test.c +++ b/tests/api/api-band-test.c @@ -198,7 +198,6 @@ static int video_decode(const char *input_filename) av_packet_unref(&pkt); av_frame_free(&fr); - avcodec_close(ctx); avformat_close_input(&fmt_ctx); avcodec_free_context(&ctx); av_freep(&byte_buffer); diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c index ae6a9316d8..3fea3258f3 100644 --- a/tests/api/api-flac-test.c +++ b/tests/api/api-flac-test.c @@ -223,20 +223,6 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx, return 0; } -static int close_encoder(AVCodecContext **enc_ctx) -{ - avcodec_close(*enc_ctx); - av_freep(enc_ctx); - return 0; -} - -static int close_decoder(AVCodecContext **dec_ctx) -{ - avcodec_close(*dec_ctx); - av_freep(dec_ctx); - return 0; -} - int main(void) { AVCodec *enc = NULL, *dec = NULL; @@ -265,8 +251,8 @@ int main(void) return 1; if (run_test(enc, dec, enc_ctx, dec_ctx) != 0) return 1; - close_encoder(&enc_ctx); - close_decoder(&dec_ctx); + avcodec_free_context(&enc_ctx); + avcodec_free_context(&dec_ctx); } } diff --git a/tests/api/api-h264-test.c b/tests/api/api-h264-test.c index 60a3ae5ef4..678a1ea166 100644 --- a/tests/api/api-h264-test.c +++ b/tests/api/api-h264-test.c @@ -144,7 +144,6 @@ static int video_decode_example(const char *input_filename) av_packet_unref(&pkt); av_frame_free(&fr); - avcodec_close(ctx); avformat_close_input(&fmt_ctx); avcodec_free_context(&ctx); av_freep(&byte_buffer); diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c index d0531a2f73..ae33581244 100644 --- a/tests/api/api-seek-test.c +++ b/tests/api/api-seek-test.c @@ -266,7 +266,6 @@ end: av_freep(&crc_array); av_freep(&pts_array); av_frame_free(&fr); - avcodec_close(ctx); avformat_close_input(&fmt_ctx); avcodec_free_context(&ctx); return result; From patchwork Thu May 28 20:15:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19953 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 43CD244A30B for ; Thu, 28 May 2020 23:16:44 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3004668B075; Thu, 28 May 2020 23:16:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 827F868AF22 for ; Thu, 28 May 2020 23:16:29 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id E615F28A6C6 for ; Thu, 28 May 2020 22:16:27 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id I9I3zM7gbYTN for ; Thu, 28 May 2020 22:16:24 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 931E828A6E4 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 2B19922F35 for ; Thu, 28 May 2020 22:16:17 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id BgIjfqpZAuDv for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 7E38222DCD for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 8A8D920E00E8; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:44 +0200 Message-Id: <20200528201559.22618-2-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/17] avdevice: deprecate av_*_device_next() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" These functions rely on deprecated libavformat APIs and apparently have zero users outside of cmdutils. Since the functionality they provide is apparently not useful to anyone, deprecate them without replacement. --- doc/APIchanges | 4 ++++ fftools/cmdutils.c | 2 +- fftools/cmdutils.h | 4 ++-- libavdevice/avdevice.c | 4 ++++ libavdevice/avdevice.h | 6 ++++++ 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index fb5534b5f5..f5b2a7b964 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2017-10-21 API changes, most recent first: +2020-xx-xx - avdevice.h + Deprecate av_input_video_device_next, av_output_video_device_next, + av_input_audio_device_next, av_output_audio_device_next + 2020-xx-xx - xxxxxxxxxx - lavc 58.88.100 - avcodec.h codec.h Move AVCodec-related public API to new header codec.h. diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index dec18850d8..a948d478d5 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -2216,7 +2216,7 @@ double get_rotation(AVStream *st) return theta; } -#if CONFIG_AVDEVICE +#if CONFIG_AVDEVICE && FF_API_NEXT static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts) { int ret, i; diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h index 1917510589..ae5208f1aa 100644 --- a/fftools/cmdutils.h +++ b/fftools/cmdutils.h @@ -201,7 +201,7 @@ typedef struct OptionDef { void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags); -#if CONFIG_AVDEVICE +#if CONFIG_AVDEVICE && FF_API_NEXT #define CMDUTILS_COMMON_OPTIONS_AVDEVICE \ { "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \ "list sources of the input device", "device" }, \ @@ -498,7 +498,7 @@ int show_demuxers(void *optctx, const char *opt, const char *arg); */ int show_devices(void *optctx, const char *opt, const char *arg); -#if CONFIG_AVDEVICE +#if CONFIG_AVDEVICE && FF_API_NEXT /** * Print a listing containing autodetected sinks of the output device. * Device name with options may be passed as an argument to limit results. diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 3d03d89f04..e45cc06153 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -78,6 +78,8 @@ const char * avdevice_license(void) return &LICENSE_PREFIX FFMPEG_LICENSE[sizeof(LICENSE_PREFIX) - 1]; } +#if FF_API_NEXT +FF_DISABLE_DEPRECATION_WARNINGS static void *device_next(void *prev, int output, AVClassCategory c1, AVClassCategory c2) { @@ -99,6 +101,7 @@ static void *device_next(void *prev, int output, } while (category != c1 && category != c2); return prev; } +FF_ENABLE_DEPRECATION_WARNINGS AVInputFormat *av_input_audio_device_next(AVInputFormat *d) { @@ -123,6 +126,7 @@ AVOutputFormat *av_output_video_device_next(AVOutputFormat *d) return device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, AV_CLASS_CATEGORY_DEVICE_OUTPUT); } +#endif int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToDevMessageType type, void *data, size_t data_size) diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index ee9462480e..c63f661fc7 100644 --- a/libavdevice/avdevice.h +++ b/libavdevice/avdevice.h @@ -70,6 +70,7 @@ const char *avdevice_license(void); */ void avdevice_register_all(void); +#if FF_API_NEXT /** * Audio input devices iterator. * @@ -77,6 +78,7 @@ void avdevice_register_all(void); * if d is non-NULL, returns the next registered input audio/video device after d * or NULL if d is the last one. */ +attribute_deprecated AVInputFormat *av_input_audio_device_next(AVInputFormat *d); /** @@ -86,6 +88,7 @@ AVInputFormat *av_input_audio_device_next(AVInputFormat *d); * if d is non-NULL, returns the next registered input audio/video device after d * or NULL if d is the last one. */ +attribute_deprecated AVInputFormat *av_input_video_device_next(AVInputFormat *d); /** @@ -95,6 +98,7 @@ AVInputFormat *av_input_video_device_next(AVInputFormat *d); * if d is non-NULL, returns the next registered output audio/video device after d * or NULL if d is the last one. */ +attribute_deprecated AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d); /** @@ -104,7 +108,9 @@ AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d); * if d is non-NULL, returns the next registered output audio/video device after d * or NULL if d is the last one. */ +attribute_deprecated AVOutputFormat *av_output_video_device_next(AVOutputFormat *d); +#endif typedef struct AVDeviceRect { int x; /**< x coordinate of top left corner */ From patchwork Thu May 28 20:15:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19940 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EA48944A30B for ; Thu, 28 May 2020 23:16:30 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D55E368AD79; Thu, 28 May 2020 23:16:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ED28568AAD8 for ; Thu, 28 May 2020 23:16:23 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 83AAE28A6E6 for ; Thu, 28 May 2020 22:16:23 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id JaTmT35vTBTc for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 91D9B28A6E3 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 2292C20279 for ; Thu, 28 May 2020 22:16:18 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Jq264ngeEPmX for ; Thu, 28 May 2020 22:16:17 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 80B2622DD1 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id C155E20E00E9; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:45 +0200 Message-Id: <20200528201559.22618-3-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/17] lavf/dump: schedule use of deprecated API for removal X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/dump.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libavformat/dump.c b/libavformat/dump.c index 06bafc272d..117c68145c 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -500,6 +500,8 @@ static void dump_stream_format(AVFormatContext *ic, int i, return; } +#if FF_API_LAVF_AVCTX +FF_DISABLE_DEPRECATION_WARNINGS // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext avctx->properties = st->codec->properties; avctx->codec = st->codec->codec; @@ -507,6 +509,8 @@ static void dump_stream_format(AVFormatContext *ic, int i, avctx->qmax = st->codec->qmax; avctx->coded_width = st->codec->coded_width; avctx->coded_height = st->codec->coded_height; +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (separator) av_opt_set(avctx, "dump_separator", separator, 0); @@ -541,7 +545,13 @@ static void dump_stream_format(AVFormatContext *ic, int i, int fps = st->avg_frame_rate.den && st->avg_frame_rate.num; int tbr = st->r_frame_rate.den && st->r_frame_rate.num; int tbn = st->time_base.den && st->time_base.num; +#if FF_API_LAVF_AVCTX +FF_DISABLE_DEPRECATION_WARNINGS int tbc = st->codec->time_base.den && st->codec->time_base.num; +FF_ENABLE_DEPRECATION_WARNINGS +#else + int tbc = 0; +#endif if (fps || tbr || tbn || tbc) av_log(NULL, AV_LOG_INFO, "%s", separator); @@ -552,8 +562,12 @@ static void dump_stream_format(AVFormatContext *ic, int i, print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr"); if (tbn) print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn"); +#if FF_API_LAVF_AVCTX +FF_DISABLE_DEPRECATION_WARNINGS if (tbc) print_fps(1 / av_q2d(st->codec->time_base), "tbc"); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } if (st->disposition & AV_DISPOSITION_DEFAULT) From patchwork Thu May 28 20:15:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19951 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 84A2544A30B for ; Thu, 28 May 2020 23:16:42 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6C8D068B029; Thu, 28 May 2020 23:16:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 30BB368ABE7 for ; Thu, 28 May 2020 23:16:29 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 369A828A6ED for ; Thu, 28 May 2020 22:16:26 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id hyKIyWHpaSN5 for ; Thu, 28 May 2020 22:16:25 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id EED6D28A6E9 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 3A25222E06 for ; Thu, 28 May 2020 22:16:20 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id SDl6FZU1bcJc for ; Thu, 28 May 2020 22:16:18 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 864E122DED for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 6669820E0040; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:46 +0200 Message-Id: <20200528201559.22618-4-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 04/17] lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next bump X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" They are not properly namespaced and not intended for public use. --- libavutil/mem.h | 6 ++++ libavutil/mem_internal.h | 70 ++++++++++++++++++++++++++++++++++++++++ libavutil/version.h | 4 ++- 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/libavutil/mem.h b/libavutil/mem.h index 5fb1a02dd9..e21a1feaae 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -33,6 +33,7 @@ #include "attributes.h" #include "error.h" #include "avutil.h" +#include "version.h" /** * @addtogroup lavu_mem @@ -49,6 +50,10 @@ * dealing with memory consistently possible on all platforms. * * @{ + */ + +#if FF_API_DECLARE_ALIGNED +/** * * @defgroup lavu_mem_macros Alignment Macros * Helper macros for declaring aligned variables. @@ -125,6 +130,7 @@ /** * @} */ +#endif /** * @defgroup lavu_mem_attrs Function Attributes diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h index 6fdbcb016e..c25c28ed1a 100644 --- a/libavutil/mem_internal.h +++ b/libavutil/mem_internal.h @@ -23,6 +23,76 @@ #include "avassert.h" #include "mem.h" +#include "version.h" + +#if !FF_API_DECLARE_ALIGNED +/** + * @def DECLARE_ALIGNED(n,t,v) + * Declare a variable that is aligned in memory. + * + * @code{.c} + * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42; + * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128]; + * + * // The default-alignment equivalent would be + * uint16_t aligned_int = 42; + * uint8_t aligned_array[128]; + * @endcode + * + * @param n Minimum alignment in bytes + * @param t Type of the variable (or array element) + * @param v Name of the variable + */ + +/** + * @def DECLARE_ASM_ALIGNED(n,t,v) + * Declare an aligned variable appropriate for use in inline assembly code. + * + * @code{.c} + * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008); + * @endcode + * + * @param n Minimum alignment in bytes + * @param t Type of the variable (or array element) + * @param v Name of the variable + */ + +/** + * @def DECLARE_ASM_CONST(n,t,v) + * Declare a static constant aligned variable appropriate for use in inline + * assembly code. + * + * @code{.c} + * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008); + * @endcode + * + * @param n Minimum alignment in bytes + * @param t Type of the variable (or array element) + * @param v Name of the variable + */ + +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v +#elif defined(__DJGPP__) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v +#elif defined(__GNUC__) || defined(__clang__) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v +#elif defined(_MSC_VER) + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v + #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v +#else + #define DECLARE_ALIGNED(n,t,v) t v + #define DECLARE_ASM_ALIGNED(n,t,v) t v + #define DECLARE_ASM_CONST(n,t,v) static const t v +#endif +#endif static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc) { diff --git a/libavutil/version.h b/libavutil/version.h index 7acecf5a97..f8cd0b5f8a 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -129,7 +129,9 @@ #ifndef FF_API_PSEUDOPAL #define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57) #endif - +#ifndef FF_API_DECLARE_ALIGNED +#define FF_API_DECLARE_ALIGNED (LIBAVUTIL_VERSION_MAJOR < 57) +#endif /** * @} From patchwork Thu May 28 20:15:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19941 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D5F5644A30B for ; Thu, 28 May 2020 23:16:31 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C981D68AE4C; Thu, 28 May 2020 23:16:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DE25568ACD3 for ; Thu, 28 May 2020 23:16:24 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 6784828A6E3 for ; Thu, 28 May 2020 22:16:24 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id OYTeLlNKvvyn for ; Thu, 28 May 2020 22:16:23 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 8E21728A6C6 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id F158F22DD1 for ; Thu, 28 May 2020 22:16:18 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id zLbU4vzL_w0e for ; Thu, 28 May 2020 22:16:17 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 83F6322DE3 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id AB12820E0099; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:47 +0200 Message-Id: <20200528201559.22618-5-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/17] lavu/opt: add a more general child class iteration API X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Use opaque iteration state instead of the previous child class. This mirrors similar changes done in lavf/lavc. Deprecate the av_opt_child_class_next() API. --- libavutil/log.h | 13 +++++++++++++ libavutil/opt.c | 24 ++++++++++++++++++++++-- libavutil/opt.h | 31 +++++++++++++++++++++++-------- libavutil/version.h | 3 +++ 4 files changed, 61 insertions(+), 10 deletions(-) diff --git a/libavutil/log.h b/libavutil/log.h index 9c14188a9c..4a7fdca8c2 100644 --- a/libavutil/log.h +++ b/libavutil/log.h @@ -112,6 +112,7 @@ typedef struct AVClass { */ void* (*child_next)(void *obj, void *prev); +#if FF_API_CHILD_CLASS_NEXT /** * Return an AVClass corresponding to the next potential * AVOptions-enabled child. @@ -120,7 +121,9 @@ typedef struct AVClass { * child_next iterates over _already existing_ objects, while * child_class_next iterates over _all possible_ children. */ + attribute_deprecated const struct AVClass* (*child_class_next)(const struct AVClass *prev); +#endif /** * Category used for visualization (like color) @@ -140,6 +143,16 @@ typedef struct AVClass { * available since version (52.12) */ int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); + + /** + * Return an AVClass corresponding to the next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + */ + const struct AVClass* (*child_class_iterate)(void **iter); } AVClass; /** diff --git a/libavutil/opt.c b/libavutil/opt.c index 423313bce2..2c3f998d97 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1679,8 +1679,9 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, if (search_flags & AV_OPT_SEARCH_CHILDREN) { if (search_flags & AV_OPT_SEARCH_FAKE_OBJ) { - const AVClass *child = NULL; - while (child = av_opt_child_class_next(c, child)) + void *iter = NULL; + const AVClass *child; + while (child = av_opt_child_class_iterate(c, &iter)) if (o = av_opt_find2(&child, name, unit, opt_flags, search_flags, NULL)) return o; } else { @@ -1715,12 +1716,31 @@ void *av_opt_child_next(void *obj, void *prev) return NULL; } +#if FF_API_CHILD_CLASS_NEXT +FF_DISABLE_DEPRECATION_WARNINGS const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev) { if (parent->child_class_next) return parent->child_class_next(prev); return NULL; } +FF_ENABLE_DEPRECATION_WARNINGS +#endif + +const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter) +{ + if (parent->child_class_iterate) + return parent->child_class_iterate(iter); +#if FF_API_CHILD_CLASS_NEXT +FF_DISABLE_DEPRECATION_WARNINGS + if (parent->child_class_next) { + *iter = parent->child_class_next(*iter); + return *iter; + } +FF_ENABLE_DEPRECATION_WARNINGS +#endif + return NULL; +} void *av_opt_ptr(const AVClass *class, void *obj, const char *name) { diff --git a/libavutil/opt.h b/libavutil/opt.h index e46119572a..8dc020a820 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -114,7 +114,7 @@ * libavcodec exports generic options, while its priv_data field exports * codec-specific options). In such a case, it is possible to set up the * parent struct to export a child's options. To do that, simply - * implement AVClass.child_next() and AVClass.child_class_next() in the + * implement AVClass.child_next() and AVClass.child_class_iterate() in the * parent struct's AVClass. * Assuming that the test_struct from above now also contains a * child_struct field: @@ -143,23 +143,25 @@ * return t->child_struct; * return NULL * } - * const AVClass child_class_next(const AVClass *prev) + * const AVClass child_class_iterate(void **iter) * { - * return prev ? NULL : &child_class; + * const AVClass *c = *iter ? NULL : &child_class; + * *iter = (void*)(uintptr_t)c; + * return c; * } * @endcode - * Putting child_next() and child_class_next() as defined above into + * Putting child_next() and child_class_iterate() as defined above into * test_class will now make child_struct's options accessible through * test_struct (again, proper setup as described above needs to be done on * child_struct right after it is created). * * From the above example it might not be clear why both child_next() - * and child_class_next() are needed. The distinction is that child_next() - * iterates over actually existing objects, while child_class_next() + * and child_class_iterate() are needed. The distinction is that child_next() + * iterates over actually existing objects, while child_class_iterate() * iterates over all possible child classes. E.g. if an AVCodecContext * was initialized to use a codec which has private options, then its * child_next() will return AVCodecContext.priv_data and finish - * iterating. OTOH child_class_next() on AVCodecContext.av_class will + * iterating. OTOH child_class_iterate() on AVCodecContext.av_class will * iterate over all available codecs with private options. * * @subsection avoptions_implement_named_constants Named constants @@ -194,7 +196,7 @@ * For enumerating there are basically two cases. The first is when you want to * get all options that may potentially exist on the struct and its children * (e.g. when constructing documentation). In that case you should call - * av_opt_child_class_next() recursively on the parent struct's AVClass. The + * av_opt_child_class_iterate() recursively on the parent struct's AVClass. The * second case is when you have an already initialized struct with all its * children and you want to get all options that can be actually written or read * from it. In that case you should call av_opt_child_next() recursively (and @@ -646,13 +648,26 @@ const AVOption *av_opt_next(const void *obj, const AVOption *prev); */ void *av_opt_child_next(void *obj, void *prev); +#if FF_API_CHILD_CLASS_NEXT /** * Iterate over potential AVOptions-enabled children of parent. * * @param prev result of a previous call to this function or NULL * @return AVClass corresponding to next potential child or NULL + * + * @deprecated use av_opt_child_class_iterate */ +attribute_deprecated const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); +#endif + +/** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param iter a pointer where iteration state is stored. + * @return AVClass corresponding to next potential child or NULL + */ +const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter); /** * @defgroup opt_set_funcs Option setting functions diff --git a/libavutil/version.h b/libavutil/version.h index f8cd0b5f8a..b805455d06 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -132,6 +132,9 @@ #ifndef FF_API_DECLARE_ALIGNED #define FF_API_DECLARE_ALIGNED (LIBAVUTIL_VERSION_MAJOR < 57) #endif +#ifndef FF_API_CHILD_CLASS_NEXT +#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57) +#endif /** * @} From patchwork Thu May 28 20:15:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19943 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 1BC4244A30B for ; Thu, 28 May 2020 23:16:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ECFEE68AF70; Thu, 28 May 2020 23:16:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2668B68AE2D for ; Thu, 28 May 2020 23:16:26 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 8DD9528A6E0 for ; Thu, 28 May 2020 22:16:25 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 1T0V76ED3KT0 for ; Thu, 28 May 2020 22:16:25 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 019CA28A6ED for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id A0B2522DED for ; Thu, 28 May 2020 22:16:20 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id X7r0EcegiIFh for ; Thu, 28 May 2020 22:16:19 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 88D7422E10 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 040F720E00F9; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:48 +0200 Message-Id: <20200528201559.22618-6-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/17] fftools: switch to the new child class iteration API X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- fftools/cmdutils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index a948d478d5..e7ceed1c38 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -202,13 +202,14 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags, void show_help_children(const AVClass *class, int flags) { - const AVClass *child = NULL; + void *iter = NULL; + const AVClass *child; if (class->option) { av_opt_show2(&class, NULL, flags, 0); printf("\n"); } - while (child = av_opt_child_class_next(class, child)) + while (child = av_opt_child_class_iterate(class, &iter)) show_help_children(child, flags); } From patchwork Thu May 28 20:15:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19952 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 5F50144A30B for ; Thu, 28 May 2020 23:16:43 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 473FF68B06D; Thu, 28 May 2020 23:16:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80DFF68ABE7 for ; Thu, 28 May 2020 23:16:29 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 7A2BB28A6EB for ; Thu, 28 May 2020 22:16:27 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id dZw0o850zkg7 for ; Thu, 28 May 2020 22:16:27 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 01E5228A6EF for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id DFDD322DE3 for ; Thu, 28 May 2020 22:16:19 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id vsiw8T9e-PJH for ; Thu, 28 May 2020 22:16:19 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 8A3D522E26 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 1EB3C20E00F4; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:49 +0200 Message-Id: <20200528201559.22618-7-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/17] bsf: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/bitstream_filters.c | 14 ++++++++++++++ libavcodec/bsf.c | 3 +++ libavcodec/bsf_internal.h | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c index a7aa5dca65..b26d6a910e 100644 --- a/libavcodec/bitstream_filters.c +++ b/libavcodec/bitstream_filters.c @@ -96,6 +96,7 @@ const AVBitStreamFilter *av_bsf_get_by_name(const char *name) return NULL; } +#if FF_API_CHILD_CLASS_NEXT const AVClass *ff_bsf_child_class_next(const AVClass *prev) { const AVBitStreamFilter *f = NULL; @@ -115,3 +116,16 @@ const AVClass *ff_bsf_child_class_next(const AVClass *prev) } return NULL; } +#endif + +const AVClass *ff_bsf_child_class_iterate(void **opaque) +{ + const AVBitStreamFilter *f; + + /* find next filter with priv options */ + while ((f = av_bsf_iterate(opaque))) { + if (f->priv_class) + return f->priv_class; + } + return NULL; +} diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 5e1c794a76..d71bc32584 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -79,7 +79,10 @@ static const AVClass bsf_class = { .item_name = bsf_to_name, .version = LIBAVUTIL_VERSION_INT, .child_next = bsf_child_next, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = ff_bsf_child_class_next, +#endif + .child_class_iterate = ff_bsf_child_class_iterate, .category = AV_CLASS_CATEGORY_BITSTREAM_FILTER, }; diff --git a/libavcodec/bsf_internal.h b/libavcodec/bsf_internal.h index fefd5b8905..b78c134bdd 100644 --- a/libavcodec/bsf_internal.h +++ b/libavcodec/bsf_internal.h @@ -42,6 +42,10 @@ int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt); */ int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt); +#if FF_API_CHILD_CLASS_NEXT const AVClass *ff_bsf_child_class_next(const AVClass *prev); +#endif + +const AVClass *ff_bsf_child_class_iterate(void **opaque); #endif /* AVCODEC_BSF_INTERNAL_H */ From patchwork Thu May 28 20:15:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19954 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3125144A30B for ; Thu, 28 May 2020 23:16:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 18E7D68AFCC; Thu, 28 May 2020 23:16:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 99D8D68AFBE for ; Thu, 28 May 2020 23:16:30 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id E101A28A6EF for ; Thu, 28 May 2020 22:16:28 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id gNyXbXwT0oDK for ; Thu, 28 May 2020 22:16:27 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 06A0728A6F0 for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 743B422E26 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id yX_gJVlHdIwU for ; Thu, 28 May 2020 22:16:20 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 8D80C22E36 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 3A32320E00F5; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:50 +0200 Message-Id: <20200528201559.22618-8-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/17] AVCodecContext: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/options.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libavcodec/options.c b/libavcodec/options.c index 7706a03297..ff16e2cbfd 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -53,6 +53,7 @@ static void *codec_child_next(void *obj, void *prev) return NULL; } +#if FF_API_CHILD_CLASS_NEXT static const AVClass *codec_child_class_next(const AVClass *prev) { void *iter = NULL; @@ -69,6 +70,17 @@ static const AVClass *codec_child_class_next(const AVClass *prev) return c->priv_class; return NULL; } +#endif + +static const AVClass *codec_child_class_iterate(void **iter) +{ + const AVCodec *c; + /* find next codec with priv options */ + while (c = av_codec_iterate(iter)) + if (c->priv_class) + return c->priv_class; + return NULL; +} static AVClassCategory get_category(void *ptr) { @@ -84,7 +96,10 @@ static const AVClass av_codec_context_class = { .version = LIBAVUTIL_VERSION_INT, .log_level_offset_offset = offsetof(AVCodecContext, log_level_offset), .child_next = codec_child_next, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = codec_child_class_next, +#endif + .child_class_iterate = codec_child_class_iterate, .category = AV_CLASS_CATEGORY_ENCODER, .get_category = get_category, }; From patchwork Thu May 28 20:15:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19939 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id C548044A30B for ; Thu, 28 May 2020 23:16:29 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A476368AC9B; Thu, 28 May 2020 23:16:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8797868AA68 for ; Thu, 28 May 2020 23:16:23 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id C881428A6E7 for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 1sToNxkQG5kR for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 9492328A6E6 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id E325522DCD for ; Thu, 28 May 2020 22:16:18 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 1f8scS8Rih_8 for ; Thu, 28 May 2020 22:16:18 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 86DE322E06 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id DA3CC20E009B; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:51 +0200 Message-Id: <20200528201559.22618-9-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/17] af_aresample: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/af_aresample.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c index ef10621c35..fb10bd1c33 100644 --- a/libavfilter/af_aresample.c +++ b/libavfilter/af_aresample.c @@ -293,10 +293,19 @@ static int request_frame(AVFilterLink *outlink) return ret; } +#if FF_API_CHILD_CLASS_NEXT static const AVClass *resample_child_class_next(const AVClass *prev) { return prev ? NULL : swr_get_class(); } +#endif + +static const AVClass *resample_child_class_iterate(void **iter) +{ + const AVClass *c = *iter ? NULL : swr_get_class(); + *iter = (void*)(uintptr_t)c; + return c; +} static void *resample_child_next(void *obj, void *prev) { @@ -317,7 +326,10 @@ static const AVClass aresample_class = { .item_name = av_default_item_name, .option = options, .version = LIBAVUTIL_VERSION_INT, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = resample_child_class_next, +#endif + .child_class_iterate = resample_child_class_iterate, .child_next = resample_child_next, }; From patchwork Thu May 28 20:15:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19945 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 7527544A30B for ; Thu, 28 May 2020 23:16:37 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 638E668AFEB; Thu, 28 May 2020 23:16:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4C4CB68AE41 for ; Thu, 28 May 2020 23:16:31 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 5E1EB28A6E6 for ; Thu, 28 May 2020 22:16:29 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id GV0O_lN1fF4d for ; Thu, 28 May 2020 22:16:28 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 498BC28A6FF for ; Thu, 28 May 2020 22:16:23 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 1638120279 for ; Thu, 28 May 2020 22:16:23 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Ktfpf4snW3cJ for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id AC6B422EBE for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 9274220E00FC; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:52 +0200 Message-Id: <20200528201559.22618-10-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/17] af_resample: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/af_resample.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavfilter/af_resample.c b/libavfilter/af_resample.c index e3c6a20696..785cd0c7f4 100644 --- a/libavfilter/af_resample.c +++ b/libavfilter/af_resample.c @@ -306,10 +306,19 @@ fail: return ret; } +#if FF_API_CHILD_CLASS_NEXT static const AVClass *resample_child_class_next(const AVClass *prev) { return prev ? NULL : avresample_get_class(); } +#endif + +static const AVClass *resample_child_class_iterate(void **iter) +{ + const AVClass *c = *iter ? NULL : avresample_get_class(); + *iter = (void*)(uintptr_t)c; + return c; +} static void *resample_child_next(void *obj, void *prev) { @@ -321,7 +330,10 @@ static const AVClass resample_class = { .class_name = "resample", .item_name = av_default_item_name, .version = LIBAVUTIL_VERSION_INT, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = resample_child_class_next, +#endif + .child_class_iterate = resample_child_class_iterate, .child_next = resample_child_next, }; From patchwork Thu May 28 20:15:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19950 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 7D71F44A30B for ; Thu, 28 May 2020 23:16:41 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6A42D68B057; Thu, 28 May 2020 23:16:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 349E668AD85 for ; Thu, 28 May 2020 23:16:29 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id E960128A6E9 for ; Thu, 28 May 2020 22:16:26 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 4FrJWF-D0S6j for ; Thu, 28 May 2020 22:16:26 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 0196128A6EB for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 0911222E10 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id PI3hTVQ7_LQc for ; Thu, 28 May 2020 22:16:20 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 8FC0922E53 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 59A2320E00F8; Thu, 28 May 2020 22:16:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:53 +0200 Message-Id: <20200528201559.22618-11-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/17] avflter: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/avfilter.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 394811916d..dd8074e462 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -583,6 +583,7 @@ static void *filter_child_next(void *obj, void *prev) return NULL; } +#if FF_API_CHILD_CLASS_NEXT static const AVClass *filter_child_class_next(const AVClass *prev) { void *opaque = NULL; @@ -604,6 +605,18 @@ static const AVClass *filter_child_class_next(const AVClass *prev) return NULL; } +#endif + +static const AVClass *filter_child_class_iterate(void **iter) +{ + const AVFilter *f; + + while ((f = av_filter_iterate(iter))) + if (f->priv_class) + return f->priv_class; + + return NULL; +} #define OFFSET(x) offsetof(AVFilterContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM @@ -625,7 +638,10 @@ static const AVClass avfilter_class = { .version = LIBAVUTIL_VERSION_INT, .category = AV_CLASS_CATEGORY_FILTER, .child_next = filter_child_next, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = filter_child_class_next, +#endif + .child_class_iterate = filter_child_class_iterate, .option = avfilter_options, }; From patchwork Thu May 28 20:15:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19947 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 07BD244A30B for ; Thu, 28 May 2020 23:16:39 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DCBAD68AFE9; Thu, 28 May 2020 23:16:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EAF3F68AEEB for ; Thu, 28 May 2020 23:16:31 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id C9AAB28A6F0 for ; Thu, 28 May 2020 22:16:29 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 2glBhDM3Fw2G for ; Thu, 28 May 2020 22:16:29 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 4562B28A6FB for ; Thu, 28 May 2020 22:16:23 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 163BE22DCD for ; Thu, 28 May 2020 22:16:23 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id sQ7Iea_dV0M6 for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 9E15A22E6A for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 7415820E00FB; Thu, 28 May 2020 22:16:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:54 +0200 Message-Id: <20200528201559.22618-12-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/17] framesync: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/framesync.c | 7 +++++++ libavfilter/framesync.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c index b32a5cba6c..04119d686c 100644 --- a/libavfilter/framesync.c +++ b/libavfilter/framesync.c @@ -53,6 +53,13 @@ static const AVClass framesync_class = { .parent_log_context_offset = OFFSET(parent), }; +const AVClass *ff_framesync_child_class_iterate(void **iter) +{ + const AVClass *c = *iter ? NULL : &framesync_class; + *iter = (void*)(uintptr_t)c; + return c; +} + enum { STATE_BOF, STATE_RUN, diff --git a/libavfilter/framesync.h b/libavfilter/framesync.h index 37743cccb7..51bab16285 100644 --- a/libavfilter/framesync.h +++ b/libavfilter/framesync.h @@ -297,6 +297,8 @@ int ff_framesync_dualinput_get(FFFrameSync *fs, AVFrame **f0, AVFrame **f1); */ int ff_framesync_dualinput_get_writable(FFFrameSync *fs, AVFrame **f0, AVFrame **f1); +const AVClass *ff_framesync_child_class_iterate(void **iter); + #define FRAMESYNC_DEFINE_CLASS(name, context, field) \ static int name##_framesync_preinit(AVFilterContext *ctx) { \ context *s = ctx->priv; \ @@ -318,6 +320,7 @@ static const AVClass name##_class = { \ .version = LIBAVUTIL_VERSION_INT, \ .category = AV_CLASS_CATEGORY_FILTER, \ .child_class_next = name##_child_class_next, \ + .child_class_iterate = ff_framesync_child_class_iterate, \ .child_next = name##_child_next, \ } From patchwork Thu May 28 20:15:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19949 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id CB65044A30B for ; Thu, 28 May 2020 23:16:40 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B465768AFA6; Thu, 28 May 2020 23:16:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DB88D68ACD3 for ; Thu, 28 May 2020 23:16:32 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 663BD28A6E0 for ; Thu, 28 May 2020 22:16:32 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id ulD4lQuGxogV for ; Thu, 28 May 2020 22:16:29 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 2D61C28A705 for ; Thu, 28 May 2020 22:16:24 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id E899F20279 for ; Thu, 28 May 2020 22:16:23 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id dYozUurG5UYx for ; Thu, 28 May 2020 22:16:23 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id C30EA22EC1 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id ADE6020E00FA; Thu, 28 May 2020 22:16:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:55 +0200 Message-Id: <20200528201559.22618-13-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 13/17] vf_scale: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/vf_scale.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 0348f19d33..f92529e7c8 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -882,10 +882,19 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar return ret; } +#if FF_API_CHILD_CLASS_NEXT static const AVClass *child_class_next(const AVClass *prev) { return prev ? NULL : sws_get_class(); } +#endif + +static const AVClass *child_class_iterate(void **iter) +{ + const AVClass *c = *iter ? NULL : sws_get_class(); + *iter = (void*)(uintptr_t)c; + return c; +} #define OFFSET(x) offsetof(ScaleContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -944,7 +953,10 @@ static const AVClass scale_class = { .option = scale_options, .version = LIBAVUTIL_VERSION_INT, .category = AV_CLASS_CATEGORY_FILTER, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = child_class_next, +#endif + .child_class_iterate = child_class_iterate, }; static const AVFilterPad avfilter_vf_scale_inputs[] = { @@ -984,7 +996,10 @@ static const AVClass scale2ref_class = { .option = scale_options, .version = LIBAVUTIL_VERSION_INT, .category = AV_CLASS_CATEGORY_FILTER, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = child_class_next, +#endif + .child_class_iterate = child_class_iterate, }; static const AVFilterPad avfilter_vf_scale2ref_inputs[] = { From patchwork Thu May 28 20:15:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19944 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id DE8F344A30B for ; Thu, 28 May 2020 23:16:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CD6AD68AFE6; Thu, 28 May 2020 23:16:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4E98468AE4C for ; Thu, 28 May 2020 23:16:31 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 32F9628A6E7 for ; Thu, 28 May 2020 22:16:29 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id L2KGsjd_4XtA for ; Thu, 28 May 2020 22:16:28 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 73CD328A6F5 for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 4244922DCD for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Yulcn7_SYOd6 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 8FBC222E4E for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id C4E5120E011B; Thu, 28 May 2020 22:16:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:56 +0200 Message-Id: <20200528201559.22618-14-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/17] vf_spp: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/vf_spp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c index a83b1195c0..4bcc6429e0 100644 --- a/libavfilter/vf_spp.c +++ b/libavfilter/vf_spp.c @@ -44,10 +44,19 @@ enum mode { NB_MODES }; +#if FF_API_CHILD_CLASS_NEXT static const AVClass *child_class_next(const AVClass *prev) { return prev ? NULL : avcodec_dct_get_class(); } +#endif + +static const AVClass *child_class_iterate(void **iter) +{ + const AVClass *c = *iter ? NULL : avcodec_dct_get_class(); + *iter = (void*)(uintptr_t)c; + return c; +} static void *child_next(void *obj, void *prev) { @@ -74,7 +83,10 @@ static const AVClass spp_class = { .option = spp_options, .version = LIBAVUTIL_VERSION_INT, .category = AV_CLASS_CATEGORY_FILTER, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = child_class_next, +#endif + .child_class_iterate = child_class_iterate, .child_next = child_next, }; From patchwork Thu May 28 20:15:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19955 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id F20D044ACB3 for ; Thu, 28 May 2020 23:19:16 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CF53D68AFA0; Thu, 28 May 2020 23:16:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 90AD668AFBC for ; Thu, 28 May 2020 23:16:30 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 9BBA828A6E4 for ; Thu, 28 May 2020 22:16:28 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id TOSfvyERPaKR for ; Thu, 28 May 2020 22:16:27 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 4294F28A6F4 for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id F2ABA20279 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id n72KStaWlpM1 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 91AF222E63 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id F2DB920E0146; Thu, 28 May 2020 22:16:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:57 +0200 Message-Id: <20200528201559.22618-15-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 15/17] URLContext: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/avio.c | 3 +++ libavformat/protocols.c | 16 ++++++++++++++++ libavformat/url.h | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/libavformat/avio.c b/libavformat/avio.c index 237966c303..3886ed7a90 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -67,7 +67,10 @@ const AVClass ffurl_context_class = { .option = options, .version = LIBAVUTIL_VERSION_INT, .child_next = urlcontext_child_next, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = ff_urlcontext_child_class_next, +#endif + .child_class_iterate = ff_urlcontext_child_class_iterate, }; /*@}*/ diff --git a/libavformat/protocols.c b/libavformat/protocols.c index f1b8eab0fd..7df18fbb3b 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -73,6 +73,7 @@ extern const URLProtocol ff_libzmq_protocol; #include "libavformat/protocol_list.c" +#if FF_API_CHILD_CLASS_NEXT const AVClass *ff_urlcontext_child_class_next(const AVClass *prev) { int i; @@ -91,7 +92,22 @@ const AVClass *ff_urlcontext_child_class_next(const AVClass *prev) return url_protocols[i]->priv_data_class; return NULL; } +#endif +const AVClass *ff_urlcontext_child_class_iterate(void **iter) +{ + const AVClass *ret = NULL; + uintptr_t i; + + for (i = (uintptr_t)*iter; url_protocols[i]; i++) { + ret = url_protocols[i]->priv_data_class; + if (ret) + break; + } + + *iter = (void*)(uintptr_t)(url_protocols[i] ? i + 1 : i); + return ret; +} const char *avio_enum_protocols(void **opaque, int output) { diff --git a/libavformat/url.h b/libavformat/url.h index 4750bfff82..de0d30aca0 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -322,7 +322,11 @@ void ff_make_absolute_url(char *buf, int size, const char *base, */ AVIODirEntry *ff_alloc_dir_entry(void); +#if FF_API_CHILD_CLASS_NEXT const AVClass *ff_urlcontext_child_class_next(const AVClass *prev); +#endif + +const AVClass *ff_urlcontext_child_class_iterate(void **iter); /** * Construct a list of protocols matching a given whitelist and/or blacklist. From patchwork Thu May 28 20:15:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19948 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 1716D44A30B for ; Thu, 28 May 2020 23:16:40 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0204668B028; Thu, 28 May 2020 23:16:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0D2BE68AF1D for ; Thu, 28 May 2020 23:16:32 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 5958A28A6E0 for ; Thu, 28 May 2020 22:16:31 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id TETXqR_OczsC for ; Thu, 28 May 2020 22:16:30 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id EBAE028A707 for ; Thu, 28 May 2020 22:16:24 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id AB26820279 for ; Thu, 28 May 2020 22:16:24 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id kS632xWNiBRB for ; Thu, 28 May 2020 22:16:24 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id ECDD122F00 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id E482120E0147; Thu, 28 May 2020 22:16:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:58 +0200 Message-Id: <20200528201559.22618-16-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 16/17] AVIOContext: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/aviobuf.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index eb0387bdf7..5ba5de01c6 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -48,10 +48,19 @@ static void *ff_avio_child_next(void *obj, void *prev) return prev ? NULL : s->opaque; } +#if FF_API_CHILD_CLASS_NEXT static const AVClass *ff_avio_child_class_next(const AVClass *prev) { return prev ? NULL : &ffurl_context_class; } +#endif + +static const AVClass *child_class_iterate(void **iter) +{ + const AVClass *c = *iter ? NULL : &ffurl_context_class; + *iter = (void*)(uintptr_t)c; + return c; +} #define OFFSET(x) offsetof(AVIOContext,x) #define E AV_OPT_FLAG_ENCODING_PARAM @@ -67,7 +76,10 @@ const AVClass ff_avio_class = { .version = LIBAVUTIL_VERSION_INT, .option = ff_avio_options, .child_next = ff_avio_child_next, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = ff_avio_child_class_next, +#endif + .child_class_iterate = child_class_iterate, }; static void fill_buffer(AVIOContext *s); From patchwork Thu May 28 20:15:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19946 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3BCDE44A30B for ; Thu, 28 May 2020 23:16:38 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2B4AE68B002; Thu, 28 May 2020 23:16:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EB84C68AF04 for ; Thu, 28 May 2020 23:16:31 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id A281128A6E3 for ; Thu, 28 May 2020 22:16:30 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id MryZhZ4HZbRf for ; Thu, 28 May 2020 22:16:29 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 5896428A706 for ; Thu, 28 May 2020 22:16:24 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 1C0C422DCD for ; Thu, 28 May 2020 22:16:24 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 3s-psG0q7vTi for ; Thu, 28 May 2020 22:16:23 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id DF5EC22EE6 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id D7A5520E011C; Thu, 28 May 2020 22:16:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:59 +0200 Message-Id: <20200528201559.22618-17-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 17/17] AVFormatContext: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/options.c | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/libavformat/options.c b/libavformat/options.c index e14510504f..3160904fda 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -21,6 +21,7 @@ #include "avio_internal.h" #include "internal.h" +#include "libavutil/avassert.h" #include "libavutil/internal.h" #include "libavutil/opt.h" @@ -53,6 +54,8 @@ static void *format_child_next(void *obj, void *prev) return NULL; } +#if FF_API_CHILD_CLASS_NEXT +FF_DISABLE_DEPRECATION_WARNINGS static const AVClass *format_child_class_next(const AVClass *prev) { AVInputFormat *ifmt = NULL; @@ -80,6 +83,64 @@ static const AVClass *format_child_class_next(const AVClass *prev) return NULL; } +FF_ENABLE_DEPRECATION_WARNINGS +#endif + +enum { + CHILD_CLASS_ITER_AVIO = 0, + CHILD_CLASS_ITER_MUX, + CHILD_CLASS_ITER_DEMUX, + CHILD_CLASS_ITER_DONE, + +}; + +#define ITER_STATE_SHIFT 16 + +static const AVClass *format_child_class_iterate(void **iter) +{ + // we use the low 16 bits of iter as the value to be passed to + // av_(de)muxer_iterate() + void *val = (void*)(((uintptr_t)*iter) & ((1 << ITER_STATE_SHIFT) - 1)); + unsigned int state = ((uintptr_t)*iter) >> ITER_STATE_SHIFT; + const AVClass *ret = NULL; + + if (state == CHILD_CLASS_ITER_AVIO) { + ret = &ff_avio_class; + state++; + goto finish; + } + + if (state == CHILD_CLASS_ITER_MUX) { + const AVOutputFormat *ofmt; + + while ((ofmt = av_muxer_iterate(&val))) { + ret = ofmt->priv_class; + if (ret) + goto finish; + } + + val = NULL; + state++; + } + + if (state == CHILD_CLASS_ITER_DEMUX) { + const AVInputFormat *ifmt; + + while ((ifmt = av_demuxer_iterate(&val))) { + ret = ifmt->priv_class; + if (ret) + goto finish; + } + val = NULL; + state++; + } + +finish: + // make sure none av_(de)muxer_iterate does not set the high bits of val + av_assert0(!((uintptr_t)val >> ITER_STATE_SHIFT)); + *iter = (void*)((uintptr_t)val | (state << ITER_STATE_SHIFT)); + return ret; +} static AVClassCategory get_category(void *ptr) { @@ -94,7 +155,10 @@ static const AVClass av_format_context_class = { .option = avformat_options, .version = LIBAVUTIL_VERSION_INT, .child_next = format_child_next, +#if FF_API_CHILD_CLASS_NEXT .child_class_next = format_child_class_next, +#endif + .child_class_iterate = format_child_class_iterate, .category = AV_CLASS_CATEGORY_MUXER, .get_category = get_category, };