[vlc-commits] Rename EventOwner to CallbackOwner

Hugo Beauzée-Luyssen git at videolan.org
Fri May 15 14:38:38 CEST 2015


libvlcpp | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed May 13 10:03:26 2015 +0200| [e664906fc67b9d3820b997a340b914aed706390d] | committer: Hugo Beauzée-Luyssen

Rename EventOwner to CallbackOwner

Since it contains callbacks, not events.

> http://git.videolan.org/gitweb.cgi/libvlcpp.git/?a=commit;h=e664906fc67b9d3820b997a340b914aed706390d
---

 vlcpp/Instance.hpp    |   12 ++++++------
 vlcpp/MediaPlayer.hpp |   34 +++++++++++++++++-----------------
 vlcpp/common.hpp      |   16 ++++++++--------
 3 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/vlcpp/Instance.hpp b/vlcpp/Instance.hpp
index 1b6c005..fccb15a 100644
--- a/vlcpp/Instance.hpp
+++ b/vlcpp/Instance.hpp
@@ -34,10 +34,10 @@
 namespace VLC
 {
 
-class Instance : public Internal<libvlc_instance_t>, private EventOwner<2>
+class Instance : public Internal<libvlc_instance_t>, private CallbackOwner<2>
 {
 private:
-    enum class EventIdx : unsigned int
+    enum class CallbackIdx : unsigned int
     {
         Exit,
         Log
@@ -118,8 +118,8 @@ public:
     {
         static_assert(signature_match_or_nullptr<ExitCb, void()>::value, "Mismatched exit callback" );
         libvlc_set_exit_handler( *this,
-            CallbackWrapper<(int)EventIdx::Exit, void(*)(void*)>::wrap( this, std::forward<ExitCb>( exitCb ) ),
-            static_cast<EventOwner<2>*>( this ) );
+            CallbackWrapper<(int)CallbackIdx::Exit, void(*)(void*)>::wrap( this, std::forward<ExitCb>( exitCb ) ),
+            static_cast<CallbackOwner<2>*>( this ) );
     }
 
     /**
@@ -201,8 +201,8 @@ public:
                     logCb( level, ctx, std::string{ message.get() } );
             }
         };
-        libvlc_log_set( *this, CallbackWrapper<(int)EventIdx::Log, libvlc_log_cb>::wrap( this, std::move( wrapper ) ),
-                        static_cast<EventOwner<2>*>( this ) );
+        libvlc_log_set( *this, CallbackWrapper<(int)CallbackIdx::Log, libvlc_log_cb>::wrap( this, std::move( wrapper ) ),
+                        static_cast<CallbackOwner<2>*>( this ) );
     }
 
     /**
diff --git a/vlcpp/MediaPlayer.hpp b/vlcpp/MediaPlayer.hpp
index 16ae8f9..cc10036 100644
--- a/vlcpp/MediaPlayer.hpp
+++ b/vlcpp/MediaPlayer.hpp
@@ -43,10 +43,10 @@ class MediaPlayerEventManager;
 ///
 /// \brief The MediaPlayer class exposes libvlc_media_player_t functionnalities
 ///
-class MediaPlayer : public Internal<libvlc_media_player_t>, private EventOwner<13>
+class MediaPlayer : public Internal<libvlc_media_player_t>, private CallbackOwner<13>
 {
 private:
-    enum class EventIdx : unsigned int
+    enum class CallbackIdx : unsigned int
     {
         AudioPlay,
         AudioPause,
@@ -701,14 +701,14 @@ public:
         static_assert(signature_match_or_nullptr<DrainCb, void()>::value, "Mismatched drain callback prototype");
 
         libvlc_audio_set_callbacks( *this,
-            CallbackWrapper<(int)EventIdx::AudioPlay,   libvlc_audio_play_cb>::wrap(   this, std::forward<PlayCb>( play ) ),
-            CallbackWrapper<(int)EventIdx::AudioPause,  libvlc_audio_pause_cb>::wrap(  this, std::forward<PauseCb>( pause ) ),
-            CallbackWrapper<(int)EventIdx::AudioResume, libvlc_audio_resume_cb>::wrap( this, std::forward<ResumeCb>( resume ) ),
-            CallbackWrapper<(int)EventIdx::AudioFlush,  libvlc_audio_flush_cb>::wrap(  this, std::forward<FlushCb>( flush ) ),
-            CallbackWrapper<(int)EventIdx::AudioDrain,  libvlc_audio_drain_cb>::wrap(  this, std::forward<DrainCb>( drain ) ),
+            CallbackWrapper<(int)CallbackIdx::AudioPlay,   libvlc_audio_play_cb>::wrap(   this, std::forward<PlayCb>( play ) ),
+            CallbackWrapper<(int)CallbackIdx::AudioPause,  libvlc_audio_pause_cb>::wrap(  this, std::forward<PauseCb>( pause ) ),
+            CallbackWrapper<(int)CallbackIdx::AudioResume, libvlc_audio_resume_cb>::wrap( this, std::forward<ResumeCb>( resume ) ),
+            CallbackWrapper<(int)CallbackIdx::AudioFlush,  libvlc_audio_flush_cb>::wrap(  this, std::forward<FlushCb>( flush ) ),
+            CallbackWrapper<(int)CallbackIdx::AudioDrain,  libvlc_audio_drain_cb>::wrap(  this, std::forward<DrainCb>( drain ) ),
             // We will receive the pointer as a void*, we need to offset the value *now*, otherwise we'd get
             // a shifted value, resulting in an invalid callback array.
-            static_cast<EventOwner<13>*>( this ) );
+            static_cast<CallbackOwner<13>*>( this ) );
     }
 
     /**
@@ -727,7 +727,7 @@ public:
     {
         static_assert(signature_match_or_nullptr<VolumeCb, void(float, bool)>::value, "Mismatched set volume callback");
         libvlc_audio_set_volume_callback(*this,
-            CallbackWrapper<(int)EventIdx::AudioVolume, libvlc_audio_set_volume_cb>::wrap( this, std::forward<VolumeCb>( func ) ) );
+            CallbackWrapper<(int)CallbackIdx::AudioVolume, libvlc_audio_set_volume_cb>::wrap( this, std::forward<VolumeCb>( func ) ) );
     }
 
     /**
@@ -750,8 +750,8 @@ public:
         static_assert(signature_match_or_nullptr<CleanupCb, void()>::value, "Mismatched cleanup callback");
 
         libvlc_audio_set_format_callbacks(*this,
-            CallbackWrapper<(int)EventIdx::AudioSetup, libvlc_audio_setup_cb>::wrap( this, std::forward<SetupCb>( setup ) ),
-            CallbackWrapper<(int)EventIdx::AudioCleanup, libvlc_audio_cleanup_cb>::wrap( this, std::forward<CleanupCb>( cleanup ) ) );
+            CallbackWrapper<(int)CallbackIdx::AudioSetup, libvlc_audio_setup_cb>::wrap( this, std::forward<SetupCb>( setup ) ),
+            CallbackWrapper<(int)CallbackIdx::AudioCleanup, libvlc_audio_cleanup_cb>::wrap( this, std::forward<CleanupCb>( cleanup ) ) );
     }
 
     /**
@@ -1042,12 +1042,12 @@ public:
         static_assert(signature_match_or_nullptr<DisplayCb, void(void*)>::value, "Mismatched lock callback signature");
 
         libvlc_video_set_callbacks(*this,
-                CallbackWrapper<(int)EventIdx::VideoLock, libvlc_video_lock_cb>::wrap( this, std::forward<LockCb>( lock ) ),
-                CallbackWrapper<(int)EventIdx::VideoUnlock, libvlc_video_unlock_cb>::wrap( this, std::forward<UnlockCb>( unlock ) ),
-                CallbackWrapper<(int)EventIdx::VideoDisplay, libvlc_video_display_cb>::wrap( this, std::forward<DisplayCb>( display ) ),
+                CallbackWrapper<(int)CallbackIdx::VideoLock, libvlc_video_lock_cb>::wrap( this, std::forward<LockCb>( lock ) ),
+                CallbackWrapper<(int)CallbackIdx::VideoUnlock, libvlc_video_unlock_cb>::wrap( this, std::forward<UnlockCb>( unlock ) ),
+                CallbackWrapper<(int)CallbackIdx::VideoDisplay, libvlc_video_display_cb>::wrap( this, std::forward<DisplayCb>( display ) ),
                 // We will receive the pointer as a void*, we need to offset the value *now*, otherwise we'd get
                 // a shifted value, resulting in an empty callback array.
-                static_cast<EventOwner<13>*>( this ) );
+                static_cast<CallbackOwner<13>*>( this ) );
     }
 
     /**
@@ -1096,8 +1096,8 @@ public:
         static_assert(signature_match_or_nullptr<CleanupCb, void()>::value, "Unmatched prototype for cleanup callback");
 
         libvlc_video_set_format_callbacks(*this,
-                CallbackWrapper<(int)EventIdx::VideoFormat, libvlc_video_format_cb>::wrap( static_cast<EventOwner<13>*>( this ), std::forward<FormatCb>( setup ) ),
-                CallbackWrapper<(int)EventIdx::VideoCleanup, libvlc_video_cleanup_cb>::wrap( this, std::forward<CleanupCb>( cleanup ) ) );
+                CallbackWrapper<(int)CallbackIdx::VideoFormat, libvlc_video_format_cb>::wrap( static_cast<CallbackOwner<13>*>( this ), std::forward<FormatCb>( setup ) ),
+                CallbackWrapper<(int)CallbackIdx::VideoCleanup, libvlc_video_cleanup_cb>::wrap( this, std::forward<CleanupCb>( cleanup ) ) );
     }
 
     /**
diff --git a/vlcpp/common.hpp b/vlcpp/common.hpp
index e2412b5..633c7af 100644
--- a/vlcpp/common.hpp
+++ b/vlcpp/common.hpp
@@ -104,12 +104,12 @@ namespace VLC
     };
 
     template <int NbEvent>
-    struct EventOwner
+    struct CallbackOwner
     {
         std::array<std::shared_ptr<CallbackHandlerBase>, NbEvent> callbacks;
 
     protected:
-        EventOwner() = default;
+        CallbackOwner() = default;
     };
 
     template <int, typename>
@@ -118,18 +118,18 @@ namespace VLC
     template <int NbEvents>
     struct FromOpaque<NbEvents, void*>
     {
-        static EventOwner<NbEvents>* get(void* opaque)
+        static CallbackOwner<NbEvents>* get(void* opaque)
         {
-            return reinterpret_cast<EventOwner<NbEvents>*>( opaque );
+            return reinterpret_cast<CallbackOwner<NbEvents>*>( opaque );
         }
     };
 
     template <int NbEvents>
     struct FromOpaque<NbEvents, void**>
     {
-        static EventOwner<NbEvents>* get(void** opaque)
+        static CallbackOwner<NbEvents>* get(void** opaque)
         {
-            return reinterpret_cast<EventOwner<NbEvents>*>( *opaque );
+            return reinterpret_cast<CallbackOwner<NbEvents>*>( *opaque );
         }
     };
 
@@ -148,7 +148,7 @@ namespace VLC
         using Wrapped = Ret(*)(Opaque, Args...);
 
         template <int NbEvents, typename Func>
-        static Wrapped wrap(EventOwner<NbEvents>* owner, Func&& func)
+        static Wrapped wrap(CallbackOwner<NbEvents>* owner, Func&& func)
         {
             owner->callbacks[Idx] = std::make_shared<CallbackHandler<Func>>( std::forward<Func>( func ) );
             return [](Opaque opaque, Args... args) -> Ret {
@@ -165,7 +165,7 @@ namespace VLC
         // it could be an instance of a function object, which doesn't compare nicely against nullptr.
         // Using the specialization at build time is easier and performs better.
         template <int NbEvents>
-        static std::nullptr_t wrap(EventOwner<NbEvents>*, std::nullptr_t)
+        static std::nullptr_t wrap(CallbackOwner<NbEvents>*, std::nullptr_t)
         {
             return nullptr;
         }



More information about the vlc-commits mailing list