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

#include <HLSReader.h>

Collaboration diagram for HLSReader:
Collaboration graph
[legend]

Public Types

using StreamContainer = QMap< QString, HLSRecStream * >
 
using SegmentContainer = QList< HLSRecSegment >
 

Public Member Functions

 HLSReader (void)=default
 
 ~HLSReader (void)
 
bool Open (const QString &m3u, int bitrate_index=0)
 
void Close (bool quiet=false)
 
int Read (uint8_t *buffer, int len)
 
void Throttle (bool val)
 
bool IsThrottled (void) const
 
bool IsOpen (const QString &url) const
 
bool FatalError (void) const
 
bool LoadMetaPlaylists (MythSingleDownload &downloader)
 
void ResetStream (void)
 
void ResetSequence (void)
 
QString StreamURL (void) const
 

Static Public Member Functions

static void CancelURL (const QString &url)
 
static void CancelURL (const QStringList &urls)
 
static bool IsValidPlaylist (QTextStream &text)
 

Protected Member Functions

void Cancel (bool quiet=false)
 
bool LoadSegments (MythSingleDownload &downloader)
 
uint PercentBuffered (void) const
 
int TargetDuration (void) const
 
void AllowPlaylistSwitch (void)
 
void PlaylistGood (void)
 
void PlaylistRetrying (void)
 
int PlaylistRetryCount (void) const
 

Private Member Functions

bool ParseM3U8 (const QByteArray &buffer, HLSRecStream *stream=nullptr)
 
void DecreaseBitrate (int progid)
 
void IncreaseBitrate (int progid)
 
bool LoadSegments (HLSRecStream &hlsstream)
 
int DownloadSegmentData (MythSingleDownload &downloader, HLSRecStream *hls, HLSRecSegment &segment, int playlist_size)
 
void EnableDebugging (void)
 

Private Attributes

QString m_m3u8
 
QString m_segmentBase
 
StreamContainer m_streams
 
SegmentContainer m_segments
 
HLSRecStreamm_curstream {nullptr}
 
int64_t m_curSeq {-1}
 
int m_bitrateIndex {0}
 
bool m_fatal {false}
 
bool m_cancel {false}
 
bool m_throttle {true}
 
bool m_aesMsg {false}
 
HLSPlaylistWorkerm_playlistWorker {nullptr}
 
HLSStreamWorkerm_streamWorker {nullptr}
 
int m_playlistSize {0}
 
bool m_bandwidthCheck {false}
 
uint m_prebufferCnt {10}
 
QMutex m_seqLock
 
QMutex m_streamLock
 
QMutex m_workerLock
 
QMutex m_throttleLock
 
QWaitCondition m_throttleCond
 
bool m_debug {false}
 
int m_debugCnt {0}
 
int m_slowCnt {0}
 
QByteArray m_buffer
 
QMutex m_bufLock
 

Friends

class HLSStreamWorker
 
class HLSPlaylistWorker
 

Detailed Description

Definition at line 34 of file HLSReader.h.

Member Typedef Documentation

◆ StreamContainer

using HLSReader::StreamContainer = QMap<QString, HLSRecStream* >

Definition at line 40 of file HLSReader.h.

◆ SegmentContainer

Definition at line 41 of file HLSReader.h.

Constructor & Destructor Documentation

◆ HLSReader()

HLSReader::HLSReader ( void  )
default

◆ ~HLSReader()

HLSReader::~HLSReader ( void  )

Definition at line 29 of file HLSReader.cpp.

Member Function Documentation

◆ Open()

bool HLSReader::Open ( const QString &  m3u,
int  bitrate_index = 0 
)

Definition at line 36 of file HLSReader.cpp.

Referenced by HLSStreamHandler::run().

◆ Close()

void HLSReader::Close ( bool  quiet = false)

Definition at line 138 of file HLSReader.cpp.

Referenced by Open(), and ~HLSReader().

◆ Read()

int HLSReader::Read ( uint8_t *  buffer,
int  len 
)

Definition at line 205 of file HLSReader.cpp.

Referenced by HLSStreamHandler::run().

◆ Throttle()

void HLSReader::Throttle ( bool  val)

Definition at line 191 of file HLSReader.cpp.

Referenced by HLSStreamHandler::run().

◆ IsThrottled()

bool HLSReader::IsThrottled ( void  ) const
inline

Definition at line 50 of file HLSReader.h.

Referenced by HLSStreamHandler::run().

◆ IsOpen()

bool HLSReader::IsOpen ( const QString &  url) const
inline

Definition at line 51 of file HLSReader.h.

Referenced by Open(), and HLSStreamHandler::run().

◆ FatalError()

bool HLSReader::FatalError ( void  ) const
inline

Definition at line 53 of file HLSReader.h.

Referenced by HLSPlaylistWorker::run(), HLSStreamWorker::run(), and HLSStreamHandler::run().

◆ LoadMetaPlaylists()

bool HLSReader::LoadMetaPlaylists ( MythSingleDownload downloader)

Definition at line 630 of file HLSReader.cpp.

Referenced by HLSPlaylistWorker::run().

◆ ResetStream()

void HLSReader::ResetStream ( void  )
inline

Definition at line 56 of file HLSReader.h.

Referenced by HLSPlaylistWorker::run().

◆ ResetSequence()

void HLSReader::ResetSequence ( void  )
inline

Definition at line 58 of file HLSReader.h.

Referenced by ParseM3U8(), and HLSStreamWorker::run().

◆ StreamURL()

QString HLSReader::StreamURL ( void  ) const
inline

Definition at line 60 of file HLSReader.h.

Referenced by ParseM3U8().

◆ CancelURL() [1/2]

static void HLSReader::CancelURL ( const QString &  url)
static

Referenced by Cancel().

◆ CancelURL() [2/2]

static void HLSReader::CancelURL ( const QStringList &  urls)
static

◆ IsValidPlaylist()

bool HLSReader::IsValidPlaylist ( QTextStream &  text)
static

Definition at line 256 of file HLSReader.cpp.

Referenced by IPTVTuningData::IsHLSPlaylist(), and Open().

◆ Cancel()

void HLSReader::Cancel ( bool  quiet = false)
protected

Definition at line 162 of file HLSReader.cpp.

Referenced by Close().

◆ LoadSegments() [1/2]

bool HLSReader::LoadSegments ( MythSingleDownload downloader)
protected

Definition at line 776 of file HLSReader.cpp.

Referenced by HLSStreamWorker::run().

◆ PercentBuffered()

uint HLSReader::PercentBuffered ( void  ) const
protected

Definition at line 877 of file HLSReader.cpp.

Referenced by LoadMetaPlaylists(), and HLSPlaylistWorker::run().

◆ TargetDuration()

int HLSReader::TargetDuration ( void  ) const
inlineprotected

Definition at line 75 of file HLSReader.h.

Referenced by HLSPlaylistWorker::run().

◆ AllowPlaylistSwitch()

void HLSReader::AllowPlaylistSwitch ( void  )
inlineprotected

Definition at line 78 of file HLSReader.h.

Referenced by HLSPlaylistWorker::run().

◆ PlaylistGood()

void HLSReader::PlaylistGood ( void  )
protected

Definition at line 1014 of file HLSReader.cpp.

Referenced by HLSPlaylistWorker::run().

◆ PlaylistRetrying()

void HLSReader::PlaylistRetrying ( void  )
protected

Definition at line 1021 of file HLSReader.cpp.

Referenced by HLSPlaylistWorker::run().

◆ PlaylistRetryCount()

int HLSReader::PlaylistRetryCount ( void  ) const
protected

Definition at line 1028 of file HLSReader.cpp.

Referenced by HLSPlaylistWorker::run().

◆ ParseM3U8()

bool HLSReader::ParseM3U8 ( const QByteArray &  buffer,
HLSRecStream stream = nullptr 
)
private

Definition at line 289 of file HLSReader.cpp.

Referenced by LoadMetaPlaylists(), and Open().

◆ DecreaseBitrate()

void HLSReader::DecreaseBitrate ( int  progid)
private

Definition at line 704 of file HLSReader.cpp.

Referenced by LoadMetaPlaylists().

◆ IncreaseBitrate()

void HLSReader::IncreaseBitrate ( int  progid)
private

Definition at line 740 of file HLSReader.cpp.

Referenced by LoadMetaPlaylists().

◆ LoadSegments() [2/2]

bool HLSReader::LoadSegments ( HLSRecStream hlsstream)
private

◆ DownloadSegmentData()

int HLSReader::DownloadSegmentData ( MythSingleDownload downloader,
HLSRecStream hls,
HLSRecSegment segment,
int  playlist_size 
)
private

Definition at line 885 of file HLSReader.cpp.

Referenced by LoadSegments().

◆ EnableDebugging()

void HLSReader::EnableDebugging ( void  )
private

Friends And Related Function Documentation

◆ HLSStreamWorker

friend class HLSStreamWorker
friend

Definition at line 36 of file HLSReader.h.

Referenced by Open().

◆ HLSPlaylistWorker

friend class HLSPlaylistWorker
friend

Definition at line 37 of file HLSReader.h.

Referenced by Open().

Member Data Documentation

◆ m_m3u8

QString HLSReader::m_m3u8
private

Definition at line 98 of file HLSReader.h.

Referenced by Open(), and ParseM3U8().

◆ m_segmentBase

QString HLSReader::m_segmentBase
private

Definition at line 99 of file HLSReader.h.

Referenced by LoadMetaPlaylists(), Open(), and ParseM3U8().

◆ m_streams

StreamContainer HLSReader::m_streams
private

Definition at line 100 of file HLSReader.h.

Referenced by Close(), DecreaseBitrate(), IncreaseBitrate(), Open(), and ParseM3U8().

◆ m_segments

SegmentContainer HLSReader::m_segments
private

Definition at line 101 of file HLSReader.h.

Referenced by Cancel(), LoadMetaPlaylists(), LoadSegments(), ParseM3U8(), and PercentBuffered().

◆ m_curstream

HLSRecStream* HLSReader::m_curstream {nullptr}
private

◆ m_curSeq

int64_t HLSReader::m_curSeq {-1}
private

Definition at line 103 of file HLSReader.h.

Referenced by LoadSegments(), and ParseM3U8().

◆ m_bitrateIndex

int HLSReader::m_bitrateIndex {0}
private

Definition at line 104 of file HLSReader.h.

Referenced by LoadSegments(), Open(), and ParseM3U8().

◆ m_fatal

bool HLSReader::m_fatal {false}
private

Definition at line 106 of file HLSReader.h.

Referenced by DownloadSegmentData(), and Open().

◆ m_cancel

bool HLSReader::m_cancel {false}
private

Definition at line 107 of file HLSReader.h.

Referenced by Cancel(), LoadMetaPlaylists(), LoadSegments(), Open(), ParseM3U8(), and Read().

◆ m_throttle

bool HLSReader::m_throttle {true}
private

Definition at line 108 of file HLSReader.h.

Referenced by LoadSegments(), and Throttle().

◆ m_aesMsg

bool HLSReader::m_aesMsg {false}
private

Definition at line 110 of file HLSReader.h.

Referenced by ParseM3U8().

◆ m_playlistWorker

HLSPlaylistWorker* HLSReader::m_playlistWorker {nullptr}
private

Definition at line 112 of file HLSReader.h.

Referenced by Cancel(), Close(), and Open().

◆ m_streamWorker

HLSStreamWorker* HLSReader::m_streamWorker {nullptr}
private

Definition at line 113 of file HLSReader.h.

Referenced by Cancel(), Close(), LoadMetaPlaylists(), Open(), and ParseM3U8().

◆ m_playlistSize

int HLSReader::m_playlistSize {0}
private

Definition at line 115 of file HLSReader.h.

Referenced by LoadMetaPlaylists(), LoadSegments(), ParseM3U8(), and PercentBuffered().

◆ m_bandwidthCheck

bool HLSReader::m_bandwidthCheck {false}
private

Definition at line 116 of file HLSReader.h.

Referenced by LoadMetaPlaylists(), LoadSegments(), and ParseM3U8().

◆ m_prebufferCnt

uint HLSReader::m_prebufferCnt {10}
private

Definition at line 117 of file HLSReader.h.

Referenced by LoadSegments(), and Throttle().

◆ m_seqLock

QMutex HLSReader::m_seqLock
private

Definition at line 118 of file HLSReader.h.

Referenced by LoadSegments(), and ParseM3U8().

◆ m_streamLock

QMutex HLSReader::m_streamLock
mutableprivate

◆ m_workerLock

QMutex HLSReader::m_workerLock
mutableprivate

Definition at line 120 of file HLSReader.h.

Referenced by Cancel(), Close(), Open(), and ParseM3U8().

◆ m_throttleLock

QMutex HLSReader::m_throttleLock
private

Definition at line 121 of file HLSReader.h.

Referenced by Cancel(), LoadSegments(), and Throttle().

◆ m_throttleCond

QWaitCondition HLSReader::m_throttleCond
private

Definition at line 122 of file HLSReader.h.

Referenced by Cancel(), LoadSegments(), and Throttle().

◆ m_debug

bool HLSReader::m_debug {false}
private

Definition at line 123 of file HLSReader.h.

Referenced by DownloadSegmentData(), EnableDebugging(), LoadSegments(), and ParseM3U8().

◆ m_debugCnt

int HLSReader::m_debugCnt {0}
private

Definition at line 124 of file HLSReader.h.

Referenced by EnableDebugging(), and ParseM3U8().

◆ m_slowCnt

int HLSReader::m_slowCnt {0}
private

Definition at line 127 of file HLSReader.h.

Referenced by DownloadSegmentData().

◆ m_buffer

QByteArray HLSReader::m_buffer
private

Definition at line 128 of file HLSReader.h.

Referenced by DownloadSegmentData(), and Read().

◆ m_bufLock

QMutex HLSReader::m_bufLock
private

Definition at line 129 of file HLSReader.h.

Referenced by DownloadSegmentData(), and Read().


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