5 #include <QWaitCondition> 12 #include <QReadWriteLock> 152 Q_DECLARE_TR_FUNCTIONS(
TVRec)
155 friend class TVRecRecordThread;
158 explicit
TVRec(
int _inputid);
163 void RecordPending(const
ProgramInfo *rcinfo,
int secsleft,
bool hasLater);
165 RecStatus::Type GetRecordingStatus(
void) const;
167 void StopRecording(
bool killFile =
false);
169 void FinishRecording(
void) { SetFlags(kFlagFinishRecording,
170 __FILE__, __LINE__); }
173 __FILE__, __LINE__); }
174 void CancelNextRecording(
bool cancel);
178 bool IsRunning(
void)
const {
return HasFlags(kFlagRunMainLoop); }
180 void Stop(
void) { ClearFlags(kFlagRunMainLoop, __FILE__, __LINE__); }
184 bool IsPlaying(
void) {
return StateIsPlaying(internalState); }
187 bool IsRecording(
void) {
return StateIsRecording(internalState); }
189 bool SetVideoFiltersForChannel(
uint sourceid,
const QString &channum);
191 bool IsBusy(
InputInfo *busy_input =
nullptr,
int time_buffer = 5)
const;
192 bool IsReallyRecording(
void);
194 float GetFramerate(
void);
195 long long GetFramesWritten(
void);
196 long long GetFilePosition(
void);
197 long long GetMaxBitrate(
void)
const;
198 int64_t GetKeyframePosition(uint64_t desired)
const;
199 bool GetKeyframePositions(int64_t start, int64_t end,
frm_pos_map_t&)
const;
200 bool GetKeyframeDurations(int64_t start, int64_t end,
frm_pos_map_t&)
const;
201 void SpawnLiveTV(
LiveTVChain *newchain,
bool pip, QString startchan);
202 QString GetChainID(
void);
203 void StopLiveTV(
void);
204 void PauseRecorder(
void);
205 void ToggleChannelFavorite(QString);
207 void SetLiveRecording(
int recording);
209 QString GetInput(
void)
const;
210 uint GetSourceID(
void)
const;
211 QString SetInput(QString input);
215 { SetChannel(QString(
"NextChannel %1").arg((
int)dir)); }
216 void SetChannel(QString
name,
uint requestType = kFlagDetect);
217 bool QueueEITChannelChange(
const QString &
name);
219 int SetSignalMonitoringRate(
int rate,
int notifyFrontend = 1);
223 bool CheckChannel(QString
name)
const;
224 bool ShouldSwitchToAnotherInput(QString chanid);
225 bool CheckChannelPrefix(
const QString&,
uint&,
bool&,QString&);
227 QString &title, QString &subtitle,
228 QString &desc, QString &category,
229 QString &starttime, QString &endtime,
230 QString &callsign, QString &iconpath,
231 QString &channelname,
uint &chanid,
232 QString &seriesid, QString &programid);
233 bool GetChannelInfo(
uint &chanid,
uint &sourceid,
234 QString &callsign, QString &channum,
235 QString &channame, QString &xmltvid)
const;
236 bool SetChannelInfo(
uint chanid,
uint sourceid, QString oldchannum,
237 QString callsign, QString channum,
238 QString channame, QString xmltvid);
245 bool IsErrored(
void)
const {
return HasFlags(kFlagErrored); }
248 void RecorderPaused(
void);
250 void SetNextLiveTVDir(QString dir);
256 void AllGood(
void)
override { WakeEventLoop(); }
262 void run(
void)
override;
263 bool WaitForEventThreadSleep(
bool wake =
true, ulong time = ULONG_MAX);
268 void TeardownAll(
void);
269 void WakeEventLoop(
void);
271 static bool GetDevices(
uint inputid,
277 static QString GetStartChannel(
uint inputid);
279 void TeardownRecorder(
uint request_flags);
282 bool CreateChannel(
const QString &startChanNum,
283 bool enter_power_save_mode);
284 void CloseChannel(
void);
288 bool SetupSignalMonitor(
289 bool tablemon,
bool EITscan,
bool notify);
290 bool SetupDTVSignalMonitor(
bool EITscan);
291 void TeardownSignalMonitor(
void);
295 void SetFlags(
uint f,
const QString & file,
int line);
296 void ClearFlags(
uint f,
const QString & file,
int line);
297 static QString FlagToString(
uint);
299 void HandleTuning(
void);
305 void TuningRestartRecorder(
void);
306 QString TuningGetChanNum(
const TuningRequest&, QString &input)
const;
309 void HandleStateChange(
void);
310 void ChangeState(
TVState nextState);
311 bool StateIsRecording(
TVState state);
312 bool StateIsPlaying(
TVState state);
316 void HandlePendingRecordings(
void);
318 bool WaitForNextLiveTVDir(
void);
320 const QString &channum);
321 bool CreateLiveTVRingBuffer(
const QString & channum);
322 bool SwitchLiveTVRingBuffer(
const QString & channum,
323 bool discont,
bool set_rec);
329 QDateTime GetRecordEndTime(
const ProgramInfo*)
const;
330 void CheckForRecGroupChange(
void);
336 void SetRecordingStatus(
439 static const uint kFlagFrontendReady = 0x00000001;
440 static const uint kFlagRunMainLoop = 0x00000002;
441 static const uint kFlagExitPlayer = 0x00000004;
442 static const uint kFlagFinishRecording = 0x00000008;
443 static const uint kFlagErrored = 0x00000010;
444 static const uint kFlagCancelNextRecording = 0x00000020;
448 static const uint kFlagLiveTV = 0x00000100;
450 static const uint kFlagRecording = 0x00000200;
452 static const uint kFlagAntennaAdjust = 0x00000400;
453 static const uint kFlagRec = 0x00000F00;
457 static const uint kFlagEITScan = 0x00001000;
459 static const uint kFlagCloseRec = 0x00002000;
461 static const uint kFlagKillRec = 0x00004000;
463 static const uint kFlagNoRec = 0x0000F000;
464 static const uint kFlagKillRingBuffer = 0x00010000;
467 static const uint kFlagWaitingForRecPause = 0x00100000;
468 static const uint kFlagWaitingForSignal = 0x00200000;
469 static const uint kFlagNeedToStartRecorder = 0x00800000;
470 static const uint kFlagPendingActions = 0x00F00000;
473 static const uint kFlagSignalMonitorRunning = 0x01000000;
474 static const uint kFlagEITScannerRunning = 0x04000000;
476 static const uint kFlagDummyRecorderRunning = 0x10000000;
477 static const uint kFlagRecorderRunning = 0x20000000;
478 static const uint kFlagAnyRecRunning = 0x30000000;
479 static const uint kFlagAnyRunning = 0x3F000000;
482 static const uint kFlagRingBufferReady = 0x40000000;
483 static const uint kFlagDetect = 0x80000000;
bool IsPlaying(void)
Returns "state == kState_RecordingPreRecorded".
This is a wrapper around QThread that does several additional things.
QString LiveTVStartChannel
This is a specialization of RecorderBase used to handle MPEG-2, MPEG-4, MPEG-4 AVC,...
uint GetInputId(void)
Returns the inputid.
ChannelChangeDirection
ChannelChangeDirection is an enumeration of possible channel changing directions.
RecordingInfo * pseudoLiveTVRecording
VERBOSE_PREAMBLE Most true
MythDeque< TuningRequest > TuningQueue
QMutex triggerEventSleepLock
This is a specialization of DTVRecorder used to handle streams from DVB drivers.
QMap< uint, PendingInfo > PendingMap
RecStatus::Type m_recStatus
void AllGood(void) override
Signal to be sent when you have a lock on all values.
volatile bool switchingBuffer
static QMap< uint, TVRec * > inputs
Holds information on a TV Program one might wish to record.
Provides interface to the tuning hardware when using DVB drivers.
QHash< QString, int > autoRunJobs
void ChangeChannel(ChannelChangeDirection dir)
Changes to a channel in the 'dir' channel change direction.
void StatusChannelTuned(const SignalMonitorValue &) override
Signal to be sent with change change status.
void FrontendReady(void)
Tells TVRec that the frontend's TV class is ready for messages.
static QReadWriteLock inputsLock
bool IsOnSameMultiplex(void) const
TVState
TVState is an enumeration of the states used by TV and TVRec.
QWaitCondition triggerEventSleepWait
QDateTime signalMonitorDeadline
QDateTime preFailDeadline
void StatusSignalLock(const SignalMonitorValue &) override
Signal to be sent as true when it is safe to begin or continue recording, and false if it may not be ...
RecordingInfo * curRecording
bool triggerEventLoopSignal
QString overRecordCategory
PendingMap pendingRecordings
enum BrowseDirections BrowseDirection
Used to request ProgramInfo for channel browsing.
Holds information on recordings and videos.
static int run(MythMediaDevice *dev=nullptr, bool startRandomShow=false)
uint signalMonitorCheckCnt
Class providing a generic interface to digital tuning hardware.
This is the coordinating class of the Recorder Subsystem.
TuningRequest myth_deque_init(const TuningRequest *)
TuningQueue tuningRequests
QDateTime startRecordingDeadline
FirewireChannel Copyright (c) 2005 by Jim Westfall and Dave Abrahams Distributed as part of MythTV un...
void Stop(void)
Tells TVRec to stop event loop.
Acts as glue between ChannelBase, EITSource, and EITHelper.
QDateTime eitScanStartTime
static const uint kSignalMonitoringRate
How many milliseconds the signal monitor should wait between checks.
Implements tuning for TV cards using the V4L driver API, both versions 1 and 2.
This is the abstract base class for supporting recorder hardware.
void StatusSignalStrength(const SignalMonitorValue &) override
Signal to be sent with an actual signal value.
QDateTime signalEventCmdTimeout
This is a specialization of DTVRecorder used to handle streams from ASI drivers.
This class is intended to detect the presence of needed tables.
bool IsRunning(void) const
Returns true if event loop has not been told to shut down.
QWaitCondition triggerEventLoopWait
Signal monitoring base class.
MThread * eventThread
Event processing thread, runs TVRec::run().
uint GetFlags(void) const
bool triggerEventSleepSignal
bool reachedRecordingDeadline
Abstract class providing a generic interface to tuning hardware.
bool HasFlags(uint f) const
TuningRequest(uint f, QString ch, QString in=QString())
bool IsErrored(void) const
Returns true is "errored" is true, false otherwise.
vector< uint > possibleConflicts
bool IsRecording(void)
Returns "state == kState_RecordingRecordedOnly".
Implements a file/stream reader/writer.
QMap< long long, long long > frm_pos_map_t
Frame # -> File offset map.
QWaitCondition triggerLiveTVDir
QMutex triggerEventLoopLock
QString toString(void) const
MThread * recorderThread
Recorder thread, runs RecorderBase::run().
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
Keeps track of recordings in a current LiveTV instance.
SignalMonitor * signalMonitor
Encapsulates data about MPEG stream and emits events for each table.
TuningRequest(uint f, RecordingInfo *p)
TuningRequest lastTuningRequest