From 31e6b1c6982dbd5a6d51d8c082756d2c0dcb77f0 Mon Sep 17 00:00:00 2001 From: Gabriel Vasile Date: Tue, 6 Aug 2024 22:57:12 +0900 Subject: [PATCH] add support for .dvb video/vnd.dvb.file --- internal/magic/ftyp.go | 9 +++++++++ supported_mimes.md | 3 ++- tree.go | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/magic/ftyp.go b/internal/magic/ftyp.go index c553bcdd..ac727139 100644 --- a/internal/magic/ftyp.go +++ b/internal/magic/ftyp.go @@ -47,6 +47,15 @@ var ( HeifSequence = ftyp([]byte("msf1"), []byte("hevm"), []byte("hevs"), []byte("avcs")) // Mj2 matches a Motion JPEG 2000 file: https://en.wikipedia.org/wiki/Motion_JPEG_2000. Mj2 = ftyp([]byte("mj2s"), []byte("mjp2"), []byte("MFSM"), []byte("MGSV")) + // Dvb matches a Digital Video Broadcasting file: https://dvb.org. + // https://cconcolato.github.io/mp4ra/filetype.html + // https://github.com/file/file/blob/512840337ead1076519332d24fefcaa8fac36e06/magic/Magdir/animation#L135-L154 + Dvb = ftyp( + []byte("dby1"), []byte("dsms"), []byte("dts1"), []byte("dts2"), + []byte("dts3"), []byte("dxo "), []byte("dmb1"), []byte("dmpf"), + []byte("drc1"), []byte("dv1a"), []byte("dv1b"), []byte("dv2a"), + []byte("dv2b"), []byte("dv3a"), []byte("dv3b"), []byte("dvr1"), + []byte("dvt1"), []byte("emsg")) // TODO: add support for remaining video formats at ftyps.com. ) diff --git a/supported_mimes.md b/supported_mimes.md index a9ed413f..a0799605 100644 --- a/supported_mimes.md +++ b/supported_mimes.md @@ -1,4 +1,4 @@ -## 174 Supported MIME types +## 175 Supported MIME types This file is automatically generated when running tests. Do not edit manually. Extension | MIME type | Aliases @@ -88,6 +88,7 @@ Extension | MIME type | Aliases **.heif** | image/heif | - **.heif** | image/heif-sequence | - **.mj2** | video/mj2 | - +**.dvb** | video/vnd.dvb.file | - **.webm** | video/webm | audio/webm **.avi** | video/x-msvideo | video/avi, video/msvideo **.flv** | video/x-flv | - diff --git a/tree.go b/tree.go index e264bc63..6bf13619 100644 --- a/tree.go +++ b/tree.go @@ -161,7 +161,8 @@ var ( alias("audio/mpegurl") m4v = newMIME("video/x-m4v", ".m4v", magic.M4v) mj2 = newMIME("video/mj2", ".mj2", magic.Mj2) - mp4 = newMIME("video/mp4", ".mp4", magic.Mp4, avif, threeGP, threeG2, aMp4, mqv, m4a, m4v, heic, heicSeq, heif, heifSeq, mj2) + dvb = newMIME("video/vnd.dvb.file", ".dvb", magic.Dvb) + mp4 = newMIME("video/mp4", ".mp4", magic.Mp4, avif, threeGP, threeG2, aMp4, mqv, m4a, m4v, heic, heicSeq, heif, heifSeq, mj2, dvb) webM = newMIME("video/webm", ".webm", magic.WebM). alias("audio/webm") mpeg = newMIME("video/mpeg", ".mpeg", magic.Mpeg)