vdr  1.7.27
hdffcmd_mux.c
Go to the documentation of this file.
00001 /**********************************************************************
00002  *
00003  * HDFF firmware command interface library
00004  *
00005  * Copyright (C) 2011  Andreas Regel
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the
00019  * Free Software Foundation, Inc.,
00020  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021  *
00022  *********************************************************************/
00023 
00024 #include <stdint.h>
00025 #include <string.h>
00026 #include <sys/ioctl.h>
00027 
00028 #include "hdffcmd.h"
00029 #include "hdffcmd_base.h"
00030 #include "hdffcmd_defs.h"
00031 
00032 
00033 int HdffCmdMuxSetVideoOut(int OsdDevice, HdffVideoOut_t VideoOut)
00034 {
00035     uint8_t cmdData[8];
00036     BitBuffer_t cmdBuf;
00037     osd_raw_cmd_t osd_cmd;
00038 
00039     BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
00040     memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
00041     osd_cmd.cmd_data = cmdData;
00042     HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_AV_MUX,
00043                        HDFF_MSG_MUX_SET_VIDEO_OUT);
00044     BitBuffer_SetBits(&cmdBuf, 4, VideoOut);
00045     BitBuffer_SetBits(&cmdBuf, 4, 0); // reserved
00046     osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
00047     return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
00048 }
00049 
00050 int HdffCmdMuxSetVolume(int OsdDevice, uint8_t Volume)
00051 {
00052     uint8_t cmdData[8];
00053     BitBuffer_t cmdBuf;
00054     osd_raw_cmd_t osd_cmd;
00055 
00056     BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
00057     memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
00058     osd_cmd.cmd_data = cmdData;
00059     HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_AV_MUX,
00060                        HDFF_MSG_MUX_SET_VOLUME);
00061     BitBuffer_SetBits(&cmdBuf, 8, Volume);
00062     osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
00063     return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
00064 }
00065 
00066 int HdffCmdMuxMuteAudio(int OsdDevice, int Mute)
00067 {
00068     uint8_t cmdData[8];
00069     BitBuffer_t cmdBuf;
00070     osd_raw_cmd_t osd_cmd;
00071 
00072     BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
00073     memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
00074     osd_cmd.cmd_data = cmdData;
00075     HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_AV_MUX,
00076                        HDFF_MSG_MUX_SET_AUDIO_MUTE);
00077     BitBuffer_SetBits(&cmdBuf, 1, Mute);
00078     BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved
00079     osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
00080     return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
00081 }