summaryrefslogtreecommitdiffstats
path: root/apps/cuesheet.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-06-06 06:28:40 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-06-06 06:28:40 +0000
commitb8d98fcc1991a60ec1cde475b68fcda67153528b (patch)
treea9e33268e8b289983ee753961894d0608351dc5f /apps/cuesheet.c
parentb807cb0808b2c045e0fdcd332c711a713eb25032 (diff)
downloadrockbox-b8d98fcc1991a60ec1cde475b68fcda67153528b.tar.gz
rockbox-b8d98fcc1991a60ec1cde475b68fcda67153528b.tar.bz2
rockbox-b8d98fcc1991a60ec1cde475b68fcda67153528b.zip
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
Diffstat (limited to 'apps/cuesheet.c')
-rw-r--r--apps/cuesheet.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index c75ea65334..cadb2ab8f6 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -346,29 +346,39 @@ bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_
}
}
-
-void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3)
+const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3,
+ int offset_tracks, char *buf, int buf_size)
{
+ struct cuesheet *cue = id3?id3->cuesheet:NULL;
if (!cue || !cue->curr_track)
- return;
-
+ return NULL;
+
struct cue_track_info *track = cue->curr_track;
-
- id3->title = *track->title ? track->title : NULL;
- id3->artist = *track->performer ? track->performer : NULL;
- id3->composer = *track->songwriter ? track->songwriter : NULL;
- id3->album = *cue->title ? cue->title : NULL;
-
- /* if the album artist is the same as the track artist, we hide it. */
- if (strcmp(cue->performer, track->performer))
- id3->albumartist = *cue->performer ? cue->performer : NULL;
- else
- id3->albumartist = NULL;
-
- int i = cue->curr_track_idx;
- id3->tracknum = i+1;
- if (id3->track_string)
- snprintf(id3->track_string, 10, "%d/%d", i+1, cue->track_count);
+ if (offset_tracks)
+ {
+ if (cue->curr_track_idx+offset_tracks < cue->track_count)
+ track+=offset_tracks;
+ else
+ return NULL;
+ }
+ switch (token->type)
+ {
+ case WPS_TOKEN_METADATA_ARTIST:
+ return *track->performer ? track->performer : NULL;
+ case WPS_TOKEN_METADATA_COMPOSER:
+ return *track->songwriter ? track->songwriter : NULL;
+ case WPS_TOKEN_METADATA_ALBUM:
+ return *cue->title ? cue->title : NULL;
+ case WPS_TOKEN_METADATA_ALBUM_ARTIST:
+ return *cue->performer ? cue->performer : NULL;
+ case WPS_TOKEN_METADATA_TRACK_TITLE:
+ return *track->title ? track->title : NULL;
+ case WPS_TOKEN_METADATA_TRACK_NUMBER:
+ snprintf(buf, buf_size, "%d/%d",
+ cue->curr_track_idx+offset_tracks+1, cue->track_count);
+ return buf;
+ }
+ return NULL;
}
#ifdef HAVE_LCD_BITMAP
@@ -402,7 +412,6 @@ bool cuesheet_subtrack_changed(struct mp3entry *id3)
&& id3->elapsed >= (cue->curr_track+1)->offset)))
{
cue_find_current_track(cue, id3->elapsed);
- cue_spoof_id3(cue, id3);
return true;
}
return false;