[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rockbox-cvs
Subject:    Album Art: Eliminate redundant check
From:       rockbox-gerrit-noreply--- via rockbox-cvs <rockbox-cvs () lists ! haxx ! se>
Date:       2022-04-18 13:13:33
Message-ID: 202204181313.23IDDXDU042805 () archos ! rockbox ! org
[Download RAW message or body]

commit 4d7327b04d8e5384973185cc649a56e2779be714
Author: Christian Soffke <christian.soffke@gmail.com>
Date:   Tue Apr 12 17:54:37 2022 +0200

    Album Art: Eliminate redundant check
    
    When the 'Album Art' setting was set to
    'Prefer Image File' and neither image file
    nor embedded artwork were found,
    playback would check for files twice.
    
    Change-Id: Ibe392928d58ec04103e2572124841724509bd859

diff --git a/apps/playback.c b/apps/playback.c
index 59d70842ee..a56c6d17ec 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1710,6 +1710,7 @@ static int audio_load_albumart(struct track_info *infop,
         struct bufopen_bitmap_data user_data;
         int *aa_hid = &infop->aa_hid[i];
         int hid = ERR_UNSUPPORTED_TYPE;
+        bool checked_image_file = false;
 
         /* albumart_slots may change during a yield of bufopen,
          * but that's no problem */
@@ -1721,12 +1722,15 @@ static int audio_load_albumart(struct track_info *infop,
         user_data.dim = &albumart_slots[i].dim;
 
         char path[MAX_PATH];
-        if(global_settings.album_art == AA_PREFER_IMAGE_FILE &&
-           find_albumart(track_id3, path, sizeof(path),
-                          &albumart_slots[i].dim))
+        if(global_settings.album_art == AA_PREFER_IMAGE_FILE)
         {
+            if (find_albumart(track_id3, path, sizeof(path),
+                          &albumart_slots[i].dim))
+            {
                 user_data.embedded_albumart = NULL;
                 hid = bufopen(path, 0, TYPE_BITMAP, &user_data);
+            }
+            checked_image_file = true;
         }
 
         /* We can only decode jpeg for embedded AA */
@@ -1738,7 +1742,7 @@ static int audio_load_albumart(struct track_info *infop,
             hid = bufopen(track_id3->path, 0, TYPE_BITMAP, &user_data);
         }
 
-        if (global_settings.album_art != AA_OFF &&
+        if (global_settings.album_art != AA_OFF && !checked_image_file &&
             hid < 0 && hid != ERR_BUFFER_FULL)
         {
             /* No embedded AA or it couldn't be loaded - try other sources */
-- 
rockbox-cvs mailing list
rockbox-cvs@lists.haxx.se
https://lists.haxx.se/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic