void V4L2encRecorder::StartNewFile(void) { LOG(VB_RECORD, LOG_INFO, LOC + "StartNewFile -- begin"); // debugging // Make sure the first things in the file are a PAT & PMT HandleSingleProgramPAT(m_stream_data->PATSingleProgram(), true); HandleSingleProgramPMT(m_stream_data->PMTSingleProgram(), true); LOG(VB_RECORD, LOG_INFO, LOC + "StartNewFile -- end"); // debugging }
void ASIRecorder::StartNewFile(void) { if (_record_mpts) m_stream_handler->AddNamedOutputFile(ringBuffer->GetFilename()); // Make sure the first things in the file are a PAT & PMT HandleSingleProgramPAT(_stream_data->PATSingleProgram(), true); HandleSingleProgramPMT(_stream_data->PMTSingleProgram(), true); }
void DVBRecorder::run(void) { if (!Open()) { _error = "Failed to open DVB device"; LOG(VB_GENERAL, LOG_ERR, LOC + _error); return; } { QMutexLocker locker(&pauseLock); request_recording = true; recording = true; recordingWait.wakeAll(); } // Listen for time table on DVB standard streams if (_channel && (_channel->GetSIStandard() == "dvb")) _stream_data->AddListeningPID(DVB_TDT_PID); // Make sure the first things in the file are a PAT & PMT bool tmp = _wait_for_keyframe_option; _wait_for_keyframe_option = false; HandleSingleProgramPAT(_stream_data->PATSingleProgram()); HandleSingleProgramPMT(_stream_data->PMTSingleProgram()); _wait_for_keyframe_option = tmp; _stream_data->AddAVListener(this); _stream_data->AddWritingListener(this); _stream_handler->AddListener(_stream_data, false, true); while (IsRecordingRequested() && !IsErrored()) { if (PauseAndWait()) continue; { // sleep 100 milliseconds unless StopRecording() or Unpause() // is called, just to avoid running this too often. QMutexLocker locker(&pauseLock); if (!request_recording || request_pause) continue; unpauseWait.wait(&pauseLock, 100); } if (!_input_pmt) { LOG(VB_GENERAL, LOG_WARNING, LOC + "Recording will not commence until a PMT is set."); usleep(5000); continue; } if (!_stream_handler->IsRunning()) { _error = "Stream handler died unexpectedly."; LOG(VB_GENERAL, LOG_ERR, LOC + _error); } } _stream_handler->RemoveListener(_stream_data); _stream_data->RemoveWritingListener(this); _stream_data->RemoveAVListener(this); Close(); FinishRecording(); QMutexLocker locker(&pauseLock); recording = false; recordingWait.wakeAll(); }
void HDHRRecorder::StartRecording(void) { LOG(VB_RECORD, LOG_INFO, LOC + "StartRecording -- begin"); /* Create video socket. */ if (!Open()) { _error = "Failed to open HDHRRecorder device"; LOG(VB_GENERAL, LOG_ERR, LOC + _error); return; } _continuity_error_count = 0; { QMutexLocker locker(&pauseLock); request_recording = true; recording = true; recordingWait.wakeAll(); } // Make sure the first things in the file are a PAT & PMT bool tmp = _wait_for_keyframe_option; _wait_for_keyframe_option = false; HandleSingleProgramPAT(_stream_data->PATSingleProgram()); HandleSingleProgramPMT(_stream_data->PMTSingleProgram()); _wait_for_keyframe_option = tmp; _stream_data->AddAVListener(this); _stream_data->AddWritingListener(this); _stream_handler->AddListener(_stream_data); while (IsRecordingRequested() && !IsErrored()) { if (PauseAndWait()) continue; if (!IsRecordingRequested()) break; { // sleep 100 milliseconds unless StopRecording() or Unpause() // is called, just to avoid running this too often. QMutexLocker locker(&pauseLock); if (!request_recording || request_pause) continue; unpauseWait.wait(&pauseLock, 100); } if (!_input_pmt) { LOG(VB_GENERAL, LOG_WARNING, LOC + "Recording will not commence until a PMT is set."); usleep(5000); continue; } if (!_stream_handler->IsRunning()) { _error = "Stream handler died unexpectedly."; LOG(VB_GENERAL, LOG_ERR, LOC + _error); } } LOG(VB_RECORD, LOG_INFO, LOC + "StartRecording -- ending..."); _stream_handler->RemoveListener(_stream_data); _stream_data->RemoveWritingListener(this); _stream_data->RemoveAVListener(this); Close(); FinishRecording(); QMutexLocker locker(&pauseLock); recording = false; recordingWait.wakeAll(); LOG(VB_RECORD, LOG_INFO, LOC + "StartRecording -- end"); }
void HDHRRecorder::StartNewFile(void) { // Make sure the first things in the file are a PAT & PMT HandleSingleProgramPAT(_stream_data->PATSingleProgram(), true); HandleSingleProgramPMT(_stream_data->PMTSingleProgram(), true); }
void ASIRecorder::run(void) { if (!Open()) { _error = "Failed to open device"; LOG(VB_GENERAL, LOG_ERR, LOC + _error); return; } if (!_stream_data) { _error = "MPEGStreamData pointer has not been set"; LOG(VB_GENERAL, LOG_ERR, LOC + _error); Close(); return; } _continuity_error_count = 0; { QMutexLocker locker(&pauseLock); request_recording = true; recording = true; recordingWait.wakeAll(); } if (m_channel->HasGeneratedPAT()) { const ProgramAssociationTable *pat = m_channel->GetGeneratedPAT(); const ProgramMapTable *pmt = m_channel->GetGeneratedPMT(); _stream_data->Reset(pat->ProgramNumber(0)); _stream_data->HandleTables(MPEG_PAT_PID, *pat); _stream_data->HandleTables(pat->ProgramPID(0), *pmt); } // Listen for time table on DVB standard streams if (m_channel && (m_channel->GetSIStandard() == "dvb")) _stream_data->AddListeningPID(DVB_TDT_PID); // Make sure the first things in the file are a PAT & PMT bool tmp = _wait_for_keyframe_option; _wait_for_keyframe_option = false; HandleSingleProgramPAT(_stream_data->PATSingleProgram()); HandleSingleProgramPMT(_stream_data->PMTSingleProgram()); _wait_for_keyframe_option = tmp; _stream_data->AddAVListener(this); _stream_data->AddWritingListener(this); m_stream_handler->AddListener( _stream_data, false, true, (m_record_mpts) ? ringBuffer->GetFilename() : QString()); while (IsRecordingRequested() && !IsErrored()) { if (PauseAndWait()) continue; { // sleep 100 milliseconds unless StopRecording() or Unpause() // is called, just to avoid running this too often. QMutexLocker locker(&pauseLock); if (!request_recording || request_pause) continue; unpauseWait.wait(&pauseLock, 100); } if (!_input_pmt) { LOG(VB_GENERAL, LOG_WARNING, LOC + "Recording will not commence until a PMT is set."); usleep(5000); continue; } if (!m_stream_handler->IsRunning()) { _error = "Stream handler died unexpectedly."; LOG(VB_GENERAL, LOG_ERR, LOC + _error); } } m_stream_handler->RemoveListener(_stream_data); _stream_data->RemoveWritingListener(this); _stream_data->RemoveAVListener(this); Close(); FinishRecording(); QMutexLocker locker(&pauseLock); recording = false; recordingWait.wakeAll(); }