From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5DC3A42112 for ; Thu, 28 Apr 2022 13:58:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 916FB68B419; Thu, 28 Apr 2022 16:58:26 +0300 (EEST) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 60F4D68B410 for ; Thu, 28 Apr 2022 16:58:20 +0300 (EEST) Received: by mail-lf1-f45.google.com with SMTP id w19so8759556lfu.11 for ; Thu, 28 Apr 2022 06:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=MlgpXcfxKoXxpZ64TvRQZJ9806QvfbYY0tOQ69v3QFg=; b=jjWw1LxgkINmeSgjqCZ8P7urSYItY4yJw/DvZm8YW7ZTcnQq3RbaKIgAWogniBsIgv ACbH0Tq39F1B+ROZrBAAAqw1fyDYTW1tvASxbLnQkoEz2MW1pD/ui3oprxSGHCCchd+7 aveYGpzj8Nap8UI5gwaaMAaNHrKPpR1TW49EP0mLSABm22K1DPktBhU1Mo5UTEHkKtjU HIrRfl7f86tUcyfVqK707HfWx/9MER9Ox0kXxec8nvN8QiscIKO9hH857mxk1vZQAWhe mSiksIlCPTmXLSfRwftyg2D9XosPo7qgcfk+ws49p9TMBj550fUxAMNZHbYC9p94kv1d pv/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=MlgpXcfxKoXxpZ64TvRQZJ9806QvfbYY0tOQ69v3QFg=; b=y/1RHfOOj1HEMl0u8mbouOUHic9azLIDbhiFLqkEPcMSw4tuysddPljX1jkj2VFcRz 0EGAswyHXtKcrf1Wy5fLVbyOThk0HsIeg/RJTxJKhyLWHkxI2GSNEpxDeB4t6bQhorT7 nwer+MTyDdS37c2uaOuERrr8mKVMh6ieR9I+drnpYF2S8tpR0Lo2e8G07z9rm0vGBOUO eaGDlXK8z/+ALCPiwdj7T1nPZlR2/pcYH9+lTCspmUwpxHnGDDl/KJ/iCV0TiTikb0F0 ThoF1s8ASu4fhnRLhATFHU42VKjZmgwVkSXs8pirVm8Hya7XsGh+fMu88V6jWPtbzQaT ZCww== X-Gm-Message-State: AOAM533K1lWrFzwRBGCO0nml3tczcAe67zhyQuY9FjCHDzti/scH1DA8 FBPYqK1W1mZCK85N5gr6rQP1mwmJjXuCqpl/elA416STGpBfwA== X-Google-Smtp-Source: ABdhPJwa9x/7nNiWKrnj4gNfGsNHViJ/rlCMZ1NrXWGqFP+Z7pl8+fo3aFDVgsM0GVcZlLmwbyXA5HCMsbqKxCoop1M= X-Received: by 2002:ac2:424e:0:b0:46b:9249:8ce3 with SMTP id m14-20020ac2424e000000b0046b92498ce3mr23970196lfl.282.1651154299725; Thu, 28 Apr 2022 06:58:19 -0700 (PDT) MIME-Version: 1.0 From: Andreas Unterweger Date: Thu, 28 Apr 2022 15:58:09 +0200 Message-ID: To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v6 2/4] doc/examples/transcode_aac: Set decoder packet timebase 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Previously, the default timebase caused two warnings during decoding about not being able to update timestamps for skipped and discarded samples, respectively. Signed-off-by: Andreas Unterweger --- doc/examples/transcode_aac.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index c9b93f6439..52548f080d 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -62,6 +62,7 @@ static int open_input_file(const char *filename, { AVCodecContext *avctx; const AVCodec *input_codec; + const AVStream *stream; int error; /* Open the input file to read from it. */ @@ -88,9 +89,11 @@ static int open_input_file(const char *filename, avformat_close_input(input_format_context); return AVERROR_EXIT; } + + stream = (*input_format_context)->streams[0]; /* Find a decoder for the audio stream. */ - if (!(input_codec = avcodec_find_decoder((*input_format_context)->streams[0]->codecpar->codec_id))) { + if (!(input_codec = avcodec_find_decoder(stream->codecpar->codec_id))) { fprintf(stderr, "Could not find input codec\n"); avformat_close_input(input_format_context); return AVERROR_EXIT; @@ -105,7 +108,7 @@ static int open_input_file(const char *filename, } /* Initialize the stream parameters with demuxer information. */ - error = avcodec_parameters_to_context(avctx, (*input_format_context)->streams[0]->codecpar); + error = avcodec_parameters_to_context(avctx, stream->codecpar); if (error < 0) { avformat_close_input(input_format_context); avcodec_free_context(&avctx); @@ -120,6 +123,9 @@ static int open_input_file(const char *filename, avformat_close_input(input_format_context); return error; } + + /* Set the packet timebase for the decoder. */ + avctx->pkt_timebase = stream->time_base; /* Save the decoder context for easier access later. */ *input_codec_context = avctx; -- 2.30.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".