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: default avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent b541b1e1
...@@ -300,12 +300,21 @@ class MediaEventManager : public EventManager ...@@ -300,12 +300,21 @@ class MediaEventManager : public EventManager
template <typename Func> template <typename Func>
RegisteredEvent onParsedChanged( Func&& f ) RegisteredEvent onParsedChanged( Func&& f )
{ {
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
EXPECT_SIGNATURE( void(Media::ParsedStatus) ); EXPECT_SIGNATURE( void(Media::ParsedStatus) );
return handle(libvlc_MediaParsedChanged, std::forward<Func>( f ), [](const libvlc_event_t* e, void* data) return handle(libvlc_MediaParsedChanged, std::forward<Func>( f ), [](const libvlc_event_t* e, void* data)
{ {
auto callback = static_cast<DecayPtr<Func>>(data); auto callback = static_cast<DecayPtr<Func>>(data);
(*callback)( static_cast<Media::ParsedStatus>( e->u.media_parsed_changed.new_status ) ); (*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: ...@@ -89,6 +89,7 @@ public:
static const FromType AsNode = FromType::AsNode; static const FromType AsNode = FromType::AsNode;
#endif #endif
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
enum class ParseFlags enum class ParseFlags
{ {
/** /**
...@@ -132,6 +133,7 @@ public: ...@@ -132,6 +133,7 @@ public:
Stream = libvlc_media_type_stream, Stream = libvlc_media_type_stream,
Playlist = libvlc_media_type_playlist, Playlist = libvlc_media_type_playlist,
}; };
#endif
/** /**
* @brief Media Constructs a libvlc Media instance * @brief Media Constructs a libvlc Media instance
...@@ -749,11 +751,13 @@ private: ...@@ -749,11 +751,13 @@ private:
std::shared_ptr<MediaEventManager> m_eventManager; 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) inline VLC::Media::ParseFlags operator|(Media::ParseFlags l, Media::ParseFlags r)
{ {
using T = typename std::underlying_type<Media::ParseFlags>::type; using T = typename std::underlying_type<Media::ParseFlags>::type;
return static_cast<Media::ParseFlags>( static_cast<T>( l ) | static_cast<T>( r ) ); return static_cast<Media::ParseFlags>( static_cast<T>( l ) | static_cast<T>( r ) );
} }
#endif
} // namespace VLC } // 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