summaryrefslogtreecommitdiff
path: root/dvbapi.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-03-17 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-03-17 18:00:00 +0100
commit217fcb26808f74c9de81b4c653757f75ba13852f (patch)
treeaf479bc0ed80611549280dcdc8ed324ace38b32e /dvbapi.c
parenta001a4bf97715d62b387d1da9fd1e48382508428 (diff)
downloadvdr-patch-lnbsharing-217fcb26808f74c9de81b4c653757f75ba13852f.tar.gz
vdr-patch-lnbsharing-217fcb26808f74c9de81b4c653757f75ba13852f.tar.bz2
Version 1.0.0pre4vdr-1.0.0pre4
- Added 'Ca' code 201 for 'Cryptoworks, GOD-DIGITAL' to 'ca.conf' (thanks to Bernd Schweikert). - Fixed avoiding the primary DVB interface in case Setup.PrimaryLimit is 0. - Fixed handling CICAM settings if the first one of a DVB card was FTA. - Fixed reacting on changes in CICAM settings (needed to restart VDR before). - The "Blue" button in the "Main" menu now works as "Stop" button if a recording is currently being replayed. - New command line option '-m' to mute audio of the primary DVB device at startup (suggested by Mirko Günther). - The new SVDRP command VOLU can be used to control the audio volume (suggested by Mirko Günther). - Fixed resetting 'mute' state when setting the volume to a non-zero value. - Added log messages when deleting recordings in case the disk runs full while recording. - Fixed closing a pipe (used for replaying Dolby Digital audio), which sometimes left 'zombie' processes behind (thanks to Werner Fink for helping to debug this one). - Now starting the Dolby Digital output thread only if the recording actually contains Dolby Digital audio data (thanks to Werner Fink). - Implemented OSD for Volume and Mute (works only if there is no other OSD activity, but this should be no problem for normal use). - Changed the MANUAL description of the "Conditional Access" setup parameters to reflect the actual "CICAM DVBn m" notation in the "Setup" menu. - The new Setup parameter "Use time from transponder" can be used to define which transponder shall be used to set the system time (see MANUAL for details). If you have been using the SetSystemTime option previously, you now MUST select a channel that you trust to have a reliable time base. - Grouped the Setup parameters into several sub-menus, so that each group of parameters fits on a single screen - unless the height of the OSD has been set to a small value (based on code from Markus Lang). - Changed the title of the "Main" menu to "VDR". - Fixed displaying a system message while the replay mode is being shown. - Physically removing a deleted recording if one with the same name shall be deleted again. - The "Left" and "Right" keys are now used to page up and down in text displays (like the EPG descriptions or the results of commands executed from the "Commands" menu). - Fixed high CPU usage in transfer mode. - Replaced 'killproc' with 'killall' in 'runvdr', since apparently 'killproc' is not available by default on some Linux distributions, whereas 'killall' is. Please check if your system provides 'killall' - if it doesn't, please change this back in 'runvdr' and report this (thanks to Achim Lange). - The "Commands" menu now automatically assigns number keys as hotkeys to the commands. If you have preceeded your commands with digits you may want to remove these from your 'commands.conf' file. - The new Setup item "Restart" can be used to force a complete restart of VDR, including reloading the driver. Note that this can only work if VDR and the driver are wrapped into a mechanism that actually performs this action if VDR exits. The 'runvdr' script can be used for this purpose. - Refined texts of the "Setup" menu.
Diffstat (limited to 'dvbapi.c')
-rw-r--r--dvbapi.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/dvbapi.c b/dvbapi.c
index 2f1ca14..1ade142 100644
--- a/dvbapi.c
+++ b/dvbapi.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbapi.c 1.154 2002/03/03 15:43:24 kls Exp $
+ * $Id: dvbapi.c 1.163 2002/03/16 14:20:47 kls Exp $
*/
#include "dvbapi.h"
@@ -63,6 +63,9 @@ extern "C" {
// The maximum time to wait before giving up while catching up on an index file:
#define MAXINDEXCATCHUP 2 // seconds
+// The default priority for non-primary DVB cards:
+#define DEFAULTPRIORITY -2
+
#define CHECK(s) { if ((s) < 0) LOG_ERROR; } // used for 'ioctl()' calls
#define FATALERRNO (errno != EAGAIN && errno != EINTR)
@@ -743,10 +746,6 @@ cPlayBuffer::cPlayBuffer(cDvbApi *DvbApi, int VideoDev, int AudioDev)
canToggleAudioTrack = false;
skipAC3bytes = false;
audioTrack = 0xC0;
- if (cDvbApi::AudioCommand()) {
- if (!dolbyDev.Open(cDvbApi::AudioCommand(), "w"))
- esyslog(LOG_ERR, "ERROR: can't open pipe to audio command '%s'", cDvbApi::AudioCommand());
- }
}
cPlayBuffer::~cPlayBuffer()
@@ -755,7 +754,11 @@ cPlayBuffer::~cPlayBuffer()
void cPlayBuffer::PlayExternalDolby(const uchar *b, int MaxLength)
{
- if (dolbyDev) {
+ if (cDvbApi::AudioCommand()) {
+ if (!dolbyDev && !dolbyDev.Open(cDvbApi::AudioCommand(), "w")) {
+ esyslog(LOG_ERR, "ERROR: can't open pipe to audio command '%s'", cDvbApi::AudioCommand());
+ return;
+ }
if (b[0] == 0x00 && b[1] == 0x00 && b[2] == 0x01) {
if (b[3] == 0xBD) { // dolby
int l = b[4] * 256 + b[5] + 6;
@@ -1147,7 +1150,7 @@ void cReplayBuffer::StripAudioPackets(uchar *b, int Length, uchar Except)
int l = b[i + 4] * 256 + b[i + 5] + 6;
switch (c) {
case 0xBD: // dolby
- if (Except && dolbyDev)
+ if (Except)
PlayExternalDolby(&b[i], Length - i);
// continue with deleting the data - otherwise it disturbs DVB replay
case 0xC0 ... 0xC1: // audio
@@ -1408,7 +1411,7 @@ void cTransferBuffer::Output(void)
int r = Get(b, sizeof(b));
if (r > 0) {
uchar *p = b;
- while (r > 0 && Busy()) {
+ while (r > 0 && Busy() && cFile::FileReadyForWriting(toDevice, 100)) {
int w = write(toDevice, p, r);
if (w > 0) {
p += w;
@@ -1685,9 +1688,8 @@ cDvbApi::cDvbApi(int n)
transferBuffer = NULL;
transferringFromDvbApi = NULL;
ca = -1;
- priority = -1;
+ priority = DEFAULTPRIORITY;
cardIndex = n;
- SetCaCaps();
// Devices that are only present on DVB-C or DVB-S cards:
@@ -1721,8 +1723,6 @@ cDvbApi::cDvbApi(int n)
if (fd_frontend >= 0 && fd_demuxv >= 0 && fd_demuxa1 >= 0 && fd_demuxa2 >= 0 && fd_demuxd1 >= 0 && fd_demuxd2 >= 0 && fd_demuxt >= 0) {
siProcessor = new cSIProcessor(OstName(DEV_OST_DEMUX, n));
- if (!dvbApi[0]) // only the first one shall set the system time
- siProcessor->SetUseTSTime(Setup.SetSystemTime);
FrontendInfo feinfo;
CHECK(ioctl(fd_frontend, FE_GET_INFO, &feinfo));
frontendType = feinfo.type;
@@ -1749,7 +1749,7 @@ cDvbApi::cDvbApi(int n)
#endif
currentChannel = 1;
mute = false;
- volume = MAXVOLUME;
+ volume = Setup.CurrentVolume;
}
cDvbApi::~cDvbApi()
@@ -1848,8 +1848,10 @@ cDvbApi *cDvbApi::GetDvbApi(int Ca, int Priority)
void cDvbApi::SetCaCaps(void)
{
- for (int i = 0; i < MAXCACAPS; i++)
- caCaps[i] = Setup.CaCaps[CardIndex()][i];
+ for (int d = 0; d < NumDvbApis; d++) {
+ for (int i = 0; i < MAXCACAPS; i++)
+ dvbApi[d]->caCaps[i] = Setup.CaCaps[dvbApi[d]->CardIndex()][i];
+ }
}
int cDvbApi::ProvidesCa(int Ca)
@@ -1867,8 +1869,6 @@ int cDvbApi::ProvidesCa(int Ca)
else
others++;
}
- else
- break;
}
return result ? result + others : 0;
}
@@ -1906,6 +1906,7 @@ bool cDvbApi::Init(void)
isyslog(LOG_INFO, "found %d video device%s", NumDvbApis, NumDvbApis > 1 ? "s" : "");
else
esyslog(LOG_ERR, "ERROR: no video device found, giving up!");
+ SetCaCaps();
return NumDvbApis > 0;
}
@@ -2321,6 +2322,11 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int Frequency, char Pol
CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
}
+ // Stop setting system time:
+
+ if (siProcessor)
+ siProcessor->SetCurrentTransponder(0);
+
// If this card can't receive this channel, we must not actually switch
// the channel here, because that would irritate the driver when we
// start replaying in Transfer Mode immediately after switching the channel:
@@ -2472,6 +2478,11 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int Frequency, char Pol
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, false));
}
+ // Start setting system time:
+
+ if (Result == scrOk && siProcessor)
+ siProcessor->SetCurrentTransponder(Frequency);
+
return Result;
}
@@ -2567,7 +2578,7 @@ void cDvbApi::StopRecord(void)
delete recordBuffer;
recordBuffer = NULL;
ca = -1;
- priority = -1;
+ priority = DEFAULTPRIORITY;
}
}
@@ -2699,12 +2710,13 @@ bool cDvbApi::ToggleAudioTrack(void)
return false;
}
-void cDvbApi::ToggleMute(void)
+bool cDvbApi::ToggleMute(void)
{
int OldVolume = volume;
mute = !mute;
SetVolume(0, mute);
volume = OldVolume;
+ return mute;
}
void cDvbApi::SetVolume(int Volume, bool Absolute)
@@ -2714,6 +2726,8 @@ void cDvbApi::SetVolume(int Volume, bool Absolute)
audioMixer_t am;
am.volume_left = am.volume_right = volume;
CHECK(ioctl(fd_audio, AUDIO_SET_MIXER, &am));
+ if (volume > 0)
+ mute = false;
}
}