Anzeigen der neuesten Beiträge
0 Mitglieder und 1 Gast betrachten dieses Thema.
--- kevents.cpp 2007-03-21 12:01:37.000000000 +0100+++ kevents.cpp 2007-03-21 11:54:15.000000000 +0100@@ -33,11 +33,13 @@ #include "dvbevents.h" #include "dvbstream.h" +#define MAX_FOLLOW 10 -EListViewItem::EListViewItem( QListView *parent, QString chanName, QString eBegin, QString eDuration, QString eTitle, EventDesc *desc ) : KListViewItem( parent, chanName, eBegin, eDuration, eTitle )+EListViewItem::EListViewItem( QListView *parent, QString chanName, QString eBegin, QString eDuration, QString eTitle, EventDesc *desc, QString follow_begin) : KListViewItem( parent, chanName, eBegin, eDuration, eTitle, follow_begin) { event = desc;+ followBegin=follow_begin; } @@ -101,7 +103,7 @@ allBtn->setGuiItem( KGuiItem(i18n("Scheduled"), icon->loadIconSet("date", KIcon::Small) ) ); currentNextBtn->setGuiItem( KGuiItem(i18n("Current/Next"), icon->loadIconSet("toggle_log", KIcon::Small) ) ); currentChannelEpg->setGuiItem( KGuiItem(i18n("Current Channel"), icon->loadIconSet("date", KIcon::Small) ) );- new EListViewItem( (QListView*)listView, "Une chaine", "99/99/99 99:99 9999", "99:99 99", "un titre de programme", 0 );+ new EListViewItem( (QListView*)listView, "Une chaine", "99/99/99 99:99 9999", "99:99 99", "un titre de programme", 0,0 ); resize( size ); connect( resetBtn , SIGNAL( clicked() ), this, SLOT( reset() ) );@@ -206,6 +208,20 @@ for ( i=0; i<(int)ei->event->extEvents.count(); i++ ) { s = s+ *ei->event->extEvents.at(i); }+ if(!ei->followBegin.isEmpty())+ {+ int pos2=0,pos=0;+ s = s+ "<br>";+ for(int i=0;i<MAX_FOLLOW;i++)+ {+ pos=ei->followBegin.find("#",pos2);+ if(pos==-1)+ break;+ s = s+"<br><font color=\"blue\">";+ s=s+ei->followBegin.mid(pos2,pos-pos2);+ pos2=pos+1;+ }+ } s = s+"</qt>"; textBrow->setText( s ); break;@@ -267,14 +283,14 @@ void KEvents::checkNewEvent() {- int i, j, k, m, n;+ int i, j, k, m, n,follow=0; DVBevents *events=0; EventSourceList *slist; EventTsidList *tlist; EListViewItem *itt=0;- QString s, t, channel, begin, duration, title;+ QString s, t, channel, begin, duration, title, follow_begin; bool ret;- EventDesc *desc;+ EventDesc *desc,*desctmp; QPixmap pix; QValueList<int> sids; @@ -319,7 +335,31 @@ title = desc->title; if ( title.isEmpty() ) continue;- itt = new EListViewItem( (QListView*)listView, channel, begin, duration, title, desc );++ for (int x=0; x<(int)tlist->events.count() && follow < MAX_FOLLOW; x++ ) {+ desctmp = tlist->events.at(x);+ if ( !desc->title.isEmpty() && !desctmp->title.isEmpty()) {+ if (desc->title==desctmp->title && desctmp->startDateTime > desc->startDateTime) {+ for (int y=0; y<(int)channels->count(); y++ ) {+ if ( desctmp->source==channels->at(y)->tp.source && desctmp->sid==channels->at(y)->sid && desctmp->tsid==channels->at(y)->tp.tsid ) + {+ follow_begin+=channels->at(y)->name;+ follow_begin+=": ";+ break;+ }+ }+ follow_begin+=KGlobal::locale()->formatDateTime( desctmp->startDateTime, true );+ follow_begin+="#";+ follow++;+ }+ }+ }++ itt = new EListViewItem( (QListView*)listView, channel, begin, duration, title, desc, follow_begin );++ follow_begin="";+ follow=0;+ if ( !pix.isNull() ) itt->setPixmap( 0, pix ); }--- kevents.h 2007-03-21 12:01:37.000000000 +0100+++ kevents.h 2007-03-20 21:29:28.000000000 +0100@@ -41,10 +41,11 @@ public: - EListViewItem( QListView *parent, QString chanName, QString eBegin, QString eDuration, QString eTitle, EventDesc *desc );+ EListViewItem( QListView *parent, QString chanName, QString eBegin, QString eDuration, QString eTitle, EventDesc *desc, QString follow_begin ); virtual int compare( QListViewItem *i, int col, bool ascending ) const; EventDesc *event;+ QString followBegin; };
--- kaffeine/src/input/dvb/dvbpanel.cpp 2007/03/28 23:12:15 647633+++ kaffeine/src/input/dvb/dvbpanel.cpp 2007/04/26 18:00:34 658054@@ -53,6 +53,7 @@ #include "dvbevents.h" #include "kevents.h" #include "broadcasteditor.h"+#include "channeleditor.h" #define CHANICONSIZE 28 @@ -303,6 +304,7 @@ QPopupMenu *pop = new QPopupMenu(); pop->insertItem( i18n("Select icon..."), 1 );+ pop->insertItem( i18n("Edit..."), 2 ); i = 0; i = pop->exec( QCursor::pos() ); switch ( i ) {@@ -329,10 +331,59 @@ pix.save( dvbConfig->dvbConfigIconsDir+name, "PNG" ); fillChannelList(); break;+ case 2:+ if ( editChannel( name ) ) {+ fillChannelList();+ }+ break;+ } delete pop; } +bool DvbPanel::editChannel( QString &name )+{+ int j;+ ChannelDesc *chan=0;+ QStringList list;+ QPixmap pix;++ for ( j=0; j<(int)channels.count(); j++ ) {+ chan = channels.at(j);+ if ( chan->name==name ) {+ j = -1;+ list.append( chan->tp.source );+ break;+ }+ }+ if ( j==-1 ) {+ ChannelEditor dlg( list, false, chan, &channels, mainWidget );+ int ret = dlg.exec();+ if ( ret==ChannelEditor::Accepted ) {+ pix.load( dvbConfig->dvbConfigIconsDir+chan->name );+ if ( !pix.isNull() )+ chan->pix = pix;+ else {+ if ( chan->type==1 ) {+ if ( chan->fta )+ pix = tvcPix;+ else+ pix = tvPix;+ }+ else {+ if ( chan->fta )+ pix = racPix;+ else+ pix = raPix;+ }+ }+ return true;+ }+ }+ return false;+}++ void DvbPanel::getTargets( QStringList &uiNames, QStringList &iconNames, QStringList &targetNames )@@ -969,7 +1020,7 @@ getChannelList(); rtp = new Ts2Rtp(); rtp->setSocket( dvbConfig->broadcastAddress, dvbConfig->broadcastPort, dvbConfig->senderPort );- cleaner = new Cleaner( dvbConfig->shiftDir );+ cleaner = new Cleaner( dvbConfig->shiftDir, dvbConfig->recordDir ); split->setSizes( dvbConfig->splitSizes ); } @@ -997,7 +1048,7 @@ if ( ret==DvbConfigDialog::Rejected ) return; rtp->setSocket( dvbConfig->broadcastAddress, dvbConfig->broadcastPort, dvbConfig->senderPort );- cleaner->setPath( dvbConfig->shiftDir );+ cleaner->setPaths( dvbConfig->shiftDir, dvbConfig->recordDir ); }
Index: scandialog.cpp===================================================================--- src/input/dvb/scandialog.cpp (revision 659304)+++ src/input/dvb/scandialog.cpp (working copy)@@ -650,6 +650,21 @@ chan->name = name; } +bool ScanDialog::checkChannUpdate( ChannelDesc *chan )+{+ int i;+ for ( i=0; i<(int)chandesc->count(); i++ ) {+ if ( chan->tp.source == chandesc->at(i)->tp.source && chan->tp.tsid == chandesc->at(i)->tp.tsid && chan->sid == chandesc->at(i)->sid ) {+ chan->category=chandesc->at(i)->category;+ chan->num=chandesc->at(i)->num;+ chan->name=chandesc->at(i)->name;+ chan->fta=chandesc->at(i)->fta;+ chandesc->replace(i,new ChannelDesc(*chan));+ return false;+ }+ }+ return true;+} void ScanDialog::addSelected()@@ -670,24 +684,25 @@ dit = (DListViewItem*)dit->nextSibling(); continue; }+ if(checkChannUpdate(chan)){+ checkDuplicateName( chan ); - checkDuplicateName( chan );-- chan->num = chandesc->count()+1;- chandesc->append( new ChannelDesc( *chan ) );- it = new QListViewItem( channelsList, chan->name );- if ( chan->type==1 ) {- if ( chan->fta )- it->setPixmap( 0, tvcPix );- else- it->setPixmap( 0, tvPix );+ chan->num = chandesc->count()+1;+ chandesc->append( new ChannelDesc( *chan ) );+ it = new QListViewItem( channelsList, chan->name );+ if ( chan->type==1 ) {+ if ( chan->fta )+ it->setPixmap( 0, tvcPix );+ else+ it->setPixmap( 0, tvPix );+ }+ else {+ if ( chan->fta )+ it->setPixmap( 0, racPix );+ else+ it->setPixmap( 0, raPix );+ } }- else {- if ( chan->fta )- it->setPixmap( 0, racPix );- else- it->setPixmap( 0, raPix );- } odit = dit; dit = (DListViewItem*)dit->nextSibling(); delete odit;@@ -775,25 +790,25 @@ dit = (DListViewItem*)dit->nextSibling(); continue; }+ if(checkChannUpdate(chan)){+ checkDuplicateName( chan ); - checkDuplicateName( chan );-- chan->num = chandesc->count()+1;- chandesc->append( new ChannelDesc( *chan ) );- it = new QListViewItem( channelsList, chan->name );- if ( chan->type==1 ) {- if ( chan->fta )- it->setPixmap( 0, tvcPix );- else- it->setPixmap( 0, tvPix );+ chan->num = chandesc->count()+1;+ chandesc->append( new ChannelDesc( *chan ) );+ it = new QListViewItem( channelsList, chan->name );+ if ( chan->type==1 ) {+ if ( chan->fta )+ it->setPixmap( 0, tvcPix );+ else+ it->setPixmap( 0, tvPix );+ }+ else {+ if ( chan->fta )+ it->setPixmap( 0, racPix );+ else+ it->setPixmap( 0, raPix );+ } }- else {- if ( chan->fta )- it->setPixmap( 0, racPix );- else- it->setPixmap( 0, raPix );- }- odit = dit; dit = (DListViewItem*)dit->nextSibling(); delete odit;Index: scandialog.h===================================================================--- src/input/dvb/scandialog.h (revision 659304)+++ src/input/dvb/scandialog.h (working copy)@@ -86,6 +86,7 @@ void parseTp( QString s, fe_type_t type, QString src ); void addFound( ChannelDesc *chan, bool scan ); void checkDuplicateName( ChannelDesc *chan );+ bool checkChannUpdate( ChannelDesc *chan ); QPtrList<DvbStream> *dvb; DvbStream *ds;Index: dvbpanel.cpp===================================================================--- src/input/dvb/dvbpanel.cpp (revision 659778)+++ src/input/dvb/dvbpanel.cpp (working copy)@@ -1166,6 +1166,7 @@ continue; it = new KListViewItem( channelsCb, QString().sprintf("%04d", chan->num), chan->name, chan->tp.source ); it->setDragEnabled( true );+ chan->pix.load( dvbConfig->dvbConfigIconsDir+chan->name ); if ( !chan->pix.isNull() ) it->setPixmap( 1, chan->pix ); else {
Index: kevents.h===================================================================--- src/input/dvb/kevents.h (revision 662166)+++ src/input/dvb/kevents.h (working copy)@@ -28,15 +28,14 @@ #include <klistview.h> #include <kpushbutton.h>+#include <klineedit.h> class EventDesc; class DvbStream; class DVBevents; class ChannelDesc;-class QCheckBox; - class EListViewItem : public KListViewItem { @@ -61,8 +60,6 @@ private slots: - void checkNewEvent();- void checkEpgSearch(QString searchword); void mouseClickedSlot( int btn, QListViewItem *it, const QPoint &p, int c ); void reset(); void setMode( int m, QString name="" );@@ -70,14 +67,18 @@ void setCurrentNext(); void setCurrentChannelEpg(); void epgSearch();+ void resetSearch(); void zap( QListViewItem* it, const QPoint &p, int col ); private:+ void checkEpgSearch(QString searchword);+ void checkNewEvent(); QPtrList<DvbStream> *dvb; KListView *listView;- KPushButton *resetBtn, *currentNextBtn, *allBtn, *currentChannelEpgBtn, *searchBtn;- QCheckBox *titleCb;+ KPushButton *resetBtn, *currentNextBtn, *allBtn, *currentChannelEpgBtn;+ QToolButton *searchBtn;+ QCheckBox *titleCb,*tvradioCb,*ftaCb; QPtrList<ChannelDesc> *channels; QTextBrowser *textBrow; int mode;@@ -85,7 +86,7 @@ protected: - QLineEdit *searchLineEdit;+ KLineEdit *searchLineEdit; signals: Index: kevents.cpp===================================================================--- src/input/dvb/kevents.cpp (revision 662166)+++ src/input/dvb/kevents.cpp (working copy)@@ -25,6 +25,7 @@ #include <qcursor.h> #include <qwhatsthis.h> #include <qcheckbox.h>+#include <qtooltip.h> #include <klocale.h> #include <kiconloader.h>@@ -64,10 +65,11 @@ dvb = d; channels = chans; - setCaption( i18n("EPG") );+ setCaption( i18n("Electronic Program Guide") ); QGridLayout *grid = new QGridLayout( this, 1, 1, 11, 6, "grid"); QHBoxLayout *hbox = new QHBoxLayout( 0, 0, 6, "hbox" );+ QVBoxLayout *vbox = new QVBoxLayout( 0, 0, 6 , "vbox"); resetBtn = new KPushButton( i18n("Refresh"), this ); hbox->addWidget( resetBtn );@@ -77,19 +79,44 @@ hbox->addWidget( currentNextBtn ); currentChannelEpgBtn = new KPushButton( i18n("Current Channel"), this ); hbox->addWidget( currentChannelEpgBtn );- searchLineEdit = new QLineEdit(this);++ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );+ hbox->addItem( spacer );++ vbox->addLayout( hbox);++ hbox = new QHBoxLayout();++ searchBtn = new QToolButton( this );+ searchBtn->setAutoRaise( true );+ QToolTip::add( searchBtn, i18n("Electronic Program Guide Search"));+ hbox->addWidget( searchBtn );++ QLabel* filterLabel = new QLabel( i18n("Search") + ":", this );+ hbox->addWidget( filterLabel );++ searchLineEdit = new KLineEdit(this); hbox->addWidget( searchLineEdit );- titleCb = new QCheckBox(i18n("only Title"), this );++ tvradioCb = new QCheckBox(i18n("TV "), this );+ QToolTip::add( tvradioCb, i18n("Search TV Channels only (omit Radio)"));+ tvradioCb->setChecked(true);+ hbox->addWidget( tvradioCb);++ titleCb = new QCheckBox(i18n("Titles "), this );+ QToolTip::add( titleCb, i18n("Search Event Titles only (omit Description)")); titleCb->setChecked(true); hbox->addWidget( titleCb);- searchBtn = new KPushButton( i18n("Search"), this );- searchBtn->setFocus();- hbox->addWidget( searchBtn ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );- hbox->addItem( spacer );- grid->addLayout( hbox, 0, 0 );+ ftaCb = new QCheckBox(i18n("FTA "), this );+ QToolTip::add( ftaCb, i18n("Search Free to Air Channels only (omit PayTV)"));+ ftaCb->setChecked(false);+ hbox->addWidget( ftaCb); + vbox->addLayout( hbox );++ grid->addLayout( vbox, 0, 0 );+ listView = new KListView( this, "listView" ); listView->addColumn( i18n( "Channel" ) ); listView->addColumn( i18n( "Begin" ) );@@ -110,18 +137,21 @@ allBtn->setGuiItem( KGuiItem(i18n("Scheduled"), icon->loadIconSet("date", KIcon::Small) ) ); currentNextBtn->setGuiItem( KGuiItem(i18n("Current/Next"), icon->loadIconSet("toggle_log", KIcon::Small) ) ); currentChannelEpgBtn->setGuiItem( KGuiItem(i18n("Current Channel"), icon->loadIconSet("date", KIcon::Small) ) );- searchBtn->setGuiItem( KGuiItem(i18n("EPG-Search"), icon->loadIconSet("find", KIcon::Small) ) );+ searchBtn->setIconSet( icon->loadIconSet("locationbar_erase", KIcon::Small) );+ new EListViewItem( (QListView*)listView, "Une chaine", "99/99/99 99:99 9999", "99:99 99", "un titre de programme", 0 ); resize( size );- connect( resetBtn , SIGNAL( clicked() ), this, SLOT( reset() ) );+ connect( resetBtn , SIGNAL( pressed() ), this, SLOT( reset() ) ); connect( allBtn , SIGNAL( clicked() ), this, SLOT( setScheduled() ) ); connect( currentNextBtn , SIGNAL( clicked() ), this, SLOT( setCurrentNext() ) ); connect( currentChannelEpgBtn, SIGNAL( clicked() ), this, SLOT( setCurrentChannelEpg() ) );- connect( searchBtn , SIGNAL( clicked() ), this, SLOT( epgSearch() ) );+ connect( searchBtn, SIGNAL( clicked() ), this, SLOT(resetSearch()) );+ connect( searchLineEdit, SIGNAL( returnPressed() ), this, SLOT( epgSearch() ) ); connect( listView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), this, SLOT(mouseClickedSlot(int,QListViewItem*,const QPoint&,int)) );+ connect( listView, SIGNAL(doubleClicked(QListViewItem*,const QPoint &,int)), this, SLOT(zap(QListViewItem*,const QPoint &,int)) ); @@ -129,6 +159,11 @@ delete icon; } +void KEvents::resetSearch()+{+ searchLineEdit->clear();+}+ void KEvents::checkEpgSearch(QString searchword) { int i, j, k, m, n,l;@@ -136,7 +171,6 @@ EventSourceList *slist; EventTsidList *tlist; EListViewItem *itt=0;- QString s, channel, begin, duration, title; bool found; EventDesc *desc;@@ -156,50 +190,70 @@ for ( i=0; i<(int)channels->count(); i++ ) { if ( desc->source==channels->at(i)->tp.source && desc->sid==channels->at(i)->sid && desc->tsid==channels->at(i)->tp.tsid ) {++ if(tvradioCb->isChecked() && channels->at(i)->type==2)+ break;++ if(ftaCb->isChecked() && channels->at(i)->fta==1)+ break;+ channel = channels->at(i)->name; - found=false;- if(desc->title.upper().find(searchword.upper())!=-1)- found=true;- if(!titleCb->isChecked()) {- if(!found) {- for ( l=0; l<(int)desc->extEvents.count(); l++ ) {- s = *desc->extEvents.at(l);- if(!s.isEmpty()) {- if(s.upper().find(searchword.upper())!=-1) {- found=true;- s="";- break;+ found=false;+ if(desc->title.upper().find(searchword.upper())!=-1)+ found=true;++ if(!desc->subtitle.isEmpty()) {+ if(desc->subtitle.upper().find(searchword.upper())!=-1)+ found=true;+ }++ if(!titleCb->isChecked()) {+ if(!found) {+ for ( l=0; l<(int)desc->extEvents.count(); l++ ) {+ s = *desc->extEvents.at(l);+ if(!s.isEmpty()) {+ if(s.upper().find(searchword.upper())!=-1) {+ found=true;+ s="";+ break;+ } } } }- }- if(!found) {- for ( l=0; l<(int)desc->shortEvents.count(); l++ ) {- s = s + desc->shortEvents.at(l)->name;- s += s + desc->shortEvents.at(l)->text;- if(!s.isEmpty()) {- if(s.upper().find(searchword.upper())!=-1) {- found=true;- s="";- break;+ if(!found) {+ for ( l=0; l<(int)desc->shortEvents.count(); l++ ) {+ s = desc->shortEvents.at(l)->name;+ if(!s.isEmpty()) {+ if(s.upper().find(searchword.upper())!=-1) {+ found=true;+ s="";+ break;+ } }+ s = desc->shortEvents.at(l)->text;+ if(!s.isEmpty()) {+ if(s.upper().find(searchword.upper())!=-1) {+ found=true;+ s="";+ break;+ }+ } } } }- }- if(!found)- continue;+ if(!found)+ break; - pix = channels->at(i)->pix;- begin = KGlobal::locale()->formatDateTime( desc->startDateTime );- duration = desc->duration.toString("hh:mm");- title = desc->title;+ pix = channels->at(i)->pix;+ begin = KGlobal::locale()->formatDateTime( desc->startDateTime );+ duration = desc->duration.toString("hh:mm");+ title = desc->title; - itt = new EListViewItem( (QListView*)listView, channel, begin, duration, title, desc );+ itt = new EListViewItem( (QListView*)listView, channel, begin, duration, title, desc ); - if ( !pix.isNull() )- itt->setPixmap( 0, pix );+ if ( !pix.isNull() )+ itt->setPixmap( 0, pix ); } } }@@ -211,9 +265,11 @@ void KEvents::epgSearch() {- QString text = searchLineEdit->text();- if (text.stripWhiteSpace().isEmpty()) return;- listView->clear();++ QString text = searchLineEdit->text();+ if (text.stripWhiteSpace().isEmpty()) return;++ listView->clear(); checkEpgSearch(text); }
Index: dvbpanel.cpp===================================================================--- src/input/dvb/dvbpanel.cpp (revision 666596)+++ src/input/dvb/dvbpanel.cpp (working copy)@@ -31,6 +31,7 @@ #include <qapplication.h> #include <qpopupmenu.h> #include <qmap.h>+#include <qregexp.h> #include <kiconloader.h> #include <klocale.h>@@ -1136,7 +1137,7 @@ bool cont=false; QPtrList<Transponder> trans = getSourcesStatus(); trans.setAutoDelete( true );-+ QString tsource; searchLE->clear(); channelsCb->clear(); for ( i=0; i<(int)channels.count(); i++ ) {@@ -1141,7 +1141,8 @@ } else if ( currentCategory!="All" && chan->category!=currentCategory ) continue;- it = new KListViewItem( channelsCb, QString().sprintf("%04d", chan->num), chan->name, chan->tp.source );+ tsource=chan->tp.source;+ it = new KListViewItem( channelsCb, QString().sprintf("%04d", chan->num), chan->name, QString().sprintf("%s-%05lu%c",tsource.remove( QRegExp(".*-")).ascii(), chan->tp.freq, chan->tp.type==FE_QPSK ?chan->tp.pol:' ') ); if ( ch && ch==chan ) visible = it; it->setDragEnabled( true );@@ -2146,7 +2148,7 @@ QString s, c, t, u, type; int pos, tpos; ChannelDesc *chan;- QString src="";+ QString src="",tsource; int ns; KListViewItem *it; QPixmap pix;@@ -2381,7 +2383,8 @@ } chan->pix.load( dvbConfig->dvbConfigIconsDir+chan->name );- it = new KListViewItem( channelsCb, QString().sprintf("%04d", chan->num), chan->name, chan->tp.source );+ tsource=chan->tp.source;+ it = new KListViewItem( channelsCb, QString().sprintf("%04d", chan->num), chan->name, QString().sprintf("%s-%05lu%c",tsource.remove( QRegExp(".*-")).ascii(), chan->tp.freq, chan->tp.type==FE_QPSK ?chan->tp.pol:' ') ); it->setDragEnabled( true ); if ( !chan->pix.isNull() ) it->setPixmap( 1, chan->pix );
Index: src/input/dvb/ktimereditor.cpp===================================================================--- src/input/dvb/ktimereditor.cpp (revision 692979)+++ src/input/dvb/ktimereditor.cpp (working copy)@@ -29,10 +29,10 @@-KTimerEditor::KTimerEditor( bool newone, QStringList &chanList,RecTimer t, QWidget *parent ) : QDialog( parent )+KTimerEditor::KTimerEditor( bool newone, QPtrList<ChannelDesc> chan,RecTimer t, QWidget *parent ) : QDialog( parent ) { int i;-+ QGridLayout *grid = new QGridLayout( 0, 1, 1, 11, 6 ); QLabel *lab = new QLabel( i18n("Name:"), this ); grid->addWidget( lab, 0, 0 );@@ -58,10 +58,14 @@ grid->addWidget( lab, 5, 0 ); typeComb = new QComboBox( this ); grid->addWidget( typeComb, 5, 1 );+ lab = new QLabel( i18n("Audio channel:"), this );+ grid->addWidget( lab, 6, 0 );+ audioChannelComb = new QComboBox( this );+ grid->addWidget(audioChannelComb, 6, 1 ); repeatBtn = new KPushButton( this );- grid->addWidget( repeatBtn, 6, 0 );+ grid->addWidget( repeatBtn, 7, 0 ); repeatLab = new QLabel( this );- grid->addWidget( repeatLab, 6, 1 );+ grid->addWidget( repeatLab, 7, 1 ); QFrame *line = new QFrame( this, "line1" ); line->setFrameStyle( QFrame::HLine );@@ -83,17 +87,25 @@ vb->addLayout( hb ); timer = t;+ chanList = chan; typeComb->insertItem( "TS" ); typeComb->insertItem( "MPEG_PES" ); typeComb->insertItem( "MPEG_PS" ); //begin->dateEdit()->setOrder( QDateEdit::DMY );- channelComb->insertStringList( chanList );+ QStringList list;+ QMap<QString,QString> map;+ for ( QPtrListIterator<ChannelDesc> it(chanList); it.current(); ++it )+ list.append( it.current()->name );++ channelComb->insertStringList( list );+ if ( newone ) { begin->setDateTime( QDateTime::currentDateTime() ); duration->setTime( QTime(2,0,0) );+ newChannelSelect(channelComb->currentItem()); } else { nameLe->setText( timer.name );@@ -105,10 +117,13 @@ } begin->setDateTime( timer.begin ); duration->setTime( timer.duration );+ newChannelSelect(channelComb->currentItem());+ audioChannelComb->setCurrentItem(timer.napid); if ( timer.running ) { nameLe->setEnabled( false ); channelComb->setEnabled( false ); begin->setEnabled( false );+ audioChannelComb->setEnabled( false ); typeComb->setEnabled( false ); repeatBtn->setEnabled( false ); }@@ -132,18 +147,33 @@ repeatBtn->setGuiItem( KGuiItem(i18n("Repeat..."),icon->loadIconSet("reload", KIcon::Small) ) ); setCaption( i18n("Timer Editor") );-+ connect( okBtn, SIGNAL(clicked()), this, SLOT(accept()) ); connect( cancelBtn, SIGNAL(clicked()), this, SLOT(reject()) ); connect( repeatBtn, SIGNAL(clicked()), this, SLOT(setRepeat()) ); connect( begin, SIGNAL(valueChanged(const QDateTime&)), this,SLOT(setMaxEnd(const QDateTime&)) ); connect( end, SIGNAL(valueChanged(const QDateTime&)), this,SLOT(setDuration(const QDateTime&)) ); connect( duration, SIGNAL(valueChanged(const QTime&)), this,SLOT(setEnd(const QTime&)) );+ connect( channelComb, SIGNAL(activated(int)), this,SLOT(newChannelSelect(int)) );+ setMaxEnd( begin->dateTime() ); delete icon; }+void KTimerEditor::newChannelSelect(int channelIndex)+{+ QString str;+ int i;+ ChannelDesc *channel;+ channel=chanList.at((unsigned int)channelIndex);+ audioChannelComb->clear();+ for(i=0;i<channel->napid;i++)+ if (channel->apid[i].ac3)+ audioChannelComb->insertItem("AC3");+ else+ audioChannelComb->insertItem(channel->apid[i].lang);+} void KTimerEditor::setMaxEnd( const QDateTime &dt ) {@@ -192,6 +222,7 @@ void KTimerEditor::accept() {+ ChannelDesc *channel; if ( nameLe->text().stripWhiteSpace().isEmpty() ) { KMessageBox::sorry( this, i18n("You must give it a name!") ); nameLe->setFocus();@@ -231,6 +262,9 @@ timer.name = nameLe->text().stripWhiteSpace(); timer.channel = channelComb->currentText(); timer.begin = begin->dateTime();+ channel = chanList.at(channelComb->currentItem());+ timer.napid = audioChannelComb->currentItem();+ done( Accepted ); return;Index: src/input/dvb/channeldesc.h===================================================================--- src/input/dvb/channeldesc.h (revision 692979)+++ src/input/dvb/channeldesc.h (working copy)@@ -37,12 +37,14 @@ public:+ RecTimer(); QString name; QString fullPath; QString channel; QDateTime begin; QTime duration; int filetype;+ unsigned short napid; char running; int mode; };Index: src/input/dvb/krecord.h===================================================================--- src/input/dvb/krecord.h (revision 692979)+++ src/input/dvb/krecord.h (working copy)@@ -38,10 +38,10 @@ public:- KRecord( QStringList chanList, QPtrList<RecTimer> *t, QWidget*parent, QSize size, int format );+ KRecord( QPtrList<ChannelDesc> chanList, QPtrList<RecTimer> *t,QWidget *parent, QSize size, int format , int maxSize); ~KRecord();- QStringList channelsList;+ QPtrList<ChannelDesc> channelsList; protected slots:@@ -54,11 +54,12 @@ private: QListViewItem* where( RecTimer *rt, bool add=false );+ QString KRecord::textAudioPid(QString channel,int pid); KPushButton *newBtn, *editBtn, *deleteBtn, *okBtn; KListView *list; QPtrList<RecTimer> *timers;- int prefFormat;+ int prefFormat, maxFileSize; QPixmap isRecording, yesRepeat; signals:Index: src/input/dvb/dvbconfig.cpp===================================================================--- src/input/dvb/dvbconfig.cpp (revision 692979)+++ src/input/dvb/dvbconfig.cpp (working copy)@@ -474,6 +474,7 @@ config->writeEntry( "InstantDuration", instantDuration ); config->writeEntry( "PrefFormat", format ); config->writeEntry( "RecordDir", recordDir );+ config->writeEntry( "SizeFile",sizeFile); config->writeEntry( "ShiftDir", shiftDir ); config->writeEntry( "BroadcastAddress", broadcastAddress ); config->writeEntry( "BroadcastPort", broadcastPort );Index: src/input/dvb/dvbout.cpp===================================================================--- src/input/dvb/dvbout.cpp (revision 692979)+++ src/input/dvb/dvbout.cpp (working copy)@@ -363,10 +363,11 @@ QString fname=name; recTimer = t;+ activeApid = (t->napid<channel.napid)?t->napid:0; if ( outType ) return false; if ( tp ) return false;-+ if ( channel.apid[activeApid].ac3 || !channel.vpid ||channel.subpid[0].pid || channel.apid[activeApid].pid==8192 ) type = OutTS;@@ -388,7 +389,7 @@ case OutTS : { fileName=name; fileNumber=0;-+ if (maxsize>0) { fileMaxSize = (long long int)1048576*(long long int)maxsize; fname=fileName+"_"+QString().setNum(fileNumber);@@ -478,7 +479,6 @@ int i, pid; unsigned char *buffer=buf; QString fname;- for ( i=0; i<size; i+=TS_SIZE ) { pid = (((buffer[1] & 0x1f) << 8) | buffer[2]); if ( channel.vpid==pid || channel.apid[activeApid].pid==pid ||channel.subpid[0].pid==pid || channel.apid[activeApid].pid==8192) {Index: src/input/dvb/channeldesc.cpp===================================================================--- src/input/dvb/channeldesc.cpp (revision 692979)+++ src/input/dvb/channeldesc.cpp (working copy)@@ -22,6 +22,11 @@ #include "channeldesc.h"+RecTimer::RecTimer()+{+ fileSize=0;+}+ AudioPid::AudioPid() { pid=ac3=0;Index: src/input/dvb/ktimereditor.h===================================================================--- src/input/dvb/ktimereditor.h (revision 692979)+++ src/input/dvb/ktimereditor.h (working copy)@@ -41,16 +41,17 @@ public:- KTimerEditor( bool newone, QStringList &chanList, RecTimer t,QWidget *parent );+ KTimerEditor( bool newone, QPtrList<ChannelDesc> chanList, RecTimert, QWidget *parent ); ~KTimerEditor(); KPushButton *okBtn, *cancelBtn, *repeatBtn; QLabel *repeatLab; QLineEdit *nameLe;- QComboBox *channelComb, *typeComb;+ QComboBox *channelComb, *typeComb, *audioChannelComb; QDateTimeEdit *begin, *end; QTimeEdit *duration; RecTimer timer;+ QPtrList<ChannelDesc> chanList; public slots:@@ -62,6 +63,7 @@ void setDuration( const QDateTime &dt ); void setEnd( const QTime &t ); void setMaxEnd( const QDateTime &dt );+ void newChannelSelect(int channelIndex ); }; #endif /* KTIMEREDITOR_H */Index: src/input/dvb/dvbstream.cpp===================================================================--- src/input/dvb/dvbstream.cpp (revision 692979)+++ src/input/dvb/dvbstream.cpp (working copy)@@ -1152,7 +1152,7 @@ connect( o, SIGNAL(playDvb()), this, SLOT(receivePlayDvb()) ); connect( o, SIGNAL(shifting(bool)), this, SLOT(receiveShifting(bool)) ); out.append( o );- if ( !setPids( o, 0 ) ) {+ if ( !setPids( o, (t->napid<chan->napid)?t->napid:0) ) { if ( stop ) stopFrontend(); removePids( o );@@ -1235,7 +1235,7 @@ return ErrCantSetPids; } }-+ i=0; if ( o->hasRec() ) { napid = o->currentAudioPid(); i = ErrDontSwitchAudio;Index: src/input/dvb/krecord.cpp===================================================================--- src/input/dvb/krecord.cpp (revision 692979)+++ src/input/dvb/krecord.cpp (working copy)@@ -32,11 +32,12 @@-KRecord::KRecord( QStringList chanList, QPtrList<RecTimer> *t,QWidget *parent, QSize size, int format ) : QDialog( parent )+KRecord::KRecord( QPtrList<ChannelDesc> chanList, QPtrList<RecTimer>*t, QWidget *parent, QSize size, int format , int maxSize) : QDialog(parent ) { timers = t; channelsList = chanList; prefFormat = format;+ maxFileSize = maxSize; QVBoxLayout *vb = new QVBoxLayout( 0, 0, 6 ); QLabel *lab = new QLabel( i18n("Timers list:"), this );@@ -48,6 +49,7 @@ list->addColumn( i18n( "Channel" ) ); list->addColumn( i18n( "Begin" ) ); list->addColumn( i18n( "Duration" ) );+ list->addColumn( i18n( "Audio track" ) ); list->setResizePolicy( KListView::AutoOneFit ); list->setAllColumnsShowFocus( true ); list->setFullWidth( true );@@ -57,6 +59,7 @@ item->setText( 2, "Une chaine du meme calibre" ); item->setText( 3, "00:00 00/00/00mm" ); item->setText( 4, "00:00mm" );+ item->setText( 5, "fra" ); vb->addWidget( list ); QVBoxLayout *vb1 = new QVBoxLayout( 0, 0, 6 );@@ -108,8 +111,26 @@ delete icon; }+QString KRecord::textAudioPid(QString channel,int napid)+{+ QString apidname,s;+ int ichan;+ for (ichan=0 ; ichan < (int)channelsList.count() ; ichan++)+ if (channelsList.at(ichan)->name == channel)+ break;+ apidname = s.setNum( napid+1 ) + " - ";+ if (channelsList.at(ichan)->apid[napid].ac3)+ apidname = apidname + "AC3";+ else+ apidname = apidname + channelsList.at(ichan)->apid[napid].lang;+ apidname = apidname + " ("+ s.setNum(channelsList.at(ichan)->apid[napid].pid ) + ")";++ return(apidname);+}++ void KRecord::refresh() { QListViewItem *after, *itt;@@ -126,7 +147,9 @@ else s = ""; s = s+ti->name;*/ s = ti->name;- itt = new KListViewItem( (QListView*)list, "", s, ti->channel,KGlobal::locale()->formatDateTime( ti->begin ),ti->duration.toString("hh:mm") );+++ itt = new KListViewItem( (QListView*)list, "", s, ti->channel,KGlobal::locale()->formatDateTime( ti->begin ),ti->duration.toString("hh:mm") , textAudioPid( ti->channel , ti->napid) ); if ( ti->mode ) itt->setPixmap( 0, yesRepeat ); if ( ti->running )@@ -146,13 +169,14 @@ t->running = 0; t->filetype = prefFormat; t->mode = 0;+ t->fileSize = maxFileSize; KTimerEditor dlg( true, channelsList, *t, this ); int ret=dlg.exec(); if ( ret==KTimerEditor::Accepted ) { *t = dlg.timer; after = where( t, true );- itt = new KListViewItem( (QListView*)list, "", t->name, t->channel,KGlobal::locale()->formatDateTime( t->begin ),t->duration.toString("hh:mm") );+ itt = new KListViewItem( (QListView*)list, "", t->name, t->channel,KGlobal::locale()->formatDateTime( t->begin ),t->duration.toString("hh:mm"), textAudioPid( t->channel , t->napid )); if ( t->mode ) itt->setPixmap( 0, yesRepeat ); if ( t->running )Index: src/input/dvb/dvbpanel.cpp===================================================================--- src/input/dvb/dvbpanel.cpp (revision 692979)+++ src/input/dvb/dvbpanel.cpp (working copy)@@ -1362,6 +1362,7 @@ rt->filetype = dvbConfig->format; rt->running = 1; rt->mode = 0;+ rt->napid = audioComb->currentItem(); ret = d->canStartTimer( live, &curchan ); if ( ret==0 ) {@@ -1523,14 +1524,15 @@ KMessageBox::sorry( 0, i18n("You may want to define some channel first!") ); return; }+ /* for ( QPtrListIterator<ChannelDesc> it(channels); it.current(); ++it ) map[it.current()->name] = it.current()->name; QMap<QString,QString>::Iterator it; QMap<QString,QString>::Iterator end(map.end()); for ( it = map.begin(); it != end; ++it ) list.append( it.data() );-- timersDialog = new KRecord( list, &timers, mainWidget,dvbConfig->timerSize, dvbConfig->format );+ */+ timersDialog = new KRecord( channels, &timers, mainWidget,dvbConfig->timerSize, dvbConfig->format, dvbConfig->sizeFile ); for ( i=0; i<(int)dvb.count(); i++ ) { connect( timersDialog, SIGNAL(updateTimer(RecTimer*,int)),dvb.at(i), SLOT(updateTimer(RecTimer*,int)) ); }@@ -1576,6 +1578,7 @@ rt->filetype = dvbConfig->format; rt->running = 0; rt->mode = 0;+ rt->napid = 0; for ( i=0; i<(int)timers.count(); i++ ) { t = timers.at(i);@@ -2551,6 +2554,9 @@ t->channel = s.left( pos ); s = s.right( s.length()-pos-1 ); pos = s.find("|");+ t->napid = s.left( pos ).toInt();+ s = s.right( s.length()-pos-1 );+ pos = s.find("|"); t->begin = QDateTime::fromString( s.left( pos ), Qt::ISODate ); s = s.right( s.length()-pos-1 ); pos = s.find("|");@@ -2590,6 +2596,7 @@ continue; tt<< t->name+"|"; tt<< t->channel+"|";+ tt<< s.setNum(t->napid)+"|"; tt<< t->begin.toString("yyyy-MM-ddThh:mm:ss")+"|"; tt<< t->duration.toString()+"|"; tt<< s.setNum(t->filetype)+"|";
Index: src/input/dvb/dvbevents.cpp===================================================================--- src/input/dvb/dvbevents.cpp (Revision 725163)+++ src/input/dvb/dvbevents.cpp (Arbeitskopie)@@ -2,6 +2,7 @@ * dvbevents.cpp * * Copyright (C) 2003-2007 Christophe Thommeret <hftom@free.fr>+ * Copyright (C) 2007 guality (DVBCITevents) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by@@ -448,10 +449,408 @@ } +DVBCITevents::DVBCITevents( int anum, int tnum, const QString &charset, EventTable *table, int pid_ ) : DVBsection( anum, tnum, charset )+{+ pid = pid_;+ events = table;+} +DVBCITevents::~DVBCITevents()+{+ isRunning = false;+ if ( !wait(2000) ) {+ terminate();+ wait();+ }+}++bool DVBCITevents::safeLen( unsigned char* buf )+{+ if ( buf<(secbuf+readSize) )+ return true;+ fprintf( stderr, "CIT (%d:%d) : buffer overflow! Rejected\n", adapter, tuner );+ return false;+}++bool DVBCITevents::extEventForCID(unsigned char *buf, EventDesc *desc )+{+ int loop, len1, len2;+ unsigned char *b = buf;+ QString s;++ if ( !safeLen( b+7 ) )+ return false;+ loop = getBits(b+6,0,8);+ b +=7;++ while ( loop>0 ) {+ if ( !safeLen( b+1 ) )+ return false;+ len1 = getBits(b,0,8);+ if ( !safeLen( b+1+len1 ) )+ return false;+ s = getText(b+1,len1);+ if ( !safeLen( b+1+len1+1 ) )+ return false;+ len2 = getBits(b+1+len1,0,8);+ if ( !safeLen( buf+2+len1+len2 ) )+ return false;+ if ( !s.isEmpty() )+ s = s+" : ";+ s = s+getText(b+2+len1,len2);+ desc->extEvents.append( new QString( s ) );+ b +=(2+len1+len2);+ loop -=(2+len1+len2);+ }+ if ( !safeLen( b+1 ) )+ return false;+ len1 = getBits(b,0,8);+ if ( !safeLen( b+1+len1 ) )+ return false;+ s = getText(b+1,len1);+ desc->extEvents.append( new QString( s ) );+ return true;+}++bool DVBCITevents::shortEventForCID(unsigned char* buf, EventDesc *desc)+{+ QString name, text;+ int len, len2;+ ShortEvent *ev;++ if ( !safeLen( buf+6 ) )+ return false;+ len = getBits(buf,40,8);+ if ( !safeLen( buf+6+len ) )+ return false;+ name = getText( buf+6, len );+ if ( !safeLen( buf+6+len+1 ) )+ return false;+ len2 = getBits(buf+6+len,0,8);+ if ( !safeLen( buf+7+len+len2 ) )+ return false;+ text = getText( buf+7+len, len2);+ if ( desc->title.isEmpty() ) {+ desc->title=name;+ desc->subtitle=text;+ //qDebug("%d: %s", pid, desc->title.latin1());+ return true;+ }+ desc->shortEvents.append( new ShortEvent() );+ ev = desc->shortEvents.getLast();+ ev->name = name;+ ev->text = text;+ return true;+}++unsigned int DVBCITevents::crc16(unsigned int crc, unsigned char const *p, int len)+{+ while(len--) {+ crc^=*p++;+ for(int i=0; i<8; i++)+ crc=(crc&1) ? (crc>>1)^POLY : (crc>>1);+ }+ return crc&0xFFFF;+}++bool DVBCITevents::contentTransmissionTable( unsigned char* buffer, EventDesc *desc )+{+ // every 0xf2 table has multiple dates and times for one SID+ // for every time we need an event_id and a seperate EventDesc++ unsigned char *buf = buffer;+ int len = buf[1];+ int start_tm_loop;+ int tsid, nid, sid;+ int content_id;+ unsigned short event_id;+ QDateTime start, cur, dt; + QDate start_dt;+ QTime start_tm;+ EventSid *slist;+ QPtrList<EventDesc> *currentEvents;+ bool dontadd = false;++ EventDesc *newDesc = 0, *itdesc = 0;+ + tsid = getBits(buf, 16, 16);+ nid = getBits(buf, 32, 16);+ sid = getBits(buf, 48, 16);+ buf += 8;+ len -= 6;++ slist = currentSrc->getEventSid(nid, tsid, sid);+ if(!slist) return false;+ slist->lock();+ currentEvents = slist->getEvents();+ QPtrListIterator<EventDesc> it( *currentEvents );+ unsigned int cdt = QDateTime::currentDateTime().toTime_t();+ bool parse = true;+ int optCount = 0;+ + while(len > 0)+ {+ start_dt = getDate(buf);+ start_tm_loop = getBits(buf, 16, 8);+ buf += 3;+ len -= 3;+ optCount++;+ int index = 0;++ for(; start_tm_loop > 0; start_tm_loop -= 3)+ {+ int h, m, s;+ s = ((getBits(buf,16,4)*10)+getBits(buf,20,4))%60;+ m = ((getBits(buf,8,4)*10)+getBits(buf,12,4))%60;+ h = ((getBits(buf,0,4)*10)+getBits(buf,4,4))%24;+ start_tm = QTime(h, m, s);++ QTime local = QTime::currentTime(Qt::LocalTime);+ QTime loc_utc = QTime::currentTime(Qt::UTC);+ int diff = loc_utc.secsTo(local);+ /*printf("local: %s, loc_utc: %s, diff: %d, time: %s", local.toString("hh:mm:ss").latin1(), + loc_utc.toString("hh:mm:ss").latin1(), diff,+ start_tm.toString("hh:mm:ss").latin1());*/+ start_tm = start_tm.addSecs(diff);+ //printf(", conv: %s\n", start_tm.toString("hh:mm:ss").latin1());+ start = QDateTime( start_dt, start_tm );++ content_id = desc->eid;+ + // event_id calculation by Stefan Huelswitt, vdr-premiereepg+ unsigned int crc[3];+ bool isOpt = false;+ if(index++==0) isOpt = true;+ crc[0] = content_id;+ crc[1] = isOpt ? optCount : 0;+ crc[2] = start.toTime_t() / STARTTIME_BIAS;+ event_id = ((('P'<<8)|'W')<<16) | crc16(0,(unsigned char *)crc,sizeof(crc));+ //event_id = content_id ^ (start.toTime_t() & 0xFFFFF800);+ + newDesc = new EventDesc(*desc);++ // epg fix by Stefan Huelswitt, vdr-premiereepg+ if(nid==133) {+ if (tsid==0x03 && sid==0xf0) { tsid=0x02; sid=0xe0; }+ else if(tsid==0x03 && sid==0xf1) { tsid=0x02; sid=0xe1; }+ else if(tsid==0x03 && sid==0xf5) { tsid=0x03; sid=0xdc; }+ else if(tsid==0x04 && sid==0xd2) { tsid=0x11; sid=0xe2; }+ else if(tsid==0x11 && sid==0xd3) { tsid=0x11; sid=0xe3; }+ else if(tsid==0x01 && sid==0xd4) { tsid=0x04; sid=0xe4; } // new shift due to deactivated SID 212+ //if(sid==0xd4) sid=0xe4; //as 0xd4 is no longer in service, we can map this directly (tsid 0x01 seems to be wrong)+ }+ + newDesc->eid = event_id;+ newDesc->tsid = tsid;+ newDesc->nid = nid;+ newDesc->sid = sid;+ newDesc->startDateTime = start;+ parse = true;+ + it.toFirst();+ while ( (itdesc = it.current()) != 0 ) {+ if( itdesc->sid == sid) {+ if( itdesc->startDateTime == start || itdesc->eid == event_id ) {+ parse = false;+ break;+ }+ /*else {+ if ( (cdt - itdesc->loop) < 300 ) { // only reparse events every 300 seconds+ parse = false;+ }+ else parse = true;+ break;+ }*/+ }+ ++it;+ }++ if(parse) {+ for( int i=0; i < (int)currentEvents->count(); i++)+ {+ itdesc = currentEvents->at(i);+ /*if( itdesc->startDateTime == start || itdesc->eid == event_id ) {+ dontadd = true; + break;+ }+ else {*/+ if( start < itdesc->startDateTime){+ currentEvents->insert(i, newDesc);+ break;+ }+ itdesc = 0;+ //dontadd = false;+ //}+ }+ if(!itdesc)// && dontadd == false)+ currentEvents->append(newDesc);+ }+ + cur = QDateTime::currentDateTime();+ dt = start;+ int sec = newDesc->duration.hour()*3600+newDesc->duration.minute()*60+newDesc->duration.second();+ if ( dt.addSecs( sec ) < cur)+ currentEvents->remove( newDesc );+ else+ newDesc->source = currentSrc->getSource();+ + buf += 3;+ len -= 3;+ }+ }++ slist->unlock();++ return true;+}++bool DVBCITevents::tableCIT( unsigned char* buffer )+{+ unsigned char* buf = buffer;+ int sec_length, sec_num, sec_last;+ int content_id, discr_sec_length;+ QTime dur;+ + sec_length = getBits(buf, 12, 12);+ sec_num = getBits(buf, 48, 8);+ sec_last = getBits(buf, 56, 8);+ buf += 8;+ sec_length -= 5;+ content_id = getBits(buf, 0, 32);+ //duration = getBits(buf, 32, 24);+ dur = getTime(buf+4);+ discr_sec_length = getBits(buf, 60, 12);+ buf += 9;+ sec_length -= 9;++ EventDesc *desc = 0;+ desc = new EventDesc();+ int event_id = 0;+ int sanity_count = 0;+ + while (sec_length > 4) // traverse all descriptors, remember, there might be multiple sub-tables+ {+ int descr_id = (int)buf[0];+ int descr_length = ((int)buf[1]) + 2;+ unsigned int cdt = QDateTime::currentDateTime().toTime_t();+ + switch(buf[0])+ {+ case 0x4d: //short_event+ {+ shortEventForCID(buf,desc);+ }+ break;+ + case 0x4e: //extended_event+ {+ extEventForCID(buf,desc);+ }+ break;+ + case 0xf2: //privat_content_transmission+ {+ desc->eid = content_id; //pass temporary content_id+ desc->duration = dur;+ //desc->running = 1;+ desc->tid = buf[0];+ desc->lsn = sec_last;+ desc->sn = sec_num;+ desc->loop = cdt;+ + contentTransmissionTable(buf,desc);+ }+ break;+ }+ + if(sec_length < descr_length) break;+ buf += descr_length;+ sec_length -= descr_length;+ }++ return true;+}+++bool DVBCITevents::go( QString src )+{+ if ( isRunning )+ return true;++ currentSrc = events->getEventSource( src );++ // CIT PID 2833 (0xb11) Prem Direkt+ // CIT PID 2834 (0xb12) Prem Sport+ + if ( !setFilter( pid, 0, 1000) )+ return false;++ isRunning = true;+ start();+ fprintf(stderr,"dvbCITEvents %d:%d:%d started\n", adapter, tuner, pid);+ return true;+}++void DVBCITevents::stop()+{+ if ( !isRunning )+ return;++ isRunning = false;+ if ( !wait(2000) ) {+ terminate();+ wait();+ fprintf(stderr,"dvbCITEvents %d:%d:%d terminated\n", adapter, tuner, pid);+ }+ else+ fprintf(stderr,"dvbCITEvents %d:%d:%d ended\n", adapter, tuner, pid);+ stopFilter();+}++void DVBCITevents::run()+{+ int n=0, tid;+ int skip=0;++ setpriority(PRIO_PROCESS, 0, 19); + while ( isRunning ) {+ if ( !isRunning )+ break;++ if ( poll(pf,1,1000)>0 ){+ if ( pf[0].revents & POLLIN ){+ n = read( fdDemux, secbuf, 4096 );+ skip = 0;+ }+ else+ skip++;+ }+ else+ skip++;++ if (skip)+ continue;+ if ( n<16 )+ continue;+ else+ readSize = n;++ if ( !isRunning )+ break;++ if ( getBits(secbuf,0,8) == 0xa0 ) {+ tableCIT( secbuf );+ }+ }+}++ DVBevents::DVBevents( int anum, int tnum, const QString &charset, EventTable *table ) : DVBsection( anum, tnum, charset ) { events = table;++ citEvents = new DVBCITevents( anum, tnum, charset, table, 2833 );+ citEvents2 = new DVBCITevents( anum, tnum, charset, table, 2834 ); } @@ -463,6 +862,8 @@ terminate(); wait(); }+ delete citEvents;+ delete citEvents2; } @@ -540,7 +941,33 @@ } +bool DVBevents::linkageDesc( unsigned char* buf )+{+ unsigned char *b = buf;+ unsigned int descr_len, tsid, nid, sid, type;+ int len;+ QString name;+ QPtrList<ChannelDesc> channels;+ + descr_len = b[1];+ tsid = getBits(b, 16, 16);+ nid = getBits(b, 32, 16);+ sid = getBits(b, 48, 16);+ type = getBits(b, 64, 8);+ + len = descr_len - 7;+ b += 7 +2;+ + if(type == 0xB0)+ {+ name = getText(b, len);+ qDebug("%s\n", name.latin1());+ }+ + return true;+} + bool DVBevents::tableEIT( unsigned char* buffer ) { unsigned char* buf = buffer;@@ -647,6 +1074,10 @@ if ( !extEventDesc( buf, desc ) ) goto stop; break;+ /*case 0x4A :+ if ( !linkageDesc( buf ) )+ goto stop;+ break;*/ default : break; }@@ -715,6 +1146,9 @@ bool DVBevents::go( QString src, bool all ) {+ citEvents->go( src );+ citEvents2->go( src );+ int tid; if ( isRunning )@@ -739,6 +1173,9 @@ void DVBevents::stop() {+ citEvents->stop();+ citEvents2->stop();+ if ( !isRunning ) return; Index: src/input/dvb/dvbevents.h===================================================================--- src/input/dvb/dvbevents.h (Revision 725163)+++ src/input/dvb/dvbevents.h (Arbeitskopie)@@ -2,6 +2,7 @@ * dvbevents.h * * Copyright (C) 2003-2007 Christophe Thommeret <hftom@free.fr>+ * Copyright (C) 2007 guality (DVBCITevents) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by@@ -28,7 +29,6 @@ #include "channeldesc.h" - class EventSid { public:@@ -111,8 +111,8 @@ void setClean(); }; +class DVBCITevents; - class DVBevents : public DVBsection { Q_OBJECT@@ -130,6 +130,7 @@ bool tableEIT( unsigned char* buffer ); bool shortEventDesc( unsigned char *buf, EventDesc *desc ); bool extEventDesc( unsigned char *buf, EventDesc *desc );+ bool linkageDesc( unsigned char* buf ); bool safeLen( unsigned char* buf ); unsigned char secbuf[4096];@@ -137,6 +138,8 @@ EventTable *events; EventSource *currentSrc;+ DVBCITevents *citEvents;+ DVBCITevents *citEvents2; signals: @@ -144,4 +147,38 @@ }; ++#define STARTTIME_BIAS (20*60)+#define POLY 0xA001 // CRC16++class DVBCITevents : public DVBsection+{+ Q_OBJECT++public:++ DVBCITevents( int anum, int tnum, const QString &charset, EventTable *table, int pid );+ ~DVBCITevents();+ bool go( QString src );+ void stop();++private:++ virtual void run();+ bool tableCIT( unsigned char* buffer );+ bool shortEventForCID( unsigned char *buf, EventDesc *desc );+ bool extEventForCID( unsigned char *buf, EventDesc *desc );+ bool contentTransmissionTable( unsigned char* buffer, EventDesc *desc );+ bool safeLen( unsigned char* buf );+ unsigned int crc16(unsigned int crc, unsigned char const *p, int len);+ + int pid;+ unsigned char secbuf[4096];+ int readSize;++ EventTable *events;+ EventSource *currentSrc;+};++ #endif /* DVBEVENTS_H */