things
This commit is contained in:
parent
a74bd0b3e7
commit
86cb181e36
3 changed files with 19 additions and 4 deletions
|
|
@ -18,10 +18,11 @@ struct _MDESoundContext {
|
|||
int frames;
|
||||
void* opaque;
|
||||
|
||||
char* title;
|
||||
char* album;
|
||||
char* artist;
|
||||
char* genre;
|
||||
char* title;
|
||||
char* album;
|
||||
char* artist;
|
||||
char* genre;
|
||||
unsigned int track;
|
||||
};
|
||||
|
||||
struct _MDESoundDriver {
|
||||
|
|
|
|||
|
|
@ -6,12 +6,24 @@
|
|||
|
||||
static MDESoundContext mp3_open(const char* path) {
|
||||
MDESoundContext ctx = malloc(sizeof(*ctx));
|
||||
char* s;
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
|
||||
ctx->title = MDEID3GetString(path, "TIT2");
|
||||
ctx->artist = MDEID3GetString(path, "TPE1");
|
||||
ctx->album = MDEID3GetString(path, "TALB");
|
||||
ctx->genre = MDEID3GetString(path, "TCON");
|
||||
ctx->track = 0;
|
||||
|
||||
s = MDEID3GetString(path, "TRCK");
|
||||
if(s != NULL) {
|
||||
char* t = strchr(s, '/');
|
||||
if(t != NULL) t[0] = 0;
|
||||
|
||||
ctx->track = atoi(s);
|
||||
|
||||
free(s);
|
||||
}
|
||||
|
||||
ctx->opaque = malloc(sizeof(drmp3));
|
||||
if(!drmp3_init_file(ctx->opaque, path, NULL)) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ static MDESoundContext vorbis_open(const char* path) {
|
|||
ctx->artist = MDEStringDuplicate(p + 1);
|
||||
} else if(strcasecmp(s, "GENRE") == 0) {
|
||||
ctx->genre = MDEStringDuplicate(p + 1);
|
||||
} else if(strcasecmp(s, "TRACK") == 0) {
|
||||
ctx->track = atoi(p + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue