Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
[Device] Check X_DLNA_GetBytePositionInfo action availability
Browse files Browse the repository at this point in the history
Introspection is used to check if the UPnP X_DLNA_GetBytePositionInfo
action is supported. If it is not supported we skip its call when we
retrieve all the properties.
X_DLNA_GetBytePositionInfo doesn't seem to be widely supported by
renderer devices.

Partial fix for issue:
#115

Signed-off-by: Christophe Guiraud <christophe.guiraud@intel.com>
  • Loading branch information
cguiraud committed Sep 17, 2013
1 parent dfda858 commit c94e4a0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
29 changes: 24 additions & 5 deletions libdleyna/renderer/device.c
Expand Up @@ -2106,9 +2106,11 @@ static gboolean prv_get_av_service_states_values(GUPnPServiceProxy *av_proxy,
GVariant **mpris_tp_speeds,
GPtrArray **upnp_tp_speeds,
double *min_rate,
double *max_rate)
double *max_rate,
gboolean *can_get_byte_pos)
{
const GUPnPServiceStateVariableInfo *svi;
const GUPnPServiceActionInfo *sai;
GUPnPServiceIntrospection *introspection;
GError *error = NULL;
GVariant *speeds = NULL;
Expand Down Expand Up @@ -2162,6 +2164,12 @@ static gboolean prv_get_av_service_states_values(GUPnPServiceProxy *av_proxy,
*mpris_tp_speeds = g_variant_ref_sink(speeds);
}

sai = gupnp_service_introspection_get_action(
introspection,
"X_DLNA_GetBytePositionInfo");

*can_get_byte_pos = (sai != NULL);

g_object_unref(introspection);

exit:
Expand Down Expand Up @@ -2360,7 +2368,8 @@ static gboolean prv_props_update(dlr_device_t *device, dlr_task_t *task)
&device->mpris_transport_play_speeds,
&device->transport_play_speeds,
&device->min_rate,
&device->max_rate)) {
&device->max_rate,
&device->can_get_byte_position)) {
DLEYNA_LOG_DEBUG("Lost Device AV");

device_alive = FALSE;
Expand Down Expand Up @@ -2709,13 +2718,23 @@ void dlr_device_get_all_props(dlr_device_t *device, dlr_task_t *task,
evented */

device_cb_data = g_new0(dlr_device_data_t, 1);
device_cb_data->ut.get_all_position.expected_props = 2;

cb_data->private = device_cb_data;
cb_data->free_private = prv_free_get_all_position_data;

prv_get_position_info(cb_data, "X_DLNA_GetBytePositionInfo",
prv_get_all_byte_position_info_cb);
if (device->can_get_byte_position) {
device_cb_data->ut.get_all_position.expected_props = 2;
prv_get_position_info(
cb_data,
"X_DLNA_GetBytePositionInfo",
prv_get_all_byte_position_info_cb);
} else {
device_cb_data->ut.get_all_position.expected_props = 1;
prv_get_position_info(
cb_data,
"GetPositionInfo",
prv_get_all_position_info_cb);
}
} else {
prv_get_props(cb_data);
(void) g_idle_add(dlr_async_task_complete, cb_data);
Expand Down
1 change: 1 addition & 0 deletions libdleyna/renderer/device.h
Expand Up @@ -85,6 +85,7 @@ struct dlr_device_t_ {
gchar *rate;
double min_rate;
double max_rate;
gboolean can_get_byte_position;
guint construct_step;
dlr_device_icon_t icon;
GHashTable *rc_event_handlers;
Expand Down

0 comments on commit c94e4a0

Please sign in to comment.