Dominique Leuenberger 2019-05-16 20:09:02 +00:00 committed by Git OBS Bridge
commit c0d46b6a73
6 changed files with 24 additions and 186 deletions

View File

@ -1,106 +0,0 @@
From 402cbee5e675cf795b619b834f92aac086972afc Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Date: Fri, 3 May 2019 08:41:36 -0300
Subject: vlc: fix support for vlc 2.x
As reported by Wolfgang, the changes made on Kaffeine 2.0.16 to
solve issues with audio CDs broke Kaffeine when building it with
legacy vlc 2.2.x.
The fix here is simple: just place two libVlc 3.0 events at the
print logic inside the Vlc3 block is enough to make it build
again.
The libvlc_MediaMetaChanged is used to report when a new media is
playing.
With vlc 2.0, such event should be enabled only inside mediaPlay()
routine. Doing it early causes the play to not work.
So, re-add such logic, with got removed on changeset d03abc77ad40
("backend-vlc: simplify events handling logic").
BUG: 407153
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
src/backend-vlc/vlcmediawidget.cpp | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/backend-vlc/vlcmediawidget.cpp b/src/backend-vlc/vlcmediawidget.cpp
index e47a44d..7917417 100644
--- a/src/backend-vlc/vlcmediawidget.cpp
+++ b/src/backend-vlc/vlcmediawidget.cpp
@@ -113,10 +113,6 @@ const char *vlcEventName(int event)
return "MediaListPlayerNextItemSet";
case libvlc_MediaListPlayerStopped:
return "MediaListPlayerStopped";
- case libvlc_RendererDiscovererItemAdded:
- return "RendererDiscovererItemAdded";
- case libvlc_RendererDiscovererItemDeleted:
- return "RendererDiscovererItemDeleted";
case libvlc_VlmMediaAdded:
return "VlmMediaAdded";
case libvlc_VlmMediaRemoved:
@@ -140,6 +136,10 @@ const char *vlcEventName(int event)
case libvlc_VlmMediaInstanceStatusError:
return "VlmMediaInstanceStatusError";
#if LIBVLC_VERSION_MAJOR > 2
+ case libvlc_RendererDiscovererItemAdded:
+ return "RendererDiscovererItemAdded";
+ case libvlc_RendererDiscovererItemDeleted:
+ return "RendererDiscovererItemDeleted";
case libvlc_MediaPlayerAudioVolume:
return "MediaPlayerAudioVolume";
case libvlc_MediaPlayerAudioDevice:
@@ -171,17 +171,17 @@ VlcMediaWidget::VlcMediaWidget(QWidget *parent) : AbstractMediaWidget(parent),
typeOfDevice(""), trackNumber(1), numTracks(1)
{
libvlc_event_e events[] = {
- libvlc_MediaMetaChanged,
libvlc_MediaPlayerEncounteredError,
libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerLengthChanged,
libvlc_MediaPlayerSeekableChanged,
libvlc_MediaPlayerStopped,
+ libvlc_MediaPlayerTimeChanged,
#if LIBVLC_VERSION_MAJOR > 2
+ libvlc_MediaMetaChanged,
libvlc_MediaPlayerESAdded,
libvlc_MediaPlayerESDeleted,
#endif
- libvlc_MediaPlayerTimeChanged,
#if 0 // all other possible events
libvlc_MediaSubItemAdded,
libvlc_MediaDurationChanged,
@@ -558,6 +558,10 @@ void VlcMediaWidget::unregisterEvents()
for (int i = 0; i < eventType.size(); ++i)
libvlc_event_detach(eventManager, eventType.at(i),
vlcEventHandler, this);
+#if LIBVLC_VERSION_MAJOR <= 2
+ libvlc_event_detach(eventManager, libvlc_MediaMetaChanged,
+ vlcEventHandler, this);
+#endif
}
bool VlcMediaWidget::registerEvents()
@@ -578,6 +582,16 @@ int VlcMediaWidget::makePlay()
return -1;
}
+#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,
+ vlcEventHandler, this) != 0) {
+ qCWarning(logMediaWidget, "Cannot attach event handler %d",
+ libvlc_MediaMetaChanged);
+ }
+#endif
+
libvlc_media_player_set_media(vlcMediaPlayer, vlcMedia);
/*
--
cgit v1.1

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6578b785f754663c105d425605cf9a5dc139881fd479a9290b55cbf49182cce1
size 6029896

3
kaffeine-2.0.18.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d9799a5b7b94a55963f94938b36b8fcb1be3e753b2be110989934ab15386b681
size 6033112

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Wed May 15 11:54:48 UTC 2019 - wbauer@tmo.at
- Update to 2.0.18:
* Start using TravisCI for test builds
* mediawidget: Override DVD keys instead of changing their
settings (kde#394076)
* mediawidget: warn user to use keys for DVD menu
* mediawidget: remove a now unneeded check
* mediawidget: fix video position movement with mouse wheel
* mediawidget: fix the mouse wheel behavior at the streaming
window
* vlc: with vlc 2.x, use vlcMedia for libvlc_MediaMetaChanged
event (kde#407153)
* vlc: fix support for vlc 2.x (kde#407153)
- Drop patches merged upstream:
* fix-support-for-vlc-2.x.patch
* with-vlc-2.x-use-vlcMedia-for-libvlc_MediaMetaChanged-event.patch
-------------------------------------------------------------------
Sat May 4 17:01:52 UTC 2019 - wbauer@tmo.at

View File

@ -17,18 +17,15 @@
Name: kaffeine
Version: 2.0.17
Version: 2.0.18
Release: 0
Summary: VLC-based Multimedia Player
License: GPL-2.0-or-later
Group: Productivity/Multimedia/Video/Players
URL: http://kaffeine.kde.org/
URL: https://kaffeine.kde.org/
Source0: https://download.kde.org/stable/%{name}/%{name}-%{version}.tar.xz
# PATCH-FEATURE-OPENSUSE kaffeine-fixsplitter.patch -- GUI improvement (allow more flexibly set splitters)
Patch0: kaffeine-fixsplitter.patch
# PATCH-FIX-UPSTREAM
Patch1: fix-support-for-vlc-2.x.patch
Patch2: with-vlc-2.x-use-vlcMedia-for-libvlc_MediaMetaChanged-event.patch
BuildRequires: extra-cmake-modules
BuildRequires: pkgconfig
BuildRequires: cmake(KF5CoreAddons)

View File

@ -1,72 +0,0 @@
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