diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-02-10 10:26:07 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-02-10 10:26:07 +0000 |
commit | edfff8a5efb1bca75f8b49c3ad3dd151653d39c8 (patch) | |
tree | 88d2c99f09f107489f67250403aa7e9c1ccdb26f | |
parent | 6f9d2ad130701ec6b54ed90885c6972dbef79d27 (diff) | |
download | rockbox-edfff8a5efb1bca75f8b49c3ad3dd151653d39c8.tar.gz rockbox-edfff8a5efb1bca75f8b49c3ad3dd151653d39c8.zip |
audio_peek_track should copy the struct mp3entry instead of pointing directly into the buffer. Despite the dire warning, caller does in fact yield/sleep and its usage is too nonlocalized to control that reliably.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29275 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 14 | ||||
-rw-r--r-- | apps/playback.c | 13 | ||||
-rw-r--r-- | firmware/export/audio.h | 2 |
3 files changed, 16 insertions, 13 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index ddc2221ce6..f455999b2a 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -563,17 +563,15 @@ static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename) | |||
563 | fname = playlist_peek(offset, filename_buf, sizeof(filename_buf)); | 563 | fname = playlist_peek(offset, filename_buf, sizeof(filename_buf)); |
564 | *filename = (char*)fname; | 564 | *filename = (char*)fname; |
565 | #if CONFIG_CODEC == SWCODEC | 565 | #if CONFIG_CODEC == SWCODEC |
566 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | ||
567 | static struct mp3entry tempid3; | 566 | static struct mp3entry tempid3; |
568 | if (tagcache_fill_tags(&tempid3, fname)) | 567 | if ( |
569 | { | 568 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) |
570 | pid3 = &tempid3; | 569 | tagcache_fill_tags(&tempid3, fname) || |
571 | } | ||
572 | else | ||
573 | #endif | 570 | #endif |
571 | audio_peek_track(&tempid3, offset) | ||
572 | ) | ||
574 | { | 573 | { |
575 | if (!audio_peek_track(&pid3, offset)) | 574 | pid3 = &tempid3; |
576 | pid3 = NULL; | ||
577 | } | 575 | } |
578 | #endif | 576 | #endif |
579 | } | 577 | } |
diff --git a/apps/playback.c b/apps/playback.c index 3a7faa3d8d..a99a22372e 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -628,8 +628,8 @@ struct mp3entry* audio_next_track(void) | |||
628 | return NULL; | 628 | return NULL; |
629 | } | 629 | } |
630 | 630 | ||
631 | /* gets a pointer to the id3 data, Not thread safe!, DON'T yield()/sleep() */ | 631 | /* gets a copy of the id3 data */ |
632 | bool audio_peek_track(struct mp3entry** id3, int offset) | 632 | bool audio_peek_track(struct mp3entry* id3, int offset) |
633 | { | 633 | { |
634 | int next_idx; | 634 | int next_idx; |
635 | int new_offset = ci.new_track + wps_offset + offset; | 635 | int new_offset = ci.new_track + wps_offset + offset; |
@@ -640,8 +640,13 @@ bool audio_peek_track(struct mp3entry** id3, int offset) | |||
640 | 640 | ||
641 | if (tracks[next_idx].id3_hid >= 0) | 641 | if (tracks[next_idx].id3_hid >= 0) |
642 | { | 642 | { |
643 | return bufgetdata(tracks[next_idx].id3_hid, 0, (void**)id3) | 643 | struct mp3entry *id3src; |
644 | == sizeof(struct mp3entry); | 644 | if (bufgetdata(tracks[next_idx].id3_hid, 0, (void**)&id3src) |
645 | == sizeof(struct mp3entry)) | ||
646 | { | ||
647 | copy_mp3entry(id3, id3src); | ||
648 | return true; | ||
649 | } | ||
645 | } | 650 | } |
646 | return false; | 651 | return false; |
647 | } | 652 | } |
diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 34bcfb6b8f..910791c7fd 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h | |||
@@ -60,7 +60,7 @@ void audio_ff_rewind(long newpos); | |||
60 | void audio_flush_and_reload_tracks(void); | 60 | void audio_flush_and_reload_tracks(void); |
61 | struct mp3entry* audio_current_track(void); | 61 | struct mp3entry* audio_current_track(void); |
62 | struct mp3entry* audio_next_track(void); | 62 | struct mp3entry* audio_next_track(void); |
63 | bool audio_peek_track(struct mp3entry** id3, int offset); | 63 | bool audio_peek_track(struct mp3entry* id3, int offset); |
64 | #ifdef HAVE_DISK_STORAGE | 64 | #ifdef HAVE_DISK_STORAGE |
65 | void audio_set_buffer_margin(int setting); | 65 | void audio_set_buffer_margin(int setting); |
66 | #endif | 66 | #endif |