This commit is contained in:
Nishi 2025-11-25 03:05:20 +09:00
commit 86cb181e36
Signed by: nishi
GPG key ID: 27EF69B208EB9343
3 changed files with 19 additions and 4 deletions

View file

@ -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 {

View file

@ -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)) {

View file

@ -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);
}
}