X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/033a2333874297c1c388ecf4532de2bc2b11fb30..740ae9b4a03c13901e4f4ffc008e4c0cfd63d896:/lib/dvb/decoder.cpp diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp index 26172e0c..7bdb3062 100644 --- a/lib/dvb/decoder.cpp +++ b/lib/dvb/decoder.cpp @@ -125,7 +125,7 @@ void eDVBAudio::freeze() if (::ioctl(m_fd, AUDIO_PAUSE) < 0) eDebug("video: AUDIO_PAUSE: %m"); } - + void eDVBAudio::unfreeze() { if (::ioctl(m_fd, AUDIO_CONTINUE) < 0) @@ -191,12 +191,13 @@ int eDVBVideo::startPid(int pid) void eDVBVideo::stop() { - if (::ioctl(m_fd, VIDEO_STOP, 1) < 0) - eWarning("video: VIDEO_STOP: %m"); #if HAVE_DVB_API_VERSION > 2 if (::ioctl(m_fd_demux, DMX_STOP) < 0) eWarning("video: DMX_STOP: %m"); #endif + eDebug("VIDEO_STOP"); + if (::ioctl(m_fd, VIDEO_STOP, 1) < 0) + eWarning("video: VIDEO_STOP: %m"); } #if HAVE_DVB_API_VERSION < 3 @@ -225,8 +226,24 @@ void eDVBVideo::unfreeze() eDebug("video: VIDEO_CONTINUE: %m"); } +int eDVBVideo::setSlowMotion(int repeat) +{ + m_is_slow_motion = repeat; + return ::ioctl(m_fd, VIDEO_SLOWMOTION, repeat); +} + +int eDVBVideo::setFastForward(int skip) +{ + m_is_fast_forward = skip; + return ::ioctl(m_fd, VIDEO_FAST_FORWARD, skip); +} + eDVBVideo::~eDVBVideo() { + if (m_is_slow_motion) + setSlowMotion(0); + if (m_is_fast_forward) + setFastForward(0); if (m_fd >= 0) ::close(m_fd); if (m_fd_demux >= 0) @@ -289,6 +306,12 @@ DEFINE_REF(eTSMPEGDecoder); int eTSMPEGDecoder::setState() { int res = 0; + + int noaudio = m_is_sm || m_is_ff || m_is_trickmode; + + if ((noaudio && m_audio) || (!m_audio && !noaudio)) + m_changed |= changeAudio; + #if HAVE_DVB_API_VERSION < 3 if (m_changed & changeAudio && m_audio) m_audio->stopPid(); @@ -340,29 +363,18 @@ int eTSMPEGDecoder::setState() m_changed &= ~changeAudio; } #else - if (m_changed & changePCR) - { - if (m_pcr) - m_pcr->stop(); - m_pcr = 0; - if ((m_pcrpid >= 0) && (m_pcrpid < 0x1FFF)) - { - m_pcr = new eDVBPCR(m_demux); - if (m_pcr->startPid(m_pcrpid)) - { - eWarning("pcr: startpid failed!"); - res = -1; - } - } - m_changed &= ~changePCR; - } if (m_changed & changeVideo) { + eDebug("VIDEO CHANGED (to %04x)", m_vpid); if (m_video) + { + eDebug("STOP"); m_video->stop(); + } m_video = 0; if ((m_vpid >= 0) && (m_vpid < 0x1FFF)) { + eDebug("new video"); m_video = new eDVBVideo(m_demux, 0); if (m_video->startPid(m_vpid)) { @@ -372,12 +384,28 @@ int eTSMPEGDecoder::setState() } m_changed &= ~changeVideo; } + if (m_changed & changePCR) + { + if (m_pcr) + m_pcr->stop(); + m_pcr = 0; + if ((m_pcrpid >= 0) && (m_pcrpid < 0x1FFF)) + { + m_pcr = new eDVBPCR(m_demux); + if (m_pcr->startPid(m_pcrpid)) + { + eWarning("pcr: startpid failed!"); + res = -1; + } + } + m_changed &= ~changePCR; + } if (m_changed & changeAudio) { if (m_audio) m_audio->stop(); m_audio = 0; - if ((m_apid >= 0) && (m_apid < 0x1FFF)) + if ((m_apid >= 0) && (m_apid < 0x1FFF) && !noaudio) { m_audio = new eDVBAudio(m_demux, 0); if (m_audio->startPid(m_apid, m_atype)) @@ -395,6 +423,7 @@ int eTSMPEGDecoder::setState() eTSMPEGDecoder::eTSMPEGDecoder(eDVBDemux *demux, int decoder): m_demux(demux), m_changed(0) { demux->connectEvent(slot(*this, &eTSMPEGDecoder::demux_event), m_demux_event); + m_is_ff = m_is_sm = m_is_trickmode = 0; } eTSMPEGDecoder::~eTSMPEGDecoder() @@ -477,9 +506,28 @@ RESULT eTSMPEGDecoder::setPictureSkipMode(int what) return -1; } +RESULT eTSMPEGDecoder::setFastForward(int frames_to_skip) +{ + m_is_ff = frames_to_skip != 0; + + setState(); + + if (m_video) + return m_video->setFastForward(frames_to_skip); + else + return -1; +} + RESULT eTSMPEGDecoder::setSlowMotion(int repeat) { - return -1; + m_is_sm = repeat != 0; + + setState(); + + if (m_video) + return m_video->setSlowMotion(repeat); + else + return -1; } RESULT eTSMPEGDecoder::setZoom(int what) @@ -507,3 +555,10 @@ void eTSMPEGDecoder::demux_event(int event) break; } } + +RESULT eTSMPEGDecoder::setTrickmode(int what) +{ + m_is_trickmode = what; + setState(); + return 0; +}