diff --git a/include/vlc_media_library.h b/include/vlc_media_library.h index eeaa1460f6b61b43836ab4b97b80a2142d9b436b..b038566d7a9751e7fb4c78c86d2033b41f0e5cd4 100644 --- a/include/vlc_media_library.h +++ b/include/vlc_media_library.h @@ -229,9 +229,16 @@ typedef struct vlc_ml_media_t typedef struct vlc_ml_playlist_t { int64_t i_id; + char* psz_name; - uint32_t i_creation_date; + + char* psz_mrl; + char* psz_artwork_mrl; + + uint32_t i_creation_date; + + bool b_is_read_only; } vlc_ml_playlist_t; typedef struct vlc_ml_artist_t diff --git a/modules/misc/medialibrary/entities.cpp b/modules/misc/medialibrary/entities.cpp index 02c106e4e17011e61763188ab87c513fa6d908a1..1e7bbd1cef68e9fd1ebfa5f09f3a02167baf2ec4 100644 --- a/modules/misc/medialibrary/entities.cpp +++ b/modules/misc/medialibrary/entities.cpp @@ -410,9 +410,20 @@ bool Convert( const medialibrary::IPlaylist* input, vlc_ml_playlist_t& output ) { output.i_id = input->id(); + output.i_creation_date = input->creationDate(); + + output.b_is_read_only = input->isReadOnly(); + if( !strdup_helper( input->name(), output.psz_name ) || !strdup_helper( input->artworkMrl(), output.psz_artwork_mrl ) ) return false; + + // NOTE: mrl() must only be called when isReadOnly() is true. + if( output.b_is_read_only && !strdup_helper( input->mrl(), output.psz_mrl ) ) + return false; + else + output.psz_mrl = nullptr; + return true; } diff --git a/src/misc/medialibrary.c b/src/misc/medialibrary.c index 140f055b5f9d3d7d843f59b8aa996ab247b95a35..f83fc8584b191c58344098443ec8c373108f1a2d 100644 --- a/src/misc/medialibrary.c +++ b/src/misc/medialibrary.c @@ -233,8 +233,9 @@ void vlc_ml_genre_release( vlc_ml_genre_t* p_genre ) static void vlc_ml_playlist_release_inner( vlc_ml_playlist_t* p_playlist ) { - free( p_playlist->psz_artwork_mrl ); free( p_playlist->psz_name ); + free( p_playlist->psz_mrl ); + free( p_playlist->psz_artwork_mrl ); } void vlc_ml_playlist_release( vlc_ml_playlist_t* p_playlist )