diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-06-25 22:14:53 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-06-25 22:14:53 +0000 |
| commit | 03379b6e86edfcce851da2d11c3189d1b7843afb (patch) | |
| tree | c08865b11559dca984c648e661cbe070f71f500a /lib | |
| parent | 687353c5fefbeea8486cbb28dedf52a53dc65e9b (diff) | |
| download | enigma2-03379b6e86edfcce851da2d11c3189d1b7843afb.tar.gz enigma2-03379b6e86edfcce851da2d11c3189d1b7843afb.zip | |
add possibility to show iframes (not bugfree yet)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dvb/decoder.cpp | 84 | ||||
| -rw-r--r-- | lib/dvb/decoder.h | 4 | ||||
| -rw-r--r-- | lib/dvb/idvb.h | 4 | ||||
| -rw-r--r-- | lib/service/servicedvb.cpp | 9 |
4 files changed, 98 insertions, 3 deletions
diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp index a05c837c..8e172c8b 100644 --- a/lib/dvb/decoder.cpp +++ b/lib/dvb/decoder.cpp @@ -405,7 +405,8 @@ int eTSMPEGDecoder::setState() if ((nott && m_text) || (!m_text && !nott)) m_changed |= changeText; - + + bool changed = !!m_changed; #if HAVE_DVB_API_VERSION < 3 if (m_changed & changeAudio && m_audio) m_audio->stopPid(); @@ -477,7 +478,7 @@ int eTSMPEGDecoder::setState() { eDebug("VIDEO CHANGED (to %04x)", m_vpid); if (m_video) - { + { eDebug("STOP"); m_video->stop(); } @@ -527,6 +528,9 @@ int eTSMPEGDecoder::setState() m_changed &= ~changeText; } #endif + if (changed && !m_video && m_audio && m_radio_pic.length()) + showSinglePic(m_radio_pic.c_str()); + return res; } @@ -762,3 +766,79 @@ RESULT eTSMPEGDecoder::getPTS(int what, pts_t &pts) return -1; } + +RESULT eTSMPEGDecoder::setRadioPic(const std::string &filename) +{ + m_radio_pic = filename; +} + +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) + { + int length = fseek(f, 0, SEEK_END); + unsigned char *buffer = new unsigned char[length*3+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)"); + int cnt=0; + int pos=0; + while(cnt<3) + { + int rd; + fseek(f, 0, SEEK_SET); + while(1) + { + if (!cnt) + { + buffer[pos++]=0; + buffer[pos++]=0; + buffer[pos++]=1; + buffer[pos++]=0xE0; + buffer[pos++]=(length*3)>>8; + buffer[pos++]=(length*3)&0xFF; + buffer[pos++]=0x80; + buffer[pos++]=0; + buffer[pos++]=0; + } + rd = fread(buffer+pos, 1, length, f); + if (rd > 0) + pos += rd; + else + break; + } + ++cnt; + } + write(vfd, buffer, pos); + usleep(50000); + 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; +} diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h index b50a605b..8e8f65ad 100644 --- a/lib/dvb/decoder.h +++ b/lib/dvb/decoder.h @@ -86,6 +86,7 @@ class eTSMPEGDecoder: public Object, public iTSMPEGDecoder static int m_ac3_delay; static int m_audio_channel; DECLARE_REF(eTSMPEGDecoder); + std::string m_radio_pic; private: ePtr<eDVBDemux> m_demux; ePtr<eDVBAudio> m_audio; @@ -131,7 +132,8 @@ public: RESULT setZoom(int what); RESULT flush(); RESULT setTrickmode(int what); - + RESULT showSinglePic(const char *filename); + RESULT setRadioPic(const std::string &filename); /* what 0=auto, 1=video, 2=audio. */ RESULT getPTS(int what, pts_t &pts); }; diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 69342717..2c80a9b8 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -641,6 +641,10 @@ public: virtual RESULT setTrickmode(int what) = 0; virtual RESULT getPTS(int what, pts_t &pts) = 0; + + virtual RESULT showSinglePic(const char *filename) = 0; + + virtual RESULT setRadioPic(const std::string &filename) = 0; }; #endif //SWIG diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 8f58cdee..b7acd1f4 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1734,6 +1734,15 @@ void eDVBServicePlay::updateDecoder() m_decoder->start(); + if (vpid > 0 && vpid < 0x2000) + ; + else + { + std::string radio_pic; + if (!ePythonConfigQuery::getConfigValue("config.misc.radiopic", radio_pic)) + m_decoder->setRadioPic(radio_pic); + } + m_decoder->setAudioChannel(achannel); // how we can do this better? |
