[vlc-devel] [PATCH] Add mappings for some new libvlc events
Daniel Amm
da2424 at t-online.de
Mon Dec 14 17:59:26 CET 2015
---
vlcpp/EventManager.hpp | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/vlcpp/EventManager.hpp b/vlcpp/EventManager.hpp
index f15ea46..15ff377 100644
--- a/vlcpp/EventManager.hpp
+++ b/vlcpp/EventManager.hpp
@@ -700,6 +700,78 @@ class MediaPlayerEventManager : public EventManager
(*callback)( e->u.media_player_es_changed.i_type, e->u.media_player_es_changed.i_id );
});
}
+
+ /**
+ * \brief onCorked Registers an event called when the playback is paused automatically for a higher priority audio stream
+ * \param f A std::function<void(void)> (or an equivalent Callable type)
+ */
+ template <typename Func>
+ RegisteredEvent onCorked( Func&& f )
+ {
+ return handle( libvlc_MediaPlayerCorked, std::forward<Func>( f ) );
+ }
+
+ /**
+ * \brief onUncorked Registers an event called when the playback is unpaused automatically after a higher priority audio stream ends
+ * \param f A std::function<void(void)> (or an equivalent Callable type)
+ */
+ template <typename Func>
+ RegisteredEvent onUncorked( Func&& f )
+ {
+ return handle( libvlc_MediaPlayerUncorked, std::forward<Func>( f ) );
+ }
+
+ /**
+ * \brief onMuted Registers an event called when the audio is muted
+ * \param f A std::function<void(void)> (or an equivalent Callable type)
+ */
+ template <typename Func>
+ RegisteredEvent onMuted( Func&& f )
+ {
+ return handle( libvlc_MediaPlayerMuted, std::forward<Func>( f ) );
+ }
+
+ /**
+ * \brief onUnmuted Registers an event called when the audio is unmuted
+ * \param f A std::function<void(void)> (or an equivalent Callable type)
+ */
+ template <typename Func>
+ RegisteredEvent onUnmuted( Func&& f )
+ {
+ return handle( libvlc_MediaPlayerUnmuted, std::forward<Func>( f ) );
+ }
+
+ /**
+ * \brief onAudioVolume Registers an event called when the current audio volume changes
+ * \param f A std::function<void(float)> (or an equivalent Callable type)
+ * The provided float is the new current audio volume percentage.
+ */
+ template <typename Func>
+ RegisteredEvent onAudioVolume( Func&& f )
+ {
+ EXPECT_SIGNATURE(void(float));
+ return handle( libvlc_MediaPlayerAudioVolume, std::forward<Func>( f ), [](const libvlc_event_t* e, void* data)
+ {
+ auto callback = static_cast<DecayPtr<Func>>( data );
+ (*callback)( e->u.media_player_audio_volume.volume );
+ });
+ }
+
+ /**
+ * \brief onAudioDevice Registers an event called when the current audio output device changes
+ * \param f A std::function<void(std::string)> (or an equivalent Callable type)
+ * The provided string is the new current volume.
+ */
+ template <typename Func>
+ RegisteredEvent onAudioDevice( Func&& f )
+ {
+ EXPECT_SIGNATURE(void(std::string));
+ return handle( libvlc_MediaPlayerAudioDevice, std::forward<Func>( f ), [](const libvlc_event_t* e, void* data)
+ {
+ auto callback = static_cast<DecayPtr<Func>>( data );
+ (*callback)( e->u.media_player_audio_device.device );
+ });
+ }
#endif
};
--
2.6.3.windows.1
More information about the vlc-devel
mailing list