From patchwork Wed Jul 1 15:34:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 20762 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 9686A44AE63 for ; Wed, 1 Jul 2020 20:21:04 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 76A9A6882C9; Wed, 1 Jul 2020 20:21:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EEDA16882C9 for ; Wed, 1 Jul 2020 20:20:57 +0300 (EEST) Received: by mail-ej1-f65.google.com with SMTP id n26so11821188ejx.0 for ; Wed, 01 Jul 2020 10:20:57 -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=uXTtNh9Ia22VIFwfwXAUmPbJua8vKPuVSvtsc9fWE8w=; b=CnKbO78msIbA5TN1F6ECG32rOS0HU5rSbflD2N3QOcyhFoJ9Vd2q0lyt64XxIwsFCz uoaRytD3M3tnQa9oYFNUQjWG6Hk8tL577wVWkdEaCACcAZRQySSPueEHcVu6ib3CzNje /5XSmiVVG8J7ups2LE56LzTpyyfTMZT//A4xnBRxk+zrwXMp6priJm2LQm2GfVsKH8g1 NnvHcQWroy4AAT8XbQaRujdL5E5fHRSYUbbGEBPqAEec2oNHghCtjt68dSucHH5CuPCx eq2NfZY5cKvI0uSYyNzCckRwcOWdXoMqUtVx3jT6WbgGvR7IcoPlC4u8Mp8zzWk80FhN oF8A== 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=uXTtNh9Ia22VIFwfwXAUmPbJua8vKPuVSvtsc9fWE8w=; b=cwl41aWV+NIupO+JCt4NCIwYuz/nHip2FSWkf4hGFMRf1ZDgfKJc1nG32FyY6iqzJC uVcZ242ZmPFVa8U8FbZJDfU6oXH4S9aJfSdcNnkWAyraMkAOs7ExDErkkTIPhy2eFkVn MHvr0+NtKMRFzB2UaOVvmkNjf04gfwRqBemjUW2/39xmBO6pKrWcLvSZRneEZbwo+nt7 pXVnOpYiXJ+J+LlbFkkqC1GMYrSRCEyspITPTANO6JHbBDRp0/ZPyIDBE9PslKlv/4wU Ui45J0cXBf8DtNpWhEOWV+7cEHaUU4CMPFwHxRME9oIA+EHe5Gjk2CaGpxz4SQoOwZN5 gCJQ== X-Gm-Message-State: AOAM532YseyNytDK7nh+D9PPhqbd3hfsGizkikJlyvARVz4ZvAqJ5s+S uDg9GPiY9rv1AqwbduJfwnzGWRAH X-Google-Smtp-Source: ABdhPJxuztoA41KLbvGTKuwuKly9M43+mL3OiwdWapJPlMW0BqkF4sAfm+HHgCZwdf40CLqwEG59yw== X-Received: by 2002:a5d:44d1:: with SMTP id z17mr26877821wrr.259.1593617685028; Wed, 01 Jul 2020 08:34:45 -0700 (PDT) Received: from localhost.localdomain ([82.129.83.65]) by smtp.gmail.com with ESMTPSA id t15sm7702912wmj.14.2020.07.01.08.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 08:34:44 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Wed, 1 Jul 2020 16:34:32 +0100 Message-Id: <20200701153432.762460-1-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.27.0.rc2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] ffprobe: 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 --- It now iterates over the missing keys as Marton requested. --- fftools/ffprobe.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 5515e1b31b..d4e494f11f 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2854,7 +2854,7 @@ static int open_input_file(InputFile *ifile, const char *filename, { int err, i; AVFormatContext *fmt_ctx = NULL; - AVDictionaryEntry *t; + AVDictionaryEntry *t = NULL; int scan_all_pmts_set = 0; fmt_ctx = avformat_alloc_context(); @@ -2879,10 +2879,8 @@ static int open_input_file(InputFile *ifile, const char *filename, ifile->fmt_ctx = fmt_ctx; 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; - } + while ((t = av_dict_get(format_opts, "", t, AV_DICT_IGNORE_SUFFIX))) + av_log(NULL, AV_LOG_WARNING, "Option %s skipped - not known to demuxer.\n", t->key); if (find_stream_info) { AVDictionary **opts = setup_find_stream_info_opts(fmt_ctx, codec_opts);