ref: a57ad59bf0af4ff9548e97b94e5461f69b2db12f
parent: 72dc88448c13ec4fd3be8455f0c1b7ac94355efe
author: cinap_lenrek <[email protected]>
date: Tue Feb 14 10:42:58 EST 2012
mp3dec: skip ID3v2 tags
--- a/sys/src/cmd/audio/mp3dec/main.c
+++ b/sys/src/cmd/audio/mp3dec/main.c
@@ -129,9 +129,20 @@
error(void *, struct mad_stream *stream, struct mad_frame *frame)
{
if(stream->error == MAD_ERROR_LOSTSYNC){
- if(memcmp(stream->this_frame, "TAG", 3)==0){
+ uchar *p;
+ ulong n;
+
+ p = stream->this_frame;
+ if(memcmp(p, "TAG", 3)==0){
mad_stream_skip(stream, 128);
return MAD_FLOW_CONTINUE;
+ }
+ if(memcmp(p, "ID3", 3)==0){
+ if(((p[6] | p[7] | p[8] | p[9]) & 0x80) == 0){
+ n = p[9] | p[8]<<7 | p[7]<<14 | p[6]<<21;
+ mad_stream_skip(stream, n+10);
+ return MAD_FLOW_CONTINUE;
+ }
}
}
if(debug)