mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Current channel is now device specific
This commit is contained in:
		
							
								
								
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -269,3 +269,5 @@ Video Disk Recorder Revision History | ||||
| 2000-11-05: Version 0.68 | ||||
|  | ||||
| - 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). | ||||
|   | ||||
							
								
								
									
										8
									
								
								config.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								config.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * 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" | ||||
| @@ -262,9 +262,8 @@ bool cChannel::Switch(cDvbApi *DvbApi) | ||||
|      DvbApi = cDvbApi::PrimaryDvbApi; | ||||
|   if (!DvbApi->Recording() && !groupSep) { | ||||
|      isyslog(LOG_INFO, "switching to channel %d", number); | ||||
|      CurrentChannel = number; | ||||
|      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; | ||||
|          esyslog(LOG_ERR, "retrying"); | ||||
|          } | ||||
| @@ -284,7 +283,7 @@ cTimer::cTimer(bool Instant) | ||||
|   startTime = stopTime = 0; | ||||
|   recording = false; | ||||
|   active = Instant; | ||||
|   cChannel *ch = Channels.GetByNumber(CurrentChannel); | ||||
|   cChannel *ch = Channels.GetByNumber(cDvbApi::CurrentChannel()); | ||||
|   channel = ch ? ch->number : 0; | ||||
|   time_t t = time(NULL); | ||||
|   struct tm *now = localtime(&t); | ||||
| @@ -545,7 +544,6 @@ cKeys Keys; | ||||
|  | ||||
| // -- cChannels -------------------------------------------------------------- | ||||
|  | ||||
| int CurrentChannel = 1; | ||||
| int CurrentGroup = -1; | ||||
|  | ||||
| cChannels Channels; | ||||
|   | ||||
							
								
								
									
										3
									
								
								config.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								config.h
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * 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 | ||||
| @@ -217,7 +217,6 @@ public: | ||||
|   cTimer *GetTimer(cTimer *Timer); | ||||
|   }; | ||||
|  | ||||
| extern int CurrentChannel; | ||||
| extern int CurrentGroup; | ||||
|  | ||||
| extern cChannels Channels; | ||||
|   | ||||
							
								
								
									
										6
									
								
								dvbapi.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								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.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" | ||||
| @@ -1130,6 +1130,7 @@ cDvbApi::cDvbApi(const char *VideoFileName, const char *VbiFileName) | ||||
| #endif | ||||
|   lastProgress = lastTotal = -1; | ||||
|   replayTitle = NULL; | ||||
|   currentChannel = 1; | ||||
| } | ||||
|  | ||||
| cDvbApi::~cDvbApi() | ||||
| @@ -1698,7 +1699,7 @@ bool cDvbApi::ShowProgress(bool Initial) | ||||
|   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) { | ||||
|      struct frontend front; | ||||
| @@ -1723,6 +1724,7 @@ bool cDvbApi::SetChannel(int FrequencyMHz, char Polarization, int Diseqc, int Sr | ||||
|      if (front.sync & 0x1F == 0x1F) { | ||||
|         if (siProcessor) | ||||
|            siProcessor->SetCurrentServiceID(Pnr); | ||||
|         currentChannel = ChannelNumber; | ||||
|         return true; | ||||
|         } | ||||
|      esyslog(LOG_ERR, "ERROR: channel not sync'ed (front.sync=%X)!", front.sync); | ||||
|   | ||||
							
								
								
									
										8
									
								
								dvbapi.h
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								dvbapi.h
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * 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 | ||||
| @@ -138,7 +138,11 @@ public: | ||||
|  | ||||
|   // 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 | ||||
|  | ||||
|   | ||||
							
								
								
									
										10
									
								
								menu.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								menu.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * 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" | ||||
| @@ -594,7 +594,7 @@ cMenuChannels::cMenuChannels(void) | ||||
|   //TODO | ||||
|   int i = 0; | ||||
|   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) { | ||||
|         Add(new cMenuChannelItem(i, channel), i == curr); | ||||
| @@ -1245,7 +1245,7 @@ cMenuSchedule::cMenuSchedule(void) | ||||
| :cOsdMenu("Schedule", 6, 6) | ||||
| { | ||||
|   now = next = false; | ||||
|   cChannel *channel = Channels.GetByNumber(CurrentChannel); | ||||
|   cChannel *channel = Channels.GetByNumber(cDvbApi::CurrentChannel()); | ||||
|   if (channel) { | ||||
|      char *buffer = NULL; | ||||
|      asprintf(&buffer, "Schedule - %s", channel->name); | ||||
| @@ -1547,7 +1547,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched, bool Group) | ||||
| cDisplayChannel::cDisplayChannel(eKeys FirstKey) | ||||
| :cOsdBase(true) | ||||
| { | ||||
|   oldNumber = CurrentChannel; | ||||
|   oldNumber = cDvbApi::CurrentChannel(); | ||||
|   number = 0; | ||||
|   lastTime = time_ms(); | ||||
|   Interface->Open(MenuColumns, 5); | ||||
| @@ -1744,7 +1744,7 @@ cRecordControl *cRecordControls::RecordControls[MAXDVBAPI] = { NULL }; | ||||
|  | ||||
| bool cRecordControls::Start(cTimer *Timer) | ||||
| { | ||||
|   int ch = Timer ? Timer->channel : CurrentChannel; | ||||
|   int ch = Timer ? Timer->channel : cDvbApi::CurrentChannel(); | ||||
|   cChannel *channel = Channels.GetByNumber(ch); | ||||
|  | ||||
|   if (channel) { | ||||
|   | ||||
							
								
								
									
										16
									
								
								svdrp.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								svdrp.c
									
									
									
									
									
								
							| @@ -10,7 +10,7 @@ | ||||
|  * and interact with the Video Disk Recorder - or write a full featured | ||||
|  * 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 | ||||
| @@ -302,13 +302,13 @@ void cSVDRP::CmdCHAN(const char *Option) | ||||
|            n = o; | ||||
|         } | ||||
|      else if (strcmp(Option, "-") == 0) { | ||||
|         n = CurrentChannel; | ||||
|         if (CurrentChannel > 1) | ||||
|         n = cDvbApi::CurrentChannel(); | ||||
|         if (n > 1) | ||||
|            n--; | ||||
|         } | ||||
|      else if (strcmp(Option, "+") == 0) { | ||||
|         n = CurrentChannel; | ||||
|         if (CurrentChannel < Channels.MaxNumber()) | ||||
|         n = cDvbApi::CurrentChannel(); | ||||
|         if (n < Channels.MaxNumber()) | ||||
|            n++; | ||||
|         } | ||||
|      else { | ||||
| @@ -342,11 +342,11 @@ void cSVDRP::CmdCHAN(const char *Option) | ||||
|         return; | ||||
|         } | ||||
|      } | ||||
|   cChannel *channel = Channels.GetByNumber(CurrentChannel); | ||||
|   cChannel *channel = Channels.GetByNumber(cDvbApi::CurrentChannel()); | ||||
|   if (channel) | ||||
|      Reply(250, "%d %s", CurrentChannel, channel->name); | ||||
|      Reply(250, "%d %s", channel->number, channel->name); | ||||
|   else | ||||
|      Reply(550, "Unable to find channel \"%d\"", CurrentChannel); | ||||
|      Reply(550, "Unable to find channel \"%d\"", cDvbApi::CurrentChannel()); | ||||
| } | ||||
|  | ||||
| void cSVDRP::CmdDELC(const char *Option) | ||||
|   | ||||
							
								
								
									
										16
									
								
								vdr.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								vdr.c
									
									
									
									
									
								
							| @@ -22,7 +22,7 @@ | ||||
|  * | ||||
|  * 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> | ||||
| @@ -177,7 +177,7 @@ int main(int argc, char *argv[]) | ||||
|  | ||||
|   cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); | ||||
|  | ||||
|   Channels.SwitchTo(CurrentChannel); | ||||
|   Channels.SwitchTo(1); | ||||
|  | ||||
|   // User interface: | ||||
|  | ||||
| @@ -199,15 +199,15 @@ int main(int argc, char *argv[]) | ||||
|   cOsdBase *Menu = NULL; | ||||
|   cReplayControl *ReplayControl = NULL; | ||||
|   int LastChannel = -1; | ||||
|   int PreviousChannel = CurrentChannel; | ||||
|   int PreviousChannel = cDvbApi::CurrentChannel(); | ||||
|  | ||||
|   while (!Interrupted) { | ||||
|         // Channel display: | ||||
|         if (CurrentChannel != LastChannel) { | ||||
|         if (cDvbApi::CurrentChannel() != LastChannel) { | ||||
|            if (!Menu) | ||||
|               Menu = new cDisplayChannel(CurrentChannel, LastChannel > 0); | ||||
|               Menu = new cDisplayChannel(cDvbApi::CurrentChannel(), LastChannel > 0); | ||||
|            PreviousChannel = LastChannel; | ||||
|            LastChannel = CurrentChannel; | ||||
|            LastChannel = cDvbApi::CurrentChannel(); | ||||
|            } | ||||
|         // Timers and Recordings: | ||||
|         if (!Menu) { | ||||
| @@ -259,7 +259,7 @@ int main(int argc, char *argv[]) | ||||
|            switch (key) { | ||||
|              // Toggle channels: | ||||
|              case k0: | ||||
|                   if (PreviousChannel != CurrentChannel) | ||||
|                   if (PreviousChannel != cDvbApi::CurrentChannel()) | ||||
|                      Channels.SwitchTo(PreviousChannel); | ||||
|                   break; | ||||
|              // Direct Channel Select: | ||||
| @@ -287,7 +287,7 @@ int main(int argc, char *argv[]) | ||||
|              case kUp: | ||||
|              case kDown|k_Repeat: | ||||
|              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); | ||||
|                             if (channel) | ||||
|                                channel->Switch(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user