diff options
author | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-11-11 12:29:37 +0000 |
---|---|---|
committer | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-11-11 12:29:37 +0000 |
commit | 9d4bed7ff06818b098926932db824a8d6532bfee (patch) | |
tree | 0a1cfa6a98a75a2badc1a8d2a2d7839454522beb /apps/playback.c | |
parent | f34720b163aff1d167ae031f23f3250356aa2c1b (diff) | |
download | rockbox-9d4bed7ff06818b098926932db824a8d6532bfee.tar.gz rockbox-9d4bed7ff06818b098926932db824a8d6532bfee.zip |
Album art support. Based on FS#3045, but heavily modified to adapt to MoB and for cleanness.
The cover pictures are loaded from external bitmaps. JPEG and embedded art are not supported. The pictures will only be drawn on the main display. There is no resizing but it is possible to specify the WPS bitmap size in the bitmap names (e.g. cover.100x100.bmp).
The bitmaps are stored in the main buffer and read directly from there. Currently, duplicate bitmaps will simply be present several times in the buffer, but this will be improved.
To enable for a target, #define HAVE_ALBUMART in its config file.
For more information, see the wiki page: http://www.rockbox.org/wiki/AlbumArt.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15572 a1c6a512-1295-4272-9138-f99709370657
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 */ |