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 207C5484D3 for ; Tue, 5 Mar 2024 10:00:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 42AC368C978; Tue, 5 Mar 2024 12:00:09 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6FEBF68BE58 for ; Tue, 5 Mar 2024 12:00:03 +0200 (EET) Authentication-Results: mail0.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=ZlsTkfyJ; dkim-atps=neutral Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 2F2DA24048D for ; Tue, 5 Mar 2024 11:00:03 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id l4GPOYJEecTC for ; Tue, 5 Mar 2024 11:00:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1709632802; bh=zjYNqlQPQDxPdIkQL2/0KrxZYMlbjv6qsMy0R/7rHXs=; h=Subject:From:To:In-Reply-To:References:Date:From; b=ZlsTkfyJ+oF7SFq/gb5sB41p5HGx36O+yhxnd6yW1AVf+ibNn8AO5v8VjnHWELMKm Y++Bp0z6/Fj9SrVZGw2MD4pP8IWIptoJPAGn1xuoB4p3y0gBuVHbqhC/kN98l4misC 8VuRAMYowGLls1J7Nqc4zfbqZFqSmB3q1uTUUKoagS7Q469wN5EXe1DfVLivH2XlwP ifW9PIslZh8Ax017LRRBTYO36Y2b/Ixuz2485L0eX6tvomcZXMzVDVzDuv3OWLezpT Fw816c2IcO7a6EIxiQMTSJ9EN3lmAzGbriglKL4YAhKJz9XGoOWaaSN78l+YzbVaQd qy+d1F085oBww== 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 7D364240177 for ; Tue, 5 Mar 2024 11:00:02 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id 596281601B9; Tue, 5 Mar 2024 11:00:02 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: References: <20240304130657.30631-1-anton@khirnov.net> <20240304130657.30631-23-anton@khirnov.net> Mail-Followup-To: FFmpeg development discussions and patches Date: Tue, 05 Mar 2024 11:00:02 +0100 Message-ID: <170963280234.29002.12316451033069413004@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 23/29] avcodec/mpeg12dec: use ff_frame_new_side_data 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 (2024-03-04 14:36:09) > Anton Khirnov: > > From: Niklas Haas > > > > For consistency, even though this cannot be overriden at the packet > > level. > > --- > > libavcodec/mpeg12dec.c | 18 ++++++++++-------- > > 1 file changed, 10 insertions(+), 8 deletions(-) > > > > diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c > > index 3a2f17e508..aa116336dd 100644 > > --- a/libavcodec/mpeg12dec.c > > +++ b/libavcodec/mpeg12dec.c > > @@ -2531,15 +2531,17 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture, > > > > if (s->timecode_frame_start != -1 && *got_output) { > > char tcbuf[AV_TIMECODE_STR_SIZE]; > > - AVFrameSideData *tcside = av_frame_new_side_data(picture, > > - AV_FRAME_DATA_GOP_TIMECODE, > > - sizeof(int64_t)); > > - if (!tcside) > > - return AVERROR(ENOMEM); > > - memcpy(tcside->data, &s->timecode_frame_start, sizeof(int64_t)); > > + AVFrameSideData *tcside; > > + ret = ff_frame_new_side_data(avctx, picture, AV_FRAME_DATA_GOP_TIMECODE, > > + sizeof(int64_t), &tcside); > > + if (ret < 0) > > + return ret; > > + if (tcside) { > > + memcpy(tcside->data, &s->timecode_frame_start, sizeof(int64_t)); > > > > - av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start); > > - av_dict_set(&picture->metadata, "timecode", tcbuf, 0); > > + av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start); > > + av_dict_set(&picture->metadata, "timecode", tcbuf, 0); > > + } > > > > s->timecode_frame_start = -1; > > } > > -1 to everything that is only done for consistency. I prefer consistency here, otherwise the decoder authors have to choose which function to use, and they are often not aware of the precise implications of thise choice. Better to always use just one function. -- 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".