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

Keeps track of recordings in a current LiveTV instance. More...

#include <livetvchain.h>

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

Public Member Functions

 LiveTVChain ()
 
 ~LiveTVChain ()
 
QString InitializeNewChain (const QString &seed)
 
void LoadFromExistingChain (const QString &id)
 
void SetHostPrefix (const QString &prefix)
 
void SetInputType (const QString &type)
 
void DestroyChain (void)
 
void AppendNewProgram (ProgramInfo *pginfo, const QString &channum, const QString &inputname, bool discont)
 
void FinishedRecording (ProgramInfo *pginfo)
 
void DeleteProgram (ProgramInfo *pginfo)
 
void ReloadAll (const QStringList &data=QStringList())
 
QString GetID (void) const
 
int GetCurPos (void) const
 
int ProgramIsAt (uint chanid, const QDateTime &starttime) const
 
int ProgramIsAt (const ProgramInfo &pginfo) const
 
int GetLengthAtCurPos (void)
 
int GetLengthAtPos (int pos)
 
int TotalSize (void) const
 
bool HasNext (void) const
 
bool HasPrev (void) const
 
ProgramInfoGetProgramAt (int at) const
 Returns program at the desired location. More...
 
bool NeedsToSwitch (void) const
 Returns true iff a switch is required but no jump is required m_jumppos sets to INT_MAX means not set. More...
 
bool NeedsToJump (void) const
 Returns true iff a switch and jump are required. More...
 
QString GetChannelName (int pos=-1) const
 
QString GetInputName (int pos=-1) const
 
QString GetInputType (int pos=-1) const
 
void SetProgram (const ProgramInfo &pginfo)
 
void SwitchTo (int num)
 Sets the recording to switch to. More...
 
void SwitchToNext (bool up)
 Sets the recording to switch to. More...
 
void ClearSwitch (void)
 
ProgramInfoGetSwitchProgram (bool &discont, bool &newtype, int &newid)
 Returns the recording we should switch to. More...
 
void JumpTo (int num, int pos)
 
void JumpToNext (bool up, int pos)
 JumpToNext(bool up, int pos) jump to the next (up == true) or previous (up == false) liveTV program If pos > 0: indicate the absolute position where to start the next program If pos < 0: indicate offset position; in which case the right liveTV program will be found accordingly. More...
 
int GetJumpPos (void)
 Returns the jump position in seconds and clears it. More...
 
void SetHostSocket (MythSocket *sock)
 
bool IsHostSocket (const MythSocket *sock) const
 
uint HostSocketCount (void) const
 
void DelHostSocket (MythSocket *sock)
 
QString toString () const
 
QStringList entriesToStringList () const
 
bool entriesFromStringList (const QStringList &items)
 
- Public Member Functions inherited from ReferenceCounter
 ReferenceCounter (const QString &debugName, bool logDebug=true)
 Creates reference counter with an initial value of 1. More...
 
virtual int IncrRef (void)
 Increments reference count. More...
 
virtual int DecrRef (void)
 Decrements reference count and deletes on 0. More...
 

Private Member Functions

void BroadcastUpdate ()
 
void GetEntryAt (int at, LiveTVChainEntry &entry) const
 
ProgramInfoDoGetNextProgram (bool up, int curpos, int &newid, bool &discont, bool &newtype)
 

Static Private Member Functions

static ProgramInfoEntryToProgram (const LiveTVChainEntry &entry)
 

Private Attributes

QString m_id
 
QList< LiveTVChainEntrym_chain
 
int m_maxpos {0}
 
QMutex m_lock {QMutex::Recursive}
 
QString m_hostprefix
 
QString m_inputtype
 
int m_curpos {0}
 
uint m_cur_chanid {0}
 
QDateTime m_cur_startts
 
int m_switchid {-1}
 
LiveTVChainEntry m_switchentry
 
int m_jumppos {INT_MAX}
 
QMutex m_sockLock
 
QList< MythSocket * > m_inUseSocks
 

Additional Inherited Members

- Static Public Member Functions inherited from ReferenceCounter
static void PrintDebug (void)
 Print out any leaks if that level of debugging is enabled. More...
 
- Protected Member Functions inherited from ReferenceCounter
virtual ~ReferenceCounter (void)
 Called on destruction, will warn if object deleted with references in place. More...
 
- Protected Attributes inherited from ReferenceCounter
bool m_logDebug
 This is used to suppress creating LoggingItem classes for LoggingItem reference count changes. More...
 
QAtomicInt m_referenceCount {1}
 

Detailed Description

Keeps track of recordings in a current LiveTV instance.

Definition at line 31 of file livetvchain.h.

Constructor & Destructor Documentation

◆ LiveTVChain()

LiveTVChain::LiveTVChain ( )

Definition at line 30 of file livetvchain.cpp.

◆ ~LiveTVChain()

LiveTVChain::~LiveTVChain ( )

Definition at line 36 of file livetvchain.cpp.

Member Function Documentation

◆ InitializeNewChain()

QString LiveTVChain::InitializeNewChain ( const QString &  seed)

Definition at line 41 of file livetvchain.cpp.

Referenced by PlayerContext::SetTVChain().

◆ LoadFromExistingChain()

void LiveTVChain::LoadFromExistingChain ( const QString &  id)

Definition at line 58 of file livetvchain.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ SetHostPrefix()

void LiveTVChain::SetHostPrefix ( const QString &  prefix)

Definition at line 48 of file livetvchain.cpp.

Referenced by TVRec::SpawnLiveTV().

◆ SetInputType()

void LiveTVChain::SetInputType ( const QString &  type)

Definition at line 53 of file livetvchain.cpp.

Referenced by TVRec::SpawnLiveTV(), and TVRec::TuningFrequency().

◆ DestroyChain()

void LiveTVChain::DestroyChain ( void  )

Definition at line 196 of file livetvchain.cpp.

Referenced by PlayerContext::SetTVChain().

◆ AppendNewProgram()

void LiveTVChain::AppendNewProgram ( ProgramInfo pginfo,
const QString &  channum,
const QString &  inputname,
bool  discont 
)

Definition at line 64 of file livetvchain.cpp.

Referenced by TVRec::CreateLiveTVRingBuffer(), and TVRec::SwitchLiveTVRingBuffer().

◆ FinishedRecording()

void LiveTVChain::FinishedRecording ( ProgramInfo pginfo)

Definition at line 112 of file livetvchain.cpp.

Referenced by TVRec::FinishedRecording().

◆ DeleteProgram()

void LiveTVChain::DeleteProgram ( ProgramInfo pginfo)

Definition at line 144 of file livetvchain.cpp.

Referenced by MainServer::DoDeleteThread().

◆ ReloadAll()

void LiveTVChain::ReloadAll ( const QStringList &  data = QStringList())

◆ GetID()

QString LiveTVChain::GetID ( void  ) const
inline

◆ GetCurPos()

int LiveTVChain::GetCurPos ( void  ) const
inline

Definition at line 54 of file livetvchain.h.

Referenced by TV::GetLiveTVIndex(), and MythPlayer::OpenFile().

◆ ProgramIsAt() [1/2]

int LiveTVChain::ProgramIsAt ( uint  chanid,
const QDateTime &  starttime 
) const
Returns
program location or -1 for not found.

Definition at line 330 of file livetvchain.cpp.

Referenced by ProgramIsAt(), ReloadAll(), and SetProgram().

◆ ProgramIsAt() [2/2]

int LiveTVChain::ProgramIsAt ( const ProgramInfo pginfo) const
Returns
program location or -1 for not found.

Definition at line 351 of file livetvchain.cpp.

◆ GetLengthAtCurPos()

LiveTVChain::GetLengthAtCurPos ( void  )
Returns
length in seocnds of recording at current position
length in seocnds of recording at m_curpos

Definition at line 359 of file livetvchain.cpp.

Referenced by MythPlayer::calcSliderPos(), and MythPlayer::JumpToProgram().

◆ GetLengthAtPos()

int LiveTVChain::GetLengthAtPos ( int  pos)

Definition at line 367 of file livetvchain.cpp.

Referenced by GetLengthAtCurPos(), and JumpToNext().

◆ TotalSize()

int LiveTVChain::TotalSize ( void  ) const

Definition at line 387 of file livetvchain.cpp.

Referenced by TVRec::CreateLiveTVRingBuffer(), and TV::GetLiveTVIndex().

◆ HasNext()

bool LiveTVChain::HasNext ( void  ) const

◆ HasPrev()

bool LiveTVChain::HasPrev ( void  ) const
inline

Definition at line 61 of file livetvchain.h.

Referenced by MythPlayer::CalcRWTime(), MythPlayer::calcSliderPos(), and SwitchToNext().

◆ GetProgramAt()

ProgramInfo * LiveTVChain::GetProgramAt ( int  at) const

Returns program at the desired location.

NOTE: The caller must delete the returned program.

Parameters
atProgramInfo to return [0..TotalSize()-1] or -1 for last program

Definition at line 319 of file livetvchain.cpp.

Referenced by PlayerContext::ReloadTVChain(), and TVRec::TuningRestartRecorder().

◆ NeedsToSwitch()

bool LiveTVChain::NeedsToSwitch ( void  ) const
inline

Returns true iff a switch is required but no jump is required m_jumppos sets to INT_MAX means not set.

Definition at line 65 of file livetvchain.h.

Referenced by MythPlayer::EventLoop().

◆ NeedsToJump()

bool LiveTVChain::NeedsToJump ( void  ) const
inline

Returns true iff a switch and jump are required.

Definition at line 68 of file livetvchain.h.

Referenced by MythPlayer::EventLoop().

◆ GetChannelName()

QString LiveTVChain::GetChannelName ( int  pos = -1) const

◆ GetInputName()

QString LiveTVChain::GetInputName ( int  pos = -1) const

Definition at line 685 of file livetvchain.cpp.

Referenced by TV::UpdateOSDInput().

◆ GetInputType()

QString LiveTVChain::GetInputType ( int  pos = -1) const

◆ SetProgram()

void LiveTVChain::SetProgram ( const ProgramInfo pginfo)

◆ SwitchTo()

void LiveTVChain::SwitchTo ( int  num)

Sets the recording to switch to.

Parameters
numIndex of recording to switch to, -1 for last recording.

Definition at line 555 of file livetvchain.cpp.

Referenced by JumpTo(), and SwitchToNext().

◆ SwitchToNext()

void LiveTVChain::SwitchToNext ( bool  up)

Sets the recording to switch to.

Parameters
upSet to true to switch to the next recording, false to switch to the previous recording.

Definition at line 590 of file livetvchain.cpp.

Referenced by JumpToNext(), and RingBuffer::run().

◆ ClearSwitch()

void LiveTVChain::ClearSwitch ( void  )

Definition at line 410 of file livetvchain.cpp.

Referenced by GetSwitchProgram().

◆ GetSwitchProgram()

ProgramInfo * LiveTVChain::GetSwitchProgram ( bool discont,
bool newtype,
int &  newid 
)

Returns the recording we should switch to.

This returns a ProgramInfo* and tells us if this is a discontiuous switch and whether the recording type is changing.

This also clears the NeedsToSwitch()/NeedsToJump() state.

NOTE: The caller is resposible for deleting the ProgramInfo

Definition at line 428 of file livetvchain.cpp.

Referenced by MythPlayer::JumpToProgram(), and MythPlayer::SwitchToProgram().

◆ JumpTo()

void LiveTVChain::JumpTo ( int  num,
int  pos 
)

Definition at line 601 of file livetvchain.cpp.

Referenced by TV::UnpauseLiveTV().

◆ JumpToNext()

void LiveTVChain::JumpToNext ( bool  up,
int  pos 
)

JumpToNext(bool up, int pos) jump to the next (up == true) or previous (up == false) liveTV program If pos > 0: indicate the absolute position where to start the next program If pos < 0: indicate offset position; in which case the right liveTV program will be found accordingly.

Offset is in reference to the beginning of the current recordings when going down and in reference to the end of the current recording when going up

Definition at line 616 of file livetvchain.cpp.

Referenced by MythPlayer::CalcMaxFFTime(), MythPlayer::CalcRWTime(), MythPlayer::EventLoop(), and MythPlayer::SetStream().

◆ GetJumpPos()

int LiveTVChain::GetJumpPos ( void  )

Returns the jump position in seconds and clears it.

Definition at line 670 of file livetvchain.cpp.

Referenced by MythPlayer::JumpToProgram().

◆ SetHostSocket()

void LiveTVChain::SetHostSocket ( MythSocket sock)

Definition at line 701 of file livetvchain.cpp.

Referenced by MainServer::HandleRecorderQuery().

◆ IsHostSocket()

bool LiveTVChain::IsHostSocket ( const MythSocket sock) const

Definition at line 709 of file livetvchain.cpp.

◆ HostSocketCount()

uint LiveTVChain::HostSocketCount ( void  ) const

◆ DelHostSocket()

void LiveTVChain::DelHostSocket ( MythSocket sock)

◆ toString()

QString LiveTVChain::toString ( void  ) const

◆ entriesToStringList()

QStringList LiveTVChain::entriesToStringList ( ) const

Definition at line 748 of file livetvchain.cpp.

Referenced by BroadcastUpdate().

◆ entriesFromStringList()

bool LiveTVChain::entriesFromStringList ( const QStringList &  items)

Definition at line 767 of file livetvchain.cpp.

Referenced by ReloadAll().

◆ BroadcastUpdate()

void LiveTVChain::BroadcastUpdate ( void  )
private

Definition at line 189 of file livetvchain.cpp.

Referenced by AppendNewProgram(), DeleteProgram(), and FinishedRecording().

◆ GetEntryAt()

void LiveTVChain::GetEntryAt ( int  at,
LiveTVChainEntry entry 
) const
private

◆ EntryToProgram()

ProgramInfo * LiveTVChain::EntryToProgram ( const LiveTVChainEntry entry)
staticprivate

Definition at line 295 of file livetvchain.cpp.

Referenced by DoGetNextProgram(), and GetProgramAt().

◆ DoGetNextProgram()

ProgramInfo * LiveTVChain::DoGetNextProgram ( bool  up,
int  curpos,
int &  newid,
bool discont,
bool newtype 
)
private

Definition at line 446 of file livetvchain.cpp.

Referenced by GetSwitchProgram(), and JumpToNext().

Member Data Documentation

◆ m_id

QString LiveTVChain::m_id
private

◆ m_chain

QList<LiveTVChainEntry> LiveTVChain::m_chain
private

◆ m_maxpos

int LiveTVChain::m_maxpos {0}
private

◆ m_lock

QMutex LiveTVChain::m_lock {QMutex::Recursive}
mutableprivate

◆ m_hostprefix

QString LiveTVChain::m_hostprefix
private

Definition at line 111 of file livetvchain.h.

Referenced by AppendNewProgram(), and SetHostPrefix().

◆ m_inputtype

QString LiveTVChain::m_inputtype
private

Definition at line 112 of file livetvchain.h.

Referenced by AppendNewProgram(), and SetInputType().

◆ m_curpos

int LiveTVChain::m_curpos {0}
private

◆ m_cur_chanid

uint LiveTVChain::m_cur_chanid {0}
private

Definition at line 115 of file livetvchain.h.

Referenced by ReloadAll(), and SetProgram().

◆ m_cur_startts

QDateTime LiveTVChain::m_cur_startts
private

Definition at line 116 of file livetvchain.h.

Referenced by ReloadAll(), and SetProgram().

◆ m_switchid

int LiveTVChain::m_switchid {-1}
private

◆ m_switchentry

LiveTVChainEntry LiveTVChain::m_switchentry
private

Definition at line 119 of file livetvchain.h.

Referenced by JumpToNext(), LiveTVChain(), ReloadAll(), and SwitchTo().

◆ m_jumppos

int LiveTVChain::m_jumppos {INT_MAX}
private

Definition at line 121 of file livetvchain.h.

Referenced by ClearSwitch(), GetJumpPos(), JumpTo(), and JumpToNext().

◆ m_sockLock

QMutex LiveTVChain::m_sockLock
mutableprivate

Definition at line 123 of file livetvchain.h.

Referenced by DelHostSocket(), HostSocketCount(), IsHostSocket(), and SetHostSocket().

◆ m_inUseSocks

QList<MythSocket*> LiveTVChain::m_inUseSocks
private

Definition at line 124 of file livetvchain.h.

Referenced by DelHostSocket(), HostSocketCount(), IsHostSocket(), and SetHostSocket().


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