summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dxr3interface.c52
-rw-r--r--dxr3interface.h38
2 files changed, 73 insertions, 17 deletions
diff --git a/dxr3interface.c b/dxr3interface.c
index efe1d46..052cd43 100644
--- a/dxr3interface.c
+++ b/dxr3interface.c
@@ -1,9 +1,9 @@
#include <assert.h>
#include <math.h>
#include <sys/soundcard.h>
+
#include "dxr3interface.h"
#include "dxr3syncbuffer.h"
-
#include "dxr3log.h"
#include "dxr3configdata.h"
@@ -36,6 +36,7 @@ static int Dxr3Open(const char *Name, int n, int Mode)
}
// ==================================
+// constr.
cDxr3Interface::cDxr3Interface()
{
// open control stream
@@ -88,6 +89,16 @@ cDxr3Interface::cDxr3Interface()
// configure device based on settings
ConfigureDevice();
+ // get bcs values from driver
+ ioctl(m_fdControl, EM8300_IOCTL_GETBCS, &m_bcs);
+
+ if (cDxr3ConfigData::Instance().GetDebug())
+ {
+ cLog::Instance() << "DXR3: brightness: " << m_bcs.brightness << "\n";
+ cLog::Instance() << "DXR3: contrast: " << m_bcs.contrast << "\n";
+ cLog::Instance() << "DXR3: saturation: " << m_bcs.saturation << "\n";
+ }
+
PlayBlackFrame();
SetChannelCount(1);
}
@@ -213,7 +224,7 @@ void cDxr3Interface::SetAudioSpeed(uint32_t speed)
{
if (m_audioMode != EM8300_AUDIOMODE_DIGITALAC3)
{
- if(ioctl(m_fdAudio, SNDCTL_DSP_SPEED, &speed) < 0)
+ if (ioctl(m_fdAudio, SNDCTL_DSP_SPEED, &speed) < 0)
{
cLog::Instance() << "cDxr3AbsDevice::SetAudioSpeed Unable to set dsp speed\n";
}
@@ -1069,5 +1080,42 @@ void cDxr3Interface::ResetHardware()
Unlock();
}
+// set brightness/contrast/saturation
+// ==================================
+// set brightness
+void cDxr3Interface::SetBrightness(int value)
+{
+ m_bcs.brightness = value;
+
+ if (ioctl(m_fdControl, EM8300_IOCTL_SETBCS, &m_bcs) < 0)
+ {
+ cLog::Instance() << "cDxr3Interface::SetBrightness: Unable to set brightness to " << value << "\n";
+ }
+}
+
+// ==================================
+// set contrast
+void cDxr3Interface::SetContrast(int value)
+{
+ m_bcs.contrast = value;
+
+ if (ioctl(m_fdControl, EM8300_IOCTL_SETBCS, &m_bcs) < 0)
+ {
+ cLog::Instance() << "cDxr3Interface::SetContrast: Unable to set contrast to " << value << "\n";
+ }
+}
+
+// ==================================
+// set saturation
+void cDxr3Interface::SetSaturation(int value)
+{
+ m_bcs.saturation = value;
+
+ if (ioctl(m_fdControl, EM8300_IOCTL_SETBCS, &m_bcs) < 0)
+ {
+ cLog::Instance() << "cDxr3Interface::SetSaturation: Unable to set saturation to " << value << "\n";
+ }
+}
+
// ==================================
cMutex* cDxr3Interface::m_pMutex = new cMutex;
diff --git a/dxr3interface.h b/dxr3interface.h
index d1df60e..1041ad9 100644
--- a/dxr3interface.h
+++ b/dxr3interface.h
@@ -94,6 +94,11 @@ public:
// helper functions for dxr3 main osd screen
void ResetHardware();
+ // set brightness/contrast/saturation
+ void SetBrightness(int value);
+ void SetContrast(int value);
+ void SetSaturation(int value);
+
private:
// file handles
int m_fdControl;
@@ -102,21 +107,24 @@ private:
int m_fdAudio;
// dxr3 clock
- cDxr3SysClock* m_pClock;
-
- uint32_t m_audioChannelCount;
- uint32_t m_audioDataRate;
- int m_aspectDelayCounter;
- uint32_t m_aspectRatio;
- uint32_t m_horizontal;
- uint32_t m_audioSampleSize;
- uint32_t m_audioMode;
- uint32_t m_spuMode;
- bool m_ExternalReleased; // is dxr3 used by e.g. mplayer?
- int m_volume;
- bool m_AudioActive;
- bool m_VideoActive;
- bool m_OverlayActive;
+ cDxr3SysClock* m_pClock;
+
+ uint32_t m_audioChannelCount;
+ uint32_t m_audioDataRate;
+ int m_aspectDelayCounter;
+ uint32_t m_aspectRatio;
+ uint32_t m_horizontal;
+ uint32_t m_audioSampleSize;
+ uint32_t m_audioMode;
+ uint32_t m_spuMode;
+ bool m_ExternalReleased; // is dxr3 used by e.g. mplayer?
+ int m_volume;
+ bool m_AudioActive;
+ bool m_VideoActive;
+ bool m_OverlayActive;
+
+ // bcs
+ em8300_bcs_t m_bcs;
// spu
// cDxr3InterfaceSpu m_SpuInterface;