diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/quickscreen.c | 10 | ||||
-rw-r--r-- | apps/lang/english.lang | 42 | ||||
-rw-r--r-- | apps/menus/playback_menu.c | 25 | ||||
-rw-r--r-- | apps/playback.c | 29 | ||||
-rw-r--r-- | apps/playback.h | 3 | ||||
-rw-r--r-- | apps/settings.c | 3 | ||||
-rw-r--r-- | apps/settings.h | 14 | ||||
-rw-r--r-- | apps/settings_list.c | 10 | ||||
-rw-r--r-- | apps/shortcuts.c | 11 |
9 files changed, 141 insertions, 6 deletions
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index b2f5050ab3..a7d07f4e33 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c | |||
@@ -39,6 +39,9 @@ | |||
39 | #include "option_select.h" | 39 | #include "option_select.h" |
40 | #include "debug.h" | 40 | #include "debug.h" |
41 | #include "shortcuts.h" | 41 | #include "shortcuts.h" |
42 | #ifdef HAVE_ALBUMART | ||
43 | #include "playback.h" | ||
44 | #endif | ||
42 | 45 | ||
43 | /* 1 top, 1 bottom, 2 on either side, 1 for the icons | 46 | /* 1 top, 1 bottom, 2 on either side, 1 for the icons |
44 | * if enough space, top and bottom have 2 lines */ | 47 | * if enough space, top and bottom have 2 lines */ |
@@ -411,6 +414,9 @@ int quick_screen_quick(int button_enter) | |||
411 | struct gui_quickscreen qs; | 414 | struct gui_quickscreen qs; |
412 | bool oldshuffle = global_settings.playlist_shuffle; | 415 | bool oldshuffle = global_settings.playlist_shuffle; |
413 | int oldrepeat = global_settings.repeat_mode; | 416 | int oldrepeat = global_settings.repeat_mode; |
417 | #ifdef HAVE_ALBUMART | ||
418 | int old_album_art = global_settings.album_art; | ||
419 | #endif | ||
414 | bool usb = false; | 420 | bool usb = false; |
415 | 421 | ||
416 | if (global_settings.shortcuts_replaces_qs) | 422 | if (global_settings.shortcuts_replaces_qs) |
@@ -446,6 +452,10 @@ int quick_screen_quick(int button_enter) | |||
446 | else | 452 | else |
447 | playlist_sort(NULL, true); | 453 | playlist_sort(NULL, true); |
448 | } | 454 | } |
455 | #ifdef HAVE_ALBUMART | ||
456 | if (old_album_art != global_settings.album_art) | ||
457 | set_albumart_mode(global_settings.album_art); | ||
458 | #endif | ||
449 | } | 459 | } |
450 | return (usb ? 1:0); | 460 | return (usb ? 1:0); |
451 | } | 461 | } |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 86d1dc5daf..43d73a8445 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -16187,3 +16187,45 @@ | |||
16187 | *: "Descending" | 16187 | *: "Descending" |
16188 | </voice> | 16188 | </voice> |
16189 | </phrase> | 16189 | </phrase> |
16190 | <phrase> | ||
16191 | id: LANG_ALBUM_ART | ||
16192 | desc: in Settings | ||
16193 | user: core | ||
16194 | <source> | ||
16195 | *: "Album Art" | ||
16196 | </source> | ||
16197 | <dest> | ||
16198 | *: "Album Art" | ||
16199 | </dest> | ||
16200 | <voice> | ||
16201 | *: "Album Art" | ||
16202 | </voice> | ||
16203 | </phrase> | ||
16204 | <phrase> | ||
16205 | id: LANG_PREFER_EMBEDDED | ||
16206 | desc: in Settings | ||
16207 | user: core | ||
16208 | <source> | ||
16209 | *: "Prefer Embedded" | ||
16210 | </source> | ||
16211 | <dest> | ||
16212 | *: "Prefer Embedded" | ||
16213 | </dest> | ||
16214 | <voice> | ||
16215 | *: "Prefer Embedded" | ||
16216 | </voice> | ||
16217 | </phrase> | ||
16218 | <phrase> | ||
16219 | id: LANG_PREFER_IMAGE_FILE | ||
16220 | desc: in Settings | ||
16221 | user: core | ||
16222 | <source> | ||
16223 | *: "Prefer Image File" | ||
16224 | </source> | ||
16225 | <dest> | ||
16226 | *: "Prefer Image File" | ||
16227 | </dest> | ||
16228 | <voice> | ||
16229 | *: "Prefer Image File" | ||
16230 | </voice> | ||
16231 | </phrase> | ||
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index 5f9479fae3..fe319d6027 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c | |||
@@ -201,6 +201,28 @@ MENUITEM_SETTING(pause_rewind, &global_settings.pause_rewind, NULL); | |||
201 | MENUITEM_SETTING(play_frequency, &global_settings.play_frequency, | 201 | MENUITEM_SETTING(play_frequency, &global_settings.play_frequency, |
202 | playback_callback); | 202 | playback_callback); |
203 | #endif | 203 | #endif |
204 | #ifdef HAVE_ALBUMART | ||
205 | static int albumart_callback(int action, | ||
206 | const struct menu_item_ex *this_item, | ||
207 | struct gui_synclist *this_list) | ||
208 | { | ||
209 | (void)this_item; | ||
210 | (void)this_list; | ||
211 | static int initial_aa_setting; | ||
212 | switch (action) | ||
213 | { | ||
214 | case ACTION_ENTER_MENUITEM: | ||
215 | initial_aa_setting = global_settings.album_art; | ||
216 | break; | ||
217 | case ACTION_EXIT_MENUITEM: /* on exit */ | ||
218 | if (initial_aa_setting != global_settings.album_art) | ||
219 | set_albumart_mode(global_settings.album_art); | ||
220 | } | ||
221 | return action; | ||
222 | } | ||
223 | MENUITEM_SETTING(album_art, &global_settings.album_art, | ||
224 | albumart_callback); | ||
225 | #endif | ||
204 | 226 | ||
205 | MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, | 227 | MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, |
206 | Icon_Playback_menu, | 228 | Icon_Playback_menu, |
@@ -231,6 +253,9 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, | |||
231 | #ifdef HAVE_PLAY_FREQ | 253 | #ifdef HAVE_PLAY_FREQ |
232 | ,&play_frequency | 254 | ,&play_frequency |
233 | #endif | 255 | #endif |
256 | #ifdef HAVE_ALBUMART | ||
257 | ,&album_art | ||
258 | #endif | ||
234 | ); | 259 | ); |
235 | 260 | ||
236 | static int playback_callback(int action, | 261 | static int playback_callback(int action, |
diff --git a/apps/playback.c b/apps/playback.c index 4162d9b647..cac28bd6e7 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -172,6 +172,8 @@ static struct mutex id3_mutex SHAREDBSS_ATTR; /* (A,O)*/ | |||
172 | #define MAX_MULTIPLE_AA SKINNABLE_SCREENS_COUNT | 172 | #define MAX_MULTIPLE_AA SKINNABLE_SCREENS_COUNT |
173 | #ifdef HAVE_ALBUMART | 173 | #ifdef HAVE_ALBUMART |
174 | 174 | ||
175 | static int albumart_mode = -1; | ||
176 | |||
175 | static struct albumart_slot | 177 | static struct albumart_slot |
176 | { | 178 | { |
177 | struct dim dim; /* Holds width, height of the albumart */ | 179 | struct dim dim; /* Holds width, height of the albumart */ |
@@ -1690,6 +1692,15 @@ static bool audio_load_cuesheet(struct track_info *infop, | |||
1690 | } | 1692 | } |
1691 | 1693 | ||
1692 | #ifdef HAVE_ALBUMART | 1694 | #ifdef HAVE_ALBUMART |
1695 | |||
1696 | void set_albumart_mode(int setting) | ||
1697 | { | ||
1698 | if (albumart_mode != -1 && | ||
1699 | albumart_mode != setting) | ||
1700 | playback_update_aa_dims(); | ||
1701 | albumart_mode = setting; | ||
1702 | } | ||
1703 | |||
1693 | /* Load any album art for the file - returns false if the buffer is full */ | 1704 | /* Load any album art for the file - returns false if the buffer is full */ |
1694 | static int audio_load_albumart(struct track_info *infop, | 1705 | static int audio_load_albumart(struct track_info *infop, |
1695 | struct mp3entry *track_id3) | 1706 | struct mp3entry *track_id3) |
@@ -1709,18 +1720,28 @@ static int audio_load_albumart(struct track_info *infop, | |||
1709 | memset(&user_data, 0, sizeof(user_data)); | 1720 | memset(&user_data, 0, sizeof(user_data)); |
1710 | user_data.dim = &albumart_slots[i].dim; | 1721 | user_data.dim = &albumart_slots[i].dim; |
1711 | 1722 | ||
1723 | char path[MAX_PATH]; | ||
1724 | if(global_settings.album_art == AA_PREFER_IMAGE_FILE && | ||
1725 | find_albumart(track_id3, path, sizeof(path), | ||
1726 | &albumart_slots[i].dim)) | ||
1727 | { | ||
1728 | user_data.embedded_albumart = NULL; | ||
1729 | hid = bufopen(path, 0, TYPE_BITMAP, &user_data); | ||
1730 | } | ||
1731 | |||
1712 | /* We can only decode jpeg for embedded AA */ | 1732 | /* We can only decode jpeg for embedded AA */ |
1713 | if (track_id3->has_embedded_albumart && track_id3->albumart.type == AA_TYPE_JPG) | 1733 | if (global_settings.album_art != AA_OFF && |
1734 | hid < 0 && hid != ERR_BUFFER_FULL && | ||
1735 | track_id3->has_embedded_albumart && track_id3->albumart.type == AA_TYPE_JPG) | ||
1714 | { | 1736 | { |
1715 | user_data.embedded_albumart = &track_id3->albumart; | 1737 | user_data.embedded_albumart = &track_id3->albumart; |
1716 | hid = bufopen(track_id3->path, 0, TYPE_BITMAP, &user_data); | 1738 | hid = bufopen(track_id3->path, 0, TYPE_BITMAP, &user_data); |
1717 | } | 1739 | } |
1718 | 1740 | ||
1719 | if (hid < 0 && hid != ERR_BUFFER_FULL) | 1741 | if (global_settings.album_art != AA_OFF && |
1742 | hid < 0 && hid != ERR_BUFFER_FULL) | ||
1720 | { | 1743 | { |
1721 | /* No embedded AA or it couldn't be loaded - try other sources */ | 1744 | /* No embedded AA or it couldn't be loaded - try other sources */ |
1722 | char path[MAX_PATH]; | ||
1723 | |||
1724 | if (find_albumart(track_id3, path, sizeof(path), | 1745 | if (find_albumart(track_id3, path, sizeof(path), |
1725 | &albumart_slots[i].dim)) | 1746 | &albumart_slots[i].dim)) |
1726 | { | 1747 | { |
diff --git a/apps/playback.h b/apps/playback.h index a87ef873d0..b9aa413ef3 100644 --- a/apps/playback.h +++ b/apps/playback.h | |||
@@ -85,6 +85,9 @@ void audio_set_crossfade(int enable); | |||
85 | #ifdef HAVE_PLAY_FREQ | 85 | #ifdef HAVE_PLAY_FREQ |
86 | void audio_set_playback_frequency(int setting); | 86 | void audio_set_playback_frequency(int setting); |
87 | #endif | 87 | #endif |
88 | #ifdef HAVE_ALBUMART | ||
89 | void set_albumart_mode(int setting); | ||
90 | #endif | ||
88 | 91 | ||
89 | size_t audio_get_filebuflen(void); | 92 | size_t audio_get_filebuflen(void); |
90 | 93 | ||
diff --git a/apps/settings.c b/apps/settings.c index 6d49beb5e3..566573ae68 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -945,6 +945,9 @@ void settings_apply(bool read_disk) | |||
945 | lcd_bidir_scroll(global_settings.bidir_limit); | 945 | lcd_bidir_scroll(global_settings.bidir_limit); |
946 | lcd_scroll_delay(global_settings.scroll_delay); | 946 | lcd_scroll_delay(global_settings.scroll_delay); |
947 | 947 | ||
948 | #ifdef HAVE_ALBUMART | ||
949 | set_albumart_mode(global_settings.album_art); | ||
950 | #endif | ||
948 | 951 | ||
949 | #ifdef HAVE_PLAY_FREQ | 952 | #ifdef HAVE_PLAY_FREQ |
950 | /* before crossfade */ | 953 | /* before crossfade */ |
diff --git a/apps/settings.h b/apps/settings.h index b3c31476e3..936280ba5a 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -127,6 +127,15 @@ enum | |||
127 | QUEUE_SHOW_IN_SUBMENU | 127 | QUEUE_SHOW_IN_SUBMENU |
128 | }; | 128 | }; |
129 | 129 | ||
130 | #ifdef HAVE_ALBUMART | ||
131 | enum | ||
132 | { | ||
133 | AA_OFF = 0, | ||
134 | AA_PREFER_EMBEDDED, | ||
135 | AA_PREFER_IMAGE_FILE | ||
136 | }; | ||
137 | #endif | ||
138 | |||
130 | /* dir filter options */ | 139 | /* dir filter options */ |
131 | /* Note: Any new filter modes need to be added before NUM_FILTER_MODES. | 140 | /* Note: Any new filter modes need to be added before NUM_FILTER_MODES. |
132 | * Any new rockbox browse filter modes (accessible through the menu) | 141 | * Any new rockbox browse filter modes (accessible through the menu) |
@@ -598,7 +607,10 @@ struct user_settings | |||
598 | bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */ | 607 | bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */ |
599 | bool show_shuffled_adding_options; /* whether to display options for adding shuffled tracks to dynamic playlist */ | 608 | bool show_shuffled_adding_options; /* whether to display options for adding shuffled tracks to dynamic playlist */ |
600 | int show_queue_options; /* how and whether to display options to queue tracks */ | 609 | int show_queue_options; /* how and whether to display options to queue tracks */ |
601 | 610 | #ifdef HAVE_ALBUMART | |
611 | int album_art; /* switch off album art display or choose preferred source */ | ||
612 | #endif | ||
613 | |||
602 | /* playlist viewer settings */ | 614 | /* playlist viewer settings */ |
603 | bool playlist_viewer_icons; /* display icons on viewer */ | 615 | bool playlist_viewer_icons; /* display icons on viewer */ |
604 | bool playlist_viewer_indices; /* display playlist indices on viewer */ | 616 | bool playlist_viewer_indices; /* display playlist indices on viewer */ |
diff --git a/apps/settings_list.c b/apps/settings_list.c index 795d42ceba..7b24db22e5 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -927,6 +927,16 @@ const struct settings_list settings[] = { | |||
927 | #error "HAVE_PLAY_FREQ < 48???" | 927 | #error "HAVE_PLAY_FREQ < 48???" |
928 | #endif | 928 | #endif |
929 | #endif /* HAVE_PLAY_FREQ */ | 929 | #endif /* HAVE_PLAY_FREQ */ |
930 | |||
931 | #ifdef HAVE_ALBUMART | ||
932 | CHOICE_SETTING(0, album_art, LANG_ALBUM_ART, 1, | ||
933 | "album art", "off,prefer embedded,prefer image file", | ||
934 | NULL, 3, | ||
935 | ID2P(LANG_OFF), | ||
936 | ID2P(LANG_PREFER_EMBEDDED), | ||
937 | ID2P(LANG_PREFER_IMAGE_FILE)), | ||
938 | #endif | ||
939 | |||
930 | /* LCD */ | 940 | /* LCD */ |
931 | #ifdef HAVE_LCD_CONTRAST | 941 | #ifdef HAVE_LCD_CONTRAST |
932 | /* its easier to leave this one un-macro()ed for the time being */ | 942 | /* its easier to leave this one un-macro()ed for the time being */ |
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index b0a949933c..9f042a926a 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c | |||
@@ -47,7 +47,9 @@ | |||
47 | #include "screens.h" | 47 | #include "screens.h" |
48 | #include "talk.h" | 48 | #include "talk.h" |
49 | #include "yesno.h" | 49 | #include "yesno.h" |
50 | 50 | #ifdef HAVE_ALBUMART | |
51 | #include "playback.h" | ||
52 | #endif | ||
51 | 53 | ||
52 | #define MAX_SHORTCUT_NAME 32 | 54 | #define MAX_SHORTCUT_NAME 32 |
53 | #define SHORTCUTS_FILENAME ROCKBOX_DIR "/shortcuts.txt" | 55 | #define SHORTCUTS_FILENAME ROCKBOX_DIR "/shortcuts.txt" |
@@ -661,9 +663,16 @@ int do_shortcut_menu(void *ignored) | |||
661 | case SHORTCUT_SETTING: | 663 | case SHORTCUT_SETTING: |
662 | { | 664 | { |
663 | int old_sleeptimer_duration = global_settings.sleeptimer_duration; | 665 | int old_sleeptimer_duration = global_settings.sleeptimer_duration; |
666 | #ifdef HAVE_ALBUMART | ||
667 | int old_album_art = global_settings.album_art; | ||
668 | #endif | ||
664 | do_setting_screen(sc->u.setting, | 669 | do_setting_screen(sc->u.setting, |
665 | sc->name[0] ? sc->name : P2STR(ID2P(sc->u.setting->lang_id)),NULL); | 670 | sc->name[0] ? sc->name : P2STR(ID2P(sc->u.setting->lang_id)),NULL); |
666 | 671 | ||
672 | #ifdef HAVE_ALBUMART | ||
673 | if (old_album_art != global_settings.album_art) | ||
674 | set_albumart_mode(global_settings.album_art); | ||
675 | #endif | ||
667 | if (old_sleeptimer_duration != global_settings.sleeptimer_duration && | 676 | if (old_sleeptimer_duration != global_settings.sleeptimer_duration && |
668 | get_sleep_timer()) | 677 | get_sleep_timer()) |
669 | set_sleeptimer_duration(global_settings.sleeptimer_duration); | 678 | set_sleeptimer_duration(global_settings.sleeptimer_duration); |