[vlc-commits] medialibrary: Allow media type to be set
Hugo Beauzée-Luyssen
git at videolan.org
Thu Jan 9 16:54:43 CET 2020
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Nov 26 16:13:23 2019 +0100| [aa84a30ecc74bb2062fd4bf5a747a4322993d4ff] | committer: Hugo Beauzée-Luyssen
medialibrary: Allow media type to be set
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aa84a30ecc74bb2062fd4bf5a747a4322993d4ff
---
include/vlc_media_library.h | 7 +++++++
modules/misc/medialibrary/medialib.cpp | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/include/vlc_media_library.h b/include/vlc_media_library.h
index 81b4204ee3..55a170db61 100644
--- a/include/vlc_media_library.h
+++ b/include/vlc_media_library.h
@@ -464,6 +464,7 @@ enum vlc_ml_control
VLC_ML_MEDIA_SET_THUMBNAIL, /**< arg1: media id; arg2: const char*; arg3: vlc_ml_thumbnail_size_t */
VLC_ML_MEDIA_GENERATE_THUMBNAIL, /**< arg1: media id; arg2: vlc_ml_thumbnail_size_t; arg3: width; arg4: height; arg5: position */
VLC_ML_MEDIA_ADD_EXTERNAL_MRL, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
+ VLC_ML_MEDIA_SET_TYPE, /**< arg1: media id; arg2: vlc_ml_media_type_t */
};
/**
@@ -957,6 +958,12 @@ static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t* p_ml, int64
return vlc_ml_control( p_ml, VLC_ML_MEDIA_ADD_EXTERNAL_MRL, i_media_id, psz_mrl, i_type );
}
+static inline int vlc_ml_media_set_type( vlc_medialibrary_t* p_ml, int64_t i_media_id,
+ vlc_ml_media_type_t i_type )
+{
+ return vlc_ml_control( p_ml, VLC_ML_MEDIA_SET_TYPE, i_media_id, (int)i_type );
+}
+
static inline vlc_ml_media_t* vlc_ml_get_media( vlc_medialibrary_t* p_ml, int64_t i_media_id )
{
return (vlc_ml_media_t*)vlc_ml_get( p_ml, VLC_ML_GET_MEDIA, i_media_id );
diff --git a/modules/misc/medialibrary/medialib.cpp b/modules/misc/medialibrary/medialib.cpp
index 09940d8e55..f4e27676f7 100644
--- a/modules/misc/medialibrary/medialib.cpp
+++ b/modules/misc/medialibrary/medialib.cpp
@@ -564,6 +564,7 @@ int MediaLibrary::Control( int query, va_list args )
case VLC_ML_MEDIA_SET_THUMBNAIL:
case VLC_ML_MEDIA_GENERATE_THUMBNAIL:
case VLC_ML_MEDIA_ADD_EXTERNAL_MRL:
+ case VLC_ML_MEDIA_SET_TYPE:
return controlMedia( query, args );
default:
return VLC_EGENERIC;
@@ -1214,6 +1215,13 @@ int MediaLibrary::controlMedia( int query, va_list args )
return VLC_EGENERIC;
return VLC_SUCCESS;
}
+ case VLC_ML_MEDIA_SET_TYPE:
+ {
+ auto type = va_arg( args, int );
+ if ( m->setType( static_cast<medialibrary::IMedia::Type>( type ) ) == false )
+ return VLC_EGENERIC;
+ return VLC_SUCCESS;
+ }
default:
vlc_assert_unreachable();
}
More information about the vlc-commits
mailing list