From 8f9cc68f76c4fd0960f919a77fb16a6455922deb Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 29 Jul 2001 18:00:00 +0200 Subject: =?UTF-8?q?Version=200.85=20-=20Added=20Norwegian=20language=20tex?= =?UTF-8?q?ts=20(thanks=20to=20J=F8rgen=20Tvedt).=20-=20Increased=20the=20?= =?UTF-8?q?usleep=20value=20in=20cDvbOsd::Cmd()=20to=205000=20in=20order?= =?UTF-8?q?=20to=20work=20on=20=20=20systems=20with=20the=20KURT/utime-pat?= =?UTF-8?q?ch=20(thanks=20to=20Guido=20Fiala).=20-=20Changed=20the=20check?= =?UTF-8?q?=20whether=20the=20driver=20is=20loaded=20in=20runvdr=20to=20ch?= =?UTF-8?q?eck=20for=20the=20=20=20'dvb'=20module=20(the=20last=20one=20lo?= =?UTF-8?q?aded).=20-=20Fixed=20repeat=20function=20with=20LIRC=20(thanks?= =?UTF-8?q?=20to=20Stefan=20Huelswitt).=20-=20Increased=20the=20upper=20li?= =?UTF-8?q?mit=20for=20the=20symbol=20rate=20to=2030000=20(thanks=20to=20U?= =?UTF-8?q?lrich=20=20=20R=F6der).=20-=20Made=20the=20position=20of=20the?= =?UTF-8?q?=20channel=20display=20configurable=20(thanks=20to=20Stefan=20?= =?UTF-8?q?=20=20Huelswitt).=20-=20Made=20the=20width=20and=20height=20of?= =?UTF-8?q?=20the=20OSD=20configurable=20(thanks=20to=20Stefan=20Huelswitt?= =?UTF-8?q?).=20-=20DiSEqC=20support=20can=20now=20be=20generally=20enable?= =?UTF-8?q?d/disabled=20in=20the=20Setup=20menu.=20This=20=20=20may=20be?= =?UTF-8?q?=20necessary=20if=20your=20multiswitch=20gets=20irritated=20by?= =?UTF-8?q?=20the=20default=20DiSEqC=20=20=20codes=20'0'=20(thanks=20to=20?= =?UTF-8?q?Markus=20Lang).=20-=20Fixed=20replaying=20in=20case=20there=20i?= =?UTF-8?q?s=20no=20index=20file.=20-=20Fixed=20jumping=20to=20an=20editin?= =?UTF-8?q?g=20mark=20when=20replay=20has=20been=20paused.=20-=20Avoiding?= =?UTF-8?q?=20unnecessary=20code=20execution=20in=20the=20replay=20progres?= =?UTF-8?q?s=20display=20(thanks=20=20=20to=20Guido=20Fiala).=20-=20When?= =?UTF-8?q?=20entering=20time=20values=20the=20digits=20that=20still=20hav?= =?UTF-8?q?e=20to=20be=20entered=20are=20now=20=20=20shown=20as=20'-'=20(a?= =?UTF-8?q?s=20in=20"1-:--").=20-=20When=20setting=20an=20editing=20mark?= =?UTF-8?q?=20while=20the=20progress=20display=20is=20not=20active,=20the?= =?UTF-8?q?=20=20=20display=20will=20now=20be=20turned=20on=20for=20a=20sh?= =?UTF-8?q?ort=20while=20to=20indicate=20the=20successful=20=20=20setting?= =?UTF-8?q?=20of=20the=20mark.=20-=20Updated=20'channels.conf'=20for=20Pre?= =?UTF-8?q?miere=20World=20(thanks=20to=20Helmut=20Sch=E4chner).=20=20=20C?= =?UTF-8?q?heck=20your=20timers=20if=20you=20use=20this=20channels.conf=20?= =?UTF-8?q?file,=20since=20the=20sequence=20of=20=20=20several=20PW=20chan?= =?UTF-8?q?nels=20has=20been=20changed.=20-=20Changed=20the=20color=20of?= =?UTF-8?q?=20"Info"=20messages=20to=20"black=20on=20green"=20and=20that?= =?UTF-8?q?=20of=20the=20=20=20confirmation=20messages=20(like=20"Delete..?= =?UTF-8?q?.")=20to=20"black=20on=20yellow".=20-=20Fixed=20display=20with?= =?UTF-8?q?=20DEBUG=5FOSD=20(it=20still=20crashes=20sometimes,=20esp.=20wh?= =?UTF-8?q?en=20replaying,=20=20=20but=20I=20can't=20seem=20to=20find=20wh?= =?UTF-8?q?at=20causes=20this...=20any=20ideas=20anybody=3F).=20-=20Avoidi?= =?UTF-8?q?ng=20audio/video=20distortions=20in=20'Transfer=20Mode'=20by=20?= =?UTF-8?q?no=20longer=20actually=20=20=20tuning=20the=20primary=20interfa?= =?UTF-8?q?ce=20(which=20can't=20receive=20this=20channel,=20anyway).=20?= =?UTF-8?q?=20=20Apparently=20the=20driver=20gets=20irritated=20when=20the?= =?UTF-8?q?=20channel=20is=20switched=20and=20a=20=20=20replay=20session?= =?UTF-8?q?=20is=20started=20immediately=20after=20that.=20-=20Increased?= =?UTF-8?q?=20timeout=20until=20reporting=20"video=20data=20stream=20broke?= =?UTF-8?q?n"=20when=20recording.=20-=20Explicitly=20switching=20back=20to?= =?UTF-8?q?=20the=20previously=20active=20channel=20after=20ending=20a=20?= =?UTF-8?q?=20=20replay=20session=20(to=20have=20it=20shown=20correctly=20?= =?UTF-8?q?in=20case=20it=20was=20in=20'Transfer=20Mode').?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- menu.c | 250 ++++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 156 insertions(+), 94 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index 09c180c..30532a7 100644 --- a/menu.c +++ b/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.70 2001/03/18 10:16:56 kls Exp $ + * $Id: menu.c 1.88 2001/07/28 16:17:28 kls Exp $ */ #include "menu.h" @@ -118,21 +118,24 @@ eOSState cMenuEditIntItem::ProcessKey(eKeys Key) class cMenuEditBoolItem : public cMenuEditIntItem { protected: + const char *falseString, *trueString; virtual void Set(void); public: - cMenuEditBoolItem(const char *Name, int *Value); + cMenuEditBoolItem(const char *Name, int *Value, const char *FalseString = NULL, const char *TrueString = NULL); }; -cMenuEditBoolItem::cMenuEditBoolItem(const char *Name, int *Value) +cMenuEditBoolItem::cMenuEditBoolItem(const char *Name, int *Value, const char *FalseString, const char *TrueString) :cMenuEditIntItem(Name, Value, 0, 1) { + falseString = FalseString ? FalseString : tr("no"); + trueString = TrueString ? TrueString : tr("yes"); Set(); } void cMenuEditBoolItem::Set(void) { char buf[16]; - snprintf(buf, sizeof(buf), "%s", *value ? tr("yes") : tr("no")); + snprintf(buf, sizeof(buf), "%s", *value ? trueString : falseString); SetValue(buf); } @@ -274,7 +277,12 @@ cMenuEditTimeItem::cMenuEditTimeItem(const char *Name, int *Value) void cMenuEditTimeItem::Set(void) { char buf[10]; - snprintf(buf, sizeof(buf), "%02d:%02d", hh, mm); + switch (pos) { + case 1: snprintf(buf, sizeof(buf), "%01d-:--", hh / 10); break; + case 2: snprintf(buf, sizeof(buf), "%02d:--", hh); break; + case 3: snprintf(buf, sizeof(buf), "%02d:%01d-", hh, mm / 10); break; + default: snprintf(buf, sizeof(buf), "%02d:%02d", hh, mm); + } SetValue(buf); } @@ -538,10 +546,13 @@ cMenuEditChannel::cMenuEditChannel(int Index) Add(new cMenuEditIntItem( tr("Frequency"), &data.frequency, 10000, 13000)); //TODO exact limits??? Add(new cMenuEditChrItem( tr("Polarization"), &data.polarization, "hv")); Add(new cMenuEditIntItem( tr("Diseqc"), &data.diseqc, 0, 10)); //TODO exact limits??? - Add(new cMenuEditIntItem( tr("Srate"), &data.srate, 22000, 27500)); //TODO exact limits - toggle??? - Add(new cMenuEditIntItem( tr("Vpid"), &data.vpid, 0, 10000)); //TODO exact limits??? - Add(new cMenuEditIntItem( tr("Apid"), &data.apid, 0, 10000)); //TODO exact limits??? - Add(new cMenuEditIntItem( tr("Tpid"), &data.tpid, 0, 10000)); //TODO exact limits??? + Add(new cMenuEditIntItem( tr("Srate"), &data.srate, 22000, 30000)); //TODO exact limits - toggle??? + Add(new cMenuEditIntItem( tr("Vpid"), &data.vpid, 0, 0xFFFE)); + Add(new cMenuEditIntItem( tr("Apid1"), &data.apid1, 0, 0xFFFE)); + Add(new cMenuEditIntItem( tr("Apid2"), &data.apid2, 0, 0xFFFE)); + Add(new cMenuEditIntItem( tr("Dpid1"), &data.dpid1, 0, 0xFFFE)); + Add(new cMenuEditIntItem( tr("Dpid2"), &data.dpid2, 0, 0xFFFE)); + Add(new cMenuEditIntItem( tr("Tpid"), &data.tpid, 0, 0xFFFE)); Add(new cMenuEditIntItem( tr("CA"), &data.ca, 0, cDvbApi::NumDvbApis)); Add(new cMenuEditIntItem( tr("Pnr"), &data.pnr, 0)); } @@ -579,7 +590,7 @@ cMenuChannelItem::cMenuChannelItem(int Index, cChannel *Channel) index = Index; channel = Channel; if (channel->groupSep) - SetColor(clrWhite, clrBlue); + SetColor(clrWhite, clrCyan); Set(); } @@ -589,7 +600,7 @@ void cMenuChannelItem::Set(void) if (!channel->groupSep) asprintf(&buffer, "%d\t%s", channel->number, channel->name ); else - asprintf(&buffer, "\t%s", channel->name); + asprintf(&buffer, "\t%s", channel->name); SetText(buffer, false); } @@ -868,7 +879,7 @@ public: cMenuText::cMenuText(const char *Title, const char *Text, eDvbFont Font) :cOsdMenu(Title) { - Add(new cMenuTextItem(Text, 1, 2, MenuColumns - 2, MAXOSDITEMS, clrWhite, clrBackground, Font)); + Add(new cMenuTextItem(Text, 1, 2, Setup.OSDwidth - 2, MAXOSDITEMS, clrWhite, clrBackground, Font)); } eOSState cMenuText::ProcessKey(eKeys Key) @@ -904,13 +915,13 @@ cMenuEditTimer::cMenuEditTimer(int Index, bool New) if (New) data.active = 1; Add(new cMenuEditBoolItem(tr("Active"), &data.active)); - Add(new cMenuEditChanItem(tr("Channel"), &data.channel)); - Add(new cMenuEditDayItem( tr("Day"), &data.day)); - Add(new cMenuEditTimeItem(tr("Start"), &data.start)); - Add(new cMenuEditTimeItem(tr("Stop"), &data.stop)); + Add(new cMenuEditChanItem(tr("Channel"), &data.channel)); + Add(new cMenuEditDayItem( tr("Day"), &data.day)); + Add(new cMenuEditTimeItem(tr("Start"), &data.start)); + Add(new cMenuEditTimeItem(tr("Stop"), &data.stop)); //TODO VPS??? - Add(new cMenuEditIntItem( tr("Priority"), &data.priority, 0, 99)); - Add(new cMenuEditIntItem( tr("Lifetime"), &data.lifetime, 0, 99)); + Add(new cMenuEditIntItem( tr("Priority"), &data.priority, 0, MAXPRIORITY)); + Add(new cMenuEditIntItem( tr("Lifetime"), &data.lifetime, 0, MAXLIFETIME)); Add(new cMenuEditStrItem( tr("File"), data.file, sizeof(data.file), FileNameChars)); } } @@ -963,9 +974,9 @@ void cMenuTimerItem::Set(void) { char *buffer = NULL; asprintf(&buffer, "%c\t%d\t%s\t%02d:%02d\t%02d:%02d\t%s", - timer->active ? '>' : ' ', - timer->channel, - timer->PrintDay(timer->day), + timer->active ? '>' : ' ', + timer->channel, + timer->PrintDay(timer->day), timer->start / 100, timer->start % 100, timer->stop / 100, @@ -1137,20 +1148,20 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch) // like all the others? Well, at least like those who actually send the full range // of information (like, e.g., 'Sat.1'). Some stations (like 'RTL') don't even // bother sending anything but the 'Title'... - if (isempty(ExtendedDescription) && !isempty(Subtitle) && strlen(Subtitle) > 2 * MenuColumns) { + if (isempty(ExtendedDescription) && !isempty(Subtitle) && int(strlen(Subtitle)) > 2 * Setup.OSDwidth) { ExtendedDescription = Subtitle; Subtitle = NULL; } if (!isempty(Title)) { - Add(item = new cMenuTextItem(Title, 1, Line, MenuColumns - 2, -1, clrCyan)); + Add(item = new cMenuTextItem(Title, 1, Line, Setup.OSDwidth - 2, -1, clrCyan)); Line += item->Height() + 1; } if (!isempty(Subtitle)) { - Add(item = new cMenuTextItem(Subtitle, 1, Line, MenuColumns - 2, -1, clrYellow)); + Add(item = new cMenuTextItem(Subtitle, 1, Line, Setup.OSDwidth - 2, -1, clrYellow)); Line += item->Height() + 1; } if (!isempty(ExtendedDescription)) - Add(new cMenuTextItem(ExtendedDescription, 1, Line, MenuColumns - 2, Height() - Line - 2, clrCyan), true); + Add(new cMenuTextItem(ExtendedDescription, 1, Line, Setup.OSDwidth - 2, Height() - Line - 2, clrCyan), true); SetHelp(tr("Record"), NULL, NULL, CanSwitch ? tr("Switch") : NULL); } } @@ -1265,7 +1276,7 @@ eOSState cMenuWhatsOn::Switch(void) eOSState cMenuWhatsOn::Record(void) { cMenuWhatsOnItem *item = (cMenuWhatsOnItem *)Get(Current()); - if (item) { + if (item) { cTimer *timer = new cTimer(item->eventInfo); cTimer *t = Timers.GetTimer(timer); if (!t) { @@ -1391,7 +1402,7 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel) eOSState cMenuSchedule::Record(void) { cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current()); - if (item) { + if (item) { cTimer *timer = new cTimer(item->eventInfo); cTimer *t = Timers.GetTimer(timer); if (!t) { @@ -1608,14 +1619,22 @@ void cMenuSetup::Set(void) Add(new cMenuEditBoolItem(tr("ShowInfoOnChSwitch"), &data.ShowInfoOnChSwitch)); Add(new cMenuEditBoolItem(tr("MenuScrollPage"), &data.MenuScrollPage)); Add(new cMenuEditBoolItem(tr("MarkInstantRecord"), &data.MarkInstantRecord)); + Add(new cMenuEditIntItem( tr("LnbSLOF"), &data.LnbSLOF)); Add(new cMenuEditIntItem( tr("LnbFrequLo"), &data.LnbFrequLo)); Add(new cMenuEditIntItem( tr("LnbFrequHi"), &data.LnbFrequHi)); + Add(new cMenuEditBoolItem(tr("DiSEqC"), &data.DiSEqC)); Add(new cMenuEditBoolItem(tr("SetSystemTime"), &data.SetSystemTime)); Add(new cMenuEditIntItem( tr("MarginStart"), &data.MarginStart)); Add(new cMenuEditIntItem( tr("MarginStop"), &data.MarginStop)); Add(new cMenuEditIntItem( tr("EPGScanTimeout"), &data.EPGScanTimeout)); Add(new cMenuEditIntItem( tr("SVDRPTimeout"), &data.SVDRPTimeout)); - Add(new cMenuEditIntItem( tr("PrimaryLimit"), &data.PrimaryLimit)); + Add(new cMenuEditIntItem( tr("PrimaryLimit"), &data.PrimaryLimit, 0, MAXPRIORITY)); + Add(new cMenuEditIntItem( tr("DefaultPriority"), &data.DefaultPriority, 0, MAXPRIORITY)); + Add(new cMenuEditIntItem( tr("DefaultLifetime"), &data.DefaultLifetime, 0, MAXLIFETIME)); + Add(new cMenuEditBoolItem(tr("VideoFormat"), &data.VideoFormat, "4:3", "16:9")); + Add(new cMenuEditBoolItem(tr("ChannelInfoPos"), &data.ChannelInfoPos, tr("bottom"), tr("top"))); + Add(new cMenuEditIntItem( tr("OSDwidth"), &data.OSDwidth, MINOSDWIDTH, MAXOSDWIDTH)); + Add(new cMenuEditIntItem( tr("OSDheight"), &data.OSDheight, MINOSDHEIGHT, MAXOSDHEIGHT)); } eOSState cMenuSetup::ProcessKey(eKeys Key) @@ -1626,6 +1645,7 @@ eOSState cMenuSetup::ProcessKey(eKeys Key) switch (Key) { case kOk: state = (Setup.PrimaryDVB != data.PrimaryDVB) ? osSwitchDvb : osEnd; cDvbApi::PrimaryDvbApi->SetUseTSTime(data.SetSystemTime); + cDvbApi::PrimaryDvbApi->SetVideoFormat(data.VideoFormat ? VIDEO_FORMAT_16_9 : VIDEO_FORMAT_4_3); Setup = data; Setup.Save(); break; @@ -1722,7 +1742,7 @@ cMenuMain::cMenuMain(bool Replaying) } if (cVideoCutter::Active()) Add(new cOsdItem(tr(" Cancel editing"), osCancelEdit)); - SetHelp(tr("Record"), NULL, NULL, cReplayControl::LastReplayed() ? tr("Resume") : NULL); + SetHelp(tr("Record"), cDvbApi::PrimaryDvbApi->CanToggleAudioTrack() ? tr("Language") : NULL, NULL, cReplayControl::LastReplayed() ? tr("Resume") : NULL); Display(); lastActivity = time(NULL); SetHasHotkeys(); @@ -1753,14 +1773,22 @@ eOSState cMenuMain::ProcessKey(eKeys Key) } break; default: switch (Key) { - case kMenu: state = osEnd; break; - case kRed: if (!HasSubMenu()) - state = osRecord; - break; - case kBlue: if (!HasSubMenu()) - state = osReplay; - break; - default: break; + case kMenu: state = osEnd; break; + case kRed: if (!HasSubMenu()) + state = osRecord; + break; + case kGreen: if (!HasSubMenu()) { + if (cDvbApi::PrimaryDvbApi->CanToggleAudioTrack()) { + Interface->Clear(); + cDvbApi::PrimaryDvbApi->ToggleAudioTrack(); + state = osEnd; + } + } + break; + case kBlue: if (!HasSubMenu()) + state = osReplay; + break; + default: break; } } if (Key != kNone) @@ -1772,7 +1800,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key) // --- cDisplayChannel ------------------------------------------------------- -#define DIRECTCHANNELTIMEOUT 500 //ms +#define DIRECTCHANNELTIMEOUT 1000 //ms #define INFOTIMEOUT 5000 //ms cDisplayChannel::cDisplayChannel(int Number, bool Switched, bool Group) @@ -1783,7 +1811,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched, bool Group) lines = 0; oldNumber = number = 0; cChannel *channel = Group ? Channels.Get(Number) : Channels.GetByNumber(Number); - Interface->Open(MenuColumns, 5); + Interface->Open(Setup.OSDwidth, Setup.ChannelInfoPos ? 5 : -5); if (channel) { DisplayChannel(channel); DisplayInfo(); @@ -1797,7 +1825,7 @@ cDisplayChannel::cDisplayChannel(eKeys FirstKey) oldNumber = cDvbApi::CurrentChannel(); number = 0; lastTime = time_ms(); - Interface->Open(MenuColumns, 5); + Interface->Open(Setup.OSDwidth, Setup.ChannelInfoPos ? 5 : -5); ProcessKey(FirstKey); } @@ -1810,21 +1838,20 @@ cDisplayChannel::~cDisplayChannel() void cDisplayChannel::DisplayChannel(const cChannel *Channel) { - if (Channel && Channel->number) + if (Channel && Channel->number > 0) Interface->DisplayChannelNumber(Channel->number); int BufSize = Width() + 1; char buffer[BufSize]; - if (Channel && Channel->number) - snprintf(buffer, BufSize, "%d %s", Channel->number, Channel->name); + if (Channel && Channel->number > 0) + snprintf(buffer, BufSize, "%d%s %s", Channel->number, number ? "-" : "", Channel->name); else snprintf(buffer, BufSize, "%s", Channel ? Channel->name : tr("*** Invalid Channel ***")); - Interface->Fill(0, 0, MenuColumns, 1, clrBackground); + Interface->Fill(0, 0, Setup.OSDwidth, 1, clrBackground); Interface->Write(0, 0, buffer); time_t t = time(NULL); struct tm *now = localtime(&t); snprintf(buffer, BufSize, "%02d:%02d", now->tm_hour, now->tm_min); Interface->Write(-5, 0, buffer); - Interface->Flush(); } void cDisplayChannel::DisplayInfo(void) @@ -1857,7 +1884,7 @@ void cDisplayChannel::DisplayInfo(void) if (Lines > lines) { const int t = 6; int l = 1; - Interface->Fill(0, 1, MenuColumns, Lines, clrBackground); + Interface->Fill(0, 1, Setup.OSDwidth, Lines, clrBackground); if (!isempty(PresentTitle)) { Interface->Write(0, l, Present->GetTimeString(), clrYellow, clrBackground); Interface->Write(t, l, PresentTitle, clrCyan, clrBackground); @@ -1945,11 +1972,14 @@ cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer) asprintf(&instantId, cDvbApi::NumDvbApis > 1 ? "%s - %d" : "%s", Channels.GetChannelNameByNumber(timer->channel), dvbApi->Index() + 1); } timer->SetRecording(true); - Channels.SwitchTo(timer->channel, dvbApi); - cRecording Recording(timer); - if (dvbApi->StartRecord(Recording.FileName(), Channels.GetByNumber(timer->channel)->ca, timer->priority)) - Recording.WriteSummary(); - Interface->DisplayRecording(dvbApi->Index(), true); + if (Channels.SwitchTo(timer->channel, dvbApi)) { + cRecording Recording(timer); + if (dvbApi->StartRecord(Recording.FileName(), Channels.GetByNumber(timer->channel)->ca, timer->priority)) + Recording.WriteSummary(); + Interface->DisplayRecording(dvbApi->Index(), true); + } + else + cThread::EmergencyExit(true); } cRecordControl::~cRecordControl() @@ -1979,7 +2009,7 @@ bool cRecordControl::Process(void) { if (!timer || !timer->Matches()) return false; - AssertFreeDiskSpace(); + AssertFreeDiskSpace(timer->priority); return true; } @@ -1993,7 +2023,7 @@ bool cRecordControls::Start(cTimer *Timer) cChannel *channel = Channels.GetByNumber(ch); if (channel) { - cDvbApi *dvbApi = cDvbApi::GetDvbApi(channel->ca, Timer ? Timer->priority : DEFAULTPRIORITY); + cDvbApi *dvbApi = cDvbApi::GetDvbApi(channel->ca, Timer ? Timer->priority : Setup.DefaultPriority); if (dvbApi) { Stop(dvbApi); for (int i = 0; i < MAXDVBAPI; i++) { @@ -2078,7 +2108,7 @@ public: }; cProgressBar::cProgressBar(int Width, int Height, int Current, int Total, const cMarks &Marks) -:cBitmap(Width, Height) +:cBitmap(Width, Height, 2) { total = Total; if (total > 0) { @@ -2119,6 +2149,8 @@ cReplayControl::cReplayControl(void) { dvbApi = cDvbApi::PrimaryDvbApi; visible = shown = displayFrames = false; + lastCurrent = lastTotal = -1; + timeoutShow = 0; if (fileName) { marks.Load(fileName); dvbApi->StartReplay(fileName); @@ -2152,12 +2184,14 @@ void cReplayControl::ClearLastReplayed(const char *FileName) } } -void cReplayControl::Show(void) +void cReplayControl::Show(int Seconds) { if (!visible) { - Interface->Open(MenuColumns, -3); + Interface->Open(Setup.OSDwidth, -3); needsFastResponse = visible = true; shown = ShowProgress(true); + if (Seconds > 0) + timeoutShow = time(NULL) + Seconds; } } @@ -2178,21 +2212,27 @@ bool cReplayControl::ShowProgress(bool Initial) Interface->Clear(); if (title) Interface->Write(0, 0, title); - displayFrames = marks.Count() > 0; + lastCurrent = lastTotal = -1; + } + if (Total != lastTotal) { + Interface->Write(-7, 2, IndexToHMSF(Total)); + Interface->Flush(); + lastTotal = Total; } - Interface->Write(-7, 2, IndexToHMSF(Total)); - Interface->Flush(); + if (Current != lastCurrent) { #ifdef DEBUG_OSD - int p = Width() * Current / Total; - Interface->Fill(0, 1, p, 1, clrGreen); - Interface->Fill(p, 1, Width() - p, 1, clrWhite); + int p = Width() * Current / Total; + Interface->Fill(0, 1, p, 1, clrGreen); + Interface->Fill(p, 1, Width() - p, 1, clrWhite); #else - cProgressBar ProgressBar(Width() * dvbApi->CellWidth(), dvbApi->LineHeight(), Current, Total, marks); - Interface->SetBitmap(0, dvbApi->LineHeight(), ProgressBar); - Interface->Flush(); + cProgressBar ProgressBar(Width() * dvbApi->CellWidth(), dvbApi->LineHeight(), Current, Total, marks); + Interface->SetBitmap(0, dvbApi->LineHeight(), ProgressBar); + Interface->Flush(); #endif - Interface->Write(0, 2, IndexToHMSF(Current, displayFrames)); - Interface->Flush(); + Interface->Write(0, 2, IndexToHMSF(Current, displayFrames)); + Interface->Flush(); + lastCurrent = Current; + } return true; } return false; @@ -2205,22 +2245,24 @@ void cReplayControl::MarkToggle(void) cMark *m = marks.Get(Current); if (m) marks.Del(m); - else + else { marks.Add(Current); + Show(2); + } marks.Save(); } - displayFrames = marks.Count() > 0; - if (!displayFrames) - Interface->Fill(0, 2, Width() / 2, 1, clrBackground); } void cReplayControl::MarkJump(bool Forward) { - int Current, Total; - if (dvbApi->GetIndex(Current, Total)) { - cMark *m = Forward ? marks.GetNext(Current) : marks.GetPrev(Current); - if (m) - dvbApi->Goto(m->position, true); + if (marks.Count()) { + int Current, Total; + if (dvbApi->GetIndex(Current, Total)) { + cMark *m = Forward ? marks.GetNext(Current) : marks.GetPrev(Current); + if (m) + dvbApi->Goto(m->position, true); + } + displayFrames = true; } } @@ -2230,6 +2272,7 @@ void cReplayControl::MarkMove(bool Forward) if (dvbApi->GetIndex(Current, Total)) { cMark *m = marks.Get(Current); if (m) { + displayFrames = true; int p = dvbApi->SkipFrames(Forward ? 1 : -1); cMark *m2; if (Forward) { @@ -2281,8 +2324,16 @@ eOSState cReplayControl::ProcessKey(eKeys Key) { if (!dvbApi->Replaying()) return osEnd; - if (visible) - shown = ShowProgress(!shown) || shown; + if (visible) { + if (timeoutShow && time(NULL) > timeoutShow) { + Hide(); + timeoutShow = 0; + } + else + shown = ShowProgress(!shown) || shown; + } + bool DisplayedFrames = displayFrames; + displayFrames = false; switch (Key) { // Positioning: case kUp: dvbApi->Play(); break; @@ -2299,23 +2350,34 @@ eOSState cReplayControl::ProcessKey(eKeys Key) case kBlue: Hide(); dvbApi->StopReplay(); return osEnd; - // Editing: - //XXX should we do this only when the ProgressDisplay is on??? - case kMarkToggle: MarkToggle(); break; - case kMarkJumpBack: MarkJump(false); break; - case kMarkJumpForward: MarkJump(true); break; - case kMarkMoveBack|k_Repeat: - case kMarkMoveBack: MarkMove(false); break; - case kMarkMoveForward|k_Repeat: - case kMarkMoveForward: MarkMove(true); break; - case kEditCut: EditCut(); break; - case kEditTest: EditTest(); break; - // Menu control: - case kMenu: Hide(); return osMenu; // allow direct switching to menu - case kOk: visible ? Hide() : Show(); break; - case kBack: return osRecordings; - default: return osUnknown; + default: { + switch (Key) { + // Editing: + //XXX should we do this only when the ProgressDisplay is on??? + case kMarkToggle: MarkToggle(); break; + case kMarkJumpBack: MarkJump(false); break; + case kMarkJumpForward: MarkJump(true); break; + case kMarkMoveBack|k_Repeat: + case kMarkMoveBack: MarkMove(false); break; + case kMarkMoveForward|k_Repeat: + case kMarkMoveForward: MarkMove(true); break; + case kEditCut: EditCut(); break; + case kEditTest: EditTest(); break; + default: { + displayFrames = DisplayedFrames; + switch (Key) { + // Menu control: + case kMenu: Hide(); return osMenu; // allow direct switching to menu + case kOk: visible ? Hide() : Show(); break; + case kBack: return osRecordings; + default: return osUnknown; + } + } + } + } } + if (DisplayedFrames && !displayFrames) + Interface->Fill(0, 2, Width() / 2, 1, clrBackground); return osContinue; } -- cgit v1.2.3