summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Todo4
-rw-r--r--softhddev.c66
-rw-r--r--softhddevice.cpp19
3 files changed, 69 insertions, 20 deletions
diff --git a/Todo b/Todo
index f1b7f0c..c47450f 100644
--- a/Todo
+++ b/Todo
@@ -25,10 +25,11 @@ missing:
software deinterlace
auto crop
atmolight
- zoom/fit-zoom 4:3
+ zoom/fit-zoom 4:3 (SetVideoDisplayFormat, SetVideoFormat?)
multistream handling
ITU BT601, ITU BT709 (HD), RGB studio levels (16-235)?
suspend output / energie saver: stop audio, stop video, configurable
+ Subtitle have the wrong position
vdpau:
1080i with temporal spatial and level 1 scaling too slow with my GT 520
@@ -79,6 +80,7 @@ audio/oss:
HDMI/SPDIF Passthrough:
only AC-3 written
Channels are wrong setup, if changing setting during operation.
+ split pcm and ac-3 out into two devices
playback of recording
pause is not reset, when replay exit
diff --git a/softhddev.c b/softhddev.c
index e900890..7573049 100644
--- a/softhddev.c
+++ b/softhddev.c
@@ -35,6 +35,11 @@
#include <libavcodec/avcodec.h>
+#ifndef __USE_GNU
+#define __USE_GNU
+#endif
+#include <pthread.h>
+
#include "misc.h"
#include "softhddev.h"
@@ -52,6 +57,11 @@ static char ConfigVdpauDecoder = 1; ///< use vdpau decoder, if possible
#define ConfigVdpauDecoder 0 ///< no vdpau decoder configured
#endif
+static char ConfigSuspendClose = 1; ///< suspend should close devices
+static char ConfigSuspendX11 = 1; ///< suspend should stop x11
+
+static pthread_mutex_t SuspendLockMutex;///< suspend lock mutex
+
static volatile char VideoFreezed; ///< video freezed
//////////////////////////////////////////////////////////////////////////////
@@ -581,8 +591,8 @@ static void StartVideo(void)
if ((hw_decoder = VideoNewHwDecoder())) {
MyVideoDecoder = CodecVideoNewDecoder(hw_decoder);
- VideoCodecID = CODEC_ID_NONE;
}
+ VideoCodecID = CODEC_ID_NONE;
}
VideoPacketInit();
}
@@ -927,7 +937,7 @@ void OsdDrawARGB(int x, int y, int height, int width, const uint8_t * argb)
//////////////////////////////////////////////////////////////////////////////
-static char StartX11Server; ///< flag start the x11 server
+static char ConfigStartX11Server; ///< flag start the x11 server
/**
** Return command line help string.
@@ -968,7 +978,7 @@ int ProcessArgs(int argc, char *const argv[])
}
continue;
case 'x': // x11 server
- StartX11Server = 1;
+ ConfigStartX11Server = 1;
continue;
case EOF:
break;
@@ -1107,13 +1117,15 @@ void SoftHdDeviceExit(void)
CodecExit();
VideoPacketExit();
- if (StartX11Server) {
+ if (ConfigStartX11Server) {
Debug(3, "x-setup: Stop x11 server\n");
if (X11ServerPid) {
kill(X11ServerPid, SIGTERM);
}
}
+
+ pthread_mutex_destroy(&SuspendLockMutex);
}
/**
@@ -1121,15 +1133,17 @@ void SoftHdDeviceExit(void)
*/
void Start(void)
{
- if (StartX11Server) {
+ if (ConfigStartX11Server) {
StartXServer();
}
CodecInit();
// FIXME: AudioInit for HDMI after X11 startup
AudioInit();
- if (!StartX11Server) {
+ if (!ConfigStartX11Server) {
StartVideo();
}
+
+ pthread_mutex_init(&SuspendLockMutex, NULL);
}
/**
@@ -1160,11 +1174,27 @@ void MainThreadHook(void)
*/
void Suspend(void)
{
- // FIXME: close audio
- // FIXME: close video
- // FIXME: stop x11, if started
+ pthread_mutex_lock(&SuspendLockMutex);
+ if( SkipVideo && SkipAudio ) { // already suspended
+ pthread_mutex_unlock(&SuspendLockMutex);
+ return;
+ }
+
+ Debug(3, "[softhddev]%s:\n", __FUNCTION__);
+
SkipVideo = 1;
SkipAudio = 1;
+ pthread_mutex_unlock(&SuspendLockMutex);
+
+ if ( ConfigSuspendClose ) {
+ pthread_mutex_lock(&SuspendLockMutex);
+ // FIXME: close audio
+ // FIXME: close video
+ pthread_mutex_unlock(&SuspendLockMutex);
+ }
+ if ( ConfigSuspendX11 ) {
+ // FIXME: stop x11, if started
+ }
}
/**
@@ -1172,9 +1202,19 @@ void Suspend(void)
*/
void Resume(void)
{
- if (SkipVideo && SkipAudio) {
- Debug(3, "[softhddev]%s:\n", __FUNCTION__);
- SkipVideo = 0;
- SkipAudio = 0;
+ if (!SkipVideo && !SkipAudio) { // we are not suspended
+ return;
}
+
+ Debug(3, "[softhddev]%s:\n", __FUNCTION__);
+
+ if ( ConfigSuspendX11 ) {
+ }
+ if ( ConfigSuspendClose ) {
+ pthread_mutex_lock(&SuspendLockMutex);
+ pthread_mutex_unlock(&SuspendLockMutex);
+ }
+
+ SkipVideo = 0;
+ SkipAudio = 0;
}
diff --git a/softhddevice.cpp b/softhddevice.cpp
index 7d40b61..d34daea 100644
--- a/softhddevice.cpp
+++ b/softhddevice.cpp
@@ -547,7 +547,7 @@ bool cSoftHdDevice::SetPlayMode(ePlayMode PlayMode)
case pmVideoOnly:
break;
case pmNone:
- break;
+ return true;
case pmExtern_THIS_SHOULD_BE_AVOIDED:
break;
default:
@@ -830,15 +830,14 @@ bool cPluginSoftHdDevice::Initialize(void)
return true;
}
+/**
+** Start any background activities the plugin shall perform.
+*/
bool cPluginSoftHdDevice::Start(void)
{
- const cDevice *primary;
-
- // Start any background activities the plugin shall perform.
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
- primary = cDevice::PrimaryDevice();
- if (MyDevice != primary) {
+ if (!MyDevice->IsPrimaryDevice()) {
isyslog("[softhddev] softhddevice is not the primary device!");
if (ConfigMakePrimary) {
// Must be done in the main thread
@@ -889,6 +888,8 @@ cOsdObject *cPluginSoftHdDevice::MainMenuAction(void)
{
dsyslog("[softhddev]%s:\n", __FUNCTION__);
+ //cDevice::PrimaryDevice()->StopReplay();
+ ShutdownHandler.SetUserInactive();
Suspend();
return NULL;
@@ -908,6 +909,12 @@ void cPluginSoftHdDevice::MainThreadHook(void)
DoMakePrimary = 0;
}
+ // check if user is inactive, automatic enter suspend mode
+ if (ShutdownHandler.IsUserInactive()) {
+ // this is regular called, but guarded against double calls
+ Suspend();
+ }
+
::MainThreadHook();
}