[FFmpeg-devel] [PATCH] avformat: add DAT (Digital Audio Tape) demuxer
Michael Niedermayer
michael at niedermayer.cc
Fri Jan 17 22:43:15 EET 2025
Hi
On Fri, Jan 17, 2025 at 12:38:02PM +0100, Jerome Martinez wrote:
> Sample files are available at https://archive.org/download/datstrue-read/
>
> Makefile | 1
> allformats.c | 1
> dat.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 161 insertions(+)
> d8c9ff24544dbf47c46cd3066740ff8fec304d4b 0001-avformat-add-DAT-demuxer.patch
> From 50c78a0ae2049e2dbd65e2c3d28f3d8abea1adfa Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda at gmail.com>
> Date: Thu, 12 Sep 2024 20:34:22 +0200
> Subject: [PATCH] avformat: add DAT demuxer
breaks fate-cdxl-pal8-small
I guess the probe function is not working as expected
[...]
> +static int valid_frame(uint8_t *frame)
> +{
> + uint8_t *scode = frame+DAT_OFFSET;
> + uint8_t *subid = scode+7*8;
> + uint8_t *mainid = subid+4;
> + int chan_index = (mainid[0] >> 0) & 0x3;
> + int rate_index = (mainid[0] >> 2) & 0x3;
> + int enc_index = (mainid[1] >> 6) & 0x3;
> + int dataid = (subid[0] >> 0) & 0xf;
> +
> + if (dataid != 0 || encoded_codec[enc_index] == AV_CODEC_ID_NONE ||
> + encoded_chans[chan_index] == 0 ||
> + encoded_rate[rate_index] == 0)
> + return 0;
> +
> + return 1;
> +}
> +
> +static int read_probe(const AVProbeData *p)
> +{
> + const int cnt = p->buf_size / DAT_PACKET_SIZE;
> + int score = 0;
> +
> + for (int i = 0; i < cnt; i++) {
> + const int ret = valid_frame(&p->buf[i * DAT_PACKET_SIZE]);
> +
> + score += ret;
> + if (ret == 0)
> + break;
> + }
> +
> + return FFMIN(score, AVPROBE_SCORE_MAX);
> +}
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250117/a975e9f1/attachment.sig>
More information about the ffmpeg-devel
mailing list