Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Change cuesheet handling so the id3 info is not spoofed anymore. If something wants the subtracks info it is easy to get to. This makes next track display in the skins show the next subtrack if we are in a cuesheet


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26611 a1c6a512-1295-4272-9138-f99709370657

+41 -27
+30 -21
apps/cuesheet.c
··· 346 346 } 347 347 348 348 } 349 - 350 - void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3) 349 + const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3, 350 + int offset_tracks, char *buf, int buf_size) 351 351 { 352 + struct cuesheet *cue = id3?id3->cuesheet:NULL; 352 353 if (!cue || !cue->curr_track) 353 - return; 354 - 354 + return NULL; 355 + 355 356 struct cue_track_info *track = cue->curr_track; 356 - 357 - id3->title = *track->title ? track->title : NULL; 358 - id3->artist = *track->performer ? track->performer : NULL; 359 - id3->composer = *track->songwriter ? track->songwriter : NULL; 360 - id3->album = *cue->title ? cue->title : NULL; 361 - 362 - /* if the album artist is the same as the track artist, we hide it. */ 363 - if (strcmp(cue->performer, track->performer)) 364 - id3->albumartist = *cue->performer ? cue->performer : NULL; 365 - else 366 - id3->albumartist = NULL; 367 - 368 - int i = cue->curr_track_idx; 369 - id3->tracknum = i+1; 370 - if (id3->track_string) 371 - snprintf(id3->track_string, 10, "%d/%d", i+1, cue->track_count); 357 + if (offset_tracks) 358 + { 359 + if (cue->curr_track_idx+offset_tracks < cue->track_count) 360 + track+=offset_tracks; 361 + else 362 + return NULL; 363 + } 364 + switch (token->type) 365 + { 366 + case WPS_TOKEN_METADATA_ARTIST: 367 + return *track->performer ? track->performer : NULL; 368 + case WPS_TOKEN_METADATA_COMPOSER: 369 + return *track->songwriter ? track->songwriter : NULL; 370 + case WPS_TOKEN_METADATA_ALBUM: 371 + return *cue->title ? cue->title : NULL; 372 + case WPS_TOKEN_METADATA_ALBUM_ARTIST: 373 + return *cue->performer ? cue->performer : NULL; 374 + case WPS_TOKEN_METADATA_TRACK_TITLE: 375 + return *track->title ? track->title : NULL; 376 + case WPS_TOKEN_METADATA_TRACK_NUMBER: 377 + snprintf(buf, buf_size, "%d/%d", 378 + cue->curr_track_idx+offset_tracks+1, cue->track_count); 379 + return buf; 380 + } 381 + return NULL; 372 382 } 373 383 374 384 #ifdef HAVE_LCD_BITMAP ··· 402 412 && id3->elapsed >= (cue->curr_track+1)->offset))) 403 413 { 404 414 cue_find_current_track(cue, id3->elapsed); 405 - cue_spoof_id3(cue, id3); 406 415 return true; 407 416 } 408 417 return false;
+4 -2
apps/cuesheet.h
··· 26 26 #include "screens.h" 27 27 #include "file.h" 28 28 #include "metadata.h" 29 + #include "skin_engine/skin_tokens.h" 29 30 30 31 #define MAX_NAME 80 /* Max length of information strings */ 31 32 #define MAX_TRACKS 99 /* Max number of tracks in a cuesheet */ ··· 69 70 /* finds the index of the current track played within a cuesheet */ 70 71 int cue_find_current_track(struct cuesheet *cue, unsigned long curpos); 71 72 72 - /* update the id3 info to that of the currently playing track in the cuesheet */ 73 - void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3); 73 + /* Get the id3 fields from the cuesheet */ 74 + const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3, 75 + int offset_tracks, char *buf, int buf_size); 74 76 75 77 /* skip to next track in the cuesheet towards "direction" (which is 1 or -1) */ 76 78 bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_pos);
+7
apps/gui/skin_engine/skin_tokens.c
··· 34 34 #include "powermgmt.h" 35 35 #include "sound.h" 36 36 #include "debug.h" 37 + #include "cuesheet.h" 37 38 #ifdef HAVE_LCD_CHARCELLS 38 39 #include "hwcompat.h" 39 40 #endif ··· 513 514 *intval = -1; 514 515 } 515 516 517 + if (state->id3 && state->id3->cuesheet) 518 + { 519 + out_text = get_cuesheetid3_token(token, state->id3, token->next?1:0, buf, buf_size); 520 + if (out_text) 521 + return out_text; 522 + } 516 523 out_text = get_id3_token(token, id3, buf, buf_size, limit, intval); 517 524 if (out_text) 518 525 return out_text;
-1
apps/gui/wps.c
··· 1230 1230 if (wps_state.id3->cuesheet) 1231 1231 { 1232 1232 cue_find_current_track(wps_state.id3->cuesheet, wps_state.id3->elapsed); 1233 - cue_spoof_id3(wps_state.id3->cuesheet, wps_state.id3); 1234 1233 } 1235 1234 wps_sync_data.do_full_update = true; 1236 1235 }
-1
apps/mpeg.c
··· 2079 2079 parse_cuesheet(cuepath, curr_cuesheet)) 2080 2080 { 2081 2081 id3->cuesheet = curr_cuesheet; 2082 - cue_spoof_id3(curr_cuesheet, id3); 2083 2082 } 2084 2083 } 2085 2084 return id3;
-2
apps/playback.c
··· 524 524 { 525 525 bufread(tracks[cur_idx].cuesheet_hid, sizeof(struct cuesheet), curr_cue); 526 526 thistrack_id3->cuesheet = curr_cue; 527 - cue_spoof_id3(thistrack_id3->cuesheet, thistrack_id3); 528 527 } 529 528 return thistrack_id3; 530 529 } ··· 538 537 { 539 538 bufread(tracks[cur_idx].cuesheet_hid, sizeof(struct cuesheet), curr_cue); 540 539 othertrack_id3->cuesheet = curr_cue; 541 - cue_spoof_id3(othertrack_id3->cuesheet, othertrack_id3); 542 540 } 543 541 return othertrack_id3; 544 542 }