2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "recording.h"
23 Recording* Recording::recInfoFor = NULL;
24 RecInfo* Recording::recInfo = NULL;
26 Recording::Recording()
34 Recording::~Recording()
36 if (progName) { delete[] progName; progName = NULL; }
37 if (fileName) { delete[] fileName; fileName = NULL; }
38 index = -1; // just in case
41 ULONG Recording::getStartTime() const
46 char* Recording::getProgName() const
51 char* Recording::getFileName() const
56 void Recording::setStartTime(ULONG tstartTime)
61 void Recording::setProgName(char* tProgName)
63 if (progName) delete[] progName;
65 progName = new char[strlen(tProgName) + 1];
66 if (progName) strcpy(progName, tProgName);
69 void Recording::setFileName(char* tFileName)
71 if (fileName) delete[] fileName;
73 fileName = new char[strlen(tFileName) + 1];
74 if (fileName) strcpy(fileName, tFileName);
77 void Recording::loadRecInfo()
79 if (recInfoFor == this) return; // it already is loaded
81 if (recInfo) delete recInfo;
83 recInfo = VDR::getInstance()->getRecInfo(fileName);
84 Log::getInstance()->log("Recording", Log::DEBUG, "Recording has loaded recInfo %p", recInfo);
87 void Recording::dropRecInfo()
89 if (recInfo) delete recInfo;
94 bool Recording::isRadio()
96 VDR* vdr = VDR::getInstance();
97 if (!vdr) return false;
99 ULONG lengthFrames = 0;
100 ULLONG lengthBytes = vdr->streamRecording(getFileName(), &lengthFrames);
101 if (!lengthBytes || !lengthFrames) return false;
104 UCHAR* buffer = vdr->getBlock(0ULL, 10000U, &thisRead);
105 if (!buffer) return false;
113 bool hasVideo = Demuxer::scanForVideo(buffer, thisRead);
118 vdr->stopStreaming();
119 Log::getInstance()->log("Recording", Log::DEBUG, "Recording has messed about and worked out radio = %u", !hasVideo);
122 if (!hasVideo) return true;