diff options
author | cinap_lenrek <cinap_lenrek@rei2.9hal> | 2012-02-14 17:29:18 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@rei2.9hal> | 2012-02-14 17:29:18 +0100 |
commit | ac0107ca4234d1c51fcf3c7ae30fc6fde86464ae (patch) | |
tree | 505cf18e5268c14b0d385c637ecfba1e574e8073 /sys/src/cmd/file.c | |
parent | a57ad59bf0af4ff9548e97b94e5461f69b2db12f (diff) |
file: mp3 audio data detection by syncword, play: remote -t option as file now works for mp3 streams
Diffstat (limited to 'sys/src/cmd/file.c')
-rw-r--r-- | sys/src/cmd/file.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/src/cmd/file.c b/sys/src/cmd/file.c index 2759cce8d..7da5abdaa 100644 --- a/sys/src/cmd/file.c +++ b/sys/src/cmd/file.c @@ -150,6 +150,7 @@ int ishtml(void); int isrfc822(void); int ismbox(void); int islimbo(void); +int ismp3(void); int ismung(void); int isp9bit(void); int isp9font(void); @@ -195,6 +196,7 @@ int (*call[])(void) = ismsdos, /* msdos exe (virus file attachement) */ isicocur, /* windows icon or cursor file */ isface, /* ascii face file */ + ismp3, /* last resorts */ ismung, /* entropy compressed/encrypted */ @@ -1135,6 +1137,23 @@ isas(void) return 1; } +int +ismp3(void) +{ + uchar *p, *e; + + p = buf; + e = p + nbuf-1; + while((p < e) && (p = memchr(p, 0xFF, e - p))){ + if((p[1] & 0xFE) == 0xFA){ + print(mime ? "audio/mpeg\n" : "mp3 audio\n"); + return 1; + } + p++; + } + return 0; +} + /* * low entropy means encrypted */ |