From patchwork Tue Apr 20 15:13:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 27192 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:5014:0:0:0:0:0 with SMTP id e20csp1562601iob; Tue, 20 Apr 2021 08:13:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFIigNU9foJrJ0Q0C6mnE3K6Xl8ay3GaVyDc/n3mm1O5jko+O1AgxZHjR0qcbG4J5tmy0I X-Received: by 2002:a17:906:c79a:: with SMTP id cw26mr27653121ejb.220.1618931622231; Tue, 20 Apr 2021 08:13:42 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t25si6351720edy.465.2021.04.20.08.13.41; Tue, 20 Apr 2021 08:13:42 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b="FJ/vWPtc"; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A546A6881C2; Tue, 20 Apr 2021 18:13:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066017.outbound.protection.outlook.com [40.92.66.17]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D6B3C68002D for ; Tue, 20 Apr 2021 18:13:30 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dNI9EgrjH3gS3jwMtIaE0bIEBBBz5XD6LIETHPQJtn7UGDIqt6bYOcZIEGuCDSP2+KwPiH+3cteiVrLQmEMI16q8OhCBHxpoundvAqJmHnnfX8jPz3gWioyRn5yGa9mteLl+hT/f9iJ8hDmwzN/imHE2Y7nfRf+D/aJNZdrtXrX3WT7V/oG1+I829z+vgExG9P/off2zyPsa3U6vkow0bymyPMAQkF5qZyKVDAKfQEoDjFOfpOGL0AyM3A23OxF9C4EOTA1LySajkvUu2O68x/N9tC7qUqDQYE4e2RB0bOWryvganGuqnWpJMIY7M6qov8V6xhR9OBf0t7Xre2vIjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zs3FfRZfWxN6j275AU5gjl5W9juTriWrWBYKo4LI6hA=; b=DSVWA/zar/fPH5hsNghg1lhjJqP6UYUKvN2F2f17chqD80yFVT1TRYENmW9qzhXAFXkq0gYXuA8td5gmrd47bIekvIvXKm1u72F3bXaDzUtB//ii6/HcyXO4Raj7lmDJ30bGeHAE/4Eiwe7BPGGoP9f4ngddjnL9fsfXBvp6rD9W9ZJJH0GS+/W7ss35l7kVifKrffnH4AYB/5+y7ZsBpg4dFqi6M3bJJxdSf0iqrE7MC35Ql+1SqXPArA9nKwHjkNaNEEjhtWsOJuFNzjBwl003o7wpYqC+7OJgkeiObV7AVWzp7urzEH7a1+j2vf4FRPSlB71Zj5KK2DRV0/efbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zs3FfRZfWxN6j275AU5gjl5W9juTriWrWBYKo4LI6hA=; b=FJ/vWPtct/7i6SJ6rRgWxkI3nfjZL99vmLg6E0svVd+RuAF4S54MFU6XzaaOxPXbyX1CeZ5+gPJ3RMtlelbPTuueIvQqFo0VHooi/X1tkTZWYZpKzT/kYsuN5srHAu6hsg9X7ucm+6e4k0d/vbH35P4KK+t+mhszJ8fIJUV8sTASa2q/EN6cZYYkZ2ShBqNnhXxop3mYq27hV8NUM/R/jn9UjIz0JFviYsRf1yQAsbRZtd9ltBlwVPkyreb4paXijW9W8CGyBSPyVJc0wiHDdLPQyoKzOx6nn4GVDwz0Pah/OwA+DALnlVYteKjm8j/Eklm1eM+fd+Qq7AWX0w3Agg== Received: from HE1EUR01FT045.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e18::49) by HE1EUR01HT011.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e18::81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Tue, 20 Apr 2021 15:13:28 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e18::4e) by HE1EUR01FT045.mail.protection.outlook.com (2a01:111:e400:7e18::239) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Tue, 20 Apr 2021 15:13:28 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:8E112AA463EF4E22039DB32E5E7B395042D1A8195CD4874CF4F133D484C6410A; UpperCasedChecksum:B48E96511377A7CCB16412CFA6033C18707DD6D1B9173614F2F84BB66EC76F8C; SizeAsReceived:7512; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::45bb:c44f:2b75:23b7]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::45bb:c44f:2b75:23b7%5]) with mapi id 15.20.4042.024; Tue, 20 Apr 2021 15:13:28 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Apr 2021 17:13:19 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210419141024.8174-34-jamrial@gmail.com> References: <20210419141024.8174-34-jamrial@gmail.com> X-TMN: [a2cMtduiO8hv7WKZq2PHnfeTCuEPrI1QDgm4BwsQuz4=] X-ClientProxiedBy: PR0P264CA0247.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100::19) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210420151319.1699632-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.193.169.173) by PR0P264CA0247.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Tue, 20 Apr 2021 15:13:27 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 5bdef229-9e5d-47b7-b883-08d9040ed9be X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiSaJ/Gj/W3pBm4L34lmZkwX2k/x77nFNKpgKBLI9P96CY8E6+yYmcZDepBmbZpJiHG6Hkw993PFf62JQbG9Hd47VEBpN5ThBZJq6ozwEQZNTXVxCw05wyNMEGCy6KOD9+RugP7TLLZvhxHp2r2IadfqM+j9819t0743tk8uwfgH99c+hlyTn9lve1FhMSC0yDZgMa6K+EJmxkkI1guCST/wXBZizf/oFoJnCBREjZrmjAwUvGhlDQAETyuauY38rVTsPnscIATYZdpee+FD4vGKWwgy8IniOVKkTdtkSsHJeXsA51pk3B11FS9AZZoRB/tznYyXW3/LbJuiMr8roh6oTZzxfrU18Do22HYTlb7j66+dYbQ00s9JX4eLPXJAu4pY+52XgLYBvUCppNo5XuFrv0wVQv4BTRAvxCs3MVx6+dXYF555hW8y0sdGn/r5E2QEEX6lVhCObvChVlNXufEncgf00SGWPm7CcGm6h8T8VEZ7+uo7rFcpo3bYqqNVWUfxehQjlwcnAz3AvqrpL3otcA76jwgKD/zpjIXn0W17kbhKJPcONBjKWtSWefFodsJuIY2D96sU8VK9irKNAdfx9U6DGfht2IlwyAUt1nqJfp4eySttHr/tibCOKqoCbTBt+Nv4dA9pbpYh3AqhjocziWM5XzVWvGUVD8sue3oa3qCVnhb4fCPRa3oYIz9dqSMrPPguzZIGTons6koDyuOw2CXmUS/INjEKahcPhjOaKHLCfdWVPysflBZPVR+HVPQ= X-MS-TrafficTypeDiagnostic: HE1EUR01HT011: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yl89TS8Oo4lc0/87LmW30NBdLrXLrXqBnfrW1/rNbKL+G1o2VADQyfLiLeH43/yfRI4yiNSaAXAEmZvWCPh9z9b2cjGxFSC7x6FPcBvFtwGdkZpAc/Qg/JquI4zNoo+jcyDJz80stIY8dBwx8uX93Oh60ELsBN6cfG7UcxcqGbMVCNJcmSt1NsS7431FHHqiv1nWJAUXYR1AmM6JfPhxhsxLGcPvx8VDmKEf92UusnHzazgd6w8iu//+yT0+6I0D9o+hINYdpRX1Jalu/psFMX5Ni3y1rmh/leccouo3o0g+Lj/QoDXqe1XYOKH/5TyoeTysprKu7fTetPyy/QNNBbbacuITOWaFyGlWVFnCVneVaNHNsZlCfsR5zxcE8z2+09ezSC1NFz5+P3oNulrmkA== X-MS-Exchange-AntiSpam-MessageData: X8GJqfUf5oLTF/i4a/IlA89Y6ye/yx2GhVTS93xtcQ39xV6ELHP3a2a2RaPsbObzqV3zKRnzove3I9UvSTqg316IieykPNxjsxZ4fftFJ5AuqusS6RZr7waPdsuSnO3IHgFnMVuYuJ+ZLfwmPOvtaw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bdef229-9e5d-47b7-b883-08d9040ed9be X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2021 15:13:28.2002 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR01FT045.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT011 Subject: [FFmpeg-devel] [PATCH v2 33/90] avformat: Constify the API wrt AV(In|Out)putFormat 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6bSdTU5DsE6Z Also constify AVProbeData. Signed-off-by: Andreas Rheinhardt --- v1 forgot to update doc/examples. doc/APIchanges | 10 ++++++++ doc/examples/muxing.c | 2 +- doc/examples/remuxing.c | 2 +- fftools/ffmpeg_opt.c | 12 +++++---- fftools/ffplay.c | 7 ++--- fftools/ffprobe.c | 2 +- libavdevice/internal.h | 2 +- libavdevice/utils.c | 2 +- libavfilter/lavfutils.c | 2 +- libavfilter/src_movie.c | 2 +- libavformat/avformat.h | 44 ++++++++++++++------------------ libavformat/avidec.c | 2 +- libavformat/dashdec.c | 2 +- libavformat/fifo.c | 4 +-- libavformat/format.c | 33 ++++++++++++------------ libavformat/hdsenc.c | 2 +- libavformat/hls.c | 2 +- libavformat/hlsenc.c | 4 +-- libavformat/mpeg.c | 2 +- libavformat/mux.c | 2 +- libavformat/rtpdec_asf.c | 2 +- libavformat/rtpenc_chain.c | 2 +- libavformat/rtpenc_mpegts.c | 4 +-- libavformat/sapdec.c | 2 +- libavformat/segment.c | 2 +- libavformat/smoothstreamingenc.c | 2 +- libavformat/utils.c | 2 +- libavformat/version.h | 3 --- libavformat/webm_chunk.c | 2 +- 29 files changed, 83 insertions(+), 78 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index cd3ea3c865..e9fa7ddf64 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -17,6 +17,16 @@ API changes, most recent first: 2021-04-17 - xxxxxxxxxx - lavu 56.73.100 - frame.h detection_bbox.h Add AV_FRAME_DATA_DETECTION_BBOXES +2021-04-14 - xxxxxxxxxx - lavf yyyyyyyyy - avformat.h + Constified the pointers to AVInputFormats and AVOutputFormats + in AVFormatContext, avformat_alloc_output_context2(), + av_find_input_format(), av_probe_input_format(), + av_probe_input_format2(), av_probe_input_format3(), + av_probe_input_buffer2(), av_probe_input_buffer(), + avformat_open_input(), av_guess_format() and av_guess_codec(). + Furthermore, constified the AVProbeData in av_probe_input_format(), + av_probe_input_format2() and av_probe_input_format3(). + 2021-04-06 - xxxxxxxxxx - lavf 58.78.100 - avformat.h Add avformat_index_get_entries_count(), avformat_index_get_entry(), and avformat_index_get_entry_from_timestamp(). diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c index 42f704c258..014359e2ca 100644 --- a/doc/examples/muxing.c +++ b/doc/examples/muxing.c @@ -536,8 +536,8 @@ static void close_stream(AVFormatContext *oc, OutputStream *ost) int main(int argc, char **argv) { OutputStream video_st = { 0 }, audio_st = { 0 }; + const AVOutputFormat *fmt; const char *filename; - AVOutputFormat *fmt; AVFormatContext *oc; AVCodec *audio_codec, *video_codec; int ret; diff --git a/doc/examples/remuxing.c b/doc/examples/remuxing.c index 9e4d1031b4..13313a1748 100644 --- a/doc/examples/remuxing.c +++ b/doc/examples/remuxing.c @@ -45,7 +45,7 @@ static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, cons int main(int argc, char **argv) { - AVOutputFormat *ofmt = NULL; + const AVOutputFormat *ofmt = NULL; AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL; AVPacket pkt; const char *in_filename, *out_filename; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 807e783422..9e26de5a94 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1068,7 +1068,7 @@ static int open_input_file(OptionsContext *o, const char *filename) { InputFile *f; AVFormatContext *ic; - AVInputFormat *file_iformat = NULL; + const AVInputFormat *file_iformat = NULL; int err, i, ret; int64_t timestamp; AVDictionary *unused_opts = NULL; @@ -1117,20 +1117,22 @@ static int open_input_file(OptionsContext *o, const char *filename) av_dict_set_int(&o->g->format_opts, "sample_rate", o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i, 0); } if (o->nb_audio_channels) { + const AVClass *priv_class; /* because we set audio_channels based on both the "ac" and * "channel_layout" options, we need to check that the specified * demuxer actually has the "channels" option before setting it */ - if (file_iformat && file_iformat->priv_class && - av_opt_find(&file_iformat->priv_class, "channels", NULL, 0, + if (file_iformat && (priv_class = file_iformat->priv_class) && + av_opt_find(&priv_class, "channels", NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)) { av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0); } } if (o->nb_frame_rates) { + const AVClass *priv_class; /* set the format-level framerate option; * this is important for video grabbers, e.g. x11 */ - if (file_iformat && file_iformat->priv_class && - av_opt_find(&file_iformat->priv_class, "framerate", NULL, 0, + if (file_iformat && (priv_class = file_iformat->priv_class) && + av_opt_find(&priv_class, "framerate", NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)) { av_dict_set(&o->g->format_opts, "framerate", o->frame_rates[o->nb_frame_rates - 1].u.str, 0); diff --git a/fftools/ffplay.c b/fftools/ffplay.c index e14c800b8f..0be1d90bf9 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -203,7 +203,7 @@ typedef struct Decoder { typedef struct VideoState { SDL_Thread *read_tid; - AVInputFormat *iformat; + const AVInputFormat *iformat; int abort_request; int force_refresh; int paused; @@ -308,7 +308,7 @@ typedef struct VideoState { } VideoState; /* options specified by the user */ -static AVInputFormat *file_iformat; +static const AVInputFormat *file_iformat; static const char *input_filename; static const char *window_title; static int default_width = 640; @@ -3075,7 +3075,8 @@ static int read_thread(void *arg) return 0; } -static VideoState *stream_open(const char *filename, AVInputFormat *iformat) +static VideoState *stream_open(const char *filename, + const AVInputFormat *iformat) { VideoState *is; diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index a2cb7dc986..13ed16431d 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -257,7 +257,7 @@ static const OptionDef *options; /* FFprobe context */ static const char *input_filename; static const char *print_input_filename; -static AVInputFormat *iformat = NULL; +static const AVInputFormat *iformat = NULL; static struct AVHashContext *hash; diff --git a/libavdevice/internal.h b/libavdevice/internal.h index e222cf204d..67c90e1f87 100644 --- a/libavdevice/internal.h +++ b/libavdevice/internal.h @@ -22,7 +22,7 @@ #include "libavformat/avformat.h" av_warn_unused_result -int ff_alloc_input_device_context(struct AVFormatContext **avctx, struct AVInputFormat *iformat, +int ff_alloc_input_device_context(struct AVFormatContext **avctx, const AVInputFormat *iformat, const char *format); #endif diff --git a/libavdevice/utils.c b/libavdevice/utils.c index ccd7318012..d9a52c53ab 100644 --- a/libavdevice/utils.c +++ b/libavdevice/utils.c @@ -20,7 +20,7 @@ #include "libavutil/opt.h" #include "libavformat/avformat.h" -int ff_alloc_input_device_context(AVFormatContext **avctx, AVInputFormat *iformat, const char *format) +int ff_alloc_input_device_context(AVFormatContext **avctx, const AVInputFormat *iformat, const char *format) { AVFormatContext *s; int ret = 0; diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c index 34051ee61d..2bc06257c6 100644 --- a/libavfilter/lavfutils.c +++ b/libavfilter/lavfutils.c @@ -26,7 +26,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], int *w, int *h, enum AVPixelFormat *pix_fmt, const char *filename, void *log_ctx) { - AVInputFormat *iformat = NULL; + const AVInputFormat *iformat = NULL; AVFormatContext *format_ctx = NULL; const AVCodec *codec; AVCodecContext *codec_ctx = NULL; diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 5892500410..e449e7e0c2 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -205,7 +205,7 @@ static int guess_channel_layout(MovieStream *st, int st_index, void *log_ctx) static av_cold int movie_common_init(AVFilterContext *ctx) { MovieContext *movie = ctx->priv; - AVInputFormat *iformat = NULL; + const AVInputFormat *iformat = NULL; int64_t timestamp; int nb_streams = 1, ret, i; char default_streams[16], *stream_specs, *spec, *cursor; diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 17b54c0997..166f1aa41c 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -525,15 +525,6 @@ typedef struct AVOutputFormat { * New public fields should be added right above. ***************************************************************** */ - /** - * The ff_const59 define is not part of the public API and will - * be removed without further warning. - */ -#if FF_API_AVIOFORMAT -#define ff_const59 -#else -#define ff_const59 const -#endif /** * size of private data so that it can be allocated in the wrapper */ @@ -1235,14 +1226,14 @@ typedef struct AVFormatContext { * * Demuxing only, set by avformat_open_input(). */ - ff_const59 struct AVInputFormat *iformat; + const struct AVInputFormat *iformat; /** * The output container format. * * Muxing only, must be set by the caller before avformat_write_header(). */ - ff_const59 struct AVOutputFormat *oformat; + const struct AVOutputFormat *oformat; /** * Format private data. This is an AVOptions-enabled struct @@ -2088,7 +2079,7 @@ AVProgram *av_new_program(AVFormatContext *s, int id); * @return >= 0 in case of success, a negative AVERROR code in case of * failure */ -int avformat_alloc_output_context2(AVFormatContext **ctx, ff_const59 AVOutputFormat *oformat, +int avformat_alloc_output_context2(AVFormatContext **ctx, const AVOutputFormat *oformat, const char *format_name, const char *filename); /** @@ -2099,7 +2090,7 @@ int avformat_alloc_output_context2(AVFormatContext **ctx, ff_const59 AVOutputFor /** * Find AVInputFormat based on the short name of the input format. */ -ff_const59 AVInputFormat *av_find_input_format(const char *short_name); +const AVInputFormat *av_find_input_format(const char *short_name); /** * Guess the file format. @@ -2108,7 +2099,7 @@ ff_const59 AVInputFormat *av_find_input_format(const char *short_name); * @param is_opened Whether the file is already opened; determines whether * demuxers with or without AVFMT_NOFILE are probed. */ -ff_const59 AVInputFormat *av_probe_input_format(ff_const59 AVProbeData *pd, int is_opened); +const AVInputFormat *av_probe_input_format(const AVProbeData *pd, int is_opened); /** * Guess the file format. @@ -2122,7 +2113,8 @@ ff_const59 AVInputFormat *av_probe_input_format(ff_const59 AVProbeData *pd, int * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended * to retry with a larger probe buffer. */ -ff_const59 AVInputFormat *av_probe_input_format2(ff_const59 AVProbeData *pd, int is_opened, int *score_max); +const AVInputFormat *av_probe_input_format2(const AVProbeData *pd, + int is_opened, int *score_max); /** * Guess the file format. @@ -2131,7 +2123,8 @@ ff_const59 AVInputFormat *av_probe_input_format2(ff_const59 AVProbeData *pd, int * demuxers with or without AVFMT_NOFILE are probed. * @param score_ret The score of the best detection. */ -ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int is_opened, int *score_ret); +const AVInputFormat *av_probe_input_format3(const AVProbeData *pd, + int is_opened, int *score_ret); /** * Probe a bytestream to determine the input format. Each time a probe returns @@ -2149,14 +2142,14 @@ ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int * the maximal score is AVPROBE_SCORE_MAX * AVERROR code otherwise */ -int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt, +int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); /** * Like av_probe_input_buffer2() but returns 0 on success */ -int av_probe_input_buffer(AVIOContext *pb, ff_const59 AVInputFormat **fmt, +int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); @@ -2179,7 +2172,8 @@ int av_probe_input_buffer(AVIOContext *pb, ff_const59 AVInputFormat **fmt, * * @note If you want to use custom IO, preallocate the format context and set its pb field. */ -int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options); +int avformat_open_input(AVFormatContext **ps, const char *url, + const AVInputFormat *fmt, AVDictionary **options); #if FF_API_DEMUXER_OPEN /** @@ -2570,16 +2564,16 @@ int av_write_trailer(AVFormatContext *s); * @param mime_type if non-NULL checks if mime_type matches with the * MIME type of the registered formats */ -ff_const59 AVOutputFormat *av_guess_format(const char *short_name, - const char *filename, - const char *mime_type); +const AVOutputFormat *av_guess_format(const char *short_name, + const char *filename, + const char *mime_type); /** * Guess the codec ID based upon muxer and filename. */ -enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name, - const char *filename, const char *mime_type, - enum AVMediaType type); +enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, const char *short_name, + const char *filename, const char *mime_type, + enum AVMediaType type); /** * Get timing information for the data currently output. diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 48370fe5ce..ac020109c6 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1092,7 +1092,7 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt) uint8_t desc[256]; int score = AVPROBE_SCORE_EXTENSION, ret; AVIStream *ast = st->priv_data; - ff_const59 AVInputFormat *sub_demuxer; + const AVInputFormat *sub_demuxer; AVRational time_base; int size; AVProbeData pd; diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 73effd85db..39e7810e42 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1879,7 +1879,7 @@ static void close_demux_for_component(struct representation *pls) static int reopen_demux_for_component(AVFormatContext *s, struct representation *pls) { DASHContext *c = s->priv_data; - ff_const59 AVInputFormat *in_fmt = NULL; + const AVInputFormat *in_fmt = NULL; AVDictionary *in_fmt_opts = NULL; uint8_t *avio_ctx_buffer = NULL; int ret = 0, i; diff --git a/libavformat/fifo.c b/libavformat/fifo.c index 17748e94ce..78afaff197 100644 --- a/libavformat/fifo.c +++ b/libavformat/fifo.c @@ -469,7 +469,7 @@ static void *fifo_consumer_thread(void *data) return NULL; } -static int fifo_mux_init(AVFormatContext *avf, ff_const59 AVOutputFormat *oformat, +static int fifo_mux_init(AVFormatContext *avf, const AVOutputFormat *oformat, const char *filename) { FifoContext *fifo = avf->priv_data; @@ -508,7 +508,7 @@ static int fifo_mux_init(AVFormatContext *avf, ff_const59 AVOutputFormat *oforma static int fifo_init(AVFormatContext *avf) { FifoContext *fifo = avf->priv_data; - ff_const59 AVOutputFormat *oformat; + const AVOutputFormat *oformat; int ret = 0; if (fifo->recovery_wait_streamtime && !fifo->drop_pkts_on_overflow) { diff --git a/libavformat/format.c b/libavformat/format.c index c47490c8eb..cc214741bd 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -48,8 +48,8 @@ int av_match_ext(const char *filename, const char *extensions) return 0; } -ff_const59 AVOutputFormat *av_guess_format(const char *short_name, const char *filename, - const char *mime_type) +const AVOutputFormat *av_guess_format(const char *short_name, const char *filename, + const char *mime_type) { const AVOutputFormat *fmt = NULL; AVOutputFormat *fmt_found = NULL; @@ -84,12 +84,12 @@ ff_const59 AVOutputFormat *av_guess_format(const char *short_name, const char *f return fmt_found; } -enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name, +enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type) { if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) { - ff_const59 AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL); + const AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL); if (fmt2) fmt = fmt2; } @@ -115,7 +115,7 @@ enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_ return AV_CODEC_ID_NONE; } -ff_const59 AVInputFormat *av_find_input_format(const char *short_name) +const AVInputFormat *av_find_input_format(const char *short_name) { const AVInputFormat *fmt = NULL; void *i = 0; @@ -125,12 +125,12 @@ ff_const59 AVInputFormat *av_find_input_format(const char *short_name) return NULL; } -ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int is_opened, - int *score_ret) +const AVInputFormat *av_probe_input_format3(const AVProbeData *pd, + int is_opened, int *score_ret) { AVProbeData lpd = *pd; const AVInputFormat *fmt1 = NULL; - ff_const59 AVInputFormat *fmt = NULL; + const AVInputFormat *fmt = NULL; int score, score_max = 0; void *i = 0; const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE]; @@ -191,7 +191,7 @@ ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int } if (score > score_max) { score_max = score; - fmt = (AVInputFormat*)fmt1; + fmt = fmt1; } else if (score == score_max) fmt = NULL; } @@ -202,10 +202,11 @@ ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int return fmt; } -ff_const59 AVInputFormat *av_probe_input_format2(ff_const59 AVProbeData *pd, int is_opened, int *score_max) +const AVInputFormat *av_probe_input_format2(const AVProbeData *pd, + int is_opened, int *score_max) { int score_ret; - ff_const59 AVInputFormat *fmt = av_probe_input_format3(pd, is_opened, &score_ret); + const AVInputFormat *fmt = av_probe_input_format3(pd, is_opened, &score_ret); if (score_ret > *score_max) { *score_max = score_ret; return fmt; @@ -213,15 +214,15 @@ ff_const59 AVInputFormat *av_probe_input_format2(ff_const59 AVProbeData *pd, int return NULL; } -ff_const59 AVInputFormat *av_probe_input_format(ff_const59 AVProbeData *pd, int is_opened) +const AVInputFormat *av_probe_input_format(const AVProbeData *pd, int is_opened) { int score = 0; return av_probe_input_format2(pd, is_opened, &score); } -int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt, - const char *filename, void *logctx, - unsigned int offset, unsigned int max_probe_size) +int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size) { AVProbeData pd = { filename ? filename : "" }; uint8_t *buf = NULL; @@ -309,7 +310,7 @@ fail: return ret < 0 ? ret : score; } -int av_probe_input_buffer(AVIOContext *pb, ff_const59 AVInputFormat **fmt, +int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 353a45f6df..98156afafa 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -313,8 +313,8 @@ static void close_file(AVFormatContext *s, OutputStream *os) static int hds_write_header(AVFormatContext *s) { HDSContext *c = s->priv_data; + const AVOutputFormat *oformat; int ret = 0, i; - ff_const59 AVOutputFormat *oformat; if (mkdir(s->url, 0777) == -1 && errno != EEXIST) { av_log(s, AV_LOG_ERROR , "Failed to create directory %s\n", s->url); diff --git a/libavformat/hls.c b/libavformat/hls.c index b589ad2870..83acbb0aa6 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1957,8 +1957,8 @@ static int hls_read_header(AVFormatContext *s) /* Open the demuxer for each playlist */ for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; + const AVInputFormat *in_fmt = NULL; char *url; - ff_const59 AVInputFormat *in_fmt = NULL; if (!(pls->ctx = avformat_alloc_context())) { ret = AVERROR(ENOMEM); diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 7d97ce1789..9a848b6470 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -119,8 +119,8 @@ typedef struct VariantStream { unsigned var_stream_idx; unsigned number; int64_t sequence; - ff_const59 AVOutputFormat *oformat; - ff_const59 AVOutputFormat *vtt_oformat; + const AVOutputFormat *oformat; + const AVOutputFormat *vtt_oformat; AVIOContext *out; AVIOContext *out_single_file; int packets_written; diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 79610ec600..0ddeaa9fb8 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -732,6 +732,7 @@ static int vobsub_read_header(AVFormatContext *s) { int i, ret = 0, header_parsed = 0, langidx = 0; VobSubDemuxContext *vobsub = s->priv_data; + const AVInputFormat *iformat; size_t fname_len; AVBPrint header; int64_t delay = 0; @@ -739,7 +740,6 @@ static int vobsub_read_header(AVFormatContext *s) int stream_id = -1; char id[64] = {0}; char alt[MAX_LINE_SIZE] = {0}; - ff_const59 AVInputFormat *iformat; if (!vobsub->sub_name) { char *ext; diff --git a/libavformat/mux.c b/libavformat/mux.c index d8746f3c13..a05b55b53c 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -133,7 +133,7 @@ enum AVChromaLocation ff_choose_chroma_location(AVFormatContext *s, AVStream *st } -int avformat_alloc_output_context2(AVFormatContext **avctx, ff_const59 AVOutputFormat *oformat, +int avformat_alloc_output_context2(AVFormatContext **avctx, const AVOutputFormat *oformat, const char *format, const char *filename) { AVFormatContext *s = avformat_alloc_context(); diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index e58f0260f3..2749ad1380 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -106,7 +106,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) AVDictionary *opts = NULL; int len = strlen(p) * 6 / 8; char *buf = av_mallocz(len); - ff_const59 AVInputFormat *iformat; + const AVInputFormat *iformat; if (!buf) return AVERROR(ENOMEM); diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index e6b603db70..cd751f48b6 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -31,7 +31,7 @@ int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s, { AVFormatContext *rtpctx = NULL; int ret; - ff_const59 AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); + const AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); uint8_t *rtpflags; AVDictionary *opts = NULL; diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c index da17b1d776..36c0979ca1 100644 --- a/libavformat/rtpenc_mpegts.c +++ b/libavformat/rtpenc_mpegts.c @@ -56,8 +56,8 @@ static int rtp_mpegts_write_header(AVFormatContext *s) { MuxChain *chain = s->priv_data; AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL; - ff_const59 AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL); - ff_const59 AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); + const AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL); + const AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); int i, ret = AVERROR(ENOMEM); AVStream *st; AVDictionary *mpegts_muxer_options = NULL; diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index eec73aa2f4..3014bdaa97 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -65,9 +65,9 @@ static int sap_read_header(AVFormatContext *s) struct SAPState *sap = s->priv_data; char host[1024], path[1024], url[1024]; uint8_t recvbuf[RTP_MAX_PACKET_LENGTH]; + const AVInputFormat *infmt; int port; int ret, i; - ff_const59 AVInputFormat* infmt; if (!ff_network_init()) return AVERROR(EIO); diff --git a/libavformat/segment.c b/libavformat/segment.c index cd72e8b701..13954b8f99 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -72,7 +72,7 @@ typedef struct SegmentContext { int segment_idx_wrap; ///< number after which the index wraps int segment_idx_wrap_nb; ///< number of time the index has wraped int segment_count; ///< number of segment files already written - ff_const59 AVOutputFormat *oformat; + const AVOutputFormat *oformat; AVFormatContext *avf; char *format; ///< format to use for output segment files AVDictionary *format_options; diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index ba5cc27ca0..941f03f0b1 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -283,7 +283,7 @@ static int ism_write_header(AVFormatContext *s) { SmoothStreamingContext *c = s->priv_data; int ret = 0, i; - ff_const59 AVOutputFormat *oformat; + const AVOutputFormat *oformat; if (mkdir(s->url, 0777) == -1 && errno != EEXIST) { av_log(s, AV_LOG_ERROR, "mkdir failed\n"); diff --git a/libavformat/utils.c b/libavformat/utils.c index 322ccd3af2..ec48d1c08e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -545,7 +545,7 @@ FF_ENABLE_DEPRECATION_WARNINGS int avformat_open_input(AVFormatContext **ps, const char *filename, - ff_const59 AVInputFormat *fmt, AVDictionary **options) + const AVInputFormat *fmt, AVDictionary **options) { AVFormatContext *s = *ps; int i, ret = 0; diff --git a/libavformat/version.h b/libavformat/version.h index d82adba668..81326aa199 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -97,9 +97,6 @@ #ifndef FF_API_LAVF_MP4A_LATM #define FF_API_LAVF_MP4A_LATM (LIBAVFORMAT_VERSION_MAJOR < 59) #endif -#ifndef FF_API_AVIOFORMAT -#define FF_API_AVIOFORMAT (LIBAVFORMAT_VERSION_MAJOR < 59) -#endif #ifndef FF_API_DEMUXER_OPEN #define FF_API_DEMUXER_OPEN (LIBAVFORMAT_VERSION_MAJOR < 59) #endif diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c index fb5b20a8cc..fefab982cb 100644 --- a/libavformat/webm_chunk.c +++ b/libavformat/webm_chunk.c @@ -50,7 +50,7 @@ typedef struct WebMChunkContext { static int webm_chunk_init(AVFormatContext *s) { WebMChunkContext *wc = s->priv_data; - ff_const59 AVOutputFormat *oformat; + const AVOutputFormat *oformat; AVFormatContext *oc; AVStream *st, *ost = s->streams[0]; AVDictionary *dict = NULL;