Marcoen Hirschberg | 2175d1e | 2007-06-16 18:19:51 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2005 Dave Chapman |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Marcoen Hirschberg | 2175d1e | 2007-06-16 18:19:51 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | #include "id3.h" |
| 22 | |
| 23 | #ifdef ROCKBOX_BIG_ENDIAN |
| 24 | #define IS_BIG_ENDIAN 1 |
| 25 | #else |
| 26 | #define IS_BIG_ENDIAN 0 |
| 27 | #endif |
| 28 | |
| 29 | #define TAG_NAME_LENGTH 32 |
| 30 | #define TAG_VALUE_LENGTH 128 |
| 31 | |
| 32 | enum tagtype { TAGTYPE_APE = 1, TAGTYPE_VORBIS }; |
| 33 | |
| 34 | bool read_ape_tags(int fd, struct mp3entry* id3); |
| 35 | bool read_vorbis_tags(int fd, struct mp3entry *id3, |
| 36 | long tag_remaining); |
| 37 | |
| 38 | bool skip_id3v2(int fd, struct mp3entry *id3); |
| 39 | long read_string(int fd, char* buf, long buf_size, int eos, long size); |
Dave Chapman | c728247 | 2007-07-03 09:25:36 +0000 | [diff] [blame] | 40 | |
Marcoen Hirschberg | e097b5f | 2007-06-16 18:40:07 +0000 | [diff] [blame] | 41 | #ifdef ROCKBOX_BIG_ENDIAN |
| 42 | #define read_uint32be(fd,buf) read((fd), (buf), 4) |
Dave Chapman | c728247 | 2007-07-03 09:25:36 +0000 | [diff] [blame] | 43 | int read_uint16le(int fd, uint16_t* buf); |
| 44 | int read_uint32le(int fd, uint32_t* buf); |
| 45 | int read_uint64le(int fd, uint64_t* buf); |
Marcoen Hirschberg | e097b5f | 2007-06-16 18:40:07 +0000 | [diff] [blame] | 46 | #else |
Marcoen Hirschberg | 2175d1e | 2007-06-16 18:19:51 +0000 | [diff] [blame] | 47 | int read_uint32be(int fd, unsigned int* buf); |
Dave Chapman | c728247 | 2007-07-03 09:25:36 +0000 | [diff] [blame] | 48 | #define read_uint16le(fd,buf) read((fd), (buf), 2) |
| 49 | #define read_uint32le(fd,buf) read((fd), (buf), 4) |
| 50 | #define read_uint64le(fd,buf) read((fd), (buf), 8) |
Marcoen Hirschberg | e097b5f | 2007-06-16 18:40:07 +0000 | [diff] [blame] | 51 | #endif |
Dave Chapman | c728247 | 2007-07-03 09:25:36 +0000 | [diff] [blame] | 52 | |
Marcoen Hirschberg | 2175d1e | 2007-06-16 18:19:51 +0000 | [diff] [blame] | 53 | unsigned long get_long_le(void* buf); |
| 54 | unsigned short get_short_le(void* buf); |
| 55 | unsigned long get_long_be(void* buf); |
| 56 | long get_slong(void* buf); |
| 57 | unsigned long get_itunes_int32(char* value, int count); |
| 58 | long parse_tag(const char* name, char* value, struct mp3entry* id3, |
| 59 | char* buf, long buf_remaining, enum tagtype type); |