diff options
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/apps/playback.c b/apps/playback.c index 0b2c9bb76c..5c526f94ed 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include "icons.h" | 66 | #include "icons.h" |
67 | #include "peakmeter.h" | 67 | #include "peakmeter.h" |
68 | #include "action.h" | 68 | #include "action.h" |
69 | #include "albumart.h" | ||
69 | #endif | 70 | #endif |
70 | #include "lang.h" | 71 | #include "lang.h" |
71 | #include "bookmark.h" | 72 | #include "bookmark.h" |
@@ -217,6 +218,9 @@ struct track_info { | |||
217 | int audio_hid; /* The ID for the track's buffer handle */ | 218 | int audio_hid; /* The ID for the track's buffer handle */ |
218 | int id3_hid; /* The ID for the track's metadata handle */ | 219 | int id3_hid; /* The ID for the track's metadata handle */ |
219 | int codec_hid; /* The ID for the track's codec handle */ | 220 | int codec_hid; /* The ID for the track's codec handle */ |
221 | #ifdef HAVE_ALBUMART | ||
222 | int aa_hid; /* The ID for the track's album art handle */ | ||
223 | #endif | ||
220 | 224 | ||
221 | size_t filesize; /* File total length */ | 225 | size_t filesize; /* File total length */ |
222 | 226 | ||
@@ -391,6 +395,15 @@ static bool clear_track_info(struct track_info *track) | |||
391 | return false; | 395 | return false; |
392 | } | 396 | } |
393 | 397 | ||
398 | #ifdef HAVE_ALBUMART | ||
399 | if (track->aa_hid >= 0) { | ||
400 | if (bufclose(track->aa_hid)) | ||
401 | track->aa_hid = -1; | ||
402 | else | ||
403 | return false; | ||
404 | #endif | ||
405 | } | ||
406 | |||
394 | track->filesize = 0; | 407 | track->filesize = 0; |
395 | track->taginfo_ready = false; | 408 | track->taginfo_ready = false; |
396 | track->event_sent = false; | 409 | track->event_sent = false; |
@@ -635,6 +648,13 @@ void audio_remove_encoder(void) | |||
635 | 648 | ||
636 | #endif /* HAVE_RECORDING */ | 649 | #endif /* HAVE_RECORDING */ |
637 | 650 | ||
651 | #ifdef HAVE_ALBUMART | ||
652 | int audio_current_aa_hid(void) | ||
653 | { | ||
654 | return CUR_TI->aa_hid; | ||
655 | } | ||
656 | #endif | ||
657 | |||
638 | struct mp3entry* audio_current_track(void) | 658 | struct mp3entry* audio_current_track(void) |
639 | { | 659 | { |
640 | const char *filename; | 660 | const char *filename; |
@@ -2381,6 +2401,16 @@ static bool audio_load_track(int offset, bool start_play) | |||
2381 | else | 2401 | else |
2382 | track_id3 = bufgetid3(tracks[track_widx].id3_hid); | 2402 | track_id3 = bufgetid3(tracks[track_widx].id3_hid); |
2383 | 2403 | ||
2404 | |||
2405 | #ifdef HAVE_ALBUMART | ||
2406 | if (gui_sync_wps_uses_albumart()) | ||
2407 | { | ||
2408 | char aa_path[MAX_PATH]; | ||
2409 | if (find_albumart(track_id3, aa_path, sizeof(aa_path))) | ||
2410 | tracks[track_widx].aa_hid = bufopen(aa_path, 0, TYPE_BITMAP); | ||
2411 | } | ||
2412 | #endif | ||
2413 | |||
2384 | track_id3->elapsed = 0; | 2414 | track_id3->elapsed = 0; |
2385 | 2415 | ||
2386 | enum data_type type = TYPE_PACKET_AUDIO; | 2416 | enum data_type type = TYPE_PACKET_AUDIO; |
@@ -3286,6 +3316,9 @@ void audio_init(void) | |||
3286 | tracks[i].audio_hid = -1; | 3316 | tracks[i].audio_hid = -1; |
3287 | tracks[i].id3_hid = -1; | 3317 | tracks[i].id3_hid = -1; |
3288 | tracks[i].codec_hid = -1; | 3318 | tracks[i].codec_hid = -1; |
3319 | #ifdef HAVE_ALBUMART | ||
3320 | tracks[i].aa_hid = -1; | ||
3321 | #endif | ||
3289 | } | 3322 | } |
3290 | 3323 | ||
3291 | /* Probably safe to say */ | 3324 | /* Probably safe to say */ |