Skip to content
Snippets Groups Projects
Commit 329758a9 authored by Prince Gupta's avatar Prince Gupta :speech_balloon: Committed by Hugo Beauzée-Luyssen
Browse files

medialibrary: add thumbnail to vlc_ml_genre_t

parent 52424a5e
No related branches found
No related tags found
1 merge request!845qt: save genre cover in medialibrary
......@@ -295,6 +295,7 @@ typedef struct vlc_ml_genre_t
int64_t i_id;
char* psz_name;
size_t i_nb_tracks;
vlc_ml_thumbnail_t thumbnails[VLC_ML_THUMBNAIL_SIZE_COUNT];
} vlc_ml_genre_t;
typedef struct vlc_ml_media_list_t
......
......@@ -385,7 +385,24 @@ bool Convert( const medialibrary::IGenre* input, vlc_ml_genre_t& output )
output.i_id = input->id();
output.i_nb_tracks = input->nbTracks();
assert( input->name().empty() == false );
return strdup_helper( input->name(), output.psz_name );
if ( !strdup_helper( input->name(), output.psz_name ) )
return false;
for (int i = VLC_ML_THUMBNAIL_SMALL; i < VLC_ML_THUMBNAIL_SIZE_COUNT; ++i)
{
const auto sizeType = static_cast<medialibrary::ThumbnailSizeType>(i);
if ( input->hasThumbnail( sizeType ) )
{
const auto thumbnailMrl = input->thumbnailMrl( sizeType );
assert( !thumbnailMrl.empty() );
if ( !strdup_helper( thumbnailMrl, output.thumbnails[i].psz_mrl ) )
return false;
}
}
return true;
}
bool Convert( const medialibrary::IShow* input, vlc_ml_show_t& output )
......
......@@ -227,6 +227,7 @@ void vlc_ml_genre_release( vlc_ml_genre_t* p_genre )
{
if ( p_genre == NULL )
return;
vlc_ml_thumbnails_release( p_genre->thumbnails );
free( p_genre->psz_name );
free( p_genre );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment