[vlc-devel] [PATCH] Do not use album art if the file has a built-in cover.

Rémi Denis-Courmont remi at remlab.net
Fri Feb 5 19:55:03 UTC 2021


Le sunnuntaina 31. tammikuuta 2021, 13.19.10 EET Samo Golež a écrit :
> Currently, VLC uses the same image if the files are from the same album, but
> with this PATCH, if the file has a built-in image, it will be used instead
> of the album image.

The patch seems to be doing multiple things that had better be split in 
separate and better explained change sets.

Also inline

> ---
>  src/input/meta.c        |  2 +
>  src/preparser/art.c     | 84 +++++++++++++++++++++++++++++------------
>  src/preparser/art.h     |  1 +
>  src/preparser/fetcher.c | 38 ++++++++++++++-----
>  src/preparser/fetcher.h |  6 +++
>  5 files changed, 97 insertions(+), 34 deletions(-)
> 
> diff --git a/src/input/meta.c b/src/input/meta.c
> index 9ef43ca..ba7a97b 100644
> --- a/src/input/meta.c
> +++ b/src/input/meta.c
> @@ -212,6 +212,8 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t
> *p_input, msg_Warn( p_input, "art already fetched" );
>          if( likely(input_FindArtInCache( p_item ) == VLC_SUCCESS) )
>              return;
> +        if( likely(input_FindAlbumArtInCache( p_item ) == VLC_SUCCESS) )
> +            return;
>      }

This looks suspicious and inconsistent.  The rule for fetching art should not 
depend on the call site.

> 
>      /* */
> diff --git a/src/preparser/art.c b/src/preparser/art.c
> index 9fa9e66..a44e2be 100644
> --- a/src/preparser/art.c
> +++ b/src/preparser/art.c
> @@ -56,12 +56,12 @@ static void ArtCacheCreateDir( char *psz_dir )
> 
>  static char* ArtCacheGetDirPath( const char *psz_arturl, const char
> *psz_artist, const char *psz_album,  const char *psz_date, -               
>                  const char *psz_title )
> +                                 const char *psz_title,  bool b_unique )
>  {
>      char *psz_dir;
>      char *psz_cachedir = config_GetUserDir(VLC_CACHE_DIR);
> 
> -    if( !EMPTY_STR(psz_artist) && !EMPTY_STR(psz_album) )
> +    if( !EMPTY_STR(psz_artist) && !EMPTY_STR(psz_album) && !b_unique )
>      {
>          char *psz_album_sanitized = strdup( psz_album );
>          if (!psz_album_sanitized)
> @@ -108,6 +108,8 @@ static char* ArtCacheGetDirPath( const char *psz_arturl,
> const char *psz_artist,
> 
>          vlc_hash_md5_t md5;
>          vlc_hash_md5_Init( &md5 );
> +        if (!psz_arturl)
> +            return NULL;

Leaks, also other occurences further down.

>          vlc_hash_md5_Update( &md5, psz_arturl, strlen( psz_arturl ) );
>          if( !strncmp( psz_arturl, "attachment://", 13 ) )
>              vlc_hash_md5_Update( &md5, psz_title, strlen( psz_title ) );


-- 
Реми Дёни-Курмон
http://www.remlab.net/





More information about the vlc-devel mailing list