[vlc-commits] medialib: Move media related listing in a specific function
Hugo Beauzée-Luyssen
git at videolan.org
Mon Jun 22 15:24:14 CEST 2020
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Mar 13 09:47:17 2020 +0100| [3e4307ef7868e351dac8acc8b54e7f30b0a533a0] | committer: Hugo Beauzée-Luyssen
medialib: Move media related listing in a specific function
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3e4307ef7868e351dac8acc8b54e7f30b0a533a0
---
modules/misc/medialibrary/medialib.cpp | 48 ++++++++++++++++++--------------
modules/misc/medialibrary/medialibrary.h | 2 ++
2 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/modules/misc/medialibrary/medialib.cpp b/modules/misc/medialibrary/medialib.cpp
index 0d884711fb..9239a768ef 100644
--- a/modules/misc/medialibrary/medialib.cpp
+++ b/modules/misc/medialibrary/medialib.cpp
@@ -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 );
diff --git a/modules/misc/medialibrary/medialibrary.h b/modules/misc/medialibrary/medialibrary.h
index fee466b62d..80fcc68ac4 100644
--- a/modules/misc/medialibrary/medialibrary.h
+++ b/modules/misc/medialibrary/medialibrary.h
@@ -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 );
More information about the vlc-commits
mailing list