/*
- Copyright 2006 Chris Tallon
+ Copyright 2019 Chris Tallon
This file is part of VOMP.
along with VOMP; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+//portions from vdr by Klaus Schmiding HSMF code
+
+#include <math.h>
-#include "recinfo.h"
#include "log.h"
+#include "i18n.h"
+
+#include "recinfo.h"
RecInfo::RecInfo()
{
descriptions = NULL;
title = NULL;
+
+ channelName = NULL;
+ duration = 0;
+ fileSize = 0;
+ priority = 0;
+ lifetime = 0;
+
+ summaryWithDetails = NULL;
}
RecInfo::~RecInfo()
types = NULL;
languages = NULL;
descriptions = NULL;
+
+ // TODO: Investigate why this is clearing instance vars
+
+ if (channelName) delete[] channelName;
+ channelName = NULL;
+ duration = 0;
+ fileSize = 0;
+ priority = 0;
+ lifetime = 0;
+
+ if (summaryWithDetails) delete[] summaryWithDetails;
+ summaryWithDetails = NULL;
}
void RecInfo::setNumComponents(ULONG tnumComponents)
logger->log("RecInfo", Log::DEBUG, "languages[%lu]: %s", i, languages[i]);
logger->log("RecInfo", Log::DEBUG, "descriptions[%lu]: %s", i, descriptions[i]);
}
+
+ logger->log("RecInfo", Log::DEBUG, "Title: %s", title);
+ logger->log("RecInfo", Log::DEBUG, "Channel: %s", channelName);
+ logger->log("RecInfo", Log::DEBUG, "Duration: %lu", duration);
+ logger->log("RecInfo", Log::DEBUG, "Filesize: %lu", fileSize);
+ logger->log("RecInfo", Log::DEBUG, "Priority: %lu", priority);
+ logger->log("RecInfo", Log::DEBUG, "Lifetime: %lu", lifetime);
}
bool RecInfo::hasNoVideo()
return true;
}
+
+char* RecInfo::buildSummaryWithDetails()
+{
+ if (!summaryWithDetails)
+ {
+ Log* logger = Log::getInstance();
+
+ int swdLength = strlen(summary) +
+ strlen(tr("Channel: ")) + strlen(channelName) +
+ strlen(tr("Duration: ")) + 5 + /* 'hh:mm' */
+ strlen(tr("Resume at: ")) + 5 + /* 'hh:mm' */
+ strlen(tr("Size: ")) + 8 + /* '12345 MB' */
+ 6 + /* line endings */
+ 40 /* just in case (translation of New?) */ ;
+
+ int mins = duration / 60;
+ int hours = mins / 60;
+ mins = mins % 60;
+
+
+ char resumePointText[30];
+ if (resumePoint == 0)
+ {
+ strncpy(resumePointText, tr("New"), 30);
+ resumePointText[29] = '\0';
+ }
+ else
+ {
+ hmsf resumeHMSF = framesToHMSF(resumePoint);
+ SNPRINTF(resumePointText, 30, "%01u:%02u", resumeHMSF.hours, resumeHMSF.minutes);
+ }
+
+ summaryWithDetails = new char[swdLength];
+ SNPRINTF(summaryWithDetails, swdLength, "%s\n\n%s%s\n%s%01i:%02i\n%s%s\n%s%lu MB", summary,
+ tr("Channel: "), channelName,
+ tr("Duration: "), hours, mins,
+ tr("Resume at: "), resumePointText,
+ tr("Size: "), fileSize
+ );
+
+ logger->log("RecInfo", Log::DEBUG, "Build summary with details C: %i, A: %i", swdLength, strlen(summaryWithDetails));
+ }
+ return summaryWithDetails;
+}
+
+hmsf RecInfo::framesToHMSF(ULONG frames)
+{
+ hmsf ret;
+ /* from vdr */
+ double Seconds;
+ ret.frames = int(modf((frames + 0.5) / fps, &Seconds) * fps + 1);
+ int s = int(Seconds);
+ ret.seconds = s % 60;
+ ret.minutes = s / 60 % 60;
+ ret.hours = s / 3600;
+
+ return ret;
+}
/*
- Copyright 2006 Chris Tallon
+ Copyright 2019 Chris Tallon
This file is part of VOMP.
along with VOMP; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+//portions from vdr by Klaus Schmiding HSMF code
#ifndef RECINFO_H
#define RECINFO_H
#include "defines.h"
+typedef struct _hmsf
+{
+ UINT hours;
+ UINT minutes;
+ UINT seconds;
+ UINT frames;
+} hmsf;
+
class RecInfo
{
public:
char *title;
+ char* channelName;
+ ULONG duration;
+ ULONG fileSize;
+ ULONG priority;
+ ULONG lifetime;
+
void setNumComponents(ULONG);
void addComponent(ULONG componentNum, UCHAR tstream, UCHAR ttype, char* tlanguage, char* tdescription);
// addComponent accepts a pointer to a buffer that RecInfo will free, not the caller
+ char* buildSummaryWithDetails();
void print();
+ hmsf framesToHMSF(ULONG frames);
bool hasNoVideo();
private:
-
+ char* summaryWithDetails;
};
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include "recording.h"
-
#include "recinfo.h"
#include "mark.h"
#include "log.h"
#include "seriesinfo.h"
#include "movieinfo.h"
+#include "recording.h"
+
Recording* Recording::recInfoFor = NULL;
RecInfo* Recording::recInfo = NULL;
MovieInfo* Recording::movieInfo = NULL;
bool hasMarks();
MarkList* getMarkList();
- int movieID;
- int seriesID;
- int episodeID;
+ int movieID;
+ int seriesID;
+ int episodeID;
static RecInfo* recInfo;
static MovieInfo* movieInfo;
#include "tvmedia.h"
#include <climits>
-#define VOMP_PROTOCOLL_VERSION 0x00000401
+#define VOMP_PROTOCOLL_VERSION 0x00000402
VDR* VDR::instance = NULL;
#ifdef VOMP_MEDIAPLAYER
RecInfo* VDR::getRecInfo(char* fileName)
{
VDR_RequestPacket vrp;
- if (!vrp.init(VDR_GETRECINFO, true, strlen(fileName) + 1)) return NULL;
+ if (!vrp.init(VDR_GETRECINFO2, true, strlen(fileName) + 1)) return NULL;
if (!vrp.addString(fileName)) return NULL;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
recInfo->fps=vresp->extractdouble();
recInfo->title=vresp->extractString();
+ // New stuff
+ recInfo->channelName = vresp->extractString();
+ recInfo->duration = vresp->extractULONG();
+ recInfo->fileSize = vresp->extractULONG();
+ recInfo->priority = vresp->extractULONG();
+ recInfo->lifetime = vresp->extractULONG();
recInfo->print();
const static ULONG VDR_FRAMEFROMPOS = 17;
const static ULONG VDR_MOVERECORDING = 18;
const static ULONG VDR_GETNEXTIFRAME = 19;
-const static ULONG VDR_GETRECINFO = 20;
+// const static ULONG VDR_GETRECINFO = 20;
+const static ULONG VDR_GETRECINFO2 = 24;
const static ULONG VDR_GETMARKS = 21;
const static ULONG VDR_GETCHANNELPIDS = 22;
const static ULONG VDR_DELETETIMER = 23;
along with VOMP; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-//portions from vdr by Klaus Schmiding HSMF code
#include "video.h"
/*
- Copyright 2004-2005 Chris Tallon
+ Copyright 2004-2019 Chris Tallon
This file is part of VOMP.
#include "draintarget.h"
#include "abstractoption.h"
-typedef struct _hmsf
-{
- UINT hours;
- UINT minutes;
- UINT seconds;
- UINT frames;
-} hmsf;
-
enum VideoMode {
None,
Fullscreen,
virtual bool setVideoDisplay(VideoDisplay display);
-
-
-
- //hmsf framesToHMSF(ULONG frames,double fps);
- // UINT getFPS(); //removed
+ // UINT getFPS(); //removed
// Video formats - AV_SET_VID_DISP_FMT
const static UCHAR NTSC = 0;
/*
- Copyright 2004-2006 Chris Tallon
+ Copyright 2004-2019 Chris Tallon
This file is part of VOMP.
rectangle(clocksRegion, barBlue);
-/*
- ULONG currentFrameNum = player->getCurrentFrameNum();
- ULONG lengthFrames;
- if (myRec->recInfo->timerEnd > time(NULL))
- {
- // chasing playback
- // Work out an approximate length in frames (good to 1s...)
- lengthFrames = (myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * video->getFPS();
- }
- else
- {
-// lengthFrames = player->getLengthFrames();
- lengthFrames = 0;
- }
-
- hmsf currentFrameHMSF = video->framesToHMSF(currentFrameNum);
- hmsf lengthHMSF = video->framesToHMSF(lengthFrames);
-
- char buffer[100];
- if (currentFrameNum >= lengthFrames)
- {
- strcpy(buffer, "-:--:-- / -:--:--");
- }
- else
- {
- SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds);
- logger->log("VRadioRec", Log::DEBUG, buffer);
- }
-*/
-
ULONG currentSeconds = player->getCurrentSeconds();
ULONG lengthSeconds = player->getLengthSeconds();
char buffer[100];
WTextbox * summary=new WTextbox();
summary->setParaMode(true);
- if (rec->recInfo && strlen(rec->recInfo->summary))
- summary->setText(rec->recInfo->summary);
+ if (rec->recInfo)
+ summary->setText(rec->recInfo->buildSummaryWithDetails());
else
summary->setText(tr("Summary unavailable"));
/*
- Copyright 2004-2005 Chris Tallon
+ Copyright 2004-2019 Chris Tallon
This file is part of VOMP.
#include <math.h>
-#include "vvideorec.h"
-#include "vteletextview.h"
-
#include "command.h"
#include "osd.h"
#include "wsymbol.h"
#include "recinfo.h"
#include "log.h"
#include "channel.h"
-
+#include "vteletextview.h"
+#include "vvideorec.h"
+
VVideoRec::VVideoRec(Recording* rec, bool ish264)
{
boxstack = BoxStack::getInstance();
}
}
-hmsf VVideoRec::framesToHMSF(ULONG frames)
-{
- hmsf ret;
- /* from vdr */
- double Seconds;
- double fps=myRec->recInfo->fps;
- ret.frames= int(modf((frames + 0.5) / fps, &Seconds) * fps + 1);
- int s = int(Seconds);
- ret.seconds=s % 60;
- ret.minutes = s / 60 % 60;
- ret.hours = s / 3600;
-
-
- return ret;
-}
-
void VVideoRec::drawBarClocks()
{
if (barScanHold)
lengthFrames = player->getLengthFrames();
}
- hmsf currentFrameHMSF = framesToHMSF(currentFrameNum);
- hmsf lengthHMSF = framesToHMSF(lengthFrames);
+ hmsf currentFrameHMSF = myRec->recInfo->framesToHMSF(currentFrameNum);
+ hmsf lengthHMSF = myRec->recInfo->framesToHMSF(lengthFrames);
char buffer[100];
if (currentFrameNum >= lengthFrames)
/*
- Copyright 2004-2005 Chris Tallon
+ Copyright 2004-2019 Chris Tallon
This file is part of VOMP.
void doTeletext();
- hmsf framesToHMSF(ULONG frames); //moved from video, this is a recording property, if needed elsewhere -> recording
-
private:
BoxStack* boxstack;
VDR* vdr;