Add deinterlace/scaling modes to setup.

This commit is contained in:
Johns 2011-12-12 17:06:05 +01:00
parent fa970400f1
commit edfb9932c0
6 changed files with 80 additions and 20 deletions

View File

@ -1,4 +1,9 @@
User johns User johns
Date:
DisplayFrame displays now only a single frame.
Add deinterlace/scaling modes to setup.
Date: Sat Dec 10 00:06:46 CET 2011 Date: Sat Dec 10 00:06:46 CET 2011
Release Version 0.0.9 Release Version 0.0.9

9
Todo
View File

@ -14,8 +14,13 @@ x11:
support fullscreen window support fullscreen window
support fullscreen / window toggle support fullscreen / window toggle
video/audio asyncron audio/alsa:
video/audio asyncron
playback of >2 channels on 2 channel hardware playback of >2 channels on 2 channel hardware
done?
on some channels it takes long time until sound can be heared.
this channels has packet start not at the beginning of the start packet
playback of recording playback of recording

View File

@ -478,26 +478,28 @@ static void StartVideo(void)
** @param data data of exactly one complete PES packet ** @param data data of exactly one complete PES packet
** @param size size of PES packet ** @param size size of PES packet
** **
** @return number of bytes used, 0 if internal buffer are full.
**
** @note vdr sends incomplete packets, va-api h264 decoder only ** @note vdr sends incomplete packets, va-api h264 decoder only
** supports complete packets. ** supports complete packets.
** We buffer here until we receive an complete PES Packet, which ** We buffer here until we receive an complete PES Packet, which
** is no problem, the audio is always far behind us. ** is no problem, the audio is always far behind us.
*/ */
void PlayVideo(const uint8_t * data, int size) int PlayVideo(const uint8_t * data, int size)
{ {
const uint8_t *check; const uint8_t *check;
int64_t pts; int64_t pts;
int n; int n;
if (BrokenThreadsAndPlugins) { if (BrokenThreadsAndPlugins) {
return; return size;
} }
if (Usr1Signal) { // x11 server ready if (Usr1Signal) { // x11 server ready
Usr1Signal = 0; Usr1Signal = 0;
StartVideo(); StartVideo();
} }
if (!MyVideoDecoder) { // no x11 video started if (!MyVideoDecoder) { // no x11 video started
return; return size;
} }
if (NewVideoStream) { if (NewVideoStream) {
Debug(3, "video: new stream %d\n", GetMsTicks() - VideoSwitch); Debug(3, "video: new stream %d\n", GetMsTicks() - VideoSwitch);
@ -506,15 +508,15 @@ void PlayVideo(const uint8_t * data, int size)
NewVideoStream = 0; NewVideoStream = 0;
} }
// must be a PES start code // must be a PES start code
if (data[0] || data[1] || data[2] != 0x01 || size < 9) { if (size < 9 || data[0] || data[1] || data[2] != 0x01) {
Error(_("[softhddev] invalid PES video packet\n")); Error(_("[softhddev] invalid PES video packet\n"));
return; return size;
} }
n = data[8]; // header size n = data[8]; // header size
// wrong size // wrong size
if (size < 9 + n) { if (size < 9 + n) {
Error(_("[softhddev] invalid video packet\n")); Error(_("[softhddev] invalid video packet\n"));
return; return size;
} }
check = data + 9 + n; check = data + 9 + n;
@ -555,7 +557,7 @@ void PlayVideo(const uint8_t * data, int size)
// this happens when vdr sends incomplete packets // this happens when vdr sends incomplete packets
if (VideoCodecID == CODEC_ID_NONE) { if (VideoCodecID == CODEC_ID_NONE) {
Debug(3, "video: not detected\n"); Debug(3, "video: not detected\n");
return; return size;
} }
if (VideoCodecID == CODEC_ID_MPEG2VIDEO) { if (VideoCodecID == CODEC_ID_MPEG2VIDEO) {
// mpeg codec supports incomplete packages // mpeg codec supports incomplete packages
@ -564,8 +566,9 @@ void PlayVideo(const uint8_t * data, int size)
} }
// SKIP PES header // SKIP PES header
size -= 9 + n; VideoEnqueue(pts, check, size - 9 - n);
VideoEnqueue(pts, check, size);
return size;
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -591,6 +594,23 @@ void SetPlayMode(void)
} }
} }
/**
** Poll if device is ready. Called by replay.
*/
int Poll(int timeout)
{
return 1;
// buffers are too full
if (atomic_read(&VideoPacketsFilled) >= VIDEO_PACKET_MAX / 2) {
if (timeout) {
// let display thread work
usleep(timeout * 1000);
}
return atomic_read(&VideoPacketsFilled) < VIDEO_PACKET_MAX / 2;
}
return 0;
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// OSD // OSD
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -43,12 +43,14 @@ extern "C"
extern void SetVolumeDevice(int); extern void SetVolumeDevice(int);
/// C plugin play video packet /// C plugin play video packet
extern void PlayVideo(const uint8_t *, int); extern int PlayVideo(const uint8_t *, int);
/// C plugin play TS video packet /// C plugin play TS video packet
extern void PlayTsVideo(const uint8_t *, int); extern void PlayTsVideo(const uint8_t *, int);
/// C plugin set play mode /// C plugin set play mode
extern void SetPlayMode(void); extern void SetPlayMode(void);
/// C plugin poll if ready
extern int Poll(int);
/// C plugin command line help /// C plugin command line help
extern const char *CommandLineHelp(void); extern const char *CommandLineHelp(void);

View File

@ -33,10 +33,13 @@
#include "softhddev.h" #include "softhddev.h"
#include "softhddevice.h" #include "softhddevice.h"
extern "C" {
#include "video.h"
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static const char *const VERSION = "0.0.9"; static const char *const VERSION = "0.1.0";
static const char *const DESCRIPTION = static const char *const DESCRIPTION =
trNOOP("A software and GPU emulated HD device"); trNOOP("A software and GPU emulated HD device");
@ -254,6 +257,8 @@ class cMenuSetupSoft:public cMenuSetupPage
{ {
protected: protected:
int MakePrimary; int MakePrimary;
int Deinterlace;
int Scaling;
protected: protected:
virtual void Store(void); virtual void Store(void);
public: public:
@ -265,10 +270,17 @@ class cMenuSetupSoft:public cMenuSetupPage
*/ */
cMenuSetupSoft::cMenuSetupSoft(void) cMenuSetupSoft::cMenuSetupSoft(void)
{ {
static const char * const deinterlace[] = {
"Bob", "Weave", "Temporal", "TemporalSpatial", "Software" };
static const char * const scaling[] = {
"Normal", "Fast", "HQ", "Anamorphic" };
// cMenuEditBoolItem cMenuEditBitItem cMenuEditNumItem // cMenuEditBoolItem cMenuEditBitItem cMenuEditNumItem
// cMenuEditStrItem cMenuEditStraItem cMenuEditIntItem // cMenuEditStrItem cMenuEditStraItem cMenuEditIntItem
Add(new cMenuEditBoolItem(tr("Make primary device"), &MakePrimary, Add(new cMenuEditBoolItem(tr("Make primary device"), &MakePrimary,
tr("no"), tr("yes"))); tr("no"), tr("yes")));
Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace, 5, deinterlace));
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling, 4, scaling));
} }
/** /**
@ -277,6 +289,8 @@ cMenuSetupSoft::cMenuSetupSoft(void)
void cMenuSetupSoft::Store(void) void cMenuSetupSoft::Store(void)
{ {
SetupStore("MakePrimary", MakePrimary); SetupStore("MakePrimary", MakePrimary);
SetupStore("Deinterlace", Deinterlace);
SetupStore("Scaling", Scaling);
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -451,11 +465,11 @@ void cSoftHdDevice::StillPicture(
} }
bool cSoftHdDevice::Poll( bool cSoftHdDevice::Poll(
__attribute__ ((unused)) cPoller & poller, __attribute__ ((unused)) __attribute__ ((unused)) cPoller & poller, int timeout_ms)
int timeout_ms)
{ {
dsyslog("[softhddev]%s:\n", __FUNCTION__); dsyslog("[softhddev]%s: %d\n", __FUNCTION__, timeout_ms);
return true;
return ::Poll(timeout_ms);
} }
bool cSoftHdDevice::Flush( __attribute__ ((unused)) int timeout_ms) bool cSoftHdDevice::Flush( __attribute__ ((unused)) int timeout_ms)
@ -518,9 +532,7 @@ int cSoftHdDevice::PlayVideo(const uchar * data, int length)
{ {
//dsyslog("[softhddev]%s: %p %d\n", __FUNCTION__, data, length); //dsyslog("[softhddev]%s: %p %d\n", __FUNCTION__, data, length);
::PlayVideo(data, length); return ::PlayVideo(data, length);
return length;
} }
#if 0 #if 0
@ -728,6 +740,16 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
ConfigMakePrimary = atoi(value); ConfigMakePrimary = atoi(value);
return true; return true;
} }
if (!strcmp(name, "Deinterlace")) {
printf("Deinterlace: %d\n", atoi(value));
VideoSetDeinterlace(atoi(value));
return true;
}
if (!strcmp(name, "Scaling")) {
printf("Scaling: %d\n", atoi(value));
VideoSetScaling(atoi(value));
return true;
}
return false; return false;
} }

View File

@ -71,6 +71,12 @@ extern void VideoDisplayHandler(void);
/// set video geometry /// set video geometry
extern int VideoSetGeometry(const char *); extern int VideoSetGeometry(const char *);
/// set deinterlace
extern void VideoSetDeinterlace(int);
/// set scaling
extern void VideoSetScaling(int);
/// Clear OSD /// Clear OSD
extern void VideoOsdClear(void); extern void VideoOsdClear(void);