Hello community,

here is the log from the commit of package kaffeine for openSUSE:Factory 
checked in at 2019-05-06 13:27:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kaffeine (Old)
 and      /work/SRC/openSUSE:Factory/.kaffeine.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kaffeine"

Mon May  6 13:27:13 2019 rev:76 rq:700624 version:2.0.17

Changes:
--------
--- /work/SRC/openSUSE:Factory/kaffeine/kaffeine.changes        2019-05-02 
19:22:13.393895144 +0200
+++ /work/SRC/openSUSE:Factory/.kaffeine.new.5148/kaffeine.changes      
2019-05-06 13:27:16.605265306 +0200
@@ -1,0 +2,8 @@
+Sat May  4 17:01:52 UTC 2019 - wba...@tmo.at
+
+- 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
+
+-------------------------------------------------------------------

New:
----
  fix-support-for-vlc-2.x.patch
  with-vlc-2.x-use-vlcMedia-for-libvlc_MediaMetaChanged-event.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kaffeine.spec ++++++
--- /var/tmp/diff_new_pack.0UVdOq/_old  2019-05-06 13:27:17.597267077 +0200
+++ /var/tmp/diff_new_pack.0UVdOq/_new  2019-05-06 13:27:17.597267077 +0200
@@ -26,6 +26,9 @@
 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)
@@ -42,7 +45,7 @@
 BuildRequires:  pkgconfig(Qt5Sql)
 BuildRequires:  pkgconfig(Qt5Widgets)
 BuildRequires:  pkgconfig(Qt5X11Extras)
-BuildRequires:  pkgconfig(libvlc) >= 3.0
+BuildRequires:  pkgconfig(libvlc)
 BuildRequires:  pkgconfig(x11)
 BuildRequires:  pkgconfig(xscrnsaver)
 Requires:       libQt5Sql5-sqlite

++++++ fix-support-for-vlc-2.x.patch ++++++
>From 402cbee5e675cf795b619b834f92aac086972afc Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab+sams...@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+sams...@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

++++++ with-vlc-2.x-use-vlcMedia-for-libvlc_MediaMetaChanged-event.patch ++++++
>From 2644cbf02ed39bb6b194bc6b7935b069b5769364 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab+sams...@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+sams...@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


Reply via email to