From patchwork Wed May 31 15:32:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41930 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c51c:b0:10c:5e6f:955f with SMTP id gm28csp3356916pzb; Wed, 31 May 2023 08:32:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Rp7cdasmvs+yiqKTRhJJiDvMBYirdM8YQksiL+qa83XXqi9HDA6ku0v4OKHbnjy0OlK1R X-Received: by 2002:ac2:47f8:0:b0:4ed:c5a4:28dc with SMTP id b24-20020ac247f8000000b004edc5a428dcmr2686098lfp.38.1685547142298; Wed, 31 May 2023 08:32:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685547142; cv=none; d=google.com; s=arc-20160816; b=ujXMz7JZ5yZ00of1+5sL0osa/j8Rzqm6yEUIjUPU5/CsbG/DLy3XGUOsEpkaELgjuB frKa2ux6VLLTcxkD5R9TAxiiEY8tUsfw2+jbRRK7K7YNOv50cmcllxqXLYFdpH+e3kFZ z7WaANvriP7DXudSiXnU+CvMTlPa/jinLh8TP6JruE7ro3LSTSCMJGB+EiPQIL5nG2qW EWPBIW/3saM4djfd44hSxjwRXTTV06Nc0MIKkzGBUQLh8u3QTmiH2TDAWWfgmIDR6yUI hgS9v8tnSQMJzpPc/BNO7Ordsj6xoGBOOnBE5fy8Ql8zd1Ov6OoX3kQilgKx+epyHc7S t5ww== 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=kq+KgDeXsJnINt4lfuRuNOW8uGis/8y8CxyPQUWAl4o=; b=DdAP9HKorJhz4Lv2pbfFxELepzeRggbAwN98of8TWH+jUCNzJuBl+leVPAUmYNUedO d0diFzeJM/9xXRnb7LuaPxK9Qrxe+kCAgLHwMpCd1eCg7tDYRqoqcSoJJy3exJKpZ3m6 mHen5pfqAUldtwb4x5Jc2OmkJYCYhnn1Fw5V24Tgq1Lg1Zan49BtjZNqim1igF/b9zlK ves0oqy0se/10HZZsy/G+A0WX+X3+nggvg47ye7TbmPFMkTeGQC8ELzKygqLqUI4tfmI RkEnPSjqoJlmhKixeHA8napH8sfsy/dLcwLiu1yt2BJvkW1AgECwCALi2rZ353amOqXi AAqQ== 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 m3-20020aa7d343000000b00514bba0cd8bsi1283130edr.45.2023.05.31.08.32.21; Wed, 31 May 2023 08:32:22 -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; 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 D9DFC68C25C; Wed, 31 May 2023 18:32:17 +0300 (EEST) 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 D819268C1D5 for ; Wed, 31 May 2023 18:32:10 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 52C6E2404F5 for ; Wed, 31 May 2023 17:32:10 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id nq7wOHcMpdJz for ; Wed, 31 May 2023 17:32:09 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [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 A003A2404EC for ; Wed, 31 May 2023 17:32:09 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 5B7203A03F3 for ; Wed, 31 May 2023 17:32:09 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 31 May 2023 17:32:04 +0200 Message-Id: <20230531153205.24424-2-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230531153205.24424-1-anton@khirnov.net> References: <20230531153205.24424-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] doc/examples/transcode: stop using decoder's AVCodecContext.time_base 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: PUAF79/GuCTs The contents of this field are not defined for decoding. Use pkt_timebase, which is the timebase of demuxed packets. Drop a tautological av_packet_rescale_ts() call, as the stream and decoder timebases are the same. --- doc/examples/transcode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c index 7110816fe6..2e1491f432 100644 --- a/doc/examples/transcode.c +++ b/doc/examples/transcode.c @@ -269,7 +269,7 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, snprintf(args, sizeof(args), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt, - dec_ctx->time_base.num, dec_ctx->time_base.den, + dec_ctx->pkt_timebase.num, dec_ctx->pkt_timebase.den, dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den); @@ -309,7 +309,7 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx, av_channel_layout_describe(&dec_ctx->ch_layout, buf, sizeof(buf)); snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=%s", - dec_ctx->time_base.num, dec_ctx->time_base.den, dec_ctx->sample_rate, + dec_ctx->pkt_timebase.num, dec_ctx->pkt_timebase.den, dec_ctx->sample_rate, av_get_sample_fmt_name(dec_ctx->sample_fmt), buf); ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in", @@ -547,9 +547,6 @@ int main(int argc, char **argv) av_log(NULL, AV_LOG_DEBUG, "Going to reencode&filter the frame\n"); - av_packet_rescale_ts(packet, - ifmt_ctx->streams[stream_index]->time_base, - stream->dec_ctx->time_base); ret = avcodec_send_packet(stream->dec_ctx, packet); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Decoding failed\n");