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 ESMTPS id 9A5CF4C625 for ; Sun, 9 Mar 2025 18:31:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CD8EA68D542; Sun, 9 Mar 2025 20:31:52 +0200 (EET) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CAAF868D542 for ; Sun, 9 Mar 2025 20:31:45 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 17C17443B3 for ; Sun, 9 Mar 2025 18:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1741545105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gOE5a6mOVVyvTMh4zGiNF1zChRu/ney35pmfTYfGgRQ=; b=T20+XiPBq3PU9LOGQh2snjW5BD9lBFnGfFzTYMHi6UMdMcLkHPkqQS+mU2OaQ2OtbN4Xcy VsPaTIIDqbJoMeKREGIQFoABe9+kY3uaBZ4HC+rH3wQkU1rkxQ0PUouLXEMEK/tXaoTB/w ukW2ad+u/1KNGVSZCrbJj6BQLXZxFFWoTWb7UA+MMnnfpheTXpjLyTwLLlPnR/KcX49+By zSPLa/mrljEBSGDfy7tk+o2k+Bdu+yAZBG1TUYWHbN8+1ygxK2pz/mP3PNNK2SooSQ1ZgO oGKhRZ688X8DZh5HOV+T8ORsDKPijepDTHo9MYb2l6fDmWZwMr4VnBmcsMLQkQ== Date: Sun, 9 Mar 2025 19:31:43 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250309183143.GJ4991@pb2> References: <20250225220121.98449-1-romain.beauxis@gmail.com> <20250225220121.98449-2-romain.beauxis@gmail.com> MIME-Version: 1.0 In-Reply-To: <20250225220121.98449-2-romain.beauxis@gmail.com> X-GND-State: clean X-GND-Score: -70 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduudejudejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeeigeektdejudffjefhteegjedtgeettefggedthfejgfevhfetgeekjedtvdfhveenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v7 1/8] Add generic metadata injection using AV_PKT_DATA_METADATA_UPDATE 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: multipart/mixed; boundary="===============7090203046738976392==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============7090203046738976392== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="lGm/uRR6DsMTKgwF" Content-Disposition: inline --lGm/uRR6DsMTKgwF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 25, 2025 at 04:01:14PM -0600, Romain Beauxis wrote: > libavcodec/decode.c: intercept `AV_PKT_DATA_METADATA_UPDATE` packet > extra data, attach them to the next decoded frame. >=20 > --- > libavcodec/decode.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) >=20 > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > index cac7e620d2..96e2f0ce95 100644 > --- a/libavcodec/decode.c > +++ b/libavcodec/decode.c > @@ -97,6 +97,8 @@ typedef struct DecodeContext { > int lcevc_frame; > int width; > int height; > + > + AVDictionary *pending_metadata; > } DecodeContext; > =20 > static DecodeContext *decode_ctx(AVCodecInternal *avci) > @@ -729,6 +731,8 @@ int attribute_align_arg avcodec_send_packet(AVCodecCo= ntext *avctx, const AVPacke > { > AVCodecInternal *avci =3D avctx->internal; > DecodeContext *dc =3D decode_ctx(avci); > + const uint8_t *side_metadata; > + size_t size; > int ret; > =20 > if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec)) > @@ -746,6 +750,14 @@ int attribute_align_arg avcodec_send_packet(AVCodecC= ontext *avctx, const AVPacke > ret =3D av_packet_ref(avci->buffer_pkt, avpkt); > if (ret < 0) > return ret; > + > + side_metadata =3D av_packet_get_side_data(avpkt, AV_PKT_DATA_MET= ADATA_UPDATE, &size); > + if (side_metadata) { > + av_dict_free(&dc->pending_metadata); > + ret =3D av_packet_unpack_dictionary(side_metadata, size, &dc= ->pending_metadata); > + if (ret < 0) > + return ret; > + } > } else > dc->draining_started =3D 1; > =20 > @@ -815,6 +827,7 @@ fail: > int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) > { > AVCodecInternal *avci =3D avctx->internal; > + DecodeContext *dc =3D decode_ctx(avci); > int ret; > =20 > if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec)) > @@ -887,6 +900,12 @@ int ff_decode_receive_frame(AVCodecContext *avctx, A= VFrame *frame) > } > } > #endif > + > + if (dc->pending_metadata) { > + av_dict_copy(&frame->metadata, dc->pending_metadata, AV_DICT_APP= END); > + av_dict_free(&dc->pending_metadata); > + } > + > return 0; > fail: > av_frame_unref(frame); Does this work correctly, if theres a delay/latency in the decoder ? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Give a rich man 100$ and he will turn it into 1000$. Give a poor man 1000$ and he will spend it. --lGm/uRR6DsMTKgwF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ83ejAAKCRBhHseHBAsP q+AnAJ9ClcG+F3qpNqFZv+ZcWl5i0eABGACdGPs607KBPpmp8GNuQXQN/UprXyo= =PUO0 -----END PGP SIGNATURE----- --lGm/uRR6DsMTKgwF-- --===============7090203046738976392== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============7090203046738976392==--