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
This commit is contained in:
parent
b807cb0808
commit
b8d98fcc19
6 changed files with 41 additions and 27 deletions
|
@ -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;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "screens.h"
|
||||
#include "file.h"
|
||||
#include "metadata.h"
|
||||
#include "skin_engine/skin_tokens.h"
|
||||
|
||||
#define MAX_NAME 80 /* Max length of information strings */
|
||||
#define MAX_TRACKS 99 /* Max number of tracks in a cuesheet */
|
||||
|
@ -69,8 +70,9 @@ bool display_cuesheet_content(char* filename);
|
|||
/* finds the index of the current track played within a cuesheet */
|
||||
int cue_find_current_track(struct cuesheet *cue, unsigned long curpos);
|
||||
|
||||
/* update the id3 info to that of the currently playing track in the cuesheet */
|
||||
void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3);
|
||||
/* Get the id3 fields from the cuesheet */
|
||||
const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3,
|
||||
int offset_tracks, char *buf, int buf_size);
|
||||
|
||||
/* skip to next track in the cuesheet towards "direction" (which is 1 or -1) */
|
||||
bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_pos);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "powermgmt.h"
|
||||
#include "sound.h"
|
||||
#include "debug.h"
|
||||
#include "cuesheet.h"
|
||||
#ifdef HAVE_LCD_CHARCELLS
|
||||
#include "hwcompat.h"
|
||||
#endif
|
||||
|
@ -513,6 +514,12 @@ const char *get_token_value(struct gui_wps *gwps,
|
|||
*intval = -1;
|
||||
}
|
||||
|
||||
if (state->id3 && state->id3->cuesheet)
|
||||
{
|
||||
out_text = get_cuesheetid3_token(token, state->id3, token->next?1:0, buf, buf_size);
|
||||
if (out_text)
|
||||
return out_text;
|
||||
}
|
||||
out_text = get_id3_token(token, id3, buf, buf_size, limit, intval);
|
||||
if (out_text)
|
||||
return out_text;
|
||||
|
|
|
@ -1230,7 +1230,6 @@ static void track_changed_callback(void *param)
|
|||
if (wps_state.id3->cuesheet)
|
||||
{
|
||||
cue_find_current_track(wps_state.id3->cuesheet, wps_state.id3->elapsed);
|
||||
cue_spoof_id3(wps_state.id3->cuesheet, wps_state.id3);
|
||||
}
|
||||
wps_sync_data.do_full_update = true;
|
||||
}
|
||||
|
|
|
@ -2079,7 +2079,6 @@ struct mp3entry* audio_current_track(void)
|
|||
parse_cuesheet(cuepath, curr_cuesheet))
|
||||
{
|
||||
id3->cuesheet = curr_cuesheet;
|
||||
cue_spoof_id3(curr_cuesheet, id3);
|
||||
}
|
||||
}
|
||||
return id3;
|
||||
|
|
|
@ -524,7 +524,6 @@ struct mp3entry* audio_current_track(void)
|
|||
{
|
||||
bufread(tracks[cur_idx].cuesheet_hid, sizeof(struct cuesheet), curr_cue);
|
||||
thistrack_id3->cuesheet = curr_cue;
|
||||
cue_spoof_id3(thistrack_id3->cuesheet, thistrack_id3);
|
||||
}
|
||||
return thistrack_id3;
|
||||
}
|
||||
|
@ -538,7 +537,6 @@ struct mp3entry* audio_current_track(void)
|
|||
{
|
||||
bufread(tracks[cur_idx].cuesheet_hid, sizeof(struct cuesheet), curr_cue);
|
||||
othertrack_id3->cuesheet = curr_cue;
|
||||
cue_spoof_id3(othertrack_id3->cuesheet, othertrack_id3);
|
||||
}
|
||||
return othertrack_id3;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue