Fix red and yellow. Move resume_index from mp3entry to playlist_info struct. Bump codec api.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29691 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4df825be43
commit
39d9d8bab1
7 changed files with 22 additions and 24 deletions
|
@ -266,7 +266,6 @@ struct mp3entry {
|
|||
|
||||
/* resume related */
|
||||
unsigned long offset; /* bytes played */
|
||||
int index; /* playlist index */
|
||||
|
||||
#ifdef HAVE_TAGCACHE
|
||||
unsigned char autoresumable; /* caches result of autoresumable() */
|
||||
|
|
|
@ -2751,7 +2751,6 @@ void audio_next(void)
|
|||
continue;
|
||||
}
|
||||
index = playlist_next(steps);
|
||||
taginfo.index = index;
|
||||
current_track_counter++;
|
||||
is_playing = true;
|
||||
playing = true;
|
||||
|
@ -2780,7 +2779,6 @@ void audio_prev(void)
|
|||
continue;
|
||||
}
|
||||
index = playlist_next(steps);
|
||||
taginfo.index = index;
|
||||
current_track_counter++;
|
||||
is_playing = true;
|
||||
playing = true;
|
||||
|
|
|
@ -233,15 +233,6 @@ static void audio_stop_playback(void);
|
|||
|
||||
/**************************************/
|
||||
|
||||
/** Playlist callback */
|
||||
|
||||
/* This callback is required to update the resume index in case of changing
|
||||
* a playlist and pausing/resuming before the next track change. */
|
||||
void playback_set_playlist_index(int index)
|
||||
{
|
||||
thistrack_id3->index = index;
|
||||
}
|
||||
|
||||
/** Pcmbuf callbacks */
|
||||
|
||||
/* Between the codec and PCM track change, we need to keep updating the
|
||||
|
@ -2216,7 +2207,7 @@ static void audio_thread(void)
|
|||
/* PCM track change done */
|
||||
LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED");
|
||||
/* Set new playlist position for resuming. */
|
||||
thistrack_id3->index = playlist_get_index();
|
||||
playlist_update_resume_index();
|
||||
if (filling != STATE_ENDING)
|
||||
audio_finalise_track_change();
|
||||
else if (playing)
|
||||
|
|
|
@ -67,7 +67,6 @@ long audio_filebufused(void);
|
|||
void audio_pre_ff_rewind(void);
|
||||
void audio_skip(int direction);
|
||||
void audio_hard_stop(void); /* Stops audio from serving playback */
|
||||
void playback_set_playlist_index(int index);
|
||||
#ifdef HAVE_CROSSFADE
|
||||
void audio_set_crossfade(int enable);
|
||||
#endif
|
||||
|
|
|
@ -821,7 +821,7 @@ static int add_track_to_playlist(struct playlist_info* playlist,
|
|||
playlist->num_inserted_tracks++;
|
||||
|
||||
/* Update index for resume. */
|
||||
playback_set_playlist_index(playlist->index);
|
||||
playlist_update_resume_index();
|
||||
|
||||
return insert_position;
|
||||
}
|
||||
|
@ -924,7 +924,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
|
|||
}
|
||||
|
||||
/* Update index for resume. */
|
||||
playback_set_playlist_index(playlist->index);
|
||||
playlist_update_resume_index();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -986,7 +986,7 @@ static int randomise_playlist(struct playlist_info* playlist,
|
|||
}
|
||||
|
||||
/* Update index for resume. */
|
||||
playback_set_playlist_index(playlist->index);
|
||||
playlist_update_resume_index();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1029,7 +1029,7 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current,
|
|||
}
|
||||
|
||||
/* Update index for resume. */
|
||||
playback_set_playlist_index(playlist->index);
|
||||
playlist_update_resume_index();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1205,7 +1205,7 @@ static void find_and_set_playlist_index(struct playlist_info* playlist,
|
|||
}
|
||||
|
||||
/* Update index for resume. */
|
||||
playback_set_playlist_index(playlist->index);
|
||||
playlist_update_resume_index();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2633,15 +2633,24 @@ int playlist_get_index(void)
|
|||
return current_playlist.index;
|
||||
}
|
||||
|
||||
/* Update resume index within playlist_info structure. */
|
||||
void playlist_update_resume_index(void)
|
||||
{
|
||||
struct playlist_info* playlist = ¤t_playlist;
|
||||
playlist->resume_index = playlist->index;
|
||||
}
|
||||
|
||||
/* Update resume info for current playing song. Returns -1 on error. */
|
||||
int playlist_update_resume_info(const struct mp3entry* id3)
|
||||
{
|
||||
struct playlist_info* playlist = ¤t_playlist;
|
||||
|
||||
if (id3)
|
||||
{
|
||||
if (global_status.resume_index != id3->index ||
|
||||
if (global_status.resume_index != playlist->resume_index ||
|
||||
global_status.resume_offset != id3->offset)
|
||||
{
|
||||
global_status.resume_index = id3->index;
|
||||
global_status.resume_index = playlist->resume_index;
|
||||
global_status.resume_offset = id3->offset;
|
||||
status_save();
|
||||
}
|
||||
|
@ -3190,7 +3199,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
|
|||
#endif
|
||||
|
||||
/* Update index for resume. */
|
||||
playback_set_playlist_index(playlist->index);
|
||||
playlist_update_resume_index();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ struct playlist_info
|
|||
int buffer_end_pos; /* last position where buffer was written */
|
||||
int index; /* index of current playing track */
|
||||
int first_index; /* index of first song in playlist */
|
||||
int resume_index; /* index of playing track to resume */
|
||||
int amount; /* number of tracks in the index */
|
||||
int last_insert_pos; /* last position we inserted a track */
|
||||
int seed; /* shuffle seed */
|
||||
|
@ -175,5 +176,6 @@ int playlist_directory_tracksearch(const char* dirname, bool recurse,
|
|||
int (*callback)(char*, void*),
|
||||
void* context);
|
||||
int playlist_remove_all_tracks(struct playlist_info *playlist);
|
||||
void playlist_update_resume_index(void);
|
||||
|
||||
#endif /* __PLAYLIST_H__ */
|
||||
|
|
|
@ -145,12 +145,12 @@ void* plugin_get_buffer(size_t *buffer_size);
|
|||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||
|
||||
/* increase this every time the api struct changes */
|
||||
#define PLUGIN_API_VERSION 202
|
||||
#define PLUGIN_API_VERSION 203
|
||||
|
||||
/* update this to latest version if a change to the api struct breaks
|
||||
backwards compatibility (and please take the opportunity to sort in any
|
||||
new function which are "waiting" at the end of the function table) */
|
||||
#define PLUGIN_MIN_API_VERSION 202
|
||||
#define PLUGIN_MIN_API_VERSION 203
|
||||
|
||||
/* plugin return codes */
|
||||
/* internal returns start at 0x100 to make exit(1..255) work */
|
||||
|
|
Loading…
Reference in a new issue