kaffeine s2api v2 patch

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

 



If anyone is interested.
Applies to kaffeine svn.

-- 
Christophe Thommeret
Index: src/player-parts/xine-part/kxinewidget.cpp
===================================================================
--- src/player-parts/xine-part/kxinewidget.cpp	(révision 863489)
+++ src/player-parts/xine-part/kxinewidget.cpp	(copie de travail)
@@ -1858,7 +1858,7 @@
 
 void KXineWidget::setDvb( const QString &pipeName, const QString &chanName, int haveVideo )
 {
-	m_trackURL = pipeName;
+	m_trackURL = /*"fifo://"+*/pipeName;
 	m_trackTitle = chanName;
 	dvbHaveVideo = haveVideo;
 }
@@ -1875,7 +1875,7 @@
 	clearQueue();
 	m_lengthInfoTimer.stop();
 	m_posTimer.stop();
-	xine_set_param( m_xineStream, XINE_PARAM_METRONOM_PREBUFFER, 180000);
+	xine_set_param( m_xineStream, XINE_PARAM_METRONOM_PREBUFFER, 90000);
 	if (!xine_open(m_xineStream, QFile::encodeName(m_trackURL))) {
 		sendXineError();
 		return false;
Index: src/kaffeine.cpp
===================================================================
--- src/kaffeine.cpp	(révision 863489)
+++ src/kaffeine.cpp	(copie de travail)
@@ -307,8 +307,10 @@
 	}
 	loadTMP(urls);
 
-	if (args->isSet("fullscreen"))
+	if (args->isSet("fullscreen")) {
+		inplug->showPlayer();
 		fullscreen();
+	}
 
 	if (args->isSet("minimal"))
 		minimal();
@@ -1210,8 +1212,6 @@
 			inplug->fullscreen( false );
 		}
 
-		inplug->showPlayer();
-
 		if (m_haveKWin)
 			KWin::clearState(winId(), NET::FullScreen);
 		else
Index: src/input/dvb/channeleditorui.ui
===================================================================
--- src/input/dvb/channeleditorui.ui	(révision 863489)
+++ src/input/dvb/channeleditorui.ui	(copie de travail)
@@ -9,7 +9,7 @@
             <x>0</x>
             <y>0</y>
             <width>477</width>
-            <height>533</height>
+            <height>541</height>
         </rect>
     </property>
     <property name="caption">
@@ -19,7 +19,7 @@
         <property name="name">
             <cstring>unnamed</cstring>
         </property>
-        <widget class="Line" row="1" column="0">
+        <widget class="Line" row="0" column="1">
             <property name="name">
                 <cstring>line2</cstring>
             </property>
@@ -35,7 +35,7 @@
         </widget>
         <widget class="QLayoutWidget" row="0" column="0">
             <property name="name">
-                <cstring>layout9</cstring>
+                <cstring>layout7</cstring>
             </property>
             <vbox>
                 <property name="name">
@@ -432,22 +432,6 @@
                                 <cstring>transmissionComb</cstring>
                             </property>
                         </widget>
-                        <widget class="QLabel" row="3" column="0">
-                            <property name="name">
-                                <cstring>textLabel11</cstring>
-                            </property>
-                            <property name="sizePolicy">
-                                <sizepolicy>
-                                    <hsizetype>4</hsizetype>
-                                    <vsizetype>5</vsizetype>
-                                    <horstretch>0</horstretch>
-                                    <verstretch>0</verstretch>
-                                </sizepolicy>
-                            </property>
-                            <property name="text">
-                                <string>Bandwidth:</string>
-                            </property>
-                        </widget>
                         <widget class="QLabel" row="2" column="0">
                             <property name="name">
                                 <cstring>textLabel10</cstring>
@@ -480,11 +464,6 @@
                                 <string>Transmission:</string>
                             </property>
                         </widget>
-                        <widget class="QComboBox" row="3" column="1">
-                            <property name="name">
-                                <cstring>bandwidthComb</cstring>
-                            </property>
-                        </widget>
                         <widget class="QComboBox" row="2" column="1">
                             <property name="name">
                                 <cstring>coderateHComb</cstring>
@@ -511,11 +490,6 @@
                                 <string>FEC low:</string>
                             </property>
                         </widget>
-                        <widget class="QComboBox" row="3" column="3">
-                            <property name="name">
-                                <cstring>guardComb</cstring>
-                            </property>
-                        </widget>
                         <widget class="QLabel" row="3" column="2">
                             <property name="name">
                                 <cstring>textLabel7</cstring>
@@ -595,6 +569,58 @@
                                 <string>Inversion:</string>
                             </property>
                         </widget>
+                        <widget class="QLabel" row="3" column="0">
+                            <property name="name">
+                                <cstring>textLabel11</cstring>
+                            </property>
+                            <property name="sizePolicy">
+                                <sizepolicy>
+                                    <hsizetype>4</hsizetype>
+                                    <vsizetype>5</vsizetype>
+                                    <horstretch>0</horstretch>
+                                    <verstretch>0</verstretch>
+                                </sizepolicy>
+                            </property>
+                            <property name="text">
+                                <string>Bandwidth:</string>
+                            </property>
+                        </widget>
+                        <widget class="QComboBox" row="3" column="1">
+                            <property name="name">
+                                <cstring>bandwidthComb</cstring>
+                            </property>
+                        </widget>
+                        <widget class="QLabel" row="4" column="0">
+                            <property name="name">
+                                <cstring>textLabel1_3</cstring>
+                            </property>
+                            <property name="text">
+                                <string>Type:</string>
+                            </property>
+                        </widget>
+                        <widget class="QComboBox" row="4" column="1">
+                            <property name="name">
+                                <cstring>stypeComb</cstring>
+                            </property>
+                        </widget>
+                        <widget class="QComboBox" row="4" column="3">
+                            <property name="name">
+                                <cstring>rolloffComb</cstring>
+                            </property>
+                        </widget>
+                        <widget class="QLabel" row="4" column="2">
+                            <property name="name">
+                                <cstring>textLabel2_4</cstring>
+                            </property>
+                            <property name="text">
+                                <string>Roll off:</string>
+                            </property>
+                        </widget>
+                        <widget class="QComboBox" row="3" column="3">
+                            <property name="name">
+                                <cstring>guardComb</cstring>
+                            </property>
+                        </widget>
                     </grid>
                 </widget>
                 <spacer>
@@ -610,7 +636,7 @@
                     <property name="sizeHint">
                         <size>
                             <width>20</width>
-                            <height>98</height>
+                            <height>166</height>
                         </size>
                     </property>
                 </spacer>
Index: src/input/dvb/channeldesc.h
===================================================================
--- src/input/dvb/channeldesc.h	(révision 863489)
+++ src/input/dvb/channeldesc.h	(copie de travail)
@@ -101,6 +101,8 @@
 	fe_code_rate_t coderateH;
 	fe_bandwidth_t bandwidth;
 	int snr;
+	fe_rolloff_t rolloff;
+	char S2;
 };
 
 class ChannelDesc
Index: src/input/dvb/dvbsi.h
===================================================================
--- src/input/dvb/dvbsi.h	(révision 863489)
+++ src/input/dvb/dvbsi.h	(copie de travail)
@@ -36,6 +36,7 @@
 	bool getSection( int pid, int tid, int timeout=5000 );
 	bool tableNIT( unsigned char* buf );
 	void satelliteDesc( unsigned char* buf, Transponder *trans );
+	void S2satelliteDesc( unsigned char* buf, Transponder *trans );
 	void cableDesc( unsigned char* buf, Transponder *trans );
 	void terrestrialDesc( unsigned char* buf, Transponder *trans );
 	void freqListDesc( unsigned char* buf, Transponder *trans );
Index: src/input/dvb/channeleditor.cpp
===================================================================
--- src/input/dvb/channeleditor.cpp	(révision 863489)
+++ src/input/dvb/channeleditor.cpp	(copie de travail)
@@ -143,6 +143,9 @@
 		else channel->tp.pol = 'h';
 		channel->tp.coderateH = (fe_code_rate_t)(FEC_NONE+coderateHComb->currentItem());
 		channel->tp.inversion = (fe_spectral_inversion_t)(INVERSION_OFF+inversionComb->currentItem());
+		channel->tp.modulation = (fe_modulation_t)(QPSK+modulationComb->currentItem());
+		channel->tp.S2 = stypeComb->currentItem();
+		channel->tp.rolloff = (fe_rolloff_t)(ROLLOFF_35+rolloffComb->currentItem() );
 	}
 	else if ( channel->tp.type==FE_QAM ) {
 		channel->tp.freq = freqSpin->value();
@@ -165,13 +168,7 @@
 	else {
 		channel->tp.freq = freqSpin->value();
 		channel->tp.inversion = (fe_spectral_inversion_t)(INVERSION_OFF+inversionComb->currentItem());
-		switch (modulationComb->currentItem()) {
-		case 0: channel->tp.modulation = QAM_64; break;
-		case 1: channel->tp.modulation = QAM_256; break;
-		case 2: channel->tp.modulation = VSB_8; break;
-		case 3: channel->tp.modulation = VSB_16; break;
-		default: channel->tp.modulation = QAM_AUTO; break;
-		}
+		channel->tp.modulation = (fe_modulation_t)(QPSK+modulationComb->currentItem());
 	}
 
 	done( Accepted );
@@ -187,10 +184,15 @@
 	inversionComb->setCurrentItem( INVERSION_OFF+channel->tp.inversion );
 	coderateHComb->insertStringList( coderateList() );
 	coderateHComb->setCurrentItem( FEC_NONE+channel->tp.coderateH );
+	modulationComb->insertStringList( modulationList() );
+	modulationComb->setCurrentItem( QPSK+channel->tp.modulation );
+	stypeComb->insertStringList( stypeList() );
+	stypeComb->setCurrentItem( channel->tp.S2 );
+	rolloffComb->insertStringList( rolloffList() );
+	rolloffComb->setCurrentItem( ROLLOFF_35+channel->tp.rolloff );
 	transmissionComb->setEnabled( false );
 	coderateLComb->setEnabled( false );
 	bandwidthComb->setEnabled( false );
-	modulationComb->setEnabled( false );
 	hierarchyComb->setEnabled( false );
 	guardComb->setEnabled( false );
 }
@@ -211,6 +213,8 @@
 	bandwidthComb->setEnabled( false );
 	hierarchyComb->setEnabled( false );
 	guardComb->setEnabled( false );
+	stypeComb->setEnabled( false );
+	rolloffComb->setEnabled( false );
 }
 
 void ChannelEditor::initT()
@@ -234,6 +238,8 @@
 	guardComb->setCurrentItem( GUARD_INTERVAL_1_32+channel->tp.guard );
 	srSpin->setEnabled( false );
 	polGroup->setEnabled( false );
+	stypeComb->setEnabled( false );
+	rolloffComb->setEnabled( false );
 }
 
 void ChannelEditor::initA()
@@ -241,14 +247,8 @@
 	freqSpin->setValue( channel->tp.freq );
 	inversionComb->insertStringList( inversionList() );
 	inversionComb->setCurrentItem( INVERSION_OFF+channel->tp.inversion );
-	modulationComb->insertStringList( modulationListAtsc() );
-	switch (channel->tp.modulation) {
-	case QAM_64: modulationComb->setCurrentItem(0); break;
-	case QAM_256: modulationComb->setCurrentItem(1); break;
-	case VSB_8: modulationComb->setCurrentItem(2); break;
-	case VSB_16: modulationComb->setCurrentItem(3); break;
-	default: modulationComb->setCurrentItem(4); break;
-	}
+	modulationComb->insertStringList( modulationList() );
+	modulationComb->setCurrentItem( QPSK+channel->tp.modulation );
 	srSpin->setEnabled( false );
 	polGroup->setEnabled( false );
 	transmissionComb->setEnabled( false );
@@ -257,6 +257,8 @@
 	bandwidthComb->setEnabled( false );
 	hierarchyComb->setEnabled( false );
 	guardComb->setEnabled( false );
+	stypeComb->setEnabled( false );
+	rolloffComb->setEnabled( false );
 }
 
 QStringList ChannelEditor::inversionList()
@@ -271,7 +273,7 @@
 {
 	QStringList list;
 
-	list<<"NONE"<<"1/2"<<"2/3"<<"3/4"<<"4/5"<<"5/6"<<"6/7"<<"7/8"<<"8/9"<<"AUTO";
+	list<<"NONE"<<"1/2"<<"2/3"<<"3/4"<<"4/5"<<"5/6"<<"6/7"<<"7/8"<<"8/9"<<"AUTO"<<"3/5"<<"9/10";
 	return list;
 }
 
@@ -279,18 +281,10 @@
 {
 	QStringList list;
 
-	list<<"QPSK"<<"QAM 16"<<"QAM 32"<<"QAM 64"<<"QAM 128"<<"QAM 256"<<"AUTO";
+	list<<"QPSK"<<"QAM 16"<<"QAM 32"<<"QAM 64"<<"QAM 128"<<"QAM 256"<<"AUTO"<<"VSB-8"<<"VSB-16"<<"8PSK"<<"16APSK"<<"DQPSK";
 	return list;
 }
 
-QStringList ChannelEditor::modulationListAtsc()
-{
-	QStringList list;
-
-	list<<"QAM 64"<<"QAM 256"<<"VSB 8"<<"VSB 16"<<"AUTO";
-	return list;
-}
-
 QStringList ChannelEditor::transmissionList()
 {
 	QStringList list;
@@ -323,6 +317,22 @@
 	return list;
 }
 
+QStringList ChannelEditor::stypeList()
+{
+	QStringList list;
+
+	list<<"DVB-S"<<"DVB-S2";
+	return list;
+}
+
+QStringList ChannelEditor::rolloffList()
+{
+	QStringList list;
+
+	list<<"35"<<"20"<<"25"<<"AUTO";
+	return list;
+}
+
 ChannelEditor::~ChannelEditor()
 {
 }
Index: src/input/dvb/plugins/epg/kaffeinedvbsection.cpp
===================================================================
--- src/input/dvb/plugins/epg/kaffeinedvbsection.cpp	(révision 863489)
+++ src/input/dvb/plugins/epg/kaffeinedvbsection.cpp	(copie de travail)
@@ -141,6 +141,9 @@
 	if ( inSize<1 )
 		return false;
 	cd = iconv_open( "UTF8", table );
+	//check if charset unknown
+	if( cd == (iconv_t)(-1) )
+		return false;
 	inBuf = s.data();
 	outBuf = buffer;
 	outBuf[0] = 0;
Index: src/input/dvb/dvbconfig.cpp
===================================================================
--- src/input/dvb/dvbconfig.cpp	(révision 863489)
+++ src/input/dvb/dvbconfig.cpp	(copie de travail)
@@ -205,6 +205,8 @@
 	int i=0, j=0, res, fdFrontend=0;
 	struct dvb_frontend_info info;
 	bool as;
+	bool loop;
+	QTime t1;
 
 	QStringList list, flist;
 	QString s, t;
@@ -218,25 +220,36 @@
 		for ( j=0; j<(int)flist.count(); j++ ) {
 			s = list[i];
 			t = flist[j];
-			fdFrontend = open( QString("/dev/dvb/%1/%2").arg( s ).arg( t ).ascii(), O_RDWR);
-			if ( fdFrontend>0 ) {
-				if ( !(res = ioctl( fdFrontend, FE_GET_INFO, &info ) < 0) ) {
-					if ( (info.type==FE_OFDM)
-						&& (info.caps & FE_CAN_QAM_AUTO)
-						&& (info.caps & FE_CAN_TRANSMISSION_MODE_AUTO)
-						&& (info.caps & FE_CAN_GUARD_INTERVAL_AUTO)
-						&& (info.caps & FE_CAN_HIERARCHY_AUTO)
-						&& (info.caps & FE_CAN_FEC_AUTO) )
-						as = true;
-					else
-						as = false;
-					fprintf(stderr,"/dev/dvb/%s/%s : opened ( %s )\n", s.ascii(), t.ascii(), info.name );
-					devList.append( new Device( s.replace("adapter","").toInt(), t.replace("frontend","").toInt(), info.type, info.name, as ) );
+			loop = true;
+			t1 = QTime::currentTime();
+			while ( loop ) {
+				fdFrontend = open( QString("/dev/dvb/%1/%2").arg( s ).arg( t ).ascii(), O_RDWR);
+				if ( fdFrontend>0 ) {
+					loop = false;
+					if ( !(res = ioctl( fdFrontend, FE_GET_INFO, &info ) < 0) ) {
+						if ( (info.type==FE_OFDM)
+							&& (info.caps & FE_CAN_QAM_AUTO)
+							&& (info.caps & FE_CAN_TRANSMISSION_MODE_AUTO)
+							&& (info.caps & FE_CAN_GUARD_INTERVAL_AUTO)
+							&& (info.caps & FE_CAN_HIERARCHY_AUTO)
+							&& (info.caps & FE_CAN_FEC_AUTO) )
+							as = true;
+						else
+							as = false;
+						fprintf(stderr,"/dev/dvb/%s/%s : opened ( %s ) (%dms)\n", s.ascii(), t.ascii(), info.name, t1.msecsTo(QTime::currentTime()) );
+						devList.append( new Device( s.replace("adapter","").toInt(), t.replace("frontend","").toInt(), info.type, info.name, as ) );
+					}
+					close( fdFrontend );
 				}
-				close( fdFrontend );
+				else {
+					/*if ( errno==EBUSY && j>0 && t1.msecsTo(QTime::currentTime())<5000 ) {// exclusive frontends ?
+						usleep( 10000 );
+						continue;
+					}*/
+					perror( QString("/dev/dvb/%1/%2  %3/%4").arg( s ).arg( t ).arg( errno ).arg( -EBUSY ).ascii() );
+					loop = false;
+				}
 			}
-			else
-				perror( QString("/dev/dvb/%1/%2").arg( s ).arg( t ).ascii() );
 		}
 	}
 
Index: src/input/dvb/dvbsi.cpp
===================================================================
--- src/input/dvb/dvbsi.cpp	(révision 863489)
+++ src/input/dvb/dvbsi.cpp	(copie de travail)
@@ -173,6 +173,9 @@
 					fprintf(stderr,"     Found frequency list.\n");
 					freqListDesc( buf, trans );
 					break;
+				case 0x79 :
+					S2satelliteDesc( buf, trans );
+					break;
 				default :
 					break;
 			}
@@ -226,22 +229,57 @@
 		trans->pol = 'v';
 	else
 		trans->pol = 'h';
+	switch ( getBits(buf,70,2) ) {
+		case 0 : trans->modulation = QAM_AUTO; break;
+		case 1 : trans->modulation = QPSK; break;
+		case 2 : trans->modulation = PSK_8; break;
+		case 3 : trans->modulation = QAM_16; break;
+	}
 	s = t.setNum( getBits(buf,72,28), 16 );
 	trans->sr = s.toInt();
 	trans->sr /=10;
 	switch ( getBits(buf,100,4) ) {
+		case 0 : trans->coderateH = FEC_AUTO; break;
 		case 1 : trans->coderateH = FEC_1_2; break;
 		case 2 : trans->coderateH = FEC_2_3; break;
 		case 3 : trans->coderateH = FEC_3_4; break;
 		case 4 : trans->coderateH = FEC_5_6; break;
 		case 5 : trans->coderateH = FEC_7_8; break;
 		case 6 : trans->coderateH = FEC_8_9; break;
-		case 7 : trans->coderateH = FEC_NONE; break;
+		case 7 : trans->coderateH = FEC_3_5; break;
+		case 8 : trans->coderateH = FEC_4_5; break;
+		case 9 : trans->coderateH = FEC_9_10; break;
+		case 15 : trans->coderateH = FEC_NONE; break;
 	}
+	if ( getBits(buf,69,1) ) {
+		fprintf(stderr,"!!!!!!!!!!!!!!!!!! Found S2 MODULATION SYSTEM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+		trans->S2 = 1;
+		switch ( getBits(buf,67,2) ) {
+			case 0 : trans->rolloff = ROLLOFF_35; break;
+			case 1 : trans->rolloff = ROLLOFF_25; break;
+			case 2 : trans->rolloff = ROLLOFF_20; break;
+		}
+	}
 }
 
 
 
+void NitSection::S2satelliteDesc( unsigned char* buf, Transponder *trans )
+{
+	fprintf(stderr,"!!!!!!!!!!!!!!!!!! Found S2 DESCRIPTOR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+	int scrambling_sequence_selector = getBits(buf,16,1);
+	int multiple_input_stream_flag = getBits(buf,17,1);
+	int backwards_compatibility_indicator = getBits(buf,18,1);
+	int scrambling_sequence_index = 0;
+	if ( scrambling_sequence_selector )
+		scrambling_sequence_index = getBits(buf,30,18);
+	int input_stream_identifier = 0;
+	if ( multiple_input_stream_flag )
+		input_stream_identifier = getBits(buf,48,8);
+}
+
+
+
 void NitSection::cableDesc( unsigned char* buf, Transponder *trans )
 {
 	QString s, t;
@@ -261,13 +299,17 @@
 	trans->sr = s.toInt();
 	trans->sr /=10;
 	switch ( getBits(buf,100,4) ) {
+		case 0 : trans->coderateH = FEC_AUTO; break;
 		case 1 : trans->coderateH = FEC_1_2; break;
 		case 2 : trans->coderateH = FEC_2_3; break;
 		case 3 : trans->coderateH = FEC_3_4; break;
 		case 4 : trans->coderateH = FEC_5_6; break;
 		case 5 : trans->coderateH = FEC_7_8; break;
 		case 6 : trans->coderateH = FEC_8_9; break;
-		case 7 : trans->coderateH = FEC_NONE; break;
+		case 7 : trans->coderateH = FEC_3_5; break;
+		case 8 : trans->coderateH = FEC_4_5; break;
+		case 9 : trans->coderateH = FEC_9_10; break;
+		case 15 : trans->coderateH = FEC_NONE; break;
 	}
 }
 
Index: src/input/dvb/channeldesc.cpp
===================================================================
--- src/input/dvb/channeldesc.cpp	(révision 863489)
+++ src/input/dvb/channeldesc.cpp	(copie de travail)
@@ -115,6 +115,8 @@
 	coderateH=FEC_AUTO;
 	bandwidth=BANDWIDTH_AUTO;
 	snr = 0;
+	rolloff = ROLLOFF_AUTO;
+	S2 = 0;
 }
 
 Transponder::Transponder( const Transponder &trans )
@@ -134,6 +136,8 @@
 	coderateL=trans.coderateL;
 	coderateH=trans.coderateH;
 	bandwidth=trans.bandwidth;
+	rolloff = trans.rolloff;
+	S2 = trans.S2;
 }
 
 bool Transponder::sameAs( Transponder *trans )
Index: src/input/dvb/channeleditor.h
===================================================================
--- src/input/dvb/channeleditor.h	(révision 863489)
+++ src/input/dvb/channeleditor.h	(copie de travail)
@@ -53,11 +53,12 @@
 	QStringList inversionList();
 	QStringList coderateList();
 	QStringList modulationList();
-	QStringList modulationListAtsc();
 	QStringList transmissionList();
 	QStringList bandwidthList();
 	QStringList hierarchyList();
 	QStringList guardList();
+	QStringList stypeList();
+	QStringList rolloffList();
 
 	ChannelDesc *channel;
 	QPtrList<ChannelDesc> *chandesc;
Index: src/input/dvb/dvbstream.cpp
===================================================================
--- src/input/dvb/dvbstream.cpp	(révision 863489)
+++ src/input/dvb/dvbstream.cpp	(copie de travail)
@@ -185,7 +185,7 @@
 		fprintf(stderr,"openFe: fdFrontend != 0\n");
 		return false;
 	}
-	fdFrontend = open( frontendName.ascii(), O_RDWR );
+	fdFrontend = open( frontendName.ascii(), O_RDWR /*| O_NONBLOCK*/ );
 	if ( fdFrontend<0 ) {
 		perror("openFe:");
 		fdFrontend = 0;
@@ -319,7 +319,6 @@
 {
 	unsigned long lof=0;
 	int res, hiband=0;
-	struct dvb_frontend_parameters feparams;
 	struct dvb_frontend_info fe_info;
 	fe_status_t status;
 	unsigned long freq=chan->tp.freq;
@@ -328,6 +327,11 @@
 	int rotorMove = 0;
 	int loop=0, i;
 
+	struct dtv_property cmdargs[20];
+	struct dtv_properties cmdseq;
+	int inversion;
+	int bandwidth;
+
 	closeFe();
 	if ( !openFe() )
 		return false;
@@ -344,18 +348,43 @@
 	freq*=1000;
 	srate*=1000;
 
+	QTime t1 = QTime::currentTime();
+	QTime t2;
+
+	if ( chan->tp.inversion==INVERSION_AUTO ) {
+		if ( fe_info.caps & FE_CAN_INVERSION_AUTO )
+			inversion = chan->tp.inversion;
+		else {
+			fprintf(stderr,"Can NOT inversion_auto\n");
+			inversion = INVERSION_OFF;
+		}
+	}
+	else
+		inversion=chan->tp.inversion;
+
 	switch( fe_info.type ) {
 		case FE_OFDM : {
 			if (freq < 1000000)
 				freq*=1000UL;
-			feparams.frequency=freq;
-			feparams.u.ofdm.bandwidth=chan->tp.bandwidth;
-			feparams.u.ofdm.code_rate_HP=chan->tp.coderateH;
-			feparams.u.ofdm.code_rate_LP=chan->tp.coderateL;
-			feparams.u.ofdm.constellation=chan->tp.modulation;
-			feparams.u.ofdm.transmission_mode=chan->tp.transmission;
-			feparams.u.ofdm.guard_interval=chan->tp.guard;
-			feparams.u.ofdm.hierarchy_information=chan->tp.hierarchy;
+			cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_DVBT;
+			cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+			cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+			cmdargs[3].cmd = DTV_CODE_RATE_HP; cmdargs[3].u.data = chan->tp.coderateH;
+			cmdargs[4].cmd = DTV_CODE_RATE_LP; cmdargs[4].u.data = chan->tp.coderateL;
+			cmdargs[5].cmd = DTV_GUARD_INTERVAL; cmdargs[5].u.data = chan->tp.guard;
+			cmdargs[6].cmd = DTV_TRANSMISSION_MODE; cmdargs[6].u.data = chan->tp.transmission;
+			cmdargs[7].cmd = DTV_HIERARCHY; cmdargs[7].u.data = chan->tp.hierarchy;
+			if ( chan->tp.bandwidth==BANDWIDTH_8_MHZ )
+				bandwidth = 8000000;
+			else if ( chan->tp.bandwidth==BANDWIDTH_7_MHZ )
+				bandwidth = 7000000;
+			else if ( chan->tp.bandwidth==BANDWIDTH_6_MHZ )
+				bandwidth = 6000000;
+			cmdargs[8].cmd = DTV_BANDWIDTH_HZ; cmdargs[8].u.data = bandwidth;
+			cmdargs[9].cmd = DTV_INVERSION; cmdargs[9].u.data = inversion;
+			cmdargs[10].cmd = DTV_TUNE;
+			cmdseq.num = 11;
+			cmdseq.props = cmdargs;
 			fprintf(stderr,"tuning DVB-T to %lu Hz\n", freq);
 			fprintf(stderr,"inv:%d bw:%d fecH:%d fecL:%d mod:%d tm:%d gi:%d hier:%d\n", chan->tp.inversion,
 				chan->tp.bandwidth, chan->tp.coderateH, chan->tp.coderateL, chan->tp.modulation,
@@ -363,11 +392,16 @@
 			break;
 		}
 		case FE_QAM : {
+			cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_DVBC_ANNEX_AC;
+			cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+			cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+			cmdargs[3].cmd = DTV_SYMBOL_RATE; cmdargs[3].u.data = srate;
+			cmdargs[4].cmd = DTV_INNER_FEC; cmdargs[4].u.data = chan->tp.coderateH;
+			cmdargs[5].cmd = DTV_INVERSION; cmdargs[5].u.data = inversion;
+			cmdargs[6].cmd = DTV_TUNE;
+			cmdseq.num = 7;
+			cmdseq.props = cmdargs;
 			fprintf(stderr,"tuning DVB-C to %lu\n", freq);
-			feparams.frequency=freq;
-			feparams.u.qam.symbol_rate = srate;
-			feparams.u.qam.fec_inner = chan->tp.coderateH;
-			feparams.u.qam.modulation = chan->tp.modulation;
 			fprintf(stderr,"inv:%d sr:%lu fecH:%d mod:%d\n", chan->tp.inversion,
 				srate, chan->tp.coderateH, chan->tp.modulation );
 			break;
@@ -395,47 +429,68 @@
 						lof = (dvbDevice->lnb[lnbPos].loFreq*1000);
 				}
 				if ( freq<lof )
-					feparams.frequency = ( lof-freq );
+					freq = ( lof-freq );
 				else
-					feparams.frequency = ( freq-lof );
+					freq = ( freq-lof );
 			}
-			else
-				feparams.frequency=freq;
-
-			feparams.u.qpsk.symbol_rate=srate;
-			feparams.u.qpsk.fec_inner=chan->tp.coderateH;
-			fprintf(stderr,"inv:%d fecH:%d\n", chan->tp.inversion, chan->tp.coderateH );
+			fprintf(stderr,"inv:%d fecH:%d mod:%d\n", chan->tp.inversion, chan->tp.coderateH, chan->tp.modulation );
 			if ( setDiseqc( lnbPos, chan, hiband, rotorMove, dvr )!=0 ) {
 				closeFe();
 				return false;
 			}
+			if ( chan->tp.S2 ) {
+				fprintf(stderr,"\nTHIS IS DVB-S2 >>>>>>>>>>>>>>>>>>>\n");
+				cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_DVBS2;
+				cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+				cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+				cmdargs[3].cmd = DTV_SYMBOL_RATE; cmdargs[3].u.data = srate;
+				cmdargs[4].cmd = DTV_INNER_FEC; cmdargs[4].u.data = chan->tp.coderateH;
+				cmdargs[5].cmd = DTV_PILOT; cmdargs[5].u.data = PILOT_AUTO;
+				cmdargs[6].cmd = DTV_ROLLOFF; cmdargs[6].u.data = chan->tp.rolloff;
+				cmdargs[7].cmd = DTV_INVERSION; cmdargs[7].u.data = inversion;
+				cmdargs[8].cmd = DTV_TUNE;
+				cmdseq.num = 9;
+				cmdseq.props = cmdargs;
+			}
+			else {
+				cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_DVBS;
+				cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+				cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+				if ( chan->tp.modulation==QAM_AUTO )
+					cmdargs[2].u.data = QPSK;
+				cmdargs[3].cmd = DTV_SYMBOL_RATE; cmdargs[3].u.data = srate;
+				cmdargs[4].cmd = DTV_INNER_FEC; cmdargs[4].u.data = chan->tp.coderateH;
+				cmdargs[5].cmd = DTV_INVERSION; cmdargs[5].u.data = inversion;
+				cmdargs[6].cmd = DTV_TUNE;
+				cmdseq.num = 7;
+				cmdseq.props = cmdargs;
+			}
 			break;
 		}
 		case FE_ATSC : {
+			cmdargs[0].cmd = DTV_DELIVERY_SYSTEM; cmdargs[0].u.data = SYS_ATSC;
+			cmdargs[1].cmd = DTV_FREQUENCY; cmdargs[1].u.data = freq;
+			cmdargs[2].cmd = DTV_MODULATION; cmdargs[2].u.data = chan->tp.modulation;
+			cmdargs[3].cmd = DTV_INVERSION; cmdargs[3].u.data = inversion;
+			cmdargs[4].cmd = DTV_TUNE;
+			cmdseq.num = 5;
+			cmdseq.props = cmdargs;
 			fprintf(stderr,"tuning ATSC to %lu\n", freq);
-			feparams.frequency=freq;
-			feparams.u.vsb.modulation = chan->tp.modulation;
 			fprintf(stderr,"inv:%d mod:%d\n", chan->tp.inversion, chan->tp.modulation );
 			break;
 		}
 	}
-	if ( chan->tp.inversion==INVERSION_AUTO ) {
-		if ( fe_info.caps & FE_CAN_INVERSION_AUTO )
-			feparams.inversion=chan->tp.inversion;
-		else {
-			fprintf(stderr,"Can NOT inversion_auto\n");
-			feparams.inversion=INVERSION_OFF;
-		}
-	}
-	else
-		feparams.inversion=chan->tp.inversion;
 
 	if ( rotorMove )
 		loop = 2;
 
+	t2 = QTime::currentTime();
+	fprintf( stderr, "Diseqc settings time = %d ms\n", t1.msecsTo( t2 ) );
+	t1 = t2;
+
 	while ( loop>-1 ) {
-		if (ioctl(fdFrontend,FE_SET_FRONTEND,&feparams) < 0) {
-			perror("ERROR tuning \n");
+		if ( ioctl( fdFrontend, FE_SET_PROPERTY, &cmdseq )<0 ) {
+			perror("ERROR tuning\n");
 			closeFe();
 			return false;
 		}
@@ -462,6 +517,10 @@
 		return false;
 	}
 
+	t2 = QTime::currentTime();
+	fprintf( stderr, "Tuning time = %d ms\n", t1.msecsTo( t2 ) );
+	t1 = t2;
+
 	if ( rotorMove )
 		dvbDevice->lnb[lnbPos].currentSource = chan->tp.source;
 
@@ -482,7 +541,7 @@
 }
 
 
-
+#define DISEQC_X 2
 int DvbStream::setDiseqc( int switchPos, ChannelDesc *chan, int hiband, int &rotor, bool dvr )
 {
 	struct dvb_diseqc_master_cmd switchCmd[] = {
@@ -519,7 +578,7 @@
 		perror("FE_SET_VOLTAGE failed");
 
 	fprintf( stderr, "DiSEqC: %02x %02x %02x %02x %02x %02x\n", switchCmd[ci].msg[0], switchCmd[ci].msg[1], switchCmd[ci].msg[2], switchCmd[ci].msg[3], switchCmd[ci].msg[4], switchCmd[ci].msg[5] );
-	for ( i=0; i<2; ++i ) {
+	for ( i=0; i<DISEQC_X; ++i ) {
 		usleep(15*1000);
 		if ( ioctl(fdFrontend, FE_DISEQC_SEND_MASTER_CMD, &switchCmd[ci]) )
 			perror("FE_DISEQC_SEND_MASTER_CMD failed");
@@ -586,15 +645,17 @@
 		}
 	}
 
-	for ( i=0; i<2; ++i ) {
+	for ( i=0; i<DISEQC_X; ++i ) {
 		usleep(15*1000);
 		if ( ioctl(fdFrontend, FE_DISEQC_SEND_BURST, (ci/4)%2 ? SEC_MINI_B : SEC_MINI_A) )
 			perror("FE_DISEQC_SEND_BURST failed");
 	}
 
-	usleep(15*1000);
-	if ( ioctl(fdFrontend, FE_SET_TONE, (ci/2)%2 ? SEC_TONE_ON : SEC_TONE_OFF) )
-		perror("FE_SET_TONE failed");
+	if ( (ci/2)%2 ) {
+		usleep(15*1000);
+		if ( ioctl(fdFrontend, FE_SET_TONE, SEC_TONE_ON) )
+			perror("FE_SET_TONE failed");
+	}
 
 	return 0;
 }
@@ -692,7 +753,7 @@
 	};
 
 	int i;
-	for ( i=0; i<2; ++i ) {
+	for ( i=0; i<DISEQC_X; ++i ) {
 		usleep(15*1000);
 		if ( ioctl( fdFrontend, FE_DISEQC_SEND_MASTER_CMD, &cmds[cmd] ) )
 			perror("Rotor : FE_DISEQC_SEND_MASTER_CMD failed");
Index: src/input/dvb/dvbpanel.cpp
===================================================================
--- src/input/dvb/dvbpanel.cpp	(révision 863489)
+++ src/input/dvb/dvbpanel.cpp	(copie de travail)
@@ -2263,6 +2263,8 @@
 				case 67 : chan->tp.coderateH = FEC_6_7; break;
 				case 78 : chan->tp.coderateH = FEC_7_8; break;
 				case 89 : chan->tp.coderateH = FEC_8_9; break;
+				case 35 : chan->tp.coderateH = FEC_3_5; break;
+				case 910 : chan->tp.coderateH = FEC_9_10; break;
 				case -1 : chan->tp.coderateH = FEC_AUTO;
 			}
 			s = s.right( s.length()-pos-1 );
@@ -2283,6 +2285,9 @@
 				case 256 : chan->tp.modulation = QAM_256; break;
 				case 108 : chan->tp.modulation = VSB_8; break;
 				case 116 : chan->tp.modulation = VSB_16; break;
+				case 1000 : chan->tp.modulation = PSK_8; break;
+				case 1001 : chan->tp.modulation = APSK_16; break;
+				case 1003 : chan->tp.modulation = DQPSK; break;
 				case -1 : chan->tp.modulation = QAM_AUTO;
 			}
 			s = s.right( s.length()-pos-1 );
@@ -2297,6 +2302,8 @@
 				case 67 : chan->tp.coderateL = FEC_6_7; break;
 				case 78 : chan->tp.coderateL = FEC_7_8; break;
 				case 89 : chan->tp.coderateL = FEC_8_9; break;
+				case 35 : chan->tp.coderateH = FEC_3_5; break;
+				case 910 : chan->tp.coderateH = FEC_9_10; break;
 				case -1 : chan->tp.coderateL = FEC_AUTO;
 			}
 			s = s.right( s.length()-pos-1 );
@@ -2364,6 +2371,17 @@
 			s = s.right( s.length()-pos-1 );
 			pos = s.find("|");
 			chan->tp.nid = s.left(pos).toUShort();
+			s = s.right( s.length()-pos-1 );
+			pos = s.find("|");
+			switch ( s.left(pos).toInt() ) {
+				case 20 : chan->tp.rolloff = ROLLOFF_20; break;
+				case 25 : chan->tp.rolloff = ROLLOFF_25; break;
+				case 35 : chan->tp.rolloff = ROLLOFF_35; break;
+				case -1 : chan->tp.rolloff = ROLLOFF_AUTO;
+			}
+			s = s.right( s.length()-pos-1 );
+			pos = s.find("|");
+			chan->tp.S2 = s.left(pos).toInt();
 
 			if ( chan->tp.source.isEmpty() ) {
 				delete chan;
@@ -2475,6 +2493,8 @@
 				case FEC_6_7 : tt<< "67|"; break;
 				case FEC_7_8 : tt<< "78|"; break;
 				case FEC_8_9 : tt<< "89|"; break;
+				case FEC_3_5 : tt<< "35|"; break;
+				case FEC_9_10 : tt<< "910|"; break;
 				case FEC_AUTO : tt<< "-1|";
 			}
 			switch ( chan->tp.inversion ) {
@@ -2491,6 +2511,9 @@
 				case QAM_256 : tt<< "256|"; break;
 				case VSB_8 : tt<< "108|"; break;
 				case VSB_16 : tt<< "116|"; break;
+				case PSK_8 : tt<< "1000|"; break;
+				case APSK_16 : tt<< "1001|"; break;
+				case DQPSK : tt<< "1003|"; break;
 				case QAM_AUTO : tt<< "-1|";
 			}
 			switch ( chan->tp.coderateL ) {
@@ -2503,6 +2526,8 @@
 				case FEC_6_7 : tt<< "67|"; break;
 				case FEC_7_8 : tt<< "78|"; break;
 				case FEC_8_9 : tt<< "89|"; break;
+				case FEC_3_5 : tt<< "35|"; break;
+				case FEC_9_10 : tt<< "910|"; break;
 				case FEC_AUTO : tt<< "-1|";
 			}
 			switch ( chan->tp.bandwidth ) {
@@ -2541,7 +2566,15 @@
 			}
 			tt<< "|";
 			tt<< chan->category+"|";
-			tt<< s.setNum(chan->tp.nid)+"|\n";
+			tt<< s.setNum(chan->tp.nid)+"|";
+			switch ( chan->tp.rolloff ) {
+				case ROLLOFF_20 : tt<< "20|"; break;
+				case ROLLOFF_25 : tt<< "25|"; break;
+				case ROLLOFF_35 : tt<< "35|"; break;
+				case ROLLOFF_AUTO : tt<< "-1|";
+			}
+			tt<< s.setNum(chan->tp.S2)+"|";
+			tt<< "\n";
 		}
 		ret = true;
 		f.close();
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

  Powered by Linux