]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
SAT>IP Client: add RTSP port to log messages
authorJaroslav Kysela <perex@perex.cz>
Tue, 3 Mar 2015 15:59:17 +0000 (16:59 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Mar 2015 20:41:13 +0000 (21:41 +0100)
src/input/mpegts/satip/satip.c
src/input/mpegts/satip/satip_frontend.c
src/input/mpegts/satip/satip_private.h

index 2f7dedd94227887b078fe15666987b4a681d0867..a0a2a950e7f4716b7fb3a95d8c84b77b363c242a 100644 (file)
@@ -51,6 +51,7 @@ satip_device_dbus_notify( satip_device_t *sd, const char *sig_name )
   htsmsg_add_str(msg, NULL, sd->sd_info.addr);
   htsmsg_add_str(msg, NULL, sd->sd_info.location);
   htsmsg_add_str(msg, NULL, sd->sd_info.server);
+  htsmsg_add_s64(msg, NULL, sd->sd_info.rtsp_port);
   snprintf(buf, sizeof(buf), "/input/mpegts/satip/%s", idnode_uuid_as_str(&sd->th_id));
   dbus_emit_signal(buf, sig_name, msg);
 #endif
@@ -99,6 +100,19 @@ satip_device_addr( void *aux, const char *path, char *value )
   return strdup("err");
 }
 
+/*
+ *
+ */
+char *
+satip_device_nicename( satip_device_t *sd, char *buf, int len )
+{
+  if (sd->sd_info.rtsp_port != 554)
+    snprintf(buf, len, "%s:%d", sd->sd_info.addr, sd->sd_info.rtsp_port);
+  else
+    snprintf(buf, len, "%s", sd->sd_info.addr);
+  return buf;
+}
+
 /*
  * SAT-IP client
  */
@@ -202,6 +216,13 @@ const idclass_t satip_device_class =
       .opts     = PO_RDONLY | PO_NOSAVE,
       .off      = offsetof(satip_device_t, sd_info.addr),
     },
+    {
+      .type     = PT_INT,
+      .id       = "rtsp",
+      .name     = "RTSP Port",
+      .opts     = PO_RDONLY | PO_NOSAVE,
+      .off      = offsetof(satip_device_t, sd_info.rtsp_port),
+    },
     {
       .type     = PT_STR,
       .id       = "device_uuid",
@@ -371,6 +392,7 @@ satip_device_create( satip_device_info_t *info )
   char *argv[10];
   int i, j, n, m, fenum, t2, save = 0;
   dvb_fe_type_t type;
+  char buf2[60];
 
   satip_device_calc_uuid(&uuid, info->uuid);
 
@@ -448,9 +470,11 @@ satip_device_create( satip_device_info_t *info )
       m = atoi(argv[i] + 5);
     }
     if (type == DVB_TYPE_NONE) {
-      tvhlog(LOG_ERR, "satip", "%s: bad tuner type [%s]", sd->sd_info.addr, argv[i]);
+      tvhlog(LOG_ERR, "satip", "%s: bad tuner type [%s]",
+             satip_device_nicename(sd, buf2, sizeof(buf2)), argv[i]);
     } else if (m < 0 || m > 32) {
-      tvhlog(LOG_ERR, "satip", "%s: bad tuner count [%s]", sd->sd_info.addr, argv[i]);
+      tvhlog(LOG_ERR, "satip", "%s: bad tuner count [%s]",
+             satip_device_nicename(sd, buf2, sizeof(buf2)), argv[i]);
     } else {
       for (j = 0; j < m; j++)
         if (satip_frontend_create(feconf, sd, type, t2, fenum))
index bbed461bbdb0b9fef19b6803544044c32cf40b5f..d5b50a3de053e55760a10f79947a64fa14a4b6d0 100644 (file)
@@ -1713,7 +1713,7 @@ satip_frontend_create
 {
   const idclass_t *idc;
   const char *uuid = NULL, *override = NULL;
-  char id[16], lname[256];
+  char id[16], lname[256], nname[60];
   satip_frontend_t *lfe;
   uint32_t master = 0;
   int i, def_positions = sd->sd_info.srcs;
@@ -1789,7 +1789,8 @@ satip_frontend_create
        strstr(lfe->mi_name, " Tuner ") &&
        strstr(lfe->mi_name, " #"))) {
     snprintf(lname, sizeof(lname), "SAT>IP %s Tuner #%i (%s)",
-             dvb_type2str(type), num, sd->sd_info.addr);
+             dvb_type2str(type), num,
+             satip_device_nicename(sd, nname, sizeof(nname)));
     free(lfe->mi_name);
     lfe->mi_name = strdup(lname);
   }
index a3eb92957e7511f9656ccb2d3e19c719e348a13d..71f3243f82e60f2a6323c7ba0b341ee4421bf132 100644 (file)
@@ -184,6 +184,8 @@ void satip_device_destroy ( satip_device_t *sd );
 
 void satip_device_destroy_later( satip_device_t *sd, int after_ms );
 
+char *satip_device_nicename ( satip_device_t *sd, char *buf, int len );
+
 satip_frontend_t *
 satip_frontend_create
   ( htsmsg_t *conf, satip_device_t *sd, dvb_fe_type_t type, int t2, int num );