mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-12 06:32:34 -05:00
Unify fourcc macro and some style changes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23664 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
556daaf34a
commit
2e28c1853b
8 changed files with 79 additions and 75 deletions
|
|
@ -59,7 +59,8 @@ bool read_ape_tags(int fd, struct mp3entry* id3)
|
||||||
struct apetag_header header;
|
struct apetag_header header;
|
||||||
|
|
||||||
if ((lseek(fd, -APETAG_HEADER_LENGTH, SEEK_END) < 0)
|
if ((lseek(fd, -APETAG_HEADER_LENGTH, SEEK_END) < 0)
|
||||||
|| (ecread(fd, &header, 1, APETAG_HEADER_FORMAT, IS_BIG_ENDIAN) != APETAG_HEADER_LENGTH)
|
|| (ecread(fd, &header, 1, APETAG_HEADER_FORMAT, IS_BIG_ENDIAN)
|
||||||
|
!= APETAG_HEADER_LENGTH)
|
||||||
|| (memcmp(header.id, "APETAGEX", sizeof(header.id))))
|
|| (memcmp(header.id, "APETAGEX", sizeof(header.id))))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -91,7 +92,8 @@ bool read_ape_tags(int fd, struct mp3entry* id3)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ecread(fd, &item, 1, APETAG_ITEM_HEADER_FORMAT, IS_BIG_ENDIAN) < (long) sizeof(item))
|
if (ecread(fd, &item, 1, APETAG_ITEM_HEADER_FORMAT, IS_BIG_ENDIAN)
|
||||||
|
< (long) sizeof(item))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,8 @@ static int ASAP_ParseDuration(const char *s)
|
||||||
|
|
||||||
static bool read_asap_string(char* source, char** buf, char** buffer_end, char** dest)
|
static bool read_asap_string(char* source, char** buf, char** buffer_end, char** dest)
|
||||||
{
|
{
|
||||||
if(parse_text(*buf,source) == false) return false;
|
if(parse_text(*buf,source) == false)
|
||||||
|
return false;
|
||||||
|
|
||||||
/* set dest pointer */
|
/* set dest pointer */
|
||||||
*dest = *buf;
|
*dest = *buf;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@
|
||||||
#define TAG_NAME_LENGTH 32
|
#define TAG_NAME_LENGTH 32
|
||||||
#define TAG_VALUE_LENGTH 128
|
#define TAG_VALUE_LENGTH 128
|
||||||
|
|
||||||
|
#define FOURCC(a,b,c,d) (((a)<<24) | ((b) << 16) | ((c) << 8) | (d))
|
||||||
|
|
||||||
enum tagtype { TAGTYPE_APE = 1, TAGTYPE_VORBIS };
|
enum tagtype { TAGTYPE_APE = 1, TAGTYPE_VORBIS };
|
||||||
|
|
||||||
bool read_ape_tags(int fd, struct mp3entry* id3);
|
bool read_ape_tags(int fd, struct mp3entry* id3);
|
||||||
|
|
|
||||||
|
|
@ -33,45 +33,43 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "replaygain.h"
|
#include "replaygain.h"
|
||||||
|
|
||||||
#define MP4_ID(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
|
#define MP4_3gp6 FOURCC('3', 'g', 'p', '6')
|
||||||
|
#define MP4_aART FOURCC('a', 'A', 'R', 'T')
|
||||||
#define MP4_3gp6 MP4_ID('3', 'g', 'p', '6')
|
#define MP4_alac FOURCC('a', 'l', 'a', 'c')
|
||||||
#define MP4_aART MP4_ID('a', 'A', 'R', 'T')
|
#define MP4_calb FOURCC(0xa9, 'a', 'l', 'b')
|
||||||
#define MP4_alac MP4_ID('a', 'l', 'a', 'c')
|
#define MP4_cART FOURCC(0xa9, 'A', 'R', 'T')
|
||||||
#define MP4_calb MP4_ID(0xa9, 'a', 'l', 'b')
|
#define MP4_cgrp FOURCC(0xa9, 'g', 'r', 'p')
|
||||||
#define MP4_cART MP4_ID(0xa9, 'A', 'R', 'T')
|
#define MP4_cgen FOURCC(0xa9, 'g', 'e', 'n')
|
||||||
#define MP4_cgrp MP4_ID(0xa9, 'g', 'r', 'p')
|
#define MP4_chpl FOURCC('c', 'h', 'p', 'l')
|
||||||
#define MP4_cgen MP4_ID(0xa9, 'g', 'e', 'n')
|
#define MP4_cnam FOURCC(0xa9, 'n', 'a', 'm')
|
||||||
#define MP4_chpl MP4_ID('c', 'h', 'p', 'l')
|
#define MP4_cwrt FOURCC(0xa9, 'w', 'r', 't')
|
||||||
#define MP4_cnam MP4_ID(0xa9, 'n', 'a', 'm')
|
#define MP4_ccmt FOURCC(0xa9, 'c', 'm', 't')
|
||||||
#define MP4_cwrt MP4_ID(0xa9, 'w', 'r', 't')
|
#define MP4_cday FOURCC(0xa9, 'd', 'a', 'y')
|
||||||
#define MP4_ccmt MP4_ID(0xa9, 'c', 'm', 't')
|
#define MP4_disk FOURCC('d', 'i', 's', 'k')
|
||||||
#define MP4_cday MP4_ID(0xa9, 'd', 'a', 'y')
|
#define MP4_esds FOURCC('e', 's', 'd', 's')
|
||||||
#define MP4_disk MP4_ID('d', 'i', 's', 'k')
|
#define MP4_ftyp FOURCC('f', 't', 'y', 'p')
|
||||||
#define MP4_esds MP4_ID('e', 's', 'd', 's')
|
#define MP4_gnre FOURCC('g', 'n', 'r', 'e')
|
||||||
#define MP4_ftyp MP4_ID('f', 't', 'y', 'p')
|
#define MP4_hdlr FOURCC('h', 'd', 'l', 'r')
|
||||||
#define MP4_gnre MP4_ID('g', 'n', 'r', 'e')
|
#define MP4_ilst FOURCC('i', 'l', 's', 't')
|
||||||
#define MP4_hdlr MP4_ID('h', 'd', 'l', 'r')
|
#define MP4_M4A FOURCC('M', '4', 'A', ' ')
|
||||||
#define MP4_ilst MP4_ID('i', 'l', 's', 't')
|
#define MP4_M4B FOURCC('M', '4', 'B', ' ')
|
||||||
#define MP4_M4A MP4_ID('M', '4', 'A', ' ')
|
#define MP4_mdat FOURCC('m', 'd', 'a', 't')
|
||||||
#define MP4_M4B MP4_ID('M', '4', 'B', ' ')
|
#define MP4_mdia FOURCC('m', 'd', 'i', 'a')
|
||||||
#define MP4_mdat MP4_ID('m', 'd', 'a', 't')
|
#define MP4_mdir FOURCC('m', 'd', 'i', 'r')
|
||||||
#define MP4_mdia MP4_ID('m', 'd', 'i', 'a')
|
#define MP4_meta FOURCC('m', 'e', 't', 'a')
|
||||||
#define MP4_mdir MP4_ID('m', 'd', 'i', 'r')
|
#define MP4_minf FOURCC('m', 'i', 'n', 'f')
|
||||||
#define MP4_meta MP4_ID('m', 'e', 't', 'a')
|
#define MP4_moov FOURCC('m', 'o', 'o', 'v')
|
||||||
#define MP4_minf MP4_ID('m', 'i', 'n', 'f')
|
#define MP4_mp4a FOURCC('m', 'p', '4', 'a')
|
||||||
#define MP4_moov MP4_ID('m', 'o', 'o', 'v')
|
#define MP4_mp42 FOURCC('m', 'p', '4', '2')
|
||||||
#define MP4_mp4a MP4_ID('m', 'p', '4', 'a')
|
#define MP4_qt FOURCC('q', 't', ' ', ' ')
|
||||||
#define MP4_mp42 MP4_ID('m', 'p', '4', '2')
|
#define MP4_soun FOURCC('s', 'o', 'u', 'n')
|
||||||
#define MP4_qt MP4_ID('q', 't', ' ', ' ')
|
#define MP4_stbl FOURCC('s', 't', 'b', 'l')
|
||||||
#define MP4_soun MP4_ID('s', 'o', 'u', 'n')
|
#define MP4_stsd FOURCC('s', 't', 's', 'd')
|
||||||
#define MP4_stbl MP4_ID('s', 't', 'b', 'l')
|
#define MP4_stts FOURCC('s', 't', 't', 's')
|
||||||
#define MP4_stsd MP4_ID('s', 't', 's', 'd')
|
#define MP4_trak FOURCC('t', 'r', 'a', 'k')
|
||||||
#define MP4_stts MP4_ID('s', 't', 't', 's')
|
#define MP4_trkn FOURCC('t', 'r', 'k', 'n')
|
||||||
#define MP4_trak MP4_ID('t', 'r', 'a', 'k')
|
#define MP4_udta FOURCC('u', 'd', 't', 'a')
|
||||||
#define MP4_trkn MP4_ID('t', 'r', 'k', 'n')
|
#define MP4_extra FOURCC('-', '-', '-', '-')
|
||||||
#define MP4_udta MP4_ID('u', 'd', 't', 'a')
|
|
||||||
#define MP4_extra MP4_ID('-', '-', '-', '-')
|
|
||||||
|
|
||||||
/* Read the tag data from an MP4 file, storing up to buffer_size bytes in
|
/* Read the tag data from an MP4 file, storing up to buffer_size bytes in
|
||||||
* buffer.
|
* buffer.
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ static int set_replaygain(struct mp3entry* id3, bool album, long value,
|
||||||
|
|
||||||
bool get_musepack_metadata(int fd, struct mp3entry *id3)
|
bool get_musepack_metadata(int fd, struct mp3entry *id3)
|
||||||
{
|
{
|
||||||
const int32_t sfreqs_sv7[4] = { 44100, 48000, 37800, 32000 };
|
static const int32_t sfreqs_sv7[4] = { 44100, 48000, 37800, 32000 };
|
||||||
uint32_t header[8];
|
uint32_t header[8];
|
||||||
uint64_t samples = 0;
|
uint64_t samples = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
||||||
|
|
@ -60,15 +60,16 @@ struct real_object_t
|
||||||
uint16_t version;
|
uint16_t version;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FOURCC(a,b,c,d) (((a)<<24) | ((b) << 16) | ((c) << 8) | (d))
|
|
||||||
|
|
||||||
static int real_read_object_header(int fd, struct real_object_t* obj)
|
static int real_read_object_header(int fd, struct real_object_t* obj)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if ((n = read_uint32be(fd, &obj->fourcc)) <= 0) return n;
|
if ((n = read_uint32be(fd, &obj->fourcc)) <= 0)
|
||||||
if ((n = read_uint32be(fd, &obj->size)) <= 0) return n;
|
return n;
|
||||||
if ((n = read_uint16be(fd, &obj->version)) <= 0) return n;
|
if ((n = read_uint32be(fd, &obj->size)) <= 0)
|
||||||
|
return n;
|
||||||
|
if ((n = read_uint16be(fd, &obj->version)) <= 0)
|
||||||
|
return n;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue