From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id A54494F7AD for ; Mon, 23 Jun 2025 08:09:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 5575668E66A; Mon, 23 Jun 2025 11:09:55 +0300 (EEST) Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 9D7B268E47E for ; Mon, 23 Jun 2025 11:09:48 +0300 (EEST) Received: from 97128e981a0fdc76c1c3e90f890ef837 ([1.136.108.120]) (authenticated (0 bits)) by mx.sdf.org (8.18.1/8.14.3) with ESMTPSA id 55N89cM0001590 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Mon, 23 Jun 2025 08:09:44 GMT Date: Mon, 23 Jun 2025 18:09:37 +1000 From: Peter Ross To: ffmpeg-devel@ffmpeg.org Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] tools/pktdumper: dump extradata buffers 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="===============7285181075985491846==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============7285181075985491846== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QnFBcFODSpxTSV0q" Content-Disposition: inline --QnFBcFODSpxTSV0q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable --- useful for re'ing files with extradata tools/pktdumper.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tools/pktdumper.c b/tools/pktdumper.c index c51f5c8922..d7d3147b22 100644 --- a/tools/pktdumper.c +++ b/tools/pktdumper.c @@ -37,6 +37,7 @@ =20 #define FILENAME_BUF_SIZE 4096 #define PKTFILESUFF "_%08" PRId64 "_%02d_%010" PRId64 "_%06d_%c.bin" +#define EXTRADATAFILESUFF "_extradata_%02d_%06d.bin" =20 static int usage(int ret) { @@ -52,6 +53,7 @@ static int usage(int ret) int main(int argc, char **argv) { char fntemplate[FILENAME_BUF_SIZE]; + char fntemplate2[FILENAME_BUF_SIZE]; char pktfilename[FILENAME_BUF_SIZE]; AVFormatContext *fctx =3D NULL; AVPacket *pkt; @@ -86,8 +88,6 @@ int main(int argc, char **argv) fprintf(stderr, "filename too long\n"); return usage(1); } - strcat(fntemplate, PKTFILESUFF); - printf("FNTEMPLATE: '%s'\n", fntemplate); =20 err =3D avformat_open_input(&fctx, argv[1], NULL, NULL); if (err < 0) { @@ -107,6 +107,30 @@ int main(int argc, char **argv) return 1; } =20 + strcpy(fntemplate2, fntemplate); + strcat(fntemplate2, EXTRADATAFILESUFF); + + for (int i =3D 0; i < fctx->nb_streams; i++) { + AVCodecParameters * par =3D fctx->streams[i]->codecpar; + int fd; + if (par->extradata_size) { + snprintf(pktfilename, sizeof(pktfilename), fntemplate2, i, par= ->extradata_size); + printf(EXTRADATAFILESUFF "\n", i, par->extradata_size); + if (!nowrite) { + fd =3D open(pktfilename, O_WRONLY | O_CREAT, 0644); + err =3D write(fd, par->extradata, par->extradata_size); + if (err < 0) { + fprintf(stderr, "write: error %d\n", err); + return 1; + } + close(fd); + } + } + } + + strcat(fntemplate, PKTFILESUFF); + printf("FNTEMPLATE: '%s'\n", fntemplate); + while ((err =3D av_read_frame(fctx, pkt)) >=3D 0) { int fd; snprintf(pktfilename, sizeof(pktfilename), fntemplate, pktnum, --=20 2.47.2 -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) --QnFBcFODSpxTSV0q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQSpB+AvpuUM0jTNINJnYHnFrEDdawUCaFkLvQAKCRBnYHnFrEDd a4MfAKDEQUREu6A6pezwQ1ank9teSsLAagCcDO6aKEm/EXJlS4ooVH7GEgqRJTc= =L7T4 -----END PGP SIGNATURE----- --QnFBcFODSpxTSV0q-- --===============7285181075985491846== 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". --===============7285181075985491846==--