mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Add deinterlace/scaling modes to setup.
This commit is contained in:
parent
fa970400f1
commit
edfb9932c0
@ -1,4 +1,9 @@
|
||||
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
|
||||
|
||||
Release Version 0.0.9
|
||||
|
5
Todo
5
Todo
@ -14,8 +14,13 @@ x11:
|
||||
support fullscreen window
|
||||
support fullscreen / window toggle
|
||||
|
||||
audio/alsa:
|
||||
video/audio asyncron
|
||||
|
||||
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
|
||||
|
38
softhddev.c
38
softhddev.c
@ -478,26 +478,28 @@ static void StartVideo(void)
|
||||
** @param data data of exactly one complete 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
|
||||
** supports complete packets.
|
||||
** We buffer here until we receive an complete PES Packet, which
|
||||
** 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;
|
||||
int64_t pts;
|
||||
int n;
|
||||
|
||||
if (BrokenThreadsAndPlugins) {
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
if (Usr1Signal) { // x11 server ready
|
||||
Usr1Signal = 0;
|
||||
StartVideo();
|
||||
}
|
||||
if (!MyVideoDecoder) { // no x11 video started
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
if (NewVideoStream) {
|
||||
Debug(3, "video: new stream %d\n", GetMsTicks() - VideoSwitch);
|
||||
@ -506,15 +508,15 @@ void PlayVideo(const uint8_t * data, int size)
|
||||
NewVideoStream = 0;
|
||||
}
|
||||
// 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"));
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
n = data[8]; // header size
|
||||
// wrong size
|
||||
if (size < 9 + n) {
|
||||
Error(_("[softhddev] invalid video packet\n"));
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
check = data + 9 + n;
|
||||
|
||||
@ -555,7 +557,7 @@ void PlayVideo(const uint8_t * data, int size)
|
||||
// this happens when vdr sends incomplete packets
|
||||
if (VideoCodecID == CODEC_ID_NONE) {
|
||||
Debug(3, "video: not detected\n");
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
if (VideoCodecID == CODEC_ID_MPEG2VIDEO) {
|
||||
// mpeg codec supports incomplete packages
|
||||
@ -564,8 +566,9 @@ void PlayVideo(const uint8_t * data, int size)
|
||||
}
|
||||
|
||||
// SKIP PES header
|
||||
size -= 9 + n;
|
||||
VideoEnqueue(pts, check, size);
|
||||
VideoEnqueue(pts, check, size - 9 - n);
|
||||
|
||||
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
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -43,12 +43,14 @@ extern "C"
|
||||
extern void SetVolumeDevice(int);
|
||||
|
||||
/// 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
|
||||
extern void PlayTsVideo(const uint8_t *, int);
|
||||
|
||||
/// C plugin set play mode
|
||||
extern void SetPlayMode(void);
|
||||
/// C plugin poll if ready
|
||||
extern int Poll(int);
|
||||
|
||||
/// C plugin command line help
|
||||
extern const char *CommandLineHelp(void);
|
||||
|
@ -33,10 +33,13 @@
|
||||
|
||||
#include "softhddev.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 =
|
||||
trNOOP("A software and GPU emulated HD device");
|
||||
|
||||
@ -254,6 +257,8 @@ class cMenuSetupSoft:public cMenuSetupPage
|
||||
{
|
||||
protected:
|
||||
int MakePrimary;
|
||||
int Deinterlace;
|
||||
int Scaling;
|
||||
protected:
|
||||
virtual void Store(void);
|
||||
public:
|
||||
@ -265,10 +270,17 @@ class cMenuSetupSoft:public cMenuSetupPage
|
||||
*/
|
||||
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
|
||||
// cMenuEditStrItem cMenuEditStraItem cMenuEditIntItem
|
||||
Add(new cMenuEditBoolItem(tr("Make primary device"), &MakePrimary,
|
||||
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)
|
||||
{
|
||||
SetupStore("MakePrimary", MakePrimary);
|
||||
SetupStore("Deinterlace", Deinterlace);
|
||||
SetupStore("Scaling", Scaling);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -451,11 +465,11 @@ void cSoftHdDevice::StillPicture(
|
||||
}
|
||||
|
||||
bool cSoftHdDevice::Poll(
|
||||
__attribute__ ((unused)) cPoller & poller, __attribute__ ((unused))
|
||||
int timeout_ms)
|
||||
__attribute__ ((unused)) cPoller & poller, int timeout_ms)
|
||||
{
|
||||
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
||||
return true;
|
||||
dsyslog("[softhddev]%s: %d\n", __FUNCTION__, timeout_ms);
|
||||
|
||||
return ::Poll(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);
|
||||
|
||||
::PlayVideo(data, length);
|
||||
|
||||
return length;
|
||||
return ::PlayVideo(data, length);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -728,6 +740,16 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
|
||||
ConfigMakePrimary = atoi(value);
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user