From fb5cccb2df60361a18fe3fd572b0fe18f3a4331c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 9 Jan 2005 18:00:00 +0100 Subject: =?UTF-8?q?Version=201.3.18=20-=20Removed=20an=20unused=20variable?= =?UTF-8?q?=20from=20cTimer::GetWDayFromMDay()=20(thanks=20to=20Wayne=20Ke?= =?UTF-8?q?er=20=20=20for=20reporting=20this=20one).=20-=20Some=20more=20c?= =?UTF-8?q?hanges=20to=20the=20'childTid'=20handling=20in=20cThread=20(bas?= =?UTF-8?q?ed=20on=20suggestions=20by=20=20=20Stefan=20Huelswitt).=20-=20F?= =?UTF-8?q?ixed=20the=20spelling=20of=20'canceling'=20(thanks=20to=20Wayne?= =?UTF-8?q?=20Keer=20for=20reporting=20this=20one).=20-=20Re-introduced=20?= =?UTF-8?q?a=20sleep=20to=20cDvbPlayer::Action()=20to=20avoid=20high=20CPU?= =?UTF-8?q?=20load=20in=20still=20=20=20picture=20mode=20(thanks=20to=20Re?= =?UTF-8?q?inhard=20Nissl=20for=20reporting=20this=20one).=20-=20Fixed=20a?= =?UTF-8?q?=20possible=20race=20condition=20in=20generating=20the=20DVB=20?= =?UTF-8?q?device=20names=20(thanks=20to=20=20=20Rainer=20Zocholl=20for=20?= =?UTF-8?q?reporting=20this=20one).=20-=20Changed=20the=20way=20PES=20pack?= =?UTF-8?q?ets=20are=20played=20to=20allow=20replay=20of=20AC3=20sound=20o?= =?UTF-8?q?ver=20the=20=20=20full=20featured=20DVB=20cards=20(partially=20?= =?UTF-8?q?based=20on=20a=20patch=20from=20Werner=20Fink).=20=20=20+=20The?= =?UTF-8?q?=20new=20function=20cDevice::PlayPes()=20is=20now=20called=20wi?= =?UTF-8?q?th=20the=20complete=20PES=20data=20=20=20=20=20stream=20and=20c?= =?UTF-8?q?alls=20PlayVideo()=20and=20PlayAudio()=20as=20necessary.=20=20?= =?UTF-8?q?=20+=20cDevice::PlayVideo()=20is=20now=20only=20called=20with?= =?UTF-8?q?=20actual=20video=20PES=20packets.=20=20=20+=20cDevice::PlayAud?= =?UTF-8?q?io()=20is=20now=20called=20with=20the=20actual=20audio=20PES=20?= =?UTF-8?q?packets,=20which=20=20=20=20=20can=20be=20either=20"normal"=20a?= =?UTF-8?q?udio=20or=20AC3=20data.=20You=20need=20at=20least=20firmware=20?= =?UTF-8?q?version=20=20=20=20=200x261d=20to=20replay=20AC3=20sound=20over?= =?UTF-8?q?=20a=20full=20featured=20DVB=20card.=20This=20function=20now=20?= =?UTF-8?q?=20=20=20=20has=20an=20'int'=20return=20value.=20=20=20+=20Play?= =?UTF-8?q?Audio()=20of=20derived=20cDevice=20classes=20shall=20no=20longe?= =?UTF-8?q?r=20call=20the=20base=20class=20=20=20=20=20function.=20It=20sh?= =?UTF-8?q?all=20just=20play=20the=20given=20data=20as=20audio.=20=20=20+?= =?UTF-8?q?=20cPlayer::PlayVideo()=20and=20cPlayer::PlayAudio()=20are=20no?= =?UTF-8?q?w=20obsolete=20and=20have=20been=20=20=20=20=20replaced=20with?= =?UTF-8?q?=20cPlayer::PlayPes().=20=20=20+=20All=20StripAudioPackets()=20?= =?UTF-8?q?functions=20are=20now=20obsolete.=20The=20functionality=20has?= =?UTF-8?q?=20been=20=20=20=20=20moved=20into=20cDevice::PlayPes(),=20wher?= =?UTF-8?q?e=20only=20the=20video=20and=20audio=20packets=20that=20are=20?= =?UTF-8?q?=20=20=20=20actually=20required=20will=20be=20processed.=20=20?= =?UTF-8?q?=20+=20All=20audio=20track=20handling=20is=20now=20done=20by=20?= =?UTF-8?q?cDevice;=20cTransfer=20and=20cDvbPlayer=20no=20=20=20=20=20long?= =?UTF-8?q?er=20care=20about=20audio=20tracks.=20cPlayer,=20however,=20sti?= =?UTF-8?q?ll=20has=20the=20virtual=20hooks=20=20=20=20=20for=20audio=20tr?= =?UTF-8?q?ack=20handling=20in=20order=20to=20allow=20plugins=20to=20imple?= =?UTF-8?q?ment=20players=20that=20=20=20=20=20have=20their=20own=20idea?= =?UTF-8?q?=20about=20this.=20=20=20+=20cChannel::[AD]pid[12]()=20have=20b?= =?UTF-8?q?een=20replaced=20with=20cChannel::[AD]pid(int=20i)=20to=20=20?= =?UTF-8?q?=20=20=20allow=20access=20to=20all=20available=20PIDs.=20-=20Es?= =?UTF-8?q?caped=20the=20'-'=20and=20'=C3=B6'=20characters=20in=20the=20ma?= =?UTF-8?q?n=20pages=20(thanks=20to=20Darren=20Salt=20for=20=20=20pointing?= =?UTF-8?q?=20this=20out).=20-=20Completed=20the=20Italian=20OSD=20texts?= =?UTF-8?q?=20(thanks=20to=20Sean=20Carlos).=20-=20Fixed=20setting=20'sync?= =?UTF-8?q?ed'=20in=20cRemux=20when=20recording=20radio=20channels=20(than?= =?UTF-8?q?ks=20to=20=20=20Laurence=20Abbott).=20-=20Removed=20the=20LOCK?= =?UTF-8?q?=5FTHREAD=20from=20the=20LIRC=20thread=20(thanks=20to=20Ludwig?= =?UTF-8?q?=20Nussel).=20-=20Fixed=20genfontfile.c=20(sometimes=20the=20ch?= =?UTF-8?q?aracter=20width=20was=20wrong,=20and=20the=20codes=20were=20=20?= =?UTF-8?q?=20shifted=20one=20too=20far=20to=20the=20left).=20-=20Fixed=20?= =?UTF-8?q?the=20character=20width=20and=20shifted=20the=20codes=20one=20t?= =?UTF-8?q?o=20the=20right=20in=20all=20font=20=20=20files.=20-=20Renamed?= =?UTF-8?q?=20font=3F=3F=3F.c=20to=20font=3F=3F=3F-iso8859-1.c=20for=20sym?= =?UTF-8?q?metry.=20-=20Switched=20the=20character=20set=20to=20iso8859-15?= =?UTF-8?q?=20for=20English,=20German=20and=20Finnish=20(thanks=20=20=20to?= =?UTF-8?q?=20Andreas=20Brugger=20for=20reporting=20the=20missing=20Euro?= =?UTF-8?q?=20sign=20in=20iso8859-1).=20-=20Added=20'channels.conf.terr'?= =?UTF-8?q?=20entries=20for=20L=C3=BCbeck=20(thanks=20to=20Stefan=20Hu?= =?UTF-8?q?=C3=9Ffeldt).=20-=20Fixed=20a=20race=20condition=20in=20startin?= =?UTF-8?q?g=20a=20thread=20(thanks=20to=20Reinhard=20Nissl=20for=20=20=20?= =?UTF-8?q?reporting=20this=20one).=20-=20Replaced=20non-threadsafe=20libr?= =?UTF-8?q?ary=20functions=20with=20their=20threadsafe=20versions=20(thank?= =?UTF-8?q?s=20=20=20to=20Rainer=20Zocholl=20for=20pointing=20this=20out).?= =?UTF-8?q?=20-=20Other=20non-threadsafe=20functions=20have=20been=20repla?= =?UTF-8?q?ced=20by=20threadsafe=20classes=20that=20hide=20=20=20the=20act?= =?UTF-8?q?ual=20buffering.=20In=20particular=20these=20are:=20=20=20readd?= =?UTF-8?q?ir()=20->=20cReadDir=20=20=20readline()=20->=20cReadLine=20-=20?= =?UTF-8?q?Several=20formerly=20non-threadsafe=20functions=20now=20have=20?= =?UTF-8?q?a=20return=20type=20of=20cString:=20=20=20cChannel::ToText()=20?= =?UTF-8?q?=20=20tChannelID::ToString()=20=20=20cEvent::GetDateString()=20?= =?UTF-8?q?=20=20cEvent::GetTimeString()=20=20=20cEvent::GetEndTimeString(?= =?UTF-8?q?)=20=20=20cEvent::GetVpsString()=20=20=20cMark::ToText()=20=20?= =?UTF-8?q?=20cTimer::ToText()=20=20=20cSource::ToString()=20=20=20cTimer:?= =?UTF-8?q?:PrintDay()=20=20=20cTimer::PrintFirstDay()=20=20=20PrefixVideo?= =?UTF-8?q?FileName()=20=20=20IndexToHMSF()=20=20=20ChannelString()=20=20?= =?UTF-8?q?=20strescape()=20=20=20AddDirectory()=20=20=20itoa()=20=20=20We?= =?UTF-8?q?ekDayName()=20=20=20DayDateTime()=20=20=20When=20using=20these?= =?UTF-8?q?=20functions=20in=20a=20'const=20char=20*'=20context=20there=20?= =?UTF-8?q?is=20nothing=20special=20=20=20to=20consider,=20except=20that?= =?UTF-8?q?=20you=20can=20no=20longer=20have=20a=20pointer=20to=20the=20re?= =?UTF-8?q?turn=20value,=20=20=20as=20in=20=20=20const=20char=20*date=20?= =?UTF-8?q?=3D=20DayDateTime();=20=20=20Although=20this=20will=20compile?= =?UTF-8?q?=20without=20error=20message,=20the=20resulting=20'date'=20will?= =?UTF-8?q?=20not=20=20=20be=20valid=20after=20this=20line.=20Use=20this?= =?UTF-8?q?=20instead:=20=20=20cString=20date=20=3D=20DayDateTime();=20=20?= =?UTF-8?q?=20In=20a=20'const=20void=20*'=20context=20(as=20in=20printf()?= =?UTF-8?q?=20etc.)=20the=20result=20needs=20to=20be=20=20=20dereferenced?= =?UTF-8?q?=20with=20a=20'*',=20as=20in=20=20=20printf("%s",=20*DayDateTim?= =?UTF-8?q?e());=20=20=20to=20make=20it=20a=20'const=20char=20*'.=20-=20Re?= =?UTF-8?q?moved=20delay=5Fms(),=20using=20cCondWait::SleepMs()=20instead.?= =?UTF-8?q?=20-=20Replaced=20time=5Fms()=20with=20a=20threadsafe=20and=20n?= =?UTF-8?q?on-overflowing=20cTimeMs=20(thanks=20to=20Rainer=20=20=20Zochol?= =?UTF-8?q?l=20for=20pointing=20out=20this=20problem).=20-=20Added=20cDevi?= =?UTF-8?q?ce::mutexReceiver=20to=20avoid=20a=20race=20condition=20when=20?= =?UTF-8?q?attaching/detaching=20=20=20receivers=20from=20different=20thre?= =?UTF-8?q?ads.=20-=20The=20new=20remote=20control=20button=20"Audio"=20ca?= =?UTF-8?q?n=20be=20used=20to=20switch=20between=20different=20=20=20audio?= =?UTF-8?q?=20tracks.=20The=20"Green"=20button=20in=20the=20"Main"=20menu?= =?UTF-8?q?=20has=20been=20changed=20from=20"Language"=20=20=20to=20"Audio?= =?UTF-8?q?",=20since=20it=20now=20also=20controls=20switching=20between?= =?UTF-8?q?=20normal=20and=20Dolby=20Digital=20=20=20audio=20tracks=20(see?= =?UTF-8?q?=20MANUAL=20for=20details).=20-=20The=20description=20of=20the?= =?UTF-8?q?=20audio=20tracks=20is=20now=20taken=20from=20the=20"component?= =?UTF-8?q?=20descriptors"=20=20=20that=20are=20broadcast=20in=20the=20EPG?= =?UTF-8?q?=20data.=20However=20(as=20no=20big=20surprise),=20not=20all=20?= =?UTF-8?q?channels=20=20=20actually=20provide=20useful=20data=20here,=20s?= =?UTF-8?q?o=20there=20are=20now=20some=20additional=20EPG=20bugfixes,=20?= =?UTF-8?q?=20=20which=20can=20be=20activated=20by=20setting=20the=20"EPG?= =?UTF-8?q?=20bugfix=20level"=20to=203.=20-=20The=20format=20of=20the=20'e?= =?UTF-8?q?pg.data'=20files=20has=20been=20extended=20by=20the=20new=20tag?= =?UTF-8?q?=20'X',=20which=20=20=20contains=20the=20stream=20components=20?= =?UTF-8?q?of=20an=20event=20(see=20man=20vdr(5)=20for=20details).=20-=20T?= =?UTF-8?q?he=20cStatus=20class=20now=20has=20the=20new=20member=20functio?= =?UTF-8?q?n=20SetAudioTrack(),=20which=20can=20be=20=20=20used=20to=20get?= =?UTF-8?q?=20notified=20when=20the=20audio=20track=20has=20been=20switche?= =?UTF-8?q?d,=20and=20the=20new=20member=20=20=20function=20SetAudioChanne?= =?UTF-8?q?l()=20which=20is=20called=20when=20the=20audio=20channel=20is?= =?UTF-8?q?=20changed.=20-=20Skins=20need=20to=20implement=20the=20new=20c?= =?UTF-8?q?SkinDisplayTrack=20class=20to=20display=20the=20audio=20=20=20t?= =?UTF-8?q?rack=20menu.=20-=20The=20ST:TNG=20skin=20now=20displays=20the?= =?UTF-8?q?=20current=20audio=20track=20description=20(if=20any)=20at=20th?= =?UTF-8?q?e=20=20=20botton=20left=20side.=20-=20The=20new=20setup=20optio?= =?UTF-8?q?n=20"DVB/Audio=20languages"=20can=20be=20used=20to=20control=20?= =?UTF-8?q?which=20audio=20=20=20language=20shall=20be=20selected=20in=20c?= =?UTF-8?q?ase=20a=20channel=20broadcasts=20in=20different=20languages=20?= =?UTF-8?q?=20=20(see=20MANUAL=20for=20details).=20-=20The=20"Left"=20and?= =?UTF-8?q?=20"Right"=20keys=20in=20the=20"Audio"=20menu=20can=20be=20used?= =?UTF-8?q?=20to=20switch=20between=20=20=20the=20left=20and=20right=20ste?= =?UTF-8?q?reo=20channels=20in=20case=20there=20are=20different=20audio=20?= =?UTF-8?q?tracks=20=20=20in=20these=20channels=20(see=20MANUAL=20for=20de?= =?UTF-8?q?tails).=20-=20Fixed=20a=20possible=20race=20condition=20in=20cD?= =?UTF-8?q?evice::Action()=20(thanks=20to=20Mattias=20Gr=C3=B6nlund).=20-?= =?UTF-8?q?=20Fixed=20the=20default=20quality=20value=20when=20grabbing=20?= =?UTF-8?q?a=20JPEG=20image=20(thanks=20to=20Patrick=20=20=20Gleichmann).?= =?UTF-8?q?=20-=20Fixed=20deleting=20a=20menu=20item=20in=20case=20the=20n?= =?UTF-8?q?ext=20item=20is=20not=20selectable=20(thanks=20to=20=20=20Dino?= =?UTF-8?q?=20Ravnic).=20-=20Implemented=20displaying=20mandatory=20subtit?= =?UTF-8?q?les=20in=20the=20SPU=20decoder=20(thanks=20to=20Marco=20=20=20S?= =?UTF-8?q?chl=C3=BC=C3=9Fler).=20-=20The=20setup=20option=20"Recording/Re?= =?UTF-8?q?cord=20Dolby=20Digital"=20has=20been=20renamed=20and=20moved=20?= =?UTF-8?q?to=20=20=20"DVB/Use=20Dolby=20Digital".=20It=20now=20controls?= =?UTF-8?q?=20whether=20Dolby=20Digital=20is=20recorded=20and=20=20=20whet?= =?UTF-8?q?her=20an=20available=20DD=20audio=20track=20will=20appear=20in?= =?UTF-8?q?=20the=20"Audio"=20menu.=20-=20Added=20support=20for=20circular?= =?UTF-8?q?=20polarization=20(thanks=20to=20Jonan=20Santiago).=20-=20Thank?= =?UTF-8?q?s=20to=20Werner=20Fink,=20Reinhard=20Nissl,=20Sascha=20Volkenan?= =?UTF-8?q?dt=20and=20Bj=C3=B8rnar=20Nilsen=20for=20=20=20their=20support?= =?UTF-8?q?=20in=20testing=20and=20fine=20tuning=20this=20version.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- menu.c | 271 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 232 insertions(+), 39 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index f482ad1..6f8ef28 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.320 2004/11/20 10:49:17 kls Exp $ + * $Id: menu.c 1.334 2005/01/09 13:04:49 kls Exp $ */ #include "menu.h" @@ -116,7 +116,7 @@ void cMenuEditSrcItem::Set(void) { if (source) { char *buffer = NULL; - asprintf(&buffer, "%s - %s", cSource::ToString(source->Code()), source->Description()); + asprintf(&buffer, "%s - %s", *cSource::ToString(source->Code()), source->Description()); SetValue(buffer); free(buffer); } @@ -249,7 +249,7 @@ cMenuEditChannel::cMenuEditChannel(cChannel *Channel, bool New) void cMenuEditChannel::Setup(void) { int current = Current(); - char type = *cSource::ToString(data.source); + char type = **cSource::ToString(data.source); #define ST(s) if (strchr(s, type)) Clear(); @@ -274,7 +274,7 @@ void cMenuEditChannel::Setup(void) Add(new cMenuEditIntItem( tr("Rid"), &data.rid, 0)); XXX*/ // Parameters for specific types of sources: - ST(" S ") Add(new cMenuEditChrItem( tr("Polarization"), &data.polarization, "hv")); + ST(" S ") Add(new cMenuEditChrItem( tr("Polarization"), &data.polarization, "hvlr")); ST("CS ") Add(new cMenuEditIntItem( tr("Srate"), &data.srate)); ST("CST") Add(new cMenuEditMapItem( tr("Inversion"), &data.inversion, InversionValues, tr("off"))); ST("CST") Add(new cMenuEditMapItem( tr("CoderateH"), &data.coderateH, CoderateValues, tr("none"))); @@ -300,7 +300,7 @@ eOSState cMenuEditChannel::ProcessKey(eKeys Key) data.name = strcpyrealloc(data.name, name); if (channel) { *channel = data; - isyslog("edited channel %d %s", channel->Number(), data.ToText()); + isyslog("edited channel %d %s", channel->Number(), *data.ToText()); state = osBack; } else { @@ -308,7 +308,7 @@ eOSState cMenuEditChannel::ProcessKey(eKeys Key) *channel = data; Channels.Add(channel); Channels.ReNumber(); - isyslog("added channel %d %s", channel->Number(), data.ToText()); + isyslog("added channel %d %s", channel->Number(), *data.ToText()); state = osUser1; } Channels.SetModified(true); @@ -737,9 +737,9 @@ void cMenuTimerItem::Set(void) asprintf(&buffer, "%c\t%d\t%s%s%s\t%02d:%02d\t%02d:%02d\t%s", !(timer->HasFlags(tfActive)) ? ' ' : timer->FirstDay() ? '!' : timer->Recording() ? '#' : '>', timer->Channel()->Number(), - timer->IsSingleEvent() ? WeekDayName(timer->StartTime()) : "", + timer->IsSingleEvent() ? *WeekDayName(timer->StartTime()) : "", timer->IsSingleEvent() ? " " : "", - timer->PrintDay(timer->Day()), + *timer->PrintDay(timer->Day()), timer->Start() / 100, timer->Start() % 100, timer->Stop() / 100, @@ -795,7 +795,7 @@ eOSState cMenuTimers::OnOff(void) RefreshCurrent(); DisplayCurrent(true); if (timer->FirstDay()) - isyslog("timer %d first day set to %s", timer->Index() + 1, timer->PrintFirstDay()); + isyslog("timer %d first day set to %s", timer->Index() + 1, *timer->PrintFirstDay()); else isyslog("timer %d %sactivated", timer->Index() + 1, timer->HasFlags(tfActive) ? "" : "de"); Timers.SetModified(); @@ -969,7 +969,7 @@ cMenuWhatsOnItem::cMenuWhatsOnItem(const cEvent *Event, cChannel *Channel) char t = Timers.GetMatch(Event, &TimerMatch) ? (TimerMatch == tmFull) ? 'T' : 't' : ' '; char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' '; char r = event->IsRunning() ? '*' : ' '; - asprintf(&buffer, "%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), 6, channel->ShortName(true), event->GetTimeString(), t, v, r, event->Title()); + asprintf(&buffer, "%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), 6, channel->ShortName(true), *event->GetTimeString(), t, v, r, event->Title()); SetText(buffer, false); } @@ -1087,7 +1087,7 @@ cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event) char t = Timers.GetMatch(Event, &TimerMatch) ? (TimerMatch == tmFull) ? 'T' : 't' : ' '; char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' '; char r = event->IsRunning() ? '*' : ' '; - asprintf(&buffer, "%.*s\t%s\t%c%c%c\t%s", 6, event->GetDateString(), event->GetTimeString(), t, v, r, event->Title()); + asprintf(&buffer, "%.*s\t%s\t%c%c%c\t%s", 6, *event->GetDateString(), *event->GetTimeString(), t, v, r, event->Title()); SetText(buffer, false); } @@ -1911,6 +1911,9 @@ eOSState cMenuSetupEPG::ProcessKey(eKeys Key) class cMenuSetupDVB : public cMenuSetupBase { private: + int originalNumAudioLanguages; + int numAudioLanguages; + void Setup(void); const char *updateChannelsTexts[5]; public: cMenuSetupDVB(void); @@ -1919,6 +1922,9 @@ public: cMenuSetupDVB::cMenuSetupDVB(void) { + for (numAudioLanguages = 0; numAudioLanguages < I18nNumLanguages && data.AudioLanguages[numAudioLanguages] >= 0; numAudioLanguages++) + ; + originalNumAudioLanguages = numAudioLanguages; updateChannelsTexts[0] = tr("no"); updateChannelsTexts[1] = tr("names only"); updateChannelsTexts[2] = tr("names and PIDs"); @@ -1926,22 +1932,59 @@ cMenuSetupDVB::cMenuSetupDVB(void) updateChannelsTexts[4] = tr("add new transponders"); SetSection(tr("DVB")); + Setup(); +} + +void cMenuSetupDVB::Setup(void) +{ + int current = Current(); + + Clear(); + Add(new cMenuEditIntItem( tr("Setup.DVB$Primary DVB interface"), &data.PrimaryDVB, 1, cDevice::NumDevices())); Add(new cMenuEditBoolItem(tr("Setup.DVB$Video format"), &data.VideoFormat, "4:3", "16:9")); + Add(new cMenuEditBoolItem(tr("Setup.DVB$Use Dolby Digital"), &data.UseDolbyDigital)); Add(new cMenuEditStraItem(tr("Setup.DVB$Update channels"), &data.UpdateChannels, 5, updateChannelsTexts)); + Add(new cMenuEditIntItem( tr("Setup.DVB$Audio languages"), &numAudioLanguages, 0, I18nNumLanguages)); + for (int i = 0; i < numAudioLanguages; i++) + Add(new cMenuEditStraItem(tr("Setup.EPG$Audio language"), &data.AudioLanguages[i], I18nNumLanguages, I18nLanguages())); + + SetCurrent(Get(current)); + Display(); } eOSState cMenuSetupDVB::ProcessKey(eKeys Key) { - int oldPrimaryDVB = Setup.PrimaryDVB; - bool oldVideoFormat = Setup.VideoFormat; + int oldPrimaryDVB = ::Setup.PrimaryDVB; + bool oldVideoFormat = ::Setup.VideoFormat; + int oldnumAudioLanguages = numAudioLanguages; eOSState state = cMenuSetupBase::ProcessKey(Key); + if (Key != kNone) { + if (numAudioLanguages != oldnumAudioLanguages) { + for (int i = oldnumAudioLanguages; i < numAudioLanguages; i++) { + data.AudioLanguages[i] = 0; + for (int l = 0; l < I18nNumLanguages; l++) { + int k; + for (k = 0; k < oldnumAudioLanguages; k++) { + if (data.AudioLanguages[k] == l) + break; + } + if (k >= oldnumAudioLanguages) { + data.AudioLanguages[i] = l; + break; + } + } + } + data.AudioLanguages[numAudioLanguages] = -1; + Setup(); + } + } if (state == osBack && Key == kOk) { - if (Setup.PrimaryDVB != oldPrimaryDVB) + if (::Setup.PrimaryDVB != oldPrimaryDVB) state = osSwitchDvb; - if (Setup.VideoFormat != oldVideoFormat) - cDevice::PrimaryDevice()->SetVideoFormat(Setup.VideoFormat); + if (::Setup.VideoFormat != oldVideoFormat) + cDevice::PrimaryDevice()->SetVideoFormat(::Setup.VideoFormat); } return state; } @@ -2111,7 +2154,6 @@ cMenuSetupRecord::cMenuSetupRecord(void) Add(new cMenuEditBoolItem(tr("Setup.Recording$Mark instant recording"), &data.MarkInstantRecord)); Add(new cMenuEditStrItem( tr("Setup.Recording$Name instant recording"), data.NameInstantRecord, sizeof(data.NameInstantRecord), tr(FileNameChars))); Add(new cMenuEditIntItem( tr("Setup.Recording$Instant rec. time (min)"), &data.InstantRecordTime, 1, MAXINSTANTRECTIME)); - Add(new cMenuEditBoolItem(tr("Setup.Recording$Record Dolby Digital"), &data.RecordDolbyDigital)); Add(new cMenuEditIntItem( tr("Setup.Recording$Max. video file size (MB)"), &data.MaxVideoFileSize, MINVIDEOFILESIZE, MAXVIDEOFILESIZE)); Add(new cMenuEditBoolItem(tr("Setup.Recording$Split edited files"), &data.SplitEditedFiles)); } @@ -2410,7 +2452,7 @@ void cMenuMain::Set(const char *Plugin) // Color buttons: - SetHelp(!replaying ? tr("Record") : NULL, cDevice::PrimaryDevice()->NumAudioTracks() > 1 ? tr("Language") : NULL, replaying ? NULL : tr("Pause"), replaying ? tr("Button$Stop") : cReplayControl::LastReplayed() ? tr("Resume") : NULL); + SetHelp(!replaying ? tr("Record") : NULL, cDevice::PrimaryDevice()->NumAudioTracks() > 1 ? tr("Audio") : NULL, replaying ? NULL : tr("Pause"), replaying ? tr("Button$Stop") : cReplayControl::LastReplayed() ? tr("Resume") : NULL); Display(); lastActivity = time(NULL); } @@ -2471,13 +2513,8 @@ eOSState cMenuMain::ProcessKey(eKeys Key) state = replaying ? osContinue : osRecord; break; case kGreen: if (!HadSubMenu) { - int CurrentAudioTrack = -1; - const char **AudioTracks = cDevice::PrimaryDevice()->GetAudioTracks(&CurrentAudioTrack); - if (AudioTracks) { - const char **at = &AudioTracks[CurrentAudioTrack]; - if (!*++at) - at = AudioTracks; - cDevice::PrimaryDevice()->SetAudioTrack(at - AudioTracks); + if (cDevice::PrimaryDevice()->NumAudioTracks() > 1) { + cRemote::Put(kAudio, true); state = osEnd; } } @@ -2504,6 +2541,40 @@ eOSState cMenuMain::ProcessKey(eKeys Key) return state; } +// --- SetTrackDescriptions -------------------------------------------------- + +static void SetTrackDescriptions(void) +{ + cDevice::PrimaryDevice()->ClrAvailableTracks(true); + cChannel *Channel = Channels.GetByNumber(cDevice::CurrentChannel()); + if (Channel) { + cSchedulesLock SchedulesLock; + const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); + if (Schedules) { + const cSchedule *Schedule = Schedules->GetSchedule(Channel->GetChannelID()); + if (Schedule) { + const cEvent *Present = Schedule->GetPresentEvent(true); + if (Present) { + const cComponents *Components = Present->Components(); + if (Components) { + int indexAudio = 0; + int indexDolby = 0; + for (int i = 0; i < Components->NumComponents(); i++) { + const tComponent *p = Components->Component(i); + if (p->stream == 2) { + if (p->type == 0x05) + cDevice::PrimaryDevice()->SetAvailableTrack(ttDolby, indexDolby++, 0, NULL, p->description); + else + cDevice::PrimaryDevice()->SetAvailableTrack(ttAudio, indexAudio++, 0, NULL, p->description); + } + } + } + } + } + } + } +} + // --- cDisplayChannel ------------------------------------------------------- #define DIRECTCHANNELTIMEOUT 1000 //ms @@ -2523,7 +2594,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched) DisplayInfo(); displayChannel->Flush(); } - lastTime = time_ms(); + lastTime.Set(); } cDisplayChannel::cDisplayChannel(eKeys FirstKey) @@ -2532,7 +2603,7 @@ cDisplayChannel::cDisplayChannel(eKeys FirstKey) group = -1; number = 0; lastPresent = lastFollowing = NULL; - lastTime = time_ms(); + lastTime.Set(); withInfo = Setup.ShowInfoOnChSwitch; displayChannel = Skins.Current()->DisplayChannel(withInfo); ProcessKey(FirstKey); @@ -2562,6 +2633,7 @@ void cDisplayChannel::DisplayInfo(void) const cEvent *Present = Schedule->GetPresentEvent(true); const cEvent *Following = Schedule->GetFollowingEvent(true); if (Present != lastPresent || Following != lastFollowing) { + SetTrackDescriptions(); displayChannel->SetEvents(Present, Following); cStatus::MsgOsdProgramme(Present ? Present->StartTime() : 0, Present ? Present->Title() : NULL, Present ? Present->ShortText() : NULL, Following ? Following->StartTime() : 0, Following ? Following->Title() : NULL, Following ? Following->ShortText() : NULL); lastPresent = Present; @@ -2577,7 +2649,7 @@ void cDisplayChannel::Refresh(void) channel = Channels.GetByNumber(cDevice::CurrentChannel()); DisplayChannel(); displayChannel->SetEvents(NULL, NULL); - lastTime = time_ms(); + lastTime.Set(); } eOSState cDisplayChannel::ProcessKey(eKeys Key) @@ -2597,7 +2669,7 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) displayChannel->SetEvents(NULL, NULL); withInfo = false; DisplayChannel(); - lastTime = time_ms(); + lastTime.Set(); // Lets see if there can be any useful further input: int n = channel ? number * 10 : 0; cChannel *ch = channel; @@ -2646,7 +2718,7 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) group = -1; } } - lastTime = time_ms(); + lastTime.Set(); break; case kUp|k_Repeat: case kUp: @@ -2663,14 +2735,14 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) Refresh(); break; case kNone: - if (number && time_ms() - lastTime > DIRECTCHANNELTIMEOUT) { + if (number && lastTime.Elapsed() > DIRECTCHANNELTIMEOUT) { if (Channels.GetByNumber(number)) Channels.SwitchTo(number); else { number = 0; channel = NULL; DisplayChannel(); - lastTime = time_ms(); + lastTime.Set(); return osContinue; } return osEnd; @@ -2694,7 +2766,7 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) return osEnd; } }; - if (time_ms() - lastTime < INFOTIMEOUT) { + if (lastTime.Elapsed() < INFOTIMEOUT) { if (!number && group < 0 && channel && channel->Number() != cDevice::CurrentChannel()) Refresh(); // makes sure a channel switch through the SVDRP CHAN command is displayed DisplayInfo(); @@ -2715,7 +2787,7 @@ cDisplayVolume::cDisplayVolume(void) :cOsdObject(true) { currentDisplayVolume = this; - timeout = time_ms() + (cDevice::PrimaryDevice()->IsMute() ? MUTETIMEOUT : VOLUMETIMEOUT); + timeout.Set(cDevice::PrimaryDevice()->IsMute() ? MUTETIMEOUT : VOLUMETIMEOUT); displayVolume = Skins.Current()->DisplayVolume(); Show(); } @@ -2752,15 +2824,15 @@ eOSState cDisplayVolume::ProcessKey(eKeys Key) case kVolDn|k_Repeat: case kVolDn: Show(); - timeout = time_ms() + VOLUMETIMEOUT; + timeout.Set(VOLUMETIMEOUT); break; case kMute: if (cDevice::PrimaryDevice()->IsMute()) { Show(); - timeout = time_ms() + MUTETIMEOUT; + timeout.Set(MUTETIMEOUT); } else - timeout = 0; + timeout.Set(); break; case kNone: break; default: if ((Key & k_Release) == 0) { @@ -2768,7 +2840,128 @@ eOSState cDisplayVolume::ProcessKey(eKeys Key) return osEnd; } } - return time_ms() < timeout ? osContinue : osEnd; + return timeout.TimedOut() ? osEnd : osContinue; +} + +// --- cDisplayTracks -------------------------------------------------------- + +#define TRACKTIMEOUT 5000 //ms + +cDisplayTracks *cDisplayTracks::currentDisplayTracks = NULL; + +cDisplayTracks::cDisplayTracks(void) +:cOsdObject(true) +{ + // Get the actual audio track descriptions from the EPG if we're not replaying: + if (!cDevice::PrimaryDevice()->Replaying() || cTransferControl::ReceiverDevice()) + SetTrackDescriptions(); + currentDisplayTracks = this; + numTracks = track = 0; + audioChannel = cDevice::PrimaryDevice()->GetAudioChannel(); + eTrackType CurrentAudioTrack = cDevice::PrimaryDevice()->GetCurrentAudioTrack(); + for (int i = ttAudioFirst; i <= ttDolbyLast; i++) { + const tTrackId *TrackId = cDevice::PrimaryDevice()->GetTrack(eTrackType(i)); + if (TrackId && TrackId->id) { + types[numTracks] = eTrackType(i); + descriptions[numTracks] = strdup(*TrackId->description ? TrackId->description : *TrackId->language ? TrackId->language : *itoa(i)); + if (i == CurrentAudioTrack) + track = numTracks; + numTracks++; + } + } + timeout.Set(TRACKTIMEOUT); + displayTracks = Skins.Current()->DisplayTracks(tr("Audio"), numTracks, descriptions); + Show(); +} + +cDisplayTracks::~cDisplayTracks() +{ + delete displayTracks; + currentDisplayTracks = NULL; + for (int i = 0; i < numTracks; i++) + free(descriptions[i]); + cStatus::MsgOsdClear(); +} + +void cDisplayTracks::Show(void) +{ + int ac = IS_AUDIO_TRACK(types[track]) ? audioChannel : -1; + displayTracks->SetTrack(track, descriptions); + displayTracks->SetAudioChannel(ac); + displayTracks->Flush(); + cStatus::MsgSetAudioTrack(track, descriptions); + cStatus::MsgSetAudioChannel(ac); +} + +cDisplayTracks *cDisplayTracks::Create(void) +{ + if (cDevice::PrimaryDevice()->NumAudioTracks() > 0) { + if (!currentDisplayTracks) + new cDisplayTracks; + return currentDisplayTracks; + } + Skins.Message(mtWarning, tr("No audio available!")); + return NULL; +} + +void cDisplayTracks::Process(eKeys Key) +{ + if (currentDisplayTracks) + currentDisplayTracks->ProcessKey(Key); +} + +eOSState cDisplayTracks::ProcessKey(eKeys Key) +{ + int oldTrack = track; + int oldAudioChannel = audioChannel; + switch (Key) { + case kUp|k_Repeat: + case kUp: + case kDown|k_Repeat: + case kDown: + if (NORMALKEY(Key) == kUp && track > 0) + track--; + else if (NORMALKEY(Key) == kDown && track < numTracks - 1) + track++; + timeout.Set(TRACKTIMEOUT); + break; + case kLeft|k_Repeat: + case kLeft: + case kRight|k_Repeat: + case kRight: if (IS_AUDIO_TRACK(types[track])) { + static int ac[] = { 1, 0, 2 }; + audioChannel = ac[cDevice::PrimaryDevice()->GetAudioChannel()]; + if (NORMALKEY(Key) == kLeft && audioChannel > 0) + audioChannel--; + else if (NORMALKEY(Key) == kRight && audioChannel < 2) + audioChannel++; + audioChannel = ac[audioChannel]; + timeout.Set(TRACKTIMEOUT); + } + break; + case kAudio: + if (++track >= numTracks) + track = 0; + timeout.Set(TRACKTIMEOUT); + break; + case kOk: + if (track != cDevice::PrimaryDevice()->GetCurrentAudioTrack()) + oldTrack = -1; // make sure we explicitly switch to that track + timeout.Set(); + break; + case kNone: break; + default: if ((Key & k_Release) == 0) + return osEnd; + } + if (track != oldTrack || audioChannel != oldAudioChannel) + Show(); + if (track != oldTrack) { + cDevice::PrimaryDevice()->SetCurrentAudioTrack(types[track]); + Setup.CurrentDolby = IS_DOLBY_TRACK(types[track]); + } + if (audioChannel != oldAudioChannel) + cDevice::PrimaryDevice()->SetAudioChannel(audioChannel); + return timeout.TimedOut() ? osEnd : osContinue; } // --- cRecordControl -------------------------------------------------------- @@ -2826,7 +3019,7 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause) isyslog("record %s", fileName); if (MakeDirs(fileName, true)) { const cChannel *ch = timer->Channel(); - recorder = new cRecorder(fileName, ch->Ca(), timer->Priority(), ch->Vpid(), ch->Apid1(), ch->Apid2(), ch->Dpid1(), ch->Dpid2()); + recorder = new cRecorder(fileName, ch->Ca(), timer->Priority(), ch->Vpid(), ch->Apid(0), ch->Apid(1), ch->Dpid(0), ch->Dpid(1)); if (device->AttachReceiver(recorder)) { Recording.WriteSummary(); cStatus::MsgRecording(device, Recording.Name()); -- cgit v1.2.3