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 E3DA143E94 for ; Thu, 15 Sep 2022 18:06:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CC52A68BBD7; Thu, 15 Sep 2022 21:06:41 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D52E668BA8B for ; Thu, 15 Sep 2022 21:06:34 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id E990BE7C51 for ; Thu, 15 Sep 2022 20:06:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fgOjieEGT2g3 for ; Thu, 15 Sep 2022 20:06:30 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 99D17E7B45 for ; Thu, 15 Sep 2022 20:06:30 +0200 (CEST) Date: Thu, 15 Sep 2022 20:06:30 +0200 (CEST) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20220910164259.213742-1-leo.izen@gmail.com> Message-ID: <617ab599-6476-c0a8-fec0-2468d3c82a6@passwd.hu> References: <20220910164259.213742-1-leo.izen@gmail.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] fftools: allow decoders to set AVFrame 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sat, 10 Sep 2022, Leo Izen wrote: > This patch allows decoders to set AVFrame->time_base, which > determines the units that AVFrame->pts will use. Currently > no decoders do this, but it will allow it in the future. This is patch is wrong, because it implies that decoders can output frames in time base different to stream time base. They can't, because that would be a breaking change. AVFrame->time_base was not introduced for that use case. Regards, Marton > --- > fftools/ffmpeg.c | 3 ++- > fftools/ffplay.c | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 0e1477299d..e3ea7a6c29 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -2274,7 +2274,8 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_ > } > > if(best_effort_timestamp != AV_NOPTS_VALUE) { > - int64_t ts = av_rescale_q(decoded_frame->pts = best_effort_timestamp, ist->st->time_base, AV_TIME_BASE_Q); > + int64_t ts = av_rescale_q(decoded_frame->pts = best_effort_timestamp, > + decoded_frame->time_base.num ? decoded_frame->time_base : ist->st->time_base, AV_TIME_BASE_Q); > > if (ts != AV_NOPTS_VALUE) > ist->next_pts = ist->pts = ts; > diff --git a/fftools/ffplay.c b/fftools/ffplay.c > index 9242047f5c..986b0831ac 100644 > --- a/fftools/ffplay.c > +++ b/fftools/ffplay.c > @@ -1771,7 +1771,7 @@ static int get_video_frame(VideoState *is, AVFrame *frame) > double dpts = NAN; > > if (frame->pts != AV_NOPTS_VALUE) > - dpts = av_q2d(is->video_st->time_base) * frame->pts; > + dpts = av_q2d(frame->time_base.num ? frame->time_base : is->video_st->time_base) * frame->pts; > > frame->sample_aspect_ratio = av_guess_sample_aspect_ratio(is->ic, is->video_st, frame); > > -- > 2.37.3 > > _______________________________________________ > 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". > _______________________________________________ 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".