add iSubserviceList interface to iRecordableService
[enigma2.git] / lib / dvb / decoder.cpp
index edefd7644871b461725e03eaa9cc84bf2272ff8e..bc6e06033885fa24fd121ddfb922471ebc7ecfa4 100644 (file)
@@ -203,8 +203,7 @@ int eDVBAudio::startPid(int pid, int type)
                eDebug("failed (%m)");
        else
                eDebug("ok");
-       freeze();
-
+       freeze();  // why freeze here?!? this is a problem when only a pid change is requested... because of the unfreeze logic in Decoder::setState
        eDebugNoNewLine("AUDIO_PLAY - ");
        if (::ioctl(m_fd, AUDIO_PLAY) < 0)
                eDebug("failed (%m)");
@@ -285,7 +284,7 @@ int eDVBAudio::getPTS(pts_t &now)
 
 eDVBAudio::~eDVBAudio()
 {
-       unfreeze();
+       unfreeze();  // why unfreeze here... but not unfreeze video in ~eDVBVideo ?!?
        if (m_fd >= 0)
                ::close(m_fd);
        if (m_fd_demux >= 0)
@@ -448,7 +447,7 @@ int eDVBVideo::startPid(int pid, int type)
                return -errno;
        }
        eDebug("ok");
-       freeze();
+       freeze();  // why freeze here?!? this is a problem when only a pid change is requested... because of the unfreeze logic in Decoder::setState
        eDebugNoNewLine("VIDEO_PLAY - ");
        if (::ioctl(m_fd, VIDEO_PLAY) < 0)
                eDebug("failed (%m)");
@@ -1093,7 +1092,7 @@ eTSMPEGDecoder::~eTSMPEGDecoder()
 
 RESULT eTSMPEGDecoder::setVideoPID(int vpid, int type)
 {
-       if (m_vpid != vpid)
+       if ((m_vpid != vpid) || (m_vtype != type))
        {
                m_changed |= changeVideo;
                m_vpid = vpid;
@@ -1170,9 +1169,17 @@ RESULT eTSMPEGDecoder::set()
 RESULT eTSMPEGDecoder::play()
 {
        if (m_state == statePlay)
-               return 0;
-       m_state = statePlay;
-       m_changed |= changeState;
+       {
+               if (!m_changed)
+                       return 0;
+       }
+//     else  
+/* commented out because the changeState is needed to unfreeze decoders in decoder::setState... needed by normal pmt changes
+tmbinc please recheck this! */
+       {
+               m_state = statePlay;
+               m_changed |= changeState;
+       }
        return setState();
 }
 
@@ -1290,15 +1297,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;