summaryrefslogtreecommitdiff
path: root/PLUGINS/src/dvbhddevice/libhdffcmd
diff options
context:
space:
mode:
authorKlaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de>2011-12-04 16:53:00 +0100
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2011-12-05 20:36:02 +0100
commit5a28d999363f8ace192489d4f6b13dfeb6cfc20b (patch)
tree4aa9a419b3e1d45656c66ead7b8a4997665951e2 /PLUGINS/src/dvbhddevice/libhdffcmd
parent0c96d6b62650790dc83ce6621eb664e51f39719b (diff)
downloadvdr-patches-5a28d999363f8ace192489d4f6b13dfeb6cfc20b.tar.gz
vdr-patches-5a28d999363f8ace192489d4f6b13dfeb6cfc20b.tar.bz2
Version 1.7.22
Original announce message: VDR developer version 1.7.22 is now available at ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.22.tar.bz2 A 'diff' against the previous version is available at ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.21-1.7.22.diff MD5 checksums: b9c0fe1aac8e653c0d0234bc72c2bb2c vdr-1.7.22.tar.bz2 868bb332342c9a78beda17cc85e0bb93 vdr-1.7.21-1.7.22.diff WARNING: ======== This is a developer version. Even though I use it in my productive environment. I strongly recommend that you only use it under controlled conditions and for testing and debugging. From the HISTORY file: - Fixed scaling subtitles in case the primary device's GetVideoSize() function doesn't return actual values (thanks to Luca Olivetti). - The DiSEqC codes are now copied in the call to cDiseqc::Execute(). - VDR now supports "Satellite Channel Routing" (SCR) according to EN50494 (based on the "unicable" patch from Lars Hanisch). Since "Unicable" is a registered trademark and stands for only one of many implementations of SCR, the following changes have been made compared to the patch, which need to be taken into account by people who have set up their system using the patch: - The 'U' parameter in the diseqc.conf file has been changed to 'S' ("Scr"). - The configuration file name has been changed from "unicable.conf" to "scr.conf". - Updated sources.conf (thanks to Arthur Konovalov). - The SVDRP command LSTC now also accepts channel IDs (thanks to Dominic Evans). - Fixed handling DVB subtitles and implemented decoding textual DVB subtitles (thanks to Rolf Ahrenberg). - Added cap_net_raw to the capabilities that are not dropped (thanks to Dominic Evans). - Fixed setting the start time of an edited recording (thanks to Christoph Haubrich). - Temporarily switching free devices to transponders in order to have their running status updated is now done by marking the devices as "occupied" for a certain amount of time. - The new setup options "LNB/Device n connected to sat cable" can be used to define which DVB-S devices are connected to the same sat cable and are therefore "bonded". This obsoletes the LNBSHARE patch. Users of the LNBSHARE patch will need to newly set up their sat devices with the above options. - Fixed a crash when deleting a recording while cutting it (thanks to Ville Skyttä). - Fixed several spelling errors (thanks to Ville Skyttä). - The new SVDRP command UPDR can be used to trigger an update of the list of recordings (thanks to Lars Hanisch). - Added generating a pkg-config file to the Makefile (thanks to Ville Skyttä). - Removed the '.pl' suffix from all scripts (thanks to Ville Skyttä). - Changed the default location for the LIRC socket to /var/run/lirc/lircd (thanks to Ville Skyttä). - Added file name and line number to LOG_ERROR_STR() (thanks to Rolf Ahrenberg). - Replaced all calls to sleep() with cCondWait::SleepMs() (thanks to Rolf Ahrenberg). - Fixed a crash with malformed SI data (patch from vdr-portal).
Diffstat (limited to 'PLUGINS/src/dvbhddevice/libhdffcmd')
-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
19 files changed, 2434 insertions, 0 deletions
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 */