From patchwork Fri Jun 26 13:15:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 20629 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 50C2744BE08 for ; Fri, 26 Jun 2020 16:42:26 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2131468AE45; Fri, 26 Jun 2020 16:42:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7BBE0689ED4 for ; Fri, 26 Jun 2020 16:42:19 +0300 (EEST) Received: by mail-lf1-f65.google.com with SMTP id d7so5163543lfi.12 for ; Fri, 26 Jun 2020 06:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=j2bXbxg2R54rac5tEcnlQlkWLvsgrNVZmMGUC6/jyf4=; b=dHy0tc311AMIDoLMWAHrmqDeHhNAZXzRo6WUQ2ieaunuokmlHSjou08qFOfv1CWKrc IBYWTKvEza4z8p2jI/7WJnQt65IPmSdWVEmYLyjtbcP/AAMCuLpgzTBsN26mXqe8rLT/ +fBFuho1gSfiRNKiVi6thQ9uc8K+ZHUIN4zuCQGvCo9+luVeRFDt1rL/XZHUbikXcs64 guJdfXqEOHL6ugo5sNlC3++4F//dNeCmmIETBLuG9VIuTN03HNO9144TxEHtKKbWetm1 qVm56px728fwFr4ysmaRdZ8C+yJ94zUJP+DBrs3JssbNSJ/UOIFyJwMWtdgDdx8jmgpm OCuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=j2bXbxg2R54rac5tEcnlQlkWLvsgrNVZmMGUC6/jyf4=; b=JUCSUfl0UZ987wRisY5JNZMoZbDq4As049ZLFpjfXaLv2uk2uTJ/tWPxM80QbqGjc/ +7zowJE5S/4dOPlIDT/mGJaWQRi9+JEIPBPpVMrrWqEP+4Stp00WeAthMvGwu3sci/vD NZ160GFQG0pWo0alZ7Yk8fWmH5cN94P8YLyY3nYQylaIvRjYLMvSoR5Zop1dOXhwre/R IAXMGVGB4/sh8x1udXqBcBPcVjyoAFlx0TE8nPQF00MTLJHsMn/X+GzbSk+QaVOjbO0a rL9eiIpaGoe96HYuIY/1Pom+qrDXafibah5RhlWtyaewFHR0/nbEng4waDz21O3qZnyn B0zQ== X-Gm-Message-State: AOAM530C+TO5vQSqdtA6UMJqAQjtdyxoBWFACW0XoBG9kOvVC+RzaBrx UkLmEOchGFkANu+rF/UqtxG7Z5HB X-Google-Smtp-Source: ABdhPJwc6YwL4jYJBhdKm1K6yU9HYI+i81ylN1nosL05YQjQFjYUcQlJBW0ufgkUqjOdo4joppAIpQ== X-Received: by 2002:adf:ee0f:: with SMTP id y15mr3731505wrn.76.1593177311548; Fri, 26 Jun 2020 06:15:11 -0700 (PDT) Received: from localhost.localdomain ([82.129.83.65]) by smtp.gmail.com with ESMTPSA id v66sm18146484wme.13.2020.06.26.06.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 06:15:11 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Jun 2020 14:15:00 +0100 Message-Id: <20200626131500.526716-1-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.27.0.rc2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] ffprobe: Add option to allow unknown format private AVOptions 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" This useful, because by ffprobe's very nature, you use it to probe a file and find out what it is. Requiring every format private option to be known to the demuxer forces one to run ffprobe twice, if one wants to use ffprobe in a generic way. For example, say one wants to probe all user-uploaded files, while also ignoring edit lists for any MP4s that are uploaded. Currently, you'd have to run ffprobe twice: once to identify the format, and once again to actually probe the metadata you want. After this patch, you could set -ignore_editlist 1 on every call and only probe once. Signed-off-by: Derek Buitenhuis --- fftools/ffprobe.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 5515e1b31b..cf66e5b0a2 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -115,6 +115,7 @@ static int use_value_prefix = 0; static int use_byte_value_binary_prefix = 0; static int use_value_sexagesimal_format = 0; static int show_private_data = 1; +static int allow_unknown_format_opts = 0; static char *print_format; static char *stream_specifier; @@ -2880,8 +2881,12 @@ static int open_input_file(InputFile *ifile, const char *filename, if (scan_all_pmts_set) av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE); if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { - av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); - return AVERROR_OPTION_NOT_FOUND; + if (allow_unknown_format_opts) { + av_log(NULL, AV_LOG_WARNING, "Option %s skipped - not known to demuxer.\n", t->key); + } else { + av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); + return AVERROR_OPTION_NOT_FOUND; + } } if (find_stream_info) { @@ -3573,6 +3578,8 @@ static const OptionDef real_options[] = { { "print_filename", HAS_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"}, { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info }, "read and decode the streams to fill missing information with heuristics" }, + { "allow_unknown_format_opts", OPT_BOOL, { &allow_unknown_format_opts }, + "allow unknown format options to be set without failing" }, { NULL, }, };