mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Suspend when user is inactive.
This commit is contained in:
parent
712b2e0de1
commit
d983f780b3
4
Todo
4
Todo
@ -25,10 +25,11 @@ missing:
|
|||||||
software deinterlace
|
software deinterlace
|
||||||
auto crop
|
auto crop
|
||||||
atmolight
|
atmolight
|
||||||
zoom/fit-zoom 4:3
|
zoom/fit-zoom 4:3 (SetVideoDisplayFormat, SetVideoFormat?)
|
||||||
multistream handling
|
multistream handling
|
||||||
ITU BT601, ITU BT709 (HD), RGB studio levels (16-235)?
|
ITU BT601, ITU BT709 (HD), RGB studio levels (16-235)?
|
||||||
suspend output / energie saver: stop audio, stop video, configurable
|
suspend output / energie saver: stop audio, stop video, configurable
|
||||||
|
Subtitle have the wrong position
|
||||||
|
|
||||||
vdpau:
|
vdpau:
|
||||||
1080i with temporal spatial and level 1 scaling too slow with my GT 520
|
1080i with temporal spatial and level 1 scaling too slow with my GT 520
|
||||||
@ -79,6 +80,7 @@ audio/oss:
|
|||||||
HDMI/SPDIF Passthrough:
|
HDMI/SPDIF Passthrough:
|
||||||
only AC-3 written
|
only AC-3 written
|
||||||
Channels are wrong setup, if changing setting during operation.
|
Channels are wrong setup, if changing setting during operation.
|
||||||
|
split pcm and ac-3 out into two devices
|
||||||
|
|
||||||
playback of recording
|
playback of recording
|
||||||
pause is not reset, when replay exit
|
pause is not reset, when replay exit
|
||||||
|
62
softhddev.c
62
softhddev.c
@ -35,6 +35,11 @@
|
|||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
|
||||||
|
#ifndef __USE_GNU
|
||||||
|
#define __USE_GNU
|
||||||
|
#endif
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "softhddev.h"
|
#include "softhddev.h"
|
||||||
|
|
||||||
@ -52,6 +57,11 @@ static char ConfigVdpauDecoder = 1; ///< use vdpau decoder, if possible
|
|||||||
#define ConfigVdpauDecoder 0 ///< no vdpau decoder configured
|
#define ConfigVdpauDecoder 0 ///< no vdpau decoder configured
|
||||||
#endif
|
#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
|
static volatile char VideoFreezed; ///< video freezed
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -581,8 +591,8 @@ static void StartVideo(void)
|
|||||||
|
|
||||||
if ((hw_decoder = VideoNewHwDecoder())) {
|
if ((hw_decoder = VideoNewHwDecoder())) {
|
||||||
MyVideoDecoder = CodecVideoNewDecoder(hw_decoder);
|
MyVideoDecoder = CodecVideoNewDecoder(hw_decoder);
|
||||||
VideoCodecID = CODEC_ID_NONE;
|
|
||||||
}
|
}
|
||||||
|
VideoCodecID = CODEC_ID_NONE;
|
||||||
}
|
}
|
||||||
VideoPacketInit();
|
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.
|
** Return command line help string.
|
||||||
@ -968,7 +978,7 @@ int ProcessArgs(int argc, char *const argv[])
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
case 'x': // x11 server
|
case 'x': // x11 server
|
||||||
StartX11Server = 1;
|
ConfigStartX11Server = 1;
|
||||||
continue;
|
continue;
|
||||||
case EOF:
|
case EOF:
|
||||||
break;
|
break;
|
||||||
@ -1107,13 +1117,15 @@ void SoftHdDeviceExit(void)
|
|||||||
CodecExit();
|
CodecExit();
|
||||||
VideoPacketExit();
|
VideoPacketExit();
|
||||||
|
|
||||||
if (StartX11Server) {
|
if (ConfigStartX11Server) {
|
||||||
Debug(3, "x-setup: Stop x11 server\n");
|
Debug(3, "x-setup: Stop x11 server\n");
|
||||||
|
|
||||||
if (X11ServerPid) {
|
if (X11ServerPid) {
|
||||||
kill(X11ServerPid, SIGTERM);
|
kill(X11ServerPid, SIGTERM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_destroy(&SuspendLockMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1121,15 +1133,17 @@ void SoftHdDeviceExit(void)
|
|||||||
*/
|
*/
|
||||||
void Start(void)
|
void Start(void)
|
||||||
{
|
{
|
||||||
if (StartX11Server) {
|
if (ConfigStartX11Server) {
|
||||||
StartXServer();
|
StartXServer();
|
||||||
}
|
}
|
||||||
CodecInit();
|
CodecInit();
|
||||||
// FIXME: AudioInit for HDMI after X11 startup
|
// FIXME: AudioInit for HDMI after X11 startup
|
||||||
AudioInit();
|
AudioInit();
|
||||||
if (!StartX11Server) {
|
if (!ConfigStartX11Server) {
|
||||||
StartVideo();
|
StartVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_init(&SuspendLockMutex, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1160,11 +1174,27 @@ void MainThreadHook(void)
|
|||||||
*/
|
*/
|
||||||
void Suspend(void)
|
void Suspend(void)
|
||||||
{
|
{
|
||||||
// FIXME: close audio
|
pthread_mutex_lock(&SuspendLockMutex);
|
||||||
// FIXME: close video
|
if( SkipVideo && SkipAudio ) { // already suspended
|
||||||
// FIXME: stop x11, if started
|
pthread_mutex_unlock(&SuspendLockMutex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug(3, "[softhddev]%s:\n", __FUNCTION__);
|
||||||
|
|
||||||
SkipVideo = 1;
|
SkipVideo = 1;
|
||||||
SkipAudio = 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)
|
void Resume(void)
|
||||||
{
|
{
|
||||||
if (SkipVideo && SkipAudio) {
|
if (!SkipVideo && !SkipAudio) { // we are not suspended
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Debug(3, "[softhddev]%s:\n", __FUNCTION__);
|
Debug(3, "[softhddev]%s:\n", __FUNCTION__);
|
||||||
|
|
||||||
|
if ( ConfigSuspendX11 ) {
|
||||||
|
}
|
||||||
|
if ( ConfigSuspendClose ) {
|
||||||
|
pthread_mutex_lock(&SuspendLockMutex);
|
||||||
|
pthread_mutex_unlock(&SuspendLockMutex);
|
||||||
|
}
|
||||||
|
|
||||||
SkipVideo = 0;
|
SkipVideo = 0;
|
||||||
SkipAudio = 0;
|
SkipAudio = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -547,7 +547,7 @@ bool cSoftHdDevice::SetPlayMode(ePlayMode PlayMode)
|
|||||||
case pmVideoOnly:
|
case pmVideoOnly:
|
||||||
break;
|
break;
|
||||||
case pmNone:
|
case pmNone:
|
||||||
break;
|
return true;
|
||||||
case pmExtern_THIS_SHOULD_BE_AVOIDED:
|
case pmExtern_THIS_SHOULD_BE_AVOIDED:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -830,15 +830,14 @@ bool cPluginSoftHdDevice::Initialize(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
** Start any background activities the plugin shall perform.
|
||||||
|
*/
|
||||||
bool cPluginSoftHdDevice::Start(void)
|
bool cPluginSoftHdDevice::Start(void)
|
||||||
{
|
{
|
||||||
const cDevice *primary;
|
|
||||||
|
|
||||||
// Start any background activities the plugin shall perform.
|
|
||||||
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
||||||
|
|
||||||
primary = cDevice::PrimaryDevice();
|
if (!MyDevice->IsPrimaryDevice()) {
|
||||||
if (MyDevice != primary) {
|
|
||||||
isyslog("[softhddev] softhddevice is not the primary device!");
|
isyslog("[softhddev] softhddevice is not the primary device!");
|
||||||
if (ConfigMakePrimary) {
|
if (ConfigMakePrimary) {
|
||||||
// Must be done in the main thread
|
// Must be done in the main thread
|
||||||
@ -889,6 +888,8 @@ cOsdObject *cPluginSoftHdDevice::MainMenuAction(void)
|
|||||||
{
|
{
|
||||||
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
||||||
|
|
||||||
|
//cDevice::PrimaryDevice()->StopReplay();
|
||||||
|
ShutdownHandler.SetUserInactive();
|
||||||
Suspend();
|
Suspend();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -908,6 +909,12 @@ void cPluginSoftHdDevice::MainThreadHook(void)
|
|||||||
DoMakePrimary = 0;
|
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();
|
::MainThreadHook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user