diff options
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | displaymenu.c | 8 | ||||
-rw-r--r-- | menudetailview.c | 130 | ||||
-rw-r--r-- | menudetailview.h | 2 | ||||
-rw-r--r-- | po/de_DE.po | 17 |
5 files changed, 160 insertions, 1 deletions
@@ -95,3 +95,7 @@ Version 0.0.6 - Fixed some nullpointer accesses in Schedules Menus - Improved cutting of scrolled text - Added Separator Items for Schedule Menus +- Adapted video scaling to new implementation (thanks @Zoolook for the patch) +- Fixed showing current show as rerun in epg detail view +- Added some recording information (channel, size, cutted size, format, + est. bitrate) in detailed recording view diff --git a/displaymenu.c b/displaymenu.c index ef76d65..a371512 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -530,12 +530,20 @@ void cNopacityDisplayMenu::SetEvent(const cEvent *Event) { } void cNopacityDisplayMenu::SetRecording(const cRecording *Recording) { + esyslog("nopacity: aga0"); if (!Recording) return; + const cRecordingInfo *Info = Recording->Info(); + if (!Info) { + return; + } menuView->AdjustContentBackground(false, contentNarrowLast, videoWindowRect); detailView = new cNopacityMenuDetailRecordingView(osd, Recording); menuView->SetDetailViewSize(dvRecording, detailView); detailView->SetFonts(); + esyslog("nopacity: aga"); + detailView->LoadRecordingInformation(Recording); + esyslog("nopacity: aga2"); detailView->SetContent(Recording->Info()->Description()); detailView->CreatePixmaps(); detailView->Render(); diff --git a/menudetailview.c b/menudetailview.c index d8b73c5..dc8e6eb 100644 --- a/menudetailview.c +++ b/menudetailview.c @@ -108,6 +108,136 @@ void cNopacityMenuDetailView::LoadReruns(const cEvent *event) { } } +void cNopacityMenuDetailView::LoadRecordingInformation(const cRecording *recording) { + const cRecordingInfo *Info = recording->Info(); + unsigned long long nRecSize = -1; + unsigned long long nFileSize[1000]; + nFileSize[0] = 0; + int i = 0; + struct stat filebuf; + cString filename; + int rc = 0; + do { + if (recording->IsPesRecording()) + filename = cString::sprintf("%s/%03d.vdr", recording->FileName(), ++i); + else + filename = cString::sprintf("%s/%05d.ts", recording->FileName(), ++i); + rc = stat(filename, &filebuf); + if (rc == 0) + nFileSize[i] = nFileSize[i-1] + filebuf.st_size; + else + if (ENOENT != errno) { + nRecSize = -1; + } + } while (i <= 999 && !rc); + nRecSize = nFileSize[i-1]; + + cMarks marks; + bool fHasMarks = marks.Load(recording->FileName(), recording->FramesPerSecond(), recording->IsPesRecording()) && marks.Count(); + cIndexFile *index = new cIndexFile(recording->FileName(), false, recording->IsPesRecording()); + + int nCutLength = 0; + long nCutInFrame = 0; + unsigned long long nRecSizeCut = nRecSize < 0 ? -1 : 0; + unsigned long long nCutInOffset = 0; + + if (fHasMarks && index) { + uint16_t FileNumber; + off_t FileOffset; + + bool fCutIn = true; + cMark *mark = marks.First(); + while (mark) { + int pos = mark->Position(); + index->Get(pos, &FileNumber, &FileOffset); //TODO: will disc spin up? + if (fCutIn) { + nCutInFrame = pos; + fCutIn = false; + if (nRecSize >= 0) + nCutInOffset = nFileSize[FileNumber-1] + FileOffset; + } else { + nCutLength += pos - nCutInFrame; + fCutIn = true; + if (nRecSize >= 0) + nRecSizeCut += nFileSize[FileNumber-1] + FileOffset - nCutInOffset; + } + cMark *nextmark = marks.Next(mark); + mark = nextmark; + } + if (!fCutIn) { + nCutLength += index->Last() - nCutInFrame; + index->Get(index->Last() - 1, &FileNumber, &FileOffset); + if (nRecSize >= 0) + nRecSizeCut += nFileSize[FileNumber-1] + FileOffset - nCutInOffset; + } + } + + std::stringstream sstrInfo; + + cChannel *channel = Channels.GetByChannelID(Info->ChannelID()); + if (channel) + sstrInfo << trVDR("Channel") << ": " << channel->Number() << " - " << channel->Name() << std::endl; + if (nRecSize < 0) { + if ((nRecSize = ReadSizeVdr(recording->FileName())) < 0) { + nRecSize = DirSizeMB(recording->FileName()); + } + } + if (nRecSize >= 0) { + cString strRecSize = ""; + if (fHasMarks) { + if (nRecSize > MEGABYTE(1023)) + strRecSize = cString::sprintf("%s: %.2f GB (%s: %.2f GB)", tr("Size"), (float)nRecSize / MEGABYTE(1024), tr("cut"), (float)nRecSizeCut / MEGABYTE(1024)); + else + strRecSize = cString::sprintf("%s: %lld MB (%s: %lld MB)", tr("Size"), nRecSize / MEGABYTE(1), tr("cut"), nRecSizeCut / MEGABYTE(1)); + } else { + if (nRecSize > MEGABYTE(1023)) + strRecSize = cString::sprintf("%s: %.2f GB", tr("Size"), (float)nRecSize / MEGABYTE(1024)); + else + strRecSize = cString::sprintf("%s: %lld MB", tr("Size"), nRecSize / MEGABYTE(1)); + } + sstrInfo << (const char*)strRecSize << std::endl; + } + + if (index) { + int nLastIndex = index->Last(); + if (nLastIndex) { + cString strLength; + if (fHasMarks) { + strLength = cString::sprintf("%s: %s (%s %s)", tr("Length"), *IndexToHMSF(nLastIndex, false, recording->FramesPerSecond()), tr("cut"), *IndexToHMSF(nCutLength, false, recording->FramesPerSecond())); + } else { + strLength = cString::sprintf("%s: %s", tr("Length"), *IndexToHMSF(nLastIndex, false, recording->FramesPerSecond())); + } + sstrInfo << (const char*)strLength << std::endl; + cString strBitrate = cString::sprintf("%s: %s\n%s: %.2f MBit/s (Video+Audio)", tr("Format"), recording->IsPesRecording() ? "PES" : "TS", tr("Est. bitrate"), (float)nRecSize / nLastIndex * recording->FramesPerSecond() * 8 / MEGABYTE(1)); + sstrInfo << (const char*)strBitrate << std::endl; + } + } + delete index; + + additionalContent = sstrInfo.str().c_str(); + additionalContentSet = true; +} + +int cNopacityMenuDetailView::ReadSizeVdr(const char *strPath) { + int dirSize = -1; + char buffer[20]; + char *strFilename = NULL; + if (-1 != asprintf(&strFilename, "%s/size.vdr", strPath)) { + struct stat st; + if (stat(strFilename, &st) == 0) { + int fd = open(strFilename, O_RDONLY); + if (fd >= 0) { + if (safe_read(fd, &buffer, sizeof(buffer)) >= 0) { + dirSize = atoi(buffer); + } + close(fd); + } + } + free(strFilename); + } + return dirSize; +} + double cNopacityMenuDetailView::ScrollbarSize(void) { double barSize = (double)contentHeight / (double)contentDrawPortHeight; return barSize; diff --git a/menudetailview.h b/menudetailview.h index 95cb789..bd7780f 100644 --- a/menudetailview.h +++ b/menudetailview.h @@ -17,6 +17,7 @@ protected: cPixmap *pixmapHeader; cPixmap *pixmapLogo; cPixmap *pixmapContent; + int ReadSizeVdr(const char *strPath); void DrawContent(void); public: cNopacityMenuDetailView(cOsd *osd); @@ -25,6 +26,7 @@ public: virtual void SetFonts(void) = 0; void SetContent(const char *textContent); void LoadReruns(const cEvent *event); + void LoadRecordingInformation(const cRecording *recording); bool Scrollable(void) {return hasScrollbar;} double ScrollbarSize(void); double Offset(void); diff --git a/po/de_DE.po b/po/de_DE.po index da86484..9562983 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: skinnopacity 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2013-01-02 15:58+0100\n" +"POT-Creation-Date: 2013-01-09 20:30+0100\n" "PO-Revision-Date: 2012-11-11 17:49+0200\n" "Last-Translator: louis\n" "Language-Team: \n" @@ -29,6 +29,21 @@ msgstr "Lautstärke" msgid "RERUNS OF THIS SHOW" msgstr "Wiederholungen dieser Sendung" +msgid "Size" +msgstr "Größe" + +msgid "cut" +msgstr "geschnitten" + +msgid "Length" +msgstr "Länge" + +msgid "Format" +msgstr "Format" + +msgid "Est. bitrate" +msgstr "Geschätzte Bitrate" + msgid "Duration" msgstr "Dauer" |