MythTV  master
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
TVRec Class Reference

This is the coordinating class of the Recorder Subsystem. More...

#include <tv_rec.h>

Inheritance diagram for TVRec:
Inheritance graph
[legend]
Collaboration diagram for TVRec:
Collaboration graph
[legend]

Public Member Functions

 TVRec (int _inputid)
 Performs instance initialization not requiring access to database. More...
 
 ~TVRec (void)
 Stops the event and scanning threads and deletes any ChannelBase, RingBuffer, and RecorderBase instances. More...
 
bool Init (void)
 Performs instance initialization, returns true on success. More...
 
void RecordPending (const ProgramInfo *rcinfo, int secsleft, bool hasLater)
 Tells TVRec "rcinfo" is the next pending recording. More...
 
RecStatus::Type StartRecording (ProgramInfo *pginfo)
 Tells TVRec to Start recording the program "rcinfo" as soon as possible. More...
 
RecStatus::Type GetRecordingStatus (void) const
 
void StopRecording (bool killFile=false)
 Changes from a recording state to kState_None. More...
 
void FinishRecording (void)
 Tells TVRec to finish the current recording as soon as possible. More...
 
void FrontendReady (void)
 Tells TVRec that the frontend's TV class is ready for messages. More...
 
void CancelNextRecording (bool cancel)
 Tells TVRec to cancel the upcoming recording. More...
 
ProgramInfoGetRecording (void)
 Allocates and returns a ProgramInfo for the current recording. More...
 
bool IsRunning (void) const
 Returns true if event loop has not been told to shut down. More...
 
void Stop (void)
 Tells TVRec to stop event loop. More...
 
TVState GetState (void) const
 Returns the TVState of the recorder. More...
 
bool IsPlaying (void)
 Returns "state == kState_RecordingPreRecorded". More...
 
bool IsRecording (void)
 Returns "state == kState_RecordingRecordedOnly". More...
 
bool SetVideoFiltersForChannel (uint sourceid, const QString &channum)
 
bool IsBusy (InputInfo *busy_input=nullptr, int time_buffer=5) const
 Returns true if the recorder is busy, or will be within the next time_buffer seconds. More...
 
bool IsReallyRecording (void)
 Returns true if frontend can consider the recorder started. More...
 
float GetFramerate (void)
 Returns recordering frame rate from the recorder. More...
 
long long GetFramesWritten (void)
 Returns number of frames written to disk by recorder. More...
 
long long GetFilePosition (void)
 Returns total number of bytes written by RingBuffer. More...
 
long long GetMaxBitrate (void) const
 Returns the maximum bits per second this recorder can produce. More...
 
int64_t GetKeyframePosition (uint64_t desired) const
 Returns byte position in RingBuffer of a keyframe according to recorder. More...
 
bool GetKeyframePositions (int64_t start, int64_t end, frm_pos_map_t &) const
 Returns byte position in RingBuffer of a keyframes according to recorder. More...
 
bool GetKeyframeDurations (int64_t start, int64_t end, frm_pos_map_t &) const
 
void SpawnLiveTV (LiveTVChain *newchain, bool pip, QString startchan)
 Tells TVRec to spawn a "Live TV" recorder. More...
 
QString GetChainID (void)
 Get the chainid of the livetv instance. More...
 
void StopLiveTV (void)
 Tells TVRec to stop a "Live TV" recorder. More...
 
void PauseRecorder (void)
 Tells "recorder" to pause, used for channel and input changes. More...
 
void ToggleChannelFavorite (const QString &)
 Toggles whether the current channel should be on our favorites list. More...
 
void SetLiveRecording (int recording)
 Tells the Scheduler about changes to the recording status of the LiveTV recording. More...
 
QString GetInput (void) const
 Returns current input. More...
 
uint GetSourceID (void) const
 Returns current source id. More...
 
QString SetInput (QString input)
 Changes to the specified input. More...
 
void ChangeChannel (ChannelChangeDirection dir)
 Changes to a channel in the 'dir' channel change direction. More...
 
void SetChannel (const QString &name, uint requestType=kFlagDetect)
 Changes to a named channel on the current tuner. More...
 
bool QueueEITChannelChange (const QString &name)
 Queues up a channel change for the EITScanner. More...
 
int SetSignalMonitoringRate (int rate, int notifyFrontend=1)
 Sets the signal monitoring rate. More...
 
int GetPictureAttribute (PictureAttribute attr)
 
int ChangePictureAttribute (PictureAdjustType type, PictureAttribute attr, bool direction)
 Returns current value [0,100] if it succeeds, -1 otherwise. More...
 
bool CheckChannel (const QString &name) const
 Checks if named channel exists on current tuner. More...
 
bool ShouldSwitchToAnotherInput (const QString &chanid)
 Checks if named channel exists on current tuner, or another tuner. More...
 
bool CheckChannelPrefix (const QString &, uint &, bool &, QString &)
 Checks a prefix against the channels in the DB. More...
 
void GetNextProgram (BrowseDirection direction, QString &title, QString &subtitle, QString &desc, QString &category, QString &starttime, QString &endtime, QString &callsign, QString &iconpath, QString &channum, uint &chanid, QString &seriesid, QString &programid)
 
bool GetChannelInfo (uint &chanid, uint &sourceid, QString &callsign, QString &channum, QString &channame, QString &xmltvid) const
 
bool SetChannelInfo (uint chanid, uint sourceid, const QString &oldchannum, const QString &callsign, const QString &channum, const QString &channame, const QString &xmltvid)
 
uint GetInputId (void)
 Returns the inputid. More...
 
uint GetParentId (void)
 
uint GetMajorId (void)
 
bool IsErrored (void) const
 Returns true is "errored" is true, false otherwise. More...
 
void RingBufferChanged (RingBuffer *, RecordingInfo *, RecordingQuality *)
 
void RecorderPaused (void)
 This is a callback, called by the "recorder" instance when it has actually paused. More...
 
void SetNextLiveTVDir (QString dir)
 
uint GetFlags (void) const
 
void AllGood (void) override
 Signal to be sent when you have a lock on all values. More...
 
void StatusChannelTuned (const SignalMonitorValue &) override
 Signal to be sent with change change status. More...
 
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 safe. More...
 
void StatusSignalStrength (const SignalMonitorValue &) override
 Signal to be sent with an actual signal value. More...
 

Static Public Member Functions

static TVRecGetTVRec (uint inputid)
 

Static Public Attributes

static QReadWriteLock s_inputsLock
 
static QMap< uint, TVRec * > s_inputs
 
static const uint kSignalMonitoringRate = 50
 How many milliseconds the signal monitor should wait between checks. More...
 
static const uint kFlagFrontendReady = 0x00000001
 
static const uint kFlagRunMainLoop = 0x00000002
 
static const uint kFlagExitPlayer = 0x00000004
 
static const uint kFlagFinishRecording = 0x00000008
 
static const uint kFlagErrored = 0x00000010
 
static const uint kFlagCancelNextRecording = 0x00000020
 
static const uint kFlagLiveTV = 0x00000100
 final result desired is LiveTV recording More...
 
static const uint kFlagRecording = 0x00000200
 final result desired is a timed recording More...
 
static const uint kFlagAntennaAdjust = 0x00000400
 antenna adjusting mode (LiveTV without recording). More...
 
static const uint kFlagRec = 0x00000F00
 
static const uint kFlagEITScan = 0x00001000
 final result desired is an EIT Scan More...
 
static const uint kFlagCloseRec = 0x00002000
 close recorder, keep recording More...
 
static const uint kFlagKillRec = 0x00004000
 close recorder, discard recording More...
 
static const uint kFlagNoRec = 0x0000F000
 
static const uint kFlagKillRingBuffer = 0x00010000
 
static const uint kFlagWaitingForRecPause = 0x00100000
 
static const uint kFlagWaitingForSignal = 0x00200000
 
static const uint kFlagNeedToStartRecorder = 0x00800000
 
static const uint kFlagPendingActions = 0x00F00000
 
static const uint kFlagSignalMonitorRunning = 0x01000000
 
static const uint kFlagEITScannerRunning = 0x04000000
 
static const uint kFlagDummyRecorderRunning = 0x10000000
 
static const uint kFlagRecorderRunning = 0x20000000
 
static const uint kFlagAnyRecRunning = 0x30000000
 
static const uint kFlagAnyRunning = 0x3F000000
 
static const uint kFlagRingBufferReady = 0x40000000
 
static const uint kFlagDetect = 0x80000000
 

Protected Member Functions

void run (void) override
 Event handling method, contains event loop. More...
 
bool WaitForEventThreadSleep (bool wake=true, ulong time=ULONG_MAX)
 You MUST HAVE the stateChange-lock locked when you call this method! More...
 
- Protected Member Functions inherited from SignalMonitorListener
virtual ~SignalMonitorListener ()=default
 

Private Types

enum  AutoRunInitType { kAutoRunProfile, kAutoRunNone }
 

Private Member Functions

void SetRingBuffer (RingBuffer *)
 Sets "ringBuffer", deleting any existing RingBuffer. More...
 
void SetPseudoLiveTVRecording (RecordingInfo *)
 Sets the pseudo LiveTV RecordingInfo. More...
 
void TeardownAll (void)
 
void WakeEventLoop (void)
 
void TeardownRecorder (uint request_flags)
 Tears down the recorder. More...
 
DTVRecorderGetDTVRecorder (void)
 
bool CreateChannel (const QString &startchannel, bool enter_power_save_mode)
 
void CloseChannel (void)
 
DTVChannelGetDTVChannel (void)
 
V4LChannelGetV4LChannel (void)
 
bool SetupSignalMonitor (bool tablemon, bool EITscan, bool notify)
 This creates a SignalMonitor instance and begins signal monitoring. More...
 
bool SetupDTVSignalMonitor (bool EITscan)
 Tells DTVSignalMonitor what channel to look for. More...
 
void TeardownSignalMonitor (void)
 If a SignalMonitor instance exists, the monitoring thread is stopped and the instance is deleted. More...
 
DTVSignalMonitorGetDTVSignalMonitor (void)
 
bool HasFlags (uint f) const
 
void SetFlags (uint f, const QString &file, int line)
 
void ClearFlags (uint f, const QString &file, int line)
 
void HandleTuning (void)
 Handles all tuning events. More...
 
void TuningShutdowns (const TuningRequest &)
 This shuts down anything that needs to be shut down before handling the passed in tuning request. More...
 
void TuningFrequency (const TuningRequest &)
 Performs initial tuning required for any tuning event. More...
 
MPEGStreamDataTuningSignalCheck (void)
 This checks if we have a channel lock. More...
 
void TuningNewRecorder (MPEGStreamData *)
 Creates a recorder instance. More...
 
void TuningRestartRecorder (void)
 Restarts a stopped recorder or unpauses a paused recorder. More...
 
QString TuningGetChanNum (const TuningRequest &, QString &input) const
 
bool TuningOnSameMultiplex (TuningRequest &request)
 
void HandleStateChange (void)
 Changes the internalState to the desiredNextState if possible. More...
 
void ChangeState (TVState nextState)
 Puts a state change on the nextState queue. More...
 
TVState RemovePlaying (TVState state)
 Returns TVState that would remove the playing, but potentially keep recording if we are watching an in progress recording. More...
 
TVState RemoveRecording (TVState state)
 If "state" is kState_RecordingOnly or kState_WatchingLiveTV, returns a kState_None, otherwise returns kState_Error. More...
 
void HandlePendingRecordings (void)
 
bool WaitForNextLiveTVDir (void)
 
bool GetProgramRingBufferForLiveTV (RecordingInfo **pginfo, RingBuffer **rb, const QString &channum)
 
bool CreateLiveTVRingBuffer (const QString &channum)
 
bool SwitchLiveTVRingBuffer (const QString &channum, bool discont, bool set_rec)
 
RecordingInfoSwitchRecordingRingBuffer (const RecordingInfo &rcinfo)
 
void StartedRecording (RecordingInfo *)
 Inserts a "curRec" into the database. More...
 
void FinishedRecording (RecordingInfo *, RecordingQuality *)
 If not a premature stop, adds program to history of recorded programs. More...
 
QDateTime GetRecordEndTime (const ProgramInfo *) const
 Returns recording end time with proper post-roll. More...
 
void CheckForRecGroupChange (void)
 Check if frontend changed the recording group. More...
 
void NotifySchedulerOfRecording (RecordingInfo *)
 Tell scheduler about the recording. More...
 
void InitAutoRunJobs (RecordingInfo *, AutoRunInitType, RecordingProfile *, int line)
 
void SetRecordingStatus (RecStatus::Type new_status, int line, bool have_lock=false)
 
QString LoadProfile (void *, RecordingInfo *, RecordingProfile &)
 

Static Private Member Functions

static bool GetDevices (uint inputid, uint &parentid, GeneralDBOptions &gen_opts, DVBDBOptions &dvb_opts, FireWireDBOptions &firewire_opts)
 
static QString GetStartChannel (uint inputid)
 
static QString FlagToString (uint)
 
static bool StateIsRecording (TVState state)
 Returns true if "state" is kState_RecordingOnly, or kState_WatchingLiveTV. More...
 
static bool StateIsPlaying (TVState state)
 Returns true if we are in any state associated with a player. More...
 

Private Attributes

RecorderBasem_recorder {nullptr}
 
ChannelBasem_channel {nullptr}
 
SignalMonitorm_signalMonitor {nullptr}
 
EITScannerm_scanner {nullptr}
 
QDateTime m_signalEventCmdTimeout
 
bool m_signalEventCmdSent {false}
 
QDateTime m_startRecordingDeadline
 
QDateTime m_signalMonitorDeadline
 
uint m_signalMonitorCheckCnt {0}
 
bool m_reachedRecordingDeadline {false}
 
QDateTime m_preFailDeadline
 
bool m_reachedPreFail {false}
 
MThreadm_eventThread {nullptr}
 Event processing thread, runs TVRec::run(). More...
 
MThreadm_recorderThread {nullptr}
 Recorder thread, runs RecorderBase::run(). More...
 
bool m_transcodeFirst {false}
 
bool m_earlyCommFlag {false}
 
bool m_runJobOnHostOnly {false}
 
int m_eitCrawlIdleStart {60}
 
int m_eitTransportTimeout {5*60}
 
int m_audioSampleRateDB {0}
 
int m_overRecordSecNrml {0}
 
int m_overRecordSecCat {0}
 
QString m_overRecordCategory
 
uint m_inputid
 
uint m_parentid {0}
 
bool m_ispip {false}
 
GeneralDBOptions m_genOpt
 
DVBDBOptions m_dvbOpt
 
FireWireDBOptions m_fwOpt
 
QString m_recProfileName
 
QMutex m_setChannelLock
 
QMutex m_stateChangeLock {QMutex::Recursive}
 
QMutex m_pendingRecLock {QMutex::Recursive}
 
TVState m_internalState {kState_None}
 
TVState m_desiredNextState {kState_None}
 
bool m_changeState {false}
 
bool m_pauseNotify {true}
 
uint m_stateFlags {0}
 
TuningQueue m_tuningRequests
 
TuningRequest m_lastTuningRequest {0}
 
QDateTime m_eitScanStartTime
 
QMutex m_triggerEventLoopLock {QMutex::NonRecursive}
 
QWaitCondition m_triggerEventLoopWait
 
bool m_triggerEventLoopSignal {false}
 
QMutex m_triggerEventSleepLock {QMutex::NonRecursive}
 
QWaitCondition m_triggerEventSleepWait
 
bool m_triggerEventSleepSignal {false}
 
volatile bool m_switchingBuffer {false}
 
RecStatus::Type m_recStatus {RecStatus::Unknown}
 
RecordingInfom_curRecording {nullptr}
 
QDateTime m_recordEndTime
 
QHash< QString, int > m_autoRunJobs
 
int m_overrecordseconds {0}
 
PendingMap m_pendingRecordings
 
RecordingInfom_pseudoLiveTVRecording {nullptr}
 
QString m_nextLiveTVDir
 
QMutex m_nextLiveTVDirLock
 
QWaitCondition m_triggerLiveTVDir
 
QString m_liveTVStartChannel
 
LiveTVChainm_tvChain {nullptr}
 
RingBufferm_ringBuffer {nullptr}
 
QString m_rbFileExt {"ts"}
 

Friends

class TuningRequest
 
class TVRecRecordThread
 

Detailed Description

This is the coordinating class of the Recorder Subsystem.

TVRec is used by EncoderLink, which in turn is used by RemoteEncoder which allows the TV class on the frontend to communicate with TVRec and is used by MainServer to implement portions of the MythTV Network Protocol on the backend.

TVRec contains an instance of RecorderBase, which actually handles the recording of a program. It also contains an instance of RingBuffer, which in this case is used to either stream an existing recording to the frontend, or to save a stream from the RecorderBase to disk. Finally, if there is a tuner on the hardware RecorderBase is implementing then TVRec contains a channel instance for that hardware, and possibly a SignalMonitor instance which monitors the signal quality on a tuners current input.

Definition at line 141 of file tv_rec.h.

Member Enumeration Documentation

◆ AutoRunInitType

enum TVRec::AutoRunInitType
private
Enumerator
kAutoRunProfile 
kAutoRunNone 

Definition at line 323 of file tv_rec.h.

Constructor & Destructor Documentation

◆ TVRec()

TVRec::TVRec ( int  inputid)
explicit

Performs instance initialization not requiring access to database.

See also
Init()
Parameters
_inputid

Definition at line 85 of file tv_rec.cpp.

◆ ~TVRec()

TVRec::~TVRec ( void  )

Stops the event and scanning threads and deletes any ChannelBase, RingBuffer, and RecorderBase instances.

Definition at line 176 of file tv_rec.cpp.

Member Function Documentation

◆ Init()

bool TVRec::Init ( void  )

Performs instance initialization, returns true on success.

Returns
Returns true on success, false on failure.

Definition at line 139 of file tv_rec.cpp.

Referenced by setupTVs().

◆ RecordPending()

void TVRec::RecordPending ( const ProgramInfo rcinfo,
int  secsleft,
bool  hasLater 
)

Tells TVRec "rcinfo" is the next pending recording.

When there is a pending recording and the frontend is in "Live TV" mode the TVRec event loop will send a "ASK_RECORDING" message to it. Depending on what that query returns, the recording will be started or not started.

See also
TV::AskAllowRecording(const QStringList&, int, bool)
Parameters
rcinfoProgramInfo on pending program.
secsleftSeconds left until pending recording begins. Set to -1 to revoke the current pending recording.
hasLaterIf true, a later non-conflicting showing is available.

Definition at line 271 of file tv_rec.cpp.

Referenced by CancelNextRecording(), EncoderLink::RecordPending(), and RemoteRecordPending().

◆ StartRecording()

RecStatus::Type TVRec::StartRecording ( ProgramInfo pginfo)

Tells TVRec to Start recording the program "rcinfo" as soon as possible.

See also
EncoderLink::StartRecording(ProgramInfo*) RecordPending(const ProgramInfo*, int, bool), StopRecording()

Definition at line 397 of file tv_rec.cpp.

Referenced by EncoderLink::StartRecording().

◆ GetRecordingStatus()

RecStatus::Type TVRec::GetRecordingStatus ( void  ) const

Definition at line 666 of file tv_rec.cpp.

Referenced by EncoderLink::GetRecordingStatus(), and StartRecording().

◆ StopRecording()

void TVRec::StopRecording ( bool  killFile = false)

Changes from a recording state to kState_None.

Note
For the sake of recording quality measurements this is treated as the desired end point of the recording.
See also
StartRecording(const ProgramInfo *rec), FinishRecording()

Definition at line 702 of file tv_rec.cpp.

Referenced by RemoteStopRecording(), StartRecording(), and EncoderLink::StopRecording().

◆ FinishRecording()

void TVRec::FinishRecording ( void  )
inline

Tells TVRec to finish the current recording as soon as possible.

Definition at line 160 of file tv_rec.h.

Referenced by EncoderLink::FinishRecording().

◆ FrontendReady()

void TVRec::FrontendReady ( void  )
inline

Tells TVRec that the frontend's TV class is ready for messages.

Definition at line 163 of file tv_rec.h.

Referenced by EncoderLink::FrontendReady().

◆ CancelNextRecording()

void TVRec::CancelNextRecording ( bool  cancel)

Tells TVRec to cancel the upcoming recording.

See also
RecordPending(const ProgramInfo*, int, bool), TV::AskAllowRecording(const QStringList&, int, bool)

Definition at line 347 of file tv_rec.cpp.

Referenced by EncoderLink::CancelNextRecording(), and StartRecording().

◆ GetRecording()

ProgramInfo * TVRec::GetRecording ( void  )

Allocates and returns a ProgramInfo for the current recording.

Note: The user of this function must free the ProgramInfo this returns.

Returns
ProgramInfo for the current recording, if it exists, blank ProgramInfo otherwise.

Definition at line 239 of file tv_rec.cpp.

Referenced by EncoderLink::GetRecording(), and EncoderLink::MatchesRecording().

◆ IsRunning()

bool TVRec::IsRunning ( void  ) const
inline

Returns true if event loop has not been told to shut down.

Definition at line 169 of file tv_rec.h.

◆ Stop()

void TVRec::Stop ( void  )
inline

Tells TVRec to stop event loop.

Definition at line 171 of file tv_rec.h.

◆ GetState()

TVState TVRec::GetState ( void  ) const

Returns the TVState of the recorder.

If there is a pending state change kState_ChangingState is returned.

See also
EncoderLink::GetState(), Recorder Subsystem

Definition at line 225 of file tv_rec.cpp.

Referenced by CreateChannel(), EncoderLink::GetState(), HandlePendingRecordings(), IsBusy(), RemoteGetState(), run(), SetSignalMonitoringRate(), StartRecording(), and StopRecording().

◆ IsPlaying()

bool TVRec::IsPlaying ( void  )
inline

Returns "state == kState_RecordingPreRecorded".

Definition at line 175 of file tv_rec.h.

◆ IsRecording()

bool TVRec::IsRecording ( void  )
inline

Returns "state == kState_RecordingRecordedOnly".

See also
IsReallyRecording()

Definition at line 178 of file tv_rec.h.

◆ SetVideoFiltersForChannel()

bool TVRec::SetVideoFiltersForChannel ( uint  sourceid,
const QString &  channum 
)

Definition at line 2450 of file tv_rec.cpp.

Referenced by DTVChannel::SetChannelByString(), and TuningNewRecorder().

◆ IsBusy()

bool TVRec::IsBusy ( InputInfo busy_input = nullptr,
int  time_buffer = 5 
) const

Returns true if the recorder is busy, or will be within the next time_buffer seconds.

See also
EncoderLink::IsBusy(TunedInputInfo*, int time_buffer)

Definition at line 2481 of file tv_rec.cpp.

Referenced by EncoderLink::IsBusy(), and RemoteIsBusy().

◆ IsReallyRecording()

bool TVRec::IsReallyRecording ( void  )

Returns true if frontend can consider the recorder started.

See also
IsRecording()

Definition at line 2470 of file tv_rec.cpp.

Referenced by EncoderLink::IsReallyRecording().

◆ GetFramerate()

float TVRec::GetFramerate ( void  )

Returns recordering frame rate from the recorder.

See also
RemoteEncoder::GetFrameRate(), EncoderLink::GetFramerate(void), RecorderBase::GetFrameRate()
Returns
Frames per second if query succeeds -1 otherwise.

Definition at line 2549 of file tv_rec.cpp.

Referenced by EncoderLink::GetFramerate().

◆ GetFramesWritten()

long long TVRec::GetFramesWritten ( void  )

Returns number of frames written to disk by recorder.

See also
EncoderLink::GetFramesWritten(), RemoteEncoder::GetFramesWritten()
Returns
Number of frames if query succeeds, -1 otherwise.

Definition at line 2564 of file tv_rec.cpp.

Referenced by FinishedRecording(), and EncoderLink::GetFramesWritten().

◆ GetFilePosition()

long long TVRec::GetFilePosition ( void  )

Returns total number of bytes written by RingBuffer.

See also
EncoderLink::GetFilePosition(), RemoteEncoder::GetFilePosition()
Returns
Bytes written if query succeeds, -1 otherwise.

Definition at line 2579 of file tv_rec.cpp.

Referenced by EncoderLink::GetFilePosition().

◆ GetMaxBitrate()

long long TVRec::GetMaxBitrate ( void  ) const

Returns the maximum bits per second this recorder can produce.

See also
EncoderLink::GetMaxBitrate(void), RemoteEncoder::GetMaxBitrate(void)

Definition at line 2639 of file tv_rec.cpp.

Referenced by EncoderLink::GetMaxBitrate().

◆ GetKeyframePosition()

int64_t TVRec::GetKeyframePosition ( uint64_t  desired) const

Returns byte position in RingBuffer of a keyframe according to recorder.

See also
EncoderLink::GetKeyframePosition(uint64_t), RemoteEncoder::GetKeyframePosition(uint64_t)
Returns
Byte position of keyframe if query succeeds, -1 otherwise.

Definition at line 2595 of file tv_rec.cpp.

Referenced by EncoderLink::GetKeyframePosition().

◆ GetKeyframePositions()

bool TVRec::GetKeyframePositions ( int64_t  start,
int64_t  end,
frm_pos_map_t map 
) const

Returns byte position in RingBuffer of a keyframes according to recorder.

See also
EncoderLink::GetKeyframePositions(int64_t, int64_t, frm_pos_map_t&), RemoteEncoder::GetKeyframePositions(int64_t, int64_t, frm_pos_map_t&)
Returns
Byte position of keyframe if query succeeds, -1 otherwise.

Definition at line 2612 of file tv_rec.cpp.

Referenced by EncoderLink::GetKeyframePositions().

◆ GetKeyframeDurations()

bool TVRec::GetKeyframeDurations ( int64_t  start,
int64_t  end,
frm_pos_map_t map 
) const

Definition at line 2623 of file tv_rec.cpp.

Referenced by EncoderLink::GetKeyframeDurations().

◆ SpawnLiveTV()

void TVRec::SpawnLiveTV ( LiveTVChain newchain,
bool  pip,
QString  startchan 
)

Tells TVRec to spawn a "Live TV" recorder.

See also
EncoderLink::SpawnLiveTV(LiveTVChain*,bool,QString), RemoteEncoder::SpawnLiveTV(QString,bool,QSting)

Definition at line 2660 of file tv_rec.cpp.

Referenced by EncoderLink::SpawnLiveTV().

◆ GetChainID()

QString TVRec::GetChainID ( void  )

Get the chainid of the livetv instance.

Definition at line 2690 of file tv_rec.cpp.

Referenced by EncoderLink::GetChainID().

◆ StopLiveTV()

void TVRec::StopLiveTV ( void  )

Tells TVRec to stop a "Live TV" recorder.

See also
EncoderLink::StopLiveTV(), RemoteEncoder::StopLiveTV()

Definition at line 2869 of file tv_rec.cpp.

Referenced by RemoteStopLiveTV(), and EncoderLink::StopLiveTV().

◆ PauseRecorder()

void TVRec::PauseRecorder ( void  )

Tells "recorder" to pause, used for channel and input changes.

When the RecorderBase instance has paused it calls RecorderPaused(void)

See also
EncoderLink::PauseRecorder(void), RemoteEncoder::PauseRecorder(void), RecorderBase::Pause(void)

Definition at line 2916 of file tv_rec.cpp.

Referenced by EncoderLink::PauseRecorder().

◆ ToggleChannelFavorite()

void TVRec::ToggleChannelFavorite ( const QString &  changroupname)

Toggles whether the current channel should be on our favorites list.

Definition at line 2944 of file tv_rec.cpp.

Referenced by EncoderLink::ToggleChannelFavorite().

◆ SetLiveRecording()

void TVRec::SetLiveRecording ( int  recording)

Tells the Scheduler about changes to the recording status of the LiveTV recording.

NOTE: Currently the 'recording' parameter is ignored and decisions are based on the recording group alone.

Parameters
recordingSet to 1 to mark as RecStatus::Recording, set to 0 to mark as RecStatus::Cancelled, and set to -1 to base the decision of the recording group.

Definition at line 2821 of file tv_rec.cpp.

Referenced by EncoderLink::SetLiveRecording().

◆ GetInput()

QString TVRec::GetInput ( void  ) const

Returns current input.

Definition at line 3028 of file tv_rec.cpp.

Referenced by EncoderLink::GetInput().

◆ GetSourceID()

uint TVRec::GetSourceID ( void  ) const

Returns current source id.

Definition at line 3038 of file tv_rec.cpp.

Referenced by EITScanner::run().

◆ SetInput()

QString TVRec::SetInput ( QString  input)

Changes to the specified input.

You must call PauseRecorder(void) before calling this.

Parameters
inputInput to switch to, or "SwitchToNextInput".
Returns
input we have switched to

Definition at line 3053 of file tv_rec.cpp.

Referenced by EncoderLink::SetInput().

◆ ChangeChannel()

void TVRec::ChangeChannel ( ChannelChangeDirection  dir)
inline

Changes to a channel in the 'dir' channel change direction.

Definition at line 205 of file tv_rec.h.

Referenced by EncoderLink::ChangeChannel().

◆ SetChannel()

void TVRec::SetChannel ( const QString &  name,
uint  requestType = kFlagDetect 
)

Changes to a named channel on the current tuner.

You must call PauseRecorder() before calling this.

Parameters
namechannum of channel to change to
requestTypetells us what kind of request to actually send to the tuning thread, kFlagDetect is usually sufficient

Definition at line 3079 of file tv_rec.cpp.

Referenced by EncoderLink::SetChannel().

◆ QueueEITChannelChange()

bool TVRec::QueueEITChannelChange ( const QString &  name)

Queues up a channel change for the EITScanner.

Unlike the normal SetChannel() this does not block until the channel change occurs to avoid a deadlock if EITScanner::StopActiveScan() is called with the stateChangeLock held while the EITScanner is calling TVRec::SetChannel().

Definition at line 3128 of file tv_rec.cpp.

Referenced by EITScanner::run().

◆ SetSignalMonitoringRate()

int TVRec::SetSignalMonitoringRate ( int  rate,
int  notifyFrontend = 1 
)

Sets the signal monitoring rate.

See also
EncoderLink::SetSignalMonitoringRate(int,int), RemoteEncoder::SetSignalMonitoringRate(int,int)
Parameters
rateThe update rate to use in milliseconds, use 0 to disable signal monitoring.
notifyFrontendIf 1, SIGNAL messages will be sent to the frontend using this recorder.
Returns
1 if it signal monitoring is turned on, 0 otherwise.

Definition at line 2124 of file tv_rec.cpp.

Referenced by EncoderLink::SetSignalMonitoringRate().

◆ GetPictureAttribute()

int TVRec::GetPictureAttribute ( PictureAttribute  attr)

Definition at line 2994 of file tv_rec.cpp.

Referenced by EncoderLink::GetPictureAttribute().

◆ ChangePictureAttribute()

int TVRec::ChangePictureAttribute ( PictureAdjustType  type,
PictureAttribute  attr,
bool  direction 
)

Returns current value [0,100] if it succeeds, -1 otherwise.

Changes brightness/contrast/colour/hue of a recording.

Note: In practice this only works with frame grabbing recorders.

Note: In practice this only works with frame grabbing recorders.

Returns
current value [0,100] if it succeeds, -1 otherwise.

Definition at line 3012 of file tv_rec.cpp.

Referenced by EncoderLink::ChangePictureAttribute().

◆ CheckChannel()

bool TVRec::CheckChannel ( const QString &  name) const

Checks if named channel exists on current tuner.

Parameters
namechannel to verify against current tuner.
Returns
true if it succeeds, false otherwise.
See also
EncoderLink::CheckChannel(const QString&), RemoteEncoder::CheckChannel(QString), CheckChannel(ChannelBase*,const QString&,QString&), ShouldSwitchToAnotherInput(QString)

Definition at line 2268 of file tv_rec.cpp.

Referenced by EncoderLink::CheckChannel().

◆ ShouldSwitchToAnotherInput()

bool TVRec::ShouldSwitchToAnotherInput ( const QString &  chanid)

Checks if named channel exists on current tuner, or another tuner.

Parameters
chanidchannel to verify against tuners.
Returns
true if the channel on another tuner and not current tuner, false otherwise.
See also
EncoderLink::ShouldSwitchToAnotherInput(const QString&), RemoteEncoder::ShouldSwitchToAnotherInput(QString), CheckChannel(QString)

Definition at line 2178 of file tv_rec.cpp.

Referenced by EncoderLink::ShouldSwitchToAnotherInput().

◆ CheckChannelPrefix()

bool TVRec::CheckChannelPrefix ( const QString &  prefix,
uint complete_valid_channel_on_rec,
bool is_extra_char_useful,
QString &  needed_spacer 
)

Checks a prefix against the channels in the DB.

If the prefix matches a channel on any recorder this function returns true, otherwise it returns false.

If the prefix matches any channel entirely (i.e. prefix == channum), then the inputid of the recorder it matches is returned in 'complete_valid_channel_on_rec'; if it matches multiple recorders, and one of them is this recorder, this recorder is returned in 'complete_valid_channel_on_rec'; if it isn't complete for any channel on any recorder 'complete_valid_channel_on_rec' is set to zero.

If adding another character could reduce the number of channels the prefix matches 'is_extra_char_useful' is set to true, otherwise it is set to false.

Finally, if in order for the prefix to match a channel, a spacer needs to be added, the first matching spacer is returned in needed_spacer. If there is more than one spacer that might be employed and one of them is used for the current recorder, and others are used for other recorders, then the one for the current recorder is returned. The spacer must be inserted before the last character of the prefix for anything else returned from the function to be valid.

Returns
true if this is a valid prefix for a channel, false otherwise

Definition at line 2314 of file tv_rec.cpp.

Referenced by EncoderLink::CheckChannelPrefix().

◆ GetNextProgram()

void TVRec::GetNextProgram ( BrowseDirection  direction,
QString &  title,
QString &  subtitle,
QString &  desc,
QString &  category,
QString &  starttime,
QString &  endtime,
QString &  callsign,
QString &  iconpath,
QString &  channum,
uint chanid,
QString &  seriesid,
QString &  programid 
)

Definition at line 3154 of file tv_rec.cpp.

Referenced by EncoderLink::GetNextProgram().

◆ GetChannelInfo()

bool TVRec::GetChannelInfo ( uint chanid,
uint sourceid,
QString &  callsign,
QString &  channum,
QString &  channame,
QString &  xmltvid 
) const

Definition at line 3277 of file tv_rec.cpp.

Referenced by EncoderLink::GetChannelInfo().

◆ SetChannelInfo()

bool TVRec::SetChannelInfo ( uint  chanid,
uint  sourceid,
const QString &  oldchannum,
const QString &  callsign,
const QString &  channum,
const QString &  channame,
const QString &  xmltvid 
)

Definition at line 3318 of file tv_rec.cpp.

Referenced by EncoderLink::SetChannelInfo().

◆ GetInputId()

uint TVRec::GetInputId ( void  )
inline

◆ GetParentId()

uint TVRec::GetParentId ( void  )
inline

Definition at line 233 of file tv_rec.h.

◆ GetMajorId()

uint TVRec::GetMajorId ( void  )
inline

Definition at line 234 of file tv_rec.h.

◆ IsErrored()

bool TVRec::IsErrored ( void  ) const
inline

Returns true is "errored" is true, false otherwise.

Definition at line 236 of file tv_rec.h.

Referenced by run().

◆ RingBufferChanged()

void TVRec::RingBufferChanged ( RingBuffer rb,
RecordingInfo pginfo,
RecordingQuality recq 
)

Definition at line 3374 of file tv_rec.cpp.

Referenced by RecorderBase::CheckForRingBufferSwitch().

◆ RecorderPaused()

void TVRec::RecorderPaused ( void  )

◆ SetNextLiveTVDir()

void TVRec::SetNextLiveTVDir ( QString  dir)

Definition at line 4523 of file tv_rec.cpp.

Referenced by EncoderLink::SetNextLiveTVDir().

◆ GetFlags()

uint TVRec::GetFlags ( void  ) const
inline

Definition at line 243 of file tv_rec.h.

Referenced by EncoderLink::GetFlags(), HandleStateChange(), and RemoteGetFlags().

◆ GetTVRec()

TVRec * TVRec::GetTVRec ( uint  inputid)
static

◆ AllGood()

void TVRec::AllGood ( void  )
inlineoverridevirtual

Signal to be sent when you have a lock on all values.

Note: Signals are only sent once the monitoring thread has been started.

Implements SignalMonitorListener.

Definition at line 247 of file tv_rec.h.

◆ StatusChannelTuned()

void TVRec::StatusChannelTuned ( const SignalMonitorValue )
inlineoverridevirtual

Signal to be sent with change change status.

Note: Signals are only sent once the monitoring thread has been started.

Implements SignalMonitorListener.

Definition at line 248 of file tv_rec.h.

◆ StatusSignalLock()

void TVRec::StatusSignalLock ( const SignalMonitorValue )
inlineoverridevirtual

Signal to be sent as true when it is safe to begin or continue recording, and false if it may not be safe.

Note: Signals are only sent once the monitoring thread has been started.

Implements SignalMonitorListener.

Definition at line 249 of file tv_rec.h.

◆ StatusSignalStrength()

void TVRec::StatusSignalStrength ( const SignalMonitorValue )
inlineoverridevirtual

Signal to be sent with an actual signal value.

Note: Signals are only sent once the monitoring thread has been started.

Implements SignalMonitorListener.

Definition at line 250 of file tv_rec.h.

◆ run()

void TVRec::run ( void  )
overrideprotected

Event handling method, contains event loop.

Definition at line 1260 of file tv_rec.cpp.

◆ WaitForEventThreadSleep()

bool TVRec::WaitForEventThreadSleep ( bool  wake = true,
ulong  time = ULONG_MAX 
)
protected

You MUST HAVE the stateChange-lock locked when you call this method!

Definition at line 1511 of file tv_rec.cpp.

Referenced by Init(), SetChannel(), SetSignalMonitoringRate(), SpawnLiveTV(), StartRecording(), StopLiveTV(), and StopRecording().

◆ SetRingBuffer()

void TVRec::SetRingBuffer ( RingBuffer rb)
private

Sets "ringBuffer", deleting any existing RingBuffer.

Definition at line 3357 of file tv_rec.cpp.

Referenced by CreateLiveTVRingBuffer(), RingBufferChanged(), SwitchLiveTVRingBuffer(), TeardownAll(), TuningNewRecorder(), and TuningShutdowns().

◆ SetPseudoLiveTVRecording()

void TVRec::SetPseudoLiveTVRecording ( RecordingInfo pi)
private

Sets the pseudo LiveTV RecordingInfo.

Definition at line 324 of file tv_rec.cpp.

Referenced by CheckForRecGroupChange(), HandleStateChange(), run(), and StartRecording().

◆ TeardownAll()

void TVRec::TeardownAll ( void  )
private

Definition at line 195 of file tv_rec.cpp.

Referenced by run().

◆ WakeEventLoop()

void TVRec::WakeEventLoop ( void  )
private

◆ GetDevices()

bool TVRec::GetDevices ( uint  inputid,
uint parentid,
GeneralDBOptions gen_opts,
DVBDBOptions dvb_opts,
FireWireDBOptions firewire_opts 
)
staticprivate

Definition at line 1626 of file tv_rec.cpp.

Referenced by Init().

◆ GetStartChannel()

QString TVRec::GetStartChannel ( uint  inputid)
staticprivate

Definition at line 1713 of file tv_rec.cpp.

Referenced by Init(), and TuningGetChanNum().

◆ TeardownRecorder()

void TVRec::TeardownRecorder ( uint  request_flags)
private

Tears down the recorder.

If a "recorder" exists, RecorderBase::StopRecording() is called. We then wait for "recorder_thread" to exit, and finally we delete "recorder".

If a RingBuffer instance exists, RingBuffer::StopReads() is called.

If request_flags include kFlagKillRec we mark the recording as being damaged.

Finally, if there was a recording and it was not damaged, schedule any post-processing jobs.

Definition at line 1100 of file tv_rec.cpp.

Referenced by TeardownAll(), TuningNewRecorder(), and TuningShutdowns().

◆ GetDTVRecorder()

DTVRecorder * TVRec::GetDTVRecorder ( void  )
private

◆ CreateChannel()

bool TVRec::CreateChannel ( const QString &  startchannel,
bool  enter_power_save_mode 
)
private

Definition at line 94 of file tv_rec.cpp.

Referenced by Init().

◆ CloseChannel()

void TVRec::CloseChannel ( void  )
private

Definition at line 1160 of file tv_rec.cpp.

Referenced by TuningNewRecorder(), and TuningShutdowns().

◆ GetDTVChannel()

DTVChannel * TVRec::GetDTVChannel ( void  )
private

◆ GetV4LChannel()

V4LChannel * TVRec::GetV4LChannel ( void  )
private

Definition at line 1178 of file tv_rec.cpp.

Referenced by TeardownRecorder(), TuningNewRecorder(), and TuningRestartRecorder().

◆ SetupSignalMonitor()

bool TVRec::SetupSignalMonitor ( bool  tablemon,
bool  EITscan,
bool  notify 
)
private

This creates a SignalMonitor instance and begins signal monitoring.

If the channel exists and there is something to monitor a SignalMonitor instance is created and SignalMonitor::Start() is called to start the signal monitoring thread.

Parameters
tablemonIf set we enable table monitoring
EITscanif set we never look for video streams and we lock on encrypted streams even if we can't decode them.
notifyIf set we notify the frontend of the signal values
Returns
true on success, false on failure

Definition at line 2032 of file tv_rec.cpp.

Referenced by TuningFrequency().

◆ SetupDTVSignalMonitor()

bool TVRec::SetupDTVSignalMonitor ( bool  EITscan)
private

Tells DTVSignalMonitor what channel to look for.

If the major and minor channels are set we tell the signal monitor to look for those in the VCT.

Otherwise, we tell the signal monitor to look for the MPEG program number in the PAT.

This method also grabs the ATSCStreamData() from the recorder if possible, or creates one if needed.

Parameters
EITscanif set we never look for video streams and we lock on encrypted streams even if we can't decode them.

Definition at line 1851 of file tv_rec.cpp.

Referenced by SetupSignalMonitor().

◆ TeardownSignalMonitor()

void TVRec::TeardownSignalMonitor ( void  )
private

If a SignalMonitor instance exists, the monitoring thread is stopped and the instance is deleted.

Definition at line 2086 of file tv_rec.cpp.

Referenced by TeardownAll(), TuningShutdowns(), and TuningSignalCheck().

◆ GetDTVSignalMonitor()

DTVSignalMonitor * TVRec::GetDTVSignalMonitor ( void  )
private

◆ HasFlags()

bool TVRec::HasFlags ( uint  f) const
inlineprivate

◆ SetFlags()

void TVRec::SetFlags ( uint  f,
const QString &  file,
int  line 
)
private

◆ ClearFlags()

void TVRec::ClearFlags ( uint  f,
const QString &  file,
int  line 
)
private

◆ FlagToString()

QString TVRec::FlagToString ( uint  f)
staticprivate

Definition at line 4429 of file tv_rec.cpp.

Referenced by ClearFlags(), SetFlags(), and TuningRequest::toString().

◆ HandleTuning()

void TVRec::HandleTuning ( void  )
private

Handles all tuning events.

This method pops tuning events off the tuningState queue and does what needs to be done, mostly by calling one of the Tuning... methods.

Definition at line 3486 of file tv_rec.cpp.

Referenced by run().

◆ TuningShutdowns()

void TVRec::TuningShutdowns ( const TuningRequest request)
private

This shuts down anything that needs to be shut down before handling the passed in tuning request.

Definition at line 3558 of file tv_rec.cpp.

Referenced by HandleTuning().

◆ TuningFrequency()

void TVRec::TuningFrequency ( const TuningRequest request)
private

Performs initial tuning required for any tuning event.

This figures out the channel name, and possibly the input name we need to pass to "channel" and then calls channel appropriately.

Then it adds any filters and sets any video capture attributes that need to be set.

The signal monitoring is started if possible. If it is started the kFlagWaitForSignal flag is set.

The kFlagNeedToStartRecorder flag is ald set if this isn't an EIT scan so that the recorder is started or restarted a appropriate.

Definition at line 3649 of file tv_rec.cpp.

Referenced by HandleTuning().

◆ TuningSignalCheck()

MPEGStreamData * TVRec::TuningSignalCheck ( void  )
private

This checks if we have a channel lock.

If we have a channel lock this shuts down the signal monitoring.

Returns
MPEGStreamData pointer if we have a complete lock, nullptr otherwise

Definition at line 3895 of file tv_rec.cpp.

Referenced by HandleTuning().

◆ TuningNewRecorder()

void TVRec::TuningNewRecorder ( MPEGStreamData streamData)
private

Creates a recorder instance.

Definition at line 4160 of file tv_rec.cpp.

Referenced by HandleTuning().

◆ TuningRestartRecorder()

void TVRec::TuningRestartRecorder ( void  )
private

Restarts a stopped recorder or unpauses a paused recorder.

Definition at line 4346 of file tv_rec.cpp.

Referenced by HandleTuning().

◆ TuningGetChanNum()

QString TVRec::TuningGetChanNum ( const TuningRequest request,
QString &  input 
) const
private

Definition at line 3396 of file tv_rec.cpp.

Referenced by HandleTuning().

◆ TuningOnSameMultiplex()

bool TVRec::TuningOnSameMultiplex ( TuningRequest request)
private

Definition at line 3435 of file tv_rec.cpp.

Referenced by HandleTuning().

◆ HandleStateChange()

void TVRec::HandleStateChange ( void  )
private

Changes the internalState to the desiredNextState if possible.

Note: There must exist a state transition from any state we can enter to the kState_None state, as this is used to shutdown TV in RunTV.

Definition at line 994 of file tv_rec.cpp.

Referenced by run().

◆ ChangeState()

void TVRec::ChangeState ( TVState  nextState)
private

Puts a state change on the nextState queue.

Definition at line 1078 of file tv_rec.cpp.

Referenced by CreateLiveTVRingBuffer(), run(), SpawnLiveTV(), StartRecording(), StopLiveTV(), StopRecording(), SwitchLiveTVRingBuffer(), TuningFrequency(), and TuningNewRecorder().

◆ StateIsRecording()

bool TVRec::StateIsRecording ( TVState  state)
staticprivate

Returns true if "state" is kState_RecordingOnly, or kState_WatchingLiveTV.

Parameters
stateTVState to check.

Definition at line 729 of file tv_rec.cpp.

Referenced by RemoveRecording(), and StopRecording().

◆ StateIsPlaying()

bool TVRec::StateIsPlaying ( TVState  state)
staticprivate

Returns true if we are in any state associated with a player.

Parameters
stateTVState to check.

Definition at line 739 of file tv_rec.cpp.

Referenced by RemovePlaying(), and run().

◆ RemovePlaying()

TVState TVRec::RemovePlaying ( TVState  state)
private

Returns TVState that would remove the playing, but potentially keep recording if we are watching an in progress recording.

Parameters
stateTVState to check.

Definition at line 765 of file tv_rec.cpp.

Referenced by run().

◆ RemoveRecording()

TVState TVRec::RemoveRecording ( TVState  state)
private

If "state" is kState_RecordingOnly or kState_WatchingLiveTV, returns a kState_None, otherwise returns kState_Error.

Parameters
stateTVState to check.

Definition at line 749 of file tv_rec.cpp.

Referenced by StopRecording().

◆ HandlePendingRecordings()

void TVRec::HandlePendingRecordings ( void  )
private

Definition at line 1548 of file tv_rec.cpp.

Referenced by run().

◆ WaitForNextLiveTVDir()

bool TVRec::WaitForNextLiveTVDir ( void  )
private

Definition at line 4510 of file tv_rec.cpp.

Referenced by GetProgramRingBufferForLiveTV().

◆ GetProgramRingBufferForLiveTV()

bool TVRec::GetProgramRingBufferForLiveTV ( RecordingInfo **  pginfo,
RingBuffer **  rb,
const QString &  channum 
)
private

Definition at line 4531 of file tv_rec.cpp.

Referenced by CreateLiveTVRingBuffer(), and SwitchLiveTVRingBuffer().

◆ CreateLiveTVRingBuffer()

bool TVRec::CreateLiveTVRingBuffer ( const QString &  channum)
private

Definition at line 4629 of file tv_rec.cpp.

Referenced by TuningFrequency(), and TuningNewRecorder().

◆ SwitchLiveTVRingBuffer()

bool TVRec::SwitchLiveTVRingBuffer ( const QString &  channum,
bool  discont,
bool  set_rec 
)
private

Definition at line 4676 of file tv_rec.cpp.

Referenced by run(), TuningFrequency(), TuningNewRecorder(), and TuningRestartRecorder().

◆ SwitchRecordingRingBuffer()

RecordingInfo * TVRec::SwitchRecordingRingBuffer ( const RecordingInfo rcinfo)
private

Definition at line 4745 of file tv_rec.cpp.

Referenced by StartRecording().

◆ StartedRecording()

void TVRec::StartedRecording ( RecordingInfo curRec)
private

Inserts a "curRec" into the database.

Parameters
curRecRecording to add to database.
See also
ProgramInfo::StartedRecording(const QString&)

Definition at line 785 of file tv_rec.cpp.

Referenced by GetProgramRingBufferForLiveTV(), StartRecording(), and SwitchRecordingRingBuffer().

◆ FinishedRecording()

void TVRec::FinishedRecording ( RecordingInfo curRec,
RecordingQuality recq 
)
private

If not a premature stop, adds program to history of recorded programs.

If the recording type is kOneRecord this find is removed.

See also
ProgramInfo::FinishedRecording(bool prematurestop)
Parameters
curRecRecordingInfo or recording to mark as done
recqInformation on the quality if the recording.

Definition at line 811 of file tv_rec.cpp.

Referenced by RingBufferChanged(), SwitchLiveTVRingBuffer(), SwitchRecordingRingBuffer(), TeardownRecorder(), TuningNewRecorder(), TuningRestartRecorder(), and TuningShutdowns().

◆ GetRecordEndTime()

QDateTime TVRec::GetRecordEndTime ( const ProgramInfo pi) const
private

Returns recording end time with proper post-roll.

Definition at line 334 of file tv_rec.cpp.

Referenced by RingBufferChanged(), SetLiveRecording(), StartRecording(), StopLiveTV(), and SwitchRecordingRingBuffer().

◆ CheckForRecGroupChange()

void TVRec::CheckForRecGroupChange ( void  )
private

Check if frontend changed the recording group.

This is needed because the frontend may toggle whether something should be kept as a recording in the frontend, but this class may not find out about it in time unless we check the DB when this information is important.

Definition at line 2705 of file tv_rec.cpp.

Referenced by HandlePendingRecordings(), SetLiveRecording(), and StopLiveTV().

◆ NotifySchedulerOfRecording()

void TVRec::NotifySchedulerOfRecording ( RecordingInfo rec)
private

Tell scheduler about the recording.

This is needed if the frontend has marked the LiveTV buffer for recording after we exit LiveTV. In this case the scheduler needs to know about the recording so it can properly take overrecord into account, and to properly reschedule other recordings around to avoid this recording.

Definition at line 2739 of file tv_rec.cpp.

Referenced by SetLiveRecording(), and StopLiveTV().

◆ InitAutoRunJobs()

void TVRec::InitAutoRunJobs ( RecordingInfo rec,
AutoRunInitType  t,
RecordingProfile recpro,
int  line 
)
private

◆ SetRecordingStatus()

void TVRec::SetRecordingStatus ( RecStatus::Type  new_status,
int  line,
bool  have_lock = false 
)
private

◆ LoadProfile()

QString TVRec::LoadProfile ( void *  tvchain,
RecordingInfo rec,
RecordingProfile profile 
)
private

Friends And Related Function Documentation

◆ TuningRequest

friend class TuningRequest
friend

◆ TVRecRecordThread

friend class TVRecRecordThread
friend

Definition at line 146 of file tv_rec.h.

Member Data Documentation

◆ m_recorder

RecorderBase* TVRec::m_recorder {nullptr}
private

◆ m_channel

ChannelBase* TVRec::m_channel {nullptr}
private

◆ m_signalMonitor

SignalMonitor* TVRec::m_signalMonitor {nullptr}
private

◆ m_scanner

EITScanner* TVRec::m_scanner {nullptr}
private

◆ m_signalEventCmdTimeout

QDateTime TVRec::m_signalEventCmdTimeout
private

Definition at line 339 of file tv_rec.h.

Referenced by TuningFrequency(), and TuningSignalCheck().

◆ m_signalEventCmdSent

bool TVRec::m_signalEventCmdSent {false}
private

Definition at line 340 of file tv_rec.h.

Referenced by TuningFrequency(), and TuningSignalCheck().

◆ m_startRecordingDeadline

QDateTime TVRec::m_startRecordingDeadline
private

Definition at line 342 of file tv_rec.h.

Referenced by TuningFrequency(), and TuningSignalCheck().

◆ m_signalMonitorDeadline

QDateTime TVRec::m_signalMonitorDeadline
private

Definition at line 343 of file tv_rec.h.

Referenced by TuningFrequency(), and TuningSignalCheck().

◆ m_signalMonitorCheckCnt

uint TVRec::m_signalMonitorCheckCnt {0}
private

Definition at line 344 of file tv_rec.h.

Referenced by TuningFrequency(), and TuningSignalCheck().

◆ m_reachedRecordingDeadline

bool TVRec::m_reachedRecordingDeadline {false}
private

Definition at line 345 of file tv_rec.h.

Referenced by TuningFrequency(), and TuningSignalCheck().

◆ m_preFailDeadline

QDateTime TVRec::m_preFailDeadline
private

Definition at line 346 of file tv_rec.h.

Referenced by TuningFrequency(), and TuningSignalCheck().

◆ m_reachedPreFail

bool TVRec::m_reachedPreFail {false}
private

Definition at line 347 of file tv_rec.h.

Referenced by TuningFrequency(), and TuningSignalCheck().

◆ m_eventThread

MThread* TVRec::m_eventThread {nullptr}
private

Event processing thread, runs TVRec::run().

Definition at line 351 of file tv_rec.h.

Referenced by Init(), and ~TVRec().

◆ m_recorderThread

MThread* TVRec::m_recorderThread {nullptr}
private

Recorder thread, runs RecorderBase::run().

Definition at line 353 of file tv_rec.h.

Referenced by TeardownRecorder(), and TuningNewRecorder().

◆ m_transcodeFirst

bool TVRec::m_transcodeFirst {false}
private

Definition at line 356 of file tv_rec.h.

Referenced by Init(), and InitAutoRunJobs().

◆ m_earlyCommFlag

bool TVRec::m_earlyCommFlag {false}
private

Definition at line 357 of file tv_rec.h.

Referenced by Init(), and InitAutoRunJobs().

◆ m_runJobOnHostOnly

bool TVRec::m_runJobOnHostOnly {false}
private

Definition at line 358 of file tv_rec.h.

Referenced by Init(), and InitAutoRunJobs().

◆ m_eitCrawlIdleStart

int TVRec::m_eitCrawlIdleStart {60}
private

Definition at line 359 of file tv_rec.h.

Referenced by HandleStateChange(), Init(), run(), and TuningShutdowns().

◆ m_eitTransportTimeout

int TVRec::m_eitTransportTimeout {5*60}
private

Definition at line 360 of file tv_rec.h.

Referenced by HandleStateChange(), Init(), run(), and TuningShutdowns().

◆ m_audioSampleRateDB

int TVRec::m_audioSampleRateDB {0}
private

Definition at line 361 of file tv_rec.h.

Referenced by Init().

◆ m_overRecordSecNrml

int TVRec::m_overRecordSecNrml {0}
private

Definition at line 362 of file tv_rec.h.

Referenced by GetRecordEndTime(), and Init().

◆ m_overRecordSecCat

int TVRec::m_overRecordSecCat {0}
private

Definition at line 363 of file tv_rec.h.

Referenced by GetRecordEndTime(), and Init().

◆ m_overRecordCategory

QString TVRec::m_overRecordCategory
private

Definition at line 364 of file tv_rec.h.

Referenced by GetRecordEndTime(), and Init().

◆ m_inputid

uint TVRec::m_inputid
private

◆ m_parentid

uint TVRec::m_parentid {0}
private

Definition at line 368 of file tv_rec.h.

Referenced by CreateChannel(), and Init().

◆ m_ispip

bool TVRec::m_ispip {false}
private

Definition at line 369 of file tv_rec.h.

Referenced by SpawnLiveTV(), and TeardownRecorder().

◆ m_genOpt

GeneralDBOptions TVRec::m_genOpt
private

◆ m_dvbOpt

DVBDBOptions TVRec::m_dvbOpt
private

Definition at line 373 of file tv_rec.h.

Referenced by CloseChannel(), CreateChannel(), Init(), and run().

◆ m_fwOpt

FireWireDBOptions TVRec::m_fwOpt
private

Definition at line 374 of file tv_rec.h.

Referenced by CreateChannel(), and Init().

◆ m_recProfileName

QString TVRec::m_recProfileName
private

Definition at line 376 of file tv_rec.h.

Referenced by SetupDTVSignalMonitor(), SwitchRecordingRingBuffer(), and TuningNewRecorder().

◆ m_setChannelLock

QMutex TVRec::m_setChannelLock
mutableprivate

Definition at line 379 of file tv_rec.h.

Referenced by QueueEITChannelChange(), and SetChannel().

◆ m_stateChangeLock

QMutex TVRec::m_stateChangeLock {QMutex::Recursive}
mutableprivate

◆ m_pendingRecLock

QMutex TVRec::m_pendingRecLock {QMutex::Recursive}
mutableprivate

◆ m_internalState

TVState TVRec::m_internalState {kState_None}
private

◆ m_desiredNextState

TVState TVRec::m_desiredNextState {kState_None}
private

Definition at line 383 of file tv_rec.h.

Referenced by ChangeState(), and HandleStateChange().

◆ m_changeState

bool TVRec::m_changeState {false}
private

◆ m_pauseNotify

bool TVRec::m_pauseNotify {true}
private

Definition at line 385 of file tv_rec.h.

Referenced by RecorderPaused(), and TeardownRecorder().

◆ m_stateFlags

uint TVRec::m_stateFlags {0}
private

Definition at line 386 of file tv_rec.h.

Referenced by ClearFlags(), and SetFlags().

◆ m_tuningRequests

TuningQueue TVRec::m_tuningRequests
private

◆ m_lastTuningRequest

TuningRequest TVRec::m_lastTuningRequest {0}
private

Definition at line 388 of file tv_rec.h.

Referenced by HandleTuning(), SetChannel(), SetupDTVSignalMonitor(), and TuningNewRecorder().

◆ m_eitScanStartTime

QDateTime TVRec::m_eitScanStartTime
private

Definition at line 389 of file tv_rec.h.

Referenced by HandleStateChange(), run(), and TuningShutdowns().

◆ m_triggerEventLoopLock

QMutex TVRec::m_triggerEventLoopLock {QMutex::NonRecursive}
mutableprivate

Definition at line 390 of file tv_rec.h.

Referenced by run(), and WakeEventLoop().

◆ m_triggerEventLoopWait

QWaitCondition TVRec::m_triggerEventLoopWait
private

Definition at line 391 of file tv_rec.h.

Referenced by run(), and WakeEventLoop().

◆ m_triggerEventLoopSignal

bool TVRec::m_triggerEventLoopSignal {false}
private

Definition at line 392 of file tv_rec.h.

Referenced by run(), and WakeEventLoop().

◆ m_triggerEventSleepLock

QMutex TVRec::m_triggerEventSleepLock {QMutex::NonRecursive}
mutableprivate

Definition at line 393 of file tv_rec.h.

Referenced by run(), and WaitForEventThreadSleep().

◆ m_triggerEventSleepWait

QWaitCondition TVRec::m_triggerEventSleepWait
private

Definition at line 394 of file tv_rec.h.

Referenced by run(), and WaitForEventThreadSleep().

◆ m_triggerEventSleepSignal

bool TVRec::m_triggerEventSleepSignal {false}
private

Definition at line 395 of file tv_rec.h.

Referenced by run(), and WaitForEventThreadSleep().

◆ m_switchingBuffer

volatile bool TVRec::m_switchingBuffer {false}
private

Definition at line 396 of file tv_rec.h.

Referenced by run(), SetRingBuffer(), and SwitchRecordingRingBuffer().

◆ m_recStatus

RecStatus::Type TVRec::m_recStatus {RecStatus::Unknown}
private

Definition at line 397 of file tv_rec.h.

Referenced by GetRecordingStatus(), SetRecordingStatus(), and StartRecording().

◆ m_curRecording

RecordingInfo* TVRec::m_curRecording {nullptr}
private

◆ m_recordEndTime

QDateTime TVRec::m_recordEndTime
private

◆ m_autoRunJobs

QHash<QString,int> TVRec::m_autoRunJobs
private

Definition at line 403 of file tv_rec.h.

Referenced by FinishedRecording(), and InitAutoRunJobs().

◆ m_overrecordseconds

int TVRec::m_overrecordseconds {0}
private

Definition at line 404 of file tv_rec.h.

◆ m_pendingRecordings

PendingMap TVRec::m_pendingRecordings
private

◆ m_pseudoLiveTVRecording

RecordingInfo* TVRec::m_pseudoLiveTVRecording {nullptr}
private

◆ m_nextLiveTVDir

QString TVRec::m_nextLiveTVDir
private

Definition at line 411 of file tv_rec.h.

Referenced by GetProgramRingBufferForLiveTV(), SetNextLiveTVDir(), and WaitForNextLiveTVDir().

◆ m_nextLiveTVDirLock

QMutex TVRec::m_nextLiveTVDirLock
private

Definition at line 412 of file tv_rec.h.

Referenced by GetProgramRingBufferForLiveTV(), SetNextLiveTVDir(), and WaitForNextLiveTVDir().

◆ m_triggerLiveTVDir

QWaitCondition TVRec::m_triggerLiveTVDir
private

Definition at line 413 of file tv_rec.h.

Referenced by SetNextLiveTVDir(), and WaitForNextLiveTVDir().

◆ m_liveTVStartChannel

QString TVRec::m_liveTVStartChannel
private

Definition at line 414 of file tv_rec.h.

Referenced by SpawnLiveTV(), and TuningGetChanNum().

◆ m_tvChain

LiveTVChain* TVRec::m_tvChain {nullptr}
private

◆ m_ringBuffer

RingBuffer* TVRec::m_ringBuffer {nullptr}
private

◆ m_rbFileExt

QString TVRec::m_rbFileExt {"ts"}
private

Definition at line 421 of file tv_rec.h.

Referenced by CreateChannel(), and StartedRecording().

◆ s_inputsLock

QReadWriteLock TVRec::s_inputsLock
static

◆ s_inputs

QMap< uint, TVRec * > TVRec::s_inputs
static

Definition at line 425 of file tv_rec.h.

Referenced by cleanup(), GetTVRec(), TVRec(), and ~TVRec().

◆ kSignalMonitoringRate

const uint TVRec::kSignalMonitoringRate = 50
static

How many milliseconds the signal monitor should wait between checks.

Definition at line 428 of file tv_rec.h.

Referenced by SetupSignalMonitor().

◆ kFlagFrontendReady

const uint TVRec::kFlagFrontendReady = 0x00000001
static

Definition at line 431 of file tv_rec.h.

Referenced by FlagToString(), and run().

◆ kFlagRunMainLoop

const uint TVRec::kFlagRunMainLoop = 0x00000002
static

Definition at line 432 of file tv_rec.h.

Referenced by FlagToString(), run(), and ~TVRec().

◆ kFlagExitPlayer

const uint TVRec::kFlagExitPlayer = 0x00000004
static

Definition at line 433 of file tv_rec.h.

Referenced by FlagToString(), and run().

◆ kFlagFinishRecording

const uint TVRec::kFlagFinishRecording = 0x00000008
static

Definition at line 434 of file tv_rec.h.

Referenced by FlagToString(), and run().

◆ kFlagErrored

const uint TVRec::kFlagErrored = 0x00000010
static

Definition at line 435 of file tv_rec.h.

Referenced by CreateChannel(), and FlagToString().

◆ kFlagCancelNextRecording

const uint TVRec::kFlagCancelNextRecording = 0x00000020
static

◆ kFlagLiveTV

const uint TVRec::kFlagLiveTV = 0x00000100
static

final result desired is LiveTV recording

Definition at line 440 of file tv_rec.h.

Referenced by FlagToString(), HandleStateChange(), HandleTuning(), SetSignalMonitoringRate(), TuningFrequency(), TuningGetChanNum(), and TuningNewRecorder().

◆ kFlagRecording

const uint TVRec::kFlagRecording = 0x00000200
static

final result desired is a timed recording

Definition at line 442 of file tv_rec.h.

Referenced by FlagToString(), HandleStateChange(), HandleTuning(), and TuningNewRecorder().

◆ kFlagAntennaAdjust

const uint TVRec::kFlagAntennaAdjust = 0x00000400
static

antenna adjusting mode (LiveTV without recording).

Definition at line 444 of file tv_rec.h.

Referenced by FlagToString(), HandleTuning(), SetSignalMonitoringRate(), TuningFrequency(), and TuningOnSameMultiplex().

◆ kFlagRec

const uint TVRec::kFlagRec = 0x00000F00
static

Definition at line 445 of file tv_rec.h.

Referenced by FlagToString(), SetChannel(), and TuningFrequency().

◆ kFlagEITScan

const uint TVRec::kFlagEITScan = 0x00001000
static

final result desired is an EIT Scan

Definition at line 449 of file tv_rec.h.

Referenced by FlagToString(), HandleTuning(), QueueEITChannelChange(), SetChannel(), TuningFrequency(), and TuningShutdowns().

◆ kFlagCloseRec

const uint TVRec::kFlagCloseRec = 0x00002000
static

close recorder, keep recording

Definition at line 451 of file tv_rec.h.

Referenced by FlagToString(), and HandleStateChange().

◆ kFlagKillRec

const uint TVRec::kFlagKillRec = 0x00004000
static

close recorder, discard recording

Definition at line 453 of file tv_rec.h.

Referenced by FlagToString(), HandleStateChange(), StopRecording(), TeardownAll(), TeardownRecorder(), TuningFrequency(), and TuningNewRecorder().

◆ kFlagNoRec

const uint TVRec::kFlagNoRec = 0x0000F000
static

◆ kFlagKillRingBuffer

const uint TVRec::kFlagKillRingBuffer = 0x00010000
static

Definition at line 456 of file tv_rec.h.

Referenced by FlagToString(), HandleStateChange(), and TuningShutdowns().

◆ kFlagWaitingForRecPause

const uint TVRec::kFlagWaitingForRecPause = 0x00100000
static

Definition at line 459 of file tv_rec.h.

Referenced by FlagToString(), and HandleTuning().

◆ kFlagWaitingForSignal

const uint TVRec::kFlagWaitingForSignal = 0x00200000
static

◆ kFlagNeedToStartRecorder

const uint TVRec::kFlagNeedToStartRecorder = 0x00800000
static

◆ kFlagPendingActions

const uint TVRec::kFlagPendingActions = 0x00F00000
static

Definition at line 462 of file tv_rec.h.

Referenced by CreateLiveTVRingBuffer(), FlagToString(), TuningNewRecorder(), and TuningShutdowns().

◆ kFlagSignalMonitorRunning

const uint TVRec::kFlagSignalMonitorRunning = 0x01000000
static

Definition at line 465 of file tv_rec.h.

Referenced by FlagToString(), TuningFrequency(), TuningShutdowns(), and TuningSignalCheck().

◆ kFlagEITScannerRunning

const uint TVRec::kFlagEITScannerRunning = 0x04000000
static

◆ kFlagDummyRecorderRunning

const uint TVRec::kFlagDummyRecorderRunning = 0x10000000
static

◆ kFlagRecorderRunning

const uint TVRec::kFlagRecorderRunning = 0x20000000
static

Definition at line 469 of file tv_rec.h.

Referenced by FlagToString(), TeardownRecorder(), TuningNewRecorder(), and TuningShutdowns().

◆ kFlagAnyRecRunning

const uint TVRec::kFlagAnyRecRunning = 0x30000000
static

Definition at line 470 of file tv_rec.h.

Referenced by FlagToString().

◆ kFlagAnyRunning

const uint TVRec::kFlagAnyRunning = 0x3F000000
static

Definition at line 471 of file tv_rec.h.

Referenced by FlagToString().

◆ kFlagRingBufferReady

const uint TVRec::kFlagRingBufferReady = 0x40000000
static

◆ kFlagDetect

const uint TVRec::kFlagDetect = 0x80000000
static

Definition at line 475 of file tv_rec.h.

Referenced by SetChannel().


The documentation for this class was generated from the following files: