]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/file.c
make bind(2) error handling consistent
[plan9front.git] / sys / src / cmd / file.c
index 854e8e07c4d6bf5e3047f147f2e1ce793d0c485c..bd9d1afb5b492146277b6c53411a34177dbc2026 100644 (file)
@@ -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);
@@ -200,6 +201,7 @@ int (*call[])(void) =
        isicocur,               /* windows icon or cursor file */
        isface,         /* ascii face file */
        istga,
+       ismp4,
        ismp3,
 
        /* last resorts */
@@ -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
  */