diff --git a/mythtv/libs/libmythtv/NuppelVideoRecorder.cpp b/mythtv/libs/libmythtv/NuppelVideoRecorder.cpp
index 6fc9b80..e9a1246 100644
a
|
b
|
void NuppelVideoRecorder::doWriteThread(void) |
2806 | 2806 | } |
2807 | 2807 | } |
2808 | 2808 | |
2809 | | void NuppelVideoRecorder::SetNextRecording(const ProgramInfo *progInf, |
2810 | | RingBuffer *rb) |
| 2809 | void NuppelVideoRecorder::SetNextRecording( |
| 2810 | const RecordingInfo *progInf, RingBuffer *rb) |
2811 | 2811 | { |
2812 | 2812 | // First we do some of the time consuming stuff we can do now |
2813 | 2813 | SavePositionMap(true); |
… |
… |
void NuppelVideoRecorder::SetNextRecording(const ProgramInfo *progInf, |
2819 | 2819 | QMutexLocker locker(&nextRingBufferLock); |
2820 | 2820 | nextRecording = NULL; |
2821 | 2821 | if (progInf) |
2822 | | nextRecording = new ProgramInfo(*progInf); |
| 2822 | nextRecording = new RecordingInfo(*progInf); |
2823 | 2823 | nextRingBuffer = rb; |
2824 | 2824 | } |
2825 | 2825 | |
diff --git a/mythtv/libs/libmythtv/NuppelVideoRecorder.h b/mythtv/libs/libmythtv/NuppelVideoRecorder.h
index 67b7d67..33cc2a7 100644
a
|
b
|
class MTV_PUBLIC NuppelVideoRecorder : public V4LRecorder, public CC608Input |
101 | 101 | void SetVideoFilters(QString &filters); |
102 | 102 | void SetTranscoding(bool value) { transcoding = value; }; |
103 | 103 | |
104 | | void SetNextRecording(const ProgramInfo*, RingBuffer*); |
| 104 | void SetNextRecording(const RecordingInfo*, RingBuffer*); |
105 | 105 | void ResetForNewFile(void); |
106 | 106 | void FinishRecording(void); |
107 | 107 | void StartNewFile(void); |
diff --git a/mythtv/libs/libmythtv/dtvrecorder.cpp b/mythtv/libs/libmythtv/dtvrecorder.cpp
index fba78fc..a4e6ce8 100644
a
|
b
|
bool DTVRecorder::FindOtherKeyframes(const TSPacket *tspacket) |
688 | 688 | } |
689 | 689 | |
690 | 690 | // documented in recorderbase.h |
691 | | void DTVRecorder::SetNextRecording(const ProgramInfo *progInf, RingBuffer *rb) |
| 691 | void DTVRecorder::SetNextRecording(const RecordingInfo *progInf, RingBuffer *rb) |
692 | 692 | { |
693 | 693 | LOG(VB_RECORD, LOG_INFO, LOC + QString("SetNextRecord(0x%1, 0x%2)") |
694 | 694 | .arg((uint64_t)progInf,0,16).arg((uint64_t)rb,0,16)); |
… |
… |
void DTVRecorder::SetNextRecording(const ProgramInfo *progInf, RingBuffer *rb) |
706 | 706 | |
707 | 707 | nextRecording = NULL; |
708 | 708 | if (progInf) |
709 | | nextRecording = new ProgramInfo(*progInf); |
| 709 | nextRecording = new RecordingInfo(*progInf); |
710 | 710 | |
711 | 711 | nextRingBuffer = rb; |
712 | 712 | nextRingBufferLock.unlock(); |
diff --git a/mythtv/libs/libmythtv/dtvrecorder.h b/mythtv/libs/libmythtv/dtvrecorder.h
index e2749bf..6200a13 100644
a
|
b
|
class DTVRecorder : |
50 | 50 | void Initialize(void) {;} |
51 | 51 | int GetVideoFd(void) { return _stream_fd; } |
52 | 52 | |
53 | | virtual void SetNextRecording(const ProgramInfo*, RingBuffer*); |
| 53 | virtual void SetNextRecording(const RecordingInfo*, RingBuffer*); |
54 | 54 | virtual void SetStreamData(void); |
55 | 55 | void SetStreamData(MPEGStreamData* sd); |
56 | 56 | MPEGStreamData *GetStreamData(void) const { return _stream_data; } |
diff --git a/mythtv/libs/libmythtv/recorderbase.cpp b/mythtv/libs/libmythtv/recorderbase.cpp
index 84731c7..df5a6dd 100644
a
|
b
|
void RecorderBase::SetRingBuffer(RingBuffer *rbuf) |
82 | 82 | weMadeBuffer = false; |
83 | 83 | } |
84 | 84 | |
85 | | void RecorderBase::SetRecording(const ProgramInfo *pginfo) |
| 85 | void RecorderBase::SetRecording(const RecordingInfo *pginfo) |
86 | 86 | { |
87 | 87 | if (pginfo) |
88 | 88 | LOG(VB_RECORD, LOG_INFO, LOC + QString("SetRecording(0x%1) title(%2)") |
… |
… |
void RecorderBase::SetRecording(const ProgramInfo *pginfo) |
92 | 92 | |
93 | 93 | ProgramInfo *oldrec = curRecording; |
94 | 94 | if (pginfo) |
95 | | curRecording = new ProgramInfo(*pginfo); |
| 95 | curRecording = new RecordingInfo(*pginfo); |
96 | 96 | else |
97 | 97 | curRecording = NULL; |
98 | 98 | |
diff --git a/mythtv/libs/libmythtv/recorderbase.h b/mythtv/libs/libmythtv/recorderbase.h
index d124dbd..7dca9c7 100644
a
|
b
|
|
20 | 20 | class FireWireDBOptions; |
21 | 21 | class GeneralDBOptions; |
22 | 22 | class RecordingProfile; |
| 23 | class RecordingInfo; |
23 | 24 | class DVBDBOptions; |
24 | 25 | class RecorderBase; |
25 | 26 | class ChannelBase; |
26 | | class ProgramInfo; |
27 | 27 | class RingBuffer; |
28 | 28 | class TVRec; |
29 | 29 | |
… |
… |
class MTV_PUBLIC RecorderBase : public QRunnable |
63 | 63 | * |
64 | 64 | * \sa ChannelNameChanged(const QString&) |
65 | 65 | */ |
66 | | void SetRecording(const ProgramInfo *pginfo); |
| 66 | void SetRecording(const RecordingInfo *pginfo); |
67 | 67 | |
68 | 68 | /** \brief Tells recorder to use an externally created ringbuffer. |
69 | 69 | * |
… |
… |
class MTV_PUBLIC RecorderBase : public QRunnable |
116 | 116 | * |
117 | 117 | * This calls TVRec::RingBufferChanged() when the switch happens. |
118 | 118 | */ |
119 | | virtual void SetNextRecording(const ProgramInfo*, RingBuffer*) = 0; |
| 119 | virtual void SetNextRecording(const RecordingInfo*, RingBuffer*) = 0; |
120 | 120 | |
121 | 121 | /** \brief This is called between SetOptionsFromProfile() and |
122 | 122 | * run() to initialize any devices, etc. |
… |
… |
class MTV_PUBLIC RecorderBase : public QRunnable |
276 | 276 | uint m_videoWidth; |
277 | 277 | double m_frameRate; |
278 | 278 | |
279 | | ProgramInfo *curRecording; |
| 279 | RecordingInfo *curRecording; |
280 | 280 | |
281 | 281 | // For handling pausing + stop recording |
282 | 282 | mutable QMutex pauseLock; // also used for request_recording and recording |
… |
… |
class MTV_PUBLIC RecorderBase : public QRunnable |
294 | 294 | // For RingBuffer switching |
295 | 295 | QMutex nextRingBufferLock; |
296 | 296 | RingBuffer *nextRingBuffer; |
297 | | ProgramInfo *nextRecording; |
| 297 | RecordingInfo *nextRecording; |
298 | 298 | |
299 | 299 | // Seektable support |
300 | 300 | MarkTypes positionMapType; |
diff --git a/mythtv/libs/libmythtv/recordinginfo.cpp b/mythtv/libs/libmythtv/recordinginfo.cpp
index 0fc9e02..39003e8 100644
a
|
b
|
RecordingInfo::RecordingInfo( |
110 | 110 | oldrecstatus(_oldrecstatus), |
111 | 111 | savedrecstatus(rsUnknown), |
112 | 112 | future(_future), |
| 113 | desiredrecstartts(_recstartts), |
| 114 | desiredrecendts(_recendts), |
113 | 115 | record(NULL) |
114 | 116 | { |
115 | 117 | hostname = _hostname; |
… |
… |
RecordingInfo::RecordingInfo( |
203 | 205 | oldrecstatus(rsUnknown), |
204 | 206 | savedrecstatus(rsUnknown), |
205 | 207 | future(false), |
| 208 | desiredrecstartts(_recstartts), |
| 209 | desiredrecendts(_recendts), |
206 | 210 | record(NULL) |
207 | 211 | { |
208 | 212 | recpriority = _recpriority; |
… |
… |
void RecordingInfo::clone(const RecordingInfo &other, |
379 | 383 | oldrecstatus = other.oldrecstatus; |
380 | 384 | savedrecstatus = other.savedrecstatus; |
381 | 385 | future = other.future; |
| 386 | desiredrecstartts = other.desiredrecstartts; |
| 387 | desiredrecendts = other.desiredrecendts; |
382 | 388 | } |
383 | 389 | } |
384 | 390 | |
… |
… |
void RecordingInfo::clone(const ProgramInfo &other, |
403 | 409 | oldrecstatus = rsUnknown; |
404 | 410 | savedrecstatus = rsUnknown; |
405 | 411 | future = false; |
| 412 | desiredrecstartts = QDateTime(); |
| 413 | desiredrecendts = QDateTime(); |
406 | 414 | } |
407 | 415 | |
408 | 416 | void RecordingInfo::clear(void) |
… |
… |
void RecordingInfo::clear(void) |
415 | 423 | oldrecstatus = rsUnknown; |
416 | 424 | savedrecstatus = rsUnknown; |
417 | 425 | future = false; |
| 426 | desiredrecstartts = QDateTime(); |
| 427 | desiredrecendts = QDateTime(); |
418 | 428 | } |
419 | 429 | |
420 | 430 | |
diff --git a/mythtv/libs/libmythtv/recordinginfo.h b/mythtv/libs/libmythtv/recordinginfo.h
index 4c8378a..7650e36 100644
a
|
b
|
|
1 | 1 | #ifndef _RECORDING_INFO_H_ |
2 | 2 | #define _RECORDING_INFO_H_ |
3 | 3 | |
| 4 | #include <QDateTime> |
| 5 | #include <QString> |
| 6 | |
4 | 7 | #include "mythtvexp.h" |
5 | 8 | #include "programinfo.h" |
6 | 9 | |
… |
… |
class MTV_PUBLIC RecordingInfo : public ProgramInfo |
206 | 209 | void ApplyRecordRecPriorityChange(int); |
207 | 210 | void ToggleRecord(void); |
208 | 211 | |
| 212 | // Used in determining start and end for RecordingQuality determination |
| 213 | void SetDesiredStartTime(const QDateTime &dt) { desiredrecstartts = dt; } |
| 214 | void SetDesiredEndTime(const QDateTime &dt) { desiredrecendts = dt; } |
| 215 | QDateTime GetDesiredStartTime(void) const { return desiredrecstartts; } |
| 216 | QDateTime GetDesiredEndTime(void) const { return desiredrecendts; } |
| 217 | |
209 | 218 | // these five can be moved to programinfo |
210 | 219 | void AddHistory(bool resched = true, bool forcedup = false, |
211 | 220 | bool future = false);//pi |
… |
… |
class MTV_PUBLIC RecordingInfo : public ProgramInfo |
231 | 240 | RecStatusType oldrecstatus; |
232 | 241 | RecStatusType savedrecstatus; |
233 | 242 | bool future; |
| 243 | QDateTime desiredrecstartts; |
| 244 | QDateTime desiredrecendts; |
234 | 245 | |
235 | 246 | private: |
236 | 247 | mutable class RecordingRule *record; |
diff --git a/mythtv/libs/libmythtv/recordingquality.cpp b/mythtv/libs/libmythtv/recordingquality.cpp
index f3f79d1..9a251d8 100644
a
|
b
|
using namespace std; |
3 | 3 | |
4 | 4 | #include "recordingquality.h" |
5 | 5 | #include "mythcorecontext.h" |
| 6 | #include "recordinginfo.h" |
6 | 7 | #include "mythmiscutil.h" |
7 | 8 | #include "mythlogging.h" |
8 | | #include "programinfo.h" |
9 | 9 | |
10 | 10 | static void merge_overlapping(RecordingGaps &gaps); |
11 | | static double score_gaps(const ProgramInfo*, const RecordingGaps&); |
| 11 | static double score_gaps(const RecordingInfo&, const RecordingGaps&); |
| 12 | static QDateTime get_start(const RecordingInfo&); |
| 13 | static QDateTime get_end(const RecordingInfo&); |
12 | 14 | |
13 | 15 | RecordingQuality::RecordingQuality( |
14 | | const ProgramInfo *pi, const RecordingGaps &rg, |
| 16 | const RecordingInfo *ri, const RecordingGaps &rg, |
15 | 17 | const QDateTime &first, const QDateTime &latest) : |
16 | 18 | m_continuity_error_count(0), m_packet_count(0), |
17 | 19 | m_overall_score(1.0), m_recording_gaps(rg) |
18 | 20 | { |
19 | | if (!pi) |
| 21 | if (!ri) |
20 | 22 | return; |
21 | 23 | |
22 | | m_program_key = pi->MakeUniqueKey(); |
| 24 | m_program_key = ri->MakeUniqueKey(); |
23 | 25 | |
24 | 26 | // trim start |
25 | | QDateTime start = pi->GetScheduledStartTime(); |
| 27 | QDateTime start = get_start(*ri); |
26 | 28 | while (!m_recording_gaps.empty() && |
27 | 29 | m_recording_gaps.first().GetStart() < start) |
28 | 30 | { |
… |
… |
RecordingQuality::RecordingQuality( |
34 | 36 | } |
35 | 37 | |
36 | 38 | // trim end |
37 | | QDateTime end = pi->GetScheduledEndTime(); |
| 39 | QDateTime end = get_end(*ri); |
38 | 40 | while (!m_recording_gaps.empty() && |
39 | 41 | m_recording_gaps.back().GetEnd() > end) |
40 | 42 | { |
… |
… |
RecordingQuality::RecordingQuality( |
58 | 60 | stable_sort(m_recording_gaps.begin(), m_recording_gaps.end()); |
59 | 61 | merge_overlapping(m_recording_gaps); |
60 | 62 | |
61 | | m_overall_score = score_gaps(pi, m_recording_gaps); |
| 63 | m_overall_score = score_gaps(*ri, m_recording_gaps); |
62 | 64 | } |
63 | 65 | |
64 | 66 | void RecordingQuality::AddTSStatistics( |
… |
… |
static void merge_overlapping(RecordingGaps &gaps) |
137 | 139 | } |
138 | 140 | } |
139 | 141 | |
140 | | static double score_gaps(const ProgramInfo *pi, const RecordingGaps &gaps) |
| 142 | static double score_gaps(const RecordingInfo &ri, const RecordingGaps &gaps) |
141 | 143 | { |
142 | 144 | RecordingGaps::const_iterator it = gaps.begin(); |
143 | 145 | if (it == gaps.end()) |
144 | 146 | return 1.0; |
145 | 147 | |
146 | | QDateTime start = pi->GetScheduledStartTime(); |
| 148 | QDateTime start = get_start(ri); |
147 | 149 | |
148 | | double program_length = start.secsTo(pi->GetScheduledEndTime()); |
| 150 | double program_length = start.secsTo(get_end(ri)); |
149 | 151 | if (program_length < 1.0) |
150 | 152 | return 0.0; |
151 | 153 | |
… |
… |
static double score_gaps(const ProgramInfo *pi, const RecordingGaps &gaps) |
190 | 192 | return (score > 0.0) ? score : 0.0; |
191 | 193 | } |
192 | 194 | |
| 195 | static QDateTime get_start(const RecordingInfo &ri) |
| 196 | { |
| 197 | if (ri.GetDesiredStartTime().isValid()) |
| 198 | { |
| 199 | return (ri.GetScheduledStartTime() > ri.GetDesiredStartTime()) ? |
| 200 | ri.GetScheduledStartTime() : ri.GetDesiredStartTime(); |
| 201 | } |
| 202 | else |
| 203 | { |
| 204 | return ri.GetScheduledStartTime(); |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | static QDateTime get_end(const RecordingInfo &ri) |
| 209 | { |
| 210 | if (ri.GetDesiredEndTime().isValid()) |
| 211 | { |
| 212 | return (ri.GetScheduledEndTime() < ri.GetDesiredEndTime()) ? |
| 213 | ri.GetScheduledEndTime() : ri.GetDesiredEndTime(); |
| 214 | } |
| 215 | else |
| 216 | { |
| 217 | return ri.GetScheduledEndTime(); |
| 218 | } |
| 219 | } |
diff --git a/mythtv/libs/libmythtv/recordingquality.h b/mythtv/libs/libmythtv/recordingquality.h
index e7f1361..056bbb0 100644
a
|
b
|
|
7 | 7 | |
8 | 8 | #include "mythtvexp.h" |
9 | 9 | |
10 | | class ProgramInfo; |
| 10 | class RecordingInfo; |
11 | 11 | |
12 | 12 | class RecordingGap |
13 | 13 | { |
… |
… |
class MTV_PUBLIC RecordingQuality |
33 | 33 | { |
34 | 34 | public: |
35 | 35 | RecordingQuality( |
36 | | const ProgramInfo*, const RecordingGaps&, |
| 36 | const RecordingInfo*, const RecordingGaps&, |
37 | 37 | const QDateTime &firstData, const QDateTime &latestData); |
38 | 38 | |
39 | 39 | void AddTSStatistics(int continuity_error_count, int packet_count); |
diff --git a/mythtv/libs/libmythtv/tv_rec.cpp b/mythtv/libs/libmythtv/tv_rec.cpp
index a84c078..16ba400 100644
a
|
b
|
void TVRec::TuningRestartRecorder(void) |
4145 | 4145 | { |
4146 | 4146 | recorder->SetRingBuffer(ringBuffer); |
4147 | 4147 | ProgramInfo *progInfo = tvchain->GetProgramAt(-1); |
4148 | | recorder->SetRecording(progInfo); |
| 4148 | RecordingInfo recinfo(*progInfo); |
4149 | 4149 | delete progInfo; |
| 4150 | recorder->SetRecording(&recinfo); |
4150 | 4151 | } |
4151 | 4152 | recorder->Reset(); |
4152 | 4153 | |