diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | e2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch) | |
tree | 9047cf9e6b5c43878d5bf82660adae77ceee097a /mpg123_artsplugin/mpg123/vbrhead.c | |
download | tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'mpg123_artsplugin/mpg123/vbrhead.c')
-rw-r--r-- | mpg123_artsplugin/mpg123/vbrhead.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/mpg123_artsplugin/mpg123/vbrhead.c b/mpg123_artsplugin/mpg123/vbrhead.c new file mode 100644 index 00000000..f77ab279 --- /dev/null +++ b/mpg123_artsplugin/mpg123/vbrhead.c @@ -0,0 +1,79 @@ +/* + * This checks for the VBR Header defined by Xing(tm) + */ + +#include "mpg123.h" + +static unsigned long get32bits(unsigned char *buf) { + unsigned long ret = 0; + + ret = (((unsigned long) buf[0]) << 24) | + (((unsigned long) buf[1]) << 16) | + (((unsigned long) buf[2]) << 8) | + ((unsigned long) buf[3]) ; + + return ret; +} + +int getVBRHeader(struct vbrHeader *head,unsigned char *buf, struct frame *fr) +{ + int ssize; + + if(fr->lay != 3) + return 0; + + if(fr->lsf) + ssize = (fr->stereo == 1) ? 9 : 17; + else + ssize = (fr->stereo == 1) ? 17 : 32; + + + buf += ssize; + + if(( buf[0] != 'X' ) || ( buf[1] != 'i' ) || + ( buf[2] != 'n' ) || ( buf[3] != 'g' ) ) + return 0; + buf+=4; + + head->flags = get32bits(buf); + buf+=4; + + if(head->flags & VBR_FRAMES_FLAG) { + head->frames = get32bits(buf); + buf += 4; + } + + if(head->flags & VBR_BYTES_FLAG) { + head->bytes = get32bits(buf); + buf += 4; + } + + if(head->flags & VBR_TOC_FLAG) { + memcpy(head->toc,buf,100); + buf += 100; + } + + if(head->flags & VBR_SCALE_FLAG) { + head->scale = get32bits(buf); + buf += 4; + } + + fprintf(stderr,"Found XING %04lx\n",head->flags); + + return 1; + +} + + + + + + + + + + + + + + |