medialibrary: rename vlc_ml_entry_point_t to vlc_ml_folder_t

This better reflects the medialibrary internals while also allowing more
flexible medialibrary folder listing as vlc_ml_folder_t is now available
through a more generic name.
This commit is contained in:
Alaric Senat 2021-02-25 13:58:53 +01:00 committed by Jean-Baptiste Kempf
parent 761079335c
commit 3cb3b1f647
11 changed files with 33 additions and 32 deletions

View File

@ -330,18 +330,18 @@ typedef struct vlc_ml_playlist_list_t
vlc_ml_playlist_t p_items[];
} vlc_ml_playlist_list_t;
typedef struct vlc_ml_entry_point_t
typedef struct vlc_ml_folder_t
{
char* psz_mrl; /**< This entrypoint's MRL. Will be NULL if b_present is false */
bool b_present; /**< The presence state for this entrypoint. */
bool b_banned; /**< Will be true if the user required this entrypoint to be excluded */
} vlc_ml_entry_point_t;
char* psz_mrl; /**< This folder's MRL. Will be NULL if b_present is false */
bool b_present; /**< The presence state for this folder. */
bool b_banned; /**< Will be true if the user required this folder to be excluded */
} vlc_ml_folder_t;
typedef struct vlc_ml_entry_point_list_t
typedef struct vlc_ml_folder_list_t
{
size_t i_nb_items;
vlc_ml_entry_point_t p_items[];
} vlc_ml_entry_point_list_t;
vlc_ml_folder_t p_items[];
} vlc_ml_folder_list_t;
typedef struct vlc_ml_bookmark_t
{
@ -500,8 +500,8 @@ enum vlc_ml_control
VLC_ML_REMOVE_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
VLC_ML_BAN_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
VLC_ML_UNBAN_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
VLC_ML_LIST_FOLDERS, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
VLC_ML_LIST_BANNED_FOLDERS, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
VLC_ML_LIST_FOLDERS, /**< arg1: entrypoints (vlc_ml_folder_list_t**); res: can fail */
VLC_ML_LIST_BANNED_FOLDERS, /**< arg1: entrypoints (vlc_ml_folder_list_t**); res: can fail */
VLC_ML_IS_INDEXED, /**< arg1: mrl (const char*) arg2 (out): bool*; res: can fail */
/**
* Reload a specific folder, or all.
@ -886,7 +886,7 @@ VLC_API void vlc_ml_show_list_release( vlc_ml_show_list_t* p_list );
VLC_API void vlc_ml_genre_list_release( vlc_ml_genre_list_t* p_list );
VLC_API void vlc_ml_group_list_release( vlc_ml_group_list_t* p_list );
VLC_API void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t* p_list );
VLC_API void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t* p_list );
VLC_API void vlc_ml_folder_list_release( vlc_ml_folder_list_t* p_list );
VLC_API void vlc_ml_playback_states_all_release( vlc_ml_playback_states_all* prefs );
VLC_API void vlc_ml_bookmark_release( vlc_ml_bookmark_t* p_bookmark );
VLC_API void vlc_ml_bookmark_list_release( vlc_ml_bookmark_list_t* p_list );
@ -923,13 +923,13 @@ static inline int vlc_ml_unban_folder( vlc_medialibrary_t* p_ml, const char* psz
}
static inline int vlc_ml_list_folder( vlc_medialibrary_t* p_ml,
vlc_ml_entry_point_list_t** pp_entrypoints )
vlc_ml_folder_list_t** pp_entrypoints )
{
return vlc_ml_control( p_ml, VLC_ML_LIST_FOLDERS, pp_entrypoints );
}
static inline int vlc_ml_list_banned_folder( vlc_medialibrary_t* p_ml,
vlc_ml_entry_point_list_t** pp_entrypoints )
vlc_ml_folder_list_t** pp_entrypoints )
{
return vlc_ml_control( p_ml, VLC_ML_LIST_BANNED_FOLDERS, pp_entrypoints );
}
@ -1670,7 +1670,7 @@ static inline size_t vlc_ml_count_playlist_media( vlc_medialibrary_t* p_ml, cons
vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
vlc_ml_group_list_t*: vlc_ml_group_list_release, \
vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release, \
vlc_ml_entry_point_list_t*: vlc_ml_entry_point_list_release, \
vlc_ml_folder_list_t*: vlc_ml_folder_list_release, \
vlc_ml_playback_states_all*: vlc_ml_playback_states_all_release, \
vlc_ml_bookmark_t*: vlc_ml_bookmark_release, \
vlc_ml_bookmark_list_t*: vlc_ml_bookmark_list_release \
@ -1692,7 +1692,7 @@ static inline void vlc_ml_release( vlc_ml_show_list_t* list ) { vlc_ml_show_list
static inline void vlc_ml_release( vlc_ml_genre_list_t* list ) { vlc_ml_genre_list_release( list ); }
static inline void vlc_ml_release( vlc_ml_group_list_t* list ) { vlc_ml_group_list_release( list ); }
static inline void vlc_ml_release( vlc_ml_playlist_list_t* list ) { vlc_ml_playlist_list_release( list ); }
static inline void vlc_ml_release( vlc_ml_entry_point_list_t* list ) { vlc_ml_entry_point_list_release( list ); }
static inline void vlc_ml_release( vlc_ml_folder_list_t* list ) { vlc_ml_folder_list_release( list ); }
static inline void vlc_ml_release( vlc_ml_playback_states_all* prefs ) { vlc_ml_playback_states_all_release( prefs ); }
static inline void vlc_ml_release( vlc_ml_bookmark_t* bookmark ) { vlc_ml_bookmark_release( bookmark ); }
static inline void vlc_ml_release( vlc_ml_bookmark_list_t* list ) { vlc_ml_bookmark_list_release( list ); }

View File

@ -207,7 +207,7 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
@interface VLCMediaLibraryEntryPoint : NSObject
- (instancetype)initWithEntryPoint:(struct vlc_ml_entry_point_t *)p_entryPoint;
- (instancetype)initWithEntryPoint:(struct vlc_ml_folder_t *)p_entryPoint;
@property (readonly) NSString *MRL;
@property (readonly) NSString *decodedMRL;

View File

@ -763,7 +763,7 @@ NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryI
@implementation VLCMediaLibraryEntryPoint
- (instancetype)initWithEntryPoint:(struct vlc_ml_entry_point_t *)p_entryPoint
- (instancetype)initWithEntryPoint:(struct vlc_ml_folder_t *)p_entryPoint
{
self = [super init];
if (self && p_entryPoint != NULL) {

View File

@ -364,7 +364,7 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
- (NSArray<VLCMediaLibraryEntryPoint *> *)listOfMonitoredFolders
{
vlc_ml_entry_point_list_t *pp_entrypoints;
vlc_ml_folder_list_t *pp_entrypoints;
int ret = vlc_ml_list_folder(_p_mediaLibrary, &pp_entrypoints);
if (ret != VLC_SUCCESS) {
msg_Err(getIntf(), "failed to retrieve list of monitored library folders (%i)", ret);
@ -379,7 +379,7 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
}
}
vlc_ml_entry_point_list_release(pp_entrypoints);
vlc_ml_folder_list_release(pp_entrypoints);
return [mutableArray copy];
}

View File

@ -29,7 +29,7 @@ MLFoldersBaseModel::MLFoldersBaseModel( QObject *parent )
connect( this , &MLFoldersBaseModel::onMLEntryPointModified , this , &MLFoldersBaseModel::update );
}
MLFoldersBaseModel::EntryPoint::EntryPoint( const vlc_ml_entry_point_t& entryPoint)
MLFoldersBaseModel::EntryPoint::EntryPoint( const vlc_ml_folder_t& entryPoint)
: mrl(entryPoint.psz_mrl)
, banned(entryPoint.b_banned)
{
@ -118,11 +118,11 @@ std::vector<MLFoldersBaseModel::EntryPoint> MLFoldersModel::entryPoints() const
{
std::vector<MLFoldersBaseModel::EntryPoint> r;
vlc_ml_entry_point_list_t * entrypoints = nullptr;
vlc_ml_folder_list_t * entrypoints = nullptr;
vlc_ml_list_folder( ml() , &entrypoints );
for ( unsigned int i=0 ; i<entrypoints->i_nb_items ; i++ )
r.emplace_back( entrypoints->p_items[i] );
vlc_ml_release(entrypoints);
vlc_ml_release( entrypoints );
return r;
}
@ -159,11 +159,11 @@ std::vector<MLFoldersBaseModel::EntryPoint> MLBannedFoldersModel::entryPoints()
{
std::vector<MLFoldersBaseModel::EntryPoint> r;
vlc_ml_entry_point_list_t * entrypoints = nullptr;
vlc_ml_folder_list_t * entrypoints = nullptr;
vlc_ml_list_banned_folder( ml() , &entrypoints );
for ( unsigned int i=0 ; i<entrypoints->i_nb_items ; i++ )
r.emplace_back( entrypoints->p_items[i] );
vlc_ml_release(entrypoints);
vlc_ml_release( entrypoints );
return r;
}

View File

@ -69,7 +69,7 @@ signals:
protected:
struct EntryPoint
{
EntryPoint(const vlc_ml_entry_point_t &entryPoint );
EntryPoint(const vlc_ml_folder_t &entryPoint );
QString mrl;
bool banned;
};

View File

@ -446,7 +446,7 @@ bool Convert( const medialibrary::IPlaylist* input, vlc_ml_playlist_t& output )
return true;
}
bool Convert( const medialibrary::IFolder* input, vlc_ml_entry_point_t& output )
bool Convert( const medialibrary::IFolder* input, vlc_ml_folder_t& output )
{
try
{

View File

@ -41,6 +41,7 @@
#include <medialibrary/IMediaGroup.h>
#include <medialibrary/IPlaylist.h>
#include <medialibrary/IBookmark.h>
#include <medialibrary/IFolder.h>
#include <sstream>
#include <initializer_list>
@ -556,9 +557,9 @@ int MediaLibrary::Control( int query, va_list args )
auto entryPoints = ( query == VLC_ML_LIST_FOLDERS )
? m_ml->entryPoints()->all()
: m_ml->bannedEntryPoints()->all();
auto res = ml_convert_list<vlc_ml_entry_point_list_t,
vlc_ml_entry_point_t>( entryPoints );
*(va_arg( args, vlc_ml_entry_point_list_t**) ) = res;
auto res = ml_convert_list<vlc_ml_folder_list_t,
vlc_ml_folder_t>( entryPoints );
*(va_arg( args, vlc_ml_folder_list_t**) ) = res;
break;
}
case VLC_ML_IS_INDEXED:

View File

@ -228,7 +228,7 @@ bool Convert( const medialibrary::IShow* input, vlc_ml_show_t& output );
bool Convert( const medialibrary::ILabel* input, vlc_ml_label_t& output );
bool Convert( const medialibrary::IMediaGroup* input, vlc_ml_group_t& output );
bool Convert( const medialibrary::IPlaylist* input, vlc_ml_playlist_t& output );
bool Convert( const medialibrary::IFolder* input, vlc_ml_entry_point_t& output );
bool Convert( const medialibrary::IFolder* input, vlc_ml_folder_t& output );
bool Convert( const medialibrary::IBookmark* input, vlc_ml_bookmark_t& output );
input_item_t* MediaToInputItem( const medialibrary::IMedia* media );

View File

@ -593,7 +593,7 @@ vlc_ml_show_list_release
vlc_ml_genre_list_release
vlc_ml_group_list_release
vlc_ml_playlist_list_release
vlc_ml_entry_point_list_release
vlc_ml_folder_list_release
vlc_ml_bookmark_release
vlc_ml_bookmark_list_release
vlc_poll_i11e

View File

@ -356,7 +356,7 @@ void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t* p_list )
free( p_list );
}
void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t* p_list )
void vlc_ml_folder_list_release( vlc_ml_folder_list_t* p_list )
{
if ( p_list == NULL )
return;