[linux-dvb] [PATCH] dvb-apps: fix a few problems in scan wrt VDR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The attached patches fix the following bugs in scan.

 - duplicate "0x" in some debug text
   - "0x%#04x" => "0x0x1234"

 - breakage in Freeview channel number parsing
   - was applying the wrong mask for bits 8 and 9 due to operator precedence

 - always output the stream ID (needed for EPG data association in VDR)
   - may be the wrong method...?

 - output of audio language information (for VDR 1.3.x)
   - assumption: audio language 0 is also applicable to the AC3 stream

-- 
| Darren Salt                    | nr. Ashington, | RISC OS,
| ds@xxxxxxxxxxxxxxxxxxxxxxxxxxx | Northumberland | Linux
| ds@xxxxxxxxxxxxxxxx            | *Toon Army*    |
|   Down with the Mackems!

Small change can often be found under seat cushions.
-------------- next part --------------
Index: util/scan/scan.c
===================================================================
RCS file: /cvs/linuxtv/dvb-apps/util/scan/scan.c,v
retrieving revision 1.19
diff -u -r1.19 scan.c
--- util/scan/scan.c	28 Aug 2005 22:52:21 -0000	1.19
+++ util/scan/scan.c	22 Oct 2005 22:22:26 -0000
@@ -401,7 +403,7 @@
 	t->param.inversion = spectral_inversion;
 
 	if (verbosity >= 5) {
-		debug("0x%#04x/0x%#04x ", t->network_id, t->transport_stream_id);
+		debug("%#04x/%#04x ", t->network_id, t->transport_stream_id);
 		dump_dvb_parameters (stderr, t);
 		if (t->scan_done)
 			dprintf(5, " (done)");
@@ -433,7 +435,7 @@
 	t->we_flag = buf[8] >> 7;
 
 	if (verbosity >= 5) {
-		debug("0x%#04x/0x%#04x ", t->network_id, t->transport_stream_id);
+		debug("%#04x/%#04x ", t->network_id, t->transport_stream_id);
 		dump_dvb_parameters (stderr, t);
 		if (t->scan_done)
 			dprintf(5, " (done)");
@@ -487,7 +489,7 @@
 	t->other_frequency_flag = (buf[8] & 0x01);
 
 	if (verbosity >= 5) {
-		debug("0x%#04x/0x%#04x ", t->network_id, t->transport_stream_id);
+		debug("%#04x/%#04x ", t->network_id, t->transport_stream_id);
 		dump_dvb_parameters (stderr, t);
 		if (t->scan_done)
 			dprintf(5, " (done)");
-------------- next part --------------
Index: util/scan/scan.c
===================================================================
RCS file: /cvs/linuxtv/dvb-apps/util/scan/scan.c,v
retrieving revision 1.19
diff -u -r1.19 scan.c
--- util/scan/scan.c	28 Aug 2005 22:52:21 -0000	1.19
+++ util/scan/scan.c	22 Oct 2005 22:22:26 -0000
@@ -343,7 +345,7 @@
 	buf += 2;
 	for (i = 0; i < n; i++) {
 		service_id = (buf[0]<<8)|(buf[1]&0xff);
-		channel_num = (buf[2]&0x03<<8)|(buf[3]&0xff);
+		channel_num = ((buf[2]&0x03)<<8)|(buf[3]&0xff);
 		debug("Service ID 0x%x has channel number %d ", service_id, channel_num);
 		list_for_each(p1, &scanned_transponders) {
 			t = list_entry(p1, struct transponder, list);
-------------- next part --------------
Index: util/scan/scan.c
===================================================================
RCS file: /cvs/linuxtv/dvb-apps/util/scan/scan.c,v
retrieving revision 1.19
diff -u -r1.19 scan.c
--- util/scan/scan.c	28 Aug 2005 22:52:21 -0000	1.19
+++ util/scan/scan.c	22 Oct 2005 22:22:26 -0000
@@ -257,11 +257,13 @@
  * (the DVB standards say theay should be unique within one
  * network, but in real life...)
  */
-static struct service *alloc_service(struct transponder *tp, int service_id)
+static struct service *alloc_service(struct transponder *tp, int service_id,
+				     int transport_stream_id)
 {
 	struct service *s = calloc(1, sizeof(*s));
 	INIT_LIST_HEAD(&s->list);
 	s->service_id = service_id;
+	s->transport_stream_id = transport_stream_id;
 	list_add_tail(&s->list, &tp->services);
 	return s;
 }
@@ -702,7 +704,7 @@
 		/* SDT might have been parsed first... */
 		s = find_service(current_tp, service_id);
 		if (!s)
-			s = alloc_service(current_tp, service_id);
+			s = alloc_service(current_tp, service_id, transport_stream_id);
 		s->pmt_pid = ((buf[2] & 0x1f) << 8) | buf[3];
 		if (!s->priv && s->pmt_pid) {
 			s->priv = malloc(sizeof(struct section_buf));
@@ -892,7 +894,7 @@
 		s = find_service(current_tp, service_id);
 		if (!s)
 			/* maybe PAT has not yet been parsed... */
-			s = alloc_service(current_tp, service_id);
+			s = alloc_service(current_tp, service_id, transport_stream_id);
 
 		s->running = (buf[3] >> 5) & 0x7;
 		s->scrambled = (buf[3] >> 4) & 1;
@@ -1020,7 +1022,7 @@
 
 		s = find_service(current_tp, ch.program_number);
 		if (!s)
-			s = alloc_service(current_tp, ch.program_number);
+			s = alloc_service(current_tp, ch.program_number, transport_stream_id);
 
 		if (s->service_name)
 			free(s->service_name);
-------------- next part --------------
Index: util/scan/dump-vdr.c
===================================================================
RCS file: /cvs/linuxtv/dvb-apps/util/scan/dump-vdr.c,v
retrieving revision 1.4
diff -u -r1.4 dump-vdr.c
--- util/scan/dump-vdr.c	10 May 2005 20:29:17 -0000	1.4
+++ util/scan/dump-vdr.c	22 Oct 2005 22:22:21 -0000
@@ -120,6 +120,7 @@
 				 int video_pid,
 				 int pcr_pid,
 				 uint16_t *audio_pid,
+				 char audio_lang[][4],
                                  int audio_num,
 				 int teletext_pid,
 				 int scrambled,
@@ -138,6 +139,11 @@
         int i;
 
 	if ((video_pid || audio_pid[0]) && ((ca_select > 0) || ((ca_select == 0) && (scrambled == 0)))) {
+		if (vdr_version <= 2) {
+			audio_lang = NULL;
+			network_id = 0;
+			transport_stream_id = 0;
+		}
 		if ((dump_channum == 1) && (channel_num > 0))
 			fprintf(f, ":@%i\n", channel_num);
 		if (vdr_version >= 3)
@@ -154,15 +160,21 @@
 		else
 			fprintf (f, "%i:", video_pid);
 		fprintf (f, "%i", audio_pid[0]);
+		if (audio_lang && audio_lang[0][0])
+			fprintf (f, "=%.4s", audio_lang[0]);
 	        for (i = 1; i < audio_num; i++)
+	        {
 			fprintf (f, ",%i", audio_pid[i]);
+			if (audio_lang && audio_lang[i][0])
+				fprintf (f, "=%.4s", audio_lang[i]);
+		}
 		if (ac3_pid)
+	        {
 			fprintf (f, ";%i", ac3_pid);
+			if (audio_lang && audio_lang[0][0])
+				fprintf (f, "=%.4s", audio_lang[0]);
+ 		}
 		if (scrambled == 1) scrambled = ca_select;
-		if (vdr_version == 2) {
-			network_id = 0;
-			transport_stream_id = 0;
-		}
 		fprintf (f, ":%d:%d:%d:%d:%d:0", teletext_pid, scrambled,
 				service_id, network_id, transport_stream_id);
 		fprintf (f, "\n");
Index: util/scan/dump-vdr.h
===================================================================
RCS file: /cvs/linuxtv/dvb-apps/util/scan/dump-vdr.h,v
retrieving revision 1.2
diff -u -r1.2 dump-vdr.h
--- util/scan/dump-vdr.h	19 Jan 2004 20:43:07 -0000	1.2
+++ util/scan/dump-vdr.h	22 Oct 2005 22:22:21 -0000
@@ -19,6 +19,7 @@
 				 int video_pid,
 				 int pcr_pid,
 				 uint16_t *audio_pid,
+				 char audio_lang[][4],
                                  int audio_num,
 				 int teletext_pid,
 				 int scrambled,
Index: util/scan/scan.c
===================================================================
RCS file: /cvs/linuxtv/dvb-apps/util/scan/scan.c,v
retrieving revision 1.19
diff -u -r1.19 scan.c
--- util/scan/scan.c	28 Aug 2005 22:52:21 -0000	1.19
+++ util/scan/scan.c	22 Oct 2005 22:22:26 -0000
@@ -1968,7 +1970,7 @@
 						    s->video_pid,
 						    s->pcr_pid,
 						    s->audio_pid,
-						    //FIXME: s->audio_lang
+						    s->audio_lang,
 						    s->audio_num,
 						    s->teletext_pid,
 						    s->scrambled,

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux