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