changeset 176:2ae60285f383

Change DLNA display name.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Mon, 05 Nov 2012 23:11:32 +0900
parents 309936cf7277
children 1d6674183e76
files src/ushare.c
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ushare.c	Tue Oct 30 22:15:24 2012 +0900
+++ b/src/ushare.c	Mon Nov 05 23:11:32 2012 +0900
@@ -87,20 +87,28 @@
   extern struct channel_info_list *channel_list;
   thread_data *tdata = gp_tdata;
   struct ushare_t *ut = (struct ushare_t *) malloc (sizeof (struct ushare_t));
-  char model_name[32];
+  char model_name[HOST_NAME_MAX + 1];
   char host_name[HOST_NAME_MAX+1];
+  char *mode = NULL;
+  char *utf8_str = NULL;
   model_name[0] = '\0';
   gethostname(host_name, sizeof(host_name));
   if (!ut)
     return NULL;
-  snprintf(model_name, sizeof(model_name), "%s: %s", host_name, tdata->device_name);
+ if(tdata->table->type == CHTYPE_GROUND) {
+    mode = "地デジ";
+  } else {
+    mode = "BS|CS";
+  }
+  snprintf(model_name, sizeof(model_name), "%s(%s): %s", host_name, mode, tdata->device_name);
+  utf8_str = iconv_convert(model_name);
   model_name[sizeof(model_name)-1] = '\0';
 
 //  ut->name = strdup (DEFAULT_USHARE_NAME);
-  ut->name = strdup (model_name);
+  ut->name = strdup (utf8_str);
   ut->interface = strdup (DEFAULT_USHARE_IFACE);
 //  ut->model_name = strdup (DEFAULT_USHARE_NAME);
-  ut->model_name = strdup (model_name);
+  ut->model_name = strdup (utf8_str);
   ut->contentlist = NULL;
   ut->rb = rbinit (rb_compare, NULL);
   ut->root_entry = NULL;
@@ -770,14 +778,14 @@
 void *
 dlna_startup (void *p)
 {
+  setup_i18n ();
+  setup_iconv ();
   ut = ushare_new ();
   log_verbose ("dlna_startup() start\n");
 
   if (!ut)
     return NULL;
 
-  setup_i18n ();
-  setup_iconv ();
 
 #if 0
   /* Parse args before cfg file, as we may override the default file */