+
+RESULT eTSMPEGDecoder::setTrickmode(int what)
+{
+ m_is_trickmode = what;
+ setState();
+ return 0;
+}
+
+RESULT eTSMPEGDecoder::getPTS(int what, pts_t &pts)
+{
+ if (what == 0) /* auto */
+ what = m_video ? 1 : 2;
+
+ if (what == 1) /* video */
+ {
+ if (m_video)
+ return m_video->getPTS(pts);
+ else
+ return -1;
+ }
+
+ if (what == 2) /* audio */
+ {
+ if (m_audio)
+ return m_audio->getPTS(pts);
+ else
+ return -1;
+ }
+
+ return -1;
+}
+
+RESULT eTSMPEGDecoder::setRadioPic(const std::string &filename)
+{
+ m_radio_pic = filename;
+ return 0;
+}
+
+RESULT eTSMPEGDecoder::showSinglePic(const char *filename)
+{
+ if (m_decoder == 0)
+ {
+ FILE *f = fopen(filename, "r");
+ if (f)
+ {
+ int vfd = open("/dev/dvb/adapter0/video0", O_RDWR);
+ if (vfd > 0)
+ {
+ fseek(f, 0, SEEK_END);
+ int length = ftell(f);
+ unsigned char *buffer = new unsigned char[length*2+9];
+ if (ioctl(vfd, VIDEO_FAST_FORWARD, 1) < 0)
+ eDebug("VIDEO_FAST_FORWARD failed (%m)");
+ if (ioctl(vfd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY) < 0)
+ eDebug("VIDEO_SELECT_SOURCE MEMORY failed (%m)");
+ if (ioctl(vfd, VIDEO_PLAY) < 0)
+ eDebug("VIDEO_PLAY failed (%m)");
+ if (::ioctl(vfd, VIDEO_CONTINUE) < 0)
+ eDebug("video: VIDEO_CONTINUE: %m");
+ int cnt=0;
+ int pos=0;
+ while(cnt<2)
+ {
+ int rd;
+ fseek(f, 0, SEEK_SET);
+ if (!cnt)
+ {
+ buffer[pos++]=0;
+ buffer[pos++]=0;
+ buffer[pos++]=1;
+ buffer[pos++]=0xE0;
+ buffer[pos++]=(length*2)>>8;
+ buffer[pos++]=(length*2)&0xFF;
+ buffer[pos++]=0x80;
+ buffer[pos++]=0;
+ buffer[pos++]=0;
+ }
+ while(1)
+ {
+ rd = fread(buffer+pos, 1, length, f);
+ if (rd > 0)
+ pos += rd;
+ else
+ break;
+ }
+ ++cnt;
+ }
+ write(vfd, buffer, pos);
+ usleep(75000); // i dont like this.. but i dont have a better solution :(
+ if (ioctl(vfd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX) < 0)
+ eDebug("VIDEO_SELECT_SOURCE DEMUX failed (%m)");
+ if (ioctl(vfd, VIDEO_FAST_FORWARD, 0) < 0)
+ eDebug("VIDEO_FAST_FORWARD failed (%m)");
+ close(vfd);
+ delete [] buffer;
+ }
+ fclose(f);
+ }
+ else
+ {
+ eDebug("couldnt open %s", filename);
+ return -1;
+ }
+ }
+ else
+ {
+ eDebug("only show single pics on first decoder");
+ return -1;
+ }
+ return 0;
+}
+
+RESULT eTSMPEGDecoder::connectVideoEvent(const Slot1<void, struct videoEvent> &event, ePtr<eConnection> &conn)
+{
+ conn = new eConnection(this, m_video_event.connect(event));
+ return 0;
+}
+
+void eTSMPEGDecoder::video_event(struct videoEvent event)
+{
+ /* emit */ m_video_event(event);
+}