linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S
@ 2014-10-08 12:09 tskd08
  2014-10-08 12:09 ` [PATCH 1/4] v4l-utils/libdvbv5: avoid crash when failed to get a channel name tskd08
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: tskd08 @ 2014-10-08 12:09 UTC (permalink / raw)
  To: linux-media; +Cc: m.chehab

From: Akihiro Tsukada <tskd08@gmail.com>

This patch series adds tuning and scanning features for ISDB-S.
Other part of the libdvbv5 API may not work for ISDB-S.
At least the charset conversion and the parser for extended
event descriptors do not work now,
as they require some ISDB-S(/T) specific modifications.

Akihiro Tsukada (4):
  v4l-utils/libdvbv5: avoid crash when failed to get a channel name
  v4l-utils/libdvbv5: add support for ISDB-S tuning
  v4l-utils/libdvbv5: add support for ISDB-S scanning
  v4l-utils/dvbv5-scan: add support for ISDB-S scanning

 lib/include/libdvbv5/dvb-scan.h |   2 +
 lib/libdvbv5/dvb-fe.c           |   6 +-
 lib/libdvbv5/dvb-file.c         |  32 +++++++---
 lib/libdvbv5/dvb-sat.c          |  11 ++++
 lib/libdvbv5/dvb-scan.c         | 125 +++++++++++++++++++++++++++++++++++++++-
 lib/libdvbv5/parse_string.c     |  23 ++++++++
 utils/dvb/dvb-format-convert.c  |   3 +-
 utils/dvb/dvbv5-scan.c          |  14 +++++
 8 files changed, 203 insertions(+), 13 deletions(-)

-- 
2.1.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/4] v4l-utils/libdvbv5: avoid crash when failed to get a channel name
  2014-10-08 12:09 [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S tskd08
@ 2014-10-08 12:09 ` tskd08
  2014-10-08 16:05   ` Mauro Carvalho Chehab
  2014-10-08 12:09 ` [PATCH 2/4] v4l-utils/libdvbv5: add support for ISDB-S tuning tskd08
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: tskd08 @ 2014-10-08 12:09 UTC (permalink / raw)
  To: linux-media; +Cc: m.chehab

From: Akihiro Tsukada <tskd08@gmail.com>

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
 lib/libdvbv5/dvb-file.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 27d9a63..bcb1762 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -1121,20 +1121,21 @@ static int get_program_and_store(struct dvb_v5_fe_parms_priv *parms,
 		if (rc)
 			dvb_logerr("Couldn't get frontend props");
 	}
-	if (!*channel) {
-		r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
-		if (r < 0)
-			dvb_perror("asprintf");
-		if (parms->p.verbose)
-			dvb_log("Storing as: '%s'", channel);
-	}
 	for (j = 0; j < parms->n_props; j++) {
 		entry->props[j].cmd = parms->dvb_prop[j].cmd;
 		entry->props[j].u.data = parms->dvb_prop[j].u.data;
 
-		if (!*channel && entry->props[j].cmd == DTV_FREQUENCY)
+		if ((!channel || !*channel) &&
+		    entry->props[j].cmd == DTV_FREQUENCY)
 			freq = parms->dvb_prop[j].u.data;
 	}
+	if (!channel || !*channel) {
+		r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
+		if (r < 0)
+			dvb_perror("asprintf");
+		if (parms->p.verbose)
+			dvb_log("Storing as: '%s'", channel);
+	}
 	entry->n_props = parms->n_props;
 	entry->channel = channel;
 
-- 
2.1.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/4] v4l-utils/libdvbv5: add support for ISDB-S tuning
  2014-10-08 12:09 [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S tskd08
  2014-10-08 12:09 ` [PATCH 1/4] v4l-utils/libdvbv5: avoid crash when failed to get a channel name tskd08
@ 2014-10-08 12:09 ` tskd08
  2014-10-08 13:57   ` Mauro Carvalho Chehab
  2014-10-08 12:09 ` [PATCH 3/4] v4l-utils/libdvbv5: add support for ISDB-S scanning tskd08
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: tskd08 @ 2014-10-08 12:09 UTC (permalink / raw)
  To: linux-media; +Cc: m.chehab

From: Akihiro Tsukada <tskd08@gmail.com>

Added LNB support for Japanese satellites.
Currently tested with dvbv5-zap, dvb-fe-tool.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
 lib/libdvbv5/dvb-sat.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index e8df06b..70b1021 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -91,6 +91,13 @@ static const struct dvb_sat_lnb lnb[] = {
 		.freqrange = {
 			{ 12200, 12700 }
 		}
+	}, {
+		.name = "Japan 110BS/CS LNBf",
+		.alias = "110BS",
+		.lowfreq = 10678,
+		.freqrange = {
+			{ 11727, 12731 }
+		}
 	},
 };
 
@@ -304,6 +311,8 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
 		 */
 		pol_v = 0;
 		high_band = 1;
+		if (lnb == &lnb[8])
+			vol_high = 1;
 	} else {
 		/* Adjust voltage/tone accordingly */
 		if (parms->p.sat_number < 2) {
@@ -316,6 +325,8 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
 	rc = dvb_fe_sec_voltage(&parms->p, 1, vol_high);
 	if (rc)
 		return rc;
+	if (parms->p.current_sys == SYS_ISDBS)
+		return 0;
 
 	if (parms->p.sat_number > 0) {
 		rc = dvb_fe_sec_tone(&parms->p, SEC_TONE_OFF);
-- 
2.1.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/4] v4l-utils/libdvbv5: add support for ISDB-S scanning
  2014-10-08 12:09 [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S tskd08
  2014-10-08 12:09 ` [PATCH 1/4] v4l-utils/libdvbv5: avoid crash when failed to get a channel name tskd08
  2014-10-08 12:09 ` [PATCH 2/4] v4l-utils/libdvbv5: add support for ISDB-S tuning tskd08
@ 2014-10-08 12:09 ` tskd08
  2014-10-08 15:59   ` Mauro Carvalho Chehab
  2014-10-08 12:09 ` [PATCH 4/4] v4l-utils/dvbv5-scan: " tskd08
  2014-10-08 16:22 ` [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S Mauro Carvalho Chehab
  4 siblings, 1 reply; 13+ messages in thread
From: tskd08 @ 2014-10-08 12:09 UTC (permalink / raw)
  To: linux-media; +Cc: m.chehab

From: Akihiro Tsukada <tskd08@gmail.com>

added NIT scan for ISDB-S,
fixed wrong/too-close frequency of the scanned entries,
when freq_offset/bandwith was not set properly.

ISDB-S/T specific charset conversion is separeted off
as an iconv module, and not implemented in this lib.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
 lib/include/libdvbv5/dvb-scan.h |   2 +
 lib/libdvbv5/dvb-fe.c           |   6 +-
 lib/libdvbv5/dvb-file.c         |  21 +++++--
 lib/libdvbv5/dvb-scan.c         | 125 +++++++++++++++++++++++++++++++++++++++-
 lib/libdvbv5/parse_string.c     |  23 ++++++++
 5 files changed, 170 insertions(+), 7 deletions(-)

diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h
index fe50687..e3a0d24 100644
--- a/lib/include/libdvbv5/dvb-scan.h
+++ b/lib/include/libdvbv5/dvb-scan.h
@@ -387,6 +387,8 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
 
 int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
 			   uint32_t freq, enum dvb_sat_polarization pol, int shift);
+int dvb_new_ts_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
+			   uint32_t freq, int shift, uint32_t ts_id);
 
 struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
 				     struct dvb_entry *first_entry,
diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index f535311..93c0b9b 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -372,6 +372,8 @@ int dvb_set_sys(struct dvb_v5_fe_parms *p, fe_delivery_system_t sys)
 	parms->p.current_sys = sys;
 	parms->n_props = rc;
 
+	if (sys == SYS_ISDBS /* || sys == SYS_ISDBT */)
+		parms->p.default_charset = "arib-std-b24";
 	return 0;
 }
 
@@ -683,8 +685,10 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *p)
 			dvb_logdbg("LNA is %s", parms->p.lna ? "ON" : "OFF");
 	}
 
-	if (dvb_fe_is_satellite(tmp_parms.p.current_sys))
+	if (dvb_fe_is_satellite(tmp_parms.p.current_sys)) {
 		dvb_sat_set_parms(&tmp_parms.p);
+		parms->freq_offset = tmp_parms.freq_offset;
+	}
 
 	/* Filter out any user DTV_foo property such as DTV_POLARIZATION */
 	tmp_parms.n_props = dvb_copy_fe_props(tmp_parms.dvb_prop,
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index bcb1762..0a0e41a 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -1125,12 +1125,25 @@ static int get_program_and_store(struct dvb_v5_fe_parms_priv *parms,
 		entry->props[j].cmd = parms->dvb_prop[j].cmd;
 		entry->props[j].u.data = parms->dvb_prop[j].u.data;
 
-		if ((!channel || !*channel) &&
-		    entry->props[j].cmd == DTV_FREQUENCY)
-			freq = parms->dvb_prop[j].u.data;
+		if (entry->props[j].cmd == DTV_STREAM_ID &&
+		    entry->props[j].u.data == 0 &&
+		    parms->p.current_sys == SYS_ISDBS)
+			entry->props[j].u.data = dvb_scan_handler->pat->header.id;
+
+		if (entry->props[j].cmd != DTV_FREQUENCY)
+			continue;
+
+		if (dvb_fe_is_satellite(parms->p.current_sys) &&
+		    entry->props[j].u.data < parms->freq_offset)
+			entry->props[j].u.data += parms->freq_offset;
+
+		if (!channel || !*channel)
+			freq = entry->props[j].u.data;
 	}
 	if (!channel || !*channel) {
-		r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
+		r = asprintf(&channel, "%.2f%cHz#%d", freq / 1000000.,
+			dvb_fe_is_satellite(parms->p.current_sys) ? 'G' : 'M',
+			service_id);
 		if (r < 0)
 			dvb_perror("asprintf");
 		if (parms->p.verbose)
diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c
index 3b70f5a..470ef61 100644
--- a/lib/libdvbv5/dvb-scan.c
+++ b/lib/libdvbv5/dvb-scan.c
@@ -635,7 +635,7 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
 		rolloff = 115;
 		break;
 	case SYS_DVBS:
-	case SYS_ISDBS:	/* FIXME: not sure if this rollof is right for ISDB-S */
+	case SYS_ISDBS:
 		divisor = 100000;
 		rolloff = 135;
 		break;
@@ -672,11 +672,14 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
 		 * purposes of estimating a max frequency shift here.
 		 */
 		dvb_fe_retrieve_parm(&parms->p, DTV_SYMBOL_RATE, &symbol_rate);
+		if (parms->p.current_sys == SYS_ISDBS)
+			symbol_rate = 28800;
 		bw = (symbol_rate * rolloff) / divisor;
 	}
 	if (!bw)
 		dvb_fe_retrieve_parm(&parms->p, DTV_BANDWIDTH_HZ, &bw);
-
+	if (!bw && parms->p.current_sys == SYS_ISDBT)
+		bw = 6000000;
 	/*
 	 * If the max frequency shift between two frequencies is below
 	 * than the used bandwidth / 8, it should be the same channel.
@@ -758,6 +761,87 @@ struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p,
 	return NULL;
 }
 
+int dvb_new_ts_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
+			 uint32_t freq, int shift, uint32_t ts_id)
+{
+	int i;
+	uint32_t data;
+
+	for (; entry != last_entry; entry = entry->next) {
+		for (i = 0; i < entry->n_props; i++) {
+			data = entry->props[i].u.data;
+			if (entry->props[i].cmd == DTV_STREAM_ID) {
+				if (data != ts_id)
+					break;
+			}
+			if (entry->props[i].cmd == DTV_FREQUENCY) {
+				if (freq < data - shift || freq > data + shift)
+					break;
+			}
+		}
+		if (i == entry->n_props && entry->n_props > 0)
+			return 0;
+	}
+
+	return 1;
+}
+
+static struct dvb_entry *
+dvb_scan_add_entry_isdbs(struct dvb_v5_fe_parms *__p,
+			 struct dvb_entry *first_entry, struct dvb_entry *entry,
+			 uint32_t freq, uint32_t shift, uint32_t ts_id)
+{
+	struct dvb_v5_fe_parms_priv *parms = (void *)__p;
+	struct dvb_entry *new_entry;
+	int i, n = 2;
+
+	if (!dvb_new_ts_is_needed(first_entry, NULL, freq, shift, ts_id))
+		return NULL;
+
+	/* 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");
+		return NULL;
+	}
+
+	memcpy(new_entry, entry, sizeof(*entry));
+	if (entry->channel)
+		new_entry->channel = strdup(entry->channel);
+	if (entry->vchannel)
+		new_entry->vchannel = strdup(entry->vchannel);
+	if (entry->location)
+		new_entry->location = strdup(entry->location);
+	if (entry->lnb)
+		new_entry->lnb = strdup(entry->lnb);
+
+	/*
+	 * The frequency should change to the new one. Seek for it and
+	 * replace its value to the desired one.
+	 */
+	for (i = 0; i < new_entry->n_props; i++) {
+		if (new_entry->props[i].cmd == DTV_FREQUENCY) {
+			new_entry->props[i].u.data = freq;
+			/* Navigate to the end of the entry list */
+			while (entry->next) {
+				entry = entry->next;
+				n++;
+			}
+			dvb_log("New transponder/channel found: #%d: %d",
+			        n, freq);
+			entry->next = new_entry;
+			new_entry->next = NULL;
+			return new_entry;
+		}
+	}
+
+	/* This should never happen */
+	dvb_logerr("BUG: Couldn't add %d to the scan frequency list.", freq);
+	free(new_entry);
+
+	return NULL;
+}
+
 struct update_transponders {
 	struct dvb_v5_fe_parms *parms;
 	struct dvb_v5_descriptors *dvb_scan_handler;
@@ -987,6 +1071,36 @@ static void add_update_nit_dvbs(struct dvb_table_nit *nit,
 				     SYS_DVBS2);
 }
 
+static void add_update_nit_isdbs(struct dvb_table_nit *nit,
+				 struct dvb_table_nit_transport *tran,
+				 struct dvb_desc *desc,
+				 void *priv)
+{
+	struct update_transponders *tr = priv;
+	struct dvb_entry *new;
+	struct dvb_desc_sat *d = (void *)desc;
+	uint32_t ts_id;
+
+	if (tr->update)
+		return;
+
+        ts_id = tran->transport_id;
+	new = dvb_scan_add_entry_isdbs(tr->parms, tr->first_entry, tr->entry,
+				       d->frequency, tr->shift, ts_id);
+	if (!new)
+		return;
+
+	/* Set NIT ISDB-S props for the transponder */
+	/* modulation is not defined here but in TMCC. */
+	/* skip setting it since no "AUTO" value in fe_modulation_t */
+	dvb_store_entry_prop(new, DTV_POLARIZATION,
+			     dvbs_polarization[d->polarization]);
+	dvb_store_entry_prop(new, DTV_SYMBOL_RATE,
+			     d->symbol_rate);
+	dvb_store_entry_prop(new, DTV_INNER_FEC,
+			     dvbs_dvbc_dvbs_freq_inner[d->fec]);
+}
+
 
 static void __dvb_add_update_transponders(struct dvb_v5_fe_parms_priv *parms,
 					  struct dvb_v5_descriptors *dvb_scan_handler,
@@ -1045,6 +1159,13 @@ static void __dvb_add_update_transponders(struct dvb_v5_fe_parms_priv *parms,
 				satellite_delivery_system_descriptor,
 				NULL, add_update_nit_dvbs, &tr);
 		return;
+	case SYS_ISDBS:
+		dvb_table_nit_descriptor_handler(
+				&parms->p, dvb_scan_handler->nit,
+				satellite_delivery_system_descriptor,
+				NULL, add_update_nit_isdbs, &tr);
+		return;
+
 	default:
 		dvb_log("Transponders detection not implemented for this standard yet.");
 		return;
diff --git a/lib/libdvbv5/parse_string.c b/lib/libdvbv5/parse_string.c
index 3750d04..6a4de2b 100644
--- a/lib/libdvbv5/parse_string.c
+++ b/lib/libdvbv5/parse_string.c
@@ -366,6 +366,22 @@ static void charset_conversion(struct dvb_v5_fe_parms *parms, char **dest, const
 				     parms->output_charset);
 }
 
+static void isdb_parse_string(struct dvb_v5_fe_parms *parms, char **dest,
+			      const unsigned char *src, size_t len)
+{
+	int destlen;
+
+	destlen = len * 4;
+	*dest = malloc(destlen + 1);
+	dvb_iconv_to_charset(parms, *dest, destlen, src, len,
+			     "ARIB-STD-B24", parms->output_charset);
+	/* The code had over-sized the space. Fix it. */
+	if (*dest)
+		*dest = realloc(*dest, strlen(*dest) + 1);
+	return;
+}
+
+
 void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
 		      const unsigned char *src, size_t len)
 {
@@ -386,6 +402,13 @@ void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
 	if (!len)
 		return;
 
+	/* Strings in ISDB-S/T do not start with a charset identifier, */
+	/*  and can start with a control character. */
+	if (!strcasecmp(type, "ARIB-STD-B24")) {
+		isdb_parse_string(parms, dest, src, len);
+		return;
+	}
+
 	if (*src < 0x20) {
 		switch (*src) {
 		case 0x00:	type = "ISO-6937";		break;
-- 
2.1.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/4] v4l-utils/dvbv5-scan: add support for ISDB-S scanning
  2014-10-08 12:09 [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S tskd08
                   ` (2 preceding siblings ...)
  2014-10-08 12:09 ` [PATCH 3/4] v4l-utils/libdvbv5: add support for ISDB-S scanning tskd08
@ 2014-10-08 12:09 ` tskd08
  2014-10-08 16:04   ` Mauro Carvalho Chehab
  2014-10-08 16:22 ` [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S Mauro Carvalho Chehab
  4 siblings, 1 reply; 13+ messages in thread
From: tskd08 @ 2014-10-08 12:09 UTC (permalink / raw)
  To: linux-media; +Cc: m.chehab

From: Akihiro Tsukada <tskd08@gmail.com>

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
 utils/dvb/dvb-format-convert.c |  3 ++-
 utils/dvb/dvbv5-scan.c         | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/utils/dvb/dvb-format-convert.c b/utils/dvb/dvb-format-convert.c
index 4f0e075..bf37945 100644
--- a/utils/dvb/dvb-format-convert.c
+++ b/utils/dvb/dvb-format-convert.c
@@ -125,7 +125,8 @@ int main(int argc, char **argv)
 		fprintf(stderr, "ERROR: Please specify a valid output file\n");
 		missing = 1;
 	} else if (((args.input_format == FILE_ZAP) ||
-		   (args.output_format == FILE_ZAP)) && args.delsys <= 0) {
+		   (args.output_format == FILE_ZAP)) &&
+		   (args.delsys <= 0 || args.delsys == SYS_ISDBS)) {
 		fprintf(stderr, "ERROR: Please specify a valid delivery system for ZAP format\n");
 		missing = 1;
 	}
diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
index cdc82ec..0ef95f3 100644
--- a/utils/dvb/dvbv5-scan.c
+++ b/utils/dvb/dvbv5-scan.c
@@ -251,6 +251,16 @@ static int run_scan(struct arguments *args,
 		if (dvb_retrieve_entry_prop(entry, DTV_POLARIZATION, &pol))
 			pol = POLARIZATION_OFF;
 
+		if (parms->current_sys == SYS_ISDBS) {
+			uint32_t tsid = 0;
+
+			dvb_store_entry_prop(entry, DTV_POLARIZATION, POLARIZATION_R);
+
+			dvb_retrieve_entry_prop(entry, DTV_STREAM_ID, &tsid);
+			if (!dvb_new_ts_is_needed(dvb_file->first_entry, entry,
+						  freq, shift, tsid))
+				continue;
+		} else
 		if (!dvb_new_freq_is_needed(dvb_file->first_entry, entry,
 					    freq, pol, shift))
 			continue;
@@ -258,6 +268,10 @@ static int run_scan(struct arguments *args,
 		count++;
 		dvb_log("Scanning frequency #%d %d", count, freq);
 
+		if (!args->lnb_name && entry->lnb &&
+		    (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias)))
+			parms->lnb = dvb_sat_get_lnb(dvb_sat_search_lnb(entry->lnb));
+
 		/*
 		 * Run the scanning logic
 		 */
-- 
2.1.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/4] v4l-utils/libdvbv5: add support for ISDB-S tuning
  2014-10-08 12:09 ` [PATCH 2/4] v4l-utils/libdvbv5: add support for ISDB-S tuning tskd08
@ 2014-10-08 13:57   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 13+ messages in thread
From: Mauro Carvalho Chehab @ 2014-10-08 13:57 UTC (permalink / raw)
  To: tskd08; +Cc: linux-media

Em Wed, 08 Oct 2014 21:09:39 +0900
tskd08@gmail.com escreveu:

> From: Akihiro Tsukada <tskd08@gmail.com>
> 
> Added LNB support for Japanese satellites.
> Currently tested with dvbv5-zap, dvb-fe-tool.
> 
> Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
> ---
>  lib/libdvbv5/dvb-sat.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
> index e8df06b..70b1021 100644
> --- a/lib/libdvbv5/dvb-sat.c
> +++ b/lib/libdvbv5/dvb-sat.c
> @@ -91,6 +91,13 @@ static const struct dvb_sat_lnb lnb[] = {
>  		.freqrange = {
>  			{ 12200, 12700 }
>  		}
> +	}, {
> +		.name = "Japan 110BS/CS LNBf",
> +		.alias = "110BS",
> +		.lowfreq = 10678,
> +		.freqrange = {
> +			{ 11727, 12731 }
> +		}

Hmm... a quick search for 110BS gave me this datasheet:
	http://www.sesl-sharp.com/Products/pdf/rf201309_e.pdf

Frequencies there are a little broader. If this datasheet is
right, .freqrange should be:
		{ 11710, 12751 }

>  	},
>  };
>  
> @@ -304,6 +311,8 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
>  		 */
>  		pol_v = 0;
>  		high_band = 1;
> +		if (lnb == &lnb[8])
> +			vol_high = 1;

I don't like the idea of using an index here. It would be easy
to have this broken. 

Also, probably the best would be to add another field and/or a libdvbv5
property to indicate the DiSEqC specific stuff as found in Japan.

What kind of DiSEqC switch are you using (if any)?

>  	} else {
>  		/* Adjust voltage/tone accordingly */
>  		if (parms->p.sat_number < 2) {
> @@ -316,6 +325,8 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
>  	rc = dvb_fe_sec_voltage(&parms->p, 1, vol_high);
>  	if (rc)
>  		return rc;
> +	if (parms->p.current_sys == SYS_ISDBS)
> +		return 0;

Are you sure that this need is due to ISDB-S, and not due to a
different DiSEqC switch or satellite system arrangement?

>  	if (parms->p.sat_number > 0) {
>  		rc = dvb_fe_sec_tone(&parms->p, SEC_TONE_OFF);

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/4] v4l-utils/libdvbv5: add support for ISDB-S scanning
  2014-10-08 12:09 ` [PATCH 3/4] v4l-utils/libdvbv5: add support for ISDB-S scanning tskd08
@ 2014-10-08 15:59   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 13+ messages in thread
From: Mauro Carvalho Chehab @ 2014-10-08 15:59 UTC (permalink / raw)
  To: tskd08; +Cc: linux-media

Em Wed, 08 Oct 2014 21:09:40 +0900
tskd08@gmail.com escreveu:

> From: Akihiro Tsukada <tskd08@gmail.com>
> 
> added NIT scan for ISDB-S,
> fixed wrong/too-close frequency of the scanned entries,
> when freq_offset/bandwith was not set properly.
> 
> ISDB-S/T specific charset conversion is separeted off
> as an iconv module, and not implemented in this lib.
> 
> Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
> ---
>  lib/include/libdvbv5/dvb-scan.h |   2 +
>  lib/libdvbv5/dvb-fe.c           |   6 +-
>  lib/libdvbv5/dvb-file.c         |  21 +++++--
>  lib/libdvbv5/dvb-scan.c         | 125 +++++++++++++++++++++++++++++++++++++++-
>  lib/libdvbv5/parse_string.c     |  23 ++++++++
>  5 files changed, 170 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h
> index fe50687..e3a0d24 100644
> --- a/lib/include/libdvbv5/dvb-scan.h
> +++ b/lib/include/libdvbv5/dvb-scan.h
> @@ -387,6 +387,8 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
>  
>  int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
>  			   uint32_t freq, enum dvb_sat_polarization pol, int shift);
> +int dvb_new_ts_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
> +			   uint32_t freq, int shift, uint32_t ts_id);
>  
>  struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
>  				     struct dvb_entry *first_entry,
> diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
> index f535311..93c0b9b 100644
> --- a/lib/libdvbv5/dvb-fe.c
> +++ b/lib/libdvbv5/dvb-fe.c
> @@ -372,6 +372,8 @@ int dvb_set_sys(struct dvb_v5_fe_parms *p, fe_delivery_system_t sys)
>  	parms->p.current_sys = sys;
>  	parms->n_props = rc;
>  
> +	if (sys == SYS_ISDBS /* || sys == SYS_ISDBT */)
> +		parms->p.default_charset = "arib-std-b24";

Actually, the best would be to add a Country property at the library
for this kind of adjustment. If you take a look at page 12 of:
	http://www.dibeg.org/techp/aribstd/harmonization/090918_Harmonization_volume8_Receivers.pdf

You'll see that the charset definition is different between JP and BR.
Also, there are several other things that are different among the
descriptors used in Japan (ARIB specs) and South America (NBR specs).
I don't doubt that some other Countries will end by deciding to apply
some different definitions.

So, the best is to add a Country field and use it to handle those
differences. We'll need a new parameter at dvbv5 tools to handle the
Country code. Btw, wscan has an interesting logic of guessing it
from the locale vars. We could use something like that at the userspace
tools as a hint (that could, of course, be overriden).

>  	return 0;
>  }
>  
> @@ -683,8 +685,10 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *p)
>  			dvb_logdbg("LNA is %s", parms->p.lna ? "ON" : "OFF");
>  	}
>  
> -	if (dvb_fe_is_satellite(tmp_parms.p.current_sys))
> +	if (dvb_fe_is_satellite(tmp_parms.p.current_sys)) {
>  		dvb_sat_set_parms(&tmp_parms.p);
> +		parms->freq_offset = tmp_parms.freq_offset;
> +	}
>  
>  	/* Filter out any user DTV_foo property such as DTV_POLARIZATION */
>  	tmp_parms.n_props = dvb_copy_fe_props(tmp_parms.dvb_prop,
> diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
> index bcb1762..0a0e41a 100644
> --- a/lib/libdvbv5/dvb-file.c
> +++ b/lib/libdvbv5/dvb-file.c
> @@ -1125,12 +1125,25 @@ static int get_program_and_store(struct dvb_v5_fe_parms_priv *parms,
>  		entry->props[j].cmd = parms->dvb_prop[j].cmd;
>  		entry->props[j].u.data = parms->dvb_prop[j].u.data;
>  
> -		if ((!channel || !*channel) &&
> -		    entry->props[j].cmd == DTV_FREQUENCY)
> -			freq = parms->dvb_prop[j].u.data;
> +		if (entry->props[j].cmd == DTV_STREAM_ID &&
> +		    entry->props[j].u.data == 0 &&
> +		    parms->p.current_sys == SYS_ISDBS)
> +			entry->props[j].u.data = dvb_scan_handler->pat->header.id;

Hmm... I don't like very much the idea of having a code here accessing the
pat->header.id, just for ISDB-S.

All the standard-specific issues should have already being solved here.

It probably makes more sense to fill it at dvb-scan.c, while handling the
standard-specifi stuff, for example, at the function
__dvb_add_update_transponders(). It will likely need a parser for
the ISDB-S descriptor too, at least when we start to have some code that
would allow to force the demod to not use the TMCC data.

> +
> +		if (entry->props[j].cmd != DTV_FREQUENCY)
> +			continue;
> +
> +		if (dvb_fe_is_satellite(parms->p.current_sys) &&
> +		    entry->props[j].u.data < parms->freq_offset)
> +			entry->props[j].u.data += parms->freq_offset;
> +
> +		if (!channel || !*channel)
> +			freq = entry->props[j].u.data;
>  	}

>  	if (!channel || !*channel) {
> -		r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
> +		r = asprintf(&channel, "%.2f%cHz#%d", freq / 1000000.,
> +			dvb_fe_is_satellite(parms->p.current_sys) ? 'G' : 'M',
> +			service_id);

Good catch! better to put it into a separate patch, as it is actually
unrelated and also affects DVB-S.

>  		if (r < 0)
>  			dvb_perror("asprintf");
>  		if (parms->p.verbose)
> diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c
> index 3b70f5a..470ef61 100644
> --- a/lib/libdvbv5/dvb-scan.c
> +++ b/lib/libdvbv5/dvb-scan.c
> @@ -635,7 +635,7 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
>  		rolloff = 115;
>  		break;
>  	case SYS_DVBS:
> -	case SYS_ISDBS:	/* FIXME: not sure if this rollof is right for ISDB-S */
> +	case SYS_ISDBS:
>  		divisor = 100000;
>  		rolloff = 135;
>  		break;
> @@ -672,11 +672,14 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
>  		 * purposes of estimating a max frequency shift here.
>  		 */
>  		dvb_fe_retrieve_parm(&parms->p, DTV_SYMBOL_RATE, &symbol_rate);
> +		if (parms->p.current_sys == SYS_ISDBS)
> +			symbol_rate = 28800;

Better to add it at the switch, splitting DVBS and ISDBS, like:

	case SYS_ISDBS:
		symbol_rate = 28800;
		/* fall though */
	case SYS_ISDBS:
 		divisor = 100000;
 		rolloff = 135;
 		break;

Btw, we should likely be adding a similar code at the Kernel, as it
provides already a symbol rate estimation for other Satellite and Cable
standards.

>  		bw = (symbol_rate * rolloff) / divisor;
>  	}
>  	if (!bw)
>  		dvb_fe_retrieve_parm(&parms->p, DTV_BANDWIDTH_HZ, &bw);
> -
> +	if (!bw && parms->p.current_sys == SYS_ISDBT)
> +		bw = 6000000;

No, this is wrong, as the specs allow other bandwidths.

Btw, according with: http://www.soumu.go.jp/main_sosiki/joho_tsusin/eng/Releases/Telecommunications/111019_c.html
(link obtained from http://en.wikipedia.org/wiki/ISDB-T_International),
Maldives is using ISDB-T with 8MHz.

>  	/*
>  	 * If the max frequency shift between two frequencies is below
>  	 * than the used bandwidth / 8, it should be the same channel.
> @@ -758,6 +761,87 @@ struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p,
>  	return NULL;
>  }
>  
> +int dvb_new_ts_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
> +			 uint32_t freq, int shift, uint32_t ts_id)
> +{
> +	int i;
> +	uint32_t data;
> +
> +	for (; entry != last_entry; entry = entry->next) {
> +		for (i = 0; i < entry->n_props; i++) {
> +			data = entry->props[i].u.data;
> +			if (entry->props[i].cmd == DTV_STREAM_ID) {
> +				if (data != ts_id)
> +					break;
> +			}
> +			if (entry->props[i].cmd == DTV_FREQUENCY) {
> +				if (freq < data - shift || freq > data + shift)
> +					break;
> +			}
> +		}
> +		if (i == entry->n_props && entry->n_props > 0)
> +			return 0;
> +	}
> +
> +	return 1;
> +}
> +
> +static struct dvb_entry *
> +dvb_scan_add_entry_isdbs(struct dvb_v5_fe_parms *__p,
> +			 struct dvb_entry *first_entry, struct dvb_entry *entry,
> +			 uint32_t freq, uint32_t shift, uint32_t ts_id)
> +{
> +	struct dvb_v5_fe_parms_priv *parms = (void *)__p;
> +	struct dvb_entry *new_entry;
> +	int i, n = 2;
> +
> +	if (!dvb_new_ts_is_needed(first_entry, NULL, freq, shift, ts_id))
> +		return NULL;
> +
> +	/* 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");
> +		return NULL;
> +	}
> +
> +	memcpy(new_entry, entry, sizeof(*entry));
> +	if (entry->channel)
> +		new_entry->channel = strdup(entry->channel);
> +	if (entry->vchannel)
> +		new_entry->vchannel = strdup(entry->vchannel);
> +	if (entry->location)
> +		new_entry->location = strdup(entry->location);
> +	if (entry->lnb)
> +		new_entry->lnb = strdup(entry->lnb);
> +
> +	/*
> +	 * The frequency should change to the new one. Seek for it and
> +	 * replace its value to the desired one.
> +	 */
> +	for (i = 0; i < new_entry->n_props; i++) {
> +		if (new_entry->props[i].cmd == DTV_FREQUENCY) {
> +			new_entry->props[i].u.data = freq;
> +			/* Navigate to the end of the entry list */
> +			while (entry->next) {
> +				entry = entry->next;
> +				n++;
> +			}
> +			dvb_log("New transponder/channel found: #%d: %d",
> +			        n, freq);
> +			entry->next = new_entry;
> +			new_entry->next = NULL;
> +			return new_entry;
> +		}
> +	}
> +
> +	/* This should never happen */
> +	dvb_logerr("BUG: Couldn't add %d to the scan frequency list.", freq);
> +	free(new_entry);
> +
> +	return NULL;
> +}
> +
>  struct update_transponders {
>  	struct dvb_v5_fe_parms *parms;
>  	struct dvb_v5_descriptors *dvb_scan_handler;
> @@ -987,6 +1071,36 @@ static void add_update_nit_dvbs(struct dvb_table_nit *nit,
>  				     SYS_DVBS2);
>  }
>  
> +static void add_update_nit_isdbs(struct dvb_table_nit *nit,
> +				 struct dvb_table_nit_transport *tran,
> +				 struct dvb_desc *desc,
> +				 void *priv)
> +{
> +	struct update_transponders *tr = priv;
> +	struct dvb_entry *new;
> +	struct dvb_desc_sat *d = (void *)desc;

Hmm... this looks wrong... please add a FIXME here, as we'll need to handle
it better, as the Satellite descriptor at ARIB STB-B10 is not quite the
same as the one defined at ETSI EN 300 468.

At DVB, we have (lib/include/libdvbv5/desc_sat.h):

        uint8_t modulation_type:2;
        uint8_t modulation_system:1;
       	uint8_t roll_off:2;

However, for ISDB-S, this should be, instead:

	uint8_t modulation:5;

The fec field for ISDB-S is also 4 bits, but has a different meaning:
On EN300468, 1000b means 4/5 conv. code rate, while it means ISDB-S 
at STD B10. Upper codes there are also different.

> +	uint32_t ts_id;
> +
> +	if (tr->update)
> +		return;
> +
> +        ts_id = tran->transport_id;
> +	new = dvb_scan_add_entry_isdbs(tr->parms, tr->first_entry, tr->entry,
> +				       d->frequency, tr->shift, ts_id);
> +	if (!new)
> +		return;
> +
> +	/* Set NIT ISDB-S props for the transponder */
> +	/* modulation is not defined here but in TMCC. */
> +	/* skip setting it since no "AUTO" value in fe_modulation_t */
> +	dvb_store_entry_prop(new, DTV_POLARIZATION,
> +			     dvbs_polarization[d->polarization]);
> +	dvb_store_entry_prop(new, DTV_SYMBOL_RATE,
> +			     d->symbol_rate);
> +	dvb_store_entry_prop(new, DTV_INNER_FEC,
> +			     dvbs_dvbc_dvbs_freq_inner[d->fec]);
> +}
> +
>  
>  static void __dvb_add_update_transponders(struct dvb_v5_fe_parms_priv *parms,
>  					  struct dvb_v5_descriptors *dvb_scan_handler,
> @@ -1045,6 +1159,13 @@ static void __dvb_add_update_transponders(struct dvb_v5_fe_parms_priv *parms,
>  				satellite_delivery_system_descriptor,
>  				NULL, add_update_nit_dvbs, &tr);
>  		return;
> +	case SYS_ISDBS:
> +		dvb_table_nit_descriptor_handler(
> +				&parms->p, dvb_scan_handler->nit,
> +				satellite_delivery_system_descriptor,
> +				NULL, add_update_nit_isdbs, &tr);
> +		return;
> +
>  	default:
>  		dvb_log("Transponders detection not implemented for this standard yet.");
>  		return;
> diff --git a/lib/libdvbv5/parse_string.c b/lib/libdvbv5/parse_string.c
> index 3750d04..6a4de2b 100644
> --- a/lib/libdvbv5/parse_string.c
> +++ b/lib/libdvbv5/parse_string.c
> @@ -366,6 +366,22 @@ static void charset_conversion(struct dvb_v5_fe_parms *parms, char **dest, const
>  				     parms->output_charset);
>  }
>  
> +static void isdb_parse_string(struct dvb_v5_fe_parms *parms, char **dest,
> +			      const unsigned char *src, size_t len)
> +{
> +	int destlen;
> +
> +	destlen = len * 4;
> +	*dest = malloc(destlen + 1);
> +	dvb_iconv_to_charset(parms, *dest, destlen, src, len,
> +			     "ARIB-STD-B24", parms->output_charset);

Hmm... I don't think that iconv supports it. We'll need to add a handler
for it, just like we had to do for EN 300 468 table.

Anyway, you don't need a separate function here. Just 
parms->default_charset needs to be filled properly.

> +	/* The code had over-sized the space. Fix it. */
> +	if (*dest)
> +		*dest = realloc(*dest, strlen(*dest) + 1);
> +	return;
> +}
> +
> +
>  void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
>  		      const unsigned char *src, size_t len)
>  {
> @@ -386,6 +402,13 @@ void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
>  	if (!len)
>  		return;
>  
> +	/* Strings in ISDB-S/T do not start with a charset identifier, */
> +	/*  and can start with a control character. */
> +	if (!strcasecmp(type, "ARIB-STD-B24")) {
> +		isdb_parse_string(parms, dest, src, len);
> +		return;
> +	}
> +
>  	if (*src < 0x20) {
>  		switch (*src) {
>  		case 0x00:	type = "ISO-6937";		break;

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] v4l-utils/dvbv5-scan: add support for ISDB-S scanning
  2014-10-08 12:09 ` [PATCH 4/4] v4l-utils/dvbv5-scan: " tskd08
@ 2014-10-08 16:04   ` Mauro Carvalho Chehab
  2014-10-09 18:11     ` Akihiro TSUKADA
  0 siblings, 1 reply; 13+ messages in thread
From: Mauro Carvalho Chehab @ 2014-10-08 16:04 UTC (permalink / raw)
  To: tskd08; +Cc: linux-media

Em Wed, 08 Oct 2014 21:09:41 +0900
tskd08@gmail.com escreveu:

> From: Akihiro Tsukada <tskd08@gmail.com>
> 
> Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
> ---
>  utils/dvb/dvb-format-convert.c |  3 ++-
>  utils/dvb/dvbv5-scan.c         | 14 ++++++++++++++
>  2 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/dvb/dvb-format-convert.c b/utils/dvb/dvb-format-convert.c
> index 4f0e075..bf37945 100644
> --- a/utils/dvb/dvb-format-convert.c
> +++ b/utils/dvb/dvb-format-convert.c
> @@ -125,7 +125,8 @@ int main(int argc, char **argv)
>  		fprintf(stderr, "ERROR: Please specify a valid output file\n");
>  		missing = 1;
>  	} else if (((args.input_format == FILE_ZAP) ||
> -		   (args.output_format == FILE_ZAP)) && args.delsys <= 0) {
> +		   (args.output_format == FILE_ZAP)) &&
> +		   (args.delsys <= 0 || args.delsys == SYS_ISDBS)) {
>  		fprintf(stderr, "ERROR: Please specify a valid delivery system for ZAP format\n");
>  		missing = 1;
>  	}
> diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
> index cdc82ec..0ef95f3 100644
> --- a/utils/dvb/dvbv5-scan.c
> +++ b/utils/dvb/dvbv5-scan.c
> @@ -251,6 +251,16 @@ static int run_scan(struct arguments *args,
>  		if (dvb_retrieve_entry_prop(entry, DTV_POLARIZATION, &pol))
>  			pol = POLARIZATION_OFF;
>  
> +		if (parms->current_sys == SYS_ISDBS) {
> +			uint32_t tsid = 0;
> +
> +			dvb_store_entry_prop(entry, DTV_POLARIZATION, POLARIZATION_R);
> +
> +			dvb_retrieve_entry_prop(entry, DTV_STREAM_ID, &tsid);
> +			if (!dvb_new_ts_is_needed(dvb_file->first_entry, entry,
> +						  freq, shift, tsid))
> +				continue;

This is likely needed for DVB-T2 and DVB-S2 too.

> +		} else
>  		if (!dvb_new_freq_is_needed(dvb_file->first_entry, entry,
>  					    freq, pol, shift))

Just coding style:
		} else if (!dvb_new_freq_is_needed(dvb_file->first_entry, entry,
  					    freq, pol, shift))

We use the same coding style here as the one defined at the Kernel.

>  			continue;
> @@ -258,6 +268,10 @@ static int run_scan(struct arguments *args,
>  		count++;
>  		dvb_log("Scanning frequency #%d %d", count, freq);
>  
> +		if (!args->lnb_name && entry->lnb &&
> +		    (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias)))

Shouldn't it be: !strcasecmp(entry->lnb, parms->lnb->alias)? Or maybe just
remove this test.

> +			parms->lnb = dvb_sat_get_lnb(dvb_sat_search_lnb(entry->lnb));
> +
>  		/*
>  		 * Run the scanning logic
>  		 */

Regards,
Mauro

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] v4l-utils/libdvbv5: avoid crash when failed to get a channel name
  2014-10-08 12:09 ` [PATCH 1/4] v4l-utils/libdvbv5: avoid crash when failed to get a channel name tskd08
@ 2014-10-08 16:05   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 13+ messages in thread
From: Mauro Carvalho Chehab @ 2014-10-08 16:05 UTC (permalink / raw)
  To: tskd08; +Cc: linux-media

Em Wed, 08 Oct 2014 21:09:38 +0900
tskd08@gmail.com escreveu:

> From: Akihiro Tsukada <tskd08@gmail.com>
> 
> Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
> ---
>  lib/libdvbv5/dvb-file.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
> index 27d9a63..bcb1762 100644
> --- a/lib/libdvbv5/dvb-file.c
> +++ b/lib/libdvbv5/dvb-file.c
> @@ -1121,20 +1121,21 @@ static int get_program_and_store(struct dvb_v5_fe_parms_priv *parms,
>  		if (rc)
>  			dvb_logerr("Couldn't get frontend props");
>  	}
> -	if (!*channel) {
> -		r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
> -		if (r < 0)
> -			dvb_perror("asprintf");
> -		if (parms->p.verbose)
> -			dvb_log("Storing as: '%s'", channel);
> -	}

I prefer to keep the code as is and fix the caller that would be passing
a null pointer here, replacing it for an empty channel name.

>  	for (j = 0; j < parms->n_props; j++) {
>  		entry->props[j].cmd = parms->dvb_prop[j].cmd;
>  		entry->props[j].u.data = parms->dvb_prop[j].u.data;
>  
> -		if (!*channel && entry->props[j].cmd == DTV_FREQUENCY)
> +		if ((!channel || !*channel) &&
> +		    entry->props[j].cmd == DTV_FREQUENCY)
>  			freq = parms->dvb_prop[j].u.data;
>  	}
> +	if (!channel || !*channel) {
> +		r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
> +		if (r < 0)
> +			dvb_perror("asprintf");
> +		if (parms->p.verbose)
> +			dvb_log("Storing as: '%s'", channel);
> +	}
>  	entry->n_props = parms->n_props;
>  	entry->channel = channel;
>  

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S
  2014-10-08 12:09 [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S tskd08
                   ` (3 preceding siblings ...)
  2014-10-08 12:09 ` [PATCH 4/4] v4l-utils/dvbv5-scan: " tskd08
@ 2014-10-08 16:22 ` Mauro Carvalho Chehab
  2014-10-09 16:41   ` Akihiro TSUKADA
  4 siblings, 1 reply; 13+ messages in thread
From: Mauro Carvalho Chehab @ 2014-10-08 16:22 UTC (permalink / raw)
  To: tskd08; +Cc: linux-media

Em Wed, 08 Oct 2014 21:09:37 +0900
tskd08@gmail.com escreveu:

> From: Akihiro Tsukada <tskd08@gmail.com>
> 
> This patch series adds tuning and scanning features for ISDB-S.
> Other part of the libdvbv5 API may not work for ISDB-S.

Thanks for the patchset! I sent you some comments about them.

> At least the charset conversion and the parser for extended
> event descriptors do not work now,
> as they require some ISDB-S(/T) specific modifications.

Yeah, it will likely require a table just like the one we've added
for EN 300 468 specific charset with the euro sign.

There are some patches for charset decoding like this one:

http://marc.info/?l=mplayer-dev-eng&m=125642040004816

Not sure how hard would be to port one of those things to libdvbv5.

Regards,
Mauro

> 
> Akihiro Tsukada (4):
>   v4l-utils/libdvbv5: avoid crash when failed to get a channel name
>   v4l-utils/libdvbv5: add support for ISDB-S tuning
>   v4l-utils/libdvbv5: add support for ISDB-S scanning
>   v4l-utils/dvbv5-scan: add support for ISDB-S scanning
> 
>  lib/include/libdvbv5/dvb-scan.h |   2 +
>  lib/libdvbv5/dvb-fe.c           |   6 +-
>  lib/libdvbv5/dvb-file.c         |  32 +++++++---
>  lib/libdvbv5/dvb-sat.c          |  11 ++++
>  lib/libdvbv5/dvb-scan.c         | 125 +++++++++++++++++++++++++++++++++++++++-
>  lib/libdvbv5/parse_string.c     |  23 ++++++++
>  utils/dvb/dvb-format-convert.c  |   3 +-
>  utils/dvb/dvbv5-scan.c          |  14 +++++
>  8 files changed, 203 insertions(+), 13 deletions(-)
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S
  2014-10-08 16:22 ` [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S Mauro Carvalho Chehab
@ 2014-10-09 16:41   ` Akihiro TSUKADA
  0 siblings, 0 replies; 13+ messages in thread
From: Akihiro TSUKADA @ 2014-10-09 16:41 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

Hi, Mauro,
thanks for the review.

I'll update the patch soon.
And I wrote some comments and questions as a reply to
your each review mail.

On 2014年10月09日 01:22, Mauro Carvalho Chehab wrote:

> Yeah, it will likely require a table just like the one we've added
> for EN 300 468 specific charset with the euro sign.
> 
> There are some patches for charset decoding like this one:
> 
> http://marc.info/?l=mplayer-dev-eng&m=125642040004816

I already looked over other examples in some Japan local patches
to the applications like mplayer,gstreamer, mythtv...,
( https://github.com/0p1pp1?tab=repositories
  https://github.com/takaakis62/mythtv_isdb )
so I'm going to reuse those code.

regards,
akihiro

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] v4l-utils/dvbv5-scan: add support for ISDB-S scanning
  2014-10-08 16:04   ` Mauro Carvalho Chehab
@ 2014-10-09 18:11     ` Akihiro TSUKADA
  2014-10-09 18:35       ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 13+ messages in thread
From: Akihiro TSUKADA @ 2014-10-09 18:11 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

On 2014年10月09日 01:04, Mauro Carvalho Chehab wrote:
>> @@ -251,6 +251,16 @@ static int run_scan(struct arguments *args,
>>  		if (dvb_retrieve_entry_prop(entry, DTV_POLARIZATION, &pol))
>>  			pol = POLARIZATION_OFF;
>>  
>> +		if (parms->current_sys == SYS_ISDBS) {
>> +			uint32_t tsid = 0;
>> +
>> +			dvb_store_entry_prop(entry, DTV_POLARIZATION, POLARIZATION_R);
>> +
>> +			dvb_retrieve_entry_prop(entry, DTV_STREAM_ID, &tsid);
>> +			if (!dvb_new_ts_is_needed(dvb_file->first_entry, entry,
>> +						  freq, shift, tsid))
>> +				continue;
> 
> This is likely needed for DVB-T2 and DVB-S2 too.

Should we compare channel entries by (freq, stream_id, polarization) triplet
instead of by the current (freq, polarization) or (freq, stream_id)?

>> @@ -258,6 +268,10 @@ static int run_scan(struct arguments *args,
>>  		count++;
>>  		dvb_log("Scanning frequency #%d %d", count, freq);
>>  
>> +		if (!args->lnb_name && entry->lnb &&
>> +		    (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias)))
> 
> Shouldn't it be: !strcasecmp(entry->lnb, parms->lnb->alias)? Or maybe just
> remove this test.
I want to update parms->lnb (which was set from the prev entry)
only if it differs from entry->lnb (current one),
and don't want to linear-search all LNB types for every entries,
as lots of entries are expected to have the same LNB types.
--
akihiro 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] v4l-utils/dvbv5-scan: add support for ISDB-S scanning
  2014-10-09 18:11     ` Akihiro TSUKADA
@ 2014-10-09 18:35       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 13+ messages in thread
From: Mauro Carvalho Chehab @ 2014-10-09 18:35 UTC (permalink / raw)
  To: Akihiro TSUKADA; +Cc: linux-media

Em Fri, 10 Oct 2014 03:11:32 +0900
Akihiro TSUKADA <tskd08@gmail.com> escreveu:

> On 2014年10月09日 01:04, Mauro Carvalho Chehab wrote:
> >> @@ -251,6 +251,16 @@ static int run_scan(struct arguments *args,
> >>  		if (dvb_retrieve_entry_prop(entry, DTV_POLARIZATION, &pol))
> >>  			pol = POLARIZATION_OFF;
> >>  
> >> +		if (parms->current_sys == SYS_ISDBS) {
> >> +			uint32_t tsid = 0;
> >> +
> >> +			dvb_store_entry_prop(entry, DTV_POLARIZATION, POLARIZATION_R);
> >> +
> >> +			dvb_retrieve_entry_prop(entry, DTV_STREAM_ID, &tsid);
> >> +			if (!dvb_new_ts_is_needed(dvb_file->first_entry, entry,
> >> +						  freq, shift, tsid))
> >> +				continue;
> > 
> > This is likely needed for DVB-T2 and DVB-S2 too.
> 
> Should we compare channel entries by (freq, stream_id, polarization) triplet
> instead of by the current (freq, polarization) or (freq, stream_id)?

For DVB-S2, it should likely  be (freq, stream_id, polarization) triplet
(tests needed).

For DVB-T2, (freq, stream_id) pair should work;

For ISDB-S, you likely need the (freq, stream_id, polarization) triplet
too, as you may have two polarizations there, right?

> >> @@ -258,6 +268,10 @@ static int run_scan(struct arguments *args,
> >>  		count++;
> >>  		dvb_log("Scanning frequency #%d %d", count, freq);
> >>  
> >> +		if (!args->lnb_name && entry->lnb &&
> >> +		    (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias)))
> > 
> > Shouldn't it be: !strcasecmp(entry->lnb, parms->lnb->alias)? Or maybe just
> > remove this test.
> I want to update parms->lnb (which was set from the prev entry)
> only if it differs from entry->lnb (current one),
> and don't want to linear-search all LNB types for every entries,
> as lots of entries are expected to have the same LNB types.

Ah, ok. Please add a comment then.

> --
> akihiro 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-10-09 18:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-08 12:09 [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S tskd08
2014-10-08 12:09 ` [PATCH 1/4] v4l-utils/libdvbv5: avoid crash when failed to get a channel name tskd08
2014-10-08 16:05   ` Mauro Carvalho Chehab
2014-10-08 12:09 ` [PATCH 2/4] v4l-utils/libdvbv5: add support for ISDB-S tuning tskd08
2014-10-08 13:57   ` Mauro Carvalho Chehab
2014-10-08 12:09 ` [PATCH 3/4] v4l-utils/libdvbv5: add support for ISDB-S scanning tskd08
2014-10-08 15:59   ` Mauro Carvalho Chehab
2014-10-08 12:09 ` [PATCH 4/4] v4l-utils/dvbv5-scan: " tskd08
2014-10-08 16:04   ` Mauro Carvalho Chehab
2014-10-09 18:11     ` Akihiro TSUKADA
2014-10-09 18:35       ` Mauro Carvalho Chehab
2014-10-08 16:22 ` [PATCH 0/4] v4l-utils:libdvbv5,dvb: add basic support for ISDB-S Mauro Carvalho Chehab
2014-10-09 16:41   ` Akihiro TSUKADA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).