From patchwork Wed Jul 28 12:15:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29085 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp5736408pxb; Wed, 28 Jul 2021 05:15:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBgTZ43yxkHCGb8+IMmddC5jTNxbJviLTFSBdA+pTgrg2D3GP3Pm2QAGQ4qJVIeTMwWVVT X-Received: by 2002:a17:907:1b11:: with SMTP id mp17mr27103924ejc.1.1627474533194; Wed, 28 Jul 2021 05:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627474533; cv=none; d=google.com; s=arc-20160816; b=RA0+NV6CBme7fYyHApPV7zW+rJfAlwE8fimVw9JyyfxXkl80glZEUpdPlRIXt5bc+5 tdThrl2d+4njspDnyuumKeKHkxHNncK58oUFW2uj0xD7G6JZLs1jcHj/1YXxIh/7EbZQ Z2wPUHXvPM1V90oe6Y8wD3LCHYTjR+SN0Y+3H5amQP4hg/yzfFlJ0eoLAn4udxbo+Ail B8FksgA3F9sY3jU4ijCkEePaXKAIg2uesW/HZDiy+WpzfPbuRFPvz+lCfWVEL0niAyBi l1isxFfpL8RgoCZsmmBl9pSgWkplahBdOzmdx2ltmQMUZNQJqSUSk/hVOJxLyq3O5GPv ESUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=sLdO2nD7ygfsC0xdQPZFvdpBQ/GFVx/AjSAINg/w+qo=; b=Vc8FG6cazJiIDpzqrMpwq0oLi1iMgi0ItqA5FpgFvACdCDnrEbSiO6Ih/kFTXC/86g bEHBmFjwPTvZkl7pptfkg7X28iB826xSHc92or/TJg2jNtxoN8p1Ih281mkEBPr9EXk8 QfkJvCuKZHSrb3BcHHcZ2e7HNeX7KoPaPi9ZHjTZz+8QHW8RFGj1fPHZnY8Ys2d56KS9 MC9ldgNJfARGWQ44Fnf/gdpQDYMyU1owd6V0qotoo8WqMUqfYyQi6p61OsKcRwaFm5aP H7NSd8p+0W7yqLsNOv1rKHQtqCrkuLeA5VLgEVuYmZEuBM38tFJKHZD2u77vmUuflJzf ZfXA== 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 cb18si4773390ejb.171.2021.07.28.05.15.31; Wed, 28 Jul 2021 05:15:33 -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; 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 9770E689BFF; Wed, 28 Jul 2021 15:15:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0BC9268081D for ; Wed, 28 Jul 2021 15:15:19 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 16SCFIJt030331 for ; Wed, 28 Jul 2021 14:15:19 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id E9D80E62AD; Wed, 28 Jul 2021 14:15:18 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Jul 2021 14:15:12 +0200 Message-Id: <20210728121517.533173-1-george@nsup.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Wed, 28 Jul 2021 14:15:19 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 1/5] libavformat/concatdec: remove support for unsafe=-1. 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: jbz7jUOhB3un It only makes sense as the default value, but it is not the default since 689211d5727231c3fe92762d224dbadebdbf4e30. Signed-off-by: Nicolas George --- doc/demuxers.texi | 9 +++------ libavformat/concatdec.c | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 5b8cf1bfea..5f18e4551b 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -96,8 +96,7 @@ backslash or single quotes. All subsequent file-related directives apply to that file. @item @code{ffconcat version 1.0} -Identify the script type and version. It also sets the @option{safe} option -to 1 if it was -1. +Identify the script type and version. To make FFmpeg recognize the format automatically, this directive must appear exactly as is (no extra space or byte-order-mark) on the very first @@ -177,7 +176,8 @@ This demuxer accepts the following option: @table @option @item safe -If set to 1, reject unsafe file paths. A file path is considered safe if it +If set to 1, reject unsafe file paths and directives. +A file path is considered safe if it does not contain a protocol specification and is relative and all components only contain characters from the portable character set (letters, digits, period, underscore and hyphen) and have no period at the beginning of a @@ -187,9 +187,6 @@ If set to 0, any file name is accepted. The default is 1. --1 is equivalent to 1 if the format was automatically -probed and 0 otherwise. - @item auto_convert If set to 1, try to perform automatic conversions on packet data to make the streams concatenable. diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 74354fce25..3db1693725 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -117,7 +117,7 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile, size_t url_len; int ret; - if (cat->safe > 0 && !safe_filename(filename)) { + if (cat->safe && !safe_filename(filename)) { av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename); FAIL(AVERROR(EPERM)); } @@ -475,8 +475,6 @@ static int concat_read_header(AVFormatContext *avf) av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line); FAIL(AVERROR_INVALIDDATA); } - if (cat->safe < 0) - cat->safe = 1; } else { av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n", line, keyword); @@ -756,7 +754,7 @@ static int concat_seek(AVFormatContext *avf, int stream, static const AVOption options[] = { { "safe", "enable safe mode", - OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, DEC }, + OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC }, { "auto_convert", "automatically convert bitstream format", OFFSET(auto_convert), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC }, { "segment_time_metadata", "output file segment start time and duration as packet metadata", From patchwork Wed Jul 28 12:15:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29083 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp5736576pxb; Wed, 28 Jul 2021 05:15:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnt+JEoKFdUs/qaxmq70MW1hWSbfuFXpE7YGq/SUKysZlX9RsMnOnuxWIMtCnNgBFmzE9L X-Received: by 2002:a17:906:eb4b:: with SMTP id mc11mr2893547ejb.474.1627474545042; Wed, 28 Jul 2021 05:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627474545; cv=none; d=google.com; s=arc-20160816; b=MLuaey8FmBE4Md4kBsZaGfctnoT7j/Iy6LJkYRf7t2S4cySzrNPFpt6ua5P9NELfWU siCG3cbh7Pwt7UC3HhBbmlfltw61mhBWMk12zno5uGsv/v4/+8kV/GTqRbMyKCLCd/hQ Zlf2DXVnHc6d4k44CH0+8JVrnj2qRoIT4DBWNaVtH3GB++B6V86pzVTocuYZHKKsJB5w e42Q3wOQUpDOpmCvDERnU2IwdpyQK7uYfp+L0BLCnu9Z0GxwFViHSZguQYWGWsR/CQwh vyqcPcN6L0V7tIgt1d/O/k28PZqJP1iAK+5nRGcetMhQnZ3XjzDQmBG2yceeY29RTsvs W0rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=WRZFz0NvDLPA3zhnMt0xwd1cYs/XDhmOeY8tJ8RRzlk=; b=wDaeq57fra5zN7WbLVNJNFisfgIIReToJFZvj/fY+Xvo+sSI+7Ij06YfSV4QYI6uSC mmRrrB1hskkSia/tPUqKtVixzx2N+2BNT5VKbonG1No8Da02aGMGBHqpYiIGphkurPNR Xhm0x2Rpxam+bSucgF41YX5NfJyoakmxtnT+4gMiFdwGGtgXHhG8v68DiZ3ryvIVqDhX vyGeGPllzb47wlkaYh//N9TCGlLoFmlZUtis91nxkq9Ozn81eoa32M9fjBkPTULc1pCp ohney3h2+wx10A+CAF/sB7rEgcmMyNAsD7FJlUWVgI6sh9Kl94RxzVED3YFVbK0Wl+01 hQSA== 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 eg26si5947862edb.271.2021.07.28.05.15.44; Wed, 28 Jul 2021 05:15:45 -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; 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 9F67D689EDA; Wed, 28 Jul 2021 15:15:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7263468081D for ; Wed, 28 Jul 2021 15:15:20 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 16SCFJ0i030343 for ; Wed, 28 Jul 2021 14:15:20 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id A8EA0E62AD; Wed, 28 Jul 2021 14:15:19 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Jul 2021 14:15:13 +0200 Message-Id: <20210728121517.533173-2-george@nsup.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210728121517.533173-1-george@nsup.org> References: <20210728121517.533173-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Wed, 28 Jul 2021 14:15:20 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 2/5] lavf/concatdec: support per-file options. 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: hl/PyVKenfdo Signed-off-by: Nicolas George --- doc/demuxers.texi | 4 ++++ libavformat/concatdec.c | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) I intend to refactor the parser some time later. diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 5f18e4551b..eb3351833a 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -151,6 +151,10 @@ Metadata of the packets of the file. The specified metadata will be set for each file packet. You can specify this directive multiple times to add multiple metadata entries. +@item @code{option @var{key} @var{value}} +Option to access, open and probe the file. +Can be present multiple times. + @item @code{stream} Introduce a stream in the virtual file. All subsequent stream-related directives apply to the last introduced diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 3db1693725..0203b1e6dc 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -51,6 +51,7 @@ typedef struct { int64_t inpoint; int64_t outpoint; AVDictionary *metadata; + AVDictionary *options; int nb_streams; } ConcatFile; @@ -329,6 +330,7 @@ static int open_file(AVFormatContext *avf, unsigned fileno) { ConcatContext *cat = avf->priv_data; ConcatFile *file = &cat->files[fileno]; + AVDictionary *options = NULL; int ret; if (cat->avf) @@ -344,12 +346,21 @@ static int open_file(AVFormatContext *avf, unsigned fileno) if ((ret = ff_copy_whiteblacklists(cat->avf, avf)) < 0) return ret; - if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 || + ret = av_dict_copy(&options, file->options, 0); + if (ret < 0) + return ret; + + if ((ret = avformat_open_input(&cat->avf, file->url, NULL, &options)) < 0 || (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) { av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url); avformat_close_input(&cat->avf); return ret; } + if (options) { + av_log(avf, AV_LOG_WARNING, "Unused options for '%s'.\n", file->url); + /* TODO log unused options once we have a proper string API */ + av_dict_free(&options); + } cat->cur_file = file; file->start_time = !fileno ? 0 : cat->files[fileno - 1].start_time + @@ -386,6 +397,7 @@ static int concat_read_close(AVFormatContext *avf) } av_freep(&cat->files[i].streams); av_dict_free(&cat->files[i].metadata); + av_dict_free(&cat->files[i].options); } if (cat->avf) avformat_close_input(&cat->avf); @@ -457,6 +469,29 @@ static int concat_read_header(AVFormatContext *avf) FAIL(AVERROR_INVALIDDATA); } av_freep(&metadata); + } else if (!strcmp(keyword, "option")) { + char *key, *val; + if (cat->safe) { + av_log(avf, AV_LOG_ERROR, "Options not permitted in safe mode.\n"); + FAIL(AVERROR(EPERM)); + } + if (!file) { + av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n", + line, keyword); + FAIL(AVERROR_INVALIDDATA); + } + if (!(key = av_get_token((const char **)&cursor, SPACE_CHARS)) || + !(val = av_get_token((const char **)&cursor, SPACE_CHARS))) { + av_log(avf, AV_LOG_ERROR, "Line %d: key and val required\n", line); + FAIL(AVERROR_INVALIDDATA); + } + ret = av_dict_set(&file->options, key, val, + AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + if (ret < 0) { + av_freep(&key); + av_freep(&val); + FAIL(ret); + } } else if (!strcmp(keyword, "stream")) { if (!avformat_new_stream(avf, NULL)) FAIL(AVERROR(ENOMEM)); From patchwork Wed Jul 28 12:15:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29084 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp5736702pxb; Wed, 28 Jul 2021 05:15:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytF7yrD5fXpryZJy+siksXXDZM5fX79loP24HG6poZPEXTbhDPz7MrnR9WphlMvZtq3zDI X-Received: by 2002:a05:6402:198:: with SMTP id r24mr33892194edv.93.1627474554837; Wed, 28 Jul 2021 05:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627474554; cv=none; d=google.com; s=arc-20160816; b=x55wIolp7QcLas/uZspaAv36KKiSeKM4pNRRQj8m/h8xkZ41sh5PHzGcJhtGoz6ncO 7C3oCHkIClwU2miyjNL2z5ty/SjCbnRGI12/Kzc4ZUwhgZRZku6EoIqdXFqAa10h0nS3 knBBZSEELg5I8dGuTX0ywPjsEmWaKYA7twidmOmvLVCHDTeq8L/07khpVnJiWhbPc2O6 oDOpcJwe99BBU6HWlDIkSo8tycelZcdk5dtivadpbIaA/nYCCe2HbblooJqCPpBw/Iks sT3AhwCV4uIZjNd9dd3mxw9puWfL97JLC6anDYBNFCEOuTU6g1/oQ6MTlo9/pqr2Ue6C soEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=G0NLUL5NWq5v5+1w4PO+joJ6O6bIpqEw0Tq6x5sP+L8=; b=VVmv/Hiq/XGqvIsG9JUo9Xnv/q0y5isM7rZdVEZk/XmQuBJFQhEeeprCbm2BaiANig WLt6yJceTX5iEE5onxpEYsuuberZBLU/WchqHThoasfcyzOLYmj32HnqBSqj95k0HwhB OPAmPLnRkSjXOoc1l57S/JAsoscJdGPSbqzV3sFX4snrhAOYs7kLnExAP2lgaHPj0t7z uLkdWKWKdR0onYfSk+NRejDXkuuKhgJ+2n5ULTcRXPvPBtTrUmWUzfDXYkfEfXqU3u4Z ZVbnMRCaZAcW0OZDF6wofKHCo59tQf+zZmqyuCUZHQPNStK2oXmQGF29V6Wk8qu4xKCe tX+Q== 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 dd13si5047459ejc.88.2021.07.28.05.15.54; Wed, 28 Jul 2021 05:15:54 -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; 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 AE11A68A03A; Wed, 28 Jul 2021 15:15:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26B9F6808E6 for ; Wed, 28 Jul 2021 15:15:21 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 16SCFKHu030348 for ; Wed, 28 Jul 2021 14:15:20 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 5BB88E62AD; Wed, 28 Jul 2021 14:15:20 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Jul 2021 14:15:14 +0200 Message-Id: <20210728121517.533173-3-george@nsup.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210728121517.533173-1-george@nsup.org> References: <20210728121517.533173-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Wed, 28 Jul 2021 14:15:20 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 3/5] tools/dvd2concat: document that -protocol_whitelist is needed. 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: CbXnMU78wWUj Signed-off-by: Nicolas George --- tools/dvd2concat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/dvd2concat b/tools/dvd2concat index 8effee86b9..0280838a6b 100755 --- a/tools/dvd2concat +++ b/tools/dvd2concat @@ -37,7 +37,8 @@ normally contains a directory named B. It must not be encrypted with CSS. I is the output file. It can be used as an input to ffmpeg. -It will require the B<-safe 0> option. +It will require the B<-safe 0> and +B<-protocol_whitelist file,subfile,concat> options. =cut From patchwork Wed Jul 28 12:15:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29086 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp5736822pxb; Wed, 28 Jul 2021 05:16:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUIdVpc0kkyA0TRgK8RYV+0PuCoWknSzkzFpmlqgxpZfYjs5woAA9bOgMH2B96Xw29c6o2 X-Received: by 2002:a17:907:961b:: with SMTP id gb27mr27089337ejc.340.1627474563805; Wed, 28 Jul 2021 05:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627474563; cv=none; d=google.com; s=arc-20160816; b=Y1/ABhSPPdaQi3490/fNZYgPtvyes8IbObdaJUdQLDsuOLIexIN4TMIN2Y7tvuUOxZ g5F0UyQqOocXQu9MmBcIBoAataz3+ibvUUea2Z7C+Nyq167X7bRVacSu+Y/uXYp9HyGp aG3JY/21GPR+palUiDi6MYS7UOkZiuPyRvDCD59H/Wytnh15p9b4XX+TZb3coO6kGwDn arRxfmKjO3Kygj9CpyfihF6m94wRg79X2eMR+/nnwbMibz6t/LNix8wMyhrduHMvRMSe sxrA50H7PouvdeIEwGwXyZL41+nc9kI8v5aaqoCE7qo0RSPIQLnjcLxVboEb41cJCAem Wb/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=F0MUZiJNHuT946jczGgIoxawb8SSomsiloV5S7fwlIk=; b=bz+feu8n+ukdZqBhDUlUzRrnr7GegybMezsYQVYMJhZQpCz980sM37nEiBHV9haX/+ xb6HECcH6K3mnZP2mMyod+rP6PZWHe4dSJsUUpeeVSqt/JZgQQpnVIlNRSB03JXcYc/g WI54oko5jAlOovsNZg4HpDgREybcugo7H1qowGFRlDFW8LWEeedlcF+RmyfGfEpU3Ad1 zWiwtX/stxeHIDWgVoUHleXUAt9TMQvcMUwMdmLHmlmfphAWWcEtNswcN9RR47EMN2yH PLmwnYljuKGq7ebxkim5f0j8qcyX7TWVqlZcyFnPMokeuesTp9j10T14MUdE0cxMXRlX eEUQ== 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 d12si6743451ejj.278.2021.07.28.05.16.03; Wed, 28 Jul 2021 05:16:03 -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; 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 B56AD6808D6; Wed, 28 Jul 2021 15:15:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D8370689CFE for ; Wed, 28 Jul 2021 15:15:21 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 16SCFLLW030360 for ; Wed, 28 Jul 2021 14:15:21 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 18C05E62AD; Wed, 28 Jul 2021 14:15:21 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Jul 2021 14:15:15 +0200 Message-Id: <20210728121517.533173-4-george@nsup.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210728121517.533173-1-george@nsup.org> References: <20210728121517.533173-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Wed, 28 Jul 2021 14:15:21 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 4/5] tools/dvd2concat: use option keyword. 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5l2Pr1sKGEdH subfile,,start,X,end,Y,,: is ugly and will be gone. Signed-off-by: Nicolas George --- tools/dvd2concat | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/dvd2concat b/tools/dvd2concat index 0280838a6b..ef04a87d05 100755 --- a/tools/dvd2concat +++ b/tools/dvd2concat @@ -117,10 +117,12 @@ for my $cell (@{$track->{cell}}) { my $file = @files == 1 ? $files[0] : "concat:" . join("|", @files); my $start = $off << 11; my $end = ($off + $size) << 11; - $file = "subfile,,start,${start},end,${end},,:$file"; my $dur = int(1000 * $cell->{length}); - $concat .= sprintf "\nfile '%s'\nduration %02d:%02d:%02d.%03d\n", $file, + $concat .= "\nfile 'subfile:$file'\n"; + $concat .= "option start $start\n"; + $concat .= "option end $end\n"; + $concat .= sprintf "duration %02d:%02d:%02d.%03d\n", int($dur / 3600000), int($dur / 60000) % 60, int($dur / 1000) % 60, $dur % 1000; } From patchwork Wed Jul 28 12:15:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29087 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp5736992pxb; Wed, 28 Jul 2021 05:16:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGUAaZUI57wb0PZGsUqKFJPH46A9mqcakaS2UczxxyaLMBe2WZI4UGCzfzFOvDt92bSuXu X-Received: by 2002:a05:6402:145a:: with SMTP id d26mr28193918edx.35.1627474574487; Wed, 28 Jul 2021 05:16:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627474574; cv=none; d=google.com; s=arc-20160816; b=XLKNXb/BZIRo6edZWNz5rFP1ogQ/+7rR+4A1VZfVlV0ukXo9YZMUzC99PviR5jy6qR 9NaiDWBWK0n4PLPw0DjRqE2ivyTMi2OkvqmE/Fj8eehVU207v/aJM8KqyRi8J+JRHL7B 02+DtgVMkYUEX4XyH6Ws0J7tOdvRBQGVkc6LzjHZ8duqyeGTvGWrk64aF+s6m9EA6KQi 6ruqgVJKILtaswCO76DngdVvQ4J9y/RsvZnB+DZZyHbzsmbNcx10G9ooX3TrgshF6qIM 832zSjsOBcKSgAfPOPryY2ae6sFXCO39vWe4S/FI4A69vPUSN7OU/1Z4fqzbs2jdABG8 OB9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=JLwYQNpkOK13V3apAdAIfaiS3dX97xGq2m3vdmj5stQ=; b=Xl3R+1AHo9Q2/tl0CDDcRRnykkxR4wpe7zJe+SyVKxxrOxwPZaWS2ce6M0ahI5MyLl KDoEganDFmYAUtZAFlSl13QMr/cyw/jQPXHEyCWltmF0jBjlQBCvx0IhNrQwlyaCOnq9 lGcsyOUQmDYBrtO6hMMmkhfkBJWPADxwnPUfbNbaPIvN9MnlZbb+J0CnL7d94mjdYr0m 2QNXKvCyGAt575Z+nTLG/qefa1qGWnsmeTFSl0CR/T4SUD2SZBG7mMD1/UiTDzJySvUP RFCiWrhH3vI9wU+El8NyK53vQ8BUOJN7P2jDhGe6mr04265t49eHqPNTMDKjN04p00aI 0P4Q== 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 z16si7968960edm.47.2021.07.28.05.16.14; Wed, 28 Jul 2021 05:16:14 -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; 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 A19EC689D21; Wed, 28 Jul 2021 15:15:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9DDD2689EC9 for ; Wed, 28 Jul 2021 15:15:22 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 16SCFL5W030370 for ; Wed, 28 Jul 2021 14:15:22 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id CD75FE62AD; Wed, 28 Jul 2021 14:15:21 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Jul 2021 14:15:16 +0200 Message-Id: <20210728121517.533173-5-george@nsup.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210728121517.533173-1-george@nsup.org> References: <20210728121517.533173-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Wed, 28 Jul 2021 14:15:22 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 5/5] lavf/avio: remove support for proto, , opt, val, , syntax. 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HTA1vAojkOWv It was only still supported for subfile and only used by dvd2concat. Signed-off-by: Nicolas George --- libavformat/avio.c | 34 +--------------------------------- libavformat/dashdec.c | 2 +- libavformat/hls.c | 2 +- 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index 4846bbd8c6..1ce290737a 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -111,39 +111,8 @@ static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up, goto fail; } if (up->priv_data_class) { - char *start; *(const AVClass **)uc->priv_data = up->priv_data_class; av_opt_set_defaults(uc->priv_data); - if (av_strstart(uc->filename, up->name, (const char**)&start) && *start == ',') { - int ret= 0; - char *p= start; - char sep= *++p; - char *key, *val; - p++; - - if (strcmp(up->name, "subfile")) - ret = AVERROR(EINVAL); - - while(ret >= 0 && (key= strchr(p, sep)) && ppriv_data, p, key+1, 0); - if (ret == AVERROR_OPTION_NOT_FOUND) - av_log(uc, AV_LOG_ERROR, "Key '%s' not found.\n", p); - *val= *key= sep; - p= val+1; - } - if(ret<0 || p!=key){ - av_log(uc, AV_LOG_ERROR, "Error parsing options string %s\n", start); - av_freep(&uc->priv_data); - av_freep(&uc); - err = AVERROR(EINVAL); - goto fail; - } - memmove(start, key+1, strlen(key)); - } } } if (int_cb) @@ -255,8 +224,7 @@ static const struct URLProtocol *url_find_protocol(const char *filename) size_t proto_len = strspn(filename, URL_SCHEME_CHARS); int i; - if (filename[proto_len] != ':' && - (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) || + if (filename[proto_len] != ':' || is_dos_path(filename)) strcpy(proto_str, "file"); else diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 11966f905c..1d186802b3 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -435,7 +435,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, ; else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, strlen(proto_name)) && url[7 + strlen(proto_name)] == ':') ; - else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5)) + else if (strcmp(proto_name, "file")) return AVERROR_INVALIDDATA; av_freep(pb); diff --git a/libavformat/hls.c b/libavformat/hls.c index 3c1b80f60c..e4d24b6fe0 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -667,7 +667,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, ; else if (av_strstart(url, "data", NULL) && !strncmp(proto_name, url + 5, strlen(proto_name)) && url[5 + strlen(proto_name)] == ':') ; - else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5)) + else if (strcmp(proto_name, "file")) return AVERROR_INVALIDDATA; av_dict_copy(&tmp, *opts, 0);