summaryrefslogtreecommitdiff
path: root/PLUGINS/src/dvbhddevice
diff options
context:
space:
mode:
Diffstat (limited to 'PLUGINS/src/dvbhddevice')
-rw-r--r--PLUGINS/src/dvbhddevice/Makefile8
-rw-r--r--PLUGINS/src/dvbhddevice/dvbhdffdevice.c114
-rw-r--r--PLUGINS/src/dvbhddevice/dvbhdffdevice.h4
-rw-r--r--PLUGINS/src/dvbhddevice/hdffcmd.c991
-rw-r--r--PLUGINS/src/dvbhddevice/hdffcmd.h39
-rw-r--r--PLUGINS/src/dvbhddevice/hdffosd.c138
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/Makefile75
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/bitbuffer.c79
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/bitbuffer.h43
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd.h42
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_av.c451
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_av.h151
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_base.c45
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_base.h55
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_defs.h120
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_generic.c147
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_generic.h36
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_hdmi.c82
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_hdmi.h67
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_mux.c81
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_mux.h56
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_osd.c637
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_osd.h161
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_remote.c67
-rw-r--r--PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_remote.h39
-rw-r--r--PLUGINS/src/dvbhddevice/po/fi_FI.po8
-rw-r--r--PLUGINS/src/dvbhddevice/setup.c40
-rw-r--r--PLUGINS/src/dvbhddevice/setup.h4
28 files changed, 2745 insertions, 1035 deletions
diff --git a/PLUGINS/src/dvbhddevice/Makefile b/PLUGINS/src/dvbhddevice/Makefile
index 91fdfce..09ca4ad 100644
--- a/PLUGINS/src/dvbhddevice/Makefile
+++ b/PLUGINS/src/dvbhddevice/Makefile
@@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
-# $Id: Makefile 1.8 2011/05/21 12:25:33 kls Exp $
+# $Id: Makefile 1.9 2011/12/04 15:30:21 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
@@ -98,8 +98,9 @@ i18n: $(I18Nmsgs) $(I18Npot)
### Targets:
-libvdr-$(PLUGIN).so: $(OBJS)
- $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+libvdr-$(PLUGIN).so: $(OBJS) libhdffcmd
+ $(MAKE) -C libhdffcmd all
+ $(CXX) $(CXXFLAGS) -shared $(OBJS) libhdffcmd/libhdffcmd.a -o $@
@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
dist: $(I18Npo) clean
@@ -112,3 +113,4 @@ dist: $(I18Npo) clean
clean:
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot
+ $(MAKE) -C libhdffcmd clean
diff --git a/PLUGINS/src/dvbhddevice/dvbhdffdevice.c b/PLUGINS/src/dvbhddevice/dvbhdffdevice.c
index ff3f953..101558d 100644
--- a/PLUGINS/src/dvbhddevice/dvbhdffdevice.c
+++ b/PLUGINS/src/dvbhddevice/dvbhdffdevice.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: dvbhdffdevice.c 1.33 2011/08/27 09:32:18 kls Exp $
+ * $Id: dvbhdffdevice.c 1.35 2011/12/04 15:30:42 kls Exp $
*/
#include "dvbhdffdevice.h"
@@ -47,18 +47,18 @@ cDvbHdFfDevice::cDvbHdFfDevice(int Adapter, int Frontend)
isHdffPrimary = true;
mHdffCmdIf = new HDFF::cHdffCmdIf(fd_osd);
mHdffCmdIf->CmdAvSetAudioDelay(gHdffSetup.AudioDelay);
- mHdffCmdIf->CmdAvSetAudioDownmix((HDFF::eDownmixMode) gHdffSetup.AudioDownmix);
- mHdffCmdIf->CmdMuxSetVideoOut((HDFF::eVideoOut) gHdffSetup.AnalogueVideo);
+ mHdffCmdIf->CmdAvSetAudioDownmix((HdffAudioDownmixMode_t) gHdffSetup.AudioDownmix);
+ mHdffCmdIf->CmdMuxSetVideoOut((HdffVideoOut_t) gHdffSetup.AnalogueVideo);
mHdffCmdIf->CmdHdmiSetVideoMode(gHdffSetup.GetVideoMode());
- HDFF::tHdmiConfig hdmiConfig;
+ HdffHdmiConfig_t hdmiConfig;
hdmiConfig.TransmitAudio = true;
hdmiConfig.ForceDviMode = false;
hdmiConfig.CecEnabled = gHdffSetup.CecEnabled;
- hdmiConfig.VideoModeAdaption = (HDFF::eVideoModeAdaption) gHdffSetup.VideoModeAdaption;
+ hdmiConfig.VideoModeAdaption = (HdffVideoModeAdaption_t) gHdffSetup.VideoModeAdaption;
mHdffCmdIf->CmdHdmiConfigure(&hdmiConfig);
if (gHdffSetup.CecEnabled)
- mHdffCmdIf->CmdHdmiSendCecCommand(HDFF::cecCommandTvOn);
- mHdffCmdIf->CmdRemoteSetProtocol((HDFF::eRemoteProtocol) gHdffSetup.RemoteProtocol);
+ mHdffCmdIf->CmdHdmiSendCecCommand(HDFF_CEC_COMMAND_TV_ON);
+ mHdffCmdIf->CmdRemoteSetProtocol((HdffRemoteProtocol_t) gHdffSetup.RemoteProtocol);
mHdffCmdIf->CmdRemoteSetAddressFilter(gHdffSetup.RemoteAddress >= 0, gHdffSetup.RemoteAddress);
}
@@ -109,11 +109,11 @@ void cDvbHdFfDevice::SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayForma
void cDvbHdFfDevice::SetVideoFormat(bool VideoFormat16_9)
{
- HDFF::tVideoFormat videoFormat;
+ HdffVideoFormat_t videoFormat;
videoFormat.AutomaticEnabled = true;
videoFormat.AfdEnabled = true;
- videoFormat.TvFormat = (HDFF::eTvFormat) gHdffSetup.TvFormat;
- videoFormat.VideoConversion = (HDFF::eVideoConversion) gHdffSetup.VideoConversion;
+ videoFormat.TvFormat = (HdffTvFormat_t) gHdffSetup.TvFormat;
+ videoFormat.VideoConversion = (HdffVideoConversion_t) gHdffSetup.VideoConversion;
mHdffCmdIf->CmdAvSetVideoFormat(0, &videoFormat);
}
@@ -184,14 +184,14 @@ bool cDvbHdFfDevice::SetPid(cPidHandle *Handle, int Type, bool On)
mHdffCmdIf->CmdAvSetPcrPid(0, Handle->pid);
else if (Type == ptVideo) {
if (Handle->streamType == 0x1B)
- mHdffCmdIf->CmdAvSetVideoPid(0, Handle->pid, HDFF::videoStreamH264);
+ mHdffCmdIf->CmdAvSetVideoPid(0, Handle->pid, HDFF_VIDEO_STREAM_H264);
else
- mHdffCmdIf->CmdAvSetVideoPid(0, Handle->pid, HDFF::videoStreamMpeg2);
+ mHdffCmdIf->CmdAvSetVideoPid(0, Handle->pid, HDFF_VIDEO_STREAM_MPEG2);
}
else if (Type == ptAudio)
- mHdffCmdIf->CmdAvSetAudioPid(0, Handle->pid, HDFF::audioStreamMpeg1);
+ mHdffCmdIf->CmdAvSetAudioPid(0, Handle->pid, HDFF_AUDIO_STREAM_MPEG1);
else if (Type == ptDolby)
- mHdffCmdIf->CmdAvSetAudioPid(0, Handle->pid, HDFF::audioStreamAc3);
+ mHdffCmdIf->CmdAvSetAudioPid(0, Handle->pid, HDFF_AUDIO_STREAM_AC3);
if (!(Type <= ptDolby && Handle->used <= 1)) {
pesFilterParams.pid = Handle->pid;
pesFilterParams.input = DMX_IN_FRONTEND;
@@ -209,11 +209,11 @@ bool cDvbHdFfDevice::SetPid(cPidHandle *Handle, int Type, bool On)
if (Type == ptPcr)
mHdffCmdIf->CmdAvSetPcrPid(0, 0);
else if (Type == ptVideo)
- mHdffCmdIf->CmdAvSetVideoPid(0, 0, HDFF::videoStreamMpeg2);
+ mHdffCmdIf->CmdAvSetVideoPid(0, 0, HDFF_VIDEO_STREAM_MPEG1);
else if (Type == ptAudio)
- mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF::audioStreamMpeg1);
+ mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF_AUDIO_STREAM_MPEG1);
else if (Type == ptDolby)
- mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF::audioStreamAc3);
+ mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF_AUDIO_STREAM_AC3);
//TODO missing setting to 0x1FFF??? see cDvbDevice::SetPid()
close(Handle->handle);
Handle->handle = -1;
@@ -351,10 +351,13 @@ bool cDvbHdFfDevice::CanReplay(void) const
bool cDvbHdFfDevice::SetPlayMode(ePlayMode PlayMode)
{
if (PlayMode == pmNone) {
+ mHdffCmdIf->CmdAvSetVideoSpeed(0, 100);
+ mHdffCmdIf->CmdAvSetAudioSpeed(0, 100);
+
mHdffCmdIf->CmdAvEnableVideoAfterStop(0, false);
mHdffCmdIf->CmdAvSetPcrPid(0, 0);
- mHdffCmdIf->CmdAvSetVideoPid(0, 0, HDFF::videoStreamMpeg2);
- mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF::audioStreamMpeg1);
+ mHdffCmdIf->CmdAvSetVideoPid(0, 0, HDFF_VIDEO_STREAM_MPEG1);
+ mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF_AUDIO_STREAM_MPEG1);
ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
mHdffCmdIf->CmdAvSetDecoderInput(0, 0);
@@ -374,6 +377,8 @@ bool cDvbHdFfDevice::SetPlayMode(ePlayMode PlayMode)
playAudioPid = -1;
audioCounter = 0;
videoCounter = 0;
+ freezed = false;
+ trickMode = false;
mHdffCmdIf->CmdAvSetDecoderInput(0, 2);
ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY);
@@ -405,18 +410,20 @@ int64_t cDvbHdFfDevice::GetSTC(void)
void cDvbHdFfDevice::TrickSpeed(int Speed)
{
+ freezed = false;
mHdffCmdIf->CmdAvEnableSync(0, false);
- mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF::audioStreamMpeg1);
+ mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF_AUDIO_STREAM_MPEG1);
playAudioPid = -1;
if (Speed > 0)
mHdffCmdIf->CmdAvSetVideoSpeed(0, 100 / Speed);
+ trickMode = true;
}
void cDvbHdFfDevice::Clear(void)
{
CHECK(ioctl(fd_video, VIDEO_CLEAR_BUFFER));
- mHdffCmdIf->CmdAvSetVideoPid(0, 0, HDFF::videoStreamMpeg1);
- mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF::audioStreamMpeg1);
+ mHdffCmdIf->CmdAvSetVideoPid(0, 0, HDFF_VIDEO_STREAM_MPEG1);
+ mHdffCmdIf->CmdAvSetAudioPid(0, 0, HDFF_AUDIO_STREAM_MPEG1);
playVideoPid = -1;
playAudioPid = -1;
cDevice::Clear();
@@ -424,6 +431,8 @@ void cDvbHdFfDevice::Clear(void)
void cDvbHdFfDevice::Play(void)
{
+ freezed = false;
+ trickMode = false;
mHdffCmdIf->CmdAvEnableSync(0, true);
mHdffCmdIf->CmdAvSetVideoSpeed(0, 100);
mHdffCmdIf->CmdAvSetAudioSpeed(0, 100);
@@ -432,6 +441,7 @@ void cDvbHdFfDevice::Play(void)
void cDvbHdFfDevice::Freeze(void)
{
+ freezed = true;
mHdffCmdIf->CmdAvSetVideoSpeed(0, 0);
mHdffCmdIf->CmdAvSetAudioSpeed(0, 0);
cDevice::Freeze();
@@ -443,13 +453,13 @@ void cDvbHdFfDevice::Mute(void)
cDevice::Mute();
}
-static HDFF::eVideoStreamType MapVideoStreamTypes(int Vtype)
+static HdffVideoStreamType_t MapVideoStreamTypes(int Vtype)
{
switch (Vtype) {
- case 0x01: return HDFF::videoStreamMpeg1;
- case 0x02: return HDFF::videoStreamMpeg2;
- case 0x1B: return HDFF::videoStreamH264;
- default: return HDFF::videoStreamMpeg2; // fallback to MPEG2
+ case 0x01: return HDFF_VIDEO_STREAM_MPEG1;
+ case 0x02: return HDFF_VIDEO_STREAM_MPEG2;
+ case 0x1B: return HDFF_VIDEO_STREAM_H264;
+ default: return HDFF_VIDEO_STREAM_MPEG2; // fallback to MPEG2
}
}
@@ -594,6 +604,8 @@ uint32_t cDvbHdFfDevice::PesToTs(uint8_t * TsBuffer, uint16_t Pid, uint8_t & Cou
int cDvbHdFfDevice::PlayVideo(const uchar *Data, int Length)
{
+ if (freezed)
+ return -1;
//TODO: support greater Length
uint8_t tsBuffer[188 * 16];
uint32_t tsLength;
@@ -603,7 +615,7 @@ int cDvbHdFfDevice::PlayVideo(const uchar *Data, int Length)
if (pid != playVideoPid) {
playVideoPid = pid;
- mHdffCmdIf->CmdAvSetVideoPid(0, playVideoPid, HDFF::videoStreamMpeg2, true);
+ mHdffCmdIf->CmdAvSetVideoPid(0, playVideoPid, HDFF_VIDEO_STREAM_MPEG2, true);
}
if (WriteAllOrNothing(fd_video, tsBuffer, tsLength, 1000, 10) <= 0)
Length = 0;
@@ -612,39 +624,43 @@ int cDvbHdFfDevice::PlayVideo(const uchar *Data, int Length)
int cDvbHdFfDevice::PlayAudio(const uchar *Data, int Length, uchar Id)
{
+ if (freezed)
+ return -1;
+ if (trickMode)
+ return Length;
uint8_t streamId;
uint8_t tsBuffer[188 * 16];
uint32_t tsLength;
- HDFF::eAudioStreamType streamType = HDFF::audioStreamMpeg1;
- HDFF::eAVContainerType containerType = HDFF::avContainerPes;
+ HdffAudioStreamType_t streamType = HDFF_AUDIO_STREAM_MPEG1;
+ HdffAvContainerType_t containerType = HDFF_AV_CONTAINER_PES;
int pid;
streamId = Data[3];
if (streamId >= 0xC0 && streamId <= 0xDF)
{
- streamType = HDFF::audioStreamMpeg1;
+ streamType = HDFF_AUDIO_STREAM_MPEG1;
}
else if (streamId == 0xBD)
{
const uint8_t * payload = Data + 9 + Data[8];
if ((payload[0] & 0xF8) == 0xA0)
{
- containerType = HDFF::avContainerPesDvd;
- streamType = HDFF::audioStreamPcm;
+ containerType = HDFF_AV_CONTAINER_PES_DVD;
+ streamType = HDFF_AUDIO_STREAM_PCM;
}
else if ((payload[0] & 0xF8) == 0x88)
{
- containerType = HDFF::avContainerPesDvd;
- streamType = HDFF::audioStreamDts;
+ containerType = HDFF_AV_CONTAINER_PES_DVD;
+ streamType = HDFF_AUDIO_STREAM_DTS;
}
else if ((payload[0] & 0xF8) == 0x80)
{
- containerType = HDFF::avContainerPesDvd;
- streamType = HDFF::audioStreamAc3;
+ containerType = HDFF_AV_CONTAINER_PES_DVD;
+ streamType = HDFF_AUDIO_STREAM_AC3;
}
else
{
- streamType = HDFF::audioStreamAc3;
+ streamType = HDFF_AUDIO_STREAM_AC3;
}
}
pid = 200 + (int) streamType;
@@ -661,6 +677,8 @@ int cDvbHdFfDevice::PlayAudio(const uchar *Data, int Length, uchar Id)
int cDvbHdFfDevice::PlayTsVideo(const uchar *Data, int Length)
{
+ if (freezed)
+ return -1;
int pid = TsPid(Data);
if (pid != playVideoPid) {
PatPmtParser();
@@ -672,21 +690,25 @@ int cDvbHdFfDevice::PlayTsVideo(const uchar *Data, int Length)
return WriteAllOrNothing(fd_video, Data, Length, 1000, 10);
}
-static HDFF::eAudioStreamType MapAudioStreamTypes(int Atype)
+static HdffAudioStreamType_t MapAudioStreamTypes(int Atype)
{
switch (Atype) {
- case 0x03: return HDFF::audioStreamMpeg1;
- case 0x04: return HDFF::audioStreamMpeg2;
- case SI::AC3DescriptorTag: return HDFF::audioStreamAc3;
- case SI::EnhancedAC3DescriptorTag: return HDFF::audioStreamEAc3;
- case 0x0F: return HDFF::audioStreamAac;
- case 0x11: return HDFF::audioStreamHeAac;
- default: return HDFF::audioStreamMaxValue; // there is no HDFF::audioStreamNone
+ case 0x03: return HDFF_AUDIO_STREAM_MPEG1;
+ case 0x04: return HDFF_AUDIO_STREAM_MPEG2;
+ case SI::AC3DescriptorTag: return HDFF_AUDIO_STREAM_AC3;
+ case SI::EnhancedAC3DescriptorTag: return HDFF_AUDIO_STREAM_EAC3;
+ case 0x0F: return HDFF_AUDIO_STREAM_AAC;
+ case 0x11: return HDFF_AUDIO_STREAM_HE_AAC;
+ default: return HDFF_AUDIO_STREAM_MPEG1;
}
}
int cDvbHdFfDevice::PlayTsAudio(const uchar *Data, int Length)
{
+ if (freezed)
+ return -1;
+ if (trickMode)
+ return Length;
int pid = TsPid(Data);
if (pid != playAudioPid) {
playAudioPid = pid;
diff --git a/PLUGINS/src/dvbhddevice/dvbhdffdevice.h b/PLUGINS/src/dvbhddevice/dvbhdffdevice.h
index 4dcfb6a..439ec9b 100644
--- a/PLUGINS/src/dvbhddevice/dvbhdffdevice.h
+++ b/PLUGINS/src/dvbhddevice/dvbhdffdevice.h
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: dvbhdffdevice.h 1.6 2010/03/13 11:18:13 kls Exp $
+ * $Id: dvbhdffdevice.h 1.7 2011/09/10 10:17:32 kls Exp $
*/
#ifndef __DVBHDFFDEVICE_H
@@ -79,6 +79,8 @@ protected:
private:
int playVideoPid;
int playAudioPid;
+ bool freezed;
+ bool trickMode;
// Pes2Ts conversion stuff
uint8_t videoCounter;
diff --git a/PLUGINS/src/dvbhddevice/hdffcmd.c b/PLUGINS/src/dvbhddevice/hdffcmd.c
index 60ad70e..957f2c7 100644
--- a/PLUGINS/src/dvbhddevice/hdffcmd.c
+++ b/PLUGINS/src/dvbhddevice/hdffcmd.c
@@ -3,34 +3,15 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: hdffcmd.c 1.21 2011/08/27 09:34:18 kls Exp $
+ * $Id: hdffcmd.c 1.22 2011/12/04 15:31:03 kls Exp $
*/
#include "hdffcmd.h"
-#include <linux/dvb/osd.h>
+#include "libhdffcmd/hdffcmd.h"
#include <stdio.h>
#include <string.h>
-#include <sys/ioctl.h>
#include <vdr/tools.h>
-#if !defined OSD_RAW_CMD
-typedef struct osd_raw_cmd_s {
- const void *cmd_data;
- int cmd_len;
- void *result_data;
- int result_len;
-} osd_raw_cmd_t;
-
-typedef struct osd_raw_data_s {
- const void *data_buffer;
- int data_length;
- int data_handle;
-} osd_raw_data_t;
-
-#define OSD_RAW_CMD _IOWR('o', 162, osd_raw_cmd_t)
-#define OSD_RAW_DATA _IOWR('o', 163, osd_raw_data_t)
-#endif
-
namespace HDFF
{
@@ -48,1093 +29,347 @@ cHdffCmdIf::~cHdffCmdIf(void)
{
}
-void cHdffCmdIf::CmdBuildHeader(cBitBuffer & MsgBuf, eMessageType MsgType, eMessageGroup MsgGroup, eMessageId MsgId)
-{
- MsgBuf.SetBits(16, 0); // length field will be set later
- MsgBuf.SetBits(6, 0); // reserved
- MsgBuf.SetBits(2, MsgType);
- MsgBuf.SetBits(8, MsgGroup);
- MsgBuf.SetBits(16, MsgId);
-}
-
-uint32_t cHdffCmdIf::CmdSetLength(cBitBuffer & MsgBuf)
-{
- uint32_t length;
-
- length = MsgBuf.GetByteLength() - 2;
- MsgBuf.SetDataByte(0, (uint8_t) (length >> 8));
- MsgBuf.SetDataByte(1, (uint8_t) length);
-
- return length + 2;
-}
-
uint32_t cHdffCmdIf::CmdGetFirmwareVersion(char * pString, uint32_t MaxLength)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- cBitBuffer resBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- osd_cmd.result_data = resBuf.GetData();
- osd_cmd.result_len = resBuf.GetMaxLength();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupGeneric, msgGenGetFirmwareVersion);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
- if (osd_cmd.result_len > 0)
- {
- uint8_t * result = resBuf.GetData();
- uint8_t textLength = result[9];
- if (textLength >= MaxLength)
- textLength = MaxLength - 1;
- memcpy(pString, &result[10], textLength);
- pString[textLength] = 0;
- return (result[6] << 16) | (result[7] << 8) | result[8];
- }
+ uint32_t version;
+ int err;
+
+ err = HdffCmdGetFirmwareVersion(mOsdDev, &version, pString, MaxLength);
+ if (err == 0)
+ return version;
return 0;
}
uint32_t cHdffCmdIf::CmdGetInterfaceVersion(char * pString, uint32_t MaxLength)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- cBitBuffer resBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- osd_cmd.result_data = resBuf.GetData();
- osd_cmd.result_len = resBuf.GetMaxLength();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupGeneric, msgGenGetInterfaceVersion);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
- if (osd_cmd.result_len > 0)
- {
- uint8_t * result = resBuf.GetData();
- uint8_t textLength = result[9];
- if (textLength >= MaxLength)
- textLength = MaxLength - 1;
- memcpy(pString, &result[10], textLength);
- pString[textLength] = 0;
- return (result[6] << 16) | (result[7] << 8) | result[8];
- }
+ uint32_t version;
+ int err;
+
+ err = HdffCmdGetInterfaceVersion(mOsdDev, &version, pString, MaxLength);
+ if (err == 0)
+ return version;
return 0;
}
uint32_t cHdffCmdIf::CmdGetCopyrights(uint8_t Index, char * pString, uint32_t MaxLength)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- cBitBuffer resBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- osd_cmd.result_data = resBuf.GetData();
- osd_cmd.result_len = resBuf.GetMaxLength();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupGeneric, msgGenGetCopyrights);
- cmdBuf.SetBits(8, Index);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
- if (osd_cmd.result_len > 0)
- {
- uint8_t * result = resBuf.GetData();
- uint8_t index = result[6];
- uint8_t textLen = result[7];
- if (index == Index && textLen > 0)
- {
- if (textLen >= MaxLength)
- {
- textLen = MaxLength - 1;
- }
- memcpy(pString, result + 8, textLen);
- pString[textLen] = 0;
- return textLen;
- }
- }
+ int err;
+
+ err = HdffCmdGetCopyrights(mOsdDev, Index, pString, MaxLength);
+ if (err == 0)
+ return strlen(pString);
return 0;
}
void cHdffCmdIf::CmdAvSetPlayMode(uint8_t PlayMode, bool Realtime)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetPlayMode);
- cmdBuf.SetBits(1, Realtime ? 1 : 0);
- cmdBuf.SetBits(7, PlayMode);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetPlayMode(mOsdDev, PlayMode, Realtime);
}
-void cHdffCmdIf::CmdAvSetVideoPid(uint8_t DecoderIndex, uint16_t VideoPid, eVideoStreamType StreamType, bool PlaybackMode)
+void cHdffCmdIf::CmdAvSetVideoPid(uint8_t DecoderIndex, uint16_t VideoPid, HdffVideoStreamType_t StreamType, bool PlaybackMode)
{
//printf("SetVideoPid %d %d\n", VideoPid, StreamType);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetVideoPid);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(4, StreamType);
- cmdBuf.SetBits(1, PlaybackMode ? 1 : 0);
- cmdBuf.SetBits(15, VideoPid);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetVideoPid(mOsdDev, DecoderIndex, VideoPid, StreamType);
}
-void cHdffCmdIf::CmdAvSetAudioPid(uint8_t DecoderIndex, uint16_t AudioPid, eAudioStreamType StreamType, eAVContainerType ContainerType)
+void cHdffCmdIf::CmdAvSetAudioPid(uint8_t DecoderIndex, uint16_t AudioPid, HdffAudioStreamType_t StreamType, HdffAvContainerType_t ContainerType)
{
//printf("SetAudioPid %d %d %d\n", AudioPid, StreamType, ContainerType);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetAudioPid);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(4, StreamType);
- cmdBuf.SetBits(2, 0); // reserved
- cmdBuf.SetBits(1, ContainerType);
- cmdBuf.SetBits(13, AudioPid);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetAudioPid(mOsdDev, DecoderIndex, AudioPid, StreamType,
+ ContainerType);
}
void cHdffCmdIf::CmdAvSetPcrPid(uint8_t DecoderIndex, uint16_t PcrPid)
{
//printf("SetPcrPid %d\n", PcrPid);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetPcrPid);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(4, 0); // reserved
- cmdBuf.SetBits(16, PcrPid);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetPcrPid(mOsdDev, DecoderIndex, PcrPid);
}
void cHdffCmdIf::CmdAvSetTeletextPid(uint8_t DecoderIndex, uint16_t TeletextPid)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetTeletextPid);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(4, 0); // reserved
- cmdBuf.SetBits(16, TeletextPid);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetTeletextPid(mOsdDev, DecoderIndex, TeletextPid);
}
void cHdffCmdIf::CmdAvSetVideoWindow(uint8_t DecoderIndex, bool Enable, uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetVideoWindow);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(3, 0); // reserved
- if (Enable)
- cmdBuf.SetBits(1, 1);
- else
- cmdBuf.SetBits(1, 0);
- cmdBuf.SetBits(16, X);
- cmdBuf.SetBits(16, Y);
- cmdBuf.SetBits(16, Width);
- cmdBuf.SetBits(16, Height);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetVideoWindow(mOsdDev, DecoderIndex, Enable, X, Y, Width, Height);
}
-void cHdffCmdIf::CmdAvShowStillImage(uint8_t DecoderIndex, const uint8_t * pStillImage, int Size, eVideoStreamType StreamType)
+void cHdffCmdIf::CmdAvShowStillImage(uint8_t DecoderIndex, const uint8_t * pStillImage, int Size, HdffVideoStreamType_t StreamType)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
- osd_raw_data_t osd_data;
-
- memset(&osd_data, 0, sizeof(osd_raw_data_t));
- osd_data.data_buffer = (void *) pStillImage;
- osd_data.data_length = Size;
- ioctl(mOsdDev, OSD_RAW_DATA, &osd_data);
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvShowStillImage);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(4, StreamType);
- cmdBuf.SetBits(16, osd_data.data_handle);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvShowStillImage(mOsdDev, DecoderIndex, pStillImage, Size,
+ StreamType);
}
void cHdffCmdIf::CmdAvSetDecoderInput(uint8_t DecoderIndex, uint8_t DemultiplexerIndex)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetDecoderInput);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(4, DemultiplexerIndex);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetDecoderInput(mOsdDev, DecoderIndex, DemultiplexerIndex);
}
void cHdffCmdIf::CmdAvSetDemultiplexerInput(uint8_t DemultiplexerIndex, uint8_t TsInputIndex)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetDemultiplexerInput);
- cmdBuf.SetBits(4, DemultiplexerIndex);
- cmdBuf.SetBits(4, TsInputIndex);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetDemultiplexerInput(mOsdDev, DemultiplexerIndex, TsInputIndex);
}
-void cHdffCmdIf::CmdAvSetVideoFormat(uint8_t DecoderIndex, const tVideoFormat * pVideoFormat)
+void cHdffCmdIf::CmdAvSetVideoFormat(uint8_t DecoderIndex, const HdffVideoFormat_t * pVideoFormat)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetVideoFormat);
- cmdBuf.SetBits(4, DecoderIndex);
- if (pVideoFormat->AutomaticEnabled)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- if (pVideoFormat->AfdEnabled)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- cmdBuf.SetBits(2, pVideoFormat->TvFormat);
- cmdBuf.SetBits(8, pVideoFormat->VideoConversion);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetVideoFormat(mOsdDev, DecoderIndex, pVideoFormat);
}
-void cHdffCmdIf::CmdAvSetVideoOutputMode(uint8_t DecoderIndex, eVideoOutputMode OutputMode)
+void cHdffCmdIf::CmdAvSetVideoOutputMode(uint8_t DecoderIndex, HdffVideoOutputMode_t OutputMode)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetVideoOutputMode);
- cmdBuf.SetBits(8, OutputMode);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetVideoOutputMode(mOsdDev, DecoderIndex, OutputMode);
}
void cHdffCmdIf::CmdAvSetStc(uint8_t DecoderIndex, uint64_t Stc)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetStc);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(3, 0); // reserved
- cmdBuf.SetBits(1, (uint32_t) (Stc >> 32));
- cmdBuf.SetBits(32, (uint32_t) Stc);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetStc(mOsdDev, DecoderIndex, Stc);
}
void cHdffCmdIf::CmdAvFlushBuffer(uint8_t DecoderIndex, bool FlushAudio, bool FlushVideo)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvFlushBuffer);
- cmdBuf.SetBits(4, DecoderIndex);
- if (FlushAudio)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- if (FlushVideo)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvFlushBuffer(mOsdDev, DecoderIndex, FlushAudio, FlushVideo);
}
void cHdffCmdIf::CmdAvEnableSync(uint8_t DecoderIndex, bool EnableSync)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvEnableSync);
- cmdBuf.SetBits(4, DecoderIndex);
- if (EnableSync)
- {
- cmdBuf.SetBits(1, 1);
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- cmdBuf.SetBits(1, 0);
- }
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvEnableSync(mOsdDev, DecoderIndex, EnableSync, EnableSync);
}
void cHdffCmdIf::CmdAvSetVideoSpeed(uint8_t DecoderIndex, int32_t Speed)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetVideoSpeed);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(4, 0);
- cmdBuf.SetBits(32, Speed);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetVideoSpeed(mOsdDev, DecoderIndex, Speed);
}
void cHdffCmdIf::CmdAvSetAudioSpeed(uint8_t DecoderIndex, int32_t Speed)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetAudioSpeed);
- cmdBuf.SetBits(4, DecoderIndex);
- cmdBuf.SetBits(4, 0);
- cmdBuf.SetBits(32, Speed);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetAudioSpeed(mOsdDev, DecoderIndex, Speed);
}
void cHdffCmdIf::CmdAvEnableVideoAfterStop(uint8_t DecoderIndex, bool EnableVideoAfterStop)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvEnableVideoAfterStop);
- cmdBuf.SetBits(4, DecoderIndex);
- if (EnableVideoAfterStop)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvEnableVideoAfterStop(mOsdDev, DecoderIndex, EnableVideoAfterStop);
}
void cHdffCmdIf::CmdAvSetAudioDelay(int16_t Delay)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetAudioDelay);
- cmdBuf.SetBits(16, Delay);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetAudioDelay(mOsdDev, Delay);
}
-void cHdffCmdIf::CmdAvSetAudioDownmix(eDownmixMode DownmixMode)
+void cHdffCmdIf::CmdAvSetAudioDownmix(HdffAudioDownmixMode_t DownmixMode)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetAudioDownmix);
- cmdBuf.SetBits(8, DownmixMode);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetAudioDownmix(mOsdDev, DownmixMode);
}
void cHdffCmdIf::CmdAvSetAudioChannel(uint8_t AudioChannel)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvDec, msgAvSetAudioChannel);
- cmdBuf.SetBits(8, AudioChannel);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdAvSetAudioChannel(mOsdDev, AudioChannel);
}
-void cHdffCmdIf::CmdOsdConfigure(const tOsdConfig * pConfig)
+void cHdffCmdIf::CmdOsdConfigure(const HdffOsdConfig_t * pConfig)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdConfigure);
- if (pConfig->FontAntialiasing)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- if (pConfig->FontKerning)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdConfigure(mOsdDev, pConfig);
}
void cHdffCmdIf::CmdOsdReset(void)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdReset);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdReset(mOsdDev);
}
-uint32_t cHdffCmdIf::CmdOsdCreateDisplay(uint32_t Width, uint32_t Height, eColorType ColorType)
+uint32_t cHdffCmdIf::CmdOsdCreateDisplay(uint32_t Width, uint32_t Height, HdffColorType_t ColorType)
{
//printf("CreateDisplay %d %d %d\n", Width, Height, ColorType);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- cBitBuffer resBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- osd_cmd.result_data = resBuf.GetData();
- osd_cmd.result_len = resBuf.GetMaxLength();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdCreateDisplay);
- cmdBuf.SetBits(16, Width);
- cmdBuf.SetBits(16, Height);
- cmdBuf.SetBits(8, ColorType);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
- if (osd_cmd.result_len > 0)
- {
- uint8_t * result = resBuf.GetData();
- return (result[6] << 24) | (result[7] << 16) | (result[8] << 8) | result[9];
- }
- return InvalidHandle;
+ uint32_t newDisplay;
+
+ if (HdffCmdOsdCreateDisplay(mOsdDev, Width, Height, ColorType, &newDisplay) == 0)
+ return newDisplay;
+ return HDFF_INVALID_HANDLE;
}
void cHdffCmdIf::CmdOsdDeleteDisplay(uint32_t hDisplay)
{
//printf("DeleteDisplay\n");
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdDeleteDisplay);
- cmdBuf.SetBits(32, hDisplay);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdDeleteDisplay(mOsdDev, hDisplay);
}
void cHdffCmdIf::CmdOsdEnableDisplay(uint32_t hDisplay, bool Enable)
{
//printf("EnableDisplay\n");
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdEnableDisplay);
- cmdBuf.SetBits(32, hDisplay);
- if (Enable)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- cmdBuf.SetBits(7, 0); // reserved
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdEnableDisplay(mOsdDev, hDisplay, Enable);
}
void cHdffCmdIf::CmdOsdSetDisplayOutputRectangle(uint32_t hDisplay, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
{
//printf("SetOutputRect %d %d %d %d %d\n", hDisplay, X, Y, Width, Height);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdSetDisplayOutputRectangle);
- cmdBuf.SetBits(32, hDisplay);
- cmdBuf.SetBits(16, X);
- cmdBuf.SetBits(16, Y);
- cmdBuf.SetBits(16, Width);
- cmdBuf.SetBits(16, Height);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdSetDisplayOutputRectangle(mOsdDev, hDisplay, X, Y, Width, Height);
}
void cHdffCmdIf::CmdOsdSetDisplayClippingArea(uint32_t hDisplay, bool Enable, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
{
//printf("SetClippingArea %d %d %d %d %d %d\n", hDisplay, Enable, X, Y, Width, Height);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdSetDisplayClippingArea);
- cmdBuf.SetBits(32, hDisplay);
- if (Enable)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- cmdBuf.SetBits(7, 0); // reserved
- cmdBuf.SetBits(16, X);
- cmdBuf.SetBits(16, Y);
- cmdBuf.SetBits(16, Width);
- cmdBuf.SetBits(16, Height);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdSetDisplayClippingArea(mOsdDev, hDisplay, Enable, X, Y, Width, Height);
}
void cHdffCmdIf::CmdOsdRenderDisplay(uint32_t hDisplay)
{
//printf("Render\n");
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdRenderDisplay);
- cmdBuf.SetBits(32, hDisplay);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdRenderDisplay(mOsdDev, hDisplay);
}
-uint32_t cHdffCmdIf::CmdOsdCreatePalette(eColorType ColorType, eColorFormat ColorFormat,
+uint32_t cHdffCmdIf::CmdOsdCreatePalette(HdffColorType_t ColorType, HdffColorFormat_t ColorFormat,
uint32_t NumColors, const uint32_t * pColors)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- cBitBuffer resBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
- uint32_t i;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- osd_cmd.result_data = resBuf.GetData();
- osd_cmd.result_len = resBuf.GetMaxLength();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdCreatePalette);
- cmdBuf.SetBits(8, ColorType);
- cmdBuf.SetBits(8, ColorFormat);
- if (NumColors > 256)
- NumColors = 256;
- cmdBuf.SetBits(8, NumColors == 256 ? 0 : NumColors);
- for (i = 0; i < NumColors; i++)
- {
- cmdBuf.SetBits(32, pColors[i]);
- }
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
- if (osd_cmd.result_len > 0)
- {
- uint8_t * result = resBuf.GetData();
- return (result[6] << 24) | (result[7] << 16) | (result[8] << 8) | result[9];
- }
- return InvalidHandle;
+ uint32_t newPalette;
+ int err;
+
+ err = HdffCmdOsdCreatePalette(mOsdDev, ColorType, ColorFormat, NumColors,
+ pColors, &newPalette);
+ if (err == 0)
+ return newPalette;
+ return HDFF_INVALID_HANDLE;
}
void cHdffCmdIf::CmdOsdDeletePalette(uint32_t hPalette)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdDeletePalette);
- cmdBuf.SetBits(32, hPalette);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdDeletePalette(mOsdDev, hPalette);
}
void cHdffCmdIf::CmdOsdSetDisplayPalette(uint32_t hDisplay, uint32_t hPalette)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdSetDisplayPalette);
- cmdBuf.SetBits(32, hDisplay);
- cmdBuf.SetBits(32, hPalette);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdSetDisplayPalette(mOsdDev, hDisplay, hPalette);
}
-void cHdffCmdIf::CmdOsdSetPaletteColors(uint32_t hPalette, eColorFormat ColorFormat,
+void cHdffCmdIf::CmdOsdSetPaletteColors(uint32_t hPalette, HdffColorFormat_t ColorFormat,
uint8_t StartColor, uint32_t NumColors, const uint32_t * pColors)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
- uint32_t i;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdSetPaletteColors);
- cmdBuf.SetBits(32, hPalette);
- cmdBuf.SetBits(8, ColorFormat);
- cmdBuf.SetBits(8, StartColor);
- if (NumColors > 256)
- NumColors = 256;
- cmdBuf.SetBits(8, NumColors == 256 ? 0 : NumColors);
- for (i = 0; i < NumColors; i++)
- {
- cmdBuf.SetBits(32, pColors[i]);
- }
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdSetPaletteColors(mOsdDev, hPalette, ColorFormat, StartColor,
+ NumColors, pColors);
}
uint32_t cHdffCmdIf::CmdOsdCreateFontFace(const uint8_t * pFontData, uint32_t DataSize)
{
//printf("CreateFontFace %d\n", DataSize);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- cBitBuffer resBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
- osd_raw_data_t osd_data;
-
- memset(&osd_data, 0, sizeof(osd_raw_data_t));
- osd_data.data_buffer = pFontData;
- osd_data.data_length = DataSize;
- ioctl(mOsdDev, OSD_RAW_DATA, &osd_data);
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- osd_cmd.result_data = resBuf.GetData();
- osd_cmd.result_len = resBuf.GetMaxLength();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdCreateFontFace);
- cmdBuf.SetBits(16, osd_data.data_handle);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
- if (osd_cmd.result_len > 0)
- {
- uint8_t * result = resBuf.GetData();
- return (result[6] << 24) | (result[7] << 16) | (result[8] << 8) | result[9];
- }
- return InvalidHandle;
+ uint32_t newFontFace;
+ int err;
+
+ err = HdffCmdOsdCreateFontFace(mOsdDev, pFontData, DataSize, &newFontFace);
+ if (err == 0)
+ return newFontFace;
+ return HDFF_INVALID_HANDLE;
}
void cHdffCmdIf::CmdOsdDeleteFontFace(uint32_t hFontFace)
{
//printf("DeleteFontFace %08X\n", hFontFace);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdDeleteFontFace);
- cmdBuf.SetBits(32, hFontFace);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdDeleteFontFace(mOsdDev, hFontFace);
}
uint32_t cHdffCmdIf::CmdOsdCreateFont(uint32_t hFontFace, uint32_t Size)
{
//printf("CreateFont %d\n", Size);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- cBitBuffer resBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- osd_cmd.result_data = resBuf.GetData();
- osd_cmd.result_len = resBuf.GetMaxLength();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdCreateFont);
- cmdBuf.SetBits(32, hFontFace);
- cmdBuf.SetBits(32, Size);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
- if (osd_cmd.result_len > 0)
- {
- uint8_t * result = resBuf.GetData();
- return (result[6] << 24) | (result[7] << 16) | (result[8] << 8) | result[9];
- }
- return InvalidHandle;
+ uint32_t newFont;
+ int err;
+
+ err = HdffCmdOsdCreateFont(mOsdDev, hFontFace, Size, &newFont);
+ if (err == 0)
+ return newFont;
+ return HDFF_INVALID_HANDLE;
}
void cHdffCmdIf::CmdOsdDeleteFont(uint32_t hFont)
{
//printf("DeleteFont %08X\n", hFont);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdDeleteFont);
- cmdBuf.SetBits(32, hFont);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdDeleteFont(mOsdDev, hFont);
}
void cHdffCmdIf::CmdOsdDrawRectangle(uint32_t hDisplay, int X, int Y, int Width, int Height, uint32_t Color)
{
//printf("Rect (%d,%d) %d x %d, %08X\n", X, Y, Width, Height, Color);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdDrawRectangle);
- cmdBuf.SetBits(32, hDisplay);
- cmdBuf.SetBits(16, X);
- cmdBuf.SetBits(16, Y);
- cmdBuf.SetBits(16, Width);
- cmdBuf.SetBits(16, Height);
- cmdBuf.SetBits(32, Color);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdDrawRectangle(mOsdDev, hDisplay, X, Y, Width, Height, Color);
}
void cHdffCmdIf::CmdOsdDrawEllipse(uint32_t hDisplay, int CX, int CY, int RadiusX, int RadiusY,
uint32_t Color, uint32_t Flags)
{
//printf("Ellipse (%d,%d) %d x %d, %08X, %d\n", CX, CY, RadiusX, RadiusY, Color, Flags);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdDrawEllipse);
- cmdBuf.SetBits(32, hDisplay);
- cmdBuf.SetBits(16, CX);
- cmdBuf.SetBits(16, CY);
- cmdBuf.SetBits(16, RadiusX);
- cmdBuf.SetBits(16, RadiusY);
- cmdBuf.SetBits(32, Color);
- cmdBuf.SetBits(32, Flags);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdDrawEllipse(mOsdDev, hDisplay, CX, CY, RadiusX, RadiusY, Color, Flags);
}
void cHdffCmdIf::CmdOsdDrawText(uint32_t hDisplay, uint32_t hFont, int X, int Y, const char * pText, uint32_t Color)
{
//printf("Text %08X (%d,%d), %s, %08X\n", hFont, X, Y, pText, Color);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
- int i;
- int length;
-
- length = 0;
- while (pText[length])
- {
- length++;
- }
- if (length > 980)
- length = 980;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdDrawText);
- cmdBuf.SetBits(32, hDisplay);
- cmdBuf.SetBits(32, hFont);
- cmdBuf.SetBits(16, X);
- cmdBuf.SetBits(16, Y);
- cmdBuf.SetBits(32, Color);
- cmdBuf.SetBits(16, length);
- for (i = 0; i < length; i++)
- {
- cmdBuf.SetBits(8, pText[i]);
- }
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdDrawText(mOsdDev, hDisplay, hFont, X, Y, pText, Color);
}
void cHdffCmdIf::CmdOsdDrawTextW(uint32_t hDisplay, uint32_t hFont, int X, int Y, const uint16_t * pText, uint32_t Color)
{
//printf("TextW %08X (%d,%d), %08X\n", hFont, X, Y, Color);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
- int i;
- int length;
-
- length = 0;
- while (pText[length])
- {
- length++;
- }
- if (length > 480)
- length = 480;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdDrawTextW);
- cmdBuf.SetBits(32, hDisplay);
- cmdBuf.SetBits(32, hFont);
- cmdBuf.SetBits(16, X);
- cmdBuf.SetBits(16, Y);
- cmdBuf.SetBits(32, Color);
- cmdBuf.SetBits(16, length);
- for (i = 0; i < length; i++)
- {
- cmdBuf.SetBits(16, pText[i]);
- }
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdDrawWideText(mOsdDev, hDisplay, hFont, X, Y, pText, Color);
}
void cHdffCmdIf::CmdOsdDrawBitmap(uint32_t hDisplay, int X, int Y, const uint8_t * pBitmap,
int BmpWidth, int BmpHeight, int BmpSize,
- eColorType ColorType, uint32_t hPalette)
+ HdffColorType_t ColorType, uint32_t hPalette)
{
//printf("Bitmap (%d,%d) %d x %d\n", X, Y, BmpWidth, BmpHeight);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
- osd_raw_data_t osd_data;
-
- memset(&osd_data, 0, sizeof(osd_raw_data_t));
- osd_data.data_buffer = pBitmap;
- osd_data.data_length = BmpSize;
- ioctl(mOsdDev, OSD_RAW_DATA, &osd_data);
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdDrawBitmap);
- cmdBuf.SetBits(32, hDisplay);
- cmdBuf.SetBits(16, X);
- cmdBuf.SetBits(16, Y);
- cmdBuf.SetBits(16, BmpWidth);
- cmdBuf.SetBits(16, BmpHeight);
- cmdBuf.SetBits(8, ColorType);
- cmdBuf.SetBits(6, 0); // reserved
- cmdBuf.SetBits(2, 0); // uncompressed
- cmdBuf.SetBits(32, hPalette);
- cmdBuf.SetBits(16, osd_data.data_handle);
- cmdBuf.SetBits(32, 0);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdDrawBitmap(mOsdDev, hDisplay, X, Y, pBitmap, BmpWidth, BmpHeight,
+ BmpSize, ColorType, hPalette);
}
void cHdffCmdIf::CmdOsdSaveRegion(uint32_t hDisplay, int X, int Y, int Width, int Height)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdSaveRegion);
- cmdBuf.SetBits(32, hDisplay);
- cmdBuf.SetBits(16, X);
- cmdBuf.SetBits(16, Y);
- cmdBuf.SetBits(16, Width);
- cmdBuf.SetBits(16, Height);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdSaveRegion(mOsdDev, hDisplay, X, Y, Width, Height);
}
void cHdffCmdIf::CmdOsdRestoreRegion(uint32_t hDisplay)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupOsd, msgOsdRestoreRegion);
- cmdBuf.SetBits(32, hDisplay);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdOsdRestoreRegion(mOsdDev, hDisplay);
}
-void cHdffCmdIf::CmdMuxSetVideoOut(eVideoOut VideoOut)
+void cHdffCmdIf::CmdMuxSetVideoOut(HdffVideoOut_t VideoOut)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvMux, msgMuxSetVideoOut);
- cmdBuf.SetBits(4, VideoOut);
- cmdBuf.SetBits(4, 0); // reserved
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdMuxSetVideoOut(mOsdDev, VideoOut);
}
void cHdffCmdIf::CmdMuxSetVolume(uint8_t Volume)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvMux, msgMuxSetVolume);
- cmdBuf.SetBits(8, Volume);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdMuxSetVolume(mOsdDev, Volume);
}
void cHdffCmdIf::CmdMuxMuteAudio(bool Mute)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupAvMux, msgMuxSetAudioMute);
- cmdBuf.SetBits(1, Mute);
- cmdBuf.SetBits(7, 0); // reserved
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdMuxMuteAudio(mOsdDev, Mute);
}
-void cHdffCmdIf::CmdHdmiSetVideoMode(eHdmiVideoMode VideoMode)
+void cHdffCmdIf::CmdHdmiSetVideoMode(HdffVideoMode_t VideoMode)
{
//printf("HdmiSetVideoMode %d\n", VideoMode);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupHdmi, msgHdmiSetVideoMode);
- cmdBuf.SetBits(8, VideoMode);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdHdmiSetVideoMode(mOsdDev, VideoMode);
}
-void cHdffCmdIf::CmdHdmiConfigure(const tHdmiConfig * pConfig)
+void cHdffCmdIf::CmdHdmiConfigure(const HdffHdmiConfig_t * pConfig)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupHdmi, msgHdmiConfigure);
- if (pConfig->TransmitAudio)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- if (pConfig->ForceDviMode)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- if (pConfig->CecEnabled)
- {
- cmdBuf.SetBits(1, 1);
- }
- else
- {
- cmdBuf.SetBits(1, 0);
- }
- cmdBuf.SetBits(3, (uint32_t) pConfig->VideoModeAdaption);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdHdmiConfigure(mOsdDev, pConfig);
}
-void cHdffCmdIf::CmdHdmiSendCecCommand(eCecCommand Command)
+void cHdffCmdIf::CmdHdmiSendCecCommand(HdffCecCommand_t Command)
{
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupHdmi, msgHdmiSendCecCommand);
- cmdBuf.SetBits(8, Command);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdHdmiSendCecCommand(mOsdDev, Command);
}
-void cHdffCmdIf::CmdRemoteSetProtocol(eRemoteProtocol Protocol)
+void cHdffCmdIf::CmdRemoteSetProtocol(HdffRemoteProtocol_t Protocol)
{
//printf("%s %d\n", __func__, Protocol);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupRemoteControl, msgRemoteSetProtocol);
- cmdBuf.SetBits(8, Protocol);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdRemoteSetProtocol(mOsdDev, Protocol);
}
void cHdffCmdIf::CmdRemoteSetAddressFilter(bool Enable, uint32_t Address)
{
//printf("%s %d %d\n", __func__, Enable, Address);
- cBitBuffer cmdBuf(MAX_CMD_LEN);
- osd_raw_cmd_t osd_cmd;
-
- memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
- osd_cmd.cmd_data = cmdBuf.GetData();
- CmdBuildHeader(cmdBuf, msgTypeCommand, msgGroupRemoteControl, msgRemoteSetAddressFilter);
- cmdBuf.SetBits(1, Enable);
- cmdBuf.SetBits(7, 0); // reserved
- cmdBuf.SetBits(32, Address);
- osd_cmd.cmd_len = CmdSetLength(cmdBuf);
- ioctl(mOsdDev, OSD_RAW_CMD, &osd_cmd);
+ HdffCmdRemoteSetAddressFilter(mOsdDev, Enable, Address);
}
} // end of namespace
diff --git a/PLUGINS/src/dvbhddevice/hdffcmd.h b/PLUGINS/src/dvbhddevice/hdffcmd.h
index cd641eb..142f65f 100644
--- a/PLUGINS/src/dvbhddevice/hdffcmd.h
+++ b/PLUGINS/src/dvbhddevice/hdffcmd.h
@@ -3,14 +3,14 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: hdffcmd.h 1.17 2011/04/17 11:20:22 kls Exp $
+ * $Id: hdffcmd.h 1.18 2011/12/04 15:31:23 kls Exp $
*/
#ifndef _HDFF_CMD_H_
#define _HDFF_CMD_H_
#include "bitbuffer.h"
-#include "hdffmsgdef.h"
+#include "libhdffcmd/hdffcmd.h"
namespace HDFF
{
@@ -20,9 +20,6 @@ class cHdffCmdIf
private:
int mOsdDev;
- void CmdBuildHeader(cBitBuffer & MsgBuf, eMessageType MsgType, eMessageGroup MsgGroup, eMessageId MsgId);
- uint32_t CmdSetLength(cBitBuffer & MsgBuf);
-
public:
cHdffCmdIf(int OsdDev);
~cHdffCmdIf(void);
@@ -32,16 +29,16 @@ public:
uint32_t CmdGetCopyrights(uint8_t Index, char * pString, uint32_t MaxLength);
void CmdAvSetPlayMode(uint8_t PlayMode, bool Realtime);
- void CmdAvSetVideoPid(uint8_t DecoderIndex, uint16_t VideoPid, eVideoStreamType StreamType, bool PlaybackMode = false);
- void CmdAvSetAudioPid(uint8_t DecoderIndex, uint16_t AudioPid, eAudioStreamType StreamType, eAVContainerType ContainerType = avContainerPes);
+ void CmdAvSetVideoPid(uint8_t DecoderIndex, uint16_t VideoPid, HdffVideoStreamType_t StreamType, bool PlaybackMode = false);
+ void CmdAvSetAudioPid(uint8_t DecoderIndex, uint16_t AudioPid, HdffAudioStreamType_t StreamType, HdffAvContainerType_t ContainerType = HDFF_AV_CONTAINER_PES);
void CmdAvSetPcrPid(uint8_t DecoderIndex, uint16_t PcrPid);
void CmdAvSetTeletextPid(uint8_t DecoderIndex, uint16_t TeletextPid);
void CmdAvSetVideoWindow(uint8_t DecoderIndex, bool Enable, uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height);
- void CmdAvShowStillImage(uint8_t DecoderIndex, const uint8_t * pStillImage, int Size, eVideoStreamType StreamType);
+ void CmdAvShowStillImage(uint8_t DecoderIndex, const uint8_t * pStillImage, int Size, HdffVideoStreamType_t StreamType);
void CmdAvSetDecoderInput(uint8_t DecoderIndex, uint8_t DemultiplexerIndex);
void CmdAvSetDemultiplexerInput(uint8_t DemultiplexerIndex, uint8_t TsInputIndex);
- void CmdAvSetVideoFormat(uint8_t DecoderIndex, const tVideoFormat * pVideoFormat);
- void CmdAvSetVideoOutputMode(uint8_t DecoderIndex, eVideoOutputMode OutputMode);
+ void CmdAvSetVideoFormat(uint8_t DecoderIndex, const HdffVideoFormat_t * pVideoFormat);
+ void CmdAvSetVideoOutputMode(uint8_t DecoderIndex, HdffVideoOutputMode_t OutputMode);
void CmdAvSetStc(uint8_t DecoderIndex, uint64_t Stc);
void CmdAvFlushBuffer(uint8_t DecoderIndex, bool FlushAudio, bool FlushVideo);
void CmdAvEnableSync(uint8_t DecoderIndex, bool EnableSync);
@@ -49,24 +46,24 @@ public:
void CmdAvSetAudioSpeed(uint8_t DecoderIndex, int32_t Speed);
void CmdAvEnableVideoAfterStop(uint8_t DecoderIndex, bool EnableVideoAfterStop);
void CmdAvSetAudioDelay(int16_t Delay);
- void CmdAvSetAudioDownmix(eDownmixMode DownmixMode);
+ void CmdAvSetAudioDownmix(HdffAudioDownmixMode_t DownmixMode);
void CmdAvSetAudioChannel(uint8_t AudioChannel);
- void CmdOsdConfigure(const tOsdConfig * pConfig);
+ void CmdOsdConfigure(const HdffOsdConfig_t * pConfig);
void CmdOsdReset(void);
- uint32_t CmdOsdCreateDisplay(uint32_t Width, uint32_t Height, eColorType ColorType);
+ uint32_t CmdOsdCreateDisplay(uint32_t Width, uint32_t Height, HdffColorType_t ColorType);
void CmdOsdDeleteDisplay(uint32_t hDisplay);
void CmdOsdEnableDisplay(uint32_t hDisplay, bool Enable);
void CmdOsdSetDisplayOutputRectangle(uint32_t hDisplay, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height);
void CmdOsdSetDisplayClippingArea(uint32_t hDisplay, bool Enable, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height);
void CmdOsdRenderDisplay(uint32_t hDisplay);
- uint32_t CmdOsdCreatePalette(eColorType ColorType, eColorFormat ColorFormat,
+ uint32_t CmdOsdCreatePalette(HdffColorType_t ColorType, HdffColorFormat_t ColorFormat,
uint32_t NumColors, const uint32_t * pColors);
void CmdOsdDeletePalette(uint32_t hPalette);
void CmdOsdSetDisplayPalette(uint32_t hDisplay, uint32_t hPalette);
- void CmdOsdSetPaletteColors(uint32_t hPalette, eColorFormat ColorFormat,
+ void CmdOsdSetPaletteColors(uint32_t hPalette, HdffColorFormat_t ColorFormat,
uint8_t StartColor, uint32_t NumColors, const uint32_t * pColors);
uint32_t CmdOsdCreateFontFace(const uint8_t * pFontData, uint32_t DataSize);
@@ -81,19 +78,19 @@ public:
void CmdOsdDrawTextW(uint32_t hDisplay, uint32_t hFont, int X, int Y, const uint16_t * pText, uint32_t Color);
void CmdOsdDrawBitmap(uint32_t hDisplay, int X, int Y, const uint8_t * pBitmap,
int BmpWidth, int BmpHeight, int BmpSize,
- eColorType ColorType, uint32_t hPalette);
+ HdffColorType_t ColorType, uint32_t hPalette);
void CmdOsdSaveRegion(uint32_t hDisplay, int X, int Y, int Width, int Height);
void CmdOsdRestoreRegion(uint32_t hDisplay);
- void CmdMuxSetVideoOut(eVideoOut VideoOut);
+ void CmdMuxSetVideoOut(HdffVideoOut_t VideoOut);
void CmdMuxSetVolume(uint8_t Volume);
void CmdMuxMuteAudio(bool Mute);
- void CmdHdmiSetVideoMode(eHdmiVideoMode VideoMode);
- void CmdHdmiConfigure(const tHdmiConfig * pConfig);
- void CmdHdmiSendCecCommand(eCecCommand Command);
+ void CmdHdmiSetVideoMode(HdffVideoMode_t VideoMode);
+ void CmdHdmiConfigure(const HdffHdmiConfig_t * pConfig);
+ void CmdHdmiSendCecCommand(HdffCecCommand_t Command);
- void CmdRemoteSetProtocol(eRemoteProtocol Protocol);
+ void CmdRemoteSetProtocol(HdffRemoteProtocol_t Protocol);
void CmdRemoteSetAddressFilter(bool Enable, uint32_t Address);
};
diff --git a/PLUGINS/src/dvbhddevice/hdffosd.c b/PLUGINS/src/dvbhddevice/hdffosd.c
index 90d6897..a492275 100644
--- a/PLUGINS/src/dvbhddevice/hdffosd.c
+++ b/PLUGINS/src/dvbhddevice/hdffosd.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: hdffosd.c 1.10 2011/05/15 14:47:29 kls Exp $
+ * $Id: hdffosd.c 1.12 2011/12/04 15:31:41 kls Exp $
*/
#include "hdffosd.h"
@@ -71,7 +71,7 @@ cHdffOsd::cHdffOsd(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level)
: cOsd(Left, Top, Level)
{
double pixelAspect;
- HDFF::tOsdConfig config;
+ HdffOsdConfig_t config;
//printf("cHdffOsd %d, %d, %d\n", Left, Top, Level);
mHdffCmdIf = pHdffCmdIf;
@@ -80,24 +80,24 @@ cHdffOsd::cHdffOsd(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level)
shown = false;
mChanged = false;
mBitmapModified = false;
- mBitmapPalette = InvalidHandle;
+ mBitmapPalette = HDFF_INVALID_HANDLE;
config.FontKerning = false;
config.FontAntialiasing = Setup.AntiAlias ? true : false;
mHdffCmdIf->CmdOsdConfigure(&config);
gHdffSetup.GetOsdSize(mDispWidth, mDispHeight, pixelAspect);
- mDisplay = mHdffCmdIf->CmdOsdCreateDisplay(mDispWidth, mDispHeight, HDFF::colorTypeARGB8888);
- mHdffCmdIf->CmdOsdSetDisplayOutputRectangle(mDisplay, 0, 0, SizeFullScreen, SizeFullScreen);
+ mDisplay = mHdffCmdIf->CmdOsdCreateDisplay(mDispWidth, mDispHeight, HDFF_COLOR_TYPE_ARGB8888);
+ mHdffCmdIf->CmdOsdSetDisplayOutputRectangle(mDisplay, 0, 0, HDFF_SIZE_FULL_SCREEN, HDFF_SIZE_FULL_SCREEN);
for (int i = 0; i < MAX_NUM_FONTFACES; i++)
{
mFontFaces[i].Name = "";
- mFontFaces[i].Handle = InvalidHandle;
+ mFontFaces[i].Handle = HDFF_INVALID_HANDLE;
}
for (int i = 0; i < MAX_NUM_FONTS; i++)
{
- mFonts[i].hFontFace = InvalidHandle;
+ mFonts[i].hFontFace = HDFF_INVALID_HANDLE;
mFonts[i].Size = 0;
- mFonts[i].Handle = InvalidHandle;
+ mFonts[i].Handle = HDFF_INVALID_HANDLE;
}
}
@@ -108,18 +108,18 @@ cHdffOsd::~cHdffOsd()
for (int i = 0; i < MAX_NUM_FONTS; i++)
{
- if (mFonts[i].Handle == InvalidHandle)
+ if (mFonts[i].Handle == HDFF_INVALID_HANDLE)
break;
mHdffCmdIf->CmdOsdDeleteFont(mFonts[i].Handle);
}
for (int i = 0; i < MAX_NUM_FONTFACES; i++)
{
- if (mFontFaces[i].Handle == InvalidHandle)
+ if (mFontFaces[i].Handle == HDFF_INVALID_HANDLE)
break;
mHdffCmdIf->CmdOsdDeleteFontFace(mFontFaces[i].Handle);
}
- if (mBitmapPalette != InvalidHandle)
+ if (mBitmapPalette != HDFF_INVALID_HANDLE)
mHdffCmdIf->CmdOsdDeletePalette(mBitmapPalette);
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
@@ -220,19 +220,19 @@ void cHdffOsd::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, t
mBitmapColors[i] = ColorFg;
}
}
- if (mBitmapPalette == InvalidHandle)
+ if (mBitmapPalette == HDFF_INVALID_HANDLE)
{
- mBitmapPalette = mHdffCmdIf->CmdOsdCreatePalette(HDFF::colorTypeClut8,
- HDFF::colorFormatARGB, numColors, mBitmapColors);
+ mBitmapPalette = mHdffCmdIf->CmdOsdCreatePalette(HDFF_COLOR_TYPE_CLUT8,
+ HDFF_COLOR_FORMAT_ARGB, numColors, mBitmapColors);
}
else
{
mHdffCmdIf->CmdOsdSetPaletteColors(mBitmapPalette,
- HDFF::colorFormatARGB, 0, numColors, mBitmapColors);
+ HDFF_COLOR_FORMAT_ARGB, 0, numColors, mBitmapColors);
}
mHdffCmdIf->CmdOsdDrawBitmap(mDisplay, mLeft + x, mTop + y,
(uint8_t *) Bitmap.Data(0, 0), Bitmap.Width(), Bitmap.Height(),
- Bitmap.Width() * Bitmap.Height(), HDFF::colorTypeClut8, mBitmapPalette);
+ Bitmap.Width() * Bitmap.Height(), HDFF_COLOR_TYPE_CLUT8, mBitmapPalette);
#if 0
uint32_t * tmpBitmap = new uint32_t[Bitmap.Width() * Bitmap.Height()];
for (int ix = 0; ix < Bitmap.Width(); ix++)
@@ -284,7 +284,7 @@ void cHdffOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Colo
pFontFace = NULL;
for (i = 0; i < MAX_NUM_FONTFACES; i++)
{
- if (mFontFaces[i].Handle == InvalidHandle)
+ if (mFontFaces[i].Handle == HDFF_INVALID_HANDLE)
break;
if (strcmp(mFontFaces[i].Name, Font->FontName()) == 0)
@@ -312,7 +312,7 @@ void cHdffOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Colo
if (fread(buffer, fileSize, 1, fp) == 1)
{
mFontFaces[i].Handle = mHdffCmdIf->CmdOsdCreateFontFace(buffer, fileSize);
- if (mFontFaces[i].Handle != InvalidHandle)
+ if (mFontFaces[i].Handle != HDFF_INVALID_HANDLE)
{
mFontFaces[i].Name = Font->FontName();
pFontFace = &mFontFaces[i];
@@ -331,7 +331,7 @@ void cHdffOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Colo
pFont = NULL;
for (i = 0; i < MAX_NUM_FONTS; i++)
{
- if (mFonts[i].Handle == InvalidHandle)
+ if (mFonts[i].Handle == HDFF_INVALID_HANDLE)
break;
if (mFonts[i].hFontFace == pFontFace->Handle
@@ -346,7 +346,7 @@ void cHdffOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Colo
if (i < MAX_NUM_FONTS)
{
mFonts[i].Handle = mHdffCmdIf->CmdOsdCreateFont(pFontFace->Handle, size);
- if (mFonts[i].Handle != InvalidHandle)
+ if (mFonts[i].Handle != HDFF_INVALID_HANDLE)
{
mFonts[i].hFontFace = pFontFace->Handle;
mFonts[i].Size = size;
@@ -435,9 +435,9 @@ void cHdffOsd::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Qua
{
case 1:
if (Quadrants > 0)
- flags = HDFF::drawQuarterTopRight;
+ flags = HDFF_DRAW_QUARTER_TOP_RIGHT;
else
- flags = HDFF::drawQuarterTopRightInverted;
+ flags = HDFF_DRAW_QUARTER_TOP_RIGHT_INVERTED;
cx = x1;
cy = y2;
rx = x2 - x1;
@@ -445,9 +445,9 @@ void cHdffOsd::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Qua
break;
case 2:
if (Quadrants > 0)
- flags = HDFF::drawQuarterTopLeft;
+ flags = HDFF_DRAW_QUARTER_TOP_LEFT;
else
- flags = HDFF::drawQuarterTopLeftInverted;
+ flags = HDFF_DRAW_QUARTER_TOP_LEFT_INVERTED;
cx = x2;
cy = y2;
rx = x2 - x1;
@@ -455,9 +455,9 @@ void cHdffOsd::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Qua
break;
case 3:
if (Quadrants > 0)
- flags = HDFF::drawQuarterBottomLeft;
+ flags = HDFF_DRAW_QUARTER_BOTTOM_LEFT;
else
- flags = HDFF::drawQuarterBottomLeftInverted;
+ flags = HDFF_DRAW_QUARTER_BOTTOM_LEFT_INVERTED;
cx = x2;
cy = y1;
rx = x2 - x1;
@@ -465,44 +465,44 @@ void cHdffOsd::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Qua
break;
case 4:
if (Quadrants > 0)
- flags = HDFF::drawQuarterBottomRight;
+ flags = HDFF_DRAW_QUARTER_BOTTOM_RIGHT;
else
- flags = HDFF::drawQuarterBottomRightInverted;
+ flags = HDFF_DRAW_QUARTER_BOTTOM_RIGHT_INVERTED;
cx = x1;
cy = y1;
rx = x2 - x1;
ry = y2 - y1;
break;
case 5:
- flags = HDFF::drawHalfRight;
+ flags = HDFF_DRAW_HALF_RIGHT;
cx = x1;
cy = (y1 + y2) / 2;
rx = x2 - x1;
ry = (y2 - y1) / 2;
break;
case 6:
- flags = HDFF::drawHalfTop;
+ flags = HDFF_DRAW_HALF_TOP;
cx = (x1 + x2) / 2;
cy = y2;
rx = (x2 - x1) / 2;
ry = y2 - y1;
break;
case 7:
- flags = HDFF::drawHalfLeft;
+ flags = HDFF_DRAW_HALF_LEFT;
cx = x2;
cy = (y1 + y2) / 2;
rx = x2 - x1;
ry = (y2 - y1) / 2;
break;
case 8:
- flags = HDFF::drawHalfBottom;
+ flags = HDFF_DRAW_HALF_BOTTOM;
cx = (x1 + x2) / 2;
cy = y1;
rx = (x2 - x1) / 2;
ry = y2 - y1;
break;
default:
- flags = HDFF::drawFull;
+ flags = HDFF_DRAW_FULL;
cx = (x1 + x2) / 2;
cy = (y1 + y2) / 2;
rx = (x2 - x1) / 2;
@@ -552,7 +552,7 @@ private:
HDFF::cHdffCmdIf * mHdffCmdIf;
int mDispWidth;
int mDispHeight;
- bool shown;
+ bool refresh;
uint32_t mDisplay;
uint32_t mBitmapPalette;
uint32_t mBitmapColors[256];
@@ -575,24 +575,27 @@ cHdffOsdRaw::cHdffOsdRaw(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint
//printf("cHdffOsdRaw %d, %d, %d\n", Left, Top, Level);
mHdffCmdIf = pHdffCmdIf;
- shown = false;
- mBitmapPalette = InvalidHandle;
+ refresh = true;
+ mBitmapPalette = HDFF_INVALID_HANDLE;
+ mDisplay = HDFF_INVALID_HANDLE;
gHdffSetup.GetOsdSize(mDispWidth, mDispHeight, pixelAspect);
- mDisplay = mHdffCmdIf->CmdOsdCreateDisplay(mDispWidth, mDispHeight, HDFF::colorTypeARGB8888);
- mHdffCmdIf->CmdOsdSetDisplayOutputRectangle(mDisplay, 0, 0, SizeFullScreen, SizeFullScreen);
}
cHdffOsdRaw::~cHdffOsdRaw()
{
//printf("~cHdffOsdRaw %d %d\n", Left(), Top());
- SetActive(false);
-
- if (mBitmapPalette != InvalidHandle)
+ if (mDisplay != HDFF_INVALID_HANDLE)
+ {
+ mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
+ mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
+ }
+ if (mBitmapPalette != HDFF_INVALID_HANDLE)
mHdffCmdIf->CmdOsdDeletePalette(mBitmapPalette);
- mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
- mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
- mHdffCmdIf->CmdOsdDeleteDisplay(mDisplay);
+ mBitmapPalette = HDFF_INVALID_HANDLE;
+ if (mDisplay != HDFF_INVALID_HANDLE)
+ mHdffCmdIf->CmdOsdDeleteDisplay(mDisplay);
+ mDisplay = HDFF_INVALID_HANDLE;
}
void cHdffOsdRaw::SetActive(bool On)
@@ -602,14 +605,29 @@ void cHdffOsdRaw::SetActive(bool On)
cOsd::SetActive(On);
if (On)
{
+ if (mDisplay == HDFF_INVALID_HANDLE)
+ {
+ mDisplay = mHdffCmdIf->CmdOsdCreateDisplay(mDispWidth, mDispHeight, HDFF_COLOR_TYPE_ARGB8888);
+ if (mDisplay != HDFF_INVALID_HANDLE)
+ mHdffCmdIf->CmdOsdSetDisplayOutputRectangle(mDisplay, 0, 0, HDFF_SIZE_FULL_SCREEN, HDFF_SIZE_FULL_SCREEN);
+ }
+ refresh = true;
if (GetBitmap(0)) // only flush here if there are already bitmaps
Flush();
}
- else if (shown)
+ else
{
- mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
- mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
- shown = false;
+ if (mDisplay != HDFF_INVALID_HANDLE)
+ {
+ mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
+ mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
+ }
+ if (mBitmapPalette != HDFF_INVALID_HANDLE)
+ mHdffCmdIf->CmdOsdDeletePalette(mBitmapPalette);
+ mBitmapPalette = HDFF_INVALID_HANDLE;
+ if (mDisplay != HDFF_INVALID_HANDLE)
+ mHdffCmdIf->CmdOsdDeleteDisplay(mDisplay);
+ mDisplay = HDFF_INVALID_HANDLE;
}
}
}
@@ -635,18 +653,18 @@ eOsdError cHdffOsdRaw::SetAreas(const tArea *Areas, int NumAreas)
{
//printf("SetAreas %d: %d %d %d %d %d\n", i, Areas[i].x1, Areas[i].y1, Areas[i].x2, Areas[i].y2, Areas[i].bpp);
}
- if (shown)
+ if (mDisplay != HDFF_INVALID_HANDLE)
{
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
- shown = false;
+ refresh = true;
}
return cOsd::SetAreas(Areas, NumAreas);
}
void cHdffOsdRaw::Flush(void)
{
- if (!Active())
+ if (!Active() || (mDisplay == HDFF_INVALID_HANDLE))
return;
//struct timeval start;
//struct timeval end;
@@ -673,7 +691,7 @@ void cHdffOsdRaw::Flush(void)
mHdffCmdIf->CmdOsdDrawBitmap(mDisplay,
Left() + pm->ViewPort().X(), Top() + pm->ViewPort().Y() + y,
pm->Data() + y * d, w, hc, hc * d,
- HDFF::colorTypeARGB8888, InvalidHandle);
+ HDFF_COLOR_TYPE_ARGB8888, HDFF_INVALID_HANDLE);
}
delete pm;
render = true;
@@ -688,9 +706,9 @@ void cHdffOsdRaw::Flush(void)
for (int i = 0; (bitmap = GetBitmap(i)) != NULL; i++)
{
int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
- if (!shown || bitmap->Dirty(x1, y1, x2, y2))
+ if (refresh || bitmap->Dirty(x1, y1, x2, y2))
{
- if (!shown)
+ if (refresh)
{
x2 = bitmap->Width() - 1;
y2 = bitmap->Height() - 1;
@@ -702,15 +720,15 @@ void cHdffOsdRaw::Flush(void)
{
for (int c = 0; c < numColors; c++)
mBitmapColors[c] = colors[c];
- if (mBitmapPalette == InvalidHandle)
+ if (mBitmapPalette == HDFF_INVALID_HANDLE)
{
- mBitmapPalette = mHdffCmdIf->CmdOsdCreatePalette(HDFF::colorTypeClut8,
- HDFF::colorFormatARGB, numColors, mBitmapColors);
+ mBitmapPalette = mHdffCmdIf->CmdOsdCreatePalette(HDFF_COLOR_TYPE_CLUT8,
+ HDFF_COLOR_FORMAT_ARGB, numColors, mBitmapColors);
}
else
{
mHdffCmdIf->CmdOsdSetPaletteColors(mBitmapPalette,
- HDFF::colorFormatARGB, 0, numColors, mBitmapColors);
+ HDFF_COLOR_FORMAT_ARGB, 0, numColors, mBitmapColors);
}
}
// commit modified data:
@@ -729,7 +747,7 @@ void cHdffOsdRaw::Flush(void)
mHdffCmdIf->CmdOsdDrawBitmap(mDisplay,
Left() + bitmap->X0() + x1, Top() + bitmap->Y0() + y1 + y,
buffer, width, hc, hc * width,
- HDFF::colorTypeClut8, mBitmapPalette);
+ HDFF_COLOR_TYPE_CLUT8, mBitmapPalette);
}
render = true;
}
@@ -745,7 +763,7 @@ void cHdffOsdRaw::Flush(void)
//timeNeeded += (end.tv_sec - start.tv_sec) * 1000000;
//printf("time = %d\n", timeNeeded);
}
- shown = true;
+ refresh = false;
}
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/Makefile b/PLUGINS/src/dvbhddevice/libhdffcmd/Makefile
new file mode 100644
index 0000000..f9c068a
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/Makefile
@@ -0,0 +1,75 @@
+#
+# Makefile for the HDFF firmware command interface library
+#
+
+VERSION = 0.1.0
+
+ifndef $(INSTALL_PATH)
+ INSTALL_PATH=/usr/local
+endif
+
+ifndef $(INSTALL_LIB_PATH)
+ INSTALL_LIB_PATH=$(INSTALL_PATH)/lib
+endif
+
+ifndef $(INSTALL_INCLUDE_PATH)
+ INSTALL_INCLUDE_PATH=$(INSTALL_PATH)/include
+endif
+
+LIB_NAME = libhdffcmd
+
+LIB_OBJS = bitbuffer.o hdffcmd_av.o hdffcmd_base.o hdffcmd_generic.o \
+ hdffcmd_hdmi.o hdffcmd_mux.o hdffcmd_osd.o hdffcmd_remote.o
+
+LIB_HEADERS = hdffcmd.h hdffcmd_av.h hdffcmd_generic.h hdffcmd_hdmi.h \
+ hdffcmd_mux.h hdffcmd_osd.h hdffcmd_remote.h
+
+LIB_STATIC = $(LIB_NAME).a
+LIB_SHARED = $(LIB_NAME)-$(VERSION).so
+
+CC = gcc
+CFLAGS = -g -O2 -fPIC -Wall
+AR = ar -r
+
+### Implicit rules:
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $(DEFINES) $(INCLUDES) $<
+
+# Dependencies:
+
+MAKEDEP = $(CC) -MM -MG
+DEPFILE = .dependencies
+$(DEPFILE): Makefile
+ @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+
+-include $(DEPFILE)
+
+### Targets:
+
+all: $(LIB_STATIC) $(LIB_SHARED)
+
+$(LIB_STATIC): $(LIB_OBJS)
+ $(AR) $(LIB_STATIC) $(LIB_OBJS)
+
+$(LIB_SHARED): $(LIB_OBJS)
+ $(CC) -fPIC -shared -o $(LIB_SHARED) $(LIB_OBJS)
+ ln -sf $(LIB_SHARED) $(LIB_NAME).so
+
+clean:
+ rm -f $(LIB_OBJS) $(DEPFILE) $(LIB_STATIC) $(LIB_NAME)*.so
+
+install: $(LIB_SHARED)
+ chown root $(LIB_SHARED)
+ chgrp root $(LIB_SHARED)
+ chmod 0755 $(LIB_SHARED)
+ cp -f $(LIB_SHARED) $(INSTALL_LIB_PATH)/
+ ln -sf $(LIB_SHARED) $(INSTALL_LIB_PATH)/$(LIB_NAME).so
+ mkdir -p $(INSTALL_INCLUDE_PATH)/libhdffcmd
+ list='$(LIB_HEADERS)'; \
+ for headerfile in $$list; do \
+ cp -f $$headerfile $(INSTALL_INCLUDE_PATH)/libhdffcmd/ ; \
+ chown root $(INSTALL_INCLUDE_PATH)/libhdffcmd/$$headerfile ; \
+ chgrp root $(INSTALL_INCLUDE_PATH)/libhdffcmd/$$headerfile ; \
+ chmod 0644 $(INSTALL_INCLUDE_PATH)/libhdffcmd/$$headerfile ; \
+ done
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/bitbuffer.c b/PLUGINS/src/dvbhddevice/libhdffcmd/bitbuffer.c
new file mode 100644
index 0000000..b85990d
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/bitbuffer.c
@@ -0,0 +1,79 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#include <string.h>
+
+#include "bitbuffer.h"
+
+void BitBuffer_Init(BitBuffer_t * BitBuffer,
+ uint8_t * Data, uint32_t MaxLength)
+{
+ memset(Data, 0, MaxLength);
+ BitBuffer->Data = Data;
+ BitBuffer->MaxLength = MaxLength * 8;
+ BitBuffer->BitPos = 0;
+}
+
+void BitBuffer_SetBits(BitBuffer_t * BitBuffer, int NumBits, uint32_t Data)
+{
+ uint32_t nextBitPos;
+ uint32_t bytePos;
+ uint32_t bitsInByte;
+ int shift;
+
+ if (NumBits <= 0 || NumBits > 32)
+ return;
+
+ nextBitPos = BitBuffer->BitPos + NumBits;
+
+ if (nextBitPos > BitBuffer->MaxLength)
+ return;
+
+ bytePos = BitBuffer->BitPos / 8;
+ bitsInByte = BitBuffer->BitPos % 8;
+
+ BitBuffer->Data[bytePos] &= (uint8_t) (0xFF << (8 - bitsInByte));
+ shift = NumBits - (8 - bitsInByte);
+ if (shift > 0)
+ BitBuffer->Data[bytePos] |= (uint8_t) (Data >> shift);
+ else
+ BitBuffer->Data[bytePos] |= (uint8_t) (Data << (-shift));
+ NumBits -= 8 - bitsInByte;
+ bytePos++;
+ while (NumBits > 0)
+ {
+ shift = NumBits - 8;
+ if (shift > 0)
+ BitBuffer->Data[bytePos] = (uint8_t) (Data >> shift);
+ else
+ BitBuffer->Data[bytePos] = (uint8_t) (Data << (-shift));
+ NumBits -= 8;
+ bytePos++;
+ }
+ BitBuffer->BitPos = nextBitPos;
+}
+
+uint32_t BitBuffer_GetByteLength(BitBuffer_t * BitBuffer)
+{
+ return (BitBuffer->BitPos + 7) / 8;
+}
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/bitbuffer.h b/PLUGINS/src/dvbhddevice/libhdffcmd/bitbuffer.h
new file mode 100644
index 0000000..5bdc23b
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/bitbuffer.h
@@ -0,0 +1,43 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef BITBUFFER_H
+#define BITBUFFER_H
+
+#include <stdint.h>
+
+typedef struct BitBuffer_t
+{
+ uint8_t * Data;
+ uint32_t MaxLength;
+ uint32_t BitPos;
+} BitBuffer_t;
+
+void BitBuffer_Init(BitBuffer_t * BitBuffer,
+ uint8_t * Data, uint32_t MaxLength);
+
+void BitBuffer_SetBits(BitBuffer_t * BitBuffer, int NumBits, uint32_t Data);
+
+uint32_t BitBuffer_GetByteLength(BitBuffer_t * BitBuffer);
+
+#endif /* BITBUFFER_H */
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd.h b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd.h
new file mode 100644
index 0000000..8d05782
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd.h
@@ -0,0 +1,42 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef HDFFCMD_H
+#define HDFFCMD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "hdffcmd_av.h"
+#include "hdffcmd_generic.h"
+#include "hdffcmd_hdmi.h"
+#include "hdffcmd_mux.h"
+#include "hdffcmd_osd.h"
+#include "hdffcmd_remote.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HDFFCMD_H */
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_av.c b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_av.c
new file mode 100644
index 0000000..413f3e2
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_av.c
@@ -0,0 +1,451 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/ioctl.h>
+
+#include "hdffcmd.h"
+#include "hdffcmd_base.h"
+#include "hdffcmd_defs.h"
+
+
+int HdffCmdAvSetPlayMode(int OsdDevice, uint8_t PlayMode, int Realtime)
+{
+ uint8_t cmdData[8];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_PLAY_MODE);
+ BitBuffer_SetBits(&cmdBuf, 1, Realtime ? 1 : 0);
+ BitBuffer_SetBits(&cmdBuf, 7, PlayMode);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetVideoPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid,
+ HdffVideoStreamType_t StreamType)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_VIDEO_PID);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 4, StreamType);
+ BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 13, Pid);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetAudioPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid,
+ HdffAudioStreamType_t StreamType,
+ HdffAvContainerType_t ContainerType)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_AUDIO_PID);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 4, StreamType);
+ BitBuffer_SetBits(&cmdBuf, 2, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 1, ContainerType);
+ BitBuffer_SetBits(&cmdBuf, 13, Pid);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetPcrPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_PCR_PID);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 4, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 13, Pid);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetTeletextPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_TELETEXT_PID);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 4, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 13, Pid);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetVideoWindow(int OsdDevice, uint8_t DecoderIndex, int Enable,
+ uint16_t X, uint16_t Y, uint16_t Width,
+ uint16_t Height)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_VIDEO_WINDOW);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
+ if (Enable)
+ BitBuffer_SetBits(&cmdBuf, 1, 1);
+ else
+ BitBuffer_SetBits(&cmdBuf, 1, 0);
+ BitBuffer_SetBits(&cmdBuf, 16, X);
+ BitBuffer_SetBits(&cmdBuf, 16, Y);
+ BitBuffer_SetBits(&cmdBuf, 16, Width);
+ BitBuffer_SetBits(&cmdBuf, 16, Height);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvShowStillImage(int OsdDevice, uint8_t DecoderIndex,
+ const uint8_t * StillImage, int Size,
+ HdffVideoStreamType_t StreamType)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ osd_raw_data_t osd_data;
+ int err;
+
+ memset(&osd_data, 0, sizeof(osd_raw_data_t));
+ osd_data.data_buffer = StillImage;
+ osd_data.data_length = Size;
+ err = ioctl(OsdDevice, OSD_RAW_DATA, &osd_data);
+ if (err != 0)
+ return err;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SHOW_STILL_IMAGE);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 4, StreamType);
+ BitBuffer_SetBits(&cmdBuf, 16, osd_data.data_handle);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetDecoderInput(int OsdDevice, uint8_t DecoderIndex,
+ uint8_t DemultiplexerIndex)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_DECODER_INPUT);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 4, DemultiplexerIndex);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetDemultiplexerInput(int OsdDevice, uint8_t DemultiplexerIndex,
+ uint8_t TsInputIndex)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_DEMULTIPLEXER_INPUT);
+ BitBuffer_SetBits(&cmdBuf, 4, DemultiplexerIndex);
+ BitBuffer_SetBits(&cmdBuf, 4, TsInputIndex);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetVideoFormat(int OsdDevice, uint8_t DecoderIndex,
+ const HdffVideoFormat_t * VideoFormat)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_VIDEO_FORMAT);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 1, VideoFormat->AutomaticEnabled ? 1 : 0);
+ BitBuffer_SetBits(&cmdBuf, 1, VideoFormat->AfdEnabled ? 1 : 0);
+ BitBuffer_SetBits(&cmdBuf, 2, VideoFormat->TvFormat);
+ BitBuffer_SetBits(&cmdBuf, 8, VideoFormat->VideoConversion);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetVideoOutputMode(int OsdDevice, uint8_t DecoderIndex,
+ HdffVideoOutputMode_t OutputMode)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_VIDEO_OUTPUT_MODE);
+ BitBuffer_SetBits(&cmdBuf, 8, OutputMode);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetStc(int OsdDevice, uint8_t DecoderIndex, uint64_t Stc)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_STC);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 1, (uint32_t) (Stc >> 32));
+ BitBuffer_SetBits(&cmdBuf, 32, (uint32_t) Stc);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvFlushBuffer(int OsdDevice, uint8_t DecoderIndex, int FlushAudio,
+ int FlushVideo)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_FLUSH_BUFFER);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ if (FlushAudio)
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 1);
+ }
+ else
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 0);
+ }
+ if (FlushVideo)
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 1);
+ }
+ else
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 0);
+ }
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvEnableSync(int OsdDevice, uint8_t DecoderIndex, int SyncAudio,
+ int SyncVideo)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_ENABLE_SYNC);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 1, SyncAudio ? 1 : 0);
+ BitBuffer_SetBits(&cmdBuf, 1, SyncVideo ? 1 : 0);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetVideoSpeed(int OsdDevice, uint8_t DecoderIndex, int32_t Speed)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_VIDEO_SPEED);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 4, 0);
+ BitBuffer_SetBits(&cmdBuf, 32, Speed);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetAudioSpeed(int OsdDevice, uint8_t DecoderIndex, int32_t Speed)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_AUDIO_SPEED);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 4, 0);
+ BitBuffer_SetBits(&cmdBuf, 32, Speed);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvEnableVideoAfterStop(int OsdDevice, uint8_t DecoderIndex,
+ int EnableVideoAfterStop)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_ENABLE_VIDEO_AFTER_STOP);
+ BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
+ BitBuffer_SetBits(&cmdBuf, 1, EnableVideoAfterStop ? 1 : 0);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetAudioDelay(int OsdDevice, int16_t Delay)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_AUDIO_DELAY);
+ BitBuffer_SetBits(&cmdBuf, 16, Delay);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetAudioDownmix(int OsdDevice, HdffAudioDownmixMode_t DownmixMode)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_AUDIO_DOWNMIX);
+ BitBuffer_SetBits(&cmdBuf, 8, DownmixMode);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdAvSetAudioChannel(int OsdDevice, uint8_t AudioChannel)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_AV_SET_AUDIO_CHANNEL);
+ BitBuffer_SetBits(&cmdBuf, 8, AudioChannel);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_av.h b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_av.h
new file mode 100644
index 0000000..7c2189b
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_av.h
@@ -0,0 +1,151 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef HDFFCMD_AV_H
+#define HDFFCMD_AV_H
+
+typedef enum HdffAvContainerType_t
+{
+ HDFF_AV_CONTAINER_PES,
+ HDFF_AV_CONTAINER_PES_DVD
+} HdffAvContainerType_t;
+
+typedef enum HdffAudioStreamType_t
+{
+ HDFF_AUDIO_STREAM_INVALID = -1,
+ HDFF_AUDIO_STREAM_MPEG1 = 0,
+ HDFF_AUDIO_STREAM_MPEG2,
+ HDFF_AUDIO_STREAM_AC3,
+ HDFF_AUDIO_STREAM_AAC,
+ HDFF_AUDIO_STREAM_HE_AAC,
+ HDFF_AUDIO_STREAM_PCM,
+ HDFF_AUDIO_STREAM_EAC3,
+ HDFF_AUDIO_STREAM_DTS
+} HdffAudioStreamType_t;
+
+typedef enum HdffVideoStreamType_t
+{
+ HDFF_VIDEO_STREAM_INVALID = -1,
+ HDFF_VIDEO_STREAM_MPEG1 = 0,
+ HDFF_VIDEO_STREAM_MPEG2,
+ HDFF_VIDEO_STREAM_H264,
+ HDFF_VIDEO_STREAM_MPEG4_ASP,
+ HDFF_VIDEO_STREAM_VC1
+} HdffVideoStreamType_t;
+
+typedef enum HdffTvFormat_t
+{
+ HDFF_TV_FORMAT_4_BY_3,
+ HDFF_TV_FORMAT_16_BY_9
+} HdffTvFormat_t;
+
+typedef enum HdffVideoConversion_t
+{
+ HDFF_VIDEO_CONVERSION_AUTOMATIC,
+ HDFF_VIDEO_CONVERSION_LETTERBOX_16_BY_9,
+ HDFF_VIDEO_CONVERSION_LETTERBOX_14_BY_9,
+ HDFF_VIDEO_CONVERSION_PILLARBOX,
+ HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT,
+ HDFF_VIDEO_CONVERSION_ALWAYS_16_BY_9
+} HdffVideoConversion_t;
+
+typedef struct HdffVideoFormat_t
+{
+ int AutomaticEnabled;
+ int AfdEnabled;
+ HdffTvFormat_t TvFormat;
+ HdffVideoConversion_t VideoConversion;
+} HdffVideoFormat_t;
+
+typedef enum HdffVideoOutputMode_t
+{
+ HDFF_VIDEO_OUTPUT_CLONE,
+ HDFF_VIDEO_OUTPUT_HD_ONLY
+} HdffVideoOutputMode_t;
+
+typedef enum HdffAudioDownmixMode_t
+{
+ HDFF_AUDIO_DOWNMIX_OFF,
+ HDFF_AUDIO_DOWNMIX_ANALOG,
+ HDFF_AUDIO_DOWNMIX_ALWAYS,
+ HDFF_AUDIO_DOWNMIX_AUTOMATIC,
+ HDFF_AUDIO_DOWNMIX_HDMI_ONLY
+} HdffAudioDownmixMode_t;
+
+
+int HdffCmdAvSetPlayMode(int OsdDevice, uint8_t PlayMode, int Realtime);
+
+int HdffCmdAvSetVideoPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid,
+ HdffVideoStreamType_t StreamType);
+
+int HdffCmdAvSetAudioPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid,
+ HdffAudioStreamType_t StreamType,
+ HdffAvContainerType_t ContainerType);
+
+int HdffCmdAvSetPcrPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid);
+
+int HdffCmdAvSetTeletextPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid);
+
+int HdffCmdAvSetVideoWindow(int OsdDevice, uint8_t DecoderIndex, int Enable,
+ uint16_t X, uint16_t Y, uint16_t Width,
+ uint16_t Height);
+
+int HdffCmdAvShowStillImage(int OsdDevice, uint8_t DecoderIndex,
+ const uint8_t * StillImage, int Size,
+ HdffVideoStreamType_t StreamType);
+
+int HdffCmdAvSetDecoderInput(int OsdDevice, uint8_t DecoderIndex,
+ uint8_t DemultiplexerIndex);
+
+int HdffCmdAvSetDemultiplexerInput(int OsdDevice, uint8_t DemultiplexerIndex,
+ uint8_t TsInputIndex);
+
+int HdffCmdAvSetVideoFormat(int OsdDevice, uint8_t DecoderIndex,
+ const HdffVideoFormat_t * VideoFormat);
+
+int HdffCmdAvSetVideoOutputMode(int OsdDevice, uint8_t DecoderIndex,
+ HdffVideoOutputMode_t OutputMode);
+
+int HdffCmdAvSetStc(int OsdDevice, uint8_t DecoderIndex, uint64_t Stc);
+
+int HdffCmdAvFlushBuffer(int OsdDevice, uint8_t DecoderIndex, int FlushAudio,
+ int FlushVideo);
+
+int HdffCmdAvEnableSync(int OsdDevice, uint8_t DecoderIndex, int SyncAudio,
+ int SyncVideo);
+
+int HdffCmdAvSetVideoSpeed(int OsdDevice, uint8_t DecoderIndex, int32_t Speed);
+
+int HdffCmdAvSetAudioSpeed(int OsdDevice, uint8_t DecoderIndex, int32_t Speed);
+
+int HdffCmdAvEnableVideoAfterStop(int OsdDevice, uint8_t DecoderIndex,
+ int EnableVideoAfterStop);
+
+int HdffCmdAvSetAudioDelay(int OsdDevice, int16_t Delay);
+
+int HdffCmdAvSetAudioDownmix(int OsdDevice,
+ HdffAudioDownmixMode_t DownmixMode);
+
+int HdffCmdAvSetAudioChannel(int OsdDevice, uint8_t AudioChannel);
+
+#endif /* HDFFCMD_AV_H */
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_base.c b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_base.c
new file mode 100644
index 0000000..ac1ab7e
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_base.c
@@ -0,0 +1,45 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#include "hdffcmd_base.h"
+
+void HdffCmdBuildHeader(BitBuffer_t * MsgBuf, HdffMessageType_t MsgType,
+ HdffMessageGroup_t MsgGroup, HdffMessageId_t MsgId)
+{
+ BitBuffer_SetBits(MsgBuf, 16, 0); // length field will be set later
+ BitBuffer_SetBits(MsgBuf, 6, 0); // reserved
+ BitBuffer_SetBits(MsgBuf, 2, MsgType);
+ BitBuffer_SetBits(MsgBuf, 8, MsgGroup);
+ BitBuffer_SetBits(MsgBuf, 16, MsgId);
+}
+
+uint32_t HdffCmdSetLength(BitBuffer_t * MsgBuf)
+{
+ uint32_t length;
+
+ length = BitBuffer_GetByteLength(MsgBuf) - 2;
+ MsgBuf->Data[0] = (uint8_t) (length >> 8);
+ MsgBuf->Data[1] = (uint8_t) length;
+
+ return length + 2;
+}
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_base.h b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_base.h
new file mode 100644
index 0000000..b6856aa
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_base.h
@@ -0,0 +1,55 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef HDFFCMD_BASE_H
+#define HDFFCMD_BASE_H
+
+#include <linux/dvb/osd.h>
+
+#if !defined OSD_RAW_CMD
+typedef struct osd_raw_cmd_s {
+ const void *cmd_data;
+ int cmd_len;
+ void *result_data;
+ int result_len;
+} osd_raw_cmd_t;
+
+typedef struct osd_raw_data_s {
+ const void *data_buffer;
+ int data_length;
+ int data_handle;
+} osd_raw_data_t;
+
+#define OSD_RAW_CMD _IOWR('o', 162, osd_raw_cmd_t)
+#define OSD_RAW_DATA _IOWR('o', 163, osd_raw_data_t)
+#endif
+
+#include "bitbuffer.h"
+#include "hdffcmd_defs.h"
+
+void HdffCmdBuildHeader(BitBuffer_t * MsgBuf, HdffMessageType_t MsgType,
+ HdffMessageGroup_t MsgGroup, HdffMessageId_t MsgId);
+
+uint32_t HdffCmdSetLength(BitBuffer_t * MsgBuf);
+
+#endif /* HDFFCMD_BASE_H */
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_defs.h b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_defs.h
new file mode 100644
index 0000000..8b24d7b
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_defs.h
@@ -0,0 +1,120 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef HDFFCMD_DEFS_H
+#define HDFFCMD_DEFS_H
+
+typedef enum HdffMessageType_t
+{
+ HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_TYPE_ANSWER,
+ HDFF_MSG_TYPE_RESULT,
+ HDFF_MSG_TYPE_EVENT
+} HdffMessageType_t;
+
+typedef enum HdffMessageGroup_t
+{
+ HDFF_MSG_GROUP_GENERIC,
+ HDFF_MSG_GROUP_AV_DECODER,
+ HDFF_MSG_GROUP_AV_MUX,
+ HDFF_MSG_GROUP_FRONTEND,
+ HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_GROUP_HDMI,
+ HDFF_MSG_GROUP_REMOTE_CONTROL
+} HdffMessageGroup_t;
+
+typedef enum HdffMessageId_t
+{
+ HDFF_MSG_GEN_GET_FIRMWARE_VERSION = 0,
+ HDFF_MSG_GEN_GET_INTERFACE_VERSION,
+ HDFF_MSG_GEN_GET_COPYRIGHTS,
+
+ HDFF_MSG_AV_SET_AUDIO_PID = 0,
+ HDFF_MSG_AV_SET_VIDEO_PID,
+ HDFF_MSG_AV_SET_PCR_PID,
+ HDFF_MSG_AV_SET_TELETEXT_PID,
+ HDFF_MSG_AV_SHOW_STILL_IMAGE,
+ HDFF_MSG_AV_SET_VIDEO_WINDOW,
+ HDFF_MSG_AV_SET_DECODER_INPUT,
+ HDFF_MSG_AV_SET_DEMULTIPLEXER_INPUT,
+ HDFF_MSG_AV_SET_VIDEO_FORMAT,
+ HDFF_MSG_AV_SET_VIDEO_OUTPUT_MODE,
+ HDFF_MSG_AV_SET_STC,
+ HDFF_MSG_AV_FLUSH_BUFFER,
+ HDFF_MSG_AV_ENABLE_SYNC,
+ HDFF_MSG_AV_SET_VIDEO_SPEED,
+ HDFF_MSG_AV_SET_AUDIO_SPEED,
+ HDFF_MSG_AV_ENABLE_VIDEO_AFTER_STOP,
+ HDFF_MSG_AV_GET_VIDEO_FORMAT_INFO,
+ HDFF_MSG_AV_SET_AUDIO_DELAY,
+ HDFF_MSG_AV_SET_AUDIO_DOWNMIX,
+ HDFF_MSG_AV_SET_AUDIO_CHANNEL,
+ HDFF_MSG_AV_SET_PLAY_MODE,
+
+ HDFF_MSG_MUX_SET_VIDEO_OUT = 0,
+ HDFF_MSG_MUX_SET_SLOW_BLANK,
+ HDFF_MSG_MUX_SET_FAST_BLANK,
+ HDFF_MSG_MUX_SET_VOLUME,
+ HDFF_MSG_MUX_SET_AUDIO_MUTE,
+
+ HDFF_MSG_OSD_CONFIGURE = 0,
+ HDFF_MSG_OSD_RESET,
+ HDFF_MSG_OSD_CREATE_DISPLAY = 10,
+ HDFF_MSG_OSD_DELETE_DISPLAY,
+ HDFF_MSG_OSD_ENABLE_DISPLAY,
+ HDFF_MSG_OSD_SET_DISPLAY_OUTPUT_RECTANGLE,
+ HDFF_MSG_OSD_SET_DISPLAY_CLIPPLING_AREA,
+ HDFF_MSG_OSD_RENDER_DISPLAY,
+ HDFF_MSG_OSD_SAVE_REGION,
+ HDFF_MSG_OSD_RESTORE_REGION,
+ HDFF_MSG_OSD_CREATE_PALETTE = 30,
+ HDFF_MSG_OSD_DELETE_PALETTE,
+ HDFF_MSG_OSD_SET_DISPLAY_PALETTE,
+ HDFF_MSG_OSD_SET_PALETTE_COLORS,
+ HDFF_MSG_OSD_CREATE_FONT_FACE = 50,
+ HDFF_MSG_OSD_DELETE_FONT_FACE,
+ HDFF_MSG_OSD_CREATE_FONT,
+ HDFF_MSG_OSD_DELETE_FONT,
+ HDFF_MSG_OSD_DRAW_PIXEL = 70,
+ HDFF_MSG_OSD_DRAW_RECTANGLE,
+ HDFF_MSG_OSD_DRAW_CIRCLE,
+ HDFF_MSG_OSD_DRAW_ELLIPSE,
+ HDFF_MSG_OSD_DRAW_SLOPE,
+ HDFF_MSG_OSD_DRAW_TEXT,
+ HDFF_MSG_OSD_DRAW_WIDE_TEXT,
+ HDFF_MSG_OSD_DRAW_BITMAP,
+
+ HDFF_MSG_HDMI_ENABLE_OUTPUT = 0,
+ HDFF_MSG_HDMI_SET_VIDEO_MODE,
+ HDFF_MSG_HDMI_CONFIGURE,
+ HDFF_MSG_HDMI_IS_DISPLAY_CONNECTED,
+ HDFF_MSG_HDMI_GET_DISPLAY_INFO,
+ HDFF_MSG_HDMI_GET_VIDEO_MODE,
+ HDFF_MSG_HDMI_SEND_CEC_COMMAND,
+
+ HDFF_MSG_REMOTE_SET_PROTOCOL = 0,
+ HDFF_MSG_REMOTE_SET_ADDRESS_FILTER,
+ HDFF_MSG_REMOTE_KEY_EVENT
+} HdffMessageId_t;
+
+#endif /* HDFFCMD_DEFS_H */
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_generic.c b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_generic.c
new file mode 100644
index 0000000..f72a7d3
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_generic.c
@@ -0,0 +1,147 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/ioctl.h>
+
+#include "hdffcmd.h"
+#include "hdffcmd_base.h"
+#include "hdffcmd_defs.h"
+
+int HdffCmdGetFirmwareVersion(int OsdDevice, uint32_t * Version, char * String,
+ uint32_t MaxLength)
+{
+ uint8_t cmdData[8];
+ uint8_t resultData[64];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ int err;
+
+ *Version = 0;
+ String[0] = 0;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ osd_cmd.result_data = resultData;
+ osd_cmd.result_len = sizeof(resultData);
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_GENERIC,
+ HDFF_MSG_GEN_GET_FIRMWARE_VERSION);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+ if (err == 0)
+ {
+ if (osd_cmd.result_len > 0)
+ {
+ uint8_t textLength = resultData[9];
+ if (textLength >= MaxLength)
+ textLength = MaxLength - 1;
+ memcpy(String, &resultData[10], textLength);
+ String[textLength] = 0;
+ *Version = (resultData[6] << 16)
+ | (resultData[7] << 8)
+ | resultData[8];
+ }
+ }
+ return err;
+}
+
+int HdffCmdGetInterfaceVersion(int OsdDevice, uint32_t * Version, char * String,
+ uint32_t MaxLength)
+{
+ uint8_t cmdData[8];
+ uint8_t resultData[64];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ int err;
+
+ *Version = 0;
+ String[0] = 0;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ osd_cmd.result_data = resultData;
+ osd_cmd.result_len = sizeof(resultData);
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_GENERIC,
+ HDFF_MSG_GEN_GET_INTERFACE_VERSION);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+ if (err == 0)
+ {
+ if (osd_cmd.result_len > 0)
+ {
+ uint8_t textLength = resultData[9];
+ if (textLength >= MaxLength)
+ textLength = MaxLength - 1;
+ memcpy(String, &resultData[10], textLength);
+ String[textLength] = 0;
+ *Version = (resultData[6] << 16)
+ | (resultData[7] << 8)
+ | resultData[8];
+ }
+ }
+ return err;
+}
+
+int HdffCmdGetCopyrights(int OsdDevice, uint8_t Index, char * String,
+ uint32_t MaxLength)
+{
+ uint8_t cmdData[8];
+ uint8_t resultData[280];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ int err;
+
+ String[0] = 0;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ osd_cmd.result_data = resultData;
+ osd_cmd.result_len = sizeof(resultData);
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_GENERIC,
+ HDFF_MSG_GEN_GET_COPYRIGHTS);
+ BitBuffer_SetBits(&cmdBuf, 8, Index);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+ if (err == 0)
+ {
+ if (osd_cmd.result_len > 0)
+ {
+ uint8_t index = resultData[6];
+ uint8_t textLen = resultData[7];
+ if (index == Index && textLen > 0)
+ {
+ if (textLen >= MaxLength)
+ {
+ textLen = MaxLength - 1;
+ }
+ memcpy(String, resultData + 8, textLen);
+ String[textLen] = 0;
+ }
+ }
+ }
+ return err;
+}
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_generic.h b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_generic.h
new file mode 100644
index 0000000..c12b296
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_generic.h
@@ -0,0 +1,36 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef HDFFCMD_GENERIC_H
+#define HDFFCMD_GENERIC_H
+
+int HdffCmdGetFirmwareVersion(int OsdDevice, uint32_t * Version, char * String,
+ uint32_t MaxLength);
+
+int HdffCmdGetInterfaceVersion(int OsdDevice, uint32_t * Version, char * String,
+ uint32_t MaxLength);
+
+int HdffCmdGetCopyrights(int OsdDevice, uint8_t Index, char * String,
+ uint32_t MaxLength);
+
+#endif /* HDFFCMD_GENERIC_H */
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_hdmi.c b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_hdmi.c
new file mode 100644
index 0000000..42b82b5
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_hdmi.c
@@ -0,0 +1,82 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/ioctl.h>
+
+#include "hdffcmd.h"
+#include "hdffcmd_base.h"
+#include "hdffcmd_defs.h"
+
+
+int HdffCmdHdmiSetVideoMode(int OsdDevice, HdffVideoMode_t VideoMode)
+{
+ uint8_t cmdData[8];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_HDMI,
+ HDFF_MSG_HDMI_SET_VIDEO_MODE);
+ BitBuffer_SetBits(&cmdBuf, 8, VideoMode);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdHdmiConfigure(int OsdDevice, const HdffHdmiConfig_t * Config)
+{
+ uint8_t cmdData[8];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_HDMI,
+ HDFF_MSG_HDMI_CONFIGURE);
+ BitBuffer_SetBits(&cmdBuf, 1, Config->TransmitAudio ? 1 : 0);
+ BitBuffer_SetBits(&cmdBuf, 1, Config->ForceDviMode ? 1 : 0);
+ BitBuffer_SetBits(&cmdBuf, 1, Config->CecEnabled ? 1 : 0);
+ BitBuffer_SetBits(&cmdBuf, 3, Config->VideoModeAdaption);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdHdmiSendCecCommand(int OsdDevice, HdffCecCommand_t Command)
+{
+ uint8_t cmdData[8];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_HDMI,
+ HDFF_MSG_HDMI_SEND_CEC_COMMAND);
+ BitBuffer_SetBits(&cmdBuf, 8, Command);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_hdmi.h b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_hdmi.h
new file mode 100644
index 0000000..16e375f
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_hdmi.h
@@ -0,0 +1,67 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef HDFFCMD_HDMI_H
+#define HDFFCMD_HDMI_H
+
+
+typedef enum HdffVideoMode_t
+{
+ HDFF_VIDEO_MODE_576P50 = 18,
+ HDFF_VIDEO_MODE_720P50 = 19,
+ HDFF_VIDEO_MODE_1080I50 = 20,
+ HDFF_VIDEO_MODE_576I50 = 22
+} HdffVideoMode_t;
+
+typedef enum HdffVideoModeAdaption_t
+{
+ HDFF_VIDEO_MODE_ADAPT_OFF,
+ HDFF_VIDEO_MODE_ADAPT_FRAME_RATE,
+ HDFF_VIDEO_MODE_ADAPT_ONLY_FOR_HD,
+ HDFF_VIDEO_MODE_ADAPT_ALWAYS
+} HdffVideoModeAdaption_t;
+
+typedef struct HdffHdmiConfig_t
+{
+ int TransmitAudio;
+ int ForceDviMode;
+ int CecEnabled;
+ HdffVideoModeAdaption_t VideoModeAdaption;
+} HdffHdmiConfig_t;
+
+typedef enum HdffCecCommand_t
+{
+ HDFF_CEC_COMMAND_TV_ON,
+ HDFF_CEC_COMMAND_TV_OFF,
+ HDFF_CEC_COMMAND_TV_ACTIVE_SOURCE,
+ HDFF_CEC_COMMAND_TV_INACTIVE_SOURCE
+} HdffCecCommand_t;
+
+
+int HdffCmdHdmiSetVideoMode(int OsdDevice, HdffVideoMode_t VideoMode);
+
+int HdffCmdHdmiConfigure(int OsdDevice, const HdffHdmiConfig_t * Config);
+
+int HdffCmdHdmiSendCecCommand(int OsdDevice, HdffCecCommand_t Command);
+
+#endif /* HDFFCMD_HDMI_H */
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_mux.c b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_mux.c
new file mode 100644
index 0000000..3698b56
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_mux.c
@@ -0,0 +1,81 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/ioctl.h>
+
+#include "hdffcmd.h"
+#include "hdffcmd_base.h"
+#include "hdffcmd_defs.h"
+
+
+int HdffCmdMuxSetVideoOut(int OsdDevice, HdffVideoOut_t VideoOut)
+{
+ uint8_t cmdData[8];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_AV_MUX,
+ HDFF_MSG_MUX_SET_VIDEO_OUT);
+ BitBuffer_SetBits(&cmdBuf, 4, VideoOut);
+ BitBuffer_SetBits(&cmdBuf, 4, 0); // reserved
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdMuxSetVolume(int OsdDevice, uint8_t Volume)
+{
+ uint8_t cmdData[8];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_AV_MUX,
+ HDFF_MSG_MUX_SET_VOLUME);
+ BitBuffer_SetBits(&cmdBuf, 8, Volume);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdMuxMuteAudio(int OsdDevice, int Mute)
+{
+ uint8_t cmdData[8];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_AV_MUX,
+ HDFF_MSG_MUX_SET_AUDIO_MUTE);
+ BitBuffer_SetBits(&cmdBuf, 1, Mute);
+ BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_mux.h b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_mux.h
new file mode 100644
index 0000000..8821d5f
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_mux.h
@@ -0,0 +1,56 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef HDFFCMD_MUX_H
+#define HDFFCMD_MUX_H
+
+
+typedef enum HdffVideoOut_t
+{
+ HDFF_VIDEO_OUT_DISABLED,
+ HDFF_VIDEO_OUT_CVBS_RGB,
+ HDFF_VIDEO_OUT_CVBS_YUV,
+ HDFF_VIDEO_OUT_YC
+} HdffVideoOut_t;
+
+typedef enum HdffSlowBlank_t
+{
+ HDFF_SLOW_BLANK_OFF,
+ HDFF_SLOW_BLANK_16_BY_9,
+ HDFF_SLOW_BLANK_4_BY_3
+} HdffSlowBlank_t;
+
+typedef enum HdffFastBlank_t
+{
+ HDFF_FAST_BLANK_CVBS,
+ HDFF_FAST_BLANK_RGB
+} HdffFastBlank_t;
+
+
+int HdffCmdMuxSetVideoOut(int OsdDevice, HdffVideoOut_t VideoOut);
+
+int HdffCmdMuxSetVolume(int OsdDevice, uint8_t Volume);
+
+int HdffCmdMuxMuteAudio(int OsdDevice, int Mute);
+
+#endif /* HDFFCMD_MUX_H */
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_osd.c b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_osd.c
new file mode 100644
index 0000000..a80051f
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_osd.c
@@ -0,0 +1,637 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/ioctl.h>
+
+#include "hdffcmd.h"
+#include "hdffcmd_base.h"
+#include "hdffcmd_defs.h"
+
+
+int HdffCmdOsdConfigure(int OsdDevice, const HdffOsdConfig_t * Config)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_CONFIGURE);
+ if (Config->FontAntialiasing)
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 1);
+ }
+ else
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 0);
+ }
+ if (Config->FontKerning)
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 1);
+ }
+ else
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 0);
+ }
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdReset(int OsdDevice)
+{
+ uint8_t cmdData[8];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_RESET);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+
+int HdffCmdOsdCreateDisplay(int OsdDevice, uint16_t Width, uint16_t Height,
+ HdffColorType_t ColorType, uint32_t * NewDisplay)
+{
+ uint8_t cmdData[16];
+ uint8_t resultData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ int err;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ osd_cmd.result_data = resultData;
+ osd_cmd.result_len = sizeof(resultData);
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_CREATE_DISPLAY);
+ BitBuffer_SetBits(&cmdBuf, 16, Width);
+ BitBuffer_SetBits(&cmdBuf, 16, Height);
+ BitBuffer_SetBits(&cmdBuf, 8, ColorType);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+ *NewDisplay = HDFF_INVALID_HANDLE;
+ if (err == 0)
+ {
+ if (osd_cmd.result_len > 0)
+ {
+ *NewDisplay = (resultData[6] << 24)
+ | (resultData[7] << 16)
+ | (resultData[8] << 8)
+ | resultData[9];
+ }
+ }
+ return err;
+}
+
+int HdffCmdOsdDeleteDisplay(int OsdDevice, uint32_t Display)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_DELETE_DISPLAY);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdEnableDisplay(int OsdDevice, uint32_t Display, int Enable)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_ENABLE_DISPLAY);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ if (Enable)
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 1);
+ }
+ else
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 0);
+ }
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdSetDisplayOutputRectangle(int OsdDevice, uint32_t Display,
+ uint16_t X, uint16_t Y,
+ uint16_t Width, uint16_t Height)
+{
+ uint8_t cmdData[20];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_SET_DISPLAY_OUTPUT_RECTANGLE);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ BitBuffer_SetBits(&cmdBuf, 16, X);
+ BitBuffer_SetBits(&cmdBuf, 16, Y);
+ BitBuffer_SetBits(&cmdBuf, 16, Width);
+ BitBuffer_SetBits(&cmdBuf, 16, Height);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdSetDisplayClippingArea(int OsdDevice, uint32_t Display,
+ int Enable, uint16_t X, uint16_t Y,
+ uint16_t Width, uint16_t Height)
+{
+ uint8_t cmdData[20];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_SET_DISPLAY_CLIPPLING_AREA);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ if (Enable)
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 1);
+ }
+ else
+ {
+ BitBuffer_SetBits(&cmdBuf, 1, 0);
+ }
+ BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 16, X);
+ BitBuffer_SetBits(&cmdBuf, 16, Y);
+ BitBuffer_SetBits(&cmdBuf, 16, Width);
+ BitBuffer_SetBits(&cmdBuf, 16, Height);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdRenderDisplay(int OsdDevice, uint32_t Display)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_RENDER_DISPLAY);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdSaveRegion(int OsdDevice, uint32_t Display,
+ uint16_t X, uint16_t Y,
+ uint16_t Width, uint16_t Height)
+{
+ uint8_t cmdData[20];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_SAVE_REGION);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ BitBuffer_SetBits(&cmdBuf, 16, X);
+ BitBuffer_SetBits(&cmdBuf, 16, Y);
+ BitBuffer_SetBits(&cmdBuf, 16, Width);
+ BitBuffer_SetBits(&cmdBuf, 16, Height);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdRestoreRegion(int OsdDevice, uint32_t Display)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_RESTORE_REGION);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+
+int HdffCmdOsdCreatePalette(int OsdDevice, HdffColorType_t ColorType,
+ HdffColorFormat_t ColorFormat,
+ uint32_t NumColors, const uint32_t * Colors,
+ uint32_t * NewPalette)
+{
+ uint8_t cmdData[1060];
+ uint8_t resultData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ int i;
+ int err;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ osd_cmd.result_data = resultData;
+ osd_cmd.result_len = sizeof(resultData);
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_CREATE_PALETTE);
+ BitBuffer_SetBits(&cmdBuf, 8, ColorType);
+ BitBuffer_SetBits(&cmdBuf, 8, ColorFormat);
+ if (NumColors > 256)
+ NumColors = 256;
+ BitBuffer_SetBits(&cmdBuf, 8, NumColors == 256 ? 0 : NumColors);
+ for (i = 0; i < NumColors; i++)
+ {
+ BitBuffer_SetBits(&cmdBuf, 32, Colors[i]);
+ }
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+ *NewPalette = HDFF_INVALID_HANDLE;
+ if (err == 0)
+ {
+ if (osd_cmd.result_len > 0)
+ {
+ *NewPalette = (resultData[6] << 24)
+ | (resultData[7] << 16)
+ | (resultData[8] << 8)
+ | resultData[9];
+ }
+ }
+ return err;
+}
+
+int HdffCmdOsdDeletePalette(int OsdDevice, uint32_t Palette)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_DELETE_PALETTE);
+ BitBuffer_SetBits(&cmdBuf, 32, Palette);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdSetDisplayPalette(int OsdDevice, uint32_t Display,
+ uint32_t Palette)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_SET_DISPLAY_PALETTE);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ BitBuffer_SetBits(&cmdBuf, 32, Palette);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdSetPaletteColors(int OsdDevice, uint32_t Palette,
+ HdffColorFormat_t ColorFormat,
+ uint8_t StartColor, uint32_t NumColors,
+ const uint32_t * Colors)
+{
+ uint8_t cmdData[1060];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ int i;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_SET_PALETTE_COLORS);
+ BitBuffer_SetBits(&cmdBuf, 32, Palette);
+ BitBuffer_SetBits(&cmdBuf, 8, ColorFormat);
+ BitBuffer_SetBits(&cmdBuf, 8, StartColor);
+ if (NumColors > 256)
+ NumColors = 256;
+ BitBuffer_SetBits(&cmdBuf, 8, NumColors == 256 ? 0 : NumColors);
+ for (i = 0; i < NumColors; i++)
+ {
+ BitBuffer_SetBits(&cmdBuf, 32, Colors[i]);
+ }
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdCreateFontFace(int OsdDevice, const uint8_t * FontData,
+ uint32_t DataSize, uint32_t * NewFontFace)
+{
+ uint8_t cmdData[16];
+ uint8_t resultData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ osd_raw_data_t osd_data;
+ int err;
+
+ *NewFontFace = HDFF_INVALID_HANDLE;
+
+ memset(&osd_data, 0, sizeof(osd_raw_data_t));
+ osd_data.data_buffer = FontData;
+ osd_data.data_length = DataSize;
+ err = ioctl(OsdDevice, OSD_RAW_DATA, &osd_data);
+ if (err != 0)
+ return err;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ osd_cmd.result_data = resultData;
+ osd_cmd.result_len = sizeof(resultData);
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_CREATE_FONT_FACE);
+ BitBuffer_SetBits(&cmdBuf, 16, osd_data.data_handle);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+ if (err == 0)
+ {
+ if (osd_cmd.result_len > 0)
+ {
+ *NewFontFace = (resultData[6] << 24)
+ | (resultData[7] << 16)
+ | (resultData[8] << 8)
+ | resultData[9];
+ }
+ }
+ return err;
+}
+
+int HdffCmdOsdDeleteFontFace(int OsdDevice, uint32_t FontFace)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_DELETE_FONT_FACE);
+ BitBuffer_SetBits(&cmdBuf, 32, FontFace);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdCreateFont(int OsdDevice, uint32_t FontFace, uint32_t Size,
+ uint32_t * NewFont)
+{
+ uint8_t cmdData[16];
+ uint8_t resultData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ int err;
+
+ *NewFont = HDFF_INVALID_HANDLE;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ osd_cmd.result_data = resultData;
+ osd_cmd.result_len = sizeof(resultData);
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_CREATE_FONT);
+ BitBuffer_SetBits(&cmdBuf, 32, FontFace);
+ BitBuffer_SetBits(&cmdBuf, 32, Size);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+ if (err == 0)
+ {
+ if (osd_cmd.result_len > 0)
+ {
+ *NewFont = (resultData[6] << 24)
+ | (resultData[7] << 16)
+ | (resultData[8] << 8)
+ | resultData[9];
+ }
+ }
+ return err;
+}
+
+int HdffCmdOsdDeleteFont(int OsdDevice, uint32_t Font)
+{
+ uint8_t cmdData[16];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_DELETE_FONT);
+ BitBuffer_SetBits(&cmdBuf, 32, Font);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+
+int HdffCmdOsdDrawRectangle(int OsdDevice, uint32_t Display, uint16_t X,
+ uint16_t Y, uint16_t Width, uint16_t Height,
+ uint32_t Color)
+{
+ uint8_t cmdData[24];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_DRAW_RECTANGLE);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ BitBuffer_SetBits(&cmdBuf, 16, X);
+ BitBuffer_SetBits(&cmdBuf, 16, Y);
+ BitBuffer_SetBits(&cmdBuf, 16, Width);
+ BitBuffer_SetBits(&cmdBuf, 16, Height);
+ BitBuffer_SetBits(&cmdBuf, 32, Color);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdDrawEllipse(int OsdDevice, uint32_t Display, uint16_t CX,
+ uint16_t CY, uint16_t RadiusX, uint16_t RadiusY,
+ uint32_t Color, uint32_t Flags)
+{
+ uint8_t cmdData[28];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_DRAW_ELLIPSE);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ BitBuffer_SetBits(&cmdBuf, 16, CX);
+ BitBuffer_SetBits(&cmdBuf, 16, CY);
+ BitBuffer_SetBits(&cmdBuf, 16, RadiusX);
+ BitBuffer_SetBits(&cmdBuf, 16, RadiusY);
+ BitBuffer_SetBits(&cmdBuf, 32, Color);
+ BitBuffer_SetBits(&cmdBuf, 32, Flags);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdDrawText(int OsdDevice, uint32_t Display, uint32_t Font,
+ uint16_t X, uint16_t Y, const char * Text,
+ uint32_t Color)
+{
+ uint8_t cmdData[1060];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ int i;
+ int length;
+
+ length = 0;
+ while (Text[length])
+ {
+ length++;
+ }
+ if (length > 980)
+ length = 980;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_DRAW_TEXT);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ BitBuffer_SetBits(&cmdBuf, 32, Font);
+ BitBuffer_SetBits(&cmdBuf, 16, X);
+ BitBuffer_SetBits(&cmdBuf, 16, Y);
+ BitBuffer_SetBits(&cmdBuf, 32, Color);
+ BitBuffer_SetBits(&cmdBuf, 16, length);
+ for (i = 0; i < length; i++)
+ {
+ BitBuffer_SetBits(&cmdBuf, 8, Text[i]);
+ }
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdDrawWideText(int OsdDevice, uint32_t Display, uint32_t Font,
+ uint16_t X, uint16_t Y, const uint16_t * Text,
+ uint32_t Color)
+{
+ uint8_t cmdData[1060];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ int i;
+ int length;
+
+ length = 0;
+ while (Text[length])
+ {
+ length++;
+ }
+ if (length > 480)
+ length = 480;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_DRAW_WIDE_TEXT);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ BitBuffer_SetBits(&cmdBuf, 32, Font);
+ BitBuffer_SetBits(&cmdBuf, 16, X);
+ BitBuffer_SetBits(&cmdBuf, 16, Y);
+ BitBuffer_SetBits(&cmdBuf, 32, Color);
+ BitBuffer_SetBits(&cmdBuf, 16, length);
+ for (i = 0; i < length; i++)
+ {
+ BitBuffer_SetBits(&cmdBuf, 16, Text[i]);
+ }
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdOsdDrawBitmap(int OsdDevice, uint32_t Display, uint16_t X,
+ uint16_t Y, const uint8_t * Bitmap, uint16_t BmpWidth,
+ uint16_t BmpHeight, uint32_t BmpSize,
+ HdffColorType_t ColorType, uint32_t Palette)
+{
+ uint8_t cmdData[32];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+ osd_raw_data_t osd_data;
+ int err;
+
+ memset(&osd_data, 0, sizeof(osd_raw_data_t));
+ osd_data.data_buffer = Bitmap;
+ osd_data.data_length = BmpSize;
+ err = ioctl(OsdDevice, OSD_RAW_DATA, &osd_data);
+ if (err != 0)
+ return err;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
+ HDFF_MSG_OSD_DRAW_BITMAP);
+ BitBuffer_SetBits(&cmdBuf, 32, Display);
+ BitBuffer_SetBits(&cmdBuf, 16, X);
+ BitBuffer_SetBits(&cmdBuf, 16, Y);
+ BitBuffer_SetBits(&cmdBuf, 16, BmpWidth);
+ BitBuffer_SetBits(&cmdBuf, 16, BmpHeight);
+ BitBuffer_SetBits(&cmdBuf, 8, ColorType);
+ BitBuffer_SetBits(&cmdBuf, 6, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 2, 0); // uncompressed
+ BitBuffer_SetBits(&cmdBuf, 32, Palette);
+ BitBuffer_SetBits(&cmdBuf, 16, osd_data.data_handle);
+ BitBuffer_SetBits(&cmdBuf, 32, 0);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_osd.h b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_osd.h
new file mode 100644
index 0000000..5c13559
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_osd.h
@@ -0,0 +1,161 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef HDFFCMD_OSD_H
+#define HDFFCMD_OSD_H
+
+
+#define HDFF_INVALID_HANDLE 0xFFFFFFFF
+#define HDFF_SCREEN_DISPLAY_HANDLE 0xFFFFFFFE
+
+#define HDFF_POSITION_SCREEN_CENTERED 0xFFFF
+
+#define HDFF_SIZE_FULL_SCREEN 0xFFFF
+#define HDFF_SIZE_SAME_AS_SOURCE 0xFFFE
+
+#define HDFF_FONT_FACE_TIRESIAS 0x00000000
+
+
+typedef struct HdffOsdConfig_t
+{
+ int FontAntialiasing;
+ int FontKerning;
+} HdffOsdConfig_t;
+
+typedef enum HdffColorType_t
+{
+ HDFF_COLOR_TYPE_CLUT1,
+ HDFF_COLOR_TYPE_CLUT2,
+ HDFF_COLOR_TYPE_CLUT4,
+ HDFF_COLOR_TYPE_CLUT8,
+ HDFF_COLOR_TYPE_ARGB8888,
+ HDFF_COLOR_TYPE_ARGB8565,
+ HDFF_COLOR_TYPE_ARGB4444,
+ HDFF_COLOR_TYPE_ARGB1555,
+ HDFF_COLOR_TYPE_RGB888,
+ HDFF_COLOR_TYPE_RGB565
+} HdffColorType_t;
+
+typedef enum HdffColorFormat_t
+{
+ HDFF_COLOR_FORMAT_ARGB,
+ HDFF_COLOR_FORMAT_ACBYCR
+} HdffColorFormat_t;
+
+typedef enum HdffDrawingFlags_t
+{
+ HDFF_DRAW_FULL,
+ HDFF_DRAW_HALF_TOP,
+ HDFF_DRAW_HALF_LEFT,
+ HDFF_DRAW_HALF_BOTTOM,
+ HDFF_DRAW_HALF_RIGHT,
+ HDFF_DRAW_QUARTER_TOP_LEFT,
+ HDFF_DRAW_QUARTER_TOP_RIGHT,
+ HDFF_DRAW_QUARTER_BOTTOM_LEFT,
+ HDFF_DRAW_QUARTER_BOTTOM_RIGHT,
+ HDFF_DRAW_QUARTER_TOP_LEFT_INVERTED,
+ HDFF_DRAW_QUARTER_TOP_RIGHT_INVERTED,
+ HDFF_DRAW_QUARTER_BOTTOM_LEFT_INVERTED,
+ HDFF_DRAW_QUARTER_BOTTOM_RIGHT_INVERTED
+} HdffDrawingFlags_t;
+
+
+int HdffCmdOsdConfigure(int OsdDevice, const HdffOsdConfig_t * Config);
+
+int HdffCmdOsdReset(int OsdDevice);
+
+
+int HdffCmdOsdCreateDisplay(int OsdDevice, uint16_t Width, uint16_t Height,
+ HdffColorType_t ColorType, uint32_t * NewDisplay);
+
+int HdffCmdOsdDeleteDisplay(int OsdDevice, uint32_t Display);
+
+int HdffCmdOsdEnableDisplay(int OsdDevice, uint32_t Display, int Enable);
+
+int HdffCmdOsdSetDisplayOutputRectangle(int OsdDevice, uint32_t Display,
+ uint16_t X, uint16_t Y,
+ uint16_t Width, uint16_t Height);
+
+int HdffCmdOsdSetDisplayClippingArea(int OsdDevice, uint32_t Display,
+ int Enable, uint16_t X, uint16_t Y,
+ uint16_t Width, uint16_t Height);
+
+int HdffCmdOsdRenderDisplay(int OsdDevice, uint32_t Display);
+
+int HdffCmdOsdSaveRegion(int OsdDevice, uint32_t Display,
+ uint16_t X, uint16_t Y,
+ uint16_t Width, uint16_t Height);
+
+int HdffCmdOsdRestoreRegion(int OsdDevice, uint32_t Display);
+
+
+int HdffCmdOsdCreatePalette(int OsdDevice, HdffColorType_t ColorType,
+ HdffColorFormat_t ColorFormat,
+ uint32_t NumColors, const uint32_t * Colors,
+ uint32_t * NewPalette);
+
+int HdffCmdOsdDeletePalette(int OsdDevice, uint32_t Palette);
+
+int HdffCmdOsdSetDisplayPalette(int OsdDevice, uint32_t Display,
+ uint32_t Palette);
+
+int HdffCmdOsdSetPaletteColors(int OsdDevice, uint32_t Palette,
+ HdffColorFormat_t ColorFormat,
+ uint8_t StartColor, uint32_t NumColors,
+ const uint32_t * Colors);
+
+
+int HdffCmdOsdCreateFontFace(int OsdDevice, const uint8_t * FontData,
+ uint32_t DataSize, uint32_t * NewFontFace);
+
+int HdffCmdOsdDeleteFontFace(int OsdDevice, uint32_t FontFace);
+
+int HdffCmdOsdCreateFont(int OsdDevice, uint32_t FontFace, uint32_t Size,
+ uint32_t * NewFont);
+
+int HdffCmdOsdDeleteFont(int OsdDevice, uint32_t Font);
+
+
+int HdffCmdOsdDrawRectangle(int OsdDevice, uint32_t Display, uint16_t X,
+ uint16_t Y, uint16_t Width, uint16_t Height,
+ uint32_t Color);
+
+int HdffCmdOsdDrawEllipse(int OsdDevice, uint32_t Display, uint16_t CX,
+ uint16_t CY, uint16_t RadiusX, uint16_t RadiusY,
+ uint32_t Color, uint32_t Flags);
+
+int HdffCmdOsdDrawText(int OsdDevice, uint32_t Display, uint32_t Font,
+ uint16_t X, uint16_t Y, const char * Text,
+ uint32_t Color);
+
+int HdffCmdOsdDrawWideText(int OsdDevice, uint32_t Display, uint32_t Font,
+ uint16_t X, uint16_t Y, const uint16_t * Text,
+ uint32_t Color);
+
+int HdffCmdOsdDrawBitmap(int OsdDevice, uint32_t Display, uint16_t X,
+ uint16_t Y, const uint8_t * Bitmap, uint16_t BmpWidth,
+ uint16_t BmpHeight, uint32_t BmpSize,
+ HdffColorType_t ColorType, uint32_t Palette);
+
+
+#endif /* HDFFCMD_OSD_H */
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_remote.c b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_remote.c
new file mode 100644
index 0000000..d9bbe45
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_remote.c
@@ -0,0 +1,67 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/ioctl.h>
+
+#include "hdffcmd.h"
+#include "hdffcmd_base.h"
+#include "hdffcmd_defs.h"
+
+
+int HdffCmdRemoteSetProtocol(int OsdDevice, HdffRemoteProtocol_t Protocol)
+{
+ uint8_t cmdData[8];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_REMOTE_CONTROL,
+ HDFF_MSG_REMOTE_SET_PROTOCOL);
+ BitBuffer_SetBits(&cmdBuf, 8, Protocol);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
+
+int HdffCmdRemoteSetAddressFilter(int OsdDevice, int Enable, uint32_t Address)
+{
+ uint8_t cmdData[12];
+ BitBuffer_t cmdBuf;
+ osd_raw_cmd_t osd_cmd;
+
+ BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
+ memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
+ osd_cmd.cmd_data = cmdData;
+ HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
+ HDFF_MSG_GROUP_REMOTE_CONTROL,
+ HDFF_MSG_REMOTE_SET_ADDRESS_FILTER);
+ BitBuffer_SetBits(&cmdBuf, 1, Enable);
+ BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved
+ BitBuffer_SetBits(&cmdBuf, 32, Address);
+ osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
+ return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
+}
diff --git a/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_remote.h b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_remote.h
new file mode 100644
index 0000000..f2e6b8a
--- /dev/null
+++ b/PLUGINS/src/dvbhddevice/libhdffcmd/hdffcmd_remote.h
@@ -0,0 +1,39 @@
+/**********************************************************************
+ *
+ * HDFF firmware command interface library
+ *
+ * Copyright (C) 2011 Andreas Regel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *********************************************************************/
+
+#ifndef HDFFCMD_REMOTE_H
+#define HDFFCMD_REMOTE_H
+
+typedef enum HdffRemoteProtocol_t
+{
+ HDFF_REMOTE_PROTOCOL_NONE,
+ HDFF_REMOTE_PROTOCOL_RC5,
+ HDFF_REMOTE_PROTOCOL_RC6
+} HdffRemoteProtocol_t;
+
+
+int HdffCmdRemoteSetProtocol(int OsdDevice, HdffRemoteProtocol_t Protocol);
+
+int HdffCmdRemoteSetAddressFilter(int OsdDevice, int Enable, uint32_t Address);
+
+#endif /* HDFFCMD_REMOTE_H */
diff --git a/PLUGINS/src/dvbhddevice/po/fi_FI.po b/PLUGINS/src/dvbhddevice/po/fi_FI.po
index db8ef0b..48abaf5 100644
--- a/PLUGINS/src/dvbhddevice/po/fi_FI.po
+++ b/PLUGINS/src/dvbhddevice/po/fi_FI.po
@@ -20,13 +20,13 @@ msgid "HD Full Featured DVB device"
msgstr "DVB-laite HD-ulostulolla"
msgid "Off"
-msgstr ""
+msgstr "ei"
msgid "Frame rate"
-msgstr ""
+msgstr "kuvataajuuden mukaan"
msgid "HD Only"
-msgstr ""
+msgstr "vain HD-resoluutiolla"
msgid "Always"
msgstr "aina"
@@ -68,7 +68,7 @@ msgid "Resolution"
msgstr "Kuvaresoluutio"
msgid "Video Mode Adaption"
-msgstr ""
+msgstr "Sovita näyttömoodi"
msgid "TV format"
msgstr "Näytön kuvasuhde"
diff --git a/PLUGINS/src/dvbhddevice/setup.c b/PLUGINS/src/dvbhddevice/setup.c
index 6e41860..cb476a8 100644
--- a/PLUGINS/src/dvbhddevice/setup.c
+++ b/PLUGINS/src/dvbhddevice/setup.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: setup.c 1.13 2011/08/27 09:35:35 kls Exp $
+ * $Id: setup.c 1.14 2011/12/04 15:31:58 kls Exp $
*/
#include "setup.h"
@@ -20,12 +20,12 @@ cHdffSetup gHdffSetup;
cHdffSetup::cHdffSetup(void)
{
Resolution = kResolution1080i;
- VideoModeAdaption = HDFF::videoModeAdaptOff;
- TvFormat = HDFF::tvFormat16by9;
- VideoConversion = HDFF::videoConversionPillarbox;
- AnalogueVideo = HDFF::videoOutCvbsYuv;
+ VideoModeAdaption = HDFF_VIDEO_MODE_ADAPT_OFF;
+ TvFormat = HDFF_TV_FORMAT_16_BY_9;
+ VideoConversion = HDFF_VIDEO_CONVERSION_PILLARBOX;
+ AnalogueVideo = HDFF_VIDEO_OUT_CVBS_YUV;
AudioDelay = 0;
- AudioDownmix = HDFF::downmixAutomatic;
+ AudioDownmix = HDFF_AUDIO_DOWNMIX_AUTOMATIC;
OsdSize = 0;
CecEnabled = 1;
RemoteProtocol = 1;
@@ -68,7 +68,7 @@ void cHdffSetup::GetOsdSize(int &Width, int &Height, double &PixelAspect)
Width = 720;
Height = 576;
}
- if (TvFormat == HDFF::tvFormat16by9)
+ if (TvFormat == HDFF_TV_FORMAT_16_BY_9)
PixelAspect = 16.0 / 9.0;
else
PixelAspect = 4.0 / 3.0;
@@ -96,19 +96,19 @@ void cHdffSetup::GetOsdSize(int &Width, int &Height, double &PixelAspect)
PixelAspect /= double(Width) / Height;
}
-HDFF::eHdmiVideoMode cHdffSetup::GetVideoMode(void)
+HdffVideoMode_t cHdffSetup::GetVideoMode(void)
{
switch (Resolution)
{
case kResolution1080i:
default:
- return HDFF::videoMode1080i50;
+ return HDFF_VIDEO_MODE_1080I50;
case kResolution720p:
- return HDFF::videoMode720p50;
+ return HDFF_VIDEO_MODE_720P50;
case kResolution576p:
- return HDFF::videoMode576p50;
+ return HDFF_VIDEO_MODE_576P50;
case kResolution576i:
- return HDFF::videoMode576i50;
+ return HDFF_VIDEO_MODE_576I50;
}
}
@@ -233,27 +233,27 @@ void cHdffSetupPage::Store(void)
{
mHdffCmdIf->CmdHdmiSetVideoMode(mNewHdffSetup.GetVideoMode());
}
- HDFF::tVideoFormat videoFormat;
- HDFF::tHdmiConfig hdmiConfig;
+ HdffVideoFormat_t videoFormat;
+ HdffHdmiConfig_t hdmiConfig;
videoFormat.AutomaticEnabled = true;
videoFormat.AfdEnabled = true;
- videoFormat.TvFormat = (HDFF::eTvFormat) mNewHdffSetup.TvFormat;
- videoFormat.VideoConversion = (HDFF::eVideoConversion) mNewHdffSetup.VideoConversion;
+ videoFormat.TvFormat = (HdffTvFormat_t) mNewHdffSetup.TvFormat;
+ videoFormat.VideoConversion = (HdffVideoConversion_t) mNewHdffSetup.VideoConversion;
mHdffCmdIf->CmdAvSetVideoFormat(0, &videoFormat);
mHdffCmdIf->CmdAvSetAudioDelay(mNewHdffSetup.AudioDelay);
- mHdffCmdIf->CmdAvSetAudioDownmix((HDFF::eDownmixMode) mNewHdffSetup.AudioDownmix);
+ mHdffCmdIf->CmdAvSetAudioDownmix((HdffAudioDownmixMode_t) mNewHdffSetup.AudioDownmix);
- mHdffCmdIf->CmdMuxSetVideoOut((HDFF::eVideoOut) mNewHdffSetup.AnalogueVideo);
+ mHdffCmdIf->CmdMuxSetVideoOut((HdffVideoOut_t) mNewHdffSetup.AnalogueVideo);
hdmiConfig.TransmitAudio = true;
hdmiConfig.ForceDviMode = false;
hdmiConfig.CecEnabled = mNewHdffSetup.CecEnabled;
- hdmiConfig.VideoModeAdaption = (HDFF::eVideoModeAdaption) mNewHdffSetup.VideoModeAdaption;
+ hdmiConfig.VideoModeAdaption = (HdffVideoModeAdaption_t) mNewHdffSetup.VideoModeAdaption;
mHdffCmdIf->CmdHdmiConfigure(&hdmiConfig);
- mHdffCmdIf->CmdRemoteSetProtocol((HDFF::eRemoteProtocol) mNewHdffSetup.RemoteProtocol);
+ mHdffCmdIf->CmdRemoteSetProtocol((HdffRemoteProtocol_t) mNewHdffSetup.RemoteProtocol);
mHdffCmdIf->CmdRemoteSetAddressFilter(mNewHdffSetup.RemoteAddress >= 0, mNewHdffSetup.RemoteAddress);
}
diff --git a/PLUGINS/src/dvbhddevice/setup.h b/PLUGINS/src/dvbhddevice/setup.h
index c3fe7a6..964105e 100644
--- a/PLUGINS/src/dvbhddevice/setup.h
+++ b/PLUGINS/src/dvbhddevice/setup.h
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: setup.h 1.9 2011/08/27 09:36:02 kls Exp $
+ * $Id: setup.h 1.10 2011/12/04 15:32:13 kls Exp $
*/
#ifndef _HDFF_SETUP_H_
@@ -17,7 +17,7 @@ struct cHdffSetup
cHdffSetup(void);
bool SetupParse(const char * Name, const char * Value);
void GetOsdSize(int &Width, int &Height, double &PixelAspect);
- HDFF::eHdmiVideoMode GetVideoMode(void);
+ HdffVideoMode_t GetVideoMode(void);
int Resolution;
int VideoModeAdaption;