[vlc-commits] Add OnParseChanged callback in MediaEventManager
Thomas Nigro
git at videolan.org
Fri Aug 21 18:40:08 CEST 2015
libvlcpp | branch: master | Thomas Nigro <tn at thomasnigro.fr> | Fri Aug 21 18:31:32 2015 +0200| [f71837301cac0d5b08b7153e982a2a9b513bb6b4] | committer: Hugo Beauzée-Luyssen
Add OnParseChanged callback in MediaEventManager
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/libvlcpp.git/?a=commit;h=f71837301cac0d5b08b7153e982a2a9b513bb6b4
---
cppcx/EventManagerCX.hpp | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/cppcx/EventManagerCX.hpp b/cppcx/EventManagerCX.hpp
index b53931e..18b91b9 100644
--- a/cppcx/EventManagerCX.hpp
+++ b/cppcx/EventManagerCX.hpp
@@ -54,6 +54,7 @@ namespace libVLCX
public delegate void ESDeleted(TrackType, int);
public delegate void ESSelected(TrackType, int);
+ public delegate void ParsedChanged(bool);
ref class EventManager;
public ref class MediaPlayerEventManager sealed
@@ -532,7 +533,30 @@ namespace libVLCX
{
internal:
MediaEventManager(VLC::MediaEventManager& em);
+
private:
- VLC::MediaEventManager m_em;
+ VLC::MediaEventManager& m_em;
+ std::vector<VLC::EventManager::RegisteredEvent> m_events;
+
+ public:
+ event ParsedChanged^ OnParsedChanged
+ {
+ Windows::Foundation::EventRegistrationToken add(ParsedChanged^ handler)
+ {
+ auto h = m_em.onParsedChanged([handler](bool b) {
+ handler(b);
+ });
+ m_events.push_back(h);
+ return Windows::Foundation::EventRegistrationToken{ (int64)h };
+ }
+
+ void remove(Windows::Foundation::EventRegistrationToken token) {
+ auto h = (VLC::EventManager::RegisteredEvent)token.Value;
+ auto it = std::find(begin(m_events), end(m_events), h);
+ assert(it != end(m_events));
+ (*it)->unregister();
+ m_events.erase(it);
+ }
+ }
};
}
\ No newline at end of file
More information about the vlc-commits
mailing list