medialibrary: Add missing reload operation

This commit is contained in:
Hugo Beauzée-Luyssen 2018-08-13 16:14:10 +02:00
parent 1718b63dad
commit 5c029693c9
2 changed files with 20 additions and 0 deletions

View File

@ -401,6 +401,12 @@ enum vlc_ml_control
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_entrypoint_t**); arg2: nb results(size_t*), res: can fail */
/**
* Reload a specific folder, or all.
* arg1: mrl (const char*), NULL to reload all folders
* res: can't fail
*/
VLC_ML_RELOAD_FOLDER,
/* Pause/resume background operations, such as media discovery & media analysis */
VLC_ML_PAUSE_BACKGROUND, /**< no args; can't fail */
@ -554,6 +560,11 @@ static inline int vlc_ml_list_folder( vlc_medialibrary_t* p_ml,
return vlc_ml_control( p_ml, VLC_ML_LIST_FOLDERS, pp_entrypoints, p_nb_items );
}
static inline int vlc_ml_reload_folder( vlc_medialibrary_t* p_ml, const char* psz_mrl )
{
return vlc_ml_control( p_ml, VLC_ML_RELOAD_FOLDER, psz_mrl );
}
static inline int vlc_ml_pause_background( vlc_medialibrary_t* p_ml )
{
return vlc_ml_control( p_ml, VLC_ML_PAUSE_BACKGROUND );

View File

@ -309,6 +309,15 @@ int MediaLibrary::Control( int query, va_list args )
*(va_arg( args, size_t*) ) = entryPoints.size();
break;
}
case VLC_ML_RELOAD_FOLDER:
{
auto mrl = va_arg( args, const char* );
if ( mrl == nullptr )
m_ml->reload();
else
m_ml->reload( mrl );
break;
}
case VLC_ML_PAUSE_BACKGROUND:
m_ml->pauseBackgroundOperations();
break;