Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package mpvpaper for openSUSE:Factory 
checked in at 2022-02-22 21:18:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mpvpaper (Old)
 and      /work/SRC/openSUSE:Factory/.mpvpaper.new.1958 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mpvpaper"

Tue Feb 22 21:18:05 2022 rev:5 rq:956558 version:1.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/mpvpaper/mpvpaper.changes        2021-11-18 
10:34:02.183918726 +0100
+++ /work/SRC/openSUSE:Factory/.mpvpaper.new.1958/mpvpaper.changes      
2022-02-22 21:18:36.054290746 +0100
@@ -1,0 +2,7 @@
+Mon Feb 21 08:54:23 UTC 2022 - Fusion Future <[email protected]>
+
+- Fix build with removed deprecated APIs in mpv 2.x
+  (gh#mpv-player/mpv#9541, gh#GhostNaN/mpvpaper#19)
+  * observe-property-instead-of-MPV_EVENT-since-mpv-deprecated.patch
+
+-------------------------------------------------------------------

New:
----
  observe-property-instead-of-MPV_EVENT-since-mpv-deprecated.patch

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

Other differences:
------------------
++++++ mpvpaper.spec ++++++
--- /var/tmp/diff_new_pack.3I2os8/_old  2022-02-22 21:18:36.818290887 +0100
+++ /var/tmp/diff_new_pack.3I2os8/_new  2022-02-22 21:18:36.822290887 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package mpvpaper
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,6 +24,8 @@
 Group:          Productivity/Multimedia/Other
 URL:            https://github.com/GhostNaN/mpvpaper
 Source:         https://github.com/GhostNaN/mpvpaper/archive/%{version}.tar.gz
+# PATCH-FIX-UPSTREAM Fix build with removed deprecated APIs in mpv 2.x 
gh#GhostNaN/mpvpaper#19
+Patch0:         
observe-property-instead-of-MPV_EVENT-since-mpv-deprecated.patch
 BuildRequires:  meson
 BuildRequires:  mpv-devel
 BuildRequires:  ninja
@@ -36,7 +38,7 @@
 A video wallpaper program for wlroots based wayland compositors.
 
 %prep
-%setup -q
+%autosetup -p1
 
 %build
 %meson

++++++ observe-property-instead-of-MPV_EVENT-since-mpv-deprecated.patch ++++++
 
Index: mpvpaper-1.2/src/main.c
===================================================================
--- mpvpaper-1.2.orig/src/main.c
+++ mpvpaper-1.2/src/main.c
@@ -23,6 +23,9 @@
 
 typedef unsigned int uint;
 
+#define MPV_OBSERVE_IDLE 1
+#define MPV_OBSERVE_PAUSE 2
+
 struct wl_state {
     struct wl_display *display;
     struct wl_compositor *compositor;
@@ -346,6 +349,15 @@ static void *handle_mpv_events() {
     bool mpv_paused = 0;
     time_t start_time = time(NULL);
 
+    /**
+     * Register observers as MPV_EVENT_IDLE is deprecated and
+     * MPV_EVENT_PAUSE/MPV_EVENT_UNPAUSE have been removed.
+     *
+     * @see https://github.com/mpv-player/mpv/pull/9541
+     */
+    mpv_observe_property(mpv, MPV_OBSERVE_IDLE, "idle-active", 
MPV_FORMAT_NONE);
+    mpv_observe_property(mpv, MPV_OBSERVE_PAUSE, "pause", MPV_FORMAT_FLAG);
+
     while (!halt_info.kill_render_loop) {
         if (SLIDESHOW_TIME) {
             if ((time(NULL) - start_time) >= SLIDESHOW_TIME) {
@@ -355,25 +367,44 @@ static void *handle_mpv_events() {
         }
 
         mpv_event* event = mpv_wait_event(mpv, 0);
-        if (event->event_id == MPV_EVENT_SHUTDOWN || event->event_id == 
MPV_EVENT_IDLE)
+
+        if (event->event_id == MPV_EVENT_SHUTDOWN)
             exit_mpvpaper(0);
-        else if (event->event_id == MPV_EVENT_PAUSE) {
-            mpv_paused = 1;
-            // User paused
-            if (!halt_info.is_paused)
-                halt_info.is_paused += 1;
-        }
-        else if (event->event_id == MPV_EVENT_UNPAUSE) {
-            mpv_paused = 0;
-            halt_info.is_paused = 0;
-        }
+        else if (event->event_id == MPV_EVENT_PROPERTY_CHANGE) {
+            switch (event->reply_userdata) {
+                case MPV_OBSERVE_IDLE: {
+                    exit_mpvpaper(0);
+                    break;
+                }
+                case MPV_OBSERVE_PAUSE: {
+                    if (mpv_get_property(mpv, "paused", MPV_FORMAT_FLAG, 
&mpv_paused) < 0) {
+                        break;
+                    }
+                    if (mpv_paused) {
+                        // User paused
+                        if (!halt_info.is_paused)
+                            halt_info.is_paused += 1;
+                    } else {
+                        halt_info.is_paused = 0;
+                    }
+
+                    if (!halt_info.is_paused && mpv_paused) {
+                        mpv_command_async(mpv, 0, (const char*[]) {"set", 
"pause", "no", NULL});
+                    }
 
-        if (!halt_info.is_paused && mpv_paused) {
-            mpv_command_async(mpv, 0, (const char*[]) {"set", "pause", "no", 
NULL});
+                    break;
+                }
+                default:
+                    break;
+            }
         }
 
         pthread_usleep(10000);
     }
+
+    mpv_unobserve_property(mpv, MPV_OBSERVE_IDLE);
+    mpv_unobserve_property(mpv, MPV_OBSERVE_PAUSE);
+
     pthread_exit(NULL);
 }
 

Reply via email to