summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--dxr3.c268
-rw-r--r--dxr3.h134
-rw-r--r--dxr3dolbydigital.c56
-rw-r--r--dxr3dolbydigital.h47
5 files changed, 465 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index 7d9fa05..855fc10 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
-# $Id: Makefile,v 1.1 2004/08/05 23:05:21 austriancoder Exp $
+# $Id: Makefile,v 1.2 2004/09/18 00:09:20 austriancoder Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
@@ -55,13 +55,18 @@ DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
DEFINES += -DSOCKET_CHMOD=0660
DEFINES += -D_GNU_SOURCE
+# where is the microcode for the dxr3 located?
+export MICROCODE := /usr/share/misc/em8300.uc
+
+EXTRA_CFLAGS := -DMICROCODE=\"$(MICROCODE)\"
+
### The object files (add further files here):
OBJS = $(PLUGIN).o dxr3multichannelaudio.o dxr3sysclock.o dxr3colormanager.o dxr3syncbuffer.o dxr3audiodecoder.o \
dxr3blackframe.o dxr3palettemanager.o dxr3nextpts.o dxr3pesframe.o dxr3demuxdevice.o dxr3configdata.o \
dxr3log.o dxr3ffmpeg.o dxr3interface_spu_encoder.o dxr3i18n.o \
dxr3interface.o dxr3device.o dxr3outputthread.o dxr3osd.o dxr3osd_subpicture.o dxr3spudecoder.o dxr3unixserversocket.o \
-dxr3cpu.o dxr3memcpy.o
+dxr3cpu.o dxr3memcpy.o dxr3dolbydigital.o
### Implicit rules:
diff --git a/dxr3.c b/dxr3.c
index 0024a48..b030779 100644
--- a/dxr3.c
+++ b/dxr3.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
-* $Id: dxr3.c,v 1.1 2004/08/05 23:05:21 austriancoder Exp $
+* $Id: dxr3.c,v 1.2 2004/09/18 00:11:11 austriancoder Exp $
*/
@@ -12,14 +12,15 @@
#include "dxr3syncbuffer.h"
#include "dxr3configdata.h"
#include "dxr3interface.h"
+#include "dxr3i18n.h"
+#include "dxr3cpu.h"
+#include "dxr3dolbydigital.h"
#include "dxr3.h"
static const char *VERSION = "0.2.3-pre3-cvs";
static const char *DESCRIPTION = "DXR3-MPEG decoder plugin";
static const char *MAINMENUENTRY = "DXR3";
-#include "dxr3cpu.h"
-
// ==================================
// 'message-handler' for the main screen
eOSState cDxr3OsdItem::ProcessKey(eKeys Key)
@@ -63,6 +64,250 @@ eOSState cDxr3OsdItem::ProcessKey(eKeys Key)
}
// ==================================
+// special osd item to change color settings
+cDxr3OsdColorItem::cDxr3OsdColorItem(const char* Name, eDxr3ColorItem item)
+:cMenuEditItem(Name), m_item(item)
+{
+ m_value = 0;
+ m_min = 0;
+ m_max = 32;
+
+ // get vale from setup.conf
+ switch (m_item)
+ {
+ case DXR3_BRIGHTNESS:
+ m_value = cDxr3ConfigData::Instance().GetBrightness();
+ break;
+
+ case DXR3_CONTRAST:
+ m_value = cDxr3ConfigData::Instance().GetContrast();
+ break;
+
+ case DXR3_SATURATION:
+ m_value = cDxr3ConfigData::Instance().GetSaturation();
+ break;
+ };
+
+ Set();
+}
+
+// ==================================
+// react to keypresses
+eOSState cDxr3OsdColorItem::ProcessKey(eKeys Key)
+{
+ eOSState state = cMenuEditItem::ProcessKey(Key);
+
+ if (state == osUnknown)
+ {
+ int newValue = m_value;
+ Key = NORMALKEY(Key);
+ switch (Key)
+ {
+ case kNone: break;
+ case k0 ... k9:
+ if (fresh)
+ {
+ m_value = 0;
+ fresh = false;
+ }
+ newValue = m_value * 10 + (Key - k0);
+ break;
+ case kLeft: // TODO might want to increase the delta if repeated quickly?
+ newValue = m_value - 1;
+ fresh = true;
+ break;
+ case kRight:
+ newValue = m_value + 1;
+ fresh = true;
+ break;
+ default:
+ if (m_value < m_min) { m_value = m_min; Set(); }
+ if (m_value > m_max) { m_value = m_max; Set(); }
+ return state;
+ }
+ if ((!fresh || m_min <= newValue) && newValue <= m_max)
+ {
+ m_value = newValue;
+ Set();
+ }
+ state = osContinue;
+ }
+ return state;
+}
+
+// ==================================
+// set caption and call hardware ioctl's
+void cDxr3OsdColorItem::Set()
+{
+ // real value with rounding
+ int realValue = int(m_value * 31.25);
+
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%s", "Hallo");
+ SetValue(buf);
+}
+
+/*
+// ==================================
+// special osd item to change color settings
+cDxr3OsdColorItem::cDxr3OsdColorItem(const char* Name, eDxr3ColorItem item)
+:cOsdItem(Name), m_item(item)
+{
+ // get vale from setup.conf
+ switch (m_item)
+ {
+ case DXR3_BRIGHTNESS:
+ m_value = cDxr3ConfigData::Instance().GetBrightness();
+ break;
+
+ case DXR3_CONTRAST:
+ m_value = cDxr3ConfigData::Instance().GetContrast();
+ break;
+
+ case DXR3_SATURATION:
+ m_value = cDxr3ConfigData::Instance().GetSaturation();
+ break;
+ };
+
+ // allowed values: 0 - 32
+ m_min = 0;
+ m_max = 32;
+
+ m_name = strdup(Name);
+ m_caption = NULL;
+
+ Set();
+}
+
+// ==================================
+// set caption and call hardware ioctl's
+void cDxr3OsdColorItem::Set()
+{
+/*
+ SetValue(SettingBar[m_value]);
+
+ // real value with rounding
+ int realValue = int(m_value * 31.25);
+
+ switch (m_item)
+ {
+ case DXR3_BRIGHTNESS:
+ cDxr3Interface::Instance().SetBrightness(realValue);
+ cDxr3ConfigData::Instance().SetBrightness(m_value);
+ break;
+
+ case DXR3_CONTRAST:
+ cDxr3Interface::Instance().SetContrast(realValue);
+ cDxr3ConfigData::Instance().SetContrast(m_value);
+ break;
+
+ case DXR3_SATURATION:
+ cDxr3Interface::Instance().SetSaturation(realValue);
+ cDxr3ConfigData::Instance().SetSaturation(m_value);
+ break;
+ };
+*//*
+}
+
+// ==================================
+void cDxr3OsdColorItem::SetValue(const char *Value)
+{
+/*
+ free(m_caption);
+ m_caption = strdup(Value);
+ char *buffer = NULL;
+ asprintf(&buffer, "%s:\t%s", m_name, m_caption);
+ SetText(buffer, false);
+ cStatus::MsgOsdCurrentItem(buffer);
+*//*
+}
+
+// ==================================
+// react to keypresses
+eOSState cDxr3OsdColorItem::ProcessKey(eKeys Key)
+{
+/*
+ eOSState state = osUnknown;
+
+ if (state == osUnknown)
+ {
+ int newValue = m_value;
+ Key = NORMALKEY(Key);
+
+ switch (Key)
+ {
+ case kNone:
+ break;
+
+ case k0 ... k9:
+ if (fresh)
+ {
+ m_value = 0;
+ fresh = false;
+ }
+ newValue = m_value * 10 + (Key - k0);
+ break;
+
+ case kLeft: // TODO might want to increase the delta if repeated quickly?
+ newValue = m_value - 1;
+ fresh = true;
+ break;
+
+ case kRight:
+ newValue = m_value + 1;
+ fresh = true;
+ break;
+
+ default:
+ if (m_value < m_min) { m_value = m_min; Set(); }
+ if (m_value > m_max) { m_value = m_max; Set(); }
+ return state;
+ }
+
+ if ((!fresh || m_min <= newValue) && newValue <= m_max)
+ {
+ m_value = newValue;
+ Set();
+ }
+ state = osContinue;
+ }
+ return state;
+*/
+//}
+
+
+// ==================================
+// the main menu of the plugin
+cDxr3OsdMenu::cDxr3OsdMenu() : cOsdMenu(tr("DXR3 Adjustment"))
+{
+ b = 0;
+ c = 10;
+ s = 0;
+
+ Clear();
+ SetHasHotkeys();
+ Add(new cDxr3OsdItem(tr("Reset DXR3 Hardware"), DXR3_RESET_HARDWARE));
+ Add(new cDxr3OsdItem(tr("Toggle Force LetterBox"), DXR3_FORCE_LETTER_BOX));
+
+ // switch between differen output modes
+ if (cDxr3ConfigData::Instance().GetUseDigitalOut())
+ {
+ Add(new cDxr3OsdItem(tr("Analog Output"), DXR3_ANALOG_OUT));
+ }
+ else
+ {
+ Add(new cDxr3OsdItem(tr("Digital Output"), DXR3_DIGITAL_OUT));
+ }
+
+ //SettingBar
+ Add(new cDxr3OsdColorItem(tr("Brightness"), DXR3_BRIGHTNESS));
+// Add(new cMenuEditStraItem(tr("Brightness"), &b, 33, SettingBar));
+// Add(new cMenuEditStraItem(tr("Contrast"), &c, 33, SettingBar));
+// Add(new cMenuEditStraItem(tr("Saturation"), &s, 33, SettingBar));
+}
+
+
+// ==================================
// setup menu
cMenuSetupDxr3::cMenuSetupDxr3(void)
{
@@ -82,11 +327,11 @@ cMenuSetupDxr3::cMenuSetupDxr3(void)
// save menu values
void cMenuSetupDxr3::Store(void)
{
- SetupStore("UseDigitalOut", cDxr3ConfigData::Instance().SetUseDigitalOut(newUseDigitalOut));
- SetupStore("Dxr3Card", cDxr3ConfigData::Instance().SetDxr3Card(newDxr3Card));
- SetupStore("Dxr3VideoMode", cDxr3ConfigData::Instance().SetVideoMode((eVideoMode) newVideoMode));
- SetupStore("Dxr3Debug", cDxr3ConfigData::Instance().SetDebug(newDebug));
- SetupStore("Dxr3DebugLevel", cDxr3ConfigData::Instance().SetDebugLevel(newDebugLevel));
+ SetupStore("UseDigitalOut", cDxr3ConfigData::Instance().SetUseDigitalOut(newUseDigitalOut));
+ SetupStore("Dxr3Card", cDxr3ConfigData::Instance().SetDxr3Card(newDxr3Card));
+ SetupStore("Dxr3VideoMode", cDxr3ConfigData::Instance().SetVideoMode((eVideoMode) newVideoMode));
+ SetupStore("Dxr3Debug", cDxr3ConfigData::Instance().SetDebug(newDebug));
+ SetupStore("Dxr3DebugLevel", cDxr3ConfigData::Instance().SetDebugLevel(newDebugLevel));
}
// ==================================
@@ -139,14 +384,18 @@ bool cPluginDxr3::ProcessArgs(int argc, char *argv[])
// ==================================
bool cPluginDxr3::Start()
{
+ new cDxr3DolbyDigital();
return true;
}
// ==================================
bool cPluginDxr3::Initialize()
{
+ RegisterI18n(Phrases);
+
new cDxr3CPU();
cDxr3Device::Instance();
+
return true;
}
@@ -170,6 +419,9 @@ bool cPluginDxr3::SetupParse(const char *Name, const char *Value)
if (!strcasecmp(Name, "Dxr3Debug")) { cDxr3ConfigData::Instance().SetDebug(atoi(Value)); return true; }
if (!strcasecmp(Name, "Dxr3VideoMode")) { cDxr3ConfigData::Instance().SetVideoMode((eVideoMode) atoi(Value)); return true;}
if (!strcasecmp(Name, "Dxr3DebugLevel")) { cDxr3ConfigData::Instance().SetDebugLevel(atoi(Value)); return true;}
+ if (!strcasecmp(Name, "Dxr3Contrast")) { cDxr3ConfigData::Instance().SetContrast(atoi(Value)); return true;}
+ if (!strcasecmp(Name, "Dxr3Brightness")) { cDxr3ConfigData::Instance().SetBrightness(atoi(Value)); return true;}
+ if (!strcasecmp(Name, "Dxr3Saturation")) { cDxr3ConfigData::Instance().SetSaturation(atoi(Value)); return true;}
return false;
}
diff --git a/dxr3.h b/dxr3.h
index 069f488..bf3cbca 100644
--- a/dxr3.h
+++ b/dxr3.h
@@ -1,7 +1,6 @@
#ifndef _DXR3_H_
#define _DXR3_H_
-// --- cMenuSetupDxr3 -------------------------------------------------------
const char* menuVideoModes[] =
{
"PAL",
@@ -16,6 +15,44 @@ const char* menuDebugModes[] =
"Everything"
};
+// color setting bar
+static const char *SettingBar[] =
+{
+ "[................................]",
+ "[|...............................]",
+ "[||..............................]",
+ "[|||.............................]",
+ "[||||............................]",
+ "[|||||...........................]",
+ "[||||||..........................]",
+ "[|||||||.........................]",
+ "[||||||||........................]",
+ "[|||||||||.......................]",
+ "[||||||||||......................]",
+ "[|||||||||||.....................]",
+ "[||||||||||||....................]",
+ "[|||||||||||||...................]",
+ "[||||||||||||||..................]",
+ "[|||||||||||||||.................]",
+ "[||||||||||||||||................]",
+ "[|||||||||||||||||...............]",
+ "[||||||||||||||||||..............]",
+ "[|||||||||||||||||||.............]",
+ "[||||||||||||||||||||............]",
+ "[|||||||||||||||||||||...........]",
+ "[||||||||||||||||||||||..........]",
+ "[|||||||||||||||||||||||.........]",
+ "[||||||||||||||||||||||||........]",
+ "[|||||||||||||||||||||||||.......]",
+ "[||||||||||||||||||||||||||......]",
+ "[|||||||||||||||||||||||||||.....]",
+ "[||||||||||||||||||||||||||||....]",
+ "[|||||||||||||||||||||||||||||...]",
+ "[||||||||||||||||||||||||||||||..]",
+ "[|||||||||||||||||||||||||||||||.]"
+ "[||||||||||||||||||||||||||||||||]" // 32 x |
+};
+
// ==================================
// setup screen
class cMenuSetupDxr3 : public cMenuSetupPage
@@ -46,6 +83,14 @@ enum eDxr3OsdItem
};
// ==================================
+enum eDxr3ColorItem
+{
+ DXR3_BRIGHTNESS,
+ DXR3_CONTRAST,
+ DXR3_SATURATION
+};
+
+// ==================================
// osd item
class cDxr3OsdItem : public cOsdItem
{
@@ -60,48 +105,59 @@ protected:
};
// ==================================
+// used to change color settings
+class cDxr3OsdColorItem : public cMenuEditItem
+{
+public:
+ cDxr3OsdColorItem(const char* text, eDxr3ColorItem item);
+ virtual eOSState ProcessKey(eKeys Key);
+
+protected:
+ eDxr3ColorItem m_item;
+ int m_value;
+ int m_min;
+ int m_max;
+
+ virtual void Set();
+};
+
+/*
+// ==================================
+// used to change color settings
+class cDxr3OsdColorItem : public cOsdItem//cMenuEditItem
+{
+public:
+ cDxr3OsdColorItem(const char* text, eDxr3ColorItem item);
+
+ cDxr3OsdColorItem::~cDxr3OsdColorItem()
+ {
+ free(m_name);
+ free(m_caption);
+ }
+
+ eOSState ProcessKey(eKeys Key);
+
+protected:
+ eDxr3ColorItem m_item;
+ int m_value;
+ int m_min;
+ int m_max;
+ char* m_caption;
+ char* m_name;
+
+ void Set();
+ void SetValue(const char *Value);
+};
+*/
+
+// ==================================
// main screen
class cDxr3OsdMenu : public cOsdMenu
{
public:
- cDxr3OsdMenu(): cOsdMenu("DXR3 Adjustment")
- {
- Clear();
- SetHasHotkeys();
- Add(new cDxr3OsdItem(hk("Reset DXR3 Hardware"), DXR3_RESET_HARDWARE));
- Add(new cDxr3OsdItem(hk("Toggle Force LetterBox"), DXR3_FORCE_LETTER_BOX));
-
- if (cDxr3ConfigData::Instance().GetUseDigitalOut())
- {
- Add(new cDxr3OsdItem(hk("Analog Output"), DXR3_ANALOG_OUT));
- }
- else
- {
- Add(new cDxr3OsdItem(hk("Digital Output"), DXR3_DIGITAL_OUT));
- }
-/*
- if (cDxr3ConfigData::Instance().GetUseDigitalOut())
- {
- Add(new cDxr3OsdItem(hk("Analog Output"), DXR3_ANALOG_OUT));
-
- if (cDxr3ConfigData::Instance().GetAc3OutPut())
- {
- Add(new cDxr3OsdItem(hk("AC3 Output Off"), DXR3_AC3_OUT));
- }
- else
- {
- if (cDxr3Interface::Instance().IsAc3Present())
- {
- Add(new cDxr3OsdItem(hk("AC3 Output On"), DXR3_AC3_OUT));
- }
- }
- }
- else
- {
- Add(new cDxr3OsdItem(hk("Digital Output"), DXR3_DIGITAL_OUT));
- }
- */
- }
+ cDxr3OsdMenu();
+
+ int b,c,s;
};
#endif /*_DXR3_H_*/
diff --git a/dxr3dolbydigital.c b/dxr3dolbydigital.c
new file mode 100644
index 0000000..67bfb03
--- /dev/null
+++ b/dxr3dolbydigital.c
@@ -0,0 +1,56 @@
+/*
+* dxr3dolbydigital.c
+*
+* Copyright (C) 2004 Christian Gmeiner
+*
+* Taken from Nesseia-Renderengine Copyright (C) 2003-2004 Christian Gmeiner
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public License
+* as published by the Free Software Foundation; either version 2.1
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include "dxr3dolbydigital.h"
+#include "dxr3device.h"
+#include "dxr3configdata.h"
+
+// ==================================
+//! play
+void cDxr3DolbyDigital::Play(const uchar *Data, int Length)
+{
+ if (cDxr3ConfigData::Instance().GetUseDigitalOut())
+ {
+ // call simply cDxr3Device::PlayAudio
+ cDxr3Device::Instance().PlayAudio(Data, Length);
+ }
+}
+
+// ==================================
+//
+void cDxr3DolbyDigital::Mute(bool On)
+{
+}
+
+// ==================================
+//
+void cDxr3DolbyDigital::Clear()
+{
+}
+
+// ==================================
+//
+void cDxr3DolbyDigital::Action()
+{
+}
+
diff --git a/dxr3dolbydigital.h b/dxr3dolbydigital.h
new file mode 100644
index 0000000..05e09cb
--- /dev/null
+++ b/dxr3dolbydigital.h
@@ -0,0 +1,47 @@
+/*
+* dxr3dolbydigital.h
+*
+* Copyright (C) 2004 Christian Gmeiner
+*
+* Taken from Nesseia-Renderengine Copyright (C) 2003-2004 Christian Gmeiner
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public License
+* as published by the Free Software Foundation; either version 2.1
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#ifndef _DXR3_DOLBYDIGITAL_H_
+#define _DXR3_DOLBYDIGITAL_H_
+
+#include "dxr3vdrincludes.h"
+
+// ==================================
+//! interface to vdr to output dolby digital via dxr3
+/*
+ With this class it is possible to listen real ac3 from
+ vdr :)
+*/
+class cDxr3DolbyDigital : public cAudio, private cThread
+{
+public:
+ cDxr3DolbyDigital() {}
+ virtual void Play(const uchar *Data, int Length);
+ virtual void Mute(bool On);
+ virtual void Clear();
+
+private:
+ virtual void Action();
+};
+
+#endif /*_DXR3_DOLBYDIGITAL_H_*/ \ No newline at end of file