SAT>IP Client: add RTSP port to log messages

This commit is contained in:
Jaroslav Kysela 2015-03-03 16:59:17 +01:00
parent afede2267f
commit c522d71ed0
3 changed files with 31 additions and 4 deletions

View 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))

View 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);
}

View 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 );