aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/mp4.c
diff options
context:
space:
mode:
authorSergey V. Lobanov <sergey@lobanov.in>2023-01-13 10:58:12 +0100
committerJohn Thacker <johnthacker@gmail.com>2023-01-19 17:59:50 +0000
commit4d2d0b7f6dbe0d61e2f1e292e22b85383ac5c618 (patch)
tree9448bc3af7ac7c5e0c3dddb0bd585fdc60716b52 /wiretap/mp4.c
parent776aafc7de32aa6219be0555eefa905f9eb83631 (diff)
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
Diffstat (limited to 'wiretap/mp4.c')
-rw-r--r--wiretap/mp4.c6
1 files changed, 5 insertions, 1 deletions
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)