1 #include <streaminfo.h>
5 #include <lib/system/elock.h>
6 #include <lib/driver/rc.h>
7 #include <lib/dvb/dvb.h>
8 #include <lib/dvb/edvb.h>
9 #include <lib/dvb/decoder.h>
10 #include <lib/dvb/servicemp3.h>
11 #include <lib/gdi/font.h>
12 #include <lib/gui/multipage.h>
13 #include <lib/gui/eskin.h>
14 #include <lib/gui/guiactions.h>
15 #include <lib/gui/elabel.h>
16 #include <lib/gui/echeckbox.h>
17 #include <lib/gui/ebutton.h>
18 #include <lib/dvb/dvbwidgets.h>
19 #include <lib/dvb/frontend.h>
20 #include <lib/dvb/dvbservice.h>
21 #include <lib/dvb/service.h>
22 #include <lib/system/info.h>
24 eStreaminfo
*eStreaminfo::instance
;
26 int eStreaminfo::eventHandler(const eWidgetEvent
&event
)
30 case eWidgetEvent::evtAction
:
31 if ((event
.action
== &i_cursorActions
->ok
))
33 else if (event
.action
== &i_cursorActions
->right
)
36 descr
->setText( lb
->goNext()->getHelpText() );
38 else if (event
.action
== &i_cursorActions
->left
)
41 descr
->setText( lb
->goPrev()->getHelpText() );
43 else if (event
.action
== &i_cursorActions
->up
)
45 else if (event
.action
== &i_cursorActions
->down
)
50 case eWidgetEvent::execBegin
:
54 case eWidgetEvent::execDone
:
60 return eWindow::eventHandler(event
);
63 /* http://www.dvb.org/index.php?id=16 */
64 struct caids_t caids
[]=
65 {{0x0100, 0xFF00, "Seca/Mediaguard (Canal Plus)", 0},
66 {0x0200, 0xFF00, "CCETT", 0},
67 {0x0300, 0xFF00, "MSG MediaServices GmbH", 0},
68 {0x0400, 0xFF00, "Eurodec", 0},
69 {0x0500, 0xFF00, "Viaccess (France Telecom)", 0},
70 {0x0600, 0xFF00, "Irdeto", 0},
71 {0x0700, 0xFF00, "Jerrold/GI/Motorola", 0},
72 {0x0800, 0xFF00, "Matra Communication", 0},
73 {0x0900, 0xFF00, "Videoguard (News Datacom)", 0},
74 {0x0A00, 0xFF00, "Nokia", 0},
75 {0x0B00, 0xFF00, "Conax (Norwegian Telekom)", 0},
76 {0x0C00, 0xFF00, "NTL", 0},
77 {0x0D00, 0xFF00, "Cryptoworks (Philips)", 0},
78 {0x0E00, 0xFF00, "Power VU (Scientific Atlanta)", 0},
79 {0x0F00, 0xFF00, "Sony", 0},
80 {0x1000, 0xFF00, "Tandberg Television", 0},
81 {0x1100, 0xFF00, "Thomson", 0},
82 {0x1200, 0xFF00, "TV/Com", 0},
83 {0x1300, 0xFF00, "HPT - Croatian Post and Telecommunications", 0},
84 {0x1400, 0xFF00, "HRT - Croatian Radio and Television", 0},
85 {0x1500, 0xFF00, "IBM", 0},
86 {0x1600, 0xFF00, "Nera", 0},
87 {0x1702, 0xFFFF, "Betacrypt (BetaTechnik) (C)", 0},
88 {0x1708, 0xFFFF, "Betacrypt 2 (BetaTechnik)", 0},
89 {0x1722, 0xFFFF, "Betacrypt (BetaTechnik) (D)", 0},
90 {0x1762, 0xFFFF, "Betacrypt (BetaTechnik) (F)", 0},
91 {0x1700, 0xFF00, "Betacrypt (BetaTechnik)", 0},
92 {0x1800, 0xFF00, "Kudelski SA", 0},
93 {0x1900, 0xFF00, "Titan Information Systems", 0},
94 {0x2000, 0xFF00, "Telefonica Servicios Audiovisuales", 0},
95 {0x2100, 0xFF00, "STENTOR (France Telecom, CNES and DGA)", 0},
96 {0x2200, 0xFF00, "Scopus Network Technologies", 0},
97 {0x2300, 0xFF00, "BARCO AS", 0},
98 {0x2400, 0xFF00, "Starguide Digital Networks", 0},
99 {0x2500, 0xFF00, "Mentor Data Systems, Inc.", 0},
100 {0x2600, 0xFF00, "European Broadcasting Union", 0},
101 {0x4700, 0xFF00, "General Instrument", 0},
102 {0x4800, 0xFF00, "Telemann", 0},
103 {0x4900, 0xFF00, "Digital TV Industry Alliance of China", 0},
104 {0x4A00, 0xFFF0, "Tsinghua TongFang", 0},
105 {0x4A10, 0xFFF0, "Easycas", 0},
106 {0x4A20, 0xFFF0, "AlphaCrypt", 0},
107 {0x4A30, 0xFFF0, "DVN Holdings", 0},
108 {0x4A40, 0xFFF0, "Shanghai Advanced Digital Technology Co. Ltd.", 0},
109 {0x4A50, 0xFFF0, "Shenzhen Kingsky Company (China) Ltd.", 0},
110 {0x4A60, 0xFFF0, "@Sky", 0},
111 {0x4A70, 0xFFFF, "Dream Multimedia TV (DreamCrypt)", 0},
112 {0x4A71, 0xFFFF, "Dream Multimedia TV (High security, 4096bit RSA)", 0},
113 {0x4A72, 0xFFFF, "Dream Multimedia TV (Consumer, 48bit)", 0},
114 {0x4A73, 0xFFFF, "Dream Multimedia TV (non-DVB)", 0},
115 {0x4A74, 0xFFFF, "Dream Multimedia TV (export)", 0},
116 {0x4A70, 0xFFF0, "Dream Multimedia TV (other)", 0},
117 {0x4A80, 0xFFF0, "THALESCrypt", 0},
118 {0x4A90, 0xFFF0, "Runcom Technologies", 0},
119 {0x4AA0, 0xFFF0, "SIDSA", 0},
120 {0x4AB0, 0xFFF0, "Beijing Compunicate Technology Inc.", 0},
121 {0x4AC0, 0xFFF0, "Latens Systems Ltd", 0},
122 {0x4AD0, 0xFFFE, "XCrypt Inc.", 0},
123 {0x4AD2, 0xFFFE, "Beijing Digital Video Technology Co., Ltd.", 0},
124 {0x0000, 0x0000, "other/unknown", 0}};
126 unsigned int caids_cnt
= sizeof(caids
)/sizeof(struct caids_t
);
128 eString
eStreaminfo::getCAName(int casysid
, int always
)
130 for (unsigned int i
=0; i
< caids_cnt
; ++i
)
131 if ((casysid
& caids
[i
].mask
) == caids
[i
].value
)
133 if ((caids
[i
].flag
) && !always
)
137 return caids
[i
].description
;
139 for (int a
=0; a
<4; ++a
)
140 if (caids
[i
].mask
&(0xF<<((3-a
)*4)))
141 n
+=eString().sprintf("%x", (casysid
>>((3-a
)*4))&0xF);
145 n
+=caids
[i
].description
;
152 class siTags
: public eWidget
155 eString tagString
, descrString
;
157 eLabel
*tags
, *descr
;
159 siTags(const eService
*service
, eWidget
*parent
);
162 static eString
getDescription(eString tag
)
166 else if (tag
== "TIT2")
168 else if (tag
== "TPE1")
170 else if (tag
== "TCON")
172 else if (tag
== "TDRC")
174 else if (tag
== "TCOM")
175 return _("composer");
176 else if (tag
== "TRCK")
178 else if (tag
== "TLEN")
184 siTags::siTags(const eService
*service
, eWidget
*parent
)
185 : eWidget(parent
), ok(false)
190 tags
= new eLabel(this);
191 descr
= new eLabel(this);
192 for (std::map
<eString
,eString
>::const_iterator
i(service
->id3
->getID3Tags().begin());
193 i
!= service
->id3
->getID3Tags().end(); ++i
)
195 tagString
+=getDescription(i
->first
)+'\n';
196 if ( i
->first
.find("TLEN") != eString::npos
)
198 int len
= atoi( i
->second
.c_str() ) / 1000;
199 descrString
+=eString().sprintf("%d:%02d", len
/60, len
%60)+'\n';
202 descrString
+=i
->second
+'\n';
206 void siTags::willShow()
211 tags
->move(ePoint(0,0));
212 tags
->resize( eSize(width()/3, height()) );
213 descr
->move( ePoint(width()/3, 0) );
214 descr
->resize( eSize((width()/3)*2, height()) );
215 tags
->setText(tagString
);
216 descr
->setText(descrString
);
222 class siPID
: public eWidget
224 eLabel
*service_name
[2], *service_provider
[2], *apid
[2], *vpid
[2], *pcrpid
[2], *pmtpid
[2], *tpid
[2], *vform
[2], *tsid
[2], *onid
[2], *sid
[2];
225 void init_siPID(decoderParameters parms
, const eService
*service
, eWidget
*parent
);
227 siPID(decoderParameters parms
, const eService
*service
, eWidget
*parent
);
231 siPID::siPID(decoderParameters parms
, const eService
*cservice
, eWidget
*parent
)
234 init_siPID(parms
, cservice
, parent
);
239 eString
getVidFormat()
241 eString vformat
="n/a";
244 if (Decoder::current
.vpid
!=-1)
245 bitstream
=fopen("/proc/bus/bitstream", "rt");
249 int xres
=0, yres
=0, aspect
=0, framerate
=0;
250 while (fgets(buffer
, 100, bitstream
))
252 if (!strncmp(buffer
, "H_SIZE: ", 9))
254 if (!strncmp(buffer
, "V_SIZE: ", 9))
256 if (!strncmp(buffer
, "A_RATIO: ", 9))
257 aspect
=atoi(buffer
+9);
258 if (!strncmp(buffer
, "F_RATE: ", 8))
259 framerate
=atoi(buffer
+8);
262 vformat
.sprintf("%dx%d ", xres
, yres
);
266 vformat
+="square"; break;
268 vformat
+="4:3"; break;
270 vformat
+="16:9"; break;
272 vformat
+="20:9"; break;
274 vformat
+="Unk"; break;
279 vformat
+=" 23.976 fps"; break;
281 vformat
+=" 24 fps"; break;
283 vformat
+=" 25 fps"; break;
285 vformat
+=" 29.97 fps"; break;
287 vformat
+=" 30 fps"; break;
289 vformat
+=" 50 fps"; break;
291 vformat
+=" 59.94 fps"; break;
293 vformat
+=" 80 fps"; break;
295 vformat
+="Unk"; break;
303 void siPID::init_siPID(decoderParameters parms
, const eService
*cservice
, eWidget
*parent
)
305 eDVBServiceController
*sapi
=eDVB::getInstance()->getServiceAPI();
311 gFont fontfixed
=eSkin::getActive()->queryFont("global.fixed");
313 service_name
[0]=new eLabel(this);
314 service_name
[0]->setText("Name:");
315 service_name
[0]->move(ePoint(10, yOffs
));
316 service_name
[0]->resize(eSize(140, fs
+5));
318 service_name
[1]=new eLabel(this);
319 service_name
[1]->setText(cservice
?(cservice
->service_name
.c_str()):"--");
320 service_name
[1]->setFont(fontfixed
);
321 service_name
[1]->move(ePoint(240, yOffs
+2));
322 service_name
[1]->resize(eSize(260, fs
+5));
325 service_provider
[0]=new eLabel(this);
326 service_provider
[0]->setText("Provider:");
327 service_provider
[0]->move(ePoint(10, yOffs
));
328 service_provider
[0]->resize(eSize(140, fs
+5));
330 service_provider
[1]=new eLabel(this);
331 service_provider
[1]->setText((cservice
&& cservice
->dvb
)?cservice
->dvb
->service_provider
.c_str():"--");
332 service_provider
[1]->setFont(fontfixed
);
333 service_provider
[1]->move(ePoint(240, yOffs
+2));
334 service_provider
[1]->resize(eSize(260, fs
+5));
337 vpid
[0]=new eLabel(this);
338 vpid
[0]->setText("Video PID:");
339 vpid
[0]->move(ePoint(10, yOffs
));
340 vpid
[0]->resize(eSize(140, fs
+5));
342 vpid
[1]=new eLabel(this);
343 vpid
[1]->setFont(fontfixed
);
344 vpid
[1]->setText((Decoder::current
.vpid
==-1)?eString(_("none")):eString().sprintf("%04xh (%dd)", Decoder::current
.vpid
, Decoder::current
.vpid
));
345 vpid
[1]->move(ePoint(240, yOffs
+2));
346 vpid
[1]->resize(eSize(260, fs
+5));
349 apid
[0]=new eLabel(this);
350 apid
[0]->setText("Audio PID:");
351 apid
[0]->move(ePoint(10, yOffs
));
352 apid
[0]->resize(eSize(140, fs
+5));
354 apid
[1]=new eLabel(this);
355 apid
[1]->setText((Decoder::current
.apid
==-1)?eString(_("none")):eString().sprintf("%04xh (%dd)", Decoder::current
.apid
, Decoder::current
.apid
));
356 apid
[1]->move(ePoint(240, yOffs
+2));
357 apid
[1]->resize(eSize(260, fs
+5));
358 apid
[1]->setFont(fontfixed
);
361 pcrpid
[0]=new eLabel(this);
362 pcrpid
[0]->setText("PCR PID:");
363 pcrpid
[0]->move(ePoint(10, yOffs
));
364 pcrpid
[0]->resize(eSize(140, fs
+5));
366 pcrpid
[1]=new eLabel(this);
367 pcrpid
[1]->setText((Decoder::current
.pcrpid
==-1)?eString(_("none")):eString().sprintf("%04xh (%dd)", Decoder::current
.pcrpid
, Decoder::current
.pcrpid
));
368 pcrpid
[1]->move(ePoint(240, yOffs
+2));
369 pcrpid
[1]->resize(eSize(260, fs
+5));
370 pcrpid
[1]->setFont(fontfixed
);
373 pmtpid
[0]=new eLabel(this);
374 pmtpid
[0]->setText("PMT PID:");
375 pmtpid
[0]->move(ePoint(10, yOffs
));
376 pmtpid
[0]->resize(eSize(140, fs
+5));
378 pmtpid
[1]=new eLabel(this);
379 pmtpid
[1]->setText((Decoder::current
.pmtpid
==-1)?eString(_("none")):eString().sprintf("%04xh (%dd)", Decoder::current
.pmtpid
, Decoder::current
.pmtpid
));
380 pmtpid
[1]->move(ePoint(240, yOffs
+2));
381 pmtpid
[1]->resize(eSize(260, fs
+5));
382 pmtpid
[1]->setFont(fontfixed
);
385 tpid
[0]=new eLabel(this);
386 tpid
[0]->setText("Teletext PID:");
387 tpid
[0]->move(ePoint(10, yOffs
));
388 tpid
[0]->resize(eSize(140, fs
+5));
390 tpid
[1]=new eLabel(this);
391 tpid
[1]->setText((Decoder::current
.tpid
==-1)?eString(_("none")):eString().sprintf("%04xh (%dd)", Decoder::current
.tpid
, Decoder::current
.tpid
));
392 tpid
[1]->move(ePoint(240, yOffs
+2));
393 tpid
[1]->resize(eSize(260, fs
+5));
394 tpid
[1]->setFont(fontfixed
);
397 vform
[0]=new eLabel(this);
398 vform
[0]->setText(_("Video format:"));
399 vform
[0]->move(ePoint(10, yOffs
));
400 vform
[0]->resize(eSize(150, fs
+5));
402 vform
[1]=new eLabel(this);
403 vform
[1]->setText(getVidFormat());
404 vform
[1]->move(ePoint(240, yOffs
));
405 vform
[1]->resize(eSize(260, fs
));
406 vform
[1]->setFont(fontfixed
);
409 tsid
[0]=new eLabel(this);
410 tsid
[0]->setText("Transport Stream ID:");
411 tsid
[0]->move(ePoint(10, yOffs
));
412 tsid
[0]->resize(eSize(230, fs
+5));
414 tsid
[1]=new eLabel(this);
415 tsid
[1]->setText(eString().sprintf("%04xh", sapi
->service
.getTransportStreamID().get()));
416 tsid
[1]->move(ePoint(240, yOffs
));
417 tsid
[1]->resize(eSize(130, fs
+5));
418 tsid
[1]->setFont(fontfixed
);
421 onid
[0]=new eLabel(this);
422 onid
[0]->setText("Original Network ID:");
423 onid
[0]->move(ePoint(10, yOffs
));
424 onid
[0]->resize(eSize(210, fs
+5));
426 onid
[1]=new eLabel(this);
427 onid
[1]->setText(eString().sprintf("%04xh", sapi
->service
.getOriginalNetworkID().get()));
428 onid
[1]->move(ePoint(240, yOffs
));
429 onid
[1]->resize(eSize(130, fs
+5));
430 onid
[1]->setFont(fontfixed
);
433 sid
[0]=new eLabel(this);
434 sid
[0]->setText("Service ID:");
435 sid
[0]->move(ePoint(10, yOffs
));
436 sid
[0]->resize(eSize(185, fs
+5));
438 sid
[1]=new eLabel(this);
439 sid
[1]->setText(eString().sprintf("%04xh", sapi
->service
.getServiceID().get()));
440 sid
[1]->move(ePoint(240, yOffs
));
441 sid
[1]->resize(eSize(130, fs
+5));
442 sid
[1]->setFont(fontfixed
);
445 eLabel
*l
=new eLabel(this);
446 l
->setText("Namespace:");
447 l
->move(ePoint(10, yOffs
));
448 l
->resize(eSize(185, fs
+5));
451 l
->setText(eString().sprintf("%04xh", sapi
->service
.getDVBNamespace().get()));
452 l
->move(ePoint(240, yOffs
));
453 l
->resize(eSize(130, fs
+5));
454 l
->setFont(fontfixed
);
457 void siPID::redrawWidget()
461 class siCA
: public eWidget
463 eLabel
*availca
[2], *usedca
[2];
465 siCA(eWidget
*parent
);
468 siCA::siCA(eWidget
*parent
): eWidget(parent
)
470 eDVBServiceController
*sapi
=eDVB::getInstance()->getServiceAPI();
475 int fs
=eSkin::getActive()->queryValue("fontsize", 20);
476 availca
[0]=new eLabel(this);
477 availca
[0]->setText(_("supported coding systems:"));
478 availca
[0]->move(ePoint(10, 0));
479 availca
[0]->resize(eSize(420, fs
+5));
482 eString availcas
=_("none");
487 singleLock
s(eDVBServiceController::availCALock
);
488 std::set
<int>& availCA
= sapi
->availableCASystems
;
489 for (std::set
<int>::iterator
i(availCA
.begin()); i
!= availCA
.end(); ++i
)
493 eString caname
=eStreaminfo::getInstance()->getCAName(*i
, 0);
496 availcas
+= caname
+ "\n";
509 availca
[1]=new eLabel(this);
510 availca
[1]->setText(availcas
);
511 availca
[1]->move(ePoint(10, fs
*2));
512 availca
[1]->resize(eSize(420, numsys
*fs
+fs
));
514 int y
=numsys
*fs
+fs
*2+20;
516 usedca
[0]=new eLabel(this);
517 usedca
[0]->setText(_("Systems used in service:"));
518 usedca
[0]->move(ePoint(10, y
));
519 usedca
[0]->resize(eSize(420, fs
));
521 eString usedcas
=_("none");
525 std::set
<int>& calist
= sapi
->usedCASystems
;
527 for (std::set
<int>::iterator
i(calist
.begin()); i
!= calist
.end(); ++i
)
536 eString caname
=eStreaminfo::getInstance()->getCAName(*i
, 1);
537 usedcas
+=eString().sprintf("%04xh: ", *i
) + caname
+ "\n";
543 usedca
[1]=new eLabel(this);
544 usedca
[1]->setText(usedcas
);
545 usedca
[1]->move(ePoint(10, y
+50));
546 usedca
[1]->resize(eSize(420, numsys
*fs
+fs
));
549 eStreaminfo::eStreaminfo(int mode
, const eServiceReference
&ref
, decoderParameters
*parms
): eWindow(1), statusbar(this)
554 setText(mode
?_("Record mode - read manual"):_("Streaminfo"));
555 cmove(ePoint(140, 100));
556 cresize(eSize(470, 420));
557 eSize
s(clientrect
.size());
558 s
.setHeight( s
.height() - 40 );
562 eService
*service
=eServiceInterface::getInstance()->addRef(ref
);
566 if (ref
.type
== eServiceReference::idDVB
)
568 w
=new siPID(Decoder::current
, service
, this);
569 w
->move(ePoint(0, 0));
574 else if (service
&& service
->id3
)
576 w
=new siTags(service
, this);
577 w
->move(ePoint(0, 0));
585 w
->setText(_("no information is available"));
586 ((eLabel
*)w
)->setFlags(eLabel::flagVCenter
);
587 ((eLabel
*)w
)->setAlign(eTextPara::dirCenter
);
588 w
->move(ePoint(0, 0));
595 if ((ref
.type
== eServiceReference::idDVB
) && (!ref
.path
))
598 w
->move(ePoint(0, 0));
604 w
->move(ePoint(0, 0));
608 eTransponderWidget
*t
= 0;
609 switch ( eSystemInfo::getInstance()->getFEType() )
611 case eSystemInfo::feSatellite
:
612 t
= new eTransponderWidget(w
, 0, eTransponderWidget::deliverySatellite
);
614 case eSystemInfo::feCable
:
615 t
= new eTransponderWidget(w
, 0, eTransponderWidget::deliveryCable
);
617 case eSystemInfo::feTerrestrial
:
618 t
= new eTransponderWidget(w
, 0, eTransponderWidget::deliveryTerrestrial
);
625 t
->move(ePoint(0, 0));
626 t
->resize(eSize(clientrect
.width(), 200));
628 eDVBServiceController
*sapi
=eDVB::getInstance()->getServiceAPI();
630 t
->setTransponder(sapi
->transponder
);
633 eWidget
*fe
=new eFEStatusWidget(w
, eFrontend::getInstance());
634 fe
->move(ePoint(0, 200));
635 fe
->resize(eSize(clientrect
.width(), 100));
640 for ( int i
= 0; i
< 2; i
++ )
643 w
->setText(_("no information is available"));
644 ((eLabel
*)w
)->setFlags(eLabel::flagVCenter
);
645 ((eLabel
*)w
)->setAlign(eTextPara::dirCenter
);
646 w
->move(ePoint(0, 0));
655 statusbar
.loadDeco();
656 statusbar
.move( ePoint(0, clientrect
.height()-40) );
657 statusbar
.resize( eSize(clientrect
.width(), 40) );
658 eRect rect
= statusbar
.getClientRect();
660 lb
= new eListBox
<eListBoxEntryMenu
>( &statusbar
);
661 lb
->move( ePoint(rect
.width()-50, 2) );
662 lb
->resize( eSize(45, rect
.height()-5) );
663 lb
->setFlags( eListBoxBase::flagNoPageMovement
| eListBoxBase::flagNoUpDownMovement
);
664 new eListBoxEntryMenu( lb
, "1/3", _("Service information (right)"), eTextPara::dirCenter
);
665 new eListBoxEntryMenu( lb
, "2/3", _("Scrambled system information (left, right)"), eTextPara::dirCenter
);
666 new eListBoxEntryMenu( lb
, "3/3", _("Transponder information (left)"), eTextPara::dirCenter
);
667 descr
= new eLabel( &statusbar
);
668 descr
->move( ePoint(0,0) );
669 descr
->resize( eSize(rect
.width() - 50, rect
.height()) );
670 descr
->setText( lb
->getCurrent()->getHelpText() );
671 descr
->setFlags( eLabel::flagVCenter
);
674 eServiceInterface::getInstance()->removeRef(ref
);
677 eStreaminfo::~eStreaminfo()