summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-05-29 19:08:15 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-05-29 19:08:15 +0200
commitb681e2018ab1e212195aa5dfa1fb03cb69533e62 (patch)
treef657319e7d8507aa9571f8d277408f161a42fd66
parentdcd3bdb0ea6df1a110f317ad4d8995653d9ba5a9 (diff)
downloadxine-lib-b681e2018ab1e212195aa5dfa1fb03cb69533e62.tar.gz
xine-lib-b681e2018ab1e212195aa5dfa1fb03cb69533e62.tar.bz2
Actually id3v2_tagsize was used by demux_mpgaudio and demux_aac; but as it makes little sense, move BE_*_synchsafe functions from id3.c to id3.h and declare them inline, then BE_32_synchsafe can be replaced to id3v2_tagsize as drop in.
-rw-r--r--src/demuxers/demux_aac.c2
-rw-r--r--src/demuxers/demux_mpgaudio.c3
-rw-r--r--src/demuxers/id3.c32
-rw-r--r--src/demuxers/id3.h32
4 files changed, 34 insertions, 35 deletions
diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c
index ab71e8382..1775a4e0e 100644
--- a/src/demuxers/demux_aac.c
+++ b/src/demuxers/demux_aac.c
@@ -84,7 +84,7 @@ static int open_aac_file(demux_aac_t *this) {
/* Check if there's an ID3v2 tag at the start */
if ( id3v2_istag(peak) ) {
- id3size = id3v2_tagsize(&peak[6]);
+ id3size = BE_32_synchsafe(&peak[6]);
this->input->seek(this->input, 4, SEEK_SET);
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index 31b2d33ff..f675e227a 100644
--- a/src/demuxers/demux_mpgaudio.c
+++ b/src/demuxers/demux_mpgaudio.c
@@ -697,8 +697,7 @@ static int detect_mpgaudio_file(input_plugin_t *input) {
* id3v2 are not specific to mp3 files,
* flac files can contain id3v2 tags
*/
- uint8_t *ptr = &buf[6];
- uint32_t tag_size = id3v2_tagsize(ptr);
+ uint32_t tag_size = BE_32_synchsafe(&buf[6]);
lprintf("try to skip id3v2 tag (%d bytes)\n", tag_size);
if ((10 + tag_size) >= preview_len) {
lprintf("cannot skip id3v2 tag\n");
diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c
index e9ed43d4d..a59eb6259 100644
--- a/src/demuxers/id3.c
+++ b/src/demuxers/id3.c
@@ -227,38 +227,6 @@ static int id3v2_parse_genre(char* dest, char *src, int len) {
return 1;
}
-#if 0
-/* parse an unsynchronized 16bits integer */
-static uint16_t BE_16_synchsafe(uint8_t buf[2]) {
- return ((uint16_t)(buf[0] & 0x7F) << 7) |
- (uint16_t)(buf[1] & 0x7F);
-}
-#endif
-
-/* parse an unsynchronized 24bits integer */
-static uint32_t BE_24_synchsafe(uint8_t buf[3]) {
- return ((uint32_t)(buf[0] & 0x7F) << 14) |
- ((uint32_t)(buf[1] & 0x7F) << 7) |
- (uint32_t)(buf[2] & 0x7F);
-}
-
-/* parse an unsynchronized 32bits integer */
-static uint32_t BE_32_synchsafe(uint8_t buf[4]) {
- return ((uint32_t)(buf[0] & 0x7F) << 21) |
- ((uint32_t)(buf[1] & 0x7F) << 14) |
- ((uint32_t)(buf[2] & 0x7F) << 7) |
- (uint32_t)(buf[3] & 0x7F);
-}
-
-/* parse an unsynchronized 35bits integer */
-static uint32_t BE_35_synchsafe(uint8_t buf[5]) {
- return ((uint32_t)(buf[0] & 0x07) << 28) |
- ((uint32_t)(buf[1] & 0x7F) << 21) |
- ((uint32_t)(buf[2] & 0x7F) << 14) |
- ((uint32_t)(buf[3] & 0x7F) << 7) |
- (uint32_t)(buf[4] & 0x7F);
-}
-
static int id3v2_parse_header(input_plugin_t *input, uint8_t *mp3_frame_header,
id3v2_header_t *tag_header) {
uint8_t buf[6];
diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h
index 9b86ec94e..b8f0984b1 100644
--- a/src/demuxers/id3.h
+++ b/src/demuxers/id3.h
@@ -181,4 +181,36 @@ static inline int id3v2_istag(uint8_t *ptr) {
(ptr[2] == '3');
}
+#if 0
+/* parse an unsynchronized 16bits integer */
+static inline uint16_t BE_16_synchsafe(uint8_t buf[2]) {
+ return ((uint16_t)(buf[0] & 0x7F) << 7) |
+ (uint16_t)(buf[1] & 0x7F);
+}
+#endif
+
+/* parse an unsynchronized 24bits integer */
+static inline uint32_t BE_24_synchsafe(uint8_t buf[3]) {
+ return ((uint32_t)(buf[0] & 0x7F) << 14) |
+ ((uint32_t)(buf[1] & 0x7F) << 7) |
+ (uint32_t)(buf[2] & 0x7F);
+}
+
+/* parse an unsynchronized 32bits integer */
+static inline uint32_t BE_32_synchsafe(uint8_t buf[4]) {
+ return ((uint32_t)(buf[0] & 0x7F) << 21) |
+ ((uint32_t)(buf[1] & 0x7F) << 14) |
+ ((uint32_t)(buf[2] & 0x7F) << 7) |
+ (uint32_t)(buf[3] & 0x7F);
+}
+
+/* parse an unsynchronized 35bits integer */
+static inline uint32_t BE_35_synchsafe(uint8_t buf[5]) {
+ return ((uint32_t)(buf[0] & 0x07) << 28) |
+ ((uint32_t)(buf[1] & 0x7F) << 21) |
+ ((uint32_t)(buf[2] & 0x7F) << 14) |
+ ((uint32_t)(buf[3] & 0x7F) << 7) |
+ (uint32_t)(buf[4] & 0x7F);
+}
+
#endif /* ID3_H */