summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Hanisch <dvb@flensrocker.de>2010-03-18 21:44:17 +0100
committerLars Hanisch <dvb@flensrocker.de>2010-03-18 21:44:17 +0100
commite1b2fc176c912bd9dca665ecae129f87b8f39909 (patch)
treece2e6b43e1c168fb2bfd0af9995978b226534d78
parent74b2bcef2a7c9576a4c841d8a1d256cb59f4acc1 (diff)
downloadvdr-plugin-pvrinput-e1b2fc176c912bd9dca665ecae129f87b8f39909.tar.gz
vdr-plugin-pvrinput-e1b2fc176c912bd9dca665ecae129f87b8f39909.tar.bz2
global code review and minor style cleanups
-rw-r--r--common.c110
-rw-r--r--common.h6
-rw-r--r--device.c809
-rw-r--r--device.h30
-rw-r--r--filter.c60
-rw-r--r--filter.h4
-rw-r--r--global.h3
-rw-r--r--menu.c566
-rw-r--r--menu.h6
-rw-r--r--pvrinput.c135
-rw-r--r--pvrinput.h18
-rw-r--r--reader.c148
-rw-r--r--reader.h16
-rw-r--r--setup.c7
-rw-r--r--setup.h4
15 files changed, 926 insertions, 996 deletions
diff --git a/common.c b/common.c
index 1ff6b65..a4a3f07 100644
--- a/common.c
+++ b/common.c
@@ -1,6 +1,7 @@
#include "common.h"
-void log(int level, const char * fmt, ...) {
+void log(int level, const char *fmt, ...)
+{
char tmpstr[BUFSIZ];
char timestr[16];
va_list ap;
@@ -8,27 +9,28 @@ void log(int level, const char * fmt, ...) {
struct tm local;
if (PvrSetup.LogLevel >= level) {
- va_start(ap, fmt);
- time(&now);
- localtime_r(&now, &local);
- vsnprintf(tmpstr, sizeof(tmpstr), fmt, ap);
- strftime(timestr, sizeof(timestr), "%H:%M:%S", &local);
- printf("pvrinput: %s %s\n", timestr, tmpstr);
- switch (level) {
- case pvrERROR:
- esyslog("%s",tmpstr);
- break;
- case pvrINFO:
- isyslog("%s",tmpstr);
- break;
- case pvrDEBUG1:
- case pvrDEBUG2:
- default:
- dsyslog("%s",tmpstr);
- break;
- }
- va_end(ap);
- }
+ va_start(ap, fmt);
+ time(&now);
+ localtime_r(&now, &local);
+ vsnprintf(tmpstr, sizeof(tmpstr), fmt, ap);
+ strftime(timestr, sizeof(timestr), "%H:%M:%S", &local);
+ printf("pvrinput: %s %s\n", timestr, tmpstr);
+ switch (level) {
+ case pvrERROR:
+ esyslog("%s",tmpstr);
+ break;
+ case pvrINFO:
+ isyslog("%s",tmpstr);
+ break;
+ case pvrDEBUG1:
+ case pvrDEBUG2:
+ case pvrDEBUG3:
+ default:
+ dsyslog("%s",tmpstr);
+ break;
+ }
+ va_end(ap);
+ }
}
/*
@@ -36,23 +38,24 @@ function IOCTL
retries the ioctl given six times before giving up,
improves stability if device/driver is actually busy
*/
-int IOCTL(int fd, int cmd, void *data) {
- if (fd <0) {
- log(pvrERROR, "Error IOCTL %s: %s is not open", cmd, fd);
- return (-1);
- }
+int IOCTL(int fd, int cmd, void *data)
+{
+ if (fd < 0) {
+ log(pvrERROR, "Error IOCTL %s: %s is not open", cmd, fd);
+ return -1;
+ }
for (int retry = 5; retry >= 0; ) {
- if (ioctl(fd, cmd, data) != 0) {
- if (retry){
- usleep(20000); /* 20msec */
- retry--;
- continue;
- }
- return -1;
+ if (ioctl(fd, cmd, data) != 0) {
+ if (retry) {
+ usleep(20000); /* 20msec */
+ retry--;
+ continue;
+ }
+ return -1;
+ }
+ else
+ return 0; /* all went okay :) */
}
- else
- return 0; /* all went okay :) */
- }
return 0; /* should never reach this */
}
@@ -62,14 +65,14 @@ and returns it as rounded 0..100% integer value
-wirbel-
*/
-int IntVal2Percent(int NumVal, int MinVal, int MaxVal){
- double t=0;
- log(pvrDEBUG1, "IntVal2Percent(NumVal=%d, MinVal=%d, MaxVal=%d)\n",
- NumVal, MinVal, MaxVal);
- t=(double) (MaxVal - MinVal);
- t=(NumVal-MinVal)/t;
- t=100.0*t + 0.5; /* rounding to nearest int) */
- return (int) t;
+int IntVal2Percent(int NumVal, int MinVal, int MaxVal)
+{
+ double t = 0;
+ log(pvrDEBUG1, "IntVal2Percent(NumVal=%d, MinVal=%d, MaxVal=%d)", NumVal, MinVal, MaxVal);
+ t = (double)(MaxVal - MinVal);
+ t = (NumVal - MinVal) / t;
+ t = 100.0 * t + 0.5; /* rounding to nearest int) */
+ return (int)t;
}
/*
@@ -77,13 +80,12 @@ This function takes a 0..100% integer value
and returns it as rounded ivtv V4L2 integer value
-wirbel-
*/
-
-int Percent2IntVal(int Percent, int MinVal, int MaxVal){
- double t=0;
- log(pvrDEBUG1, "Percent2IntVal(Percent=%d, MinVal=%d, MaxVal=%d)\n",
- Percent, MinVal, MaxVal);
- t=Percent/100.0;
- t=0.5 + t*(MaxVal-MinVal); /* +0.5 is rounding to int */
- t=MinVal+t;
- return (int) t;
+int Percent2IntVal(int Percent, int MinVal, int MaxVal)
+{
+ double t = 0;
+ log(pvrDEBUG1, "Percent2IntVal(Percent=%d, MinVal=%d, MaxVal=%d)", Percent, MinVal, MaxVal);
+ t = Percent / 100.0;
+ t = 0.5 + t * (MaxVal - MinVal); /* +0.5 is rounding to int */
+ t = MinVal + t;
+ return (int)t;
}
diff --git a/common.h b/common.h
index aeed142..a7a617d 100644
--- a/common.h
+++ b/common.h
@@ -1,5 +1,5 @@
-#ifndef _PVR_COMMON_H_
-#define _PVR_COMMON_H_
+#ifndef _PVRINPUT_COMMON_H_
+#define _PVRINPUT_COMMON_H_
enum eLogLevel { pvrUNUSED, pvrERROR, pvrINFO, pvrDEBUG1, pvrDEBUG2, pvrDEBUG3 };
@@ -37,7 +37,7 @@ enum eLogLevel { pvrUNUSED, pvrERROR, pvrINFO, pvrDEBUG1, pvrDEBUG2, pvrDEBUG3 }
#endif //VDRVERSNUM < 10507
-void log(int level, const char * fmt, ...);
+void log(int level, const char *fmt, ...);
int IOCTL(int fd, int cmd, void *data);
diff --git a/device.c b/device.c
index 998ef48..67c8b13 100644
--- a/device.c
+++ b/device.c
@@ -15,7 +15,7 @@ char CARDNAME[][9] = {
"undef", "PVR150", "PVR250", "PVR350", "PVR500#1", "PVR500#2", "HVR1300", "HVR1600", "HVR1900", "HVR1950", "PVRUSB2", "HDPVR"
};
-cPvrDevice * PvrDevices[kMaxPvrDevices];
+cPvrDevice *PvrDevices[kMaxPvrDevices];
cString cPvrDevice::externChannelSwitchScript;
@@ -30,7 +30,7 @@ private:
public:
cPvrSourceParam();
cString ParametersToString(void) const;
- void ParseParameters(const char* Parameters);
+ void ParseParameters(const char *Parameters);
virtual void SetData(cChannel *Channel);
virtual void GetData(cChannel *Channel);
virtual cOsdItem *GetOsdItem(void);
@@ -40,14 +40,14 @@ public:
static const char sSourceID = 'V';
static const uint stPvr = (sSourceID << 24);
static const int sNumInputs = 12;
- static const char* sInputs[];
+ static const char *sInputs[];
static const int sNumCards = 9;
- static const char* sCards[];
+ static const char *sCards[];
static const int sNumStandards = 31;
- static const char* sStandards[];
+ static const char *sStandards[];
};
-const char* cPvrSourceParam::sInputs[] = {
+const char *cPvrSourceParam::sInputs[] = {
"TV",
"RADIO",
"COMPOSITE0",
@@ -62,7 +62,7 @@ const char* cPvrSourceParam::sInputs[] = {
"COMPONENT"
};
-const char* cPvrSourceParam::sCards[] = {
+const char *cPvrSourceParam::sCards[] = {
"",
"CARD0",
"CARD1",
@@ -74,7 +74,7 @@ const char* cPvrSourceParam::sCards[] = {
"CARD7"
};
-const char* cPvrSourceParam::sStandards[] = {
+const char *cPvrSourceParam::sStandards[] = {
"",
"PAL",
"NTSC",
@@ -120,24 +120,25 @@ cPvrSourceParam::cPvrSourceParam()
cString cPvrSourceParam::ParametersToString(void) const
{
if ((standard == 0) && (card == 0))
- return cString::sprintf("%s", sInputs[input]);
+ return cString::sprintf("%s", sInputs[input]);
if ((standard == 0) && (card != 0))
- return cString::sprintf("%s|%s", sInputs[input], sCards[card]);
+ return cString::sprintf("%s|%s", sInputs[input], sCards[card]);
if ((standard != 0) && (card == 0))
- return cString::sprintf("%s|%s", sInputs[input], sStandards[standard]);
+ return cString::sprintf("%s|%s", sInputs[input], sStandards[standard]);
return cString::sprintf("%s|%s|%s", sInputs[input], sCards[card], sStandards[standard]);
}
-void cPvrSourceParam::ParseParameters(const char* Parameters) {
- char * Input = NULL;
- char * optArg[2] = { NULL, NULL };
+void cPvrSourceParam::ParseParameters(const char *Parameters)
+{
+ char *Input = NULL;
+ char *optArg[2] = { NULL, NULL };
int NumArgs = sscanf(Parameters, "%a[^|]|%a[^|]|%a[^:\n]", &Input, &optArg[0], &optArg[1]);
input = 0;
card = 0;
standard = 0;
if (NumArgs >= 1) {
for (int i = 0; sInputs[i]; i++) {
- if (!strcasecmp (Input, sInputs[i])) {
+ if (!strcasecmp(Input, sInputs[i])) {
input = i;
break;
}
@@ -147,7 +148,7 @@ void cPvrSourceParam::ParseParameters(const char* Parameters) {
if (NumArgs >= (opt + 2)) {
bool parsed = false;
for (int c = 1; sCards[c]; c++) {
- if (!strcasecmp (optArg[opt], sCards[c])) {
+ if (!strcasecmp(optArg[opt], sCards[c])) {
card = c;
parsed = true;
break;
@@ -155,7 +156,7 @@ void cPvrSourceParam::ParseParameters(const char* Parameters) {
}
if (!parsed) {
for (int s = 1; sStandards[s]; s++) {
- if (!strcasecmp (optArg[opt], sStandards[s])) {
+ if (!strcasecmp(optArg[opt], sStandards[s])) {
standard = s;
break;
}
@@ -189,19 +190,21 @@ cOsdItem *cPvrSourceParam::GetOsdItem(void)
return NULL;
}
-bool cPvrSourceParam::IsPvr(int Code) {
+bool cPvrSourceParam::IsPvr(int Code)
+{
return (Code & cSource::st_Mask) == stPvr;
}
#endif
-static void cPvrSourceParam_Initialize() {
+static void cPvrSourceParam_Initialize()
+{
#ifdef PVR_SOURCEPARAMS
new cPvrSourceParam();
#endif
}
cPvrDevice::cPvrDevice(int DeviceNumber)
-: number(DeviceNumber),
+: number(DeviceNumber),
frequency(-1),
CurrentNorm(0), //uint64_t can't be negative
CurrentLinesPerFrame(-1),
@@ -221,7 +224,8 @@ cPvrDevice::cPvrDevice(int DeviceNumber)
cardname(UNDEF),
tsBufferPrefill(0),
readThread(0)
-{ log(pvrDEBUG2,"new cPvrDevice (%d)", number);
+{
+ log(pvrDEBUG2, "new cPvrDevice (%d)", number);
v4l2_fd = mpeg_fd = radio_fd = -1;
v4l2_dev = mpeg_dev = radio_dev = -1;
vpid = apid = tpid = -1;
@@ -234,65 +238,61 @@ cPvrDevice::cPvrDevice(int DeviceNumber)
v4l2_dev = number;
devName = cString::sprintf("/dev/video%d", v4l2_dev);
v4l2_fd = open(devName, O_RDWR);
- if (v4l2_fd < 0) {
- log(pvrERROR, "cPvrDevice::cPvrDevice(): error opening video device %s: %s",
- *devName, strerror(errno));
- }
+ if (v4l2_fd < 0)
+ log(pvrERROR, "cPvrDevice::cPvrDevice(): error opening video device %s: %s", *devName, strerror(errno));
memset(&video_vcap, 0, sizeof(video_vcap));
IOCTL(v4l2_fd, VIDIOC_QUERYCAP, &video_vcap);
log(pvrDEBUG1, "%s = %s", *devName, video_vcap.card);
BusID = cString::sprintf("%s", video_vcap.bus_info);
log(pvrDEBUG1, "BusID = %s", *BusID);
- if (!memcmp(video_vcap.driver, "ivtv",4)) driver = ivtv;
- else if (!memcmp(video_vcap.driver, "cx18",4)) driver = cx18;
- else if (!memcmp(video_vcap.driver, "pvrusb2",7)) driver = pvrusb2;
- else if (!memcmp(video_vcap.driver, "cx88_blackbird",14)) driver = cx88_blackbird;
- else if (!memcmp(video_vcap.driver, "hdpvr",5)) driver = hdpvr;
+ if (!memcmp(video_vcap.driver, "ivtv", 4)) driver = ivtv;
+ else if (!memcmp(video_vcap.driver, "cx18", 4)) driver = cx18;
+ else if (!memcmp(video_vcap.driver, "pvrusb2", 7)) driver = pvrusb2;
+ else if (!memcmp(video_vcap.driver, "cx88_blackbird", 14)) driver = cx88_blackbird;
+ else if (!memcmp(video_vcap.driver, "hdpvr", 5)) driver = hdpvr;
else { driver = undef; log(pvrDEBUG1, "unknown video driver: \"%s\"",video_vcap.driver); }
- if (!memcmp(video_vcap.card, "Hauppauge WinTV PVR-150",23)) cardname = PVR150;
- else if (!memcmp(video_vcap.card, "Hauppauge WinTV PVR-250",23)) cardname = PVR250;
- else if (!memcmp(video_vcap.card, "Hauppauge WinTV PVR-350",23)) cardname = PVR350;
- else if (!memcmp(video_vcap.card, "WinTV PVR 500 (unit #1)",23)) cardname = PVR500_1;
- else if (!memcmp(video_vcap.card, "WinTV PVR 500 (unit #2)",23)) cardname = PVR500_2;
- else if (!memcmp(video_vcap.card, "Hauppauge WinTV-HVR1300",23)) cardname = HVR1300;
- else if (!memcmp(video_vcap.card, "Hauppauge HVR-1600",18)) cardname = HVR1600;
- else if (!memcmp(video_vcap.card, "WinTV HVR-1900",14)) cardname = HVR1900;
- else if (!memcmp(video_vcap.card, "WinTV HVR-1950",14)) cardname = HVR1950;
- else if (!memcmp(video_vcap.card, "WinTV PVR USB2",14)) cardname = PVRUSB2;
- else if (!memcmp(video_vcap.card, "Hauppauge HD PVR",16)) cardname = HDPVR;
- else if (!memcmp(video_vcap.card, "Haupauge HD PVR",15)) cardname = HDPVR; // spelling error in hdpvr
+ if (!memcmp(video_vcap.card, "Hauppauge WinTV PVR-150", 23)) cardname = PVR150;
+ else if (!memcmp(video_vcap.card, "Hauppauge WinTV PVR-250", 23)) cardname = PVR250;
+ else if (!memcmp(video_vcap.card, "Hauppauge WinTV PVR-350", 23)) cardname = PVR350;
+ else if (!memcmp(video_vcap.card, "WinTV PVR 500 (unit #1)", 23)) cardname = PVR500_1;
+ else if (!memcmp(video_vcap.card, "WinTV PVR 500 (unit #2)", 23)) cardname = PVR500_2;
+ else if (!memcmp(video_vcap.card, "Hauppauge WinTV-HVR1300", 23)) cardname = HVR1300;
+ else if (!memcmp(video_vcap.card, "Hauppauge HVR-1600", 18)) cardname = HVR1600;
+ else if (!memcmp(video_vcap.card, "WinTV HVR-1900", 14)) cardname = HVR1900;
+ else if (!memcmp(video_vcap.card, "WinTV HVR-1950", 14)) cardname = HVR1950;
+ else if (!memcmp(video_vcap.card, "WinTV PVR USB2", 14)) cardname = PVRUSB2;
+ else if (!memcmp(video_vcap.card, "Hauppauge HD PVR", 16)) cardname = HDPVR;
+ else if (!memcmp(video_vcap.card, "Haupauge HD PVR", 15)) cardname = HDPVR; // spelling error in hdpvr
else { cardname = UNDEF; log(pvrDEBUG1, "unknown video card: \"%s\"",video_vcap.card); }
- if (cardname == HVR1300) log(pvrERROR, "HVR 1300 is not really supported yet");
+ if (cardname == HVR1300)
+ log(pvrERROR, "HVR 1300 is not really supported yet");
driver_apiversion = video_vcap.version;
log(pvrDEBUG1, "%s Version 0x%06x", DRIVERNAME[driver], driver_apiversion);
if ((video_vcap.capabilities & V4L2_CAP_SLICED_VBI_CAPTURE) && (driver != pvrusb2)) {
/*The pvrusb2 driver advertises vbi capability, although it isn't there.
This was fixed in v4l-dvb hg in 01/2009 and will hopefully be in Kernel 2.6.30*/
SupportsSlicedVBI = true;
- log(pvrDEBUG1, "%s supports sliced VBI Capture",*devName);
- }
- if (video_vcap.capabilities & V4L2_CAP_VIDEO_OUTPUT_OVERLAY) {
- hasDecoder = true; //can only be a PVR350
+ log(pvrDEBUG1, "%s supports sliced VBI Capture", *devName);
}
- for (i=0; i<kMaxPvrDevices; i++) {
+ if (video_vcap.capabilities & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)
+ hasDecoder = true; //can only be a PVR350
+ for (i = 0; i < kMaxPvrDevices; i++) {
if (radio_dev<0 && (video_vcap.capabilities & V4L2_CAP_RADIO)) { //searching matching radio dev
devName = cString::sprintf("/dev/radio%d", i);
radio_fd = open(devName, O_RDWR);
if (radio_fd >= 0) {
memset(&capability, 0, sizeof(capability));
- if (IOCTL(radio_fd, VIDIOC_QUERYCAP, &capability) !=0) {
- log(pvrERROR, "VIDIOC_QUERYCAP failed, %d:%s",
- errno, strerror(errno));
- }
- if (!strncmp(*BusID,(const char *) capability.bus_info, strlen(*BusID)-1)) {
- radio_dev=i; // store info for later
+ if (IOCTL(radio_fd, VIDIOC_QUERYCAP, &capability) != 0)
+ log(pvrERROR, "VIDIOC_QUERYCAP failed, %d:%s", errno, strerror(errno));
+ if (!strncmp(*BusID, (const char*)capability.bus_info, strlen(*BusID) - 1)) {
+ radio_dev = i; // store info for later
log(pvrDEBUG1, "/dev/radio%d = FM radio dev",radio_dev);
}
close(radio_fd); // a pvrusb2 will remain on input 3. The bool FirstChannelSwitch will solve this later
radio_fd = -1;
}
}
- if (mpeg_dev<0 && (driver == cx88_blackbird)) { // the blackbird uses two (!) different devices, search the other one.
+ if (mpeg_dev < 0 && (driver == cx88_blackbird)) { // the blackbird uses two (!) different devices, search the other one.
close(v4l2_fd);
v4l2_fd = -1;
devName = cString::sprintf("/dev/video%d", i);
@@ -300,12 +300,12 @@ cPvrDevice::cPvrDevice(int DeviceNumber)
if (mpeg_fd) {
memset(&capability, 0, sizeof(capability));
IOCTL(mpeg_fd, VIDIOC_QUERYCAP, &capability);
- if (!strncmp(*BusID ,(const char *) capability.bus_info, strlen(*BusID)-1) &&
- !strcmp("cx8800",(const char *) capability.driver)) {
+ if (!strncmp(*BusID, (const char*)capability.bus_info, strlen(*BusID) - 1)
+ && !strcmp("cx8800", (const char*)capability.driver)) {
mpeg_dev = v4l2_dev; //for this driver we found mpeg_dev up to now.
v4l2_dev = i; //reassigning, now with correct value.
- log(pvrDEBUG1, "/dev/video%d = v4l2 dev (analog properties: volume/hue/brightness/inputs..)",v4l2_dev);
- log(pvrDEBUG1, "/dev/video%d = mpeg dev (MPEG properties: bitrates/frame rate/filters..)",mpeg_dev);
+ log(pvrDEBUG1, "/dev/video%d = v4l2 dev (analog properties: volume/hue/brightness/inputs..)", v4l2_dev);
+ log(pvrDEBUG1, "/dev/video%d = mpeg dev (MPEG properties: bitrates/frame rate/filters..)", mpeg_dev);
}
close(mpeg_fd);
mpeg_fd = -1;
@@ -333,32 +333,31 @@ cPvrDevice::cPvrDevice(int DeviceNumber)
for (i = 0;; i++) {
memset(&input, 0, sizeof(input));
input.index = i;
- if (IOCTL(v4l2_fd, VIDIOC_ENUMINPUT, &input) == -1) {
+ if (IOCTL(v4l2_fd, VIDIOC_ENUMINPUT, &input) == -1)
break;
- }
else {
log(pvrDEBUG1, "input %d = %s", i, input.name);
numInputs++;
}
- if (!memcmp(input.name, "Tuner", 5)) { inputs[eTelevision]=inputs[eRadio]=i; continue; } //ivtv: Radio and TV tuner are same input.
- else if (!memcmp(input.name, "television", 10)) { inputs[eTelevision]=i; continue; } //pvrusb2
- else if (!memcmp(input.name, "Television", 10)) { inputs[eTelevision]=i; continue; } //cx88_blackbird
- else if (!memcmp(input.name, "radio", 5)) { inputs[eRadio] =i; continue; } //pvrusb2
- else if (!memcmp(input.name, "Composite 0", 11)) { inputs[eComposite0]=i; continue; }
- else if (!memcmp(input.name, "Composite 1", 11)) { inputs[eComposite1]=i; continue; }
- else if (!memcmp(input.name, "Composite 2", 11)) { inputs[eComposite2]=i; continue; }
- else if (!memcmp(input.name, "Composite 3", 11)) { inputs[eComposite3]=i; continue; }
- else if (!memcmp(input.name, "Composite 4", 11)) { inputs[eComposite4]=i; continue; }
- else if (!memcmp(input.name, "Composite1", 10)) { inputs[eComposite1]=i; continue; } //cx88_blackbird
- else if (!memcmp(input.name, "composite", 9)) { inputs[eComposite0]=i; continue; } //pvrusb2
- else if (!memcmp(input.name, "Composite", 9)) { inputs[eComposite0]=i; continue; } //hdpvr
- else if (!memcmp(input.name, "S-Video 3", 9)) { inputs[eSVideo3] =i; continue; }
- else if (!memcmp(input.name, "S-Video 0", 9)) { inputs[eSVideo0] =i; continue; }
- else if (!memcmp(input.name, "S-Video 1", 9)) { inputs[eSVideo1] =i; continue; }
- else if (!memcmp(input.name, "S-Video 2", 9)) { inputs[eSVideo2] =i; continue; }
- else if (!memcmp(input.name, "S-Video", 7)) { inputs[eSVideo0] =i; continue; } //cx88_blackbird & hdpvr
- else if (!memcmp(input.name, "s-video", 7)) { inputs[eSVideo0] =i; continue; } //pvrusb2
- else if (!memcmp(input.name, "Component", 9)) { inputs[eComponent] =i; continue; } //hdpvr
+ if (!memcmp(input.name, "Tuner", 5)) { inputs[eTelevision] = inputs[eRadio] = i; continue; } //ivtv: Radio and TV tuner are same input.
+ else if (!memcmp(input.name, "television", 10)) { inputs[eTelevision] = i; continue; } //pvrusb2
+ else if (!memcmp(input.name, "Television", 10)) { inputs[eTelevision] = i; continue; } //cx88_blackbird
+ else if (!memcmp(input.name, "radio", 5)) { inputs[eRadio] = i; continue; } //pvrusb2
+ else if (!memcmp(input.name, "Composite 0", 11)) { inputs[eComposite0] = i; continue; }
+ else if (!memcmp(input.name, "Composite 1", 11)) { inputs[eComposite1] = i; continue; }
+ else if (!memcmp(input.name, "Composite 2", 11)) { inputs[eComposite2] = i; continue; }
+ else if (!memcmp(input.name, "Composite 3", 11)) { inputs[eComposite3] = i; continue; }
+ else if (!memcmp(input.name, "Composite 4", 11)) { inputs[eComposite4] = i; continue; }
+ else if (!memcmp(input.name, "Composite1", 10)) { inputs[eComposite1] = i; continue; } //cx88_blackbird
+ else if (!memcmp(input.name, "composite", 9)) { inputs[eComposite0] = i; continue; } //pvrusb2
+ else if (!memcmp(input.name, "Composite", 9)) { inputs[eComposite0] = i; continue; } //hdpvr
+ else if (!memcmp(input.name, "S-Video 3", 9)) { inputs[eSVideo3] = i; continue; }
+ else if (!memcmp(input.name, "S-Video 0", 9)) { inputs[eSVideo0] = i; continue; }
+ else if (!memcmp(input.name, "S-Video 1", 9)) { inputs[eSVideo1] = i; continue; }
+ else if (!memcmp(input.name, "S-Video 2", 9)) { inputs[eSVideo2] = i; continue; }
+ else if (!memcmp(input.name, "S-Video", 7)) { inputs[eSVideo0] = i; continue; } //cx88_blackbird & hdpvr
+ else if (!memcmp(input.name, "s-video", 7)) { inputs[eSVideo0] = i; continue; } //pvrusb2
+ else if (!memcmp(input.name, "Component", 9)) { inputs[eComponent] = i; continue; } //hdpvr
else log(pvrERROR, "unknown input %s. PLEASE SEND LOG TO MAINTAINER.", input.name);
}
if (inputs[eTelevision] >= 0)
@@ -389,19 +388,21 @@ cPvrDevice::cPvrDevice(int DeviceNumber)
StartSectionHandler();
}
-cPvrDevice::~cPvrDevice() {
+cPvrDevice::~cPvrDevice()
+{
#if VDRVERSNUM >= 10600
StopSectionHandler();
#endif
- cRingBufferLinear * tsBuffer_tmp = tsBuffer;
- log(pvrDEBUG2,"~cPvrDevice()");
+ cRingBufferLinear *tsBuffer_tmp = tsBuffer;
+ log(pvrDEBUG2, "~cPvrDevice()");
tsBuffer = NULL;
delete tsBuffer_tmp;
close(radio_fd);
close(v4l2_fd);
}
-bool cPvrDevice::Probe(int DeviceNumber) {
+bool cPvrDevice::Probe(int DeviceNumber)
+{
char device[256];
struct v4l2_capability vcap;
struct v4l2_format vfmt;
@@ -411,7 +412,7 @@ bool cPvrDevice::Probe(int DeviceNumber) {
memset(&vfmt, 0, sizeof(vfmt));
sprintf(device, "/dev/video%d", DeviceNumber);
v4l2_fd = open(device, O_RDONLY);
- if (v4l2_fd >=0) {
+ if (v4l2_fd >= 0) {
IOCTL(v4l2_fd, VIDIOC_QUERYCAP, &vcap);
if (!memcmp(vcap.driver, "ivtv",4) ||
!memcmp(vcap.driver, "cx18",4) ||
@@ -420,18 +421,20 @@ bool cPvrDevice::Probe(int DeviceNumber) {
found = true;
if (!memcmp(vcap.driver, "cx88_blackbird", 14)) {
vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if (! IOCTL(v4l2_fd, VIDIOC_G_FMT, &vfmt) &&
+ if (!IOCTL(v4l2_fd, VIDIOC_G_FMT, &vfmt) &&
(v4l2_fourcc('M','P','E','G') == vfmt.fmt.pix.pixelformat))
- found=true;
+ found = true;
}
close(v4l2_fd);
- if (found) log(pvrINFO, "cPvrDevice::Probe():found %s", vcap.card);
+ if (found)
+ log(pvrINFO, "cPvrDevice::Probe():found %s", vcap.card);
return found;
}
return false;
}
-bool cPvrDevice::Initialize(void) {
+bool cPvrDevice::Initialize(void)
+{
int found = 0;
cPvrSourceParam_Initialize();
for (int i = 0; i < kMaxPvrDevices; i++) {
@@ -449,7 +452,8 @@ bool cPvrDevice::Initialize(void) {
return found > 0;
}
-void cPvrDevice::Stop(void) {
+void cPvrDevice::Stop(void)
+{
/* recursively stop all threads inside pvrinputs devices */
for (int i = 0; i < kMaxPvrDevices; i++) {
if (PvrDevices[i]) {
@@ -463,49 +467,47 @@ void cPvrDevice::Stop(void) {
}
}
-void cPvrDevice::GetStandard(void) {
+void cPvrDevice::GetStandard(void)
+{
v4l2_std_id std;
if (IOCTL(v4l2_fd, VIDIOC_G_STD, &std) == -1) {
- log(pvrERROR, "error VIDIOC_G_STD on /dev/video%d (%s): %d:%s", \
- number, CARDNAME[cardname], errno, strerror(errno));
- }
- if (std & V4L2_STD_625_50) {
+ log(pvrERROR, "error VIDIOC_G_STD on /dev/video%d (%s): %d:%s",
+ number, CARDNAME[cardname], errno, strerror(errno));
+ }
+ if (std & V4L2_STD_625_50)
CurrentLinesPerFrame = 625;
- }
- else {
+ else
CurrentLinesPerFrame = 525;
- }
/* the driver will automatically set the height to 576 or 480 on each change */
CurrentNorm = std;
- log(pvrINFO, "cPvrDevice::CurrentNorm=0x%08llx, CurrentLinesPerFrame=%d on /dev/video%d (%s)", \
+ log(pvrINFO, "cPvrDevice::CurrentNorm=0x%08llx, CurrentLinesPerFrame=%d on /dev/video%d (%s)",
std, CurrentLinesPerFrame, number, CARDNAME[cardname]);
}
-void cPvrDevice::StopReadThread(void) {
+void cPvrDevice::StopReadThread(void)
+{
if (readThreadRunning) {
- log(pvrDEBUG2,"cPvrDevice::StopReadThread on /dev/video%d (%s): read thread exists, delete it", \
- number, CARDNAME[cardname]);
- cPvrReadThread * readThread_tmp = readThread;
+ log(pvrDEBUG2,"cPvrDevice::StopReadThread on /dev/video%d (%s): read thread exists, delete it", number, CARDNAME[cardname]);
+ cPvrReadThread *readThread_tmp = readThread;
readThread = NULL;
delete readThread_tmp;
- }
- else {
- log(pvrDEBUG2,"cPvrDevice::StopReadThread: no read thread running on /dev/video%d (%s)", \
- number, CARDNAME[cardname]);
}
+ else
+ log(pvrDEBUG2,"cPvrDevice::StopReadThread: no read thread running on /dev/video%d (%s)", number, CARDNAME[cardname]);
}
-void cPvrDevice::ReInitAll(void) {
- log(pvrDEBUG1,"cPvrDevice::ReInitAll");
+void cPvrDevice::ReInitAll(void)
+{
+ log(pvrDEBUG1, "cPvrDevice::ReInitAll");
int i;
for (i = 0; i < kMaxPvrDevices; i++) {
- if (PvrDevices[i]) {
+ if (PvrDevices[i])
PvrDevices[i]->ReInit();
- }
}
}
-int cPvrDevice::Count() {
+int cPvrDevice::Count()
+{
int count = 0;
for (int i = 0; i < kMaxPvrDevices; i++) {
if (PvrDevices[i])
@@ -514,7 +516,8 @@ int cPvrDevice::Count() {
return count;
}
-cPvrDevice * cPvrDevice::Get(int index) {
+cPvrDevice *cPvrDevice::Get(int index)
+{
int count = 0;
for (int i = 0; i < kMaxPvrDevices; i++) {
if (PvrDevices[i]) {
@@ -526,8 +529,9 @@ cPvrDevice * cPvrDevice::Get(int index) {
return NULL;
}
-void cPvrDevice::ReInit(void) {
- log(pvrDEBUG1,"cPvrDevice::ReInit /dev/video%d = %s (%s)", number, CARDNAME[cardname], DRIVERNAME[driver]);
+void cPvrDevice::ReInit(void)
+{
+ log(pvrDEBUG1, "cPvrDevice::ReInit /dev/video%d = %s (%s)", number, CARDNAME[cardname], DRIVERNAME[driver]);
SetTunerAudioMode(PvrSetup.TunerAudioMode);
SetInput(CurrentInput);
/* begin new v4l2 ivtv controls */
@@ -574,7 +578,8 @@ void cPvrDevice::ReInit(void) {
}
}
-bool cPvrDevice::Tune(eVideoInputs encoderInput, int freq) {
+bool cPvrDevice::Tune(eVideoInputs encoderInput, int freq)
+{
double fac = 16;
int freqaux = freq;
struct v4l2_frequency vf;
@@ -584,18 +589,17 @@ bool cPvrDevice::Tune(eVideoInputs encoderInput, int freq) {
memset(&vf, 0, sizeof(vf));
struct v4l2_tuner tuner;
memset(&tuner, 0, sizeof(tuner));
- if (IOCTL(v4l2_fd, VIDIOC_G_TUNER,&tuner) == 0) {
+ if (IOCTL(v4l2_fd, VIDIOC_G_TUNER,&tuner) == 0)
fac = (tuner.capability & V4L2_TUNER_CAP_LOW) ? 16000 : 16;
- }
vf.tuner = 0;
vf.type = tuner.type;
- vf.frequency = (int) ((double) freqaux * fac / 1000.0);
+ vf.frequency = (int)((double)freqaux * fac / 1000.0);
if (IOCTL(v4l2_fd, VIDIOC_S_FREQUENCY, &vf) == 0) {
- log(pvrDEBUG1, "cPvrDevice::Tune(): set Frequency on /dev/video%d (%s) to %.2f MHz (%d)", \
- number, CARDNAME[cardname], vf.frequency / fac, vf.frequency);
+ log(pvrDEBUG1, "cPvrDevice::Tune(): set Frequency on /dev/video%d (%s) to %.2f MHz (%d)",
+ number, CARDNAME[cardname], vf.frequency / fac, vf.frequency);
}
else {
- log(pvrERROR, "cPvrDevice::Tune(): error on /dev/video%d (%s) tuning to %.2f MHz (%d): %d:%s", \
+ log(pvrERROR, "cPvrDevice::Tune(): error on /dev/video%d (%s) tuning to %.2f MHz (%d): %d:%s",
number, CARDNAME[cardname], vf.frequency / fac, vf.frequency, errno, strerror(errno));
return false;
}
@@ -605,52 +609,52 @@ bool cPvrDevice::Tune(eVideoInputs encoderInput, int freq) {
return true;
}
-bool cPvrDevice::SetInput(int input) {
- if (input == CurrentInput && !FirstChannelSwitch) return true;
- log(pvrDEBUG1,"cPvrDevice::SetInput on /dev/video%d (%s) to %d", number, CARDNAME[cardname], input);
+bool cPvrDevice::SetInput(int input)
+{
+ if (input == CurrentInput && !FirstChannelSwitch)
+ return true;
+ log(pvrDEBUG1, "cPvrDevice::SetInput on /dev/video%d (%s) to %d", number, CARDNAME[cardname], input);
if (IOCTL(v4l2_fd, VIDIOC_S_INPUT, &input) != 0) {
log(pvrERROR, "VIDIOC_S_INPUT failed on /dev/video%d (%s) for input%d, %d:%s",
- number, CARDNAME[cardname], errno, strerror(errno));
+ number, CARDNAME[cardname], errno, strerror(errno));
return false;
}
#if 1 /* workaround for pvrusb2 driver bug: no audio after switching from radio to TV */
- if (input == 0 && CurrentInput == 3 && driver == pvrusb2) {
+ if ((input == 0) && (CurrentInput == 3) && (driver == pvrusb2)) {
usleep(200000); /* 200msec */
- log(pvrDEBUG2,"cPvrDevice::SetInput on /dev/video%d (%s) again to %d (workaround for driver bug)",
- number, CARDNAME[cardname], input);
+ log(pvrDEBUG2, "cPvrDevice::SetInput on /dev/video%d (%s) again to %d (workaround for driver bug)",
+ number, CARDNAME[cardname], input);
IOCTL(v4l2_fd, VIDIOC_S_INPUT, &input); //set input television again
}
#endif
- CurrentInput=input;
+ CurrentInput = input;
if (driver == pvrusb2) {
usleep(100000); /* 100msec */
- if (CurrentInput == inputs[eRadio]) {
- SetControlValue(&PvrSetup.AudioVolumeFM,
- PvrSetup.AudioVolumeFM.value);
- }
- else { //television or extern
+ if (CurrentInput == inputs[eRadio])
+ SetControlValue(&PvrSetup.AudioVolumeFM, PvrSetup.AudioVolumeFM.value);
+ else //television or extern
SetAudioVolumeTV();
- }
}
return true;
}
-bool cPvrDevice::SetAudioInput(int input) {
- struct v4l2_audio a;
+bool cPvrDevice::SetAudioInput(int input)
+{
+ struct v4l2_audio a;
a.index = input;
log(pvrDEBUG1,"cPvrDevice::SetAudioInput on /dev/video%d (%s) to %d", number, CARDNAME[cardname], input);
if (IOCTL(v4l2_fd, VIDIOC_S_AUDIO, &a) != 0) {
log(pvrERROR, "VIDIOC_S_AUDIO failed on /dev/video%d (%s) for input%d, %d:%s",
- number, CARDNAME[cardname], errno, strerror(errno));
+ number, CARDNAME[cardname], errno, strerror(errno));
return false;
}
return true;
}
-bool cPvrDevice::SetVideoNorm(uint64_t norm) {
- if (norm == CurrentNorm){
+bool cPvrDevice::SetVideoNorm(uint64_t norm)
+{
+ if (norm == CurrentNorm)
return true;
- }
log(pvrDEBUG1, "SetVideoNorm(0x%08llx) for /dev/video%d (%s)", norm, number, CARDNAME[cardname]);
if (hasDecoder) {
log(pvrDEBUG1, "cPvrDevice::we need to stop the PVR350 decoder");
@@ -658,65 +662,66 @@ bool cPvrDevice::SetVideoNorm(uint64_t norm) {
memset(&cmd, 0, sizeof(cmd));
cmd.cmd = VIDEO_CMD_STOP;
cmd.flags = VIDEO_CMD_STOP_TO_BLACK | VIDEO_CMD_STOP_IMMEDIATELY;
- if (IOCTL(v4l2_fd, VIDEO_COMMAND, &cmd) < 0) {
+ if (IOCTL(v4l2_fd, VIDEO_COMMAND, &cmd) < 0)
log(pvrERROR, "pvrinput: VIDEO_CMD_STOP error on /dev/video%d=%d:%s", number, strerror(errno));
- }
}
if (IOCTL(v4l2_fd, VIDIOC_S_STD, &norm) !=0) {
- log(pvrERROR, "cPvrDevice::SetVideoNorm() on /dev/video%d (%s) failed, %d:%s", \
- number, CARDNAME[cardname], errno, strerror(errno));
+ log(pvrERROR, "cPvrDevice::SetVideoNorm() on /dev/video%d (%s) failed, %d:%s",
+ number, CARDNAME[cardname], errno, strerror(errno));
return false;
}
- CurrentNorm=norm;
+ CurrentNorm = norm;
return true;
}
-bool cPvrDevice::SetVideoSize(int width, int height) {
- log(pvrDEBUG1,"cPvrDevice::SetVideoSize");
+bool cPvrDevice::SetVideoSize(int width, int height)
+{
+ log(pvrDEBUG1, "cPvrDevice::SetVideoSize");
struct v4l2_format vfmt;
-
vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (IOCTL(v4l2_fd, VIDIOC_G_FMT, &vfmt) != 0) {
- log(pvrERROR, "cPvrDevice::SetVideoSize(): VIDIOC_G_FMT failed on /dev/video%d (%s), %d:%s", \
- number, CARDNAME[cardname], errno, strerror(errno));
- return false;
- }
- vfmt.fmt.pix.width = width;
+ log(pvrERROR, "cPvrDevice::SetVideoSize(): VIDIOC_G_FMT failed on /dev/video%d (%s), %d:%s",
+ number, CARDNAME[cardname], errno, strerror(errno));
+ return false;
+ }
+ vfmt.fmt.pix.width = width;
vfmt.fmt.pix.height = height;
if (IOCTL(v4l2_fd, VIDIOC_S_FMT, &vfmt) != 0) {
- log(pvrERROR, "cPvrDevice::SetVideoSize(): VIDIOC_S_FMT failed on /dev/video%d (%s), %d:%s", \
- number, CARDNAME[cardname], errno, strerror(errno));
- return false;
- }
+ log(pvrERROR, "cPvrDevice::SetVideoSize(): VIDIOC_S_FMT failed on /dev/video%d (%s), %d:%s",
+ number, CARDNAME[cardname], errno, strerror(errno));
+ return false;
+ }
return true;
}
-void cPvrDevice::SetTunerAudioMode(int tuneraudiomode) {
+void cPvrDevice::SetTunerAudioMode(int tuneraudiomode)
+{
if (!hasTuner)
return;
- log(pvrDEBUG1, "cPvrDevice::SetTunerAudioMode(%s) on /dev/video%d (%s)", \
- tuneraudiomode == V4L2_TUNER_MODE_MONO?"mono":
- tuneraudiomode == V4L2_TUNER_MODE_STEREO?"stereo":
- tuneraudiomode == V4L2_TUNER_MODE_LANG1?"lang1":
- tuneraudiomode == V4L2_TUNER_MODE_LANG2?"lang2":"bilingual", \
+ log(pvrDEBUG1, "cPvrDevice::SetTunerAudioMode(%s) on /dev/video%d (%s)",
+ tuneraudiomode == V4L2_TUNER_MODE_MONO ? "mono" :
+ tuneraudiomode == V4L2_TUNER_MODE_STEREO ? "stereo" :
+ tuneraudiomode == V4L2_TUNER_MODE_LANG1 ? "lang1" :
+ tuneraudiomode == V4L2_TUNER_MODE_LANG2 ? "lang2" : "bilingual",
number, CARDNAME[cardname]);
struct v4l2_tuner vt;
memset(&vt, 0, sizeof(vt));
vt.audmode = tuneraudiomode;
if (IOCTL(v4l2_fd, VIDIOC_S_TUNER, &vt))
- log(pvrERROR, "cPvrDevice::SetTunerAudioMode(%d): error %d:%s on /dev/video%d (%s)", \
- tuneraudiomode, errno, strerror(errno), number, CARDNAME[cardname]);
+ log(pvrERROR, "cPvrDevice::SetTunerAudioMode(%d): error %d:%s on /dev/video%d (%s)",
+ tuneraudiomode, errno, strerror(errno), number, CARDNAME[cardname]);
}
-void cPvrDevice::SetAudioVolumeTV() {
- log(pvrDEBUG2, "AudioVolumeTVException.value=%d; AudioVolumeTVCommon.value=%d; number=%d, AudioVolumeTVExceptionCard=%d", \
+void cPvrDevice::SetAudioVolumeTV()
+{
+ log(pvrDEBUG2, "AudioVolumeTVException.value=%d; AudioVolumeTVCommon.value=%d; number=%d, AudioVolumeTVExceptionCard=%d",
PvrSetup.AudioVolumeTVException.value, PvrSetup.AudioVolumeTVCommon.value, number, PvrSetup.AudioVolumeTVExceptionCard);
- if ((PvrSetup.AudioVolumeTVExceptionCard >= 0 && PvrSetup.AudioVolumeTVExceptionCard <=7) \
- && (number == PvrSetup.AudioVolumeTVExceptionCard)) { //special value selected for a /dev/videoX number
- log(pvrDEBUG1, "cPvrDevice::SetAudioVolumeTVException %d for /dev/video%d (%s)", \
- PvrSetup.AudioVolumeTVException.value, number, CARDNAME[cardname]);
- SetControlValue(&PvrSetup.AudioVolumeTVException, PvrSetup.AudioVolumeTVException.value);
- }
+ if ((PvrSetup.AudioVolumeTVExceptionCard >= 0 && PvrSetup.AudioVolumeTVExceptionCard <= 7)
+ && (number == PvrSetup.AudioVolumeTVExceptionCard)) { //special value selected for a /dev/videoX number
+ log(pvrDEBUG1, "cPvrDevice::SetAudioVolumeTVException %d for /dev/video%d (%s)",
+ PvrSetup.AudioVolumeTVException.value, number, CARDNAME[cardname]);
+ SetControlValue(&PvrSetup.AudioVolumeTVException, PvrSetup.AudioVolumeTVException.value);
+ }
if (PvrSetup.AudioVolumeTVExceptionCard >= 9 && PvrSetup.AudioVolumeTVExceptionCard <=18) { //special value for card(s) with certain name
if ((cardname == PVR150 && PvrSetup.AudioVolumeTVExceptionCard ==9) ||
(cardname == PVR250 && PvrSetup.AudioVolumeTVExceptionCard ==10) ||
@@ -728,46 +733,46 @@ void cPvrDevice::SetAudioVolumeTV() {
(cardname == HVR1900 && PvrSetup.AudioVolumeTVExceptionCard ==16) ||
(cardname == HVR1950 && PvrSetup.AudioVolumeTVExceptionCard ==17) ||
(cardname == PVRUSB2 && PvrSetup.AudioVolumeTVExceptionCard ==18) ) {
- log(pvrDEBUG1, "cPvrDevice::SetAudioVolumeTVException %d for /dev/video%d (%s)", \
- PvrSetup.AudioVolumeTVException.value, number, CARDNAME[cardname]);
+ log(pvrDEBUG1, "cPvrDevice::SetAudioVolumeTVException %d for /dev/video%d (%s)",
+ PvrSetup.AudioVolumeTVException.value, number, CARDNAME[cardname]);
SetControlValue(&PvrSetup.AudioVolumeTVException, PvrSetup.AudioVolumeTVException.value);
}
}
else { //no special value (PvrSetup.AudioVolumeTVExceptionCard ==8)
- log(pvrDEBUG1, "cPvrDevice::SetAudioVolumeTVCommon %d for /dev/video%d (%s)", \
- PvrSetup.AudioVolumeTVCommon.value, number, CARDNAME[cardname]);
- SetControlValue(&PvrSetup.AudioVolumeTVCommon, PvrSetup.AudioVolumeTVCommon.value);
- }
+ log(pvrDEBUG1, "cPvrDevice::SetAudioVolumeTVCommon %d for /dev/video%d (%s)",
+ PvrSetup.AudioVolumeTVCommon.value, number, CARDNAME[cardname]);
+ SetControlValue(&PvrSetup.AudioVolumeTVCommon, PvrSetup.AudioVolumeTVCommon.value);
+ }
}
-void cPvrDevice::SetEncoderState(eEncState state) {
- log(pvrDEBUG1, "cPvrDevice::SetEncoderState (%s) for /dev/video%d (%s)", \
- state==eStop?"Stop":"Start", number, CARDNAME[cardname]);
+void cPvrDevice::SetEncoderState(eEncState state)
+{
+ log(pvrDEBUG1, "cPvrDevice::SetEncoderState (%s) for /dev/video%d (%s)", state == eStop ? "Stop" : "Start", number, CARDNAME[cardname]);
if (driver == ivtv || driver == cx18 || driver == hdpvr) {
struct v4l2_encoder_cmd encoderCommand;
memset(&encoderCommand, 0, sizeof(encoderCommand));
- switch(state) {
+ switch (state) {
case eStop : encoderCommand.cmd = V4L2_ENC_CMD_STOP; break;
case eStart : encoderCommand.cmd = V4L2_ENC_CMD_START; break;
}
- if (IOCTL(v4l2_fd, VIDIOC_ENCODER_CMD, &encoderCommand))
- log(pvrERROR, "cPvrDevice::SetEncoderState(%s): error %d:%s on /dev/video%d (%s)", \
- state==eStop?"Stop":"Start", errno, strerror(errno), number, CARDNAME[cardname]);
+ if (IOCTL(v4l2_fd, VIDIOC_ENCODER_CMD, &encoderCommand)) {
+ log(pvrERROR, "cPvrDevice::SetEncoderState(%s): error %d:%s on /dev/video%d (%s)",
+ state == eStop ? "Stop" : "Start", errno, strerror(errno), number, CARDNAME[cardname]);
+ }
}
if (driver == pvrusb2 && state == eStop) {
int retry_count = 5;
retry:
close(v4l2_fd);
v4l2_fd = -1;
- log(pvrDEBUG2, "cPvrDevice::SetEncoderState (eStop): /dev/video%d (%s) is closed", \
+ log(pvrDEBUG2, "cPvrDevice::SetEncoderState (eStop): /dev/video%d (%s) is closed",
number, CARDNAME[cardname]);
pvrusb2_ready = false;
- char * devName;
- if (asprintf(&devName, "/dev/video%d", number) != -1) {
+ char *devName;
+ if (asprintf(&devName, "/dev/video%d", number) != -1)
v4l2_fd = open(devName, O_RDWR); //reopen for tuning
- }
if (v4l2_fd < 0) {
- log(pvrERROR, "cPvrDevice::SetEncoderState(eStop): error reopening %s (%s): %d:%s", \
+ log(pvrERROR, "cPvrDevice::SetEncoderState(eStop): error reopening %s (%s): %d:%s",
CARDNAME[cardname], devName, errno, strerror(errno));
free(devName);
retry_count--;
@@ -775,7 +780,7 @@ void cPvrDevice::SetEncoderState(eEncState state) {
goto retry;
}
else {
- log(pvrDEBUG2, "cPvrDevice::SetEncoderState (eStop): %s (%s) successfully re-opened", \
+ log(pvrDEBUG2, "cPvrDevice::SetEncoderState (eStop): %s (%s) successfully re-opened",
devName, CARDNAME[cardname]);
pvrusb2_ready = true;
free(devName);
@@ -783,10 +788,10 @@ void cPvrDevice::SetEncoderState(eEncState state) {
}
}
-bool cPvrDevice::SetVBImode(int vbiLinesPerFrame, int vbistatus) {
- if (v4l2_fd >= 0 && SupportsSlicedVBI ) {
- log(pvrDEBUG1, "SetVBImode(%d, %d) on /dev/video%d (%s)", \
- vbiLinesPerFrame, vbistatus, number, CARDNAME[cardname]);
+bool cPvrDevice::SetVBImode(int vbiLinesPerFrame, int vbistatus)
+{
+ if (v4l2_fd >= 0 && SupportsSlicedVBI) {
+ log(pvrDEBUG1, "SetVBImode(%d, %d) on /dev/video%d (%s)", vbiLinesPerFrame, vbistatus, number, CARDNAME[cardname]);
struct v4l2_format vbifmt;
struct v4l2_ext_controls ctrls;
struct v4l2_ext_control ctrl;
@@ -797,12 +802,12 @@ bool cPvrDevice::SetVBImode(int vbiLinesPerFrame, int vbistatus) {
ctrl.value = vbistatus;
/* 0 = V4L2_MPEG_STREAM_VBI_FMT_NONE, No VBI in the MPEG stream
1 = V4L2_MPEG_STREAM_VBI_FMT_IVTV, VBI in private packets, IVTV format */
- ctrls.ctrl_class=V4L2_CTRL_CLASS_MPEG;
- ctrls.controls=&ctrl;
- ctrls.count=1;
+ ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
+ ctrls.controls = &ctrl;
+ ctrls.count = 1;
if (IOCTL(v4l2_fd, VIDIOC_S_EXT_CTRLS, &ctrls) != 0) {
log(pvrERROR, "cPvrDevice::SetVBImode(): error setting vbi mode (ctrls) on /dev/video%d (%s), %d:%s",
- number, CARDNAME[cardname], errno, strerror(errno));
+ number, CARDNAME[cardname], errno, strerror(errno));
return false;
}
if (ctrl.value == V4L2_MPEG_STREAM_VBI_FMT_IVTV && vbiLinesPerFrame == 625) {
@@ -822,9 +827,10 @@ bool cPvrDevice::SetVBImode(int vbiLinesPerFrame, int vbistatus) {
}
bool cPvrDevice::ParseChannel(const cChannel *Channel, int *input, uint64_t *norm, int *LinesPerFrame,
- int *card, eVideoInputs *encoderInput, int *apid, int *vpid, int *tpid) const {
- *card = 999;
- *norm = CurrentNorm; //make sure we have a value if channels.conf has no optArg for norm
+ int *card, eVideoInputs *encoderInput, int *apid, int *vpid, int *tpid) const
+{
+ *card = 999;
+ *norm = CurrentNorm; //make sure we have a value if channels.conf has no optArg for norm
*LinesPerFrame = CurrentLinesPerFrame; //see above
*input = -1;
if (Channel->IsCable() && Channel->Ca() == 0xA1) {
@@ -833,30 +839,29 @@ bool cPvrDevice::ParseChannel(const cChannel *Channel, int *input, uint64_t *nor
}
#ifdef PVR_SOURCEPARAMS
if (cPvrSourceParam::IsPvr(Channel->Source())) {
- const char * str = Channel->Parameters();
- const char * PluginId = "PVRINPUT";
- char * Input = NULL;
- char * optArg1 = NULL;
- char * optArg2 = NULL;
- int NumArgs = 1 + sscanf(str, "%a[^|]|%a[^|]|%a[^:\n]",
- &Input, &optArg1, &optArg2);
+ const char *str = Channel->Parameters();
+ const char *PluginId = "PVRINPUT";
+ char *Input = NULL;
+ char *optArg1 = NULL;
+ char *optArg2 = NULL;
+ int NumArgs = 1 + sscanf(str, "%a[^|]|%a[^|]|%a[^:\n]", &Input, &optArg1, &optArg2);
#else
if (Channel->IsPlug()) {
- const char * str = Channel->PluginParam();
- char * PluginId = NULL;
- char * Input = NULL;
- char * optArg1 = NULL;
- char * optArg2 = NULL;
- int NumArgs = sscanf(str, "%a[^|]|%a[^|]|%a[^|]|%a[^:\n]",
- &PluginId, &Input, &optArg1, &optArg2);
+ const char *str = Channel->PluginParam();
+ char *PluginId = NULL;
+ char *Input = NULL;
+ char *optArg1 = NULL;
+ char *optArg2 = NULL;
+ int NumArgs = sscanf(str, "%a[^|]|%a[^|]|%a[^|]|%a[^:\n]", &PluginId, &Input, &optArg1, &optArg2);
#endif
if (NumArgs >= 2) {
- if (strcasecmp(PluginId, "PVRINPUT")) return false;
+ if (strcasecmp(PluginId, "PVRINPUT"))
+ return false;
log(pvrDEBUG1, "cPvrDevice::ParseChannel: using iptv channel syntax.");
- *vpid = Channel->Vpid();
- *apid = Channel->Apid(0);
- *tpid = Channel->Tpid();
+ *vpid = Channel->Vpid();
+ *apid = Channel->Apid(0);
+ *tpid = Channel->Tpid();
if (!strcasecmp (Input, "RADIO")) *encoderInput=eRadio;
else if (!strcasecmp (Input, "TV")) *encoderInput=eTelevision;
else if (!strncasecmp(Input, "COMPOSITE",9)) *encoderInput=eExternalInput;
@@ -959,27 +964,27 @@ bool cPvrDevice::ParseChannel(const cChannel *Channel, int *input, uint64_t *nor
else if (!strcasecmp (optArg2, "CARD7")) *card = 7;
}
log(pvrDEBUG2, "ParseChannel %s input %d, norm=0x%08llx, card %d",
- (*encoderInput==eRadio)?"Radio":(*encoderInput==eTelevision)?"TV":"Ext",
- *input,*norm,*card);
+ (*encoderInput == eRadio) ? "Radio" : (*encoderInput == eTelevision) ? "TV" : "Ext", *input, *norm, *card);
return true;
}
}
return false;
}
-bool cPvrDevice::SetChannelDevice(const cChannel * Channel, bool LiveView) {
+bool cPvrDevice::SetChannelDevice(const cChannel * Channel, bool LiveView)
+{
log(pvrDEBUG1, "cPvrDevice::SetChannelDevice %d (%s) %3.2fMHz (/dev/video%d = %s)",
- Channel->Number(), Channel->Name(), (double) Channel->Frequency()/1000, number, CARDNAME[cardname]);
+ Channel->Number(), Channel->Name(), (double)Channel->Frequency() / 1000, number, CARDNAME[cardname]);
int input, LinesPerFrame, card;
uint64_t norm;
eVideoInputs encoderInput;
- if (! ParseChannel(Channel,&input,&norm,&LinesPerFrame,&card,&encoderInput,&apid,&vpid,&tpid))
+ if (!ParseChannel(Channel, &input, &norm, &LinesPerFrame, &card, &encoderInput, &apid, &vpid, &tpid))
return false;
if ((Channel->Number() == currentChannel.Number()) && (Channel->Frequency() == frequency) && (input == CurrentInput) && (norm == CurrentNorm))
return true;
log(pvrDEBUG1, "cPvrDevice::SetChannelDevice prepare switch to %d (%s) %3.2fMHz (/dev/video%d = %s)",
- Channel->Number(), Channel->Name(), (double) Channel->Frequency()/1000, number, CARDNAME[cardname]);
+ Channel->Number(), Channel->Name(), (double)Channel->Frequency() / 1000, number, CARDNAME[cardname]);
newFrequency = Channel->Frequency();
newInput = input;
newNorm = norm;
@@ -990,7 +995,8 @@ bool cPvrDevice::SetChannelDevice(const cChannel * Channel, bool LiveView) {
return true;
}
-bool cPvrDevice::SetPid(cPidHandle * Handle, int Type, bool On) {
+bool cPvrDevice::SetPid(cPidHandle * Handle, int Type, bool On)
+{
log(pvrDEBUG2, "cPvrDevice::SetPid %d = %s", Handle->pid, On?"On":"Off");
return true;
}
@@ -1012,15 +1018,15 @@ void cPvrDevice::CloseFilter(int Handle)
}
#endif
-bool cPvrDevice::OpenDvr(void) {
+bool cPvrDevice::OpenDvr(void)
+{
log(pvrDEBUG1, "entering cPvrDevice::OpenDvr: Dvr of /dev/video%d (%s) is %s",
number, CARDNAME[cardname], (dvrOpen)?"open":"closed");
delivered = false;
CloseDvr();
while (dvrOpen) { //wait until CloseDvr has finnished
usleep(40000);
- log(pvrDEBUG1, "OpenDvr: wait for CloseDvr on /dev/video%d (%s) to finnish", \
- number, CARDNAME[cardname]);
+ log(pvrDEBUG1, "OpenDvr: wait for CloseDvr on /dev/video%d (%s) to finnish", number, CARDNAME[cardname]);
}
tsBuffer->Clear();
ResetBuffering();
@@ -1035,8 +1041,7 @@ bool cPvrDevice::OpenDvr(void) {
if (driver == pvrusb2) {
while (!pvrusb2_ready) { //re-opening pvrusb2 in SetEncoderState might be in progress
usleep(40000);
- log(pvrDEBUG1, "OpenDvr: wait until /dev/video%d (%s) is ready", \
- number, CARDNAME[cardname]);
+ log(pvrDEBUG1, "OpenDvr: wait until /dev/video%d (%s) is ready", number, CARDNAME[cardname]);
}
}
switch (newEncoderInput) {
@@ -1045,14 +1050,13 @@ bool cPvrDevice::OpenDvr(void) {
case eComponent: //no break here, continuing at next case item
case eExternalInput:
{
- log(pvrDEBUG2,"channel is external input.");
+ log(pvrDEBUG2, "channel is external input.");
if (radio_fd >= 0) {
close(radio_fd);
radio_fd = -1;
usleep(100000); /* 100msec */
SetAudioVolumeTV();
- SetControlValue(&PvrSetup.VideoBitrateTV, \
- PvrSetup.VideoBitrateTV.value);
+ SetControlValue(&PvrSetup.VideoBitrateTV, PvrSetup.VideoBitrateTV.value);
}
if (PvrSetup.UseExternChannelSwitchScript) {
@@ -1060,9 +1064,8 @@ bool cPvrDevice::OpenDvr(void) {
*externChannelSwitchScript, currentChannel.Sid(), currentChannel.Number(),
number, currentChannel.Frequency());
log(pvrDEBUG1, "OpenDvr: calling %s", *cmd);
- if (system(*cmd) < 0) {
- log(pvrERROR, "OpenDvr: executing %s failed", *cmd);
- }
+ if (system(*cmd) < 0)
+ log(pvrERROR, "OpenDvr: executing %s failed", *cmd);
log(pvrDEBUG1, "OpenDvr: returned from %s", *cmd);
if (PvrSetup.ExternChannelSwitchSleep > 0) {
log(pvrDEBUG2, "OpenDvr: sleeping for %d seconds...", PvrSetup.ExternChannelSwitchSleep);
@@ -1071,60 +1074,67 @@ bool cPvrDevice::OpenDvr(void) {
}
}
- if (! SetInput(newInput)) return false;
- if (! SetVideoNorm(newNorm)) return false;
+ if (!SetInput(newInput))
+ return false;
+ if (!SetVideoNorm(newNorm))
+ return false;
frequency = newFrequency; // since we don't tune: set it here
EncoderInput = newEncoderInput;
break;
}
- case eRadio :
+ case eRadio:
{
log(pvrDEBUG2,"channel is FM radio.");
switch (driver) {
case ivtv:
case cx18:
- if (radio_dev < 0) return false; //no hardware support.
+ if (radio_dev < 0)
+ return false; //no hardware support.
if (radio_fd < 0) {
- char * devName;
- if (asprintf(&devName, "/dev/radio%d", radio_dev) != -1) {
+ char *devName;
+ if (asprintf(&devName, "/dev/radio%d", radio_dev) != -1)
radio_fd = open(devName, O_RDONLY);
- }
if (radio_fd < 0) {
- log(pvrERROR, "Error opening FM radio device %s: %s",\
- devName, strerror(errno));
+ log(pvrERROR, "Error opening FM radio device %s: %s", devName, strerror(errno));
return false;
}
free(devName);
usleep(100000); /* 100msec */
- SetControlValue(&PvrSetup.AudioVolumeFM, \
- PvrSetup.AudioVolumeFM.value);
+ SetControlValue(&PvrSetup.AudioVolumeFM, PvrSetup.AudioVolumeFM.value);
}
break;
case pvrusb2:
- if (! SetInput(inputs[eRadio])) return false;
+ if (!SetInput(inputs[eRadio]))
+ return false;
case cx88_blackbird:
case hdpvr:
break;
- case undef: log(pvrERROR, "driver is unknown!!"); return false;
+ case undef:
+ log(pvrERROR, "driver is unknown!!");
+ return false;
}
- if (! Tune(newEncoderInput, newFrequency)) return false;
+ if (!Tune(newEncoderInput, newFrequency))
+ return false;
break;
}
- case eTelevision :
+ case eTelevision:
{
- log(pvrDEBUG2,"channel is television.");
+ log(pvrDEBUG2, "channel is television.");
if ((driver == ivtv) && (radio_fd >= 0)) {
close(radio_fd);
radio_fd = -1;
usleep(100000); /* 100msec */
SetAudioVolumeTV();
- SetControlValue(&PvrSetup.VideoBitrateTV, \
- PvrSetup.VideoBitrateTV.value);
+ SetControlValue(&PvrSetup.VideoBitrateTV, PvrSetup.VideoBitrateTV.value);
}
- if (! SetInput(inputs[eTelevision])) return false;
- if (! SetVideoNorm(newNorm)) return false;
- if (! SetVBImode(newLinesPerFrame, PvrSetup.SliceVBI)) return false;
- if (! Tune(newEncoderInput, newFrequency)) return false;
+ if (!SetInput(inputs[eTelevision]))
+ return false;
+ if (!SetVideoNorm(newNorm))
+ return false;
+ if (!SetVBImode(newLinesPerFrame, PvrSetup.SliceVBI))
+ return false;
+ if (!Tune(newEncoderInput, newFrequency))
+ return false;
}
} //end: switch (newEncoderInput)
ChannelSettingsDone = true;
@@ -1132,19 +1142,20 @@ bool cPvrDevice::OpenDvr(void) {
} //end: if ((!ChannelSettingsDone)
SetEncoderState(eStart);
if (!readThreadRunning) {
- log(pvrDEBUG2, "cPvrDevice::OpenDvr: create new readThread on /dev/video%d (%s)", \
- number, CARDNAME[cardname]);
- readThread = new cPvrReadThread(tsBuffer, this);
- }
+ log(pvrDEBUG2, "cPvrDevice::OpenDvr: create new readThread on /dev/video%d (%s)", number, CARDNAME[cardname]);
+ readThread = new cPvrReadThread(tsBuffer, this);
+ }
} //end: if (!dvrOpen)
dvrOpen = true;
return true;
}
-void cPvrDevice::CloseDvr(void) {
- if (isClosing) return;
+void cPvrDevice::CloseDvr(void)
+{
+ if (isClosing)
+ return;
isClosing = true;
- log(pvrDEBUG2, "entering cPvrDevice::CloseDvr: Dvr of /dev/video%d (%s) is %s", \
+ log(pvrDEBUG2, "entering cPvrDevice::CloseDvr: Dvr of /dev/video%d (%s) is %s",
number, CARDNAME[cardname], (dvrOpen)?"open":"closed");
if (dvrOpen) {
StopReadThread();
@@ -1155,14 +1166,16 @@ void cPvrDevice::CloseDvr(void) {
isClosing = false;
}
-void cPvrDevice::ResetBuffering() {
+void cPvrDevice::ResetBuffering()
+{
tsBufferPrefill = (MEGABYTE(PvrSetup.TsBufferSizeMB) * PvrSetup.TsBufferPrefillRatio) / 100;
tsBufferPrefill -= (tsBufferPrefill % TS_SIZE);
log(pvrDEBUG2, "cPvrDevice::ResetBuffering(): tsBuffer prefill = %d for /dev/video%d (%s)",
tsBufferPrefill, number, CARDNAME[cardname]);
}
-bool cPvrDevice::IsBuffering() {
+bool cPvrDevice::IsBuffering()
+{
int avail = tsBuffer->Available();
if (tsBufferPrefill && (avail < tsBufferPrefill)) {
log(pvrDEBUG2, "cPvrDevice::IsBuffering(): available = %d, prefill = %d for /dev/video%d (%s)",
@@ -1173,11 +1186,11 @@ bool cPvrDevice::IsBuffering() {
return false;
}
-bool cPvrDevice::GetTSPacket(uchar *&Data) {
+bool cPvrDevice::GetTSPacket(uchar *&Data)
+{
int Count = 0;
- if (! tsBuffer ) {
- log(pvrERROR, "cPvrDevice::GetTSPacket(): no tsBuffer for /dev/video%d (%s)", \
- number, CARDNAME[cardname]);
+ if (!tsBuffer ) {
+ log(pvrERROR, "cPvrDevice::GetTSPacket(): no tsBuffer for /dev/video%d (%s)", number, CARDNAME[cardname]);
return false;
}
if (tsBuffer && readThreadRunning) {
@@ -1213,20 +1226,21 @@ bool cPvrDevice::GetTSPacket(uchar *&Data) {
return false;
}
-bool cPvrDevice::ProvidesSource(int Source) const {
+bool cPvrDevice::ProvidesSource(int Source) const
+{
#ifdef PVR_SOURCEPARAMS
if (cPvrSourceParam::IsPvr(Source)) {
#else
if (cSource::IsPlug(Source)) {
#endif
- log(pvrDEBUG1, "cPvrDevice::ProvidesSource Source=%s -> true",
- (const char *) cSource::ToString(Source));
+ log(pvrDEBUG1, "cPvrDevice::ProvidesSource Source=%s -> true", (const char*)cSource::ToString(Source));
return true;
}
return false;
}
-bool cPvrDevice::ProvidesTransponder(const cChannel * Channel) const {
+bool cPvrDevice::ProvidesTransponder(const cChannel *Channel) const
+{
return ProvidesSource(Channel->Source());
}
@@ -1235,52 +1249,52 @@ int cPvrDevice::NumProvidedSystems(void) const
return 1;
}
-bool cPvrDevice::ProvidesChannel(const cChannel * Channel, int Priority, \
- bool * NeedsDetachReceivers) const {
+bool cPvrDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) const
+{
bool result = false;
bool hasPriority = Priority < 0 || Priority > this->Priority();
bool needsDetachReceivers = true;
int input, LinesPerFrame, dev;
uint64_t norm;
- eVideoInputs encoderInput; //only dummy
- int audioPid,videoPid,teletextPid; //only dummy
- if (! ParseChannel(Channel, &input, &norm, &LinesPerFrame, &dev, &encoderInput, &audioPid, &videoPid, &teletextPid))
+ eVideoInputs encoderInput; //only dummy
+ int audioPid, videoPid, teletextPid; //only dummy
+ if (!ParseChannel(Channel, &input, &norm, &LinesPerFrame, &dev, &encoderInput, &audioPid, &videoPid, &teletextPid))
return false; // non-pvrinput channel or wrong syntax used, silently ignore this one
if ((dev < 999) && (number != dev)) {
log(pvrDEBUG1, "cPvrDevice::ProvidesChannel %s -> false (this is /dev/video%d, but CARD parameter says /dev/video%d only)",
Channel->Name(), number, dev);
return false;
}
- if ((PvrSetup.UseOnlyCard >= 0 && PvrSetup.UseOnlyCard <=7) && (number != PvrSetup.UseOnlyCard)) { //select by number
+ if ((PvrSetup.UseOnlyCard >= 0 && PvrSetup.UseOnlyCard <= 7) && (number != PvrSetup.UseOnlyCard)) { //select by number
log(pvrDEBUG1, "cPvrDevice::ProvidesChannel %s -> false (this is /dev/video%d, but /dev/video%d only was selected in setup)",
Channel->Name(), number, PvrSetup.UseOnlyCard);
return false;
}
- if (PvrSetup.UseOnlyCard >= 9 && PvrSetup.UseOnlyCard <=19) { //select by Name
- if ((cardname == PVR150 && PvrSetup.UseOnlyCard !=9) ||
- (cardname == PVR250 && PvrSetup.UseOnlyCard !=10) ||
- (cardname == PVR350 && PvrSetup.UseOnlyCard !=11) ||
- (cardname == PVR500_1 && PvrSetup.UseOnlyCard !=12) ||
- (cardname == PVR500_2 && PvrSetup.UseOnlyCard !=13) ||
- (cardname == HVR1300 && PvrSetup.UseOnlyCard !=14) ||
- (cardname == HVR1600 && PvrSetup.UseOnlyCard !=15) ||
- (cardname == HVR1900 && PvrSetup.UseOnlyCard !=16) ||
- (cardname == HVR1950 && PvrSetup.UseOnlyCard !=17) ||
- (cardname == PVRUSB2 && PvrSetup.UseOnlyCard !=18) ||
- (cardname == HDPVR && PvrSetup.UseOnlyCard !=19) ) {
+ if (PvrSetup.UseOnlyCard >= 9 && PvrSetup.UseOnlyCard <= 19) { //select by Name
+ if ((cardname == PVR150 && PvrSetup.UseOnlyCard != 9) ||
+ (cardname == PVR250 && PvrSetup.UseOnlyCard != 10) ||
+ (cardname == PVR350 && PvrSetup.UseOnlyCard != 11) ||
+ (cardname == PVR500_1 && PvrSetup.UseOnlyCard != 12) ||
+ (cardname == PVR500_2 && PvrSetup.UseOnlyCard != 13) ||
+ (cardname == HVR1300 && PvrSetup.UseOnlyCard != 14) ||
+ (cardname == HVR1600 && PvrSetup.UseOnlyCard != 15) ||
+ (cardname == HVR1900 && PvrSetup.UseOnlyCard != 16) ||
+ (cardname == HVR1950 && PvrSetup.UseOnlyCard != 17) ||
+ (cardname == PVRUSB2 && PvrSetup.UseOnlyCard != 18) ||
+ (cardname == HDPVR && PvrSetup.UseOnlyCard != 19) ) {
log(pvrDEBUG1, "cPvrDevice::ProvidesChannel %s -> false (this is %s, but %s only was selected in setup)",
- Channel->Name(),CARDNAME[cardname],
- PvrSetup.UseOnlyCard==9?"PVR150": \
- PvrSetup.UseOnlyCard==10?"PVR250": \
- PvrSetup.UseOnlyCard==11?"PVR350": \
- PvrSetup.UseOnlyCard==12?"PVR500#1": \
- PvrSetup.UseOnlyCard==13?"PVR500#2": \
- PvrSetup.UseOnlyCard==14?"HVR1300": \
- PvrSetup.UseOnlyCard==15?"HVR1600": \
- PvrSetup.UseOnlyCard==16?"HVR1900": \
- PvrSetup.UseOnlyCard==17?"HVR1950": \
- PvrSetup.UseOnlyCard==18?"PVRUSB2": \
- PvrSetup.UseOnlyCard==19?"HDPVR":"UNDEF");
+ Channel->Name(), CARDNAME[cardname],
+ PvrSetup.UseOnlyCard == 9 ? "PVR150" :
+ PvrSetup.UseOnlyCard == 10 ? "PVR250" :
+ PvrSetup.UseOnlyCard == 11 ? "PVR350" :
+ PvrSetup.UseOnlyCard == 12 ? "PVR500#1" :
+ PvrSetup.UseOnlyCard == 13 ? "PVR500#2" :
+ PvrSetup.UseOnlyCard == 14 ? "HVR1300" :
+ PvrSetup.UseOnlyCard == 15 ? "HVR1600" :
+ PvrSetup.UseOnlyCard == 16 ? "HVR1900" :
+ PvrSetup.UseOnlyCard == 17 ? "HVR1950" :
+ PvrSetup.UseOnlyCard == 18 ? "PVRUSB2" :
+ PvrSetup.UseOnlyCard == 19 ? "HDPVR" : "UNDEF");
return false;
}
}
@@ -1291,7 +1305,7 @@ bool cPvrDevice::ProvidesChannel(const cChannel * Channel, int Priority, \
}
}
if ((input < 0) || (input >= numInputs)) {
- log(pvrERROR, "cPvrDevice::ProvidesChannel: input %d unknown on /dev/video%d (%s)", \
+ log(pvrERROR, "cPvrDevice::ProvidesChannel: input %d unknown on /dev/video%d (%s)",
input, number, CARDNAME[cardname]);
return false;
}
@@ -1308,18 +1322,19 @@ bool cPvrDevice::ProvidesChannel(const cChannel * Channel, int Priority, \
result = hasPriority;
if (NeedsDetachReceivers)
*NeedsDetachReceivers = needsDetachReceivers;
- log(pvrDEBUG1, "cPvrDevice::ProvidesChannel: /dev/video%d (%s): Channel %d (%s) %3.2fMHz, -> %s", \
- number, CARDNAME[cardname], Channel->Number(), Channel->Name(), (double) Channel->Frequency()/1000, \
- result?"true":"false");
- log(pvrDEBUG2, "cPvrDevice::ProvidesChannel: /dev/video%d: Receiving()=%s, needsDetachReceivers=%s, Priority=%d, hasPriority=%s", \
- number, Receiving(true)?"true":"false", needsDetachReceivers?"true":"false", Priority, hasPriority?"true":"false");
+ log(pvrDEBUG1, "cPvrDevice::ProvidesChannel: /dev/video%d (%s): Channel %d (%s) %3.2fMHz, -> %s",
+ number, CARDNAME[cardname], Channel->Number(), Channel->Name(), (double)Channel->Frequency() / 1000,
+ result ? "true" : "false");
+ log(pvrDEBUG2, "cPvrDevice::ProvidesChannel: /dev/video%d: Receiving()=%s, needsDetachReceivers=%s, Priority=%d, hasPriority=%s",
+ number, Receiving(true) ? "true" : "false", needsDetachReceivers ? "true" : "false", Priority, hasPriority ? "true" : "false");
return result;
}
/*
if a card/driver has unsupported controls, it returns false for this
*/
-bool cPvrDevice::ControlIdIsValid(__u32 ctrlid) {
+bool cPvrDevice::ControlIdIsValid(__u32 ctrlid)
+{
if (driver == hdpvr) {
if (/*(ctrlid != V4L2_CID_BRIGHTNESS) // these controls seem to use other values for the HD PVR
&& (ctrlid != V4L2_CID_CONTRAST) // than the other PVRs (ioctl returns "invalid argument")
@@ -1347,126 +1362,122 @@ If possible, use THIS function for setting VIDIOC_S_EXT_CTRLS.
-wirbel-
*/
-int cPvrDevice::SetControlValue(struct valSet * vs, __s32 Val) {
+int cPvrDevice::SetControlValue(struct valSet * vs, __s32 Val)
+{
if (SetControlValue(vs->ctrl_class, vs->queryctrl.id, Val, vs->queryctrl) == 0) {
- vs->value = Val;
- return 0;
- }
- else
- return -1;
+ vs->value = Val;
+ return 0;
+ }
+ return -1;
}
/*
functionality as above, but no valSet needed.
*/
+int cPvrDevice::SetControlValue(__u32 control, __s32 Val)
+{
+ __u32 ctrl_class=V4L2_CTRL_CLASS_MPEG;
+ struct v4l2_queryctrl *query = 0;
-int cPvrDevice::SetControlValue(__u32 control, __s32 Val) {
-
-__u32 ctrl_class=V4L2_CTRL_CLASS_MPEG;
-struct v4l2_queryctrl * query;
-
-switch (control) {
+ switch (control) {
// picture properties
- case V4L2_CID_BRIGHTNESS: ctrl_class=V4L2_CTRL_CLASS_USER;
- query=&PvrSetup.Brightness.queryctrl;
+ case V4L2_CID_BRIGHTNESS: ctrl_class = V4L2_CTRL_CLASS_USER;
+ query = &PvrSetup.Brightness.queryctrl;
break;
- case V4L2_CID_CONTRAST: ctrl_class=V4L2_CTRL_CLASS_USER;
- query=&PvrSetup.Contrast.queryctrl;
+ case V4L2_CID_CONTRAST: ctrl_class = V4L2_CTRL_CLASS_USER;
+ query = &PvrSetup.Contrast.queryctrl;
break;
- case V4L2_CID_SATURATION: ctrl_class=V4L2_CTRL_CLASS_USER;
- query=&PvrSetup.Saturation.queryctrl;
+ case V4L2_CID_SATURATION: ctrl_class = V4L2_CTRL_CLASS_USER;
+ query = &PvrSetup.Saturation.queryctrl;
break;
- case V4L2_CID_HUE: ctrl_class=V4L2_CTRL_CLASS_USER;
- query=&PvrSetup.Hue.queryctrl;
+ case V4L2_CID_HUE: ctrl_class = V4L2_CTRL_CLASS_USER;
+ query = &PvrSetup.Hue.queryctrl;
break;
// Audio
- case V4L2_CID_AUDIO_VOLUME: ctrl_class=V4L2_CTRL_CLASS_USER;
- query=&PvrSetup.AudioVolumeTVCommon.queryctrl;
+ case V4L2_CID_AUDIO_VOLUME: ctrl_class = V4L2_CTRL_CLASS_USER;
+ query = &PvrSetup.AudioVolumeTVCommon.queryctrl;
break;
- case V4L2_CID_AUDIO_MUTE: ctrl_class=V4L2_CTRL_CLASS_USER;
- query=&PvrSetup.AudioMute.queryctrl;
+ case V4L2_CID_AUDIO_MUTE: ctrl_class = V4L2_CTRL_CLASS_USER;
+ query = &PvrSetup.AudioMute.queryctrl;
break;
case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
- query=&PvrSetup.AudioBitrate.queryctrl;
+ query = &PvrSetup.AudioBitrate.queryctrl;
break;
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
- query=&PvrSetup.AudioSampling.queryctrl;
+ query = &PvrSetup.AudioSampling.queryctrl;
break;
case V4L2_CID_MPEG_AUDIO_ENCODING:
if (driver == hdpvr)
- query=&PvrSetup.HDPVR_AudioEncoding.queryctrl;
+ query = &PvrSetup.HDPVR_AudioEncoding.queryctrl;
else
- query=&PvrSetup.AudioEncoding.queryctrl;
+ query = &PvrSetup.AudioEncoding.queryctrl;
break;
// Video
case V4L2_CID_MPEG_VIDEO_BITRATE:
- query=&PvrSetup.VideoBitrateTV.queryctrl;
+ query = &PvrSetup.VideoBitrateTV.queryctrl;
break;
case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
- query=&PvrSetup.VideoBitratePeak.queryctrl;
+ query = &PvrSetup.VideoBitratePeak.queryctrl;
break;
case V4L2_CID_MPEG_VIDEO_ASPECT:
- query=&PvrSetup.AspectRatio.queryctrl;
+ query = &PvrSetup.AspectRatio.queryctrl;
break;
// MPEG
case V4L2_CID_MPEG_STREAM_TYPE:
- query=&PvrSetup.StreamType.queryctrl;
+ query = &PvrSetup.StreamType.queryctrl;
break;
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
- query=&PvrSetup.BitrateMode.queryctrl;
+ query = &PvrSetup.BitrateMode.queryctrl;
break;
case V4L2_CID_MPEG_VIDEO_B_FRAMES:
- query=&PvrSetup.BFrames.queryctrl;
+ query = &PvrSetup.BFrames.queryctrl;
break;
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
- query=&PvrSetup.GopSize.queryctrl;
+ query = &PvrSetup.GopSize.queryctrl;
break;
case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE:
- query=&PvrSetup.GopClosure.queryctrl;
+ query = &PvrSetup.GopClosure.queryctrl;
break;
// Video Filters
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
- query=&PvrSetup.FilterSpatialMode.queryctrl;
+ query = &PvrSetup.FilterSpatialMode.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER:
- query=&PvrSetup.FilterSpatial.queryctrl;
+ query = &PvrSetup.FilterSpatial.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE:
- query=&PvrSetup.FilterLumaSpatialType.queryctrl;
+ query = &PvrSetup.FilterLumaSpatialType.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE:
- query=&PvrSetup.FilterChromaSpatialType.queryctrl;
+ query = &PvrSetup.FilterChromaSpatialType.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE:
- query=&PvrSetup.FilterTemporalMode.queryctrl;
+ query = &PvrSetup.FilterTemporalMode.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER:
- query=&PvrSetup.FilterTemporal.queryctrl;
+ query = &PvrSetup.FilterTemporal.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE:
- query=&PvrSetup.FilterMedianType.queryctrl;
+ query = &PvrSetup.FilterMedianType.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM:
- query=&PvrSetup.FilterLumaMedianBottom.queryctrl;
+ query = &PvrSetup.FilterLumaMedianBottom.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP:
- query=&PvrSetup.FilterLumaMedianTop.queryctrl;
+ query = &PvrSetup.FilterLumaMedianTop.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM:
- query=&PvrSetup.FilterChromaMedianBottom.queryctrl;
+ query = &PvrSetup.FilterChromaMedianBottom.queryctrl;
break;
case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP:
- query=&PvrSetup.FilterChromaMedianTop.queryctrl;
+ query = &PvrSetup.FilterChromaMedianTop.queryctrl;
+ break;
+ case V4L2_CID_MPEG_STREAM_VBI_FMT:
+ if (SupportsSlicedVBI)
+ query = &PvrSetup.VBIformat.queryctrl;
break;
- if (SupportsSlicedVBI) {
- // VBI
- case V4L2_CID_MPEG_STREAM_VBI_FMT:
- query=&PvrSetup.VBIformat.queryctrl;
- break;
- }
default:
- log(pvrERROR, "SetControlValue(__u32 control, __s32 Val): ERROR: control %d not included in switch(control)",\
- control);
+ log(pvrERROR, "SetControlValue(__u32 control, __s32 Val): ERROR: control %d not included in switch(control)", control);
return -1;
}
@@ -1482,30 +1493,28 @@ default.
Has to be used *after* calling cPvrDevice::QueryAllControls().
-wirbel-
*/
-
-int cPvrDevice::SetControlValue(__u32 control_class, __u32 control, __s32 Val, \
- struct v4l2_queryctrl queryctrl) {
-
+int cPvrDevice::SetControlValue(__u32 control_class, __u32 control, __s32 Val, struct v4l2_queryctrl queryctrl)
+{
struct v4l2_ext_controls ctrls;
struct v4l2_ext_control ctrl;
if (!ControlIdIsValid(queryctrl.id)) // skip known unsupported controls of the driver with "no error"
return Val;
- log (3, "SetControlValue(%s, %d)",queryctrl.name, Val);
- if ((queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) == V4L2_CTRL_FLAG_DISABLED){
+ log (3, "SetControlValue(%s, %d)", queryctrl.name, Val);
+ if ((queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) == V4L2_CTRL_FLAG_DISABLED) {
log(pvrINFO, " Error: this control is disabled by driver. Skipped.");
return Val;
}
- if ((Val>queryctrl.maximum) || (Val<queryctrl.minimum)) {
- log(pvrINFO, " Info: setting value to default(%d)",queryctrl.default_value);
- Val=queryctrl.default_value;
+ if ((Val > queryctrl.maximum) || (Val < queryctrl.minimum)) {
+ log(pvrINFO, " Info: setting value to default(%d)", queryctrl.default_value);
+ Val = queryctrl.default_value;
}
ctrl.id = control;
ctrl.value = Val;
- ctrls.ctrl_class=control_class;
- ctrls.controls=&ctrl;
- ctrls.count=1;
+ ctrls.ctrl_class = control_class;
+ ctrls.controls = &ctrl;
+ ctrls.count = 1;
if (IOCTL(v4l2_fd, VIDIOC_S_EXT_CTRLS, &ctrls) != 0) {
log(pvrERROR, "cPvrDevice::SetControlValue(): setting control value %s: %d:%s",
@@ -1521,8 +1530,8 @@ Queries the properties of a given valSet
-> Before using function, valSet's queryctrl.id has to be set.
-wirbel-
*/
-
-int cPvrDevice::QueryControl(struct valSet * vs) {
+int cPvrDevice::QueryControl(struct valSet * vs)
+{
if (!ControlIdIsValid(vs->queryctrl.id)) // skip known unsupported controls of the driver with "no error"
return 0;
vs->query_isvalid = false;
@@ -1544,9 +1553,9 @@ Queries the properties of all valSets used in SetControlValue
20070510
-wirbel-
*/
-
-bool cPvrDevice::QueryAllControls(void) {
- int err=0;
+bool cPvrDevice::QueryAllControls(void)
+{
+ int err = 0;
log(pvrDEBUG1, "QueryAllControls");
PvrSetup.Brightness.ctrl_class = V4L2_CTRL_CLASS_USER;
@@ -1620,10 +1629,8 @@ bool cPvrDevice::QueryAllControls(void) {
PvrSetup.FilterLumaMedianTop.queryctrl.id = V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP;
PvrSetup.FilterChromaMedianBottom.queryctrl.id= V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM;
PvrSetup.FilterChromaMedianTop.queryctrl.id = V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP;
- if (SupportsSlicedVBI) {
- // VBI
- PvrSetup.VBIformat.queryctrl.id = V4L2_CID_MPEG_STREAM_VBI_FMT;
- }
+ if (SupportsSlicedVBI)
+ PvrSetup.VBIformat.queryctrl.id = V4L2_CID_MPEG_STREAM_VBI_FMT;
/* now quering min, max, default */
// picture properties
err += QueryControl(&PvrSetup.Brightness);
@@ -1663,10 +1670,8 @@ bool cPvrDevice::QueryAllControls(void) {
err += QueryControl(&PvrSetup.FilterLumaMedianTop);
err += QueryControl(&PvrSetup.FilterChromaMedianBottom);
err += QueryControl(&PvrSetup.FilterChromaMedianTop);
- if (SupportsSlicedVBI) {
- // VBI
- err += QueryControl(&PvrSetup.VBIformat);
- }
+ if (SupportsSlicedVBI)
+ err += QueryControl(&PvrSetup.VBIformat);
if (err)
return false;
@@ -1681,14 +1686,11 @@ bool cPvrDevice::QueryAllControls(void) {
INIT(PvrSetup.Hue);
// Audio
if (PvrSetup.AudioVolumeTVCommon.value == INVALID_VALUE)
- PvrSetup.AudioVolumeTVCommon.value = \
- (int) (0.95 * PvrSetup.AudioVolumeTVCommon.queryctrl.maximum);
+ PvrSetup.AudioVolumeTVCommon.value = (int)(0.95 * PvrSetup.AudioVolumeTVCommon.queryctrl.maximum);
if (PvrSetup.AudioVolumeTVException.value == INVALID_VALUE)
- PvrSetup.AudioVolumeTVException.value = \
- (int) (0.95 * PvrSetup.AudioVolumeTVException.queryctrl.maximum);
+ PvrSetup.AudioVolumeTVException.value = (int)(0.95 * PvrSetup.AudioVolumeTVException.queryctrl.maximum);
if (PvrSetup.AudioVolumeFM.value == INVALID_VALUE)
- PvrSetup.AudioVolumeFM.value = \
- PvrSetup.AudioVolumeFM.queryctrl.maximum;
+ PvrSetup.AudioVolumeFM.value = PvrSetup.AudioVolumeFM.queryctrl.maximum;
INIT(PvrSetup.AudioBitrate);
INIT(PvrSetup.AudioSampling);
if (driver == hdpvr)
@@ -1715,4 +1717,3 @@ bool cPvrDevice::QueryAllControls(void) {
INIT(PvrSetup.FilterChromaMedianTop);
return true;
}
-
diff --git a/device.h b/device.h
index c3bf39d..a43ef85 100644
--- a/device.h
+++ b/device.h
@@ -1,5 +1,5 @@
-#ifndef _PVR_DEVICE_H_
-#define _PVR_DEVICE_H_
+#ifndef _PVRINPUT_DEVICE_H_
+#define _PVRINPUT_DEVICE_H_
#include "common.h"
@@ -50,13 +50,10 @@ typedef enum {
class cPvrReadThread;
-class cPvrDevice :
-public cDevice
-{
-friend class cPvrReadThread;
+class cPvrDevice : public cDevice {
+ friend class cPvrReadThread;
private:
static bool Probe(int DeviceNumber);
-
static cString externChannelSwitchScript;
public:
@@ -89,7 +86,7 @@ private:
int newLinesPerFrame;
eVideoInputs newEncoderInput;
cString BusID;
- eEncState EncoderState;
+ eEncState EncoderState;
eVideoInputs EncoderInput;
int driver_apiversion;
bool SupportsSlicedVBI;
@@ -105,11 +102,11 @@ private:
bool pvrusb2_ready;
eV4l2Driver driver;
eV4l2CardName cardname;
- cRingBufferLinear * tsBuffer;
+ cRingBufferLinear *tsBuffer;
int tsBufferPrefill;
- cPvrReadThread * readThread;
+ cPvrReadThread *readThread;
cChannel currentChannel;
- cPvrSectionHandler sectionHandler;
+ cPvrSectionHandler sectionHandler;
protected:
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
@@ -128,8 +125,7 @@ public:
virtual ~cPvrDevice(void);
virtual bool ProvidesSource(int Source) const;
virtual bool ProvidesTransponder(const cChannel *Channel) const;
- virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1,
- bool *NeedsDetachReceivers = NULL) const;
+ virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL) const;
virtual int NumProvidedSystems(void) const;
bool ParseChannel(const cChannel *Channel, int *input, uint64_t *norm, int *LinesPerFrame, int *card,
eVideoInputs *encoderInput, int *apid, int *vpid, int *tpid) const;
@@ -149,12 +145,10 @@ public:
bool ControlIdIsValid(__u32 ctrlid);
// overloaded function SetControlValue
int SetControlValue(__u32 control, __s32 Val);
- int SetControlValue(struct valSet * vs, __s32 Val);
- int SetControlValue(__u32 control_class, __u32 control,
- __s32 Val, struct v4l2_queryctrl queryctrl);
- int QueryControl(struct valSet * vs);
+ int SetControlValue(struct valSet *vs, __s32 Val);
+ int SetControlValue(__u32 control_class, __u32 control, __s32 Val, struct v4l2_queryctrl queryctrl);
+ int QueryControl(struct valSet *vs);
bool QueryAllControls(void);
- int PutData(const unsigned char * Data, int Count);
};
#endif
diff --git a/filter.c b/filter.c
index 880edca..c20f616 100644
--- a/filter.c
+++ b/filter.c
@@ -1,11 +1,5 @@
#include "common.h"
-//#include <unistd.h>
-//#include <fcntl.h>
-//#include <sys/types.h>
-//#include <sys/socket.h>
-
-
cPvrSectionFilter::cPvrSectionFilter(u_short Pid, u_char Tid, u_char Mask)
{
filterData.pid = Pid;
@@ -14,18 +8,18 @@ cPvrSectionFilter::cPvrSectionFilter(u_short Pid, u_char Tid, u_char Mask)
handle[0] = handle[1] = -1;
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, handle) != 0) {
- log(pvrERROR, "cPvrSectionFilter(): can't open socketpair");
- Close();
- }
+ log(pvrERROR, "cPvrSectionFilter(): can't open socketpair");
+ Close();
+ }
else if ((fcntl(handle[0], F_SETFL, O_NONBLOCK) != 0) || (fcntl(handle[1], F_SETFL, O_NONBLOCK) != 0)) {
- log(pvrERROR, "cPvrSectionFilter(): can't switch socketpair to unblocked mode");
- Close();
- }
+ log(pvrERROR, "cPvrSectionFilter(): can't switch socketpair to unblocked mode");
+ Close();
+ }
}
cPvrSectionFilter::~cPvrSectionFilter(void)
{
- Close();
+ Close();
}
void cPvrSectionFilter::Close(void)
@@ -59,33 +53,33 @@ int cPvrSectionHandler::AddFilter(u_short Pid, u_char Tid, u_char Mask)
cPvrSectionFilter *filter = new cPvrSectionFilter(Pid, Tid, Mask);
int handle = filter->GetHandle();
if (handle < 0)
- delete filter;
+ delete filter;
else
- filters.Add(filter);
+ filters.Add(filter);
return handle;
}
void cPvrSectionHandler::RemoveFilter(int Handle)
{
- cPvrSectionFilter *filter = filters.First();
+ cPvrSectionFilter *filter = filters.First();
while (filter) {
- if (filter->GetHandle() == Handle) {
- filters.Del(filter, true);
- break;
- }
- filter = filters.Next(filter);
- }
+ if (filter->GetHandle() == Handle) {
+ filters.Del(filter, true);
+ break;
+ }
+ filter = filters.Next(filter);
+ }
}
void cPvrSectionHandler::ProcessTSPacket(const u_char *Data)
{
if ((filters.Count() == 0) || (Data == 0))
- return;
+ return;
uint8_t section_len = ((Data[7] & 0x0F) << 8) + Data[7];
if (section_len == 0)
- return;
+ return;
if ((Data[1] & 0x40) == 0)
- return;
+ return;
u_short pid = ((Data[1] & 0x1F) << 8) + Data[2];
u_char tid = Data[5];
size_t written = 0;
@@ -93,13 +87,11 @@ void cPvrSectionHandler::ProcessTSPacket(const u_char *Data)
section_len += 3;
cPvrSectionFilter *filter = filters.First();
while (filter) {
- if (filter->filterData.Matches(pid, tid)) {
- //log(pvrDEBUG2, "cPvrSectionHandler::ProcessTSPacket(): pid = %d, tid = %d, len = %d, start = %d",
- // pid, tid, section_len, section_start);
- written = write(filter->handle[1], Data + section_start, section_len);
- if (written != section_len)
- log(pvrERROR, "cPvrSectionHandler::ProcessTSPacket(): written only %d instead of %d", written, section_len);
- }
- filter = filters.Next(filter);
- }
+ if (filter->filterData.Matches(pid, tid)) {
+ written = write(filter->handle[1], Data + section_start, section_len);
+ if (written != section_len)
+ log(pvrERROR, "cPvrSectionHandler::ProcessTSPacket(): written only %d instead of %d", written, section_len);
+ }
+ filter = filters.Next(filter);
+ }
}
diff --git a/filter.h b/filter.h
index 2a6b08b..35eee1f 100644
--- a/filter.h
+++ b/filter.h
@@ -1,5 +1,5 @@
-#ifndef _PVR_FILTER_H_
-#define _PVR_FILTER_H_
+#ifndef _PVRINPUT_FILTER_H_
+#define _PVRINPUT_FILTER_H_
#include <vdr/filter.h>
diff --git a/global.h b/global.h
index e5361ba..e28645d 100644
--- a/global.h
+++ b/global.h
@@ -1,11 +1,8 @@
#ifndef _PVRINPUT_GLOBAL_H_
#define _PVRINPUT_GLOBAL_H_
-
-
static const int kMaxPvrDevices = 8;
#define INVALID_VALUE -1000
#endif
-
diff --git a/menu.c b/menu.c
index 4af4b6e..ac528c4 100644
--- a/menu.c
+++ b/menu.c
@@ -46,23 +46,24 @@ static const char * audioBitrateValues[] = {
"256",
"320",
"384"
-};
+ };
-static const char * bitrateModes[] = {
+static const char *bitrateModes[] = {
"VBR",
"CBR"
-};
+ };
/* order must match the 'audmode' values in videodev2.h */
-static const char * tunerAudioModes[] = {
+static const char *tunerAudioModes[] = {
"mono",
"stereo",
"lang2",
"lang1",
"bilingual"
-};
+ };
+
#ifdef PVR_DEBUG
-static const char * useOnlyCard[] = {
+static const char *useOnlyCard[] = {
"/dev/video0",
"/dev/video1",
"/dev/video2",
@@ -83,21 +84,24 @@ static const char * useOnlyCard[] = {
"HVR1950", //17
"PVRUSB2", //18
"HDPVR" //19
- };
+ };
#endif
-static const char * aspectRatios[] = {
+
+static const char *aspectRatios[] = {
"1:1",
"4:3",
"16:9",
"2.21:1"
-};
+ };
+
#ifdef PVR_DEBUG
-static const char * streamType[] = {
+static const char *streamType[] = {
"MPEG2 PS",
"MPEG2 DVD"
-};
+ };
#endif
-static const char * exceptionVolumeForCard[] = {
+
+static const char *exceptionVolumeForCard[] = {
"/dev/video0",
"/dev/video1",
"/dev/video2",
@@ -117,231 +121,214 @@ static const char * exceptionVolumeForCard[] = {
"HVR1900", //16
"HVR1950", //17
"PVRUSB2" //18
- };
-
-cPvrMenuSetup::cPvrMenuSetup() {
-
- static const char * FilterModes[2];
- FilterModes[0]=tr("Setup.pvrinput$manual");
- FilterModes[1]=tr("Setup.pvrinput$auto");
-
- static const char * SpatialTypes[5];
- SpatialTypes[0]=tr("Setup.pvrinput$off");
- SpatialTypes[1]=tr("Setup.pvrinput$1D horizontal");
- SpatialTypes[2]=tr("Setup.pvrinput$1D vertical");
- SpatialTypes[3]=tr("Setup.pvrinput$2D hv separable");
- SpatialTypes[4]=tr("Setup.pvrinput$2D sym non separable");
-
- static const char * MedianTypes[5];
- MedianTypes[0]=tr("Setup.pvrinput$off");
- MedianTypes[1]=tr("Setup.pvrinput$horizontal");
- MedianTypes[2]=tr("Setup.pvrinput$vertical");
- MedianTypes[3]=tr("Setup.pvrinput$horizontal + vertical");
- MedianTypes[4]=tr("Setup.pvrinput$diagonal");
-
- static const char * SamplingFreqs[3];
- SamplingFreqs[0]=tr("Setup.pvrinput$44.1 kHz");
- SamplingFreqs[1]=tr("Setup.pvrinput$48 kHz");
- SamplingFreqs[2]=tr("Setup.pvrinput$32 kHz");
-
- static const char * HDPVR_AudioEncodings[2];
- HDPVR_AudioEncodings[0]=tr("Setup.pvrinput$AAC");
- HDPVR_AudioEncodings[1]=tr("Setup.pvrinput$AC3");
-
- static const char * HDPVR_AudioInputs[3];
- HDPVR_AudioInputs[0]=tr("Setup.pvrinput$RCA back");
- HDPVR_AudioInputs[1]=tr("Setup.pvrinput$RCA front");
- HDPVR_AudioInputs[2]=tr("Setup.pvrinput$SPDIF");
+ };
+
+cPvrMenuSetup::cPvrMenuSetup()
+{
+ static const char *FilterModes[2];
+ FilterModes[0] = tr("Setup.pvrinput$manual");
+ FilterModes[1] = tr("Setup.pvrinput$auto");
+
+ static const char *SpatialTypes[5];
+ SpatialTypes[0] = tr("Setup.pvrinput$off");
+ SpatialTypes[1] = tr("Setup.pvrinput$1D horizontal");
+ SpatialTypes[2] = tr("Setup.pvrinput$1D vertical");
+ SpatialTypes[3] = tr("Setup.pvrinput$2D hv separable");
+ SpatialTypes[4] = tr("Setup.pvrinput$2D sym non separable");
+
+ static const char *MedianTypes[5];
+ MedianTypes[0] = tr("Setup.pvrinput$off");
+ MedianTypes[1] = tr("Setup.pvrinput$horizontal");
+ MedianTypes[2] = tr("Setup.pvrinput$vertical");
+ MedianTypes[3] = tr("Setup.pvrinput$horizontal + vertical");
+ MedianTypes[4] = tr("Setup.pvrinput$diagonal");
+
+ static const char *SamplingFreqs[3];
+ SamplingFreqs[0] = tr("Setup.pvrinput$44.1 kHz");
+ SamplingFreqs[1] = tr("Setup.pvrinput$48 kHz");
+ SamplingFreqs[2] = tr("Setup.pvrinput$32 kHz");
+
+ static const char *HDPVR_AudioEncodings[2];
+ HDPVR_AudioEncodings[0] = tr("Setup.pvrinput$AAC");
+ HDPVR_AudioEncodings[1] = tr("Setup.pvrinput$AC3");
+
+ static const char *HDPVR_AudioInputs[3];
+ HDPVR_AudioInputs[0] = tr("Setup.pvrinput$RCA back");
+ HDPVR_AudioInputs[1] = tr("Setup.pvrinput$RCA front");
+ HDPVR_AudioInputs[2] = tr("Setup.pvrinput$SPDIF");
newPvrSetup = PvrSetup;
// videobitrate in setup.conf is 0..27000, but ivtv 0..27000000
- newPvrSetup.VideoBitrateTV.value =
- (int) (PvrSetup.VideoBitrateTV.value/1000);
- newPvrSetup.VideoBitrateTV.queryctrl.minimum =
- (int) (PvrSetup.VideoBitrateTV.queryctrl.minimum/1000);
- newPvrSetup.VideoBitrateTV.queryctrl.maximum =
- (int) (PvrSetup.VideoBitrateTV.queryctrl.maximum/1000);
-
- newPvrSetup.Brightness.value=IntVal2Percent(PvrSetup.Brightness.value,
- PvrSetup.Brightness.queryctrl.minimum,
- PvrSetup.Brightness.queryctrl.maximum);
-
- newPvrSetup.Contrast.value=IntVal2Percent(PvrSetup.Contrast.value,
- PvrSetup.Contrast.queryctrl.minimum,
- PvrSetup.Contrast.queryctrl.maximum);
-
- newPvrSetup.Saturation.value=IntVal2Percent(PvrSetup.Saturation.value,
- PvrSetup.Saturation.queryctrl.minimum,
- PvrSetup.Saturation.queryctrl.maximum);
-
- newPvrSetup.Hue.value=IntVal2Percent(PvrSetup.Hue.value,
- PvrSetup.Hue.queryctrl.minimum,
- PvrSetup.Hue.queryctrl.maximum);
-
- newPvrSetup.AudioVolumeTVCommon.value=IntVal2Percent(PvrSetup.AudioVolumeTVCommon.value,
- PvrSetup.AudioVolumeTVCommon.queryctrl.minimum,
- PvrSetup.AudioVolumeTVCommon.queryctrl.maximum);
-
- newPvrSetup.AudioVolumeTVException.value=IntVal2Percent(PvrSetup.AudioVolumeTVException.value,
- PvrSetup.AudioVolumeTVException.queryctrl.minimum,
- PvrSetup.AudioVolumeTVException.queryctrl.maximum);
-
- newPvrSetup.AudioVolumeFM.value=IntVal2Percent(PvrSetup.AudioVolumeFM.value,
- PvrSetup.AudioVolumeFM.queryctrl.minimum,
- PvrSetup.AudioVolumeFM.queryctrl.maximum);
-
- Add(new cMenuEditBoolItem(tr("Setup.pvrinput$Hide main menu entry"),
- &newPvrSetup.HideMainMenuEntry));
+ newPvrSetup.VideoBitrateTV.value = (int)(PvrSetup.VideoBitrateTV.value / 1000);
+ newPvrSetup.VideoBitrateTV.queryctrl.minimum = (int)(PvrSetup.VideoBitrateTV.queryctrl.minimum / 1000);
+ newPvrSetup.VideoBitrateTV.queryctrl.maximum = (int)(PvrSetup.VideoBitrateTV.queryctrl.maximum / 1000);
+
+ newPvrSetup.Brightness.value = IntVal2Percent(PvrSetup.Brightness.value,
+ PvrSetup.Brightness.queryctrl.minimum,
+ PvrSetup.Brightness.queryctrl.maximum);
+
+ newPvrSetup.Contrast.value = IntVal2Percent(PvrSetup.Contrast.value,
+ PvrSetup.Contrast.queryctrl.minimum,
+ PvrSetup.Contrast.queryctrl.maximum);
+
+ newPvrSetup.Saturation.value = IntVal2Percent(PvrSetup.Saturation.value,
+ PvrSetup.Saturation.queryctrl.minimum,
+ PvrSetup.Saturation.queryctrl.maximum);
+
+ newPvrSetup.Hue.value = IntVal2Percent(PvrSetup.Hue.value,
+ PvrSetup.Hue.queryctrl.minimum,
+ PvrSetup.Hue.queryctrl.maximum);
+
+ newPvrSetup.AudioVolumeTVCommon.value = IntVal2Percent(PvrSetup.AudioVolumeTVCommon.value,
+ PvrSetup.AudioVolumeTVCommon.queryctrl.minimum,
+ PvrSetup.AudioVolumeTVCommon.queryctrl.maximum);
+
+ newPvrSetup.AudioVolumeTVException.value = IntVal2Percent(PvrSetup.AudioVolumeTVException.value,
+ PvrSetup.AudioVolumeTVException.queryctrl.minimum,
+ PvrSetup.AudioVolumeTVException.queryctrl.maximum);
+
+ newPvrSetup.AudioVolumeFM.value = IntVal2Percent(PvrSetup.AudioVolumeFM.value,
+ PvrSetup.AudioVolumeFM.queryctrl.minimum,
+ PvrSetup.AudioVolumeFM.queryctrl.maximum);
+
+ Add(new cMenuEditBoolItem(tr("Setup.pvrinput$Hide main menu entry"), &newPvrSetup.HideMainMenuEntry));
#ifdef PVR_DEBUG
- Add(new cMenuEditStraItem(tr("Setup.pvrinput$Use only card"),
- &newPvrSetup.UseOnlyCard, 20, useOnlyCard));
+ Add(new cMenuEditStraItem(tr("Setup.pvrinput$Use only card"), &newPvrSetup.UseOnlyCard, 20, useOnlyCard));
#endif
- Add(new cMenuEditIntItem(tr("Setup.pvrinput$Log level"),
- &newPvrSetup.LogLevel, 0, 4));
+ Add(new cMenuEditIntItem(tr("Setup.pvrinput$Log level"), &newPvrSetup.LogLevel, 0, 4));
- Add(new cMenuEditBoolItem(tr("Setup.pvrinput$Slice VBI Teletext"),
- &newPvrSetup.SliceVBI));
+ Add(new cMenuEditBoolItem(tr("Setup.pvrinput$Slice VBI Teletext"), &newPvrSetup.SliceVBI));
- Add(new cMenuEditStraItem(tr("Setup.pvrinput$Tuner Audio Mode"),
- &newPvrSetup.TunerAudioMode, 5, tunerAudioModes));
+ Add(new cMenuEditStraItem(tr("Setup.pvrinput$Tuner Audio Mode"), &newPvrSetup.TunerAudioMode, 5, tunerAudioModes));
- Add(new cMenuEditIntItem(tr("Setup.pvrinput$Brightness"),
- &newPvrSetup.Brightness.value, 0, 100));
+ Add(new cMenuEditIntItem(tr("Setup.pvrinput$Brightness"), &newPvrSetup.Brightness.value, 0, 100));
- Add(new cMenuEditIntItem(tr("Setup.pvrinput$Contrast"),
- &newPvrSetup.Contrast.value, 0, 100));
+ Add(new cMenuEditIntItem(tr("Setup.pvrinput$Contrast"), &newPvrSetup.Contrast.value, 0, 100));
- Add(new cMenuEditIntItem(tr("Setup.pvrinput$Saturation"),
- &newPvrSetup.Saturation.value, 0, 100));
+ Add(new cMenuEditIntItem(tr("Setup.pvrinput$Saturation"), &newPvrSetup.Saturation.value, 0, 100));
- Add(new cMenuEditIntItem(tr("Setup.pvrinput$Hue"),
- &newPvrSetup.Hue.value, 0, 100));
+ Add(new cMenuEditIntItem(tr("Setup.pvrinput$Hue"), &newPvrSetup.Hue.value, 0, 100));
- Add(new cMenuEditIntItem(tr("Setup.pvrinput$Common Audio volume (TV)"),
- &newPvrSetup.AudioVolumeTVCommon.value, 0, 100));
+ Add(new cMenuEditIntItem(tr("Setup.pvrinput$Common Audio volume (TV)"), &newPvrSetup.AudioVolumeTVCommon.value, 0, 100));
- Add(new cMenuEditIntItem(tr("Setup.pvrinput$Exception Audio volume (TV)"),
- &newPvrSetup.AudioVolumeTVException.value, 0, 100));
+ Add(new cMenuEditIntItem(tr("Setup.pvrinput$Exception Audio volume (TV)"), &newPvrSetup.AudioVolumeTVException.value, 0, 100));
- Add(new cMenuEditStraItem(tr("Setup.pvrinput$Exception TV Volume for Card"),
- &newPvrSetup.AudioVolumeTVExceptionCard, 19, exceptionVolumeForCard));
+ Add(new cMenuEditStraItem(tr("Setup.pvrinput$Exception TV Volume for Card"), &newPvrSetup.AudioVolumeTVExceptionCard, 19, exceptionVolumeForCard));
- Add(new cMenuEditIntItem(tr("Setup.pvrinput$Audio radio volume"),
- &newPvrSetup.AudioVolumeFM.value, 0, 100));
+ Add(new cMenuEditIntItem(tr("Setup.pvrinput$Audio radio volume"), &newPvrSetup.AudioVolumeFM.value, 0, 100));
Add(new cMenuEditStraItem(tr("Setup.pvrinput$Audio bitrate (kbit/s)"),
- &newPvrSetup.AudioBitrate.value,
- newPvrSetup.AudioBitrate.queryctrl.maximum + 1, audioBitrateValues));
+ &newPvrSetup.AudioBitrate.value,
+ newPvrSetup.AudioBitrate.queryctrl.maximum + 1,
+ audioBitrateValues));
Add(new cMenuEditStraItem(tr("Setup.pvrinput$Audio sampling rate"),
- &newPvrSetup.AudioSampling.value,
- newPvrSetup.AudioSampling.queryctrl.maximum + 1, SamplingFreqs));
+ &newPvrSetup.AudioSampling.value,
+ newPvrSetup.AudioSampling.queryctrl.maximum + 1,
+ SamplingFreqs));
- Add(new cMenuEditStraItem(tr("Setup.pvrinput$HDPVR audio encoding"),
- &newPvrSetup.HDPVR_AudioEncoding.value, 2, HDPVR_AudioEncodings));
+ Add(new cMenuEditStraItem(tr("Setup.pvrinput$HDPVR audio encoding"), &newPvrSetup.HDPVR_AudioEncoding.value, 2, HDPVR_AudioEncodings));
- Add(new cMenuEditStraItem(tr("Setup.pvrinput$HDPVR audio input"),
- &newPvrSetup.HDPVR_AudioInput, 3, HDPVR_AudioInputs));
+ Add(new cMenuEditStraItem(tr("Setup.pvrinput$HDPVR audio input"), &newPvrSetup.HDPVR_AudioInput, 3, HDPVR_AudioInputs));
Add(new cMenuEditIntItem(tr("Setup.pvrinput$Video bitrate TV (kbit/s)"),
- &newPvrSetup.VideoBitrateTV.value,
- newPvrSetup.VideoBitrateTV.queryctrl.minimum,
- newPvrSetup.VideoBitrateTV.queryctrl.maximum));
+ &newPvrSetup.VideoBitrateTV.value,
+ newPvrSetup.VideoBitrateTV.queryctrl.minimum,
+ newPvrSetup.VideoBitrateTV.queryctrl.maximum));
- newPvrSetup.StreamType.value=(newPvrSetup.StreamType.value==0?0:1);
+ newPvrSetup.StreamType.value = (newPvrSetup.StreamType.value == 0 ? 0 : 1);
Add(new cMenuEditStraItem(tr("Setup.pvrinput$Bitrate mode"),
- &newPvrSetup.BitrateMode.value,
- newPvrSetup.BitrateMode.queryctrl.maximum + 1, bitrateModes));
+ &newPvrSetup.BitrateMode.value,
+ newPvrSetup.BitrateMode.queryctrl.maximum + 1,
+ bitrateModes));
Add(new cMenuEditStraItem(tr("Setup.pvrinput$Aspect ratio"),
- &newPvrSetup.AspectRatio.value,
- newPvrSetup.AspectRatio.queryctrl.maximum + 1, aspectRatios));
+ &newPvrSetup.AspectRatio.value,
+ newPvrSetup.AspectRatio.queryctrl.maximum + 1,
+ aspectRatios));
+
#ifdef PVR_DEBUG
- Add(new cMenuEditStraItem(tr("Setup.pvrinput$Stream type"),
- &newPvrSetup.StreamType.value, 2, streamType));
+ Add(new cMenuEditStraItem(tr("Setup.pvrinput$Stream type"), &newPvrSetup.StreamType.value, 2, streamType));
#endif
+
Add(new cMenuEditStraItem(tr("Setup.pvrinput$Mode Spatial Video Filter"),
- &newPvrSetup.FilterSpatialMode.value,
- newPvrSetup.FilterSpatialMode.queryctrl.maximum + 1, FilterModes));
+ &newPvrSetup.FilterSpatialMode.value,
+ newPvrSetup.FilterSpatialMode.queryctrl.maximum + 1,
+ FilterModes));
Add(new cMenuEditIntItem(tr("Setup.pvrinput$Strength Spatial Video Filter"),
- &newPvrSetup.FilterSpatial.value,
- newPvrSetup.FilterSpatial.queryctrl.minimum,
- newPvrSetup.FilterSpatial.queryctrl.maximum));
+ &newPvrSetup.FilterSpatial.value,
+ newPvrSetup.FilterSpatial.queryctrl.minimum,
+ newPvrSetup.FilterSpatial.queryctrl.maximum));
Add(new cMenuEditStraItem(tr("Setup.pvrinput$Luma Spatial Filter Type"),
- &newPvrSetup.FilterLumaSpatialType.value,
- newPvrSetup.FilterLumaSpatialType.queryctrl.maximum + 1, SpatialTypes));
+ &newPvrSetup.FilterLumaSpatialType.value,
+ newPvrSetup.FilterLumaSpatialType.queryctrl.maximum + 1,
+ SpatialTypes));
Add(new cMenuEditStraItem(tr("Setup.pvrinput$Chroma Spatial Filter Type"),
- &newPvrSetup.FilterChromaSpatialType.value,
- newPvrSetup.FilterChromaSpatialType.queryctrl.maximum + 1, SpatialTypes));
+ &newPvrSetup.FilterChromaSpatialType.value,
+ newPvrSetup.FilterChromaSpatialType.queryctrl.maximum + 1,
+ SpatialTypes));
Add(new cMenuEditStraItem(tr("Setup.pvrinput$Mode Temporal Video Filter"),
- &newPvrSetup.FilterTemporalMode.value,
- newPvrSetup.FilterTemporalMode.queryctrl.maximum + 1, FilterModes));
+ &newPvrSetup.FilterTemporalMode.value,
+ newPvrSetup.FilterTemporalMode.queryctrl.maximum + 1,
+ FilterModes));
Add(new cMenuEditIntItem(tr("Setup.pvrinput$Strength Temporal Video Filter"),
- &newPvrSetup.FilterTemporal.value,
- newPvrSetup.FilterTemporal.queryctrl.minimum,
- newPvrSetup.FilterTemporal.queryctrl.maximum));
+ &newPvrSetup.FilterTemporal.value,
+ newPvrSetup.FilterTemporal.queryctrl.minimum,
+ newPvrSetup.FilterTemporal.queryctrl.maximum));
Add(new cMenuEditStraItem(tr("Setup.pvrinput$Median Filter Type"),
- &newPvrSetup.FilterMedianType.value,
- newPvrSetup.FilterMedianType.queryctrl.maximum + 1, MedianTypes));
+ &newPvrSetup.FilterMedianType.value,
+ newPvrSetup.FilterMedianType.queryctrl.maximum + 1,
+ MedianTypes));
Add(new cMenuEditIntItem(tr("Setup.pvrinput$Luma Median Filter Bottom"),
- &newPvrSetup.FilterLumaMedianBottom.value,
- newPvrSetup.FilterLumaMedianBottom.queryctrl.minimum,
- newPvrSetup.FilterLumaMedianBottom.queryctrl.maximum));
+ &newPvrSetup.FilterLumaMedianBottom.value,
+ newPvrSetup.FilterLumaMedianBottom.queryctrl.minimum,
+ newPvrSetup.FilterLumaMedianBottom.queryctrl.maximum));
Add(new cMenuEditIntItem(tr("Setup.pvrinput$Luma Median Filter Top"),
- &newPvrSetup.FilterLumaMedianTop.value,
- newPvrSetup.FilterLumaMedianTop.queryctrl.minimum,
- newPvrSetup.FilterLumaMedianTop.queryctrl.maximum));
+ &newPvrSetup.FilterLumaMedianTop.value,
+ newPvrSetup.FilterLumaMedianTop.queryctrl.minimum,
+ newPvrSetup.FilterLumaMedianTop.queryctrl.maximum));
Add(new cMenuEditIntItem(tr("Setup.pvrinput$Chroma Median Filter Bottom"),
- &newPvrSetup.FilterChromaMedianBottom.value,
- newPvrSetup.FilterChromaMedianBottom.queryctrl.minimum,
- newPvrSetup.FilterChromaMedianBottom.queryctrl.maximum));
+ &newPvrSetup.FilterChromaMedianBottom.value,
+ newPvrSetup.FilterChromaMedianBottom.queryctrl.minimum,
+ newPvrSetup.FilterChromaMedianBottom.queryctrl.maximum));
Add(new cMenuEditIntItem(tr("Setup.pvrinput$Chroma Median Filter Top"),
- &newPvrSetup.FilterChromaMedianTop.value,
- newPvrSetup.FilterChromaMedianTop.queryctrl.minimum,
- newPvrSetup.FilterChromaMedianTop.queryctrl.maximum));
+ &newPvrSetup.FilterChromaMedianTop.value,
+ newPvrSetup.FilterChromaMedianTop.queryctrl.minimum,
+ newPvrSetup.FilterChromaMedianTop.queryctrl.maximum));
- Add(new cMenuEditBoolItem(tr("Setup.pvrinput$use externchannelswitch.sh"),
- &newPvrSetup.UseExternChannelSwitchScript));
+ Add(new cMenuEditBoolItem(tr("Setup.pvrinput$use externchannelswitch.sh"), &newPvrSetup.UseExternChannelSwitchScript));
}
-void cPvrMenuSetup::Store() {
- SetupStore("HideMainMenuEntry",
- PvrSetup.HideMainMenuEntry = newPvrSetup.HideMainMenuEntry);
+void cPvrMenuSetup::Store()
+{
+ SetupStore("HideMainMenuEntry", PvrSetup.HideMainMenuEntry = newPvrSetup.HideMainMenuEntry);
- SetupStore("UseOnlyCard",
- PvrSetup.UseOnlyCard = newPvrSetup.UseOnlyCard);
+ SetupStore("UseOnlyCard", PvrSetup.UseOnlyCard = newPvrSetup.UseOnlyCard);
- SetupStore("LogLevel",
- PvrSetup.LogLevel = newPvrSetup.LogLevel);
+ SetupStore("LogLevel", PvrSetup.LogLevel = newPvrSetup.LogLevel);
- SetupStore("TunerAudioMode",
- PvrSetup.TunerAudioMode = newPvrSetup.TunerAudioMode);
+ SetupStore("TunerAudioMode", PvrSetup.TunerAudioMode = newPvrSetup.TunerAudioMode);
- SetupStore("StreamType",
- PvrSetup.StreamType.value = newPvrSetup.StreamType.value);
+ SetupStore("StreamType", PvrSetup.StreamType.value = newPvrSetup.StreamType.value);
- SetupStore("AudioVolumeTVExceptionCard",
- PvrSetup.AudioVolumeTVExceptionCard = newPvrSetup.AudioVolumeTVExceptionCard);
+ SetupStore("AudioVolumeTVExceptionCard", PvrSetup.AudioVolumeTVExceptionCard = newPvrSetup.AudioVolumeTVExceptionCard);
- SetupStore("HDPVR_AudioInput",
- PvrSetup.HDPVR_AudioInput = newPvrSetup.HDPVR_AudioInput);
+ SetupStore("HDPVR_AudioInput", PvrSetup.HDPVR_AudioInput = newPvrSetup.HDPVR_AudioInput);
- SetupStore("SliceVBI",
- PvrSetup.SliceVBI = newPvrSetup.SliceVBI);
+ SetupStore("SliceVBI", PvrSetup.SliceVBI = newPvrSetup.SliceVBI);
- SetupStore("UseExternChannelSwitchScript",
- PvrSetup.UseExternChannelSwitchScript = newPvrSetup.UseExternChannelSwitchScript);
+ SetupStore("UseExternChannelSwitchScript", PvrSetup.UseExternChannelSwitchScript = newPvrSetup.UseExternChannelSwitchScript);
/* The following code makes sure that we don't write a zero value
into setup.conf, which would happen if it is still INVALID_VALUE
@@ -350,38 +337,38 @@ void cPvrMenuSetup::Store() {
#define SETUPSTORE(n, v) if (v.query_isvalid) SetupStore(n, v.value)
PvrSetup.Brightness.value = Percent2IntVal(newPvrSetup.Brightness.value,
- PvrSetup.Brightness.queryctrl.minimum,
- PvrSetup.Brightness.queryctrl.maximum);
+ PvrSetup.Brightness.queryctrl.minimum,
+ PvrSetup.Brightness.queryctrl.maximum);
SETUPSTORE("Brightness", PvrSetup.Brightness);
PvrSetup.Contrast.value = Percent2IntVal(newPvrSetup.Contrast.value,
- PvrSetup.Contrast.queryctrl.minimum,
- PvrSetup.Contrast.queryctrl.maximum);
+ PvrSetup.Contrast.queryctrl.minimum,
+ PvrSetup.Contrast.queryctrl.maximum);
SETUPSTORE("Contrast", PvrSetup.Contrast);
PvrSetup.Saturation.value = Percent2IntVal(newPvrSetup.Saturation.value,
- PvrSetup.Saturation.queryctrl.minimum,
- PvrSetup.Saturation.queryctrl.maximum);
+ PvrSetup.Saturation.queryctrl.minimum,
+ PvrSetup.Saturation.queryctrl.maximum);
SETUPSTORE("Saturation", PvrSetup.Saturation);
PvrSetup.Hue.value = Percent2IntVal(newPvrSetup.Hue.value,
- PvrSetup.Hue.queryctrl.minimum,
- PvrSetup.Hue.queryctrl.maximum);
+ PvrSetup.Hue.queryctrl.minimum,
+ PvrSetup.Hue.queryctrl.maximum);
SETUPSTORE("Hue", PvrSetup.Hue);
PvrSetup.AudioVolumeTVCommon.value = Percent2IntVal(newPvrSetup.AudioVolumeTVCommon.value,
- PvrSetup.AudioVolumeTVCommon.queryctrl.minimum,
- PvrSetup.AudioVolumeTVCommon.queryctrl.maximum);
+ PvrSetup.AudioVolumeTVCommon.queryctrl.minimum,
+ PvrSetup.AudioVolumeTVCommon.queryctrl.maximum);
SETUPSTORE("AudioVolumeTVCommon", PvrSetup.AudioVolumeTVCommon);
PvrSetup.AudioVolumeTVException.value = Percent2IntVal(newPvrSetup.AudioVolumeTVException.value,
- PvrSetup.AudioVolumeTVException.queryctrl.minimum,
- PvrSetup.AudioVolumeTVException.queryctrl.maximum);
+ PvrSetup.AudioVolumeTVException.queryctrl.minimum,
+ PvrSetup.AudioVolumeTVException.queryctrl.maximum);
SETUPSTORE("AudioVolumeTVException", PvrSetup.AudioVolumeTVException);
PvrSetup.AudioVolumeFM.value = Percent2IntVal(newPvrSetup.AudioVolumeFM.value,
- PvrSetup.AudioVolumeFM.queryctrl.minimum,
- PvrSetup.AudioVolumeFM.queryctrl.maximum);
+ PvrSetup.AudioVolumeFM.queryctrl.minimum,
+ PvrSetup.AudioVolumeFM.queryctrl.maximum);
SETUPSTORE("AudioVolumeFM", PvrSetup.AudioVolumeFM);
// videobitrate in setup.conf is 0..27000, but ivtv 0..27000000
@@ -397,7 +384,7 @@ void cPvrMenuSetup::Store() {
// HDPVR audio encoding in setup.conf is 0..1, but driver needs 3..4
// if audio input SPDIF is selected, audio encoding must be AAC
if (newPvrSetup.HDPVR_AudioInput == 2)
- newPvrSetup.HDPVR_AudioEncoding.value = 0;
+ newPvrSetup.HDPVR_AudioEncoding.value = 0;
PvrSetup.HDPVR_AudioEncoding.value = newPvrSetup.HDPVR_AudioEncoding.value + 3;
SETUPSTORE("HDPVR_AudioEncoding", newPvrSetup.HDPVR_AudioEncoding);
@@ -444,33 +431,32 @@ void cPvrMenuSetup::Store() {
PvrSetup.repeat_ReInitAll_after_next_encoderstop = true;
}
-
cPvrMenuMain::cPvrMenuMain(void)
-: cOsdObject(),
+: cOsdObject(),
border(2),
margin(4),
mode(ePicPropBrightness)
- {
+{
font = cFont::GetFont(fontOsd);
width = Setup.OSDWidth;
height = 2 * font->Height() + 3 * border + 4 * margin;
}
-cPvrMenuMain::~cPvrMenuMain() {
+cPvrMenuMain::~cPvrMenuMain()
+{
delete osd;
}
-void cPvrMenuMain::Draw(void) {
+void cPvrMenuMain::Draw(void)
+{
+ static const char * pictureProperties[4] = {
+ tr("Setup.pvrinput$Brightness"),
+ tr("Setup.pvrinput$Contrast"),
+ tr("Setup.pvrinput$Saturation"),
+ tr("Setup.pvrinput$Hue")
+ };
-static const char * pictureProperties[4] = {
- tr("Setup.pvrinput$Brightness"),
- tr("Setup.pvrinput$Contrast"),
- tr("Setup.pvrinput$Saturation"),
- tr("Setup.pvrinput$Hue")
- };
-
- int titleWidth = font->Width(tr(pictureProperties[mode]))
- + 2 * border + 2 * margin;
+ int titleWidth = font->Width(tr(pictureProperties[mode])) + 2 * border + 2 * margin;
int titleHeight = font->Height() + border + 2 * margin;
int titleStart = 50;
int localvalue = PvrSetup.Brightness.value;
@@ -499,68 +485,21 @@ static const char * pictureProperties[4] = {
localmaximum = PvrSetup.Hue.queryctrl.maximum;
break;
}
- int barWidth = (localvalue - localminimum) * (width - font->Width("100%")
- - 2 * border - 3 * margin) / (localmaximum - localminimum);
-
- osd->DrawRectangle(0,
- 0,
- width - 1,
- height - 1,
- clrTransparent);
- osd->DrawRectangle(0,
- titleHeight,
- width - 1,
- height - 1,
- clrBlack);
- osd->DrawRectangle(titleStart,
- 0,
- titleStart + titleWidth - 1,
- titleHeight - 1,
- clrBlack);
- osd->DrawText(titleStart + border + margin,
- border + margin,
- tr(pictureProperties[mode]),
- clrWhite,
- clrBlack,
- font);
- osd->DrawRectangle(titleStart,
- 0,
- titleStart + titleWidth - 1,
- border - 1,
- clrWhite);
- osd->DrawRectangle(titleStart,
- 0,
- titleStart + border - 1,
- titleHeight - 1,
- clrWhite);
- osd->DrawRectangle(titleStart + titleWidth - border,
- 0,
- titleStart + titleWidth - 1,
- titleHeight - 1,
- clrWhite);
- osd->DrawRectangle(0,
- titleHeight,
- width - 1,
- titleHeight + border - 1,
- clrWhite);
- osd->DrawRectangle(0,
- titleHeight,
- border - 1,
- height - 1,
- clrWhite);
- osd->DrawRectangle(0,
- height - border,
- width - 1,
- height - 1,
- clrWhite);
- osd->DrawRectangle(width - border,
- titleHeight,
- width - 1,
- height - 1,
- clrWhite);
+ int barWidth = (localvalue - localminimum) * (width - font->Width("100%") - 2 * border - 3 * margin) / (localmaximum - localminimum);
+
+ osd->DrawRectangle(0, 0, width - 1, height - 1, clrTransparent);
+ osd->DrawRectangle(0, titleHeight, width - 1, height - 1, clrBlack);
+ osd->DrawRectangle(titleStart, 0, titleStart + titleWidth - 1, titleHeight - 1, clrBlack);
+ osd->DrawText(titleStart + border + margin, border + margin, tr(pictureProperties[mode]), clrWhite, clrBlack, font);
+ osd->DrawRectangle(titleStart, 0, titleStart + titleWidth - 1, border - 1, clrWhite);
+ osd->DrawRectangle(titleStart, 0, titleStart + border - 1, titleHeight - 1, clrWhite);
+ osd->DrawRectangle(titleStart + titleWidth - border, 0, titleStart + titleWidth - 1, titleHeight - 1, clrWhite);
+ osd->DrawRectangle(0, titleHeight, width - 1, titleHeight + border - 1, clrWhite);
+ osd->DrawRectangle(0, titleHeight, border - 1, height - 1, clrWhite);
+ osd->DrawRectangle(0, height - border, width - 1, height - 1, clrWhite);
+ osd->DrawRectangle(width - border, titleHeight, width - 1, height - 1, clrWhite);
char strpercentvalue[4];
- sprintf(strpercentvalue, "%d%%", IntVal2Percent(localvalue,
- localminimum, localmaximum));
+ sprintf(strpercentvalue, "%d%%", IntVal2Percent(localvalue, localminimum, localmaximum));
osd->DrawText(width - font->Width("100%") - border - margin - 1,
border + margin + titleHeight,
strpercentvalue,
@@ -570,26 +509,20 @@ static const char * pictureProperties[4] = {
font->Width("100%"),
0,
taRight);
- osd->DrawRectangle(border + margin,
- border + margin + titleHeight,
- border + margin + barWidth - 1,
- height - border - margin - 1,
- clrWhite);
+ osd->DrawRectangle(border + margin, border + margin + titleHeight, border + margin + barWidth - 1, height - border - margin - 1, clrWhite);
osd->Flush();
}
void cPvrMenuMain::Show(void) {
- osd = cOsdProvider::NewOsd(Setup.OSDLeft,
- Setup.OSDTop + Setup.OSDHeight - height);
-
+ osd = cOsdProvider::NewOsd(Setup.OSDLeft, Setup.OSDTop + Setup.OSDHeight - height);
tArea area = { 0, 0, width - 1, height - 1, 4 };
if (osd->CanHandleAreas(&area, 1) == oeOk)
- osd->SetAreas(&area, 1);
-
+ osd->SetAreas(&area, 1);
Draw();
}
-eOSState cPvrMenuMain::ProcessKey(eKeys Key) {
+eOSState cPvrMenuMain::ProcessKey(eKeys Key)
+{
eOSState state = cOsdObject::ProcessKey(Key);
if (state == osUnknown) {
switch (Key & ~k_Repeat) {
@@ -610,41 +543,41 @@ eOSState cPvrMenuMain::ProcessKey(eKeys Key) {
case ePicPropBrightness:
if (PvrSetup.Brightness.value > PvrSetup.Brightness.queryctrl.minimum) {
PvrSetup.Brightness.value--;
- for (int i=0; i<cPvrDevice::Count(); i++) {
- cPvrDevice * pvr = cPvrDevice::Get(i);
- if (pvr) pvr->SetControlValue(&PvrSetup.Brightness,
- PvrSetup.Brightness.value);
- }
+ for (int i = 0; i < cPvrDevice::Count(); i++) {
+ cPvrDevice *pvr = cPvrDevice::Get(i);
+ if (pvr)
+ pvr->SetControlValue(&PvrSetup.Brightness, PvrSetup.Brightness.value);
+ }
}
break;
case ePicPropContrast:
if (PvrSetup.Contrast.value > PvrSetup.Contrast.queryctrl.minimum) {
PvrSetup.Contrast.value--;
- for (int i=0; i<cPvrDevice::Count(); i++) {
- cPvrDevice * pvr = cPvrDevice::Get(i);
- if (pvr) pvr->SetControlValue(&PvrSetup.Contrast,
- PvrSetup.Contrast.value);
- }
+ for (int i = 0; i < cPvrDevice::Count(); i++) {
+ cPvrDevice *pvr = cPvrDevice::Get(i);
+ if (pvr)
+ pvr->SetControlValue(&PvrSetup.Contrast, PvrSetup.Contrast.value);
+ }
}
break;
case ePicPropSaturation:
if (PvrSetup.Saturation.value > PvrSetup.Saturation.queryctrl.minimum) {
PvrSetup.Saturation.value--;
- for (int i=0; i<cPvrDevice::Count(); i++) {
- cPvrDevice * pvr = cPvrDevice::Get(i);
- if (pvr) pvr->SetControlValue(&PvrSetup.Saturation,
- PvrSetup.Saturation.value);
- }
+ for (int i = 0; i < cPvrDevice::Count(); i++) {
+ cPvrDevice *pvr = cPvrDevice::Get(i);
+ if (pvr)
+ pvr->SetControlValue(&PvrSetup.Saturation, PvrSetup.Saturation.value);
+ }
}
break;
case ePicPropHue:
if (PvrSetup.Hue.value > PvrSetup.Hue.queryctrl.minimum) {
PvrSetup.Hue.value--;
- for (int i=0; i<cPvrDevice::Count(); i++) {
- cPvrDevice * pvr = cPvrDevice::Get(i);
- if (pvr) pvr->SetControlValue(&PvrSetup.Hue,
- PvrSetup.Hue.value);
- }
+ for (int i = 0; i < cPvrDevice::Count(); i++) {
+ cPvrDevice *pvr = cPvrDevice::Get(i);
+ if (pvr)
+ pvr->SetControlValue(&PvrSetup.Hue, PvrSetup.Hue.value);
+ }
}
break;
}
@@ -656,41 +589,41 @@ eOSState cPvrMenuMain::ProcessKey(eKeys Key) {
case ePicPropBrightness:
if (PvrSetup.Brightness.value < PvrSetup.Brightness.queryctrl.maximum) {
PvrSetup.Brightness.value++;
- for (int i=0; i<cPvrDevice::Count(); i++) {
- cPvrDevice * pvr = cPvrDevice::Get(i);
- if (pvr) pvr->SetControlValue(&PvrSetup.Brightness,
- PvrSetup.Brightness.value);
- }
+ for (int i = 0; i < cPvrDevice::Count(); i++) {
+ cPvrDevice *pvr = cPvrDevice::Get(i);
+ if (pvr)
+ pvr->SetControlValue(&PvrSetup.Brightness, PvrSetup.Brightness.value);
+ }
}
break;
case ePicPropContrast:
if (PvrSetup.Contrast.value < PvrSetup.Contrast.queryctrl.maximum) {
PvrSetup.Contrast.value++;
- for (int i=0; i<cPvrDevice::Count(); i++) {
- cPvrDevice * pvr = cPvrDevice::Get(i);
- if (pvr) pvr->SetControlValue(&PvrSetup.Contrast,
- PvrSetup.Contrast.value);
- }
+ for (int i = 0; i < cPvrDevice::Count(); i++) {
+ cPvrDevice *pvr = cPvrDevice::Get(i);
+ if (pvr)
+ pvr->SetControlValue(&PvrSetup.Contrast, PvrSetup.Contrast.value);
+ }
}
break;
case ePicPropSaturation:
if (PvrSetup.Saturation.value < PvrSetup.Saturation.queryctrl.maximum) {
PvrSetup.Saturation.value++;
- for (int i=0; i<cPvrDevice::Count(); i++) {
- cPvrDevice * pvr = cPvrDevice::Get(i);
- if (pvr) pvr->SetControlValue(&PvrSetup.Saturation,
- PvrSetup.Saturation.value);
- }
+ for (int i = 0; i < cPvrDevice::Count(); i++) {
+ cPvrDevice *pvr = cPvrDevice::Get(i);
+ if (pvr)
+ pvr->SetControlValue(&PvrSetup.Saturation, PvrSetup.Saturation.value);
+ }
}
break;
case ePicPropHue:
if (PvrSetup.Hue.value < PvrSetup.Hue.queryctrl.maximum) {
PvrSetup.Hue.value++;
- for (int i=0; i<cPvrDevice::Count(); i++) {
- cPvrDevice * pvr = cPvrDevice::Get(i);
- if (pvr) pvr->SetControlValue(&PvrSetup.Hue,
- PvrSetup.Hue.value);
- }
+ for (int i = 0; i < cPvrDevice::Count(); i++) {
+ cPvrDevice *pvr = cPvrDevice::Get(i);
+ if (pvr)
+ pvr->SetControlValue(&PvrSetup.Hue, PvrSetup.Hue.value);
+ }
}
break;
}
@@ -711,4 +644,3 @@ eOSState cPvrMenuMain::ProcessKey(eKeys Key) {
}
return state;
}
-
diff --git a/menu.h b/menu.h
index 7a5cc1c..0b688ea 100644
--- a/menu.h
+++ b/menu.h
@@ -1,5 +1,5 @@
/**
- * pvrinput plugin for the Video Disk Recorder
+ * pvrinput plugin for the Video Disk Recorder
*
* menu.h - setup menu class
*
@@ -49,8 +49,8 @@ public:
class cPvrMenuMain : public cOsdObject {
private:
- cOsd * osd;
- const cFont * font;
+ cOsd *osd;
+ const cFont *font;
int border;
int margin;
int width;
diff --git a/pvrinput.c b/pvrinput.c
index be56ebc..127fc6a 100644
--- a/pvrinput.c
+++ b/pvrinput.c
@@ -11,40 +11,48 @@ static const char *DESCRIPTION = tr("use Hauppauge PVR as input device");
static const char *MAINMENUENTRY = tr("PVR picture settings");
-cPluginPvrInput * PluginPvrInput;
+cPluginPvrInput *PluginPvrInput;
-cPluginPvrInput::cPluginPvrInput(void) {
+cPluginPvrInput::cPluginPvrInput(void)
+{
PluginPvrInput = this;
}
-cPluginPvrInput::~cPluginPvrInput() {
+cPluginPvrInput::~cPluginPvrInput()
+{
PluginPvrInput = NULL;
}
-const char * cPluginPvrInput::Version(void) {
+const char *cPluginPvrInput::Version(void)
+{
return VERSION;
}
-const char * cPluginPvrInput::Description(void) {
+const char *cPluginPvrInput::Description(void)
+{
return tr(DESCRIPTION);
}
-const char * cPluginPvrInput::CommandLineHelp(void) {
+const char *cPluginPvrInput::CommandLineHelp(void)
+{
return NULL;
}
-bool cPluginPvrInput::ProcessArgs(int argc, char * argv[]) {
+bool cPluginPvrInput::ProcessArgs(int argc, char *argv[])
+{
return true;
}
-bool cPluginPvrInput::Initialize(void) {
+bool cPluginPvrInput::Initialize(void)
+{
#if VDRVERSNUM < 10507
RegisterI18n(pvrinput_Phrases);
#endif //VDRVERSNUM < 10507
return true;
}
-bool cPluginPvrInput::Start(void) {
+bool cPluginPvrInput::Start(void)
+{
/* Start() is called after the primary device and user interface has
been set up, but before the main program loop is entered. Is called
after Initialize(). */
@@ -52,80 +60,83 @@ bool cPluginPvrInput::Start(void) {
return true;
}
-void cPluginPvrInput::Stop(void) {
+void cPluginPvrInput::Stop(void)
+{
/* Any threads the plugin may have created shall be stopped
in the Stop() function. See VDR/PLUGINS.html */
cPvrDevice::Stop();
};
-void cPluginPvrInput::Housekeeping(void) {
+void cPluginPvrInput::Housekeeping(void)
+{
}
-const char * cPluginPvrInput::MainMenuEntry(void) {
+const char *cPluginPvrInput::MainMenuEntry(void)
+{
if (PvrSetup.HideMainMenuEntry)
return NULL;
- else
- return tr(MAINMENUENTRY);
+ return tr(MAINMENUENTRY);
}
-
-cOsdObject * cPluginPvrInput::MainMenuAction(void) {
- cChannel * channel = Channels.GetByNumber(cDevice::CurrentChannel());
- if (channel
+cOsdObject *cPluginPvrInput::MainMenuAction(void)
+{
+ cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
#if VDRVERSNUM < 10713
- && channel->IsPlug()
+ if (channel && channel->IsPlug())
+ return new cPvrMenuMain();
#else
- && (channel->Source() == 'V')
+ // TODO: rework cPvrSourceParams for use with older vdr
+ if (channel && ((channel->Source() >> 24) == 'V'))
+ return new cPvrMenuMain();
#endif
- )
- return new cPvrMenuMain();
Skins.Message(mtError, tr("Setup.pvrinput$Not on an analogue channel!"), 2);
return NULL;
}
-cMenuSetupPage * cPluginPvrInput::SetupMenu(void) {
+cMenuSetupPage *cPluginPvrInput::SetupMenu(void)
+{
return new cPvrMenuSetup();
}
-bool cPluginPvrInput::SetupParse(const char * Name, const char * Value) {
- if (!strcasecmp(Name, "LogLevel")) PvrSetup.LogLevel = atoi(Value);
- else if (!strcasecmp(Name, "UseOnlyCard")) PvrSetup.UseOnlyCard = atoi(Value);
- else if (!strcasecmp(Name, "SliceVBI")) PvrSetup.SliceVBI = atoi(Value);
- else if (!strcasecmp(Name, "TunerAudioMode")) PvrSetup.TunerAudioMode = atoi(Value);
- else if (!strcasecmp(Name, "Brightness")) PvrSetup.Brightness.value = atoi(Value);
- else if (!strcasecmp(Name, "Contrast")) PvrSetup.Contrast.value = atoi(Value);
- else if (!strcasecmp(Name, "Saturation")) PvrSetup.Saturation.value = atoi(Value);
- else if (!strcasecmp(Name, "Hue")) PvrSetup.Hue.value = atoi(Value);
- else if (!strcasecmp(Name, "AudioVolumeTVCommon")) PvrSetup.AudioVolumeTVCommon.value = atoi(Value);
- else if (!strcasecmp(Name, "AudioVolumeTVException")) PvrSetup.AudioVolumeTVException.value = atoi(Value);
- else if (!strcasecmp(Name, "AudioVolumeTVExceptionCard")) PvrSetup.AudioVolumeTVExceptionCard = atoi(Value);
- else if (!strcasecmp(Name, "AudioVolumeFM")) PvrSetup.AudioVolumeFM.value = atoi(Value);
- else if (!strcasecmp(Name, "AudioSampling")) PvrSetup.AudioSampling.value = atoi(Value);
- else if (!strcasecmp(Name, "VideoBitrateTV")) PvrSetup.VideoBitrateTV.value = atoi(Value) * 1000;
- else if (!strcasecmp(Name, "AudioBitrate")) PvrSetup.AudioBitrate.value = atoi(Value);
- else if (!strcasecmp(Name, "BitrateMode")) PvrSetup.BitrateMode.value = atoi(Value);
- else if (!strcasecmp(Name, "AspectRatio")) PvrSetup.AspectRatio.value = atoi(Value);
- else if (!strcasecmp(Name, "StreamType")) PvrSetup.StreamType.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterSpatialMode")) PvrSetup.FilterSpatialMode.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterSpatial")) PvrSetup.FilterSpatial.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterLumaSpatialType")) PvrSetup.FilterLumaSpatialType.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterChromaSpatialType")) PvrSetup.FilterChromaSpatialType.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterTemporalMode")) PvrSetup.FilterTemporalMode.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterTemporal")) PvrSetup.FilterTemporal.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterMedianType")) PvrSetup.FilterMedianType.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterLumaMedianBottom")) PvrSetup.FilterLumaMedianBottom.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterLumaMedianTop")) PvrSetup.FilterLumaMedianTop.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterChromaMedianBottom")) PvrSetup.FilterChromaMedianBottom.value = atoi(Value);
- else if (!strcasecmp(Name, "FilterChromaMedianTop")) PvrSetup.FilterChromaMedianTop.value = atoi(Value);
- else if (!strcasecmp(Name, "HideMainMenuEntry")) PvrSetup.HideMainMenuEntry = atoi(Value);
- else if (!strcasecmp(Name, "TsBufferSizeMB")) PvrSetup.TsBufferSizeMB = atoi(Value);
- else if (!strcasecmp(Name, "TsBufferPrefillRatio")) PvrSetup.TsBufferPrefillRatio = atoi(Value);
- else if (!strcasecmp(Name, "UseExternChannelSwitchScript")) PvrSetup.UseExternChannelSwitchScript = atoi(Value);
- else if (!strcasecmp(Name, "ExternChannelSwitchSleep")) PvrSetup.ExternChannelSwitchSleep = atoi(Value);
- else if (!strcasecmp(Name, "HDPVR_AudioEncoding")) PvrSetup.HDPVR_AudioEncoding.value = atoi(Value) + 3;
- else if (!strcasecmp(Name, "HDPVR_AudioInput")) PvrSetup.HDPVR_AudioInput = atoi(Value);
- else
- return false;
+bool cPluginPvrInput::SetupParse(const char *Name, const char *Value)
+{
+ if (!strcasecmp(Name, "LogLevel")) PvrSetup.LogLevel = atoi(Value);
+ else if (!strcasecmp(Name, "UseOnlyCard")) PvrSetup.UseOnlyCard = atoi(Value);
+ else if (!strcasecmp(Name, "SliceVBI")) PvrSetup.SliceVBI = atoi(Value);
+ else if (!strcasecmp(Name, "TunerAudioMode")) PvrSetup.TunerAudioMode = atoi(Value);
+ else if (!strcasecmp(Name, "Brightness")) PvrSetup.Brightness.value = atoi(Value);
+ else if (!strcasecmp(Name, "Contrast")) PvrSetup.Contrast.value = atoi(Value);
+ else if (!strcasecmp(Name, "Saturation")) PvrSetup.Saturation.value = atoi(Value);
+ else if (!strcasecmp(Name, "Hue")) PvrSetup.Hue.value = atoi(Value);
+ else if (!strcasecmp(Name, "AudioVolumeTVCommon")) PvrSetup.AudioVolumeTVCommon.value = atoi(Value);
+ else if (!strcasecmp(Name, "AudioVolumeTVException")) PvrSetup.AudioVolumeTVException.value = atoi(Value);
+ else if (!strcasecmp(Name, "AudioVolumeTVExceptionCard")) PvrSetup.AudioVolumeTVExceptionCard = atoi(Value);
+ else if (!strcasecmp(Name, "AudioVolumeFM")) PvrSetup.AudioVolumeFM.value = atoi(Value);
+ else if (!strcasecmp(Name, "AudioSampling")) PvrSetup.AudioSampling.value = atoi(Value);
+ else if (!strcasecmp(Name, "VideoBitrateTV")) PvrSetup.VideoBitrateTV.value = atoi(Value) * 1000;
+ else if (!strcasecmp(Name, "AudioBitrate")) PvrSetup.AudioBitrate.value = atoi(Value);
+ else if (!strcasecmp(Name, "BitrateMode")) PvrSetup.BitrateMode.value = atoi(Value);
+ else if (!strcasecmp(Name, "AspectRatio")) PvrSetup.AspectRatio.value = atoi(Value);
+ else if (!strcasecmp(Name, "StreamType")) PvrSetup.StreamType.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterSpatialMode")) PvrSetup.FilterSpatialMode.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterSpatial")) PvrSetup.FilterSpatial.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterLumaSpatialType")) PvrSetup.FilterLumaSpatialType.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterChromaSpatialType")) PvrSetup.FilterChromaSpatialType.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterTemporalMode")) PvrSetup.FilterTemporalMode.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterTemporal")) PvrSetup.FilterTemporal.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterMedianType")) PvrSetup.FilterMedianType.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterLumaMedianBottom")) PvrSetup.FilterLumaMedianBottom.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterLumaMedianTop")) PvrSetup.FilterLumaMedianTop.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterChromaMedianBottom")) PvrSetup.FilterChromaMedianBottom.value = atoi(Value);
+ else if (!strcasecmp(Name, "FilterChromaMedianTop")) PvrSetup.FilterChromaMedianTop.value = atoi(Value);
+ else if (!strcasecmp(Name, "HideMainMenuEntry")) PvrSetup.HideMainMenuEntry = atoi(Value);
+ else if (!strcasecmp(Name, "TsBufferSizeMB")) PvrSetup.TsBufferSizeMB = atoi(Value);
+ else if (!strcasecmp(Name, "TsBufferPrefillRatio")) PvrSetup.TsBufferPrefillRatio = atoi(Value);
+ else if (!strcasecmp(Name, "UseExternChannelSwitchScript")) PvrSetup.UseExternChannelSwitchScript = atoi(Value);
+ else if (!strcasecmp(Name, "ExternChannelSwitchSleep")) PvrSetup.ExternChannelSwitchSleep = atoi(Value);
+ else if (!strcasecmp(Name, "HDPVR_AudioEncoding")) PvrSetup.HDPVR_AudioEncoding.value = atoi(Value) + 3;
+ else if (!strcasecmp(Name, "HDPVR_AudioInput")) PvrSetup.HDPVR_AudioInput = atoi(Value);
+ else return false;
return true;
}
diff --git a/pvrinput.h b/pvrinput.h
index 991b4ff..289d6ad 100644
--- a/pvrinput.h
+++ b/pvrinput.h
@@ -8,20 +8,20 @@ private:
public:
cPluginPvrInput(void);
virtual ~cPluginPvrInput();
- virtual const char * Version(void);
- virtual const char * Description(void);
- virtual const char * CommandLineHelp(void);
- virtual bool ProcessArgs(int argc, char * argv[]);
+ virtual const char *Version(void);
+ virtual const char *Description(void);
+ virtual const char *CommandLineHelp(void);
+ virtual bool ProcessArgs(int argc, char *argv[]);
virtual bool Initialize(void);
virtual bool Start(void);
virtual void Stop(void);
virtual void Housekeeping(void);
- virtual const char * MainMenuEntry(void);
- virtual cOsdObject * MainMenuAction(void);
- virtual cMenuSetupPage * SetupMenu(void);
- virtual bool SetupParse(const char * Name, const char * Value);
+ virtual const char *MainMenuEntry(void);
+ virtual cOsdObject *MainMenuAction(void);
+ virtual cMenuSetupPage *SetupMenu(void);
+ virtual bool SetupParse(const char *Name, const char *Value);
};
-extern cPluginPvrInput * PluginPvrInput;
+extern cPluginPvrInput *PluginPvrInput;
#endif
diff --git a/reader.c b/reader.c
index 27b4b75..1e4a42f 100644
--- a/reader.c
+++ b/reader.c
@@ -10,8 +10,7 @@ const short kAudioPid = 300;
const short kTeletextPid = 305;
const short kPCRPid = 101;
-const unsigned char kPAT[TS_SIZE] =
-{
+const unsigned char kPAT[TS_SIZE] = {
0x47, 0x40, 0x00, 0x10, 0x00, 0x00, 0xb0, 0x0d,
0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x01, 0xe0,
0x84, 0xcc, 0x32, 0xcc, 0x32, 0xff, 0xff, 0xff,
@@ -38,8 +37,7 @@ const unsigned char kPAT[TS_SIZE] =
0xff, 0xff, 0xff, 0xff
};
-const unsigned char kPMT[TS_SIZE] =
-{
+const unsigned char kPMT[TS_SIZE] = {
0x47, 0x40, 0x84, 0x10, 0x00, 0x02, 0xb0, 0x24,
0x00, 0x01, 0xc1, 0x00, 0x00, 0xe0, 0x65, 0xf0,
0x00, 0x02, 0xe1, 0x2d, 0xf0, 0x00, 0x04, 0xe1,
@@ -66,8 +64,7 @@ const unsigned char kPMT[TS_SIZE] =
0xff, 0xff, 0xff, 0xff
};
-const unsigned char kPMTRadio[TS_SIZE] =
-{
+const unsigned char kPMTRadio[TS_SIZE] = {
0x47, 0x40, 0x84, 0x10, 0x00, 0x02, 0xb0, 0x18,
0x00, 0x01, 0xc1, 0x00, 0x00, 0xe0, 0x65, 0xf0,
0x00, 0x04, 0xe1, 0x2c, 0xf0, 0x06, 0x0a, 0x04,
@@ -94,8 +91,7 @@ const unsigned char kPMTRadio[TS_SIZE] =
0xff, 0xff, 0xff, 0xff
};
-const unsigned char kInvTab[256] =
-{
+const unsigned char kInvTab[256] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
@@ -130,7 +126,7 @@ const unsigned char kInvTab[256] =
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
};
-cPvrReadThread::cPvrReadThread(cRingBufferLinear * TsBuffer, cPvrDevice* _parent)
+cPvrReadThread::cPvrReadThread(cRingBufferLinear *TsBuffer, cPvrDevice *_parent)
: tsBuffer(TsBuffer),
video_counter(0),
audio_counter(0),
@@ -144,41 +140,44 @@ cPvrReadThread::cPvrReadThread(cRingBufferLinear * TsBuffer, cPvrDevice* _parent
pes_scr_isvalid(false),
pes_scr(0),
pes_scr_ext(0)
-{ log(pvrDEBUG1,"cPvrReadThread");
- parent=_parent;
+{
+ log(pvrDEBUG1, "cPvrReadThread");
+ parent = _parent;
parent->readThreadRunning = true;
SetDescription("PvrReadThread of /dev/video%d", _parent->number);
Start();
}
-cPvrReadThread::~cPvrReadThread(void) {
- log(pvrDEBUG2,"~cPvrReadThread");
+cPvrReadThread::~cPvrReadThread(void)
+{
+ log(pvrDEBUG2, "~cPvrReadThread");
parent->readThreadRunning = false;
if (Running())
Cancel(3);
}
-int cPvrReadThread::PutData(const unsigned char *Data, int Count) {
+int cPvrReadThread::PutData(const unsigned char *Data, int Count)
+{
if (!tsBuffer) {
- log(pvrINFO,"cPvrReadThread::PutData():Unable to put data into RingBuffer");
- return 0;
- }
+ log(pvrINFO,"cPvrReadThread::PutData():Unable to put data into RingBuffer");
+ return 0;
+ }
int bytesFree = tsBuffer->Free();
if (bytesFree < Count) {
- log(pvrERROR,"cPvrReadThread::PutData():Unable to put data into RingBuffer, only %d bytes free, need %d", bytesFree, Count);
- return 0;
- }
+ log(pvrERROR,"cPvrReadThread::PutData():Unable to put data into RingBuffer, only %d bytes free, need %d", bytesFree, Count);
+ return 0;
+ }
int written = tsBuffer->Put(Data, Count);
if (written != Count) {
- log(pvrERROR,"cPvrReadThread::PutData():put incomplete data into RingBuffer, only %d bytes written, wanted %d", written, Count);
- tsBuffer->ReportOverflow(Count - written);
- }
- //log(pvrDEBUG2, "cPvrReadThread::PutData():packet written");
+ log(pvrERROR,"cPvrReadThread::PutData():put incomplete data into RingBuffer, only %d bytes written, wanted %d", written, Count);
+ tsBuffer->ReportOverflow(Count - written);
+ }
return written;
}
-void cPvrReadThread::PesToTs(uint8_t * Data, uint32_t Length) {
+void cPvrReadThread::PesToTs(uint8_t *Data, uint32_t Length)
+{
uint8_t stream_id;
bool first = true;
uint32_t i;
@@ -190,43 +189,43 @@ void cPvrReadThread::PesToTs(uint8_t * Data, uint32_t Length) {
stream_id = Data[3];
if (packet_counter <= 0) { // time to send PAT and PMT
- // increase continuity counter
- pat_buffer[ 3]= (pat_buffer[ 3] & 0xF0) | (((pat_buffer[ 3] & 0x0F) + 1) & 0x0F);
- pmt_buffer[ 3]= (pmt_buffer[ 3] & 0xF0) | (((pmt_buffer[ 3] & 0x0F) + 1) & 0x0F);
- PutData(pat_buffer, TS_SIZE);
- PutData(pmt_buffer, TS_SIZE);
- packet_counter = SENDPATPMT_PACKETINTERVAL;
- }
+ // increase continuity counter
+ pat_buffer[ 3] = (pat_buffer[ 3] & 0xF0) | (((pat_buffer[ 3] & 0x0F) + 1) & 0x0F);
+ pmt_buffer[ 3] = (pmt_buffer[ 3] & 0xF0) | (((pmt_buffer[ 3] & 0x0F) + 1) & 0x0F);
+ PutData(pat_buffer, TS_SIZE);
+ PutData(pmt_buffer, TS_SIZE);
+ packet_counter = SENDPATPMT_PACKETINTERVAL;
+ }
if (pes_scr_isvalid) { // send PCR packet
- ts_buffer[0] = TS_SYNC_BYTE;
- ts_buffer[1] = kPCRPid >> 8;
- ts_buffer[2] = kPCRPid & 0xFF;
- ts_buffer[3] = 0x20 | pcr_counter;
- ts_buffer[4] = 0xB7;
- ts_buffer[5] = 0x10;
- ts_buffer[6] = (pes_scr & 0x01FE000000ull) >> 25; // 33 bits SCR base
- ts_buffer[7] = (pes_scr & 0x01FE0000) >> 17;
- ts_buffer[8] = (pes_scr & 0x01FE00) >> 9;
- ts_buffer[9] = (pes_scr & 0x01FE) >> 1;
- ts_buffer[10] = (pes_scr & 0x01) << 7;
- ts_buffer[10] |= 0x7E; // 6 bits between SCR and SCR extension
- ts_buffer[10] |= (pes_scr_ext & 0x0100) >> 8; // 9 bits SCR extension
- ts_buffer[11] = (pes_scr_ext & 0xFF);
- memset(ts_buffer + 12, 0xFF, TS_SIZE - 12);
- PutData(ts_buffer, TS_SIZE);
- pcr_counter = (pcr_counter + 1) & 15;
- pes_scr_isvalid = false;
- }
+ ts_buffer[0] = TS_SYNC_BYTE;
+ ts_buffer[1] = kPCRPid >> 8;
+ ts_buffer[2] = kPCRPid & 0xFF;
+ ts_buffer[3] = 0x20 | pcr_counter;
+ ts_buffer[4] = 0xB7;
+ ts_buffer[5] = 0x10;
+ ts_buffer[6] = (pes_scr & 0x01FE000000ull) >> 25; // 33 bits SCR base
+ ts_buffer[7] = (pes_scr & 0x01FE0000) >> 17;
+ ts_buffer[8] = (pes_scr & 0x01FE00) >> 9;
+ ts_buffer[9] = (pes_scr & 0x01FE) >> 1;
+ ts_buffer[10] = (pes_scr & 0x01) << 7;
+ ts_buffer[10] |= 0x7E; // 6 bits between SCR and SCR extension
+ ts_buffer[10] |= (pes_scr_ext & 0x0100) >> 8; // 9 bits SCR extension
+ ts_buffer[11] = (pes_scr_ext & 0xFF);
+ memset(ts_buffer + 12, 0xFF, TS_SIZE - 12);
+ PutData(ts_buffer, TS_SIZE);
+ pcr_counter = (pcr_counter + 1) & 15;
+ pes_scr_isvalid = false;
+ }
switch (stream_id) {
case 0xC0 ... 0xEF:
if (stream_id < 0xE0) {
- pid = &kAudioPid;
- counter = &audio_counter;
- }
+ pid = &kAudioPid;
+ counter = &audio_counter;
+ }
else if (parent->EncoderInput == eRadio)
- return;
+ return;
for (i = 0; i < Payload_Count; i++) {
ts_buffer[0] = TS_SYNC_BYTE;
ts_buffer[1] = (first ? 0x40 : 0x00) | (*pid >> 8);
@@ -239,11 +238,11 @@ void cPvrReadThread::PesToTs(uint8_t * Data, uint32_t Length) {
first = false;
} // end: for (i = 0; i < Payload_Count; i++)
if (Payload_Rest > 0) {
- ts_buffer[0] = TS_SYNC_BYTE;
- ts_buffer[1] = (first ? 0x40 : 0x00) | (*pid >> 8);
- ts_buffer[2] = *pid & 0xFF;
- ts_buffer[3] = 0x30 | *counter;
- ts_buffer[4] = PayloadSize - Payload_Rest - 1;
+ ts_buffer[0] = TS_SYNC_BYTE;
+ ts_buffer[1] = (first ? 0x40 : 0x00) | (*pid >> 8);
+ ts_buffer[2] = *pid & 0xFF;
+ ts_buffer[3] = 0x30 | *counter;
+ ts_buffer[4] = PayloadSize - Payload_Rest - 1;
if (ts_buffer[4] > 0) {
ts_buffer[5] = 0x00;
memset(ts_buffer + 6, 0xFF, ts_buffer[4] - 1);
@@ -256,7 +255,7 @@ void cPvrReadThread::PesToTs(uint8_t * Data, uint32_t Length) {
} // end: if (Payload_Rest > 0)
break; // end: case 0xE0..0xEF:
case 0xBD: {
- uint8_t * payload_data;
+ uint8_t *payload_data;
uint16_t payload_length;
uint32_t pos = 0;
uint32_t ts_pos = 0;
@@ -270,20 +269,19 @@ void cPvrReadThread::PesToTs(uint8_t * Data, uint32_t Length) {
payload_data = Data + 9 + Data[8];
if (memcmp(payload_data, "itv0", 4) == 0)
pos = 12;
+ else if (memcmp(payload_data, "ITV0", 4) == 0)
+ pos = 4;
else
- if (memcmp(payload_data, "ITV0", 4) == 0)
- pos = 4;
- else
- return;
+ return;
+
while (pos + 43 <= payload_length) {
if ((payload_data[pos] & 0x0F) == 0x01) { //VBI_TYPE_TELETEXT
- ts_buffer[4+ts_pos*46] = 0x02; // data_unit_id
- ts_buffer[5+ts_pos*46] = 0x2C; // data_unit_length
- ts_buffer[6+ts_pos*46] = 0x00; // field_parity, line_offset
- ts_buffer[7+ts_pos*46] = 0xE4; // framing_code
- for (int j = 0; j < 42; j++) {
+ ts_buffer[4 + ts_pos * 46] = 0x02; // data_unit_id
+ ts_buffer[5 + ts_pos * 46] = 0x2C; // data_unit_length
+ ts_buffer[6 + ts_pos * 46] = 0x00; // field_parity, line_offset
+ ts_buffer[7 + ts_pos * 46] = 0xE4; // framing_code
+ for (int j = 0; j < 42; j++)
ts_buffer[8 + ts_pos * 46 + j] = kInvTab[payload_data[pos + 1 + j]];
- }
ts_pos++;
if (ts_pos == 4) {
ts_pos = 0;
@@ -311,7 +309,8 @@ void cPvrReadThread::PesToTs(uint8_t * Data, uint32_t Length) {
} // end: switch (stream_id)
}
-void cPvrReadThread::ParseProgramStream(uint8_t * Data, uint32_t Length) {
+void cPvrReadThread::ParseProgramStream(uint8_t *Data, uint32_t Length)
+{
uint32_t pos = 0;
while (pos < Length) {
switch(pes_offset) {
@@ -460,7 +459,8 @@ void cPvrReadThread::ParseProgramStream(uint8_t * Data, uint32_t Length) {
} // end: while (pos < Length)
}
-void cPvrReadThread::Action(void) {
+void cPvrReadThread::Action(void)
+{
unsigned char buffer[BUFFSIZE_INPUT];
int r;
int retries = 3;
@@ -510,7 +510,7 @@ void cPvrReadThread::Action(void) {
r = read(parent->v4l2_fd, buffer, BUFFSIZE_INPUT);
if (r < 0) {
log(pvrERROR, "cPvrReadThread::Action():error reading from /dev/video%d: %d:%s %s",
- parent->number, errno, strerror(errno), (--retries > 0) ? " - retrying" : "");
+ parent->number, errno, strerror(errno), (--retries > 0) ? " - retrying" : "");
if (retries > 0) {
usleep(100);
goto retry;
diff --git a/reader.h b/reader.h
index c7f5f5b..36b8b2e 100644
--- a/reader.h
+++ b/reader.h
@@ -1,12 +1,12 @@
-#ifndef _PVR_READER_H_
-#define _PVR_READER_H_
+#ifndef _PVRINPUT_READER_H_
+#define _PVRINPUT_READER_H_
#include "common.h"
class cPvrReadThread : public cThread {
private:
- cPvrDevice* parent;
- cRingBufferLinear * tsBuffer;
+ cPvrDevice *parent;
+ cRingBufferLinear *tsBuffer;
uint8_t pat_buffer[TS_SIZE];
uint8_t pmt_buffer[TS_SIZE];
uint8_t ts_buffer[TS_SIZE];
@@ -24,13 +24,13 @@ private:
uint64_t pes_scr;
uint32_t pes_scr_ext;
- void ParseProgramStream(uint8_t * Data, uint32_t Length);
- void PesToTs(uint8_t * Data, uint32_t Length);
- int PutData(const unsigned char * Data, int Count);
+ void ParseProgramStream(uint8_t *Data, uint32_t Length);
+ void PesToTs(uint8_t *Data, uint32_t Length);
+ int PutData(const unsigned char *Data, int Count);
protected:
virtual void Action(void);
public:
- cPvrReadThread(cRingBufferLinear * TsBuffer, cPvrDevice* _parent);
+ cPvrReadThread(cRingBufferLinear *TsBuffer, cPvrDevice *_parent);
virtual ~cPvrReadThread(void);
};
diff --git a/setup.c b/setup.c
index dc1e1a1..00bfcb9 100644
--- a/setup.c
+++ b/setup.c
@@ -1,6 +1,7 @@
#include "common.h"
-cPvrSetup::cPvrSetup(void) {
+cPvrSetup::cPvrSetup(void)
+{
HideMainMenuEntry = 1; // hide main menu entry
UseOnlyCard = 8; // Use all cards
LogLevel = 2; // errors and info messages
@@ -45,8 +46,8 @@ cPvrSetup::cPvrSetup(void) {
FilterChromaMedianBottom.value = INVALID_VALUE; // default value in QueryAllControls
FilterChromaMedianTop.value = INVALID_VALUE; // default value in QueryAllControls
- HDPVR_AudioEncoding.value = INVALID_VALUE;
- HDPVR_AudioInput = 0;
+ HDPVR_AudioEncoding.value = INVALID_VALUE;
+ HDPVR_AudioInput = 0;
}
cPvrSetup PvrSetup;
diff --git a/setup.h b/setup.h
index d1a746e..e5ff35a 100644
--- a/setup.h
+++ b/setup.h
@@ -1,5 +1,5 @@
-#ifndef _PVR_SETUP_H_
-#define _PVR_SETUP_H_
+#ifndef _PVRINPUT_SETUP_H_
+#define _PVRINPUT_SETUP_H_
#include "common.h"