[vlc-commits] [Git][videolan/libvlcpp][master] 3 commits: Instance: ErrorDisplay was also introduced in VLC 3

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Mon May 2 07:11:58 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / libvlcpp


Commits:
912952c3 by Hugo Beauzée-Luyssen at 2022-05-02T08:40:59+02:00
Instance: ErrorDisplay was also introduced in VLC 3

It's part of the dialog API

- - - - -
92d8d10a by Hugo Beauzée-Luyssen at 2022-05-02T09:09:12+02:00
CI: Bump 4.0 image

- - - - -
42b58a17 by Hugo Beauzée-Luyssen at 2022-05-02T09:09:12+02:00
Instance: Update dialog API to match libvlc changes

The error dialog callback is now a separated callback

- - - - -


2 changed files:

- .gitlab-ci.yml
- vlcpp/Instance.hpp


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -1,6 +1,6 @@
 variables:
   VLC30_IMAGE: registry.videolan.org/medialibrary:20201009131431
-  VLC40_IMAGE: registry.videolan.org/libvlcpp-unstable:20220316125112
+  VLC40_IMAGE: registry.videolan.org/libvlcpp-unstable:20220502070249
 
 .common_build:
   rules:


=====================================
vlcpp/Instance.hpp
=====================================
@@ -68,8 +68,8 @@ private:
     {
         Exit = 0,
         Log,
-        ErrorDisplay,
 #if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
+        ErrorDisplay,
         LoginDisplay,
         QuestionDisplay,
         ProgressDisplay,
@@ -491,6 +491,39 @@ public:
      * \param cancel   lambda callback that will get called when a displayed dialog needs to be cancelled. \see CancelCb
      * \param updtProgress   lambda callback that will get called when a progress dialog needs to be updated. \see UpdtProgressCb
      */
+#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
+    template <class Login, class Question, class DspProgress, class Cancel, class UpdtProgress>
+    void setDialogHandlers(Login&& login, Question&& question, DspProgress&& dspProgress, Cancel &&cancel, UpdtProgress &&updtProgress)
+    {
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+        static_assert(signature_match_or_nullptr<Login, LoginCb>::value, "Mismatched login display callback prototype");
+        static_assert(signature_match_or_nullptr<Question, QuestionCb>::value, "Mismatched question display callback prototype");
+        static_assert(signature_match_or_nullptr<DspProgress, DspProgressCb>::value, "Mismatched progress display callback prototype");
+        static_assert(signature_match_or_nullptr<Cancel, CancelCb>::value, "Mismatched cancel callback prototype");
+        static_assert(signature_match_or_nullptr<UpdtProgress, UpdtProgressCb>::value, "Mismatched update progress callback prototype");
+#endif
+        libvlc_dialog_cbs tmp = {
+            CallbackWrapper<(unsigned)CallbackIdx::LoginDisplay, decltype(libvlc_dialog_cbs::pf_display_login)>::wrap(*m_callbacks, std::forward<Login>(login)),
+            CallbackWrapper<(unsigned)CallbackIdx::QuestionDisplay, decltype(libvlc_dialog_cbs::pf_display_question)>::wrap(*m_callbacks, std::forward<Question>(question)),
+            CallbackWrapper<(unsigned)CallbackIdx::ProgressDisplay, decltype(libvlc_dialog_cbs::pf_display_progress)>::wrap(*m_callbacks, std::forward<DspProgress>(dspProgress)),
+            CallbackWrapper<(unsigned)CallbackIdx::CancelDialog, decltype(libvlc_dialog_cbs::pf_cancel)>::wrap(*m_callbacks, std::forward<Cancel>(cancel)),
+            CallbackWrapper<(unsigned)CallbackIdx::ProgressUpdate, decltype(libvlc_dialog_cbs::pf_update_progress)>::wrap(*m_callbacks, std::forward<UpdtProgress>(updtProgress))
+        };
+        m_callbacks_pointers = std::make_shared<libvlc_dialog_cbs>(tmp);
+        libvlc_dialog_set_callbacks(*this, m_callbacks_pointers.get(), m_callbacks.get());
+    }
+
+    template <typename Error>
+    void setErrorCallback(Error&& error)
+    {
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+        static_assert(signature_match_or_nullptr<Error, ErrorCb>::value, "Mismatched error callback prototype");
+#endif
+        libvlc_dialog_set_error_callback(*this,
+            CallbackWrapper<(unsigned int)CallbackIdx::ErrorDisplay, libvlc_dialog_error_cbs>::wrap(
+                *m_callbacks, std::forward(error)));
+    }
+#else
     template <class Error, class Login, class Question, class DspProgress, class Cancel, class UpdtProgress>
     void setDialogHandlers(Error&& error, Login&& login, Question&& question, DspProgress&& dspProgress, Cancel &&cancel, UpdtProgress &&updtProgress)
     {
@@ -513,7 +546,7 @@ public:
         m_callbacks_pointers = std::make_shared<libvlc_dialog_cbs>(tmp);
         libvlc_dialog_set_callbacks(*this, m_callbacks_pointers.get(), m_callbacks.get());
     }
-
+#endif
     /**
      * Unset all callbacks
      */



View it on GitLab: https://code.videolan.org/videolan/libvlcpp/-/compare/acb78a24d95029f7b4a5e5e68cbf464bbc76c63d...42b58a17ab8aa0e1d30ec358d03d5ba6ca32efb7

-- 
View it on GitLab: https://code.videolan.org/videolan/libvlcpp/-/compare/acb78a24d95029f7b4a5e5e68cbf464bbc76c63d...42b58a17ab8aa0e1d30ec358d03d5ba6ca32efb7
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list