diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2021-11-19 05:11:13 +0100 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-01-22 08:29:40 -0500 |
commit | bc5a6385949c9f0a17173f3512aa9a6db9175803 (patch) | |
tree | b7b2990a4a43d6027f19cbe32a22cd2f0774d0b1 /apps/playback.c | |
parent | aafe2dd2d14e1ce88b5c9c819277ca0bc98af6e5 (diff) | |
download | rockbox-bc5a6385949c9f0a17173f3512aa9a6db9175803.tar.gz rockbox-bc5a6385949c9f0a17173f3512aa9a6db9175803.zip |
Option to switch off album art or to prefer file over embedded
Large embedded album art can cause pauses during
playback or when skipping between tracks, especially
on older devices, but embedded art is currently loaded
even when separately stored smaller image files would be
available.
A workaround is to remove large album art from the
metadata of files.
This now adds a setting to either turn off loading of
album art completely, or to prefer loading the album art
from a separate image file and thus ignore the embedded
versions.
Change-Id: I22fb581abf56072e35e6c29d72e553747ec1a96a
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 29 |
1 files changed, 25 insertions, 4 deletions
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 | { |