1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Current channel is now device specific

This commit is contained in:
Klaus Schmidinger 2000-11-05 18:39:17 +01:00
parent ea0bd668c8
commit eefbcf5216
8 changed files with 37 additions and 32 deletions

View File

@ -269,3 +269,5 @@ Video Disk Recorder Revision History
2000-11-05: Version 0.68 2000-11-05: Version 0.68
- Date and time in the title of an event info page are now always right adjusted. - Date and time in the title of an event info page are now always right adjusted.
- The 'current channel' is now handled device specific (in case there is more
than one DVB card).

View File

@ -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: config.c 1.29 2000/11/01 15:52:00 kls Exp $ * $Id: config.c 1.30 2000/11/05 18:18:30 kls Exp $
*/ */
#include "config.h" #include "config.h"
@ -262,9 +262,8 @@ bool cChannel::Switch(cDvbApi *DvbApi)
DvbApi = cDvbApi::PrimaryDvbApi; DvbApi = cDvbApi::PrimaryDvbApi;
if (!DvbApi->Recording() && !groupSep) { if (!DvbApi->Recording() && !groupSep) {
isyslog(LOG_INFO, "switching to channel %d", number); isyslog(LOG_INFO, "switching to channel %d", number);
CurrentChannel = number;
for (int i = 3; i--;) { for (int i = 3; i--;) {
if (DvbApi->SetChannel(frequency, polarization, diseqc, srate, vpid, apid, ca, pnr)) if (DvbApi->SetChannel(number, frequency, polarization, diseqc, srate, vpid, apid, ca, pnr))
return true; return true;
esyslog(LOG_ERR, "retrying"); esyslog(LOG_ERR, "retrying");
} }
@ -284,7 +283,7 @@ cTimer::cTimer(bool Instant)
startTime = stopTime = 0; startTime = stopTime = 0;
recording = false; recording = false;
active = Instant; active = Instant;
cChannel *ch = Channels.GetByNumber(CurrentChannel); cChannel *ch = Channels.GetByNumber(cDvbApi::CurrentChannel());
channel = ch ? ch->number : 0; channel = ch ? ch->number : 0;
time_t t = time(NULL); time_t t = time(NULL);
struct tm *now = localtime(&t); struct tm *now = localtime(&t);
@ -545,7 +544,6 @@ cKeys Keys;
// -- cChannels -------------------------------------------------------------- // -- cChannels --------------------------------------------------------------
int CurrentChannel = 1;
int CurrentGroup = -1; int CurrentGroup = -1;
cChannels Channels; cChannels Channels;

View File

@ -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: config.h 1.29 2000/11/01 13:42:29 kls Exp $ * $Id: config.h 1.30 2000/11/05 13:17:03 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -217,7 +217,6 @@ public:
cTimer *GetTimer(cTimer *Timer); cTimer *GetTimer(cTimer *Timer);
}; };
extern int CurrentChannel;
extern int CurrentGroup; extern int CurrentGroup;
extern cChannels Channels; extern cChannels Channels;

View File

@ -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.c 1.35 2000/11/05 13:04:23 kls Exp $ * $Id: dvbapi.c 1.36 2000/11/05 18:30:58 kls Exp $
*/ */
#include "dvbapi.h" #include "dvbapi.h"
@ -1130,6 +1130,7 @@ cDvbApi::cDvbApi(const char *VideoFileName, const char *VbiFileName)
#endif #endif
lastProgress = lastTotal = -1; lastProgress = lastTotal = -1;
replayTitle = NULL; replayTitle = NULL;
currentChannel = 1;
} }
cDvbApi::~cDvbApi() cDvbApi::~cDvbApi()
@ -1698,7 +1699,7 @@ bool cDvbApi::ShowProgress(bool Initial)
return false; return false;
} }
bool cDvbApi::SetChannel(int FrequencyMHz, char Polarization, int Diseqc, int Srate, int Vpid, int Apid, int Ca, int Pnr) bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization, int Diseqc, int Srate, int Vpid, int Apid, int Ca, int Pnr)
{ {
if (videoDev >= 0) { if (videoDev >= 0) {
struct frontend front; struct frontend front;
@ -1723,6 +1724,7 @@ bool cDvbApi::SetChannel(int FrequencyMHz, char Polarization, int Diseqc, int Sr
if (front.sync & 0x1F == 0x1F) { if (front.sync & 0x1F == 0x1F) {
if (siProcessor) if (siProcessor)
siProcessor->SetCurrentServiceID(Pnr); siProcessor->SetCurrentServiceID(Pnr);
currentChannel = ChannelNumber;
return true; return true;
} }
esyslog(LOG_ERR, "ERROR: channel not sync'ed (front.sync=%X)!", front.sync); esyslog(LOG_ERR, "ERROR: channel not sync'ed (front.sync=%X)!", front.sync);

View File

@ -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.21 2000/11/05 12:40:07 kls Exp $ * $Id: dvbapi.h 1.22 2000/11/05 13:39:31 kls Exp $
*/ */
#ifndef __DVBAPI_H #ifndef __DVBAPI_H
@ -138,7 +138,11 @@ public:
// Channel facilities // Channel facilities
bool SetChannel(int FrequencyMHz, char Polarization, int Diseqc, int Srate, int Vpid, int Apid, int Ca, int Pnr); private:
int currentChannel;
public:
bool SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization, int Diseqc, int Srate, int Vpid, int Apid, int Ca, int Pnr);
static int CurrentChannel(void) { return PrimaryDvbApi ? PrimaryDvbApi->currentChannel : 0; }
// Record/Replay facilities // Record/Replay facilities

10
menu.c
View File

@ -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.41 2000/11/05 12:47:44 kls Exp $ * $Id: menu.c 1.42 2000/11/05 13:42:39 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -594,7 +594,7 @@ cMenuChannels::cMenuChannels(void)
//TODO //TODO
int i = 0; int i = 0;
cChannel *channel; cChannel *channel;
int curr = ((channel = Channels.GetByNumber(CurrentChannel)) != NULL) ? channel->Index() : -1; int curr = ((channel = Channels.GetByNumber(cDvbApi::CurrentChannel())) != NULL) ? channel->Index() : -1;
while ((channel = Channels.Get(i)) != NULL) { while ((channel = Channels.Get(i)) != NULL) {
Add(new cMenuChannelItem(i, channel), i == curr); Add(new cMenuChannelItem(i, channel), i == curr);
@ -1245,7 +1245,7 @@ cMenuSchedule::cMenuSchedule(void)
:cOsdMenu("Schedule", 6, 6) :cOsdMenu("Schedule", 6, 6)
{ {
now = next = false; now = next = false;
cChannel *channel = Channels.GetByNumber(CurrentChannel); cChannel *channel = Channels.GetByNumber(cDvbApi::CurrentChannel());
if (channel) { if (channel) {
char *buffer = NULL; char *buffer = NULL;
asprintf(&buffer, "Schedule - %s", channel->name); asprintf(&buffer, "Schedule - %s", channel->name);
@ -1547,7 +1547,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched, bool Group)
cDisplayChannel::cDisplayChannel(eKeys FirstKey) cDisplayChannel::cDisplayChannel(eKeys FirstKey)
:cOsdBase(true) :cOsdBase(true)
{ {
oldNumber = CurrentChannel; oldNumber = cDvbApi::CurrentChannel();
number = 0; number = 0;
lastTime = time_ms(); lastTime = time_ms();
Interface->Open(MenuColumns, 5); Interface->Open(MenuColumns, 5);
@ -1744,7 +1744,7 @@ cRecordControl *cRecordControls::RecordControls[MAXDVBAPI] = { NULL };
bool cRecordControls::Start(cTimer *Timer) bool cRecordControls::Start(cTimer *Timer)
{ {
int ch = Timer ? Timer->channel : CurrentChannel; int ch = Timer ? Timer->channel : cDvbApi::CurrentChannel();
cChannel *channel = Channels.GetByNumber(ch); cChannel *channel = Channels.GetByNumber(ch);
if (channel) { if (channel) {

16
svdrp.c
View File

@ -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.11 2000/10/08 12:21:14 kls Exp $ * $Id: svdrp.c 1.12 2000/11/05 13:44:42 kls Exp $
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -302,13 +302,13 @@ void cSVDRP::CmdCHAN(const char *Option)
n = o; n = o;
} }
else if (strcmp(Option, "-") == 0) { else if (strcmp(Option, "-") == 0) {
n = CurrentChannel; n = cDvbApi::CurrentChannel();
if (CurrentChannel > 1) if (n > 1)
n--; n--;
} }
else if (strcmp(Option, "+") == 0) { else if (strcmp(Option, "+") == 0) {
n = CurrentChannel; n = cDvbApi::CurrentChannel();
if (CurrentChannel < Channels.MaxNumber()) if (n < Channels.MaxNumber())
n++; n++;
} }
else { else {
@ -342,11 +342,11 @@ void cSVDRP::CmdCHAN(const char *Option)
return; return;
} }
} }
cChannel *channel = Channels.GetByNumber(CurrentChannel); cChannel *channel = Channels.GetByNumber(cDvbApi::CurrentChannel());
if (channel) if (channel)
Reply(250, "%d %s", CurrentChannel, channel->name); Reply(250, "%d %s", channel->number, channel->name);
else else
Reply(550, "Unable to find channel \"%d\"", CurrentChannel); Reply(550, "Unable to find channel \"%d\"", cDvbApi::CurrentChannel());
} }
void cSVDRP::CmdDELC(const char *Option) void cSVDRP::CmdDELC(const char *Option)

16
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/people/kls/vdr * The project's page is at http://www.cadsoft.de/people/kls/vdr
* *
* $Id: vdr.c 1.42 2000/11/03 15:31:03 kls Exp $ * $Id: vdr.c 1.43 2000/11/05 18:39:17 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -177,7 +177,7 @@ int main(int argc, char *argv[])
cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);
Channels.SwitchTo(CurrentChannel); Channels.SwitchTo(1);
// User interface: // User interface:
@ -199,15 +199,15 @@ int main(int argc, char *argv[])
cOsdBase *Menu = NULL; cOsdBase *Menu = NULL;
cReplayControl *ReplayControl = NULL; cReplayControl *ReplayControl = NULL;
int LastChannel = -1; int LastChannel = -1;
int PreviousChannel = CurrentChannel; int PreviousChannel = cDvbApi::CurrentChannel();
while (!Interrupted) { while (!Interrupted) {
// Channel display: // Channel display:
if (CurrentChannel != LastChannel) { if (cDvbApi::CurrentChannel() != LastChannel) {
if (!Menu) if (!Menu)
Menu = new cDisplayChannel(CurrentChannel, LastChannel > 0); Menu = new cDisplayChannel(cDvbApi::CurrentChannel(), LastChannel > 0);
PreviousChannel = LastChannel; PreviousChannel = LastChannel;
LastChannel = CurrentChannel; LastChannel = cDvbApi::CurrentChannel();
} }
// Timers and Recordings: // Timers and Recordings:
if (!Menu) { if (!Menu) {
@ -259,7 +259,7 @@ int main(int argc, char *argv[])
switch (key) { switch (key) {
// Toggle channels: // Toggle channels:
case k0: case k0:
if (PreviousChannel != CurrentChannel) if (PreviousChannel != cDvbApi::CurrentChannel())
Channels.SwitchTo(PreviousChannel); Channels.SwitchTo(PreviousChannel);
break; break;
// Direct Channel Select: // Direct Channel Select:
@ -287,7 +287,7 @@ int main(int argc, char *argv[])
case kUp: case kUp:
case kDown|k_Repeat: case kDown|k_Repeat:
case kDown: if (!Interface->Recording()) { case kDown: if (!Interface->Recording()) {
int n = CurrentChannel + (NORMALKEY(key) == kUp ? 1 : -1); int n = cDvbApi::CurrentChannel() + (NORMALKEY(key) == kUp ? 1 : -1);
cChannel *channel = Channels.GetByNumber(n); cChannel *channel = Channels.GetByNumber(n);
if (channel) if (channel)
channel->Switch(); channel->Switch();