Mailing List archive

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

[linux-dvb] Adapt scan output format to match vdr channels.conf



I put this patch together to adapt the channels.conf output format to that expected by vdr-1.1.27, the patch works for me, but I imagine you will probably want to incorporate it differently so that it doesn't break compatibility with the tzap format.

Another aspect of the patch adds support for multiple audio pids which vdr accepts in a comma separated list.

The patch needs work on the Cable & Sat output format, but I don't have any way to try that out. I have recently found a similar "vdrscan" patch on the vdr portal, so I may try to merge them together.

I thought i'd send it now anyway, just in case anyone else finds it useful.

Jon
diff -urw scan-cvs/dump.c scan/dump.c
--- scan-cvs/dump.c	2002-10-28 11:59:46.000000000 +0000
+++ scan/dump.c	2003-04-17 22:21:14.000000000 +0100
@@ -1,75 +1,79 @@
 #include <stdio.h>
 #include <linux/dvb/frontend.h>
 
+/* Modified to produce vdr compatible channel list */
+
 static const char *inv_name [] = {
-	"INVERSION_OFF",
-	"INVERSION_ON",
+	"0",
+	"1",
 	"INVERSION_AUTO"
 };
 
 static const char *fec_name [] = {
-	"FEC_NONE",
-	"FEC_1_2",
-	"FEC_2_3",
-	"FEC_3_4",
-	"FEC_4_5",
-	"FEC_5_6",
-	"FEC_6_7",
-	"FEC_7_8",
-	"FEC_8_9",
+	"0",
+	"12",
+	"23",
+	"34",
+	"45",
+	"56",
+	"67",
+	"78",
+	"89",
 	"FEC_AUTO"
 };
 
 
 static const char *qam_name [] = {
-	"QPSK",
-	"QAM_16",
-	"QAM_32",
-	"QAM_64",
-	"QAM_128",
-	"QAM_256",
+	"0",
+	"16",
+	"32",
+	"64",
+	"128",
+	"256",
 	"QAM_AUTO"
 };
 
 
 static const char *bw_name [] = {
-	"BANDWIDTH_8_MHZ",
-	"BANDWIDTH_7_MHZ",
-	"BANDWIDTH_6_MHZ",
+	"8",
+	"7",
+	"6",
 	"BANDWIDTH_AUTO"
 };
 
 
 static const char *mode_name [] = {
-	"TRANSMISSION_MODE_2K",
-	"TRANSMISSION_MODE_8K",
+	"2",
+	"8",
 	"TRANSMISSION_MODE_AUTO"
 };
 
 static const char *guard_name [] = {
-	"GUARD_INTERVAL_1_32",
-	"GUARD_INTERVAL_1_16",
-	"GUARD_INTERVAL_1_8",
-	"GUARD_INTERVAL_1_4",
+	"32",
+	"16",
+	"8",
+	"4",
 	"GUARD_INTERVAL_AUTO"
 };
 
 
 static const char *hierarchy_name [] = {
-	"HIERARCHY_NONE",
-	"HIERARCHY_1",
-	"HIERARCHY_2",
-	"HIERARCHY_4",
+	"0",
+	"1",
+	"2",
+	"4",
 	"HIERARCHY_AUTO"
 };
 
 
 void dump_dvb_parameters (FILE *f, fe_type_t type, struct dvb_frontend_parameters *p)
 {
-	fprintf (f, "%i:", p->frequency);
-	fprintf (f, "%s:", inv_name[p->inversion]);
+	fprintf (f, "%i:", p->frequency / 1000);
+	fprintf (f, "I%s", inv_name[p->inversion]);
 
 	switch (type) {
+#if 0
+/* No idea about these */
 	case FE_QPSK:
 		fprintf (f, "%i:", p->u.qpsk.symbol_rate);
 		fprintf (f, "%s", fec_name[p->u.qpsk.fec_inner]);
@@ -80,15 +84,16 @@
 		fprintf (f, "%s:", fec_name[p->u.qpsk.fec_inner]);
 		fprintf (f, "%s", qam_name[p->u.qam.modulation]);
 		break;
-
+#endif
 	case FE_OFDM:
-		fprintf (f, "%s:", bw_name[p->u.ofdm.bandwidth]);
-		fprintf (f, "%s:", fec_name[p->u.ofdm.code_rate_HP]);
-		fprintf (f, "%s:", fec_name[p->u.ofdm.code_rate_LP]);
-		fprintf (f, "%s:", qam_name[p->u.ofdm.constellation]);
-		fprintf (f, "%s:", mode_name[p->u.ofdm.transmission_mode]);
-		fprintf (f, "%s:", guard_name[p->u.ofdm.guard_interval]);
-		fprintf (f, "%s", hierarchy_name[p->u.ofdm.hierarchy_information]);
+		fprintf (f, "B%s", bw_name[p->u.ofdm.bandwidth]);
+		fprintf (f, "C%s", fec_name[p->u.ofdm.code_rate_HP]);
+		fprintf (f, "D%s", fec_name[p->u.ofdm.code_rate_LP]);
+		fprintf (f, "M%s", qam_name[p->u.ofdm.constellation]);
+		fprintf (f, "T%s", mode_name[p->u.ofdm.transmission_mode]);
+		fprintf (f, "G%s", guard_name[p->u.ofdm.guard_interval]);
+		fprintf (f, "Y%s", hierarchy_name[p->u.ofdm.hierarchy_information]);
+		fprintf (f, ":T:27500");
 		break;
 
 	default:
@@ -101,11 +106,19 @@
 				 fe_type_t type,
 				 struct dvb_frontend_parameters *p,
 				 int video_pid,
-				 int audio_pid)
+				 int *audio_pid,
+                                 int audio_num,
+                                 int service_id)
 {
+        int i;
+        
 	fprintf (f, "%s:", service_name);
 	dump_dvb_parameters (f, type, p);
-	fprintf (f, ":%i:%i", video_pid, audio_pid);
+	fprintf (f, ":%i:", video_pid);
+	fprintf (f, "%i", audio_pid[0]);
+        for (i=1; i<audio_num; i++)
+        	fprintf (f, ",%i", audio_pid[i]);        
+	fprintf (f, ":0:0:%d:0:0:0", service_id);
 	fprintf (f, "\n");
 }
 
diff -urw scan-cvs/dump.h scan/dump.h
--- scan-cvs/dump.h	2002-10-28 11:59:46.000000000 +0000
+++ scan/dump.h	2003-04-17 22:18:41.000000000 +0100
@@ -12,7 +12,9 @@
 				 fe_type_t type,
 				 struct dvb_frontend_parameters *p,
 				 int video_pid,
-				 int audio_pid);
+				 int *audio_pid,
+                                 int audio_num,
+                                 int service_id);
 
 #endif
 
diff -urw scan-cvs/scan.c scan/scan.c
--- scan-cvs/scan.c	2003-02-28 11:18:40.000000000 +0000
+++ scan/scan.c	2003-04-18 13:18:07.000000000 +0100
@@ -86,6 +86,7 @@
 	RM_RUNNING     = 0x04
 };
 
+#define AUDIO_CHAN_MAX (5)
 
 struct service {
 	int transport_stream_id;
@@ -95,7 +96,8 @@
 	uint16_t pmt_pid;
 	uint16_t pcr_pid;
 	uint16_t video_pid;
-	uint16_t audio_pid;
+	int audio_pid[AUDIO_CHAN_MAX];
+        int audio_num;
 	int private_pid_count     : 8;
 	enum service_type type    : 8;
 	enum running_mode running : 3;
@@ -453,6 +455,9 @@
 {
 	int program_info_len;
 	struct service *s;
+        char msg_buf[6 * AUDIO_CHAN_MAX + 1];
+        char *tmp;
+        int i;
 
 	s = find_or_alloc_entry_by_id (&service_list,
 				       -1,
@@ -476,7 +481,7 @@
 			break;
 		case 0x03:
 		case 0x04:
-			s->audio_pid = elementary_pid;
+			s->audio_pid[s->audio_num++] = elementary_pid;
 			break;
 		default:
 			s->private_pid_count++;
@@ -486,11 +491,18 @@
 		section_length -= ES_info_len + 5;
 	};
 
-	MSG("0x%04x 0x%04x: %s -- %s, pmt_pid 0x%04x, vpid 0x%04x, apid 0x%04x",
+
+        tmp = msg_buf;
+        tmp += sprintf(tmp, "%d", s->audio_pid[0]);
+
+        for( i=1; i<s->audio_num; i++)
+                tmp += sprintf(tmp, ",%d", s->audio_pid[i]);             
+                                              
+        MSG("0x%04x 0x%04x: %s -- %s, pmt_pid 0x%04x, vpid 0x%04x, apid %s",
 	    s->transport_stream_id,
 	    s->service_id,
 	    s->provider_name, s->service_name,
-	    s->pmt_pid, s->video_pid, s->audio_pid);
+	    s->pmt_pid, s->video_pid, msg_buf);
 }
 
 
@@ -1146,7 +1158,9 @@
 						    t->type,
 						    &t->param,
 						    s->video_pid,
-						    s->audio_pid);
+						    s->audio_pid, 
+                                                    s->audio_num,
+                                                    s->service_id); 
 		}
 	}
 }

Home | Main Index | Thread Index