From patchwork Sat Feb 11 07:44:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 40364 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp1975055pzk; Fri, 10 Feb 2023 23:44:37 -0800 (PST) X-Google-Smtp-Source: AK7set965u4KuwQ7gjrl24sUFXJiyE8ALdTTdWc2gI+B/uk1Xlf9iWdXDnJi7fKFsBo/jhhRpylm X-Received: by 2002:a17:906:9c93:b0:8af:3fef:52c9 with SMTP id fj19-20020a1709069c9300b008af3fef52c9mr7602428ejc.22.1676101476886; Fri, 10 Feb 2023 23:44:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676101476; cv=none; d=google.com; s=arc-20160816; b=A6ErpQrFCffklSn8KQJK/DKQPumJZNY1hjbIxWNNZ3ahRI/heQ1CxV0/r0lDio/+Bh osaHJbUIFIm5bm1PZXaAbNpon56UJ13/wiVa1Jvnv54gzH/eBuWVTdhNosFQeU8euoB5 LWetW4CR0AXgn7prTvkjo7GyT4RNb1SnG+Xz2XcVI8RUnQ7vIgzA62tsDOHh+kX3UN13 sP8RMtECKa2DbsliPE7vh1fW6FVDX50gGMiFbNm7dSOM1SUDHvxtIYg4A7Nyht210uly ygGSkW9vjZ1FK5b8ZnJl+RQ+Dt16raG5ygG+LL9Cr5KUOX1m7KjtaO3/eyinAoDLD/Q7 cKlg== 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=gJghiJUVvcxo5WT53BgWZD8dbrWQw2EgXwXEFuwQWbI=; b=P5AA6sWy0Mhg8+hraJ9RppQjSrhiRrtLBmSHZrDGnS+BF2+xSk2LMVavrFHjRxQhOS kpdko4+jJV7DicOTLBDueR7olb/W3OgCg+FrxADSBIPF0C/aGk8JAhj2rMgY+K0aRpXW +++aTetVJG8WtFRDsLW0sKKt68rORIs5SyTyqeryI06Oy/KGTSPekMD1fcPLfr4sPK2e MYzdKTSK12T0XBkLKwmhLS3zLtMpAmhGTPOiA4mCA2iGO2rPTFMf4nB32QDeIlje67tW 6JMiqahP3SSOOb/kQZ6K1Yf9yd7/IB4Lfo81SPBOjSK4PYnd1oBfF9DztC5FbbKnx7so Pfaw== 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 10-20020a17090602ca00b00855da26bccasi9223346ejk.974.2023.02.10.23.44.36; Fri, 10 Feb 2023 23:44:36 -0800 (PST) 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 B15386804FB; Sat, 11 Feb 2023 09:44:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2034668A360 for ; Sat, 11 Feb 2023 09:44:26 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id B2C2B2405B5 for ; Sat, 11 Feb 2023 08:44:25 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id q7NdYhBHoymw for ; Sat, 11 Feb 2023 08:44:24 +0100 (CET) Received: from libav.khirnov.net (unknown [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id E23472404F5 for ; Sat, 11 Feb 2023 08:44:24 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id B8C1F3A0567 for ; Sat, 11 Feb 2023 08:44:16 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 Feb 2023 08:44:12 +0100 Message-Id: <20230211074412.29495-5-anton@khirnov.net> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230211074412.29495-1-anton@khirnov.net> References: <20230211074412.29495-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/5] fftools/ffmpeg: move ts_scale to DemuxStream 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: zJtJzLJiP856 It is not needed outside of ffmpeg_demux. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_demux.c | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 401f424f79..4d4433f5ba 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -385,7 +385,6 @@ typedef struct InputStream { int64_t nb_samples; /* number of samples in the last decoded audio frame before looping */ - double ts_scale; int saw_first_ts; AVDictionary *decoder_opts; AVRational framerate; /* framerate forced with -r */ diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index f2a1391a29..2033c1de54 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -58,6 +58,8 @@ typedef struct DemuxStream { // name used for logging char log_name[32]; + double ts_scale; + int64_t min_pts; /* pts with the smallest value in a current stream */ int64_t max_pts; /* pts with the higher value in a current stream */ } DemuxStream; @@ -225,9 +227,9 @@ static void ts_fixup(Demuxer *d, AVPacket *pkt, int *repeat_pict) pkt->pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt->pts != AV_NOPTS_VALUE) - pkt->pts *= ist->ts_scale; + pkt->pts *= ds->ts_scale; if (pkt->dts != AV_NOPTS_VALUE) - pkt->dts *= ist->ts_scale; + pkt->dts *= ds->ts_scale; duration = av_rescale_q(d->duration, d->time_base, ist->st->time_base); if (pkt->pts != AV_NOPTS_VALUE) { @@ -670,8 +672,8 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d) ds->min_pts = INT64_MAX; ds->max_pts = INT64_MIN; - ist->ts_scale = 1.0; - MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st); + ds->ts_scale = 1.0; + MATCH_PER_STREAM_OPT(ts_scale, dbl, ds->ts_scale, ic, st); ist->autorotate = 1; MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);