forked from pool/kaffeine
- Add upstream patches to make it build (and work) with vlc 2.2 on Leap 42.3 (kde#407153): * fix-support-for-vlc-2.x.patch * with-vlc-2.x-use-vlcMedia-for-libvlc_MediaMetaChanged-event.patch OBS-URL: https://build.opensuse.org/request/show/700623 OBS-URL: https://build.opensuse.org/package/show/KDE:Extra/kaffeine?expand=0&rev=45
73 lines
2.7 KiB
Diff
73 lines
2.7 KiB
Diff
From 2644cbf02ed39bb6b194bc6b7935b069b5769364 Mon Sep 17 00:00:00 2001
|
|
From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
|
Date: Sat, 4 May 2019 09:28:23 -0300
|
|
Subject: vlc: with vlc 2.x, use vlcMedia for libvlc_MediaMetaChanged event
|
|
|
|
As reported by Wolfgang, the libVlc 2.x fix applied at
|
|
402cbee5e675 ("vlc: fix support for vlc 2.x") still have issues,
|
|
causing some troubles at least on audio CDs.
|
|
|
|
The root cause seems to be that, on vlc 2.x, the event
|
|
libvlc_MediaMetaChanged should be registered against the
|
|
vlcMedia instance, instead of vlcMediaPlayer instance.
|
|
|
|
Document that inside the code, as this is not obvious.
|
|
|
|
While the old way is still supported on vlc 3.x, I opted to
|
|
keep the code inside #ifs, as some day we'll drop support for
|
|
vlc 2.x, making the code simpler.
|
|
|
|
Also, since this event is registered aganst a vlcMedia object
|
|
and behaves different than when applied against a vlcMediaPlayer
|
|
object, I'm also using a different name there, in order to avoid
|
|
confusion.
|
|
|
|
BUG: 407153
|
|
|
|
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
|
---
|
|
src/backend-vlc/vlcmediawidget.cpp | 20 ++++++++++++++++----
|
|
1 file changed, 16 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/backend-vlc/vlcmediawidget.cpp b/src/backend-vlc/vlcmediawidget.cpp
|
|
index 7917417..6f5e50f 100644
|
|
--- a/src/backend-vlc/vlcmediawidget.cpp
|
|
+++ b/src/backend-vlc/vlcmediawidget.cpp
|
|
@@ -559,7 +559,10 @@ void VlcMediaWidget::unregisterEvents()
|
|
libvlc_event_detach(eventManager, eventType.at(i),
|
|
vlcEventHandler, this);
|
|
#if LIBVLC_VERSION_MAJOR <= 2
|
|
- libvlc_event_detach(eventManager, libvlc_MediaMetaChanged,
|
|
+ if (!vlcMedia)
|
|
+ return;
|
|
+ libvlc_event_manager_t *mediaEvent = libvlc_media_event_manager(vlcMedia);
|
|
+ libvlc_event_detach(mediaEvent, libvlc_MediaMetaChanged,
|
|
vlcEventHandler, this);
|
|
#endif
|
|
}
|
|
@@ -583,9 +586,18 @@ int VlcMediaWidget::makePlay()
|
|
}
|
|
|
|
#if LIBVLC_VERSION_MAJOR <= 2
|
|
- // For libVlc 2.x to work, we need to add the
|
|
- // MediaMetaChanged event only here
|
|
- if (libvlc_event_attach(eventManager, libvlc_MediaMetaChanged,
|
|
+ /*
|
|
+ * There is a difference between libVlc 2.x and 3.x:
|
|
+ * With version 2.x, the event needs to be registered at the
|
|
+ * vlcMedia object, just before calling libvlc_media_player_set_media()
|
|
+ *
|
|
+ * On version 3.x, while this still works, you can simply register the
|
|
+ * event directly at vlcMediaPlayer, together with all other events,
|
|
+ * with simplifies the code.
|
|
+ */
|
|
+ libvlc_event_manager_t *mediaEvent = libvlc_media_event_manager(vlcMedia);
|
|
+
|
|
+ if (libvlc_event_attach(mediaEvent, libvlc_MediaMetaChanged,
|
|
vlcEventHandler, this) != 0) {
|
|
qCWarning(logMediaWidget, "Cannot attach event handler %d",
|
|
libvlc_MediaMetaChanged);
|
|
--
|
|
cgit v1.1
|
|
|