decoder.cpp/servicedvb.cpp: fix radio stillpicture displaying
[enigma2.git] / lib / dvb / decoder.cpp
index 6f0ead653c720cddd63b7d29b0d67ccfc9b33a0d..ebe3ce24fe90d75f89c42eb60a5458b59e232a31 100644 (file)
@@ -855,6 +855,9 @@ int eTSMPEGDecoder::setState()
        if ((nott && m_text) || (!m_text && !nott))
                m_changed |= changeText | changeState;
 
+       const char *decoder_states[] = {"stop", "pause", "play", "decoderfastforward", "trickmode", "slowmotion"};
+       eDebug("decoder state: %s, vpid=%d, apid=%d", decoder_states[m_state], m_vpid, m_apid);
+
        bool changed = !!m_changed;
 #if HAVE_DVB_API_VERSION < 3
        bool checkAVSync = m_changed & (changeAudio|changeVideo|changePCR);
@@ -1071,7 +1074,9 @@ RESULT eTSMPEGDecoder::setAC3Delay(int delay)
 }
 
 eTSMPEGDecoder::eTSMPEGDecoder(eDVBDemux *demux, int decoder)
-       :m_demux(demux), m_changed(0), m_decoder(decoder), m_video_clip_fd(-1), m_showSinglePicTimer(eTimer::create(eApp))
+       : m_demux(demux), 
+               m_vpid(-1), m_vtype(-1), m_apid(-1), m_atype(-1), m_pcrpid(-1), m_textpid(-1),
+               m_changed(0), m_decoder(decoder), m_video_clip_fd(-1), m_showSinglePicTimer(eTimer::create(eApp))
 {
        demux->connectEvent(slot(*this, &eTSMPEGDecoder::demux_event), m_demux_event_conn);
        CONNECT(m_showSinglePicTimer->timeout, eTSMPEGDecoder::finishShowSinglePic);
@@ -1285,15 +1290,18 @@ RESULT eTSMPEGDecoder::showSinglePic(const char *filename)
                                unsigned char seq_end[] = { 0x00, 0x00, 0x01, 0xB7 };
                                unsigned char iframe[s.st_size];
                                unsigned char stuffing[8192];
+                               int streamtype = VIDEO_STREAMTYPE_MPEG2;
                                memset(stuffing, 0, 8192);
                                read(f, iframe, s.st_size);
                                if (ioctl(m_video_clip_fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY) < 0)
                                        eDebug("VIDEO_SELECT_SOURCE MEMORY failed (%m)");
+                               if (ioctl(m_video_clip_fd, VIDEO_SET_STREAMTYPE, streamtype) < 0)
+                                       eDebug("VIDEO_SET_STREAMTYPE failed(%m)");
                                if (ioctl(m_video_clip_fd, VIDEO_PLAY) < 0)
                                        eDebug("VIDEO_PLAY failed (%m)");
-                               if (::ioctl(m_video_clip_fd, VIDEO_CONTINUE) < 0)
+                               if (ioctl(m_video_clip_fd, VIDEO_CONTINUE) < 0)
                                        eDebug("video: VIDEO_CONTINUE: %m");
-                               if (::ioctl(m_video_clip_fd, VIDEO_CLEAR_BUFFER) < 0)
+                               if (ioctl(m_video_clip_fd, VIDEO_CLEAR_BUFFER) < 0)
                                        eDebug("video: VIDEO_CLEAR_BUFFER: %m");
                                while(pos <= (s.st_size-4) && !(seq_end_avail = (!iframe[pos] && !iframe[pos+1] && iframe[pos+2] == 1 && iframe[pos+3] == 0xB7)))
                                        ++pos;