summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-02-16 15:31:53 +0100
committerJohns <johns98@gmx.net>2012-02-16 15:31:53 +0100
commit852d3672252bd13b8337b1f28c05fa457a3f1b7f (patch)
tree2450cae54bb61dd38a0301783249d47f684dae0b
parenta7f0cf6d6f2d18c982a08695ca4363aa2a55693e (diff)
downloadvdr-plugin-softhddevice-852d3672252bd13b8337b1f28c05fa457a3f1b7f.tar.gz
vdr-plugin-softhddevice-852d3672252bd13b8337b1f28c05fa457a3f1b7f.tar.bz2
Adds trick speed support.
-rw-r--r--ChangeLog5
-rw-r--r--softhddev.c47
-rw-r--r--softhddev.h6
-rw-r--r--softhddevice.cpp34
4 files changed, 72 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 60e93fd..38e12cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
User johns
+Date:
+
+ Adds trick speed support.
+
+User johns
Date: Thu Feb 16 09:59:14 CET 2012
Release Version 0.4.8
diff --git a/softhddev.c b/softhddev.c
index 7ec3bd4..85a9b1a 100644
--- a/softhddev.c
+++ b/softhddev.c
@@ -471,16 +471,6 @@ int PlayAudio(const uint8_t * data, int size, uint8_t id)
}
/**
-** Turns off audio while replaying.
-*/
-void Mute(void)
-{
- SkipAudio = 1;
- AudioFlushBuffers();
- //AudioSetVolume(0);
-}
-
-/**
** Set volume of audio device.
**
** @param volume VDR volume (0 .. 255)
@@ -513,8 +503,11 @@ static AVPacket VideoPacketRb[VIDEO_PACKET_MAX];
static int VideoPacketWrite; ///< write pointer
static int VideoPacketRead; ///< read pointer
atomic_t VideoPacketsFilled; ///< how many of the buffer is used
+
static volatile char VideoClearBuffers; ///< clear video buffers
static volatile char SkipVideo; ///< skip video
+static volatile char VideoTrickSpeed; ///< current trick speed
+static volatile char VideoTrickCounter; ///< current trick speed counter
#ifdef DEBUG
static int VideoMaxPacketSize; ///< biggest used packet buffer
@@ -722,6 +715,13 @@ int VideoDecode(void)
VideoClearBuffers = 0;
return 1;
}
+ if (VideoTrickSpeed) {
+ if (VideoTrickCounter++ < VideoTrickSpeed * 2) {
+ usleep(5 * 1000);
+ return 1;
+ }
+ VideoTrickCounter = 0;
+ }
filled = atomic_read(&VideoPacketsFilled);
if (!filled) {
@@ -1225,6 +1225,21 @@ void SetPlayMode(void)
NewAudioStream = 1;
}
}
+ Play();
+}
+
+/**
+** Set trick play speed.
+**
+** Every single frame shall then be displayed the given number of
+** times.
+**
+** @param speed trick speed
+*/
+void TrickSpeed(int speed)
+{
+ VideoTrickSpeed = speed;
+ VideoTrickCounter = 0;
StreamFreezed = 0;
}
@@ -1251,6 +1266,8 @@ void Clear(void)
*/
void Play(void)
{
+ VideoTrickSpeed = 0;
+ VideoTrickCounter = 0;
StreamFreezed = 0;
SkipAudio = 0;
AudioPlay();
@@ -1266,6 +1283,16 @@ void Freeze(void)
}
/**
+** Turns off audio while replaying.
+*/
+void Mute(void)
+{
+ SkipAudio = 1;
+ AudioFlushBuffers();
+ //AudioSetVolume(0);
+}
+
+/**
** Display the given I-frame as a still picture.
**
** @param data pes frame data
diff --git a/softhddev.h b/softhddev.h
index feb4a26..631cd56 100644
--- a/softhddev.h
+++ b/softhddev.h
@@ -37,8 +37,6 @@ extern "C"
/// C plugin play audio packet
extern int PlayAudio(const uint8_t *, int, uint8_t);
- /// C plugin mute audio
- extern void Mute(void);
/// C plugin set audio volume
extern void SetVolumeDevice(int);
@@ -51,12 +49,16 @@ extern "C"
/// C plugin set play mode
extern void SetPlayMode(void);
+ /// C plugin set trick speed
+ extern void TrickSpeed(int);
/// C plugin clears all video and audio data from the device
extern void Clear(void);
/// C plugin sets the device into play mode
extern void Play(void);
/// C plugin sets the device into "freeze frame" mode
extern void Freeze(void);
+ /// C plugin mute audio
+ extern void Mute(void);
/// C plugin display I-frame as a still picture.
extern void StillPicture(const uint8_t *, int);
/// C plugin poll if ready
diff --git a/softhddevice.cpp b/softhddevice.cpp
index 35d32ed..6002d6e 100644
--- a/softhddevice.cpp
+++ b/softhddevice.cpp
@@ -42,7 +42,7 @@ extern "C"
//////////////////////////////////////////////////////////////////////////////
-static const char *const VERSION = "0.4.8";
+static const char *const VERSION = "0.4.9";
static const char *const DESCRIPTION =
trNOOP("A software and GPU emulated HD device");
@@ -144,12 +144,15 @@ extern "C" void FeedKeyPress(const char *keymap, const char *key, int repeat,
// OSD
//////////////////////////////////////////////////////////////////////////////
+/**
+** Soft device plugin OSD class.
+*/
class cSoftOsd:public cOsd
{
- int Level; ///< level: subtitle
+ //int Level; ///< level: subtitle
public:
- cSoftOsd(int, int, uint);
+ cSoftOsd(int, int, uint);
virtual ~ cSoftOsd(void);
virtual void Flush(void);
virtual void SetActive(bool);
@@ -167,7 +170,7 @@ static volatile char OsdDirty; ///< flag force redraw everything
*/
void cSoftOsd::SetActive(bool on)
{
- dsyslog("[softhddev]%s: %d\n", __FUNCTION__, on);
+ //dsyslog("[softhddev]%s: %d\n", __FUNCTION__, on);
if (Active() == on) {
return; // already active, no action
@@ -188,7 +191,7 @@ cSoftOsd::cSoftOsd(int left, int top, uint level)
OsdHeight(), left, top, level);
*/
- this->Level = level;
+ //this->Level = level;
SetActive(true);
}
@@ -334,6 +337,9 @@ void cSoftOsd::Flush(void)
// OSD provider
//////////////////////////////////////////////////////////////////////////////
+/**
+** Soft device plugin OSD provider class.
+*/
class cSoftOsdProvider:public cOsdProvider
{
private:
@@ -357,12 +363,13 @@ cOsd *cSoftOsdProvider::CreateOsd(int left, int top, uint level)
{
//dsyslog("[softhddev]%s: %d, %d, %d\n", __FUNCTION__, left, top, level);
- Osd = new cSoftOsd(left, top, level);
- return Osd;
+ return Osd = new cSoftOsd(left, top, level);
}
/**
-** Returns true if this OSD provider is able to handle a true color OSD.
+** Check if this OSD provider is able to handle a true color OSD.
+**
+** @returns true we are able to handle a true color OSD.
*/
bool cSoftOsdProvider::ProvidesTrueColor(void)
{
@@ -810,13 +817,21 @@ int64_t cSoftHdDevice::GetSTC(void)
/**
** Set trick play speed.
**
+** Every single frame shall then be displayed the given number of
+** times.
+**
** @param speed trick speed
*/
void cSoftHdDevice::TrickSpeed(int speed)
{
dsyslog("[softhddev]%s: %d\n", __FUNCTION__, speed);
+
+ ::TrickSpeed(speed);
}
+/**
+** Clears all video and audio data from the device.
+*/
void cSoftHdDevice::Clear(void)
{
dsyslog("[softhddev]%s:\n", __FUNCTION__);
@@ -825,6 +840,9 @@ void cSoftHdDevice::Clear(void)
::Clear();
}
+/**
+** Sets the device into play mode (after a previous trick mode)
+*/
void cSoftHdDevice::Play(void)
{
dsyslog("[softhddev]%s:\n", __FUNCTION__);