changeset 14382:42d792053cde

added support for ATSC tuner and conf.file
author nicodvb
date Thu, 06 Jan 2005 09:43:10 +0000
parents dc7b86065e3c
children 8276bbb59528
files libmpdemux/dvb_tune.c libmpdemux/dvbin.c libmpdemux/dvbin.h
diffstat 3 files changed, 58 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/dvb_tune.c	Thu Jan 06 00:06:56 2005 +0000
+++ b/libmpdemux/dvb_tune.c	Thu Jan 06 09:43:10 2005 +0000
@@ -84,6 +84,11 @@
       mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-C\n");
 	  return TUNER_CBL;
 
+#ifdef DVB_ATSC
+	case FE_ATSC:
+      mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-ATSC\n");
+	  return TUNER_ATSC;
+#endif
 	default:
 	  mp_msg(MSGT_DEMUX, MSGL_ERR, "UNKNOWN TUNER TYPE\n");
 	  return 0;
@@ -386,6 +391,12 @@
 			mp_msg(MSGT_DEMUX, MSGL_V, "        SymbolRate: %d\n",feparams->u.qpsk.symbol_rate);
 			mp_msg(MSGT_DEMUX, MSGL_V, "        FEC_inner:  %d\n",feparams->u.qpsk.fec_inner);
 			break;
+#ifdef DVB_ATSC
+			case FE_ATSC:
+			mp_msg(MSGT_DEMUX, MSGL_V, "Event:  Frequency: %d\n",feparams->frequency);
+			mp_msg(MSGT_DEMUX, MSGL_V, "        Modulation: %d\n",feparams->u.vsb.modulation);
+			break;
+#endif
 			default:
 			break;
 		}
@@ -755,6 +766,13 @@
       feparams.u.qam.QAM = modulation;
 #endif
       break;
+#ifdef DVB_ATSC
+    case FE_ATSC:
+      mp_msg(MSGT_DEMUX, MSGL_V, "tuning ATSC to %d, modulation=%d\n",freq,modulation);
+      feparams.frequency=freq;
+      feparams.u.vsb.modulation = modulation;
+      break;
+#endif
     default:
       mp_msg(MSGT_DEMUX, MSGL_V, "Unknown FE type. Aborting\n");
       return 0;
--- a/libmpdemux/dvbin.c	Thu Jan 06 00:06:56 2005 +0000
+++ b/libmpdemux/dvbin.c	Thu Jan 06 09:43:10 2005 +0000
@@ -133,6 +133,7 @@
 	const char *cbl_conf = "%a[^:]:%d:%a[^:]:%d:%a[^:]:%a[^:]:%a[^:]:%a[^:]\n";
 	const char *sat_conf = "%a[^:]:%d:%c:%d:%d:%a[^:]:%a[^:]\n";
 	const char *ter_conf = "%a[^:]:%d:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]\n";
+	const char *atsc_conf = "%a[^:]:%d:%a[^:]:%a[^:]:%a[^:]\n";
 	
 	mp_msg(MSGT_DEMUX, MSGL_V, "CONFIG_READ FILE: %s, type: %d\n", filename, type);
 	if((f=fopen(filename, "r"))==NULL)
@@ -180,6 +181,16 @@
 				"CBL, NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d, SRATE: %d",
 				list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->srate);
 		}
+#ifdef DVB_ATSC
+		else if(type == TUNER_ATSC)
+		{
+			fields = sscanf(line, atsc_conf,
+				&ptr->name, &ptr->freq, &mod, &vpid_str, &apid_str);
+			mp_msg(MSGT_DEMUX, MSGL_V,
+				"ATSC, NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d\n",
+				list->NUM_CHANNELS, fields, ptr->name, ptr->freq);
+		}
+#endif
 		else //SATELLITE
 		{
 			fields = sscanf(line, sat_conf,
@@ -264,7 +275,11 @@
 			else if(! strcmp(cr, "FEC_NONE"))
 				ptr->cr =FEC_NONE;
 			else ptr->cr =FEC_AUTO;
+		}
+	
 
+		if((type == TUNER_TER) || (type == TUNER_CBL) || (type == TUNER_ATSC))
+		{
 			if(! strcmp(mod, "QAM_128"))
 				ptr->mod = QAM_128;
 			else if(! strcmp(mod, "QAM_256"))
@@ -275,10 +290,16 @@
 				ptr->mod = QAM_32;
 			else if(! strcmp(mod, "QAM_16"))
 				ptr->mod = QAM_16;
-			//else ptr->mod = QPSK;
+#ifdef DVB_ATSC	
+			else if(! strcmp(mod, "VSB_8") || ! strcmp(mod, "8VSB"))
+				ptr->mod = VSB_8;
+			else if(! strcmp(mod, "VSB_16") || !strcmp(mod, "16VSB"))
+				ptr->mod = VSB_16;
+
+			ptr->inv = INVERSION_AUTO;
+#endif
 		}
 
-
 		if(type == TUNER_TER)
 		{
 			if(! strcmp(bw, "BANDWIDTH_6_MHZ"))
@@ -487,6 +508,11 @@
 			sprintf(priv->new_tuning, "%d|%09d|%d|%d|%d|%d", priv->card, channel->freq, channel->inv, channel->srate,
 				channel->cr, channel->mod);
 		break;
+#ifdef DVB_ATSC
+		case TUNER_ATSC:
+			sprintf(priv->new_tuning, "%d|%09d|%d", priv->card, channel->freq, channel->mod);
+		break;
+#endif
 	}
 
 
@@ -752,7 +778,7 @@
 			
 		type = dvb_get_tuner_type(fd);
 		close(fd);
-		if(type != TUNER_SAT && type != TUNER_TER && type != TUNER_CBL)
+		if(type != TUNER_SAT && type != TUNER_TER && type != TUNER_CBL && type != TUNER_ATSC)
 		{
 			mp_msg(MSGT_DEMUX, MSGL_V, "DVB_CONFIG, can't detect tuner type of card %d, skipping\n", i);
 			continue;
@@ -769,6 +795,9 @@
 				case TUNER_SAT:
 				conf_file = get_path("channels.conf.sat");
 					break;
+				case TUNER_ATSC:
+				conf_file = get_path("channels.conf.atsc");
+					break;
 			}
 		
 		if((access(conf_file, F_OK | R_OK) != 0))
--- a/libmpdemux/dvbin.h	Thu Jan 06 00:06:56 2005 +0000
+++ b/libmpdemux/dvbin.h	Thu Jan 06 09:43:10 2005 +0000
@@ -8,6 +8,7 @@
 #ifdef HAVE_DVB_HEAD
 	#include <linux/dvb/dmx.h>
 	#include <linux/dvb/frontend.h>
+	#include <linux/dvb/version.h>
 #else
 	#include <ost/dmx.h>
 	#include <ost/sec.h>
@@ -26,6 +27,12 @@
 	#define dmx_pes_type_t dmxPesType_t
 #endif
 
+#undef DVB_ATSC
+#if defined(DVB_API_VERSION_MINOR)
+#if DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR >= 1
+#define DVB_ATSC 1
+#endif
+#endif
 
 
 #define DVB_CHANNEL_LOWER -1
@@ -92,6 +99,7 @@
 #define TUNER_SAT	1
 #define TUNER_TER	2
 #define TUNER_CBL	3
+#define TUNER_ATSC	4
 
 extern int dvb_step_channel(dvb_priv_t *, int);
 extern int dvb_set_channel(dvb_priv_t *, int, int);