Skip to content

Commit

Permalink
Refactor: The two SetNextRecording methods are identical, move to bas…
Browse files Browse the repository at this point in the history
…e class.
  • Loading branch information
daniel-kristjansson committed Dec 7, 2012
1 parent 9aaed0b commit d945642
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 45 deletions.
17 changes: 0 additions & 17 deletions mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.cpp
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.h
Expand Up @@ -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);
Expand Down
25 changes: 0 additions & 25 deletions mythtv/libs/libmythtv/recorders/dtvrecorder.cpp
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/recorders/dtvrecorder.h
Expand Up @@ -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; }

Expand Down
24 changes: 24 additions & 0 deletions mythtv/libs/libmythtv/recorders/recorderbase.cpp
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/recorderbase.h
Expand Up @@ -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.
Expand Down

0 comments on commit d945642

Please sign in to comment.