mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Now waiting at startup until all DVB devices are ready
This commit is contained in:
parent
ba3437f7cc
commit
6de23d7d96
6
HISTORY
6
HISTORY
@ -3700,8 +3700,12 @@ Video Disk Recorder Revision History
|
|||||||
- Removed the VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES stuff from
|
- Removed the VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES stuff from
|
||||||
cDvbDevice::StillPicture(), since apparently the VIDEO_STILLPICTURE call works.
|
cDvbDevice::StillPicture(), since apparently the VIDEO_STILLPICTURE call works.
|
||||||
|
|
||||||
2005-08-20: Version 1.3.30
|
2005-08-21: Version 1.3.30
|
||||||
|
|
||||||
- Improved responsiveness inside CAM menus.
|
- Improved responsiveness inside CAM menus.
|
||||||
- Added handling of the 'Close MMI' tag to avoid error log messages with CAMs
|
- Added handling of the 'Close MMI' tag to avoid error log messages with CAMs
|
||||||
that actually use it.
|
that actually use it.
|
||||||
|
- Now waiting at startup until all DVB devices are ready. This includes having
|
||||||
|
all CAMs initialized and ready to decrypt, so that no more "channel not
|
||||||
|
available" happens if VDR is started with the current channel being an encrypted
|
||||||
|
one, or a timer on such a channel hits right after starting VDR.
|
||||||
|
18
ci.c
18
ci.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: ci.c 1.25 2005/08/20 12:16:23 kls Exp $
|
* $Id: ci.c 1.26 2005/08/20 15:27:35 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ci.h"
|
#include "ci.h"
|
||||||
@ -1354,6 +1354,8 @@ cCiHandler::cCiHandler(int Fd, int NumSlots)
|
|||||||
hasUserIO = false;
|
hasUserIO = false;
|
||||||
for (int i = 0; i < MAX_CI_SESSION; i++)
|
for (int i = 0; i < MAX_CI_SESSION; i++)
|
||||||
sessions[i] = NULL;
|
sessions[i] = NULL;
|
||||||
|
for (int i = 0; i < MAX_CI_SLOT; i++)
|
||||||
|
moduleReady[i] = false;
|
||||||
tpl = new cCiTransportLayer(Fd, numSlots);
|
tpl = new cCiTransportLayer(Fd, numSlots);
|
||||||
tc = NULL;
|
tc = NULL;
|
||||||
}
|
}
|
||||||
@ -1506,6 +1508,19 @@ int cCiHandler::CloseAllSessions(int Slot)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cCiHandler::Ready(void)
|
||||||
|
{
|
||||||
|
cMutexLock MutexLock(&mutex);
|
||||||
|
for (int Slot = 0; Slot < numSlots; Slot++) {
|
||||||
|
if (moduleReady[Slot]) {
|
||||||
|
cCiConditionalAccessSupport *cas = (cCiConditionalAccessSupport *)GetSessionByResourceId(RI_CONDITIONAL_ACCESS_SUPPORT, Slot);
|
||||||
|
if (!cas || !*cas->GetCaSystemIds())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool cCiHandler::Process(void)
|
bool cCiHandler::Process(void)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
@ -1543,6 +1558,7 @@ bool cCiHandler::Process(void)
|
|||||||
}
|
}
|
||||||
else if (tpl->ModuleReady(Slot)) {
|
else if (tpl->ModuleReady(Slot)) {
|
||||||
dbgprotocol("Module ready in slot %d\n", Slot);
|
dbgprotocol("Module ready in slot %d\n", Slot);
|
||||||
|
moduleReady[Slot] = true;
|
||||||
tpl->NewConnection(Slot);
|
tpl->NewConnection(Slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
ci.h
5
ci.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: ci.h 1.13 2004/02/08 14:36:23 kls Exp $
|
* $Id: ci.h 1.14 2005/08/20 14:56:11 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CI_H
|
#ifndef __CI_H
|
||||||
@ -77,6 +77,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_CI_SESSION 16 //XXX
|
#define MAX_CI_SESSION 16 //XXX
|
||||||
|
#define MAX_CI_SLOT 16
|
||||||
|
|
||||||
class cCiSession;
|
class cCiSession;
|
||||||
class cCiTransportLayer;
|
class cCiTransportLayer;
|
||||||
@ -89,6 +90,7 @@ private:
|
|||||||
int numSlots;
|
int numSlots;
|
||||||
bool newCaSupport;
|
bool newCaSupport;
|
||||||
bool hasUserIO;
|
bool hasUserIO;
|
||||||
|
bool moduleReady[MAX_CI_SLOT];
|
||||||
cCiSession *sessions[MAX_CI_SESSION];
|
cCiSession *sessions[MAX_CI_SESSION];
|
||||||
cCiTransportLayer *tpl;
|
cCiTransportLayer *tpl;
|
||||||
cCiTransportConnection *tc;
|
cCiTransportConnection *tc;
|
||||||
@ -105,6 +107,7 @@ public:
|
|||||||
~cCiHandler();
|
~cCiHandler();
|
||||||
static cCiHandler *CreateCiHandler(const char *FileName);
|
static cCiHandler *CreateCiHandler(const char *FileName);
|
||||||
int NumSlots(void) { return numSlots; }
|
int NumSlots(void) { return numSlots; }
|
||||||
|
bool Ready(void);
|
||||||
bool Process(void);
|
bool Process(void);
|
||||||
bool HasUserIO(void) { return hasUserIO; }
|
bool HasUserIO(void) { return hasUserIO; }
|
||||||
bool EnterMenu(int Slot);
|
bool EnterMenu(int Slot);
|
||||||
|
21
device.c
21
device.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: device.c 1.105 2005/08/14 10:52:08 kls Exp $
|
* $Id: device.c 1.106 2005/08/21 08:56:49 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
@ -195,6 +195,20 @@ cDevice::~cDevice()
|
|||||||
delete pesAssembler;
|
delete pesAssembler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cDevice::WaitForAllDevicesReady(int Timeout)
|
||||||
|
{
|
||||||
|
for (time_t t0 = time(NULL); time(NULL) - t0 < Timeout; ) {
|
||||||
|
bool ready = true;
|
||||||
|
for (int i = 0; i < numDevices; i++) {
|
||||||
|
if (device[i] && !device[i]->Ready())
|
||||||
|
ready = false;
|
||||||
|
}
|
||||||
|
if (ready)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void cDevice::SetUseDevice(int n)
|
void cDevice::SetUseDevice(int n)
|
||||||
{
|
{
|
||||||
if (n < MAXDEVICES)
|
if (n < MAXDEVICES)
|
||||||
@ -1103,6 +1117,11 @@ int cDevice::CanShift(int Ca, int Priority, int UsedCards) const
|
|||||||
XXX*/
|
XXX*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cDevice::Ready(void)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int cDevice::ProvidesCa(const cChannel *Channel) const
|
int cDevice::ProvidesCa(const cChannel *Channel) const
|
||||||
{
|
{
|
||||||
int Ca = Channel->Ca();
|
int Ca = Channel->Ca();
|
||||||
|
13
device.h
13
device.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: device.h 1.61 2005/08/13 11:44:13 kls Exp $
|
* $Id: device.h 1.62 2005/08/21 08:52:20 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DEVICE_H
|
#ifndef __DEVICE_H
|
||||||
@ -102,6 +102,12 @@ private:
|
|||||||
public:
|
public:
|
||||||
static int NumDevices(void) { return numDevices; }
|
static int NumDevices(void) { return numDevices; }
|
||||||
///< Returns the total number of devices.
|
///< Returns the total number of devices.
|
||||||
|
static bool WaitForAllDevicesReady(int Timeout = 0);
|
||||||
|
///< Waits until all devices have become ready, or the given Timeout
|
||||||
|
///< (seconds) has expired. While waiting, the Ready() function of each
|
||||||
|
///< device is called in turn, until they all return true.
|
||||||
|
///< \return True if all devices have become ready within the given
|
||||||
|
///< timeout.
|
||||||
static void SetUseDevice(int n);
|
static void SetUseDevice(int n);
|
||||||
///< Sets the 'useDevice' flag of the given device.
|
///< Sets the 'useDevice' flag of the given device.
|
||||||
///< If this function is not called before initializing, all devices
|
///< If this function is not called before initializing, all devices
|
||||||
@ -136,6 +142,11 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
cDevice(void);
|
cDevice(void);
|
||||||
virtual ~cDevice();
|
virtual ~cDevice();
|
||||||
|
virtual bool Ready(void);
|
||||||
|
///< Returns true if this device is ready. Devices with conditional
|
||||||
|
///< access hardware may need some time until they are up and running.
|
||||||
|
///< This function is called in a loop at startup until all devices
|
||||||
|
///< are ready (see WaitForAllDevicesReady()).
|
||||||
static int NextCardIndex(int n = 0);
|
static int NextCardIndex(int n = 0);
|
||||||
///< Calculates the next card index.
|
///< Calculates the next card index.
|
||||||
///< Each device in a given machine must have a unique card index, which
|
///< Each device in a given machine must have a unique card index, which
|
||||||
|
11
dvbdevice.c
11
dvbdevice.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: dvbdevice.c 1.134 2005/08/15 14:05:23 kls Exp $
|
* $Id: dvbdevice.c 1.135 2005/08/20 15:22:36 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dvbdevice.h"
|
#include "dvbdevice.h"
|
||||||
@ -478,6 +478,15 @@ bool cDvbDevice::HasDecoder(void) const
|
|||||||
return fd_video >= 0 && fd_audio >= 0;
|
return fd_video >= 0 && fd_audio >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cDvbDevice::Ready(void)
|
||||||
|
{
|
||||||
|
if (ciHandler) {
|
||||||
|
ciHandler->Process();
|
||||||
|
return ciHandler->Ready();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int cDvbDevice::ProvidesCa(const cChannel *Channel) const
|
int cDvbDevice::ProvidesCa(const cChannel *Channel) const
|
||||||
{
|
{
|
||||||
if (Channel->Ca() >= 0x0100 && ciHandler) {
|
if (Channel->Ca() >= 0x0100 && ciHandler) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: dvbdevice.h 1.34 2005/02/20 11:17:07 kls Exp $
|
* $Id: dvbdevice.h 1.35 2005/08/20 15:20:15 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DVBDEVICE_H
|
#ifndef __DVBDEVICE_H
|
||||||
@ -42,6 +42,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
cDvbDevice(int n);
|
cDvbDevice(int n);
|
||||||
virtual ~cDvbDevice();
|
virtual ~cDvbDevice();
|
||||||
|
virtual bool Ready(void);
|
||||||
virtual int ProvidesCa(const cChannel *Channel) const;
|
virtual int ProvidesCa(const cChannel *Channel) const;
|
||||||
virtual bool HasDecoder(void) const;
|
virtual bool HasDecoder(void) const;
|
||||||
|
|
||||||
|
5
vdr.c
5
vdr.c
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
* The project's page is at http://www.cadsoft.de/vdr
|
* The project's page is at http://www.cadsoft.de/vdr
|
||||||
*
|
*
|
||||||
* $Id: vdr.c 1.210 2005/08/20 11:24:42 kls Exp $
|
* $Id: vdr.c 1.211 2005/08/21 08:47:06 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -65,6 +65,7 @@
|
|||||||
#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications
|
#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications
|
||||||
#define LASTCAMMENUTIMEOUT 3 // seconds to run the main loop 'fast' after a CAM menu has been closed
|
#define LASTCAMMENUTIMEOUT 3 // seconds to run the main loop 'fast' after a CAM menu has been closed
|
||||||
// in order to react on a possible new CAM menu as soon as possible
|
// in order to react on a possible new CAM menu as soon as possible
|
||||||
|
#define DEVICEREADYTIMEOUT 30 // seconds to wait until all devices are ready
|
||||||
|
|
||||||
#define EXIT(v) { ExitCode = (v); goto Exit; }
|
#define EXIT(v) { ExitCode = (v); goto Exit; }
|
||||||
|
|
||||||
@ -520,6 +521,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Channel:
|
// Channel:
|
||||||
|
|
||||||
|
if (!cDevice::WaitForAllDevicesReady(DEVICEREADYTIMEOUT))
|
||||||
|
dsyslog("not all devices ready after %d seconds", DEVICEREADYTIMEOUT);
|
||||||
Channels.SwitchTo(Setup.CurrentChannel);
|
Channels.SwitchTo(Setup.CurrentChannel);
|
||||||
if (MuteAudio)
|
if (MuteAudio)
|
||||||
cDevice::PrimaryDevice()->ToggleMute();
|
cDevice::PrimaryDevice()->ToggleMute();
|
||||||
|
Loading…
Reference in New Issue
Block a user