1*4882a593SmuzhiyunFrom 7c945e7960cf7dffd9dd0bb5f7ec6bee4dc0bca3 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Khem Raj <raj.khem@gmail.com>
3*4882a593SmuzhiyunDate: Tue, 18 Feb 2020 14:17:55 -0800
4*4882a593SmuzhiyunSubject: [PATCH] add gupnp 1.2 API support
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunTakes from https://git.archlinux.org/svntogit/packages.git/tree/trunk/gupnp-1.2.diff?h=packages/dleyna-renderer
7*4882a593SmuzhiyunUpstream-Status: Pending
8*4882a593SmuzhiyunSigned-off-by: Khem Raj <raj.khem@gmail.com>
9*4882a593Smuzhiyun---
10*4882a593Smuzhiyun configure.ac                |  4 +--
11*4882a593Smuzhiyun libdleyna/renderer/device.c | 51 +++++++++++++++++++++++++++++++++++--
12*4882a593Smuzhiyun libdleyna/renderer/upnp.c   |  4 +--
13*4882a593Smuzhiyun 3 files changed, 53 insertions(+), 6 deletions(-)
14*4882a593Smuzhiyun
15*4882a593Smuzhiyundiff --git a/configure.ac b/configure.ac
16*4882a593Smuzhiyunindex 271ee92..364659d 100644
17*4882a593Smuzhiyun--- a/configure.ac
18*4882a593Smuzhiyun+++ b/configure.ac
19*4882a593Smuzhiyun@@ -38,8 +38,8 @@ LT_LANG([C])
20*4882a593Smuzhiyun PKG_PROG_PKG_CONFIG(0.16)
21*4882a593Smuzhiyun PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28])
22*4882a593Smuzhiyun PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.28])
23*4882a593Smuzhiyun-PKG_CHECK_MODULES([GSSDP], [gssdp-1.0 >= 0.13.2])
24*4882a593Smuzhiyun-PKG_CHECK_MODULES([GUPNP], [gupnp-1.0 >= 0.20.5])
25*4882a593Smuzhiyun+PKG_CHECK_MODULES([GSSDP], [gssdp-1.2 >= 1.2.0])
26*4882a593Smuzhiyun+PKG_CHECK_MODULES([GUPNP], [gupnp-1.2 >= 1.2.0])
27*4882a593Smuzhiyun PKG_CHECK_MODULES([GUPNPAV], [gupnp-av-1.0 >= 0.11.5])
28*4882a593Smuzhiyun PKG_CHECK_MODULES([GUPNPDLNA], [gupnp-dlna-2.0 >= 0.9.4])
29*4882a593Smuzhiyun PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.28.2])
30*4882a593Smuzhiyundiff --git a/libdleyna/renderer/device.c b/libdleyna/renderer/device.c
31*4882a593Smuzhiyunindex 783fb52..c7b9fc3 100644
32*4882a593Smuzhiyun--- a/libdleyna/renderer/device.c
33*4882a593Smuzhiyun+++ b/libdleyna/renderer/device.c
34*4882a593Smuzhiyun@@ -2121,6 +2121,53 @@ exit:
35*4882a593Smuzhiyun 	return;
36*4882a593Smuzhiyun }
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun+typedef struct
39*4882a593Smuzhiyun+{
40*4882a593Smuzhiyun+  GMainLoop *loop;
41*4882a593Smuzhiyun+  GUPnPServiceIntrospection *introspection;
42*4882a593Smuzhiyun+  GError **error;
43*4882a593Smuzhiyun+} GetIntrospectionAsyncData;
44*4882a593Smuzhiyun+
45*4882a593Smuzhiyun+static void
46*4882a593Smuzhiyun+get_introspection_async_cb (GUPnPServiceInfo           *info,
47*4882a593Smuzhiyun+                            GUPnPServiceIntrospection  *introspection,
48*4882a593Smuzhiyun+                            const GError               *error,
49*4882a593Smuzhiyun+                            gpointer                    user_data)
50*4882a593Smuzhiyun+{
51*4882a593Smuzhiyun+  GetIntrospectionAsyncData *data = user_data;
52*4882a593Smuzhiyun+  data->introspection = introspection;
53*4882a593Smuzhiyun+  if (data->error)
54*4882a593Smuzhiyun+    *data->error = g_error_copy (error);
55*4882a593Smuzhiyun+  g_main_loop_quit (data->loop);
56*4882a593Smuzhiyun+}
57*4882a593Smuzhiyun+
58*4882a593Smuzhiyun+static GUPnPServiceIntrospection *
59*4882a593Smuzhiyun+_gupnp_service_info_get_introspection (GUPnPServiceInfo *info,
60*4882a593Smuzhiyun+                                       GError          **error)
61*4882a593Smuzhiyun+{
62*4882a593Smuzhiyun+  GetIntrospectionAsyncData data;
63*4882a593Smuzhiyun+  GMainContext *context;
64*4882a593Smuzhiyun+
65*4882a593Smuzhiyun+  context = g_main_context_new ();
66*4882a593Smuzhiyun+  data.loop = g_main_loop_new (context, FALSE);
67*4882a593Smuzhiyun+  data.error = error;
68*4882a593Smuzhiyun+
69*4882a593Smuzhiyun+  g_main_context_push_thread_default (context);
70*4882a593Smuzhiyun+
71*4882a593Smuzhiyun+  gupnp_service_info_get_introspection_async (info,
72*4882a593Smuzhiyun+                                              get_introspection_async_cb,
73*4882a593Smuzhiyun+                                              &data);
74*4882a593Smuzhiyun+
75*4882a593Smuzhiyun+  g_main_loop_run (data.loop);
76*4882a593Smuzhiyun+
77*4882a593Smuzhiyun+  g_main_context_pop_thread_default (context);
78*4882a593Smuzhiyun+
79*4882a593Smuzhiyun+  g_main_loop_unref (data.loop);
80*4882a593Smuzhiyun+  g_main_context_unref (context);
81*4882a593Smuzhiyun+
82*4882a593Smuzhiyun+  return data.introspection;
83*4882a593Smuzhiyun+}
84*4882a593Smuzhiyun+
85*4882a593Smuzhiyun static gboolean prv_get_av_service_states_values(GUPnPServiceProxy *av_proxy,
86*4882a593Smuzhiyun 						 GVariant **mpris_tp_speeds,
87*4882a593Smuzhiyun 						 GPtrArray **upnp_tp_speeds,
88*4882a593Smuzhiyun@@ -2147,7 +2194,7 @@ static gboolean prv_get_av_service_states_values(GUPnPServiceProxy *av_proxy,
89*4882a593Smuzhiyun 	weak_ref = av_proxy;
90*4882a593Smuzhiyun 	g_object_add_weak_pointer(G_OBJECT(av_proxy), &weak_ref);
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun-	introspection = gupnp_service_info_get_introspection(
93*4882a593Smuzhiyun+	introspection = _gupnp_service_info_get_introspection(
94*4882a593Smuzhiyun 		GUPNP_SERVICE_INFO(av_proxy),
95*4882a593Smuzhiyun 		&error);
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun@@ -2215,7 +2262,7 @@ static gboolean prv_get_rc_service_states_values(GUPnPServiceProxy *rc_proxy,
98*4882a593Smuzhiyun 	weak_ref = rc_proxy;
99*4882a593Smuzhiyun 	g_object_add_weak_pointer(G_OBJECT(rc_proxy), &weak_ref);
100*4882a593Smuzhiyun
101*4882a593Smuzhiyun-	introspection = gupnp_service_info_get_introspection(
102*4882a593Smuzhiyun+	introspection = _gupnp_service_info_get_introspection(
103*4882a593Smuzhiyun 		GUPNP_SERVICE_INFO(rc_proxy),
104*4882a593Smuzhiyun 		&error);
105*4882a593Smuzhiyun
106*4882a593Smuzhiyundiff --git a/libdleyna/renderer/upnp.c b/libdleyna/renderer/upnp.c
107*4882a593Smuzhiyunindex ac1b08a..b762226 100644
108*4882a593Smuzhiyun--- a/libdleyna/renderer/upnp.c
109*4882a593Smuzhiyun+++ b/libdleyna/renderer/upnp.c
110*4882a593Smuzhiyun@@ -243,8 +243,8 @@ static void prv_server_unavailable_cb(GUPnPControlPoint *cp,
111*4882a593Smuzhiyun
112*4882a593Smuzhiyun 	udn = gupnp_device_info_get_udn((GUPnPDeviceInfo *)proxy);
113*4882a593Smuzhiyun
114*4882a593Smuzhiyun-	ip_address = gupnp_context_get_host_ip(
115*4882a593Smuzhiyun-		gupnp_control_point_get_context(cp));
116*4882a593Smuzhiyun+	ip_address = gssdp_client_get_host_ip(
117*4882a593Smuzhiyun+		GSSDP_CLIENT(gupnp_control_point_get_context(cp)));
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun 	if (!udn || !ip_address)
120*4882a593Smuzhiyun 		goto on_error;
121*4882a593Smuzhiyun--
122*4882a593Smuzhiyun2.25.1
123*4882a593Smuzhiyun
124