From patchwork Sat Jan 6 20:50:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 7172 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp905362jaa; Sat, 6 Jan 2018 12:51:50 -0800 (PST) X-Google-Smtp-Source: ACJfBou5qfkk0WvP55yXPF01dzDlLF+g5gdbG5KE96Mi+VtoMiYFGZfyNUjbxeIjfiZ4MWzErr0z X-Received: by 10.28.155.198 with SMTP id d189mr5304063wme.151.1515271910643; Sat, 06 Jan 2018 12:51:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515271910; cv=none; d=google.com; s=arc-20160816; b=wY098vyKZSaNZqPCliMX29h4u8Ki+IfpfIcUfqlAzs5yHTX8guhIoeVNxl+d6Tuqi/ dnXDxkGdLdGrfDQbttE+4WY6eu8G6MNc0QyDhmpO6eRCDyeSOV1kZwduQ/lEDjhkPU4O u9Bg3T7xqbmFnhWlCkLxgTTeakS7InnzSqJPxIdeDyFsonbESx4aBlQ1Rl+Gj6GM2CRL ys/p3qglllghMEUP1AzRgKSrRZxPHXK65e2+9SBhrLOPrQHNp2H2TZh/SDJa0wL3IlJP 6V1dFuz7i1LpC5dBNhq6lr8Kl5+dXOxz+ZKK8HbCFZtuhywUj+y1+nufpbkOicjihSTw fC3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=qEMIUimoURnVT8sfbrwc+NLfHzqE1VjzvvmTiZINJSQ=; b=dhqJV0FJQdD0YOEIbfIP1dpEqbu6RixdJoPjF6POqn4f7y2JjVRYF6ftxFkpoeutkm dmcrhcZ1yCkCqjzA3uqemocCTq/CFBKujoLKMHCKFRvVEqYIpYbQgpVS5mUas7CLl5g+ ftmSOhOFW9RpfP81zzXUnAnZYanAKMdckCLtepmaiJUvNCpWc2QpU5YaHrn+XS881253 W4QEYjYvsv2SytSc8Uq3qHIpVKXmOq3rrm+m+wJ2FjxI0567zpNkMl0KsrHC9LR9LETY fA2LbgPJGdIJOas8x+rAtsasn/MO4YO/36uNy/vGEq3u9THWZjd9S8ua8da0dB5ZzPca 8oZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 45si3165271wrz.215.2018.01.06.12.51.50; Sat, 06 Jan 2018 12:51:50 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A4FA5689EC6; Sat, 6 Jan 2018 22:51:02 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5D605689E64 for ; Sat, 6 Jan 2018 22:50:56 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id CA11EE107C; Sat, 6 Jan 2018 21:50:56 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lhdE6b7agv3v; Sat, 6 Jan 2018 21:50:56 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id B2892E1623; Sat, 6 Jan 2018 21:50:54 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Jan 2018 21:50:32 +0100 Message-Id: <20180106205032.15186-7-cus@passwd.hu> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180106205032.15186-1-cus@passwd.hu> References: <20180106205032.15186-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 7/7] avformat: deprecate AVFormatContext filename field 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- doc/APIchanges | 4 ++++ libavformat/avformat.h | 5 +++++ libavformat/mux.c | 10 ++++++++++ libavformat/utils.c | 8 ++++++++ libavformat/version.h | 3 +++ 5 files changed, 30 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 4a91b7460a..9593f647cc 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -16,6 +16,10 @@ libavutil: 2017-10-21 API changes, most recent first: 2018-xx-xx - xxxxxxx - lavf 58.4.100 - avformat.h + Deprecate AVFormatContext filename field which had limited length, use the + new dynamically allocated url field instead. + +2018-xx-xx - xxxxxxx - lavf 58.4.100 - avformat.h Add url field to AVFormatContext and add ff_format_set_url helper function. 2018-01-xx - xxxxxxx - lavfi 7.11.101 - avfilter.h diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 9fa25abd90..05f742f46c 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1382,13 +1382,18 @@ typedef struct AVFormatContext { */ AVStream **streams; +#if FF_API_FORMAT_FILENAME /** * input or output filename * * - demuxing: set by avformat_open_input() * - muxing: may be set by the caller before avformat_write_header() + * + * @deprecated Use url instead. */ + attribute_deprecated char filename[1024]; +#endif /** * input or output URL. Unlike the old filename field, this field has no diff --git a/libavformat/mux.c b/libavformat/mux.c index de63f2ca25..a13f0e3a1b 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -187,7 +187,11 @@ int avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *ofor s->priv_data = NULL; if (filename) { +#if FF_API_FORMAT_FILENAME +FF_DISABLE_DEPRECATION_WARNINGS av_strlcpy(s->filename, filename, sizeof(s->filename)); +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (!(s->url = av_strdup(filename))) goto nomem; @@ -255,7 +259,13 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options) (ret = av_opt_set_dict2(s->priv_data, &tmp, AV_OPT_SEARCH_CHILDREN)) < 0) goto fail; +#if FF_API_FORMAT_FILENAME +FF_DISABLE_DEPRECATION_WARNINGS if (!s->url && !(s->url = av_strdup(s->filename))) { +FF_ENABLE_DEPRECATION_WARNINGS +#else + if (!s->url && !(s->url = av_strdup(""))) { +#endif ret = AVERROR(ENOMEM); goto fail; } diff --git a/libavformat/utils.c b/libavformat/utils.c index a74046591e..c9136a3a3b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -556,7 +556,11 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, goto fail; } +#if FF_API_FORMAT_FILENAME +FF_DISABLE_DEPRECATION_WARNINGS av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename)); +FF_ENABLE_DEPRECATION_WARNINGS +#endif if ((ret = init_input(s, filename, &tmp)) < 0) goto fail; s->probe_score = ret; @@ -5636,5 +5640,9 @@ void ff_format_set_url(AVFormatContext *s, char *url) av_assert0(url); av_freep(&s->url); s->url = url; +#if FF_API_FORMAT_FILENAME +FF_DISABLE_DEPRECATION_WARNINGS av_strlcpy(s->filename, url, sizeof(s->filename)); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } diff --git a/libavformat/version.h b/libavformat/version.h index 49b9906a20..72ae400636 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -82,6 +82,9 @@ #ifndef FF_API_OLD_AVIO_EOF_0 #define FF_API_OLD_AVIO_EOF_0 (LIBAVFORMAT_VERSION_MAJOR < 59) #endif +#ifndef FF_API_FORMAT_FILENAME +#define FF_API_FORMAT_FILENAME (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif #ifndef FF_API_R_FRAME_RATE