diff options
author | Ludovic Ferrandis <ludovic.ferrandis@intel.com> | 2013-08-08 16:14:08 +0200 |
---|---|---|
committer | Regis Merlino <regis.merlino@intel.com> | 2013-08-08 18:08:52 +0200 |
commit | 54fccf6e2378cd654a9e64719030d53154aa06a5 (patch) | |
tree | 92e0f5480373a4289c1cd823a279695dfbfa29a3 | |
parent | 209ad5d755305080bdafe7cd614f2c47ca62bbae (diff) | |
download | dleyna-renderer-54fccf6e2378cd654a9e64719030d53154aa06a5.tar.gz |
[Task] Use string constant for Open/Set URI
Define string constants for action and parameters, for
Open/Open Next/Set URI API instead of duplicating the strings
parameters.
Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
-rw-r--r-- | libdleyna/renderer/task.c | 45 | ||||
-rw-r--r-- | libdleyna/renderer/task.h | 6 |
2 files changed, 32 insertions, 19 deletions
diff --git a/libdleyna/renderer/task.c b/libdleyna/renderer/task.c index 233488d..8b41724 100644 --- a/libdleyna/renderer/task.c +++ b/libdleyna/renderer/task.c @@ -26,6 +26,14 @@ #include "async.h" #include "server.h" +#define DLR_TASK_SET_URI_OPERATION "SetAVTransportURI" +#define DLR_TASK_SET_URI_TYPE "CurrentURI" +#define DLR_TASK_SET_URI_META_DATA "CurrentURIMetaData" + +#define DLR_TASK_SET_NEXT_URI_OPERATION "SetNextAVTransportURI" +#define DLR_TASK_SET_NEXT_URI_TYPE "NextURI" +#define DLR_TASK_SET_NEXT_URI_META_DATA "NextURIMetaData" + dlr_task_t *dlr_task_rescan_new(dleyna_connector_msg_id_t invocation) { dlr_task_t *task = g_new0(dlr_task_t, 1); @@ -106,9 +114,6 @@ static void prv_dlr_task_delete(dlr_task_t *task) case DLR_TASK_SET_URI: g_free(task->ut.open_uri.uri); g_free(task->ut.open_uri.metadata); - g_free(task->ut.open_uri.operation); - g_free(task->ut.open_uri.uri_type); - g_free(task->ut.open_uri.metadata_type); break; case DLR_TASK_HOST_URI: case DLR_TASK_REMOVE_URI: @@ -301,9 +306,9 @@ dlr_task_t *dlr_task_open_uri_new(dleyna_connector_msg_id_t invocation, g_variant_get(parameters, "(s)", &task->ut.open_uri.uri); g_strstrip(task->ut.open_uri.uri); - task->ut.open_uri.operation = g_strdup("SetAVTransportURI"); - task->ut.open_uri.uri_type = g_strdup("CurrentURI"); - task->ut.open_uri.metadata_type = g_strdup("CurrentURIMetaData"); + task->ut.open_uri.operation = DLR_TASK_SET_URI_OPERATION; + task->ut.open_uri.uri_type = DLR_TASK_SET_URI_TYPE; + task->ut.open_uri.metadata_type = DLR_TASK_SET_URI_META_DATA; return task; } @@ -318,9 +323,9 @@ static dlr_task_t *prv_open_uri_ex_generic(dlr_task_t *task, &task->ut.open_uri.metadata); g_strstrip(task->ut.open_uri.uri); g_strstrip(task->ut.open_uri.metadata); - task->ut.open_uri.operation = g_strdup(operation); - task->ut.open_uri.uri_type = g_strdup(uri_type); - task->ut.open_uri.metadata_type = g_strdup(metadata_type); + task->ut.open_uri.operation = operation; + task->ut.open_uri.uri_type = uri_type; + task->ut.open_uri.metadata_type = metadata_type; return task; } @@ -333,8 +338,11 @@ dlr_task_t *dlr_task_open_uri_ex_new(dleyna_connector_msg_id_t invocation, task = prv_device_task_new(DLR_TASK_OPEN_URI, invocation, path, NULL); - return prv_open_uri_ex_generic(task, parameters, "SetAVTransportURI", - "CurrentURI", "CurrentURIMetaData"); + return prv_open_uri_ex_generic(task, + parameters, + DLR_TASK_SET_URI_OPERATION, + DLR_TASK_SET_URI_TYPE, + DLR_TASK_SET_URI_META_DATA); } dlr_task_t *dlr_task_open_next_uri_new(dleyna_connector_msg_id_t invocation, @@ -345,9 +353,11 @@ dlr_task_t *dlr_task_open_next_uri_new(dleyna_connector_msg_id_t invocation, task = prv_device_task_new(DLR_TASK_OPEN_NEXT_URI, invocation, path, NULL); - return prv_open_uri_ex_generic(task, parameters, - "SetNextAVTransportURI", "NextURI", - "NextURIMetaData"); + return prv_open_uri_ex_generic(task, + parameters, + DLR_TASK_SET_NEXT_URI_OPERATION, + DLR_TASK_SET_NEXT_URI_TYPE, + DLR_TASK_SET_NEXT_URI_META_DATA); } dlr_task_t *dlr_task_set_uri_new(dleyna_connector_msg_id_t invocation, @@ -358,8 +368,11 @@ dlr_task_t *dlr_task_set_uri_new(dleyna_connector_msg_id_t invocation, task = prv_device_task_new(DLR_TASK_SET_URI, invocation, path, NULL); - return prv_open_uri_ex_generic(task, parameters, "SetAVTransportURI", - "CurrentURI", "CurrentURIMetaData"); + return prv_open_uri_ex_generic(task, + parameters, + DLR_TASK_SET_URI_OPERATION, + DLR_TASK_SET_URI_TYPE, + DLR_TASK_SET_URI_META_DATA); } dlr_task_t *dlr_task_host_uri_new(dleyna_connector_msg_id_t invocation, diff --git a/libdleyna/renderer/task.h b/libdleyna/renderer/task.h index 6349437..016aef7 100644 --- a/libdleyna/renderer/task.h +++ b/libdleyna/renderer/task.h @@ -82,9 +82,9 @@ typedef struct dlr_task_open_uri_t_ dlr_task_open_uri_t; struct dlr_task_open_uri_t_ { gchar *uri; gchar *metadata; - gchar *operation; - gchar *uri_type; - gchar *metadata_type; + const gchar *operation; + const gchar *uri_type; + const gchar *metadata_type; }; typedef struct dlr_task_seek_t_ dlr_task_seek_t; |