Mercurial > pt1.oyama
diff src/ushare.c @ 170:4f3640bf350d
Change display name of DLNA.
- old_display name: (recpt1:devN)
- new_display name: (hostname: /dev/ptXdevY)
- change UUID format.
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Wed, 17 Oct 2012 23:47:16 +0900 |
parents | 726fe10d9e4a |
children | 6c710e5a28b8 |
line wrap: on
line diff
--- a/src/ushare.c Sun Oct 07 00:37:34 2012 +0900 +++ b/src/ushare.c Wed Oct 17 23:47:16 2012 +0900 @@ -73,6 +73,7 @@ #include "buffer.h" #include "ctrl_telnet.h" #include "recpt1.h" +#include "pt1_common.h" struct ushare_t *ut = NULL; @@ -87,10 +88,12 @@ thread_data *tdata = gp_tdata; struct ushare_t *ut = (struct ushare_t *) malloc (sizeof (struct ushare_t)); char model_name[32]; + char host_name[HOST_NAME_MAX+1]; model_name[0] = '\0'; + gethostname(host_name, sizeof(host_name)); if (!ut) return NULL; - snprintf(model_name, sizeof(model_name), "%s:dev%d", PACKAGE_NAME, tdata->device_id); + snprintf(model_name, sizeof(model_name), "%s: %s", host_name, tdata->device_name); model_name[sizeof(model_name)-1] = '\0'; // ut->name = strdup (DEFAULT_USHARE_NAME); @@ -289,44 +292,41 @@ int res; size_t len; + char *friendly_name = ut->name; + char manufacturer[] = "GeeXboX Team"; + char manufacturer_url[] = "http://ushare.geexbox.org/"; + char model_description[] = "uShare : DLNA Media Server"; + char *model_name = ut->model_name; + char model_number[] = "001"; + char model_url[] = "http://ushare.geexbox.org/"; + char serial_number[] = "USHARE-01"; + char *uuid = ut->udn; + char presentation_url[] = "/web/ushare.html"; + char cms_scpd_url[] = "/web/cms.xml"; + char cms_control_url[] = "/web/cms_control"; + char cms_event_url[] = "/web/cms_event"; + char cds_scpd_url[] = "/web/cds.xml"; + char cds_control_url[] = "/web/cds_control"; + char cds_event_url[] = "/web/cds_event"; + if (!ut || !ut->name || !ut->udn || !ut->ip) return -1; -#ifdef HAVE_DLNA - if (ut->dlna_enabled) - { - len = 0; - description = - dlna_dms_description_get (ut->name, - "GeeXboX Team", - "http://ushare.geexbox.org/", - "uShare : DLNA Media Server", - ut->model_name, - "001", - "http://ushare.geexbox.org/", - "USHARE-01", - ut->udn, - "/web/ushare.html", - "/web/cms.xml", - "/web/cms_control", - "/web/cms_event", - "/web/cds.xml", - "/web/cds_control", - "/web/cds_event"); - if (!description) - return -1; - } - else - { -#endif /* HAVE_DLNA */ - len = strlen (UPNP_DESCRIPTION) + strlen (ut->name) - + strlen (ut->model_name) + strlen (ut->udn) + 1; + len = strlen (UPNP_DMS_DESCRIPTION) + strlen (friendly_name) + + strlen (manufacturer) + strlen (manufacturer_url) + + strlen (model_description) + strlen (model_name) + + strlen (model_number) + strlen (model_url) + strlen (serial_number) + + strlen (uuid) + strlen (presentation_url) + strlen (cms_scpd_url) + + strlen (cms_control_url) + strlen (cms_event_url) + + strlen (cds_scpd_url) + strlen (cds_control_url) + + strlen (cds_event_url) + 1; description = (char *) malloc (len * sizeof (char)); memset (description, 0, len); - sprintf (description, UPNP_DESCRIPTION, ut->name, ut->model_name, ut->udn); -#ifdef HAVE_DLNA - } -#endif /* HAVE_DLNA */ + sprintf (description, UPNP_DMS_DESCRIPTION, friendly_name, + manufacturer, manufacturer_url, model_description, + model_name, model_number, model_url, serial_number, uuid, + presentation_url, cms_scpd_url, cms_control_url, cms_event_url, + cds_scpd_url, cds_control_url, cds_event_url); log_info (_("Initializing UPnP subsystem ...\n")); res = UpnpInit (ut->ip, ut->port); @@ -583,7 +583,7 @@ ptr = (unsigned char *) ifr.ifr_hwaddr.sa_data; #endif /* (defined(BSD) || defined(__FreeBSD__)) */ - snprintf (buf, 64, "%s-%04x-%02x%02x%02x%02x%02x%02x", DEFAULT_UUID, tdata->device_id, + snprintf (buf, 64, "%s-%04x-%02x%02x%02x%02x%02x%02x", DEFAULT_UUID, get_device_id_by_name(tdata->device_name), (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377));