From patchwork Sun Jan 21 18:24:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 7385 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.156.27 with SMTP id q27csp2064317jak; Sun, 21 Jan 2018 10:26:23 -0800 (PST) X-Google-Smtp-Source: AH8x226l9xSgRUBBIfHw2nG83wqE3setoax92EJDJ+S3DJlydZw+27UoolrlutyJTzup86KZulMP X-Received: by 10.28.190.3 with SMTP id o3mr3722391wmf.17.1516559183388; Sun, 21 Jan 2018 10:26:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516559183; cv=none; d=google.com; s=arc-20160816; b=xc28X7g9ci1UsE6mZsNT1drEd7B1clg5/SVRCdCWJCcxR6MR+D9etWqNLEAC+ULB6V sjrTLaEfBIcfuAkZFQ+/MPKauGDjSaKUah+2USQ8Zg3f0UHA9zATyn/HkAB1ZjhwuDbF 9Fj08FK133DZ3+DjH/JyfVCAkGUK/HBpFXOjod6LdKPFd132UVHJHs4uMn0UWb4MuGI/ 5KICAl+VCgw0SdfwVrh0nycj+3cxmmdZ3QIwoqqJLMktU+frFz8Aowsg3l6pUszQ3I7W DFOAZmK285lmy0xd70uuNInLZJF+eyCVT2JyvqoQOLT4gtUtaqIDQd8guONHWSliqKFl q2mg== 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=CGf2MgrzSz5ZL3yM3hNXtXzZOVIo2VRxBrvznK0fF4o=; b=vvqQku+1npXz+FCjhssO5Pl90wNjEYAJd2KunREyUAukJifVU1HtMXrBFjtxyRA0T+ UabcpxM/H/uVX2ZS0PdpadApVWyYbVjAnNk/B2ma9LFcBfLh32OE7e1vAGaIqYZ+RJ2V ErHyCFWPgmIPrETxvveMbeyT66pUjahXhLSlQIZ4kwrwnvwSxWdDTVhFs3hibaYcio/R je1G7MsJONxeMgVrUWLZQCjneOBOPy4dqZAT4JcxuD2NgAhymVXcWdsIVUVyKquoZ3LG MIsjhGt6M+XMixTO9UnhINC2DlQ09JV2HGc7Fs80/CiKY/hvNlvSwTPaRoSBJ9cYzZiQ J7Cg== 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 x66si3858823wmb.268.2018.01.21.10.26.23; Sun, 21 Jan 2018 10:26:23 -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 C55A268A26F; Sun, 21 Jan 2018 20:25:30 +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 F32D968A279 for ; Sun, 21 Jan 2018 20:25:22 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 9820DE164D; Sun, 21 Jan 2018 19:25:24 +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 uIu_NBCBFNAC; Sun, 21 Jan 2018 19:25:23 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 24696E1420; Sun, 21 Jan 2018 19:25:22 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 21 Jan 2018 19:24:11 +0100 Message-Id: <20180121182411.22224-8-cus@passwd.hu> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180121182411.22224-1-cus@passwd.hu> References: <20180121182411.22224-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 490f57bb2f..f4b95d8987 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.6.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.6.100 - avformat.h Add url field to AVFormatContext and add ff_format_set_url helper function. 2018-01-xx - xxxxxxx - lavf 58.5.100 - avformat.h diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 81ac7e58e8..4c4986ad0e 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1389,13 +1389,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 0b777186e1..b4d00ad368 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -560,7 +560,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; @@ -5646,5 +5650,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 5ff8a89ae0..2cd1bf438e 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -85,6 +85,9 @@ #ifndef FF_API_LAVF_FFSERVER #define FF_API_LAVF_FFSERVER (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