summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-07-04 15:50:15 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-07-04 15:50:15 +0200
commitee4a1c92793179af16cd4a9b6c2a75e00ab45beb (patch)
treee98591d10bec59cf3094784cb27baf7b40be1ed0 /src
parenta5fea58eeaff30d4bb4464c619af9d49faf425ae (diff)
downloadxine-lib-ee4a1c92793179af16cd4a9b6c2a75e00ab45beb.tar.gz
xine-lib-ee4a1c92793179af16cd4a9b6c2a75e00ab45beb.tar.bz2
Use id3.h functions to check for ID3 tags.
Rather than checking for the ID3 signature manually use id3_istag() function. Also use the _X_BE_32_synchsafe function rather than re-implementing it again. Use memcmp() to look for MPC signature. --HG-- extra : transplant_source : %3A%8CE%9B%B6%BC%CBm%DA%A4%26M%A0%CC%C5OV%1C%93%01
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_mpc.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/demuxers/demux_mpc.c b/src/demuxers/demux_mpc.c
index e00a50ea3..9b27e5954 100644
--- a/src/demuxers/demux_mpc.c
+++ b/src/demuxers/demux_mpc.c
@@ -47,6 +47,7 @@
#include "buffer.h"
#include "bswap.h"
#include "group_audio.h"
+#include "id3.h"
/* Note that the header is actually 25 bytes long, so we'd only read 28
* (because of byte swapping we have to round up to nearest multiple of 4)
@@ -89,17 +90,13 @@ static int open_mpc_file(demux_mpc_t *this) {
/* TODO: non-seeking version */
if (INPUT_IS_SEEKABLE(this->input)) {
/* Check for id3v2 tag */
- if ((this->header[0] == 'I') ||
- (this->header[1] == 'D') ||
- (this->header[2] == '3')) {
+ if (id3v2_istag(this->header)) {
lprintf("found id3v2 header\n");
/* Read tag size */
- id3v2_size = (this->header[6] << 21) +
- (this->header[7] << 14) +
- (this->header[8] << 7) +
- this->header[9] + 10;
+
+ id3v2_size = _X_BE_32_synchsafe(&this->header[6]) + 10;
/* Add footer size if one is present */
if (this->header[5] & 0x10)
@@ -118,9 +115,7 @@ static int open_mpc_file(demux_mpc_t *this) {
}
/* Validate signature - We only support SV 7.x at the moment */
- if ((this->header[0] != 'M') ||
- (this->header[1] != 'P') ||
- (this->header[2] != '+') ||
+ if ( memcmp(this->header, "MP+", 3) != 0 ||
((this->header[3]&0x0f) != 0x07))
return 0;