From 4d2d0b7f6dbe0d61e2f1e292e22b85383ac5c618 Mon Sep 17 00:00:00 2001 From: "Sergey V. Lobanov" Date: Fri, 13 Jan 2023 10:58:12 +0100 Subject: MP4: add support for segment boxes (styp, sidx) sidx and styp boxes are implemented according to 3GPP TS 26.244 Both boxes are added as mp4 magic bytes due to mp4 segments start from them pcap and mp4 samples: https://wiki.wireshark.org/SampleCaptures#mp4-init-segments-and-segments --- wiretap/mp4.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'wiretap/mp4.c') diff --git a/wiretap/mp4.c b/wiretap/mp4.c index 1ad140dc71..36a43a71b6 100644 --- a/wiretap/mp4.c +++ b/wiretap/mp4.c @@ -15,6 +15,8 @@ #include "wtap-int.h" static const guint8 mp4_magic[] = { 'f', 't', 'y', 'p' }; +static const guint8 mp4_magic_sidx[] = { 's', 'i', 'd', 'x' }; +static const guint8 mp4_magic_styp[] = { 's', 't', 'y', 'p' }; static int mp4_file_type_subtype = -1; @@ -36,7 +38,9 @@ mp4_open(wtap *wth, int *err, gchar **err_info) return WTAP_OPEN_NOT_MINE; if (bytes_read == sizeof (magic_buf) && - memcmp(magic_buf + 4, mp4_magic, sizeof (mp4_magic))) + memcmp(magic_buf + 4, mp4_magic, sizeof (mp4_magic)) && + memcmp(magic_buf + 4, mp4_magic_sidx, sizeof (mp4_magic_sidx)) && + memcmp(magic_buf + 4, mp4_magic_styp, sizeof (mp4_magic_styp))) return WTAP_OPEN_NOT_MINE; if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) -- cgit v1.2.3