From 13817c785fcf2589f857b169fd9af9e428dc64b5 Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 1 Nov 2014 10:23:34 +0100 Subject: added {channelname}, {channelid}, {channellogoexists} for all schedules list and current views --- HISTORY | 1 + displaymenu.c | 15 ++++++++------- skins/metrixhd/xmlfiles/displaymenuschedules.xml | 7 +++++-- skinskeleton/xmlfiles/displaymenuschedules.xml | 7 +++++-- views/displaymenuitemcurrentview.c | 5 ++++- views/displaymenuitemview.c | 5 ++++- views/displaymenurootview.h | 1 + views/displaymenuview.c | 5 +++-- views/displaymenuview.h | 2 ++ 9 files changed, 33 insertions(+), 15 deletions(-) diff --git a/HISTORY b/HISTORY index 35945a8..81551b4 100644 --- a/HISTORY +++ b/HISTORY @@ -47,5 +47,6 @@ Version 0.0.3 - changed skin metrixHD to display bitrate infos - added "active" Token for cutting marks so that a mark can be displayed in a dedicated way if current position in replay exactly hits the mark +- added {channelname}, {channelid}, {channellogoexists} for all schedules list and current views diff --git a/displaymenu.c b/displaymenu.c index 9f0e97e..d9ec692 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -81,17 +81,18 @@ bool cSDDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current, return false; if (config.blockFlush) rootView->LockFlush(); - if (Current) { - if (Channel) { - rootView->SetChannel(Channel); - } else if (Event) { - rootView->SetChannel(Channels.GetByChannelID(Event->ChannelID())); - } + const cChannel *channel = Channel; + if (!channel) { + channel = rootView->GetChannel(); + } + if (!channel && Event) { + channel = Channels.GetByChannelID(Event->ChannelID()); + rootView->SetChannel(channel); } cDisplayMenuListView *list = rootView->GetListView(); if (!list) return false; - list->AddSchedulesMenuItem(Index, Event, Channel, TimerMatch, MenuCategory(), Current, Selectable); + list->AddSchedulesMenuItem(Index, Event, channel, TimerMatch, MenuCategory(), Current, Selectable); if (state == vsIdle) state = vsMenuUpdate; return true; diff --git a/skins/metrixhd/xmlfiles/displaymenuschedules.xml b/skins/metrixhd/xmlfiles/displaymenuschedules.xml index b28471e..42169eb 100644 --- a/skins/metrixhd/xmlfiles/displaymenuschedules.xml +++ b/skins/metrixhd/xmlfiles/displaymenuschedules.xml @@ -40,8 +40,9 @@ {durationminutes} duration, rest of minutes {current} true if item is currently selected {separator} true if item is a list separator - {channelname} Channel Name (for what's on now and next) - {channelid} ChannelID as path to display channel logo (for what's on now and next) + {channelname} Channel Name + {channelid} ChannelID as path to display channel logo + {channellogoexists} true if a channel logo exists {whatson} true if menu "What's on" is displayed {whatsonnow} true if menu "What's on now" is displayed {whatsonnext} true if menu "What's on next" is displayed @@ -124,7 +125,9 @@ {duration} duration of event {durationhours} duration, full hours {durationminutes} duration, rest of minutes + {channelname} Channel Name {channelid} ChannelID as path to display channel logo + {channellogoexists} true if a channel logo exists {hasposter} true if a scraped poster is available for this element {posterwidth} width of scraped poster {posterheight} height of scraped poster diff --git a/skinskeleton/xmlfiles/displaymenuschedules.xml b/skinskeleton/xmlfiles/displaymenuschedules.xml index 5864fcf..4b6b20d 100644 --- a/skinskeleton/xmlfiles/displaymenuschedules.xml +++ b/skinskeleton/xmlfiles/displaymenuschedules.xml @@ -34,8 +34,9 @@ {durationminutes} duration, rest of minutes {current} true if item is currently selected {separator} true if item is a list separator - {channelname} Channel Name (for what's on now and next) - {channelid} ChannelID as path to display channel logo (for what's on now and next) + {channelname} Channel Name + {channelid} ChannelID as path to display channel logo + {channellogoexists} true if a channel logo exists {whatson} true if menu "What's on" is displayed {whatsonnow} true if menu "What's on now" is displayed {whatsonnext} true if menu "What's on next" is displayed @@ -65,7 +66,9 @@ {duration} duration of event {durationhours} duration, full hours {durationminutes} duration, rest of minutes + {channelname} Channel Name {channelid} ChannelID as path to display channel logo + {channellogoexists} true if a channel logo exists {hasposter} true if a scraped poster is available for this element {posterwidth} width of scraped poster {posterheight} height of scraped poster diff --git a/views/displaymenuitemcurrentview.c b/views/displaymenuitemcurrentview.c index 312b041..ce9fb22 100644 --- a/views/displaymenuitemcurrentview.c +++ b/views/displaymenuitemcurrentview.c @@ -165,7 +165,10 @@ void cDisplayMenuItemCurrentSchedulesView::Render(void) { SetScraperPoster(event); } if (channel) { - stringTokens.insert(pair("channelid", *(channel->GetChannelID().ToString()))); + stringTokens.insert(pair("channelname", channel->Name() ? channel->Name() : "")); + string channelID = *(channel->GetChannelID().ToString()); + stringTokens.insert(pair("channelid", channelID)); + intTokens.insert(pair("channellogoexists", imgCache->LogoExists(channelID))); } vector< map > schedulesTokens; diff --git a/views/displaymenuitemview.c b/views/displaymenuitemview.c index 5e995c5..67fd641 100644 --- a/views/displaymenuitemview.c +++ b/views/displaymenuitemview.c @@ -333,13 +333,16 @@ void cDisplayMenuItemSchedulesView::SetTokens(void) { } if (channel) { stringTokens.insert(pair("channelname", channel->Name() ? channel->Name() : "")); - stringTokens.insert(pair("channelid", *(channel->GetChannelID().ToString()))); + string channelID = *(channel->GetChannelID().ToString()); + stringTokens.insert(pair("channelid", channelID)); + intTokens.insert(pair("channellogoexists", imgCache->LogoExists(channelID))); if (!event && !selectable) { stringTokens.insert(pair("title", channel->Name() ? ParseSeparator(channel->Name()) : "")); } } else { stringTokens.insert(pair("channelname", "")); stringTokens.insert(pair("channelid", "")); + intTokens.insert(pair("channellogoexists", 0)); } } diff --git a/views/displaymenurootview.h b/views/displaymenurootview.h index 0852570..5b491e5 100644 --- a/views/displaymenurootview.h +++ b/views/displaymenurootview.h @@ -36,6 +36,7 @@ public: void SetMenu(eMenuCategory menuCat, bool menuInit); void SetTitle(const char *title); void SetChannel(const cChannel *channel) { view->SetChannel(channel); }; + const cChannel *GetChannel(void) { return view->GetChannel(); }; void SetButtonTexts(const char *Red, const char *Green, const char *Yellow, const char *Blue); void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5); void SetMessage(eMessageType type, const char *text); diff --git a/views/displaymenuview.c b/views/displaymenuview.c index f5a841c..5a54628 100644 --- a/views/displaymenuview.c +++ b/views/displaymenuview.c @@ -432,8 +432,9 @@ bool cDisplayMenuSchedulesView::DrawHeader(void) { if (channel) { stringTokens.insert(pair("channelnumber", *cString::sprintf("%d", channel->Number()))); stringTokens.insert(pair("channelname", channel->Name())); - stringTokens.insert(pair("channelid", *(channel->GetChannelID().ToString()))); - + string channelID = *(channel->GetChannelID().ToString()); + stringTokens.insert(pair("channelid", channelID)); + intTokens.insert(pair("channellogoexists", imgCache->LogoExists(channelID))); } bool hasIcon = false; string icon = imgCache->GetIconName(menuTitle, cat); diff --git a/views/displaymenuview.h b/views/displaymenuview.h index 34fed44..3247c76 100644 --- a/views/displaymenuview.h +++ b/views/displaymenuview.h @@ -17,6 +17,7 @@ public: void SetMenuCat(eMenuCategory newCat) { cat = newCat; }; void SetTitle(const char *title) {menuTitle = title; }; virtual void SetChannel(const cChannel *channel) {}; + virtual const cChannel *GetChannel(void) { return NULL; }; void SetButtonTexts(string *buttonTexts) { this->buttonTexts = buttonTexts; }; bool DrawBackground(void); virtual bool DrawHeader(void); @@ -51,6 +52,7 @@ public: cDisplayMenuSchedulesView(cTemplateView *tmplView, eMenuCategory menuCat, bool menuInit); virtual ~cDisplayMenuSchedulesView(); void SetChannel(const cChannel *channel) { this->channel = channel; }; + const cChannel *GetChannel(void) { return channel; }; bool DrawHeader(void); }; -- cgit v1.2.3 From f9f2c47cb258874dcdd75bd2154a60c65f068657 Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 1 Nov 2014 13:03:52 +0100 Subject: added printf function for --- HISTORY | 1 + libtemplate/parameter.h | 4 +- libtemplate/templatefunction.c | 93 ++++++++++++++++++++++- libtemplate/templatefunction.h | 2 + skins/metrixhd/xmlfiles/displaymenurecordings.xml | 4 +- 5 files changed, 99 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index 81551b4..ad4ef68 100644 --- a/HISTORY +++ b/HISTORY @@ -48,5 +48,6 @@ Version 0.0.3 - added "active" Token for cutting marks so that a mark can be displayed in a dedicated way if current position in replay exactly hits the mark - added {channelname}, {channelid}, {channellogoexists} for all schedules list and current views +- added printf function for , see Wiki for documentation diff --git a/libtemplate/parameter.h b/libtemplate/parameter.h index 914f3fc..c055560 100644 --- a/libtemplate/parameter.h +++ b/libtemplate/parameter.h @@ -83,13 +83,15 @@ public: enum eTextTokenType { ttConstString, ttToken, - ttConditionalToken + ttConditionalToken, + ttPrintfToken }; class cTextToken { public: eTextTokenType type; string value; + vector parameters; vector subTokens; }; diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 4b0c66f..df3e653 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -844,7 +844,9 @@ bool cTemplateFunction::SetTextTokens(string value) { //search for conditional token or normal token size_t tokenStart = value.find_first_of('{'); size_t conditionStart = value.find_first_of('|'); + size_t printfStart = value.find("{printf("); if (tokenStart == string::npos && conditionStart == string::npos) { + //find constant strings if (value.size() > 0) { cTextToken token; token.type = ttConstString; @@ -855,12 +857,25 @@ bool cTemplateFunction::SetTextTokens(string value) { continue; } else if (tokenStart != string::npos && conditionStart == string::npos) { size_t tokenEnd = value.find_first_of('}'); - ParseTextToken(value, tokenStart, tokenEnd); + if (printfStart != string::npos && printfStart <= tokenStart) { + //replace printf text token + ParsePrintfTextToken(value, printfStart, tokenEnd); + } else { + //replace normal text token + ParseTextToken(value, tokenStart, tokenEnd); + } } else if (tokenStart != string::npos && conditionStart != string::npos) { if (tokenStart < conditionStart) { size_t tokenEnd = value.find_first_of('}'); - ParseTextToken(value, tokenStart, tokenEnd); + if (printfStart != string::npos && printfStart <= tokenStart) { + //replace printf text token + ParsePrintfTextToken(value, printfStart, tokenEnd); + } else { + //replace normal text token + ParseTextToken(value, tokenStart, tokenEnd); + } } else { + //replace conditional text token size_t conditionEnd = value.find_first_of('|', conditionStart+1); ParseConditionalTextToken(value, conditionStart, conditionEnd); } @@ -931,6 +946,26 @@ void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, s } +void cTemplateFunction::ParsePrintfTextToken(string &value, size_t start, size_t end) { + cTextToken token; + token.type = ttPrintfToken; + //fetch parameter list from printf + string printfParams = value.substr(start + 8, end - start - 9); + value = value.replace(0, end - start + 1, ""); + splitstring s(printfParams.c_str()); + vector flds = s.split(',', 1); + + int numParams = flds.size(); + if (numParams < 1) + return; + string formatString = trim(flds[0]); + token.value = formatString.substr(1, formatString.size() - 2); + for (int i=1; i < numParams; i++) { + token.parameters.push_back(trim(flds[i])); + } + textTokens.push_back(token); +} + bool cTemplateFunction::SetScrollMode(string value) { eScrollMode mode = smNone; bool ok = true; @@ -1063,6 +1098,45 @@ void cTemplateFunction::ParseStringParameters(void) { found = true; } } + } else if ((*it).type == ttPrintfToken) { + cTextToken token = *it; + int paramCount = token.parameters.size(); + string printfResult = ""; + switch (paramCount) { + case 1: { + int param1 = ReplaceIntToken(token.parameters[0]); + printfResult = *cString::sprintf(token.value.c_str(), param1); + break; } + case 2: { + int param1 = ReplaceIntToken(token.parameters[0]); + int param2 = ReplaceIntToken(token.parameters[1]); + printfResult = *cString::sprintf(token.value.c_str(), param1, param2); + break; } + case 3: { + int param1 = ReplaceIntToken(token.parameters[0]); + int param2 = ReplaceIntToken(token.parameters[1]); + int param3 = ReplaceIntToken(token.parameters[2]); + printfResult = *cString::sprintf(token.value.c_str(), param1, param2, param3); + break; } + case 4: { + int param1 = ReplaceIntToken(token.parameters[0]); + int param2 = ReplaceIntToken(token.parameters[1]); + int param3 = ReplaceIntToken(token.parameters[2]); + int param4 = ReplaceIntToken(token.parameters[3]); + printfResult = *cString::sprintf(token.value.c_str(), param1, param2, param3, param4); + break; } + case 5: { + int param1 = ReplaceIntToken(token.parameters[0]); + int param2 = ReplaceIntToken(token.parameters[1]); + int param3 = ReplaceIntToken(token.parameters[2]); + int param4 = ReplaceIntToken(token.parameters[3]); + int param5 = ReplaceIntToken(token.parameters[4]); + printfResult = *cString::sprintf(token.value.c_str(), param1, param2, param3, param4, param5); + break; } + default: + break; + } + text << printfResult; } } parsedText = text.str(); @@ -1239,6 +1313,21 @@ int cTemplateFunction::CalculateTextBoxHeight(void) { return ((textLinesTall+textLinesFull) * fontHeight); } +int cTemplateFunction::ReplaceIntToken(string intTok) { + if (intTokens) { + map::iterator hit = intTokens->find(intTok); + if (hit != intTokens->end()) + return hit->second; + } + if (stringTokens) { + map::iterator hit = stringTokens->find(intTok); + if (hit != stringTokens->end()) { + return atoi(hit->second.c_str()); + } + } + return 0; +} + /******************************************************************* * Helper Functions *******************************************************************/ diff --git a/libtemplate/templatefunction.h b/libtemplate/templatefunction.h index b6c2d53..2af95dd 100644 --- a/libtemplate/templatefunction.h +++ b/libtemplate/templatefunction.h @@ -143,6 +143,7 @@ protected: bool SetTextTokens(string value); void ParseTextToken(string &value, size_t start, size_t end); void ParseConditionalTextToken(string &value, size_t start, size_t end); + void ParsePrintfTextToken(string &value, size_t start, size_t end); bool SetScrollMode(string value); bool SetScrollSpeed(string value); bool SetOrientation(string value); @@ -152,6 +153,7 @@ protected: void ParseNumericalParameters(void); void CalculateAlign(int elementWidth, int elementHeight); int CalculateTextBoxHeight(void); + int ReplaceIntToken(string intTok); public: cTemplateFunction(eFuncType type); virtual ~cTemplateFunction(void); diff --git a/skins/metrixhd/xmlfiles/displaymenurecordings.xml b/skins/metrixhd/xmlfiles/displaymenurecordings.xml index 8bae97a..1acad74 100644 --- a/skins/metrixhd/xmlfiles/displaymenurecordings.xml +++ b/skins/metrixhd/xmlfiles/displaymenurecordings.xml @@ -3,7 +3,7 @@ - + -- cgit v1.2.3 From f9f68cae8d64f5c60ffaa34118b66f5ebab28506 Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 1 Nov 2014 13:19:07 +0100 Subject: removed code for displaying bitrates in displaychannel again --- HISTORY | 1 + Makefile | 1 - config.c | 2 - config.h | 1 - displaychannel.c | 3 - dtd/displaychannel.dtd | 7 +- libcore/femonreceiver.c | 184 ----------------------------- libcore/femonreceiver.h | 53 --------- libtemplate/templateview.c | 6 - libtemplate/templateviewelement.h | 1 - skins/metrixhd/xmlfiles/displaychannel.xml | 18 +-- skinskeleton/xmlfiles/displaychannel.xml | 9 -- views/displaychannelview.c | 28 ----- views/displaychannelview.h | 2 - views/viewhelpers.c | 72 ----------- views/viewhelpers.h | 13 +- 16 files changed, 5 insertions(+), 396 deletions(-) delete mode 100644 libcore/femonreceiver.c delete mode 100644 libcore/femonreceiver.h diff --git a/HISTORY b/HISTORY index ad4ef68..059fdcf 100644 --- a/HISTORY +++ b/HISTORY @@ -49,5 +49,6 @@ Version 0.0.3 in replay exactly hits the mark - added {channelname}, {channelid}, {channellogoexists} for all schedules list and current views - added printf function for , see Wiki for documentation +- removed code for displaying bitrates in displaychannel again because of incompatibility with dvbapi Plugin diff --git a/Makefile b/Makefile index 2160ae6..2be7976 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,6 @@ OBJS = $(PLUGIN).o \ libcore/recfolderinfo.o \ libcore/extrecinfo.o \ libcore/timers.o \ - libcore/femonreceiver.o \ libtemplate/globals.o \ libtemplate/parameter.o \ libtemplate/template.o \ diff --git a/config.c b/config.c index a3ec23d..4ef6964 100644 --- a/config.c +++ b/config.c @@ -23,8 +23,6 @@ cDesignerConfig::cDesignerConfig() { //menu display style, display menu items //one after each other or in one step blockFlush = 1; - //interval for femon receiver to recalculate bitrates in tenth of a second - bitrateCalcInterval = 10; //remember current skin and theme, osd size and osd fonts SetSkin(); SetOSDSize(); diff --git a/config.h b/config.h index 9c5429e..7773208 100644 --- a/config.h +++ b/config.h @@ -61,7 +61,6 @@ public: int rerunDistance; int rerunMaxChannel; int blockFlush; - int bitrateCalcInterval; }; #ifdef DEFINE_CONFIG diff --git a/displaychannel.c b/displaychannel.c index 5d2701a..607679b 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -159,7 +159,6 @@ void cSDDisplayChannel::SetMessage(eMessageType Type, const char *Text) { channelView->ClearSignalBackground(); channelView->ClearScraperContent(); channelView->ClearAudioInfo(); - channelView->ClearBitrates(); channelView->DisplayMessage(Type, Text); groupSep = true; } @@ -187,14 +186,12 @@ void cSDDisplayChannel::Flush(void) { channelView->DrawSignal(); channelView->DrawAudioInfo(); channelView->DrawDevices(initial); - channelView->DrawBitrates(); } else { channelView->ClearStatusIcons(); channelView->ClearScreenResolution(); channelView->ClearSignal(); channelView->ClearSignalBackground(); channelView->ClearDevices(); - channelView->DrawBitrates(); } if (initial) { diff --git a/dtd/displaychannel.dtd b/dtd/displaychannel.dtd index f3b76ab..a99e87e 100644 --- a/dtd/displaychannel.dtd +++ b/dtd/displaychannel.dtd @@ -4,7 +4,7 @@ - - - -#include "../config.h" -#include "femonreceiver.h" - -cFemonReceiver::cFemonReceiver(const cChannel *Channel, int ATrack, int DTrack) - : cReceiver(Channel), - cThread("femon receiver"), - m_Mutex(), - m_Sleep(), - m_Active(false), - m_VideoBuffer(KILOBYTE(512), TS_SIZE, false, "Femon video"), - m_VideoType(Channel ? Channel->Vtype(): 0), - m_VideoPid(Channel ? Channel->Vpid() : 0), - m_VideoPacketCount(0), - m_AudioBuffer(KILOBYTE(256), TS_SIZE, false, "Femon audio"), - m_AudioPid(Channel ? Channel->Apid(ATrack) : 0), - m_AudioPacketCount(0), - m_AC3Buffer(KILOBYTE(256), TS_SIZE, false, "Femon AC3"), - m_AC3Pid(Channel ? Channel->Dpid(DTrack) : 0), - m_AC3PacketCount(0) -{ - SetPids(NULL); - AddPid(m_VideoPid); - AddPid(m_AudioPid); - AddPid(m_AC3Pid); - - m_VideoBuffer.SetTimeouts(0, 100); - m_AudioBuffer.SetTimeouts(0, 100); - m_AC3Buffer.SetTimeouts(0, 100); - - m_VideoBitrate = 0.0; - m_AudioBitrate = 0.0; - m_AC3Bitrate = 0.0; -} - -cFemonReceiver::~cFemonReceiver(void) -{ - Deactivate(); -} - -void cFemonReceiver::Deactivate(void) -{ - Detach(); - if (m_Active) { - m_Active = false; - m_Sleep.Signal(); - if (Running()) - Cancel(3); - } -} - -void cFemonReceiver::Activate(bool On) -{ - if (On) - Start(); - else - Deactivate(); -} - -void cFemonReceiver::Receive(uchar *Data, int Length) -{ - // TS packet length: TS_SIZE - if (Running() && (*Data == TS_SYNC_BYTE) && (Length == TS_SIZE)) { - int len, pid = TsPid(Data); - if (pid == m_VideoPid) { - ++m_VideoPacketCount; - len = m_VideoBuffer.Put(Data, Length); - if (len != Length) { - m_VideoBuffer.ReportOverflow(Length - len); - m_VideoBuffer.Clear(); - } - } - else if (pid == m_AudioPid) { - ++m_AudioPacketCount; - len = m_AudioBuffer.Put(Data, Length); - if (len != Length) { - m_AudioBuffer.ReportOverflow(Length - len); - m_AudioBuffer.Clear(); - } - } - else if (pid == m_AC3Pid) { - ++m_AC3PacketCount; - len = m_AC3Buffer.Put(Data, Length); - if (len != Length) { - m_AC3Buffer.ReportOverflow(Length - len); - m_AC3Buffer.Clear(); - } - } - } -} - -void cFemonReceiver::Action(void) -{ - cTimeMs calcPeriod(0); - m_Active = true; - bool init = true; - while (Running() && m_Active) { - uint8_t *Data; - double timeout; - int Length; - bool processed = false; - - // process available video data - while ((Data = m_VideoBuffer.Get(Length))) { - if (!m_Active || (Length < TS_SIZE)) - break; - Length = TS_SIZE; - if (*Data != TS_SYNC_BYTE) { - for (int i = 1; i < Length; ++i) { - if (Data[i] == TS_SYNC_BYTE) { - Length = i; - break; - } - } - m_VideoBuffer.Del(Length); - continue; - } - processed = true; - if (TsPayloadStart(Data)) { - m_VideoAssembler.Reset(); - } - m_VideoAssembler.PutTs(Data, Length); - m_VideoBuffer.Del(Length); - } - - // process available audio data - while ((Data = m_AudioBuffer.Get(Length))) { - if (!m_Active || (Length < TS_SIZE)) - break; - Length = TS_SIZE; - if (*Data != TS_SYNC_BYTE) { - for (int i = 1; i < Length; ++i) { - if (Data[i] == TS_SYNC_BYTE) { - Length = i; - break; - } - } - m_AudioBuffer.Del(Length); - continue; - } - processed = true; - m_AudioAssembler.PutTs(Data, Length); - m_AudioBuffer.Del(Length); - } - - // process available dolby data - while ((Data = m_AC3Buffer.Get(Length))) { - if (!m_Active || (Length < TS_SIZE)) - break; - Length = TS_SIZE; - if (*Data != TS_SYNC_BYTE) { - for (int i = 1; i < Length; ++i) { - if (Data[i] == TS_SYNC_BYTE) { - Length = i; - break; - } - } - m_AC3Buffer.Del(Length); - continue; - } - processed = true; - m_AC3Assembler.PutTs(Data, Length); - m_AC3Buffer.Del(Length); - } - - // calculate bitrates - timeout = double(calcPeriod.Elapsed()); - if (m_Active && (init || (timeout >= (100.0 * config.bitrateCalcInterval )))) { - // TS packet 188 bytes - 4 byte header; MPEG standard defines 1Mbit = 1000000bit - // PES headers should be compensated! - m_VideoBitrate = (1000.0 * 8.0 * 184.0 * m_VideoPacketCount) / timeout; - m_VideoPacketCount = 0; - m_AudioBitrate = (1000.0 * 8.0 * 184.0 * m_AudioPacketCount) / timeout; - m_AudioPacketCount = 0; - m_AC3Bitrate = (1000.0 * 8.0 * 184.0 * m_AC3PacketCount) / timeout; - m_AC3PacketCount = 0; - calcPeriod.Set(0); - init = false; - } - - if (!processed) - m_Sleep.Wait(10); // to avoid busy loop and reduce cpu load - } -} diff --git a/libcore/femonreceiver.h b/libcore/femonreceiver.h deleted file mode 100644 index 2720ff1..0000000 --- a/libcore/femonreceiver.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __FEMONRECEIVER_H -#define __FEMONRECEIVER_H - -#include -#include - -class cFemonReceiver : public cReceiver, public cThread { - private: - cMutex m_Mutex; - cCondWait m_Sleep; - bool m_Active; - - cRingBufferLinear m_VideoBuffer; - cTsToPes m_VideoAssembler; - int m_VideoType; - int m_VideoPid; - int m_VideoPacketCount; - double m_VideoBitrate; - - cRingBufferLinear m_AudioBuffer; - cTsToPes m_AudioAssembler; - int m_AudioPid; - int m_AudioPacketCount; - double m_AudioBitrate; - bool m_AudioValid; - - cRingBufferLinear m_AC3Buffer; - cTsToPes m_AC3Assembler; - int m_AC3Pid; - int m_AC3PacketCount; - double m_AC3Bitrate; - bool m_AC3Valid; - - protected: - virtual void Activate(bool On); - virtual void Receive(uchar *Data, int Length); - virtual void Action(void); - - public: - cFemonReceiver(const cChannel* Channel, int ATrack, int DTrack); - virtual ~cFemonReceiver(); - void Deactivate(void); - - double VideoBitrate(void) { cMutexLock MutexLock(&m_Mutex); - return m_VideoBitrate; }; // bit/s - double AudioBitrate(void) { cMutexLock MutexLock(&m_Mutex); - return m_AudioBitrate; }; // bit/s - double AC3Bitrate(void) { cMutexLock MutexLock(&m_Mutex); - return m_AC3Bitrate; }; // bit/s -}; - -#endif //__FEMONRECEIVER_H - diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index a032349..f122732 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -613,7 +613,6 @@ void cTemplateViewChannel::SetViewElements(void) { viewElementsAllowed.insert("signalquality"); viewElementsAllowed.insert("signalqualityback"); viewElementsAllowed.insert("devices"); - viewElementsAllowed.insert("bitrate"); viewElementsAllowed.insert("scrapercontent"); viewElementsAllowed.insert("datetime"); viewElementsAllowed.insert("message"); @@ -656,9 +655,6 @@ string cTemplateViewChannel::GetViewElementName(eViewElement ve) { case veSignalQualityBack: name = "Signal Quality Background"; break; - case veBitRate: - name = "Bit Rate"; - break; case veDevices: name = "Devices"; break; @@ -706,8 +702,6 @@ void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix, ve = veSignalQuality; } else if (!sViewElement.compare("signalqualityback")) { ve = veSignalQualityBack; - } else if (!sViewElement.compare("bitrate")) { - ve = veBitRate; } else if (!sViewElement.compare("devices")) { ve = veDevices; } else if (!sViewElement.compare("scrapercontent")) { diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h index a2605ca..7fe78b9 100644 --- a/libtemplate/templateviewelement.h +++ b/libtemplate/templateviewelement.h @@ -37,7 +37,6 @@ enum eViewElement { veScreenResolution, veSignalQuality, veSignalQualityBack, - veBitRate, veScraperContent, //DisplayMenu ViewElements veHeader, diff --git a/skins/metrixhd/xmlfiles/displaychannel.xml b/skins/metrixhd/xmlfiles/displaychannel.xml index c182d21..d1148d5 100644 --- a/skins/metrixhd/xmlfiles/displaychannel.xml +++ b/skins/metrixhd/xmlfiles/displaychannel.xml @@ -164,9 +164,8 @@ {signalquality} SNR value of currently displayed channel --> - - - + + @@ -209,19 +208,6 @@ - - - - - - - - - - - @@ -91,6 +91,10 @@ + + + + diff --git a/views/displaymenuitemcurrentview.c b/views/displaymenuitemcurrentview.c index ce9fb22..741c7d1 100644 --- a/views/displaymenuitemcurrentview.c +++ b/views/displaymenuitemcurrentview.c @@ -457,7 +457,7 @@ void cDisplayMenuItemCurrentTimerView::Render(void) { SetScraperPoster(event); } else { stringTokens.insert(pair("eventtitle", "")); - stringTokens.insert(pair("eventtitle", "")); + stringTokens.insert(pair("eventstart", "")); stringTokens.insert(pair("eventstop", "")); stringTokens.insert(pair("eventshorttext", "")); stringTokens.insert(pair("eventdescription", "")); -- cgit v1.2.3 From 80ac2607514422cfd77efb3429e0f70fc8713c39 Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 2 Nov 2014 11:19:05 +0100 Subject: fixed bug in printf function --- libtemplate/templatefunction.c | 43 ++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 699e872..2a6e5a3 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -981,20 +981,28 @@ void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, s void cTemplateFunction::ParsePrintfTextToken(string &value, size_t start, size_t end) { cTextToken token; - token.type = ttPrintfToken; - //fetch parameter list from printf - string printfParams = value.substr(start + 8, end - start - 9); - value = value.replace(0, end - start + 1, ""); - splitstring s(printfParams.c_str()); - vector flds = s.split(',', 1); - - int numParams = flds.size(); - if (numParams < 1) - return; - string formatString = trim(flds[0]); - token.value = formatString.substr(1, formatString.size() - 2); - for (int i=1; i < numParams; i++) { - token.parameters.push_back(trim(flds[i])); + if (start > 0) { + string constString = value.substr(0, start); + value = value.replace(0, start, ""); + token.type = ttConstString; + token.value = constString; + textTokens.push_back(token); + } else { + token.type = ttPrintfToken; + //fetch parameter list from printf + string printfParams = value.substr(start + 8, end - start - 9); + value = value.replace(0, end - start + 1, ""); + splitstring s(printfParams.c_str()); + vector flds = s.split(',', 1); + + int numParams = flds.size(); + if (numParams < 1) + return; + string formatString = trim(flds[0]); + token.value = formatString.substr(1, formatString.size() - 2); + for (int i=1; i < numParams; i++) { + token.parameters.push_back(trim(flds[i])); + } } textTokens.push_back(token); } @@ -1588,6 +1596,8 @@ void cTemplateFunction::Debug(void) { tokType = "Token: "; else if (tokenType == ttConditionalToken) tokType = "Conditional Token: "; + else if (tokenType == ttPrintfToken) + tokType = "PrintF Token: "; esyslog("skindesigner: %s %d = \"%s\"", tokType.c_str(), i++, (*it).value.c_str()); if (tokenType == ttConditionalToken) { for (vector::iterator it2 = (*it).subTokens.begin(); it2 != (*it).subTokens.end(); it2++) { @@ -1600,6 +1610,11 @@ void cTemplateFunction::Debug(void) { esyslog("skindesigner: %s \"%s\"", tokTypeCond.c_str(), (*it2).value.c_str()); } } + if (tokenType == ttPrintfToken) { + for (vector::iterator it2 = (*it).parameters.begin(); it2 != (*it).parameters.end(); it2++) { + esyslog("skindesigner: Printf parameter: %s", (*it2).c_str()); + } + } } } if (fontName.size() > 0) { -- cgit v1.2.3 From ef4502cc02b4a1b287b6710826f04f953fd4691b Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 2 Nov 2014 11:41:41 +0100 Subject: fixed Bug with menuselection Patch --- HISTORY | 1 + views/displaymenulistview.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/HISTORY b/HISTORY index f81da89..0693f0e 100644 --- a/HISTORY +++ b/HISTORY @@ -53,4 +53,5 @@ Version 0.0.3 - optimized performance when creating a menu list - fixed Bug that displaychannel was not shown after closing displaymenu with "backspace" (with active menuorg plugin) +- fixed Bug with menuselection Patch diff --git a/views/displaymenulistview.c b/views/displaymenulistview.c index eb8581e..c5f1506 100644 --- a/views/displaymenulistview.c +++ b/views/displaymenulistview.c @@ -95,6 +95,8 @@ void cDisplayMenuListView::Clear(void) { } void cDisplayMenuListView::AddDefaultMenuItem(int index, string *tabTexts, bool current, bool selectable) { + if (index >= itemCount) + return; if (menuItems[index]) { cDisplayMenuItemDefaultView *menuItem = dynamic_cast(menuItems[index]); if (!menuItem) @@ -114,6 +116,8 @@ void cDisplayMenuListView::AddDefaultMenuItem(int index, string *tabTexts, bool } void cDisplayMenuListView::AddMainMenuItem(int index, const char *itemText, bool current, bool selectable) { + if (index >= itemCount) + return; if (menuItems[index]) { menuItems[index]->SetCurrent(current); return; @@ -123,6 +127,8 @@ void cDisplayMenuListView::AddMainMenuItem(int index, const char *itemText, bool } void cDisplayMenuListView::AddSetupMenuItem(int index, const char *itemText, bool current, bool selectable) { + if (index >= itemCount) + return; if (menuItems[index]) { menuItems[index]->SetCurrent(current); return; @@ -133,6 +139,8 @@ void cDisplayMenuListView::AddSetupMenuItem(int index, const char *itemText, boo void cDisplayMenuListView::AddSchedulesMenuItem(int index, const cEvent *event, const cChannel *channel, eTimerMatch timerMatch, eMenuCategory cat, bool current, bool selectable) { + if (index >= itemCount) + return; if (menuItems[index]) { menuItems[index]->SetCurrent(current); return; @@ -142,6 +150,8 @@ void cDisplayMenuListView::AddSchedulesMenuItem(int index, const cEvent *event, } void cDisplayMenuListView::AddChannelsMenuItem(int index, const cChannel *channel, bool withProvider, bool current, bool selectable) { + if (index >= itemCount) + return; if (menuItems[index]) { menuItems[index]->SetCurrent(current); return; @@ -151,6 +161,8 @@ void cDisplayMenuListView::AddChannelsMenuItem(int index, const cChannel *channe } void cDisplayMenuListView::AddTimersMenuItem(int index, const cTimer *timer, bool current, bool selectable) { + if (index >= itemCount) + return; if (menuItems[index]) { menuItems[index]->SetCurrent(current); return; @@ -160,6 +172,8 @@ void cDisplayMenuListView::AddTimersMenuItem(int index, const cTimer *timer, boo } void cDisplayMenuListView::AddRecordingMenuItem(int index, const cRecording *recording, int level, int total, int isNew, bool current, bool selectable) { + if (index >= itemCount) + return; if (menuItems[index]) { menuItems[index]->SetCurrent(current); return; @@ -169,6 +183,8 @@ void cDisplayMenuListView::AddRecordingMenuItem(int index, const cRecording *rec } void cDisplayMenuListView::AddTracksMenuItem(int index, const char *title, bool current, bool selectable) { + if (index >= itemCount) + return; if (menuItems[index]) { menuItems[index]->SetCurrent(current); return; -- cgit v1.2.3