vdr 2.7.4
hdffcmd_mux.c
Go to the documentation of this file.
1/**********************************************************************
2 *
3 * HDFF firmware command interface library
4 *
5 * Copyright (C) 2011 Andreas Regel
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the
19 * Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 *
22 *********************************************************************/
23
24#include <stdint.h>
25#include <string.h>
26#include <sys/ioctl.h>
27
28#include "hdffcmd.h"
29#include "hdffcmd_base.h"
30#include "hdffcmd_defs.h"
31
32
33int HdffCmdMuxSetVideoOut(int OsdDevice, HdffVideoOut_t VideoOut)
34{
35 uint8_t cmdData[8];
36 BitBuffer_t cmdBuf;
37 osd_raw_cmd_t osd_cmd;
38
39 BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
40 memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
41 osd_cmd.cmd_data = cmdData;
44 BitBuffer_SetBits(&cmdBuf, 4, VideoOut);
45 BitBuffer_SetBits(&cmdBuf, 4, 0); // reserved
46 osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
47 return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
48}
49
50int HdffCmdMuxSetVolume(int OsdDevice, uint8_t Volume)
51{
52 uint8_t cmdData[8];
53 BitBuffer_t cmdBuf;
54 osd_raw_cmd_t osd_cmd;
55
56 BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
57 memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
58 osd_cmd.cmd_data = cmdData;
61 BitBuffer_SetBits(&cmdBuf, 8, Volume);
62 osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
63 return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
64}
65
66int HdffCmdMuxMuteAudio(int OsdDevice, int Mute)
67{
68 uint8_t cmdData[8];
69 BitBuffer_t cmdBuf;
70 osd_raw_cmd_t osd_cmd;
71
72 BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
73 memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
74 osd_cmd.cmd_data = cmdData;
77 BitBuffer_SetBits(&cmdBuf, 1, Mute);
78 BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved
79 osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
80 return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
81}
void BitBuffer_Init(BitBuffer_t *BitBuffer, uint8_t *Data, uint32_t MaxLength)
Definition bitbuffer.c:28
void BitBuffer_SetBits(BitBuffer_t *BitBuffer, int NumBits, uint32_t Data)
Definition bitbuffer.c:37
void HdffCmdBuildHeader(BitBuffer_t *MsgBuf, HdffMessageType_t MsgType, HdffMessageGroup_t MsgGroup, HdffMessageId_t MsgId)
uint32_t HdffCmdSetLength(BitBuffer_t *MsgBuf)
#define OSD_RAW_CMD
struct osd_raw_cmd_s osd_raw_cmd_t
@ HDFF_MSG_GROUP_AV_MUX
@ HDFF_MSG_TYPE_COMMAND
@ HDFF_MSG_MUX_SET_VIDEO_OUT
@ HDFF_MSG_MUX_SET_VOLUME
@ HDFF_MSG_MUX_SET_AUDIO_MUTE
int HdffCmdMuxSetVideoOut(int OsdDevice, HdffVideoOut_t VideoOut)
Definition hdffcmd_mux.c:33
int HdffCmdMuxSetVolume(int OsdDevice, uint8_t Volume)
Definition hdffcmd_mux.c:50
int HdffCmdMuxMuteAudio(int OsdDevice, int Mute)
Definition hdffcmd_mux.c:66
HdffVideoOut_t
Definition hdffcmd_mux.h:29
const void * cmd_data