mirror of https://code.videolan.org/videolan/vlc
medialibrary: move entry point listing calls to list
As theses ml calls actually simply list folders, moving them to the "VLC_ML_LIST" interface makes more sense.
This commit is contained in:
parent
eab292c465
commit
e4ac8d8f08
|
@ -436,6 +436,8 @@ enum vlc_ml_list_queries
|
||||||
VLC_ML_COUNT_HISTORY_BY_TYPE, /**< arg1 vlc_ml_media_type_t: the media type. arg2 (out): vlc_ml_media_list_t** */
|
VLC_ML_COUNT_HISTORY_BY_TYPE, /**< arg1 vlc_ml_media_type_t: the media type. arg2 (out): vlc_ml_media_list_t** */
|
||||||
VLC_ML_LIST_STREAM_HISTORY, /**< arg1 (out): vlc_ml_media_list_t** */
|
VLC_ML_LIST_STREAM_HISTORY, /**< arg1 (out): vlc_ml_media_list_t** */
|
||||||
VLC_ML_COUNT_STREAM_HISTORY, /**< arg1 (out): size_t* */
|
VLC_ML_COUNT_STREAM_HISTORY, /**< arg1 (out): size_t* */
|
||||||
|
VLC_ML_LIST_ENTRY_POINTS, /**< arg1 bool: list_banned; arg2 (out): vlc_ml_folder_list_t** */
|
||||||
|
VLC_ML_COUNT_ENTRY_POINTS, /**< arg1 bool: list_banned; arg2 (out): size_t* */
|
||||||
|
|
||||||
/* Album specific listings */
|
/* Album specific listings */
|
||||||
VLC_ML_LIST_ALBUM_TRACKS, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
|
VLC_ML_LIST_ALBUM_TRACKS, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
|
||||||
|
@ -501,7 +503,6 @@ enum vlc_ml_control
|
||||||
VLC_ML_REMOVE_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
|
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_BAN_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
|
||||||
VLC_ML_UNBAN_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
|
VLC_ML_UNBAN_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
|
||||||
VLC_ML_LIST_ENTRY_POINTS, /**< arg1: list_banned (bool) arg2: mrl (const char*) res: can't fail */
|
|
||||||
VLC_ML_IS_INDEXED, /**< arg1: mrl (const char*) arg2 (out): bool*; res: can fail */
|
VLC_ML_IS_INDEXED, /**< arg1: mrl (const char*) arg2 (out): bool*; res: can fail */
|
||||||
/**
|
/**
|
||||||
* Reload a specific folder, or all.
|
* Reload a specific folder, or all.
|
||||||
|
@ -923,18 +924,6 @@ static inline int vlc_ml_unban_folder( vlc_medialibrary_t* p_ml, const char* psz
|
||||||
return vlc_ml_control( p_ml, VLC_ML_UNBAN_FOLDER, psz_folder );
|
return vlc_ml_control( p_ml, VLC_ML_UNBAN_FOLDER, psz_folder );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int vlc_ml_list_entry_points( vlc_medialibrary_t* p_ml,
|
|
||||||
vlc_ml_folder_list_t** pp_entrypoints )
|
|
||||||
{
|
|
||||||
return vlc_ml_control( p_ml, VLC_ML_LIST_ENTRY_POINTS, (int)false, pp_entrypoints );
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int vlc_ml_list_banned_entry_points( vlc_medialibrary_t* p_ml,
|
|
||||||
vlc_ml_folder_list_t** pp_entrypoints )
|
|
||||||
{
|
|
||||||
return vlc_ml_control( p_ml, VLC_ML_LIST_ENTRY_POINTS, (int)true, pp_entrypoints );
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int vlc_ml_is_indexed( vlc_medialibrary_t* p_ml,
|
static inline int vlc_ml_is_indexed( vlc_medialibrary_t* p_ml,
|
||||||
const char* psz_mrl, bool* p_res )
|
const char* psz_mrl, bool* p_res )
|
||||||
{
|
{
|
||||||
|
@ -1649,6 +1638,44 @@ static inline size_t vlc_ml_count_playlist_media( vlc_medialibrary_t* p_ml, cons
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline vlc_ml_folder_list_t* vlc_ml_list_entry_points( vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params )
|
||||||
|
{
|
||||||
|
vlc_assert( p_ml != NULL );
|
||||||
|
vlc_ml_folder_list_t *res;
|
||||||
|
if ( vlc_ml_list( p_ml, VLC_ML_LIST_ENTRY_POINTS, params, (int)false, &res ) != VLC_SUCCESS )
|
||||||
|
return NULL;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline size_t vlc_ml_count_entry_points( vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params )
|
||||||
|
{
|
||||||
|
vlc_assert( p_ml != NULL );
|
||||||
|
size_t res;
|
||||||
|
if ( vlc_ml_list( p_ml, VLC_ML_COUNT_ENTRY_POINTS, params, (int)false, &res ) != VLC_SUCCESS )
|
||||||
|
return 0;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline vlc_ml_folder_list_t*
|
||||||
|
vlc_ml_list_banned_entry_points( vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params )
|
||||||
|
{
|
||||||
|
vlc_assert( p_ml != NULL );
|
||||||
|
vlc_ml_folder_list_t* res;
|
||||||
|
if ( vlc_ml_list( p_ml, VLC_ML_LIST_ENTRY_POINTS, params, (int)true, &res ) != VLC_SUCCESS )
|
||||||
|
return NULL;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline size_t vlc_ml_count_banned_entry_points( vlc_medialibrary_t* p_ml,
|
||||||
|
const vlc_ml_query_params_t* params )
|
||||||
|
{
|
||||||
|
vlc_assert( p_ml != NULL );
|
||||||
|
size_t res;
|
||||||
|
if ( vlc_ml_list( p_ml, VLC_ML_COUNT_ENTRY_POINTS, params, (int)true, &res ) != VLC_SUCCESS )
|
||||||
|
return 0;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* C++ */
|
#endif /* C++ */
|
||||||
|
|
|
@ -364,9 +364,8 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
|
||||||
|
|
||||||
- (NSArray<VLCMediaLibraryEntryPoint *> *)listOfMonitoredFolders
|
- (NSArray<VLCMediaLibraryEntryPoint *> *)listOfMonitoredFolders
|
||||||
{
|
{
|
||||||
vlc_ml_folder_list_t *pp_entrypoints;
|
vlc_ml_folder_list_t *pp_entrypoints = vlc_ml_list_entry_points(_p_mediaLibrary, NULL);
|
||||||
int ret = vlc_ml_list_entry_points(_p_mediaLibrary, &pp_entrypoints);
|
if (pp_entrypoints == NULL) {
|
||||||
if (ret != VLC_SUCCESS) {
|
|
||||||
msg_Err(getIntf(), "failed to retrieve list of monitored library folders");
|
msg_Err(getIntf(), "failed to retrieve list of monitored library folders");
|
||||||
return @[];
|
return @[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,8 +118,7 @@ std::vector<MLFoldersBaseModel::EntryPoint> MLFoldersModel::entryPoints() const
|
||||||
{
|
{
|
||||||
std::vector<MLFoldersBaseModel::EntryPoint> r;
|
std::vector<MLFoldersBaseModel::EntryPoint> r;
|
||||||
|
|
||||||
vlc_ml_folder_list_t* entrypoints = nullptr;
|
vlc_ml_folder_list_t* entrypoints = vlc_ml_list_entry_points( ml(), nullptr );
|
||||||
vlc_ml_list_entry_points( ml(), &entrypoints );
|
|
||||||
if ( entrypoints != nullptr )
|
if ( entrypoints != nullptr )
|
||||||
{
|
{
|
||||||
for ( unsigned int i = 0; entrypoints && i < entrypoints->i_nb_items; i++ )
|
for ( unsigned int i = 0; entrypoints && i < entrypoints->i_nb_items; i++ )
|
||||||
|
@ -162,8 +161,7 @@ std::vector<MLFoldersBaseModel::EntryPoint> MLBannedFoldersModel::entryPoints()
|
||||||
{
|
{
|
||||||
std::vector<MLFoldersBaseModel::EntryPoint> r;
|
std::vector<MLFoldersBaseModel::EntryPoint> r;
|
||||||
|
|
||||||
vlc_ml_folder_list_t* entrypoints = nullptr;
|
vlc_ml_folder_list_t* entrypoints = vlc_ml_list_banned_entry_points( ml(), nullptr );
|
||||||
vlc_ml_list_banned_entry_points( ml(), &entrypoints );
|
|
||||||
if ( entrypoints != nullptr )
|
if ( entrypoints != nullptr )
|
||||||
{
|
{
|
||||||
for ( unsigned int i = 0; entrypoints && i < entrypoints->i_nb_items; i++ )
|
for ( unsigned int i = 0; entrypoints && i < entrypoints->i_nb_items; i++ )
|
||||||
|
|
|
@ -551,21 +551,6 @@ int MediaLibrary::Control( int query, va_list args )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VLC_ML_LIST_ENTRY_POINTS:
|
|
||||||
{
|
|
||||||
const bool banned = va_arg( args, int ) != 0;
|
|
||||||
auto entrypoints_query =
|
|
||||||
( banned ) ? m_ml->bannedEntryPoints() : m_ml->entryPoints();
|
|
||||||
|
|
||||||
vlc_ml_folder_list_t *res = nullptr;
|
|
||||||
if ( entrypoints_query != nullptr )
|
|
||||||
{
|
|
||||||
res = ml_convert_list<vlc_ml_folder_list_t, vlc_ml_folder_t>(
|
|
||||||
entrypoints_query->all() );
|
|
||||||
}
|
|
||||||
*( va_arg( args, vlc_ml_folder_list_t ** ) ) = res;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VLC_ML_IS_INDEXED:
|
case VLC_ML_IS_INDEXED:
|
||||||
{
|
{
|
||||||
auto mrl = va_arg( args, const char* );
|
auto mrl = va_arg( args, const char* );
|
||||||
|
@ -1004,7 +989,24 @@ int MediaLibrary::List( int listQuery, const vlc_ml_query_params_t* params, va_l
|
||||||
vlc_assert_unreachable();
|
vlc_assert_unreachable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case VLC_ML_LIST_ENTRY_POINTS:
|
||||||
|
{
|
||||||
|
const bool banned = va_arg( args, int ) != 0;
|
||||||
|
const auto query = banned ? m_ml->bannedEntryPoints() : m_ml->entryPoints();
|
||||||
|
if ( query == nullptr )
|
||||||
|
return VLC_EGENERIC;
|
||||||
|
auto* res =
|
||||||
|
ml_convert_list<vlc_ml_folder_list_t, vlc_ml_folder_t>( query->all() );
|
||||||
|
*( va_arg( args, vlc_ml_folder_list_t** ) ) = res;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VLC_ML_COUNT_ENTRY_POINTS:
|
||||||
|
{
|
||||||
|
const bool banned = va_arg( args, int ) != 0;
|
||||||
|
const auto query = banned ? m_ml->bannedEntryPoints() : m_ml->entryPoints();
|
||||||
|
*( va_arg( args, size_t* ) ) = query ? query->count() : 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return VLC_SUCCESS;
|
return VLC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue