MythTV  master
Public Member Functions | Private Member Functions | Private Attributes | List of all members
EncoderLink Class Reference

Provides an interface to both local and remote TVRec's for the mythbackend. More...

#include <encoderlink.h>

Collaboration diagram for EncoderLink:
Collaboration graph
[legend]

Public Member Functions

 EncoderLink (int inputid, PlaybackSock *lsock, QString lhostname)
 This is the EncoderLink constructor for non-local recorders. More...
 
 EncoderLink (int inputid, TVRec *ltv)
 This is the EncoderLink constructor for local recorders. More...
 
 ~EncoderLink ()
 Destructor does nothing for non-local EncoderLink instances, but deletes the TVRec for local EncoderLink instances. More...
 
void SetSocket (PlaybackSock *lsock)
 Used to set the socket for a non-local EncoderLink. More...
 
PlaybackSockGetSocket (void)
 Returns the socket, if set, for a non-local EncoderLink. More...
 
void SetSleepStatus (SleepStatus newStatus)
 Used to set the asleep status of an encoder. More...
 
QDateTime GetSleepStatusTime (void) const
 Get the last time the sleep status was changed. More...
 
QDateTime GetLastSleepTime (void) const
 Get the last time the encoder was put to sleep. More...
 
void SetLastWakeTime (QDateTime newTime)
 Used to set the last wake time of an encoder. More...
 
QDateTime GetLastWakeTime (void) const
 Get the last time the encoder was awakened. More...
 
QString GetHostName (void) const
 Returns the remote host for a non-local EncoderLink. More...
 
bool IsLocal (void) const
 Returns true for a local EncoderLink. More...
 
bool IsConnected (void) const
 Returns true if the EncoderLink instance is usable. More...
 
bool IsAwake (void) const
 Returns true if the encoder is awake. More...
 
bool IsAsleep (void) const
 Returns true if the encoder is asleep. More...
 
bool IsWaking (void) const
 Returns true if the encoder is waking up. More...
 
bool IsFallingAsleep (void) const
 Returns true if the encoder is falling asleep. More...
 
bool CanSleep (void) const
 Returns true if the encoder can sleep. More...
 
SleepStatus GetSleepStatus (void) const
 Returns the current Sleep Status of the encoder. More...
 
int GetInputID (void) const
 Returns the inputid used to refer to the recorder in the DB. More...
 
TVRecGetTVRec (void)
 Returns the TVRec used by a local EncoderLink instance. More...
 
bool GoToSleep (void)
 Tell a slave backend to go to sleep. More...
 
int LockTuner (void)
 Lock the tuner for exclusive use. More...
 
void FreeTuner (void)
 Unlock the tuner. More...
 
bool IsTunerLocked (void) const
 Returns true iff the tuner is locked. More...
 
bool CheckFile (ProgramInfo *pginfo)
 Checks if program is stored locally. More...
 
void GetDiskSpace (QStringList &o_strlist)
 Appends total and used disk space in Kilobytes. More...
 
long long GetMaxBitrate (void)
 Returns maximum bits per second this recorder might output. More...
 
int SetSignalMonitoringRate (int rate, int notifyFrontend)
 Sets the signal monitoring rate. More...
 
bool IsBusy (InputInfo *busy_input=nullptr, int time_buffer=5)
 Returns true if the recorder is busy, or will be within the next time_buffer seconds. More...
 
bool IsBusyRecording (void)
 Returns true if the TVRec state is in a recording state. More...
 
TVState GetState ()
 Returns the TVState of the recorder. More...
 
uint GetFlags (void)
 Returns the flag state of the recorder. More...
 
bool IsRecording (const ProgramInfo *rec)
 Returns true if rec is scheduled for recording. More...
 
bool MatchesRecording (const ProgramInfo *rec)
 Returns true if rec is actually being recorded by TVRec. More...
 
void RecordPending (const ProgramInfo *rec, int secsleft, bool hasLater)
 Tells TVRec there is a pending recording "rec" in "secsleft" seconds. More...
 
RecStatus::Type StartRecording (ProgramInfo *rec)
 Tells TVRec to Start recording the program "rec" as soon as possible. More...
 
RecStatus::Type GetRecordingStatus (void)
 
void StopRecording (bool killFile=false)
 Tells TVRec to stop recording immediately. More...
 
void FinishRecording (void)
 Tells TVRec to stop recording, but only after "overrecord" seconds. More...
 
void FrontendReady (void)
 Tells TVRec that the frontend is ready for data. More...
 
void CancelNextRecording (bool)
 Tells TVRec to cancel the next recording. More...
 
bool WouldConflict (const ProgramInfo *rec)
 Checks a recording against any recording current or pending recordings on the recorder represented by this EncoderLink. More...
 
bool IsReallyRecording (void)
 Checks if the RecorderBase held by TVRec is actually recording. More...
 
ProgramInfoGetRecording (void)
 Returns TVRec's current recording. More...
 
float GetFramerate (void)
 Returns the recording frame rate from TVRec. More...
 
long long GetFramesWritten (void)
 Returns number of frames written to disk by TVRec's RecorderBase instance. More...
 
long long GetFilePosition (void)
 Returns total number of bytes written by TVRec's RingBuffer. More...
 
int64_t GetKeyframePosition (uint64_t desired)
 Returns byte position in RingBuffer of a keyframe. More...
 
bool GetKeyframePositions (int64_t start, int64_t end, frm_pos_map_t &)
 
bool GetKeyframeDurations (int64_t start, int64_t end, frm_pos_map_t &)
 
void SpawnLiveTV (LiveTVChain *chain, bool pip, QString startchan)
 Tells TVRec to Spawn a "Live TV" recorder. More...
 
QString GetChainID (void)
 Get the LiveTV chain id that's in use. More...
 
void StopLiveTV (void)
 Tells TVRec to stop a "Live TV" recorder. More...
 
void PauseRecorder (void)
 Tells TVRec to pause a recorder, used for channel and input changes. More...
 
void SetLiveRecording (int)
 Tells TVRec to keep a LiveTV recording if 'recording' is 1. More...
 
void SetNextLiveTVDir (const QString &dir)
 Tells TVRec where to put the next LiveTV recording. More...
 
QString GetInput (void) const
 Returns TVRec's recorders current input. More...
 
QString SetInput (QString)
 Tells TVRec's recorder to change to the specified input. More...
 
void ToggleChannelFavorite (QString)
 Toggles whether the current channel should be on our favorites list. More...
 
void ChangeChannel (ChannelChangeDirection channeldirection)
 Changes to the next or previous channel. More...
 
void SetChannel (const QString &name)
 Changes to a named channel on the current tuner. More...
 
int GetPictureAttribute (PictureAttribute attr)
 Changes brightness/contrast/colour/hue of a recording. More...
 
int ChangePictureAttribute (PictureAdjustType type, PictureAttribute attr, bool direction)
 Changes brightness/contrast/colour/hue of a recording. More...
 
bool CheckChannel (const QString &name)
 Checks if named channel exists on current tuner. More...
 
bool ShouldSwitchToAnotherInput (const QString &channelid)
 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 &channelname, uint &chanid, QString &seriesid, QString &programid)
 Returns information about the program that would be seen if we changed the channel using ChangeChannel(int) with "direction". More...
 
bool GetChannelInfo (uint &chanid, uint &sourceid, QString &callsign, QString &channum, QString &channame, QString &xmltv) const
 
bool SetChannelInfo (uint chanid, uint sourceid, QString oldchannum, QString callsign, QString channum, QString channame, QString xmltv)
 
bool AddChildInput (uint childid)
 

Private Member Functions

bool HasSockAndIncrRef ()
 Atomicly checks if sock is not null and increases its refcount. More...
 
bool HasSockAndDecrRef ()
 Atomicly checks if sock is not null and decreases its refcount. More...
 

Private Attributes

int m_inputid
 
PlaybackSockm_sock {nullptr}
 
QMutex m_sockLock
 
QString m_hostname
 
TVRecm_tv {nullptr}
 
bool m_local {false}
 
bool m_locked {false}
 
SleepStatus m_sleepStatus {sStatus_Undefined}
 
QDateTime m_sleepStatusTime
 
QDateTime m_lastSleepTime
 
QDateTime m_lastWakeTime
 
QDateTime m_endRecordingTime
 
QDateTime m_startRecordingTime
 
uint m_chanid {0}
 

Detailed Description

Provides an interface to both local and remote TVRec's for the mythbackend.

This class be instantiated for either a local or remote TVRec's. Many of the methods will work with either, but many only work for a local TVRec's and these are labeled appropriately in this document.

When used with a remote TVRec all calls go through a PlaybackSock instance.

This class is used primarily by the MainServer, Scheduler and AutoExpire classes.

Definition at line 21 of file encoderlink.h.

Constructor & Destructor Documentation

◆ EncoderLink() [1/2]

EncoderLink::EncoderLink ( int  inputid,
PlaybackSock lsock,
QString  lhostname 
)

This is the EncoderLink constructor for non-local recorders.

Definition at line 43 of file encoderlink.cpp.

◆ EncoderLink() [2/2]

EncoderLink::EncoderLink ( int  inputid,
TVRec ltv 
)

This is the EncoderLink constructor for local recorders.

Definition at line 60 of file encoderlink.cpp.

◆ ~EncoderLink()

EncoderLink::~EncoderLink ( void  )

Destructor does nothing for non-local EncoderLink instances, but deletes the TVRec for local EncoderLink instances.

Definition at line 75 of file encoderlink.cpp.

Member Function Documentation

◆ SetSocket()

void EncoderLink::SetSocket ( PlaybackSock lsock)

Used to set the socket for a non-local EncoderLink.

Increases refcount on lsock, decreases refcount on old sock, if exists.

Definition at line 118 of file encoderlink.cpp.

Referenced by MainServer::connectionClosed(), MainServer::HandleAddChildInput(), MainServer::HandleAnnounce(), and ~EncoderLink().

◆ GetSocket()

PlaybackSock* EncoderLink::GetSocket ( void  )
inline

Returns the socket, if set, for a non-local EncoderLink.

Definition at line 32 of file encoderlink.h.

Referenced by MainServer::connectionClosed(), and MainServer::HandleAddChildInput().

◆ SetSleepStatus()

void EncoderLink::SetSleepStatus ( SleepStatus  newStatus)

Used to set the asleep status of an encoder.

Sets the sleep status of a recorder.

Definition at line 144 of file encoderlink.cpp.

Referenced by Scheduler::HandleRecording(), Scheduler::PutInactiveSlavesToSleep(), SetSocket(), and Scheduler::WakeUpSlave().

◆ GetSleepStatusTime()

QDateTime EncoderLink::GetSleepStatusTime ( void  ) const
inline

Get the last time the sleep status was changed.

Definition at line 37 of file encoderlink.h.

Referenced by Scheduler::HandleWakeSlave().

◆ GetLastSleepTime()

QDateTime EncoderLink::GetLastSleepTime ( void  ) const
inline

Get the last time the encoder was put to sleep.

Definition at line 39 of file encoderlink.h.

◆ SetLastWakeTime()

void EncoderLink::SetLastWakeTime ( QDateTime  newTime)
inline

Used to set the last wake time of an encoder.

Definition at line 41 of file encoderlink.h.

Referenced by Scheduler::WakeUpSlave().

◆ GetLastWakeTime()

QDateTime EncoderLink::GetLastWakeTime ( void  ) const
inline

Get the last time the encoder was awakened.

Definition at line 43 of file encoderlink.h.

Referenced by Scheduler::HandleRecording(), and Scheduler::HandleWakeSlave().

◆ GetHostName()

QString EncoderLink::GetHostName ( void  ) const
inline

◆ IsLocal()

bool EncoderLink::IsLocal ( void  ) const
inline

◆ IsConnected()

bool EncoderLink::IsConnected ( void  ) const
inline

◆ IsAwake()

bool EncoderLink::IsAwake ( void  ) const
inline

Returns true if the encoder is awake.

Definition at line 52 of file encoderlink.h.

Referenced by Scheduler::PutInactiveSlavesToSleep().

◆ IsAsleep()

bool EncoderLink::IsAsleep ( void  ) const
inline

Returns true if the encoder is asleep.

Definition at line 54 of file encoderlink.h.

Referenced by Scheduler::AddNewRecords(), MainServer::HandleAnnounce(), and Scheduler::HandleWakeSlave().

◆ IsWaking()

bool EncoderLink::IsWaking ( void  ) const
inline

Returns true if the encoder is waking up.

Definition at line 56 of file encoderlink.h.

Referenced by MainServer::HandleAnnounce(), Scheduler::HandleRecording(), and Scheduler::HandleWakeSlave().

◆ IsFallingAsleep()

bool EncoderLink::IsFallingAsleep ( void  ) const
inline

Returns true if the encoder is falling asleep.

Definition at line 58 of file encoderlink.h.

Referenced by MainServer::connectionClosed(), Scheduler::PutInactiveSlavesToSleep(), and SetSocket().

◆ CanSleep()

bool EncoderLink::CanSleep ( void  ) const
inline

Returns true if the encoder can sleep.

Definition at line 61 of file encoderlink.h.

Referenced by Scheduler::PutInactiveSlavesToSleep().

◆ GetSleepStatus()

SleepStatus EncoderLink::GetSleepStatus ( void  ) const
inline

Returns the current Sleep Status of the encoder.

Definition at line 64 of file encoderlink.h.

Referenced by HttpStatus::FillStatusXML(), Dvr::GetEncoderList(), and MainServer::HandleRemoteEncoder().

◆ GetInputID()

int EncoderLink::GetInputID ( void  ) const
inline

◆ GetTVRec()

TVRec* EncoderLink::GetTVRec ( void  )
inline

Returns the TVRec used by a local EncoderLink instance.

Definition at line 69 of file encoderlink.h.

◆ GoToSleep()

bool EncoderLink::GoToSleep ( void  )

Tell a slave backend to go to sleep.

Tell a slave to go to sleep.

Definition at line 402 of file encoderlink.cpp.

Referenced by Scheduler::PutInactiveSlavesToSleep().

◆ LockTuner()

int EncoderLink::LockTuner ( void  )

Lock the tuner for exclusive use.

Returns
-2 if tuner is already locked, GetInputID() if you get the lock.
See also
FreeTuner(), IsTunerLocked()

Definition at line 417 of file encoderlink.cpp.

Referenced by MainServer::HandleLockTuner().

◆ FreeTuner()

void EncoderLink::FreeTuner ( void  )
inline

Unlock the tuner.

See also
LockTuner(), IsTunerLocked()

Definition at line 76 of file encoderlink.h.

Referenced by MainServer::HandleFreeTuner().

◆ IsTunerLocked()

bool EncoderLink::IsTunerLocked ( void  ) const
inline

Returns true iff the tuner is locked.

See also
LockTuner(), FreeTuner()

Definition at line 79 of file encoderlink.h.

Referenced by MainServer::HandleGetFreeInputInfo(), MainServer::HandleLockTuner(), and Scheduler::HandleRecording().

◆ CheckFile()

bool EncoderLink::CheckFile ( ProgramInfo pginfo)

Checks if program is stored locally.

Definition at line 328 of file encoderlink.cpp.

Referenced by AutoExpire::ExpireRecordings().

◆ GetDiskSpace()

void EncoderLink::GetDiskSpace ( QStringList &  o_strlist)

Appends total and used disk space in Kilobytes.

Parameters
o_strlistlist to append to

Definition at line 345 of file encoderlink.cpp.

◆ GetMaxBitrate()

long long EncoderLink::GetMaxBitrate ( void  )

Returns maximum bits per second this recorder might output.

See also
TVRec::GetFreeSpace(long long), RemoteEncoder::GetFreeSpace(long long) May be a local or remote query.

Definition at line 360 of file encoderlink.cpp.

Referenced by AutoExpire::CalcParams(), Scheduler::FillRecordingDir(), MainServer::GetCurrentMaxBitrate(), MainServer::HandleRecorderQuery(), and MainServer::HandleRemoteEncoder().

◆ SetSignalMonitoringRate()

int EncoderLink::SetSignalMonitoringRate ( int  rate,
int  notifyFrontend 
)

Sets the signal monitoring rate.

May be a local or remote query.

See also
TVRec::SetSignalMonitoringRate(int,int), RemoteEncoder::SetSignalMonitoringRate(int,int)
Parameters
rateMilliseconds between each signal check, 0 to disable, -1 to preserve old value.
notifyFrontendIf 1 SIGNAL messages are sent to the frontend, if 0 SIGNAL messages will not be sent, and if -1 the old value is preserved.
Returns
Old rate if it succeeds, -1 if it fails.

Definition at line 387 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ IsBusy()

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

◆ IsBusyRecording()

bool EncoderLink::IsBusyRecording ( void  )

Returns true if the TVRec state is in a recording state.

Contrast with IsBusy() which returns true if a recording is pending and is generally the safer call to make.

See also
IsBusy()

Definition at line 177 of file encoderlink.cpp.

Referenced by MainServer::DoHandleStopRecording(), MainServer::HandleIsRecording(), and MatchesRecording().

◆ GetState()

TVState EncoderLink::GetState ( void  )

◆ GetFlags()

uint EncoderLink::GetFlags ( void  )

Returns the flag state of the recorder.

See also
TVRec::GetFlags(void) const, Recorder Subsystem

Definition at line 221 of file encoderlink.cpp.

Referenced by MainServer::HandleRemoteEncoder().

◆ IsRecording()

bool EncoderLink::IsRecording ( const ProgramInfo rec)

Returns true if rec is scheduled for recording.

Parameters
recRecording to check.
See also
MatchesRecording(const ProgramInfo*)

Definition at line 246 of file encoderlink.cpp.

◆ MatchesRecording()

bool EncoderLink::MatchesRecording ( const ProgramInfo rec)

Returns true if rec is actually being recorded by TVRec.

This waits for TVRec to enter a state other than kState_ChangingState Then it checks TVRec::GetRecording() against rec.

Parameters
recRecording to check against TVRec::GetRecording().
See also
IsRecording(const ProgramInfo*)

Definition at line 260 of file encoderlink.cpp.

Referenced by MainServer::DoHandleStopRecording(), MainServer::HandleCheckRecordingActive(), MainServer::HandleGetRecorderNum(), and MainServer::HandleRemoteEncoder().

◆ RecordPending()

void EncoderLink::RecordPending ( const ProgramInfo rec,
int  secsleft,
bool  hasLater 
)

Tells TVRec there is a pending recording "rec" in "secsleft" seconds.

Parameters
recRecording to make.
secsleftSeconds to wait before starting recording.
hasLaterIf true, a later non-conflicting showing is available.
See also
StartRecording(const ProgramInfo*), CancelNextRecording(bool)

Definition at line 299 of file encoderlink.cpp.

Referenced by Scheduler::HandleRecording(), and MainServer::HandleRemoteEncoder().

◆ StartRecording()

RecStatus::Type EncoderLink::StartRecording ( ProgramInfo rec)

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

Returns
a RecStatus::Type indicating the state of the recording.
See also
RecordPending(const ProgramInfo*, int, bool), StopRecording()

Definition at line 432 of file encoderlink.cpp.

Referenced by Scheduler::ChangeRecordingEnd(), Scheduler::HandleRecording(), and MainServer::HandleRemoteEncoder().

◆ GetRecordingStatus()

RecStatus::Type EncoderLink::GetRecordingStatus ( void  )

Definition at line 465 of file encoderlink.cpp.

Referenced by MainServer::HandleRemoteEncoder().

◆ StopRecording()

void EncoderLink::StopRecording ( bool  killFile = false)

Tells TVRec to stop recording immediately.

This only works on local recorders.

See also
StartRecording(const ProgramInfo *rec), FinishRecording()

Definition at line 520 of file encoderlink.cpp.

Referenced by MainServer::DoHandleStopRecording(), and MainServer::HandleRemoteEncoder().

◆ FinishRecording()

void EncoderLink::FinishRecording ( void  )

Tells TVRec to stop recording, but only after "overrecord" seconds.

This only works on local recorders.

See also
StopRecording()

Definition at line 538 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ FrontendReady()

void EncoderLink::FrontendReady ( void  )

Tells TVRec that the frontend is ready for data.

This only works on local recorders.

See also
TVRec::, RemoteEncoder::

Definition at line 655 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ CancelNextRecording()

void EncoderLink::CancelNextRecording ( bool  cancel)

Tells TVRec to cancel the next recording.

This is used when the user is watching "Live TV" and does not want to allow the recorder to be taken for a pending recording.

See also
RecordPending(const ProgramInfo*, int, bool)

Definition at line 671 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery(), MainServer::HandleRemoteEncoder(), and MainServer::reconnectTimeout().

◆ WouldConflict()

bool EncoderLink::WouldConflict ( const ProgramInfo rec)

Checks a recording against any recording current or pending recordings on the recorder represented by this EncoderLink.

Parameters
recRecording to check against current/pending recording.

Definition at line 316 of file encoderlink.cpp.

◆ IsReallyRecording()

bool EncoderLink::IsReallyRecording ( void  )

Checks if the RecorderBase held by TVRec is actually recording.

This only works on local recorders.

Returns
true if actually recording, false otherwise.

Definition at line 553 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetRecording()

ProgramInfo * EncoderLink::GetRecording ( void  )

Returns TVRec's current recording.

Caller is responsible for deleting the ProgramInfo when done with it.

Returns
Returns TVRec's current recording if it succeeds, nullptr otherwise.

Definition at line 500 of file encoderlink.cpp.

Referenced by HttpStatus::FillStatusXML(), Dvr::GetEncoderList(), MainServer::HandleIsRecording(), MainServer::HandleRecorderQuery(), MainServer::HandleRemoteEncoder(), and MainServer::reconnectTimeout().

◆ GetFramerate()

float EncoderLink::GetFramerate ( void  )

Returns the recording frame rate from TVRec.

This only works on local recorders.

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

Definition at line 569 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetFramesWritten()

long long EncoderLink::GetFramesWritten ( void  )

Returns number of frames written to disk by TVRec's RecorderBase instance.

This only works on local recorders.

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

Definition at line 585 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetFilePosition()

long long EncoderLink::GetFilePosition ( void  )

Returns total number of bytes written by TVRec's RingBuffer.

This only works on local recorders.

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

Definition at line 600 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetKeyframePosition()

int64_t EncoderLink::GetKeyframePosition ( uint64_t  desired)

Returns byte position in RingBuffer of a keyframe.

This only works on local recorders.

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

Definition at line 615 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetKeyframePositions()

bool EncoderLink::GetKeyframePositions ( int64_t  start,
int64_t  end,
frm_pos_map_t map 
)

Definition at line 624 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetKeyframeDurations()

bool EncoderLink::GetKeyframeDurations ( int64_t  start,
int64_t  end,
frm_pos_map_t map 
)

Definition at line 637 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ SpawnLiveTV()

void EncoderLink::SpawnLiveTV ( LiveTVChain chain,
bool  pip,
QString  startchan 
)

Tells TVRec to Spawn a "Live TV" recorder.

This only works on local recorders.

Parameters
chainThe LiveTV chain to use
startchanThe channel the LiveTV should start with
pipTells TVRec's RingBuffer that this is for a Picture in Picture display.
See also
TVRec::SpawnLiveTV(LiveTVChain*,bool,QString), RemoteEncoder::SpawnLiveTV(QString,bool,QString)

Definition at line 693 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetChainID()

QString EncoderLink::GetChainID ( void  )

Get the LiveTV chain id that's in use.

Definition at line 704 of file encoderlink.cpp.

Referenced by MainServer::connectionClosed(), and MainServer::HandleRecorderQuery().

◆ StopLiveTV()

void EncoderLink::StopLiveTV ( void  )

Tells TVRec to stop a "Live TV" recorder.

This only works on local recorders.

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

Definition at line 718 of file encoderlink.cpp.

Referenced by MainServer::connectionClosed(), and MainServer::HandleRecorderQuery().

◆ PauseRecorder()

void EncoderLink::PauseRecorder ( void  )

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

This only works on local recorders.

See also
TVRec::PauseRecorder(), RemoteEncoder::PauseRecorder(), RecorderBase::Pause()

Definition at line 732 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ SetLiveRecording()

void EncoderLink::SetLiveRecording ( int  recording)

Tells TVRec to keep a LiveTV recording if 'recording' is 1.

and to not keep a LiveTV recording if 'recording; is 0. This only works on local recorders.

Definition at line 745 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ SetNextLiveTVDir()

void EncoderLink::SetNextLiveTVDir ( const QString &  dir)

Tells TVRec where to put the next LiveTV recording.

Definition at line 757 of file encoderlink.cpp.

Referenced by Scheduler::GetNextLiveTVDir(), and MainServer::HandleSetNextLiveTVDir().

◆ GetInput()

QString EncoderLink::GetInput ( void  ) const

Returns TVRec's recorders current input.

This only works on local recorders.

See also
TVRec::GetInput(void) const

Definition at line 774 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ SetInput()

QString EncoderLink::SetInput ( QString  input)

Tells TVRec's recorder to change to the specified input.

This only works on local recorders.

You must call PauseRecorder(void) before calling this.

Parameters
inputInput to switch to, or "SwitchToNextInput".
Returns
input we have switched to
See also
TVRec::SetInput(QString)

Definition at line 793 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ ToggleChannelFavorite()

void EncoderLink::ToggleChannelFavorite ( QString  changroup)

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

This only works on local recorders.

Returns
-1 if query does not succeed, otherwise.

Definition at line 807 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ ChangeChannel()

void EncoderLink::ChangeChannel ( ChannelChangeDirection  channeldirection)

Changes to the next or previous channel.

This only works on local recorders.

You must call PauseRecorder() before calling this.

Parameters
channeldirectionchannel change direction
See also
BrowseDirections.

Definition at line 822 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ SetChannel()

void EncoderLink::SetChannel ( const QString &  name)

Changes to a named channel on the current tuner.

This only works on local recorders.

You must call PauseRecorder() before calling this.

Parameters
nameName of channel to change to.

Definition at line 837 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetPictureAttribute()

int EncoderLink::GetPictureAttribute ( PictureAttribute  attr)

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

This only works on local recorders.

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

Returns
current value if it succeeds, -1 otherwise.

Definition at line 853 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ ChangePictureAttribute()

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

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

This only works on local recorders.

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

Returns
current value if it succeeds, -1 otherwise.

Definition at line 873 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ CheckChannel()

bool EncoderLink::CheckChannel ( const QString &  name)

Checks if named channel exists on current tuner.

This only works on local recorders.

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

Definition at line 896 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ ShouldSwitchToAnotherInput()

bool EncoderLink::ShouldSwitchToAnotherInput ( const QString &  channelid)

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

This only works on local recorders.

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

Definition at line 914 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ CheckChannelPrefix()

bool EncoderLink::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.

This only works on local recorders.

See also
TVRec::CheckChannelPrefix(const QString&,uint&,bool&,QString&) for details.

Definition at line 931 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetNextProgram()

void EncoderLink::GetNextProgram ( BrowseDirection  direction,
QString &  title,
QString &  subtitle,
QString &  desc,
QString &  category,
QString &  starttime,
QString &  endtime,
QString &  callsign,
QString &  iconpath,
QString &  channelname,
uint _chanid,
QString &  seriesid,
QString &  programid 
)

Returns information about the program that would be seen if we changed the channel using ChangeChannel(int) with "direction".

This only works on local recorders.

Definition at line 956 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ GetChannelInfo()

bool EncoderLink::GetChannelInfo ( uint chanid,
uint sourceid,
QString &  callsign,
QString &  channum,
QString &  channame,
QString &  xmltv 
) const

Definition at line 975 of file encoderlink.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ SetChannelInfo()

bool EncoderLink::SetChannelInfo ( uint  chanid,
uint  sourceid,
QString  oldchannum,
QString  callsign,
QString  channum,
QString  channame,
QString  xmltv 
)

Definition at line 989 of file encoderlink.cpp.

◆ AddChildInput()

bool EncoderLink::AddChildInput ( uint  childid)

Definition at line 1005 of file encoderlink.cpp.

Referenced by MainServer::HandleAddChildInput().

◆ HasSockAndIncrRef()

bool EncoderLink::HasSockAndIncrRef ( )
private

◆ HasSockAndDecrRef()

bool EncoderLink::HasSockAndDecrRef ( )
private

Atomicly checks if sock is not null and decreases its refcount.

Definition at line 102 of file encoderlink.cpp.

Referenced by SetSocket().

Member Data Documentation

◆ m_inputid

int EncoderLink::m_inputid
private

◆ m_sock

PlaybackSock* EncoderLink::m_sock {nullptr}
private

◆ m_sockLock

QMutex EncoderLink::m_sockLock
private

Definition at line 152 of file encoderlink.h.

Referenced by HasSockAndDecrRef(), and HasSockAndIncrRef().

◆ m_hostname

QString EncoderLink::m_hostname
private

Definition at line 153 of file encoderlink.h.

Referenced by GetHostName(), and SetSocket().

◆ m_tv

TVRec* EncoderLink::m_tv {nullptr}
private

◆ m_local

bool EncoderLink::m_local {false}
private

◆ m_locked

bool EncoderLink::m_locked {false}
private

Definition at line 158 of file encoderlink.h.

Referenced by FreeTuner(), IsTunerLocked(), and LockTuner().

◆ m_sleepStatus

SleepStatus EncoderLink::m_sleepStatus {sStatus_Undefined}
private

◆ m_sleepStatusTime

QDateTime EncoderLink::m_sleepStatusTime
private

Definition at line 161 of file encoderlink.h.

Referenced by EncoderLink(), GetSleepStatusTime(), and SetSleepStatus().

◆ m_lastSleepTime

QDateTime EncoderLink::m_lastSleepTime
private

Definition at line 162 of file encoderlink.h.

Referenced by EncoderLink(), GetLastSleepTime(), and GoToSleep().

◆ m_lastWakeTime

QDateTime EncoderLink::m_lastWakeTime
private

Definition at line 163 of file encoderlink.h.

Referenced by EncoderLink(), GetLastWakeTime(), and SetLastWakeTime().

◆ m_endRecordingTime

QDateTime EncoderLink::m_endRecordingTime
private

◆ m_startRecordingTime

QDateTime EncoderLink::m_startRecordingTime
private

◆ m_chanid

uint EncoderLink::m_chanid {0}
private

Definition at line 167 of file encoderlink.h.

Referenced by GetRecordingStatus(), IsRecording(), StartRecording(), and StopRecording().


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