mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Accessing Schedules data directly via cSIProcessor
This commit is contained in:
parent
645f62fee4
commit
db7f6ee619
9
dvbapi.c
9
dvbapi.c
@ -7,7 +7,7 @@
|
|||||||
* DVD support initially written by Andreas Schultz <aschultz@warp10.net>
|
* DVD support initially written by Andreas Schultz <aschultz@warp10.net>
|
||||||
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si>
|
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si>
|
||||||
*
|
*
|
||||||
* $Id: dvbapi.c 1.149 2002/02/23 10:40:55 kls Exp $
|
* $Id: dvbapi.c 1.150 2002/02/23 13:11:13 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define DVDDEBUG 1
|
//#define DVDDEBUG 1
|
||||||
@ -2732,13 +2732,6 @@ void cDvbApi::Cleanup(void)
|
|||||||
PrimaryDvbApi = NULL;
|
PrimaryDvbApi = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cSchedules *cDvbApi::Schedules(cThreadLock *ThreadLock) const
|
|
||||||
{
|
|
||||||
if (siProcessor && ThreadLock->Lock(siProcessor))
|
|
||||||
return siProcessor->Schedules();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cDvbApi::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX, int SizeY)
|
bool cDvbApi::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX, int SizeY)
|
||||||
{
|
{
|
||||||
int videoDev = OstOpen(DEV_VIDEO, CardIndex(), O_RDWR, true);
|
int videoDev = OstOpen(DEV_VIDEO, CardIndex(), O_RDWR, true);
|
||||||
|
6
dvbapi.h
6
dvbapi.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: dvbapi.h 1.61 2002/02/03 16:43:38 kls Exp $
|
* $Id: dvbapi.h 1.62 2002/02/23 13:11:07 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DVBAPI_H
|
#ifndef __DVBAPI_H
|
||||||
@ -143,10 +143,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
cSIProcessor *siProcessor;
|
cSIProcessor *siProcessor;
|
||||||
public:
|
public:
|
||||||
const cSchedules *Schedules(cThreadLock *ThreadLock) const;
|
|
||||||
// Caller must provide a cThreadLock which has to survive the entire
|
|
||||||
// time the returned cSchedules is accessed. Once the cSchedules is no
|
|
||||||
// longer used, the cThreadLock must be destroyed.
|
|
||||||
void SetUseTSTime(bool On) { if (siProcessor) siProcessor->SetUseTSTime(On); }
|
void SetUseTSTime(bool On) { if (siProcessor) siProcessor->SetUseTSTime(On); }
|
||||||
|
|
||||||
// Image Grab facilities
|
// Image Grab facilities
|
||||||
|
9
eit.c
9
eit.c
@ -16,7 +16,7 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* $Id: eit.c 1.35 2002/02/15 13:58:26 kls Exp $
|
* $Id: eit.c 1.36 2002/02/23 13:53:53 kls Exp $
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "eit.h"
|
#include "eit.h"
|
||||||
@ -913,6 +913,13 @@ cSIProcessor::~cSIProcessor()
|
|||||||
delete fileName;
|
delete fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cSchedules *cSIProcessor::Schedules(cMutexLock &MutexLock)
|
||||||
|
{
|
||||||
|
if (MutexLock.Lock(&schedulesMutex))
|
||||||
|
return schedules;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void cSIProcessor::SetEpgDataFileName(const char *FileName)
|
void cSIProcessor::SetEpgDataFileName(const char *FileName)
|
||||||
{
|
{
|
||||||
epgDataFileName = NULL;
|
epgDataFileName = NULL;
|
||||||
|
7
eit.h
7
eit.h
@ -16,7 +16,7 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* $Id: eit.h 1.13 2002/01/13 16:18:23 kls Exp $
|
* $Id: eit.h 1.14 2002/02/23 13:51:31 kls Exp $
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef __EIT_H
|
#ifndef __EIT_H
|
||||||
@ -146,10 +146,13 @@ public:
|
|||||||
~cSIProcessor();
|
~cSIProcessor();
|
||||||
static void SetEpgDataFileName(const char *FileName);
|
static void SetEpgDataFileName(const char *FileName);
|
||||||
static const char *GetEpgDataFileName(void);
|
static const char *GetEpgDataFileName(void);
|
||||||
|
static const cSchedules *Schedules(cMutexLock &MutexLock);
|
||||||
|
// Caller must provide a cMutexLock which has to survive the entire
|
||||||
|
// time the returned cSchedules is accessed. Once the cSchedules is no
|
||||||
|
// longer used, the cMutexLock must be destroyed.
|
||||||
void SetStatus(bool On);
|
void SetStatus(bool On);
|
||||||
bool SetUseTSTime(bool use);
|
bool SetUseTSTime(bool use);
|
||||||
bool SetCurrentServiceID(unsigned short servid);
|
bool SetCurrentServiceID(unsigned short servid);
|
||||||
const cSchedules *Schedules(void) { return schedules; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
14
menu.c
14
menu.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: menu.c 1.156 2002/02/23 09:33:04 kls Exp $
|
* $Id: menu.c 1.157 2002/02/23 13:55:23 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@ -1429,7 +1429,7 @@ cMenuScheduleItem::cMenuScheduleItem(const cEventInfo *EventInfo)
|
|||||||
|
|
||||||
class cMenuSchedule : public cOsdMenu {
|
class cMenuSchedule : public cOsdMenu {
|
||||||
private:
|
private:
|
||||||
cThreadLock threadLock;
|
cMutexLock mutexLock;
|
||||||
const cSchedules *schedules;
|
const cSchedules *schedules;
|
||||||
bool now, next;
|
bool now, next;
|
||||||
int otherChannel;
|
int otherChannel;
|
||||||
@ -1449,7 +1449,7 @@ cMenuSchedule::cMenuSchedule(void)
|
|||||||
cChannel *channel = Channels.GetByNumber(cDvbApi::CurrentChannel());
|
cChannel *channel = Channels.GetByNumber(cDvbApi::CurrentChannel());
|
||||||
if (channel) {
|
if (channel) {
|
||||||
cMenuWhatsOn::SetCurrentChannel(channel->number);
|
cMenuWhatsOn::SetCurrentChannel(channel->number);
|
||||||
schedules = cDvbApi::PrimaryDvbApi->Schedules(&threadLock);
|
schedules = cSIProcessor::Schedules(mutexLock);
|
||||||
PrepareSchedule(channel);
|
PrepareSchedule(channel);
|
||||||
SetHelp(tr("Record"), tr("Now"), tr("Next"));
|
SetHelp(tr("Record"), tr("Now"), tr("Next"));
|
||||||
}
|
}
|
||||||
@ -2262,8 +2262,8 @@ void cDisplayChannel::DisplayInfo(void)
|
|||||||
{
|
{
|
||||||
if (withInfo) {
|
if (withInfo) {
|
||||||
const cEventInfo *Present = NULL, *Following = NULL;
|
const cEventInfo *Present = NULL, *Following = NULL;
|
||||||
cThreadLock ThreadLock;
|
cMutexLock MutexLock;
|
||||||
const cSchedules *Schedules = cDvbApi::PrimaryDvbApi->Schedules(&ThreadLock);
|
const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock);
|
||||||
if (Schedules) {
|
if (Schedules) {
|
||||||
const cSchedule *Schedule = Schedules->GetSchedule();
|
const cSchedule *Schedule = Schedules->GetSchedule();
|
||||||
if (Schedule) {
|
if (Schedule) {
|
||||||
@ -2445,8 +2445,8 @@ bool cRecordControl::GetEventInfo(void)
|
|||||||
time_t Time = timer->active == taActInst ? timer->StartTime() + INSTANT_REC_EPG_LOOKAHEAD : timer->StartTime() + (timer->StopTime() - timer->StartTime()) / 2;
|
time_t Time = timer->active == taActInst ? timer->StartTime() + INSTANT_REC_EPG_LOOKAHEAD : timer->StartTime() + (timer->StopTime() - timer->StartTime()) / 2;
|
||||||
for (int seconds = 0; seconds <= MAXWAIT4EPGINFO; seconds++) {
|
for (int seconds = 0; seconds <= MAXWAIT4EPGINFO; seconds++) {
|
||||||
{
|
{
|
||||||
cThreadLock ThreadLock;
|
cMutexLock MutexLock;
|
||||||
const cSchedules *Schedules = dvbApi->Schedules(&ThreadLock);
|
const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock);
|
||||||
if (Schedules) {
|
if (Schedules) {
|
||||||
const cSchedule *Schedule = Schedules->GetSchedule(channel->pnr);
|
const cSchedule *Schedule = Schedules->GetSchedule(channel->pnr);
|
||||||
if (Schedule) {
|
if (Schedule) {
|
||||||
|
6
svdrp.c
6
svdrp.c
@ -10,7 +10,7 @@
|
|||||||
* and interact with the Video Disk Recorder - or write a full featured
|
* and interact with the Video Disk Recorder - or write a full featured
|
||||||
* graphical interface that sits on top of an SVDRP connection.
|
* graphical interface that sits on top of an SVDRP connection.
|
||||||
*
|
*
|
||||||
* $Id: svdrp.c 1.30 2002/02/02 15:59:18 kls Exp $
|
* $Id: svdrp.c 1.31 2002/02/23 13:55:57 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "svdrp.h"
|
#include "svdrp.h"
|
||||||
@ -600,8 +600,8 @@ void cSVDRP::CmdLSTC(const char *Option)
|
|||||||
|
|
||||||
void cSVDRP::CmdLSTE(const char *Option)
|
void cSVDRP::CmdLSTE(const char *Option)
|
||||||
{
|
{
|
||||||
cThreadLock ThreadLock;
|
cMutexLock MutexLock;
|
||||||
const cSchedules *Schedules = cDvbApi::PrimaryDvbApi->Schedules(&ThreadLock);
|
const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock);
|
||||||
if (Schedules) {
|
if (Schedules) {
|
||||||
FILE *f = fdopen(file, "w");
|
FILE *f = fdopen(file, "w");
|
||||||
if (f) {
|
if (f) {
|
||||||
|
28
thread.c
28
thread.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: thread.c 1.17 2002/02/17 14:47:28 kls Exp $
|
* $Id: thread.c 1.18 2002/02/23 13:49:06 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
@ -190,6 +190,32 @@ bool cThread::EmergencyExit(bool Request)
|
|||||||
return emergencyExitRequested = true; // yes, it's an assignment, not a comparison!
|
return emergencyExitRequested = true; // yes, it's an assignment, not a comparison!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- cMutexLock ------------------------------------------------------------
|
||||||
|
|
||||||
|
cMutexLock::cMutexLock(cMutex *Mutex)
|
||||||
|
{
|
||||||
|
mutex = NULL;
|
||||||
|
locked = false;
|
||||||
|
Lock(Mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
cMutexLock::~cMutexLock()
|
||||||
|
{
|
||||||
|
if (mutex && locked)
|
||||||
|
mutex->Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cMutexLock::Lock(cMutex *Mutex)
|
||||||
|
{
|
||||||
|
if (Mutex && !mutex) {
|
||||||
|
mutex = Mutex;
|
||||||
|
Mutex->Lock();
|
||||||
|
locked = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// --- cThreadLock -----------------------------------------------------------
|
// --- cThreadLock -----------------------------------------------------------
|
||||||
|
|
||||||
cThreadLock::cThreadLock(cThread *Thread)
|
cThreadLock::cThreadLock(cThread *Thread)
|
||||||
|
18
thread.h
18
thread.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: thread.h 1.11 2001/10/27 13:22:20 kls Exp $
|
* $Id: thread.h 1.12 2002/02/23 13:53:38 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __THREAD_H
|
#ifndef __THREAD_H
|
||||||
@ -69,6 +69,22 @@ public:
|
|||||||
static bool EmergencyExit(bool Request = false);
|
static bool EmergencyExit(bool Request = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// cMutexLock can be used to easily set a lock on mutex and make absolutely
|
||||||
|
// sure that it will be unlocked when the block will be left. Several locks can
|
||||||
|
// be stacked, so a function that makes many calls to another function which uses
|
||||||
|
// cMutexLock may itself use a cMutexLock to make one longer lock instead of many
|
||||||
|
// short ones.
|
||||||
|
|
||||||
|
class cMutexLock {
|
||||||
|
private:
|
||||||
|
cMutex *mutex;
|
||||||
|
bool locked;
|
||||||
|
public:
|
||||||
|
cMutexLock(cMutex *Mutex = NULL);
|
||||||
|
~cMutexLock();
|
||||||
|
bool Lock(cMutex *Mutex);
|
||||||
|
};
|
||||||
|
|
||||||
// cThreadLock can be used to easily set a lock in a thread and make absolutely
|
// cThreadLock can be used to easily set a lock in a thread and make absolutely
|
||||||
// sure that it will be unlocked when the block will be left. Several locks can
|
// sure that it will be unlocked when the block will be left. Several locks can
|
||||||
// be stacked, so a function that makes many calls to another function which uses
|
// be stacked, so a function that makes many calls to another function which uses
|
||||||
|
Loading…
x
Reference in New Issue
Block a user