mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
skin_token.c, playback.c, add get_temp_mp3entry()
add function get_temp_mp3entry() to return a valid mp3entry from scratch_mem UNBUFFERED_ID3 or if playback hasn't been started used statically allocated mp3entry NEXTTRACK_ID3 Change-Id: I3909fb585e0f5ad590f917ce827e991440f1fe75
This commit is contained in:
parent
d323d968d8
commit
b07d7d6af0
3 changed files with 51 additions and 19 deletions
|
@ -428,6 +428,30 @@ static inline struct mp3entry * id3_get(enum audio_id3_types id3_num)
|
|||
}
|
||||
}
|
||||
|
||||
struct mp3entry* get_temp_mp3entry(struct mp3entry *free)
|
||||
{
|
||||
/* free should be NULL on first call pass back the returned mp3entry to unlock */
|
||||
enum audio_id3_types id3_num = UNBUFFERED_ID3;
|
||||
/* playback hasn't started return NEXTTRACK_ID3 (statically allocated) */
|
||||
if (!audio_scratch_memory)
|
||||
id3_num = NEXTTRACK_ID3;
|
||||
|
||||
if (free)
|
||||
{
|
||||
/* scratch_mem_init() has to aquire the lock
|
||||
* to change id3_num via audio_scratch_memory.. */
|
||||
if (free == id3_get(id3_num))
|
||||
id3_mutex_unlock();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
id3_mutex_lock();
|
||||
|
||||
struct mp3entry *temp_id3 = id3_get(id3_num);
|
||||
wipe_mp3entry(temp_id3);
|
||||
return temp_id3;
|
||||
}
|
||||
|
||||
/* Copy an mp3entry into one of the mp3 entries */
|
||||
static void id3_write(enum audio_id3_types id3_num,
|
||||
const struct mp3entry *id3_src)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue