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

#include <libmythtv/remoteencoder.h>

Collaboration diagram for RemoteEncoder:
[legend]

Public Member Functions

 RemoteEncoder (int num, QString host, short port)
 
 ~RemoteEncoder (void)
 
bool Setup (void)
 
bool IsValidRecorder (void) const
 
int GetRecorderNumber (void) const
 
ProgramInfoGetRecording (void)
 
bool IsRecording (bool *ok=nullptr)
 
float GetFrameRate (void)
 Returns recordering frame rate set by nvr. More...
 
long long GetFramesWritten (void)
 Returns number of frames written to disk by TVRec's RecorderBase instance. More...
 
long long GetCachedFramesWritten (void) const
 Return value last returned by GetFramesWritten(). More...
 
long long GetFilePosition (void)
 Returns total number of bytes written by TVRec's RingBuffer. More...
 
long long GetFreeDiskSpace ()
 
long long GetMaxBitrate ()
 Returns the maximum bits per second this recorder can produce. More...
 
int64_t GetKeyframePosition (uint64_t desired)
 Returns byte position in RingBuffer of a keyframe. More...
 
void FillPositionMap (int64_t start, int64_t end, frm_pos_map_t &positionMap)
 
void FillDurationMap (int64_t start, int64_t end, frm_pos_map_t &durationMap)
 
void StopPlaying (void)
 Tells TVRec to stop streaming a recording to the frontend. More...
 
void SpawnLiveTV (const QString &chainid, bool pip, const QString &startchan)
 Tells TVRec to Spawn a "Live TV" recorder. 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 FinishRecording (void)
 
void FrontendReady (void)
 
void CancelNextRecording (bool cancel)
 
void SetLiveRecording (bool recording)
 
QString GetInput (void)
 
QString SetInput (const QString &input)
 
int GetPictureAttribute (PictureAttribute attr)
 
int ChangePictureAttribute (PictureAdjustType type, PictureAttribute attr, bool up)
 Changes brightness/contrast/colour/hue of a recording. More...
 
void ChangeChannel (int channeldirection)
 
void ChangeDeinterlacer (int deint_mode)
 
void ToggleChannelFavorite (const QString &changroupname)
 
void SetChannel (const QString &channel)
 
std::chrono::milliseconds SetSignalMonitoringRate (std::chrono::milliseconds rate, int notifyFrontend=1)
 Sets the signal monitoring rate. More...
 
uint GetSignalLockTimeout (const QString &input)
 
bool CheckChannel (const QString &channel)
 Checks if named channel exists on current tuner. More...
 
bool ShouldSwitchToAnotherCard (const QString &channelid)
 Checks if named channel exists on current tuner, or another tuner. This only works on local recorders. More...
 
bool 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. More...
 
void GetNextProgram (int direction, QString &title, QString &subtitle, QString &desc, QString &category, QString &starttime, QString &endtime, QString &callsign, QString &iconpath, QString &channelname, QString &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...
 
void GetChannelInfo (InfoMap &infoMap, uint chanid=0)
 
bool SetChannelInfo (const InfoMap &infoMap)
 
bool GetErrorStatus (void)
 

Private Member Functions

bool SendReceiveStringList (QStringList &strlist, uint min_reply_length=0)
 

Private Attributes

int m_recordernum
 
MythSocketm_controlSock {nullptr}
 
QMutex m_lock
 
QString m_remotehost
 
short m_remoteport
 
QString m_lastchannel
 
QString m_lastinput
 
bool m_backendError {false}
 
long long m_cachedFramesWritten {0}
 
QMap< QString, uintm_cachedTimeout
 
MythTimer m_lastTimeCheck
 

Detailed Description

Definition at line 24 of file remoteencoder.h.

Constructor & Destructor Documentation

◆ RemoteEncoder()

RemoteEncoder::RemoteEncoder ( int  num,
QString  host,
short  port 
)
inline

Definition at line 27 of file remoteencoder.h.

◆ ~RemoteEncoder()

RemoteEncoder::~RemoteEncoder ( void  )

Definition at line 19 of file remoteencoder.cpp.

Member Function Documentation

◆ Setup()

bool RemoteEncoder::Setup ( void  )

◆ IsValidRecorder()

bool RemoteEncoder::IsValidRecorder ( void  ) const

◆ GetRecorderNumber()

int RemoteEncoder::GetRecorderNumber ( void  ) const

◆ GetRecording()

ProgramInfo * RemoteEncoder::GetRecording ( void  )

Definition at line 137 of file remoteencoder.cpp.

◆ IsRecording()

bool RemoteEncoder::IsRecording ( bool ok = nullptr)

Definition at line 117 of file remoteencoder.cpp.

Referenced by TV::StartRecorder().

◆ GetFrameRate()

float RemoteEncoder::GetFrameRate ( void  )

Returns recordering frame rate set by nvr.

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

Definition at line 159 of file remoteencoder.cpp.

Referenced by MythPlayer::TranslatePositionFrameToMs().

◆ GetFramesWritten()

long long RemoteEncoder::GetFramesWritten ( void  )

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

See also
TVRec::GetFramesWritten(void), EncoderLink::GetFramesWritten(void)
Returns
Number of frames if query succeeds, return last known value otherwise.

Definition at line 194 of file remoteencoder.cpp.

Referenced by MythPlayer::CalcMaxFFTime(), MythPlayer::FindFrame(), MythPlayer::GetCurrentFrameCount(), MythPlayer::IsNearEnd(), MythPlayer::TranslatePositionFrameToMs(), and MythPlayer::WaitForSeek().

◆ GetCachedFramesWritten()

long long RemoteEncoder::GetCachedFramesWritten ( void  ) const
inline

Return value last returned by GetFramesWritten().

Definition at line 40 of file remoteencoder.h.

Referenced by MythPlayer::IsNearEnd().

◆ GetFilePosition()

long long RemoteEncoder::GetFilePosition ( void  )

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

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

Definition at line 223 of file remoteencoder.cpp.

◆ GetFreeDiskSpace()

long long RemoteEncoder::GetFreeDiskSpace ( )

◆ GetMaxBitrate()

long long RemoteEncoder::GetMaxBitrate ( )

Returns the maximum bits per second this recorder can produce.

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

Definition at line 238 of file remoteencoder.cpp.

◆ GetKeyframePosition()

int64_t RemoteEncoder::GetKeyframePosition ( uint64_t  desired)

Returns byte position in RingBuffer of a keyframe.

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

Definition at line 256 of file remoteencoder.cpp.

◆ FillPositionMap()

void RemoteEncoder::FillPositionMap ( int64_t  start,
int64_t  end,
frm_pos_map_t positionMap 
)

Definition at line 268 of file remoteencoder.cpp.

Referenced by MythPlayer::PosMapFromEnc().

◆ FillDurationMap()

void RemoteEncoder::FillDurationMap ( int64_t  start,
int64_t  end,
frm_pos_map_t durationMap 
)

Definition at line 294 of file remoteencoder.cpp.

Referenced by MythPlayer::PosMapFromEnc().

◆ StopPlaying()

void RemoteEncoder::StopPlaying ( void  )

Tells TVRec to stop streaming a recording to the frontend.

See also
TVRec::StopPlaying(void), EncoderLink::StopPlaying(void)

Definition at line 341 of file remoteencoder.cpp.

◆ SpawnLiveTV()

void RemoteEncoder::SpawnLiveTV ( const QString &  chainid,
bool  pip,
const QString &  startchan 
)

◆ StopLiveTV()

void RemoteEncoder::StopLiveTV ( void  )

Tells TVRec to stop a "Live TV" recorder.

This only works on local recorders.

See also
TVRec::StopLiveTV(void), EncoderLink::StopLiveTV(void)

Definition at line 370 of file remoteencoder.cpp.

Referenced by TV::StopStuff(), and TV::SwitchInputs().

◆ PauseRecorder()

void RemoteEncoder::PauseRecorder ( void  )

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

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

Definition at line 383 of file remoteencoder.cpp.

Referenced by TV::PauseLiveTV().

◆ FinishRecording()

void RemoteEncoder::FinishRecording ( void  )

Definition at line 392 of file remoteencoder.cpp.

◆ FrontendReady()

void RemoteEncoder::FrontendReady ( void  )

Definition at line 329 of file remoteencoder.cpp.

Referenced by TV::HandleStateChange().

◆ CancelNextRecording()

void RemoteEncoder::CancelNextRecording ( bool  cancel)

Definition at line 320 of file remoteencoder.cpp.

Referenced by TV::HandleOSDAskAllow().

◆ SetLiveRecording()

void RemoteEncoder::SetLiveRecording ( bool  recording)

Definition at line 400 of file remoteencoder.cpp.

Referenced by TV::QuickRecord().

◆ GetInput()

QString RemoteEncoder::GetInput ( void  )

◆ SetInput()

QString RemoteEncoder::SetInput ( const QString &  input)

Definition at line 426 of file remoteencoder.cpp.

◆ GetPictureAttribute()

int RemoteEncoder::GetPictureAttribute ( PictureAttribute  attr)

Definition at line 540 of file remoteencoder.cpp.

Referenced by TV::DoTogglePictureAttribute().

◆ ChangePictureAttribute()

int RemoteEncoder::ChangePictureAttribute ( PictureAdjustType  type,
PictureAttribute  attr,
bool  up 
)

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

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

Returns
contrast if it succeeds, -1 otherwise.

Definition at line 568 of file remoteencoder.cpp.

Referenced by TV::PictureAttributeHandleAction().

◆ ChangeChannel()

void RemoteEncoder::ChangeChannel ( int  channeldirection)

Definition at line 451 of file remoteencoder.cpp.

Referenced by TV::ChangeChannel().

◆ ChangeDeinterlacer()

void RemoteEncoder::ChangeDeinterlacer ( int  deint_mode)

Definition at line 593 of file remoteencoder.cpp.

◆ ToggleChannelFavorite()

void RemoteEncoder::ToggleChannelFavorite ( const QString &  changroupname)

Definition at line 442 of file remoteencoder.cpp.

Referenced by TV::ToggleChannelFavorite().

◆ SetChannel()

void RemoteEncoder::SetChannel ( const QString &  channel)

Definition at line 464 of file remoteencoder.cpp.

Referenced by TV::ChangeChannel().

◆ SetSignalMonitoringRate()

std::chrono::milliseconds RemoteEncoder::SetSignalMonitoringRate ( std::chrono::milliseconds  rate,
int  notifyFrontend = 1 
)

Sets the signal monitoring rate.

This will actually call SetupSignalMonitor() and TeardownSignalMonitor(bool) as needed, so it can be used directly, without worrying about the SignalMonitor instance.

See also
TVRec::SetSignalMonitoringRate(milliseconds,int), EncoderLink::SetSignalMonitoringRate(milliseconds,int)
Parameters
rateThe update rate to use in milliseconds, use 0 to disable.
notifyFrontendIf true, SIGNAL messages will be sent to the frontend using this recorder.
Returns
Previous update rate

Definition at line 493 of file remoteencoder.cpp.

Referenced by TV::ActiveHandleAction().

◆ GetSignalLockTimeout()

uint RemoteEncoder::GetSignalLockTimeout ( const QString &  input)

◆ CheckChannel()

bool RemoteEncoder::CheckChannel ( const QString &  channel)

Checks if named channel exists on current tuner.

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

Definition at line 611 of file remoteencoder.cpp.

Referenced by TV::ChangeChannel().

◆ ShouldSwitchToAnotherCard()

bool RemoteEncoder::ShouldSwitchToAnotherCard ( 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 632 of file remoteencoder.cpp.

Referenced by TV::HandleStateChange().

◆ CheckChannelPrefix()

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

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

Definition at line 653 of file remoteencoder.cpp.

Referenced by TV::ChangeChannel(), and TV::ProcessSmartChannel().

◆ GetNextProgram()

void RemoteEncoder::GetNextProgram ( int  direction,
QString &  title,
QString &  subtitle,
QString &  desc,
QString &  category,
QString &  starttime,
QString &  endtime,
QString &  callsign,
QString &  iconpath,
QString &  channelname,
QString &  chanid,
QString &  seriesid,
QString &  programid 
)

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

See also
TVRec::GetNextProgram(int,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&), EncoderLink::GetNextProgram(int,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&,QString&)

Definition at line 693 of file remoteencoder.cpp.

Referenced by TVBrowseHelper::GetNextProgram().

◆ GetChannelInfo()

void RemoteEncoder::GetChannelInfo ( InfoMap infoMap,
uint  chanid = 0 
)

◆ SetChannelInfo()

bool RemoteEncoder::SetChannelInfo ( const InfoMap infoMap)

Definition at line 744 of file remoteencoder.cpp.

Referenced by TV::HandleOSDChannelEdit().

◆ GetErrorStatus()

bool RemoteEncoder::GetErrorStatus ( void  )
inline

Definition at line 81 of file remoteencoder.h.

Referenced by PlayerContext::IsRecorderErrored().

◆ SendReceiveStringList()

bool RemoteEncoder::SendReceiveStringList ( QStringList &  strlist,
uint  min_reply_length = 0 
)
private

Member Data Documentation

◆ m_recordernum

int RemoteEncoder::m_recordernum
private

◆ m_controlSock

MythSocket* RemoteEncoder::m_controlSock {nullptr}
private

Definition at line 89 of file remoteencoder.h.

Referenced by SendReceiveStringList(), Setup(), and ~RemoteEncoder().

◆ m_lock

QMutex RemoteEncoder::m_lock
private

Definition at line 90 of file remoteencoder.h.

Referenced by GetSignalLockTimeout(), and SendReceiveStringList().

◆ m_remotehost

QString RemoteEncoder::m_remotehost
private

Definition at line 92 of file remoteencoder.h.

Referenced by Setup().

◆ m_remoteport

short RemoteEncoder::m_remoteport
private

Definition at line 93 of file remoteencoder.h.

Referenced by Setup().

◆ m_lastchannel

QString RemoteEncoder::m_lastchannel
private

Definition at line 95 of file remoteencoder.h.

Referenced by ChangeChannel(), SetChannel(), and SetInput().

◆ m_lastinput

QString RemoteEncoder::m_lastinput
private

Definition at line 96 of file remoteencoder.h.

Referenced by ChangeChannel(), GetInput(), PauseRecorder(), SetChannel(), and SetInput().

◆ m_backendError

bool RemoteEncoder::m_backendError {false}
private

Definition at line 98 of file remoteencoder.h.

Referenced by SendReceiveStringList().

◆ m_cachedFramesWritten

long long RemoteEncoder::m_cachedFramesWritten {0}
private

Definition at line 99 of file remoteencoder.h.

Referenced by GetFramesWritten().

◆ m_cachedTimeout

QMap<QString,uint> RemoteEncoder::m_cachedTimeout
private

Definition at line 100 of file remoteencoder.h.

Referenced by GetSignalLockTimeout().

◆ m_lastTimeCheck

MythTimer RemoteEncoder::m_lastTimeCheck
private

Definition at line 101 of file remoteencoder.h.

Referenced by GetFramesWritten().


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