From patchwork Sun Sep 4 16:24:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Sabatini X-Patchwork-Id: 414 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp2367877vsd; Sun, 4 Sep 2016 09:43:09 -0700 (PDT) X-Received: by 10.194.2.47 with SMTP id 15mr30753722wjr.133.1473007388965; Sun, 04 Sep 2016 09:43:08 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y199si13581610wmd.97.2016.09.04.09.43.06; Sun, 04 Sep 2016 09:43:08 -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; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2BC42689E26; Sun, 4 Sep 2016 19:42:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 863EC689CCF for ; Sun, 4 Sep 2016 19:42:49 +0300 (EEST) Received: by mail-wm0-f68.google.com with SMTP id w12so399624wmf.1 for ; Sun, 04 Sep 2016 09:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=y+VDHex8kSTqq14czlqKnUemK7/yKnuAJjglA62rw20=; b=hEfw442LpAkFatH6+G+wt5uEJugY9SOoKSLVrsxlrJTYXOEd8389noVZUjPlvKACra wKs2HwGLFAT79rnHcm6N3efX3D/TQVrD+oduOw2IlWj0CWOdwnXIh5HXGQNdM4sRH8U2 +iU9k6yCWkXYFVUJhX9IMvfX1dE+SLv1pIRewEpOxVLJSR5uGGT5WjHWL36KZ2hZsG26 bPi58ewjnpQEpWeKebbOEbGhzUpTVxm6kMs2VGNpE6HrJerymDWTFNlc2Pm/lOYst5h8 dC3xVXjQ6PnwD1UZmXDo/1X6W/aeO3CAbfG4wimQeOjGPuXtaGHZEvj0+Jl79hJ3ria2 LGhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=y+VDHex8kSTqq14czlqKnUemK7/yKnuAJjglA62rw20=; b=OS5H6VRybKfMclzjXDRYoeZH+S5qDtjnx/RYcJmIi4kpjj+LsleN+MKO7BgF6Q2Hio MV4mqlHFjSVfHUDO9K9amSoGc7Jg4Cqzpj+CbQpmE/zpd8igXWfG6upEQ7fmt/m9xLEz 20HZUsBoCQeAk/Gu26M5yGeI2GRu9KLHkgZh6smn5SdqCupxZvvLDQ4Y1CXxV/opji7p W7bZftWChHmu+0IL2AWoBpbeVm2vH5glO7+XCY5TYCoDPuWOJmyffFA4/k2KOKL8Q0Sy NLZPy2vFFUIRjkJYr3wCze6o2gI/YniV2lvnB4UcI7XhiWq9UDzmUcBzf+gMBKdWEwth KkXA== X-Gm-Message-State: AE9vXwMm0GbJT6TCpcWrBB5wsYmgGBdLA/wG5IBIow/GGAszSZWDNhhqKUf3HRTP7j4dmg== X-Received: by 10.194.94.138 with SMTP id dc10mr31164514wjb.40.1473006266122; Sun, 04 Sep 2016 09:24:26 -0700 (PDT) Received: from barisone ([151.56.79.219]) by smtp.gmail.com with ESMTPSA id hk4sm14472201wjb.16.2016.09.04.09.24.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 09:24:25 -0700 (PDT) Received: by barisone (Postfix, from userid 1000) id 5A7DF1A8354; Sun, 4 Sep 2016 18:24:23 +0200 (CEST) From: Stefano Sabatini To: FFmpeg development discussions and patches Date: Sun, 4 Sep 2016 18:24:23 +0200 Message-Id: <1473006263-16027-1-git-send-email-stefasab@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [FFmpeg-devel] [PATCH] ffprobe: add -show_headers_first option 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: Stefano Sabatini MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This is meant to be used for generating output suitable for the ffprobe_default demuxer. --- ffprobe.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/ffprobe.c b/ffprobe.c index 657867d..42a8d8e 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -98,6 +98,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 show_headers_first = 0; static char *print_format; static char *stream_specifier; @@ -2683,6 +2684,26 @@ static int probe_file(WriterContext *wctx, const char *filename) } } + if (show_headers_first && do_show_format) { + ret = show_format(wctx, &ifile); + CHECK_END; + } + + if (show_headers_first && do_show_chapters) { + ret = show_chapters(wctx, &ifile); + CHECK_END; + } + + if (show_headers_first && do_show_streams) { + ret = show_streams(wctx, &ifile); + CHECK_END; + } + + if (show_headers_first && do_show_programs) { + ret = show_programs(wctx, &ifile); + CHECK_END; + } + if (do_read_frames || do_read_packets) { if (do_show_frames && do_show_packets && wctx->writer->flags & WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER) @@ -2699,20 +2720,20 @@ static int probe_file(WriterContext *wctx, const char *filename) CHECK_END; } - if (do_show_programs) { + if (!show_headers_first && do_show_programs) { ret = show_programs(wctx, &ifile); CHECK_END; } - if (do_show_streams) { + if (!show_headers_first && do_show_streams) { ret = show_streams(wctx, &ifile); CHECK_END; } - if (do_show_chapters) { + if (!show_headers_first && do_show_chapters) { ret = show_chapters(wctx, &ifile); CHECK_END; } - if (do_show_format) { + if (!show_headers_first && do_show_format) { ret = show_format(wctx, &ifile); CHECK_END; } @@ -3213,6 +3234,7 @@ static const OptionDef real_options[] = { { "read_intervals", HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default}, "generic catch all option", "" }, { "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"}, + { "show_headers_first", OPT_BOOL, {&show_headers_first}, "show headers before the packets/frames" }, { NULL, }, };