int CAudio::setBypassMode(int disable) { /* disable = 1 actually means: audio is MPEG, disable = 0 is audio is AC3 */ if (disable) return quiet_fop(ioctl, MPEG_AUD_SET_MODE, AUD_MODE_MPEG); /* dvb2001 does always set AUD_MODE_DTS before setting AUD_MODE_AC3, this might be some workaround, so we do the same... */ quiet_fop(ioctl, MPEG_AUD_SET_MODE, AUD_MODE_DTS); return quiet_fop(ioctl, MPEG_AUD_SET_MODE, AUD_MODE_AC3); /* all those ioctl aways return "invalid argument", but they seem to work nevertheless, that's why I use quiet_fop here */ }
void CFrontend::setFrontend(const dvb_frontend_parameters *feparams) { dvb_frontend_event event; if (fd == -1) return; if (errno != 0) errno = 0; while ((errno == 0) || (errno == EOVERFLOW)) quiet_fop(ioctl, FE_GET_EVENT, &event); #ifdef HAVE_DREAMBOX_HARDWARE dvb_frontend_parameters feparams2; memcpy(&feparams2, feparams, sizeof(dvb_frontend_parameters)); /* the dreambox cable driver likes to get the frequency in kHz */ if (info.type == FE_QAM) { feparams2.Frequency /= 1000; DBG("cable box: setting frequency to %d khz\n", feparams2.Frequency); } fop(ioctl, FE_SET_FRONTEND, &feparams2); #else fop(ioctl, FE_SET_FRONTEND, feparams); #endif }
void CFrontend::setFrontend(const dvb_frontend_parameters *feparams) { dvb_frontend_event event; if (fd == -1) return; errno = 0; while ((errno == 0) || (errno == EOVERFLOW)) quiet_fop(ioctl, FE_GET_EVENT, &event); #if HAVE_DVB_API_VERSION < 3 dvb_frontend_parameters feparams2; memcpy(&feparams2, feparams, sizeof(dvb_frontend_parameters)); /* the dreambox cable driver likes to get the frequency in kHz */ if (info.type == FE_QAM) { feparams2.Frequency /= 1000; DBG("cable box: setting frequency to %d khz\n", feparams2.Frequency); } if (auto_fec) { if (info.type == FE_QPSK) feparams2.u.qpsk.FEC_inner = FEC_AUTO; if (info.type == FE_QAM) feparams2.u.qam.FEC_inner = FEC_AUTO; } fop(ioctl, FE_SET_FRONTEND, &feparams2); #else fop(ioctl, FE_SET_FRONTEND, feparams); #endif }
video_format_t CVideo::getAspectRatio(void) { VIDEOINFO v; /* this memset silences *TONS* of valgrind warnings */ memset(&v, 0, sizeof(v)); quiet_fop(ioctl, MPEG_VID_GET_V_INFO, &v); if (v.pel_aspect_ratio < VID_DISPSIZE_4x3 || v.pel_aspect_ratio > VID_DISPSIZE_UNKNOWN) { WARN("invalid value %d, returning VID_DISPSIZE_UNKNOWN fd: %d", v.pel_aspect_ratio, fd); return VID_DISPSIZE_UNKNOWN; } return v.pel_aspect_ratio; }
int CVideo::setBlank(int) { /* The TripleDragon has no VIDEO_SET_BLANK ioctl. instead, you write a black still-MPEG Iframe into the decoder. The original software uses different files for 4:3 and 16:9 and for PAL and NTSC. I optimized that a little bit */ int index = 0; /* default PAL */ VIDEOINFO v; BUFINFO buf; memset(&v, 0, sizeof(v)); quiet_fop(ioctl, MPEG_VID_GET_V_INFO, &v); if ((v.v_size % 240) == 0) /* NTSC */ { INFO("NTSC format detected"); index = 1; } if (blank_data[index] == NULL) /* no MPEG found */ return -1; /* hack: this might work only on those two still-MPEG files! I diff'ed the 4:3 and the 16:9 still mpeg from the original soft and spotted the single bit difference, so there is no need to keep two different MPEGs in memory If we would read them from disk all the time it would be slower and it might wake up the drive occasionally */ if (v.pel_aspect_ratio == VID_DISPSIZE_4x3) ((char *)blank_data[index])[7] &= ~0x10; // clear the bit else ((char *)blank_data[index])[7] |= 0x10; // set the bit //WARN("blank[7] == 0x%02x", ((char *)blank_data[index])[7]); buf.ulLen = blank_size[index]; buf.ulStartAdrOff = (int)blank_data[index]; return fop(ioctl, MPEG_VID_STILLP_WRITE, &buf); }
int CAudio::setBypassMode(int disable) { return quiet_fop(ioctl, AUDIO_SET_BYPASS_MODE, disable); }
int CAudio::start(void) { return quiet_fop(ioctl, AUDIO_PLAY); }
int CAudio::setSource(audio_stream_source_t source) { return quiet_fop(ioctl, AUDIO_SELECT_SOURCE, source); }
int CVideo::setSource(video_stream_source_t source) { return quiet_fop(ioctl, VIDEO_SELECT_SOURCE, source); }