cRecorder::cRecorder(const char *FileName, int Ca, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids, cLiveBuffer *LiveBuffer) :cReceiver(Ca, Priority, VPid, APids, Setup.UseDolbyInRecordings ? DPids : NULL, SPids) ,cThread("recording") { // Make sure the disk is up and running: SpinUpDisk(FileName); #if 0 ringBuffer = new cRingBufferLinear(RECORDERBUFSIZE, TS_SIZE * 2, true, "Recorder"); ringBuffer->SetTimeouts(0, 100); #endif remux = new cRemux(VPid, APids, Setup.UseDolbyInRecordings ? DPids : NULL, SPids, true); fileName = strdup(FileName); writer = NULL; liveBuffer = LiveBuffer; if (!LiveBuffer) writer = new cFileWriter(FileName, remux); }
cRecorder::cRecorder(const char *FileName, const cChannel *Channel, int Priority) :cReceiver(Channel, Priority) ,cThread("recording") #ifdef USE_LIVEBUFFER ,handleError(true) #endif /*USE_LIVEBUFFER*/ { recordingName = strdup(FileName); // Make sure the disk is up and running: SpinUpDisk(FileName); ringBuffer = new cRingBufferLinear(RECORDERBUFSIZE, MIN_TS_PACKETS_FOR_FRAME_DETECTOR * TS_SIZE, true, "Recorder"); ringBuffer->SetTimeouts(0, 100); int Pid = Channel->Vpid(); int Type = Channel->Vtype(); if (!Pid && Channel->Apid(0)) { Pid = Channel->Apid(0); Type = 0x04; } if (!Pid && Channel->Dpid(0)) { Pid = Channel->Dpid(0); Type = 0x06; } frameDetector = new cFrameDetector(Pid, Type); index = NULL; fileSize = 0; lastDiskSpaceCheck = time(NULL); fileName = new cFileName(FileName, true); int PatVersion, PmtVersion; if (fileName->GetLastPatPmtVersions(PatVersion, PmtVersion)) patPmtGenerator.SetVersions(PatVersion + 1, PmtVersion + 1); patPmtGenerator.SetChannel(Channel); recordFile = fileName->Open(); if (!recordFile) return; // Create the index file: index = new cIndexFile(FileName, true); if (!index) esyslog("ERROR: can't allocate index"); // let's continue without index, so we'll at least have the recording }
cRecorder::cRecorder(const char *FileName, tChannelID ChannelID, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids) :cReceiver(ChannelID, Priority, VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids) ,cThread("recording") ,recordingInfo(FileName) { // Make sure the disk is up and running: SpinUpDisk(FileName); ringBuffer = new cRingBufferLinear(RECORDERBUFSIZE, MIN_TS_PACKETS_FOR_FRAME_DETECTOR * TS_SIZE, true, "Recorder"); ringBuffer->SetTimeouts(0, 100); cChannel *Channel = Channels.GetByChannelID(ChannelID); int Pid = VPid; int Type = Channel ? Channel->Vtype() : 0; if (!Pid && APids) { Pid = APids[0]; Type = 0x04; } if (!Pid && DPids) { Pid = DPids[0]; Type = 0x06; } frameDetector = new cFrameDetector(Pid, Type); index = NULL; fileSize = 0; lastDiskSpaceCheck = time(NULL); fileName = new cFileName(FileName, true); int PatVersion, PmtVersion; if (fileName->GetLastPatPmtVersions(PatVersion, PmtVersion)) patPmtGenerator.SetVersions(PatVersion + 1, PmtVersion + 1); patPmtGenerator.SetChannel(Channel); recordFile = fileName->Open(); if (!recordFile) return; // Create the index file: index = new cIndexFile(FileName, true); if (!index) esyslog("ERROR: can't allocate index"); // let's continue without index, so we'll at least have the recording }