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 B24C4460A8 for ; Sun, 31 Dec 2023 21:37:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CF94368CC19; Sun, 31 Dec 2023 23:37:00 +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 8816768CAD4 for ; Sun, 31 Dec 2023 23:36:54 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id AFDB6FF803 for ; Sun, 31 Dec 2023 21:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1704058613; 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=2Y26+AJytgU1bT2yTdzauMj68vZ/Oii0QZBzL40mG0s=; b=MLeDVmEaYbCWhVyh15nWzVNqlHA8YUOcK9vb8hpr2CldwQd7v48jOPAfMbU7MCIdMBeDNA Q2OuvY22e4b00C/2jKc9msBJecAB6Ohkfr8KAoKxMYtSonb/bPaXRUyAaEKfu+RfpOCwWR 0XWa5tc/IWNCA21Jn92FOKmqYkWCNIOJSD2ZJdbS3JAx3W3NefxdB7XCCL+uBpeKj/XvEH GU5ob9rm82iFPcnNIz0ulbvz1ryNd26Zjv7aFnarpFrROyxuoXmf/aWwb1qdrqEoxA6Uo9 n5JPb5zga/OTFOKoRzbD4Ebxd4/pywhcCYIxbpjCX8+A67kA798+suodnp1lOg== Date: Sun, 31 Dec 2023 22:36:52 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20231231213652.GS6420@pb2> References: <20231226223049.GU6420@pb2> <20231229173330.GI6420@pb2> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 3/6] Add CRYO APC muxer 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="===============9095482899327908729==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============9095482899327908729== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hRJ+CtUtsUVQl6Pn" Content-Disposition: inline --hRJ+CtUtsUVQl6Pn Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 30, 2023 at 06:01:25PM +0100, Tomas H=E4rdin wrote: > fre 2023-12-29 klockan 18:33 +0100 skrev Michael Niedermayer: > > On Thu, Dec 28, 2023 at 11:31:05AM +0100, Tomas H=E4rdin wrote: > > > tis 2023-12-26 klockan 23:30 +0100 skrev Michael Niedermayer: > > > > Hi > > > >=20 > > > > On Tue, Dec 26, 2023 at 04:52:47PM +0100, Tomas H=E4rdin wrote: > > > > >=20 > > > >=20 > > > > [...] > > > > > + > > > > > +static int apc_write_header(AVFormatContext *s) > > > > > +{ > > > > > +=A0=A0=A0 AVIOContext *pb =3D s->pb; > > > > > +=A0=A0=A0 AVCodecParameters *par; > > > > > +=A0=A0=A0 AVStream *st; > > > > > + > > > > > +=A0=A0=A0 if (s->nb_streams !=3D 1) { > > > > > +=A0=A0=A0=A0=A0=A0=A0 av_log(s, AV_LOG_ERROR, "Must have exactly= one > > > > > stream\n"); > > > > > +=A0=A0=A0=A0=A0=A0=A0 return AVERROR(EINVAL); > > > > > +=A0=A0=A0 } > > > > > + > > > > > +=A0=A0=A0 st =3D s->streams[0]; > > > > > +=A0=A0=A0 par =3D st->codecpar; > > > > > + > > > > > +=A0=A0=A0 if (par->ch_layout.nb_channels <=3D 0 || par- > > > > > > ch_layout.nb_channels > 2) { > > > > > +=A0=A0=A0=A0=A0=A0=A0 av_log(s, AV_LOG_ERROR, "Must be mono or s= tereo\n"); > > > > > +=A0=A0=A0=A0=A0=A0=A0 return AVERROR(EINVAL); > > > > > +=A0=A0=A0 } > > > > > + > > > > > +=A0=A0=A0 if (par->extradata_size !=3D 0 && par->extradata_size = !=3D 8) > > > > > { > > > > > +=A0=A0=A0=A0=A0=A0=A0 av_log(s, AV_LOG_ERROR, > > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "Must have exactly 0 or 8 byte= s of extradata, got > > > > > %i\n", > > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 par->extradata_size); > > > > > +=A0=A0=A0=A0=A0=A0=A0 return AVERROR(EINVAL); > > > > > +=A0=A0=A0 } > > > > > + > > > > > +=A0=A0=A0 ffio_wfourcc(pb, "CRYO"); > > > > > +=A0=A0=A0 ffio_wfourcc(pb, "_APC"); > > > > > +=A0=A0=A0 ffio_wfourcc(pb, "1.20"); > > > >=20 > > > > > +=A0=A0=A0 avio_wl32(pb, 0); // number or samples > > > >=20 > > > > please add to the comment "updated in apc_write_trailer()" > > >=20 > > > Sure > > >=20 > > >=20 > > > > > +static int apc_write_packet(AVFormatContext *s, AVPacket *pkt) > > > > > +{ > > > > > +=A0=A0=A0 size_t extradata_size =3D 0; > > > >=20 > > > > > +=A0=A0=A0 const uint8_t *extradata =3D av_packet_get_side_data( > > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 pkt, AV_PKT_DATA_NEW_EXTRADATA= , &extradata_size); > > > > > + > > > > > +=A0=A0=A0 if (extradata_size =3D=3D 8) { > > > > > +=A0=A0=A0=A0=A0=A0=A0 // we got predictors from encoder > > > > > +=A0=A0=A0=A0=A0=A0=A0 // try to seek back end write them > > > > > +=A0=A0=A0=A0=A0=A0=A0 int64_t pos =3D avio_tell(s->pb), err; > > > > > +=A0=A0=A0=A0=A0=A0=A0 if ((err =3D avio_seek(s->pb, 20, SEEK_SET= )) >=3D 0) { > > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 avio_write(s->pb, extradata, e= xtradata_size); > > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 avio_seek(s->pb, pos, SEEK_SET= ); > > > > > +=A0=A0=A0=A0=A0=A0=A0 } else { > > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 av_log(s, AV_LOG_ERROR, "Got p= redictors from > > > > > encoder > > > > > but couldn't seek back to write them\n"); > > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // fail since we should always= be able to do this > > > > > within the avio cache > > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // unless the encoder gave us = predictors way too > > > > > late > > > > > for some reason > > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return err; > > > > > +=A0=A0=A0=A0=A0=A0=A0 } > > > > > +=A0=A0=A0 } > > > >=20 > > > > I think the encoder should buffer data or use 2 passes > > > > if it needs future data. seeking back in the muxer is a bit odd. > > > >=20 > > > > if it becomes available always in teh first packet then maybe the > > > > whole header could be written in the first packet > > >=20 > > > Good idea. IIRC the issue was that extradata is either given > > > immediately (remuxing) or after a single-packet delay (encoding), > > > hence > > > the check for *new* metadata > > >=20 > > > > I would suggest, you add APC support to nut. > > > > Thats a good test to ensure the packet and extradata is set at > > > > the > > > > right time > > > > for a generic muxer > > >=20 > > > How would I go about doing that? > >=20 > > nut mainly needs to be able to map the ffmpeg API CODEC_ID to some > > external id > > so the codec id needs to be in one of the table nut scans for it >=20 > I doubt this codec has an official RIFF TwoCC. I see some other IMA > codecs in riff.c though. I suspect this would require coordinating > with Microsoft, which I feel shouldn't hold up this patchset you only have to add it to: https://git.ffmpeg.org/gitweb/nut.git/blob/HEAD:/docs/nut4cc.txt https://lists.mplayerhq.hu/mailman/listinfo/nut-devel and please CC me in case this ML doesnt work (it seems a little silent) thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein --hRJ+CtUtsUVQl6Pn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZZHe7QAKCRBhHseHBAsP q7hwAJ9Va88hDWYxJ3Ddy+Gt/0cSm/NSBQCfQHlwp1Vp2ffky7k2usg4uc8H6xk= =mTJu -----END PGP SIGNATURE----- --hRJ+CtUtsUVQl6Pn-- --===============9095482899327908729== 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". --===============9095482899327908729==--