/* * test_switch.c - Test program for new API * * Copyright (C) 2001 Ralph Metzler * & Marcus Metzler for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include int fd_frontend; int fd_sec; int fd_demuxa; int fd_demuxv; int fd_demuxtt; struct dmx_sct_filter_params sctFilterParams; struct secCommand scmd; struct secCmdSequence scmds; struct dmx_pes_filter_params pesFilterParams; struct dmx_pes_filter_params pesFilterParamsV; struct dmx_pes_filter_params pesFilterParamsA; struct dmx_pes_filter_params pesFilterParamsTT; FrontendParameters frp; int front_type; set_front(void) { fe_status_t stat = 0; int i, freq; uint32_t soff; scmds.miniCommand = SEC_MINI_NONE; scmds.numCommands = 1; scmds.commands = &scmd; soff = frp.u.qpsk.SymbolRate/16000; if (ioctl(fd_sec, SEC_SEND_SEQUENCE, &scmds) < 0) perror("setfront sec"); usleep(100000); freq = frp.Frequency; while(tune_it(&frp)); } set_diseqc_nb(int nr) { scmd.type=0; scmd.u.diseqc.addr = 0x10; scmd.u.diseqc.cmd = 0x38; scmd.u.diseqc.numParams = 1; scmd.u.diseqc.params[0] = 0xF0 | ((nr * 4) & 0x0F) | (scmds.continuousTone == SEC_TONE_ON ? 1 : 0) | (scmds.voltage==SEC_VOLTAGE_18 ? 2 : 0); } set_ttpid(ushort ttpid) { if (ttpid==0 || ttpid==0xffff || ttpid==0x1fff) { ioctl(fd_demuxtt, DMX_STOP, 0); return; } pesFilterParamsTT.pid = ttpid; pesFilterParamsTT.input = DMX_IN_FRONTEND; pesFilterParamsTT.output = DMX_OUT_DECODER; pesFilterParamsTT.pes_type = DMX_PES_TELETEXT; pesFilterParamsTT.flags = DMX_IMMEDIATE_START; if (ioctl(fd_demuxtt, DMX_SET_PES_FILTER, &pesFilterParamsTT) < 0) { printf("PID=%04x\n", ttpid); perror("set_ttpid"); } } set_vpid(ushort vpid) { if (vpid==0 || vpid==0xffff || vpid==0x1fff) { ioctl(fd_demuxv, DMX_STOP, 0); return; } pesFilterParamsV.pid = vpid; pesFilterParamsV.input = DMX_IN_FRONTEND; pesFilterParamsV.output = DMX_OUT_DECODER; pesFilterParamsV.pes_type = DMX_PES_VIDEO; pesFilterParamsV.flags = DMX_IMMEDIATE_START; if (ioctl(fd_demuxv, DMX_SET_PES_FILTER, &pesFilterParamsV) < 0) perror("set_vpid"); } set_apid(ushort apid) { if (apid==0 || apid==0xffff || apid==0x1fff) { ioctl(fd_demuxa, DMX_STOP, apid); return; } pesFilterParamsA.pid = apid; pesFilterParamsA.input = DMX_IN_FRONTEND; pesFilterParamsA.output = DMX_OUT_DECODER; pesFilterParamsA.pes_type = DMX_PES_AUDIO; pesFilterParamsA.flags = DMX_IMMEDIATE_START; if (ioctl(fd_demuxa, DMX_SET_PES_FILTER, &pesFilterParamsA) < 0) perror("set_apid"); } int tune_it(FrontendParameters *frp) { fe_status