summaryrefslogtreecommitdiff
path: root/dvbdevice.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-10-13 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-10-13 18:00:00 +0200
commitcd7ccd64fd51b77b8b75b6e85ef6891b1917aa59 (patch)
tree7de627368728c02bdf195a3cbca5418175638434 /dvbdevice.c
parent313e33539cd22fd571fc9a0f9f841173e9faebc4 (diff)
downloadvdr-patch-lnbsharing-cd7ccd64fd51b77b8b75b6e85ef6891b1917aa59.tar.gz
vdr-patch-lnbsharing-cd7ccd64fd51b77b8b75b6e85ef6891b1917aa59.tar.bz2
Version 1.1.13vdr-1.1.13
- Added cDevice::DeviceNumber() to get the number of a device, not counting any gaps that might be in the index count. - Fixed fetching the current/next information to handle cases where the duration of an event is set wrongly and would last beyond the start time of the next event. - Adapted type names to the new HEAD version of the driver (which the previous NEWSTRUCT branch has been merged into). Note that to use this driver version you still need to add NEWSTRUCT=1 to the make call when building VDR. You need a HEAD version of the LinuxDVB driver dated 2002-10-11 or later to compile VDR with NEWSTRUCT=1. - Fixed radio channels in channels.conf.cable (thanks to Robert Schiele and Uwe Scheffler). - Fixed switching the video format in the Setup/DVB menu (thanks to Uwe Scheffler for reporting this one). - Reactivated full handling of second audio PID (even in 'Transfer Mode'). - Fixed a crash when closing down with remote control plugins (thanks to Oliver Endriss helping to debug this one). - Commands in the file 'commands.conf' can now have a '?' at the end of their title, which will result in a confirmation prompt before executing the command. - Changed a few leftover 'new char[...]' to MALLOC(char, ...). - If a command executed from the "Commands" menu doesn't return any output, the OSD will now be closed automatically. - The SVDRP command PUTE now triggers an immediate write of the 'epg.data' file (suggested by Gerhard Steiner). - The new configuration file 'reccmds.conf' can be used to define commands that shall be executed from the "Recordings" menu; see MANUAL and 'man vdr(5)' for details (suggested by Gerhard Steiner).
Diffstat (limited to 'dvbdevice.c')
-rw-r--r--dvbdevice.c92
1 files changed, 77 insertions, 15 deletions
diff --git a/dvbdevice.c b/dvbdevice.c
index eeaa7b0..a4a4308 100644
--- a/dvbdevice.c
+++ b/dvbdevice.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbdevice.c 1.22 2002/10/06 09:07:45 kls Exp $
+ * $Id: dvbdevice.c 1.24 2002/10/12 11:15:45 kls Exp $
*/
#include "dvbdevice.h"
@@ -80,7 +80,11 @@ static int DvbOpen(const char *Name, int n, int Mode, bool ReportError = false)
cDvbDevice::cDvbDevice(int n)
{
+#ifdef NEWSTRUCT
+ frontendType = fe_type_t(-1); // don't know how else to initialize this - there is no FE_UNKNOWN
+#else
frontendType = FrontendType(-1); // don't know how else to initialize this - there is no FE_UNKNOWN
+#endif
siProcessor = NULL;
spuDecoder = NULL;
playMode = pmNone;
@@ -126,6 +130,8 @@ cDvbDevice::cDvbDevice(int n)
else
esyslog("ERROR: can't open DVB device %d", n);
+ aPid1 = aPid2 = 0;
+
source = -1;
frequency = -1;
diseqcCommands = NULL;
@@ -306,12 +312,20 @@ void cDvbDevice::SetVideoFormat(bool VideoFormat16_9)
}
// ptAudio ptVideo ptTeletext ptDolby ptOther
+#ifdef NEWSTRUCT
+dmx_pes_type_t PesTypes[] = { DMX_PES_AUDIO, DMX_PES_VIDEO, DMX_PES_TELETEXT, DMX_PES_OTHER, DMX_PES_OTHER };
+#else
dmxPesType_t PesTypes[] = { DMX_PES_AUDIO, DMX_PES_VIDEO, DMX_PES_TELETEXT, DMX_PES_OTHER, DMX_PES_OTHER };
+#endif
bool cDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On)
{
if (Handle->pid) {
+#ifdef NEWSTRUCT
+ dmx_pes_filter_params pesFilterParams;
+#else
dmxPesFilterParams pesFilterParams;
+#endif
memset(&pesFilterParams, 0, sizeof(pesFilterParams));
if (On) {
if (Handle->handle < 0) {
@@ -322,7 +336,11 @@ bool cDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On)
pesFilterParams.pid = Handle->pid;
pesFilterParams.input = DMX_IN_FRONTEND;
pesFilterParams.output = (Type <= ptTeletext && Handle->used <= 1) ? DMX_OUT_DECODER : DMX_OUT_TS_TAP;
+#ifdef NEWSTRUCT
+ pesFilterParams.pes_type= PesTypes[Type < ptOther ? Type : ptOther];
+#else
pesFilterParams.pesType = PesTypes[Type < ptOther ? Type : ptOther];
+#endif
pesFilterParams.flags = DMX_IMMEDIATE_START;
if (ioctl(Handle->handle, DMX_SET_PES_FILTER, &pesFilterParams) < 0) {
LOG_ERROR;
@@ -335,7 +353,11 @@ bool cDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On)
pesFilterParams.pid = 0x1FFF;
pesFilterParams.input = DMX_IN_FRONTEND;
pesFilterParams.output = DMX_OUT_DECODER;
+#ifdef NEWSTRUCT
+ pesFilterParams.pes_type= PesTypes[Type];
+#else
pesFilterParams.pesType = PesTypes[Type];
+#endif
pesFilterParams.flags = DMX_IMMEDIATE_START;
CHECK(ioctl(Handle->handle, DMX_SET_PES_FILTER, &pesFilterParams));
close(Handle->handle);
@@ -584,9 +606,9 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
#ifdef NEWSTRUCT
Frontend.frequency = frequency * 1000UL;
- Frontend.inversion = SpectralInversion(Channel->Inversion());
+ Frontend.inversion = fe_spectral_inversion_t(Channel->Inversion());
Frontend.u.qpsk.symbol_rate = Channel->Srate() * 1000UL;
- Frontend.u.qpsk.fec_inner = CodeRate(Channel->CoderateH());
+ Frontend.u.qpsk.fec_inner = fe_code_rate_t(Channel->CoderateH());
#else
Frontend.Frequency = frequency * 1000UL;
Frontend.Inversion = SpectralInversion(Channel->Inversion());
@@ -601,10 +623,10 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
#ifdef NEWSTRUCT
Frontend.frequency = Channel->Frequency() * 1000000UL;
- Frontend.inversion = SpectralInversion(Channel->Inversion());
+ Frontend.inversion = fe_spectral_inversion_t(Channel->Inversion());
Frontend.u.qam.symbol_rate = Channel->Srate() * 1000UL;
- Frontend.u.qam.fec_inner = CodeRate(Channel->CoderateH());
- Frontend.u.qam.modulation = Modulation(Channel->Modulation());
+ Frontend.u.qam.fec_inner = fe_code_rate_t(Channel->CoderateH());
+ Frontend.u.qam.modulation = fe_modulation_t(Channel->Modulation());
#else
Frontend.Frequency = Channel->Frequency() * 1000000UL;
Frontend.Inversion = SpectralInversion(Channel->Inversion());
@@ -620,14 +642,14 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
#ifdef NEWSTRUCT
Frontend.frequency = Channel->Frequency() * 1000UL;
- Frontend.inversion = SpectralInversion(Channel->Inversion());
- Frontend.u.ofdm.bandwidth = BandWidth(Channel->Bandwidth());
- Frontend.u.ofdm.code_rate_HP = CodeRate(Channel->CoderateH());
- Frontend.u.ofdm.code_rate_LP = CodeRate(Channel->CoderateL());
- Frontend.u.ofdm.constellation = Modulation(Channel->Modulation());
- Frontend.u.ofdm.transmission_mode = TransmitMode(Channel->Transmission());
- Frontend.u.ofdm.guard_interval = GuardInterval(Channel->Guard());
- Frontend.u.ofdm.hierarchy_information = Hierarchy(Channel->Hierarchy());
+ Frontend.inversion = fe_spectral_inversion_t(Channel->Inversion());
+ Frontend.u.ofdm.bandwidth = fe_bandwidth_t(Channel->Bandwidth());
+ Frontend.u.ofdm.code_rate_HP = fe_code_rate_t(Channel->CoderateH());
+ Frontend.u.ofdm.code_rate_LP = fe_code_rate_t(Channel->CoderateL());
+ Frontend.u.ofdm.constellation = fe_modulation_t(Channel->Modulation());
+ Frontend.u.ofdm.transmission_mode = fe_transmit_mode_t(Channel->Transmission());
+ Frontend.u.ofdm.guard_interval = fe_guard_interval_t(Channel->Guard());
+ Frontend.u.ofdm.hierarchy_information = fe_hierarchy_t(Channel->Hierarchy());
#else
Frontend.Frequency = Channel->Frequency() * 1000UL;
Frontend.Inversion = SpectralInversion(Channel->Inversion());
@@ -663,7 +685,7 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
// Wait for channel lock:
#ifdef NEWSTRUCT
- FrontendStatus status = FrontendStatus(0);
+ fe_status_t status = fe_status_t(0);
for (int i = 0; i < 100; i++) {
CHECK(ioctl(fd_frontend, FE_READ_STATUS, &status));
if (status & FE_HAS_LOCK)
@@ -702,6 +724,8 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
// PID settings:
if (TurnOnLivePIDs) {
+ aPid1 = Channel->Apid1();
+ aPid2 = Channel->Apid2();
if (!(AddPid(Channel->Apid1(), ptAudio) && AddPid(Channel->Vpid(), ptVideo))) {//XXX+ dolby dpid1!!! (if audio plugins are attached)
esyslog("ERROR: failed to set PIDs for channel %d on device %d", Channel->Number(), CardIndex() + 1);
return false;
@@ -726,12 +750,46 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
void cDvbDevice::SetVolumeDevice(int Volume)
{
if (HasDecoder()) {
+#ifdef NEWSTRUCT
+ audio_mixer_t am;
+#else
audioMixer_t am;
+#endif
am.volume_left = am.volume_right = Volume;
CHECK(ioctl(fd_audio, AUDIO_SET_MIXER, &am));
}
}
+int cDvbDevice::NumAudioTracksDevice(void) const
+{
+ int n = 0;
+ if (aPid1)
+ n++;
+ if (aPid2 && aPid1 != aPid2)
+ n++;
+ return n;
+}
+
+const char **cDvbDevice::GetAudioTracksDevice(int *CurrentTrack) const
+{
+ if (NumAudioTracks()) {
+ if (CurrentTrack)
+ *CurrentTrack = (pidHandles[ptAudio].pid == aPid1) ? 0 : 1;
+ static const char *audioTracks1[] = { "Audio 1", NULL };
+ static const char *audioTracks2[] = { "Audio 1", "Audio 2", NULL };
+ return NumAudioTracks() > 1 ? audioTracks2 : audioTracks1;
+ }
+ return NULL;
+}
+
+void cDvbDevice::SetAudioTrackDevice(int Index)
+{
+ if (0 <= Index && Index < NumAudioTracks()) {
+ DelPid(pidHandles[ptAudio].pid);
+ AddPid(Index ? aPid2 : aPid1, ptAudio);
+ }
+}
+
bool cDvbDevice::SetPlayMode(ePlayMode PlayMode)
{
if (PlayMode != pmExtern_THIS_SHOULD_BE_AVOIDED && fd_video < 0 && fd_audio < 0) {
@@ -916,7 +974,11 @@ bool cDvbDevice::GetTSPacket(uchar *&Data)
return true;
}
else if (FATALERRNO) {
+#ifdef NEWSTRUCT
+ if (errno == EOVERFLOW)
+#else
if (errno == EBUFFEROVERFLOW) // this error code is not defined in the library
+#endif
esyslog("ERROR: DVB driver buffer overflow on device %d", CardIndex() + 1);
else {
LOG_ERROR;