fix parsing of external .srt subtitle files
[enigma2.git] / lib / dvb / decoder.cpp
index 72c6e392e020e30c9eec198ad89d322a57c52860..57f48ee3a7e6cb1ad382b4f03df97f5ab32d4f1a 100644 (file)
@@ -563,6 +563,20 @@ void eDVBVideo::video_event(int)
                        event.width = evt.u.size.w;
                        /* emit */ m_event(event);
                }
+               else if (evt.type == VIDEO_EVENT_FRAME_RATE_CHANGED)
+               {
+                       struct iTSMPEGDecoder::videoEvent event;
+                       event.type = iTSMPEGDecoder::videoEvent::eventFrameRateChanged;
+                       event.framerate = evt.u.frame_rate;
+                       /* emit */ m_event(event);
+               }
+               else if (evt.type == 16 /*VIDEO_EVENT_PROGRESSIVE_CHANGED*/)
+               {
+                       struct iTSMPEGDecoder::videoEvent event;
+                       event.type = iTSMPEGDecoder::videoEvent::eventProgressiveChanged;
+                       event.progressive = evt.u.frame_rate;
+                       /* emit */ m_event(event);
+               }
                else
                        eDebug("unhandled DVBAPI Video Event %d", evt.type);
        }
@@ -1145,7 +1159,7 @@ RESULT eTSMPEGDecoder::showSinglePic(const char *filename)
        {
                eDebug("showSinglePic %s", filename);
                int f = open(filename, O_RDONLY);
-               if (f)
+               if (f >= 0)
                {
                        struct stat s;
                        fstat(f, &s);
@@ -1173,6 +1187,8 @@ RESULT eTSMPEGDecoder::showSinglePic(const char *filename)
                                        ++pos;
                                if ((iframe[3] >> 4) != 0xE) // no pes header
                                        write(m_video_clip_fd, pes_header, sizeof(pes_header));
+                               else
+                                       iframe[4] = iframe[5] = 0x00;
                                write(m_video_clip_fd, iframe, s.st_size);
                                if (!seq_end_avail)
                                        write(m_video_clip_fd, seq_end, sizeof(seq_end));