aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libdvbv5/dvb-scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libdvbv5/dvb-scan.c')
-rw-r--r--lib/libdvbv5/dvb-scan.c71
1 files changed, 42 insertions, 29 deletions
diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c
index c0ede6bd..ba569340 100644
--- a/lib/libdvbv5/dvb-scan.c
+++ b/lib/libdvbv5/dvb-scan.c
@@ -62,6 +62,19 @@
#include <libdvbv5/desc_t2_delivery.h>
#include <libdvbv5/desc_sat.h>
+#include <config.h>
+
+#ifdef ENABLE_NLS
+# include "gettext.h"
+# include <libintl.h>
+# define _(string) dgettext(LIBDVBV5_DOMAIN, string)
+
+#else
+# define _(string) string
+#endif
+
+# define N_(string) string
+
static int dvb_poll(struct dvb_v5_fe_parms_priv *parms, int fd, unsigned int seconds)
{
fd_set set;
@@ -139,14 +152,14 @@ static int dvb_parse_section_alloc(struct dvb_v5_fe_parms_priv *parms,
struct dvb_table_filter_priv *priv;
if (!sect->table) {
- dvb_logerr("%s: table memory pointer not filled",
+ dvb_logerr(_("%s: table memory pointer not filled"),
__func__);
return -4;
}
*sect->table = NULL;
priv = calloc(sizeof(struct dvb_table_filter_priv), 1);
if (!priv) {
- dvb_logerr("%s: out of memory", __func__);
+ dvb_logerr(_("%s: out of memory"), __func__);
return -1;
}
priv->last_section = -1;
@@ -177,11 +190,11 @@ static int dvb_parse_section(struct dvb_v5_fe_parms_priv *parms,
dvb_table_header_init(&h);
if (parms->p.verbose)
- dvb_log("%s: received table 0x%02x, TS ID 0x%04x, section %d/%d",
+ dvb_log(_("%s: received table 0x%02x, TS ID 0x%04x, section %d/%d"),
__func__, h.table_id, h.id, h.section_id, h.last_section);
if (sect->tid != h.table_id) {
- dvb_logdbg("%s: couldn't match ID %d at the active section filters",
+ dvb_logdbg(_("%s: couldn't match ID %d at the active section filters"),
__func__, h.table_id);
return -1;
}
@@ -202,7 +215,7 @@ static int dvb_parse_section(struct dvb_v5_fe_parms_priv *parms,
/* tables like EIT can increment sections by gaps > 1.
* in this case, reading is done when a already read
* table is reached. */
- dvb_log("%s: section repeated, reading done", __func__);
+ dvb_log(_("%s: section repeated, reading done"), __func__);
priv->done = 1;
return 1;
}
@@ -224,7 +237,7 @@ static int dvb_parse_section(struct dvb_v5_fe_parms_priv *parms,
buf_length - DVB_CRC_SIZE,
sect->table);
else
- dvb_logerr("%s: no initializer for table %d",
+ dvb_logerr(_("%s: no initializer for table %d"),
__func__, tid);
if (!sect->allow_section_gaps && sect->ts_id == -1 &&
@@ -258,12 +271,12 @@ int dvb_read_sections(struct dvb_v5_fe_parms *__p, int dmx_fd,
return -1;
}
if (parms->p.verbose)
- dvb_log("%s: waiting for table ID 0x%02x, program ID 0x%02x",
+ dvb_log(_("%s: waiting for table ID 0x%02x, program ID 0x%02x"),
__func__, sect->tid, sect->pid);
buf = calloc(DVB_MAX_PAYLOAD_PACKET_SIZE, 1);
if (!buf) {
- dvb_logerr("%s: out of memory", __func__);
+ dvb_logerr(_("%s: out of memory"), __func__);
dvb_dmx_stop(dmx_fd);
dvb_table_filter_free(sect);
return -1;
@@ -284,26 +297,26 @@ int dvb_read_sections(struct dvb_v5_fe_parms *__p, int dmx_fd,
break;
}
if (available <= 0) {
- dvb_logerr("%s: no data read on section filter", __func__);
+ dvb_logerr(_("%s: no data read on section filter"), __func__);
ret = -1;
break;
}
buf_length = read(dmx_fd, buf, DVB_MAX_PAYLOAD_PACKET_SIZE);
if (!buf_length) {
- dvb_logerr("%s: buf returned an empty buffer", __func__);
+ dvb_logerr(_("%s: buf returned an empty buffer"), __func__);
ret = -1;
break;
}
if (buf_length < 0) {
- dvb_perror("dvb_read_section: read error");
+ dvb_perror(_("dvb_read_section: read error"));
ret = -2;
break;
}
crc = dvb_crc32(buf, buf_length, 0xFFFFFFFF);
if (crc != 0) {
- dvb_logerr("%s: crc error", __func__);
+ dvb_logerr(_("%s: crc error"), __func__);
ret = -3;
break;
}
@@ -443,7 +456,7 @@ struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p,
if (parms->p.abort)
return dvb_scan_handler;
if (rc < 0) {
- dvb_logerr("error while waiting for PAT table");
+ dvb_logerr(_("error while waiting for PAT table"));
dvb_scan_free_handler_table(dvb_scan_handler);
return NULL;
}
@@ -459,7 +472,7 @@ struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p,
if (parms->p.abort)
return dvb_scan_handler;
if (rc < 0)
- dvb_logerr("error while waiting for VCT table");
+ dvb_logerr(_("error while waiting for VCT table"));
else if (parms->p.verbose)
atsc_table_vct_print(&parms->p, dvb_scan_handler->vct);
}
@@ -473,13 +486,13 @@ struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p,
if (!program->service_id) {
if (parms->p.verbose)
- dvb_log("Program #%d is network PID: 0x%04x",
+ dvb_log(_("Program #%d is network PID: 0x%04x"),
num_pmt, program->pid);
num_pmt++;
continue;
}
if (parms->p.verbose)
- dvb_log("Program #%d ID 0x%04x, service ID 0x%04x",
+ dvb_log(_("Program #%d ID 0x%04x, service ID 0x%04x"),
num_pmt, program->pid, program->service_id);
rc = dvb_read_section(&parms->p, dmx_fd,
DVB_TABLE_PMT, program->pid,
@@ -490,7 +503,7 @@ struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p,
return dvb_scan_handler;
}
if (rc < 0) {
- dvb_logerr("error while reading the PMT table for service 0x%04x",
+ dvb_logerr(_("error while reading the PMT table for service 0x%04x"),
program->service_id);
dvb_scan_handler->program[num_pmt].pmt = NULL;
} else {
@@ -510,7 +523,7 @@ struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p,
if (parms->p.abort)
return dvb_scan_handler;
if (rc < 0)
- dvb_logerr("error while reading the NIT table");
+ dvb_logerr(_("error while reading the NIT table"));
else if (parms->p.verbose)
dvb_table_nit_print(&parms->p, dvb_scan_handler->nit);
@@ -523,7 +536,7 @@ struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p,
if (parms->p.abort)
return dvb_scan_handler;
if (rc < 0)
- dvb_logerr("error while reading the SDT table");
+ dvb_logerr(_("error while reading the SDT table"));
else if (parms->p.verbose)
dvb_table_sdt_print(&parms->p, dvb_scan_handler->sdt);
}
@@ -531,7 +544,7 @@ struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p,
/* NIT/SDT other tables */
if (other_nit) {
if (parms->p.verbose)
- dvb_log("Parsing other NIT/SDT");
+ dvb_log(_("Parsing other NIT/SDT"));
rc = dvb_read_section(&parms->p, dmx_fd,
DVB_TABLE_NIT2, DVB_TABLE_NIT_PID,
(void **)&dvb_scan_handler->nit,
@@ -539,7 +552,7 @@ struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p,
if (parms->p.abort)
return dvb_scan_handler;
if (rc < 0)
- dvb_logerr("error while reading the NIT table");
+ dvb_logerr(_("error while reading the NIT table"));
else if (parms->p.verbose)
dvb_table_nit_print(&parms->p, dvb_scan_handler->nit);
@@ -550,7 +563,7 @@ struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p,
if (parms->p.abort)
return dvb_scan_handler;
if (rc < 0)
- dvb_logerr("error while reading the SDT table");
+ dvb_logerr(_("error while reading the SDT table"));
else if (parms->p.verbose)
dvb_table_sdt_print(&parms->p, dvb_scan_handler->sdt);
}
@@ -596,7 +609,7 @@ struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *__p,
rc = dvb_fe_set_parms(&parms->p);
if (rc < 0) {
- dvb_perror("dvb_fe_set_parms failed");
+ dvb_perror(_("dvb_fe_set_parms failed"));
return NULL;
}
@@ -682,8 +695,8 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
if (!bw)
dvb_fe_retrieve_parm(&parms->p, DTV_BANDWIDTH_HZ, &bw);
if (!bw)
- dvb_log("Cannot calc frequency shift. " \
- "Either bandwidth/symbol-rate is unavailable (yet).");
+ dvb_log(_("Cannot calc frequency shift. " \
+ "Either bandwidth/symbol-rate is unavailable (yet)."));
/*
* If the max frequency shift between two frequencies is below
* than the used bandwidth / 8, it should be the same channel.
@@ -764,7 +777,7 @@ struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *__p,
/* Clone the current entry into a new entry */
new_entry = calloc(sizeof(*new_entry), 1);
if (!new_entry) {
- dvb_perror("not enough memory for a new scanning frequency/TS");
+ dvb_perror(_("not enough memory for a new scanning frequency/TS"));
return NULL;
}
@@ -793,7 +806,7 @@ struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *__p,
entry = entry->next;
n++;
}
- dvb_log("New transponder/channel found: #%d: %d",
+ dvb_log(_("New transponder/channel found: #%d: %d"),
n, freq);
entry->next = new_entry;
new_entry->next = NULL;
@@ -802,7 +815,7 @@ struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *__p,
}
/* This should never happen */
- dvb_logerr("BUG: Couldn't add %d to the scan frequency list.", freq);
+ dvb_logerr(_("BUG: Couldn't add %d to the scan frequency list."), freq);
free(new_entry);
return NULL;
@@ -1144,7 +1157,7 @@ static void __dvb_add_update_transponders(struct dvb_v5_fe_parms_priv *parms,
return;
default:
- dvb_log("Transponders detection not implemented for this standard yet.");
+ dvb_log(_("Transponders detection not implemented for this standard yet."));
return;
}
}

Privacy Policy