[vlc-devel] [PATCH 2/7] medialibrary: Allow media type to be set

Rémi Denis-Courmont remi at remlab.net
Wed Jan 8 15:10:57 CET 2020


That's a rather dubious or under-specified classification seen as a music video is often treated as audio, and that even audio ES-only inputs can exhibit video (visualisation).

Le 6 janvier 2020 21:38:45 GMT+09:00, "Hugo Beauzée-Luyssen" <hugo at beauzee.fr> a écrit :
>---
> 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();
>     }
>-- 
>2.20.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200108/5fc96246/attachment.html>


More information about the vlc-devel mailing list