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 BEA8844081 for ; Thu, 25 Aug 2022 10:23:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5244268B9DD; Thu, 25 Aug 2022 13:23:26 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 35A1968B308 for ; Thu, 25 Aug 2022 13:23:20 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id CA61B240D0E for ; Thu, 25 Aug 2022 12:23:19 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id aS28Qnq54JCW for ; Thu, 25 Aug 2022 12:23:19 +0200 (CEST) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (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 "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 37E10240D03 for ; Thu, 25 Aug 2022 12:23:19 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 48DF21601B2; Thu, 25 Aug 2022 12:23:19 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: =?utf-8?q?=3CDB6PR0101MB2214D3173750934728DC5AEC8F739=40DB6PR01?= =?utf-8?q?01MB2214=2Eeurprd01=2Eprod=2Eexchangelabs=2Ecom=3E?= References: <20220824084318.333-1-anton@khirnov.net> <20220824084318.333-16-anton@khirnov.net> =?utf-8?q?=3CDB6PR0101MB2214D3173?= =?utf-8?q?750934728DC5AEC8F739=40DB6PR0101MB2214=2Eeurprd01=2Eprod=2Eexchan?= =?utf-8?q?gelabs=2Ecom=3E?= Mail-Followup-To: FFmpeg development discussions and patches Date: Thu, 25 Aug 2022 12:23:19 +0200 Message-ID: <166142299926.3205.1139359813403916876@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 16/18] lavf/dv: set audio bitrate only at stream creation 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: Quoting Andreas Rheinhardt (2022-08-24 16:33:22) > Anton Khirnov: > > Demuxers are not supposed to update AVCodecParameters after the stream > > was seen by the caller. This value is not important enough to support > > dynamic updates for. > > --- > > libavformat/dv.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/dv.c b/libavformat/dv.c > > index f65c2d596f..9c8b0a262c 100644 > > --- a/libavformat/dv.c > > +++ b/libavformat/dv.c > > @@ -280,6 +280,7 @@ static int dv_extract_audio_info(DVDemuxContext *c, const uint8_t *frame) > > c->ast[i]->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; > > c->ast[i]->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; > > c->ast[i]->start_time = 0; > > + c->ast[i]->codecpar->bit_rate = 2 * dv_audio_frequency[freq] * 16; > > > > c->audio_pkt[i].size = 0; > > c->audio_pkt[i].data = c->audio_buf[i]; > > @@ -290,7 +291,6 @@ static int dv_extract_audio_info(DVDemuxContext *c, const uint8_t *frame) > > c->audio_pkt[i].pos = -1; > > } > > c->ast[i]->codecpar->sample_rate = dv_audio_frequency[freq]; > > - c->ast[i]->codecpar->bit_rate = 2 * dv_audio_frequency[freq] * 16; > > } > > c->ach = ach; > > > > FYI: dv_extract_video_info() also sets bit_rate (and avg_frame_rate and > sample_aspect_ratio) on every packet. I know, it's just that I already spent way more time on this than I intended, given how nobody really cares about DV (so much of the code is blamed directly to original commits from 2003). And while dropping bitrate is rather uncontroversial, since it's informational only, the framerate and SAR might actually be used for presentation, so handling them requires more care. I've considered using AVStream.event_flags for signalling updated values to the user, but then it might become tricky to synchronize the values seen by the user with the packets returned from the demuxer (given the presence of parsers). -- Anton Khirnov _______________________________________________ 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".