mirror of https://code.videolan.org/videolan/vlc
medialib: Move media related listing in a specific function
This commit is contained in:
parent
c287ab8603
commit
3e4307ef78
|
@ -795,27 +795,8 @@ int MediaLibrary::List( int listQuery, const vlc_ml_query_params_t* params, va_l
|
|||
|
||||
case VLC_ML_LIST_MEDIA_LABELS:
|
||||
case VLC_ML_COUNT_MEDIA_LABELS:
|
||||
{
|
||||
auto media = m_ml->media( va_arg( args, int64_t ) );
|
||||
if ( media == nullptr )
|
||||
return VLC_EGENERIC;
|
||||
auto query = media->labels();
|
||||
if ( query == nullptr )
|
||||
return VLC_EGENERIC;
|
||||
switch ( listQuery )
|
||||
{
|
||||
case VLC_ML_LIST_MEDIA_LABELS:
|
||||
*va_arg( args, vlc_ml_label_list_t**) =
|
||||
ml_convert_list<vlc_ml_label_list_t, vlc_ml_label_t>(
|
||||
query->items( nbItems, offset ) );
|
||||
return VLC_SUCCESS;
|
||||
case VLC_ML_COUNT_MEDIA_LABELS:
|
||||
*va_arg( args, size_t* ) = query->count();
|
||||
return VLC_SUCCESS;
|
||||
default:
|
||||
vlc_assert_unreachable();
|
||||
}
|
||||
}
|
||||
return listMedia( listQuery, paramsPtr, psz_pattern, nbItems, offset, args );
|
||||
|
||||
case VLC_ML_LIST_SHOWS:
|
||||
{
|
||||
medialibrary::Query<medialibrary::IShow> query;
|
||||
|
@ -1603,6 +1584,31 @@ int MediaLibrary::listPlaylist( int listQuery, const medialibrary::QueryParamete
|
|||
}
|
||||
}
|
||||
|
||||
int MediaLibrary::listMedia( int listQuery, const medialibrary::QueryParameters *,
|
||||
const char *, uint32_t nbItems, uint32_t offset,
|
||||
va_list args )
|
||||
{
|
||||
auto media = m_ml->media( va_arg( args, int64_t ) );
|
||||
if ( media == nullptr )
|
||||
return VLC_EGENERIC;
|
||||
auto query = media->labels();
|
||||
if ( query == nullptr )
|
||||
return VLC_EGENERIC;
|
||||
switch ( listQuery )
|
||||
{
|
||||
case VLC_ML_LIST_MEDIA_LABELS:
|
||||
*va_arg( args, vlc_ml_label_list_t**) =
|
||||
ml_convert_list<vlc_ml_label_list_t, vlc_ml_label_t>(
|
||||
query->items( nbItems, offset ) );
|
||||
return VLC_SUCCESS;
|
||||
case VLC_ML_COUNT_MEDIA_LABELS:
|
||||
*va_arg( args, size_t* ) = query->count();
|
||||
return VLC_SUCCESS;
|
||||
default:
|
||||
vlc_assert_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
static void* Get( vlc_medialibrary_module_t* module, int query, va_list args )
|
||||
{
|
||||
auto ml = static_cast<MediaLibrary*>( module->p_sys );
|
||||
|
|
|
@ -156,6 +156,8 @@ private:
|
|||
const char* pattern, uint32_t nbItems, uint32_t offset, va_list args );
|
||||
int listPlaylist( int listQuery, const medialibrary::QueryParameters* paramsPtr,
|
||||
const char* pattern, uint32_t nbItems, uint32_t offset, va_list args );
|
||||
int listMedia( int listQuery, const medialibrary::QueryParameters* paramsPtr,
|
||||
const char* pattern, uint32_t nbItems, uint32_t offset, va_list args );
|
||||
|
||||
static medialibrary::IMedia::MetadataType metadataType( int meta );
|
||||
static medialibrary::SortingCriteria sortingCriteria( int sort );
|
||||
|
|
Loading…
Reference in New Issue