tvh_strlcatf(buf, sizeof(buf), l, ", tag=ANY");
}
- tvhtrace("access", "%s", buf);
+ tvhtrace(LS_ACCESS, "%s", buf);
}
/*
if (idnode_insert(&ae->ae_id, uuid, &access_entry_class, 0)) {
if (uuid)
- tvherror("access", "invalid uuid '%s'", uuid);
+ tvherror(LS_ACCESS, "invalid uuid '%s'", uuid);
free(ae);
return NULL;
}
if (idnode_insert(&pw->pw_id, uuid, &passwd_entry_class, 0)) {
if (uuid)
- tvherror("access", "invalid uuid '%s'", uuid);
+ tvherror(LS_ACCESS, "invalid uuid '%s'", uuid);
free(pw);
return NULL;
}
if (idnode_insert(&ib->ib_id, uuid, &ipblock_entry_class, 0)) {
if (uuid)
- tvherror("access", "invalid uuid '%s'", uuid);
+ tvherror(LS_ACCESS, "invalid uuid '%s'", uuid);
free(ib);
return NULL;
}
access_noacl = noacl;
if (noacl)
- tvhlog(LOG_WARNING, "access", "Access control checking disabled");
+ tvhwarn(LS_ACCESS, "Access control checking disabled");
TAILQ_INIT(&access_entries);
TAILQ_INIT(&access_tickets);
idnode_changed(&ae->ae_id);
- tvhlog(LOG_WARNING, "access",
- "Created default wide open access controle entry");
+ tvhwarn(LS_ACCESS, "Created default wide open access controle entry");
}
if(!TAILQ_FIRST(&access_entries) && !noacl)
- tvherror("access", "No access entries loaded");
+ tvherror(LS_ACCESS, "No access entries loaded");
/* Load superuser account */
api_skel->hook = hook;
t = RB_INSERT_SORTED(&api_hook_tree, api_skel, link, ah_cmp);
if (t) {
- tvherror("api", "trying to re-register subsystem");
+ tvherror(LS_API, "trying to re-register subsystem");
} else {
SKEL_USED(api_skel);
}
ah = RB_FIND(&api_hook_tree, &skel, link, ah_cmp);
if (!ah) {
- tvhwarn("api", "failed to find subsystem [%s]", subsystem);
+ tvhwarn(LS_API, "failed to find subsystem [%s]", subsystem);
return ENOSYS; // TODO: is this really the right error code?
}
if (op == NULL || strcmp(op, "all"))
return -EINVAL;
- tvhinfo("satip", "Triggered new server discovery");
+ tvhinfo(LS_SATIP, "Triggered new server discovery");
pthread_mutex_lock(&global_lock);
satip_device_discovery_start();
if (!mi)
goto exit;
- tvhtrace("mpegts", "network-list: found input '%s'", mi->mi_name ?: "");
-
htsmsg_t *l = htsmsg_create_list();
if ((is = mi->mi_network_list(mi))) {
for (i = 0; i < is->is_count; i++) {
switch (state) {
case AVAHI_ENTRY_GROUP_ESTABLISHED :
/* The entry group has been established successfully */
- tvhlog(LOG_INFO, "AVAHI",
- "Service '%s' successfully established.", name);
+ tvhoinfo(LS_AVAHI, "Service '%s' successfully established.", name);
break;
case AVAHI_ENTRY_GROUP_COLLISION : {
avahi_free(name);
name = n;
- tvhlog(LOG_ERR, "AVAHI",
- "Service name collision, renaming service to '%s'", name);
+ tvherror(LS_AVAHI, "Service name collision, renaming service to '%s'", name);
/* And recreate the services */
create_services(avahi_entry_group_get_client(g));
}
case AVAHI_ENTRY_GROUP_FAILURE :
- tvhlog(LOG_ERR, "AVAHI",
- "Entry group failure: %s",
- avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g))));
+ tvherror(LS_AVAHI,
+ "Entry group failure: %s",
+ avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g))));
break;
case AVAHI_ENTRY_GROUP_UNCOMMITED:
if (!group)
if (!(group = avahi_entry_group_new(c, entry_group_callback, NULL))) {
- tvhlog(LOG_ERR, "AVAHI",
- "avahi_enty_group_new() failed: %s",
- avahi_strerror(avahi_client_errno(c)));
+ tvherror(LS_AVAHI,
+ "avahi_enty_group_new() failed: %s",
+ avahi_strerror(avahi_client_errno(c)));
goto fail;
}
* because it was reset previously, add our entries. */
if (avahi_entry_group_is_empty(group)) {
- tvhlog(LOG_DEBUG, "AVAHI", "Adding service '%s'", name);
+ tvhdebug(LS_AVAHI, "Adding service '%s'", name);
/* Add the service for HTSP */
if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC,
if (ret == AVAHI_ERR_COLLISION)
goto collision;
- tvhlog(LOG_ERR, "AVAHI",
- "Failed to add _htsp._tcp service: %s",
- avahi_strerror(ret));
+ tvherror(LS_AVAHI,
+ "Failed to add _htsp._tcp service: %s",
+ avahi_strerror(ret));
goto fail;
}
if (ret == AVAHI_ERR_COLLISION)
goto collision;
- tvhlog(LOG_ERR, "AVAHI",
- "Failed to add _http._tcp service: %s",
- avahi_strerror(ret));
+ tvherror(LS_AVAHI,
+ "Failed to add _http._tcp service: %s",
+ avahi_strerror(ret));
goto fail;
}
/* Tell the server to register the service */
if ((ret = avahi_entry_group_commit(group)) < 0) {
- tvhlog(LOG_ERR, "AVAHI",
- "Failed to commit entry group: %s",
- avahi_strerror(ret));
+ tvherror(LS_AVAHI,
+ "Failed to commit entry group: %s",
+ avahi_strerror(ret));
goto fail;
}
}
avahi_free(name);
name = n;
- tvhlog(LOG_ERR, "AVAHI",
- "Service name collision, renaming service to '%s'", name);
+ tvherror(LS_AVAHI, "Service name collision, renaming service to '%s'", name);
avahi_entry_group_reset(group);
break;
case AVAHI_CLIENT_FAILURE:
- tvhlog(LOG_ERR, "AVAHI", "Client failure: %s",
- avahi_strerror(avahi_client_errno(c)));
+ tvherror(LS_AVAHI, "Client failure: %s", avahi_strerror(avahi_client_errno(c)));
break;
case AVAHI_CLIENT_S_COLLISION:
avahi_poll = avahi_simple_poll_get(avahi_asp);
if(avahi_do_restart) {
- tvhlog(LOG_INFO, "AVAHI", "Service restarted.");
+ tvhinfo(LS_AVAHI, "Service restarted.");
avahi_do_restart = 0;
group = NULL;
}
bonjour_callback(CFNetServiceRef theService, CFStreamError* error, void* info)
{
if (error->error) {
- tvhlog(LOG_ERR, "bonjour", "callback error (domain = %ld, error =%d)",
- error->domain, error->error);
+ tvherror(LS_BONJOUR, "callback error (domain = %ld, error =%d)",
+ error->domain, error->error);
}
}
*svc = CFNetServiceCreate(NULL, CFSTR(""), str, CFSTR("Tvheadend"), port);
if (!*svc) {
- tvhlog(LOG_ERR, "bonjour", "service creation failed");
+ tvherror(LS_BONJOUR, "service creation failed");
return;
}
}
if (!CFNetServiceRegisterWithOptions(*svc, 0, &error))
- tvhlog(LOG_ERR, "bonjour", "registration failed (service type = %s, "
- "domain = %ld, error =%d)", service_type, error.domain, error.error);
+ tvherror(LS_BONJOUR, "registration failed (service type = %s, "
+ "domain = %ld, error =%d)", service_type, error.domain, error.error);
else
- tvhlog(LOG_INFO, "bonjour", "service '%s' successfully established",
- service_type);
+ tvherror(LS_BONJOUR, "service '%s' successfully established",
+ service_type);
}
static void
if (idnode_insert(&bq->bq_id, uuid, &bouquet_class, 0)) {
if (uuid)
- tvherror("bouquet", "invalid uuid '%s'", uuid);
+ tvherror(LS_BOUQUET, "invalid uuid '%s'", uuid);
bouquet_free(bq);
return NULL;
}
bq->bq_src = strdup(buf);
bq->bq_download = bqd = calloc(1, sizeof(*bqd));
bqd->bq = bq;
- download_init(&bqd->download, "bouquet");
+ download_init(&bqd->download, LS_BOUQUET);
bqd->download.process = bouquet_download_process;
bqd->download.stop = bouquet_download_stop;
bouquet_change_comment(bq, bq->bq_ext_url, 0);
bq2 = RB_INSERT_SORTED(&bouquets, bq, bq_link, _bq_cmp);
if (bq2) {
- tvherror("bouquet", "found duplicate source id: '%s', remove duplicate config", bq->bq_src);
+ tvherror(LS_BOUQUET, "found duplicate source id: '%s', remove duplicate config", bq->bq_src);
bouquet_free(bq);
return NULL;
}
bq = RB_FIND(&bouquets, &bqs, bq_link, _bq_cmp);
if (bq) {
if (name && *name && bq->bq_name && strcmp(name, bq->bq_name)) {
- tvhwarn("bouquet", "bouquet name '%s' changed to '%s'", bq->bq_name ?: "", name);
+ tvhwarn(LS_BOUQUET, "bouquet name '%s' changed to '%s'", bq->bq_name ?: "", name);
free(bq->bq_name);
bq->bq_name = strdup(name);
idnode_changed(&bq->bq_id);
}
if (create && name) {
bq = bouquet_create(NULL, NULL, name, src);
- tvhinfo("bouquet", "new bouquet '%s'", name);
+ tvhinfo(LS_BOUQUET, "new bouquet '%s'", name);
return bq;
}
return NULL;
return;
if (!idnode_set_exists(bq->bq_services, &s->s_id)) {
- tvhtrace("bouquet", "add service %s to %s", s->s_nicename, bq->bq_name ?: "<unknown>");
+ tvhtrace(LS_BOUQUET, "add service %s to %s", s->s_nicename, bq->bq_name ?: "<unknown>");
idnode_set_add(bq->bq_services, &s->s_id, NULL, NULL);
bq->bq_saveflag = 1;
}
while (ilm) {
ilm_next = LIST_NEXT(ilm, ilm_in1_link);
if (((channel_t *)ilm->ilm_in2)->ch_bouquet == bq) {
- tvhinfo("bouquet", "%s / %s: unmapped from %s",
+ tvhinfo(LS_BOUQUET, "%s / %s: unmapped from %s",
channel_get_name((channel_t *)ilm->ilm_in2), t->s_nicename,
bq->bq_name ?: "<unknown>");
channel_delete((channel_t *)ilm->ilm_in2, 1);
static void
bouquet_remove_service(bouquet_t *bq, service_t *s, int delconf)
{
- tvhtrace("bouquet", "remove service %s from %s",
+ tvhtrace(LS_BOUQUET, "remove service %s from %s",
s->s_nicename, bq->bq_name ?: "<unknown>");
idnode_set_remove(bq->bq_services, &s->s_id);
if (delconf)
bq->bq_saveflag = 1;
}
- tvhtrace("bouquet", "%s: completed: enabled=%d active=%zi old=%zi seen=%u",
+ tvhtrace(LS_BOUQUET, "%s: completed: enabled=%d active=%zi old=%zi seen=%u",
bq->bq_name ?: "", bq->bq_enabled, bq->bq_active_services->is_count,
bq->bq_services->is_count, seen);
while (*data && (*data == '\r' || *data == '\n')) data++;
}
bouquet_completed(bq, seen);
- tvhinfo("bouquet", "parsed Enigma%d bouquet %s (%d services)", ver, bq->bq_name, seen);
+ tvhinfo(LS_BOUQUET, "parsed Enigma%d bouquet %s (%d services)", ver, bq->bq_name, seen);
return 0;
}
if (idnode_insert(&ch->ch_id, uuid, idc, IDNODE_SHORT_UUID)) {
if (uuid)
- tvherror("channel", "invalid uuid '%s'", uuid);
+ tvherror(LS_CHANNEL, "invalid uuid '%s'", uuid);
free(ch);
return NULL;
}
if (RB_INSERT_SORTED(&channels, ch, ch_link, ch_id_cmp)) {
- tvherror("channel", "id collision!");
+ tvherror(LS_CHANNEL, "id collision!");
abort();
}
idnode_save_check(&ch->ch_id, delconf);
if (delconf)
- tvhinfo("channel", "%s - deleting", channel_get_name(ch));
+ tvhinfo(LS_CHANNEL, "%s - deleting", channel_get_name(ch));
/* Tags */
while((ilm = LIST_FIRST(&ch->ch_ctms)) != NULL)
if (idnode_insert(&ct->ct_id, uuid, &channel_tag_class, IDNODE_SHORT_UUID)) {
if (uuid)
- tvherror("channel", "invalid tag uuid '%s'", uuid);
+ tvherror(LS_CHANNEL, "invalid tag uuid '%s'", uuid);
free(ct);
return NULL;
}
assert(root);
- tvhinfo("config", "backup: migrating config from %s (running %s)",
+ tvhinfo(LS_CONFIG, "backup: migrating config from %s (running %s)",
oldver, tvheadend_version);
if (getcwd(cwd, sizeof(cwd)) == NULL) {
- tvherror("config", "unable to get the current working directory");
+ tvherror(LS_CONFIG, "unable to get the current working directory");
goto fatal;
}
else if (!access("/usr/local/bin/tar", X_OK))
argv[0] = "/usr/local/bin/tar";
else {
- tvherror("config", "unable to find tar program");
+ tvherror(LS_CONFIG, "unable to find tar program");
goto fatal;
}
snprintf(outfile, sizeof(outfile), "%s/backup", root);
- if (makedirs("config", outfile, 0700, 1, -1, -1))
+ if (makedirs(LS_CONFIG, outfile, 0700, 1, -1, -1))
goto fatal;
if (chdir(root)) {
- tvherror("config", "unable to find directory '%s'", root);
+ tvherror(LS_CONFIG, "unable to find directory '%s'", root);
goto fatal;
}
snprintf(outfile, sizeof(outfile), "%s/backup/%s.tar.bz2",
root, oldver);
- tvhinfo("config", "backup: running, output file %s", outfile);
+ tvhinfo(LS_CONFIG, "backup: running, output file %s", outfile);
if (spawnv(argv[0], (void *)argv, &pid, 1, 1)) {
code = -ENOENT;
tvh_safe_usleep(20000);
if (code == -ECHILD)
code = 0;
- tvhinfo("config", "backup: completed");
+ tvhinfo(LS_CONFIG, "backup: completed");
}
if (code) {
htsbuf_append(&q, " ", 1);
}
s = htsbuf_to_string(&q);
- tvherror("config", "command '%s' returned error code %d", s, code);
- tvherror("config", "executed in directory '%s'", root);
- tvherror("config", "please, do not report this as an error, you may use --nobackup option");
- tvherror("config", "... or run the above command in the printed directory");
- tvherror("config", "... using the same user/group as for the tvheadend executable");
- tvherror("config", "... to check the reason for the unfinished backup");
+ tvherror(LS_CONFIG, "command '%s' returned error code %d", s, code);
+ tvherror(LS_CONFIG, "executed in directory '%s'", root);
+ tvherror(LS_CONFIG, "please, do not report this as an error, you may use --nobackup option");
+ tvherror(LS_CONFIG, "... or run the above command in the printed directory");
+ tvherror(LS_CONFIG, "... using the same user/group as for the tvheadend executable");
+ tvherror(LS_CONFIG, "... to check the reason for the unfinished backup");
free(s);
htsbuf_queue_flush(&q);
goto fatal;
}
if (chdir(cwd)) {
- tvherror("config", "unable to change directory to '%s'", cwd);
+ tvherror(LS_CONFIG, "unable to change directory to '%s'", cwd);
goto fatal;
}
return;
fatal:
- tvherror("config", "backup: fatal error");
+ tvherror(LS_CONFIG, "backup: fatal error");
exit(EXIT_FAILURE);
}
/* Run migrations */
for ( ; v < ARRAY_SIZE(config_migrate_table); v++) {
- tvhinfo("config", "migrating config from v%d to v%d", v, v+1);
+ tvhinfo(LS_CONFIG, "migrating config from v%d to v%d", v, v+1);
config_migrate_table[v]();
}
HTSMSG_FOREACH(f, c) {
if (!(e = htsmsg_field_get_map(f))) continue;
if (strlen(f->hmf_name) != UUID_HEX_SIZE - 1) {
- tvherror("START", "filename %s/%s/%s is invalid", hts_settings_get_root(), dir, f->hmf_name);
+ tvherror(LS_START, "filename %s/%s/%s is invalid", hts_settings_get_root(), dir, f->hmf_name);
exit(1);
}
}
if (!path) {
const char *homedir = getenv("HOME");
if (homedir == NULL) {
- tvherror("START", "environment variable HOME is not set");
+ tvherror(LS_START, "environment variable HOME is not set");
exit(EXIT_FAILURE);
}
snprintf(buf, sizeof(buf), "%s/.hts/tvheadend", homedir);
/* Ensure directory exists */
if (stat(path, &st)) {
config_newcfg = 1;
- if (makedirs("config", path, 0700, 1, gid, uid)) {
- tvhwarn("START", "failed to create settings directory %s,"
+ if (makedirs(LS_CONFIG, path, 0700, 1, gid, uid)) {
+ tvhwarn(LS_START, "failed to create settings directory %s,"
" settings will not be saved", path);
return;
}
/* And is usable */
else if (access(path, R_OK | W_OK)) {
- tvhwarn("START", "configuration path %s is not r/w"
+ tvhwarn(LS_START, "configuration path %s is not r/w"
" for UID:%d GID:%d [e=%s],"
" settings will not be saved",
path, getuid(), getgid(), strerror(errno));
exit(78); /* config error */
if (chown(config_lock, uid, gid))
- tvhwarn("config", "unable to chown lock file %s UID:%d GID:%d", config_lock, uid, gid);
+ tvhwarn(LS_CONFIG, "unable to chown lock file %s UID:%d GID:%d", config_lock, uid, gid);
/* Load global settings */
config2 = hts_settings_load("config");
if (!config2) {
- tvhlog(LOG_DEBUG, "config", "no configuration, loading defaults");
+ tvhlog(LOG_DEBUG, LS_CONFIG, "no configuration, loading defaults");
config.wizard = strdup("hello");
config_newcfg = 1;
} else {
const char *path = hts_settings_get_root();
if (path == NULL || access(path, R_OK | W_OK)) {
- tvhwarn("START", "configuration path %s is not r/w"
+ tvhwarn(LS_START, "configuration path %s is not r/w"
" for UID:%d GID:%d [e=%s],"
" settings will not be saved",
path, getuid(), getgid(), strerror(errno));
if (config_migrate(backup))
config_check();
}
- tvhinfo("config", "loaded");
+ tvhinfo(LS_CONFIG, "loaded");
}
void config_done ( void )
free(muxconf_path);
return;
}
- tvhinfo("config", "scanfile (re)initialization with path %s", muxconf_path ?: "<none>");
+ tvhinfo(LS_CONFIG, "scanfile (re)initialization with path %s", muxconf_path ?: "<none>");
scanfile_init(muxconf_path, 1);
free(muxconf_path);
}
*ret = mktime(&tmp);
if (*ret <= now) {
#ifndef CRON_TEST
- tvherror("cron", "invalid time, now %"PRItime_t", result %"PRItime_t, now, *ret);
+ tvherror(LS_CRON, "invalid time, now %"PRItime_t", result %"PRItime_t, now, *ret);
#else
printf("ERROR: invalid time, now %"PRItime_t", result %"PRItime_t"\n", now, *ret);
#endif
conn = dbus_bus_get_private(dbus_session ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &err);
if (dbus_error_is_set(&err)) {
- tvherror("dbus", "Connection error: %s", err.message);
+ tvherror(LS_DBUS, "Connection error: %s", err.message);
dbus_error_free(&err);
return NULL;
}
ret = dbus_bus_request_name(conn, name, DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
if (dbus_error_is_set(&err)) {
- tvherror("dbus", "Name error: %s", err.message);
+ tvherror(LS_DBUS, "Name error: %s", err.message);
dbus_error_free(&err);
dbus_connection_close(conn);
dbus_connection_unref(conn);
return NULL;
}
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
- tvherror("dbus", "Not primary owner");
+ tvherror(LS_DBUS, "Not primary owner");
dbus_connection_close(conn);
dbus_connection_unref(conn);
return NULL;
msg = dbus_message_new_signal(obj_name, if_name, sig_name);
if (msg == NULL) {
- tvherror("dbus", "Unable to create signal %s %s %s",
+ tvherror(LS_DBUS, "Unable to create signal %s %s %s",
obj_name, if_name, sig_name);
dbus_connection_unref(conn);
return -1;
dbus_message_iter_init_append(msg, &args);
dbus_from_htsmsg(value, &args);
if (!dbus_connection_send(conn, msg, NULL)) {
- tvherror("dbus", "Unable to send signal %s %s %s",
+ tvherror(LS_DBUS, "Unable to send signal %s %s %s",
obj_name, if_name, sig_name);
dbus_message_unref(msg);
dbus_connection_unref(conn);
n = tvhpoll_wait(poll, &ev, 1, -1);
if (n < 0) {
if (atomic_get(&dbus_running) && !ERRNO_AGAIN(errno))
- tvherror("dbus", "tvhpoll_wait() error");
+ tvherror(LS_DBUS, "tvhpoll_wait() error");
} else if (n == 0) {
continue;
}
if ((s = htsmsg_get_str(conf, "class")) != NULL)
c = caclient_class_find(s);
if (c == NULL) {
- tvherror("caclient", "wrong class %s!", s);
+ tvherror(LS_CACLIENT, "wrong class %s!", s);
abort();
}
#if ENABLE_CWC
cac = constcw_create();
#endif
if (cac == NULL) {
- tvherror("caclient", "CA Client class %s is not available!", s);
+ tvherror(LS_CACLIENT, "CA Client class %s is not available!", s);
return NULL;
}
if (idnode_insert(&cac->cac_id, uuid, c, 0)) {
if (uuid)
- tvherror("caclient", "invalid uuid '%s'", uuid);
+ tvherror(LS_CACLIENT, "invalid uuid '%s'", uuid);
free(cac);
return NULL;
}
t = &ca->ca_pids[i];
if (t->pid == pid && t->ecm == ecm) {
t->pid_refs++;
- tvhtrace("capmt", "%s: adding pid %d adapter %d - reusing (%d)",
+ tvhtrace(LS_CAPMT, "%s: adding pid %d adapter %d - reusing (%d)",
capmt_name(capmt), pid, adapter, t->pid_refs);
return;
}
o->ecm = ecm;
mmi = ca->ca_tuner ? LIST_FIRST(&ca->ca_tuner->mi_mux_active) : NULL;
mux = mmi ? mmi->mmi_mux : NULL;
- tvhtrace("capmt", "%s: adding pid %d adapter %d, tuner %p, mmi %p, mux %p", capmt_name(capmt), pid, adapter, ca->ca_tuner, mmi, mux);
+ tvhtrace(LS_CAPMT, "%s: adding pid %d adapter %d, tuner %p, mmi %p, mux %p", capmt_name(capmt), pid, adapter, ca->ca_tuner, mmi, mux);
if (mux) {
pthread_mutex_unlock(&capmt->capmt_mutex);
descrambler_open_pid(mux, o,
capmt_opaque_t *o;
int pid, i;
- tvhtrace("capmt", "%s: pid flush for adapter %d", capmt_name(capmt), adapter);
+ tvhtrace(LS_CAPMT, "%s: pid flush for adapter %d", capmt_name(capmt), adapter);
ca = &capmt->capmt_adapters[adapter];
tuner = capmt->capmt_adapters[adapter].ca_tuner;
if (tuner == NULL) {
fd = tcp_connect(capmt->capmt_sockfile, capmt->capmt_port, NULL,
errbuf, sizeof(errbuf), 2);
if (fd < 0 && tvheadend_is_running()) {
- tvhlog(LOG_ERR, "capmt",
- "%s: Cannot connect to %s:%i (%s); Do you have OSCam running?",
- capmt_name(capmt), capmt->capmt_sockfile, capmt->capmt_port, errbuf);
+ tvherror(LS_CAPMT,
+ "%s: Cannot connect to %s:%i (%s); Do you have OSCam running?",
+ capmt_name(capmt), capmt->capmt_sockfile, capmt->capmt_port, errbuf);
fd = -1;
}
connect(fd, (const struct sockaddr*)&serv_addr_un,
sizeof(serv_addr_un)) != 0) {
if (tvheadend_is_running())
- tvhlog(LOG_ERR, "capmt",
- "%s: Cannot connect to %s (%s); Do you have OSCam running?",
- capmt_name(capmt), capmt->capmt_sockfile, strerror(errno));
+ tvherror(LS_CAPMT,
+ "%s: Cannot connect to %s (%s); Do you have OSCam running?",
+ capmt_name(capmt), capmt->capmt_sockfile, strerror(errno));
if (fd >= 0) {
close(fd);
fd = -1;
}
if (fd >= 0) {
- tvhlog(LOG_DEBUG, "capmt", "%s: Created socket %d", capmt_name(capmt), fd);
+ tvhdebug(LS_CAPMT, "%s: Created socket %d", capmt_name(capmt), fd);
capmt->capmt_sock[i] = fd;
capmt->capmt_sock_reconnect[i]++;
if (capmt_oscam_netproto(capmt))
lock_assert(&capmt->capmt_mutex);
if (fd < 0)
return;
- tvhtrace("capmt", "%s: socket close %d", capmt_name(capmt), fd);
+ tvhtrace(LS_CAPMT, "%s: socket close %d", capmt_name(capmt), fd);
capmt_poll_rem(capmt, fd);
close(fd);
capmt->capmt_sock[sock_idx] = -1;
if (capmt->capmt_oscam == CAPMT_OSCAM_OLD) {
// dumping current SID table
for (i = 0; i < MAX_SOCKETS; i++)
- tvhlog(LOG_DEBUG, "capmt", "%s: %s: SOCKETS TABLE DUMP [%d]: sid=%d socket=%d", capmt_name(capmt), __FUNCTION__, i, capmt->sids[i], capmt->capmt_sock[i]);
+ tvhdebug(LS_CAPMT, "%s: %s: SOCKETS TABLE DUMP [%d]: sid=%d socket=%d", capmt_name(capmt), __FUNCTION__, i, capmt->sids[i], capmt->capmt_sock[i]);
if (sid == 0) {
- tvhlog(LOG_DEBUG, "capmt", "%s: %s: got empty SID - returning from function", capmt_name(capmt), __FUNCTION__);
+ tvhdebug(LS_CAPMT, "%s: %s: got empty SID - returning from function", capmt_name(capmt), __FUNCTION__);
return -1;
}
}
if (found)
- tvhlog(LOG_DEBUG, "capmt", "%s: %s: found sid, reusing socket, i=%d", capmt_name(capmt), __FUNCTION__, i);
+ tvhdebug(LS_CAPMT, "%s: %s: found sid, reusing socket, i=%d", capmt_name(capmt), __FUNCTION__, i);
else { //not found - adding to first free in table
for (i = 0; i < MAX_SOCKETS; i++) {
if (capmt->sids[i] == 0) {
}
}
if (i == MAX_SOCKETS) {
- tvhlog(LOG_DEBUG, "capmt", "%s: %s: no free space for new SID!!!", capmt_name(capmt), __FUNCTION__);
+ tvhdebug(LS_CAPMT, "%s: %s: no free space for new SID!!!", capmt_name(capmt), __FUNCTION__);
return -1;
} else {
capmt->sids[i] = sid;
- tvhlog(LOG_DEBUG, "capmt", "%s: %s: added: i=%d", capmt_name(capmt), __FUNCTION__, i);
+ tvhdebug(LS_CAPMT, "%s: %s: added: i=%d", capmt_name(capmt), __FUNCTION__, i);
}
}
fd = capmt->capmt_sock[i];
if (fd <= 0) {
- tvhtrace("capmt", "%s: Unable to send message for sid %i", capmt_name(capmt), sid);
+ tvhtrace(LS_CAPMT, "%s: Unable to send message for sid %i", capmt_name(capmt), sid);
return -1;
}
- tvhtrace("capmt", "%s: Sending message to socket %i (sid %i)", capmt_name(capmt), fd, sid);
- tvhlog_hexdump("capmt", buf, len);
+ tvhtrace(LS_CAPMT, "%s: Sending message to socket %i (sid %i)", capmt_name(capmt), fd, sid);
+ tvhlog_hexdump(LS_CAPMT, buf, len);
res = send(fd, buf, len, MSG_DONTWAIT);
if (res < len) {
#if ENABLE_ANDROID
- tvhlog(LOG_DEBUG, "capmt", "%s: Message send failed to socket %i (%li)", capmt_name(capmt), fd, (long int)res); // Android bug, ssize_t is long int
+ tvhdebug(LS_CAPMT, "%s: Message send failed to socket %i (%li)", capmt_name(capmt), fd, (long int)res); // Android bug, ssize_t is long int
#else
- tvhlog(LOG_DEBUG, "capmt", "%s: Message send failed to socket %i (%zi)", capmt_name(capmt), fd, res);
+ tvhdebug(LS_CAPMT, "%s: Message send failed to socket %i (%zi)", capmt_name(capmt), fd, res);
#endif
if (capmt->capmt_oscam != CAPMT_OSCAM_SO_WRAPPER) {
capmt_socket_close_lock(capmt, i);
break;
if (i == MAX_SOCKETS) {
- tvhlog(LOG_DEBUG, "capmt", "%s: %s: socket to close not found", capmt_name(capmt), __FUNCTION__);
+ tvhdebug(LS_CAPMT, "%s: %s: socket to close not found", capmt_name(capmt), __FUNCTION__);
return;
}
// closing socket (oscam handle this as event and stop decrypting)
- tvhlog(LOG_DEBUG, "capmt", "%s: %s: closing socket i=%d, socket_fd=%d", capmt_name(capmt), __FUNCTION__, i, capmt->capmt_sock[i]);
+ tvhdebug(LS_CAPMT, "%s: %s: closing socket i=%d, socket_fd=%d", capmt_name(capmt), __FUNCTION__, i, capmt->capmt_sock[i]);
capmt->sids[i] = 0;
capmt->adps[i] = 0;
capmt_socket_close(capmt, i);
capmt_caid_ecm_t *cce;
capmt_t *capmt = ct->ct_capmt;
- tvhlog(LOG_INFO, "capmt",
- "%s: Removing CAPMT Server from service \"%s\" on adapter %d",
- capmt_name(capmt), s->s_dvb_svcname, ct->ct_adapter);
+ tvhdebug(LS_CAPMT,
+ "%s: Removing CAPMT Server from service \"%s\" on adapter %d",
+ capmt_name(capmt), s->s_dvb_svcname, ct->ct_adapter);
pthread_mutex_lock(&capmt->capmt_mutex);
capmt_caid_ecm_t *cce;
int i, flags = 0, add = 0;
- tvhtrace("capmt", "%s: setting filter: adapter=%d, demux=%d, filter=%d, pid=%d",
+ tvhtrace(LS_CAPMT, "%s: setting filter: adapter=%d, demux=%d, filter=%d, pid=%d",
capmt_name(capmt), adapter, demux_index, filter_index, pid);
if (adapter >= MAX_CA ||
demux_index >= MAX_INDEX ||
filter->pid = pid;
filter->flags = flags;
memcpy(&filter->filter, sbuf_peek(sb, offset + 8), sizeof(filter->filter));
- tvhlog_hexdump("capmt", filter->filter.filter, DMX_FILTER_SIZE);
- tvhlog_hexdump("capmt", filter->filter.mask, DMX_FILTER_SIZE);
- tvhlog_hexdump("capmt", filter->filter.mode, DMX_FILTER_SIZE);
+ tvhlog_hexdump(LS_CAPMT, filter->filter.filter, DMX_FILTER_SIZE);
+ tvhlog_hexdump(LS_CAPMT, filter->filter.mask, DMX_FILTER_SIZE);
+ tvhlog_hexdump(LS_CAPMT, filter->filter.mode, DMX_FILTER_SIZE);
for (i = 0; i < DMX_FILTER_SIZE; i++)
filter->filter.filter[i] &= filter->filter.mask[i];
if (add)
else
pid = sbuf_peek_s16be(sb, offset + 6);
- tvhtrace("capmt", "%s: stopping filter: adapter=%d, demux=%d, filter=%d, pid=%d",
+ tvhtrace(LS_CAPMT, "%s: stopping filter: adapter=%d, demux=%d, filter=%d, pid=%d",
capmt_name(capmt), adapter, demux_index, filter_index, pid);
if (adapter >= MAX_CA ||
demux_index >= MAX_INDEX ||
t = (mpegts_service_t *)ct->td_service;
if (ct->td_keystate != keystate) {
- tvhlog(LOG_ERR, "capmt",
- "%s: Can not descramble service \"%s\", %s",
- capmt_name(capmt),
- t->s_dvb_svcname,
- keystate == DS_FORBIDDEN ?
- "access denied" : "connection close");
+ tvherror(LS_CAPMT,
+ "%s: Can not descramble service \"%s\", %s",
+ capmt_name(capmt),
+ t->s_dvb_svcname,
+ keystate == DS_FORBIDDEN ?
+ "access denied" : "connection close");
ct->td_keystate = keystate;
}
}
if (!ok) {
if (ct->td_keystate != DS_FORBIDDEN) {
- tvhlog(LOG_ERR, "capmt",
- "%s: Can not descramble service \"%s\", access denied",
- capmt_name(capmt), t->s_dvb_svcname);
+ tvherror(LS_CAPMT,
+ "%s: Can not descramble service \"%s\", access denied",
+ capmt_name(capmt), t->s_dvb_svcname);
ct->td_keystate = DS_FORBIDDEN;
}
continue;
int i, j;
ca_info_t *cai;
- tvhlog(LOG_DEBUG, "capmt", "%s: CA_SET_PID adapter %d index %d pid %d (0x%04x)", capmt_name(capmt), adapter, index, pid, pid);
+ tvhdebug(LS_CAPMT, "%s: CA_SET_PID adapter %d index %d pid %d (0x%04x)", capmt_name(capmt), adapter, index, pid, pid);
if (adapter < MAX_CA && index >= 0 && index < MAX_INDEX) {
cai = &capmt->capmt_adapters[adapter].ca_info[index];
for (i = 0, j = -1; i < MAX_PIDS; i++) {
cai->pids[i] = 0;
}
} else {
- tvhlog(LOG_ERR, "capmt", "%s: Invalid index %d in CA_SET_PID (%d) for adapter %d", capmt_name(capmt), index, MAX_INDEX, adapter);
+ tvherror(LS_CAPMT, "%s: Invalid index %d in CA_SET_PID (%d) for adapter %d", capmt_name(capmt), index, MAX_INDEX, adapter);
}
} else if (cmd == CA_SET_DESCR) {
int32_t parity = sbuf_peek_s32(sb, offset + 8);
uint8_t *cw = sbuf_peek (sb, offset + 12);
- tvhlog(LOG_DEBUG, "capmt", "%s, CA_SET_DESCR adapter %d par %d idx %d %02x%02x%02x%02x%02x%02x%02x%02x",
- capmt_name(capmt), adapter, parity, index,
- cw[0], cw[1], cw[2], cw[3], cw[4], cw[5], cw[6], cw[7]);
+ tvhdebug(LS_CAPMT, "%s, CA_SET_DESCR adapter %d par %d idx %d %02x%02x%02x%02x%02x%02x%02x%02x",
+ capmt_name(capmt), adapter, parity, index,
+ cw[0], cw[1], cw[2], cw[3], cw[4], cw[5], cw[6], cw[7]);
if (index < 0) // skipping removal request
return;
if (adapter >= MAX_CA || index >= MAX_INDEX)
} else if (parity == 1) {
capmt_process_key(capmt, adapter, index, DESCRAMBLER_DES, empty, cw, 1);
} else
- tvhlog(LOG_ERR, "capmt", "%s: Invalid parity %d in CA_SET_DESCR for adapter%d", capmt_name(capmt), parity, adapter);
+ tvherror(LS_CAPMT, "%s: Invalid parity %d in CA_SET_DESCR for adapter%d", capmt_name(capmt), parity, adapter);
} else if (cmd == CA_SET_DESCR_AES) {
int32_t parity = sbuf_peek_s32(sb, offset + 8);
uint8_t *cw = sbuf_peek (sb, offset + 12);
- tvhlog(LOG_DEBUG, "capmt", "%s: CA_SET_DESCR_AES adapter %d par %d idx %d "
- "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
- capmt_name(capmt), adapter, parity, index,
- cw[0], cw[1], cw[2], cw[3], cw[4], cw[5], cw[6], cw[7],
- cw[8], cw[9], cw[10], cw[11], cw[12], cw[13], cw[14], cw[15]);
+ tvhdebug(LS_CAPMT, "%s: CA_SET_DESCR_AES adapter %d par %d idx %d "
+ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+ capmt_name(capmt), adapter, parity, index,
+ cw[0], cw[1], cw[2], cw[3], cw[4], cw[5], cw[6], cw[7],
+ cw[8], cw[9], cw[10], cw[11], cw[12], cw[13], cw[14], cw[15]);
if (index < 0) // skipping removal request
return;
if (adapter >= MAX_CA || index >= MAX_INDEX)
} else if (parity == 1) {
capmt_process_key(capmt, adapter, index, DESCRAMBLER_AES, empty, cw, 1);
} else
- tvhlog(LOG_ERR, "capmt", "%s: Invalid parity %d in CA_SET_DESCR_AES for adapter%d", capmt_name(capmt), parity, adapter);
+ tvherror(LS_CAPMT, "%s: Invalid parity %d in CA_SET_DESCR_AES for adapter%d", capmt_name(capmt), parity, adapter);
} else if (cmd == CA_SET_DESCR_MODE) {
cai = &capmt->capmt_adapters[adapter].ca_info[index];
if (algo != cai->algo && cai->cipher_mode != cipher_mode) {
- tvhlog(LOG_DEBUG, "capmt", "%s, CA_SET_DESCR_MODE adapter %d algo %d cipher mode %d",
- capmt_name(capmt), adapter, algo, cipher_mode);
+ tvhdebug(LS_CAPMT, "%s, CA_SET_DESCR_MODE adapter %d algo %d cipher mode %d",
+ capmt_name(capmt), adapter, algo, cipher_mode);
cai->algo = algo;
cai->cipher_mode = cipher_mode;
}
cardsystem, pid, ecmtime, hops, reader,
from, protocol);
- tvhlog(LOG_DEBUG, "capmt", "%s: ECM_INFO: adapter=%d sid=%d caid=%04X(%s) pid=%04X provid=%06X ecmtime=%d hops=%d reader=%s from=%s protocol=%s",
- capmt_name(capmt), adapter, sid, caid, cardsystem, pid, provid, ecmtime, hops, reader, from, protocol);
+ tvhdebug(LS_CAPMT, "%s: ECM_INFO: adapter=%d sid=%d caid=%04X(%s) pid=%04X provid=%06X ecmtime=%d hops=%d reader=%s from=%s protocol=%s",
+ capmt_name(capmt), adapter, sid, caid, cardsystem, pid, provid, ecmtime, hops, reader, from, protocol);
free(protocol);
free(from);
int offset2 = offset + 6;
char *info = capmt_peek_str(sb, &offset2);
- tvhlog(LOG_INFO, "capmt", "%s: Connected to server '%s' (protocol version %d)", capmt_name(capmt), info, protover);
+ tvhinfo(LS_CAPMT, "%s: Connected to server '%s' (protocol version %d)", capmt_name(capmt), info, protover);
free(info);
} else {
- tvhlog(LOG_ERR, "capmt", "%s: unknown command %08X", capmt_name(capmt), cmd);
+ tvherror(LS_CAPMT, "%s: unknown command %08X", capmt_name(capmt), cmd);
}
}
show_connection(capmt_t *capmt, const char *what)
{
if (capmt->capmt_oscam == CAPMT_OSCAM_TCP || capmt->capmt_oscam == CAPMT_OSCAM_NET_PROTO) {
- tvhlog(LOG_INFO, "capmt",
- "%s: mode %i connected to %s:%i (%s)",
- capmt_name(capmt),
- capmt->capmt_oscam,
- capmt->capmt_sockfile, capmt->capmt_port,
- what);
+ tvhinfo(LS_CAPMT,
+ "%s: mode %i connected to %s:%i (%s)",
+ capmt_name(capmt),
+ capmt->capmt_oscam,
+ capmt->capmt_sockfile, capmt->capmt_port,
+ what);
} else if (capmt->capmt_oscam == CAPMT_OSCAM_UNIX_SOCKET ||
capmt->capmt_oscam == CAPMT_OSCAM_UNIX_SOCKET_NP) {
- tvhlog(LOG_INFO, "capmt",
- "%s: mode %i sockfile %s got connection from client (%s)",
- capmt_name(capmt),
- capmt->capmt_oscam,
- capmt->capmt_sockfile,
- what);
+ tvhinfo(LS_CAPMT,
+ "%s: mode %i sockfile %s got connection from client (%s)",
+ capmt_name(capmt),
+ capmt->capmt_oscam,
+ capmt->capmt_sockfile,
+ what);
} else {
- tvhlog(LOG_INFO, "capmt",
- "%s: mode %i sockfile %s port %i got connection from client (%s)",
- capmt_name(capmt),
- capmt->capmt_oscam,
- capmt->capmt_sockfile, capmt->capmt_port,
- what);
+ tvhinfo(LS_CAPMT,
+ "%s: mode %i sockfile %s port %i got connection from client (%s)",
+ capmt_name(capmt),
+ capmt->capmt_oscam,
+ capmt->capmt_sockfile, capmt->capmt_port,
+ what);
}
}
continue;
}
- tvhtrace("capmt", "%s: thread received shutdown", capmt_name(capmt));
+ tvhtrace(LS_CAPMT, "%s: thread received shutdown", capmt_name(capmt));
atomic_set(&capmt->capmt_running, 0);
continue;
}
ret = recv(recvsock, buf, sizeof(buf), MSG_DONTWAIT);
if (ret == 0) {
- tvhlog(LOG_INFO, "capmt", "%s: normal socket shutdown", capmt_name(capmt));
+ tvhinfo(LS_CAPMT, "%s: normal socket shutdown", capmt_name(capmt));
close(recvsock);
capmt_poll_rem(capmt, recvsock);
if (ret < 0)
continue;
- tvhtrace("capmt", "%s: Received message from socket %i", capmt_name(capmt), recvsock);
- tvhlog_hexdump("capmt", buf, ret);
+ tvhtrace(LS_CAPMT, "%s: Received message from socket %i", capmt_name(capmt), recvsock);
+ tvhlog_hexdump(LS_CAPMT, buf, ret);
pbuf = &buffer[adapter];
sbuf_append(pbuf, buf, ret);
continue;
}
- tvhtrace("capmt", "%s: thread received shutdown", capmt_name(capmt));
+ tvhtrace(LS_CAPMT, "%s: thread received shutdown", capmt_name(capmt));
atomic_set(&capmt->capmt_running, 0);
continue;
}
ret = recv(recvsock, buf, sizeof(buf), MSG_DONTWAIT);
if (ret == 0) {
- tvhlog(LOG_INFO, "capmt", "%s: normal socket shutdown", capmt_name(capmt));
+ tvhinfo(LS_CAPMT, "%s: normal socket shutdown", capmt_name(capmt));
capmt_poll_rem(capmt, recvsock);
break;
}
if (ret < 0)
continue;
- tvhtrace("capmt", "%s: Received message from socket %i", capmt_name(capmt), recvsock);
- tvhlog_hexdump("capmt", buf, ret);
+ tvhtrace(LS_CAPMT, "%s: Received message from socket %i", capmt_name(capmt), recvsock);
+ tvhlog_hexdump(LS_CAPMT, buf, ret);
sbuf_append(&buffer, buf, ret);
ret = recv(capmt->capmt_adapters[0].ca_sock, buffer, 18, MSG_WAITALL);
if (ret < 0) {
- tvhlog(LOG_ERR, "capmt", "%s: error receiving over socket", capmt_name(capmt));
+ tvherror(LS_CAPMT, "%s: error receiving over socket", capmt_name(capmt));
break;
} else if (ret == 0) {
/* normal socket shutdown */
- tvhlog(LOG_INFO, "capmt", "%s: normal socket shutdown", capmt_name(capmt));
+ tvhinfo(LS_CAPMT, "%s: normal socket shutdown", capmt_name(capmt));
break;
} else {
- tvhtrace("capmt", "%s: Received message from socket %i", capmt_name(capmt), capmt->capmt_adapters[0].ca_sock);
- tvhlog_hexdump("capmt", buffer, ret);
+ tvhtrace(LS_CAPMT, "%s: Received message from socket %i", capmt_name(capmt), capmt->capmt_adapters[0].ca_sock);
+ tvhlog_hexdump(LS_CAPMT, buffer, ret);
capmt_process_key(capmt, 0,
buffer[0] | ((uint16_t)buffer[1] << 8),
}
capmt_abort(capmt, DS_UNKNOWN);
- tvhlog(LOG_INFO, "capmt", "%s: connection from client closed ...", capmt_name(capmt));
+ tvhinfo(LS_CAPMT, "%s: connection from client closed ...", capmt_name(capmt));
}
#endif
{
*socket = tvh_socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (*socket < 0) {
- tvherror("capmt", "%s: failed to create UDP socket", capmt_name(capmt));
+ tvherror(LS_CAPMT, "%s: failed to create UDP socket", capmt_name(capmt));
return 0;
}
if (bind(*socket, (const struct sockaddr*)&serv_addr, sizeof(serv_addr)) != 0)
{
- tvherror("capmt", "%s: failed to bind to ca0 (port %d)", capmt_name(capmt), port);
+ tvherror(LS_CAPMT, "%s: failed to bind to ca0 (port %d)", capmt_name(capmt), port);
return 0;
}
else
int d, i, j, fatal;
int64_t mono;
- tvhlog(LOG_INFO, "capmt", "%s active", capmt_name(capmt));
+ tvhinfo(LS_CAPMT, "%s active", capmt_name(capmt));
while (atomic_get(&capmt->capmt_running)) {
fatal = 0;
if (!la || !la->la_is_enabled(la)) continue;
n = la->la_dvb_number;
if (n < 0 || n > MAX_CA) {
- tvhlog(LOG_ERR, "capmt", "%s: adapter number > MAX_CA", capmt_name(capmt));
+ tvherror(LS_CAPMT, "%s: adapter number > MAX_CA", capmt_name(capmt));
continue;
}
- tvhlog(LOG_INFO, "capmt", "%s: created UDP socket %d", capmt_name(capmt), n);
+ tvhinfo(LS_CAPMT, "%s: created UDP socket %d", capmt_name(capmt), n);
bind_ok = capmt_create_udp_socket(capmt,
&capmt->capmt_adapters[n].ca_sock,
capmt->capmt_port + n);
capmt->capmt_oscam == CAPMT_OSCAM_UNIX_SOCKET_NP) {
handle_single(capmt);
} else {
- tvhlog(LOG_ERR, "capmt", "%s: Only modes 3 and 4 are supported for non-linuxdvb devices", capmt_name(capmt));
+ tvherror(LS_CAPMT, "%s: Only modes 3 and 4 are supported for non-linuxdvb devices", capmt_name(capmt));
fatal = 1;
}
#endif
d = 60;
}
- tvhlog(LOG_INFO, "capmt", "%s: Automatic reconnection attempt in in %d seconds", idnode_get_title(&capmt->cac_id, NULL), d);
+ tvhinfo(LS_CAPMT, "%s: Automatic reconnection attempt in in %d seconds", idnode_get_title(&capmt->cac_id, NULL), d);
mono = mclk() + sec2mono(d);
do {
pthread_mutex_unlock(&capmt->capmt_mutex);
}
- tvhlog(LOG_INFO, "capmt", "%s inactive", capmt_name(capmt));
+ tvhinfo(LS_CAPMT, "%s inactive", capmt_name(capmt));
return NULL;
}
break;
}
if (i >= DMX_FILTER_SIZE && i + 2 <= len) {
- tvhtrace("capmt", "filter match pid %d len %d emm %d", pid, len, emm);
+ tvhtrace(LS_CAPMT, "filter match pid %d len %d emm %d", pid, len, emm);
capmt_filter_data(capmt,
o->adapter, demux_index,
filter_index, data, len,
{
capmt_caid_ecm_t *cce;
- tvhlog(LOG_DEBUG, "capmt",
- "%s: New caid 0x%04X:0x%06X (pid 0x%04X) for service \"%s\"",
- capmt_name(ct->ct_capmt), c->caid, c->providerid, pid, t->s_dvb_svcname);
+ tvhdebug(LS_CAPMT,
+ "%s: New caid 0x%04X:0x%06X (pid 0x%04X) for service \"%s\"",
+ capmt_name(ct->ct_capmt), c->caid, c->providerid, pid, t->s_dvb_svcname);
cce = calloc(1, sizeof(capmt_caid_ecm_t));
cce->cce_caid = c->caid;
} else if (cce2->cce_caid == 0x4ad2) {
cad.cad_length = 0x04;
cad.cad_data[3] = cce2->cce_providerid & 0xffffff;
- }else
- tvhlog(LOG_WARNING, "capmt", "%s: Unknown CAID type, don't know where to put provider ID", capmt_name(capmt));
+ } else
+ tvhwarn(LS_CAPMT, "%s: Unknown CAID type, don't know where to put provider ID", capmt_name(capmt));
}
memcpy(&buf[pos], &cad, cad.cad_length + 2);
pos += cad.cad_length + 2;
- tvhlog(LOG_DEBUG, "capmt", "%s: adding ECMPID=0x%X (%d), "
- "CAID=0x%X (%d) PROVID=0x%X (%d), SID=%d, ADAPTER=%d",
+ tvhdebug(LS_CAPMT, "%s: adding ECMPID=0x%X (%d), "
+ "CAID=0x%X (%d) PROVID=0x%X (%d), SID=%d, ADAPTER=%d",
capmt_name(capmt),
cce2->cce_ecmpid, cce2->cce_ecmpid,
cce2->cce_caid, cce2->cce_caid,
if(ct->td_keystate != DS_RESOLVED)
- tvhlog(LOG_DEBUG, "capmt",
- "%s: Trying to obtain key for service \"%s\"", capmt_name(capmt), t->s_dvb_svcname);
+ tvhdebug(LS_CAPMT, "%s: Trying to obtain key for service \"%s\"",
+ capmt_name(capmt), t->s_dvb_svcname);
buf[9] = pmtversion;
pmtversion = (pmtversion + 1) & 0x1F;
if (!all_srv_count) {
// closing socket (oscam handle this as event and stop decrypting)
- tvhlog(LOG_DEBUG, "capmt", "%s: %s: no subscribed services, closing socket, fd=%d", capmt_name(capmt), __FUNCTION__, capmt->capmt_sock[0]);
+ tvhdebug(LS_CAPMT, "%s: %s: no subscribed services, closing socket, fd=%d",
+ capmt_name(capmt), __FUNCTION__, capmt->capmt_sock[0]);
if (capmt->capmt_sock[0] >= 0)
caclient_set_status((caclient_t *)capmt, CACLIENT_STATUS_READY);
if (capmt_oscam_netproto(capmt)) {
capmt->capmt_oscam != CAPMT_OSCAM_NET_PROTO &&
capmt->capmt_oscam != CAPMT_OSCAM_UNIX_SOCKET &&
capmt->capmt_oscam != CAPMT_OSCAM_UNIX_SOCKET_NP) {
- tvhlog(LOG_WARNING, "capmt",
- "%s: Virtual adapters are supported only in modes 3, 4, 5 and 6 (service \"%s\")",
- capmt_name(capmt), t->s_dvb_svcname);
+ tvhwarn(LS_CAPMT,
+ "%s: Virtual adapters are supported only in modes 3, 4, 5 and 6 (service \"%s\")",
+ capmt_name(capmt), t->s_dvb_svcname);
goto fin;
}
}
}
if (tuner < 0 || tuner >= MAX_CA) {
- tvhlog(LOG_ERR, "capmt",
- "%s: No free adapter slot available for service \"%s\"",
- capmt_name(capmt), t->s_dvb_svcname);
+ tvherror(LS_CAPMT,
+ "%s: No free adapter slot available for service \"%s\"",
+ capmt_name(capmt), t->s_dvb_svcname);
pthread_mutex_unlock(&capmt->capmt_mutex);
return;
}
}
- tvhlog(LOG_INFO, "capmt",
- "%s: Starting CAPMT server for service \"%s\" on adapter %d",
- capmt_name(capmt), t->s_dvb_svcname, tuner);
+ tvhinfo(LS_CAPMT,
+ "%s: Starting CAPMT server for service \"%s\" on adapter %d",
+ capmt_name(capmt), t->s_dvb_svcname, tuner);
capmt->capmt_adapters[tuner].ca_tuner = t->s_dvb_active_input;
capmt_free(caclient_t *cac)
{
capmt_t *capmt = (capmt_t *)cac;
- tvhlog(LOG_INFO, "capmt", "%s: mode %i %s %s port %i destroyed",
- capmt_name(capmt),
- capmt->capmt_oscam,
- capmt->capmt_oscam == CAPMT_OSCAM_TCP ||
- capmt->capmt_oscam == CAPMT_OSCAM_NET_PROTO ? "IP address" : "sockfile",
- capmt->capmt_sockfile, capmt->capmt_port);
+ tvhinfo(LS_CAPMT, "%s: mode %i %s %s port %i destroyed",
+ capmt_name(capmt),
+ capmt->capmt_oscam,
+ capmt->capmt_oscam == CAPMT_OSCAM_TCP ||
+ capmt->capmt_oscam == CAPMT_OSCAM_NET_PROTO ? "IP address" : "sockfile",
+ capmt->capmt_sockfile, capmt->capmt_port);
capmt_flush_queue(capmt, 1);
free(capmt->capmt_sockfile);
}
}
len = (size_t)ret;
- tvhtrace("cwc", "sending message sid %d len %zu enq %d", sid, len, enq);
- tvhlog_hexdump("cwc", buf, len);
+ tvhtrace(LS_CWC, "sending message sid %d len %zu enq %d", sid, len, enq);
+ tvhlog_hexdump(LS_CWC, buf, len);
buf[0] = (len - 2) >> 8;
buf[1] = (len - 2) & 0xff;
pthread_mutex_unlock(&cwc->cwc_writer_mutex);
} else {
if (tvh_write(cwc->cwc_fd, buf, len))
- tvhlog(LOG_INFO, "cwc", "write error %s", strerror(errno));
+ tvhinfo(LS_CWC, "write error %s", strerror(errno));
free(cm);
}
n = caid2name(caid & 0xff00) ?: "Unknown";
if (ua) {
- tvhlog(LOG_INFO, "cwc", "%s:%i: Connected as user %s "
- "to a %s-card [0x%04x : %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x] "
- "with %d provider%s",
- cwc->cwc_hostname, cwc->cwc_port,
- cwc->cwc_username, n, caid,
- ua[0], ua[1], ua[2], ua[3], ua[4], ua[5], ua[6], ua[7],
- pcount, pcount > 1 ? "s" : "");
+ tvhinfo(LS_CWC, "%s:%i: Connected as user %s "
+ "to a %s-card [0x%04x : %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x] "
+ "with %d provider%s",
+ cwc->cwc_hostname, cwc->cwc_port,
+ cwc->cwc_username, n, caid,
+ ua[0], ua[1], ua[2], ua[3], ua[4], ua[5], ua[6], ua[7],
+ pcount, pcount > 1 ? "s" : "");
} else {
- tvhlog(LOG_INFO, "cwc", "%s:%i: Connected as user %s "
- "to a %s-card [0x%04x] with %d provider%s",
- cwc->cwc_hostname, cwc->cwc_port,
- cwc->cwc_username, n, caid,
- pcount, pcount > 1 ? "s" : "");
+ tvhinfo(LS_CWC, "%s:%i: Connected as user %s "
+ "to a %s-card [0x%04x] with %d provider%s",
+ cwc->cwc_hostname, cwc->cwc_port,
+ cwc->cwc_username, n, caid,
+ pcount, pcount > 1 ? "s" : "");
}
for (i = 0, ep = pcard->cs_ra.providers; i < pcount; i++, ep++) {
if (psa) {
sa = ep->sa;
- tvhlog(LOG_INFO, "cwc", "%s:%i: Provider ID #%d: 0x%04x:0x%06x %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x",
- cwc->cwc_hostname, cwc->cwc_port, i + 1, caid, ep->id,
- sa[0], sa[1], sa[2], sa[3], sa[4], sa[5], sa[6], sa[7]);
+ tvhinfo(LS_CWC, "%s:%i: Provider ID #%d: 0x%04x:0x%06x %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x",
+ cwc->cwc_hostname, cwc->cwc_port, i + 1, caid, ep->id,
+ sa[0], sa[1], sa[2], sa[3], sa[4], sa[5], sa[6], sa[7]);
} else {
- tvhlog(LOG_INFO, "cwc", "%s:%i: Provider ID #%d: 0x%04x:0x%06x",
- cwc->cwc_hostname, cwc->cwc_port, i + 1, caid, ep->id);
+ tvhinfo(LS_CWC, "%s:%i: Provider ID #%d: 0x%04x:0x%06x",
+ cwc->cwc_hostname, cwc->cwc_port, i + 1, caid, ep->id);
}
}
len -= 12;
if(len < 3) {
- tvhlog(LOG_INFO, "cwc", "Invalid card data reply");
+ tvhinfo(LS_CWC, "Invalid card data reply");
return -1;
}
plen = (msg[1] & 0xf) << 8 | msg[2];
if(plen < 14) {
- tvhlog(LOG_INFO, "cwc", "Invalid card data reply (message)");
+ tvhinfo(LS_CWC, "Invalid card data reply (message)");
return -1;
}
plen -= 12;
if(plen < nprov * 11) {
- tvhlog(LOG_INFO, "cwc", "Invalid card data reply (provider list)");
+ tvhinfo(LS_CWC, "Invalid card data reply (provider list)");
return -1;
}
ua[4] || ua[5] || ua[6] || ua[7];
if (!emm_allowed) {
- tvhlog(LOG_INFO, "cwc",
- "%s:%i: Will not forward EMMs (not allowed by server)",
- cwc->cwc_hostname, cwc->cwc_port);
+ tvhinfo(LS_CWC,
+ "%s:%i: Will not forward EMMs (not allowed by server)",
+ cwc->cwc_hostname, cwc->cwc_port);
} else if (pcard->cs_ra.type != CARD_UNKNOWN) {
- tvhlog(LOG_INFO, "cwc", "%s:%i: Will forward EMMs",
- cwc->cwc_hostname, cwc->cwc_port);
+ tvhinfo(LS_CWC, "%s:%i: Will forward EMMs",
+ cwc->cwc_hostname, cwc->cwc_port);
cwc->cwc_forward_emm = 1;
} else {
- tvhlog(LOG_INFO, "cwc",
+ tvhinfo(LS_CWC,
"%s:%i: Will not forward EMMs (unsupported CA system)",
- cwc->cwc_hostname, cwc->cwc_port);
+ cwc->cwc_hostname, cwc->cwc_port);
}
}
return; // We already know it's bad
if (es->es_nok >= CWC_MAX_NOKS) {
- tvhlog(LOG_DEBUG, "cwc",
- "Too many NOKs[%i] for service \"%s\"%s from %s",
- es->es_section, t->s_dvb_svcname, chaninfo, ct->td_nicename);
+ tvhdebug(LS_CWC,
+ "Too many NOKs[%i] for service \"%s\"%s from %s",
+ es->es_section, t->s_dvb_svcname, chaninfo, ct->td_nicename);
es->es_keystate = ES_FORBIDDEN;
goto forbid;
}
if (descrambler_resolved((service_t *)t, (th_descrambler_t *)ct)) {
- tvhlog(LOG_DEBUG, "cwc",
- "NOK[%i] from %s: Already has a key for service \"%s\"",
- es->es_section, ct->td_nicename, t->s_dvb_svcname);
+ tvhdebug(LS_CWC,
+ "NOK[%i] from %s: Already has a key for service \"%s\"",
+ es->es_section, ct->td_nicename, t->s_dvb_svcname);
es->es_nok = CWC_MAX_NOKS; /* do not send more ECM requests */
es->es_keystate = ES_IDLE;
if (ct->td_keystate == DS_UNKNOWN)
ct->td_keystate = DS_IDLE;
}
- tvhlog(LOG_DEBUG, "cwc",
- "Received NOK[%i] for service \"%s\"%s "
- "(seqno: %d Req delay: %"PRId64" ms)",
- es->es_section, t->s_dvb_svcname, chaninfo, seq, delay);
+ tvhdebug(LS_CWC,
+ "Received NOK[%i] for service \"%s\"%s "
+ "(seqno: %d Req delay: %"PRId64" ms)",
+ es->es_section, t->s_dvb_svcname, chaninfo, seq, delay);
forbid:
i = 0;
}
if (ep == NULL) { /* !UNKNOWN && !RESOLVED */
- tvhlog(LOG_ERR, "cwc",
- "Can not descramble service \"%s\", access denied (seqno: %d "
- "Req delay: %"PRId64" ms) from %s",
- t->s_dvb_svcname, seq, delay, ct->td_nicename);
+ tvherror(LS_CWC,
+ "Can not descramble service \"%s\", access denied (seqno: %d "
+ "Req delay: %"PRId64" ms) from %s",
+ t->s_dvb_svcname, seq, delay, ct->td_nicename);
ct->td_keystate = DS_FORBIDDEN;
ct->ecm_state = ECM_RESET;
/* this pid is not valid, force full scan */
(t->s_dvb_prefcapid != ct->cs_channel &&
t->s_dvb_prefcapid_lock == PREFCAPID_OFF)) {
t->s_dvb_prefcapid = ct->cs_channel;
- tvhlog(LOG_DEBUG, "cwc", "Saving prefered PID %d for %s",
+ tvhdebug(LS_CWC, "Saving prefered PID %d for %s",
t->s_dvb_prefcapid, ct->td_nicename);
service_request_save((service_t*)t, 0);
}
if(len < 35) {
- tvhlog(LOG_DEBUG, "cwc",
- "Received ECM reply%s for service \"%s\" [%d] "
- "even: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x"
- " odd: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x (seqno: %d "
- "Req delay: %"PRId64" ms)",
- chaninfo,
- t->s_dvb_svcname, es->es_section,
- msg[3 + 0], msg[3 + 1], msg[3 + 2], msg[3 + 3], msg[3 + 4],
- msg[3 + 5], msg[3 + 6], msg[3 + 7], msg[3 + 8], msg[3 + 9],
- msg[3 + 10],msg[3 + 11],msg[3 + 12],msg[3 + 13],msg[3 + 14],
- msg[3 + 15], seq, delay);
+ tvhdebug(LS_CWC,
+ "Received ECM reply%s for service \"%s\" [%d] "
+ "even: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x"
+ " odd: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x (seqno: %d "
+ "Req delay: %"PRId64" ms)",
+ chaninfo,
+ t->s_dvb_svcname, es->es_section,
+ msg[3 + 0], msg[3 + 1], msg[3 + 2], msg[3 + 3], msg[3 + 4],
+ msg[3 + 5], msg[3 + 6], msg[3 + 7], msg[3 + 8], msg[3 + 9],
+ msg[3 + 10],msg[3 + 11],msg[3 + 12],msg[3 + 13],msg[3 + 14],
+ msg[3 + 15], seq, delay);
if(es->es_keystate != ES_RESOLVED)
- tvhlog(LOG_DEBUG, "cwc",
- "Obtained DES keys for service \"%s\" in %"PRId64" ms, from %s",
- t->s_dvb_svcname, delay, ct->td_nicename);
+ tvhdebug(LS_CWC,
+ "Obtained DES keys for service \"%s\" in %"PRId64" ms, from %s",
+ t->s_dvb_svcname, delay, ct->td_nicename);
es->es_keystate = ES_RESOLVED;
es->es_resolved = 1;
off = 8;
} else {
- tvhlog(LOG_DEBUG, "cwc",
+ tvhdebug(LS_CWC,
"Received ECM reply%s for service \"%s\" "
"even: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x"
" odd: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x"
msg[3 + 30],msg[3 + 31], seq, delay);
if(es->es_keystate != ES_RESOLVED)
- tvhlog(LOG_DEBUG, "cwc",
- "Obtained AES keys for service \"%s\" in %"PRId64" ms, from %s",
- t->s_dvb_svcname, delay, ct->td_nicename);
+ tvhdebug(LS_CWC,
+ "Obtained AES keys for service \"%s\" in %"PRId64" ms, from %s",
+ t->s_dvb_svcname, delay, ct->td_nicename);
es->es_keystate = ES_RESOLVED;
es->es_resolved = 1;
off = 16;
if(es->es_seq == seq) {
if (es->es_resolved) {
mpegts_service_t *t = (mpegts_service_t *)ct->td_service;
- tvhlog(LOG_DEBUG, "cwc",
- "Ignore %sECM (PID %d) for service \"%s\" from %s (seq %i)",
- es->es_pending ? "duplicate " : "",
- ep->ep_pid, t->s_dvb_svcname, ct->td_nicename, es->es_seq);
+ tvhdebug(LS_CWC,
+ "Ignore %sECM (PID %d) for service \"%s\" from %s (seq %i)",
+ es->es_pending ? "duplicate " : "",
+ ep->ep_pid, t->s_dvb_svcname, ct->td_nicename, es->es_seq);
return 0;
}
if (es->es_pending) {
return 0;
}
}
- tvhlog(LOG_WARNING, "cwc", "Got unexpected ECM reply (seqno: %d)", seq);
+ tvhwarn(LS_CWC, "Got unexpected ECM reply (seqno: %d)", seq);
break;
case 0xD3:
if (caid){
if(len < 3) {
- tvhlog(LOG_INFO, "cwc", "Invalid card data reply");
+ tvhinfo(LS_CWC, "Invalid card data reply");
return -1;
}
plen = (msg[1] & 0xf) << 8 | msg[2];
if(plen < 14) {
- tvhlog(LOG_INFO, "cwc", "Invalid card data reply (message)");
+ tvhinfo(LS_CWC, "Invalid card data reply (message)");
return -1;
}
pthread_mutex_lock(&cwc->cwc_mutex);
if (r && tvheadend_is_running())
- tvhwarn("cwc", "read error %d (%s)", r, strerror(r));
+ tvhwarn(LS_CWC, "read error %d (%s)", r, strerror(r));
if(cwc_must_break(cwc))
return ECONNABORTED;
if((r = cwc_read(cwc, buf, 2, timeout))) {
if (tvheadend_is_running())
- tvhlog(LOG_INFO, "cwc", "%s:%i: %s: Read error (header): %s",
- cwc->cwc_hostname, cwc->cwc_port, state, strerror(r));
+ tvhinfo(LS_CWC, "%s:%i: %s: Read error (header): %s",
+ cwc->cwc_hostname, cwc->cwc_port, state, strerror(r));
return -1;
}
msglen = (buf[0] << 8) | buf[1];
if(msglen >= CWS_NETMSGSIZE) {
if (tvheadend_is_running())
- tvhlog(LOG_INFO, "cwc", "%s:%i: %s: Invalid message size: %d",
- cwc->cwc_hostname, cwc->cwc_port, state, msglen);
+ tvhinfo(LS_CWC, "%s:%i: %s: Invalid message size: %d",
+ cwc->cwc_hostname, cwc->cwc_port, state, msglen);
return -1;
}
if((r = cwc_read(cwc, cwc->cwc_buf + 2, msglen, 1000))) {
if (tvheadend_is_running())
- tvhlog(LOG_INFO, "cwc", "%s:%i: %s: Read error: %s",
- cwc->cwc_hostname, cwc->cwc_port, state, strerror(r));
+ tvhinfo(LS_CWC, "%s:%i: %s: Read error: %s",
+ cwc->cwc_hostname, cwc->cwc_port, state, strerror(r));
return -1;
}
if((msglen = des_decrypt(cwc->cwc_buf, msglen + 2, cwc)) < 15) {
- tvhlog(LOG_INFO, "cwc", "%s:%i: %s: Decrypt failed",
- cwc->cwc_hostname, cwc->cwc_port, state);
+ tvhinfo(LS_CWC, "%s:%i: %s: Decrypt failed",
+ cwc->cwc_hostname, cwc->cwc_port, state);
return -1;
}
return msglen;
pthread_mutex_unlock(&cwc->cwc_writer_mutex);
// int64_t ts = getfastmonoclock();
if (tvh_write(cwc->cwc_fd, cm->cm_data, cm->cm_len))
- tvhlog(LOG_INFO, "cwc", "write error %s", strerror(errno));
+ tvhinfo(LS_CWC, "write error %s", strerror(errno));
// printf("Write took %lld usec\n", getfastmonoclock() - ts);
free(cm);
pthread_mutex_lock(&cwc->cwc_writer_mutex);
* Get login key
*/
if((r = cwc_read(cwc, cwc->cwc_buf, 14, 5000))) {
- tvhlog(LOG_INFO, "cwc", "%s:%i: No login key received: %s",
- cwc->cwc_hostname, cwc->cwc_port, strerror(r));
+ tvhinfo(LS_CWC, "%s:%i: No login key received: %s",
+ cwc->cwc_hostname, cwc->cwc_port, strerror(r));
return;
}
return;
if(cwc->cwc_buf[12] != MSG_CLIENT_2_SERVER_LOGIN_ACK) {
- tvhlog(LOG_INFO, "cwc", "%s:%i: Login failed",
- cwc->cwc_hostname, cwc->cwc_port);
+ tvhinfo(LS_CWC, "%s:%i: Login failed",
+ cwc->cwc_hostname, cwc->cwc_port);
return;
}
return;
if(cwc->cwc_buf[12] != MSG_CARD_DATA) {
- tvhlog(LOG_INFO, "cwc", "%s:%i: Card data request failed",
- cwc->cwc_hostname, cwc->cwc_port);
+ tvhinfo(LS_CWC, "%s:%i: Card data request failed",
+ cwc->cwc_hostname, cwc->cwc_port);
return;
}
break;
cwc_running_reply(cwc, cwc->cwc_buf[12], cwc->cwc_buf, r);
}
- tvhdebug("cwc", "session thread exiting");
+ tvhdebug(LS_CWC, "session thread exiting");
/**
* Collect the writer thread
cwc->cwc_writer_running = 0;
tvh_cond_signal(&cwc->cwc_writer_cond, 0);
pthread_join(writer_thread_id, NULL);
- tvhlog(LOG_DEBUG, "cwc", "Write thread joined");
+ tvhdebug(LS_CWC, "Write thread joined");
}
/**
snprintf(hostname, sizeof(hostname), "%s", cwc->cwc_hostname);
port = cwc->cwc_port;
- tvhlog(LOG_INFO, "cwc", "Attemping to connect to %s:%d", hostname, port);
+ tvhinfo(LS_CWC, "Attemping to connect to %s:%d", hostname, port);
pthread_mutex_unlock(&cwc->cwc_mutex);
if(fd == -1) {
attempts++;
- tvhlog(LOG_INFO, "cwc",
- "Connection attempt to %s:%d failed: %s",
- hostname, port, errbuf);
+ tvhinfo(LS_CWC,
+ "Connection attempt to %s:%d failed: %s",
+ hostname, port, errbuf);
} else {
if(cwc->cwc_running == 0) {
break;
}
- tvhlog(LOG_INFO, "cwc", "Connected to %s:%d", hostname, port);
+ tvhinfo(LS_CWC, "Connected to %s:%d", hostname, port);
attempts = 0;
cwc->cwc_fd = fd;
cwc->cwc_fd = -1;
close(fd);
- tvhlog(LOG_INFO, "cwc", "Disconnected from %s:%i",
- cwc->cwc_hostname, cwc->cwc_port);
+ tvhinfo(LS_CWC, "Disconnected from %s:%i",
+ cwc->cwc_hostname, cwc->cwc_port);
}
if(cwc->cwc_running == 0) continue;
d = 3;
- tvhlog(LOG_INFO, "cwc",
- "%s:%i: Automatic connection attempt in %d seconds",
- cwc->cwc_hostname, cwc->cwc_port, d-1);
+ tvhinfo(LS_CWC,
+ "%s:%i: Automatic connection attempt in %d seconds",
+ cwc->cwc_hostname, cwc->cwc_port, d-1);
mono = mclk() + sec2mono(d);
do {
} while (ERRNO_AGAIN(r));
}
- tvhlog(LOG_INFO, "cwc", "%s:%i inactive",
- cwc->cwc_hostname, cwc->cwc_port);
+ tvhinfo(LS_CWC, "%s:%i inactive",
+ cwc->cwc_hostname, cwc->cwc_port);
cwc_free_cards(cwc);
pthread_mutex_unlock(&cwc->cwc_mutex);
return NULL;
cs_card_data_t *pcard = aux;
cwc_t *cwc = pcard->cwc;
- tvhtrace("cwc", "sending EMM for %04x mux %p", pcard->cs_ra.caid, mux);
- tvhlog_hexdump("cwc", radata, ralen);
+ tvhtrace(LS_CWC, "sending EMM for %04x mux %p", pcard->cs_ra.caid, mux);
+ tvhlog_hexdump(LS_CWC, radata, ralen);
cwc_send_msg(cwc, radata, ralen, 0, 1, 0, 0);
}
ct->ecm_state = ECM_INIT;
ct->cs_channel = -1;
t->s_dvb_prefcapid = 0;
- tvhlog(LOG_DEBUG, "cwc", "Reset after unexpected or no reply for service \"%s\"", t->s_dvb_svcname);
+ tvhdebug(LS_CWC, "Reset after unexpected or no reply for service \"%s\"", t->s_dvb_svcname);
}
LIST_FOREACH(ep, &ct->cs_pids, ep_link)
if(ep == NULL) {
if (ct->ecm_state == ECM_INIT) {
// Validate prefered ECM PID
- tvhlog(LOG_DEBUG, "cwc", "ECM state INIT");
+ tvhdebug(LS_CWC, "ECM state INIT");
if(t->s_dvb_prefcapid_lock != PREFCAPID_OFF) {
st = service_stream_find((service_t*)t, t->s_dvb_prefcapid);
pcard->cs_ra.caid == c->caid &&
verify_provider(pcard, c->providerid))
goto prefcapid_ok;
- tvhlog(LOG_DEBUG, "cwc", "Invalid prefered ECM (PID %d) found for service \"%s\"", t->s_dvb_prefcapid, t->s_dvb_svcname);
+ tvhdebug(LS_CWC, "Invalid prefered ECM (PID %d) found for service \"%s\"", t->s_dvb_prefcapid, t->s_dvb_svcname);
t->s_dvb_prefcapid = 0;
}
ep = calloc(1, sizeof(ecm_pid_t));
ep->ep_pid = pid;
LIST_INSERT_HEAD(&ct->cs_pids, ep, ep_link);
- tvhlog(LOG_DEBUG, "cwc", "Insert %s ECM (PID %d) for service \"%s\"",
- t->s_dvb_prefcapid ? "preferred" : "new", pid, t->s_dvb_svcname);
+ tvhdebug(LS_CWC, "Insert %s ECM (PID %d) for service \"%s\"",
+ t->s_dvb_prefcapid ? "preferred" : "new", pid, t->s_dvb_svcname);
}
}
if(ep == NULL)
if(ct->cs_channel >= 0 && channel != -1 &&
ct->cs_channel != channel) {
- tvhlog(LOG_DEBUG, "cwc", "Filtering ECM (PID %d)", channel);
+ tvhdebug(LS_CWC, "Filtering ECM (PID %d)", channel);
goto end;
}
es->es_seq = cwc_send_msg(cwc, data, len, sid, 1, caid, provid);
- tvhlog(LOG_DEBUG, "cwc",
- "Sending ECM%s section=%d/%d, for service \"%s\" (seqno: %d)",
- chaninfo, section, ep->ep_last_section, t->s_dvb_svcname, es->es_seq);
+ tvhdebug(LS_CWC,
+ "Sending ECM%s section=%d/%d, for service \"%s\" (seqno: %d)",
+ chaninfo, section, ep->ep_last_section, t->s_dvb_svcname, es->es_seq);
es->es_time = getfastmonoclock();
break;
}
if (reuse != 1)
- tvhlog(LOG_DEBUG, "cwc", "%s %susing CWC %s:%d",
- service_nicename(t), reuse ? "re" : "", cwc->cwc_hostname, cwc->cwc_port);
+ tvhdebug(LS_CWC, "%s %susing CWC %s:%d",
+ service_nicename(t), reuse ? "re" : "", cwc->cwc_hostname, cwc->cwc_port);
end:
pthread_mutex_unlock(&t->s_stream_mutex);
cwc_t *cwc = (cwc_t *)cac;;
cs_card_data_t *pcard;
- tvhtrace("cwc",
+ tvhtrace(LS_CWC,
"caid update event - client %s mux %p caid %04x (%i) pid %04x (%i) valid %i",
cac->cac_name, mux, caid, caid, pid, pid, valid);
pthread_mutex_lock(&cwc->cwc_mutex);
if (idx + 1 >= MAX_QUICK_ECM_ENTRIES) continue;
if ((s = htsmsg_get_str(e, "caid")) == NULL) continue;
caid = strtol(s, NULL, 16);
- tvhinfo("descrambler", "adding CAID %04X as quick ECM (%s)", caid, htsmsg_get_str(e, "name") ?: "unknown");
+ tvhinfo(LS_DESCRAMBLER, "adding CAID %04X as quick ECM (%s)", caid, htsmsg_get_str(e, "name") ?: "unknown");
if (!quick_ecm_table)
quick_ecm_table = malloc(sizeof(uint16_t) * MAX_QUICK_ECM_ENTRIES);
quick_ecm_table[idx++] = caid;
if (idx + 1 >= MAX_CONSTCW_ENTRIES) continue;
if ((s = htsmsg_get_str(e, "caid")) == NULL) continue;
caid = strtol(s, NULL, 16);
- tvhinfo("descrambler", "adding CAID %04X as constant crypto-word (%s)", caid, htsmsg_get_str(e, "name") ?: "unknown");
+ tvhinfo(LS_DESCRAMBLER, "adding CAID %04X as constant crypto-word (%s)", caid, htsmsg_get_str(e, "name") ?: "unknown");
if (!constcw_table)
constcw_table = malloc(sizeof(uint16_t) * MAX_CONSTCW_ENTRIES);
constcw_table[idx++] = caid;
dr->dr_key_interval = sec2mono(10);
dr->dr_key_const = constcw;
if (constcw)
- tvhtrace("descrambler", "using constcw for \"%s\"", t->s_nicename);
+ tvhtrace(LS_DESCRAMBLER, "using constcw for \"%s\"", t->s_nicename);
dr->dr_skip = 0;
dr->dr_force_skip = 0;
tvhcsa_init(&dr->dr_csa);
mpegts_service_t *t = (mpegts_service_t *)dr->dr_service;
descramble_info_t *di;
- tvhlog(LOG_DEBUG, "descrambler", "no key for service='%s'", t->s_dvb_svcname);
+ tvhdebug(LS_DESCRAMBLER, "no key for service='%s'", t->s_dvb_svcname);
di = calloc(1, sizeof(*di));
di->pid = t->s_pmt_pid;
mpegts_service_t *t = (mpegts_service_t *)td->td_service;
descramble_info_t *di;
- tvhlog(LOG_DEBUG, "descrambler", "info - service='%s' caid=%04X(%s) "
+ tvhdebug(LS_DESCRAMBLER, "info - service='%s' caid=%04X(%s) "
"provid=%06X ecmtime=%d hops=%d "
"reader='%s' from='%s' protocol='%s'%s",
t->s_dvb_svcname, caid, cardsystem, provid,
LIST_FOREACH(td2, &t->s_descramblers, td_service_link)
if (td2 != td && td2->td_keystate == DS_RESOLVED) {
- tvhlog(LOG_DEBUG, "descrambler",
- "Already has a key from %s for service \"%s\", "
- "ignoring key from \"%s\"%s",
- td2->td_nicename,
- ((mpegts_service_t *)td2->td_service)->s_dvb_svcname,
- td->td_nicename,
- dr->dr_key_const ? " (const)" : "");
+ tvhdebug(LS_DESCRAMBLER,
+ "Already has a key from %s for service \"%s\", "
+ "ignoring key from \"%s\"%s",
+ td2->td_nicename,
+ ((mpegts_service_t *)td2->td_service)->s_dvb_svcname,
+ td->td_nicename,
+ dr->dr_key_const ? " (const)" : "");
td->td_keystate = DS_IDLE;
if (td->td_ecm_idle)
td->td_ecm_idle(td);
if (j) {
if (td->td_keystate != DS_RESOLVED)
- tvhlog(LOG_DEBUG, "descrambler",
- "Obtained keys from %s for service \"%s\"%s",
- td->td_nicename,
- ((mpegts_service_t *)t)->s_dvb_svcname,
- dr->dr_key_const ? " (const)" : "");
+ tvhdebug( LS_DESCRAMBLER,
+ "Obtained keys from %s for service \"%s\"%s",
+ td->td_nicename,
+ ((mpegts_service_t *)t)->s_dvb_svcname,
+ dr->dr_key_const ? " (const)" : "");
if (dr->dr_csa.csa_keylen == 8) {
- tvhtrace("descrambler", "Obtained keys "
+ tvhtrace(LS_DESCRAMBLER, "Obtained keys "
"%02X%02X%02X%02X%02X%02X%02X%02X:%02X%02X%02X%02X%02X%02X%02X%02X"
" from %s for service \"%s\"",
even[0], even[1], even[2], even[3], even[4], even[5], even[6], even[7],
td->td_nicename,
((mpegts_service_t *)t)->s_dvb_svcname);
} else if (dr->dr_csa.csa_keylen == 16) {
- tvhtrace("descrambler", "Obtained keys "
+ tvhtrace(LS_DESCRAMBLER, "Obtained keys "
"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X:"
"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X"
" from %s for service \"%s\"",
td->td_nicename,
((mpegts_service_t *)t)->s_dvb_svcname);
} else {
- tvhtrace("descrambler", "Unknown keys from %s for for service \"%s\"",
+ tvhtrace(LS_DESCRAMBLER, "Unknown keys from %s for for service \"%s\"",
td->td_nicename, ((mpegts_service_t *)t)->s_dvb_svcname);
}
dr->dr_ecm_last_key_time = mclk();
td->td_keystate = DS_RESOLVED;
td->td_service->s_descrambler = td;
} else {
- tvhlog(LOG_DEBUG, "descrambler",
- "Empty keys received from %s for service \"%s\"%s",
- td->td_nicename,
- ((mpegts_service_t *)t)->s_dvb_svcname,
- dr->dr_key_const ? " (const)" : "");
+ tvhdebug(LS_DESCRAMBLER,
+ "Empty keys received from %s for service \"%s\"%s",
+ td->td_nicename,
+ ((mpegts_service_t *)t)->s_dvb_svcname,
+ dr->dr_key_const ? " (const)" : "");
}
fin:
if (mux == NULL)
return;
- tvhtrace("descrambler", "flush table data for service \"%s\"", ms->s_dvb_svcname);
+ tvhtrace(LS_DESCRAMBLER, "flush table data for service \"%s\"", ms->s_dvb_svcname);
pthread_mutex_lock(&mux->mm_descrambler_lock);
TAILQ_FOREACH(dt, &mux->mm_descrambler_tables, link) {
if (dt->table == NULL || dt->table->mt_service != ms)
if (key_valid(dr, ki) == 0)
goto next;
if (key_changed(dr, ki, dd->dd_timestamp)) {
- tvhtrace("descrambler", "stream key changed to %s for service \"%s\"",
+ tvhtrace(LS_DESCRAMBLER, "stream key changed to %s for service \"%s\"",
(ki & 0x40) ? "odd" : "even",
((mpegts_service_t *)t)->s_dvb_svcname);
if (key_late(dr, ki, dd->dd_timestamp)) {
if ((ki & 0x80) != 0x00) {
if (key_valid(dr, ki) == 0) {
if (!key_started(dr, ki) && tvhlog_limit(&dr->dr_loglimit_key, 10))
- tvhwarn("descrambler", "%s %s",
+ tvhwarn(LS_DESCRAMBLER, "%s %s",
((mpegts_service_t *)t)->s_dvb_svcname,
(ki & 0x40) ? "odd stream key is not valid" :
"even stream key is not valid");
goto next;
}
if (key_changed(dr, ki, mclk())) {
- tvhtrace("descrambler", "stream key changed to %s for service \"%s\"",
+ tvhtrace(LS_DESCRAMBLER, "stream key changed to %s for service \"%s\"",
(ki & 0x40) ? "odd" : "even",
((mpegts_service_t *)t)->s_dvb_svcname);
if (key_late(dr, ki, mclk())) {
- tvherror("descrambler", "ECM - key late (%"PRId64" ms) for service \"%s\"",
+ tvherror(LS_DESCRAMBLER, "ECM - key late (%"PRId64" ms) for service \"%s\"",
mono2ms(mclk() - dr->dr_ecm_last_key_time),
((mpegts_service_t *)t)->s_dvb_svcname);
descrambler_notify_nokey(dr);
/* do not use the first TS packet to decide - it may be wrong */
while (dr->dr_queue_total > 20 * 188) {
if (descrambler_data_key_check(dr, ki & 0xc0, 20 * 188)) {
- tvhtrace("descrambler", "initial stream key set to %s for service \"%s\"",
+ tvhtrace(LS_DESCRAMBLER, "initial stream key set to %s for service \"%s\"",
(ki & 0x40) ? "odd" : "even",
((mpegts_service_t *)t)->s_dvb_svcname);
key_update(dr, ki, mclk());
}
} else if (dr->dr_key_index != (ki & 0x40) &&
dr->dr_key_start + sec2mono(2) < mclk()) {
- tvhtrace("descrambler", "stream key changed to %s for service \"%s\"",
+ tvhtrace(LS_DESCRAMBLER, "stream key changed to %s for service \"%s\"",
(ki & 0x40) ? "odd" : "even",
((mpegts_service_t *)t)->s_dvb_svcname);
key_update(dr, ki, mclk());
descrambler_data_cut(dr, MAX((dbuflen / 10) * 188, len));
if (dr->dr_last_err + sec2mono(10) < mclk()) {
dr->dr_last_err = mclk();
- tvherror("descrambler", "cannot decode packets for service \"%s\"",
+ tvherror(LS_DESCRAMBLER, "cannot decode packets for service \"%s\"",
((mpegts_service_t *)t)->s_dvb_svcname);
} else {
- tvhtrace("descrambler", "cannot decode packets for service \"%s\"",
+ tvhtrace(LS_DESCRAMBLER, "cannot decode packets for service \"%s\"",
((mpegts_service_t *)t)->s_dvb_svcname);
}
}
ds->quick_ecm_called = 1;
dr->dr_quick_ecm = descrambler_quick_ecm(mt->mt_service, mt->mt_pid);
if (dr->dr_quick_ecm)
- tvhdebug("descrambler", "quick ECM enabled for service '%s'",
+ tvhdebug(LS_DESCRAMBLER, "quick ECM enabled for service '%s'",
t->s_dvb_svcname);
}
if ((ptr[0] & 0xfe) == 0x80) { /* 0x80 = even, 0x81 = odd */
if (dr->dr_quick_ecm)
dr->dr_key_valid &= ~(1 << ((ptr[0] & 1) + 6)); /* 0x40 = even, 0x80 = odd */
}
- tvhtrace("descrambler", "ECM message %02x (section %d, len %d, pid %d) for service \"%s\"",
+ tvhtrace(LS_DESCRAMBLER, "ECM message %02x (section %d, len %d, pid %d) for service \"%s\"",
ptr[0], des->number, len, mt->mt_pid, t->s_dvb_svcname);
}
} else
- tvhtrace("descrambler", "Unknown fast table message %02x (section %d, len %d, pid %d)",
+ tvhtrace(LS_DESCRAMBLER, "Unknown fast table message %02x (section %d, len %d, pid %d)",
ptr[0], des->number, len, mt->mt_pid);
} else {
- tvhtrace("descrambler", "EMM message %02x:%02x:%02x:%02x (len %d, pid %d)",
+ tvhtrace(LS_DESCRAMBLER, "EMM message %02x:%02x:%02x:%02x (len %d, pid %d)",
ptr[0], ptr[1], ptr[2], ptr[3], len, mt->mt_pid);
}
}
TAILQ_INIT(&dt->sections);
dt->table = mpegts_table_add(mux, 0, 0, descrambler_table_callback,
dt, (flags & MT_FAST) ? "ecm" : "emm",
- MT_FULL | MT_DEFER | flags, pid,
+ LS_TBL_CSA, MT_FULL | MT_DEFER | flags, pid,
MPS_WEIGHT_CA);
if (dt->table)
dt->table->mt_service = (mpegts_service_t *)service;
ds->opaque = opaque;
LIST_INIT(&ds->ecmsecs);
TAILQ_INSERT_TAIL(&dt->sections, ds, link);
- tvhtrace("descrambler", "mux %p open pid %04X (%i) (flags 0x%04x) for %p", mux, pid, pid, flags, opaque);
+ tvhtrace(LS_DESCRAMBLER, "mux %p open pid %04X (%i) (flags 0x%04x) for %p", mux, pid, pid, flags, opaque);
return 1;
}
free(dt);
}
free(ds);
- tvhtrace("descrambler", "mux %p close pid %04X (%i) (flags 0x%04x) for %p", mux, pid, pid, flags, opaque);
+ tvhtrace(LS_DESCRAMBLER, "mux %p close pid %04X (%i) (flags 0x%04x) for %p", mux, pid, pid, flags, opaque);
return 1;
}
}
if (mux == NULL)
return;
- tvhtrace("descrambler", "mux %p - flush tables", mux);
+ tvhtrace(LS_DESCRAMBLER, "mux %p - flush tables", mux);
caclient_caid_update(mux, 0, 0, -1);
pthread_mutex_lock(&mux->mm_descrambler_lock);
mux->mm_descrambler_flush = 1;
uint16_t caid = 0, pid = 0;
TAILQ_HEAD(,descrambler_emm) removing;
- tvhtrace("descrambler", "CAT data (len %d)", len);
- tvhlog_hexdump("descrambler", data, len);
+ tvhtrace(LS_DESCRAMBLER, "CAT data (len %d)", len);
+ tvhlog_hexdump(LS_DESCRAMBLER, data, len);
pthread_mutex_lock(&mux->mm_descrambler_lock);
TAILQ_FOREACH(emm, &mux->mm_descrambler_emms, link)
emm->to_be_removed = 1;
if (emm->caid == caid) {
emm->to_be_removed = 0;
if (emm->pid == EMM_PID_UNKNOWN) {
- tvhtrace("descrambler", "attach emm caid %04X (%i) pid %04X (%i)", caid, caid, pid, pid);
+ tvhtrace(LS_DESCRAMBLER, "attach emm caid %04X (%i) pid %04X (%i)", caid, caid, pid, pid);
emm->pid = pid;
descrambler_open_pid_(mux, emm->opaque, pid, emm->callback, NULL);
}
if (emm->pid != EMM_PID_UNKNOWN) {
caid = emm->caid;
pid = emm->pid;
- tvhtrace("descrambler", "close emm caid %04X (%i) pid %04X (%i)", caid, caid, pid, pid);
+ tvhtrace(LS_DESCRAMBLER, "close emm caid %04X (%i) pid %04X (%i)", caid, caid, pid, pid);
descrambler_close_pid_(mux, emm->opaque, pid);
}
TAILQ_REMOVE(&mux->mm_descrambler_emms, emm, link);
}
TAILQ_INSERT_TAIL(&mux->mm_descrambler_emms, emm, link);
if (pid != EMM_PID_UNKNOWN) {
- tvhtrace("descrambler",
+ tvhtrace(LS_DESCRAMBLER,
"attach emm caid %04X (%i) pid %04X (%i) - direct",
caid, caid, pid, pid);
descrambler_open_pid_(mux, opaque, pid, callback, NULL);
pid = emm->pid;
if (pid != EMM_PID_UNKNOWN) {
caid = emm->caid;
- tvhtrace("descrambler", "close emm caid %04X (%i) pid %04X (%i) - direct", caid, caid, pid, pid);
+ tvhtrace(LS_DESCRAMBLER, "close emm caid %04X (%i) pid %04X (%i) - direct", caid, caid, pid, pid);
descrambler_close_pid_(mux, opaque, pid);
}
pthread_mutex_unlock(&mux->mm_descrambler_lock);
crc = tvh_crc32(ass2, len, 0xffffffff);
if (!emm_cache_lookup(ra, crc)) {
- tvhlog(LOG_DEBUG, "cwc",
- "Send EMM "
- "%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x"
- "...%02x.%02x.%02x.%02x",
- ass2[0], ass2[1], ass2[2], ass2[3],
- ass2[4], ass2[5], ass2[6], ass2[7],
- ass2[len-4], ass2[len-3], ass2[len-2], ass2[len-1]);
+ tvhdebug(LS_CWC,
+ "Send EMM "
+ "%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x"
+ "...%02x.%02x.%02x.%02x",
+ ass2[0], ass2[1], ass2[2], ass2[3],
+ ass2[4], ass2[5], ass2[6], ass2[7],
+ ass2[len-4], ass2[len-3], ass2[len-2], ass2[len-1]);
send(aux, ass2, len, mux);
emm_cache_insert(ra, crc);
}
if (len < 1)
return;
- tvhlog(LOG_INFO, "cwc", "emm_streamguard streamguard card data emm get,here lots of works todo...");
+ tvhinfo(LS_CWC, "emm_streamguard streamguard card data emm get,here lots of works todo...");
if (data[0] == 0x87) {
match = memcmp(&data[3], &ra->ua[4], 4) == 0;
emm_filter(emm_reass_t *ra, const uint8_t *data, int len, void *mux,
emm_send_t send, void *aux)
{
- tvhtrace("emm-filter", "%s - len %d mux %p", caid2name(ra->caid), len, mux);
- tvhlog_hexdump("emm-filter", data, len);
+ tvhtrace(LS_CWC, "emm filter : %s - len %d mux %p", caid2name(ra->caid), len, mux);
+ tvhlog_hexdump(LS_CWC, data, len);
if (ra->do_emm)
ra->do_emm(ra, data, len, mux, send, aux);
}
#ifdef CONFIG_SSE2
if (std_caps & (1<<26)) {
current = funcs_128sse2;
- tvhlog(LOG_INFO, "CSA", "Using SSE2 128bit parallel descrambling");
+ tvhinfo(LS_CSA, "Using SSE2 128bit parallel descrambling");
return;
}
#endif
#ifdef CONFIG_MMX
if (std_caps & (1<<23)) {
current = funcs_64mmx;
- tvhlog(LOG_INFO, "CSA", "Using MMX 64bit parallel descrambling");
+ tvhinfo(LS_CSA, "Using MMX 64bit parallel descrambling");
return;
}
#endif
#endif
#endif
- tvhlog(LOG_INFO, "CSA", "Using 32bit parallel descrambling");
+ tvhinfo(LS_CSA, "Using 32bit parallel descrambling");
}
fd = tvh_open(filename, O_RDONLY, 0);
if (fd < 0) {
- tvherror(dn->log, "unable to open file '%s': %s",
+ tvherror(dn->subsys, "unable to open file '%s': %s",
filename, strerror(errno));
return -1;
}
if (fstat(fd, &st) || st.st_size == 0) {
- tvherror(dn->log, "unable to stat file '%s': %s",
+ tvherror(dn->subsys, "unable to stat file '%s': %s",
filename, strerror(errno));
close(fd);
return -1;
if (hc->hc_code == HTTP_STATUS_OK && hc->hc_result == 0 && hc->hc_data_size > 0)
dn->process(dn->aux, last_url, hc->hc_url, hc->hc_data, hc->hc_data_size);
else
- tvherror(dn->log, "unable to fetch data from url [%d-%d/%zd]",
+ tvherror(dn->subsys, "unable to fetch data from url [%d-%d/%zd]",
hc->hc_code, hc->hc_result, hc->hc_data_size);
/* note: http_client_close must be called outside http_client callbacks */
if (ERRNO_AGAIN(errno))
break;
failed:
- tvherror(dn->log, "pipe: read failed: %d", errno);
+ tvherror(dn->subsys, "pipe: read failed: %d", errno);
download_pipe_close(dn);
return;
}
/* Arguments */
if (spawn_parse_args(&argv, 64, args, NULL)) {
- tvherror(dn->log, "pipe: unable to parse arguments (%s)", args);
+ tvherror(dn->subsys, "pipe: unable to parse arguments (%s)", args);
return -1;
}
if (r < 0) {
dn->pipe_fd = -1;
dn->pipe_pid = 0;
- tvherror(dn->log, "pipe: cannot start (%s)", args);
+ tvherror(dn->subsys, "pipe: cannot start (%s)", args);
return -1;
}
}
if (urlparse(dn->url, &u) < 0) {
- tvherror(dn->log, "wrong url");
+ tvherror(dn->subsys, "wrong url");
goto stop;
}
hc = http_client_connect(dn, HTTP_VERSION_1_1, u.scheme, u.host, u.port, NULL);
if (hc == NULL) {
- tvherror(dn->log, "unable to open http client");
+ tvherror(dn->subsys, "unable to open http client");
goto stop;
}
hc->hc_handle_location = 1;
http_client_ssl_peer_verify(hc, dn->ssl_peer_verify);
if (http_client_simple(hc, &u) < 0) {
http_client_close(hc);
- tvherror(dn->log, "unable to send http command");
+ tvherror(dn->subsys, "unable to send http command");
goto stop;
}
*
*/
void
-download_init( download_t *dn, const char *log )
+download_init( download_t *dn, int subsys )
{
memset(dn, 0, sizeof(*dn));
- dn->log = strdup(log);
+ dn->subsys = subsys;
dn->pipe_fd = -1;
sbuf_init(&dn->pipe_sbuf);
}
download_pipe_close(dn);
mtimer_disarm(&dn->fetch_timer);
mtimer_disarm(&dn->pipe_read_timer);
- free(dn->log); dn->log = NULL;
free(dn->url); dn->url = NULL;
}
#include "http.h"
typedef struct download {
- char *log;
+ int subsys;
char *url;
void *aux;
int ssl_peer_verify;
pid_t pipe_pid;
} download_t;
-void download_init ( download_t *dn, const char *log );
+void download_init ( download_t *dn, int subsys );
void download_start( download_t *dn, const char *url, void *aux );
void download_done ( download_t *dn );
if (count <= max_count)
break;
if (de_prev) {
- tvhinfo("dvr", "autorec %s removing recordings %s (allowed count %u total %u)",
+ tvhinfo(LS_DVR, "autorec %s removing recordings %s (allowed count %u total %u)",
dae->dae_name, idnode_uuid_as_str(&de_prev->de_id, ubuf), max_count, total);
dvr_entry_cancel_delete(de_prev, 0);
}
if (idnode_insert(&dae->dae_id, uuid, &dvr_autorec_entry_class, 0)) {
if (uuid)
- tvhwarn("dvr", "invalid autorec entry uuid '%s'", uuid);
+ tvhwarn(LS_DVR, "invalid autorec entry uuid '%s'", uuid);
free(dae);
return NULL;
}
{
idnode_update(&dae->dae_id, conf);
idnode_changed(&dae->dae_id);
- tvhlog(LOG_INFO, "autorec", "\"%s\" on \"%s\": Updated", dae->dae_title ? dae->dae_title : "",
+ tvhinfo(LS_DVR, "autorec \"%s\" on \"%s\": Updated", dae->dae_title ? dae->dae_title : "",
(dae->dae_channel && dae->dae_channel->ch_name) ? dae->dae_channel->ch_name : "any channel");
}
if (cfg == NULL) {
if (name && *name)
- tvhlog(LOG_WARNING, "dvr", "Configuration '%s' not found, using default", name);
+ tvhwarn(LS_DVR, "Configuration '%s' not found, using default", name);
cfg = dvrdefaultconfig;
} else if (!cfg->dvr_enabled) {
- tvhlog(LOG_WARNING, "dvr", "Configuration '%s' not enabled, using default", name);
+ tvhwarn(LS_DVR, "Configuration '%s' not enabled, using default", name);
cfg = dvrdefaultconfig;
}
if (idnode_insert(&cfg->dvr_id, uuid, &dvr_config_class, 0)) {
if (uuid)
- tvherror("dvr", "invalid config uuid '%s'", uuid);
+ tvherror(LS_DVR, "invalid config uuid '%s'", uuid);
free(cfg);
return NULL;
}
cfg->dvr_valid = 1;
}
- tvhinfo("dvr", "Creating new configuration '%s'", cfg->dvr_config_name);
+ tvhinfo(LS_DVR, "Creating new configuration '%s'", cfg->dvr_config_name);
if (cfg->dvr_profile == NULL) {
cfg->dvr_profile = profile_find_by_name("dvr", NULL);
}
if (dvr_config_is_default(cfg) && dvr_config_find_by_name(NULL)) {
- tvherror("dvr", "Unable to create second default config, removing");
+ tvherror(LS_DVR, "Unable to create second default config, removing");
LIST_INSERT_HEAD(&dvrconfigs, cfg, config_link);
dvr_config_destroy(cfg, 0);
cfg = NULL;
idnode_save_check(&cfg->dvr_id, delconf);
if (delconf) {
- tvhinfo("dvr", "Deleting configuration '%s'", cfg->dvr_config_name);
+ tvhinfo(LS_DVR, "Deleting configuration '%s'", cfg->dvr_config_name);
hts_settings_remove("dvr/config/%s", idnode_uuid_as_str(&cfg->dvr_id, ubuf));
}
LIST_REMOVE(cfg, config_link);
cfg->dvr_storage = strdup(getcwd(buf, sizeof(buf)));
}
- tvhlog(LOG_WARNING, "dvr",
- "Output directory for video recording is not yet configured "
- "for DVR configuration \"%s\". "
- "Defaulting to to \"%s\". "
- "This can be changed from the web user interface.",
- cfg->dvr_config_name, cfg->dvr_storage);
+ tvhwarn(LS_DVR,
+ "Output directory for video recording is not yet configured "
+ "for DVR configuration \"%s\". "
+ "Defaulting to to \"%s\". "
+ "This can be changed from the web user interface.",
+ cfg->dvr_config_name, cfg->dvr_storage);
}
/**
if (!dvr_config_is_default(cfg))
dvr_config_destroy(cfg, 1);
else
- tvhwarn("dvr", "Attempt to delete default config ignored");
+ tvhwarn(LS_DVR, "Attempt to delete default config ignored");
}
/**
/* Sanity Checks */
if(start < 0 || end < 0 || end < start || start == end ||
action < DVR_CP_CUT || action > DVR_CP_COMM) {
- tvhwarn("dvr", "Insane entry: start=%f, end=%f. Skipping.", start, end);
+ tvhwarn(LS_DVR, "Insane entry: start=%f, end=%f. Skipping.", start, end);
return 1;
}
/* Sanity Checks */
if(start < 0 || end < 0 || end < start || start == end) {
- tvherror("dvr", "Insane EDL entry: start=%d, end=%d. Skipping.", start, end);
+ tvherror(LS_DVR, "Insane EDL entry: start=%d, end=%d. Skipping.", start, end);
return 1;
}
snprintf(buf, sizeof(buf), "entry %s - %s",
idnode_uuid_as_str(&de->de_id, ubuf),
fmt);
- tvhlogv(file, line, LOG_TRACE, "dvr", buf, &args);
+ tvhlogv(file, line, LOG_TRACE, LS_DVR, buf, &args);
va_end(args);
}
t2name ? " " : "",
t2name ? gmtime2local(t2, t2buf, sizeof(t2buf)) : "",
fmt);
- tvhlogv(file, line, LOG_TRACE, "dvr", buf, &args);
+ tvhlogv(file, line, LOG_TRACE, LS_DVR, buf, &args);
va_end(args);
}
if (idnode_insert(&de->de_id, uuid, &dvr_entry_class, IDNODE_SHORT_UUID)) {
if (uuid)
- tvhwarn("dvr", "invalid entry uuid '%s'", uuid);
+ tvhwarn(LS_DVR, "invalid entry uuid '%s'", uuid);
free(de);
return NULL;
}
de2->de_sched_state != DVR_COMPLETED &&
de2->de_sched_state != DVR_MISSED_TIME &&
strcmp(de2->de_owner ?: "", de->de_owner ?: "") == 0) {
- tvhlog(LOG_INFO, "dvr", "delete entry %s \"%s\" on \"%s\" start time %"PRId64", "
+ tvhinfo(LS_DVR, "delete entry %s \"%s\" on \"%s\" start time %"PRId64", "
"scheduled for recording by \"%s\" (duplicate with %s)",
idnode_uuid_as_str(&de->de_id, ubuf),
lang_str_get(de->de_title, NULL), DVR_CH_NAME(de),
if (strftime(tbuf, sizeof(tbuf), "%F %T", &tm) <= 0)
*tbuf = 0;
- tvhlog(LOG_INFO, "dvr", "entry %s \"%s\" on \"%s\" starting at %s, "
+ tvhinfo(LS_DVR, "entry %s \"%s\" on \"%s\" starting at %s, "
"scheduled for recording by \"%s\"",
idnode_uuid_as_str(&de->de_id, ubuf),
lang_str_get(de->de_title, NULL), DVR_CH_NAME(de), tbuf, creator ?: "");
(de->de_sched_state == DVR_RECORDING)) count++;
if (count >= max_count) {
- tvhlog(LOG_DEBUG, "dvr", "Autorecord \"%s\": Not scheduling \"%s\" because of autorecord max schedules limit reached",
- dae->dae_name, lang_str_get(e->episode->title, NULL));
+ tvhinfo(LS_DVR, "Autorecord \"%s\": Not scheduling \"%s\" because of autorecord max schedules limit reached",
+ dae->dae_name, lang_str_get(e->episode->title, NULL));
return;
}
}
idnode_changed(&de->de_id);
htsp_dvr_entry_update(de);
if (tvhlog_limit(&de->de_update_limit, 60)) {
- tvhlog(LOG_INFO, "dvr", "\"%s\" on \"%s\": Updated%s (%s)",
- lang_str_get(de->de_title, NULL), DVR_CH_NAME(de),
- updated ? " Timer" : "",
- dvr_updated_str(buf, sizeof(buf), save));
+ tvhinfo(LS_DVR, "\"%s\" on \"%s\": Updated%s (%s)",
+ lang_str_get(de->de_title, NULL), DVR_CH_NAME(de),
+ updated ? " Timer" : "",
+ dvr_updated_str(buf, sizeof(buf), save));
} else {
- tvhtrace("dvr", "\"%s\" on \"%s\": Updated%s (%s)",
+ tvhtrace(LS_DVR, "\"%s\" on \"%s\": Updated%s (%s)",
lang_str_get(de->de_title, NULL), DVR_CH_NAME(de),
updated ? " Timer" : "",
dvr_updated_str(buf, sizeof(buf), save));
RB_FOREACH(e2, &ch->ch_epg_schedule, sched_link) {
if (dvr_entry_fuzzy_match(de, e2, e2->dvb_eid,
de->de_config->dvr_update_window)) {
- tvhtrace("dvr", " replacement event %s on %s @ start %s stop %s",
+ tvhtrace(LS_DVR, " replacement event %s on %s @ start %s stop %s",
epg_broadcast_get_title(e2, NULL),
channel_get_name(ch),
gmtime2local(e2->start, t1buf, sizeof(t1buf)),
if (esrc != EPG_SOURCE_EIT || e->dvb_eid == 0 || e->channel == NULL)
return;
- tvhtrace("dvr", "dvr event running check for %s on %s running %d",
+ tvhtrace(LS_DVR, "dvr event running check for %s on %s running %d",
epg_broadcast_get_title(e, NULL),
channel_get_name(e->channel),
running);
}
if (running == EPG_RUNNING_NOW && de->de_dvb_eid == e->dvb_eid) {
if (de->de_running_pause) {
- tvhdebug("dvr", "dvr entry %s event %s on %s - EPG unpause",
+ tvhdebug(LS_DVR, "dvr entry %s event %s on %s - EPG unpause",
idnode_uuid_as_str(&de->de_id, ubuf),
epg_broadcast_get_title(e, NULL),
channel_get_name(e->channel));
atomic_set_time_t(&de->de_running_pause, 0);
}
if (!de->de_running_start) {
- tvhdebug("dvr", "dvr entry %s event %s on %s - EPG marking start",
+ tvhdebug(LS_DVR, "dvr entry %s event %s on %s - EPG marking start",
idnode_uuid_as_str(&de->de_id, ubuf),
epg_broadcast_get_title(e, NULL),
channel_get_name(e->channel));
if (dvr_entry_get_start_time(de, 1) > gclk()) {
atomic_set_time_t(&de->de_start, gclk());
dvr_entry_set_timer(de);
- tvhdebug("dvr", "dvr entry %s event %s on %s - EPG start",
+ tvhdebug(LS_DVR, "dvr entry %s event %s on %s - EPG start",
idnode_uuid_as_str(&de->de_id, ubuf),
epg_broadcast_get_title(e, NULL),
channel_get_name(e->channel));
srcname = de->de_dvb_eid == e->dvb_eid ? "event" : "other running event";
if (!de->de_running_stop ||
de->de_running_start > de->de_running_stop) {
- tvhdebug("dvr", "dvr entry %s %s %s on %s - EPG marking stop",
+ tvhdebug(LS_DVR, "dvr entry %s %s %s on %s - EPG marking stop",
idnode_uuid_as_str(&de->de_id, ubuf), srcname,
epg_broadcast_get_title(e, NULL),
channel_get_name(de->de_channel));
atomic_set_time_t(&de->de_running_pause, 0);
if (de->de_sched_state == DVR_RECORDING && de->de_running_start) {
dvr_stop_recording(de, SM_CODE_OK, 0, 0);
- tvhdebug("dvr", "dvr entry %s %s %s on %s - EPG stop",
+ tvhdebug(LS_DVR, "dvr entry %s %s %s on %s - EPG stop",
idnode_uuid_as_str(&de->de_id, ubuf), srcname,
epg_broadcast_get_title(e, NULL),
channel_get_name(de->de_channel));
}
} else if (running == EPG_RUNNING_PAUSE && de->de_dvb_eid == e->dvb_eid) {
if (!de->de_running_pause) {
- tvhdebug("dvr", "dvr entry %s event %s on %s - EPG pause",
+ tvhdebug(LS_DVR, "dvr entry %s event %s on %s - EPG pause",
idnode_uuid_as_str(&de->de_id, ubuf),
epg_broadcast_get_title(e, NULL),
channel_get_name(e->channel));
else
dvr_entry_completed(de, stopcode);
- tvhlog(LOG_INFO, "dvr", "\"%s\" on \"%s\": "
- "End of program: %s",
- lang_str_get(de->de_title, NULL), DVR_CH_NAME(de),
- dvr_entry_status(de));
+ tvhinfo(LS_DVR, "\"%s\" on \"%s\": "
+ "End of program: %s",
+ lang_str_get(de->de_title, NULL), DVR_CH_NAME(de),
+ dvr_entry_status(de));
if (dvr_entry_rerecord(de))
return;
dvr_entry_set_state(de, DVR_RECORDING, DVR_RS_PENDING, SM_CODE_OK);
- tvhlog(LOG_INFO, "dvr", "\"%s\" on \"%s\" recorder starting",
- lang_str_get(de->de_title, NULL), DVR_CH_NAME(de));
+ tvhinfo(LS_DVR, "\"%s\" on \"%s\" recorder starting",
+ lang_str_get(de->de_title, NULL), DVR_CH_NAME(de));
if (!clone && (r = dvr_rec_subscribe(de)) < 0) {
dvr_entry_completed(de, r == -EPERM ? SM_CODE_USER_ACCESS :
str1 = dvr_entry_get_retention_string(de);
str2 = dvr_entry_get_removal_string(de);
- tvhlog(LOG_INFO, "dvr", "delete entry %s \"%s\" on \"%s\" start time %s, "
- "scheduled for recording by \"%s\", retention \"%s\" removal \"%s\"",
- idnode_uuid_as_str(&de->de_id, ubuf),
- lang_str_get(de->de_title, NULL), DVR_CH_NAME(de), tbuf,
- de->de_creator ?: "", str1, str2);
+ tvhinfo(LS_DVR, "delete entry %s \"%s\" on \"%s\" start time %s, "
+ "scheduled for recording by \"%s\", retention \"%s\" removal \"%s\"",
+ idnode_uuid_as_str(&de->de_id, ubuf),
+ lang_str_get(de->de_title, NULL), DVR_CH_NAME(de), tbuf,
+ de->de_creator ?: "", str1, str2);
free(str2);
free(str1);
if (filename == NULL) continue;
r = deferred_unlink(filename, rdir);
if(r && r != -ENOENT)
- tvhlog(LOG_WARNING, "dvr", "Unable to remove file '%s' from disk -- %s",
- filename, strerror(-errno));
+ tvhwarn(LS_DVR, "Unable to remove file '%s' from disk -- %s",
+ filename, strerror(-errno));
cmd = de->de_config->dvr_postremove;
if (cmd && cmd[0])
{
atomic_set(&_inot_fd, inotify_init1(IN_CLOEXEC));
if (atomic_get(&_inot_fd) < 0) {
- tvhlog(LOG_ERR, "dvr", "failed to initialise inotify (err=%s)",
- strerror(errno));
+ tvherror(LS_DVR, "failed to initialise inotify (err=%s)", strerror(errno));
return;
}
LIST_INSERT_HEAD(&e->entries, dif, link);
if (e->fd < 0) {
- tvhlog(LOG_ERR, "dvr", "failed to add inotify watch to %s (err=%s)",
- e->path, strerror(errno));
+ tvherror(LS_DVR, "failed to add inotify watch to %s (err=%s)",
+ e->path, strerror(errno));
dvr_inotify_del(de);
}
tcp_get_ip_from_str(de->de_creator, &sa) != NULL)
aa = access_get_by_addr(&sa);
else {
- tvherror("dvr", "unable to find access (owner '%s', creator '%s')",
+ tvherror(LS_DVR, "unable to find access (owner '%s', creator '%s')",
de->de_owner, de->de_creator);
return -EPERM;
}
c1 = aa->aa_conn_limit ? rec_count + net_count >= aa->aa_conn_limit : -1;
c2 = aa->aa_conn_limit_dvr ? rec_count >= aa->aa_conn_limit_dvr : -1;
if (c1 && c2) {
- tvherror("dvr", "multiple connections are not allowed for user '%s' from '%s' "
+ tvherror(LS_DVR, "multiple connections are not allowed for user '%s' from '%s' "
"(limit %u, dvr limit %u, active DVR %u, streaming %u)",
aa->aa_username ?: "", aa->aa_representative ?: "",
aa->aa_conn_limit, aa->aa_conn_limit_dvr, rec_count, net_count);
profile_chain_init(prch, pro, de->de_channel);
if (profile_chain_open(prch, &de->de_config->dvr_muxcnf, 0, 0)) {
profile_chain_close(prch);
- tvherror("dvr", "unable to create new channel streaming chain '%s' for '%s', using default",
+ tvherror(LS_DVR, "unable to create new channel streaming chain '%s' for '%s', using default",
profile_get_name(pro), channel_get_name(de->de_channel));
pro = profile_find_by_name(NULL, NULL);
profile_chain_init(prch, pro, de->de_channel);
if (profile_chain_open(prch, &de->de_config->dvr_muxcnf, 0, 0)) {
- tvherror("dvr", "unable to create channel streaming default chain '%s' for '%s'",
+ tvherror(LS_DVR, "unable to create channel streaming default chain '%s' for '%s'",
profile_get_name(pro), channel_get_name(de->de_channel));
profile_chain_close(prch);
free(prch);
buf, prch->prch_flags,
NULL, NULL, NULL, NULL);
if (de->de_s == NULL) {
- tvherror("dvr", "unable to create new channel subcription for '%s' profile '%s'",
+ tvherror(LS_DVR, "unable to create new channel subcription for '%s' profile '%s'",
channel_get_name(de->de_channel), profile_get_name(pro));
profile_chain_close(prch);
free(prch);
s1 = intlconv_utf8safestr(cfg->dvr_charset_id, s, (len * 2) + 1);
if (s1 == NULL) {
- tvherror("dvr", "Unsupported charset %s using ASCII", cfg->dvr_charset);
+ tvherror(LS_DVR, "Unsupported charset %s using ASCII", cfg->dvr_charset);
s1 = intlconv_utf8safestr(intlconv_charset_id("ASCII", 1, 1),
s, len * 2);
if (s1 == NULL)
path[sizeof(path)-1] = '\0';
l = strlen(path);
if (l + 1 >= sizeof(path)) {
- tvherror("dvr", "wrong storage path");
+ tvherror(LS_DVR, "wrong storage path");
return -1;
}
dirsep = path + l;
}
htsstr_unescape_to(path, filename, sizeof(filename));
- if (makedirs("dvr", filename,
+ if (makedirs(LS_DVR, filename,
cfg->dvr_muxcnf.m_directory_permissions, 0, -1, -1) != 0)
return -1;
max = pathconf(filename, _PC_NAME_MAX);
if (lastpath) {
if (strcmp(path, lastpath) == 0) {
free(lastpath);
- tvherror("dvr", "unable to create unique name (missing $n in format string?)");
+ tvherror(LS_DVR, "unable to create unique name (missing $n in format string?)");
return -1;
}
}
if(stat(path, &st) == -1) {
- tvhlog(LOG_DEBUG, "dvr", "File \"%s\" -- %s -- Using for recording",
- path, strerror(errno));
+ tvhdebug(LS_DVR, "File \"%s\" -- %s -- Using for recording",
+ path, strerror(errno));
break;
}
- tvhlog(LOG_DEBUG, "dvr", "Overwrite protection, file \"%s\" exists",
- path);
+ tvhdebug(LS_DVR, "Overwrite protection, file \"%s\" exists", path);
free(lastpath);
lastpath = strdup(path);
vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
va_end(ap);
- tvhlog(LOG_ERR, "dvr",
- "Recording error: \"%s\": %s",
- dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL), msgbuf);
+ tvherror(LS_DVR, "Recording error: \"%s\": %s",
+ dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL), msgbuf);
}
/**
}
}
- tvhlog(LOG_INFO, "dvr", "%s from "
+ tvhinfo(LS_DVR, "%s from "
"adapter: \"%s\", "
"network: \"%s\", mux: \"%s\", provider: \"%s\", "
"service: \"%s\"",
si->si_service ?: "<N/A>");
- tvhlog(LOG_INFO, "dvr",
+ tvhinfo(LS_DVR,
" # %-16s %-4s %-10s %-12s %-11s %-8s",
"type",
"lang",
htsmsg_add_u32(e, "ancillary_id", ssc->ssc_ancillary_id);
}
- tvhlog(LOG_INFO, "dvr",
+ tvhinfo(LS_DVR,
"%2d %-16s %-4s %-10s %-12s %-11s %-8s %s",
ssc->ssc_index,
streaming_component_type2txt(ssc->ssc_type),
if (*started &&
muxer_reconfigure(prch->prch_muxer, ss) < 0) {
- tvhlog(LOG_WARNING,
- "dvr", "Unable to reconfigure \"%s\"",
- dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL));
+ tvhwarn(LS_DVR, "Unable to reconfigure \"%s\"",
+ dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL));
// Try to restart the recording if the muxer doesn't
// support reconfiguration of the streams.
// Recording is completed
dvr_entry_set_state(de, de->de_sched_state, de->de_rec_state, SM_CODE_OK);
- tvhlog(LOG_INFO,
- "dvr", "Recording completed: \"%s\"",
- dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL));
+ tvhinfo(LS_DVR, "Recording completed: \"%s\"",
+ dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL));
goto fin;
// Error during recording
dvr_rec_set_state(de, DVR_RS_ERROR, sm->sm_code);
- tvhlog(LOG_ERR,
- "dvr", "Recording stopped: \"%s\": %s",
- dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL),
- streaming_code2txt(sm->sm_code));
+ tvherror(LS_DVR, "Recording stopped: \"%s\": %s",
+ dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL),
+ streaming_code2txt(sm->sm_code));
fin:
streaming_queue_clear(&backlog);
if(de->de_last_error != code) {
dvr_rec_set_state(de, DVR_RS_ERROR, code);
- tvhlog(LOG_ERR,
- "dvr", "Streaming error: \"%s\": %s",
- dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL),
- streaming_code2txt(code));
+ tvherror(LS_DVR, "Streaming error: \"%s\": %s",
+ dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL),
+ streaming_code2txt(code));
}
}
break;
if (de->de_last_error != sm->sm_code) {
dvr_rec_set_state(de, DVR_RS_PENDING, sm->sm_code);
- tvhlog(LOG_ERR,
- "dvr", "Recording unable to start: \"%s\": %s",
- dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL),
- streaming_code2txt(sm->sm_code));
+ tvherror(LS_DVR, "Recording unable to start: \"%s\": %s",
+ dvr_get_filename(de) ?: lang_str_get(de->de_title, NULL),
+ streaming_code2txt(sm->sm_code));
}
break;
if (idnode_insert(&dte->dte_id, uuid, &dvr_timerec_entry_class, 0)) {
if (uuid)
- tvhwarn("dvr", "invalid timerec entry uuid '%s'", uuid);
+ tvhwarn(LS_DVR, "invalid timerec entry uuid '%s'", uuid);
free(dte);
return NULL;
}
{
idnode_update(&dte->dte_id, conf);
idnode_changed(&dte->dte_id);
- tvhlog(LOG_INFO, "timerec", "\"%s\" on \"%s\": Updated", dte->dte_title ? dte->dte_title : "",
+ tvhinfo(LS_DVR, "timerec \"%s\" on \"%s\": Updated", dte->dte_title ? dte->dte_title : "",
(dte->dte_channel && dte->dte_channel->ch_name) ? dte->dte_channel->ch_name : "any channel");
}
{
dvr_timerec_entry_t *dte;
- tvhtrace("dvr", "timerec update");
+ tvhtrace(LS_DVR, "timerec update");
/* check all entries */
TAILQ_FOREACH(dte, &timerec_entries, dte_link) {
filename = htsmsg_get_str(m, "filename");
if(filename == NULL ||
statvfs(filename, &vst) < 0 || stat(filename, &st) < 0) {
- tvhlog(LOG_ERR, "dvr", "unable to stat file '%s'", filename);
+ tvherror(LS_DVR, "unable to stat file '%s'", filename);
goto rem;
}
vfs = dvr_vfs_find(vfs, tvh_fsid(vst.f_fsid));
/* If calling this function to fast after the previous call, statvfs might be wrong/not updated yet */
/* So we are risking to delete more files than needed, so allow 10s for the system to handle previous deletes */
if (dvr_disk_space_config_lastdelete + sec2mono(10) > mclk()) {
- tvhlog(LOG_WARNING, "dvr","disk space cleanup for config \"%s\" is not allowed now", configName);
+ tvhwarn(LS_DVR,"disk space cleanup for config \"%s\" is not allowed now", configName);
return -1;
}
if (diskBytes < requiredBytes) {
- tvhlog(LOG_WARNING, "dvr","disk space cleanup for config \"%s\", required free space \"%"PRId64" MiB\" is smaller than the total disk size!",
- configName, TOMIB(requiredBytes));
+ tvhwarn(LS_DVR,"disk space cleanup for config \"%s\", required free space \"%"PRId64" MiB\" is smaller than the total disk size!",
+ configName, TOMIB(requiredBytes));
if (maximalBytes >= usedBytes)
return -1;
}
- tvhtrace("dvr", "disk space cleanup for config \"%s\", required/current free space \"%"PRId64"/%"PRId64" MiB\", required/current used space \"%"PRId64"/%"PRId64" MiB\"",
+ tvhtrace(LS_DVR, "disk space cleanup for config \"%s\", required/current free space \"%"PRId64"/%"PRId64" MiB\", required/current used space \"%"PRId64"/%"PRId64" MiB\"",
configName, TOMIB(requiredBytes), TOMIB(availBytes), TOMIB(maximalBytes), TOMIB(usedBytes));
while (availBytes < requiredBytes || ((maximalBytes < usedBytes) && cfg->dvr_cleanup_threshold_used)) {
localtime_r(&stoptime, &tm);
if (strftime(tbuf, sizeof(tbuf), "%F %T", &tm) <= 0)
*tbuf = 0;
- tvhlog(LOG_INFO, "dvr","Delete \"until space needed\" recording \"%s\" with stop time \"%s\" and file size \"%"PRId64" MB\"",
- lang_str_get(oldest->de_title, NULL), tbuf, TOMIB(fileSize));
+ tvhinfo(LS_DVR,"Delete \"until space needed\" recording \"%s\" with stop time \"%s\" and file size \"%"PRId64" MB\"",
+ lang_str_get(oldest->de_title, NULL), tbuf, TOMIB(fileSize));
dvr_disk_space_config_lastdelete = mclk();
if (dvr_entry_get_retention_days(oldest) == DVR_RET_ONREMOVE) {
idnode_changed(&oldest->de_id);
}
} else {
- tvhlog(LOG_WARNING, "dvr", "%s \"until space needed\" recordings found for config \"%s\", you are running out of disk space very soon!",
- loops > 0 ? "Not enough" : "No", configName);
+ tvhwarn(LS_DVR, "%s \"until space needed\" recordings found for config \"%s\", you are running out of disk space very soon!",
+ loops > 0 ? "Not enough" : "No", configName);
goto finish;
}
loops++;
if (loops >= 10) {
- tvhlog(LOG_WARNING, "dvr", "Not able to clear the required disk space after deleting %i \"until space needed\" recordings...", loops);
+ tvhwarn(LS_DVR, "Not able to clear the required disk space after deleting %i \"until space needed\" recordings...", loops);
goto finish;
}
}
finish:
- tvhtrace("dvr", "disk space cleanup for config \"%s\", cleared \"%"PRId64" MB\" of disk space, new free disk space \"%"PRId64" MiB\", new used disk space \"%"PRId64" MiB\"",
+ tvhtrace(LS_DVR, "disk space cleanup for config \"%s\", cleared \"%"PRId64" MB\" of disk space, new free disk space \"%"PRId64" MiB\", new used disk space \"%"PRId64" MiB\"",
configName, TOMIB(clearedBytes), TOMIB(availBytes), TOMIB(usedBytes));
return clearedBytes;
continue;
if (availBytes < requiredBytes) {
- tvhlog(LOG_WARNING, "dvr","running out of free disk space for dvr config \"%s\", required free space \"%"PRId64" MiB\", current free space \"%"PRId64" MiB\"",
- cfg != dvr_config_find_by_name(NULL) ? cfg->dvr_config_name : "Default profile",
- TOMIB(requiredBytes), TOMIB(availBytes));
+ tvhwarn(LS_DVR,"running out of free disk space for dvr config \"%s\", required free space \"%"PRId64" MiB\", current free space \"%"PRId64" MiB\"",
+ cfg != dvr_config_find_by_name(NULL) ? cfg->dvr_config_name : "Default profile",
+ TOMIB(requiredBytes), TOMIB(availBytes));
} else {
- tvhlog(LOG_WARNING, "dvr","running out of used disk space for dvr config \"%s\", required used space \"%"PRId64" MiB\", current used space \"%"PRId64" MiB\"",
- cfg != dvr_config_find_by_name(NULL) ? cfg->dvr_config_name : "Default profile",
- TOMIB(maximalBytes), TOMIB(usedBytes));
+ tvhwarn(LS_DVR,"running out of used disk space for dvr config \"%s\", required used space \"%"PRId64" MiB\", current used space \"%"PRId64" MiB\"",
+ cfg != dvr_config_find_by_name(NULL) ? cfg->dvr_config_name : "Default profile",
+ TOMIB(maximalBytes), TOMIB(usedBytes));
}
/* only cleanup one directory at the time as the system needs time to delete the actual files */
goto checking;
} else {
checking:
- tvhtrace("dvr", "checking free and used disk space for config \"%s\" : OK",
+ tvhtrace(LS_DVR, "checking free and used disk space for config \"%s\" : OK",
cfg != dvr_config_find_by_name(NULL) ? cfg->dvr_config_name : "Default profile");
}
}
/* Remove unref'd */
while ((eo = LIST_FIRST(&epg_object_unref))) {
- tvhtrace("epg",
+ tvhtrace(LS_EPG,
"unref'd object %u (%s) created during update", eo->id, eo->uri);
LIST_REMOVE(eo, un_link);
eo->destroy(eo);
( epg_object_t *eo, epg_object_tree_t *tree )
{
assert(eo->refcount == 0);
- tvhtrace("epg", "eo [%p, %u, %d, %s] destroy",
+ tvhtrace(LS_EPG, "eo [%p, %u, %d, %s] destroy",
eo, eo->id, eo->type, eo->uri);
if (eo->uri) free(eo->uri);
if (tree) RB_REMOVE(tree, eo, uri_link);
static void _epg_object_getref ( void *o )
{
epg_object_t *eo = o;
- tvhtrace("epg", "eo [%p, %u, %d, %s] getref %d",
+ tvhtrace(LS_EPG, "eo [%p, %u, %d, %s] getref %d",
eo, eo->id, eo->type, eo->uri, eo->refcount+1);
if (eo->refcount == 0) LIST_REMOVE(eo, un_link);
eo->refcount++;
static void _epg_object_putref ( void *o )
{
epg_object_t *eo = o;
- tvhtrace("epg", "eo [%p, %u, %d, %s] putref %d",
+ tvhtrace(LS_EPG, "eo [%p, %u, %d, %s] putref %d",
eo, eo->id, eo->type, eo->uri, eo->refcount-1);
assert(eo->refcount>0);
eo->refcount--;
{
epg_object_t *eo = o;
if (!eo->_updated) {
- tvhtrace("epg", "eo [%p, %u, %d, %s] updated",
+ tvhtrace(LS_EPG, "eo [%p, %u, %d, %s] updated",
eo, eo->id, eo->type, eo->uri);
eo->_updated = 1;
eo->updated = gclk();
if (!eo->id) eo->id = ++_epg_object_idx;
if (!eo->getref) eo->getref = _epg_object_getref;
if (!eo->putref) eo->putref = _epg_object_putref;
- tvhtrace("epg", "eo [%p, %u, %d, %s] created",
+ tvhtrace(LS_EPG, "eo [%p, %u, %d, %s] created",
eo, eo->id, eo->type, eo->uri);
_epg_object_set_updated(eo);
LIST_INSERT_HEAD(&epg_object_unref, eo, un_link);
if (!RB_INSERT_SORTED(epg_id_tree(eo), eo, id_link, _id_cmp))
break;
if (id) {
- tvherror("epg", "fatal error, duplicate EPG ID");
+ tvherror(LS_EPG, "fatal error, duplicate EPG ID");
abort();
}
eo->id = ++_epg_object_idx;
static htsmsg_t * _epg_object_serialize ( void *o )
{
epg_object_t *eo = o;
- tvhtrace("epg", "eo [%p, %u, %d, %s] serialize",
+ tvhtrace(LS_EPG, "eo [%p, %u, %d, %s] serialize",
eo, eo->id, eo->type, eo->uri);
htsmsg_t *m;
if (!eo->id || !eo->type) return NULL;
_epg_object_set_updated(eo);
eo->updated = s64;
}
- tvhtrace("epg", "eo [%p, %u, %d, %s] deserialize",
+ tvhtrace(LS_EPG, "eo [%p, %u, %d, %s] deserialize",
eo, eo->id, eo->type, eo->uri);
return eo;
}
{
epg_brand_t *eb = (epg_brand_t*)eo;
if (LIST_FIRST(&eb->seasons)) {
- tvhlog(LOG_CRIT, "epg", "attempt to destroy brand with seasons");
+ tvhlog(LOG_CRIT, LS_EPG, "attempt to destroy brand with seasons");
assert(0);
}
if (LIST_FIRST(&eb->episodes)) {
- tvhlog(LOG_CRIT, "epg", "attempt to destroy brand with episodes");
+ tvhlog(LOG_CRIT, LS_EPG, "attempt to destroy brand with episodes");
assert(0);
}
if (eb->title) lang_str_destroy(eb->title);
{
epg_season_t *es = (epg_season_t*)eo;
if (LIST_FIRST(&es->episodes)) {
- tvhlog(LOG_CRIT, "epg", "attempt to destory season with episodes");
+ tvhlog(LOG_CRIT, LS_EPG, "attempt to destory season with episodes");
assert(0);
}
if (es->brand) _epg_brand_rem_season(es->brand, es);
epg_genre_t *g;
epg_episode_t *ee = eo;
if (LIST_FIRST(&ee->broadcasts)) {
- tvhlog(LOG_CRIT, "epg", "attempt to destroy episode with broadcasts");
+ tvhlog(LOG_CRIT, LS_EPG, "attempt to destroy episode with broadcasts");
assert(0);
}
if (ee->brand) _epg_brand_rem_episode(ee->brand, ee);
{
epg_serieslink_t *es = (epg_serieslink_t*)eo;
if (LIST_FIRST(&es->broadcasts)) {
- tvhlog(LOG_CRIT, "epg", "attempt to destory series link with broadcasts");
+ tvhlog(LOG_CRIT, LS_EPG, "attempt to destory series link with broadcasts");
assert(0);
}
_epg_object_destroy(eo, &epg_serieslinks);
/* Expire */
if ( ebc->stop <= gclk() ) {
- tvhlog(LOG_DEBUG, "epg", "expire event %u (%s) from %s",
- ebc->id, epg_broadcast_get_title(ebc, NULL),
- channel_get_name(ch));
+ tvhdebug(LS_EPG, "expire event %u (%s) from %s",
+ ebc->id, epg_broadcast_get_title(ebc, NULL),
+ channel_get_name(ch));
_epg_channel_rem_broadcast(ch, ebc, NULL);
continue; // skip to next
/* Change (update HTSP) */
if (cur != ch->ch_epg_now || nxt != ch->ch_epg_next) {
- tvhlog(LOG_DEBUG, "epg", "now/next %u/%u set on %s",
- ch->ch_epg_now ? ch->ch_epg_now->id : 0,
- ch->ch_epg_next ? ch->ch_epg_next->id : 0,
- channel_get_name(ch));
- tvhlog(LOG_DEBUG, "epg", "inform HTSP of now event change on %s",
- channel_get_name(ch));
+ tvhdebug(LS_EPG, "now/next %u/%u set on %s",
+ ch->ch_epg_now ? ch->ch_epg_now->id : 0,
+ ch->ch_epg_next ? ch->ch_epg_next->id : 0,
+ channel_get_name(ch));
+ tvhdebug(LS_EPG, "inform HTSP of now event change on %s",
+ channel_get_name(ch));
htsp_channel_update_nownext(ch);
}
/* re-arm */
if (next) {
- tvhlog(LOG_DEBUG, "epg", "arm channel timer @ %"PRItime_t" for %s",
- next, channel_get_name(ch));
+ tvhdebug(LS_EPG, "arm channel timer @ %"PRItime_t" for %s",
+ next, channel_get_name(ch));
gtimer_arm_absn(&ch->ch_epg_timer, _epg_channel_timer_callback, ch, next);
}
_epg_object_create(ret);
// Note: sets updated
_epg_object_getref(ret);
- tvhtrace("epg", "added event %u (%s) on %s @ %"PRItime_t " to %"PRItime_t,
+ tvhtrace(LS_EPG, "added event %u (%s) on %s @ %"PRItime_t " to %"PRItime_t,
ret->id, epg_broadcast_get_title(ret, NULL),
channel_get_name(ch), ret->start, ret->stop);
} else {
ret->stop = (*bcast)->stop;
_epg_object_set_updated(ret);
- tvhtrace("epg", "updated event %u (%s) on %s @ %"PRItime_t " to %"PRItime_t,
+ tvhtrace(LS_EPG, "updated event %u (%s) on %s @ %"PRItime_t " to %"PRItime_t,
ret->id, epg_broadcast_get_title(ret, NULL),
channel_get_name(ch), ret->start, ret->stop);
}
while ((ebc = RB_PREV(ret, sched_link)) != NULL) {
if (ebc->stop <= ret->start) break;
if (!_epg_object_can_remove(ebc, ret)) {
- tvhtrace("epg", "grabber for event %u has lower priority than overlap (b), removing", ebc->id);
+ tvhtrace(LS_EPG, "grabber for event %u has lower priority than overlap (b), removing", ebc->id);
_epg_channel_rem_broadcast(ch, ret, NULL);
return NULL;
}
- tvhtrace("epg", "remove overlap (b) event %u (%s) on %s @ %"PRItime_t " to %"PRItime_t,
+ tvhtrace(LS_EPG, "remove overlap (b) event %u (%s) on %s @ %"PRItime_t " to %"PRItime_t,
ebc->id, epg_broadcast_get_title(ebc, NULL),
channel_get_name(ch), ebc->start, ebc->stop);
_epg_channel_rem_broadcast(ch, ebc, ret);
while ((ebc = RB_NEXT(ret, sched_link)) != NULL) {
if (ebc->start >= ret->stop) break;
if (!_epg_object_can_remove(ebc, ret)) {
- tvhtrace("epg", "grabber for event %u has lower priority than overlap (a), removing", ebc->id);
+ tvhtrace(LS_EPG, "grabber for event %u has lower priority than overlap (a), removing", ebc->id);
_epg_channel_rem_broadcast(ch, ret, NULL);
return NULL;
}
- tvhtrace("epg", "remove overlap (a) event %u (%s) on %s @ %"PRItime_t " to %"PRItime_t,
+ tvhtrace(LS_EPG, "remove overlap (a) event %u (%s) on %s @ %"PRItime_t " to %"PRItime_t,
ebc->id, epg_broadcast_get_title(ebc, NULL),
channel_get_name(ch), ebc->start, ebc->stop);
_epg_channel_rem_broadcast(ch, ebc, ret);
/* Unknown */
} else {
- tvhlog(LOG_DEBUG, "epgdb", "malformed database section [%s]", *sect);
+ tvhdebug(LS_EPGDB, "malformed database section [%s]", *sect);
//htsmsg_print(m);
}
}
if ( fd < 0 )
fd = hts_settings_open_file(0, "epgdb");
if ( fd < 0 ) {
- tvhlog(LOG_DEBUG, "epgdb", "database does not exist");
+ tvhdebug(LS_EPGDB, "database does not exist");
return;
}
act.sa_sigaction = epg_mmap_sigbus;
act.sa_flags = SA_SIGINFO;
if (sigaction(SIGBUS, &act, &oldact)) {
- tvhlog(LOG_ERR, "epgdb", "failed to install SIGBUS handler");
+ tvherror(LS_EPGDB, "failed to install SIGBUS handler");
close(fd);
return;
}
/* Map file to memory */
if ( fstat(fd, &st) != 0 ) {
- tvhlog(LOG_ERR, "epgdb", "failed to detect database size");
+ tvherror(LS_EPGDB, "failed to detect database size");
goto end;
}
if ( !st.st_size ) {
- tvhlog(LOG_DEBUG, "epgdb", "database is empty");
+ tvhdebug(LS_EPGDB, "database is empty");
goto end;
}
remain = st.st_size;
rp = mem = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
if ( mem == MAP_FAILED ) {
- tvhlog(LOG_ERR, "epgdb", "failed to mmap database");
+ tvherror(LS_EPGDB, "failed to mmap database");
goto end;
}
if (sigsetjmp(epg_mmap_env, 1)) {
- tvhlog(LOG_ERR, "epgdb", "failed to read from mapped file");
+ tvherror(LS_EPGDB, "failed to read from mapped file");
if (mem)
munmap(mem, st.st_size);
goto end;
#if ENABLE_ZLIB
if (remain > 12 && memcmp(rp, "\xff\xffGZIP00", 8) == 0) {
uint32_t orig = (rp[8] << 24) | (rp[9] << 16) | (rp[10] << 8) | rp[11];
- tvhlog(LOG_INFO, "epgdb", "gzip format detected, inflating (ratio %.1f%%)",
+ tvhinfo(LS_EPGDB, "gzip format detected, inflating (ratio %.1f%%)",
(float)((remain * 100.0) / orig));
rp = zlib_mem = tvh_gzip_inflate(rp + 12, remain - 12, orig);
remain = rp ? orig : 0;
/* Safety check */
if ((int64_t)msglen > remain) {
- tvhlog(LOG_ERR, "epgdb", "corruption detected, some/all data lost");
+ tvherror(LS_EPGDB, "corruption detected, some/all data lost");
break;
}
}
/* Stats */
- tvhlog(LOG_INFO, "epgdb", "loaded v%d", ver);
- tvhlog(LOG_INFO, "epgdb", " config %d", stats.config.total);
- tvhlog(LOG_INFO, "epgdb", " channels %d", stats.channels.total);
- tvhlog(LOG_INFO, "epgdb", " brands %d", stats.brands.total);
- tvhlog(LOG_INFO, "epgdb", " seasons %d", stats.seasons.total);
- tvhlog(LOG_INFO, "epgdb", " episodes %d", stats.episodes.total);
- tvhlog(LOG_INFO, "epgdb", " broadcasts %d", stats.broadcasts.total);
+ tvhinfo(LS_EPGDB, "loaded v%d", ver);
+ tvhinfo(LS_EPGDB, " config %d", stats.config.total);
+ tvhinfo(LS_EPGDB, " channels %d", stats.channels.total);
+ tvhinfo(LS_EPGDB, " brands %d", stats.brands.total);
+ tvhinfo(LS_EPGDB, " seasons %d", stats.seasons.total);
+ tvhinfo(LS_EPGDB, " episodes %d", stats.episodes.total);
+ tvhinfo(LS_EPGDB, " broadcasts %d", stats.broadcasts.total);
/* Close file */
munmap(mem, st.st_size);
size_t size = sb->sb_ptr;
int fd, r;
- tvhinfo("epgdb", "save start");
+ tvhinfo(LS_EPGDB, "save start");
fd = hts_settings_open_file(1, "epgdb.v%d", EPG_DB_VERSION);
if (fd >= 0) {
#if ENABLE_ZLIB
r = tvh_write(fd, sb->sb_data, sb->sb_ptr);
close(fd);
if (r)
- tvherror("epgdb", "write error (size %zd)", size);
+ tvherror(LS_EPGDB, "write error (size %zd)", size);
else
- tvhinfo("epgdb", "stored (size %zd)", size);
+ tvhinfo(LS_EPGDB, "stored (size %zd)", size);
} else
- tvherror("epgdb", "unable to open epgdb file");
+ tvherror(LS_EPGDB, "unable to open epgdb file");
sbuf_free(sb);
free(sb);
}
if (!sb)
return;
- tvhinfo("epgdb", "snapshot start");
+ tvhinfo(LS_EPGDB, "snapshot start");
sbuf_init_fixed(sb, EPG_DB_ALLOC_STEP);
tasklet_arm_alloc(epg_save_tsk_callback, sb);
/* Stats */
- tvhinfo("epgdb", "queued to save (size %d)", sb->sb_ptr);
- tvhinfo("epgdb", " brands %d", stats.brands.total);
- tvhinfo("epgdb", " seasons %d", stats.seasons.total);
- tvhinfo("epgdb", " episodes %d", stats.episodes.total);
- tvhinfo("epgdb", " broadcasts %d", stats.broadcasts.total);
+ tvhinfo(LS_EPGDB, "queued to save (size %d)", sb->sb_ptr);
+ tvhinfo(LS_EPGDB, " brands %d", stats.brands.total);
+ tvhinfo(LS_EPGDB, " seasons %d", stats.seasons.total);
+ tvhinfo(LS_EPGDB, " episodes %d", stats.episodes.total);
+ tvhinfo(LS_EPGDB, " broadcasts %d", stats.broadcasts.total);
return;
error:
- tvhlog(LOG_ERR, "epgdb", "failed to store epg to disk");
+ tvherror(LS_EPGDB, "failed to store epg to disk");
hts_settings_remove("epgdb.v%d", EPG_DB_VERSION);
sbuf_free(sb);
free(sb);
/* Process */
if ( data ) {
- tvhlog(LOG_INFO, mod->id, "grab took %"PRId64" seconds", mono2sec(tm2 - tm1));
+ tvhinfo(mod->subsys, "%s: grab took %"PRId64" seconds", mod->id, mono2sec(tm2 - tm1));
epggrab_module_parse(mod, data);
} else {
- tvhlog(LOG_WARNING, mod->id, "grab returned no data");
+ tvhwarn(mod->subsys, "%s: grab returned no data", mod->id);
}
}
EPGGRAB_EXT,
} type; ///< Grabber type
const char *id; ///< Module identifier
+ int subsys; ///< Module log subsystem
const char *saveid; ///< Module save identifier
const char *name; ///< Module name (for display)
int enabled; ///< Whether the module is enabled
{
epggrab_channel_t *ec = (epggrab_channel_t *)ilm->ilm_in1;
channel_t *ch = (channel_t *)ilm->ilm_in2;
- tvhdebug(ec->mod->id, "unlinking %s from %s",
- ec->id, channel_get_name(ch));
+ tvhdebug(ec->mod->subsys, "%s: unlinking %s from %s",
+ ec->mod->id, ec->id, channel_get_name(ch));
idnode_list_unlink(ilm, delconf ? ec : NULL);
}
}
/* New link */
- tvhdebug(ec->mod->id, "linking %s to %s",
- ec->id, channel_get_name(ch));
+ tvhdebug(ec->mod->subsys, "%s: linking %s to %s",
+ ec->mod->id, ec->id, channel_get_name(ch));
ilm = idnode_list_link(&ec->idnode, &ec->channels,
&ch->ch_id, &ch->ch_epggrab,
ec = calloc(1, sizeof(*ec));
if (idnode_insert(&ec->idnode, uuid, &epggrab_channel_class, 0)) {
if (uuid)
- tvherror("epggrab", "invalid uuid '%s'", uuid);
+ tvherror(LS_EPGGRAB, "invalid uuid '%s'", uuid);
free(ec);
return NULL;
}
TAILQ_INSERT_TAIL(&epggrab_channel_entries, ec, all_link);
if (RB_INSERT_SORTED(&owner->channels, ec, link, _ch_id_cmp)) {
- tvherror("epggrab", "removing duplicate channel id '%s' (uuid '%s')", ec->id, uuid);
+ tvherror(LS_EPGGRAB, "removing duplicate channel id '%s' (uuid '%s')", ec->id, uuid);
epggrab_channel_destroy(ec, 1, 0);
return NULL;
}
epggrab_module_t *epggrab_module_create
( epggrab_module_t *skel, const idclass_t *cls,
- const char *id, const char *saveid,
+ const char *id, int subsys, const char *saveid,
const char *name, int priority )
{
assert(skel);
/* Setup */
skel->id = strdup(id);
+ skel->subsys = subsys;
skel->saveid = strdup(saveid ?: id);
skel->name = strdup(name);
skel->priority = priority;
/* Insert */
assert(!epggrab_module_find_by_id(id));
LIST_INSERT_HEAD(&epggrab_modules, skel, link);
- tvhlog(LOG_INFO, "epggrab", "module %s created", id);
+ tvhinfo(LS_EPGGRAB, "module %s created", id);
idnode_insert(&skel->idnode, NULL, cls, 0);
htsmsg_destroy(data);
/* Debug stats */
- tvhlog(LOG_INFO, mod->id, "parse took %"PRId64" seconds", mono2sec(tm2 - tm1));
- tvhlog(LOG_INFO, mod->id, " channels tot=%5d new=%5d mod=%5d",
- stats.channels.total, stats.channels.created,
- stats.channels.modified);
- tvhlog(LOG_INFO, mod->id, " brands tot=%5d new=%5d mod=%5d",
- stats.brands.total, stats.brands.created,
- stats.brands.modified);
- tvhlog(LOG_INFO, mod->id, " seasons tot=%5d new=%5d mod=%5d",
- stats.seasons.total, stats.seasons.created,
- stats.seasons.modified);
- tvhlog(LOG_INFO, mod->id, " episodes tot=%5d new=%5d mod=%5d",
- stats.episodes.total, stats.episodes.created,
- stats.episodes.modified);
- tvhlog(LOG_INFO, mod->id, " broadcasts tot=%5d new=%5d mod=%5d",
- stats.broadcasts.total, stats.broadcasts.created,
- stats.broadcasts.modified);
+ tvhinfo(mod->subsys, "%s: parse took %"PRId64" seconds", mod->id, mono2sec(tm2 - tm1));
+ tvhinfo(mod->subsys, "%s: channels tot=%5d new=%5d mod=%5d",
+ mod->id, stats.channels.total, stats.channels.created,
+ stats.channels.modified);
+ tvhinfo(mod->subsys, "%s: brands tot=%5d new=%5d mod=%5d",
+ mod->id, stats.brands.total, stats.brands.created,
+ stats.brands.modified);
+ tvhinfo(mod->subsys, "%s: seasons tot=%5d new=%5d mod=%5d",
+ mod->id, stats.seasons.total, stats.seasons.created,
+ stats.seasons.modified);
+ tvhinfo(mod->subsys, "%s: episodes tot=%5d new=%5d mod=%5d",
+ mod->id, stats.episodes.total, stats.episodes.created,
+ stats.episodes.modified);
+ tvhinfo(mod->subsys, "%s: broadcasts tot=%5d new=%5d mod=%5d",
+ mod->id, stats.broadcasts.total, stats.broadcasts.created,
+ stats.broadcasts.modified);
}
/* **************************************************************************
HTSMSG_FOREACH(f, m) {
if ((e = htsmsg_get_map_by_field(f))) {
id = htsmsg_get_str(e, "modid") ?: modid;
- if (mod == NULL || strcmp(mod->id, id))
+ if (mod == NULL || strcmp(mod->id, id))
mod = epggrab_module_find_by_id(id);
if (mod)
epggrab_channel_create(mod, e, f->hmf_name);
epggrab_module_int_t *epggrab_module_int_create
( epggrab_module_int_t *skel, const idclass_t *cls,
- const char *id, const char *saveid,
+ const char *id, int subsys, const char *saveid,
const char *name, int priority,
const char *path,
char* (*grab) (void*m),
/* Pass through */
epggrab_module_create((epggrab_module_t*)skel,
cls ?: &epggrab_mod_int_class,
- id, saveid, name, priority);
+ id, subsys, saveid, name, priority);
/* Int data */
skel->type = EPGGRAB_INT;
char *path;
/* Debug */
- tvhlog(LOG_INFO, mod->id, "grab %s", mod->path);
+ tvhinfo(mod->subsys, "%s: grab %s", mod->id, mod->path);
/* Extra arguments */
if (mod->args && mod->args[0]) {
/* Arguments */
if (spawn_parse_args(&argv, 64, path, NULL)) {
- tvhlog(LOG_ERR, mod->id, "unable to parse arguments");
+ tvherror(mod->subsys, "%s: unable to parse arguments", mod->id);
return NULL;
}
error:
if (rd >= 0)
close(rd);
- tvhlog(LOG_ERR, mod->id, "no output detected");
+ tvherror(mod->subsys, "%s: no output detected", mod->id);
return NULL;
}
/* Extract */
ret = htsmsg_xml_deserialize(c, errbuf, sizeof(errbuf));
if (!ret)
- tvhlog(LOG_ERR, mod->id, "htsmsg_xml_deserialize error %s", errbuf);
+ tvherror(mod->subsys, "%s: htsmsg_xml_deserialize error %s", mod->id, errbuf);
return ret;
}
/* Process */
if ( data ) {
- tvhlog(LOG_INFO, mod->id, "grab took %"PRItime_t" seconds", tm2 - tm1);
+ tvhinfo(mod->subsys, "%s: grab took %"PRItime_t" seconds", mod->id, tm2 - tm1);
epggrab_module_parse(mod, data);
/* Failed */
} else {
- tvhlog(LOG_ERR, mod->id, "failed to read data");
+ tvherror(mod->subsys, "%s: failed to read data", mod->id);
}
}
{
int s;
epggrab_module_ext_t *mod = (epggrab_module_ext_t*)p;
- tvhlog(LOG_INFO, mod->id, "external socket enabled");
+ tvhinfo(mod->subsys, "%s: external socket enabled", mod->id);
while ( mod->enabled && mod->sock ) {
- tvhlog(LOG_DEBUG, mod->id, "waiting for connection");
+ tvhdebug(mod->subsys, "%s: waiting for connection", mod->id);
s = accept(mod->sock, NULL, NULL);
if (s <= 0) continue;
- tvhlog(LOG_DEBUG, mod->id, "got connection %d", s);
+ tvhdebug(mod->subsys, "%s: got connection %d", mod->id, s);
_epggrab_socket_handler(mod, s);
close(s);
}
- tvhlog(LOG_DEBUG, mod->id, "terminated");
+ tvhdebug(mod->subsys, "%s: terminated", mod->id);
return NULL;
}
strncpy(addr.sun_path, mod->path, 100);
if ( bind(mod->sock, (struct sockaddr*)&addr,
sizeof(struct sockaddr_un)) != 0 ) {
- tvhlog(LOG_ERR, mod->id, "failed to bind socket");
+ tvherror(mod->subsys, "%s: failed to bind socket", mod->id);
close(mod->sock);
mod->sock = 0;
return 0;
}
if ( listen(mod->sock, 5) != 0 ) {
- tvhlog(LOG_ERR, mod->id, "failed to listen on socket");
+ tvherror(mod->subsys, "%s: failed to listen on socket", mod->id);
close(mod->sock);
mod->sock = 0;
return 0;
}
- tvhlog(LOG_DEBUG, mod->id, "starting socket thread");
+ tvhdebug(mod->subsys, "%s: starting socket thread", mod->id);
pthread_attr_init(&tattr);
mod->active = 1;
tvhthread_create(&mod->tid, &tattr, _epggrab_socket_thread, mod, "epggrabso");
*/
epggrab_module_ext_t *epggrab_module_ext_create
( epggrab_module_ext_t *skel, const idclass_t *cls,
- const char *id, const char *saveid,
+ const char *id, int subsys, const char *saveid,
const char *name, int priority, const char *sockid,
int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta),
htsmsg_t* (*trans) (void *mod, char *data) )
hts_settings_buildpath(path, sizeof(path), "epggrab/%s.sock", sockid);
epggrab_module_int_create((epggrab_module_int_t*)skel,
cls ?: &epggrab_mod_ext_class,
- id, saveid, name, priority, path,
+ id, subsys, saveid, name, priority, path,
NULL, parse, trans);
/* Local */
epggrab_module_ota_t *epggrab_module_ota_create
( epggrab_module_ota_t *skel,
- const char *id, const char *saveid,
+ const char *id, int subsys, const char *saveid,
const char *name, int priority,
epggrab_ota_module_ops_t *ops )
{
/* Pass through */
epggrab_module_create((epggrab_module_t*)skel,
&epggrab_mod_ota_class,
- id, saveid, name, priority);
+ id, subsys, saveid, name, priority);
/* Setup */
skel->type = EPGGRAB_OTA;
#if APS_DEBUG
int i = 0, j = 0;
char tmp[100];
- tvhlog(LOG_DEBUG, mod->id, " dtag 0x%02X len %d", dtag, dlen);
+ tvhdebug(mod->subsys, "%s: dtag 0x%02X len %d", mt->mt_name, dtag, dlen);
while (i < dlen) {
j += sprintf(tmp+j, "%02X ", buf[i]);
i++;
if ((i % 8) == 0 || (i == dlen)) {
- tvhlog(LOG_DEBUG, mod->id, " %s", tmp);
+ tvhdebug(mod->subsys, "%s: %s", mt->mt_name, tmp);
j = 0;
}
}
/* Find broadcast */
ebc = epg_broadcast_find_by_time(ch, mod, start, stop, 1, &save2, &changes2);
- tvhtrace("eit", "svc='%s', ch='%s', eid=%5d, start=%"PRItime_t","
- " stop=%"PRItime_t", ebc=%p",
+ tvhtrace(LS_TBL_EIT, "svc='%s', ch='%s', eid=%5d, start=%"PRItime_t","
+ " stop=%"PRItime_t", ebc=%p",
svc->s_dvb_svcname ?: "(null)", ch ? channel_get_name(ch) : "(null)",
eid, start, stop, ebc);
if (!ebc) return 0;
ptr += 2;
if (dllen < dlen) break;
- tvhtrace(mod->id, " dtag %02X dlen %d", dtag, dlen);
- tvhlog_hexdump(mod->id, ptr, dlen);
+ tvhtrace(mod->subsys, "%s: dtag %02X dlen %d", mod->id, dtag, dlen);
+ tvhlog_hexdump(mod->subsys, ptr, dlen);
switch (dtag) {
case DVB_DESC_SHORT_EVENT:
!mm->mm_eit_tsid_nocheck) {
if (mm->mm_onid != MPEGTS_ONID_NONE &&
mm->mm_tsid != MPEGTS_TSID_NONE)
- tvhtrace("eit",
+ tvhtrace(LS_TBL_EIT,
"invalid tsid found tid 0x%02X, onid:tsid %d:%d != %d:%d",
tableid, mm->mm_onid, mm->mm_tsid, onid, tsid);
mm = NULL;
/* Get service */
svc = mpegts_mux_find_service(mm, sid);
if (!svc) {
- tvhtrace("eit", "sid %i not found", sid);
+ tvhtrace(LS_TBL_EIT, "sid %i not found", sid);
goto done;
}
/* Freesat (3002/3003) */
if (!strcmp("uk_freesat", m->id)) {
- mpegts_table_add(dm, 0, 0, dvb_bat_callback, NULL, "bat", MT_CRC, 3002, MPS_WEIGHT_EIT);
+ mpegts_table_add(dm, 0, 0, dvb_bat_callback, NULL, "bat", LS_TBL_BASE, MT_CRC, 3002, MPS_WEIGHT_EIT);
pid = 3003;
/* Viasat Baltic (0x39) */
pid = DVB_EIT_PID;
opts = MT_RECORD;
}
- mpegts_table_add(dm, 0, 0, _eit_callback, map, m->id, MT_CRC | opts, pid, MPS_WEIGHT_EIT);
+ mpegts_table_add(dm, 0, 0, _eit_callback, map, m->id, LS_TBL_EIT, MT_CRC | opts, pid, MPS_WEIGHT_EIT);
// TODO: might want to limit recording to EITpf only
- tvhlog(LOG_DEBUG, m->id, "installed table handlers");
+ tvhdebug(m->subsys, "%s: installed table handlers", m->id);
return 0;
}
.tune = _eit_tune,
};
- epggrab_module_ota_create(NULL, "eit", NULL, "EIT: DVB Grabber", 1, &ops);
- epggrab_module_ota_create(NULL, "uk_freesat", NULL, "UK: Freesat", 5, &ops);
- epggrab_module_ota_create(NULL, "uk_freeview", NULL, "UK: Freeview", 5, &ops);
- epggrab_module_ota_create(NULL, "viasat_baltic", NULL, "VIASAT: Baltic", 5, &ops);
- epggrab_module_ota_create(NULL, "Bulsatcom_39E", NULL, "Bulsatcom: Bula 39E", 5, &ops);
+ epggrab_module_ota_create(NULL, "eit", LS_TBL_EIT, NULL, "EIT: DVB Grabber", 1, &ops);
+ epggrab_module_ota_create(NULL, "uk_freesat", LS_TBL_EIT, NULL, "UK: Freesat", 5, &ops);
+ epggrab_module_ota_create(NULL, "uk_freeview", LS_TBL_EIT, NULL, "UK: Freeview", 5, &ops);
+ epggrab_module_ota_create(NULL, "viasat_baltic", LS_TBL_EIT, NULL, "VIASAT: Baltic", 5, &ops);
+ epggrab_module_ota_create(NULL, "Bulsatcom_39E", LS_TBL_EIT, NULL, "Bulsatcom: Bula 39E", 5, &ops);
}
void eit_done ( void )
int i = 4, r;
if (slen+4 > len) {
- tvhtrace("opentv", "event len (%d) > table len (%d)", slen+4, len);
+ tvhtrace(LS_OPENTV, "event len (%d) > table len (%d)", slen+4, len);
return -1;
}
memcpy(buf, text + match[1].rm_so, size);
buf[size] = '\0';
if (size) {
- tvhtrace("opentv"," pattern \"%s\" matches with '%s'", p->text, buf);
+ tvhtrace(LS_OPENTV," pattern \"%s\" matches with '%s'", p->text, buf);
return buf;
}
}
if (ev.start && ev.stop) {
ebc = epg_broadcast_find_by_time(ch, src, ev.start, ev.stop,
1, &save, &changes);
- tvhdebug("opentv", "find by time start %"PRItime_t " stop "
+ tvhdebug(LS_OPENTV, "find by time start %"PRItime_t " stop "
"%"PRItime_t " eid %d = %p",
ev.start, ev.stop, ev.eid, ebc);
save |= epg_broadcast_set_dvb_eid(ebc, ev.eid, &changes);
} else {
ebc = epg_broadcast_find_by_eid(ch, ev.eid);
- tvhdebug("opentv", "find by eid %d = %p", ev.eid, ebc);
+ tvhdebug(LS_OPENTV, "find by eid %d = %p", ev.eid, ebc);
if (ebc && ebc->grabber != src)
goto done;
merge = 1;
/* Summary / Description */
if (ev.summary) {
- tvhdebug("opentv", " summary '%s'", ev.summary);
+ tvhdebug(LS_OPENTV, " summary '%s'", ev.summary);
ls = lang_str_create2(ev.summary, lang);
save |= epg_broadcast_set_summary(ebc, ls, &changes);
lang_str_destroy(ls);
}
if (ev.desc) {
- tvhdebug("opentv", " desc '%s'", ev.desc);
+ tvhdebug(LS_OPENTV, " desc '%s'", ev.desc);
ls = lang_str_create2(ev.desc, lang);
save |= epg_broadcast_set_description(ebc, ls, &changes);
lang_str_destroy(ls);
if ((ee = epg_episode_find_by_broadcast(ebc, src, 1, &save, &changes3))) {
save |= epg_broadcast_set_episode(ebc, ee, &changes);
- tvhdebug("opentv", " find episode %p", ee);
+ tvhdebug(LS_OPENTV, " find episode %p", ee);
if (ev.title) {
- tvhdebug("opentv", " title '%s'", ev.title);
+ tvhdebug(LS_OPENTV, " title '%s'", ev.title);
/* try to cleanup the title */
if (_opentv_apply_pattern_list(buffer, sizeof(buffer), ev.title, &mod->p_cleanup_title)) {
- tvhtrace("opentv", " clean title '%s'", buffer);
+ tvhtrace(LS_OPENTV, " clean title '%s'", buffer);
s = buffer;
} else {
s = ev.title;
/* search for season number */
if (_opentv_apply_pattern_list(buffer, sizeof(buffer), ev.summary, &mod->p_snum))
if ((en.s_num = atoi(buffer)))
- tvhtrace("opentv"," extract season number %d", en.s_num);
+ tvhtrace(LS_OPENTV," extract season number %d", en.s_num);
/* ...for episode number */
if (_opentv_apply_pattern_list(buffer, sizeof(buffer), ev.summary, &mod->p_enum))
if ((en.e_num = atoi(buffer)))
- tvhtrace("opentv"," extract episode number %d", en.e_num);
+ tvhtrace(LS_OPENTV," extract episode number %d", en.e_num);
/* ...for part number */
if (_opentv_apply_pattern_list(buffer, sizeof(buffer), ev.summary, &mod->p_pnum)) {
if (buffer[0] >= 'a' && buffer[0] <= 'z')
if (buffer[0] >= 'A' && buffer[0] <= 'Z')
en.p_num = buffer[0] - 'A' + 1;
if (en.p_num)
- tvhtrace("opentv"," extract part number %d", en.p_num);
+ tvhtrace(LS_OPENTV," extract part number %d", en.p_num);
}
/* save any found number */
if (en.s_num || en.e_num || en.p_num)
/* ...for subtitle */
if (_opentv_apply_pattern_list(buffer, sizeof(buffer), ev.summary, &mod->p_subt)) {
- tvhtrace("opentv", " extract subtitle '%s'", buffer);
+ tvhtrace(LS_OPENTV, " extract subtitle '%s'", buffer);
ls = lang_str_create2(buffer, lang);
save |= epg_episode_set_subtitle(ee, ls, &changes3);
lang_str_destroy(ls);
cid = ((int)buf[i+3] << 8) | buf[i+4];
cnum = ((int)buf[i+5] << 8) | buf[i+6];
unk = ((int)buf[i+7] << 8) | buf[i+8];
- tvhtrace(mt->mt_name, " sid %04X type %02X cid %04X cnum %d unk %04X", sid, type, cid, cnum, unk);
+ tvhtrace(LS_OPENTV, "%s: sid %04X type %02X cid %04X cnum %d unk %04X", mt->mt_name, sid, type, cid, cnum, unk);
cnum = cnum < 65535 ? cnum : 0;
/* Find the service */
svc = mpegts_service_find(mm, sid, 0, 0, NULL);
- tvhtrace(mt->mt_name, " svc %p [%s]", svc, svc ? svc->s_nicename : NULL);
+ tvhtrace(LS_OPENTV, "%s: svc %p [%s]", mt->mt_name, svc, svc ? svc->s_nicename : NULL);
if (svc && svc->s_dvb_opentv_chnum != cnum &&
(!svc->s_dvb_opentv_id || svc->s_dvb_opentv_id == unk)) {
if (mod->bouquetid != nbid) {
if (mod->bouquet_auto) {
if (nbid < mod->bouquetid) {
- tvhwarn(mt->mt_name, "bouquet id set to %d, report this!", nbid);
+ tvhwarn(LS_OPENTV, "%s: bouquet id set to %d, report this!", mt->mt_name, nbid);
mod->bouquetid = nbid;
} else
goto skip_chnum;
} else
goto skip_chnum;
}
- tvhtrace(mt->mt_name, " cnum changed (%i != %i)", cnum, (int)svc->s_dvb_opentv_chnum);
+ tvhtrace(LS_OPENTV, "%s: cnum changed (%i != %i)", mt->mt_name, cnum, (int)svc->s_dvb_opentv_chnum);
svc->s_dvb_opentv_chnum = cnum;
svc->s_dvb_opentv_id = unk;
service_request_save((service_t *)svc, 0);
ec =_opentv_find_epggrab_channel(mod, cid, 1, &save);
ilm = LIST_FIRST(&ec->channels);
ch = (channel_t *)LIST_FIRST(&svc->s_channels)->ilm_in2;
- tvhtrace(mt->mt_name, " ec = %p, ilm = %p", ec, ilm);
+ tvhtrace(mt->mt_subsys, "%s: ec = %p, ilm = %p", mt->mt_name, ec, ilm);
if (ilm && ilm->ilm_in2 != &ch->ch_id) {
epggrab_channel_link_delete(ec, ch, 1);
done:
if (!r) {
sta->os_map->om_first = 0; /* valid data mark */
- tvhtrace(mt->mt_name, "pid %d complete remain %d",
- mt->mt_pid, sta->os_refcount-1);
+ tvhtrace(mt->mt_subsys, "%s: pid %d complete remain %d",
+ mt->mt_name, mt->mt_pid, sta->os_refcount-1);
/* Last PID */
if (sta->os_refcount == 1) {
if (mt->mt_table == OPENTV_TITLE_BASE) {
if (sta->os_titles_start + sec2mono(mod->titles_time) < mclk()) {
int *t;
- tvhinfo(mt->mt_name, "titles complete");
+ tvhinfo(mt->mt_subsys, "%s: titles complete", mt->mt_name);
/* Summaries */
t = mod->summary;
mt2 = mpegts_table_add(mt->mt_mux,
OPENTV_SUMMARY_BASE, OPENTV_TABLE_MASK,
opentv_table_callback, sta,
- mod->id, MT_CRC, *t++,
+ mod->id, LS_OPENTV, MT_CRC, *t++,
MPS_WEIGHT_EIT);
if (mt2) {
sta->os_refcount++;
}
} else {
if (sta->os_summaries_start + sec2mono(mod->summaries_time) < mclk()) {
- tvhinfo(mt->mt_name, "summaries complete");
+ tvhinfo(mt->mt_subsys, "%s: summaries complete", mt->mt_name);
mpegts_table_destroy(mt);
if (ota)
epggrab_ota_complete((epggrab_module_ota_t*)mod, ota);
/* Complete */
if (!r) {
- tvhinfo(mt->mt_name, "channels complete");
+ tvhinfo(mt->mt_subsys, "%s: channels complete", mt->mt_name);
/* Install event handlers */
t = mod->title;
mt2 = mpegts_table_add(mt->mt_mux,
OPENTV_TITLE_BASE, OPENTV_TABLE_MASK,
opentv_table_callback, mt->mt_opaque,
- mod->id, MT_CRC, *t++,
+ mod->id, LS_OPENTV, MT_CRC, *t++,
MPS_WEIGHT_EIT);
if (mt2) {
if (!mt2->mt_destroy) {
if (mod->tsid != mm->mm_tsid) return -1;
/* Install tables */
- tvhdebug(mod->id, "install table handlers");
+ tvhdebug(mod->subsys, "%s: install table handlers", mod->id);
/* Channels */
t = mod->channel;
}
mt = mpegts_table_add(mm, DVB_BAT_BASE, DVB_BAT_MASK,
opentv_bat_callback, sta,
- m->id, MT_CRC, *t++,
+ m->id, LS_OPENTV, MT_CRC, *t++,
MPS_WEIGHT_EIT);
if (mt) {
mt->mt_mux_cb = bat_desc;
pattern = calloc(1, sizeof(opentv_pattern_t));
pattern->text = strdup(s);
if (regcomp(&pattern->compiled, pattern->text, REG_EXTENDED)) {
- tvhlog(LOG_WARNING, "opentv", "error compiling pattern \"%s\"", pattern->text);
+ tvhwarn(LS_OPENTV, "error compiling pattern \"%s\"", pattern->text);
free(pattern->text);
free(pattern);
} else {
- tvhtrace("opentv", "compiled pattern \"%s\"", pattern->text);
+ tvhtrace(LS_OPENTV, "compiled pattern \"%s\"", pattern->text);
TAILQ_INSERT_TAIL(list, pattern, p_links);
}
}
opentv_genre_t *genre = calloc(1, sizeof(opentv_genre_t));
genre->id = (char*)id;
if (RB_INSERT_SORTED(&_opentv_genres, genre, h_link, _genre_cmp)) {
- tvhlog(LOG_DEBUG, "opentv", "ignore duplicate genre map %s", id);
+ tvhdebug(LS_OPENTV, "ignore duplicate genre map %s", id);
free(genre);
return 0;
} else {
if ((e = htsmsg_get_list(m, f->hmf_name))) {
if ((r = _opentv_genre_load_one(f->hmf_name, e))) {
if (r > 0)
- tvhlog(LOG_DEBUG, "opentv", "genre map %s loaded", f->hmf_name);
+ tvhdebug(LS_OPENTV, "genre map %s loaded", f->hmf_name);
else
- tvhlog(LOG_WARNING, "opentv", "genre map %s failed", f->hmf_name);
+ tvhwarn(LS_OPENTV, "genre map %s failed", f->hmf_name);
}
}
}
opentv_dict_t *dict = calloc(1, sizeof(opentv_dict_t));
dict->id = (char*)id;
if (RB_INSERT_SORTED(&_opentv_dicts, dict, h_link, _dict_cmp)) {
- tvhlog(LOG_DEBUG, "opentv", "ignore duplicate dictionary %s", id);
+ tvhdebug(LS_OPENTV, "ignore duplicate dictionary %s", id);
free(dict);
return 0;
} else {
if ((e = htsmsg_get_list(m, f->hmf_name))) {
if ((r = _opentv_dict_load_one(f->hmf_name, e))) {
if (r > 0)
- tvhlog(LOG_DEBUG, "opentv", "dictionary %s loaded", f->hmf_name);
+ tvhdebug(LS_OPENTV, "dictionary %s loaded", f->hmf_name);
else
- tvhlog(LOG_WARNING, "opentv", "dictionary %s failed", f->hmf_name);
+ tvhwarn(LS_OPENTV, "dictionary %s failed", f->hmf_name);
}
}
}
sprintf(nbuf, "OpenTV: %s", name);
mod = (opentv_module_t *)
epggrab_module_ota_create(calloc(1, sizeof(opentv_module_t)),
- ibuf, NULL, nbuf, 2, &ops);
+ ibuf, LS_OPENTV, NULL, nbuf, 2, &ops);
/* Add provider details */
mod->dict = dict;
mod->sid = sid;
mod->bouquetid = bouquetid;
mod->bouquet_auto = bouquetid == 0;
- mod->titles_time = MINMAX(titles_time, 0, 120);
- mod->summaries_time = MINMAX(summaries_time, 0, 600);
+ mod->titles_time = MAX(titles_time, 120);
+ mod->summaries_time = MAX(summaries_time, 600);
mod->channel = _pid_list_to_array(cl);
mod->title = _pid_list_to_array(tl);
mod->summary = _pid_list_to_array(sl);
if ((e = htsmsg_get_map_by_field(f))) {
if ((r = _opentv_prov_load_one(f->hmf_name, e))) {
if (r > 0)
- tvhlog(LOG_DEBUG, "opentv", "provider %s loaded", f->hmf_name);
+ tvhdebug(LS_OPENTV, "provider %s loaded", f->hmf_name);
else
- tvhlog(LOG_WARNING, "opentv", "provider %s failed", f->hmf_name);
+ tvhwarn(LS_OPENTV, "provider %s failed", f->hmf_name);
}
}
}
/* Load dictionaries */
if ((m = hts_settings_load("epggrab/opentv/dict")))
_opentv_dict_load(m);
- tvhlog(LOG_DEBUG, "opentv", "dictonaries loaded");
+ tvhdebug(LS_OPENTV, "dictonaries loaded");
/* Load genres */
if ((m = hts_settings_load("epggrab/opentv/genre")))
_opentv_genre_load(m);
- tvhlog(LOG_DEBUG, "opentv", "genre maps loaded");
+ tvhdebug(LS_OPENTV, "genre maps loaded");
/* Load providers */
if ((m = hts_settings_load("epggrab/opentv/prov")))
_opentv_prov_load(m);
- tvhlog(LOG_DEBUG, "opentv", "providers loaded");
+ tvhdebug(LS_OPENTV, "providers loaded");
}
void opentv_done ( void )
if (IS_EIT(pt->pt_type)) {
/* This is an EIT table */
mt = mpegts_table_add(ps->ps_mm, DVB_ATSC_EIT_BASE, DVB_ATSC_EIT_MASK,
- _psip_eit_callback, ps, "aeit",
+ _psip_eit_callback, ps, "aeit", LS_PSIP,
MT_CRC | MT_RECORD, pt->pt_pid,
MPS_WEIGHT_EIT);
} else if (IS_ETT(pt->pt_type)) {
/* This is an ETT table */
mt = mpegts_table_add(ps->ps_mm, DVB_ATSC_ETT_BASE, DVB_ATSC_ETT_MASK,
- _psip_ett_callback, ps, "ett",
+ _psip_ett_callback, ps, "ett", LS_PSIP,
MT_CRC | MT_RECORD, pt->pt_pid,
MPS_WEIGHT_ETT);
} else {
mt->mt_destroy = psip_status_destroy;
pt->pt_start = mclk();
pt->pt_table = mt;
- tvhtrace("psip", "table activated - pid 0x%04X type 0x%04X", mt->mt_pid, pt->pt_type);
+ tvhtrace(LS_PSIP, "table activated - pid 0x%04X type 0x%04X", mt->mt_pid, pt->pt_type);
return mt;
}
TAILQ_FOREACH(pt, &ps->ps_tables, pt_link) {
total++;
if (pt->pt_table && pt->pt_start + sec2mono(10) < mclk()) {
- tvhtrace("psip", "table late: pid = 0x%04X, type = 0x%04X\n", pt->pt_pid, pt->pt_type);
+ tvhtrace(LS_PSIP, "table late: pid = 0x%04X, type = 0x%04X\n", pt->pt_pid, pt->pt_type);
mpegts_table_destroy(pt->pt_table);
pt->pt_table = NULL;
}
}
tables = malloc(total * sizeof(psip_table_t *));
- tvhtrace("psip", "reschedule tables, total %d", total);
+ tvhtrace(LS_PSIP, "reschedule tables, total %d", total);
i = 0;
TAILQ_FOREACH(pt, &ps->ps_tables, pt_link)
#if 0
for (i = 0; i < total; i++) {
pt = tables[i];
- tvhtrace("psip", "sorted: pid = 0x%04X, type = 0x%04X, time = %"PRId64", complete %d\n",
+ tvhtrace(LS_PSIP, "sorted: pid = 0x%04X, type = 0x%04X, time = %"PRId64", complete %d\n",
pt->pt_pid, pt->pt_type, pt->pt_start, pt->pt_complete);
}
#endif
break;
}
- tvhtrace("psip", "pid 0x%04X completed, found = %d", mt->mt_pid, pt != NULL);
+ tvhtrace(LS_PSIP, "pid 0x%04X completed, found = %d", mt->mt_pid, pt != NULL);
mpegts_table_destroy(mt);
dlen = ((ptr[10+titlelen] & 0x0f) << 8) | ptr[11+titlelen];
size = titlelen + dlen + 12;
- tvhtrace("psip", " %03d: titlelen %d, dlen %d", i, titlelen, dlen);
+ tvhtrace(LS_PSIP, " %03d: titlelen %d, dlen %d", i, titlelen, dlen);
if (size > len) break;
title = atsc_get_string(ptr+10, titlelen);
if (title == NULL) continue;
- tvhtrace("psip", " %03d: [%s] eventid 0x%04x at %"PRItime_t", duration %d, title: '%s' (%d bytes)",
+ tvhtrace(LS_PSIP, " %03d: [%s] eventid 0x%04x at %"PRItime_t", duration %d, title: '%s' (%d bytes)",
i, ch ? channel_get_name(ch) : "(null)", eventid, start, length,
lang_str_get(title, NULL), titlelen);
save2 = save3 = changes2 = changes3 = 0;
ebc = epg_broadcast_find_by_time(ch, mod, start, stop, 1, &save2, &changes2);
- tvhtrace("psip", " eid=%5d, start=%"PRItime_t", stop=%"PRItime_t", ebc=%p",
+ tvhtrace(LS_PSIP, " eid=%5d, start=%"PRItime_t", stop=%"PRItime_t", ebc=%p",
eventid, start, stop, ebc);
if (!ebc) goto next;
break;
}
if (!svc) {
- tvhtrace("psip", "EIT with no associated channel found (tsid 0x%04x)", tsid);
+ tvhtrace(LS_PSIP, "EIT with no associated channel found (tsid 0x%04x)", tsid);
return -1;
}
&st, §, &last, &ver);
if (r == 0) goto complete;
if (r != 1) return r;
- tvhtrace("psip", "0x%04x: EIT tsid %04X (%s), ver %d",
+ tvhtrace(LS_PSIP, "0x%04x: EIT tsid %04X (%s), ver %d",
mt->mt_pid, tsid, svc->s_dvb_svcname, ver);
/* # events */
count = ptr[6];
- tvhtrace("psip", "event count %d data len %d", count, len);
+ tvhtrace(LS_PSIP, "event count %d data len %d", count, len);
ptr += 7;
len -= 7;
break;
}
if (!svc) {
- tvhtrace("psip", "ETT with no associated channel found (sourceid 0x%04x)", sourceid);
+ tvhtrace(LS_PSIP, "ETT with no associated channel found (sourceid 0x%04x)", sourceid);
return -1;
}
goto done;
if (!isevent) {
- tvhtrace("psip", "0x%04x: channel ETT tableid 0x%04X [%s], ver %d", mt->mt_pid, tsid, svc->s_dvb_svcname, ver);
+ tvhtrace(LS_PSIP, "0x%04x: channel ETT tableid 0x%04X [%s], ver %d", mt->mt_pid, tsid, svc->s_dvb_svcname, ver);
} else {
found = 1;
description = atsc_get_string(ptr+10, len-10);
if (ebc && ebc->grabber == mod) {
save |= epg_broadcast_set_description(ebc, description, &changes);
save |= epg_broadcast_change_finish(ebc, changes, 1);
- tvhtrace("psip", "0x%04x: ETT tableid 0x%04X [%s], eventid 0x%04X (%d) ['%s'], ver %d",
+ tvhtrace(LS_PSIP, "0x%04x: ETT tableid 0x%04X [%s], eventid 0x%04X (%d) ['%s'], ver %d",
mt->mt_pid, tsid, svc->s_dvb_svcname, eventid, eventid,
lang_str_get(ebc->episode->title, "eng"), ver);
} else {
}
}
if (found == 0) {
- tvhtrace("psip", "0x%04x: ETT tableid 0x%04X [%s], eventid 0x%04X (%d), ver %d - no matching broadcast found [%.80s]",
+ tvhtrace(LS_PSIP, "0x%04x: ETT tableid 0x%04X [%s], eventid 0x%04X (%d), ver %d - no matching broadcast found [%.80s]",
mt->mt_pid, tsid, svc->s_dvb_svcname, eventid, eventid, ver, lang_str_get(description, NULL));
psip_add_desc(ps, eventid, ptr+10, len-10);
}
ptr += 8;
len -= 8;
- tvhtrace("psip", "0x%04x: MGT tsid %04X (%d), ver %d, count %d", mt->mt_pid, tsid, tsid, ver, count);
+ tvhtrace(LS_PSIP, "0x%04x: MGT tsid %04X (%d), ver %d, count %d", mt->mt_pid, tsid, tsid, ver, count);
for (i = 0; i < count && len >= 11; i++) {
unsigned int type, tablepid, tablever, tablesize;
tablever = ptr[4] & 0x1f;
tablesize = ptr[5] << 24 | ptr[6] << 16 | ptr[7] << 8 | ptr[8];
- tvhdebug("psip", "table %d - type 0x%04X, pid 0x%04X, ver 0x%04X, size 0x%08X",
+ tvhdebug(LS_PSIP, "table %d - type 0x%04X, pid 0x%04X, ver 0x%04X, size 0x%08X",
i, type, tablepid, tablever, tablesize);
psip_update_table(ps, tablepid, type);
/* Listen for Master Guide Table */
mt = mpegts_table_add(dm, DVB_ATSC_MGT_BASE, DVB_ATSC_MGT_MASK,
- _psip_mgt_callback, ps, "mgt",
+ _psip_mgt_callback, ps, "mgt", LS_TBL_EIT,
MT_CRC | MT_QUICKREQ | MT_RECORD,
DVB_ATSC_MGT_PID, MPS_WEIGHT_MGT);
if (mt && !mt->mt_destroy) {
ps->ps_refcount++;
mt->mt_destroy = psip_status_destroy;
- tvhlog(LOG_DEBUG, m->id, "installed table handlers");
+ tvhdebug(mt->mt_subsys, "%s: installed table handlers", mt->mt_name);
}
if (!ps->ps_refcount)
free(ps);
.tune = _psip_tune,
};
- epggrab_module_ota_create(NULL, "psip", NULL, "PSIP: ATSC Grabber", 1, &ops);
+ epggrab_module_ota_create(NULL, "psip", LS_PSIP, NULL, "PSIP: ATSC Grabber", 1, &ops);
}
void psip_done ( void )
/* Internal module */
if (find_exec("pyepg", buf, sizeof(buf)-1))
epggrab_module_int_create(NULL, &epggrab_mod_int_pyepg_class,
- "pyepg-internal", "pyepg", "PyEPG", 4, buf,
+ "pyepg-internal", LS_PYEPG, "pyepg",
+ "PyEPG", 4, buf,
NULL, _pyepg_parse, NULL);
/* External module */
epggrab_module_ext_create(NULL, &epggrab_mod_ext_pyepg_class,
- "pyepg", "pyepg", "PyEPG", 4, "pyepg",
+ "pyepg", LS_PYEPG, "pyepg", "PyEPG", 4, "pyepg",
_pyepg_parse, NULL);
}
outbuf[i] = '\0';
sprintf(name, "XMLTV: %s", &outbuf[n]);
epggrab_module_int_create(NULL, &epggrab_mod_int_xmltv_class,
- &outbuf[p], "xmltv",
+ &outbuf[p], LS_XMLTV, "xmltv",
name, 3, &outbuf[p],
NULL, _xmltv_parse, NULL);
p = n = i + 1;
/* Internal search */
} else if ((tmp = getenv("PATH"))) {
- tvhdebug("epggrab", "using internal grab search");
+ tvhdebug(LS_XMLTV, "using internal grab search");
char bin[256];
char *argv[] = {
NULL,
if (outbuf[outlen-1] == '\n') outbuf[outlen-1] = '\0';
snprintf(name, sizeof(name), "XMLTV: %s", outbuf);
epggrab_module_int_create(NULL, &epggrab_mod_int_xmltv_class,
- bin, "xmltv", name, 3, bin,
+ bin, LS_XMLTV, "xmltv", name, 3, bin,
NULL, _xmltv_parse, NULL);
free(outbuf);
} else {
{
/* External module */
epggrab_module_ext_create(NULL, &epggrab_mod_ext_xmltv_class,
- "xmltv", "xmltv", "XMLTV", 3, "xmltv",
+ "xmltv", LS_XMLTV, "xmltv", "XMLTV", 3, "xmltv",
_xmltv_parse, NULL);
/* Standard modules */
mm = mpegts_mux_find(om->om_mux_uuid);
mpegts_mux_nice_name(mm, name, sizeof(name));
- tvhdebug("epggrab", "grab done for %s (%s)", name, reasons[reason]);
+ tvhdebug(LS_EPGGRAB, "grab done for %s (%s)", name, reasons[reason]);
mtimer_disarm(&om->om_timer);
mtimer_disarm(&om->om_data_timer);
om->om_requeue = 0;
LIST_FOREACH(map, &om->om_modules, om_link)
if (!map->om_complete)
- tvhlog(LOG_WARNING, "epggrab", "%s - data completion timeout for %s", map->om_module->name, name);
+ tvhwarn(LS_EPGGRAB, "%s - data completion timeout for %s", map->om_module->name, name);
} else {
om->om_requeue = 0;
}
if (map->om_module->start(map, mm) < 0) {
map->om_complete = 1;
} else
- tvhdebug(map->om_module->id, "grab started");
+ tvhdebug(map->om_module->subsys, "%s: grab started", map->om_module->id);
}
}
if (tvhtrace_enabled()) {
mpegts_mux_nice_name(mm, name, sizeof(name));
- tvhtrace("epggrab", "mux %s (%p) stop", name, mm);
+ tvhtrace(LS_EPGGRAB, "mux %s (%p) stop", name, mm);
}
TAILQ_FOREACH(ota, &epggrab_ota_active, om_q_link)
if (!strcmp(ota->om_mux_uuid, uuid)) {
if (!ota) {
char buf[256];
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhinfo(mod->id, "registering mux %s", buf);
+ tvhinfo(mod->subsys, "%s: registering mux %s", buf, mod->id);
ota = epggrab_ota_mux_skel;
SKEL_USED(epggrab_ota_mux_skel);
ota->om_mux_uuid = strdup(uuid);
lock_assert(&global_lock);
if (!ota->om_complete)
- tvhdebug(mod->id, "grab complete");
+ tvhdebug(mod->subsys, "%s: grab complete", mod->id);
/* Test for completion */
LIST_FOREACH(map, &ota->om_modules, om_link) {
} else if (!map->om_complete && !map->om_first) {
done = 0;
}
- tvhtrace("epggrab", "%s complete %i first %i",
+ tvhtrace(LS_EPGGRAB, "%s complete %i first %i",
map->om_module->id, map->om_complete, map->om_first);
}
/* Not completed, but no data - wait for a manual mux tuning */
epggrab_ota_complete_mark(om, 1);
} else {
- tvhtrace("epggrab", "data timeout check succeed");
+ tvhtrace(LS_EPGGRAB, "data timeout check succeed");
}
}
if (!om)
return;
- tvhtrace("epggrab", "ota - kick callback");
+ tvhtrace(LS_EPGGRAB, "ota - kick callback");
next_one:
/* Find the mux */
if (epg_flag < 0 || epg_flag == MM_EPG_DISABLE) {
if (tvhtrace_enabled()) {
mpegts_mux_nice_name(mm, name, sizeof(name));
- tvhtrace("epggrab", "epg mux %s is disabled, skipping", name);
+ tvhtrace(LS_EPGGRAB, "epg mux %s is disabled, skipping", name);
}
goto done;
}
}
if ((i == 0 || (r == 0 && modname)) && epg_flag != MM_EPG_FORCE) {
mpegts_mux_nice_name(mm, name, sizeof(name));
- tvhdebug("epggrab", "no OTA modules active for %s, check again next time", name);
+ tvhdebug(LS_EPGGRAB, "no OTA modules active for %s, check again next time", name);
goto done;
}
if (r != SM_CODE_NO_ADAPTERS) {
if (tvhtrace_enabled()) {
mpegts_mux_nice_name(mm, name, sizeof(name));
- tvhtrace("epggrab", "subscription failed for %s (result %d)", name, r);
+ tvhtrace(LS_EPGGRAB, "subscription failed for %s (result %d)", name, r);
}
TAILQ_INSERT_TAIL(&epggrab_ota_pending, om, om_q_link);
om->om_q_type = EPGGRAB_OTA_MUX_PENDING;
} else {
if (tvhtrace_enabled()) {
mpegts_mux_nice_name(mm, name, sizeof(name));
- tvhtrace("epggrab", "no free adapter for %s (subscribe)", name);
+ tvhtrace(LS_EPGGRAB, "no free adapter for %s (subscribe)", name);
}
net->fatal = 1;
}
} else {
if (tvhtrace_enabled()) {
mpegts_mux_nice_name(mm, name, sizeof(name));
- tvhtrace("epggrab", "mux %s (%p), started", name, mm);
+ tvhtrace(LS_EPGGRAB, "mux %s (%p), started", name, mm);
}
kick = 0;
/* note: it is possible that the mux_start listener is not called */
i++;
TAILQ_FOREACH(om, &epggrab_ota_pending, om_q_link)
r++;
- tvhtrace("epggrab", "mux stats - all %i pending %i", i, r);
+ tvhtrace(LS_EPGGRAB, "mux stats - all %i pending %i", i, r);
}
}
static void
epggrab_ota_next_arm( time_t next )
{
- tvhtrace("epggrab", "next ota start event in %li seconds", next - time(NULL));
+ tvhtrace(LS_EPGGRAB, "next ota start event in %li seconds", next - time(NULL));
gtimer_arm_absn(&epggrab_ota_start_timer, epggrab_ota_start_cb, NULL, next);
dbus_emit_signal_s64("/epggrab/ota", "next", next);
}
{
time_t next;
- tvhtrace("epggrab", "ota start callback");
+ tvhtrace(LS_EPGGRAB, "ota start callback");
epggrab_ota_pending_flag = 1;
if (!cron_multi_next(epggrab_ota_cron_multi, gclk(), &next))
epggrab_ota_next_arm(next);
else
- tvhwarn("epggrab", "ota cron config invalid or unset");
+ tvhwarn(LS_EPGGRAB, "ota cron config invalid or unset");
pthread_mutex_unlock(&epggrab_ota_mutex);
}
next = last + 1800;
epggrab_ota_next_arm(next);
} else {
- tvhwarn("epggrab", "ota cron config invalid or unset");
+ tvhwarn(LS_EPGGRAB, "ota cron config invalid or unset");
}
pthread_mutex_unlock(&epggrab_ota_mutex);
svc = mpegts_service_find_by_uuid(svcl->uuid);
if (mm && svc) {
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhtrace("epggrab", "ota %s %s service %s", buf, op, svc->s_nicename);
+ tvhtrace(LS_EPGGRAB, "ota %s %s service %s", buf, op, svc->s_nicename);
} else if (tvheadend_is_running())
- tvhtrace("epggrab", "ota %s, problem? (%p %p)", op, mm, svc);
+ tvhtrace(LS_EPGGRAB, "ota %s, problem? (%p %p)", op, mm, svc);
}
void
if (tvhtrace_enabled()) {
char name[256];
mpegts_mux_nice_name(mm, name, sizeof(name));
- tvhtrace("epggrab", "loading config for %s", name);
+ tvhtrace(LS_EPGGRAB, "loading config for %s", name);
}
ota = calloc(1, sizeof(epggrab_ota_mux_t));
epggrab_module_t *epggrab_module_create
( epggrab_module_t *skel, const idclass_t *cls,
- const char *id, const char *saveid,
+ const char *id, int subsys, const char *saveid,
const char *name, int priority );
char *epggrab_module_grab_spawn ( void *m );
epggrab_module_int_t *epggrab_module_int_create
( epggrab_module_int_t *skel, const idclass_t *cls,
- const char *id, const char *saveid,
+ const char *id, int subsys, const char *saveid,
const char *name, int priority,
const char *path,
char* (*grab) (void*m),
epggrab_module_ext_t *epggrab_module_ext_create
( epggrab_module_ext_t *skel, const idclass_t *cls,
- const char *id, const char *saveid,
+ const char *id, int subsys, const char *saveid,
const char *name, int priority,
const char *sockid,
int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta),
epggrab_module_ota_t *epggrab_module_ota_create
( epggrab_module_ota_t *skel,
- const char *id, const char *saveid,
+ const char *id, int subsys, const char *saveid,
const char *name, int priority,
epggrab_ota_module_ops_t *ops );
}
}
if (!c) {
- tvherror("esfilter", "wrong class %d!", cls);
+ tvherror(LS_ESFILTER, "wrong class %d!", cls);
abort();
}
if (idnode_insert(&esf->esf_id, uuid, c, 0)) {
if (uuid)
- tvherror("esfilter", "invalid uuid '%s'", uuid);
+ tvherror(LS_ESFILTER, "invalid uuid '%s'", uuid);
free(esf);
return NULL;
}
if (ESF_CLASS_IS_VALID(cls))
esf->esf_class = cls;
else if (!ESF_CLASS_IS_VALID(esf->esf_class)) {
- tvherror("esfilter", "wrong class %d!", esf->esf_class);
+ tvherror(LS_ESFILTER, "wrong class %d!", esf->esf_class);
abort();
}
if (esf->esf_index) {
i += sizeof(struct inotify_event) + ev->len;
if (i > c)
break;
- tvhtrace("fsmonitor", "event fd %d name %s mask %08X",
+ tvhtrace(LS_FSMONITOR, "event fd %d name %s mask %08X",
ev->wd, ev->len ? ev->name : NULL, ev->mask);
/* Find */
if (fmp->fmp_fd <= 0) {
RB_REMOVE(&fsmonitor_paths, fmp, fmp_link);
free(fmp);
- tvhdebug("fsmonitor", "failed to add %s (exists?)", path);
+ tvhdebug(LS_FSMONITOR, "failed to add %s (exists?)", path);
printf("ERROR: failed to add %s\n", path);
return -1;
}
/* Setup */
fmp->fmp_path = strdup(path);
- tvhdebug("fsmonitor", "watch %s", fmp->fmp_path);
+ tvhdebug(LS_FSMONITOR, "watch %s", fmp->fmp_path);
} else {
free(skel);
}
/* Remove path */
if (LIST_EMPTY(&fmp->fmp_monitors)) {
- tvhdebug("fsmonitor", "unwatch %s", fmp->fmp_path);
+ tvhdebug(LS_FSMONITOR, "unwatch %s", fmp->fmp_path);
RB_REMOVE(&fsmonitor_paths, fmp, fmp_link);
fd = atomic_get(&fsmonitor_fd);
if (fd >= 0)
* *************************************************************************/
static void
-htsp_trace(htsp_connection_t *htsp, const char *subsystem,
+htsp_trace(htsp_connection_t *htsp, int subsystem,
const char *prefix, htsmsg_t *m)
{
htsbuf_queue_t q;
tvh_strlcatf(buf, sizeof(buf), l, "subscription %i", hs->hs_sid);
if (payloadsize)
tvh_strlcatf(buf, sizeof(buf), l, " (payload %d)", payloadsize);
- htsp_trace(htsp, "htsp-sub", buf, m);
+ htsp_trace(htsp, LS_HTSP_SUB, buf, m);
}
htsp_send(htsp, m, pb, &hs->hs_q, payloadsize);
const char *qname = "answer";
if (hmq == &htsp->htsp_hmq_qstatus)
qname = "status";
- htsp_trace(htsp, "htsp-ans", qname, m);
+ htsp_trace(htsp, LS_HTSP_ANS, qname, m);
}
htsp_send(htsp, m, NULL, hmq ?: &htsp->htsp_hmq_ctrl, 0);
}
if (!cfg && perm->aa_username)
- tvhlog(LOG_INFO, "htsp", "User '%s' has no valid dvr config in ACL, using default...", perm->aa_username);
+ tvhinfo(LS_HTSP, "User '%s' has no valid dvr config in ACL, using default...", perm->aa_username);
return cfg ? idnode_uuid_as_str(&cfg->dvr_id, ubuf) : NULL;
}
if (fd <= 0) {
fd = tvh_open(path, O_RDONLY, 0);
- tvhlog(LOG_DEBUG, "htsp", "Opening file %s -- %s", path, fd < 0 ? strerror(errno) : "OK");
+ tvhdebug(LS_HTSP, "Opening file %s -- %s", path, fd < 0 ? strerror(errno) : "OK");
if(fd == -1)
return htsp_error(htsp, N_("Unable to open file"));
}
static void
htsp_file_destroy(htsp_file_t *hf)
{
- tvhlog(LOG_DEBUG, "htsp", "Closed opened file %s", hf->hf_path);
+ tvhdebug(LS_HTSP, "Closed opened file %s", hf->hf_path);
free(hf->hf_path);
close(hf->hf_fd);
LIST_REMOVE(hf, hf_link);
tvh_str_update(&htsp->htsp_clientname, htsmsg_get_str(in, "clientname"));
- tvhlog(LOG_INFO, "htsp", "%s: Welcomed client software: %s (HTSPv%d)",
- htsp->htsp_logname, name, v);
+ tvhinfo(LS_HTSP, "%s: Welcomed client software: %s (HTSPv%d)",
+ htsp->htsp_logname, name, v);
htsmsg_add_u32(r, "htspversion", HTSP_PROTO_VERSION);
htsmsg_add_str(r, "servername", config_get_server_name());
eq.duration.comp = EC_RG;
eq.duration.val1 = min_duration;
eq.duration.val2 = max_duration;
- tvhtrace("htsp", "min_duration %d and max_duration %d", min_duration, max_duration);
+ tvhtrace(LS_HTSP, "min_duration %d and max_duration %d", min_duration, max_duration);
/* Check access */
if (ch && !htsp_user_access_channel(htsp, ch))
#if ENABLE_TIMESHIFT
if (timeshiftPeriod != 0) {
if (timeshiftPeriod == ~0)
- tvhlog(LOG_DEBUG, "htsp", "using timeshift buffer (unlimited)");
+ tvhdebug(LS_HTSP, "using timeshift buffer (unlimited)");
else
- tvhlog(LOG_DEBUG, "htsp", "using timeshift buffer (%u mins)", timeshiftPeriod / 60);
+ tvhdebug(LS_HTSP, "using timeshift buffer (%u mins)", timeshiftPeriod / 60);
}
#endif
"htsp", SUBSCRIPTION_PACKET | SUBSCRIPTION_HTSP);
profile_chain_init(&hs->hs_prch, pro, ch);
if (profile_chain_work(&hs->hs_prch, &hs->hs_input, timeshiftPeriod, 0)) {
- tvhlog(LOG_ERR, "htsp", "unable to create profile chain '%s'", profile_get_name(pro));
+ tvherror(LS_HTSP, "unable to create profile chain '%s'", profile_get_name(pro));
profile_chain_close(&hs->hs_prch);
free(hs);
return htsp_error(htsp, N_("Stream setup error"));
*/
LIST_INSERT_HEAD(&htsp->htsp_subscriptions, hs, hs_link);
- tvhdebug("htsp", "%s - subscribe to %s using profile %s",
+ tvhdebug(LS_HTSP, "%s - subscribe to %s using profile %s",
htsp->htsp_logname, channel_get_name(ch), profile_get_name(pro));
hs->hs_s = subscription_create_from_channel(&hs->hs_prch, NULL, weight,
htsp->htsp_logname,
if(!htsmsg_get_s64(in, "time", &s64)) {
skip.type = abs ? SMT_SKIP_ABS_TIME : SMT_SKIP_REL_TIME;
skip.time = hs->hs_90khz ? s64 : ts_rescale_inv(s64, 1000000);
- tvhtrace("htsp-sub", "skip: %s %"PRId64" (%s)", abs ? "abs" : "rel",
+ tvhtrace(LS_HTSP_SUB, "skip: %s %"PRId64" (%s)", abs ? "abs" : "rel",
skip.time, hs->hs_90khz ? "90kHz" : "1MHz");
} else if (!htsmsg_get_s64(in, "size", &s64)) {
skip.type = abs ? SMT_SKIP_ABS_SIZE : SMT_SKIP_REL_SIZE;
skip.size = s64;
- tvhtrace("htsp-sub", "skip: %s by size %"PRId64, abs ? "abs" : "rel", s64);
+ tvhtrace(LS_HTSP_SUB, "skip: %s by size %"PRId64, abs ? "abs" : "rel", s64);
} else {
return htsp_error(htsp, N_("Invalid arguments"));
}
if(hs == NULL)
return htsp_error(htsp, N_("Subscription does not exist"));
- tvhtrace("htsp-sub", "speed: %d", speed);
+ tvhtrace(LS_HTSP_SUB, "speed: %d", speed);
subscription_set_speed(hs->hs_s, speed);
htsp_reply(htsp, in, htsmsg_create_map());
memset(&skip, 0, sizeof(skip));
skip.type = SMT_SKIP_LIVE;
- tvhtrace("htsp-sub", "live");
+ tvhtrace(LS_HTSP_SUB, "live");
subscription_set_skip(hs->hs_s, &skip);
htsp_reply(htsp, in, htsmsg_create_map());
htsp_verify_callback, &vs);
if (rights->aa_rights == 0) {
- tvhlog(LOG_INFO, "htsp", "%s: Unauthorized access", htsp->htsp_logname);
+ tvhinfo(LS_HTSP, "%s: Unauthorized access", htsp->htsp_logname);
access_destroy(rights);
return 0;
}
htsp->htsp_granted_access->aa_rights) !=
htsp->htsp_granted_access->aa_rights;
- tvhlog(LOG_INFO, "htsp", "%s: Identified as user '%s'",
- htsp->htsp_logname, username);
+ tvhinfo(LS_HTSP, "%s: Identified as user '%s'",
+ htsp->htsp_logname, username);
tvh_str_update(&htsp->htsp_username, username);
htsp_update_logname(htsp);
if(privgain)
- tvhlog(LOG_INFO, "htsp", "%s: Privileges updated", htsp->htsp_logname);
+ tvhinfo(LS_HTSP, "%s: Privileges updated", htsp->htsp_logname);
access_destroy(htsp->htsp_granted_access);
htsp->htsp_granted_access = rights;
} else {
- tvhlog(LOG_INFO, "htsp", "%s: Identified as user '%s' (unverified)",
- htsp->htsp_logname, username);
+ tvhinfo(LS_HTSP, "%s: Identified as user '%s' (unverified)",
+ htsp->htsp_logname, username);
tvh_str_update(&htsp->htsp_username, username);
htsp_update_logname(htsp);
void *tcp_id = NULL;;
if(htsp_generate_challenge(htsp)) {
- tvhlog(LOG_ERR, "htsp", "%s: Unable to generate challenge",
- htsp->htsp_logname);
+ tvherror(LS_HTSP, "%s: Unable to generate challenge",
+ htsp->htsp_logname);
return 1;
}
if (tcp_id == NULL)
return 0;
- tvhlog(LOG_INFO, "htsp", "Got connection from %s", htsp->htsp_logname);
+ tvhinfo(LS_HTSP, "Got connection from %s", htsp->htsp_logname);
/* Session main loop */
}
if((method = htsmsg_get_str(m, "method")) != NULL) {
- tvhtrace("htsp", "%s - method %s", htsp->htsp_logname, method);
+ tvhtrace(LS_HTSP, "%s - method %s", htsp->htsp_logname, method);
if (tvhtrace_enabled())
- htsp_trace(htsp, "htsp-req", "request", m);
+ htsp_trace(htsp, LS_HTSP_REQ, "request", m);
for(i = 0; i < NUM_METHODS; i++) {
if(!strcmp(method, htsp_methods[i].name)) {
pthread_mutex_unlock(&htsp->htsp_out_mutex);
if (htsmsg_binary_serialize(hm->hm_msg, &dptr, &dlen, INT32_MAX) != 0) {
- tvhlog(LOG_WARNING, "htsp", "%s: failed to serialize data",
- htsp->htsp_logname);
+ tvhwarn(LS_HTSP, "%s: failed to serialize data", htsp->htsp_logname);
htsp_msg_destroy(hm);
pthread_mutex_lock(&htsp->htsp_out_mutex);
continue;
pthread_mutex_lock(&htsp->htsp_out_mutex);
if (r) {
- tvhlog(LOG_INFO, "htsp", "%s: Write error -- %s",
- htsp->htsp_logname, strerror(errno));
+ tvhinfo(LS_HTSP, "%s: Write error -- %s",
+ htsp->htsp_logname, strerror(errno));
break;
}
}
htsp_read_loop(&htsp);
- tvhlog(LOG_INFO, "htsp", "%s: Disconnected", htsp.htsp_logname);
+ tvhinfo(LS_HTSP, "%s: Disconnected", htsp.htsp_logname);
/**
* Ok, we're back, other end disconnected. Clean up stuff.
.stop = NULL,
.cancel = htsp_server_cancel
};
- htsp_server = tcp_server_create("htsp", "HTSP", bindaddr, tvheadend_htsp_port, &ops, NULL);
+ htsp_server = tcp_server_create(LS_HTSP, "HTSP", bindaddr, tvheadend_htsp_port, &ops, NULL);
if(tvheadend_htsp_port_extra)
- htsp_server_2 = tcp_server_create("htsp", "HTSP2", bindaddr, tvheadend_htsp_port_extra, &ops, NULL);
+ htsp_server_2 = tcp_server_create(LS_HTSP, "HTSP2", bindaddr, tvheadend_htsp_port_extra, &ops, NULL);
}
/*
int i;
const source_info_t *si;
- tvhdebug("htsp", "%s - subscription start", hs->hs_htsp->htsp_logname);
+ tvhdebug(LS_HTSP, "%s - subscription start", hs->hs_htsp->htsp_logname);
for(i = 0; i < ss->ss_num_components; i++) {
const streaming_start_component_t *ssc = &ss->ss_components[i];
htsmsg_t *m = htsmsg_create_map();
htsmsg_add_str(m, "method", "subscriptionStop");
htsmsg_add_u32(m, "subscriptionId", hs->hs_sid);
- tvhdebug("htsp", "%s - subscription stop", hs->hs_htsp->htsp_logname);
+ tvhdebug(LS_HTSP, "%s - subscription stop", hs->hs_htsp->htsp_logname);
if(err != NULL)
htsmsg_add_str(m, "status", err);
htsmsg_add_str(m, "method", "subscriptionGrace");
htsmsg_add_u32(m, "subscriptionId", hs->hs_sid);
htsmsg_add_u32(m, "graceTimeout", grace);
- tvhdebug("htsp", "%s - subscription grace %i seconds", hs->hs_htsp->htsp_logname, grace);
+ tvhdebug(LS_HTSP, "%s - subscription grace %i seconds", hs->hs_htsp->htsp_logname, grace);
htsp_send_subscription(hs->hs_htsp, m, NULL, hs, 0);
}
htsp_subscription_speed(htsp_subscription_t *hs, int speed)
{
htsmsg_t *m = htsmsg_create_map();
- tvhdebug("htsp", "%s - subscription speed", hs->hs_htsp->htsp_logname);
+ tvhdebug(LS_HTSP, "%s - subscription speed", hs->hs_htsp->htsp_logname);
htsmsg_add_str(m, "method", "subscriptionSpeed");
htsmsg_add_u32(m, "subscriptionId", hs->hs_sid);
htsmsg_add_s32(m, "speed", speed);
htsp_subscription_skip(htsp_subscription_t *hs, streaming_skip_t *skip)
{
htsmsg_t *m = htsmsg_create_map();
- tvhdebug("htsp", "%s - subscription skip", hs->hs_htsp->htsp_logname);
+ tvhdebug(LS_HTSP, "%s - subscription skip", hs->hs_htsp->htsp_logname);
htsmsg_add_str(m, "method", "subscriptionSkip");
htsmsg_add_u32(m, "subscriptionId", hs->hs_sid);
if (hs->hs_wait_for_video)
break;
if (!hs->hs_first)
- tvhdebug("htsp", "%s - first packet", hs->hs_htsp->htsp_logname);
+ tvhdebug(LS_HTSP, "%s - first packet", hs->hs_htsp->htsp_logname);
hs->hs_first = 1;
htsp_stream_deliver(hs, sm->sm_data);
// reference is transfered
level = LOG_DEBUG;
else if (error == HTTP_STATUS_BAD_REQUEST || error > HTTP_STATUS_UNAUTHORIZED)
level = LOG_ERR;
- tvhlog(level, "http", "%s: %s %s %s -- %d",
+ tvhlog(level, LS_HTTP, "%s: %s %s %s -- %d",
hc->hc_peer_ipstr, http_ver2str(hc->hc_version),
http_cmd2str(hc->hc_cmd), hc->hc_url, error);
}
hc->hc_access = access_ticket_verify2(ticket_id, hc->hc_url);
if (hc->hc_access == NULL)
return;
- tvhlog(LOG_INFO, "http", "%s: using ticket %s for %s",
- hc->hc_peer_ipstr, ticket_id, hc->hc_url);
+ tvhinfo(LS_HTTP, "%s: using ticket %s for %s",
+ hc->hc_peer_ipstr, ticket_id, hc->hc_url);
}
/**
if (!first)
tvh_strlcatf(buf, sizeof(buf), ptr, "}}");
- tvhtrace("http", "%s %s %s%s", http_ver2str(hc->hc_version),
+ tvhtrace(LS_HTTP, "%s %s %s%s", http_ver2str(hc->hc_version),
http_cmd2str(hc->hc_cmd), hc->hc_url, buf);
}
.cancel = http_cancel
};
RB_INIT(&http_nonces);
- http_server = tcp_server_create("http", "HTTP", bindaddr, tvheadend_webui_port, &ops, NULL);
+ http_server = tcp_server_create(LS_HTTP, "HTTP", bindaddr, tvheadend_webui_port, &ops, NULL);
atomic_set(&http_server_running, 1);
}
else if (scheme && strcmp(scheme, "rtsp") == 0)
port = 554;
else {
- tvhlog(LOG_ERR, "httpc", "%04X: Unknown scheme '%s'", shortid(hc), scheme ? scheme : "");
+ tvherror(LS_HTTPC, "%04X: Unknown scheme '%s'", shortid(hc), scheme ? scheme : "");
return -EINVAL;
}
}
http_client_flush( http_client_t *hc, int result )
{
hc->hc_result = result;
- tvhtrace("httpc", "%04X: client flush %i", shortid(hc), result);
+ tvhtrace(LS_HTTPC, "%04X: client flush %i", shortid(hc), result);
if (result < 0)
http_client_shutdown(hc, 0, 0);
hc->hc_in_data = 0;
if (hc->hc_verify_peer > 0) {
if (SSL_get_peer_certificate(ssl->ssl) == NULL ||
SSL_get_verify_result(ssl->ssl) != X509_V_OK) {
- tvhlog(LOG_ERR, "httpc", "%04X: SSL peer verification failed (%s:%i)%s %li",
+ tvherror(LS_HTTPC, "%04X: SSL peer verification failed (%s:%i)%s %li",
shortid(hc), hc->hc_host, hc->hc_port,
SSL_get_peer_certificate(ssl->ssl) ? " X509" : "",
SSL_get_verify_result(ssl->ssl));
htsbuf_read(&q, body, body_size);
if (tvhtrace_enabled()) {
- tvhtrace("httpc", "%04X: sending %s cmd", shortid(hc), http_ver2str(hc->hc_version));
- tvhlog_hexdump("httpc", body, body_size);
+ tvhtrace(LS_HTTPC, "%04X: sending %s cmd", shortid(hc), http_ver2str(hc->hc_version));
+ tvhlog_hexdump(LS_HTTPC, body, body_size);
}
wcmd->wbuf = body;
int res;
if (hc->hc_data && tvhtrace_enabled()) {
- tvhtrace("httpc", "%04X: received %s data", shortid(hc), http_ver2str(hc->hc_version));
- tvhlog_hexdump("httpc", hc->hc_data, hc->hc_csize);
+ tvhtrace(LS_HTTPC, "%04X: received %s data", shortid(hc), http_ver2str(hc->hc_version));
+ tvhlog_hexdump(LS_HTTPC, hc->hc_data, hc->hc_csize);
}
if (hc->hc_in_rtp_data && hc->hc_rtp_data_complete) {
pthread_mutex_unlock(&hc->hc_mutex);
return http_client_flush(hc, -errno);
}
if (r > 0 && tvhtrace_enabled()) {
- tvhtrace("httpc", "%04X: received %s answer (len = %zd)", shortid(hc), http_ver2str(hc->hc_version), r);
- tvhlog_hexdump("httpc", buf, MIN(64, r));
+ tvhtrace(LS_HTTPC, "%04X: received %s answer (len = %zd)", shortid(hc), http_ver2str(hc->hc_version), r);
+ tvhlog_hexdump(LS_HTTPC, buf, MIN(64, r));
}
if (hc->hc_in_data && !hc->hc_in_rtp_data) {
p = strtok_r(hc->hc_rbuf, "\r\n", &saveptr);
if (p == NULL)
return http_client_flush(hc, -EINVAL);
- tvhtrace("httpc", "%04X: %s answer '%s' (rcseq: %d)",
+ tvhtrace(LS_HTTPC, "%04X: %s answer '%s' (rcseq: %d)",
shortid(hc), http_ver2str(hc->hc_version), p, hc->hc_rcseq);
- tvhlog_hexdump("httpc", hc->hc_rbuf, hc->hc_hsize);
+ tvhlog_hexdump(LS_HTTPC, hc->hc_rbuf, hc->hc_hsize);
if (http_tokenize(p, argv, 3, -1) != 3)
return http_client_flush(hc, -EINVAL);
if ((ver = http_str2ver(argv[0])) < 0)
if (u->scheme == NULL || u->scheme[0] == '\0' ||
u->host == NULL || u->host[0] == '\0' ||
u->port < 0) {
- tvherror("httpc", "Invalid url '%s'", u->raw);
+ tvherror(LS_HTTPC, "Invalid url '%s'", u->raw);
return -EINVAL;
}
if (strcmp(u->scheme, hc->hc_scheme) ||
urlinit(&u);
if (urlparse(location2 ? location2 : location, &u)) {
- tvherror("httpc", "%04X: redirection - cannot parse url '%s'",
+ tvherror(LS_HTTPC, "%04X: redirection - cannot parse url '%s'",
shortid(hc), location2 ? location2 : location);
free(location);
return -EIO;
hc->hc_verify_peer = verify ? 1 : 0;
if ((ssl = hc->hc_ssl) != NULL) {
if (!SSL_CTX_set_default_verify_paths(ssl->ctx))
- tvherror("httpc", "%04X: SSL - unable to load CA certificates for verification", shortid(hc));
+ tvherror(LS_HTTPC, "%04X: SSL - unable to load CA certificates for verification", shortid(hc));
SSL_CTX_set_verify_depth(ssl->ctx, 1);
SSL_CTX_set_verify(ssl->ctx,
hc->hc_verify_peer ? SSL_VERIFY_PEER : SSL_VERIFY_NONE,
NULL);
}
} else {
- tvherror("httpc", "%04X: SSL peer verification method must be set only once", shortid(hc));
+ tvherror(LS_HTTPC, "%04X: SSL peer verification method must be set only once", shortid(hc));
}
}
n = tvhpoll_wait(http_poll, &ev, 1, -1);
if (n < 0) {
if (atomic_get(&http_running) && !ERRNO_AGAIN(errno))
- tvherror("httpc", "tvhpoll_wait() error");
+ tvherror(LS_HTTPC, "tvhpoll_wait() error");
} else if (n > 0) {
if (&http_pipe == ev.data.ptr) {
if (read(http_pipe.rd, &c, 1) == 1) {
hc->hc_port = port;
hc->hc_fd = tcp_connect(host, port, hc->hc_bindaddr, errbuf, sizeof(errbuf), -1);
if (hc->hc_fd < 0) {
- tvhlog(LOG_ERR, "httpc", "%04X: Unable to connect to %s:%i - %s", shortid(hc), host, port, errbuf);
+ tvherror(LS_HTTPC, "%04X: Unable to connect to %s:%i - %s", shortid(hc), host, port, errbuf);
goto errnval;
}
hc->hc_einprogress = 1;
- tvhtrace("httpc", "%04X: Connected to %s:%i", shortid(hc), host, port);
+ tvhtrace(LS_HTTPC, "%04X: Connected to %s:%i", shortid(hc), host, port);
http_client_ssl_free(hc);
if (strcasecmp(scheme, "https") == 0 || strcasecmp(scheme, "rtsps") == 0) {
ssl = calloc(1, sizeof(*ssl));
hc->hc_ssl = ssl;
ssl->ctx = SSL_CTX_new(SSLv23_client_method());
if (ssl->ctx == NULL) {
- tvhlog(LOG_ERR, "httpc", "%04X: Unable to get SSL_CTX", shortid(hc));
+ tvherror(LS_HTTPC, "%04X: Unable to get SSL_CTX", shortid(hc));
goto err1;
}
/* do not use SSLv2 */
SSL_CTX_set_options(ssl->ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_COMPRESSION);
/* adjust cipher list */
if (SSL_CTX_set_cipher_list(ssl->ctx, "HIGH:MEDIUM") != 1) {
- tvhlog(LOG_ERR, "httpc", "%04X: Unable to adjust SSL cipher list", shortid(hc));
+ tvherror(LS_HTTPC, "%04X: Unable to adjust SSL cipher list", shortid(hc));
goto err2;
}
ssl->rbio = BIO_new(BIO_s_mem());
ssl->wbio = BIO_new(BIO_s_mem());
ssl->ssl = SSL_new(ssl->ctx);
if (ssl->ssl == NULL || ssl->rbio == NULL || ssl->wbio == NULL) {
- tvhlog(LOG_ERR, "httpc", "%04X: Unable to get SSL handle", shortid(hc));
+ tvherror(LS_HTTPC, "%04X: Unable to get SSL handle", shortid(hc));
goto err3;
}
SSL_set_bio(ssl->ssl, ssl->rbio, ssl->wbio);
if (!SSL_set_tlsext_host_name(ssl->ssl, host)) {
- tvhlog(LOG_ERR, "httpc", "%04X: Unable to set SSL hostname", shortid(hc));
+ tvherror(LS_HTTPC, "%04X: Unable to set SSL hostname", shortid(hc));
goto err4;
}
}
pthread_mutex_lock(&hc->hc_mutex);
http_client_shutdown(hc, 1, 0);
http_client_flush(hc, 0);
- tvhtrace("httpc", "%04X: Closed", shortid(hc));
+ tvhtrace(LS_HTTPC, "%04X: Closed", shortid(hc));
while ((wcmd = TAILQ_FIRST(&hc->hc_wqueue)) != NULL)
http_client_cmd_destroy(hc, wcmd);
http_client_ssl_free(hc);
path = TVHEADEND_DATADIR "/support/httpc-test.txt";
fp = tvh_fopen(path, "r");
if (fp == NULL) {
- tvhlog(LOG_NOTICE, "httpc", "Test: unable to open '%s': %s", path, strerror(errno));
+ tvhnotice(LS_HTTPC, "Test: unable to open '%s': %s", path, strerror(errno));
return;
}
urlinit(&u1);
} while (c != NULL && --retries > 0);
if(c != NULL) {
- tvherror("idnode", "Id node collission (%s) %s",
+ tvherror(LS_IDNODE, "Id node collission (%s) %s",
uuid, (flags & IDNODE_SHORT_UUID) ? " (short)" : "");
fprintf(stderr, "Id node collision (%s) %s\n",
uuid, (flags & IDNODE_SHORT_UUID) ? " (short)" : "");
abort();
}
- tvhtrace("idnode", "insert node %s", idnode_uuid_as_str(in, ubuf));
+ tvhtrace(LS_IDNODE, "insert node %s", idnode_uuid_as_str(in, ubuf));
/* Register the class */
in->in_domain = idclass_find_domain(class);
if (in->in_domain == NULL) {
- tvherror("idnode", "classs '%s' is not registered", class->ic_class);
+ tvherror(LS_IDNODE, "classs '%s' is not registered", class->ic_class);
abort();
}
c = RB_INSERT_SORTED(in->in_domain, in, in_domain_link, in_cmp);
lock_assert(&global_lock);
RB_REMOVE(&idnodes, in, in_link);
RB_REMOVE(in->in_domain, in, in_domain_link);
- tvhtrace("idnode", "unlink node %s", idnode_uuid_as_str(in, ubuf));
+ tvhtrace(LS_IDNODE, "unlink node %s", idnode_uuid_as_str(in, ubuf));
idnode_notify(in, "delete");
assert(in->in_save == NULL || in->in_save == SAVEPTR_OUTOFSERVICE);
}
{
idnode_t skel, *r;
- tvhtrace("idnode", "find node %s class %s", uuid, idc ? idc->ic_class : NULL);
+ tvhtrace(LS_IDNODE, "find node %s class %s", uuid, idc ? idc->ic_class : NULL);
if(uuid == NULL || strlen(uuid) != UUID_HEX_SIZE - 1)
return NULL;
if(hex2bin(skel.in_uuid.bin, sizeof(skel.in_uuid.bin), uuid))
idnode_t *in;
const idclass_t *ic;
char ubuf[UUID_HEX_SIZE];
- tvhtrace("idnode", "find class %s", idc->ic_class);
+ tvhtrace(LS_IDNODE, "find class %s", idc->ic_class);
idnode_set_t *is = calloc(1, sizeof(idnode_set_t));
if (domain == NULL)
domain = idnode_domain(idc);
ic = in->in_class;
while (ic) {
if (ic == idc) {
- tvhtrace("idnode", " add node %s", idnode_uuid_as_str(in, ubuf));
+ tvhtrace(LS_IDNODE, " add node %s", idnode_uuid_as_str(in, ubuf));
idnode_set_add(is, in, NULL, NULL);
break;
}
ic = in->in_class;
while (ic) {
if (ic == idc) {
- tvhtrace("idnode", " add node %s", idnode_uuid_as_str(in, ubuf));
+ tvhtrace(LS_IDNODE, " add node %s", idnode_uuid_as_str(in, ubuf));
idnode_set_add(is, in, NULL, NULL);
break;
}
if (r) return;
RB_INIT(&idclasses_skel->nodes);
SKEL_USED(idclasses_skel);
- tvhtrace("idnode", "register root class %s", idc->ic_class);
+ tvhtrace(LS_IDNODE, "register root class %s", idc->ic_class);
}
void
}
RB_INIT(&idclasses_skel->nodes); /* not used, but for sure */
SKEL_USED(idclasses_skel);
- tvhtrace("idnode", "register class %s", idc->ic_class);
+ tvhtrace(LS_IDNODE, "register class %s", idc->ic_class);
prev = idc;
idc = idc->ic_super;
}
idclass_t idc;
skel.idc = &idc;
idc.ic_class = class;
- tvhtrace("idnode", "find class %s", class);
+ tvhtrace(LS_IDNODE, "find class %s", class);
t = RB_FIND(&idclasses, &skel, link, ic_cmp);
return t ? t->idc : NULL;
}
}
if (!r) {
if (rename(tpath, path))
- tvherror("imagecache", "unable to rename file '%s' to '%s'", tpath, path);
+ tvherror(LS_IMAGECACHE, "unable to rename file '%s' to '%s'", tpath, path);
}
imagecache_image_save(img);
pthread_mutex_unlock(&global_lock);
pthread_mutex_unlock(&global_lock);
/* Build command */
- tvhdebug("imagecache", "fetch %s", img->url);
+ tvhdebug(LS_IMAGECACHE, "fetch %s", img->url);
memset(&url, 0, sizeof(url));
if (urlparse(img->url, &url)) {
- tvherror("imagecache", "Unable to parse url '%s'", img->url);
+ tvherror(LS_IMAGECACHE, "Unable to parse url '%s'", img->url);
goto error_lock;
}
img->failed = 1;
imagecache_image_save(img);
}
- tvhwarn("imagecache", "failed to download %s", img->url);
+ tvhwarn(LS_IMAGECACHE, "failed to download %s", img->url);
} else {
- tvhdebug("imagecache", "downloaded %s", img->url);
+ tvhdebug(LS_IMAGECACHE, "downloaded %s", img->url);
}
tvh_cond_signal(&imagecache_cond, 1);
}
#endif
- tvhinfo("imagecache", "clean request");
+ tvhinfo(LS_IMAGECACHE, "clean request");
/* remove unassociated data */
if (hts_settings_buildpath(path, sizeof(path), "imagecache/data")) {
- tvherror("imagecache", "clean - buildpath");
+ tvherror(LS_IMAGECACHE, "clean - buildpath");
return;
}
if((n = fb_scandir(path, &namelist)) < 0)
img = RB_FIND(&imagecache_by_id, &skel, id_link, id_cmp);
if (img)
continue;
- tvhinfo("imagecache", "clean: removing unassociated file '%s/%s'", path, name);
+ tvhinfo(LS_IMAGECACHE, "clean: removing unassociated file '%s/%s'", path, name);
hts_settings_remove("imagecache/meta/%s", name);
hts_settings_remove("imagecache/data/%s", name);
}
lock_assert(&global_lock);
- tvhinfo("imagecache", "load triggered");
+ tvhinfo(LS_IMAGECACHE, "load triggered");
RB_FOREACH(img, &imagecache_by_url, url_link) {
if (img->state != IDLE) continue;
imagecache_image_add(img);
void
mpegts_done ( void )
{
- tvhftrace("main", mpegts_network_scan_done);
- tvhftrace("main", mpegts_mux_sched_done);
+ tvhftrace(LS_MAIN, mpegts_network_scan_done);
+ tvhftrace(LS_MAIN, mpegts_mux_sched_done);
#if ENABLE_MPEGTS_DVB
- tvhftrace("main", dvb_network_done);
+ tvhftrace(LS_MAIN, dvb_network_done);
#endif
#if ENABLE_IPTV
- tvhftrace("main", iptv_done);
+ tvhftrace(LS_MAIN, iptv_done);
#endif
#if ENABLE_LINUXDVB
- tvhftrace("main", linuxdvb_done);
+ tvhftrace(LS_MAIN, linuxdvb_done);
#endif
#if ENABLE_SATIP_CLIENT
- tvhftrace("main", satip_done);
+ tvhftrace(LS_MAIN, satip_done);
#endif
#if ENABLE_HDHOMERUN_CLIENT
- tvhftrace("main", tvhdhomerun_done);
+ tvhftrace(LS_MAIN, tvhdhomerun_done);
#endif
#if ENABLE_TSFILE
- tvhftrace("main", tsfile_done);
+ tvhftrace(LS_MAIN, tsfile_done);
#endif
dvb_fastscan_done();
}
mpegts_table_t *mpegts_table_add
(mpegts_mux_t *mm, int tableid, int mask,
mpegts_table_callback_t callback, void *opaque,
- const char *name, int flags, int pid, int weight);
+ const char *name, int subsys, int flags, int pid, int weight);
void mpegts_table_flush_all
(mpegts_mux_t *mm);
void mpegts_table_destroy ( mpegts_table_t *mt );
* PSI processing
*/
-#define DVB_LOOP_INIT(ptr, len, off, lptr, llen)\
+#define DVB_LOOP_INIT(mt, ptr, len, off, lptr, llen)\
do {\
llen = ((ptr[off] & 0xF) << 8) | ptr[off+1];\
lptr = 2 + off + ptr;\
ptr += 2 + off + llen;\
len -= 2 + off + llen;\
- if (len < 0) {tvhtrace("psi", "len < 0"); return -1; }\
+ if (len < 0) {tvhtrace(mt->mt_subsys, "%s: len < 0", mt->mt_name); return -1; }\
} while(0)
#define DVB_LOOP_EACH(ptr, len, min)\
for ( ; len > min ; )\
-#define DVB_LOOP_FOREACH(ptr, len, off, lptr, llen, min)\
- DVB_LOOP_INIT(ptr, len, off, lptr, llen);\
+#define DVB_LOOP_FOREACH(mt, ptr, len, off, lptr, llen, min)\
+ DVB_LOOP_INIT(mt, ptr, len, off, lptr, llen);\
DVB_LOOP_EACH(lptr, llen, min)
-#define DVB_DESC_EACH(ptr, len, dtag, dlen, dptr)\
+#define DVB_DESC_EACH(mt, ptr, len, dtag, dlen, dptr)\
DVB_LOOP_EACH(ptr, len, 2)\
- if (!(dtag = ptr[0])) {tvhtrace("psi", "1");return -1;}\
- else if ((dlen = ptr[1]) < 0) {tvhtrace("psi", "2");return -1;}\
- else if (!(dptr = ptr+2)) {tvhtrace("psi", "3");return -1;}\
- else if ( (len -= 2 + dlen) < 0) {tvhtrace("psi", "4");return -1;}\
- else if (!(ptr += 2 + dlen)) {tvhtrace("psi", "5");return -1;}\
+ if (!(dtag = ptr[0])) {tvhtrace(mt->mt_subsys, "%s: 1", mt->mt_name);return -1;}\
+ else if ((dlen = ptr[1]) < 0) {tvhtrace(mt->mt_subsys, "%s: 2", mt->mt_name);return -1;}\
+ else if (!(dptr = ptr+2)) {tvhtrace(mt->mt_subsys, "%s: 3", mt->mt_name);return -1;}\
+ else if ( (len -= 2 + dlen) < 0) {tvhtrace(mt->mt_subsys, "%s: 4", mt->mt_name);return -1;}\
+ else if (!(ptr += 2 + dlen)) {tvhtrace(mt->mt_subsys, "%s: 5", mt->mt_name);return -1;}\
else
-#define DVB_DESC_FOREACH(ptr, len, off, lptr, llen, dtag, dlen, dptr)\
- DVB_LOOP_INIT(ptr, len, off, lptr, llen);\
- DVB_DESC_EACH(lptr, llen, dtag, dlen, dptr)\
+#define DVB_DESC_FOREACH(mt, ptr, len, off, lptr, llen, dtag, dlen, dptr)\
+ DVB_LOOP_INIT(mt, ptr, len, off, lptr, llen);\
+ DVB_DESC_EACH(mt, lptr, llen, dtag, dlen, dptr)\
/*
* SI typedefs
LIST_ENTRY(mpegts_table) mt_link;
RB_HEAD(,mpegts_psi_table_state) mt_state;
+ int mt_subsys;
char *mt_name;
void *mt_opaque;
( mpegts_psi_table_t *, const uint8_t *buf, int len );
void dvb_table_parse_init
- ( mpegts_psi_table_t *mt, const char *name, int pid, void *opaque );
+ ( mpegts_psi_table_t *mt, const char *name, int subsys, int pid, void *opaque );
void dvb_table_parse_done ( mpegts_psi_table_t *mt);
};
if (i > 0)
- tvhlog(LOG_INFO, "charset", "%d entries loaded", i);
+ tvhinfo(LS_CHARSET, "%d entries loaded", i);
}
/*
int dvb_bouquets_parse = 1;
static int
-psi_parse_pmt(mpegts_mux_t *mux, mpegts_service_t *t,
+psi_parse_pmt(mpegts_table_t *mt, mpegts_service_t *t,
const uint8_t *ptr, int len, int *_update);
static inline int
dvb_service_autoenable( mpegts_service_t *s, const char *where )
{
if (!s->s_enabled && s->s_auto == SERVICE_AUTO_PAT_MISSING) {
- tvhinfo("mpegts", "enabling service %s [sid %04X/%d] (found in %s)",
+ tvhinfo(LS_MPEGTS, "enabling service %s [sid %04X/%d] (found in %s)",
s->s_nicename, s->s_dvb_service_id, s->s_dvb_service_id, where);
service_set_enabled((service_t *)s, 1, SERVICE_AUTO_NORMAL);
}
return;
}
}
- tvherror(mt->mt_name, "fastscan mux count overflow");
+ tvherror(mt->mt_subsys, "%s: fastscan mux count overflow", mt->mt_name);
}
#endif
bcdtoint(ptr[7]) * 100000 + bcdtoint(ptr[8]) * 1000 +
bcdtoint(ptr[9]) * 10 + (ptr[10] >> 4);
if (!frequency) {
- tvhlog(LOG_WARNING, mt->mt_name, "dvb-s frequency error");
+ tvhwarn(mt->mt_subsys, "%s: dvb-s frequency error", mt->mt_name);
return NULL;
}
if (!symrate) {
- tvhlog(LOG_WARNING, mt->mt_name, "dvb-s symbol rate error");
+ tvhwarn(mt->mt_subsys, "%s: dvb-s symbol rate error", mt->mt_name);
return NULL;
}
dmc.dmc_fe_rolloff = rtab[(ptr[6] >> 3) & 0x3];
if (dmc.dmc_fe_delsys == DVB_SYS_DVBS &&
dmc.dmc_fe_rolloff != DVB_ROLLOFF_35) {
- tvhwarn(mt->mt_name, "dvb-s rolloff error");
+ tvhwarn(mt->mt_subsys, "%s: dvb-s rolloff error", mt->mt_name);
return NULL;
}
/* Debug */
dvb_mux_conf_str(&dmc, buf, sizeof(buf));
- tvhdebug(mt->mt_name, " %s", buf);
+ tvhdebug(mt->mt_subsys, "%s: %s", mt->mt_name, buf);
/* Create */
return mm->mm_network->mn_create_mux(mm->mm_network, mm, onid, tsid, &dmc, force);
bcdtoint(ptr[7]) * 100000 + bcdtoint(ptr[8]) * 1000 +
bcdtoint(ptr[9]) * 10 + (ptr[10] >> 4);
if (!frequency) {
- tvhwarn(mt->mt_name, "dvb-c frequency error");
+ tvhwarn(mt->mt_subsys, "%s: dvb-c frequency error", mt->mt_name);
return NULL;
}
if (!symrate) {
- tvhwarn(mt->mt_name, "dvb-c symbol rate error");
+ tvhwarn(mt->mt_subsys, "%s: dvb-c symbol rate error", mt->mt_name);
return NULL;
}
/* Debug */
dvb_mux_conf_str(&dmc, buf, sizeof(buf));
- tvhdebug(mt->mt_name, " %s", buf);
+ tvhdebug(mt->mt_subsys, "%s: %s", mt->mt_name, buf);
/* Create */
return mm->mm_network->mn_create_mux(mm->mm_network, mm, onid, tsid, &dmc, 0);
/* Extract data */
frequency = ((ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3]);
if (frequency < 1000000 || frequency > 200000000) {
- tvhdebug(mt->mt_name, "dvb-t frequency error (%d)", frequency);
+ tvhdebug(mt->mt_subsys, "%s: dvb-t frequency error (%d)", mt->mt_name, frequency);
return NULL;
}
/* Debug */
dvb_mux_conf_str(&dmc, buf, sizeof(buf));
- tvhdebug(mt->mt_name, " %s", buf);
+ tvhdebug(mt->mt_subsys, "%s: %s", mt->mt_name, buf);
/* Create */
return mm->mm_network->mn_create_mux(mm->mm_network, mm, onid, tsid, &dmc, 0);
static int
dvb_desc_service_list
- ( const char *dstr, const uint8_t *ptr, int len, mpegts_mux_t *mm,
+ ( mpegts_table_t *mt, const uint8_t *ptr, int len, mpegts_mux_t *mm,
dvb_bat_id_t *bi )
{
uint16_t stype, sid;
for (i = 0; i < len; i += 3) {
sid = (ptr[i] << 8) | ptr[i+1];
stype = ptr[i+2];
- tvhdebug(dstr, " service %04X (%d) type %02X (%d)", sid, sid, stype, stype);
+ tvhdebug(mt->mt_subsys, "%s: service %04X (%d) type %02X (%d)", mt->mt_name, sid, sid, stype, stype);
if (mm) {
int save = 0;
s = mpegts_service_find(mm, sid, 0, 1, &save);
static int
dvb_desc_local_channel
- ( const char *dstr, const uint8_t *ptr, int len,
+ ( mpegts_table_t *mt, const uint8_t *ptr, int len,
uint8_t dtag, mpegts_mux_t *mm, dvb_bat_id_t *bi, int prefer )
{
int save = 0;
while(len >= 4) {
sid = (ptr[0] << 8) | ptr[1];
lcn = ((ptr[2] & 3) << 8) | ptr[3];
- tvhdebug(dstr, " sid %d lcn %d", sid, lcn);
+ tvhdebug(mt->mt_subsys, "%s: sid %d lcn %d", mt->mt_name, sid, lcn);
if (sid && lcn && mm) {
s = mpegts_service_find(mm, sid, 0, 0, &save);
if (s) {
static void
dvb_freesat_local_channels
- ( dvb_bat_id_t *bi, const char *dstr, const uint8_t *ptr, int len )
+ ( dvb_bat_id_t *bi, mpegts_table_t *mt, const uint8_t *ptr, int len )
{
uint16_t sid, lcn, regionid;
uint16_t unk;
len -= 5;
if (len2 > len)
break;
- tvhtrace(dstr, " sid %04X (%d) uknown %04X (%d)", sid, sid, unk, unk);
+ tvhtrace(mt->mt_subsys, "%s: sid %04X (%d) uknown %04X (%d)", mt->mt_name, sid, sid, unk, unk);
while (len2 > 3) {
lcn = ((ptr[0] & 0x0f) << 8) | ptr[1];
regionid = (ptr[2] << 8) | ptr[3];
- tvhtrace(dstr, " lcn %d region %d", lcn, regionid);
+ tvhtrace(mt->mt_subsys, "%s: lcn %d region %d", mt->mt_name, lcn, regionid);
TAILQ_FOREACH(fs, &bi->fservices, link)
if (fs->sid == sid && fs->regionid == regionid)
static void
dvb_freesat_regions
- ( dvb_bat_id_t *bi, const char *dstr, const uint8_t *ptr, int len )
+ ( dvb_bat_id_t *bi, mpegts_table_t *mt, const uint8_t *ptr, int len )
{
uint16_t id;
char name[32];
/* language: ptr[2-4]: 'eng' */
if ((r = dvb_get_string_with_len(name, sizeof(name), ptr + 5, len - 5, NULL, NULL)) < 0)
break;
- tvhtrace(dstr, " region %u - '%s'", id, name);
+ tvhtrace(mt->mt_subsys, "%s: region %u - '%s'", mt->mt_name, id, name);
LIST_FOREACH(fr, &bi->fregions, link)
if (fr->regionid == id)
static void
dvb_freesat_completed
- ( dvb_bat_t *b, dvb_bat_id_t *bi, const char *dstr )
+ ( dvb_bat_t *b, dvb_bat_id_t *bi, mpegts_table_t *mt )
{
dvb_bat_svc_t *bs;
dvb_freesat_svc_t *fs;
uint16_t sid;
uint32_t total = 0, regions = 0, uregions = 0;
- tvhtrace(dstr, "completed %s [%04X] bouquets '%s'",
- bi->freesat ? "freesat" : "bskyb", bi->nbid, bi->name);
+ tvhtrace(mt->mt_subsys, "%s: completed %s [%04X] bouquets '%s'",
+ mt->mt_name, bi->freesat ? "freesat" : "bskyb", bi->nbid, bi->name);
/* Find all "fallback" services and region specific */
TAILQ_FOREACH(bs, &bi->services, link) {
if (fr->regionid == fs->regionid)
break;
if (!fr)
- tvhtrace(dstr, "cannot find freesat region id %u", fs->regionid);
+ tvhtrace(mt->mt_subsys, "%s: cannot find freesat region id %u", mt->mt_name, fs->regionid);
else
TAILQ_INSERT_TAIL(&fr->services, fs, region_link);
}
}
}
- tvhtrace(dstr, "completed %s [%04X] bouquets '%s' total %u regions %u (%u)",
- bi->freesat ? "freesat" : "bskyb", bi->nbid, bi->name,
+ tvhtrace(mt->mt_subsys, "%s: completed %s [%04X] bouquets '%s' total %u regions %u (%u)",
+ mt->mt_name, bi->freesat ? "freesat" : "bskyb", bi->nbid, bi->name,
total, regions, uregions);
/* Remove all services associated to region, notify the completed status */
TAILQ_FOREACH(bs, &bi->services, link)
bs->fallback = NULL;
- tvhtrace(dstr, "completed %s [%04X] bouquets '%s' update finished",
- bi->freesat ? "freesat" : "bskyb", bi->nbid, bi->name);
+ tvhtrace(mt->mt_subsys, "%s: completed %s [%04X] bouquets '%s' update finished",
+ mt->mt_name, bi->freesat ? "freesat" : "bskyb", bi->nbid, bi->name);
}
static void
dvb_bskyb_local_channels
- ( dvb_bat_id_t *bi, const char *dstr,
+ ( dvb_bat_id_t *bi, mpegts_table_t *mt,
const uint8_t *ptr, int len, mpegts_mux_t *mm )
{
uint16_t sid, lcn, regionid;
len -= 2;
ptr += 2;
- tvhtrace(dstr, " region id %04X (%d) unknown %02X (%d)",
- regionid, regionid, ptr[0], ptr[0]);
+ tvhtrace(mt->mt_subsys, "%s: region id %04X (%d) unknown %02X (%d)",
+ mt->mt_name, regionid, regionid, ptr[0], ptr[0]);
while (len > 8) {
sid = (ptr[0] << 8) | ptr[1];
ptr += 9;
len -= 9;
- tvhtrace(dstr, " sid %04X (%d) type %02X (%d) lcn %d unknown %04X (%d)",
- sid, sid, stype, stype, lcn, unk, unk);
+ tvhtrace(mt->mt_subsys, "%s: sid %04X (%d) type %02X (%d) lcn %d unknown %04X (%d)",
+ mt->mt_name, sid, sid, stype, stype, lcn, unk, unk);
TAILQ_FOREACH(fs, &bi->fservices, link)
if (fs->sid == sid && fs->regionid == regionid)
if (tsid == 0 && !mm->mm_tsid_accept_zero_value) {
if (tvhlog_limit(&mm->mm_tsid_loglimit, 2)) {
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhwarn("pat", "%s: TSID zero value detected, ignoring", buf);
+ tvhwarn(mt->mt_subsys, "%s: %s: TSID zero value detected, ignoring", mt->mt_name, buf);
}
goto end;
}
/* Multiplex */
- tvhdebug("pat", "%p: tsid %04X (%d)", mm, tsid, tsid);
+ tvhdebug(mt->mt_subsys, "%s: %p: tsid %04X (%d)", mt->mt_name, mm, tsid, tsid);
if (mm->mm_tsid != MPEGTS_TSID_NONE) {
if (mm->mm_tsid && mm->mm_tsid != tsid) {
if (++mm->mm_tsid_checks > 12) {
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhwarn("pat", "%s: TSID change detected - old %04x (%d), new %04x (%d)",
- buf, mm->mm_tsid, mm->mm_tsid, tsid, tsid);
+ tvhwarn(mt->mt_subsys, "%s: %s: TSID change detected - old %04x (%d), new %04x (%d)",
+ mt->mt_name, buf, mm->mm_tsid, mm->mm_tsid, tsid, tsid);
} else {
if (tvhtrace_enabled()) {
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhtrace("pat", "%s: ignore TSID - old %04x (%d), new %04x (%d) (checks %d)",
- buf, mm->mm_tsid, mm->mm_tsid, tsid, tsid, mm->mm_tsid_checks);
+ tvhtrace(mt->mt_subsys, "%s: %s: ignore TSID - old %04x (%d), new %04x (%d) (checks %d)",
+ mt->mt_name, buf, mm->mm_tsid, mm->mm_tsid, tsid, tsid, mm->mm_tsid_checks);
}
return 0; /* keep rolling */
}
if (sid == 0) {
if (pid) {
nit_pid = pid;
- tvhdebug("pat", " nit on pid %04X (%d)", pid, pid);
+ tvhdebug(mt->mt_subsys, "%s: nit on pid %04X (%d)", mt->mt_name, pid, pid);
}
/* Service */
} else if (pid) {
- tvhdebug("pat", " sid %04X (%d) on pid %04X (%d)", sid, sid, pid, pid);
+ tvhdebug(mt->mt_subsys, "%s: sid %04X (%d) on pid %04X (%d)", mt->mt_name, sid, sid, pid, pid);
int save = 0;
if ((s = mpegts_service_find(mm, sid, pid, 1, &save))) {
mpegts_table_add(mm, DVB_PMT_BASE, DVB_PMT_MASK, dvb_pmt_callback,
- NULL, "pmt",
+ NULL, "pmt", LS_TBL_BASE,
MT_CRC | MT_QUICKREQ | MT_ONESHOT | MT_SCANSUBS,
pid, MPS_WEIGHT_PMT_SCAN);
/* Install NIT handler */
if (nit_pid)
mpegts_table_add(mm, DVB_NIT_BASE, DVB_NIT_MASK, dvb_nit_callback,
- NULL, "nit", MT_QUICKREQ | MT_CRC, nit_pid,
+ NULL, "nit", LS_TBL_BASE, MT_QUICKREQ | MT_CRC, nit_pid,
MPS_WEIGHT_NIT);
/* End */
if (len >= 4 && dlen >= 4) {
caid = ( ptr[0] << 8) | ptr[1];
pid = ((ptr[2] & 0x1f) << 8) | ptr[3];
- tvhdebug("cat", " caid %04X (%d) pid %04X (%d)",
- (uint16_t)caid, (uint16_t)caid, pid, pid);
+ tvhdebug(mt->mt_subsys, "%s: caid %04X (%d) pid %04X (%d)",
+ mt->mt_name, (uint16_t)caid, (uint16_t)caid, pid, pid);
}
break;
default:
if (!s) return -1;
/* Process */
- tvhdebug("pmt", "sid %04X (%d)", sid, sid);
+ tvhdebug(mt->mt_subsys, "%s: sid %04X (%d)", mt->mt_name, sid, sid);
update = 0;
pthread_mutex_lock(&s->s_stream_mutex);
- r = psi_parse_pmt(mt->mt_mux, s, ptr, len, &update);
+ r = psi_parse_pmt(mt, s, ptr, len, &update);
pthread_mutex_unlock(&s->s_stream_mutex);
if (r)
service_restart((service_t*)s);
static void
dvb_bat_completed
- ( dvb_bat_t *b, const char *dstr, int tableid, int tsid, int nbid,
+ ( dvb_bat_t *b, mpegts_table_t *mt, int tableid, int tsid, int nbid,
mpegts_mux_t *mux, bouquet_t *bq_alt )
{
dvb_bat_id_t *bi;
if (bi->freesat || bi->bskyb) {
#if ENABLE_MPEGTS_DVB
- dvb_freesat_completed(b, bi, dstr);
+ dvb_freesat_completed(b, bi, mt);
#endif
goto complete;
}
mpegts_mux_nice_name(mux, buf, sizeof(buf));
else
strcpy(buf, "<none>");
- tvhdebug(mt->mt_name, " onid %04X (%d) tsid %04X (%d) mux %s%s",
- onid, onid, tsid, tsid, buf, discovery ? " (discovery)" : "");
+ tvhdebug(mt->mt_subsys, "%s: onid %04X (%d) tsid %04X (%d) mux %s%s",
+ mt->mt_name, onid, onid, tsid, tsid, buf, discovery ? " (discovery)" : "");
- DVB_DESC_FOREACH(lptr, llen, 4, dlptr, dllen, dtag, dlen, dptr) {
- tvhtrace(mt->mt_name, " dtag %02X dlen %d", dtag, dlen);
+ DVB_DESC_FOREACH(mt, lptr, llen, 4, dlptr, dllen, dtag, dlen, dptr) {
+ tvhtrace(mt->mt_subsys, "%s: dtag %02X dlen %d", mt->mt_name, dtag, dlen);
#if ENABLE_MPEGTS_DVB
/* Limit delivery descriptiors only in the discovery phase */
case DVB_DESC_DEF_AUTHORITY:
if (dvb_get_string(dauth, sizeof(dauth), dptr, dlen, charset, NULL))
return -1;
- tvhdebug(mt->mt_name, " default auth [%s]", dauth);
+ tvhdebug(mt->mt_subsys, "%s: default auth [%s]", mt->mt_name, dauth);
if (mux && *dauth)
mpegts_mux_set_crid_authority(mux, dauth);
break;
case DVB_DESC_PRIVATE_DATA:
if (dlen == 4) {
priv = (dptr[0] << 24) | (dptr[1] << 16) | (dptr[2] << 8) | dptr[3];
- tvhtrace(mt->mt_name, " private %08X", priv);
+ tvhtrace(mt->mt_subsys, "%s: private %08X", mt->mt_name, priv);
}
break;
case 0x81:
/* Network Descriptors */
*name = 0;
charset = dvb_charset_find(mn, NULL, NULL);
- DVB_DESC_FOREACH(ptr, len, 5, lptr, llen, dtag, dlen, dptr) {
- tvhtrace(mt->mt_name, " dtag %02X dlen %d", dtag, dlen);
+ DVB_DESC_FOREACH(mt, ptr, len, 5, lptr, llen, dtag, dlen, dptr) {
+ tvhtrace(mt->mt_subsys, "%s: dtag %02X dlen %d", mt->mt_name, dtag, dlen);
switch (dtag) {
case DVB_DESC_BOUQUET_NAME:
case DVB_DESC_PRIVATE_DATA:
if (tableid == 0x4A && dlen == 4) {
priv = (dptr[0] << 24) | (dptr[1] << 16) | (dptr[2] << 8) | dptr[3];
- tvhtrace(mt->mt_name, " private %08X", priv);
+ tvhtrace(mt->mt_subsys, "%s: private %08X", mt->mt_name, priv);
}
break;
case DVB_DESC_FREESAT_REGIONS:
/* Fastscan */
if (tableid == DVB_FASTSCAN_NIT_BASE) {
- tvhdebug(mt->mt_name, "fastscan %04X (%d) [%s]", nbid, nbid, name);
+ tvhdebug(mt->mt_subsys, "%s: fastscan %04X (%d) [%s]", mt->mt_name, nbid, nbid, name);
if (bq && bi) {
dvb_bouquet_comment(bq, mm);
bq->bq_fastscan_bi = bi;
/* BAT */
} else if (tableid == 0x4A) {
- tvhdebug(mt->mt_name, "bouquet %04X (%d) [%s]", nbid, nbid, name);
+ tvhdebug(mt->mt_subsys, "%s: bouquet %04X (%d) [%s]", mt->mt_name, nbid, nbid, name);
if (bi && *name) {
strncpy(bi->name, name, sizeof(bi->name)-1);
bi->name[sizeof(bi->name)-1] = '\0';
/* NIT */
} else {
- tvhdebug(mt->mt_name, "network %04X (%d) [%s]", nbid, nbid, name);
+ tvhdebug(mt->mt_subsys, "%s: network %04X (%d) [%s]", mt->mt_name, nbid, nbid, name);
save |= mpegts_network_set_network_name(mn, name);
if (save)
idnode_changed(&mn->mn_id);
}
/* Transport length */
- DVB_LOOP_FOREACH(ptr, len, 0, lptr, llen, 6) {
+ DVB_LOOP_FOREACH(mt, ptr, len, 0, lptr, llen, 6) {
tsid = (lptr[0] << 8) | lptr[1];
onid = (lptr[2] << 8) | lptr[3];
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhdebug("sdt", "mux %s", buf);
+ tvhdebug(mt->mt_subsys, "%s: mux %s", mt->mt_name, buf);
/* Service loop */
while(len >= 5) {
int running_status = (ptr[3] >> 5) & 0x7;
const char *charset;
*sprov = *sname = *sauth = 0;
- tvhdebug("sdt", " sid %04X (%d) running %d free_ca %d",
- service_id, service_id, running_status, free_ca_mode);
+ tvhdebug(mt->mt_subsys, "%s: sid %04X (%d) running %d free_ca %d",
+ mt->mt_name, service_id, service_id, running_status, free_ca_mode);
/* Initialise the loop */
- DVB_LOOP_INIT(ptr, len, 3, lptr, llen);
+ DVB_LOOP_INIT(mt, ptr, len, 3, lptr, llen);
/* Find service */
s = mpegts_service_find(mm, service_id, 0, 1, &save);
dvb_service_autoenable(s, "SDT");
/* Descriptor loop */
- DVB_DESC_EACH(lptr, llen, dtag, dlen, dptr) {
- tvhtrace("sdt", " dtag %02X dlen %d", dtag, dlen);
+ DVB_DESC_EACH(mt, lptr, llen, dtag, dlen, dptr) {
+ tvhtrace(mt->mt_subsys, "%s: dtag %02X dlen %d", mt->mt_name, dtag, dlen);
switch (dtag) {
case DVB_DESC_SERVICE:
if (dvb_desc_service(dptr, dlen, &stype, sprov,
case DVB_DESC_PRIVATE_DATA:
if (dlen == 4) {
priv = (dptr[0] << 24) | (dptr[1] << 16) | (dptr[2] << 8) | dptr[3];
- tvhtrace(mt->mt_name, " private %08X", priv);
+ tvhtrace(mt->mt_subsys, "%s: private %08X", mt->mt_name, priv);
}
break;
case DVB_DESC_BSKYB_NVOD:
}
}
- tvhtrace("sdt", " type %02X (%d) name [%s] provider [%s] def_auth [%s]",
- stype, stype, sname, sprov, sauth);
+ tvhtrace(mt->mt_subsys, "%s: type %02X (%d) name [%s] provider [%s] def_auth [%s]",
+ mt->mt_name, stype, stype, sname, sprov, sauth);
if (!s) continue;
/* Update service type */
int r;
s->s_dvb_servicetype = stype;
save = 1;
- tvhtrace("sdt", " type changed / old %02X (%i)",
- s->s_dvb_servicetype, s->s_dvb_servicetype);
+ tvhtrace(mt->mt_subsys, "%s: type changed / old %02X (%i)",
+ mt->mt_name, s->s_dvb_servicetype, s->s_dvb_servicetype);
/* Set tvh service type */
if ((r = dvb_servicetype_lookup(stype)) != -1)
if (*sauth && strcmp(s->s_dvb_cridauth ?: "", sauth)) {
tvh_str_update(&s->s_dvb_cridauth, sauth);
save = 1;
- tvhtrace("sdt", " cridauth changed");
+ tvhtrace(mt->mt_subsys, "%s: cridauth changed", mt->mt_name);
}
/* Update name */
if (!s->s_dvb_svcname || master) {
tvh_str_update(&s->s_dvb_svcname, sname);
save2 = 1;
- tvhtrace("sdt", " name changed");
+ tvhtrace(mt->mt_subsys, "%s: name changed", mt->mt_name);
}
}
if (!s->s_dvb_provider || master) {
tvh_str_update(&s->s_dvb_provider, sprov);
save2 = 1;
- tvhtrace("sdt", " provider changed");
+ tvhtrace(mt->mt_subsys, "%s: provider changed", mt->mt_name);
}
}
pthread_mutex_lock(&s->s_stream_mutex);
service_make_nicename((service_t*)s);
pthread_mutex_unlock(&s->s_stream_mutex);
- tvhdebug("sdt", " nicename %s", s->s_nicename);
+ tvhdebug(mt->mt_subsys, "%s: nicename %s", mt->mt_name, s->s_nicename);
save = 1;
}
if (r != 1) return r;
/* ID */
- tvhdebug("sdt", "onid %04X (%d) tsid %04X (%d)", onid, onid, tsid, tsid);
+ tvhdebug(mt->mt_subsys, "%s: onid %04X (%d) tsid %04X (%d)",
+ mt->mt_name, onid, onid, tsid, tsid);
/* Service descriptors */
len -= 8;
r = dvb_table_begin((mpegts_psi_table_t *)mt, ptr, len,
tableid, extraid, 7, &st, §, &last, &ver);
if (r != 1) return r;
- tvhdebug("vct", "tsid %04X (%d)", tsid, tsid);
+ tvhdebug(mt->mt_subsys, "%s: tsid %04X (%d)", mt->mt_name, tsid, tsid);
/* # channels */
count = ptr[6];
- tvhdebug("vct", "channel count %d", count);
+ tvhdebug(mt->mt_subsys, "%s: channel count %d", mt->mt_name, count);
ptr += 7;
len -= 7;
for (i = 0; i < count && len >= 32; i++) {
sid = (ptr[24]) << 8 | ptr[25];
type = ptr[27] & 0x3f;
srcid = (ptr[28]) << 8 | ptr[29];
- tvhdebug("vct", "tsid %04X (%d)", tsid, tsid);
- tvhdebug("vct", "sid %04X (%d)", sid, sid);
- tvhdebug("vct", "chname %s", chname);
- tvhdebug("vct", "chnum %d.%d", maj, min);
- tvhdebug("vct", "type %02X (%d)", type, type);
- tvhdebug("vct", "srcid %04X (%d)", srcid, srcid);
- tvhdebug("vct", "dlen %d", dlen);
+ tvhdebug(mt->mt_subsys, "%s: tsid %04X (%d)", mt->mt_name, tsid, tsid);
+ tvhdebug(mt->mt_subsys, "%s: sid %04X (%d)", mt->mt_name, sid, sid);
+ tvhdebug(mt->mt_subsys, "%s: chname %s", mt->mt_name, chname);
+ tvhdebug(mt->mt_subsys, "%s: chnum %d.%d", mt->mt_name, maj, min);
+ tvhdebug(mt->mt_subsys, "%s: type %02X (%d)", mt->mt_name, type, type);
+ tvhdebug(mt->mt_subsys, "%s: srcid %04X (%d)", mt->mt_name, srcid, srcid);
+ tvhdebug(mt->mt_subsys, "%s: dlen %d", mt->mt_name, dlen);
/* Skip */
if (type > 3)
x = lang_str_get(ls, "eng");
if (x)
snprintf(chname, sizeof(chname), "%s", x);
- tvhdebug("vct", " extended channel name: '%s' (%d bytes)", x, len);
+ tvhdebug(mt->mt_subsys, "%s: extended channel name: '%s' (%d bytes)", mt->mt_name, x, len);
lang_str_destroy(ls);
}
} else {
- tvhdebug("vct", " tag 0x%02x, len %d", tag, len);
+ tvhdebug(mt->mt_subsys, "%s: tag 0x%02x, len %d", mt->mt_name, tag, len);
}
j += len + 2;
}
gps_utc_offset = ptr[10];
is_dst = ptr[11] >> 7;
- tvhdebug("stt", "system_time %d, gps_utc_offset %d, is DST %d",
- systemtime, gps_utc_offset, is_dst);
+ tvhdebug(mt->mt_subsys, "%s: system_time %d, gps_utc_offset %d, is DST %d",
+ mt->mt_name, systemtime, gps_utc_offset, is_dst);
return dvb_table_end((mpegts_psi_table_t *)mt, st, sect);
}
/* (ptr[14] << 8) | ptr[15] - pcr pid */
/* Initialise the loop */
- DVB_LOOP_INIT(ptr, len, 16, lptr, llen);
+ DVB_LOOP_INIT(mt, ptr, len, 16, lptr, llen);
if (discovery) {
/* Descriptor loop */
- DVB_DESC_EACH(lptr, llen, dtag, dlen, dptr) {
+ DVB_DESC_EACH(mt, lptr, llen, dtag, dlen, dptr) {
switch (dtag) {
case DVB_DESC_SAT_DEL:
- tvhtrace(mt->mt_name, " dtag %02X dlen %d (discovery) onid %04X (%d) tsid %04X (%d)",
- dtag, dlen, onid, onid, tsid, tsid);
+ tvhtrace(mt->mt_subsys, "%s: dtag %02X dlen %d (discovery) onid %04X (%d) tsid %04X (%d)",
+ mt->mt_name, dtag, dlen, onid, onid, tsid, tsid);
mux = dvb_desc_sat_del(mt, mm, onid, tsid, dptr, dlen, 1);
if (mux) {
mpegts_mux_set_onid(mux, onid);
continue;
}
- tvhdebug(mt->mt_name, " service %04X (%d) onid %04X (%d) tsid %04X (%d)",
- service_id, service_id, onid, onid, tsid, tsid);
+ tvhdebug(mt->mt_subsys, "%s: service %04X (%d) onid %04X (%d) tsid %04X (%d)",
+ mt->mt_name, service_id, service_id, onid, onid, tsid, tsid);
/* Find existing mux */
mux = dvb_fs_mux_find(mm, onid, tsid);
if (mux == NULL) {
- tvhtrace(mt->mt_name, " mux not found");
+ tvhtrace(mt->mt_subsys, "%s: mux not found", mt->mt_name);
continue;
}
mn = mux->mm_network;
charset = dvb_charset_find(mn, mux, s);
/* Descriptor loop */
- DVB_DESC_EACH(lptr, llen, dtag, dlen, dptr) {
- tvhtrace(mt->mt_name, " dtag %02X dlen %d", dtag, dlen);
+ DVB_DESC_EACH(mt, lptr, llen, dtag, dlen, dptr) {
+ tvhtrace(mt->mt_subsys, "%s: dtag %02X dlen %d", mt->mt_name, dtag, dlen);
switch (dtag) {
case DVB_DESC_SERVICE:
if (dvb_desc_service(dptr, dlen, &stype, sprov,
}
}
- tvhtrace(mt->mt_name, " type %d name [%s] provider [%s]",
- stype, sname, sprov);
+ tvhtrace(mt->mt_subsys, "%s: type %d name [%s] provider [%s]",
+ mt->mt_name, stype, sname, sprov);
if (bi)
dvb_bat_find_service(bi, s, 0, UINT_MAX);
int r;
s->s_dvb_servicetype = stype;
save = 1;
- tvhtrace(mt->mt_name, " type changed");
+ tvhtrace(mt->mt_subsys, "%s: type changed", mt->mt_name);
/* Set tvh service type */
if ((r = dvb_servicetype_lookup(stype)) != -1)
if (!s->s_dvb_svcname) {
tvh_str_update(&s->s_dvb_svcname, sname);
save = 1;
- tvhtrace(mt->mt_name, " name changed");
+ tvhtrace(mt->mt_subsys, "%s: name changed", mt->mt_name);
}
}
if (!s->s_dvb_provider) {
tvh_str_update(&s->s_dvb_provider, sprov);
save = 1;
- tvhtrace(mt->mt_name, " provider changed");
+ tvhtrace(mt->mt_subsys, "%s: provider changed", mt->mt_name);
}
}
pthread_mutex_lock(&s->s_stream_mutex);
service_make_nicename((service_t*)s);
pthread_mutex_unlock(&s->s_stream_mutex);
- tvhdebug(mt->mt_name, " nicename %s", s->s_nicename);
+ tvhdebug(mt->mt_subsys, "%s: nicename %s", mt->mt_name, s->s_nicename);
/* Save changes */
idnode_changed(&s->s_id);
service_refresh_channel((service_t*)s);
*/
static int
psi_desc_add_ca
- (mpegts_service_t *t, uint16_t caid, uint32_t provid, uint16_t pid)
+ (mpegts_table_t *mt, mpegts_service_t *t,
+ uint16_t caid, uint32_t provid, uint16_t pid)
{
elementary_stream_t *st;
caid_t *c;
int r = 0;
- tvhdebug("pmt", " caid %04X (%s) provider %08X pid %04X",
- caid, caid2name(caid), provid, pid);
+ tvhdebug(mt->mt_subsys, "%s: caid %04X (%s) provider %08X pid %04X",
+ mt->mt_name, caid, caid2name(caid), provid, pid);
if((st = service_stream_find((service_t*)t, pid)) == NULL) {
st = service_stream_create((service_t*)t, pid, SCT_CA);
* Parser for CA descriptors
*/
static int
-psi_desc_ca(mpegts_service_t *t, const uint8_t *buffer, int size)
+psi_desc_ca(mpegts_table_t *mt, mpegts_service_t *t, const uint8_t *buffer, int size)
{
int r = 0;
int i;
uint16_t xpid = ((buffer[i]&0x1F) << 8) | buffer[i + 1];
uint16_t xprovid = (buffer[i + 2] << 8) | buffer[i + 3];
- r |= psi_desc_add_ca(t, caid, xprovid, xpid);
+ r |= psi_desc_add_ca(mt, t, caid, xprovid, xpid);
}
break;
case 0x0500:// Viaccess
break;
}
- r |= psi_desc_add_ca(t, caid, provid, pid);
+ r |= psi_desc_add_ca(mt, t, caid, provid, pid);
return r;
}
*/
static int
psi_parse_pmt
- (mpegts_mux_t *mux, mpegts_service_t *t, const uint8_t *ptr, int len, int *_update)
+ (mpegts_table_t *mt, mpegts_service_t *t, const uint8_t *ptr, int len, int *_update)
{
int ret = 0;
uint16_t pcr_pid, pid;
int video_stream;
const char *lang;
uint8_t audio_type;
-
+ mpegts_mux_t *mux = mt->mt_mux;
caid_t *c, *cn;
lock_assert(&t->s_stream_mutex);
t->s_pcr_pid = pcr_pid;
update |= PMT_UPDATE_PCR;
}
- tvhdebug("pmt", " pcr_pid %04X", pcr_pid);
+ tvhdebug(mt->mt_subsys, "%s: pcr_pid %04X", mt->mt_name, pcr_pid);
ptr += 9;
len -= 9;
dtag = ptr[0];
dlen = ptr[1];
- tvhlog_hexdump("pmt", ptr, dlen + 2);
+ tvhlog_hexdump(mt->mt_subsys, ptr, dlen + 2);
len -= 2; ptr += 2; dllen -= 2;
if(dlen > len)
break;
switch(dtag) {
case DVB_DESC_CA:
- update |= psi_desc_ca(t, ptr, dlen);
+ update |= psi_desc_ca(mt, t, ptr, dlen);
break;
default:
estype = ptr[0];
pid = (ptr[1] & 0x1f) << 8 | ptr[2];
dllen = (ptr[3] & 0xf) << 8 | ptr[4];
- tvhdebug("pmt", " pid %04X estype %d", pid, estype);
- tvhlog_hexdump("pmt", ptr, 5);
+ tvhdebug(mt->mt_subsys, "%s: pid %04X estype %d", mt->mt_name, pid, estype);
+ tvhlog_hexdump(mt->mt_subsys, ptr, 5);
ptr += 5;
len -= 5;
dtag = ptr[0];
dlen = ptr[1];
- tvhlog_hexdump("pmt", ptr, dlen + 2);
+ tvhlog_hexdump(mt->mt_subsys, ptr, dlen + 2);
len -= 2; ptr += 2; dllen -= 2;
if(dlen > len)
break;
switch(dtag) {
case DVB_DESC_CA:
- update |= psi_desc_ca(t, ptr, dlen);
+ update |= psi_desc_ca(mt, t, ptr, dlen);
break;
case DVB_DESC_VIDEO_STREAM:
st->es_delete_me = 0;
- tvhdebug("pmt", " type %s position %d",
- streaming_component_type2txt(st->es_type), position);
+ tvhdebug(mt->mt_subsys, "%s: type %s position %d",
+ mt->mt_name, streaming_component_type2txt(st->es_type), position);
if (lang)
- tvhdebug("pmt", " language %s", lang);
+ tvhdebug(mt->mt_subsys, "%s: language %s", mt->mt_name, lang);
if (composition_id != -1)
- tvhdebug("pmt", " composition_id %d", composition_id);
+ tvhdebug(mt->mt_subsys, "%s: composition_id %d", mt->mt_name, composition_id);
if (ancillary_id != -1)
- tvhdebug("pmt", " ancillary_id %d", ancillary_id);
+ tvhdebug(mt->mt_subsys, "%s: ancillary_id %d", mt->mt_name, ancillary_id);
if(st->es_position != position) {
update |= PMT_REORDERED;
sort_elementary_streams((service_t*)t);
if(update) {
- tvhdebug("pmt", "Service \"%s\" PMT (version %d) updated"
+ tvhdebug(mt->mt_subsys, "%s: Service \"%s\" PMT (version %d) updated"
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+ mt->mt_name,
service_nicename((service_t*)t), version,
update&PMT_UPDATE_PCR ? ", PCR PID changed":"",
update&PMT_UPDATE_NEW_STREAM ? ", New elementary stream":"",
psi_tables_default ( mpegts_mux_t *mm )
{
mpegts_table_add(mm, DVB_PAT_BASE, DVB_PAT_MASK, dvb_pat_callback,
- NULL, "pat", MT_QUICKREQ | MT_CRC | MT_RECORD,
+ NULL, "pat", LS_TBL_BASE, MT_QUICKREQ | MT_CRC | MT_RECORD,
DVB_PAT_PID, MPS_WEIGHT_PAT);
mpegts_table_add(mm, DVB_CAT_BASE, DVB_CAT_MASK, dvb_cat_callback,
- NULL, "cat", MT_QUICKREQ | MT_CRC, DVB_CAT_PID,
+ NULL, "cat", LS_TBL_BASE, MT_QUICKREQ | MT_CRC, DVB_CAT_PID,
MPS_WEIGHT_CAT);
}
static void
psi_tables_dvb_fastscan( void *aux, bouquet_t *bq, const char *name, int pid )
{
- tvhtrace("fastscan", "adding table %04X (%i) for '%s'", pid, pid, name);
+ tvhtrace(LS_FASTSCAN, "adding table %04X (%i) for '%s'", pid, pid, name);
bq->bq_fastscan_nit = 1;
bq->bq_fastscan_sdt = 1;
mpegts_table_add(aux, DVB_FASTSCAN_NIT_BASE, DVB_FASTSCAN_MASK,
- dvb_nit_callback, bq, "fs_nit", MT_CRC, pid,
+ dvb_nit_callback, bq, "fs_nit", LS_FASTSCAN, MT_CRC, pid,
MPS_WEIGHT_NIT2);
mpegts_table_add(aux, DVB_FASTSCAN_SDT_BASE, DVB_FASTSCAN_MASK,
- dvb_fs_sdt_callback, bq, "fs_sdt", MT_CRC, pid,
+ dvb_fs_sdt_callback, bq, "fs_sdt", LS_FASTSCAN, MT_CRC, pid,
MPS_WEIGHT_SDT2);
}
#endif
psi_tables_dvb ( mpegts_mux_t *mm )
{
mpegts_table_add(mm, DVB_NIT_BASE, DVB_NIT_MASK, dvb_nit_callback,
- NULL, "nit", MT_QUICKREQ | MT_CRC, DVB_NIT_PID,
+ NULL, "nit", LS_TBL_BASE, MT_QUICKREQ | MT_CRC, DVB_NIT_PID,
MPS_WEIGHT_NIT);
mpegts_table_add(mm, DVB_SDT_BASE, DVB_SDT_MASK, dvb_sdt_callback,
- NULL, "sdt", MT_QUICKREQ | MT_CRC | MT_RECORD,
+ NULL, "sdt", LS_TBL_BASE, MT_QUICKREQ | MT_CRC | MT_RECORD,
DVB_SDT_PID, MPS_WEIGHT_SDT);
mpegts_table_add(mm, DVB_BAT_BASE, DVB_BAT_MASK, dvb_bat_callback,
- NULL, "bat", MT_CRC, DVB_BAT_PID, MPS_WEIGHT_BAT);
+ NULL, "bat", LS_TBL_BASE, MT_CRC, DVB_BAT_PID, MPS_WEIGHT_BAT);
if (config.tvhtime_update_enabled) {
mpegts_table_add(mm, DVB_TDT_BASE, DVB_TDT_MASK, dvb_tdt_callback,
- NULL, "tdt", MT_ONESHOT | MT_QUICKREQ | MT_RECORD,
+ NULL, "tdt", LS_TBL_TIME, MT_ONESHOT | MT_QUICKREQ | MT_RECORD,
DVB_TDT_PID, MPS_WEIGHT_TDT);
mpegts_table_add(mm, DVB_TOT_BASE, DVB_TOT_MASK, dvb_tot_callback,
- NULL, "tot", MT_ONESHOT | MT_QUICKREQ | MT_CRC | MT_RECORD,
+ NULL, "tot", LS_TBL_TIME, MT_ONESHOT | MT_QUICKREQ | MT_CRC | MT_RECORD,
DVB_TDT_PID, MPS_WEIGHT_TDT);
}
#if ENABLE_MPEGTS_DVB
psi_tables_atsc_c ( mpegts_mux_t *mm )
{
mpegts_table_add(mm, DVB_VCT_C_BASE, DVB_VCT_MASK, atsc_vct_callback,
- NULL, "vct", MT_QUICKREQ | MT_CRC | MT_RECORD,
+ NULL, "vct", LS_TBL_ATSC, MT_QUICKREQ | MT_CRC | MT_RECORD,
DVB_VCT_PID, MPS_WEIGHT_VCT);
mpegts_table_add(mm, DVB_ATSC_STT_BASE, DVB_ATSC_STT_MASK, atsc_stt_callback,
- NULL, "stt", MT_QUICKREQ | MT_CRC | MT_RECORD,
+ NULL, "stt", LS_TBL_ATSC, MT_QUICKREQ | MT_CRC | MT_RECORD,
DVB_ATSC_STT_PID, MPS_WEIGHT_STT);
}
psi_tables_atsc_t ( mpegts_mux_t *mm )
{
mpegts_table_add(mm, DVB_VCT_T_BASE, DVB_VCT_MASK, atsc_vct_callback,
- NULL, "vct", MT_QUICKREQ | MT_CRC | MT_RECORD,
+ NULL, "vct", LS_TBL_ATSC, MT_QUICKREQ | MT_CRC | MT_RECORD,
DVB_VCT_PID, MPS_WEIGHT_VCT);
mpegts_table_add(mm, DVB_ATSC_STT_BASE, DVB_ATSC_STT_MASK, atsc_stt_callback,
- NULL, "stt", MT_QUICKREQ | MT_CRC | MT_RECORD,
+ NULL, "stt", LS_TBL_ATSC, MT_QUICKREQ | MT_CRC | MT_RECORD,
DVB_ATSC_STT_PID, MPS_WEIGHT_STT);
}
if(crc && tvh_crc32(p, tsize, 0xffffffff)) {
if (tvhlog_limit(&mt->mt_err_log, 10)) {
- tvhwarn(mt->mt_name, "%s: invalid checksum (len %i, errors %zi)",
- logpref, tsize, mt->mt_err_log.count);
+ tvhwarn(mt->mt_subsys, "%s: %s: invalid checksum (len %i, errors %zi)",
+ mt->mt_name, logpref, tsize, mt->mt_err_log.count);
}
return -1;
}
if (cc & 0x10) {
if (mt->mt_sect.ps_cc != -1 && mt->mt_sect.ps_cc != (cc & 0x0f)) {
uint16_t pid = ((tsb[1] & 0x1f) << 8) | tsb[2];
- tvhdebug(mt->mt_name, "%s: PID %04X CC error %d != %d",
- logprefix, pid, cc & 0x0f, mt->mt_sect.ps_cc);
+ tvhdebug(mt->mt_subsys, "%s: %s: PID %04X CC error %d != %d",
+ mt->mt_name, logprefix, pid, cc & 0x0f, mt->mt_sect.ps_cc);
mt->mt_sect.ps_lock = 0;
}
mt->mt_sect.ps_cc = (cc + 1) & 0x0f;
mpegts_psi_table_state_t *st;
RB_FOREACH(st, &mt->mt_state, link)
total++;
- tvhtrace(mt->mt_name, "incomplete %d complete %d total %d",
- mt->mt_incomplete, mt->mt_complete, total);
+ tvhtrace(mt->mt_subsys, "%s: incomplete %d complete %d total %d",
+ mt->mt_name, mt->mt_incomplete, mt->mt_complete, total);
return 2;
}
if (!mt->mt_finished)
- tvhdebug(mt->mt_name, "completed pid %d table %08X / %08x", mt->mt_pid, mt->mt_table, mt->mt_mask);
+ tvhdebug(mt->mt_subsys, "%s: completed pid %d table %08X / %08x",
+ mt->mt_name, mt->mt_pid, mt->mt_table, mt->mt_mask);
mt->mt_finished = 1;
return 0;
}
for (sa = 0; sa < 8; sa++)
rem |= st->sections[sa];
if (rem) return 1;
- tvhtrace(mt->mt_name, " tableid %02X extraid %016" PRIx64 " completed",
- st->tableid, st->extraid);
+ tvhtrace(mt->mt_subsys, "%s: tableid %02X extraid %016" PRIx64 " completed",
+ mt->mt_name, st->tableid, st->extraid);
st->complete = 1;
mt->mt_incomplete--;
return dvb_table_complete(mt);
/* Not long enough */
if (len < minlen) {
- tvhdebug(mt->mt_name, "invalid table length %d min %d", len, minlen);
+ tvhdebug(mt->mt_subsys, "%s: invalid table length %d min %d", mt->mt_name, len, minlen);
return -1;
}
if((ptr[2] & 1) == 0)
return -1;
- tvhtrace(mt->mt_name, "pid %02X tableid %02X extraid %016" PRIx64 " len %d",
- mt->mt_pid, tableid, extraid, len);
+ tvhtrace(mt->mt_subsys, "%s: pid %02X tableid %02X extraid %016" PRIx64 " len %d",
+ mt->mt_name, mt->mt_pid, tableid, extraid, len);
/* Section info */
if (sect && ret) {
*last = ptr[4];
*ver = (ptr[2] >> 1) & 0x1F;
*ret = st = mpegts_table_state_find(mt, tableid, extraid, *last);
- tvhtrace(mt->mt_name, " section %d last %d ver %d (ver %d st %d incomp %d comp %d)",
- *sect, *last, *ver, st->version, st->complete, mt->mt_incomplete, mt->mt_complete);
+ tvhtrace(mt->mt_subsys, "%s: section %d last %d ver %d (ver %d st %d incomp %d comp %d)",
+ mt->mt_name, *sect, *last, *ver, st->version, st->complete, mt->mt_incomplete, mt->mt_complete);
#if 0 // FIXME, cannot be enabled in this form
/* Ignore previous version */
mt->mt_complete--;
if (st->complete)
mt->mt_incomplete++;
- tvhtrace(mt->mt_name, " new version, restart");
+ tvhtrace(mt->mt_subsys, "%s: new version, restart", mt->mt_name);
mpegts_table_state_reset(mt, st, *last);
st->version = *ver;
}
/* Complete? */
if (st->complete) {
- tvhtrace(mt->mt_name, " skip, already complete (%i)", st->complete);
+ tvhtrace(mt->mt_subsys, "%s: skip, already complete (%i)", mt->mt_name, st->complete);
if (st->complete == 1) {
st->complete = 2;
mt->mt_complete++;
sa = *sect / 32;
sb = *sect % 32;
if (!(st->sections[sa] & (0x1 << (31 - sb)))) {
- tvhtrace(mt->mt_name, " skip, already seen");
+ tvhtrace(mt->mt_subsys, "%s: skip, already seen", mt->mt_name);
return -1;
}
}
- tvhlog_hexdump(mt->mt_name, ptr, len);
+ tvhlog_hexdump(mt->mt_subsys, ptr, len);
return 1;
}
{
mpegts_psi_table_state_t *st;
- tvhtrace(mt->mt_name, "pid %02X complete reset", mt->mt_pid);
+ tvhtrace(mt->mt_subsys, "%s: pid %02X complete reset", mt->mt_name, mt->mt_pid);
mt->mt_incomplete = 0;
mt->mt_complete = 0;
while ((st = RB_FIRST(&mt->mt_state)) != NULL) {
*/
void dvb_table_parse_init
- ( mpegts_psi_table_t *mt, const char *name, int pid, void *opaque )
+ ( mpegts_psi_table_t *mt, const char *name, int subsys, int pid, void *opaque )
{
memset(mt, 0, sizeof(*mt));
mt->mt_name = strdup(name);
+ mt->mt_subsys = subsys;
mt->mt_opaque = opaque;
mt->mt_pid = pid;
mt->mt_sect.ps_cc = -1;
char buf[256];
stringcount = src[0];
- tvhtrace("atsc-str", "%d strings", stringcount);
+ tvhtrace(LS_MPEGTS, "atsc-str: %d strings", stringcount);
src++;
srclen--;
langcode[2] = src[2];
segmentcount = src[3];
- tvhtrace("atsc-str", " %d: lang '%s', segments %d", i, langcode, segmentcount);
+ tvhtrace(LS_MPEGTS, "atsc-str: %d: lang '%s', segments %d", i, langcode, segmentcount);
src += 4;
srclen -= 4;
return ls;
if (mode == 0 && compressiontype == 0) {
- tvhtrace("atsc-str", " %d: comptype 0x%02x, mode 0x%02x, %d bytes: '%.*s'",
+ tvhtrace(LS_MPEGTS, "atsc-str: %d: comptype 0x%02x, mode 0x%02x, %d bytes: '%.*s'",
j, compressiontype, mode, bytecount, bytecount, src);
memcpy(buf, src, bytecount);
buf[bytecount] = '\0';
ls = lang_str_create();
lang_str_append(ls, buf, langcode);
} else {
- tvhtrace("atsc-str", " %d: comptype 0x%02x, mode 0x%02x, %d bytes",
+ tvhtrace(LS_MPEGTS, "atsc-str: %d: comptype 0x%02x, mode 0x%02x, %d bytes",
j, compressiontype, mode, bytecount);
}
return;
fail:
- tvhwarn("fastscan", "wrong entry format");
+ tvhwarn(LS_FASTSCAN, "wrong entry format");
}
/*
htsmsg_field_t *f;
if (!(c = hts_settings_load("fastscan"))) {
- tvhwarn("fastscan", "configuration file missing");
+ tvhwarn(LS_FASTSCAN, "configuration file missing");
return;
}
while (num) {
r = RB_INSERT_SORTED(&iptv_handlers, ih, link, ih_cmp);
if (r)
- tvhwarn("iptv", "attempt to re-register handler for %s",
+ tvhwarn(LS_IPTV, "attempt to re-register handler for %s",
ih->scheme);
num--;
ih++;
} else {
if (urlparse(raw ?: "", &url)) {
- tvherror("iptv", "%s - invalid URL [%s]", buf, raw);
+ tvherror(LS_IPTV, "%s - invalid URL [%s]", buf, raw);
return ret;
}
scheme = url.scheme;
/* Find scheme handler */
ih = iptv_handler_find(scheme ?: "");
if (!ih) {
- tvherror("iptv", "%s - unsupported scheme [%s]", buf, scheme ?: "none");
+ tvherror(LS_IPTV, "%s - unsupported scheme [%s]", buf, scheme ?: "none");
return ret;
}
im->im_pcr_start += s64;
im->im_pcr += (((s64 / 10LL) * 9LL) + 4LL) / 10LL;
im->im_pcr &= PTS_MASK;
- tvhtrace("iptv-pcr", "pcr: updated %"PRId64", time start %"PRId64", limit %"PRId64,
+ tvhtrace(LS_IPTV_PCR, "pcr: updated %"PRId64", time start %"PRId64", limit %"PRId64,
im->im_pcr, im->im_pcr_start, limit);
/* queued more than 3 seconds? trigger the pause */
if (iptv_input_pause_check(im)) {
pause = 1;
} else {
- tvhtrace("iptv-pcr", "unpause timer callback");
+ tvhtrace(LS_IPTV_PCR, "unpause timer callback");
im->im_handler->pause(im, 0);
pause = 0;
}
nfds = tvhpoll_wait(iptv_poll, &ev, 1, -1);
if ( nfds < 0 ) {
if (tvheadend_is_running() && !ERRNO_AGAIN(errno)) {
- tvhlog(LOG_ERR, "iptv", "poll() error %s, sleeping 1 second",
- strerror(errno));
+ tvherror(LS_IPTV, "poll() error %s, sleeping 1 second",
+ strerror(errno));
sleep(1);
}
continue;
if (im->mm_active) {
/* Get data */
if ((n = im->im_handler->read(im)) < 0) {
- tvhlog(LOG_ERR, "iptv", "read() error %s", strerror(errno));
+ tvherror(LS_IPTV, "read() error %s", strerror(errno));
im->im_handler->stop(im);
break;
}
if (in->in_max_bandwidth &&
in->in_bps > in->in_max_bandwidth * 1024) {
if (!in->in_bw_limited) {
- tvhinfo("iptv", "%s bandwidth limited exceeded",
+ tvhinfo(LS_IPTV, "%s bandwidth limited exceeded",
idnode_get_title(&in->mn_id, NULL));
in->in_bw_limited = 1;
}
mmi = im->mm_active;
if (mmi) {
if (iptv_input_pause_check(im)) {
- tvhtrace("iptv-pcr", "pcr: paused");
+ tvhtrace(LS_IPTV_PCR, "pcr: paused");
return 1;
}
mpegts_input_recv_packets((mpegts_input_t*)iptv_input, mmi,
im->im_pcr = pcr.pcr_first;
im->im_pcr_start = getfastmonoclock();
im->im_pcr_end = im->im_pcr_start + ((s64 * 100LL) + 50LL) / 9LL;
- tvhtrace("iptv-pcr", "pcr: first %"PRId64" last %"PRId64", time start %"PRId64", end %"PRId64,
+ tvhtrace(LS_IPTV_PCR, "pcr: first %"PRId64" last %"PRId64", time start %"PRId64", end %"PRId64,
pcr.pcr_first, pcr.pcr_last, im->im_pcr_start, im->im_pcr_end);
}
} else {
s64 = pts_diff(im->im_pcr, pcr.pcr_last);
if (s64 != PTS_UNSET) {
im->im_pcr_end = im->im_pcr_start + ((s64 * 100LL) + 50LL) / 9LL;
- tvhtrace("iptv-pcr", "pcr: last %"PRId64", time end %"PRId64, pcr.pcr_last, im->im_pcr_end);
+ tvhtrace(LS_IPTV_PCR, "pcr: last %"PRId64", time end %"PRId64, pcr.pcr_last, im->im_pcr_end);
}
}
if (iptv_input_pause_check(im)) {
- tvhtrace("iptv-pcr", "pcr: paused");
+ tvhtrace(LS_IPTV_PCR, "pcr: paused");
return 1;
}
}
/* Error? */
if (tvhpoll_add(iptv_poll, &ev, 1) == -1) {
mpegts_mux_nice_name((mpegts_mux_t*)im, buf, sizeof(buf));
- tvherror("iptv", "%s - failed to add to poll q", buf);
+ tvherror(LS_IPTV, "%s - failed to add to poll q", buf);
close(im->mm_iptv_fd);
im->mm_iptv_fd = -1;
return -1;
/* Error? */
if (tvhpoll_add(iptv_poll, &ev, 1) == -1) {
mpegts_mux_nice_name((mpegts_mux_t*)im, buf, sizeof(buf));
- tvherror("iptv", "%s - failed to add to poll q (2)", buf);
+ tvherror(LS_IPTV, "%s - failed to add to poll q (2)", buf);
close(im->mm_iptv_fd2);
im->mm_iptv_fd2 = -1;
return -1;
if (total == 0)
ret = -1;
else
- tvhinfo("iptv", "m3u parse: %d new mux(es) in network '%s' (total %d)",
+ tvhinfo(LS_IPTV, "m3u parse: %d new mux(es) in network '%s' (total %d)",
count, in->mn_network_name, total);
return ret;
}
}
}
if (count > 0)
- tvhinfo("iptv", "removed %d mux(es) from network '%s'", count, in->mn_network_name);
+ tvhinfo(LS_IPTV, "removed %d mux(es) from network '%s'", count, in->mn_network_name);
} else {
LIST_FOREACH(mm, &in->mn_muxes, mm_network_link)
((iptv_mux_t *)mm)->im_delete_flag = 0;
- tvherror("iptv", "unknown playlist format for network '%s'", in->mn_network_name);
+ tvherror(LS_IPTV, "unknown playlist format for network '%s'", in->mn_network_name);
}
return -1;
auto_private_t *ap = calloc(1, sizeof(auto_private_t));
ap->in_network = in;
in->in_auto = ap;
- download_init(&ap->in_download, "iptv");
+ download_init(&ap->in_download, LS_IPTV);
ap->in_download.process = iptv_auto_network_process;
ap->in_download.stop = iptv_auto_network_stop;
iptv_auto_network_trigger(in);
int fd = tvh_open(raw + 7, O_RDONLY | O_NONBLOCK, 0);
if (fd < 0) {
- tvherror("iptv", "unable to open file '%s'", raw + 7);
+ tvherror(LS_IPTV, "unable to open file '%s'", raw + 7);
return -1;
}
if (sel && hp->hls_url == NULL) {
inf = htsmsg_get_map(sel, "stream-inf");
bandwidth = htsmsg_get_s64_or_default(inf, "BANDWIDTH", 0);
- tvhdebug("iptv", "HLS - selected stream %s, %"PRId64"kb/s, %s",
+ tvhdebug(LS_IPTV, "HLS - selected stream %s, %"PRId64"kb/s, %s",
htsmsg_get_str(inf, "RESOLUTION"),
bandwidth / 1024,
htsmsg_get_str(inf, "CODECS"));
hc->hc_keepalive = 0;
r = http_client_simple_reconnect(hc, &u, HTTP_VERSION_1_1);
if (r < 0)
- tvherror("iptv", "cannot reopen http client: %d'", r);
+ tvherror(LS_IPTV, "cannot reopen http client: %d'", r);
} else {
- tvherror("iptv", "m3u url invalid '%s'", url);
+ tvherror(LS_IPTV, "m3u url invalid '%s'", url);
}
urlreset(&u);
}
if (hp->hls_key) {
s = htsmsg_get_str(hp->hls_key, "METHOD");
if (s == NULL || strcmp(s, "AES-128")) {
- tvherror("iptv", "unknown crypto method '%s'", s);
+ tvherror(LS_IPTV, "unknown crypto method '%s'", s);
goto end;
}
memset(&hp->hls_aes128.iv, 0, sizeof(hp->hls_aes128.iv));
if (s != NULL) {
if (s[0] != '0' || (s[1] != 'x' && s[1] != 'X') ||
strlen(s) != (AES_BLOCK_SIZE * 2) + 2) {
- tvherror("iptv", "unknown IV type or length (%s)", s);
+ tvherror(LS_IPTV, "unknown IV type or length (%s)", s);
goto end;
}
hex2bin(hp->hls_aes128.iv, sizeof(hp->hls_aes128.iv), s + 2);
}
s = htsmsg_get_str(hp->hls_key, "URI");
if (s == NULL) {
- tvherror("iptv", "no URI in KEY attribute");
+ tvherror(LS_IPTV, "no URI in KEY attribute");
goto end;
}
hp->hls_encrypted = 1;
sbuf_reset(&hp->key_sbuf, 32);
}
}
- tvhtrace("iptv", "m3u url: '%s'", url);
+ tvhtrace(LS_IPTV, "m3u url: '%s'", url);
if (url == NULL) {
- tvherror("iptv", "m3u contents parsing failed");
+ tvherror(LS_IPTV, "m3u contents parsing failed");
goto fin;
}
new_m3u:
if (hp == NULL)
return 0;
- tvhtrace("iptv", "received key len %d", hp->key_sbuf.sb_ptr);
+ tvhtrace(LS_IPTV, "received key len %d", hp->key_sbuf.sb_ptr);
if (hp->key_sbuf.sb_ptr != AES_BLOCK_SIZE) {
- tvherror("iptv", "AES-128 key wrong length (%d)\n", hp->key_sbuf.sb_ptr);
+ tvherror(LS_IPTV, "AES-128 key wrong length (%d)\n", hp->key_sbuf.sb_ptr);
return 0;
}
AES_set_decrypt_key(hp->key_sbuf.sb_data, 128, &hp->hls_aes128.key);
goto err;
if (spawn_and_give_stdout(argv[0], argv, envp, &rd, &pid, 1)) {
- tvherror("iptv", "Unable to start pipe '%s' (wrong executable?)", raw);
+ tvherror(LS_IPTV, "Unable to start pipe '%s' (wrong executable?)", raw);
goto err;
}
im->mm_iptv_fd = -1;
im->im_data = NULL;
if (mclk() < im->mm_iptv_respawn_last + sec2mono(2)) {
- tvherror("iptv", "stdin pipe unexpectedly closed: %s",
+ tvherror(LS_IPTV, "stdin pipe unexpectedly closed: %s",
r < 0 ? strerror(errno) : "No data");
} else {
/* avoid deadlock here */
pthread_mutex_lock(&iptv_lock);
if (im->mm_active) {
if (iptv_pipe_start(im, im->mm_iptv_url_raw, NULL)) {
- tvherror("iptv", "unable to respawn %s", im->mm_iptv_url_raw);
+ tvherror(LS_IPTV, "unable to respawn %s", im->mm_iptv_url_raw);
} else {
iptv_input_fd_started(im);
im->mm_iptv_respawn_last = mclk();
static void
rtcp_send(iptv_rtcp_info_t *info, sbuf_t *buffer)
{
- tvhlog(LOG_DEBUG, "rtsp", "Sending receiver report");
+ tvhdebug(LS_IPTV, "RTCP: Sending receiver report");
// We don't care of the result right now
udp_write(info->connection, buffer->sb_data, buffer->sb_ptr, & info->connection->peer);
}
}
if (hc->hc_cmd == RTSP_CMD_GET_PARAMETER && hc->hc_code != HTTP_STATUS_OK) {
- tvhtrace("iptv", "GET_PARAMETER command returned invalid error code %d for '%s', "
+ tvhtrace(LS_IPTV, "GET_PARAMETER command returned invalid error code %d for '%s', "
"fall back to OPTIONS in keep alive loop.", hc->hc_code, im->mm_iptv_url_raw);
hc->hc_rtsp_keep_alive_cmd = RTSP_CMD_OPTIONS;
return 0;
}
if (hc->hc_code != HTTP_STATUS_OK) {
- tvherror("iptv", "invalid error code %d for '%s'", hc->hc_code, im->mm_iptv_url_raw);
+ tvherror(LS_IPTV, "invalid error code %d for '%s'", hc->hc_code, im->mm_iptv_url_raw);
return 0;
}
// Now let's set peer port for RTCP
// Use the HTTP host for sending RTCP reports, NOT the hc_rtp_dest (which is where the stream is sent)
if (udp_connect(rp->rtcp_info->connection, "rtcp", hc->hc_host, hc->hc_rtcp_server_port)) {
- tvhlog(LOG_WARNING, "rtsp", "Can't connect to remote, RTCP receiver reports won't be sent");
+ tvhwarn(LS_RTSP, "Can't connect to remote, RTCP receiver reports won't be sent");
}
hc->hc_cmd = HTTP_CMD_NONE;
pthread_mutex_lock(&global_lock);
return 0;
if (len > 0)
- tvherror("iptv", "unknown data %zd received for '%s'", len, im->mm_iptv_url_raw);
+ tvherror(LS_IPTV, "unknown data %zd received for '%s'", len, im->mm_iptv_url_raw);
return 0;
}
hc->hc_rtsp_pass = strdup(u->pass);
if (udp_bind_double(&rtp, &rtcp,
- "IPTV", "rtp", "rtcp",
+ LS_IPTV, "rtp", "rtcp",
NULL, 0, NULL,
128*1024, 16384, 4*1024, 4*1024) < 0) {
http_client_close(hc);
mpegts_mux_nice_name((mpegts_mux_t*)im, name, sizeof(name));
- conn = udp_bind("iptv", name, url->host, url->port,
+ conn = udp_bind(LS_IPTV, name, url->host, url->port,
im->mm_iptv_interface, IPTV_BUF_SIZE, 4*1024);
if (conn == UDP_FATAL_ERROR)
return SM_CODE_TUNING_FAILED;
if (im->mm_iptv_rtp_seq < 0xffff && im->mm_iptv_rtp_seq > 0x3ff) {
mpegts_mux_nice_name((mpegts_mux_t*)im, name, sizeof(name));
- tvherror("iptv", "receving non-raw UDP data for %s!", name);
+ tvherror(LS_IPTV, "receving non-raw UDP data for %s!", name);
im->mm_iptv_rtp_seq = 0x10000; /* no further logs! */
}
seq = nseq;
else if (((seq + 1) & 0xffff) != nseq) {
unc += (len / 188) * (uint32_t)((uint16_t)nseq-(uint16_t)(seq+1));
- tvhtrace("iptv", "RTP discontinuity (%i != %i)", seq + 1, nseq);
+ tvhtrace(LS_IPTV, "RTP discontinuity (%i != %i)", seq + 1, nseq);
}
seq = nseq;
return NULL;
}
- tvhinfo("linuxdvb", "adapter added %s", path);
+ tvhinfo(LS_LINUXDVB, "adapter added %s", path);
return la;
}
tvh_safe_usleep(100000);
}
if (fd < 0) {
- tvhlog(LOG_ERR, "linuxdvb", "unable to open %s", fe_path);
+ tvherror(LS_LINUXDVB, "unable to open %s", fe_path);
continue;
}
#if DVB_VER_ATLEAST(5,5)
r = ioctl(fd, FE_GET_INFO, &dfi);
close(fd);
if(r) {
- tvhlog(LOG_ERR, "linuxdvb", "unable to query %s", fe_path);
+ tvherror(LS_LINUXDVB, "unable to query %s", fe_path);
continue;
}
type = linuxdvb_get_type(dfi.type);
if (type == DVB_TYPE_NONE) {
- tvhlog(LOG_ERR, "linuxdvb", "unable to determine FE type %s - %i", fe_path, dfi.type);
+ tvherror(LS_LINUXDVB, "unable to determine FE type %s - %i", fe_path, dfi.type);
continue;
}
if (!la) {
la = linuxdvb_adapter_new(path, a, dfi.name, &conf, &save);
if (la == NULL) {
- tvhlog(LOG_ERR, "linuxdvb", "failed to create %s", path);
+ tvherror(LS_LINUXDVB, "failed to create %s", path);
return; // Note: save to return here as global_lock is held
}
if (conf)
tvh_safe_usleep(100000);
}
if (fd < 0) {
- tvhlog(LOG_ERR, "linuxdvb", "unable to open %s", ca_path);
+ tvherror(LS_LINUXDVB, "unable to open %s", ca_path);
continue;
}
r = ioctl(fd, CA_RESET, NULL);
close(fd);
if(r) {
- tvhlog(LOG_ERR, "linuxdvb", "unable to query %s", ca_path);
+ tvherror(LS_LINUXDVB, "unable to query %s", ca_path);
continue;
}
if (!la) {
la = linuxdvb_adapter_new(path, a, ca_path, &conf, &save);
if (la == NULL) {
- tvhlog(LOG_ERR, "linuxdvb", "failed to create %s", path);
+ tvherror(LS_LINUXDVB, "failed to create %s", path);
return; // Note: save to return here as global_lock is held
}
}
la->la_exclusive = 1;
for (i = 0; i < ARRAY_SIZE(fetypes); i++)
if (fetypes[i] > 0)
- tvhwarn("linuxdvb", "adapter %d has tuner count %d for type %s (wrong config)",
+ tvhwarn(LS_LINUXDVB, "adapter %d has tuner count %d for type %s (wrong config)",
a, fetypes[i], dvb_type2str(i));
} else if (!r && j > 1) {
la->la_exclusive = 1;
- tvhinfo("linuxdvb", "adapter %d setting exlusive flag", a);
+ tvhinfo(LS_LINUXDVB, "adapter %d setting exlusive flag", a);
}
#endif
static void
devdvb_delete ( fsmonitor_t *fsm, const char *path )
{
- tvhinfo("linuxdvb", "adapter removed %s", path);
+ tvhinfo(LS_LINUXDVB, "adapter removed %s", path);
linuxdvb_adapter_del(path);
}
-/*
+ /*
* Tvheadend - Linux DVB CA
*
* Copyright (C) 2015 Damjan Marion
if (lca->lca_ai_version != 3)
return 0;
- tvhinfo("en50221", "setting CI+ CAM data rate to %s Mbps", rate ? "96":"72");
+ tvhinfo(LS_EN50221, "setting CI+ CAM data rate to %s Mbps", rate ? "96":"72");
return en50221_sl_send_data(lca->lca_sl, lca->lca_ai_session_number, data, sizeof(data));
}
if (lca->lca_enabled) {
if (lca->lca_ca_fd < 0) {
lca->lca_ca_fd = tvh_open(lca->lca_ca_path, O_RDWR | O_NONBLOCK, 0);
- tvhtrace("linuxdvb", "opening ca%u %s (fd %d)",
+ tvhtrace(LS_LINUXDVB, "opening ca%u %s (fd %d)",
lca->lca_number, lca->lca_ca_path, lca->lca_ca_fd);
}
} else {
- tvhtrace("linuxdvb", "closing ca%u %s (fd %d)",
+ tvhtrace(LS_LINUXDVB, "closing ca%u %s (fd %d)",
lca->lca_number, lca->lca_ca_path, lca->lca_ca_fd);
if (lca->lca_en50221_thread_running) {
uint16_t session_num, uint32_t resource_id,
uint8_t *data, uint32_t data_length)
{
- tvhtrace("en50221", "unknown message slot_id %u, session_num %u, resource_id %x",
+ tvhtrace(LS_EN50221, "unknown message slot_id %u, session_num %u, resource_id %x",
slot_id, session_num, resource_id);
- tvhlog_hexdump("en50221", data, data_length);
+ tvhlog_hexdump(LS_EN50221, data, data_length);
return 0;
}
*connected_rid = EN50221_APP_MMI_RESOURCEID;
break;
default:
- tvhtrace("en50221", "lookup cb for unknown resource id %x on slot %u",
+ tvhtrace(LS_EN50221, "lookup cb for unknown resource id %x on slot %u",
requested_rid, slot_id);
*callback_out = (en50221_sl_resource_callback) en50221_app_unknown_message;
*arg_out = lca;
linuxdvb_ca_t * lca = arg;
if (reason == S_SCALLBACK_REASON_CAMCONNECTING) {
- tvhtrace("en50221", "0x%08x session %u connecting", rid, session_num);
+ tvhtrace(LS_EN50221, "0x%08x session %u connecting", rid, session_num);
return 0;
}
if (reason == S_SCALLBACK_REASON_CAMCONNECTED) {
- tvhtrace("en50221", "0x%08x session %u connected", rid, session_num);
+ tvhtrace(LS_EN50221, "0x%08x session %u connected", rid, session_num);
switch(rid) {
case EN50221_APP_RM_RESOURCEID:
en50221_app_rm_enq(lca->lca_rm_resource, session_num);
case EN50221_APP_DATETIME_RESOURCEID:
break;
default:
- tvhtrace("en50221", "session %u with unknown rid 0x%08x is connected",
+ tvhtrace(LS_EN50221, "session %u with unknown rid 0x%08x is connected",
session_num, rid);
}
return 0;
}
if (reason == S_SCALLBACK_REASON_CLOSE) {
- tvhtrace("en50221", "0x%08x session %u close", rid, session_num);
+ tvhtrace(LS_EN50221, "0x%08x session %u close", rid, session_num);
switch(rid) {
case EN50221_APP_CA_RESOURCEID:
dvbcam_unregister_cam(lca, 0);
}
if (reason == S_SCALLBACK_REASON_TC_CONNECT) {
- tvhtrace("en50221", "0x%08x session %u tc connect", rid, session_num);
+ tvhtrace(LS_EN50221, "0x%08x session %u tc connect", rid, session_num);
return 0;
}
- tvhtrace("en50221", "unhandled session callback - reason %d slot_id %u "
+ tvhtrace(LS_EN50221, "unhandled session callback - reason %d slot_id %u "
"session_num %u resource_id %x", reason, slot_id, session_num, rid);
return 0;
}
{
linuxdvb_ca_t * lca = arg;
- tvhtrace("en50221", "rm enq callback received for slot %d", slot_id);
+ tvhtrace(LS_EN50221, "rm enq callback received for slot %d", slot_id);
if (en50221_app_rm_reply(lca->lca_rm_resource, session_num,
sizeof(resource_ids)/4, resource_ids))
{
- tvherror("en50221", "failed to send rm reply to slot %u session %u",
+ tvherror(LS_EN50221, "failed to send rm reply to slot %u session %u",
slot_id, session_num);
}
{
linuxdvb_ca_t * lca = arg;
- tvhtrace("en50221", "rm reply cb received for slot %d, count %u", slot_id,
+ tvhtrace(LS_EN50221, "rm reply cb received for slot %d, count %u", slot_id,
resource_id_count);
uint32_t i;
for(i=0; i< resource_id_count; i++) {
- tvhtrace("en50221", "CAM provided resource id: %08x", _resource_ids[i]);
+ tvhtrace(LS_EN50221, "CAM provided resource id: %08x", _resource_ids[i]);
}
if (en50221_app_rm_changed(lca->lca_rm_resource, session_num)) {
- tvherror("en50221", "failed to send RM reply on slot %u", slot_id);
+ tvherror(LS_EN50221, "failed to send RM reply on slot %u", slot_id);
}
return 0;
uint16_t session_num)
{
linuxdvb_ca_t * lca = arg;
- tvhtrace("en50221", "rm changed cb received for slot %d", slot_id);
+ tvhtrace(LS_EN50221, "rm changed cb received for slot %d", slot_id);
if (en50221_app_rm_enq(lca->lca_rm_resource, session_num)) {
- tvherror("en50221", "failed to send ENQ to slot %d", slot_id);
+ tvherror(LS_EN50221, "failed to send ENQ to slot %d", slot_id);
}
return 0;
uint8_t response_int)
{
linuxdvb_ca_t * lca = arg;
- tvhtrace("en50221", "datetime enquiry cb received for slot %d", slot_id);
+ tvhtrace(LS_EN50221, "datetime enquiry cb received for slot %d", slot_id);
if (en50221_app_datetime_send(lca->lca_dt_resource, session_num, time(NULL), -1)) {
- tvherror("en50221", "Failed to send datetime to slot %d", slot_id);
+ tvherror(LS_EN50221, "Failed to send datetime to slot %d", slot_id);
}
return 0;
{
linuxdvb_ca_t * lca = arg;
- tvhinfo("en50221", "CAM slot %u: Application type: %02x, manufacturer: %04x,"
+ tvhinfo(LS_EN50221, "CAM slot %u: Application type: %02x, manufacturer: %04x,"
" Manufacturer code: %04x", slot_id, app_type, app_manufacturer,
manufacturer_code);
- tvhinfo("en50221", "CAM slot %u: Menu string: %.*s", slot_id,
+ tvhinfo(LS_EN50221, "CAM slot %u: Menu string: %.*s", slot_id,
menu_string_len, menu_string);
snprintf(lca->lca_cam_menu_string, sizeof(lca->lca_cam_menu_string),
caid2name(ca_ids[i]));
}
- tvhinfo("en50221", "CAM slot %u supported CAIDs: %s", slot_id, buf);
+ tvhinfo(LS_EN50221, "CAM slot %u supported CAIDs: %s", slot_id, buf);
return 0;
}
default: str = "state unknown (unknown value received)";
}
- tvhinfo("en50221", "CAM slot %u: descrambling %s", slot_id, str);
+ tvhinfo(LS_EN50221, "CAM slot %u: descrambling %s", slot_id, str);
return 0;
}
linuxdvb_ca_mmi_close_cb(void *arg, uint8_t slot_id, uint16_t session_num,
uint8_t cmd_id, uint8_t delay)
{
- tvhtrace("en50221", "mmi close cb received for slot %u session_num %u "
+ tvhtrace(LS_EN50221, "mmi close cb received for slot %u session_num %u "
"cmd_id 0x%02x delay %u" , slot_id, session_num, cmd_id, delay);
return 0;
{
linuxdvb_ca_t * lca = arg;
- tvhtrace("en50221", "mmi display ctl cb received for slot %u session_num %u "
+ tvhtrace(LS_EN50221, "mmi display ctl cb received for slot %u session_num %u "
"cmd_id 0x%02x mmi_mode %u" , slot_id, session_num, cmd_id, mmi_mode);
if (cmd_id == MMI_DISPLAY_CONTROL_CMD_ID_SET_MMI_MODE) {
d.u.mode_ack.mmi_mode = mmi_mode;
if (en50221_app_mmi_display_reply(lca->lca_mmi_resource, session_num,
MMI_DISPLAY_REPLY_ID_MMI_MODE_ACK, &d)) {
- tvherror("en50221","Slot %u: Failed to send MMI mode ack reply", slot_id);
+ tvherror(LS_EN50221,"Slot %u: Failed to send MMI mode ack reply", slot_id);
}
}
snprintf(buffer, sizeof(buffer), "%.*s", text_size, text);
- tvhlog(LOG_NOTICE, "en50221", "MMI enquiry from CAM in slot %u: %s (%s%u digits)",
- slot_id, buffer, blind_answ ? "blind " : "" , exp_answ_len);
+ tvhnotice(LS_EN50221, "MMI enquiry from CAM in slot %u: %s (%s%u digits)",
+ slot_id, buffer, blind_answ ? "blind " : "" , exp_answ_len);
if (lca->lca_pin_reply &&
(strlen((char *) lca->lca_pin_str) == exp_answ_len) &&
strstr((char *) buffer, lca->lca_pin_match_str))
{
- tvhtrace("en50221", "answering to PIN enquiry");
+ tvhtrace(LS_EN50221, "answering to PIN enquiry");
en50221_app_mmi_answ(lca->lca_mmi_resource, session_num,
MMI_ANSW_ID_ANSWER, (uint8_t *) lca->lca_pin_str,
exp_answ_len);
{
linuxdvb_ca_t * lca = arg;
- tvhlog(LOG_NOTICE, "en50221", "MMI menu from CAM in the slot %u:", slot_id);
- tvhlog(LOG_NOTICE, "en50221", " title: %.*s", title->text_length, title->text);
- tvhlog(LOG_NOTICE, "en50221", " subtitle: %.*s", sub_title->text_length, sub_title->text);
+ tvhnotice(LS_EN50221, "MMI menu from CAM in the slot %u:", slot_id);
+ tvhnotice(LS_EN50221, " title: %.*s", title->text_length, title->text);
+ tvhnotice(LS_EN50221, " subtitle: %.*s", sub_title->text_length, sub_title->text);
uint32_t i;
for(i=0; i< item_count; i++) {
- tvhlog(LOG_NOTICE, "en50221", " item %i: %.*s", i+1, items[i].text_length, items[i].text);
+ tvhnotice(LS_EN50221, " item %i: %.*s", i+1, items[i].text_length, items[i].text);
}
- tvhlog(LOG_NOTICE, "en50221", " bottom: %.*s", bottom->text_length, bottom->text);
+ tvhnotice(LS_EN50221, " bottom: %.*s", bottom->text_length, bottom->text);
/* cancel menu */
en50221_app_mmi_close(lca->lca_mmi_resource, session_num,
{
linuxdvb_ca_t * lca = arg;
- tvhlog(LOG_NOTICE, "en50221", "MMI list from CAM in the slot %u:", slot_id);
- tvhlog(LOG_NOTICE, "en50221", " title: %.*s", title->text_length, title->text);
- tvhlog(LOG_NOTICE, "en50221", " subtitle: %.*s", sub_title->text_length, sub_title->text);
+ tvhnotice(LS_EN50221, "MMI list from CAM in the slot %u:", slot_id);
+ tvhnotice(LS_EN50221, " title: %.*s", title->text_length, title->text);
+ tvhnotice(LS_EN50221, " subtitle: %.*s", sub_title->text_length, sub_title->text);
uint32_t i;
for(i=0; i< item_count; i++) {
- tvhlog(LOG_NOTICE, "en50221", " item %i: %.*s", i+1, items[i].text_length, items[i].text);
+ tvhnotice(LS_EN50221, " item %i: %.*s", i+1, items[i].text_length, items[i].text);
}
- tvhlog(LOG_NOTICE, "en50221", " bottom: %.*s", bottom->text_length, bottom->text);
+ tvhnotice(LS_EN50221, " bottom: %.*s", bottom->text_length, bottom->text);
/* cancel menu */
en50221_app_mmi_close(lca->lca_mmi_resource, session_num,
lca->lca_tl = en50221_tl_create(5, 32);
if (!lca->lca_tl) {
- tvherror("en50221", "failed to create transport layer");
+ tvherror(LS_EN50221, "failed to create transport layer");
return NULL;
}
slot_id = en50221_tl_register_slot(lca->lca_tl, lca->lca_ca_fd, 0, 1000, 100);
if (slot_id < 0) {
- tvherror("en50221", "slot registration failed");
+ tvherror(LS_EN50221, "slot registration failed");
return NULL;
}
lca->lca_sl = en50221_sl_create(lca->lca_tl, 256);
if (lca->lca_sl == NULL) {
- tvherror("en50221", "failed to create session layer");
+ tvherror(LS_EN50221, "failed to create session layer");
return NULL;
}
int error;
if ((error = en50221_tl_poll(lca->lca_tl)) != 0) {
if (error != lasterror) {
- tvherror("en50221", "poll error on slot %d [error:%i]",
+ tvherror(LS_EN50221, "poll error on slot %d [error:%i]",
en50221_tl_get_error_slot(lca->lca_tl),
en50221_tl_get_error(lca->lca_tl));
}
if (lca->lca_ca_fd >= 0) {
if ((ioctl(lca->lca_ca_fd, CA_GET_SLOT_INFO, &csi)) != 0) {
- tvherror("linuxdvb", "failed to get CAM slot %u info [e=%s]",
+ tvherror(LS_LINUXDVB, "failed to get CAM slot %u info [e=%s]",
csi.num, strerror(errno));
}
if (csi.flags & CA_CI_MODULE_READY)
lca->lca_state_str = ca_slot_state2str(state);
if (lca->lca_state != state) {
- tvhlog(LOG_INFO, "linuxdvb", "CAM slot %u status changed to %s",
- csi.num, lca->lca_state_str);
+ tvhnotice(LS_LINUXDVB, "CAM slot %u status changed to %s",
+ csi.num, lca->lca_state_str);
idnode_notify_title_changed(&lca->lca_id, NULL);
lca->lca_state = state;
}
return;
if (!(section = section_codec(lcc->data, lcc->len))){
- tvherror("en50221", "failed to decode PMT section");
+ tvherror(LS_EN50221, "failed to decode PMT section");
goto done;
}
if (!(result = section_ext_decode(section, 0))){
- tvherror("en50221", "failed to decode PMT ext_section");
+ tvherror(LS_EN50221, "failed to decode PMT ext_section");
goto done;
}
if (!(pmt = mpeg_pmt_section_codec(result))){
- tvherror("en50221", "failed to decode PMT");
+ tvherror(LS_EN50221, "failed to decode PMT");
goto done;
}
lcc->list_mgmt, lcc->cmd_id);
if (size < 0) {
- tvherror("en50221", "Failed to format CAPMT");
+ tvherror(LS_EN50221, "Failed to format CAPMT");
}
if (en50221_app_ca_pmt(lca->lca_ca_resource, lca->lca_ca_session_number,
capmt, size)) {
- tvherror("en50221", "Failed to send CAPMT");
+ tvherror(LS_EN50221, "Failed to send CAPMT");
}
- tvhtrace("en50221", "%s CAPMT sent (%s)", ca_pmt_cmd_id2str(lcc->cmd_id),
+ tvhtrace(LS_EN50221, "%s CAPMT sent (%s)", ca_pmt_cmd_id2str(lcc->cmd_id),
ca_pmt_list_mgmt2str(lcc->list_mgmt));
- tvhlog_hexdump("en50221", capmt, size);
+ tvhlog_hexdump(LS_EN50221, capmt, size);
done:
i = (lcc->cmd_id == CA_PMT_CMD_ID_QUERY) ?
TAILQ_INSERT_TAIL(&lca->lca_capmt_queue, lcc, lcc_link);
- tvhtrace("en50221", "%s CAPMT enqueued (%s)", ca_pmt_cmd_id2str(lcc->cmd_id),
+ tvhtrace(LS_EN50221, "%s CAPMT enqueued (%s)", ca_pmt_cmd_id2str(lcc->cmd_id),
ca_pmt_list_mgmt2str(lcc->list_mgmt));
}
/* transponder value - t */
*t = round((((freq / 1000) + 2 + le->le_frequency) / 4) - 350);
if (*t > 1024) {
- tvherror("en50494", "transponder value bigger then 1024");
+ tvherror(LS_EN50494, "transponder value bigger then 1024");
return -1;
}
*/
if (pthread_mutex_trylock(&linuxdvb_en50494_lock) != 0) {
if (pthread_mutex_lock(&linuxdvb_en50494_lock) != 0) {
- tvherror("en50494","failed to lock for tuning");
+ tvherror(LS_EN50494,"failed to lock for tuning");
return -1;
}
tvh_safe_usleep(20000);
/* use 18V */
ret = linuxdvb_diseqc_set_volt(lsp, 1);
if (ret) {
- tvherror("en50494", "error setting lnb voltage to 18V");
+ tvherror(LS_EN50494, "error setting lnb voltage to 18V");
break;
}
tvh_safe_usleep(15000); /* standard: 4ms < x < 22ms */
/* send tune command (with/without pin) */
- tvhdebug("en50494",
+ tvhdebug(LS_EN50494,
"lnb=%i id=%i freq=%i pin=%i v/h=%i l/u=%i f=%i, data=0x%02X%02X",
le->le_position, le->le_id, le->le_frequency, le->le_pin, pol,
band, freq, data1, data2);
data1, data2);
}
if (ret != 0) {
- tvherror("en50494", "error send tune command");
+ tvherror(LS_EN50494, "error send tune command");
break;
}
tvh_safe_usleep(50000); /* standard: 2ms < x < 60ms */
/* return to 13V */
ret = linuxdvb_diseqc_set_volt(lsp, 0);
if (ret) {
- tvherror("en50494", "error setting lnb voltage back to 13V");
+ tvherror(LS_EN50494, "error setting lnb voltage back to 13V");
break;
}
}
linuxdvb_en50494_init (void)
{
if (pthread_mutex_init(&linuxdvb_en50494_lock, NULL) != 0) {
- tvherror("en50494", "failed to init lock mutex");
+ tvherror(LS_EN50494, "failed to init lock mutex");
}
}
return NULL;
if (port > 1) {
- tvherror("en50494", "only 2 ports/positions are possible. given %i", port);
+ tvherror(LS_EN50494, "only 2 ports/positions are possible. given %i", port);
port = 0;
}
/* Ensure disabled */
if (!mi->mi_enabled) {
- tvhtrace("linuxdvb", "%s - disabling tuner", buf);
+ tvhtrace(LS_LINUXDVB, "%s - disabling tuner", buf);
if (lfe->lfe_fe_fd > 0) {
close(lfe->lfe_fe_fd);
lfe->lfe_fe_fd = -1;
/* Ensure FE opened (if not powersave) */
} else if (!lfe->lfe_powersave && lfe->lfe_fe_fd <= 0 && lfe->lfe_fe_path) {
lfe->lfe_fe_fd = tvh_open(lfe->lfe_fe_path, O_RDWR | O_NONBLOCK, 0);
- tvhtrace("linuxdvb", "%s - opening FE %s (%d)",
+ tvhtrace(LS_LINUXDVB, "%s - opening FE %s (%d)",
buf, lfe->lfe_fe_path, lfe->lfe_fe_fd);
}
}
mi->mi_display_name(mi, buf1, sizeof(buf1));
mpegts_mux_nice_name(mmi->mmi_mux, buf2, sizeof(buf2));
- tvhdebug("linuxdvb", "%s - stopping %s", buf1, buf2);
+ tvhdebug(LS_LINUXDVB, "%s - stopping %s", buf1, buf2);
/* Stop thread */
if (lfe->lfe_dvr_pipe.wr > 0) {
tvh_write(lfe->lfe_dvr_pipe.wr, "", 1);
- tvhtrace("linuxdvb", "%s - waiting for dvr thread", buf1);
+ tvhtrace(LS_LINUXDVB, "%s - waiting for dvr thread", buf1);
pthread_join(lfe->lfe_dvr_thread, NULL);
tvh_pipe_close(&lfe->lfe_dvr_pipe);
- tvhdebug("linuxdvb", "%s - stopped dvr thread", buf1);
+ tvhdebug(LS_LINUXDVB, "%s - stopped dvr thread", buf1);
}
/* Not locked */
{
linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)mi;
- tvhtrace("linuxdvb", "%s: network list for %s",
+ tvhtrace(LS_LINUXDVB, "%s: network list for %s",
mi->mi_name ?: "", dvb_type2str(lfe->lfe_type));
return dvb_network_list_by_fe_type(lfe->lfe_type);
#endif
lfe->mi_display_name((mpegts_input_t*)lfe, buf, sizeof(buf));
- tvhtrace("linuxdvb", "%s - checking FE status%s", buf, lfe->lfe_ready ? " (ready)" : "");
+ tvhtrace(LS_LINUXDVB, "%s - checking FE status%s", buf, lfe->lfe_ready ? " (ready)" : "");
/* Disabled */
if (!lfe->mi_enabled && mmi)
/* Close FE */
if (lfe->lfe_fe_fd > 0 && !lfe->lfe_refcount && lfe->lfe_powersave) {
- tvhtrace("linuxdvb", "%s - closing frontend", buf);
+ tvhtrace(LS_LINUXDVB, "%s - closing frontend", buf);
close(lfe->lfe_fe_fd);
lfe->lfe_fe_fd = -1;
if (lfe->lfe_satconf)
/* Check accessibility */
if (lfe->lfe_fe_fd <= 0) {
if (lfe->lfe_fe_path && access(lfe->lfe_fe_path, R_OK | W_OK)) {
- tvherror("linuxdvb", "%s - device is not accessible", buf);
+ tvherror(LS_LINUXDVB, "%s - device is not accessible", buf);
// TODO: disable device
return;
}
/* Get current status */
if (ioctl(lfe->lfe_fe_fd, FE_READ_STATUS, &fe_status) == -1) {
- tvhwarn("linuxdvb", "%s - FE_READ_STATUS error %s", buf, strerror(errno));
+ tvhwarn(LS_LINUXDVB, "%s - FE_READ_STATUS error %s", buf, strerror(errno));
/* TODO: check error value */
return;
/* Set default period */
if (fe_status != lfe->lfe_status) {
- tvhdebug("linuxdvb", "%s - status %7s (%s%s%s%s%s%s)", buf,
+ tvhdebug(LS_LINUXDVB, "%s - status %7s (%s%s%s%s%s%s)", buf,
signal2str(status),
(fe_status & FE_HAS_SIGNAL) ? "SIGNAL" : "",
(fe_status & FE_HAS_CARRIER) ? " | CARRIER" : "",
(fe_status & FE_HAS_LOCK) ? " | LOCK" : "",
(fe_status & FE_TIMEDOUT) ? "TIMEOUT" : "");
} else {
- tvhtrace("linuxdvb", "%s - status %d (%04X)", buf, status, fe_status);
+ tvhtrace(LS_LINUXDVB, "%s - status %d (%04X)", buf, status, fe_status);
}
retune = NOSIGNAL(fe_status) && NOSIGNAL(lfe->lfe_status) && !NOSIGNAL(lfe->lfe_status2);
lfe->lfe_status2 = lfe->lfe_status;
if (retune || lfe->lfe_nodata) {
lfe->lfe_nodata = 0;
if (lfe->lfe_locked && lfe->lfe_freq > 0) {
- tvhlog(LOG_WARNING, "linuxdvb", "%s - %s", buf, retune ? "retune" : "retune nodata");
+ tvhwarn(LS_LINUXDVB, "%s - %s", buf, retune ? "retune" : "retune nodata");
linuxdvb_frontend_tune0(lfe, mmi, lfe->lfe_freq);
mtimer_arm_rel(&lfe->lfe_monitor_timer, linuxdvb_frontend_monitor, lfe, ms2mono(50));
lfe->lfe_locked = 1;
/* Locked */
if (status == SIGNAL_GOOD) {
- tvhdebug("linuxdvb", "%s - locked", buf);
+ tvhdebug(LS_LINUXDVB, "%s - locked", buf);
lfe->lfe_locked = 1;
/* Start input */
ioctl_bad(lfe, 1);
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unhandled signal scale: %d",
- fe_properties[0].u.st.stat[0].scale);
+ tvhwarn(LS_LINUXDVB, "Unhandled signal scale: %d",
+ fe_properties[0].u.st.stat[0].scale);
}
}
if(!gotprop && ioctl_check(lfe, 2)) {
ioctl_bad(lfe, 2);
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unable to provide signal strength value.");
+ tvhwarn(LS_LINUXDVB, "Unable to provide signal strength value.");
}
}
else {
ioctl_bad(lfe, 3);
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unhandled ERROR_BIT_COUNT scale: %d",
- fe_properties[1].u.st.stat[0].scale);
+ tvhwarn(LS_LINUXDVB, "Unhandled ERROR_BIT_COUNT scale: %d",
+ fe_properties[1].u.st.stat[0].scale);
}
}
/* TOTAL_BIT_COUNT */
ioctl_bad(lfe, 4);
mmi->tii_stats.ec_bit = 0; /* both values or none */
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unhandled TOTAL_BIT_COUNT scale: %d",
- fe_properties[2].u.st.stat[0].scale);
+ tvhwarn(LS_LINUXDVB, "Unhandled TOTAL_BIT_COUNT scale: %d",
+ fe_properties[2].u.st.stat[0].scale);
}
}
if(!gotprop && ioctl_check(lfe, 5)) {
else {
ioctl_bad(lfe, 5);
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unable to provide BER value.");
+ tvhwarn(LS_LINUXDVB, "Unable to provide BER value.");
}
}
ioctl_bad(lfe, 6);
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unhandled SNR scale: %d",
- fe_properties[3].u.st.stat[0].scale);
+ tvhwarn(LS_LINUXDVB, "Unhandled SNR scale: %d",
+ fe_properties[3].u.st.stat[0].scale);
}
}
if(!gotprop && ioctl_check(lfe, 7)) {
ioctl_bad(lfe, 7);
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unable to provide SNR value.");
+ tvhwarn(LS_LINUXDVB, "Unable to provide SNR value.");
}
}
else {
ioctl_bad(lfe, 8);
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unhandled ERROR_BLOCK_COUNT scale: %d",
- fe_properties[4].u.st.stat[0].scale);
+ tvhwarn(LS_LINUXDVB, "Unhandled ERROR_BLOCK_COUNT scale: %d",
+ fe_properties[4].u.st.stat[0].scale);
}
}
mmi->tii_stats.ec_block = 0;
atomic_set(&mmi->tii_stats.unc, 0);
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unhandled TOTAL_BLOCK_COUNT scale: %d",
+ tvhwarn(LS_LINUXDVB, "Unhandled TOTAL_BLOCK_COUNT scale: %d",
fe_properties[5].u.st.stat[0].scale);
}
}
else {
ioctl_bad(lfe, 10);
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unable to provide UNC value.");
+ tvhwarn(LS_LINUXDVB, "Unable to provide UNC value.");
}
}
/* Older API */
ioctl_bad(lfe, 1);
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unable to provide signal strength value.");
+ tvhwarn(LS_LINUXDVB, "Unable to provide signal strength value.");
}
if (ioctl_check(lfe, 2) && !ioctl(lfe->lfe_fe_fd, FE_READ_BER, &u32))
mmi->tii_stats.ber = u32;
else {
ioctl_bad(lfe, 2);
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unable to provide BER value.");
+ tvhwarn(LS_LINUXDVB, "Unable to provide BER value.");
}
if (ioctl_check(lfe, 3) && !ioctl(lfe->lfe_fe_fd, FE_READ_SNR, &u16)) {
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_RELATIVE;
ioctl_bad(lfe, 3);
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unable to provide SNR value.");
+ tvhwarn(LS_LINUXDVB, "Unable to provide SNR value.");
}
if (ioctl_check(lfe, 4) && !ioctl(lfe->lfe_fe_fd, FE_READ_UNCORRECTED_BLOCKS, &u32))
atomic_set(&mmi->tii_stats.unc, u32);
else {
ioctl_bad(lfe, 4);
if (logit)
- tvhlog(LOG_WARNING, "linuxdvb", "Unable to provide UNC value.");
+ tvhwarn(LS_LINUXDVB, "Unable to provide UNC value.");
}
}
for ( ; pids_size > 0 && pids->fd >= 0; pids_size--, pids++);
if (pids_size == 0) {
- tvherror("linuxdvb", "%s - maximum PID count reached, pid %d ignored",
+ tvherror(LS_LINUXDVB, "%s - maximum PID count reached, pid %d ignored",
name, pid);
return;
}
/* Open DMX */
fd = tvh_open(lfe->lfe_dmx_path, O_RDWR, 0);
if(fd == -1) {
- tvherror("linuxdvb", "%s - failed to open dmx for pid %d [e=%s]",
+ tvherror(LS_LINUXDVB, "%s - failed to open dmx for pid %d [e=%s]",
name, pid, strerror(errno));
return;
}
/* Install filter */
- tvhtrace("linuxdvb", "%s - open PID %04X (%d) fd %d", name, pid, pid, fd);
+ tvhtrace(LS_LINUXDVB, "%s - open PID %04X (%d) fd %d", name, pid, pid, fd);
memset(&dmx_param, 0, sizeof(dmx_param));
dmx_param.pid = pid;
dmx_param.input = DMX_IN_FRONTEND;
dmx_param.flags = DMX_IMMEDIATE_START;
if(ioctl(fd, DMX_SET_PES_FILTER, &dmx_param)) {
- tvherror("linuxdvb", "%s - failed to config dmx for pid %d [e=%s]",
+ tvherror(LS_LINUXDVB, "%s - failed to config dmx for pid %d [e=%s]",
name, pid, strerror(errno));
close(fd);
return;
pids_size--, pids++);
if (pids_size == 0)
return;
- tvhtrace("linuxdvb", "%s - close PID %04X (%d) fd %d", name, pid, pid, pids->fd);
+ tvhtrace(LS_LINUXDVB, "%s - close PID %04X (%d) fd %d", name, pid, pid, pids->fd);
close(pids->fd);
pids->fd = -1;
pids->pid = -1;
/* Open DVR */
dvr = tvh_open(lfe->lfe_dvr_path, O_RDONLY | O_NONBLOCK, 0);
if (dvr < 0) {
- tvherror("linuxdvb", "%s - failed to open %s", name, lfe->lfe_dvr_path);
+ tvherror(LS_LINUXDVB, "%s - failed to open %s", name, lfe->lfe_dvr_path);
return NULL;
}
nfds = tvhpoll_wait(efd, ev, 1, 150);
if (nfds == 0) { /* timeout */
if (nodata == 0) {
- tvhlog(LOG_WARNING, "linuxdvb", "%s - poll TIMEOUT", name);
+ tvhwarn(LS_LINUXDVB, "%s - poll TIMEOUT", name);
nodata = 50;
lfe->lfe_nodata = 1;
} else {
if (ERRNO_AGAIN(errno))
continue;
if (errno == EOVERFLOW) {
- tvhlog(LOG_WARNING, "linuxdvb", "%s - read() EOVERFLOW", name);
+ tvhwarn(LS_LINUXDVB, "%s - read() EOVERFLOW", name);
continue;
}
- tvhlog(LOG_ERR, "linuxdvb", "%s - read() error %d (%s)",
- name, errno, strerror(errno));
+ tvherror(LS_LINUXDVB, "%s - read() error %d (%s)",
+ name, errno, strerror(errno));
break;
}
return tbl->t;
tbl++;
}
- tvhtrace("linuxdvb", "%s - linuxdvb2tvh failed %d", prefix, key);
+ tvhtrace(LS_LINUXDVB, "%s - linuxdvb2tvh failed %d", prefix, key);
return defval;
}
#endif
return tbl->l;
tbl++;
}
- tvhtrace("linuxdvb", "%s - tvh2linuxdvb failed %d", prefix, key);
+ tvhtrace(LS_LINUXDVB, "%s - tvh2linuxdvb failed %d", prefix, key);
return defval;
}
/* Open FE */
lfe->mi_display_name((mpegts_input_t*)lfe, buf1, sizeof(buf1));
- tvhtrace("linuxdvb", "%s - frontend clear", buf1);
+ tvhtrace(LS_LINUXDVB, "%s - frontend clear", buf1);
if (lfe->lfe_fe_fd <= 0) {
lfe->lfe_fe_fd = tvh_open(lfe->lfe_fe_path, O_RDWR | O_NONBLOCK, 0);
- tvhtrace("linuxdvb", "%s - opening FE %s (%d)", buf1, lfe->lfe_fe_path, lfe->lfe_fe_fd);
+ tvhtrace(LS_LINUXDVB, "%s - opening FE %s (%d)", buf1, lfe->lfe_fe_path, lfe->lfe_fe_fd);
if (lfe->lfe_fe_fd <= 0) {
return SM_CODE_TUNING_FAILED;
}
.props = clear_p
};
if ((ioctl(lfe->lfe_fe_fd, FE_SET_PROPERTY, &clear_cmdseq)) != 0) {
- tvherror("linuxdvb", "%s - DTV_CLEAR failed [e=%s]", buf1, strerror(errno));
+ tvherror(LS_LINUXDVB, "%s - DTV_CLEAR failed [e=%s]", buf1, strerror(errno));
return -1;
}
delsys_p.cmd = DTV_DELIVERY_SYSTEM;
delsys_p.u.data = TR(delsys, delsys_tbl, SYS_UNDEFINED);
if ((ioctl(lfe->lfe_fe_fd, FE_SET_PROPERTY, &delsys_cmdseq)) != 0) {
- tvherror("linuxdvb", "%s - DTV_DELIVERY_SYSTEM failed [e=%s]", buf1, strerror(errno));
+ tvherror(LS_LINUXDVB, "%s - DTV_DELIVERY_SYSTEM failed [e=%s]", buf1, strerror(errno));
return -1;
}
}
if (tvhtrace_enabled()) {
char buf2[256];
dvb_mux_conf_str(&lm->lm_tuning, buf2, sizeof(buf2));
- tvhtrace("linuxdvb", "tuner %s tunning to %s (freq %i)", buf1, buf2, freq);
+ tvhtrace(LS_LINUXDVB, "tuner %s tunning to %s (freq %i)", buf1, buf2, freq);
}
memset(&p, 0, sizeof(p));
p.frequency = dmc->dmc_fe_freq;
break;
#endif
default:
- tvherror("linuxdvb", "%s - unknown FE type %d", buf1, dmc->dmc_fe_type);
+ tvherror(LS_LINUXDVB, "%s - unknown FE type %d", buf1, dmc->dmc_fe_type);
return SM_CODE_TUNING_FAILED;
}
p.frequency = lfe->lfe_freq = freq;
if (dmc->dmc_fe_type != lfe->lfe_type) {
- tvherror("linuxdvb", "%s - failed to tune [type does not match %i != %i]", buf1, dmc->dmc_fe_type, lfe->lfe_type);
+ tvherror(LS_LINUXDVB, "%s - failed to tune [type does not match %i != %i]", buf1, dmc->dmc_fe_type, lfe->lfe_type);
return SM_CODE_TUNING_FAILED;
}
if (tvhtrace_enabled()) {
int i;
for (i = 0; i < cmdseq.num; i++)
- tvhtrace("linuxdvb", "S2CMD %02u => %u", cmds[i].cmd, cmds[i].u.data);
+ tvhtrace(LS_LINUXDVB, "S2CMD %02u => %u", cmds[i].cmd, cmds[i].u.data);
}
r = ioctl(lfe->lfe_fe_fd, FE_SET_PROPERTY, &cmdseq);
/* Failed */
if (r != 0) {
- tvherror("linuxdvb", "%s - failed to tune [e=%s]", buf1, strerror(errno));
+ tvherror(LS_LINUXDVB, "%s - failed to tune [e=%s]", buf1, strerror(errno));
if (errno == EINVAL)
mmi->mmi_tune_failed = 1;
return SM_CODE_TUNING_FAILED;
lfe->mi_display_name((mpegts_input_t*)lfe, buf1, sizeof(buf1));
mpegts_mux_nice_name(mmi->mmi_mux, buf2, sizeof(buf2));
- tvhdebug("linuxdvb", "%s - starting %s", buf1, buf2);
+ tvhdebug(LS_LINUXDVB, "%s - starting %s", buf1, buf2);
/* Tune */
- tvhtrace("linuxdvb", "%s - tuning", buf1);
+ tvhtrace(LS_LINUXDVB, "%s - tuning", buf1);
rep = lfe->lfe_tune_repeats > 0 ? lfe->lfe_tune_repeats : 0;
for (i = 0; i <= rep; i++) {
if (i > 0)
else if (type == DVB_TYPE_DAB)
idc = &linuxdvb_frontend_dab_class;
else {
- tvherror("linuxdvb", "unknown FE type %d", type);
+ tvherror(LS_LINUXDVB, "unknown FE type %d", type);
return NULL;
}
double azimuth, elevation;
#ifndef ROTOR_TEST
- tvhtrace("diseqc", "site: lat %.4f, lon %.4f, alt %.4f; sat lon %.4f",
+ tvhtrace(LS_DISEQC, "site: lat %.4f, lon %.4f, alt %.4f; sat lon %.4f",
site_lat, site_lon, site_alt, sat_lon);
#endif
&azimuth, &elevation);
#ifndef ROTOR_TEST
- tvhtrace("diseqc", "rotor angle azimuth %.4f elevation %.4f", azimuth, elevation);
+ tvhtrace(LS_DISEQC, "rotor angle azimuth %.4f elevation %.4f", azimuth, elevation);
#else
gazimuth = azimuth;
gelevation = elevation;
pos = -(pos);
dir = 'W';
}
- tvhdebug("diseqc", "rotor already positioned to %i.%i%c",
+ tvhdebug(LS_DISEQC, "rotor already positioned to %i.%i%c",
pos / 10, pos % 10, dir);
return 1;
}
for (i = 0; i <= ls->lse_parent->ls_diseqc_repeats; i++) {
if (linuxdvb_diseqc_send(fd, 0xE0, 0x31, 0x6B, 1, (int)lr->lr_position)) {
- tvherror("diseqc", "failed to set GOTOX pos %d", lr->lr_position);
+ tvherror(LS_DISEQC, "failed to set GOTOX pos %d", lr->lr_position);
return -1;
}
tvh_safe_usleep(MINMAX(lr->lr_cmd_time, 10, 100) * 1000);
}
- tvhdebug("diseqc", "rotor GOTOX pos %d sent", lr->lr_position);
+ tvhdebug(LS_DISEQC, "rotor GOTOX pos %d sent", lr->lr_position);
return linuxdvb_rotor_grace((linuxdvb_diseqc_t*)lr,lm);
}
}
cmd |= (angle / 10) * 0x10 + xtable[angle % 10];
- tvhdebug("diseqc", "rotor USALS goto %0.1f%c (motor %0.1f %sclockwise)",
+ tvhdebug(LS_DISEQC, "rotor USALS goto %0.1f%c (motor %0.1f %sclockwise)",
fabs(lr->lr_sat_lon), (lr->lr_sat_lon > 0.0) ? 'E' : 'W',
((double)angle / 10.0), (cmd & 0xF000) == 0xD000 ? "counter-" : "");
for (i = 0; i <= lsp->ls_diseqc_repeats; i++) {
if (linuxdvb_diseqc_send(fd, 0xE0, 0x31, 0x6E, 2,
(cmd >> 8) & 0xff, cmd & 0xff)) {
- tvherror("diseqc", "failed to send USALS command");
+ tvherror(LS_DISEQC, "failed to send USALS command");
return -1;
}
tvh_safe_usleep(MINMAX(lr->lr_cmd_time, 10, 100) * 1000);
return -1;
if (ls->ls_last_tone_off != 1) {
- tvhtrace("diseqc", "initial tone off");
+ tvhtrace(LS_DISEQC, "initial tone off");
if (ioctl(linuxdvb_satconf_fe_fd(ls), FE_SET_TONE, SEC_TONE_OFF)) {
- tvherror("diseqc", "failed to disable tone");
+ tvherror(LS_DISEQC, "failed to disable tone");
return -1;
}
ls->ls_last_tone_off = 1;
}
/* the linuxdvb_diseqc_set_volt() fcn already sleeps for 15ms */
if (delay > 15) {
- tvhtrace("diseqc", "initial sleep %dms", delay);
+ tvhtrace(LS_DISEQC, "initial sleep %dms", delay);
tvh_safe_usleep((delay-15)*1000);
}
return 0;
band = lse->lse_lnb->lnb_band(lse->lse_lnb, lm) & 0x1;
freq = lse->lse_lnb->lnb_freq(lse->lse_lnb, lm);
} else {
- tvherror("linuxdvb", "LNB is not defined!!!");
+ tvherror(LS_LINUXDVB, "LNB is not defined!!!");
return -1;
}
if (!lse->lse_en50494) {
/* Pending */
if (r != 0) {
- tvhtrace("diseqc", "waiting %d seconds to finish setup for %s", r, lds[i]->ld_type);
+ tvhtrace(LS_DISEQC, "waiting %d seconds to finish setup for %s", r, lds[i]->ld_type);
mtimer_arm_rel(&ls->ls_diseqc_timer, linuxdvb_satconf_ele_tune_cb, lse, sec2mono(r));
ls->ls_diseqc_idx = i + 1;
return 0;
if (!lse->lse_en50494) {
if (ls->ls_last_tone_off != band + 1) {
ls->ls_last_tone_off = 0;
- tvhtrace("diseqc", "set diseqc tone %s", band ? "on" : "off");
+ tvhtrace(LS_DISEQC, "set diseqc tone %s", band ? "on" : "off");
if (ioctl(lfe->lfe_fe_fd, FE_SET_TONE, band ? SEC_TONE_ON : SEC_TONE_OFF)) {
- tvherror("diseqc", "failed to set diseqc tone (e=%s)", strerror(errno));
+ tvherror(LS_DISEQC, "failed to set diseqc tone (e=%s)", strerror(errno));
return -1;
}
ls->ls_last_tone_off = band + 1;
if (lse->lse_en50494) {
f = lse->lse_en50494->ld_freq(lse->lse_en50494, lm, f);
if (f < 0) {
- tvherror("en50494", "invalid tuning freq");
+ tvherror(LS_EN50494, "invalid tuning freq");
return -1;
}
}
char buf1[256], buf2[256];
dvb_mux_conf_str(&lm1->lm_tuning, buf1, sizeof(buf1));
dvb_mux_conf_str(&lm2->lm_tuning, buf2, sizeof(buf2));
- tvhtrace("diseqc", "match mux 1 - %s", buf1);
- tvhtrace("diseqc", "match mux 2 - %s", buf2);
+ tvhtrace(LS_DISEQC, "match mux 1 - %s", buf1);
+ tvhtrace(LS_DISEQC, "match mux 2 - %s", buf2);
#endif
if (lse1 != lse2) {
- tvhtrace("diseqc", "match position failed");
+ tvhtrace(LS_DISEQC, "match position failed");
return 0;
}
if (!lse1->lse_lnb->lnb_match(lse1->lse_lnb, lm1, lm2)) {
- tvhtrace("diseqc", "match LNB failed");
+ tvhtrace(LS_DISEQC, "match LNB failed");
return 0;
}
if (lse1->lse_en50494 && !lse1->lse_en50494->ld_match(lse1->lse_en50494, lm1, lm2)) {
- tvhtrace("diseqc", "match en50494 failed");
+ tvhtrace(LS_DISEQC, "match en50494 failed");
return 0;
}
return 1;
va_end(ap);
if (tr)
- tvhtrace("diseqc", "sending diseqc (len %d) %02X %02X %02X %s",
+ tvhtrace(LS_DISEQC, "sending diseqc (len %d) %02X %02X %02X %s",
len + 3, framing, addr, cmd, buf);
/* Send */
if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &message)) {
- tvherror("diseqc", "failed to send diseqc cmd (e=%s)", strerror(errno));
+ tvherror(LS_DISEQC, "failed to send diseqc cmd (e=%s)", strerror(errno));
return -1;
}
return 0;
if (vol >= 0 && ls->ls_last_vol == vol + 1)
return 0;
/* Set voltage */
- tvhtrace("diseqc", "set voltage %dV", vol ? (vol < 0 ? 0 : 18) : 13);
+ tvhtrace(LS_DISEQC, "set voltage %dV", vol ? (vol < 0 ? 0 : 18) : 13);
if (ioctl(linuxdvb_satconf_fe_fd(ls), FE_SET_VOLTAGE,
vol ? (vol < 0 ? SEC_VOLTAGE_OFF : SEC_VOLTAGE_18) : SEC_VOLTAGE_13)) {
- tvherror("diseqc", "failed to set voltage (e=%s)", strerror(errno));
+ tvherror(LS_DISEQC, "failed to set voltage (e=%s)", strerror(errno));
ls->ls_last_vol = 0;
return -1;
}
return -1;
lsp->ls_last_toneburst = 0;
- tvhtrace("diseqc", "toneburst %s", ls->ls_toneburst ? "B" : "A");
+ tvhtrace(LS_DISEQC, "toneburst %s", ls->ls_toneburst ? "B" : "A");
if (ioctl(fd, FE_DISEQC_SEND_BURST,
ls->ls_toneburst ? SEC_MINI_B : SEC_MINI_A)) {
- tvherror("diseqc", "failed to set toneburst (e=%s)", strerror(errno));
+ tvherror(LS_DISEQC, "failed to set toneburst (e=%s)", strerror(errno));
return -1;
}
lsp->ls_last_toneburst = ls->ls_toneburst + 1;
if (mps2 == NULL) {
LIST_INSERT_HEAD(&mm->mm_all_subs, mps, mps_svcraw_link);
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhdebug("mpegts", "%s - open PID %s subscription [%04x/%p]",
+ tvhdebug(LS_MPEGTS, "%s - open PID %s subscription [%04x/%p]",
buf, (type & MPS_TABLES) ? "tables" : "fullmux", type, owner);
mm->mm_update_pids_flag = 1;
} else {
if (!reopen) {
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvherror("mpegts",
+ tvherror(LS_MPEGTS,
"%s - open PID %04x (%d) failed, dupe sub (owner %p)",
buf, mp->mp_pid, mp->mp_pid, owner);
}
if (type & MPS_SERVICE)
LIST_INSERT_HEAD(&mp->mp_svc_subs, mps, mps_svcraw_link);
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhdebug("mpegts", "%s - open PID %04X (%d) [%d/%p]",
+ tvhdebug(LS_MPEGTS, "%s - open PID %04X (%d) [%d/%p]",
buf, mp->mp_pid, mp->mp_pid, type, owner);
mm->mm_update_pids_flag = 1;
} else {
if (!reopen) {
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvherror("mpegts", "%s - open PID %04x (%d) failed, dupe sub (owner %p)",
+ tvherror(LS_MPEGTS, "%s - open PID %04x (%d) failed, dupe sub (owner %p)",
buf, mp->mp_pid, mp->mp_pid, owner);
}
free(mps);
LIST_FOREACH(mps, &mm->mm_all_subs, mps_svcraw_link)
if (mps->mps_owner == owner) break;
if (mps == NULL) return -1;
- tvhdebug("mpegts", "%s - close PID %s subscription [%04x/%p]",
+ tvhdebug(LS_MPEGTS, "%s - close PID %s subscription [%04x/%p]",
buf, pid == MPEGTS_TABLES_PID ? "tables" : "fullmux",
type, owner);
if (pid == MPEGTS_FULLMUX_PID)
}
if (mps) {
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhdebug("mpegts", "%s - close PID %04X (%d) [%d/%p]",
+ tvhdebug(LS_MPEGTS, "%s - close PID %04X (%d) [%d/%p]",
buf, mp->mp_pid, mp->mp_pid, type, owner);
if (type & MPS_RAW)
LIST_REMOVE(mps, mps_raw_link);
if (len >= 4 && dlen >= 4 && mm->mm_active) {
caid = ( ptr[0] << 8) | ptr[1];
pid = ((ptr[2] & 0x1f) << 8) | ptr[3];
- tvhdebug("cat", " pass: caid %04X (%d) pid %04X (%d)",
+ tvhdebug(LS_TBL_BASE, "cat: pass: caid %04X (%d) pid %04X (%d)",
(uint16_t)caid, (uint16_t)caid, pid, pid);
pthread_mutex_lock(&s->s_stream_mutex);
es = NULL;
if(s->s_type == STYPE_STD) {
s->s_pmt_mon =
mpegts_table_add(mm, DVB_PMT_BASE, DVB_PMT_MASK,
- dvb_pmt_callback, s, "pmt",
+ dvb_pmt_callback, s, "pmt", LS_TBL_BASE,
MT_CRC, s->s_pmt_pid, MPS_WEIGHT_PMT);
if (s->s_scrambled_pass && (flags & SUBSCRIPTION_EMM) != 0) {
s->s_cat_mon =
mpegts_table_add(mm, DVB_CAT_BASE, DVB_CAT_MASK,
mpegts_input_cat_pass_callback, s, "cat",
- MT_QUICKREQ | MT_CRC, DVB_CAT_PID,
+ LS_TBL_BASE, MT_QUICKREQ | MT_CRC, DVB_CAT_PID,
MPS_WEIGHT_CAT);
}
}
mtimer_disarm(&mi->mi_status_timer);
mi->mi_display_name(mi, buf, sizeof(buf));
- tvhtrace("mpegts", "%s - flush subscribers", buf);
+ tvhtrace(LS_MPEGTS, "%s - flush subscribers", buf);
for (s = LIST_FIRST(&mm->mm_transports); s; s = s_next) {
s_next = LIST_NEXT(s, s_active_link);
service_remove_subscriber(s, NULL, SM_CODE_SUBSCRIPTION_OVERRIDDEN);
tvh_cond_signal(&mi->mi_input_cond, 0);
} else {
if (tvhlog_limit(&mi->mi_input_queue_loglimit, 10))
- tvhwarn("mpegts", "too much queued input data (over 50MB), discarding new");
+ tvhwarn(LS_MPEGTS, "too much queued input data (over 50MB), discarding new");
free(mp);
}
} else {
}
pthread_mutex_unlock(&mm->mm_tables_lock);
if (i != c) {
- tvherror("psi", "tables count inconsistency (num %d, list %d)", i, c);
+ tvherror(LS_TBL, "tables count inconsistency (num %d, list %d)", i, c);
assert(0);
}
tsb2 < tsb2_end; tsb2 += 188) {
cc = tsb2[3] & 0x0f;
if (cc2 != 0xff && cc2 != cc) {
- tvhtrace("mpegts", "%s: pid %04X cc err %2d != %2d", muxname, pid, cc, cc2);
+ tvhtrace(LS_MPEGTS, "%s: pid %04X cc err %2d != %2d", muxname, pid, cc, cc2);
atomic_add(&mmi->tii_stats.cc, 1);
}
cc2 = (cc + 1) & 0xF;
if (type & MPS_TABLE) {
if (mi->mi_table_queue_size >= 2*1024*1024) {
if (tvhlog_limit(&mi->mi_input_queue_loglimit, 10))
- tvhwarn("mpegts", "too much queued table input data (over 2MB), discarding new");
+ tvhwarn(LS_MPEGTS, "too much queued table input data (over 2MB), discarding new");
} else {
mpegts_table_feed_t *mtf = malloc(sizeof(mpegts_table_feed_t)+llen);
mtf->mtf_len = llen;
/* Wait for a packet */
if (!(mp = TAILQ_FIRST(&mi->mi_input_queue))) {
if (bytes) {
- tvhtrace("mpegts", "input %s got %zu bytes", buf, bytes);
+ tvhtrace(LS_MPEGTS, "input %s got %zu bytes", buf, bytes);
bytes = 0;
}
tvh_cond_wait(&mi->mi_input_cond, &mi->mi_input_lock);
pthread_mutex_lock(&mi->mi_input_lock);
}
- tvhtrace("mpegts", "input %s got %zu bytes (finish)", buf, bytes);
+ tvhtrace(LS_MPEGTS, "input %s got %zu bytes (finish)", buf, bytes);
/* Flush */
while ((mp = TAILQ_FIRST(&mi->mi_input_queue))) {
{
if (idnode_insert(&mi->ti_id, uuid, class, 0)) {
if (uuid)
- tvherror("mpegts", "invalid input uuid '%s'", uuid);
+ tvherror(LS_MPEGTS, "invalid input uuid '%s'", uuid);
free(mi);
return NULL;
}
s = mi->mi_linked;
mi->mi_linked = NULL;
- tvhtrace("mpegts", "subscribe keep for '%s' (%p)", mi->mi_name, mm);
+ tvhtrace(LS_MPEGTS, "subscribe keep for '%s' (%p)", mi->mi_name, mm);
r = mpegts_mux_subscribe(mm, mi, "keep", SUBSCRIPTION_PRIO_KEEP,
SUBSCRIPTION_ONESHOT | SUBSCRIPTION_MINIMAL);
mi->mi_linked = s;
const char *serr = "All";
int r = 0;
- tvhtrace("mpegts", "subscribe linked");
+ tvhtrace(LS_MPEGTS, "subscribe linked");
if (!mpegts_mux_keep_exists(mi) && (r = mpegts_mux_subscribe_keep(mm, mi))) {
serr = "active1";
fatal:
mi ->mi_display_name(mi, buf1, sizeof(buf1));
mi2->mi_display_name(mi2, buf2, sizeof(buf2));
- tvherror("mpegts", "%s - %s - linked input cannot be started (%s: %i)", buf1, buf2, serr, r);
+ tvherror(LS_MPEGTS, "%s - %s - linked input cannot be started (%s: %i)", buf1, buf2, serr, r);
}
void
th_subscription_t *ths, *ths_next;
if (mi) {
- tvhtrace("mpegts", "unsubscribing linked");
+ tvhtrace(LS_MPEGTS, "unsubscribing linked");
for (ths = LIST_FIRST(&subscriptions); ths; ths = ths_next) {
ths_next = LIST_NEXT(ths, ths_global_link);
/* Already active */
if (mm->mm_active) {
*mmiptr = mm->mm_active;
- tvhdebug("mpegts", "%s - already active", buf);
+ tvhdebug(LS_MPEGTS, "%s - already active", buf);
mpegts_mux_scan_active(mm, buf, (*mmiptr)->mmi_input);
return 0;
}
/* Start */
mi->mi_display_name(mi, buf2, sizeof(buf2));
- tvhinfo("mpegts", "%s - tuning on %s", buf, buf2);
+ tvhinfo(LS_MPEGTS, "%s - tuning on %s", buf, buf2);
if (mi->mi_linked)
mpegts_mux_unsubscribe_linked(mi, t);
if (r) return r;
/* Start */
- tvhdebug("mpegts", "%s - started", buf);
+ tvhdebug(LS_MPEGTS, "%s - started", buf);
mi->mi_started_mux(mi, mmi);
/* Event handler */
idnode_save_check(&mm->mm_id, delconf);
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhinfo("mpegts", "%s (%p) - deleting", buf, mm);
+ tvhinfo(LS_MPEGTS, "%s (%p) - deleting", buf, mm);
/* Stop */
mm->mm_stop(mm, 1, SM_CODE_ABORTED);
mpegts_mux_instance_t *mmi = mm->mm_active;
if (mmi) {
if (mmi->mmi_input->mi_has_subscription(mmi->mmi_input, mm)) {
- tvhtrace("mpegts", "%s - keeping mux", name);
+ tvhtrace(LS_MPEGTS, "%s - keeping mux", name);
return 1;
}
}
/* Stop possible recursion */
if (!mmi) return;
- tvhdebug("mpegts", "%s - stopping mux%s", buf, force ? " (forced)" : "");
+ tvhdebug(LS_MPEGTS, "%s - stopping mux%s", buf, force ? " (forced)" : "");
mi = mmi->mmi_input;
assert(mi);
mi2->mi_linked = s;
} else {
if (!force) {
- tvhtrace("mpegts", "%s - keeping subscribed (linked tuner active)", buf);
+ tvhtrace(LS_MPEGTS, "%s - keeping subscribed (linked tuner active)", buf);
return;
}
}
assert(mm->mm_active == NULL);
/* Flush all tables */
- tvhtrace("mpegts", "%s - flush tables", buf);
+ tvhtrace(LS_MPEGTS, "%s - flush tables", buf);
mpegts_table_flush_all(mm);
- tvhtrace("mpegts", "%s - mi=%p", buf, (void *)mi);
+ tvhtrace(LS_MPEGTS, "%s - mi=%p", buf, (void *)mi);
/* Flush table data queue */
mpegts_input_flush_mux(mi, mm);
if (mp->mp_pid == MPEGTS_FULLMUX_PID ||
mp->mp_pid == MPEGTS_TABLES_PID) {
while ((mps = LIST_FIRST(&mm->mm_all_subs))) {
- tvhdebug("mpegts", "%s - close PID %s subscription [%d/%p]",
+ tvhdebug(LS_MPEGTS, "%s - close PID %s subscription [%d/%p]",
buf, mp->mp_pid == MPEGTS_TABLES_PID ? "tables" : "fullmux",
mps->mps_type, mps->mps_owner);
LIST_REMOVE(mps, mps_svcraw_link);
}
} else {
while ((mps = RB_FIRST(&mp->mp_subs))) {
- tvhdebug("mpegts", "%s - close PID %04X (%d) [%d/%p]", buf,
+ tvhdebug(LS_MPEGTS, "%s - close PID %04X (%d) [%d/%p]", buf,
mp->mp_pid, mp->mp_pid, mps->mps_type, mps->mps_owner);
RB_REMOVE(&mp->mp_subs, mps, mps_link);
if (mps->mps_type & (MPS_SERVICE|MPS_ALL))
snext = LIST_NEXT(s, s_dvb_mux_link);
if (s->s_enabled && s->s_auto != SERVICE_AUTO_OFF &&
s->s_dvb_check_seen + 24 * 3600 < last_seen) {
- tvhinfo("mpegts", "disabling service %s [sid %04X/%d] (missing in PAT/SDT)",
+ tvhinfo(LS_MPEGTS, "disabling service %s [sid %04X/%d] (missing in PAT/SDT)",
s->s_nicename ?: "<unknown>", s->s_dvb_service_id, s->s_dvb_service_id);
service_set_enabled((service_t *)s, 0, SERVICE_AUTO_PAT_MISSING);
}
total++;
incomplete++;
}
- tvhdebug("mpegts", "%s - %04X (%d) %s %s", buf, mt->mt_pid, mt->mt_pid, mt->mt_name, s);
+ tvhdebug(LS_MPEGTS, "%s - %04X (%d) %s %s", buf, mt->mt_pid, mt->mt_pid, mt->mt_name, s);
}
}
pthread_mutex_unlock(&mm->mm_tables_lock);
if (res < 0) {
/* is threshold 3 missing tables enough? */
if (incomplete > 0 && total > incomplete && incomplete <= 3) {
- tvhinfo("mpegts", "%s - scan complete (partial - %d/%d tables)", buf, total, incomplete);
+ tvhinfo(LS_MPEGTS, "%s - scan complete (partial - %d/%d tables)", buf, total, incomplete);
mpegts_network_scan_mux_partial(mm);
} else {
- tvhwarn("mpegts", "%s - scan timed out (%d/%d tables)", buf, total, incomplete);
+ tvhwarn(LS_MPEGTS, "%s - scan timed out (%d/%d tables)", buf, total, incomplete);
mpegts_network_scan_mux_fail(mm);
}
} else if (res) {
- tvhinfo("mpegts", "%s scan complete", buf);
+ tvhinfo(LS_MPEGTS, "%s scan complete", buf);
mpegts_network_scan_mux_done(mm);
mpegts_mux_scan_service_check(mm);
} else {
- tvhinfo("mpegts", "%s - scan no data, failed", buf);
+ tvhinfo(LS_MPEGTS, "%s - scan no data, failed", buf);
mpegts_network_scan_mux_fail(mm);
}
}
/* Pending tables (another 20s or 30s - bit arbitrary) */
} else if (q) {
- tvhtrace("mpegts", "%s - scan needs more time", buf);
+ tvhtrace(LS_MPEGTS, "%s - scan needs more time", buf);
mtimer_arm_rel(&mm->mm_scan_timeout, mpegts_mux_scan_timeout, mm, sec2mono(w ? 30 : 20));
return;
if (idnode_insert(&mm->mm_id, uuid, class, 0)) {
if (uuid)
- tvherror("mpegts", "invalid mux uuid '%s'", uuid);
+ tvherror(LS_MPEGTS, "invalid mux uuid '%s'", uuid);
free(mm);
return NULL;
}
SUBSCRIPTION_IDLESCAN, 10);
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhtrace("mpegts", "%s - created", buf);
+ tvhtrace(LS_MPEGTS, "%s - created", buf);
return mm;
}
if (tvhtrace_enabled()) {
char buf[256];
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhtrace("mpegts", "%s - set onid %04X (%d)", buf, onid, onid);
+ tvhtrace(LS_MPEGTS, "%s - set onid %04X (%d)", buf, onid, onid);
}
idnode_changed(&mm->mm_id);
return 1;
if (tvhtrace_enabled()) {
char buf[256];
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhtrace("mpegts", "%s - set tsid %04X (%d)", buf, tsid, tsid);
+ tvhtrace(LS_MPEGTS, "%s - set tsid %04X (%d)", buf, tsid, tsid);
}
idnode_changed(&mm->mm_id);
return 1;
if (tvhtrace_enabled()) {
char buf[256];
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhtrace("mpegts", "%s - set crid authority %s", buf, defauth);
+ tvhtrace(LS_MPEGTS, "%s - set crid authority %s", buf, defauth);
}
idnode_changed(&mm->mm_id);
return 1;
if (tvhtrace_enabled()) {
char buf[256];
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhtrace("mpegts", "%s - remove subscriber (reason %i)", buf, reason);
+ tvhtrace(LS_MPEGTS, "%s - remove subscriber (reason %i)", buf, reason);
}
mm->mm_stop(mm, 0, reason);
}
idc = &dvb_mux_dab_class;
delsys = DVB_SYS_DAB;
} else {
- tvherror("dvb", "unknown FE type %d", ln->ln_type);
+ tvherror(LS_DVB, "unknown FE type %d", ln->ln_type);
return NULL;
}
mms->mms_cronstr = strdup(str);
return 1;
} else {
- tvhwarn("muxsched", "invalid cronjob spec (%s)", str);
+ tvhwarn(LS_MUXSCHED, "invalid cronjob spec (%s)", str);
}
}
return 0;
/* Find mux */
if (!(mm = mpegts_mux_find(mms->mms_mux))) {
- tvhdebug("muxsched", "mux has been removed, delete sched entry");
+ tvhdebug(LS_MUXSCHED, "mux has been removed, delete sched entry");
mpegts_mux_sched_delete(mms, 1);
return;
}
/* Find next */
if (cron_next(&mms->mms_cronjob, now, &nxt)) {
- tvherror("muxsched", "failed to find next event");
+ tvherror(LS_MUXSCHED, "failed to find next event");
return;
}
mpegts_mux_sched_t *mms;
if (!(mms = calloc(1, sizeof(mpegts_mux_sched_t)))) {
- tvherror("muxsched", "calloc() failed");
+ tvherror(LS_MUXSCHED, "calloc() failed");
assert(0);
return NULL;
}
/* Insert node */
if (idnode_insert(&mms->mms_id, uuid, &mpegts_mux_sched_class, 0)) {
if (uuid)
- tvherror("muxsched", "invalid uuid '%s'", uuid);
+ tvherror(LS_MUXSCHED, "invalid uuid '%s'", uuid);
free(mms);
return NULL;
}
/* Setup idnode */
if (idnode_insert(&mn->mn_id, uuid, idc, 0)) {
if (uuid)
- tvherror("mpegts", "invalid network uuid '%s'", uuid);
+ tvherror(LS_MPEGTS, "invalid network uuid '%s'", uuid);
free(mn);
return NULL;
}
/* Name */
if (netname) mn->mn_network_name = strdup(netname);
mn->mn_display_name(mn, buf, sizeof(buf));
- tvhtrace("mpegts", "created network %s", buf);
+ tvhtrace(LS_MPEGTS, "created network %s", buf);
return mn;
}
return 0;
mn->mn_nid = nid;
mn->mn_display_name(mn, buf, sizeof(buf));
- tvhdebug("mpegts", "%s - set nid %04X (%d)", buf, nid, nid);
+ tvhdebug(LS_MPEGTS, "%s - set nid %04X (%d)", buf, nid, nid);
return 1;
}
if (name && name[0] && strcmp(name, mn->mn_network_name ?: "")) {
tvh_str_update(&mn->mn_network_name, name);
mn->mn_display_name(mn, buf, sizeof(buf));
- tvhdebug("mpegts", "%s - set name %s", buf, name);
+ tvhdebug(LS_MPEGTS, "%s - set name %s", buf, name);
save = 1;
}
}
if (tvhtrace_enabled()) {
char buf[128];
dvb_mux_conf_str(dmc, buf, sizeof(buf));
- tvhtrace("scanfile", "mux %p %s added to network %s", mm, buf, ln->mn_network_name);
+ tvhtrace(LS_SCANFILE, "mux %p %s added to network %s", mm, buf, ln->mn_network_name);
}
} else {
if (tvhtrace_enabled()) {
char buf[128];
dvb_mux_conf_str(dmc, buf, sizeof(buf));
- tvhtrace("scanfile", "mux %p skipped %s in network %s", mm, buf, ln->mn_network_name);
+ tvhtrace(LS_SCANFILE, "mux %p skipped %s in network %s", mm, buf, ln->mn_network_name);
dvb_mux_conf_str(&((dvb_mux_t *)mm)->lm_tuning, buf, sizeof(buf));
- tvhtrace("scanfile", "mux %p exists %s in network %s", mm, buf, ln->mn_network_name);
+ tvhtrace(LS_SCANFILE, "mux %p exists %s in network %s", mm, buf, ln->mn_network_name);
}
}
}
if (tvhtrace_enabled()) {
char buf[128];
dvb_mux_conf_str(&((dvb_mux_t *)mm)->lm_tuning, buf, sizeof(buf));
- tvhtrace("mpegts", "mux %p %s onid %i tsid %i added to network %s (autodiscovery)",
+ tvhtrace(LS_MPEGTS, "mux %p %s onid %i tsid %i added to network %s (autodiscovery)",
mm, buf, onid, tsid, mm->mm_network->mn_network_name);
}
}
#define COMPARE(x, cbit) ({ \
int xr = dmc->x != lm->lm_tuning.x; \
if (xr) { \
- tvhtrace("mpegts", "create mux dmc->" #x " (%li) != lm->lm_tuning." #x \
+ tvhtrace(LS_MPEGTS, "create mux dmc->" #x " (%li) != lm->lm_tuning." #x \
" (%li)", (long)dmc->x, (long)tuning_new.x); \
tuning_new.x = dmc->x; \
} xr ? cbit : 0; })
#define COMPAREN(x, cbit) ({ \
int xr = dmc->x != 0 && dmc->x != 1 && dmc->x != tuning_new.x; \
if (xr) { \
- tvhtrace("mpegts", "create mux dmc->" #x " (%li) != lm->lm_tuning." #x \
+ tvhtrace(LS_MPEGTS, "create mux dmc->" #x " (%li) != lm->lm_tuning." #x \
" (%li)", (long)dmc->x, (long)tuning_new.x); \
tuning_new.x = dmc->x; \
} xr ? cbit : 0; })
#define COMPAREN0(x, cbit) ({ \
int xr = dmc->x != 1 && dmc->x != tuning_new.x; \
if (xr) { \
- tvhtrace("mpegts", "create mux dmc->" #x " (%li) != lm->lm_tuning." #x \
+ tvhtrace(LS_MPEGTS, "create mux dmc->" #x " (%li) != lm->lm_tuning." #x \
" (%li)", (long)dmc->x, (long)tuning_new.x); \
tuning_new.x = dmc->x; \
} xr ? cbit : 0; })
char muxname[128];
mpegts_mux_nice_name((mpegts_mux_t *)mm, muxname, sizeof(muxname));
dvb_mux_conf_str(&tuning_old, buf, sizeof(buf));
- tvhlog(change ? LOG_WARNING : LOG_NOTICE, "mpegts",
+ tvhlog(change ? LOG_WARNING : LOG_NOTICE, LS_MPEGTS,
"mux %s%s %s (%08x)", muxname,
change ? " changed from" : " old params", buf, save);
dvb_mux_conf_str(&tuning_new, buf, sizeof(buf));
- tvhlog(change ? LOG_WARNING : LOG_NOTICE, "mpegts",
+ tvhlog(change ? LOG_WARNING : LOG_NOTICE, LS_MPEGTS,
"mux %s%s %s (%08x)", muxname,
change ? " changed to " : " new params", buf, save);
if (!change) save = 0;
return INT_MAX;
if (tvhtrace_enabled()) {
if (!idnode_is_instance(&mn->mn_id, &dvb_network_dvbs_class)) {
- tvhinfo("mpegts", "wrong dvb_network_get_orbital_pos() call");
+ tvhinfo(LS_MPEGTS, "wrong dvb_network_get_orbital_pos() call");
return INT_MAX;
}
}
}
mpegts_mux_nice_name(mm, buf, sizeof(buf));
mn->mn_display_name(mn, buf2, sizeof(buf2));
- tvhdebug("mpegts", "%s - removing mux %s from scan queue", buf2, buf);
+ tvhdebug(LS_MPEGTS, "%s - removing mux %s from scan queue", buf2, buf);
mm->mm_scan_state = MM_SCAN_STATE_IDLE;
mm->mm_scan_weight = 0;
mtimer_disarm(&mm->mm_scan_timeout);
mpegts_mux_nice_name(mm, buf, sizeof(buf));
mn->mn_display_name(mn, buf2, sizeof(buf2));
- tvhdebug("mpegts", "%s - adding mux %s to scan queue weight %d flags %04X",
+ tvhdebug(LS_MPEGTS, "%s - adding mux %s to scan queue weight %d flags %04X",
buf2, buf, weight, flags);
/* Add new entry */
{
char buf[256];
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhinfo("mpegts", "fastscan mux found '%s', set scan state 'PENDING'", buf);
+ tvhinfo(LS_MPEGTS, "fastscan mux found '%s', set scan state 'PENDING'", buf);
mpegts_mux_scan_state_set(mm, MM_SCAN_STATE_PEND);
return;
}
- tvhinfo("mpegts", "fastscan mux not found, position:%i, frequency:%i, polarisation:%c", satpos, freq, pol[0]);
+ tvhinfo(LS_MPEGTS, "fastscan mux not found, position:%i, frequency:%i, polarisation:%c", satpos, freq, pol[0]);
// fastscan mux not found, try to add it automatically
LIST_FOREACH(mn, &mpegts_network_all, mn_global_link)
char buf[256];
idnode_changed(&mm->mm_id);
mn->mn_display_name(mn, buf, sizeof(buf));
- tvhinfo("mpegts", "fastscan mux add to network '%s'", buf);
+ tvhinfo(LS_MPEGTS, "fastscan mux add to network '%s'", buf);
}
free(mux);
}
pthread_mutex_unlock(&s->s_stream_mutex);
mpegts_mux_nice_name(mm, buf, sizeof(buf));
- tvhlog(LOG_DEBUG, "mpegts", "%s - add service %04X %s", buf, s->s_dvb_service_id, s->s_dvb_svcname);
+ tvhdebug(LS_MPEGTS, "%s - add service %04X %s", buf, s->s_dvb_service_id, s->s_dvb_svcname);
/* Notification */
idnode_notify_changed(&mm->mm_id);
s->s_nicename = strdup(buf);
pthread_mutex_unlock(&s->s_stream_mutex);
- tvhlog(LOG_DEBUG, "mpegts", "%s - add raw service", buf);
+ tvhdebug(LS_MPEGTS, "%s - add raw service", buf);
return s;
}
c++;
if (i != c) {
- tvherror("mpegts", "table: mux %p count inconsistency (num %d, list %d)", mm, i, c);
+ tvherror(LS_MPEGTS, "table: mux %p count inconsistency (num %d, list %d)", mm, i, c);
abort();
}
}
mpegts_table_release_ ( mpegts_table_t *mt )
{
dvb_table_release((mpegts_psi_table_t *)mt);
- tvhtrace("mpegts", "table: mux %p free %s %02X/%02X (%d) pid %04X (%d)",
+ tvhtrace(LS_MPEGTS, "table: mux %p free %s %02X/%02X (%d) pid %04X (%d)",
mt->mt_mux, mt->mt_name, mt->mt_table, mt->mt_mask, mt->mt_table,
mt->mt_pid, mt->mt_pid);
if (mt->mt_bat)
lock_assert(&mm->mm_tables_lock);
- tvhtrace("mpegts", "table: mux %p destroy %s %02X/%02X (%d) pid %04X (%d)",
+ tvhtrace(LS_MPEGTS, "table: mux %p destroy %s %02X/%02X (%d) pid %04X (%d)",
mm, mt->mt_name, mt->mt_table, mt->mt_mask, mt->mt_table,
mt->mt_pid, mt->mt_pid);
mpegts_table_consistency_check(mm);
mpegts_table_add
( mpegts_mux_t *mm, int tableid, int mask,
mpegts_table_callback_t callback, void *opaque,
- const char *name, int flags, int pid, int weight )
+ const char *name, int subsys, int flags, int pid, int weight )
{
mpegts_table_t *mt;
int subscribe = 1;
pthread_mutex_unlock(&mm->mm_tables_lock);
return mt;
}
- tvhtrace("mpegts", "table: mux %p add %s %02X/%02X (%d) pid %04X (%d)",
+ tvhtrace(LS_MPEGTS, "table: mux %p add %s %02X/%02X (%d) pid %04X (%d)",
mm, name, tableid, mask, tableid, pid, pid);
/* Create */
mt = calloc(1, sizeof(mpegts_table_t));
mt->mt_arefcount = 1;
mt->mt_name = strdup(name);
+ mt->mt_subsys = subsys;
mt->mt_callback = callback;
mt->mt_opaque = opaque;
mt->mt_pid = pid;
TAILQ_FOREACH(lfe, &sd->sd_frontends, sf_link)
mpegts_input_stop_all((mpegts_input_t *)lfe);
}
- tvhinfo("satip", "address %s is %s", addr,
+ tvhinfo(LS_SATIP, "address %s is %s", addr,
block < 0 ? "stopped" : (block > 0 ? "allowed" : "disabled"));
}
}
sd->sd_fullmux_ok = 0;
sd->sd_pids_max = 32;
sd->sd_pids_deladd = 0;
- tvhwarn("satip", "Detected old Inverto firmware V1.13.0.105 and less");
- tvhwarn("satip", "Upgrade to V1.16.0.120 - http://http://www.inverto.tv/support/ - IDL400s");
+ tvhwarn(LS_SATIP, "Detected old Inverto firmware V1.13.0.105 and less");
+ tvhwarn(LS_SATIP, "Upgrade to V1.16.0.120 - http://http://www.inverto.tv/support/ - IDL400s");
} else
#endif
if (strstr(sd->sd_info.location, ":8888/octonet.xml")) {
m = atoi(argv[i] + 6);
}
if (type == DVB_TYPE_NONE) {
- tvhlog(LOG_ERR, "satip", "%s: bad tuner type [%s]",
- satip_device_nicename(sd, buf2, sizeof(buf2)), argv[i]);
+ tvherror(LS_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]",
- satip_device_nicename(sd, buf2, sizeof(buf2)), argv[i]);
+ tvherror(LS_SATIP, "%s: bad tuner count [%s]",
+ satip_device_nicename(sd, buf2, sizeof(buf2)), argv[i]);
} else {
sd->sd_nosave = 1;
for (j = 0; j < m; j++)
}
if (errn != 0 || s == NULL || hc->hc_code != 200 ||
hc->hc_data_size == 0 || hc->hc_data == NULL) {
- tvhlog(LOG_ERR, "satip", "Cannot get %s: %s", d->location, strerror(errn));
+ tvherror(LS_SATIP, "Cannot get %s: %s", d->location, strerror(errn));
return;
}
if (tvhtrace_enabled()) {
- tvhtrace("satip", "received XML description from %s", hc->hc_host);
- tvhlog_hexdump("satip", hc->hc_data, hc->hc_data_size);
+ tvhtrace(LS_SATIP, "received XML description from %s", hc->hc_host);
+ tvhlog_hexdump(LS_SATIP, hc->hc_data, hc->hc_data_size);
}
if (d->myaddr == NULL || d->myaddr[0] == '\0') {
xml = htsmsg_xml_deserialize(hc->hc_data, errbuf, sizeof(errbuf));
hc->hc_data = NULL;
if (!xml) {
- tvhlog(LOG_ERR, "satip_discovery_desc", "htsmsg_xml_deserialize error %s", errbuf);
+ tvherror(LS_SATIP, "satip_discovery_desc htsmsg_xml_deserialize error %s", errbuf);
goto finish;
}
if ((tags = htsmsg_get_map(xml, "tags")) == NULL)
mi->mi_display_name(mi, buf1, sizeof(buf1));
mpegts_mux_nice_name(mmi->mmi_mux, buf2, sizeof(buf2));
- tvhdebug("satip", "%s - stopping %s", buf1, buf2);
+ tvhdebug(LS_SATIP, "%s - stopping %s", buf1, buf2);
mtimer_disarm(&lfe->sf_monitor_timer);
lfe->mi_display_name((mpegts_input_t*)lfe, buf1, sizeof(buf1));
mpegts_mux_nice_name(mmi->mmi_mux, buf2, sizeof(buf2));
- tvhdebug("satip", "%s - starting %s", buf1, buf2);
+ tvhdebug(LS_SATIP, "%s - starting %s", buf1, buf2);
if (!lfe->sf_device->sd_no_univ_lnb &&
(lm->lm_tuning.dmc_fe_delsys == DVB_SYS_DVBS ||
/* Note: assume universal LNB */
if (lm->lm_tuning.dmc_fe_freq < 10700000 ||
lm->lm_tuning.dmc_fe_freq > 12750000) {
- tvhwarn("satip", "DVB-S/S2 frequency %d out of range universal LNB", lm->lm_tuning.dmc_fe_freq);
+ tvhwarn(LS_SATIP, "DVB-S/S2 frequency %d out of range universal LNB", lm->lm_tuning.dmc_fe_freq);
return SM_CODE_TUNING_FAILED;
}
}
if (sl > 0 && l - 16 >= sl) {
rtcp[sl + 16] = '\0';
s = (char *)rtcp + 16;
- tvhtrace("satip", "Status string: '%s'", s);
+ tvhtrace(LS_SATIP, "Status string: '%s'", s);
status = SIGNAL_NONE;
if (strncmp(s, "ver=0.9;tuner=", 14) == 0 ||
strncmp(s, "ver=1.2;tuner=", 14) == 0) {
}
if (r < 0)
- tvherror("satip", "%s - failed to modify pids: %s", name, strerror(-r));
+ tvherror(LS_SATIP, "%s - failed to modify pids: %s", name, strerror(-r));
return r;
skip:
snprintf(b, sizeof(b), "/stream=%li", stream_id);
r = rtsp_teardown(rtsp, b, NULL);
if (r < 0) {
- tvhtrace("satip", "bad shutdown for session %s stream id %li", session, stream_id);
+ tvhtrace(LS_SATIP, "bad shutdown for session %s stream id %li", session, stream_id);
} else {
while (1) {
r = http_client_run(rtsp);
}
http_client_close(rtsp);
- tvhlog(LOG_INFO, "satip", "extra shutdown done for session %s", session);
+ tvhinfo(LS_SATIP, "extra shutdown done for session %s", session);
done:
tvhpoll_destroy(efd);
goto wake;
snprintf(b, sizeof(b), "/stream=%li", rtsp->hc_rtsp_stream_id);
- tvhtrace("satip", "%s - shutdown for %s/%s", name, b, rtsp->hc_rtsp_session ?: "");
+ tvhtrace(LS_SATIP, "%s - shutdown for %s/%s", name, b, rtsp->hc_rtsp_session ?: "");
r = rtsp_teardown(rtsp, (char *)b, NULL);
if (r < 0) {
- tvhtrace("satip", "%s - bad teardown", b);
+ tvhtrace(LS_SATIP, "%s - bad teardown", b);
} else {
while (1) {
r = http_client_run(rtsp);
lfe->sf_seq = nseq;
else if (((lfe->sf_seq + 1) & 0xffff) != nseq) {
unc = ((c - pos) / 188) * (uint32_t)((uint16_t)nseq-(uint16_t)(lfe->sf_seq+1));
- tvhtrace("satip", "TCP/RTP discontinuity (%i != %i)", lfe->sf_seq + 1, nseq);
+ tvhtrace(LS_SATIP, "TCP/RTP discontinuity (%i != %i)", lfe->sf_seq + 1, nseq);
}
lfe->sf_seq = nseq;
c = read(lfe->sf_dvr_pipe.rd, b, 1);
if (c == 1) {
if (b[0] == 'e') {
- tvhtrace("satip", "%s - input thread received shutdown", buf);
+ tvhtrace(LS_SATIP, "%s - input thread received shutdown", buf);
exit_flag = 1;
goto done;
} else if (b[0] == 's') {
- tvhtrace("satip", "%s - start", buf);
+ tvhtrace(LS_SATIP, "%s - start", buf);
start = 1;
}
}
if ((rtsp_flags & SATIP_SETUP_TCP) == 0) {
if (udp_bind_double(&rtp, &rtcp,
- "satip", "rtp", "rtcp",
+ LS_SATIP, "rtp", "rtcp",
satip_frontend_bindaddr(lfe), lfe->sf_udp_rtp_port,
NULL, SATIP_BUF_SIZE, 16384, 4*1024, 4*1024) < 0) {
satip_frontend_tuning_error(lfe, tr);
rtp_port = ntohs(IP_PORT(rtp->ip));
- tvhtrace("satip", "%s - local RTP port %i RTCP port %i",
+ tvhtrace(LS_SATIP, "%s - local RTP port %i RTCP port %i",
lfe->mi_name,
ntohs(IP_PORT(rtp->ip)),
ntohs(IP_PORT(rtcp->ip)));
r = (uint64_t)i - u64_2;
if (tc)
- tvhtrace("satip", "%s - last tune diff = %llu (delay = %d)",
+ tvhtrace(LS_SATIP, "%s - last tune diff = %llu (delay = %d)",
buf, (unsigned long long)u64_2, r);
tc = 1;
changing = 1;
continue;
} else if (b[0] == 'e') {
- tvhtrace("satip", "%s - input thread received shutdown", buf);
+ tvhtrace(LS_SATIP, "%s - input thread received shutdown", buf);
exit_flag = 1;
goto done;
} else if (b[0] == 's') {
continue;
}
}
- tvhtrace("satip", "%s - input thread received mux close", buf);
+ tvhtrace(LS_SATIP, "%s - input thread received mux close", buf);
goto done;
}
pthread_mutex_unlock(&lfe->sf_dvr_lock);
if (r < 0) {
if (r != -12345678)
- tvherror("satip", "%s - failed to tune (%i)", buf, r);
+ tvherror(LS_SATIP, "%s - failed to tune (%i)", buf, r);
else
- tvhtrace("satip", "%s - mux changed in the middle", buf);
+ tvhtrace(LS_SATIP, "%s - mux changed in the middle", buf);
satip_frontend_tuning_error(lfe, tr);
goto done;
}
changing = 1;
continue;
} else if (b[0] == 'e') {
- tvhtrace("satip", "%s - input thread received shutdown", buf);
+ tvhtrace(LS_SATIP, "%s - input thread received shutdown", buf);
exit_flag = 1; running = 0;
continue;
} else if (b[0] == 's') {
continue;
}
}
- tvhtrace("satip", "%s - input thread received mux close", buf);
+ tvhtrace(LS_SATIP, "%s - input thread received mux close", buf);
running = 0;
continue;
}
r = http_client_run(rtsp);
if (r < 0) {
if (rtsp->hc_code == 404 && session[0]) {
- tvhlog(LOG_WARNING, "satip", "%s - RTSP 404 ERROR (retrying)", buf);
+ tvhwarn(LS_SATIP, "%s - RTSP 404 ERROR (retrying)", buf);
satip_frontend_extra_shutdown(lfe, session, stream_id);
session[0] = '\0';
start = 1;
rtsp = NULL;
break;
}
- tvhlog(LOG_ERR, "satip", "%s - RTSP error %d (%s) [%i-%i]",
- buf, r, strerror(-r), rtsp->hc_cmd, rtsp->hc_code);
+ tvherror(LS_SATIP, "%s - RTSP error %d (%s) [%i-%i]",
+ buf, r, strerror(-r), rtsp->hc_cmd, rtsp->hc_code);
satip_frontend_tuning_error(lfe, tr);
fatal = 1;
} else if (r == HTTP_CON_DONE) {
if (!running)
break;
if (r < 0) {
- tvhlog(LOG_ERR, "satip", "%s - RTSP OPTIONS error %d (%s) [%i-%i]",
- buf, r, strerror(-r), rtsp->hc_cmd, rtsp->hc_code);
+ tvherror(LS_SATIP, "%s - RTSP OPTIONS error %d (%s) [%i-%i]",
+ buf, r, strerror(-r), rtsp->hc_cmd, rtsp->hc_code);
satip_frontend_tuning_error(lfe, tr);
fatal = 1;
}
rtsp->hc_rtcp_port != rtp_port + 1)) ||
((rtsp_flags & SATIP_SETUP_TCP) != 0 &&
(rtsp->hc_rtp_tcp < 0 || rtsp->hc_rtcp_tcp < 0))) {
- tvhlog(LOG_ERR, "satip", "%s - RTSP SETUP error %d (%s) [%i-%i]",
- buf, r, strerror(-r), rtsp->hc_cmd, rtsp->hc_code);
+ tvherror(LS_SATIP, "%s - RTSP SETUP error %d (%s) [%i-%i]",
+ buf, r, strerror(-r), rtsp->hc_cmd, rtsp->hc_code);
satip_frontend_tuning_error(lfe, tr);
fatal = 1;
} else {
strncpy((char *)session, rtsp->hc_rtsp_session ?: "", sizeof(session));
session[sizeof(session)-1] = '\0';
stream_id = rtsp->hc_rtsp_stream_id;
- tvhdebug("satip", "%s #%i - new session %s stream id %li",
+ tvhdebug(LS_SATIP, "%s #%i - new session %s stream id %li",
rtsp->hc_host, lfe->sf_number,
rtsp->hc_rtsp_session, rtsp->hc_rtsp_stream_id);
if (lfe->sf_play2) {
}
pthread_mutex_unlock(&lfe->sf_dvr_lock);
if (r < 0) {
- tvherror("satip", "%s - failed to tune2 (%i)", buf, r);
+ tvherror(LS_SATIP, "%s - failed to tune2 (%i)", buf, r);
satip_frontend_tuning_error(lfe, tr);
fatal = 1;
}
/* fall thru */
default:
if (rtsp->hc_code >= 400) {
- tvhlog(LOG_ERR, "satip", "%s - RTSP cmd error %d (%s) [%i-%i]",
- buf, r, strerror(-r), rtsp->hc_cmd, rtsp->hc_code);
+ tvherror(LS_SATIP, "%s - RTSP cmd error %d (%s) [%i-%i]",
+ buf, r, strerror(-r), rtsp->hc_cmd, rtsp->hc_code);
satip_frontend_tuning_error(lfe, tr);
fatal = 1;
}
if (ERRNO_AGAIN(errno))
continue;
if (errno == EOVERFLOW) {
- tvhlog(LOG_WARNING, "satip", "%s - recvmsg() EOVERFLOW", buf);
+ tvhwarn(LS_SATIP, "%s - recvmsg() EOVERFLOW", buf);
continue;
}
- tvhlog(LOG_ERR, "satip", "%s - multirecv error %d (%s)",
- buf, errno, strerror(errno));
+ tvherror(LS_SATIP, "%s - multirecv error %d (%s)",
+ buf, errno, strerror(errno));
break;
}
seq = nseq;
else if (((seq + 1) & 0xffff) != nseq) {
unc += ((c - pos) / 188) * (uint32_t)((uint16_t)nseq-(uint16_t)(seq+1));
- tvhtrace("satip", "RTP discontinuity (%i != %i)", seq + 1, nseq);
+ tvhtrace(LS_SATIP, "RTP discontinuity (%i != %i)", seq + 1, nseq);
}
seq = nseq;
/* Process */
else if (type == DVB_TYPE_ATSC_C)
idc = &satip_frontend_atsc_c_class;
else {
- tvherror("satip", "unknown FE type %d", type);
+ tvherror(LS_SATIP, "unknown FE type %d", type);
return NULL;
}
/* Stop thread */
if (lfe->sf_dvr_pipe.wr > 0) {
tvh_write(lfe->sf_dvr_pipe.wr, "e", 1);
- tvhtrace("satip", "%s - waiting for control thread", buf1);
+ tvhtrace(LS_SATIP, "%s - waiting for control thread", buf1);
pthread_join(lfe->sf_dvr_thread, NULL);
tvh_pipe_close(&lfe->sf_dvr_pipe);
- tvhdebug("satip", "%s - stopped control thread", buf1);
+ tvhdebug(LS_SATIP, "%s - stopped control thread", buf1);
}
/* Stop timer */
return tbl->s;
tbl++;
}
- tvhtrace("satip", "%s - cannot translate %d", prefix, src);
+ tvhtrace(LS_SATIP, "%s - cannot translate %d", prefix, src);
return defval;
}
strcat(buf, ",21");
} else if (flags & SATIP_SETUP_PIDS21)
strcat(buf, "&pids=21");
- tvhtrace("satip", "setup params - %s", buf);
+ tvhtrace(LS_SATIP, "setup params - %s", buf);
if (hc->hc_rtsp_stream_id >= 0)
snprintf(stream = _stream, sizeof(_stream), "/stream=%li",
hc->hc_rtsp_stream_id);
TAILQ_FOREACH(sfc, &lfe->sf_satconf, sfc_link) {
if (sfc->sfc_network_limit) {
if (lfe->sf_master) {
- tvherror("satip", "%s: unable to combine master/slave with network limiter, "
- "disabling master", lfe->mi_name);
+ tvherror(LS_SATIP, "%s: unable to combine master/slave with network limiter, "
+ "disabling master", lfe->mi_name);
lfe->sf_master = 0;
}
}
}
if (!reg) {
- tvhtrace("scanfile", "%s region %s created", type, id);
+ tvhtrace(LS_SCANFILE, "%s region %s created", type, id);
reg = calloc(1, sizeof(scanfile_region_t));
reg->sfr_id = strdup(id);
reg->sfr_name = strdup(desc);
break;
}
- tvhtrace("scanfile", "[%s] %s", line, r ? "FAIL" : "OK");
+ tvhtrace(LS_SCANFILE, "[%s] %s", line, r ? "FAIL" : "OK");
if (r) {
free(mux);
} else {
}
#define mux_fail0(r, text) do { \
- tvhtrace("scanfile", text); \
+ tvhtrace(LS_SCANFILE, text); \
((r) = -1); \
} while (0)
#define mux_fail(r, text, val) do { \
- tvhtrace("scanfile", text, val); \
+ tvhtrace(LS_SCANFILE, text, val); \
((r) = -1); \
} while (0)
#define mux_ok(r) ((r) = ((r) > 0) ? 0 : (r))
free(mux);
} else {
dvb_mux_conf_str(mux, buf, sizeof(buf));
- tvhtrace("scanfile", "mux %s", buf);
+ tvhtrace(LS_SCANFILE, "mux %s", buf);
if (*net == NULL)
if (scanfile_create_network(net, type, name, mux->dmc_fe_delsys))
return -1;
char *str, buf[256];
int load = 0;
- tvhtrace("scanfile", "load file %s", name);
+ tvhtrace(LS_SCANFILE, "load file %s", name);
if (scanfile_total_load > SCANFILE_LIMIT) return;
fp = fb_open2(dir, name, 1, 0);
char p[256];
fb_dir *dir;
fb_dirent *de;
- tvhtrace("scanfile", "load dir %s", path);
+ tvhtrace(LS_SCANFILE, "load dir %s", path);
if (lvl >= 3) return;
if (!(dir = fb_opendir(path))) return;
networks++;
}
if (regions) {
- tvhinfo("scanfile", "%s - loaded %i regions with %i networks", what, regions, networks);
+ tvhinfo(LS_SCANFILE, "%s - loaded %i regions with %i networks", what, regions, networks);
return 1;
}
return 0;
r += scanfile_stats(buf, &scanfile_regions_load[i]);
}
if (!r) {
- tvhwarn("scanfile", "no predefined muxes found, check path '%s%s'",
+ tvhwarn(LS_SCANFILE, "no predefined muxes found, check path '%s%s'",
path[0] == '/' ? path : TVHEADEND_DATADIR "/",
path[0] == '/' ? "" : path);
- tvhwarn("scanfile", "expected tree structure - http://git.linuxtv.org/cgit.cgi/dtv-scan-tables.git/tree/");
+ tvhwarn(LS_SCANFILE, "expected tree structure - http://git.linuxtv.org/cgit.cgi/dtv-scan-tables.git/tree/");
for (i = 0; i < REGIONS; i++)
scanfile_done_region(&scanfile_regions_load[i]);
free(scanfile_regions_load);
/* Let the hardware to stabilize and don't flood the log */
if (t->s_start_time + sec2mono(1) < mclk() &&
tvhlog_limit(&st->es_cc_log, 10))
- tvhwarn("TS", "%s Continuity counter error (total %zi)",
+ tvhwarn(LS_TS, "%s Continuity counter error (total %zi)",
service_component_nicename(st), st->es_cc_log.count);
if (!error)
errors++;
/* Let the hardware to stabilize and don't flood the log */
if (t->s_start_time + sec2mono(1) < mclk() &&
tvhlog_limit(&st->es_cc_log, 10))
- tvhwarn("TS", "%s Continuity counter error (total %zi)",
+ tvhwarn(LS_TS, "%s Continuity counter error (total %zi)",
service_component_nicename(st), st->es_cc_log.count);
}
st->es_cc = (cc + 1) & 0xf;
if(error) {
/* Transport Error Indicator */
if (tvhlog_limit(&t->s_tei_log, 10))
- tvhwarn("TS", "%s Transport error indicator (total %zi)",
+ tvhwarn(LS_TS, "%s Transport error indicator (total %zi)",
service_nicename((service_t*)t), t->s_tei_log.count);
}
uuid = tmp;
}
- tvhtrace("tsfile", "add file %s (uuid:%s)", path, uuid);
+ tvhtrace(LS_TSFILE, "add file %s (uuid:%s)", path, uuid);
/* Create logical instance */
mm = tsfile_mux_create(uuid, tsfile_network);
tmi = (tsfile_mux_instance_t*)mmi;
fd = tvh_open(tmi->mmi_tsfile_path, O_RDONLY | O_NONBLOCK, 0);
if (fd == -1)
- tvhlog(LOG_ERR, "tsfile", "open(%s) failed %d (%s)",
- tmi->mmi_tsfile_path, errno, strerror(errno));
+ tvherror(LS_TSFILE, "open(%s) failed %d (%s)",
+ tmi->mmi_tsfile_path, errno, strerror(errno));
else
- tvhtrace("tsfile", "adapter %d opened %s", mi->mi_instance, tmi->mmi_tsfile_path);
+ tvhtrace(LS_TSFILE, "adapter %d opened %s", mi->mi_instance, tmi->mmi_tsfile_path);
}
pthread_mutex_unlock(&global_lock);
if (fd == -1) return NULL;
/* Get file length */
if (fstat(fd, &st)) {
- tvhlog(LOG_ERR, "tsfile", "stat() failed %d (%s)",
- errno, strerror(errno));
+ tvherror(LS_TSFILE, "stat() failed %d (%s)",
+ errno, strerror(errno));
goto exit;
}
/* Check for extra (incomplete) packet at end */
rem = st.st_size % 188;
len = 0;
- tvhtrace("tsfile", "adapter %d file size %jd rem %zu",
+ tvhtrace(LS_TSFILE, "adapter %d file size %jd rem %zu",
mi->mi_instance, (intmax_t)st.st_size, rem);
pcr_last_mono = getfastmonoclock();
if (c < 0) {
if (ERRNO_AGAIN(errno))
continue;
- tvhlog(LOG_ERR, "tsfile", "read() error %d (%s)",
- errno, strerror(errno));
+ tvherror(LS_TSFILE, "read() error %d (%s)",
+ errno, strerror(errno));
break;
}
len += c;
if (len >= st.st_size) {
len = 0;
c -= rem;
- tvhtrace("tsfile", "adapter %d reached eof, resetting", mi->mi_instance);
+ tvhtrace(LS_TSFILE, "adapter %d reached eof, resetting", mi->mi_instance);
lseek(fd, 0, SEEK_SET);
pcr_last = PTS_UNSET;
}
/* Stop thread */
if (ti->ti_thread_pipe.rd != -1) {
- tvhtrace("tsfile", "adapter %d stopping thread", mi->mi_instance);
+ tvhtrace(LS_TSFILE, "adapter %d stopping thread", mi->mi_instance);
err = tvh_write(ti->ti_thread_pipe.wr, "", 1);
assert(err != -1);
pthread_join(ti->ti_thread_id, NULL);
tvh_pipe_close(&ti->ti_thread_pipe);
- tvhtrace("tsfile", "adapter %d stopped thread", mi->mi_instance);
+ tvhtrace(LS_TSFILE, "adapter %d stopped thread", mi->mi_instance);
}
mmi->mmi_mux->mm_active = NULL;
mpegts_mux_t *mm = t->mmi_mux;
tsfile_mux_instance_t *mmi = (tsfile_mux_instance_t*)t;
tsfile_input_t *ti = (tsfile_input_t*)mi;
- tvhtrace("tsfile", "adapter %d starting mmi %p", mi->mi_instance, mmi);
+ tvhtrace(LS_TSFILE, "adapter %d starting mmi %p", mi->mi_instance, mmi);
/* Already tuned */
if (mmi->mmi_mux->mm_active == t) {
- tvhtrace("tsfile", "mmi %p is already active", mmi);
+ tvhtrace(LS_TSFILE, "mmi %p is already active", mmi);
return 0;
}
assert(mmi->mmi_mux->mm_active == NULL);
/* Check file is accessible */
if (lstat(mmi->mmi_tsfile_path, &st)) {
- tvhlog(LOG_ERR, "tsfile", "mmi %p could not stat '%s' (%i)",
- mmi, mmi->mmi_tsfile_path, errno);
+ tvherror(LS_TSFILE, "mmi %p could not stat '%s' (%i)",
+ mmi, mmi->mmi_tsfile_path, errno);
mmi->mmi_tune_failed = 1;
return SM_CODE_TUNING_FAILED;
}
if (ti->ti_thread_pipe.rd == -1) {
if (tvh_pipe(O_NONBLOCK, &ti->ti_thread_pipe)) {
mmi->mmi_tune_failed = 1;
- tvhlog(LOG_ERR, "tsfile", "failed to create thread pipe");
+ tvherror(LS_TSFILE, "failed to create thread pipe");
return SM_CODE_TUNING_FAILED;
}
- tvhtrace("tsfile", "adapter %d starting thread", mi->mi_instance);
+ tvhtrace(LS_TSFILE, "adapter %d starting thread", mi->mi_instance);
tvhthread_create(&ti->ti_thread_id, NULL, tsfile_input_thread, mi, "tsfile");
}
mmi->mmi_tsfile_path = strdup(path);
mmi->mmi_tsfile_pcr_pid = MPEGTS_PID_NONE;
mmi->tii_delete = tsfile_mux_instance_delete;
- tvhtrace("tsfile", "mmi created %p path %s", mmi, mmi->mmi_tsfile_path);
+ tvhtrace(LS_TSFILE, "mmi created %p path %s", mmi, mmi->mmi_tsfile_path);
return mmi;
}
= mpegts_mux_create1(uuid, mn, MPEGTS_ONID_NONE, MPEGTS_TSID_NONE, NULL);
mm->mm_config_save = iptv_mux_config_save;
mm->mm_epg = MM_EPG_DISABLE;
- tvhtrace("tsfile", "mm created %p", mm);
+ tvhtrace(LS_TSFILE, "mm created %p", mm);
return mm;
}
if ( hd->hd_override_type != NULL && strcmp(hd->hd_override_type,s) != 0 ) {
free(hd->hd_override_type);
hd->hd_override_type = strdup(p);
- tvhlog(LOG_INFO, "tvhdhomerun", "Setting override_type : %s", hd->hd_override_type);
+ tvhinfo(LS_TVHDHOMERUN, "Setting override_type : %s", hd->hd_override_type);
return 1;
}
}
}
hd->hd_override_type = strdup(dvb_type2str(type));
- tvhlog(LOG_INFO, "tvheadend","Using Network type : %s", hd->hd_override_type);
+ tvhinfo(LS_TVHDHOMERUN, "Using Network type : %s", hd->hd_override_type);
/* some sane defaults */
hd->hd_fullmux_ok = 1;
for (j = 0; j < dInfo->tuner_count; ++j) {
if (tvhdhomerun_frontend_create(hd, dInfo, feconf, type, j)) {
- tvhlog(LOG_INFO, "tvhdhomerun", "Created frontend %08X tuner %d", dInfo->device_id, j);
+ tvhinfo(LS_TVHDHOMERUN, "Created frontend %08X tuner %d", dInfo->device_id, j);
} else {
- tvhlog(LOG_ERR, "tvhdhomerun", "Unable to create frontend-device. ( %08x-%d )", dInfo->device_id,j);
+ tvherror(LS_TVHDHOMERUN, "Unable to create frontend-device. ( %08x-%d )", dInfo->device_id,j);
}
}
tvhdhomerun_device_t *existing = tvhdhomerun_device_find(cDev->device_id);
if ( tvheadend_is_running() ) {
if ( !existing ) {
- tvhlog(LOG_INFO, "tvhdhomerun","Found HDHomerun device %08x with %d tuners",
- cDev->device_id, cDev->tuner_count);
+ tvhinfo(LS_TVHDHOMERUN,"Found HDHomerun device %08x with %d tuners",
+ cDev->device_id, cDev->tuner_count);
tvhdhomerun_device_create(cDev);
} else if ( ((struct sockaddr_in *)&existing->hd_info.ip_address)->sin_addr.s_addr !=
htonl(cDev->ip_addr) ) {
tcp_get_str_from_ip((struct sockaddr *)&detected_dev_addr, detected_ip,
sizeof(detected_ip));
- tvhlog(LOG_INFO, "tvhdhomerun","HDHomerun device %08x switched IPs from %s to %s, updating",
+ tvhinfo(LS_TVHDHOMERUN,"HDHomerun device %08x switched IPs from %s to %s, updating",
cDev->device_id, existing_ip, detected_ip);
tvhdhomerun_device_destroy(existing);
tvhdhomerun_device_create(cDev);
idnode_save_check(&hd->th_id, 0);
- tvhlog(LOG_INFO, "tvhdhomerun", "Releasing locks for devices");
+ tvhinfo(LS_TVHDHOMERUN, "Releasing locks for devices");
while ((lfe = TAILQ_FIRST(&hd->hd_frontends)) != NULL) {
tvhdhomerun_frontend_delete(lfe);
}
tvhpoll_event_t ev[2];
tvhpoll_t *efd;
- tvhdebug("tvhdhomerun", "starting input thread");
+ tvhdebug(LS_TVHDHOMERUN, "starting input thread");
/* Get MMI */
pthread_mutex_lock(&hfe->hf_input_thread_mutex);
pthread_mutex_unlock(&hfe->hf_input_thread_mutex);
if (mmi == NULL) return NULL;
- tvhdebug("tvhdhomerun", "opening client socket");
+ tvhdebug(LS_TVHDHOMERUN, "opening client socket");
/* One would like to use libhdhomerun for the streaming details,
* but that library uses threads on its own and the socket is put
/* first setup a local socket for the device to stream to */
sockfd = tvh_socket(AF_INET, SOCK_DGRAM, 0);
if(sockfd == -1) {
- tvherror("tvhdhomerun", "failed to open socket (%d)", errno);
+ tvherror(LS_TVHDHOMERUN, "failed to open socket (%d)", errno);
return NULL;
}
if(fcntl(sockfd, F_SETFL, O_NONBLOCK) != 0) {
close(sockfd);
- tvherror("tvhdhomerun", "failed to set socket nonblocking (%d)", errno);
+ tvherror(LS_TVHDHOMERUN, "failed to set socket nonblocking (%d)", errno);
return NULL;
}
/* enable broadcast */
if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, (char *) &sock_opt, sizeof(sock_opt)) < 0) {
close(sockfd);
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to enable broadcast on socket (%d)", errno);
+ tvherror(LS_TVHDHOMERUN, "failed to enable broadcast on socket (%d)", errno);
return NULL;
}
if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &sock_opt, sizeof(sock_opt)) < 0) {
close(sockfd);
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to set address reuse on socket (%d)", errno);
+ tvherror(LS_TVHDHOMERUN, "failed to set address reuse on socket (%d)", errno);
return NULL;
}
/* important: we need large rx buffers to accomodate the large amount of traffic */
if(setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, (char *) &rx_size, sizeof(rx_size)) < 0) {
- tvhlog(LOG_WARNING, "tvhdhomerun", "failed set socket rx buffer size, expect CC errors (%d)", errno);
+ tvhwarn(LS_TVHDHOMERUN, "failed set socket rx buffer size, expect CC errors (%d)", errno);
}
memset(&sock_addr, 0, sizeof(sock_addr));
sock_addr.sin_addr.s_addr = htonl(INADDR_ANY);
sock_addr.sin_port = 0;
if(bind(sockfd, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) != 0) {
- tvhlog(LOG_ERR, "tvhdhomerun", "failed bind socket: %d", errno);
+ tvherror(LS_TVHDHOMERUN, "failed bind socket: %d", errno);
close(sockfd);
return NULL;
}
memset(&sock_addr, 0, sizeof(sock_addr));
if(getsockname(sockfd, (struct sockaddr *) &sock_addr, &sockaddr_len) != 0) {
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to getsockname: %d", errno);
+ tvherror(LS_TVHDHOMERUN, "failed to getsockname: %d", errno);
close(sockfd);
return NULL;
}
(unsigned int)(local_ip >> 8) & 0xFF,
(unsigned int)(local_ip >> 0) & 0xFF,
ntohs(sock_addr.sin_port));
- tvhdebug("tvhdhomerun", "setting target to: %s", target);
+ tvhdebug(LS_TVHDHOMERUN, "setting target to: %s", target);
pthread_mutex_lock(&hfe->hf_hdhomerun_device_mutex);
r = hdhomerun_device_set_tuner_target(hfe->hf_hdhomerun_tuner, target);
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
if(r < 1) {
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to set target: %d", r);
+ tvherror(LS_TVHDHOMERUN, "failed to set target: %d", r);
return NULL;
}
r = tvhpoll_add(efd, ev, 2);
if(r < 0)
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to setup poll");
+ tvherror(LS_TVHDHOMERUN, "failed to setup poll");
sbuf_init_fixed(&sb, (20000000 / 8));
if(ERRNO_AGAIN(errno))
continue;
if(errno == EOVERFLOW) {
- tvhlog(LOG_WARNING, "tvhdhomerun", "%s - read() EOVERFLOW", buf);
+ tvhwarn(LS_TVHDHOMERUN, "%s - read() EOVERFLOW", buf);
continue;
}
- tvhlog(LOG_ERR, "tvhdhomerun", "%s - read() error %d (%s)",
- buf, errno, strerror(errno));
+ tvherror(LS_TVHDHOMERUN, "%s - read() error %d (%s)",
+ buf, errno, strerror(errno));
break;
}
//if(r != (7*188))
//continue; /* dude; this is not a valid packet */
- //tvhdebug("tvhdhomerun", "got r=%d (thats %d)", r, (r == 7*188));
+ //tvhdebug(LS_TVHDHOMERUN, "got r=%d (thats %d)", r, (r == 7*188));
mpegts_input_recv_packets((mpegts_input_t*) hfe, mmi, &sb, 0, NULL);
}
- tvhdebug("tvhdhomerun", "setting target to none");
+ tvhdebug(LS_TVHDHOMERUN, "setting target to none");
pthread_mutex_lock(&hfe->hf_hdhomerun_device_mutex);
hdhomerun_device_set_tuner_target(hfe->hf_hdhomerun_tuner, "none");
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
res = hdhomerun_device_get_tuner_status(hfe->hf_hdhomerun_tuner, &tuner_status_str, &tuner_status);
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
if(res < 1)
- tvhwarn("tvhdhomerun", "tuner_status (%d)", res);
+ tvhwarn(LS_TVHDHOMERUN, "tuner_status (%d)", res);
if(tuner_status.signal_present)
hfe->hf_status = SIGNAL_GOOD;
/* wait for a signal_present */
if(!hfe->hf_locked) {
if(tuner_status.signal_present) {
- tvhdebug("tvhdhomerun", "locked");
+ tvhdebug(LS_TVHDHOMERUN, "locked");
hfe->hf_locked = 1;
/* start input thread */
/* a full mux subscription should specificly set the filter */
if (pid == MPEGTS_FULLMUX_PID) {
- tvhdebug("tvhdhomerun", "setting PID filter full mux");
+ tvhdebug(LS_TVHDHOMERUN, "setting PID filter full mux");
pthread_mutex_lock(&hfe->hf_hdhomerun_device_mutex);
res = hdhomerun_device_set_tuner_filter(hfe->hf_hdhomerun_tuner, "0x0000-0x1FFF");
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
if(res < 1)
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to set_tuner_filter to 0x0000 - 0x1FFF");
+ tvherror(LS_TVHDHOMERUN, "failed to set_tuner_filter to 0x0000 - 0x1FFF");
return;
}
res = hdhomerun_device_get_tuner_filter(hfe->hf_hdhomerun_tuner, &pfilter);
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
if(res < 1) {
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to get_tuner_filter: %d", res);
+ tvherror(LS_TVHDHOMERUN, "failed to get_tuner_filter: %d", res);
return;
}
- tvhdebug("tvhdhomerun", "current pfilter: %s", pfilter);
+ tvhdebug(LS_TVHDHOMERUN, "current pfilter: %s", pfilter);
/* make sure the pid maps to a max of 0x1FFF, API will reject the call otherwise */
if(pid > 0x1FFF) {
- tvhlog(LOG_ERR, "tvhdhomerun", "pid %d is too large, masking to API maximum of 0x1FFF", pid);
+ tvherror(LS_TVHDHOMERUN, "pid %d is too large, masking to API maximum of 0x1FFF", pid);
pid = (pid & 0x1FFF);
}
if(strncmp(pfilter, buf, strlen(buf)) != 0) {
memset(buf, 0x00, sizeof(buf));
snprintf(buf, sizeof(buf), "%s 0x%04x", pfilter, pid);
- tvhdebug("tvhdhomerun", "setting pfilter to: %s", buf);
+ tvhdebug(LS_TVHDHOMERUN, "setting pfilter to: %s", buf);
pthread_mutex_lock(&hfe->hf_hdhomerun_device_mutex);
res = hdhomerun_device_set_tuner_filter(hfe->hf_hdhomerun_tuner, buf);
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
if(res < 1)
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to set_tuner_filter: %d", res);
+ tvherror(LS_TVHDHOMERUN, "failed to set_tuner_filter: %d", res);
} else {
- //tvhdebug("tvhdhomerun", "pid 0x%x already present in pfilter", pid);
+ //tvhdebug(LS_TVHDHOMERUN, "pid 0x%x already present in pfilter", pid);
return;
}
}
break;
}
- tvhlog(LOG_INFO, "tvhdhomerun", "tuning to %s", channel_buf);
+ tvhinfo(LS_TVHDHOMERUN, "tuning to %s", channel_buf);
pthread_mutex_lock(&hfe->hf_hdhomerun_device_mutex);
res = hdhomerun_device_tuner_lockkey_request(hfe->hf_hdhomerun_tuner, &perror);
if(res < 1) {
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to acquire lockkey: %s", perror);
+ tvherror(LS_TVHDHOMERUN, "failed to acquire lockkey: %s", perror);
return SM_CODE_TUNING_FAILED;
}
res = hdhomerun_device_set_tuner_channel(hfe->hf_hdhomerun_tuner, channel_buf);
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
if(res < 1) {
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to tune to %s", channel_buf);
+ tvherror(LS_TVHDHOMERUN, "failed to tune to %s", channel_buf);
return SM_CODE_TUNING_FAILED;
}
mi->mi_display_name(mi, buf1, sizeof(buf1));
mpegts_mux_nice_name(mmi->mmi_mux, buf2, sizeof(buf2));
- tvhdebug("tvhdhomerun", "%s - starting %s", buf1, buf2);
+ tvhdebug(LS_TVHDHOMERUN, "%s - starting %s", buf1, buf2);
/* tune to the right mux */
res = tvhdhomerun_frontend_tune(hfe, mmi);
r = hdhomerun_device_set_tuner_filter(hfe->hf_hdhomerun_tuner, "0x0000");
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
if(r < 1)
- tvhlog(LOG_ERR, "tvhdhomerun", "failed to reset pfilter: %d", r);
+ tvherror(LS_TVHDHOMERUN, "failed to reset pfilter: %d", r);
return res;
}
mi->mi_display_name(mi, buf1, sizeof(buf1));
mpegts_mux_nice_name(mmi->mmi_mux, buf2, sizeof(buf2));
- tvhdebug("tvhdhomerun", "%s - stopping %s", buf1, buf2);
+ tvhdebug(LS_TVHDHOMERUN, "%s - stopping %s", buf1, buf2);
/* join input thread */
if(hfe->hf_input_thread_pipe.wr > 0) {
tvh_write(hfe->hf_input_thread_pipe.wr, "", 1); // wake input thread
- tvhtrace("tvhdhomerun", "%s - waiting for input thread", buf1);
+ tvhtrace(LS_TVHDHOMERUN, "%s - waiting for input thread", buf1);
pthread_join(hfe->hf_input_thread, NULL);
tvh_pipe_close(&hfe->hf_input_thread_pipe);
- tvhtrace("tvhdhomerun", "%s - input thread stopped", buf1);
+ tvhtrace(LS_TVHDHOMERUN, "%s - input thread stopped", buf1);
}
hdhomerun_device_tuner_lockkey_release(hfe->hf_hdhomerun_tuner);
mpegts_pid_sub_t *mps;
int i;
- //tvhdebug("tvhdhomerun", "Update pids\n");
+ //tvhdebug(LS_TVHDHOMERUN, "Update pids\n");
mpegts_pid_init(&pids);
RB_FOREACH(mp, &mm->mm_pids, mp_link) {
else if (type == DVB_TYPE_ATSC_C)
idc = &tvhdhomerun_frontend_atsc_c_class;
else {
- tvherror("stvhdhomerun", "unknown FE type %d", type);
+ tvherror(LS_TVHDHOMERUN, "unknown FE type %d", type);
return NULL;
}
if(!strlen(l))
break;
- tvhlog(level, "libav", "%s", l);
+ tvhlog(level, LS_LIBAV, "%s", l);
if(!nl)
break;
streaming_component_type_t
codec_id2streaming_component_type(enum AVCodecID id)
{
- streaming_component_type_t type = AV_CODEC_ID_NONE;
+ streaming_component_type_t type = SCT_NONE;
switch(id) {
case AV_CODEC_ID_H264:
err = state_lock_(lfile, 1, timeout, -1);
if (err < 0)
- tvherror("lock", "file %s lock error: %s", lfile, strerror(-err));
+ tvherror(LS_LOCK, "file %s lock error: %s", lfile, strerror(-err));
return err;
}
err = state_lock_(lfile, 0, 10, _fd);
if (err < 0)
- tvherror("lock", "file %s unlock error: %s", lfile, strerror(-err));
+ tvherror(LS_LOCK, "file %s unlock error: %s", lfile, strerror(-err));
return err;
}
/* Note that on some platforms, the SSL library tries */
/* to determine the CPU capabilities with possible */
/* unknown instructions */
- tvhwarn("CPU", "Illegal instruction handler (might be OK)");
+ tvhwarn(LS_CPU, "Illegal instruction handler (might be OK)");
signal(SIGILL, handle_sigill);
}
#if ENABLE_GTIMER_CHECK
mtm = getmonoclock() - mtm;
if (mtm > 10000)
- tvhtrace("mtimer", "%s:%s duration %"PRId64"us", id, fcn, mtm);
+ tvhtrace(LS_MTIMER, "%s:%s duration %"PRId64"us", id, fcn, mtm);
#endif
}
// the top of the list with a 0 offset we could loop indefinitely
#if 0
- tvhdebug("gtimer", "now %"PRItime_t, ts.tv_sec);
+ tvhdebug(LS_GTIMER, "now %"PRItime_t, ts.tv_sec);
LIST_FOREACH(gti, >imers, gti_link)
- tvhdebug("gtimer", " gti %p expire %"PRItimet, gti, gti->gti_expire.tv_sec);
+ tvhdebug(LS_GTIMER, " gti %p expire %"PRItimet, gti, gti->gti_expire.tv_sec);
#endif
while((gti = LIST_FIRST(>imers)) != NULL) {
#if ENABLE_GTIMER_CHECK
mtm = getmonoclock() - mtm;
if (mtm > 10000)
- tvhtrace("gtimer", "%s:%s duration %"PRId64"us", id, fcn, mtm);
+ tvhtrace(LS_GTIMER, "%s:%s duration %"PRId64"us", id, fcn, mtm);
#endif
}
tvhlog_init(log_level, log_options, opt_logpath);
tvhlog_set_debug(log_debug);
tvhlog_set_trace(log_trace);
- tvhinfo("main", "Log started");
+ tvhinfo(LS_MAIN, "Log started");
signal(SIGPIPE, handle_sigpipe); // will be redundant later
signal(SIGILL, handle_sigill); // see handler..
for (i = 0; i < gnum; i++)
snprintf(buf + strlen(buf), sizeof(buf) - 1 - strlen(buf),
",%d", glist[i]);
- tvhlog(LOG_ALERT, "START",
+ tvhlog(LOG_ALERT, LS_START,
"setgroups(%s) failed, do you have permission?", buf+1);
return 1;
}
pidfile = tvh_fopen(opt_pidpath, "w+");
if (gid != -1 && (getgid() != gid) && setgid(gid)) {
- tvhlog(LOG_ALERT, "START",
+ tvhlog(LOG_ALERT, LS_START,
"setgid(%d) failed, do you have permission?", gid);
return 1;
}
if (uid != -1 && (getuid() != uid) && setuid(uid)) {
- tvhlog(LOG_ALERT, "START",
+ tvhlog(LOG_ALERT, LS_START,
"setuid(%d) failed, do you have permission?", uid);
return 1;
}
if (opt_dump) {
#ifdef PLATFORM_LINUX
if (chdir("/tmp"))
- tvhwarn("START", "failed to change cwd to /tmp");
+ tvhwarn(LS_START, "failed to change cwd to /tmp");
prctl(PR_SET_DUMPABLE, 1);
#else
- tvhwarn("START", "Coredumps not implemented on your platform");
+ tvhwarn(LS_START, "Coredumps not implemented on your platform");
#endif
}
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
- tvhlog(LOG_NOTICE, "START", "HTS Tvheadend version %s started, "
+ tvhlog(LOG_NOTICE, LS_START, "HTS Tvheadend version %s started, "
"running as PID:%d UID:%d GID:%d, CWD:%s CNF:%s",
tvheadend_version,
getpid(), getuid(), getgid(), getcwd(buf, sizeof(buf)),
pthread_join(mtimer_tid, NULL);
#if ENABLE_DBUS_1
- tvhftrace("main", dbus_server_done);
+ tvhftrace(LS_MAIN, dbus_server_done);
#endif
#if ENABLE_UPNP
- tvhftrace("main", upnp_server_done);
+ tvhftrace(LS_MAIN, upnp_server_done);
#endif
- tvhftrace("main", satip_server_done);
- tvhftrace("main", htsp_done);
- tvhftrace("main", http_server_done);
- tvhftrace("main", webui_done);
- tvhftrace("main", fsmonitor_done);
- tvhftrace("main", http_client_done);
- tvhftrace("main", tcp_server_done);
+ tvhftrace(LS_MAIN, satip_server_done);
+ tvhftrace(LS_MAIN, htsp_done);
+ tvhftrace(LS_MAIN, http_server_done);
+ tvhftrace(LS_MAIN, webui_done);
+ tvhftrace(LS_MAIN, fsmonitor_done);
+ tvhftrace(LS_MAIN, http_client_done);
+ tvhftrace(LS_MAIN, tcp_server_done);
// Note: the locking is obviously a bit redundant, but without
// we need to disable the gtimer_arm call in epg_save()
pthread_mutex_lock(&global_lock);
- tvhftrace("main", epg_save);
+ tvhftrace(LS_MAIN, epg_save);
#if ENABLE_TIMESHIFT
- tvhftrace("main", timeshift_term);
+ tvhftrace(LS_MAIN, timeshift_term);
#endif
pthread_mutex_unlock(&global_lock);
- tvhftrace("main", epggrab_done);
+ tvhftrace(LS_MAIN, epggrab_done);
#if ENABLE_MPEGTS
- tvhftrace("main", mpegts_done);
+ tvhftrace(LS_MAIN, mpegts_done);
#endif
- tvhftrace("main", descrambler_done);
- tvhftrace("main", service_mapper_done);
- tvhftrace("main", service_done);
- tvhftrace("main", channel_done);
- tvhftrace("main", bouquet_done);
- tvhftrace("main", dvr_done);
- tvhftrace("main", subscription_done);
- tvhftrace("main", access_done);
- tvhftrace("main", epg_done);
- tvhftrace("main", avahi_done);
- tvhftrace("main", bonjour_done);
- tvhftrace("main", imagecache_done);
- tvhftrace("main", lang_code_done);
- tvhftrace("main", api_done);
-
- tvhtrace("main", "tasklet enter");
+ tvhftrace(LS_MAIN, descrambler_done);
+ tvhftrace(LS_MAIN, service_mapper_done);
+ tvhftrace(LS_MAIN, service_done);
+ tvhftrace(LS_MAIN, channel_done);
+ tvhftrace(LS_MAIN, bouquet_done);
+ tvhftrace(LS_MAIN, dvr_done);
+ tvhftrace(LS_MAIN, subscription_done);
+ tvhftrace(LS_MAIN, access_done);
+ tvhftrace(LS_MAIN, epg_done);
+ tvhftrace(LS_MAIN, avahi_done);
+ tvhftrace(LS_MAIN, bonjour_done);
+ tvhftrace(LS_MAIN, imagecache_done);
+ tvhftrace(LS_MAIN, lang_code_done);
+ tvhftrace(LS_MAIN, api_done);
+
+ tvhtrace(LS_MAIN, "tasklet enter");
tvh_cond_signal(&tasklet_cond, 0);
pthread_join(tasklet_tid, NULL);
- tvhtrace("main", "tasklet thread end");
+ tvhtrace(LS_MAIN, "tasklet thread end");
tasklet_flush();
- tvhtrace("main", "tasklet leave");
- tvhtrace("main", "mtimer tick thread join enter");
+ tvhtrace(LS_MAIN, "tasklet leave");
+ tvhtrace(LS_MAIN, "mtimer tick thread join enter");
pthread_join(mtimer_tick_tid, NULL);
- tvhtrace("main", "mtimer tick thread join leave");
-
- tvhftrace("main", dvb_done);
- tvhftrace("main", lang_str_done);
- tvhftrace("main", esfilter_done);
- tvhftrace("main", profile_done);
- tvhftrace("main", intlconv_done);
- tvhftrace("main", urlparse_done);
- tvhftrace("main", idnode_done);
- tvhftrace("main", notify_done);
- tvhftrace("main", spawn_done);
-
- tvhlog(LOG_NOTICE, "STOP", "Exiting HTS Tvheadend");
+ tvhtrace(LS_MAIN, "mtimer tick thread join leave");
+
+ tvhftrace(LS_MAIN, dvb_done);
+ tvhftrace(LS_MAIN, lang_str_done);
+ tvhftrace(LS_MAIN, esfilter_done);
+ tvhftrace(LS_MAIN, profile_done);
+ tvhftrace(LS_MAIN, intlconv_done);
+ tvhftrace(LS_MAIN, urlparse_done);
+ tvhftrace(LS_MAIN, idnode_done);
+ tvhftrace(LS_MAIN, notify_done);
+ tvhftrace(LS_MAIN, spawn_done);
+
+ tvhlog(LOG_NOTICE, LS_STOP, "Exiting HTS Tvheadend");
tvhlog_end();
- tvhftrace("main", config_done);
- tvhftrace("main", hts_settings_done);
+ tvhftrace(LS_MAIN, config_done);
+ tvhftrace(LS_MAIN, hts_settings_done);
if(opt_fork)
unlink(opt_pidpath);
*/
void time_t_out_of_range_notify(int64_t val)
{
- tvherror("main", "time value out of range (%"PRId64") of time_t", val);
+ tvherror(LS_MAIN, "time value out of range (%"PRId64") of time_t", val);
}
#endif
if(!m) {
- tvhlog(LOG_ERR, "mux", "Can't find a muxer that supports '%s' container",
- muxer_container_type2txt(m_cfg->m_type));
+ tvherror(LS_MUXER, "Can't find a muxer that supports '%s' container",
+ muxer_container_type2txt(m_cfg->m_type));
return NULL;
}
continue;
if(!lav_muxer_support_stream(lm->m_config.m_type, ssc->ssc_type)) {
- tvhlog(LOG_WARNING, "libav", "%s is not supported in %s",
- streaming_component_type2txt(ssc->ssc_type),
- muxer_container_type2txt(lm->m_config.m_type));
+ tvhwarn(LS_LIBAV, "%s is not supported in %s",
+ streaming_component_type2txt(ssc->ssc_type),
+ muxer_container_type2txt(lm->m_config.m_type));
ssc->ssc_muxer_disabled = 1;
continue;
}
if(lav_muxer_add_stream(lm, ssc)) {
- tvhlog(LOG_ERR, "libav", "Failed to add %s stream",
- streaming_component_type2txt(ssc->ssc_type));
+ tvherror(LS_LIBAV, "Failed to add %s stream",
+ streaming_component_type2txt(ssc->ssc_type));
ssc->ssc_muxer_disabled = 1;
continue;
}
}
if(!lm->lm_oc->nb_streams) {
- tvhlog(LOG_ERR, "libav", "No supported streams available");
+ tvherror(LS_LIBAV, "No supported streams available");
lm->m_errors++;
return -1;
} else if(avformat_write_header(lm->lm_oc, &opts) < 0) {
- tvhlog(LOG_ERR, "libav", "Failed to write %s header",
- muxer_container_type2txt(lm->m_config.m_type));
+ tvherror(LS_LIBAV, "Failed to write %s header",
+ muxer_container_type2txt(lm->m_config.m_type));
lm->m_errors++;
return -1;
}
if((r = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {
av_strerror(r, buf, sizeof(buf));
- tvhlog(LOG_ERR, "libav", "%s: Could not open -- %s", filename, buf);
+ tvherror(LS_LIBAV, "%s: Could not open -- %s", filename, buf);
lm->m_errors++;
return -1;
}
/* bypass umask settings */
if (chmod(filename, lm->m_config.m_file_permissions))
- tvhlog(LOG_ERR, "libav", "%s: Unable to change permissions -- %s",
- filename, strerror(errno));
+ tvherror(LS_LIBAV, "%s: Unable to change permissions -- %s",
+ filename, strerror(errno));
return 0;
}
oc = lm->lm_oc;
if(!oc->nb_streams) {
- tvhlog(LOG_ERR, "libav", "No streams to mux");
+ tvherror(LS_LIBAV, "No streams to mux");
rc = -1;
goto ret;
}
if(!lm->lm_init) {
- tvhlog(LOG_ERR, "libav", "Muxer not initialized correctly");
+ tvherror(LS_LIBAV, "Muxer not initialized correctly");
rc = -1;
goto ret;
}
pktbuf_ptr(pkt->pkt_payload),
pktbuf_len(pkt->pkt_payload),
pkt->pkt_frametype < PKT_P_FRAME) < 0) {
- tvhlog(LOG_WARNING, "libav", "Failed to filter bitstream");
+ tvhwarn(LS_LIBAV, "Failed to filter bitstream");
if (packet.data != pktbuf_ptr(pkt->pkt_payload))
av_free(packet.data);
break;
packet.flags |= AV_PKT_FLAG_KEY;
if((rc = av_interleaved_write_frame(oc, &packet)))
- tvhlog(LOG_WARNING, "libav", "Failed to write frame");
+ tvhwarn(LS_LIBAV, "Failed to write frame");
if(tofree && tofree != pktbuf_ptr(pkt->pkt_payload))
av_free(tofree);
lav_muxer_t *lm = (lav_muxer_t*)m;
if(lm->lm_init && av_write_trailer(lm->lm_oc) < 0) {
- tvhlog(LOG_WARNING, "libav", "Failed to write %s trailer",
- muxer_container_type2txt(lm->m_config.m_type));
+ tvhwarn(LS_LIBAV, "Failed to write %s trailer",
+ muxer_container_type2txt(lm->m_config.m_type));
lm->m_errors++;
ret = -1;
}
fmt = av_guess_format(mux_name, NULL, NULL);
if(!fmt) {
- tvhlog(LOG_ERR, "libav", "Can't find the '%s' muxer", mux_name);
+ tvherror(LS_LIBAV, "Can't find the '%s' muxer", mux_name);
return NULL;
}
tr->nextpts = PTS_UNSET;
if (mk->webm && ssc->ssc_type != SCT_VP8 && ssc->ssc_type != SCT_VORBIS)
- tvhwarn("mkv", "WEBM format supports only VP8+VORBIS streams (detected %s)",
+ tvhwarn(LS_MKV, "WEBM format supports only VP8+VORBIS streams (detected %s)",
streaming_component_type2txt(ssc->ssc_type));
switch(ssc->ssc_type) {
mk_write_queue(mk_muxer_t *mk, htsbuf_queue_t *q)
{
if(!mk->error && mk_write_to_fd(mk, q) && !MC_IS_EOS_ERROR(mk->error))
- tvhlog(LOG_ERR, "mkv", "%s: Write failed -- %s", mk->filename,
- strerror(errno));
+ tvherror(LS_MKV, "%s: Write failed -- %s", mk->filename, strerror(errno));
htsbuf_queue_flush(q);
}
mk_write_master(mk, 0x1549a966, mk_build_segment_info(mk));
else {
mk->error = errno;
- tvhlog(LOG_ERR, "mkv", "%s: Unable to write duration, seek failed -- %s",
- mk->filename, strerror(errno));
+ tvherror(LS_MKV, "%s: Unable to write duration, seek failed -- %s",
+ mk->filename, strerror(errno));
}
// Rewrite segment header to update total size
mk_write_segment_header(mk, totsize - mk->segment_header_pos - 12);
} else {
mk->error = errno;
- tvhlog(LOG_ERR, "mkv", "%s: Unable to write total size, seek failed -- %s",
- mk->filename, strerror(errno));
+ tvherror(LS_MKV, "%s: Unable to write total size, seek failed -- %s",
+ mk->filename, strerror(errno));
}
if(close(mk->fd)) {
mk->error = errno;
- tvhlog(LOG_ERR, "mkv", "%s: Unable to close the file descriptor, close failed -- %s",
- mk->filename, strerror(errno));
+ tvherror(LS_MKV, "%s: Unable to close the file descriptor, close failed -- %s",
+ mk->filename, strerror(errno));
}
}
mk_muxer_t *mk = (mk_muxer_t*)m;
int fd, permissions = mk->m_config.m_file_permissions;
- tvhtrace("mkv", "Creating file \"%s\" with file permissions \"%o\"",
+ tvhtrace(LS_MKV, "Creating file \"%s\" with file permissions \"%o\"",
filename, permissions);
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, permissions);
if(fd < 0) {
mk->error = errno;
- tvhlog(LOG_ERR, "mkv", "%s: Unable to create file, open failed -- %s",
- mk->filename, strerror(errno));
+ tvherror(LS_MKV, "%s: Unable to create file, open failed -- %s",
+ mk->filename, strerror(errno));
mk->m_errors++;
return -1;
}
/* bypass umask settings */
if (fchmod(fd, permissions))
- tvhlog(LOG_ERR, "mkv", "%s: Unable to change permissions -- %s",
- filename, strerror(errno));
+ tvherror(LS_MKV, "%s: Unable to change permissions -- %s",
+ filename, strerror(errno));
mk->filename = strdup(filename);
mk->fd = fd;
return;
if (sizeof(out) < ol + l + 5 + 4 /* crc */) {
- tvherror("pass", "PMT entry too long (%i)", l);
+ tvherror(LS_PASS, "PMT entry too long (%i)", l);
return;
}
continue;
}
if (sizeof(out) < ol + l + 5 + 4 /* crc */) {
- tvherror("pass", "SDT entry too long (%i)", l);
+ tvherror(LS_PASS, "SDT entry too long (%i)", l);
return;
}
memcpy(out + ol, buf, l + 5);
if (!SCT_ISVIDEO(ssc->ssc_type) && !SCT_ISAUDIO(ssc->ssc_type))
continue;
if (ssc->ssc_pid == DVB_SDT_PID && pm->pm_rewrite_sdt) {
- tvhwarn("pass", "SDT PID shared with A/V, rewrite disabled");
+ tvhwarn(LS_PASS, "SDT PID shared with A/V, rewrite disabled");
pm->pm_rewrite_sdt = 0;
}
if (ssc->ssc_pid == DVB_EIT_PID && pm->pm_rewrite_eit) {
- tvhwarn("pass", "EIT PID shared with A/V, rewrite disabled");
+ tvhwarn(LS_PASS, "EIT PID shared with A/V, rewrite disabled");
pm->pm_rewrite_eit = 0;
}
}
pm->pm_ss = streaming_start_copy(ss);
dvb_table_parse_done(&pm->pm_pmt);
- dvb_table_parse_init(&pm->pm_pmt, "pass-pmt", pm->pm_pmt_pid, pm);
+ dvb_table_parse_init(&pm->pm_pmt, "pass-pmt", LS_TBL_PASS, pm->pm_pmt_pid, pm);
}
return 0;
int fd;
pass_muxer_t *pm = (pass_muxer_t*)m;
- tvhtrace("pass", "Creating file \"%s\" with file permissions \"%o\"", filename, pm->m_config.m_file_permissions);
+ tvhtrace(LS_PASS, "Creating file \"%s\" with file permissions \"%o\"", filename, pm->m_config.m_file_permissions);
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, pm->m_config.m_file_permissions);
if(fd < 0) {
pm->pm_error = errno;
- tvhlog(LOG_ERR, "pass", "%s: Unable to create file, open failed -- %s",
- filename, strerror(errno));
+ tvherror(LS_PASS, "%s: Unable to create file, open failed -- %s",
+ filename, strerror(errno));
pm->m_errors++;
return -1;
}
/* bypass umask settings */
if (fchmod(fd, pm->m_config.m_file_permissions))
- tvhlog(LOG_ERR, "pass", "%s: Unable to change permissions -- %s",
- filename, strerror(errno));
+ tvherror(LS_PASS, "%s: Unable to change permissions -- %s",
+ filename, strerror(errno));
pm->pm_off = 0;
pm->pm_seekable = 1;
} else if(tvh_write(pm->pm_fd, data, size)) {
pm->pm_error = errno;
if (!MC_IS_EOS_ERROR(errno))
- tvhlog(LOG_ERR, "pass", "%s: Write failed -- %s", pm->pm_filename,
- strerror(errno));
+ tvherror(LS_PASS, "%s: Write failed -- %s", pm->pm_filename,
+ strerror(errno));
else
/* this is an end-of-streaming notification */
m->m_eos = 1;
if(pm->pm_seekable && close(pm->pm_fd)) {
pm->pm_error = errno;
- tvhlog(LOG_ERR, "pass", "%s: Unable to close file, close failed -- %s",
- pm->pm_filename, strerror(errno));
+ tvherror(LS_PASS, "%s: Unable to close file, close failed -- %s",
+ pm->pm_filename, strerror(errno));
pm->m_errors++;
return -1;
}
pm->m_destroy = pass_muxer_destroy;
pm->pm_fd = -1;
- dvb_table_parse_init(&pm->pm_pat, "pass-pat", DVB_PAT_PID, pm);
- dvb_table_parse_init(&pm->pm_pmt, "pass-pmt", 100, pm);
- dvb_table_parse_init(&pm->pm_sdt, "pass-sdt", DVB_SDT_PID, pm);
- dvb_table_parse_init(&pm->pm_eit, "pass-eit", DVB_EIT_PID, pm);
+ dvb_table_parse_init(&pm->pm_pat, "pass-pat", LS_TBL_PASS, DVB_PAT_PID, pm);
+ dvb_table_parse_init(&pm->pm_pmt, "pass-pmt", LS_TBL_PASS, 100, pm);
+ dvb_table_parse_init(&pm->pm_sdt, "pass-sdt", LS_TBL_PASS, DVB_SDT_PID, pm);
+ dvb_table_parse_init(&pm->pm_eit, "pass-eit", LS_TBL_PASS, DVB_EIT_PID, pm);
return (muxer_t *)pm;
}
*
*/
void
-pkt_trace_(const char *file, int line, const char *subsys, th_pkt_t *pkt,
+pkt_trace_(const char *file, int line, int subsys, th_pkt_t *pkt,
int index, streaming_component_type_t type, const char *fmt, ...)
{
char buf[512], _dts[22], _pts[22], _type[2];
th_pktref_t *pktref_create(th_pkt_t *pkt);
void pkt_trace_
- (const char *file, int line, const char *subsys, th_pkt_t *pkt,
+ (const char *file, int line, int subsys, th_pkt_t *pkt,
int index, streaming_component_type_t type, const char *fmt, ...);
#define pkt_trace(subsys, pkt, index, type, fmt, ...) \
if (sps->time_scale)
d = 180000 * (uint64_t)sps->units_in_tick / (uint64_t)sps->time_scale;
if (d == 0 && st->es_frame_duration < 2 && p->start + sec2mono(4) < mclk()) {
- tvhwarn("parser", "H264 stream has not timing information, using 30fps");
+ tvhwarn(LS_PARSER, "H264 stream has not timing information, using 30fps");
d = 3000; /* 90000/30 = 3000 : 30fps */
}
hvcc->avgFrameRate = 0;
hvcc->constantFrameRate = 0;
- tvhtrace("hevc", "configurationVersion: %"PRIu8,
+ tvhtrace(LS_HEVC, "configurationVersion: %"PRIu8,
hvcc->configurationVersion);
- tvhtrace("hevc", "general_profile_space: %"PRIu8,
+ tvhtrace(LS_HEVC, "general_profile_space: %"PRIu8,
hvcc->general_profile_space);
- tvhtrace("hevc", "general_tier_flag: %"PRIu8,
+ tvhtrace(LS_HEVC, "general_tier_flag: %"PRIu8,
hvcc->general_tier_flag);
- tvhtrace("hevc", "general_profile_idc: %"PRIu8,
+ tvhtrace(LS_HEVC, "general_profile_idc: %"PRIu8,
hvcc->general_profile_idc);
- tvhtrace("hevc", "general_profile_compatibility_flags: 0x%08"PRIx32,
+ tvhtrace(LS_HEVC, "general_profile_compatibility_flags: 0x%08"PRIx32,
hvcc->general_profile_compatibility_flags);
- tvhtrace("hevc", "general_constraint_indicator_flags: 0x%012"PRIx64,
+ tvhtrace(LS_HEVC, "general_constraint_indicator_flags: 0x%012"PRIx64,
hvcc->general_constraint_indicator_flags);
- tvhtrace("hevc", "general_level_idc: %"PRIu8,
+ tvhtrace(LS_HEVC, "general_level_idc: %"PRIu8,
hvcc->general_level_idc);
- tvhtrace("hevc", "min_spatial_segmentation_idc: %"PRIu16,
+ tvhtrace(LS_HEVC, "min_spatial_segmentation_idc: %"PRIu16,
hvcc->min_spatial_segmentation_idc);
- tvhtrace("hevc", "parallelismType: %"PRIu8,
+ tvhtrace(LS_HEVC, "parallelismType: %"PRIu8,
hvcc->parallelismType);
- tvhtrace("hevc", "chromaFormat: %"PRIu8,
+ tvhtrace(LS_HEVC, "chromaFormat: %"PRIu8,
hvcc->chromaFormat);
- tvhtrace("hevc", "bitDepthLumaMinus8: %"PRIu8,
+ tvhtrace(LS_HEVC, "bitDepthLumaMinus8: %"PRIu8,
hvcc->bitDepthLumaMinus8);
- tvhtrace("hevc", "bitDepthChromaMinus8: %"PRIu8,
+ tvhtrace(LS_HEVC, "bitDepthChromaMinus8: %"PRIu8,
hvcc->bitDepthChromaMinus8);
- tvhtrace("hevc", "avgFrameRate: %"PRIu16,
+ tvhtrace(LS_HEVC, "avgFrameRate: %"PRIu16,
hvcc->avgFrameRate);
- tvhtrace("hevc", "constantFrameRate: %"PRIu8,
+ tvhtrace(LS_HEVC, "constantFrameRate: %"PRIu8,
hvcc->constantFrameRate);
- tvhtrace("hevc", "numTemporalLayers: %"PRIu8,
+ tvhtrace(LS_HEVC, "numTemporalLayers: %"PRIu8,
hvcc->numTemporalLayers);
- tvhtrace("hevc", "temporalIdNested: %"PRIu8,
+ tvhtrace(LS_HEVC, "temporalIdNested: %"PRIu8,
hvcc->temporalIdNested);
- tvhtrace("hevc", "lengthSizeMinusOne: %"PRIu8,
+ tvhtrace(LS_HEVC, "lengthSizeMinusOne: %"PRIu8,
hvcc->lengthSizeMinusOne);
- tvhtrace("hevc", "numOfArrays: %"PRIu8,
+ tvhtrace(LS_HEVC, "numOfArrays: %"PRIu8,
hvcc->numOfArrays);
for (i = 0; i < hvcc->numOfArrays; i++) {
- tvhtrace("hevc", "NAL_unit_type[%"PRIu8"]: %"PRIu8,
+ tvhtrace(LS_HEVC, "NAL_unit_type[%"PRIu8"]: %"PRIu8,
i, hvcc->array[i].NAL_unit_type);
- tvhtrace("hevc", "numNalus[%"PRIu8"]: %"PRIu16,
+ tvhtrace(LS_HEVC, "numNalus[%"PRIu8"]: %"PRIu16,
i, hvcc->array[i].numNalus);
for (j = 0; j < hvcc->array[i].numNalus; j++)
- tvhtrace("hevc",
+ tvhtrace(LS_HEVC,
"nalUnitLength[%"PRIu8"][%"PRIu16"]: %"PRIu16,
i, j, hvcc->array[i].nalUnitLength[j]);
}
/* Wrong bytestream */
} else {
- tvhtrace("parser", "AAC skip byte %02x", d[0]);
+ tvhtrace(LS_PARSER, "AAC skip byte %02x", d[0]);
p++;
}
}
st->es_parser_state = 1;
if (data[0] != 0 && data[1] != 0 && data[2] != 1)
if (tvhlog_limit(&st->es_pes_log, 10))
- tvhwarn("TS", "%s: Invalid start code %02x:%02x:%02x",
+ tvhwarn(LS_TS, "%s: Invalid start code %02x:%02x:%02x",
service_component_nicename(st),
data[0], data[1], data[2]);
st->es_incomplete = 0;
st->es_curdts = PTS_UNSET;
st->es_curpts = PTS_UNSET;
if (tvhlog_limit(&st->es_pes_log, 10))
- tvhwarn("TS", "%s Corrupted PES header (errors %zi)",
+ tvhwarn(LS_TS, "%s Corrupted PES header (errors %zi)",
service_component_nicename(st), st->es_pes_log.count);
return -1;
}
pkt->pkt_pts < t->s_current_pts - 180000))
t->s_current_pts = pkt->pkt_pts;
- pkt_trace("parser", pkt, st->es_index, st->es_type, "deliver");
+ pkt_trace(LS_PARSER, pkt, st->es_index, st->es_type, "deliver");
pkt->pkt_aspect_num = st->es_aspect_num;
pkt->pkt_aspect_den = st->es_aspect_den;
int64_t pts = pkt->pkt_pts;
pkt->pkt_dts = pts_no_backlog(dts);
pkt->pkt_pts = pts_no_backlog(pts);
- pkt_trace("parser", pkt, st->es_index, st->es_type, "backlog");
+ pkt_trace(LS_PARSER, pkt, st->es_index, st->es_type, "backlog");
pkt->pkt_dts = dts;
pkt->pkt_pts = pts;
}
th_pkt_t *pkt, *npkt;
size_t metalen;
- tvhtrace("parser",
+ tvhtrace(LS_PARSER,
"pkt bcklog %2d %-12s - backlog flush start - (meta %ld)",
st->es_index,
streaming_component_type2txt(st->es_type),
sm->sm_data = NULL;
streaming_msg_free(sm);
}
- tvhtrace("parser",
+ tvhtrace(LS_PARSER,
"pkt bcklog %2d %-12s - backlog flush end -",
st->es_index,
streaming_component_type2txt(st->es_type));
*/
if(threshold || (qd[i] <= 0 && qd_max > (MAX_SCAN_TIME * 90) / 2)) {
ssc->ssc_disabled = 1;
- tvhdebug("parser", "gh disable stream %d %s%s%s (PID %i) threshold %d qd %"PRId64" qd_max %"PRId64,
+ tvhdebug(LS_TSFIX, "gh disable stream %d %s%s%s (PID %i) threshold %d qd %"PRId64" qd_max %"PRId64,
ssc->ssc_index, streaming_component_type2txt(ssc->ssc_type),
ssc->ssc_lang[0] ? " " : "", ssc->ssc_lang, ssc->ssc_pid,
threshold, qd[i], qd_max);
if (tvhtrace_enabled()) {
for(i = 0; i < ss->ss_num_components; i++) {
ssc = &ss->ss_components[i];
- tvhtrace("parser", "stream %d %s%s%s (PID %i) complete time %"PRId64"%s",
+ tvhtrace(LS_TSFIX, "stream %d %s%s%s (PID %i) complete time %"PRId64"%s",
ssc->ssc_index, streaming_component_type2txt(ssc->ssc_type),
ssc->ssc_lang[0] ? " " : "", ssc->ssc_lang, ssc->ssc_pid,
gh_queue_delay(gh, ssc->ssc_index),
ssc = streaming_start_component_find_by_index(gh->gh_ss,
pkt->pkt_componentindex);
if (ssc == NULL) {
- tvherror("globalheaders", "Unable to find component %d", pkt->pkt_componentindex);
+ tvherror(LS_GLOBALHEADERS, "Unable to find component %d", pkt->pkt_componentindex);
streaming_msg_free(sm);
return;
}
{
int opt_error;
if ((opt_error = av_opt_set_int(ctx, opt, val, 0)) != 0) {
- tvherror("transcode", "%04X: Could not set option %s (error '%s')",
+ tvherror(LS_TRANSCODE, "%04X: Could not set option %s (error '%s')",
shortid(t), opt, get_error_text(opt_error));
if (abort)
transcoder_stream_invalidate(ts);
codec_id = streaming_component_type2codec_id(ty);
if (codec_id == AV_CODEC_ID_NONE) {
- tvherror("transcode", "%04X: Unsupported input codec %s",
+ tvherror(LS_TRANSCODE, "%04X: Unsupported input codec %s",
shortid(t), streaming_component_type2txt(ty));
return NULL;
}
codec = avcodec_find_decoder(codec_id);
if (!codec) {
- tvherror("transcode", "%04X: Unable to find %s decoder",
+ tvherror(LS_TRANSCODE, "%04X: Unable to find %s decoder",
shortid(t), streaming_component_type2txt(ty));
return NULL;
}
- tvhtrace("transcode", "%04X: Using decoder %s", shortid(t), codec->name);
+ tvhtrace(LS_TRANSCODE, "%04X: Using decoder %s", shortid(t), codec->name);
return codec;
}
codec = avcodec_find_encoder_by_name(codec_name);
if (!codec) {
- tvherror("transcode", "%04X: Unable to find %s encoder",
+ tvherror(LS_TRANSCODE, "%04X: Unable to find %s encoder",
shortid(t), codec_name);
return NULL;
}
- tvhtrace("transcode", "%04X: Using encoder %s", shortid(t), codec->name);
+ tvhtrace(LS_TRANSCODE, "%04X: Using encoder %s", shortid(t), codec->name);
return codec;
}
{
streaming_message_t *sm;
- tvhtrace("transcode", "%04X: deliver copy (pts = %" PRIu64 ")",
+ tvhtrace(LS_TRANSCODE, "%04X: deliver copy (pts = %" PRIu64 ")",
shortid(t), pkt->pkt_pts);
sm = streaming_msg_create_pkt(pkt);
streaming_target_deliver2(ts->ts_target, sm);
if (!avcodec_is_open(ictx)) {
if (avcodec_open2(ictx, icodec, NULL) < 0) {
- tvherror("transcode", "%04X: Unable to open %s decoder",
+ tvherror(LS_TRANSCODE, "%04X: Unable to open %s decoder",
shortid(t), icodec->name);
transcoder_stream_invalidate(ts);
return;
length = avcodec_decode_subtitle2(ictx, &sub, &got_subtitle, &packet);
if (length <= 0) {
if (length == AVERROR_INVALIDDATA) goto cleanup;
- tvherror("transcode", "%04X: Unable to decode subtitle (%d, %s)",
+ tvherror(LS_TRANSCODE, "%04X: Unable to decode subtitle (%d, %s)",
shortid(t), length, get_error_text(length));
goto cleanup;
}
memcpy(ictx->extradata,
pktbuf_ptr(ts->ts_input_gh), pktbuf_len(ts->ts_input_gh));
} else {
- tvherror("transcode", "%04X: missing meta data for %s",
+ tvherror(LS_TRANSCODE, "%04X: missing meta data for %s",
shortid(t), icodec->id == AV_CODEC_ID_AAC ? "AAC" : "VORBIS");
}
}
if (avcodec_open2(ictx, icodec, NULL) < 0) {
- tvherror("transcode", "%04X: Unable to open %s decoder",
+ tvherror(LS_TRANSCODE, "%04X: Unable to open %s decoder",
shortid(t), icodec->name);
transcoder_stream_invalidate(ts);
goto cleanup;
}
if (pkt->pkt_pts > as->aud_dec_pts) {
- tvhwarn("transcode", "%04X: Detected framedrop in audio", shortid(t));
+ tvhwarn(LS_TRANSCODE, "%04X: Detected framedrop in audio", shortid(t));
as->aud_enc_pts += (pkt->pkt_pts - as->aud_dec_pts);
as->aud_dec_pts += (pkt->pkt_pts - as->aud_dec_pts);
}
length = avcodec_decode_audio4(ictx, frame, &got_frame, &packet);
av_free_packet(&packet);
- tvhtrace("transcode", "%04X: audio decode: consumed=%d size=%zu, got=%d, pts=%" PRIi64,
+ tvhtrace(LS_TRANSCODE, "%04X: audio decode: consumed=%d size=%zu, got=%d, pts=%" PRIi64,
shortid(t), length, pktbuf_len(pkt->pkt_payload), got_frame, pkt->pkt_pts);
if (length < 0) {
if (length == AVERROR_INVALIDDATA) goto cleanup;
- tvherror("transcode", "%04X: Unable to decode audio (%d, %s)",
+ tvherror(LS_TRANSCODE, "%04X: Unable to decode audio (%d, %s)",
shortid(t), length, get_error_text(length));
transcoder_stream_invalidate(ts);
goto cleanup;
}
if (!got_frame) {
- tvhtrace("transcode", "%04X: Did not have a full frame in the packet", shortid(t));
+ tvhtrace(LS_TRANSCODE, "%04X: Did not have a full frame in the packet", shortid(t));
goto cleanup;
}
if (length != pktbuf_len(pkt->pkt_payload))
- tvhwarn("transcode",
+ tvhwarn(LS_TRANSCODE,
"%04X: undecoded data (in=%zu, consumed=%d)",
shortid(t), pktbuf_len(pkt->pkt_payload), length);
octx->flags |= CODEC_FLAG_GLOBAL_HEADER;
if (!octx->sample_rate) {
- tvherror("transcode", "%04X: audio encoder has no suitable sample rate!", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: audio encoder has no suitable sample rate!", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
} else {
- tvhdebug("transcode", "%04X: using audio sample rate %d",
+ tvhdebug(LS_TRANSCODE, "%04X: using audio sample rate %d",
shortid(t), octx->sample_rate);
}
if (octx->sample_fmt == AV_SAMPLE_FMT_NONE) {
- tvherror("transcode", "%04X: audio encoder has no suitable sample format!", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: audio encoder has no suitable sample format!", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
} else {
- tvhdebug("transcode", "%04X: using audio sample format %s",
+ tvhdebug(LS_TRANSCODE, "%04X: using audio sample format %s",
shortid(t), av_get_sample_fmt_name(octx->sample_fmt));
}
if (!octx->channel_layout) {
- tvherror("transcode", "%04X: audio encoder has no suitable channel layout!", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: audio encoder has no suitable channel layout!", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
} else {
av_get_channel_layout_string(layout_buf, sizeof (layout_buf), octx->channels, octx->channel_layout);
- tvhdebug("transcode", "%04X: using audio channel layout %s",
+ tvhdebug(LS_TRANSCODE, "%04X: using audio channel layout %s",
shortid(t), layout_buf);
}
}
if (avcodec_open2(octx, ocodec, NULL) < 0) {
- tvherror("transcode", "%04X: Unable to open %s encoder",
+ tvherror(LS_TRANSCODE, "%04X: Unable to open %s encoder",
shortid(t), ocodec->name);
transcoder_stream_invalidate(ts);
goto cleanup;
as->fifo = av_audio_fifo_alloc(octx->sample_fmt, octx->channels, 1);
if (!as->fifo) {
- tvherror("transcode", "%04X: Could not allocate fifo", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Could not allocate fifo", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
if (as->last_sample_rate != ictx->sample_rate ||
as->last_sample_fmt != ictx->sample_fmt ||
as->last_channel_layout != ictx->channel_layout) {
- tvhdebug("transcode", "%04X: audio input format changed", shortid(t));
+ tvhdebug(LS_TRANSCODE, "%04X: audio input format changed", shortid(t));
as->last_sample_rate = ictx->sample_rate;
as->last_sample_fmt = ictx->sample_fmt;
as->last_channel_layout = ictx->channel_layout;
if (as->resample_context) {
- tvhdebug("transcode", "%04X: stopping audio resampling", shortid(t));
+ tvhdebug(LS_TRANSCODE, "%04X: stopping audio resampling", shortid(t));
avresample_free(&as->resample_context);
as->resample_context = NULL;
as->resample_is_open = 0;
if (as->resample) {
if (!as->resample_context) {
if (!(as->resample_context = avresample_alloc_context())) {
- tvherror("transcode", "%04X: Could not allocate resample context", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Could not allocate resample context", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
// resample audio
- tvhdebug("transcode", "%04X: starting audio resampling", shortid(t));
+ tvhdebug(LS_TRANSCODE, "%04X: starting audio resampling", shortid(t));
av_get_channel_layout_string(layout_buf, sizeof (layout_buf), ictx->channels, ictx->channel_layout);
- tvhdebug("transcode", "%04X: IN : channel_layout=%s, rate=%d, fmt=%s, bitrate=%"PRId64,
+ tvhdebug(LS_TRANSCODE, "%04X: IN : channel_layout=%s, rate=%d, fmt=%s, bitrate=%"PRId64,
shortid(t), layout_buf, ictx->sample_rate,
av_get_sample_fmt_name(ictx->sample_fmt), (int64_t)ictx->bit_rate);
av_get_channel_layout_string(layout_buf, sizeof (layout_buf), octx->channels, octx->channel_layout);
- tvhdebug("transcode", "%04X: OUT: channel_layout=%s, rate=%d, fmt=%s, bitrate=%"PRId64,
+ tvhdebug(LS_TRANSCODE, "%04X: OUT: channel_layout=%s, rate=%d, fmt=%s, bitrate=%"PRId64,
shortid(t), layout_buf, octx->sample_rate,
av_get_sample_fmt_name(octx->sample_fmt), (int64_t)octx->bit_rate);
"out_sample_fmt", octx->sample_fmt, 1))
goto cleanup;
if (avresample_open(as->resample_context) < 0) {
- tvherror("transcode", "%04X: Error avresample_open", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Error avresample_open", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
uint8_t **output = alloca(octx->channels * sizeof(uint8_t *));
if (av_samples_alloc(output, NULL, octx->channels, frame->nb_samples, octx->sample_fmt, 1) < 0) {
- tvherror("transcode", "%04X: av_resamples_alloc failed", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: av_resamples_alloc failed", shortid(t));
transcoder_stream_invalidate(ts);
goto scleanup;
}
length = avresample_convert(as->resample_context, NULL, 0, frame->nb_samples,
frame->extended_data, 0, frame->nb_samples);
- tvhtrace("transcode", "%04X: avresample_convert: %d", shortid(t), length);
+ tvhtrace(LS_TRANSCODE, "%04X: avresample_convert: %d", shortid(t), length);
while (avresample_available(as->resample_context) > 0) {
length = avresample_read(as->resample_context, output, frame->nb_samples);
if (length > 0) {
if (av_audio_fifo_realloc(as->fifo, av_audio_fifo_size(as->fifo) + length) < 0) {
- tvhlog(LOG_ERR, "transcode", "%04X: Could not reallocate FIFO", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Could not reallocate FIFO", shortid(t));
transcoder_stream_invalidate(ts);
goto scleanup;
}
if (av_audio_fifo_write(as->fifo, (void **)output, length) < length) {
- tvhlog(LOG_ERR, "transcode", "%04X: Could not write to FIFO", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Could not write to FIFO", shortid(t));
goto scleanup;
}
}
/* Need to find out where we are going to do this. Normally at the end.
int delay_samples = avresample_get_delay(as->resample_context);
if (delay_samples) {
- tvhlog(LOG_DEBUG, "transcode", "%d samples in resamples delay buffer.", delay_samples);
+ tvhdebug(LS_TRANSCODE, "%d samples in resamples delay buffer.", delay_samples);
goto cleanup;
}
*/
} else {
if (av_audio_fifo_realloc(as->fifo, av_audio_fifo_size(as->fifo) + frame->nb_samples) < 0) {
- tvherror("transcode", "%04X: Could not reallocate FIFO", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Could not reallocate FIFO", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
if (av_audio_fifo_write(as->fifo, (void **)frame->extended_data, frame->nb_samples) < frame->nb_samples) {
- tvherror("transcode", "%04X: Could not write to FIFO", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Could not write to FIFO", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
as->aud_dec_pts += pkt->pkt_duration;
while (av_audio_fifo_size(as->fifo) >= octx->frame_size) {
- tvhtrace("transcode", "%04X: audio loop: fifo=%d, frame=%d",
+ tvhtrace(LS_TRANSCODE, "%04X: audio loop: fifo=%d, frame=%d",
shortid(t), av_audio_fifo_size(as->fifo), octx->frame_size);
av_frame_free(&frame);
frame->channel_layout = octx->channel_layout;
frame->sample_rate = octx->sample_rate;
if (av_frame_get_buffer(frame, 0) < 0) {
- tvherror("transcode", "%04X: Could not allocate output frame samples", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Could not allocate output frame samples", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
if ((length = av_audio_fifo_read(as->fifo, (void **)frame->data, octx->frame_size)) != octx->frame_size) {
- tvherror("transcode", "%04X: Could not read data from FIFO", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Could not read data from FIFO", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
- tvhtrace("transcode", "%04X: pre-encode: linesize=%d, samples=%d, pts=%" PRIi64,
+ tvhtrace(LS_TRANSCODE, "%04X: pre-encode: linesize=%d, samples=%d, pts=%" PRIi64,
shortid(t), frame->linesize[0], length, as->aud_enc_pts);
frame->pts = as->aud_enc_pts;
packet.data = NULL;
packet.size = 0;
length = avcodec_encode_audio2(octx, &packet, frame, &got_packet_ptr);
- tvhtrace("transcode", "%04X: encoded: packet=%d, ret=%d, got=%d, pts=%" PRIi64,
+ tvhtrace(LS_TRANSCODE, "%04X: encoded: packet=%d, ret=%d, got=%d, pts=%" PRIi64,
shortid(t), packet.size, length, got_packet_ptr, packet.pts);
if ((length < 0) || (got_packet_ptr < -1)) {
- tvherror("transcode", "%04X: Unable to encode audio (%d:%d)",
+ tvherror(LS_TRANSCODE, "%04X: Unable to encode audio (%d:%d)",
shortid(t), length, got_packet_ptr);
transcoder_stream_invalidate(ts);
goto cleanup;
if (octx->extradata_size)
n->pkt_meta = pktbuf_alloc(octx->extradata, octx->extradata_size);
- tvhtrace("transcode", "%04X: deliver audio (pts = %" PRIi64 ", delay = %i)",
+ tvhtrace(LS_TRANSCODE, "%04X: deliver audio (pts = %" PRIi64 ", delay = %i)",
shortid(t), n->pkt_pts, octx->delay);
sm = streaming_msg_create_pkt(n);
streaming_target_deliver2(ts->ts_target, sm);
if (epkt->size <= 0) {
if (epkt->size) {
- tvherror("transcode", "%04X: Unable to encode video (%d)", shortid(t), epkt->size);
+ tvherror(LS_TRANSCODE, "%04X: Unable to encode video (%d)", shortid(t), epkt->size);
transcoder_stream_invalidate(ts);
}
extract_mpeg2_global_data(n, epkt->data, epkt->size);
}
- tvhtrace("transcode", "%04X: deliver video (dts = %" PRIu64 ", pts = %" PRIu64 ")", shortid(t), n->pkt_dts, n->pkt_pts);
+ tvhtrace(LS_TRANSCODE, "%04X: deliver video (dts = %" PRIu64 ", pts = %" PRIu64 ")", shortid(t), n->pkt_dts, n->pkt_pts);
if (!vs->vid_first_encoded) {
vs->vid_first_pkt = n;
sm = streaming_msg_create_pkt(vs->vid_first_pkt);
streaming_target_deliver2(ts->ts_target, sm);
} else {
- tvhtrace("transcode", "%04X: video skip first packet", shortid(t));
+ tvhtrace(LS_TRANSCODE, "%04X: video skip first packet", shortid(t));
}
pkt_ref_dec(vs->vid_first_pkt);
vs->vid_first_pkt = NULL;
flt_bufsrc = avfilter_get_by_name("buffer");
flt_bufsink = avfilter_get_by_name("buffersink");
if (!flt_bufsrc || !flt_bufsink) {
- tvherror("transcode", "%04X: libav default buffers unknown", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: libav default buffers unknown", shortid(t));
goto out_err;
}
err = avfilter_graph_create_filter(&vs->flt_bufsrcctx, flt_bufsrc, "in",
opt, NULL, vs->flt_graph);
if (err < 0) {
- tvherror("transcode", "%04X: fltchain IN init error", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: fltchain IN init error", shortid(t));
goto out_err;
}
err = avfilter_graph_create_filter(&vs->flt_bufsinkctx, flt_bufsink,
"out", NULL, NULL, vs->flt_graph);
if (err < 0) {
- tvherror("transcode", "%04X: fltchain OUT init error", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: fltchain OUT init error", shortid(t));
goto out_err;
}
err = av_opt_set_int_list(vs->flt_bufsinkctx, "pix_fmts", pix_fmts,
AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
if (err < 0) {
- tvherror("transcode", "%08X: fltchain cannot set output pixfmt",
+ tvherror(LS_TRANSCODE, "%08X: fltchain cannot set output pixfmt",
shortid(t));
goto out_err;
}
&flt_outputs,
NULL);
if (err < 0) {
- tvherror("transcode", "%04X: failed to init filter chain", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: failed to init filter chain", shortid(t));
goto out_err;
}
err = avfilter_graph_config(vs->flt_graph, NULL);
if (err < 0) {
- tvherror("transcode", "%04X: failed to config filter chain", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: failed to config filter chain", shortid(t));
goto out_err;
}
memcpy(ictx->extradata,
pktbuf_ptr(ts->ts_input_gh), pktbuf_len(ts->ts_input_gh));
} else {
- tvherror("transcode", "%04X: missing meta data for H264", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: missing meta data for H264", shortid(t));
}
}
if (avcodec_open2(ictx, icodec, NULL) < 0) {
- tvherror("transcode", "%04X: Unable to open %s decoder", shortid(t), icodec->name);
+ tvherror(LS_TRANSCODE, "%04X: Unable to open %s decoder", shortid(t), icodec->name);
transcoder_stream_invalidate(ts);
goto cleanup;
}
length = avcodec_decode_video2(ictx, vs->vid_dec_frame, &got_picture, &packet);
if (length <= 0) {
if (length == AVERROR_INVALIDDATA) goto cleanup;
- tvherror("transcode", "%04X: Unable to decode video (%d, %s)",
+ tvherror(LS_TRANSCODE, "%04X: Unable to decode video (%d, %s)",
shortid(t), length, get_error_text(length));
goto cleanup;
}
// Default = "medium". We gain more encoding speed compared to the loss of quality when lowering it _slightly_.
// select preset according to system performance and codec type
av_dict_set(&opts, "preset", t->t_props.tp_vcodec_preset, 0);
- tvhinfo("transcode", "%04X: Using preset %s", shortid(t), t->t_props.tp_vcodec_preset);
+ tvhinfo(LS_TRANSCODE, "%04X: Using preset %s", shortid(t), t->t_props.tp_vcodec_preset);
// All modern devices should support "high" profile
av_dict_set(&opts, "profile", "high", 0);
// on all hardware ultrafast (or maybe superfast) should be safe
// select preset according to system performance
av_dict_set(&opts, "preset", t->t_props.tp_vcodec_preset, 0);
- tvhinfo("transcode", "%04X: Using preset %s", shortid(t), t->t_props.tp_vcodec_preset);
+ tvhinfo(LS_TRANSCODE, "%04X: Using preset %s", shortid(t), t->t_props.tp_vcodec_preset);
// disables encoder features which tend to be bottlenecks for the decoder/player
av_dict_set(&opts, "tune", "fastdecode", 0);
maxrate = ceil(bitrate * 1.25);
bufsize = maxrate * 3;
- tvhdebug("transcode", "tuning HEVC encoder for ABR rate control, "
+ tvhdebug(LS_TRANSCODE, "tuning HEVC encoder for ABR rate control, "
"bitrate: %dkbps, vbv-bufsize: %dkbits, vbv-maxrate: %dkbps",
bitrate, bufsize, maxrate);
}
if (avcodec_open2(octx, ocodec, &opts) < 0) {
- tvherror("transcode", "%04X: Unable to open %s encoder",
+ tvherror(LS_TRANSCODE, "%04X: Unable to open %s encoder",
shortid(t), ocodec->name);
transcoder_stream_invalidate(ts);
goto cleanup;
}
if (create_video_filter(vs, t, ictx, octx)) {
- tvherror("transcode", "%04X: Video filter creation failed",
+ tvherror(LS_TRANSCODE, "%04X: Video filter creation failed",
shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
/* push decoded frame into filter chain */
if (av_buffersrc_add_frame(vs->flt_bufsrcctx, vs->vid_dec_frame) < 0) {
- tvherror("transcode", "%04X: filter input error", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: filter input error", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
break;
if (ret < 0) {
- tvherror("transcode", "%04X: filter output error", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: filter output error", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
ret = avcodec_encode_video2(octx, &packet2, vs->vid_enc_frame, &got_output);
if (ret < 0) {
- tvherror("transcode", "%04X: Error encoding frame", shortid(t));
+ tvherror(LS_TRANSCODE, "%04X: Error encoding frame", shortid(t));
transcoder_stream_invalidate(ts);
goto cleanup;
}
pktbuf_ref_inc(ssc->ssc_gh);
}
- tvhinfo("transcode", "%04X: %d:%s ==> Passthrough",
+ tvhinfo(LS_TRANSCODE, "%04X: %d:%s ==> Passthrough",
shortid(t), ssc->ssc_index,
streaming_component_type2txt(ssc->ssc_type));
LIST_INSERT_HEAD(&t->t_stream_list, (transcoder_stream_t*)ss, ts_link);
- tvhinfo("transcode", "%04X: %d:%s ==> %s (%s)",
+ tvhinfo(LS_TRANSCODE, "%04X: %d:%s ==> %s (%s)",
shortid(t), ssc->ssc_index,
streaming_component_type2txt(ssc->ssc_type),
streaming_component_type2txt(ss->ts_type),
LIST_INSERT_HEAD(&t->t_stream_list, (transcoder_stream_t*)as, ts_link);
- tvhinfo("transcode", "%04X: %d:%s ==> %s (%s)",
+ tvhinfo(LS_TRANSCODE, "%04X: %d:%s ==> %s (%s)",
shortid(t), ssc->ssc_index,
streaming_component_type2txt(ssc->ssc_type),
streaming_component_type2txt(as->ts_type),
vs->vid_width = ssc->ssc_width;
}
- tvhinfo("transcode", "%04X: %d:%s %dx%d ==> %s %dx%d (%s)",
+ tvhinfo(LS_TRANSCODE, "%04X: %d:%s %dx%d ==> %s %dx%d (%s)",
shortid(t),
ssc->ssc_index,
streaming_component_type2txt(ssc->ssc_type),
}
}
- tvhtrace("transcode", "%04X: transcoder_calc_stream_count=%d (video=%d, audio=%d, subtitle=%d)",
+ tvhtrace(LS_TRANSCODE, "%04X: transcoder_calc_stream_count=%d (video=%d, audio=%d, subtitle=%d)",
shortid(t), (video + audio + subtitle), video, audio, subtitle);
if (i == src->ss_num_components)
{
- tvhinfo("transcode", "Could not find requestd lang [%s] in stream, using first one", tp->tp_language);
+ tvhinfo(LS_TRANSCODE, "Could not find requestd lang [%s] in stream, using first one", tp->tp_language);
requested_lang[0] = '\0';
}
}
rc = 0;
if(!rc)
- tvhinfo("transcode", "%04X: %d:%s ==> Filtered",
+ tvhinfo(LS_TRANSCODE, "%04X: %d:%s ==> Filtered",
shortid(t), ssc->ssc_index,
streaming_component_type2txt(ssc->ssc_type));
else
static void
tsfix_packet_drop(tfstream_t *tfs, th_pkt_t *pkt, const char *reason)
{
- pkt_trace("tsfix", pkt, tfs->tfs_index, tfs->tfs_type, "drop");
+ pkt_trace(LS_TSFIX, pkt, tfs->tfs_index, tfs->tfs_type, "drop");
pkt_ref_dec(pkt);
}
}
tfs->tfs_bad_dts++;
if (tfs->tfs_bad_dts < 5) {
- tvhlog(LOG_ERR, "parser",
- "transport stream %s, DTS discontinuity. "
- "DTS = %" PRId64 ", last = %" PRId64,
- streaming_component_type2txt(tfs->tfs_type),
- dts, tfs->tfs_last_dts_norm);
+ tvherror(LS_TSFIX,
+ "transport stream %s, DTS discontinuity. "
+ "DTS = %" PRId64 ", last = %" PRId64,
+ streaming_component_type2txt(tfs->tfs_type),
+ dts, tfs->tfs_last_dts_norm);
}
} else {
/* DTS wrapped, increase upper bits */
deliver:
if (tvhtrace_enabled()) {
char _odts[22], _opts[22];
- pkt_trace("tsfix", pkt, tfs->tfs_index, tfs->tfs_type,
+ pkt_trace(LS_TSFIX, pkt, tfs->tfs_index, tfs->tfs_type,
"deliver odts %s opts %s ref %"PRId64" epoch %"PRId64,
pts_to_string(odts, _odts), pts_to_string(opts, _opts),
ref, tfs->tfs_dts_epoch);
case PKT_B_FRAME:
/* B-frames have same PTS as DTS, pass them on */
pkt->pkt_pts = pkt->pkt_dts;
- tvhtrace("tsfix", "%-12s PTS b-frame set to %"PRId64,
+ tvhtrace(LS_TSFIX, "%-12s PTS b-frame set to %"PRId64,
streaming_component_type2txt(tfs->tfs_type),
pkt->pkt_dts);
break;
pts_is_greater_or_equal(pkt->pkt_dts, srch->pr_pkt->pkt_dts) > 0 &&
pts_diff(pkt->pkt_dts, srch->pr_pkt->pkt_dts) < 10 * 90000) {
pkt->pkt_pts = srch->pr_pkt->pkt_dts;
- tvhtrace("tsfix", "%-12s PTS *-frame set to %"PRId64", DTS %"PRId64,
+ tvhtrace(LS_TSFIX, "%-12s PTS *-frame set to %"PRId64", DTS %"PRId64,
streaming_component_type2txt(tfs->tfs_type),
pkt->pkt_pts, pkt->pkt_dts);
break;
// If PTS is missing, set it to DTS if not video
if(pkt->pkt_pts == PTS_UNSET && !tfs->tfs_video) {
pkt->pkt_pts = pkt->pkt_dts;
- tvhtrace("tsfix", "%-12s PTS set to %"PRId64,
+ tvhtrace(LS_TSFIX, "%-12s PTS set to %"PRId64,
streaming_component_type2txt(tfs->tfs_type),
pkt->pkt_pts);
}
if (diff > 160000)
diff = 160000;
tf->tf_tsref = (tf->tf_tsref - diff) % PTS_MASK;
- tvhtrace("tsfix", "reference clock set to %"PRId64" (backlog %"PRId64")", tf->tf_tsref, diff2);
+ tvhtrace(LS_TSFIX, "reference clock set to %"PRId64" (backlog %"PRId64")", tf->tf_tsref, diff2);
tsfix_backlog(tf);
}
} else if (tfs->tfs_local_ref == PTS_UNSET && tf->tf_tsref != PTS_UNSET &&
if (tfs->tfs_audio) {
diff = tsfix_ts_diff(tf->tf_tsref, pkt->pkt_dts);
if (diff > 2 * 90000) {
- tvhwarn("tsfix", "The timediff for %s is big (%"PRId64"), using current dts",
+ tvhwarn(LS_TSFIX, "The timediff for %s is big (%"PRId64"), using current dts",
streaming_component_type2txt(tfs->tfs_type), diff);
tfs->tfs_local_ref = pkt->pkt_dts;
} else {
if(tfs2->tfs_audio && tfs2->tfs_last_dts_in != PTS_UNSET) {
diff = tsfix_ts_diff(tfs2->tfs_last_dts_in, pkt->pkt_dts);
if (diff > 3 * 90000) {
- tvhwarn("tsfix", "The timediff for DVBSUB is big (%"PRId64"), using audio dts", diff);
+ tvhwarn(LS_TSFIX, "The timediff for DVBSUB is big (%"PRId64"), using audio dts", diff);
tfs->tfs_parent = tfs2;
tfs->tfs_local_ref = tfs2->tfs_local_ref;
} else {
diff = tsfix_ts_diff(tf->tf_tsref, pkt->pkt_dts);
if (diff > 2 * 90000) {
tfstream_t *tfs2;
- tvhwarn("tsfix", "The timediff for TELETEXT is big (%"PRId64"), using current dts", diff);
+ tvhwarn(LS_TSFIX, "The timediff for TELETEXT is big (%"PRId64"), using current dts", diff);
tfs->tfs_local_ref = pkt->pkt_dts;
/* Text subtitles extracted from teletext have same timebase */
LIST_FOREACH(tfs2, &tf->tf_streams, tfs_link)
if(pkt->pkt_payload != NULL || pkt->pkt_pts != PTS_UNSET) {
pkt->pkt_dts = (tfs->tfs_last_dts_in + pdur) & PTS_MASK;
- tvhtrace("tsfix", "%-12s DTS set to last %"PRId64" +%d == %"PRId64", PTS = %"PRId64,
+ tvhtrace(LS_TSFIX, "%-12s DTS set to last %"PRId64" +%d == %"PRId64", PTS = %"PRId64,
streaming_component_type2txt(tfs->tfs_type),
tfs->tfs_last_dts_in, pdur, pkt->pkt_dts, pkt->pkt_pts);
}
if ((s = htsmsg_get_str(conf, "class")) != NULL)
pb = profile_class_find(s);
if (pb == NULL) {
- tvherror("profile", "wrong class %s!", s);
+ tvherror(LS_PROFILE, "wrong class %s!", s);
return NULL;
}
pro = pb->build();
if (pro == NULL) {
- tvherror("profile", "Profile class %s is not available!", s);
+ tvherror(LS_PROFILE, "Profile class %s is not available!", s);
return NULL;
}
LIST_INIT(&pro->pro_dvr_configs);
pro->pro_contaccess = 1;
if (idnode_insert(&pro->pro_id, uuid, pb->clazz, 0)) {
if (uuid)
- tvherror("profile", "invalid uuid '%s'", uuid);
+ tvherror(LS_PROFILE, "invalid uuid '%s'", uuid);
free(pro);
return NULL;
}
if (strncasecmp(argv[i], "timeout=", 8) == 0) {
hc->hc_rtp_timeout = atoi(argv[i] + 8);
if (hc->hc_rtp_timeout < 20 || hc->hc_rtp_timeout > 3600) {
- tvhwarn("rtsp", "timeout value out of range 20-3600 (%i)", hc->hc_rtp_timeout);
+ tvhwarn(LS_RTSP, "timeout value out of range 20-3600 (%i)", hc->hc_rtp_timeout);
return -EIO;
}
}
return;
if (sizeof(out) < ol + l + 5 + 4 /* crc */) {
- tvherror("pass", "PMT entry too long (%i)", l);
+ tvherror(LS_PASS, "PMT entry too long (%i)", l);
return;
}
int tcp = rtp->port == RTSP_TCP_DATA;
tcp_get_str_from_ip((struct sockaddr *)&rtp->peer, peername, sizeof(peername));
- tvhdebug("satips", "RTP streaming to %s:%d open", peername,
+ tvhdebug(LS_SATIPS, "RTP streaming to %s:%d open", peername,
tcp ? IP_PORT(rtp->peer) : rtp->port);
pthread_mutex_lock(&sq->sq_mutex);
}
pthread_mutex_unlock(&sq->sq_mutex);
- tvhdebug("satips", "RTP streaming to %s:%d closed (%s request)%s",
+ tvhdebug(LS_SATIPS, "RTP streaming to %s:%d closed (%s request)%s",
peername, rtp->port, alive ? "remote" : "streaming",
fatal ? " (fatal)" : "");
rtp->sig.snr = 28000;
}
- tvhtrace("satips", "rtp queue %p", rtp);
+ tvhtrace(LS_SATIPS, "rtp queue %p", rtp);
pthread_mutex_lock(&satip_rtp_lock);
TAILQ_INSERT_TAIL(&satip_rtp_sessions, rtp, link);
break;
if (!tbl) {
tbl = calloc(1, sizeof(*tbl));
- dvb_table_parse_init(&tbl->tbl, "satip-pmt", pid, rtp);
+ dvb_table_parse_init(&tbl->tbl, "satip-pmt", LS_TBL_SATIP, pid, rtp);
tbl->pid = pid;
TAILQ_INSERT_TAIL(&rtp->pmt_tables, tbl, link);
}
pthread_mutex_lock(&satip_rtp_lock);
rtp = satip_rtp_find(id);
- tvhtrace("satips", "rtp close %p", rtp);
+ tvhtrace(LS_SATIPS, "rtp close %p", rtp);
if (rtp) {
TAILQ_REMOVE(&satip_rtp_sessions, rtp, link);
sq = rtp->sq;
char addrbuf[50];
int r, len, err;
- tvhtrace("satips", "starting rtcp thread");
+ tvhtrace(LS_SATIPS, "starting rtcp thread");
while (atomic_get(&satip_rtcp_run)) {
us = 150000;
do {
if (tvhtrace_enabled()) {
msg[len] = '\0';
tcp_get_str_from_ip((struct sockaddr*)&rtp->peer2, addrbuf, sizeof(addrbuf));
- tvhtrace("satips", "RTCP send to %s:%d : %s", addrbuf, ntohs(IP_PORT(rtp->peer2)), msg + 16);
+ tvhtrace(LS_SATIPS, "RTCP send to %s:%d : %s", addrbuf, ntohs(IP_PORT(rtp->peer2)), msg + 16);
}
if (rtp->port == RTSP_TCP_DATA) {
satip_rtp_tcp_data(rtp, 1, msg, len);
if (r < 0) {
err = errno;
tcp_get_str_from_ip((struct sockaddr*)&rtp->peer2, addrbuf, sizeof(addrbuf));
- tvhwarn("satips", "RTCP send to error %s:%d : %s",
+ tvhwarn(LS_SATIPS, "RTCP send to error %s:%d : %s",
addrbuf, IP_PORT(rtp->peer2), strerror(err));
}
}
{
session_t *rs = aux;
- tvhwarn("satips", "-/%s/%i: session closed (timeout)", rs->session, rs->stream);
+ tvhwarn(LS_SATIPS, "-/%s/%i: session closed (timeout)", rs->session, rs->stream);
pthread_mutex_unlock(&global_lock);
pthread_mutex_lock(&rtsp_lock);
rtsp_close_session(rs);
buf, 0, NULL, NULL,
buf, NULL);
if (sub->ths == NULL) {
- tvherror("satips", "%i/%s/%i: unable to subscribe service %s\n",
+ tvherror(LS_SATIPS, "%i/%s/%i: unable to subscribe service %s\n",
rs->frontend, rs->session, rs->stream, slave->s_nicename);
profile_chain_close(&sub->prch);
free(sub);
master->s_unlink(master, slave);
} else {
LIST_INSERT_HEAD(&rs->slaves, sub, link);
- tvhdebug("satips", "%i/%s/%i: slave service %s subscribed",
+ tvhdebug(LS_SATIPS, "%i/%s/%i: slave service %s subscribed",
rs->frontend, rs->session, rs->stream, slave->s_nicename);
}
}
break;
if (sub == NULL)
return;
- tvhdebug("satips", "%i/%s/%i: slave service %s unsubscribed",
+ tvhdebug(LS_SATIPS, "%i/%s/%i: slave service %s unsubscribed",
rs->frontend, rs->session, rs->stream, slave->s_nicename);
master->s_unlink(master, slave);
if (sub->ths)
idnode_set_remove(found, &s->s_id);
}
if (si < found->is_count)
- tvhwarn("satips", "%i/%s/%i: limit for descrambled services reached (wanted %zd allowed %d)",
+ tvhwarn(LS_SATIPS, "%i/%s/%i: limit for descrambled services reached (wanted %zd allowed %d)",
rs->frontend, rs->session, rs->stream,
(used - si) + found->is_count, rtsp_descramble);
if (mux == NULL && mn2 &&
(rtsp_muxcnf == MUXCNF_AUTO || rtsp_muxcnf == MUXCNF_KEEP)) {
dvb_mux_conf_str(&rs->dmc, buf, sizeof(buf));
- tvhwarn("satips", "%i/%s/%i: create mux %s",
+ tvhwarn(LS_SATIPS, "%i/%s/%i: create mux %s",
rs->frontend, rs->session, rs->stream, buf);
mux =
mn2->mn_create_mux(mn2, (void *)(intptr_t)rs->nsession,
}
if (mux == NULL) {
dvb_mux_conf_str(&rs->dmc, buf, sizeof(buf));
- tvhwarn("satips", "%i/%s/%i: unable to create mux %s%s",
+ tvhwarn(LS_SATIPS, "%i/%s/%i: unable to create mux %s%s",
rs->frontend, rs->session, rs->stream, buf,
(rtsp_muxcnf == MUXCNF_REJECT || rtsp_muxcnf == MUXCNF_REJECT_EXACT_MATCH ) ? " (configuration)" : "");
goto endclean;
if (fe > 0) {
delsys = satip_rtsp_delsys(fe, &findex, NULL);
if (delsys == DVB_SYS_NONE) {
- tvherror("satips", "fe=%d does not exist", fe);
+ tvherror(LS_SATIPS, "fe=%d does not exist", fe);
goto end;
}
} else {
if (mpegts_pid_dump(&rs->pids, buf + r, sizeof(buf) - r, 0, 0) == 0)
tvh_strlcatf(buf, sizeof(buf), r, "<none>");
- tvhdebug("satips", "%i/%s/%d: %s from %s:%d %s",
+ tvhdebug(LS_SATIPS, "%i/%s/%d: %s from %s:%d %s",
rs->frontend, rs->session, rs->stream,
caller, hc->hc_peer_ipstr, IP_PORT(*hc->hc_peer), buf);
eargs:
TAILQ_FOREACH(arg, &hc->hc_req_args, link)
- tvhwarn("satips", "%i/%s/%i: extra parameter '%s'='%s'",
+ tvhwarn(LS_SATIPS, "%i/%s/%i: extra parameter '%s'='%s'",
rs->frontend, rs->session, rs->stream,
arg->key, arg->val);
goto end;
if (setup && rs->rtp_peer_port != RTSP_TCP_DATA) {
if (udp_bind_double(&rs->udp_rtp, &rs->udp_rtcp,
- "satips", "rtsp", "rtcp",
+ LS_SATIPS, "rtsp", "rtcp",
rtsp_ip, 0, NULL,
4*1024, 4*1024,
RTP_BUFSIZE, RTCP_BUFSIZE)) {
return 0;
}
- tvhdebug("satips", "-/%s/%i: teardown from %s:%d",
+ tvhdebug(LS_SATIPS, "-/%s/%i: teardown from %s:%d",
hc->hc_session, stream, hc->hc_peer_ipstr, IP_PORT(*hc->hc_peer));
pthread_mutex_lock(&rtsp_lock);
rtsp_nat_ip = nat_ip ? strdup(nat_ip) : NULL;
free(s);
if (!rtsp_server)
- rtsp_server = tcp_server_create("satips", "SAT>IP RTSP", bindaddr, port, &ops, NULL);
+ rtsp_server = tcp_server_create(LS_SATIPS, "SAT>IP RTSP", bindaddr, port, &ops, NULL);
if (reg)
tcp_server_register(rtsp_server);
}
htsbuf_queue_flush(&q);
if (devicelist == NULL || devicelist[0] == '\0') {
- tvhwarn("satips", "SAT>IP server announces an empty tuner list to a client %s (missing %s)",
+ tvhwarn(LS_SATIPS, "SAT>IP server announces an empty tuner list to a client %s (missing %s)",
hc->hc_peer_ipstr, !tuners ? "tuner settings - global config" : "network assignment");
}
if (satips_upnp_discovery == NULL || satip_server_rtsp_port <= 0)
return;
- tvhtrace("satips", "sending byebye");
+ tvhtrace(LS_SATIPS, "sending byebye");
for (attempt = 1; attempt <= 3; attempt++) {
switch (attempt) {
if (satips_upnp_discovery == NULL || satip_server_rtsp_port <= 0)
return;
- tvhtrace("satips", "sending announce");
+ tvhtrace(LS_SATIPS, "sending announce");
for (attempt = 1; attempt <= 3; attempt++) {
switch (attempt) {
if (tvhtrace_enabled()) {
tcp_get_str_from_ip((struct sockaddr *)dst, buf, sizeof(buf));
- tvhtrace("satips", "sending discover reply to %s:%d%s%s",
+ tvhtrace(LS_SATIPS, "sending discover reply to %s:%d%s%s",
buf, ntohs(IP_PORT(*dst)), deviceid ? " device: " : "", deviceid ?: "");
}
if (tvhtrace_enabled()) {
tcp_get_str_from_ip((struct sockaddr *)storage, buf2, sizeof(buf2));
- tvhtrace("satips", "received %s M-SEARCH from %s:%d",
+ tvhtrace(LS_SATIPS, "received %s M-SEARCH from %s:%d",
conn->multicast ? "multicast" : "unicast",
buf2, ntohs(IP_PORT(*storage)));
}
if (satip_server_deviceid >= 254)
satip_server_deviceid = 1;
tcp_get_str_from_ip((struct sockaddr *)storage, buf2, sizeof(buf2));
- tvhwarn("satips", "received duplicate SAT>IP DeviceID %s from %s:%d, using %d",
+ tvhwarn(LS_SATIPS, "received duplicate SAT>IP DeviceID %s from %s:%d, using %d",
deviceid, buf2, ntohs(IP_PORT(*storage)), satip_server_deviceid);
satips_upnp_send_discover_reply(storage, deviceid, 0);
satips_upnp_send_byebye();
if (!satip_server_rtsp_port_locked)
rtsp_port = satip_server_conf.satip_rtsp > 0 ? satip_server_conf.satip_rtsp : def;
if (getuid() != 0 && rtsp_port > 0 && rtsp_port < 1024) {
- tvherror("satips", "RTSP port %d specified but no root perms, using 9983", rtsp_port);
+ tvherror(LS_SATIPS, "RTSP port %d specified but no root perms, using 9983", rtsp_port);
rtsp_port = 9983;
}
satip_server_rtsp_port = rtsp_port;
int fe, findex;
const char *ftype;
- tvhinfo("satips", "SAT>IP Server %sinitialized", prefix);
- tvhinfo("satips", " HTTP %s:%d, RTSP %s:%d",
+ tvhinfo(LS_SATIPS, "SAT>IP Server %sinitialized", prefix);
+ tvhinfo(LS_SATIPS, " HTTP %s:%d, RTSP %s:%d",
http_server_ip, http_server_port,
http_server_ip, satip_server_rtsp_port);
- tvhinfo("satips", " descramble %d, muxcnf %d",
+ tvhinfo(LS_SATIPS, " descramble %d, muxcnf %d",
descramble, muxcnf);
for (fe = 1; fe <= 128; fe++) {
if (satip_rtsp_delsys(fe, &findex, &ftype) == DVB_TYPE_NONE)
break;
- tvhinfo("satips", " tuner[fe=%d]: %s #%d", fe, ftype, findex);
+ tvhinfo(LS_SATIPS, " tuner[fe=%d]: %s #%d", fe, ftype, findex);
}
}
if (http_server_ip == NULL) {
if (tcp_server_onall(http_server) && satip_server_bindaddr == NULL) {
- tvherror("satips", "use --satip_bindaddr parameter to select the local IP for SAT>IP");
- tvherror("satips", "using Google lookup (might block the task until timeout)");
+ tvherror(LS_SATIPS, "use --satip_bindaddr parameter to select the local IP for SAT>IP");
+ tvherror(LS_SATIPS, "using Google lookup (might block the task until timeout)");
}
if (tcp_server_bound(http_server, &http, PF_INET) < 0) {
- tvherror("satips", "Unable to determine the HTTP/RTSP address");
+ tvherror(LS_SATIPS, "Unable to determine the HTTP/RTSP address");
return;
}
tcp_get_str_from_ip((const struct sockaddr *)&http, http_ip, sizeof(http_ip));
satip_server_init_common("re", 1);
} else {
pthread_mutex_unlock(&global_lock);
- tvhinfo("satips", "SAT>IP Server shutdown");
+ tvhinfo(LS_SATIPS, "SAT>IP Server shutdown");
satip_server_rtsp_done();
satips_upnp_send_byebye();
pthread_mutex_lock(&global_lock);
if (satip_server_conf.satip_uuid == NULL) {
/* This is not UPnP complaint UUID */
if (uuid_init_bin(&u, NULL)) {
- tvherror("satips", "Unable to create UUID");
+ tvherror(LS_SATIPS, "Unable to create UUID");
return;
}
bin2hex(uu + 0, 9, u.bin, 4); uu[ 8] = '-';
satips_upnp_discovery = upnp_service_create(upnp_service);
if (satips_upnp_discovery == NULL) {
- tvherror("satips", "unable to create UPnP discovery service");
+ tvherror(LS_SATIPS, "unable to create UPnP discovery service");
} else {
satips_upnp_discovery->us_received = satips_upnp_discovery_received;
satips_upnp_discovery->us_destroy = satips_upnp_discovery_destroy;
TAILQ_FOREACH(st, &t->s_filt_components, es_filt_link) {
if (LIST_EMPTY(&st->es_caids)) {
- tvhinfo("service", "esfilter: \"%s\" %03d %05d %s %s",
+ tvhinfo(LS_SERVICE, "esfilter: \"%s\" %03d %05d %s %s",
t->s_nicename, st->es_index, st->es_pid,
streaming_component_type2txt(st->es_type),
lang_code_get(st->es_lang));
} else {
LIST_FOREACH(ca, &st->es_caids, link)
if (ca->use)
- tvhinfo("service", "esfilter: \"%s\" %03d %05d %s %04x %06x",
+ tvhinfo(LS_SERVICE, "esfilter: \"%s\" %03d %05d %s %04x %06x",
t->s_nicename, st->es_index, st->es_pid,
streaming_component_type2txt(st->es_type),
ca->caid, ca->providerid);
if (esf->esf_sindex && esf->esf_sindex != sindex)
continue;
if (esf->esf_log)
- tvhlog(LOG_INFO, "service", "esfilter: \"%s\" %s %03d %03d %05d %04x %06x %s",
+ tvhinfo(LS_SERVICE, "esfilter: \"%s\" %s %03d %03d %05d %04x %06x %s",
t->s_nicename, esfilter_class2txt(i), st->es_index,
esf->esf_index, st->es_pid, esf->esf_caid, esf->esf_caprovider,
esfilter_action2txt(esf->esf_action));
service_build_filter_add(t, st, sta, &p);
break;
default:
- tvhlog(LOG_DEBUG, "service", "Unknown esfilter action %d", esf->esf_action);
+ tvhdebug(LS_SERVICE, "Unknown esfilter action %d", esf->esf_action);
break;
}
} else {
if (esf->esf_sindex && esf->esf_sindex != sindex)
continue;
if (esf->esf_log)
- tvhlog(LOG_INFO, "service", "esfilter: \"%s\" %s %03d %03d %05d %s %s %s",
+ tvhinfo(LS_SERVICE, "esfilter: \"%s\" %s %03d %03d %05d %s %s %s",
t->s_nicename, esfilter_class2txt(i), st->es_index, esf->esf_index,
st->es_pid, streaming_component_type2txt(st->es_type),
lang_code_get(st->es_lang), esfilter_action2txt(esf->esf_action));
service_build_filter_add(t, st, sta, &p);
break;
default:
- tvhlog(LOG_DEBUG, "service", "Unknown esfilter action %d", esf->esf_action);
+ tvhdebug(LS_SERVICE, "Unknown esfilter action %d", esf->esf_action);
break;
}
}
lock_assert(&global_lock);
- tvhtrace("service", "starting %s", t->s_nicename);
+ tvhtrace(LS_SERVICE, "starting %s", t->s_nicename);
assert(t->s_status != SERVICE_RUNNING);
t->s_streaming_status = 0;
TAILQ_FOREACH(si, sil, si_link) {
const char *name = ch ? channel_get_name(ch) : NULL;
if (!name && s) name = s->s_nicename;
- tvhdebug("service", "%d: %s si %p %s weight %d prio %d error %d",
+ tvhdebug(LS_SERVICE, "%d: %s si %p %s weight %d prio %d error %d",
si->si_instance, name, si, si->si_source, si->si_weight, si->si_prio,
si->si_error);
}
/* Already running? */
TAILQ_FOREACH(si, sil, si_link)
if(si->si_s->s_status == SERVICE_RUNNING && si->si_error == 0) {
- tvhtrace("service", "return already running %p", si);
+ tvhtrace(LS_SERVICE, "return already running %p", si);
return si;
}
}
/* Start */
- tvhtrace("service", "will start new instance %d", si->si_instance);
+ tvhtrace(LS_SERVICE, "will start new instance %d", si->si_instance);
if (service_start(si->si_s, si->si_instance, weight, flags, timeout, postpone)) {
- tvhtrace("service", "tuning failed");
+ tvhtrace(LS_SERVICE, "tuning failed");
si->si_error = SM_CODE_TUNING_FAILED;
if (*error < SM_CODE_TUNING_FAILED)
*error = SM_CODE_TUNING_FAILED;
{
if (idnode_insert(&t->s_id, uuid, class, 0)) {
if (uuid)
- tvherror("service", "invalid uuid '%s'", uuid);
+ tvherror(LS_SERVICE, "invalid uuid '%s'", uuid);
free(t);
return NULL;
}
t->s_streaming_status = set;
- tvhlog(LOG_DEBUG, "service", "%s: Status changed to %s%s%s%s%s%s%s%s%s",
+ tvhdebug(LS_SERVICE, "%s: Status changed to %s%s%s%s%s%s%s%s%s",
service_nicename(t),
set & TSS_INPUT_HARDWARE ? "[Hardware input] " : "",
set & TSS_INPUT_SERVICE ? "[Input on service] " : "",
}
if (!f) continue;
}
- tvhtrace("service_mapper", "check service %s (%s)",
+ tvhtrace(LS_SERVICE_MAPPER, "check service %s (%s)",
s->s_nicename, idnode_uuid_as_str(&s->s_id, ubuf));
/* Already mapped (or in progress) */
if (s->s_sm_onqueue) continue;
if (LIST_FIRST(&s->s_channels)) continue;
- tvhtrace("service_mapper", " not mapped");
+ tvhtrace(LS_SERVICE_MAPPER, " not mapped");
service_mapper_stat.total++;
service_mapper_stat.ignore++;
/* Disabled */
if (!s->s_is_enabled(s, 0)) continue;
- tvhtrace("service_mapper", " enabled");
+ tvhtrace(LS_SERVICE_MAPPER, " enabled");
/* Get service info */
pthread_mutex_lock(&s->s_stream_mutex);
/* Skip non-TV / Radio */
if (!tr) continue;
- tvhtrace("service_mapper", " radio or tv");
+ tvhtrace(LS_SERVICE_MAPPER, " radio or tv");
/* Skip encrypted */
if (!conf->encrypted && e) continue;
/* Queue */
if (conf->check_availability) {
- tvhtrace("service_mapper", " queue for checking");
+ tvhtrace(LS_SERVICE_MAPPER, " queue for checking");
qd = 1;
smi = malloc(sizeof(*smi));
smi->s = s;
/* Process */
} else {
- tvhtrace("service_mapper", " process");
+ tvhtrace(LS_SERVICE_MAPPER, " process");
service_mapper_process(conf, s, NULL);
}
}
}
if (!bq) {
service_mapper_stat.ok++;
- tvhinfo("service_mapper", "%s: success", s->s_nicename);
+ tvhinfo(LS_SERVICE_MAPPER, "%s: success", s->s_nicename);
} else {
- tvhinfo("bouquet", "%s: mapped service from %s", s->s_nicename, bq->bq_name ?: "<unknown>");
+ tvhinfo(LS_BOUQUET, "%s: mapped service from %s", s->s_nicename, bq->bq_name ?: "<unknown>");
}
/* Remove */
while (!(smi = TAILQ_FIRST(&service_mapper_queue))) {
if (working) {
working = 0;
- tvhinfo("service_mapper", "idle");
+ tvhinfo(LS_SERVICE_MAPPER, "idle");
}
tvh_cond_wait(&service_mapper_cond, &global_lock);
if (!tvheadend_is_running())
if (!working) {
working = 1;
- tvhinfo("service_mapper", "starting");
+ tvhinfo(LS_SERVICE_MAPPER, "starting");
}
/* Subscribe */
- tvhinfo("service_mapper", "checking %s", s->s_nicename);
+ tvhinfo(LS_SERVICE_MAPPER, "checking %s", s->s_nicename);
prch.prch_id = s;
sub = subscription_create_from_service(&prch, NULL,
SUBSCRIPTION_PRIO_MAPPER,
/* Failed */
if (!sub) {
- tvhinfo("service_mapper", "%s: could not subscribe", s->s_nicename);
+ tvhinfo(LS_SERVICE_MAPPER, "%s: could not subscribe", s->s_nicename);
continue;
}
- tvhinfo("service_mapper", "waiting for input");
+ tvhinfo(LS_SERVICE_MAPPER, "waiting for input");
service_ref(s);
service_mapper_stat.active = s;
api_service_mapper_notify();
subscription_unsubscribe(sub, UNSUBSCRIBE_FINAL);
if(err) {
- tvhinfo("service_mapper", "%s: failed [reason: %s]", s->s_nicename, err);
+ tvhinfo(LS_SERVICE_MAPPER, "%s: failed [reason: %s]", s->s_nicename, err);
service_mapper_stat.fail++;
} else
service_mapper_process(&smi->conf, s, NULL);
}
x--;
}
- return makedirs("settings", path, 0700, 1, -1, -1);
+ return makedirs(LS_SETTINGS, path, 0700, 1, -1, -1);
}
/**
/* Create directories */
if (hts_settings_makedirs(path)) return;
- tvhdebug("settings", "saving to %s", path);
+ tvhdebug(LS_SETTINGS, "saving to %s", path);
/* Create tmp file */
snprintf(tmppath, sizeof(tmppath), "%s.tmp", path);
if((fd = tvh_open(tmppath, O_CREAT | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR)) < 0) {
- tvhlog(LOG_ALERT, "settings", "Unable to create \"%s\" - %s",
- tmppath, strerror(errno));
+ tvhalert(LS_SETTINGS, "Unable to create \"%s\" - %s",
+ tmppath, strerror(errno));
return;
}
htsmsg_json_serialize(record, &hq, 1);
TAILQ_FOREACH(hd, &hq.hq_q, hd_link)
if(tvh_write(fd, hd->hd_data + hd->hd_data_off, hd->hd_data_len)) {
- tvhlog(LOG_ALERT, "settings", "Failed to write file \"%s\" - %s",
- tmppath, strerror(errno));
+ tvhalert(LS_SETTINGS, "Failed to write file \"%s\" - %s",
+ tmppath, strerror(errno));
ok = 0;
break;
}
if (r)
ok = 0;
} else {
- tvhlog(LOG_ALERT, "settings", "Unable to pack the configuration data \"%s\"", path);
+ tvhalert(LS_SETTINGS, "Unable to pack the configuration data \"%s\"", path);
}
free(msgdata);
#endif
r = rename(tmppath, path);
}
if (r)
- tvhlog(LOG_ALERT, "settings", "Unable to rename file \"%s\" to \"%s\" - %s",
- tmppath, path, strerror(errno));
+ tvhalert(LS_SETTINGS, "Unable to rename file \"%s\" to \"%s\" - %s",
+ tmppath, path, strerror(errno));
/* Delete tmp */
} else
#if ENABLE_ZLIB
uint32_t orig = (mem[8] << 24) | (mem[9] << 16) | (mem[10] << 8) | mem[11];
if (orig > 10*1024*1024U) {
- tvhlog(LOG_ALERT, "settings", "too big gzip for %s", filename);
+ tvhalert(LS_SETTINGS, "too big gzip for %s", filename);
r = NULL;
} else if (orig > 0) {
uint8_t *unpacked = tvh_gzip_inflate((uint8_t *)mem + 12, size - 12, orig);
break;
}
buf[len + r] = '\0';
- tvhlog_hexdump("spawn", buf + len, r);
+ tvhlog_hexdump(LS_SPAWN, buf + len, r);
while (1) {
s = buf;
while (*s && *s != '\n' && *s != '\r')
break;
*s++ = '\0';
if (buf[0])
- tvhlog(level, "spawn", "%s", buf);
+ tvhlog(level, LS_SPAWN, "%s", buf);
memmove(buf, s, strlen(s) + 1);
}
if (strlen(buf) == SPAWN_PIPE_READ_SIZE - 1) {
- tvherror("spawn", "pipe buffer full");
+ tvherror(LS_SPAWN, "pipe buffer full");
buf[0] = '\0';
}
}
if(p == -1) {
pthread_mutex_unlock(&fork_lock);
- tvherror("spawn", "Unable to fork() for \"%s\" -- %s",
+ tvherror(LS_SPAWN, "Unable to fork() for \"%s\" -- %s",
prog, strerror(errno));
return -1;
}
if(p == -1) {
pthread_mutex_unlock(&fork_lock);
- tvherror("spawn", "Unable to fork() for \"%s\" -- %s",
+ tvherror(LS_SPAWN, "Unable to fork() for \"%s\" -- %s",
prog, strerror(errno));
return -1;
}
s->ths_service = t;
LIST_INSERT_HEAD(&t->s_subscriptions, s, ths_service_link);
- tvhtrace("subscription", "%04X: linking sub %p to svc %p type %i",
+ tvhtrace(LS_SUBSCRIPTION, "%04X: linking sub %p to svc %p type %i",
shortid(s), s, t, t->s_type);
pthread_mutex_lock(&t->s_stream_mutex);
}
#endif
}
- tvhlog(LOG_NOTICE, "subscription", "%04X: %s", shortid(s), buf);
+ tvhnotice(LS_SUBSCRIPTION, "%04X: %s", shortid(s), buf);
}
static void
if (s->ths_client)
tvh_strlcatf(buf, sizeof(buf), l, ", client=\"%s\"", s->ths_client);
- tvhlog(LOG_INFO, "subscription", "%04X: %s", shortid(s), buf);
+ tvhinfo(LS_SUBSCRIPTION, "%04X: %s", shortid(s), buf);
service_source_info_free(&si);
}
service_instance_t *si;
if (s->ths_channel)
- tvhtrace("subscription", "%04X: find service for %s weight %d",
+ tvhtrace(LS_SUBSCRIPTION, "%04X: find service for %s weight %d",
shortid(s), channel_get_name(s->ths_channel), s->ths_weight);
else
- tvhtrace("subscription", "%04X: find instance for %s weight %d",
+ tvhtrace(LS_SUBSCRIPTION, "%04X: find instance for %s weight %d",
shortid(s), s->ths_service->s_nicename, s->ths_weight);
si = service_find_instance(s->ths_service, s->ths_channel,
s->ths_source, s->ths_prch,
if(subgetstate(s) != SUBSCRIPTION_BAD_SERVICE)
continue; /* And it not bad, so we're happy */
- tvhwarn("subscription", "%04X: service instance is bad, reason: %s",
+ tvhwarn(LS_SUBSCRIPTION, "%04X: service instance is bad, reason: %s",
shortid(s), streaming_code2txt(s->ths_testing_error));
t->s_streaming_status = 0;
if(si == NULL) {
if (s->ths_last_error != error || s->ths_last_find + sec2mono(2) >= mclk()) {
- tvhtrace("subscription", "%04X: instance not available, retrying", shortid(s));
+ tvhtrace(LS_SUBSCRIPTION, "%04X: instance not available, retrying", shortid(s));
if (s->ths_last_error != error)
s->ths_last_find = mclk();
s->ths_last_error = error;
}
if (s->ths_flags & SUBSCRIPTION_RESTART) {
if (s->ths_channel)
- tvhwarn("subscription", "%04X: restarting channel %s",
+ tvhwarn(LS_SUBSCRIPTION, "%04X: restarting channel %s",
shortid(s), channel_get_name(s->ths_channel));
else
- tvhwarn("subscription", "%04X: restarting service %s",
+ tvhwarn(LS_SUBSCRIPTION, "%04X: restarting service %s",
shortid(s), s->ths_service->s_nicename);
s->ths_testing_error = 0;
s->ths_current_instance = NULL;
pthread_mutex_lock(&global_lock);
if (subscription_postpone != postpone) {
subscription_postpone = postpone;
- tvhinfo("subscriptions", "postpone set to %"PRId64" seconds", postpone);
+ tvhinfo(LS_SUBSCRIPTION, "postpone set to %"PRId64" seconds", postpone);
LIST_FOREACH(s, &subscriptions, ths_global_link) {
s->ths_postpone = postpone;
if (s->ths_postpone_end > now && s->ths_postpone_end - now > postpone2)
if (s->ths_client)
tvh_strlcatf(buf, sizeof(buf), l, ", client=\"%s\"", s->ths_client);
tvhlog((flags & UNSUBSCRIBE_QUIET) != 0 ? LOG_TRACE : LOG_INFO,
- "subscription", "%04X: %s", shortid(s), buf);
+ LS_SUBSCRIPTION, "%04X: %s", shortid(s), buf);
if (t)
service_remove_subscriber(t, s, SM_CODE_OK);
if (tvhtrace_enabled()) {
const char *pro_name = prch->prch_pro ? profile_get_name(prch->prch_pro) : "<none>";
if (ch)
- tvhtrace("subscription", "%04X: creating subscription for %s weight %d using profile %s",
+ tvhtrace(LS_SUBSCRIPTION, "%04X: creating subscription for %s weight %d using profile %s",
shortid(s), channel_get_name(ch), weight, pro_name);
else
- tvhtrace("subscription", "%04X: creating subscription for service %s weight %d using profile %s",
+ tvhtrace(LS_SUBSCRIPTION, "%04X: creating subscription for service %s weight %d using profile %s",
shortid(s), service->s_nicename, weight, pro_name);
}
s->ths_channel = ch;
}
if(t == NULL) {
- tvhlog(LOG_ERR, "subscription",
- "Unable to dummy join %s, service not found, retrying...", id);
+ tvherror(LS_SUBSCRIPTION,
+ "Unable to dummy join %s, service not found, retrying...", id);
mtimer_arm_rel(&dummy_sub_timer, dummy_retry, strdup(id), sec2mono(1));
return;
prch->prch_st = st;
s = subscription_create_from_service(prch, NULL, 1, "dummy", 0, NULL, NULL, "dummy", NULL);
- tvhlog(LOG_NOTICE, "subscription",
- "%04X: Dummy join %s ok", shortid(s), id);
+ tvhnotice(LS_SUBSCRIPTION, "%04X: Dummy join %s ok", shortid(s), id);
}
if (c1 && c2) {
if (started + sec2mono(3) < mclk()) {
- tvherror("tcp", "multiple connections are not allowed for user '%s' from '%s' "
+ tvherror(LS_TCP, "multiple connections are not allowed for user '%s' from '%s' "
"(limit %u, streaming limit %u, active streaming %u, DVR %u)",
aa->aa_username ?: "", aa->aa_representative ?: "",
aa->aa_conn_limit, aa->aa_conn_limit_streaming,
if(r < 0) {
if (ERRNO_AGAIN(-r))
continue;
- tvherror("tcp", "tcp_server_loop: tvhpoll_wait: %s", strerror(errno));
+ tvherror(LS_TCP, "tcp_server_loop: tvhpoll_wait: %s", strerror(errno));
continue;
}
tvhthread_create(&tsl->tid, NULL, tcp_server_start, tsl, "tcp-start");
}
}
- tvhtrace("tcp", "server thread finished");
+ tvhtrace(LS_TCP, "server thread finished");
return NULL;
}
#else
void *tcp_server_create
#endif
- (const char *subsystem, const char *name, const char *bindaddr,
+ (int subsystem, const char *name, const char *bindaddr,
int port, tcp_server_ops_t *ops, void *opaque)
{
int fd, x;
x = getaddrinfo(bindaddr, port_buf, &hints, &res);
if(x != 0) {
- tvhlog(LOG_ERR, "tcp", "getaddrinfo: %s: %s", bindaddr != NULL ? bindaddr : "*",
- x == EAI_SYSTEM ? strerror(errno) : gai_strerror(x));
+ tvherror(LS_TCP, "getaddrinfo: %s: %s", bindaddr != NULL ? bindaddr : "*",
+ x == EAI_SYSTEM ? strerror(errno) : gai_strerror(x));
return NULL;
}
if(x != 0)
{
- tvhlog(LOG_ERR, "tcp", "bind: %s:%i: %s", bindaddr != NULL ? bindaddr : "*", port, strerror(errno));
+ tvherror(LS_TCP, "bind: %s:%i: %s", bindaddr != NULL ? bindaddr : "*", port, strerror(errno));
close(fd);
return NULL;
}
ts->opaque = opaque;
tcp_get_str_from_ip((const struct sockaddr *)&bound, buf, sizeof(buf));
- tvhlog(LOG_INFO, subsystem, "Starting %s server %s:%d", name, buf, htons(IP_PORT(bound)));
+ tvhinfo(subsystem, "Starting %s server %s:%d", name, buf, htons(IP_PORT(bound)));
return ts;
}
memset(&bound, 0, sizeof(bound));
s_len = sizeof(bound);
if (getsockname(fd, (struct sockaddr *) &bound, &s_len) != 0) {
- tvhlog(LOG_ERR, "tcp", "getsockname failed: %s", strerror(errno));
+ tvherror(LS_TCP, "getsockname failed: %s", strerror(errno));
continue;
}
switch (bound.ss_family) {
ts->ops = *ops;
ts->opaque = opaque;
tcp_get_str_from_ip((const struct sockaddr *)&bound, buf, sizeof(buf));
- tvhlog(LOG_INFO, subsystem, "Starting %s server %s:%d (systemd)", name, buf, htons(IP_PORT(bound)));
+ tvhinfo(subsystem, "Starting %s server %s:%d (systemd)", name, buf, htons(IP_PORT(bound)));
} else {
/* no systemd-managed socket found, create a new one */
- tvhlog(LOG_INFO, "tcp", "No systemd socket: creating a new one");
+ tvhinfo(LS_TCP, "No systemd socket: creating a new one");
ts = tcp_server_create_new(subsystem, name, bindaddr, port, ops, opaque);
}
t = mclk();
while (LIST_FIRST(&tcp_server_active) != NULL) {
if (t + sec2mono(5) < mclk())
- tvhtrace("tcp", "tcp server %p active too long", LIST_FIRST(&tcp_server_active));
+ tvhtrace(LS_TCP, "tcp server %p active too long", LIST_FIRST(&tcp_server_active));
pthread_mutex_unlock(&global_lock);
tvh_safe_usleep(20000);
pthread_mutex_lock(&global_lock);
struct sockaddr_storage *peer,
struct sockaddr_storage *self);
-void *tcp_server_create(const char *subsystem, const char *name,
+void *tcp_server_create(int subsystem, const char *name,
const char *bindaddr, int port,
tcp_server_ops_t *ops, void *opaque);
( const char *source, timeshift_t *ts, streaming_message_t *sm )
{
th_pkt_t *pkt = sm->sm_data;
- tvhtrace("timeshift",
+ tvhtrace(LS_TIMESHIFT,
"ts %d pkt %s - stream %d type %c pts %10"PRId64
" dts %10"PRId64" dur %10d len %6zu time %14"PRId64,
ts->id, source,
pthread_mutex_unlock(×hift_reaper_lock);
if (tsf->path) {
- tvhtrace("timeshift", "remove file %s", tsf->path);
+ tvhtrace(LS_TIMESHIFT, "remove file %s", tsf->path);
/* Remove */
unlink(tsf->path);
dpath = dirname(tsf->path);
if (rmdir(dpath) == -1)
if (errno != ENOTEMPTY)
- tvhlog(LOG_ERR, "timeshift", "failed to remove %s [e=%s]",
- dpath, strerror(errno));
+ tvherror(LS_TIMESHIFT, "failed to remove %s [e=%s]", dpath, strerror(errno));
} else {
- tvhtrace("timeshift", "remove RAM segment (time %"PRId64", size %"PRId64")",
+ tvhtrace(LS_TIMESHIFT, "remove RAM segment (time %"PRId64", size %"PRId64")",
tsf->time, (int64_t)tsf->size);
}
pthread_mutex_lock(×hift_reaper_lock);
}
pthread_mutex_unlock(×hift_reaper_lock);
- tvhtrace("timeshift", "reaper thread exit");
+ tvhtrace(LS_TIMESHIFT, "reaper thread exit");
return NULL;
}
{
if (tvhtrace_enabled()) {
if (tsf->path)
- tvhtrace("timeshift", "queue file for removal %s", tsf->path);
+ tvhtrace(LS_TIMESHIFT, "queue file for removal %s", tsf->path);
else
- tvhtrace("timeshift", "queue file for removal - RAM segment time %li", (long)tsf->time);
+ tvhtrace(LS_TIMESHIFT, "queue file for removal - RAM segment time %li", (long)tsf->time);
}
pthread_mutex_lock(×hift_reaper_lock);
TAILQ_INSERT_TAIL(×hift_reaper_list, tsf, link);
timeshift_file_t *tsf;
if (TAILQ_EMPTY(&ts->files)) {
- tvhtrace("timeshift", "ts %d file dump - EMPTY", ts->id);
+ tvhtrace(LS_TIMESHIFT, "ts %d file dump - EMPTY", ts->id);
return;
}
TAILQ_FOREACH(tsf, &ts->files, link) {
- tvhtrace("timeshift", "ts %d (full=%d) file dump tsf %p time %4"PRId64" last %10"PRId64" bad %d refcnt %d",
+ tvhtrace(LS_TIMESHIFT, "ts %d (full=%d) file dump tsf %p time %4"PRId64" last %10"PRId64" bad %d refcnt %d",
ts->id, ts->full, tsf, tsf->time, tsf->last, tsf->bad, tsf->refcount);
}
}
if (timeshift_filemgr_get_root(buf, len))
return 1;
snprintf(buf+strlen(buf), len-strlen(buf), "/%d", index);
- return makedirs("timeshift", buf, 0700, 0, -1, -1);
+ return makedirs(LS_TIMESHIFT, buf, 0700, 0, -1, -1);
}
/*
assert(tsf->rfd < 0);
if (tvhtrace_enabled()) {
if (tsf->path)
- tvhdebug("timeshift", "ts %d remove %s (size %"PRId64")", ts->id, tsf->path, (int64_t)tsf->size);
+ tvhdebug(LS_TIMESHIFT, "ts %d remove %s (size %"PRId64")", ts->id, tsf->path, (int64_t)tsf->size);
else
- tvhdebug("timeshift", "ts %d RAM segment remove time %"PRId64" (size %"PRId64", alloc size %"PRId64")",
+ tvhdebug(LS_TIMESHIFT, "ts %d RAM segment remove time %"PRId64" (size %"PRId64", alloc size %"PRId64")",
ts->id, tsf->time, (int64_t)tsf->size, (int64_t)tsf->ram_size);
}
TAILQ_REMOVE(&ts->files, tsf, link);
timeshift_filemgr_remove(ts, tsf_hd, 0);
tsf_hd = NULL;
} else {
- tvhlog(LOG_DEBUG, "timeshift", "ts %d buffer full", ts->id);
+ tvhdebug(LS_TIMESHIFT, "ts %d buffer full", ts->id);
ts->full = 1;
}
}
/* Full */
} else {
- tvhlog(LOG_DEBUG, "timeshift", "ts %d buffer full", ts->id);
+ tvhdebug(LS_TIMESHIFT, "ts %d buffer full", ts->id);
ts->full = 1;
}
}
tsf_tmp = NULL;
if (!ts->full) {
- tvhtrace("timeshift", "ts %d RAM total %"PRId64" requested %"PRId64" segment %"PRId64,
+ tvhtrace(LS_TIMESHIFT, "ts %d RAM total %"PRId64" requested %"PRId64" segment %"PRId64,
ts->id, atomic_pre_add_u64(×hift_total_ram_size, 0),
timeshift_conf.ram_size, timeshift_conf.ram_segment_size);
while (1) {
free(tsf_tmp);
tsf_tmp = NULL;
} else {
- tvhtrace("timeshift", "ts %d create RAM segment with %"PRId64" bytes (time %"PRId64")",
+ tvhtrace(LS_TIMESHIFT, "ts %d create RAM segment with %"PRId64" bytes (time %"PRId64")",
ts->id, tsf_tmp->ram_size, start_time);
ts->ram_segments++;
}
tsf_hd = TAILQ_FIRST(&ts->files);
if (timeshift_conf.ram_fit && tsf_hd && !tsf_hd->refcount &&
tsf_hd->ram && ts->file_segments == 0) {
- tvhtrace("timeshift", "ts %d remove RAM segment %"PRId64" (fit)", ts->id, tsf_hd->time);
+ tvhtrace(LS_TIMESHIFT, "ts %d remove RAM segment %"PRId64" (fit)", ts->id, tsf_hd->time);
timeshift_filemgr_remove(ts, tsf_hd, 0);
} else {
break;
/* Create File */
snprintf(path, sizeof(path), "%s/tvh-%"PRId64, ts->path, start_time);
- tvhtrace("timeshift", "ts %d create file %s", ts->id, path);
+ tvhtrace(LS_TIMESHIFT, "ts %d create file %s", ts->id, path);
if ((fd = tvh_open(path, O_WRONLY | O_CREAT, 0600)) > 0) {
tsf_tmp = timeshift_filemgr_file_init(ts, start_time);
tsf_tmp->wfd = fd;
if (tsf_tmp && tsf_tl) {
/* Copy across last start message */
if ((ti = TAILQ_LAST(&tsf_tl->sstart, timeshift_index_data_list)) || ts->smt_start) {
- tvhtrace("timeshift", "ts %d copy smt_start to new file%s",
+ tvhtrace(LS_TIMESHIFT, "ts %d copy smt_start to new file%s",
ts->id, ti ? " (from last file)" : "");
timeshift_index_data_t *ti2 = calloc(1, sizeof(timeshift_index_data_t));
if (ti) {
if (r < 0) {
if (ERRNO_AGAIN(errno))
continue;
- tvhtrace("timeshift", "read errno %d", errno);
+ tvhtrace(LS_TIMESHIFT, "read errno %d", errno);
return -1;
}
if (r > 0) {
/* Wrong data size */
if (sz > 1024 * 1024) {
- tvhtrace("timeshift", "wrong msg size (%lld/0x%llx)", (long long)sz, (long long)sz);
+ tvhtrace(LS_TIMESHIFT, "wrong msg size (%lld/0x%llx)", (long long)sz, (long long)sz);
return -1;
}
timeshift_seek_t nseek;
int end;
- tvhlog(LOG_DEBUG, "timeshift", "ts %d skip to %"PRId64" from %"PRId64,
- ts->id, req_time, last_time);
+ tvhdebug(LS_TIMESHIFT, "ts %d skip to %"PRId64" from %"PRId64,
+ ts->id, req_time, last_time);
timeshift_file_get(seek->file);
/* Find */
end = _timeshift_skip(ts, req_time, last_time, seek, &nseek);
if (nseek.frame)
- tvhlog(LOG_DEBUG, "timeshift", "ts %d skip found pkt @ %"PRId64,
- ts->id, nseek.frame->time);
+ tvhdebug(LS_TIMESHIFT, "ts %d skip found pkt @ %"PRId64,
+ ts->id, nseek.frame->time);
/* File changed (close) */
if (nseek.file != seek->file)
nseek.file->roff = nseek.frame->pos;
else
nseek.file->roff = req_time > last_time ? nseek.file->size : 0;
- tvhtrace("timeshift", "do skip seek->file %p roff %"PRId64,
+ tvhtrace(LS_TIMESHIFT, "do skip seek->file %p roff %"PRId64,
nseek.file, (int64_t)nseek.file->roff);
}
/* Open file */
if (tsf->rfd < 0 && !tsf->ram) {
tsf->rfd = tvh_open(tsf->path, O_RDONLY, 0);
- tvhtrace("timeshift", "ts %d open file %s (fd %i)", ts->id, tsf->path, tsf->rfd);
+ tvhtrace(LS_TIMESHIFT, "ts %d open file %s (fd %i)", ts->id, tsf->path, tsf->rfd);
if (tsf->rfd < 0)
return -1;
}
if (tsf->rfd >= 0)
if ((off = lseek(tsf->rfd, tsf->roff, SEEK_SET)) != tsf->roff)
- tvherror("timeshift", "ts %d seek to %s failed (off %"PRId64" != %"PRId64"): %s",
+ tvherror(LS_TIMESHIFT, "ts %d seek to %s failed (off %"PRId64" != %"PRId64"): %s",
ts->id, tsf->path, (int64_t)tsf->roff, (int64_t)off, strerror(errno));
/* Read msg */
if (r < 0) {
streaming_message_t *e = streaming_msg_create_code(SMT_STOP, SM_CODE_UNDEFINED_ERROR);
streaming_target_deliver2(ts->output, e);
- tvhtrace("timeshift", "ts %d seek to %jd (woff %jd) (fd %i)", ts->id, (intmax_t)off, (intmax_t)tsf->woff, tsf->rfd);
- tvhlog(LOG_ERR, "timeshift", "ts %d could not read buffer", ts->id);
+ tvhtrace(LS_TIMESHIFT, "ts %d seek to %jd (woff %jd) (fd %i)", ts->id, (intmax_t)off, (intmax_t)tsf->woff, tsf->rfd);
+ tvherror(LS_TIMESHIFT, "ts %d could not read buffer", ts->id);
return -1;
}
- tvhtrace("timeshift", "ts %d seek to %jd (fd %i) read msg %p/%"PRId64" (%"PRId64")",
+ tvhtrace(LS_TIMESHIFT, "ts %d seek to %jd (fd %i) read msg %p/%"PRId64" (%"PRId64")",
ts->id, (intmax_t)off, tsf->rfd, *sm, *sm ? (*sm)->sm_time : -1, (int64_t)r);
/* Special case - EOF */
_read_close(seek);
_seek_set_file(seek, timeshift_filemgr_next(tsf, NULL, 0), 0);
*wait = 0;
- tvhtrace("timeshift", "ts %d eof, seek->file %p (prev %p)", ts->id, seek->file, tsf);
+ tvhtrace(LS_TIMESHIFT, "ts %d eof, seek->file %p (prev %p)", ts->id, seek->file, tsf);
timeshift_filemgr_dump(ts);
}
}
current_time = end;
}
status->full = ts->full;
- tvhtrace("timeshift", "ts %d status start %"PRId64" end %"PRId64
+ tvhtrace(LS_TIMESHIFT, "ts %d status start %"PRId64" end %"PRId64
" current %"PRId64" state %d",
ts->id, start, end, current_time, ts->state);
status->shift = ts_rescale_inv(end - current_time, 1000000);
/* Exit */
if (ctrl->sm_type == SMT_EXIT) {
- tvhtrace("timeshift", "ts %d read exit request", ts->id);
+ tvhtrace(LS_TIMESHIFT, "ts %d read exit request", ts->id);
run = 0;
streaming_msg_free(ctrl);
ctrl = NULL;
/* Reject */
if (speed >= 100) {
- tvhlog(LOG_DEBUG, "timeshift", "ts %d reject 1x+ in live mode",
- ts->id);
+ tvhdebug(LS_TIMESHIFT, "ts %d reject 1x+ in live mode", ts->id);
speed = 100;
/* Set position */
} else {
- tvhlog(LOG_DEBUG, "timeshift", "ts %d enter timeshift mode",
- ts->id);
+ tvhdebug(LS_TIMESHIFT, "ts %d enter timeshift mode", ts->id);
ts->dobuf = 1;
_seek_reset(seek);
tmp_file = timeshift_filemgr_newest(ts);
/* Check keyframe mode */
keyframe = (speed < 0) || (speed > 400);
if (keyframe != keyframe_mode) {
- tvhlog(LOG_DEBUG, "timeshift", "using keyframe mode? %s",
- keyframe ? "yes" : "no");
+ tvhdebug(LS_TIMESHIFT, "using keyframe mode? %s", keyframe ? "yes" : "no");
keyframe_mode = keyframe;
if (keyframe)
seek->frame = NULL;
/* Update */
if (speed != 100 || state != TS_LIVE) {
ts->state = speed == 0 ? TS_PAUSE : TS_PLAY;
- tvhtrace("timeshift", "reader - set %s", speed == 0 ? "TS_PAUSE" : "TS_PLAY");
+ tvhtrace(LS_TIMESHIFT, "reader - set %s", speed == 0 ? "TS_PAUSE" : "TS_PLAY");
}
if ((ts->state == TS_PLAY && state != TS_PLAY) || (speed != cur_speed)) {
mono_play_time = mono_now;
- tvhtrace("timeshift", "update play time TS_LIVE - %"PRId64" play buffer from %"PRId64,
+ tvhtrace(LS_TIMESHIFT, "update play time TS_LIVE - %"PRId64" play buffer from %"PRId64,
mono_now, pause_time);
if (speed != cur_speed)
pause_time = last_time;
pause_time = last_time;
}
cur_speed = speed;
- tvhlog(LOG_DEBUG, "timeshift", "ts %d change speed %d", ts->id, speed);
+ tvhdebug(LS_TIMESHIFT, "ts %d change speed %d", ts->id, speed);
}
/* Send on the message */
/* Convert */
skip_time = ts_rescale(skip->time, 1000000);
- tvhlog(LOG_DEBUG, "timeshift", "ts %d skip %"PRId64" requested %"PRId64, ts->id, skip_time, skip->time);
+ tvhdebug(LS_TIMESHIFT, "ts %d skip %"PRId64" requested %"PRId64, ts->id, skip_time, skip->time);
/* Live playback (stage1) */
if (ts->state == TS_LIVE) {
/* May have failed */
if (skip->type == SMT_SKIP_REL_TIME)
skip_time += last_time;
- tvhlog(LOG_DEBUG, "timeshift", "ts %d skip time %"PRId64, ts->id, skip_time);
+ tvhdebug(LS_TIMESHIFT, "ts %d skip time %"PRId64, ts->id, skip_time);
/* Live (stage2) */
if (ts->state == TS_LIVE) {
if (skip_time >= ts->buf_time - TIMESHIFT_PLAY_BUF) {
- tvhlog(LOG_DEBUG, "timeshift", "ts %d skip ignored, already live", ts->id);
+ tvhdebug(LS_TIMESHIFT, "ts %d skip ignored, already live", ts->id);
skip = NULL;
} else {
ts->state = TS_PLAY;
ts->dobuf = 1;
- tvhtrace("timeshift", "reader - set TS_PLAY");
+ tvhtrace(LS_TIMESHIFT, "reader - set TS_PLAY");
}
}
end = _timeshift_do_skip(ts, skip_time, last_time, seek);
if (seek->frame) {
pause_time = seek->frame->time;
- tvhtrace("timeshift", "ts %d skip - play buffer from %"PRId64" last_time %"PRId64,
+ tvhtrace(LS_TIMESHIFT, "ts %d skip - play buffer from %"PRId64" last_time %"PRId64,
ts->id, pause_time, last_time);
/* Adjust time */
if (mono_play_time != mono_now)
- tvhtrace("timeshift", "ts %d update play time skip - %"PRId64, ts->id, mono_now);
+ tvhtrace(LS_TIMESHIFT, "ts %d update play time skip - %"PRId64, ts->id, mono_now);
mono_play_time = mono_now;
/* Clear existing packet */
}
break;
default:
- tvhlog(LOG_ERR, "timeshift", "ts %d invalid/unsupported skip type: %d", ts->id, skip->type);
+ tvherror(LS_TIMESHIFT, "ts %d invalid/unsupported skip type: %d", ts->id, skip->type);
skip = NULL;
break;
}
deliver0 = (mono_now - mono_play_time) + TIMESHIFT_PLAY_BUF;
deliver = (deliver0 * cur_speed) / 100;
deliver = (deliver + pause_time);
- tvhtrace("timeshift", "speed %d now %"PRId64" play_time %"PRId64" deliver %"PRId64" deliver0 %"PRId64,
+ tvhtrace(LS_TIMESHIFT, "speed %d now %"PRId64" play_time %"PRId64" deliver %"PRId64" deliver0 %"PRId64,
cur_speed, mono_now, mono_play_time, deliver, deliver0);
/* Determine next packet */
/* Status message */
skip->time = ts_rescale_inv(sm->sm_time, 1000000);
skip->type = SMT_SKIP_ABS_TIME;
- tvhlog(LOG_DEBUG, "timeshift", "ts %d skip to pts %"PRId64" ok", ts->id, sm->sm_time);
+ tvhdebug(LS_TIMESHIFT, "ts %d skip to pts %"PRId64" ok", ts->id, sm->sm_time);
/* Update timeshift status */
timeshift_fill_status(ts, &skip->timeshift, sm->sm_time);
mono_last_status = mono_now;
/* Report error */
skip->type = SMT_SKIP_ERROR;
skip = NULL;
- tvhlog(LOG_DEBUG, "timeshift", "ts %d skip failed (%d)", ts->id, sm ? sm->sm_type : -1);
+ tvhdebug(LS_TIMESHIFT, "ts %d skip failed (%d)", ts->id, sm ? sm->sm_type : -1);
}
streaming_target_deliver2(ts->output, ctrl);
} else {
else
wait = (deliver - sm->sm_time) / 1000;
if (wait == 0) wait = 1;
- tvhtrace("timeshift", "ts %d wait %d speed %d sm_time %"PRId64" deliver %"PRId64,
+ tvhtrace(LS_TIMESHIFT, "ts %d wait %d speed %d sm_time %"PRId64" deliver %"PRId64,
ts->id, wait, cur_speed, sm->sm_time, deliver);
}
/* Back to live (unless buffer is full) */
if ((end == 1 && !ts->full) || !seek->file) {
- tvhlog(LOG_DEBUG, "timeshift", "ts %d eob revert to live mode", ts->id);
+ tvhdebug(LS_TIMESHIFT, "ts %d eob revert to live mode", ts->id);
cur_speed = 100;
ctrl = streaming_msg_create_code(SMT_SPEED, cur_speed);
streaming_target_deliver2(ts->output, ctrl);
ctrl = NULL;
- tvhtrace("timeshift", "reader - set TS_LIVE");
+ tvhtrace(LS_TIMESHIFT, "reader - set TS_LIVE");
/* Flush timeshift buffer to live */
if (_timeshift_flush_to_live(ts, seek, &wait) == -1) {
} else {
if (cur_speed <= 0) {
cur_speed = 0;
- tvhtrace("timeshift", "reader - set TS_PAUSE");
+ tvhtrace(LS_TIMESHIFT, "reader - set TS_PAUSE");
ts->state = TS_PAUSE;
} else {
cur_speed = 100;
- tvhtrace("timeshift", "reader - set TS_PLAY");
+ tvhtrace(LS_TIMESHIFT, "reader - set TS_PLAY");
if (ts->state != TS_PLAY) {
ts->state = TS_PLAY;
ts->dobuf = 1;
if (mono_play_time != mono_now)
- tvhtrace("timeshift", "update play time (pause) - %"PRId64, mono_now);
+ tvhtrace(LS_TIMESHIFT, "update play time (pause) - %"PRId64, mono_now);
mono_play_time = mono_now;
}
}
- tvhlog(LOG_DEBUG, "timeshift", "ts %d sob speed %d last time %"PRId64, ts->id, cur_speed, last_time);
+ tvhdebug(LS_TIMESHIFT, "ts %d sob speed %d last time %"PRId64, ts->id, cur_speed, last_time);
pause_time = last_time;
ctrl = streaming_msg_create_code(SMT_SPEED, cur_speed);
streaming_target_deliver2(ts->output, ctrl);
_read_close(seek);
if (sm) streaming_msg_free(sm);
if (ctrl) streaming_msg_free(ctrl);
- tvhtrace("timeshift", "ts %d exit reader thread", ts->id);
+ tvhtrace(LS_TIMESHIFT, "ts %d exit reader thread", ts->id);
return NULL;
}
alloc = MAX(count, 4*1024*1024);
ram = realloc(tsf->ram, tsf->ram_size + alloc);
if (ram == NULL) {
- tvhwarn("timeshift", "RAM timeshift memalloc failed");
+ tvhwarn(LS_TIMESHIFT, "RAM timeshift memalloc failed");
pthread_mutex_unlock(&tsf->ram_lock);
return -1;
}
#endif
const char *reason = NULL;
- tvhlog_spawn(LOG_ALERT, "CRASH", "Signal: %d in %s ", sig, line1);
+ tvhlog_spawn(LOG_ALERT, LS_CRASH, "Signal: %d in %s ", sig, line1);
switch(sig) {
case SIGSEGV:
break;
}
- tvhlog_spawn(LOG_ALERT, "CRASH", "Fault address %p (%s)",
+ tvhlog_spawn(LOG_ALERT, LS_CRASH, "Fault address %p (%s)",
si->si_addr, reason ?: "N/A");
- tvhlog_spawn(LOG_ALERT, "CRASH", "Loaded libraries: %s ", libs);
+ tvhlog_spawn(LOG_ALERT, LS_CRASH, "Loaded libraries: %s ", libs);
#ifdef NGREG
snprintf(tmpbuf, sizeof(tmpbuf), "Register dump [%d]: ", (int)NGREG);
sappend(tmpbuf, sizeof(tmpbuf), "%016" PRIx64, uc->uc_mcontext.gregs[i]);
}
#endif
- tvhlog_spawn(LOG_ALERT, "CRASH", "%s", tmpbuf);
+ tvhlog_spawn(LOG_ALERT, LS_CRASH, "%s", tmpbuf);
#if ENABLE_EXECINFO
- tvhlog_spawn(LOG_ALERT, "CRASH", "STACKTRACE");
+ tvhlog_spawn(LOG_ALERT, LS_CRASH, "STACKTRACE");
for(i = 0; i < nframes; i++) {
if(dladdr(frames[i], &dli)) {
if(dli.dli_sname != NULL && dli.dli_saddr != NULL) {
- tvhlog_spawn(LOG_ALERT, "CRASH", "%s+0x%tx (%s)",
+ tvhlog_spawn(LOG_ALERT, LS_CRASH, "%s+0x%tx (%s)",
dli.dli_sname,
frames[i] - dli.dli_saddr,
dli.dli_fname);
}
if(self[0] && !add2lineresolve(self, frames[i], buf, sizeof(buf))) {
- tvhlog_spawn(LOG_ALERT, "CRASH", "%s %p", buf, frames[i]);
+ tvhlog_spawn(LOG_ALERT, LS_CRASH, "%s %p", buf, frames[i]);
continue;
}
if(dli.dli_fname != NULL && dli.dli_fbase != NULL) {
- tvhlog_spawn(LOG_ALERT, "CRASH", "%s %p",
+ tvhlog_spawn(LOG_ALERT, LS_CRASH, "%s %p",
dli.dli_fname,
frames[i]);
continue;
}
- tvhlog_spawn(LOG_ALERT, "CRASH", "%p", frames[i]);
+ tvhlog_spawn(LOG_ALERT, LS_CRASH, "%p", frames[i]);
}
}
#endif
char *md5sum ( const char *str, int lowercase );
-int makedirs ( const char *subsys, const char *path, int mode, int mstrict, gid_t gid, uid_t uid );
+int makedirs ( int subsys, const char *path, int mode, int mstrict, gid_t gid, uid_t uid );
int rmtree ( const char *path );
{"TRACE", "\033[32m"},
};
+struct logsubsystxt {
+ const char *name;
+ const char *desc;
+};
+
+static struct logsubsystxt logsubsys[] = {
+ [LS_NONE] = { "<none>", N_("None") },
+ [LS_START] = { "START", N_("START") },
+ [LS_STOP] = { "STOP", N_("STOP") },
+ [LS_CRASH] = { "CRASH", N_("CRASH") },
+ [LS_CPU] = { "CPU", N_("CPU") },
+ [LS_MAIN] = { "main", N_("Main") },
+ [LS_GTIMER] = { "gtimer", N_("Global timer") },
+ [LS_MTIMER] = { "mtimer", N_("Monitonic timer") },
+ [LS_THREAD] = { "thread", N_("Thread") },
+ [LS_TVHPOLL] = { "tvhpoll", N_("Poll multiplexer") },
+ [LS_TIME] = { "time", N_("Time") },
+ [LS_SPAWN] = { "spawn", N_("Spawn") },
+ [LS_FSMONITOR] = { "fsmonitor", N_("Filesystem monitor") },
+ [LS_LOCK] = { "lock", N_("Locking") },
+ [LS_UUID] = { "uuid", N_("UUID") },
+ [LS_IDNODE] = { "idnode", N_("Node subsystem") },
+ [LS_URL] = { "url", N_("URL") },
+ [LS_TCP] = { "tcp", N_("TCP Protocol") },
+ [LS_RTSP] = { "rtsp", N_("RTSP Protocol") },
+ [LS_UPNP] = { "upnp", N_("UPnP Protocol") },
+ [LS_SETTINGS] = { "settings", N_("Settings") },
+ [LS_CONFIG] = { "config", N_("Configuration") },
+ [LS_ACCESS] = { "access", N_("Access (ACL)") },
+ [LS_CRON] = { "cron", N_("Cron") },
+ [LS_DBUS] = { "dbus", N_("DBUS") },
+ [LS_AVAHI] = { "avahi", N_("Avahi") },
+ [LS_BONJOUR] = { "bonjour", N_("Bonjour") },
+ [LS_API] = { "api", N_("API") },
+ [LS_HTTP] = { "http", N_("HTTP Server") },
+ [LS_HTTPC] = { "httpc", N_("HTTP Client") },
+ [LS_HTSP] = { "htsp", N_("HTSP Server") },
+ [LS_HTSP_SUB] = { "htsp-sub", N_("HTSP Subscription") },
+ [LS_HTSP_REQ] = { "htsp-req", N_("HTSP Request") },
+ [LS_HTSP_ANS] = { "htsp-ans", N_("HTSP Answer") },
+ [LS_IMAGECACHE] = { "imagecache", N_("Image Cache") },
+ [LS_TBL] = { "tbl", N_("DVB SI Tables") },
+ [LS_TBL_BASE] = { "tbl-base", N_("Base DVB SI Tables (PAT,CAT,PMT,SDT etc.)") },
+ [LS_TBL_CSA] = { "tbl-csa", N_("DVB CSA (descrambling) Tables") },
+ [LS_TBL_EIT] = { "tbl-eit", N_("DVB EPG Tables") },
+ [LS_TBL_TIME] = { "tbl-time", N_("DVB Time Tables") },
+ [LS_TBL_ATSC] = { "tbl-atsc", N_("ATSC SI Tables") },
+ [LS_TBL_PASS] = { "tbl-pass", N_("Passthrough Muxer SI Tables") },
+ [LS_TBL_SATIP] = { "tbl-satip", N_("SAT>IP Server SI Tables") },
+ [LS_FASTSCAN] = { "fastscan", N_("Fastscan DVB") },
+ [LS_PARSER] = { "parser", N_("MPEG-TS Parser") },
+ [LS_TS] = { "TS", N_("Transport Stream") },
+ [LS_GLOBALHEADERS] = { "globalheaders", N_("Global Headers") },
+ [LS_TSFIX] = { "tsfix", N_("Time Stamp Fix") },
+ [LS_HEVC] = { "hevc", N_("HEVC - H.265") },
+ [LS_MUXER] = { "muxer", N_("Muxer") },
+ [LS_PASS] = { "pass", N_("Pass-thru muxer") },
+ [LS_MKV] = { "mkv", N_("Matroska muxer") },
+ [LS_SERVICE] = { "service", N_("Service") },
+ [LS_CHANNEL] = { "channel", N_("Channel") },
+ [LS_SUBSCRIPTION] = { "subscription", N_("Subscription") },
+ [LS_SERVICE_MAPPER]= { "service-mapper",N_("Service Mapper") },
+ [LS_BOUQUET] = { "bouquet", N_("Bouquet") },
+ [LS_ESFILTER] = { "esfilter", N_("Elementary Stream Filter") },
+ [LS_PROFILE] = { "profile", N_("Streaming Profile") },
+ [LS_DESCRAMBLER] = { "descrambler", N_("Descrambler") },
+ [LS_CACLIENT] = { "caclient", N_("CA (descrambling) Client") },
+ [LS_CSA] = { "csa", N_("CSA (descrambling)") },
+ [LS_CAPMT] = { "capmt", N_("CAPMT CA Client") },
+ [LS_CWC] = { "cwc", N_("CWC CA Client") },
+ [LS_DVR] = { "dvr", N_("Digital Video Recorder") },
+ [LS_EPG] = { "epg", N_("Electronic Program Guide") },
+ [LS_EPGDB] = { "epgdb", N_("EPG Database") },
+ [LS_EPGGRAB] = { "epggrab", N_("EPG Grabber") },
+ [LS_CHARSET] = { "charset", N_("Charset") },
+ [LS_DVB] = { "dvb", N_("DVB") },
+ [LS_MPEGTS] = { "mpegts", N_("MPEG-TS") },
+ [LS_MUXSCHED] = { "muxsched", N_("Mux Scheduler") },
+ [LS_LIBAV] = { "libav", N_("libav / ffmpeg") },
+ [LS_TRANSCODE] = { "transcode", N_("Transcode") },
+ [LS_IPTV] = { "iptv", N_("IPTV") },
+ [LS_IPTV_PCR] = { "iptv-pcr", N_("IPTV PCR") },
+ [LS_LINUXDVB] = { "linuxdvb", N_("LinuxDVB Input") },
+ [LS_DISEQC] = { "diseqc", N_("DiseqC") },
+ [LS_EN50221] = { "en50221", N_("CI Module") },
+ [LS_EN50494] = { "en50494", N_("Unicable (EN50494)") },
+ [LS_SATIP] = { "satip", N_("SAT>IP Client") },
+ [LS_SATIPS] = { "satips", N_("SAT>IP Server") },
+ [LS_TVHDHOMERUN] = { "tvhdhomerun", N_("TVHDHomeRun Client") },
+ [LS_PSIP] = { "psip", N_("ATSC PSIP EPG") },
+ [LS_OPENTV] = { "opentv", N_("OpenTV EPG") },
+ [LS_PYEPG] = { "pyepg", N_("PyEPG Import") },
+ [LS_XMLTV] = { "xmltv", N_("XMLTV EPG Import") },
+ [LS_WEBUI] = { "webui", N_("Web User Interface") },
+ [LS_TIMESHIFT] = { "timeshift", N_("Timeshift") },
+ [LS_SCANFILE] = { "scanfile", N_("Scanfile") },
+ [LS_TSFILE] = { "tsfile", N_("MPEG-TS File") },
+};
+
static void
tvhlog_get_subsys ( htsmsg_t *ss, char *subsys, size_t len )
{
}
void tvhlogv ( const char *file, int line, int severity,
- const char *subsys, const char *fmt, va_list *args )
+ int subsys, const char *fmt, va_list *args )
{
int ok, options, notify;
size_t l;
if (severity <= atomic_get(&tvhlog_level)) {
if (tvhlog_trace) {
ok = htsmsg_get_u32_or_default(tvhlog_trace, "all", 0);
- ok = htsmsg_get_u32_or_default(tvhlog_trace, subsys, ok);
+ ok = htsmsg_get_u32_or_default(tvhlog_trace, logsubsys[subsys].name, ok);
}
if (!ok && severity == LOG_DEBUG && tvhlog_debug) {
ok = htsmsg_get_u32_or_default(tvhlog_debug, "all", 0);
- ok = htsmsg_get_u32_or_default(tvhlog_debug, subsys, ok);
+ ok = htsmsg_get_u32_or_default(tvhlog_debug, logsubsys[subsys].name, ok);
}
}
} else {
if (options & TVHLOG_OPT_THREAD) {
tvh_strlcatf(buf, sizeof(buf), l, "tid %ld: ", (long)pthread_self());
}
- tvh_strlcatf(buf, sizeof(buf), l, "%s: ", subsys);
+ tvh_strlcatf(buf, sizeof(buf), l, "%s: ", logsubsys[subsys].name);
if (options & TVHLOG_OPT_FILELINE && severity >= LOG_DEBUG)
tvh_strlcatf(buf, sizeof(buf), l, "(%s:%d) ", file, line);
if (args)
* Map args
*/
void _tvhlog ( const char *file, int line, int severity,
- const char *subsys, const char *fmt, ... )
+ int subsys, const char *fmt, ... )
{
va_list args;
va_start(args, fmt);
#define HEXDUMP_WIDTH 16
void
_tvhlog_hexdump(const char *file, int line, int severity,
- const char *subsys, const uint8_t *data, ssize_t len )
+ int subsys, const uint8_t *data, ssize_t len )
{
int i, c;
char str[1024];
void tvhlog_set_trace ( const char *subsys );
void tvhlog_get_trace ( char *subsys, size_t len );
void tvhlogv ( const char *file, int line, int severity,
- const char *subsys, const char *fmt, va_list *args );
+ int subsys, const char *fmt, va_list *args );
void _tvhlog ( const char *file, int line, int severity,
- const char *subsys, const char *fmt, ... )
+ int subsys, const char *fmt, ... )
__attribute__((format(printf,5,6)));
void _tvhlog_hexdump ( const char *file, int line, int severity,
- const char *subsys, const uint8_t *data, ssize_t len );
+ int subsys, const uint8_t *data, ssize_t len );
static inline void tvhlog_limit_reset ( tvhlog_limit_t *limit )
{ limit->last = 0; limit->count = 0; }
static inline int tvhlog_limit ( tvhlog_limit_t *limit, uint32_t delay )
#define LOG_TVH_NOTIFY 0x40000000
+/* Subsystems */
+enum {
+ LS_NONE,
+ LS_START,
+ LS_STOP,
+ LS_CRASH,
+ LS_MAIN,
+ LS_GTIMER,
+ LS_MTIMER,
+ LS_CPU,
+ LS_THREAD,
+ LS_TVHPOLL,
+ LS_TIME,
+ LS_SPAWN,
+ LS_FSMONITOR,
+ LS_LOCK,
+ LS_UUID,
+ LS_IDNODE,
+ LS_URL,
+ LS_TCP,
+ LS_RTSP,
+ LS_UPNP,
+ LS_SETTINGS,
+ LS_CONFIG,
+ LS_ACCESS,
+ LS_CRON,
+ LS_DBUS,
+ LS_AVAHI,
+ LS_BONJOUR,
+ LS_API,
+ LS_HTTP,
+ LS_HTTPC,
+ LS_HTSP,
+ LS_HTSP_SUB,
+ LS_HTSP_REQ,
+ LS_HTSP_ANS,
+ LS_IMAGECACHE,
+ LS_TBL,
+ LS_TBL_BASE,
+ LS_TBL_CSA,
+ LS_TBL_EIT,
+ LS_TBL_TIME,
+ LS_TBL_ATSC,
+ LS_TBL_PASS,
+ LS_TBL_SATIP,
+ LS_FASTSCAN,
+ LS_PARSER,
+ LS_TS,
+ LS_GLOBALHEADERS,
+ LS_TSFIX,
+ LS_HEVC,
+ LS_MUXER,
+ LS_PASS,
+ LS_MKV,
+ LS_SERVICE,
+ LS_CHANNEL,
+ LS_SUBSCRIPTION,
+ LS_SERVICE_MAPPER,
+ LS_BOUQUET,
+ LS_ESFILTER,
+ LS_PROFILE,
+ LS_DESCRAMBLER,
+ LS_CACLIENT,
+ LS_CSA,
+ LS_CAPMT,
+ LS_CWC,
+ LS_DVR,
+ LS_EPG,
+ LS_EPGDB,
+ LS_EPGGRAB,
+ LS_CHARSET,
+ LS_DVB,
+ LS_MPEGTS,
+ LS_MUXSCHED,
+ LS_LIBAV,
+ LS_TRANSCODE,
+ LS_IPTV,
+ LS_IPTV_PCR,
+ LS_LINUXDVB,
+ LS_DISEQC,
+ LS_EN50221,
+ LS_EN50494,
+ LS_SATIP,
+ LS_SATIPS,
+ LS_TVHDHOMERUN,
+ LS_PSIP,
+ LS_OPENTV,
+ LS_PYEPG,
+ LS_XMLTV,
+ LS_WEBUI,
+ LS_TIMESHIFT,
+ LS_SCANFILE,
+ LS_TSFILE
+};
+
/* Macros */
#define tvhlog(severity, subsys, fmt, ...)\
_tvhlog(__FILE__, __LINE__, severity | LOG_TVH_NOTIFY, subsys, fmt, ##__VA_ARGS__)
int fd;
#if ENABLE_EPOLL
if ((fd = epoll_create1(EPOLL_CLOEXEC)) < 0) {
- tvhlog(LOG_ERR, "tvhpoll", "failed to create epoll [%s]",
- strerror(errno));
+ tvherror(LS_TVHPOLL, "failed to create epoll [%s]", strerror(errno));
return NULL;
}
#elif ENABLE_KQUEUE
if ((fd = kqueue()) == -1) {
- tvhlog(LOG_ERR, "tvhpoll", "failed to create kqueue [%s]",
- strerror(errno));
+ tvherror(LS_TVHPOLL, "failed to create kqueue [%s]", strerror(errno));
return NULL;
}
#else
EV_SET(tp->ev+i, evs[i].fd, EVFILT_WRITE, EV_ADD, 0, 0, (intptr_t*)evs[i].data.u64);
rc = kevent(tp->fd, tp->ev+i, 1, NULL, 0, NULL);
if (rc == -1) {
- tvhlog(LOG_ERR, "tvhpoll", "failed to add kqueue WRITE filter [%d|%d]",
+ tvherror(LS_TVHPOLL, "failed to add kqueue WRITE filter [%d|%d]",
evs[i].fd, rc);
return -1;
}
EV_SET(tp->ev+i, evs[i].fd, EVFILT_READ, EV_ADD, 0, 0, (intptr_t*)evs[i].data.u64);
rc = kevent(tp->fd, tp->ev+i, 1, NULL, 0, NULL);
if (rc == -1) {
- tvhlog(LOG_ERR, "tvhpoll", "failed to add kqueue READ filter [%d|%d]",
- evs[i].fd, rc);
+ tvherror(LS_TVHPOLL, "failed to add kqueue READ filter [%d|%d]", evs[i].fd, rc);
return -1;
}
}
localtime_r(&utc, &tm);
- tvhtrace("time", "%s - current time is %04d/%02d/%02d %02d:%02d:%02d",
+ tvhtrace(LS_TIME, "%s - current time is %04d/%02d/%02d %02d:%02d:%02d",
srcname,
tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);
if ((diff = llabs(t2 - t1)) > config.tvhtime_tolerance) {
#if ENABLE_STIME
if (stime(&utc) < 0)
- tvherror("time", "%s - unable to update system time: %s", srcname, strerror(errno));
+ tvherror(LS_TIME, "%s - unable to update system time: %s", srcname, strerror(errno));
else
- tvhdebug("time", "%s - updated system clock", srcname);
+ tvhdebug(LS_TIME, "%s - updated system clock", srcname);
#else
- tvhnotice("time", "%s - stime(2) not implemented", srcname);
+ tvhnotice(LS_TIME, "%s - stime(2) not implemented", srcname);
#endif
} else {
- tvhwarn("time", "%s - time not updated (diff %"PRId64")", srcname, diff);
+ tvhwarn(LS_TIME, "%s - time not updated (diff %"PRId64")", srcname, diff);
}
}
if (!(ntp_shm = ntp_shm_init()))
return;
- tvhtrace("time", "ntp delta = %"PRId64" us\n", t2 - t1);
+ tvhtrace(LS_TIME, "ntp delta = %"PRId64" us\n", t2 - t1);
ntp_shm->valid = 0;
ntp_shm->count++;
ntp_shm->clockTimeStampSec = utc;
}
udp_connection_t *
-udp_bind ( const char *subsystem, const char *name,
+udp_bind ( int subsystem, const char *name,
const char *bindaddr, int port,
const char *ifname, int rxsize, int txsize )
{
uc->host = bindaddr ? strdup(bindaddr) : NULL;
uc->port = port;
uc->ifname = ifname ? strdup(ifname) : NULL;
- uc->subsystem = subsystem ? strdup(subsystem) : NULL;
+ uc->subsystem = subsystem;
uc->name = name ? strdup(name) : NULL;
uc->rxtxsize = rxsize;
int
udp_bind_double ( udp_connection_t **_u1, udp_connection_t **_u2,
- const char *subsystem, const char *name1,
+ int subsystem, const char *name1,
const char *name2, const char *host, int port,
const char *ifname, int rxsize1, int rxsize2,
int txsize1, int txsize2 )
}
udp_connection_t *
-udp_sendinit ( const char *subsystem, const char *name,
+udp_sendinit ( int subsystem, const char *name,
const char *ifname, int txsize )
{
int fd, ifindex;
uc = calloc(1, sizeof(udp_connection_t));
uc->fd = -1;
uc->ifname = ifname ? strdup(ifname) : NULL;
- uc->subsystem = subsystem ? strdup(subsystem) : NULL;
+ uc->subsystem = subsystem;
uc->name = name ? strdup(name) : NULL;
uc->rxtxsize = txsize;
free(uc->host);
free(uc->peer_host);
free(uc->ifname);
- free(uc->subsystem);
free(uc->name);
free(uc);
}
int peer_multicast;
struct sockaddr_storage peer;
int fd;
- char *subsystem;
+ int subsystem;
char *name;
int rxtxsize;
} udp_connection_t;
udp_connection_t *
-udp_bind ( const char *subsystem, const char *name,
+udp_bind ( int subsystem, const char *name,
const char *bindaddr, int port,
const char *ifname, int rxsize, int txsize );
int
udp_bind_double ( udp_connection_t **_u1, udp_connection_t **_u2,
- const char *subsystem, const char *name1,
+ int subsystem, const char *name1,
const char *name2, const char *host, int port,
const char *ifname, int rxsize1, int rxsize2,
int txsize1, int txsize2 );
udp_connection_t *
-udp_sendinit ( const char *subsystem, const char *name,
+udp_sendinit ( int subsystem, const char *name,
const char *ifname, int txsize );
int
udp_connect ( udp_connection_t *uc, const char *name,
size_t size;
int r, delay_ms;
- multicast = udp_bind("upnp", "upnp_thread_multicast",
+ multicast = udp_bind(LS_UPNP, "upnp_thread_multicast",
"239.255.255.250", 1900,
NULL, 32*1024, 32*1024);
if (multicast == NULL || multicast == UDP_FATAL_ERROR)
goto error;
- unicast = udp_bind("upnp", "upnp_thread_unicast", bindaddr, 0,
+ unicast = udp_bind(LS_UPNP, "upnp_thread_unicast", bindaddr, 0,
NULL, 32*1024, 32*1024);
if (unicast == NULL || unicast == UDP_FATAL_ERROR)
goto error;
if (size > 0 && tvhtrace_enabled()) {
char tbuf[256];
inet_ntop(ip.ss_family, IP_IN_ADDR(ip), tbuf, sizeof(tbuf));
- tvhtrace("upnp", "%s - received data from %s:%hu [size=%zi]",
+ tvhtrace(LS_UPNP, "%s - received data from %s:%hu [size=%zi]",
conn == multicast ? "multicast" : "unicast",
tbuf, (unsigned short) IP_PORT(ip), size);
- tvhlog_hexdump("upnp", buf, size);
+ tvhlog_hexdump(LS_UPNP, buf, size);
}
/* TODO: a filter */
TAILQ_FOREACH(us, &upnp_services, us_link)
if (!urlparse_exp) {
urlparse_exp = calloc(1, sizeof(regex_t));
if (regcomp(urlparse_exp, URL_RE, REG_ICASE | REG_EXTENDED)) {
- tvherror("url", "failed to compile regexp");
+ tvherror(LS_URL, "failed to compile regexp");
exit(1);
}
}
#define FILE_MODE_BITS(x) (x&(S_IRWXU|S_IRWXG|S_IRWXO))
int
-makedirs ( const char *subsys, const char *inpath, int mode,
+makedirs ( int subsys, const char *inpath, int mode,
int mstrict, gid_t gid, uid_t uid )
{
int err, ok;
deferred_unlink_cb(void *s, int dearmed)
{
if (unlink((const char *)s))
- tvherror("main", "unable to remove file '%s'", (const char *)s);
+ tvherror(LS_MAIN, "unable to remove file '%s'", (const char *)s);
free(s);
}
int l;
if (unlink((const char *)du->filename))
- tvherror("main", "unable to remove file '%s'", (const char *)du->filename);
+ tvherror(LS_MAIN, "unable to remove file '%s'", (const char *)du->filename);
/* Remove all directories up to rootdir */
{
fd = tvh_open(RANDOM_PATH, O_RDONLY, 0);
if (fd == -1) {
- tvherror("uuid", "failed to open %s", RANDOM_PATH);
+ tvherror(LS_UUID, "failed to open %s", RANDOM_PATH);
exit(1);
}
}
uuid_random ( uint8_t *buf, size_t bufsize )
{
if (read(fd, buf, bufsize) != bufsize) {
- tvherror("uuid", "random failed: %s", strerror(errno));
+ tvherror(LS_UUID, "random failed: %s", strerror(errno));
exit(1);
}
}
memset(u, 0, sizeof(tvh_uuid_t));
if (str) {
if (strlen(str) != UUID_HEX_SIZE - 1) {
- tvherror("uuid", "wrong uuid size");
+ tvherror(LS_UUID, "wrong uuid size");
return -EINVAL;
}
return hex2bin(u->bin, sizeof(u->bin), str);
} else if (read(fd, u->bin, sizeof(u->bin)) != sizeof(u->bin)) {
- tvherror("uuid", "failed to read from %s", RANDOM_PATH);
+ tvherror(LS_UUID, "failed to read from %s", RANDOM_PATH);
return -EINVAL;
}
return 0;
#ifdef ENABLE_GETLOADAVG
loads = getloadavg (avg, 3);
if (loads == -1) {
- tvhlog(LOG_DEBUG, "webui", "Error getting load average from getloadavg()");
+ tvhdebug(LS_WEBUI, "Error getting load average from getloadavg()");
loads = 0;
/* should we return an error or a 0 on error */
htsbuf_qprintf(hq, "<systemload>0</systemload>\n");
fb_file *fp = fb_open(path, 0, (nogzip || gzip) ? 0 : 1);
if (!fp) {
- tvhlog(LOG_ERR, "webui", "failed to open %s", path);
+ tvherror(LS_WEBUI, "failed to open %s", path);
return HTTP_STATUS_INTERNAL;
}
size = fb_size(fp);
if (r == ETIMEDOUT) {
/* Check socket status */
if (tcp_socket_dead(hc->hc_fd)) {
- tvhlog(LOG_DEBUG, "webui", "Stop streaming %s, client hung up", hc->hc_url_orig);
+ tvhdebug(LS_WEBUI, "Stop streaming %s, client hung up", hc->hc_url_orig);
run = 0;
} else if((!started && mclk() - lastpkt > sec2mono(grace)) ||
(started && ptimeout > 0 && mclk() - lastpkt > sec2mono(ptimeout))) {
- tvhlog(LOG_WARNING, "webui", "Stop streaming %s, timeout waiting for packets", hc->hc_url_orig);
+ tvhwarn(LS_WEBUI, "Stop streaming %s, timeout waiting for packets", hc->hc_url_orig);
run = 0;
}
break;
case SMT_START:
grace = 10;
if(!started) {
- tvhlog(LOG_DEBUG, "webui", "%s streaming %s",
- hc->hc_no_output ? "Probe" : "Start", hc->hc_url_orig);
+ tvhdebug(LS_WEBUI, "%s streaming %s",
+ hc->hc_no_output ? "Probe" : "Start", hc->hc_url_orig);
http_output_content(hc, muxer_mime(mux, sm->sm_data));
if (hc->hc_no_output) {
started = 1;
} else if(muxer_reconfigure(mux, sm->sm_data) < 0) {
- tvhlog(LOG_WARNING, "webui", "Unable to reconfigure stream %s", hc->hc_url_orig);
+ tvhwarn(LS_WEBUI, "Unable to reconfigure stream %s", hc->hc_url_orig);
}
break;
case SMT_STOP:
if(sm->sm_code != SM_CODE_SOURCE_RECONFIGURED) {
- tvhlog(LOG_WARNING, "webui", "Stop streaming %s, %s", hc->hc_url_orig,
- streaming_code2txt(sm->sm_code));
+ tvhwarn(LS_WEBUI, "Stop streaming %s, %s", hc->hc_url_orig,
+ streaming_code2txt(sm->sm_code));
run = 0;
}
break;
case SMT_SERVICE_STATUS:
if(tcp_socket_dead(hc->hc_fd)) {
- tvhlog(LOG_DEBUG, "webui", "Stop streaming %s, client hung up",
- hc->hc_url_orig);
+ tvhdebug(LS_WEBUI, "Stop streaming %s, client hung up",
+ hc->hc_url_orig);
run = 0;
} else if((!started && mclk() - lastpkt > sec2mono(grace)) ||
(started && ptimeout > 0 && mclk() - lastpkt > sec2mono(ptimeout))) {
- tvhlog(LOG_WARNING, "webui", "Stop streaming %s, timeout waiting for packets", hc->hc_url_orig);
+ tvhwarn(LS_WEBUI, "Stop streaming %s, timeout waiting for packets", hc->hc_url_orig);
run = 0;
}
break;
break;
case SMT_NOSTART:
- tvhlog(LOG_WARNING, "webui", "Couldn't start streaming %s, %s",
- hc->hc_url_orig, streaming_code2txt(sm->sm_code));
+ tvhwarn(LS_WEBUI, "Couldn't start streaming %s, %s",
+ hc->hc_url_orig, streaming_code2txt(sm->sm_code));
run = 0;
break;
case SMT_EXIT:
- tvhlog(LOG_WARNING, "webui", "Stop streaming %s, %s", hc->hc_url_orig,
- streaming_code2txt(sm->sm_code));
+ tvhwarn(LS_WEBUI, "Stop streaming %s, %s", hc->hc_url_orig,
+ streaming_code2txt(sm->sm_code));
run = 0;
break;
}
if(mux->m_errors) {
if (!mux->m_eos)
- tvhlog(LOG_WARNING, "webui", "Stop streaming %s, muxer reported errors", hc->hc_url_orig);
+ tvhwarn(LS_WEBUI, "Stop streaming %s, muxer reported errors", hc->hc_url_orig);
run = 0;
}
}
webui_xspf = xspf;
if (tvheadend_webui_debug)
- tvhlog(LOG_INFO, "webui", "Running web interface in debug mode");
+ tvhinfo(LS_WEBUI, "Running web interface in debug mode");
s = tvheadend_webroot;
tvheadend_webroot = NULL;
signal(SIGQUIT, doquit);
/* Run */
- tvhtrace("thread", "created thread %ld [%s / %p(%p)]",
+ tvhtrace(LS_THREAD, "created thread %ld [%s / %p(%p)]",
(long)pthread_self(), ts->name, ts->run, ts->arg);
void *r = ts->run(ts->arg);
free(ts);