diff options
author | Alex Musolino <alex@musolino.id.au> | 2019-11-01 12:05:11 +1030 |
---|---|---|
committer | Alex Musolino <alex@musolino.id.au> | 2019-11-01 12:05:11 +1030 |
commit | 7fbd3fd4fea60d3d0252dcceb20deed7cdca3873 (patch) | |
tree | 03e0749a52819ceeefb0dedfc86f78084f67e877 /sys/src/cmd/file.c | |
parent | 06786f2a71cb5330e63cf50ba7eed8278b31c07f (diff) |
file: add (very) basic support for detecting mpeg4 formats
Diffstat (limited to 'sys/src/cmd/file.c')
-rw-r--r-- | sys/src/cmd/file.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/src/cmd/file.c b/sys/src/cmd/file.c index 854e8e07c..11577b3af 100644 --- a/sys/src/cmd/file.c +++ b/sys/src/cmd/file.c @@ -152,6 +152,7 @@ int ismbox(void); int islimbo(void); int istga(void); int ismp3(void); +int ismp4(void); int ismung(void); int isp9bit(void); int isp9font(void); @@ -201,6 +202,7 @@ int (*call[])(void) = isface, /* ascii face file */ istga, ismp3, + ismp4, /* last resorts */ ismung, /* entropy compressed/encrypted */ @@ -1242,6 +1244,24 @@ ismp3(void) return 0; } +int +ismp4(void) +{ + if(nbuf <= 12) + return 0; + if(memcmp(&buf[4], "ftyp", 4) != 0) + return 0; + if(memcmp(&buf[8], "isom", 4) == 0){ + print("%s\n", mime ? "video/mp4" : "mp4 video"); + return 1; + } + if(memcmp(&buf[8], "M4A ", 4) == 0){ + print("%s\n", mime ? "audio/m4a" : "m4a audio"); + return 1; + } + return 0; +} + /* * low entropy means encrypted */ |