aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-12-08 00:35:27 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-12-08 00:35:27 +0000
commitcd038ce28d53719a27e7009365dd74fec19357df (patch)
tree72e33e60ba643f31897dd154daa3d3fabd0ba295 /lib
parentc72e1837b5fd6f2d0e222d7140008326fe89a58e (diff)
downloadenigma2-cd038ce28d53719a27e7009365dd74fec19357df.tar.gz
enigma2-cd038ce28d53719a27e7009365dd74fec19357df.zip
add slowmotion / fast forward
Diffstat (limited to 'lib')
-rw-r--r--lib/dvb/decoder.cpp43
-rw-r--r--lib/dvb/decoder.h5
-rw-r--r--lib/dvb/idvb.h3
-rw-r--r--lib/service/iservice.h4
-rw-r--r--lib/service/servicedvb.cpp16
-rw-r--r--lib/service/servicedvb.h4
-rw-r--r--lib/service/servicemp3.cpp10
-rw-r--r--lib/service/servicemp3.h3
8 files changed, 83 insertions, 5 deletions
diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp
index 835f434e..6794a056 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)
@@ -342,11 +359,16 @@ int eTSMPEGDecoder::setState()
#else
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))
{
@@ -395,6 +417,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);
+ eDebug("eTSMPEGDecoder::eTSMPEGDecoder %p", this);
}
eTSMPEGDecoder::~eTSMPEGDecoder()
@@ -402,6 +425,7 @@ eTSMPEGDecoder::~eTSMPEGDecoder()
m_vpid = m_apid = m_pcrpid = pidNone;
m_changed = -1;
setState();
+ eDebug("~eTSMPEGDecoder %p", this);
}
RESULT eTSMPEGDecoder::setVideoPID(int vpid)
@@ -477,9 +501,20 @@ RESULT eTSMPEGDecoder::setPictureSkipMode(int what)
return -1;
}
+RESULT eTSMPEGDecoder::setFastForward(int frames_to_skip)
+{
+ if (m_video)
+ return m_video->setFastForward(frames_to_skip);
+ else
+ return -1;
+}
+
RESULT eTSMPEGDecoder::setSlowMotion(int repeat)
{
- return -1;
+ if (m_video)
+ return m_video->setSlowMotion(repeat);
+ else
+ return -1;
}
RESULT eTSMPEGDecoder::setZoom(int what)
diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h
index 7bd16fd1..d1f040ec 100644
--- a/lib/dvb/decoder.h
+++ b/lib/dvb/decoder.h
@@ -31,6 +31,8 @@ DECLARE_REF(eDVBVideo);
private:
ePtr<eDVBDemux> m_demux;
int m_fd, m_fd_demux;
+
+ int m_is_slow_motion, m_is_fast_forward;
public:
eDVBVideo(eDVBDemux *demux, int dev);
int startPid(int pid);
@@ -41,6 +43,8 @@ public:
#endif
void flush();
void freeze();
+ int setSlowMotion(int repeat);
+ int setFastForward(int skip);
void unfreeze();
virtual ~eDVBVideo();
};
@@ -91,6 +95,7 @@ public:
RESULT unfreeze();
RESULT setSinglePictureMode(int when);
RESULT setPictureSkipMode(int what);
+ RESULT setFastForward(int frames_to_skip);
RESULT setSlowMotion(int repeat);
RESULT setZoom(int what);
RESULT flush();
diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h
index 742a3a32..460806a2 100644
--- a/lib/dvb/idvb.h
+++ b/lib/dvb/idvb.h
@@ -474,6 +474,9 @@ public:
/** Continue after freeze. */
virtual RESULT unfreeze()=0;
+ /** fast forward by skipping frames. 0 is disabled, 2 is twice-the-speed, ... */
+ virtual RESULT setFastForward(int skip=0)=0;
+
// stop on .. Picture
enum { spm_I, spm_Ref, spm_Any };
/** Stop on specific decoded picture. For I-Frame display. */
diff --git a/lib/service/iservice.h b/lib/service/iservice.h
index 4ec12153..eb04eadd 100644
--- a/lib/service/iservice.h
+++ b/lib/service/iservice.h
@@ -241,6 +241,10 @@ class iPauseableService: public iObject
public:
virtual RESULT pause()=0;
virtual RESULT unpause()=0;
+
+ /* hm. */
+ virtual RESULT setSlowMotion(int ratio=0)=0;
+ virtual RESULT setFastForward(int ratio=0)=0;
};
TEMPLATE_TYPEDEF(ePtr<iPauseableService>, iPauseableServicePtr);
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 307fb9f5..b3c15738 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -629,6 +629,22 @@ RESULT eDVBServicePlay::pause(ePtr<iPauseableService> &ptr)
return -1;
}
+RESULT eDVBServicePlay::setSlowMotion(int ratio)
+{
+ if (m_decoder)
+ return m_decoder->setSlowMotion(ratio);
+ else
+ return -1;
+}
+
+RESULT eDVBServicePlay::setFastForward(int ratio)
+{
+ if (m_decoder)
+ m_decoder->setFastForward(ratio);
+ else
+ return -1;
+}
+
RESULT eDVBServicePlay::seek(ePtr<iSeekableService> &ptr)
{
if (m_is_pvr)
diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h
index 5f851357..6b93469d 100644
--- a/lib/service/servicedvb.h
+++ b/lib/service/servicedvb.h
@@ -75,7 +75,9 @@ public:
// iPauseableService
RESULT pause();
RESULT unpause();
-
+ RESULT setSlowMotion(int ratio);
+ RESULT setFastForward(int ratio);
+
// iSeekableService
RESULT getLength(pts_t &len);
RESULT seekTo(pts_t to);
diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp
index 7bd4244f..27a010fb 100644
--- a/lib/service/servicemp3.cpp
+++ b/lib/service/servicemp3.cpp
@@ -152,6 +152,16 @@ RESULT eServiceMP3::pause(ePtr<iPauseableService> &ptr)
return 0;
}
+RESULT eServiceMP3::setSlowMotion(int ratio)
+{
+ return -1;
+}
+
+RESULT eServiceMP3::setFastForward(int ratio)
+{
+ return -1;
+}
+
// iPausableService
RESULT eServiceMP3::pause()
{
diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h
index dfdaa44c..ac174c41 100644
--- a/lib/service/servicemp3.h
+++ b/lib/service/servicemp3.h
@@ -56,6 +56,9 @@ public:
RESULT start();
RESULT stop();
RESULT pause(ePtr<iPauseableService> &ptr);
+ RESULT setSlowMotion(int ratio);
+ RESULT setFastForward(int ratio);
+
// not implemented (yet)
RESULT seek(ePtr<iSeekableService> &ptr) { ptr = 0; return -1; }
RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr) { ptr = 0; return -1; }