Commit faa1d63e authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf Committed by Hugo Beauzée-Luyssen

Require libVLC 3.0 for the new parse flags

Signed-off-by: 's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent b541b1e1
......@@ -300,12 +300,21 @@ class MediaEventManager : public EventManager
template <typename Func>
RegisteredEvent onParsedChanged( Func&& f )
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
EXPECT_SIGNATURE( void(Media::ParsedStatus) );
return handle(libvlc_MediaParsedChanged, std::forward<Func>( f ), [](const libvlc_event_t* e, void* data)
{
auto callback = static_cast<DecayPtr<Func>>(data);
(*callback)( static_cast<Media::ParsedStatus>( e->u.media_parsed_changed.new_status ) );
});
#else
EXPECT_SIGNATURE( void(bool) );
return handle(libvlc_MediaParsedChanged, std::forward<Func>( f ), [](const libvlc_event_t* e, void* data)
{
auto callback = static_cast<DecayPtr<Func>>(data);
(*callback)( bool( e->u.media_parsed_changed.new_status ) );
});
#endif
}
/**
......
......@@ -89,6 +89,7 @@ public:
static const FromType AsNode = FromType::AsNode;
#endif
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
enum class ParseFlags
{
/**
......@@ -132,6 +133,7 @@ public:
Stream = libvlc_media_type_stream,
Playlist = libvlc_media_type_playlist,
};
#endif
/**
* @brief Media Constructs a libvlc Media instance
......@@ -749,11 +751,13 @@ private:
std::shared_ptr<MediaEventManager> m_eventManager;
};
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
inline VLC::Media::ParseFlags operator|(Media::ParseFlags l, Media::ParseFlags r)
{
using T = typename std::underlying_type<Media::ParseFlags>::type;
return static_cast<Media::ParseFlags>( static_cast<T>( l ) | static_cast<T>( r ) );
}
#endif
} // namespace VLC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment