From patchwork Sun Sep 29 09:27:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 15377 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 428164497A5 for ; Sun, 29 Sep 2019 12:28:21 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2EF8D689B45; Sun, 29 Sep 2019 12:28:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 631666899FD for ; Sun, 29 Sep 2019 12:28:14 +0300 (EEST) Received: by mail-pf1-f194.google.com with SMTP id a2so3822517pfo.10 for ; Sun, 29 Sep 2019 02:28:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Zg31++IjLyoHD35kqNj9MU3ss7zQu7ma+LuPz8hl2Bk=; b=g0cyuDT2yUK0mS7QLER6cTdxbnlBXG+BBsoA/u0YquOUKfVyaeg6tBitrreBYPUZbq BylzzQB6QeRzNTjowIw/WS1NXQYvXXFCF1hay0wAuG/w0P2D5lXsq9SIpFVGpzscJzd3 r5j+lIZ0YoR1Yig6s2OgL9x8GL8mJw71StTw2Q1LTtR94VtwX44d9tvmrysqvLqopFhy +NbB+5N0BOAS7ZrU9yvQsK6kHuuudZWbCTW2b5iz6AiCViq5NjNmyyiB/5SPEVZyB+t0 L1fDMavWP3XJR7JZ9p3Q97x2USVRk+Nnuh02Is5fg4cAZcFC2xleQUyvclNwGNf9ulhr K9yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Zg31++IjLyoHD35kqNj9MU3ss7zQu7ma+LuPz8hl2Bk=; b=IVyJRQbHcrTB3c9eiLaDNQG9h3v7FJRO+ZJDe1Y1ngZzBVUiApYsi0qPFk53CxvLZE UwvciUy1zPwYU3Suan+T+tmt6iab5akdMkRsf0/8K8SXU//eJufzgKLLJcXkg+Jygou9 Rx/kazDQm06mpfsR/vUgaFb/j8lIof+sX0s/PEaJIJmun4bSup9XhTTD70IHvj7OpYh3 FgQbFfETLao0IVM123v/FAFfq8+XoxAJiX1ddB+tDRTnaZffoXkzBLu7TDNctxaJu9ua VjEI0LJ9Blv2weSfeNBDWZrSsFVBGzVY1WnqOuCycDoLBW8XH/uC4bJrug3EQ6YKDnRy 3Maw== X-Gm-Message-State: APjAAAVoHYEaIlrVRN7nRMPn15cdtphKzPqUMvMn0VUHwsodjiRnHGe0 AOJkkOssfsrPTdsGo30U2S789mQh X-Google-Smtp-Source: APXvYqySjFxZbWxz5KYSk6LWgu6h7VbPXLXzZD6+b/A9frl733AFBEn5dR1olr0QU9tsQ32hek5/cA== X-Received: by 2002:aa7:84d5:: with SMTP id x21mr14546980pfn.253.1569749292723; Sun, 29 Sep 2019 02:28:12 -0700 (PDT) Received: from localhost.localdomain ([47.90.47.25]) by smtp.gmail.com with ESMTPSA id i132sm2585106pgd.47.2019.09.29.02.28.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Sep 2019 02:28:12 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Sun, 29 Sep 2019 17:27:54 +0800 Message-Id: <1569749274-13151-6-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1569749274-13151-1-git-send-email-mypopydev@gmail.com> References: <1569749274-13151-1-git-send-email-mypopydev@gmail.com> Subject: [FFmpeg-devel] [PATCH V2 5/5] lavf/utils: support duration estimate method dump 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: Jun Zhao MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Jun Zhao add new function duration_estimate_name to dump duration estimate method, it's will help to debug some duration issue. Signed-off-by: Jun Zhao --- libavformat/utils.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 112d19b..60f0229 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2934,6 +2934,18 @@ skip_duration_calc: } } +/* 1:1 map to AVDurationEstimationMethod */ +static const char *duration_name[] = { + [AVFMT_DURATION_FROM_PTS] = "pts", + [AVFMT_DURATION_FROM_STREAM] = "stream", + [AVFMT_DURATION_FROM_BITRATE] = "bit rate", +}; + +static const char *duration_estimate_name(enum AVDurationEstimationMethod method) +{ + return duration_name[method]; +} + static void estimate_timings(AVFormatContext *ic, int64_t old_offset) { int64_t file_size; @@ -2979,9 +2991,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) (double) st->duration * av_q2d(st->time_base)); } av_log(ic, AV_LOG_TRACE, - "format: start_time: %0.3f duration: %0.3f bitrate=%"PRId64" kb/s\n", + "format: start_time: %0.3f duration: %0.3f (estimate from %s) bitrate=%"PRId64" kb/s\n", (double) ic->start_time / AV_TIME_BASE, (double) ic->duration / AV_TIME_BASE, + duration_estimate_name(ic->duration_estimation_method), (int64_t)ic->bit_rate / 1000); } }