Permalink
Browse files

Refactor: The two SetNextRecording methods are identical, move to bas…

…e class.
  • Loading branch information...
daniel-kristjansson committed Dec 6, 2012
1 parent 9aaed0b commit d945642da6bd23c79a2d7c45e372751dc256f027
@@ -2809,23 +2809,6 @@ void NuppelVideoRecorder::doWriteThread(void)
}
}
void NuppelVideoRecorder::SetNextRecording(
const RecordingInfo *progInf, RingBuffer *rb)
{
// First we do some of the time consuming stuff we can do now
SavePositionMap(true);
ringBuffer->WriterFlush();
if (curRecording)
curRecording->SaveFilesize(ringBuffer->GetRealFileSize());
// Then we set the next info
QMutexLocker locker(&nextRingBufferLock);
nextRecording = NULL;
if (progInf)
nextRecording = new RecordingInfo(*progInf);
nextRingBuffer = rb;
}
void NuppelVideoRecorder::ResetForNewFile(void)
{
framesWritten = 0;
@@ -101,7 +101,6 @@ class MTV_PUBLIC NuppelVideoRecorder : public V4LRecorder, public CC608Input
void SetVideoFilters(QString &filters);
void SetTranscoding(bool value) { transcoding = value; };
void SetNextRecording(const RecordingInfo*, RingBuffer*);
void ResetForNewFile(void);
void FinishRecording(void);
void StartNewFile(void);
@@ -686,31 +686,6 @@ bool DTVRecorder::FindOtherKeyframes(const TSPacket *tspacket)
return true;
}
// documented in recorderbase.h
void DTVRecorder::SetNextRecording(const RecordingInfo *progInf, RingBuffer *rb)
{
LOG(VB_RECORD, LOG_INFO, LOC + QString("SetNextRecord(0x%1, 0x%2)")
.arg((uint64_t)progInf,0,16).arg((uint64_t)rb,0,16));
// First we do some of the time consuming stuff we can do now
SavePositionMap(true);
if (ringBuffer)
{
ringBuffer->WriterFlush();
if (curRecording)
curRecording->SaveFilesize(ringBuffer->GetRealFileSize());
}
// Then we set the next info
nextRingBufferLock.lock();
nextRecording = NULL;
if (progInf)
nextRecording = new RecordingInfo(*progInf);
nextRingBuffer = rb;
nextRingBufferLock.unlock();
}
/** \fn DTVRecorder::HandleKeyframe(uint64_t)
* \brief This save the current frame to the position maps
* and handles ringbuffer switching.
@@ -50,7 +50,6 @@ class DTVRecorder :
void Initialize(void) {;}
int GetVideoFd(void) { return _stream_fd; }
virtual void SetNextRecording(const RecordingInfo*, RingBuffer*);
virtual void SetStreamData(MPEGStreamData* sd);
MPEGStreamData *GetStreamData(void) const { return _stream_data; }
@@ -100,6 +100,30 @@ void RecorderBase::SetRecording(const RecordingInfo *pginfo)
delete oldrec;
}
void RecorderBase::SetNextRecording(const RecordingInfo *ri, RingBuffer *rb)
{
LOG(VB_RECORD, LOG_INFO, LOC + QString("SetNextRecording(0x%1, 0x%2)")
.arg(reinterpret_cast<intptr_t>(ri),0,16)
.arg(reinterpret_cast<intptr_t>(rb),0,16));
// First we do some of the time consuming stuff we can do now
SavePositionMap(true);
if (ringBuffer)
{
ringBuffer->WriterFlush();
if (curRecording)
curRecording->SaveFilesize(ringBuffer->GetRealFileSize());
}
// Then we set the next info
QMutexLocker locker(&nextRingBufferLock);
nextRecording = NULL;
if (ri)
nextRecording = new RecordingInfo(*ri);
nextRingBuffer = rb;
}
void RecorderBase::SetOption(const QString &name, const QString &value)
{
if (name == "videocodec")
@@ -116,7 +116,7 @@ class MTV_PUBLIC RecorderBase : public QRunnable
*
* This calls TVRec::RingBufferChanged() when the switch happens.
*/
virtual void SetNextRecording(const RecordingInfo*, RingBuffer*) = 0;
void SetNextRecording(const RecordingInfo*, RingBuffer*);
/** \brief This is called between SetOptionsFromProfile() and
* run() to initialize any devices, etc.

0 comments on commit d945642

Please sign in to comment.