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

#include <httplivestreambuffer.h>

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

Public Member Functions

 HLSRingBuffer (const QString &lfilename)
 
 HLSRingBuffer (const QString &lfilename, bool open)
 
virtual ~HLSRingBuffer ()
 
bool IsOpen (void) const override
 Returns true if open for either reading or writing. More...
 
long long GetReadPosition (void) const override
 Returns how far into the file we have read. More...
 
bool OpenFile (const QString &lfilename, uint retry_ms=kDefaultOpenTimeout) override
 Opens an HTTP Live Stream for reading. More...
 
bool IsStreamed (void) override
 
bool IsSeekingAllowed (void) override
 
bool IsBookmarkAllowed (void) override
 
bool SaveToDisk (const QString &filename, int segstart=0, int segend=-1)
 
int NumStreams (void) const
 
int Read (void *data, uint i_read)
 
void Interrupt (void)
 
void Continue (void)
 
int DurationForBytes (uint size)
 returns an estimated duration in ms for size amount of data returns 0 if we can't estimate the duration More...
 
- Public Member Functions inherited from RingBuffer
virtual ~RingBuffer ()=0
 Deletes. More...
 
void SetWriteBufferSize (int newSize)
 
void SetWriteBufferMinWriteSize (int newMinSize)
 Calls ThreadedFileWriter::SetWriteBufferMinWriteSize(int) More...
 
void SetOldFile (bool is_old)
 Tell RingBuffer if this is an old file or not. More...
 
void UpdateRawBitrate (uint raw_bitrate)
 Set the raw bit rate, to allow RingBuffer adjust effective bitrate. More...
 
void UpdatePlaySpeed (float play_speed)
 Set the play speed, to allow RingBuffer adjust effective bitrate. More...
 
void EnableBitrateMonitor (bool enable)
 
void SetBufferSizeFactors (bool estbitrate, bool matroska)
 Tells RingBuffer that the raw bitrate may be innacurate and the underlying container is matroska, both of which may require a larger buffer size. More...
 
void SetWaitForWrite (void)
 
QString GetSafeFilename (void)
 
QString GetFilename (void) const
 Returns name of file used by this RingBuffer. More...
 
QString GetSubtitleFilename (void) const
 
QString GetLastError (void) const
 
bool GetCommsError (void) const
 
void ResetCommsError (void)
 
bool GetStopReads (void) const
 Returns value of stopreads. More...
 
bool isPaused (void) const
 Returns false iff read-ahead is not running and read-ahead is not paused. More...
 
QString GetDecoderRate (void)
 
QString GetStorageRate (void)
 
QString GetAvailableBuffer (void)
 
uint GetBufferSize (void)
 
long long GetWritePosition (void) const
 Returns how far into a ThreadedFileWriter file we have written. More...
 
long long GetRealFileSize (void) const
 Returns the size of the file we are reading/writing, or -1 if the query fails. More...
 
bool IsNearEnd (double fps, uint vvf) const
 
virtual int BestBufferSize (void)
 
RingBufferType GetType () const
 
int GetReadBufAvail () const
 Returns number of bytes available for reading from buffer. More...
 
bool SetReadInternalMode (bool mode)
 
bool IsReadInternalMode (void)
 
bool IsDisc (void) const
 
bool IsDVD (void) const
 
bool IsBD (void) const
 
const DVDRingBufferDVD (void) const
 
const BDRingBufferBD (void) const
 
DVDRingBufferDVD (void)
 
BDRingBufferBD (void)
 
virtual bool StartFromBeginning (void)
 
virtual void IgnoreWaitStates (bool)
 
virtual bool IsInMenu (void) const
 
virtual bool IsInStillFrame (void) const
 
virtual bool IsInDiscMenuOrStillFrame (void) const
 
virtual bool HandleAction (const QStringList &, int64_t)
 
virtual bool ReOpen (QString="")
 
int Read (void *buf, int count)
 This is the public method for reading from a file, it calls the appropriate read method if the file is remote or buffered, or a BD/DVD. More...
 
int Peek (void *buf, int count)
 
void Reset (bool full=false, bool toAdjust=false, bool resetInternal=false)
 Resets the read-ahead thread and our position in the file. More...
 
long long Seek (long long pos, int whence, bool has_lock=false)
 Seeks to a particular position in the file. More...
 
void Pause (void)
 Pauses the read-ahead thread. More...
 
void Unpause (void)
 Unpauses the read-ahead thread. More...
 
void WaitForPause (void)
 Waits for Pause(void) to take effect. More...
 
void Start (void)
 Starts the read-ahead thread. More...
 
void StopReads (void)
 ???? More...
 
void StartReads (void)
 ???? More...
 
bool LiveMode (void) const
 Returns true if this RingBuffer has been assigned a LiveTVChain. More...
 
void SetLiveMode (LiveTVChain *chain)
 Assigns a LiveTVChain to this RingBuffer. More...
 
void IgnoreLiveEOF (bool ignore)
 Tells RingBuffer whether to ignore the end-of-file. More...
 
int Write (const void *buf, uint count)
 Writes buffer to ThreadedFileWriter::Write(const void*,uint) More...
 
bool IsIOBound (void) const
 
void WriterFlush (void)
 Calls ThreadedFileWriter::Flush(void) More...
 
void Sync (void)
 Calls ThreadedFileWriter::Sync(void) More...
 
long long WriterSeek (long long pos, int whence, bool has_lock=false)
 Calls ThreadedFileWriter::Seek(long long,int). More...
 
bool WriterSetBlocking (bool lock=true)
 Calls ThreadedFileWriter::SetBlocking(bool) More...
 
long long SetAdjustFilesize (void)
 

Static Public Member Functions

static bool IsHTTPLiveStreaming (QByteArray *s)
 
static bool TestForHTTPLiveStreaming (const QString &filename)
 
- Static Public Member Functions inherited from RingBuffer
static RingBufferCreate (const QString &xfilename, bool write, bool usereadahead=true, int timeout_ms=kDefaultOpenTimeout, bool stream_only=false)
 Creates a RingBuffer instance. More...
 
static QString BitrateToString (uint64_t rate, bool hz=false)
 
static void AVFormatInitNetwork (void)
 

Protected Member Functions

int safe_read (void *data, uint i_read) override
 
long long GetRealFileSizeInternal (void) const override
 
long long SeekInternal (long long pos, int whence) override
 
- Protected Member Functions inherited from RingBuffer
 RingBuffer (RingBufferType rbtype)
 
void run (void) override
 Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead. More...
 
void CreateReadAheadBuffer (void)
 
void CalcReadAheadThresh (void)
 Calculates fill_min, fill_threshold, and readblocksize from the estimated effective bitrate of the stream. More...
 
bool PauseAndWait (void)
 
int ReadPriv (void *buf, int count, bool peek)
 When possible reads from the read-ahead buffer, otherwise reads directly from the device. More...
 
int ReadDirect (void *buf, int count, bool peek)
 
bool WaitForReadsAllowed (void)
 
int WaitForAvail (int count, int timeout)
 
int ReadBufFree (void) const
 Returns number of bytes available for reading into buffer. More...
 
int ReadBufAvail (void) const
 Returns number of bytes available for reading from buffer. More...
 
void ResetReadAhead (long long newinternal)
 Restart the read-ahead thread at the 'newinternal' position. More...
 
void KillReadAheadThread (void)
 Stops the read-ahead thread, and waits for it to stop. More...
 
uint64_t UpdateDecoderRate (uint64_t latest=0)
 
uint64_t UpdateStorageRate (uint64_t latest=0)
 
- Protected Member Functions inherited from MThread
int exec (void)
 Enters the qt event loop. call exit or quit to exit thread. More...
 
 MThread (const QString &objectName)
 Standard constructor. More...
 
 MThread (const QString &objectName, QRunnable *runnable)
 Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More...
 
virtual ~MThread ()
 
void RunProlog (void)
 Sets up a thread, call this if you reimplement run(). More...
 
void RunEpilog (void)
 Cleans up a thread's resources, call this if you reimplement run(). More...
 
QThread * qthread (void)
 Returns the thread, this will always return the same pointer no matter how often you restart the thread. More...
 
void setObjectName (const QString &name)
 
QString objectName (void) const
 
void setPriority (QThread::Priority priority)
 
QThread::Priority priority (void) const
 
bool isFinished (void) const
 
bool isRunning (void) const
 
void setStackSize (uint stackSize)
 
uint stackSize (void) const
 
void exit (int retcode=0)
 Use this to exit from the thread if you are using a Qt event loop. More...
 
void start (QThread::Priority=QThread::InheritPriority)
 Tell MThread to start running the thread in the near future. More...
 
void terminate (void)
 Kill a thread unsafely. More...
 
void quit (void)
 calls exit(0) More...
 
bool wait (unsigned long time=ULONG_MAX)
 Wait for the MThread to exit, with a maximum timeout. More...
 

Private Member Functions

void FreeStreamsList (QList< HLSStream * > *streams) const
 
HLSStreamGetStreamForSegment (int segid) const
 
HLSStreamGetStream (const int wanted, const StreamsList *streams=nullptr) const
 
HLSStreamGetFirstStream (const StreamsList *streams=nullptr) const
 
HLSStreamGetLastStream (const StreamsList *streams=nullptr) const
 
HLSStreamFindStream (const HLSStream *hls_new, const StreamsList *streams=nullptr) const
 
HLSStreamGetCurrentStream (void) const
 return the stream we are currently streaming from More...
 
QString ParseAttributes (const QString &line, const char *attr) const
 
int ParseDecimalValue (const QString &line, int &target) const
 Return the decimal argument in a line of type: blah:<decimal> presence of value <decimal> is compulsory or it will return RET_ERROR. More...
 
int ParseSegmentInformation (const HLSStream *hls, const QString &line, int &duration, QString &title) const
 
int ParseTargetDuration (HLSStream *hls, const QString &line) const
 
HLSStreamParseStreamInformation (const QString &line, const QString &uri) const
 
int ParseMediaSequence (HLSStream *hls, const QString &line) const
 
int ParseKey (HLSStream *hls, const QString &line)
 
int ParseProgramDateTime (HLSStream *hls, const QString &line) const
 
int ParseAllowCache (HLSStream *hls, const QString &line) const
 
int ParseVersion (const QString &line, int &version) const
 
int ParseEndList (HLSStream *hls) const
 
int ParseDiscontinuity (HLSStream *hls, const QString &line) const
 
int ParseM3U8 (const QByteArray *buffer, StreamsList *streams=nullptr)
 
int Prefetch (int count)
 Preferetch the first x segments of the stream. More...
 
void SanityCheck (const HLSStream *hls) const
 
HLSSegmentGetSegment (int segnum, int timeout=1000)
 Retrieve segment [segnum] from any available streams. More...
 
int NumSegments (void) const
 
int ChooseSegment (int stream) const
 
int64_t SizeMedia (void) const
 
void WaitUntilBuffered (void)
 Wait until we have enough segments buffered to allow smooth playback Do not wait if VOD and at end of buffer. More...
 
void SanitizeStreams (StreamsList *streams=nullptr)
 Streams may not be all starting at the same sequence number, so attempt to align their starting sequence. More...
 

Private Attributes

QString m_m3u8
 
QByteArray m_peeked
 
HLSPlaybackm_playback
 
StreamsList m_streams
 
QMutex m_lock
 
bool m_meta
 
bool m_error
 
bool m_aesmsg
 
int m_startup
 
int64_t m_bitrate
 assumed bitrate of playback used for the purpose of calculating length and seek position. More...
 
bool m_seektoend
 FFmpeg seek to the end of the stream in order to determine the length of the video. More...
 
StreamWorkerm_streamworker
 
PlaylistWorkerm_playlistworker
 
FILE * m_fd
 
bool m_interrupted
 
bool m_killed
 

Friends

class StreamWorker
 
class PlaylistWorker
 

Additional Inherited Members

- Static Public Attributes inherited from RingBuffer
static const int kDefaultOpenTimeout = 2000
 
static const int kLiveTVOpenTimeout = 10000
 
static QMutex subExtLock
 
static QStringList subExt
 
static QStringList subExtNoCheck
 
- Static Protected Member Functions inherited from MThread
static void setTerminationEnabled (bool enabled=true)
 
static void sleep (unsigned long time)
 
static void msleep (unsigned long time)
 
static void usleep (unsigned long time)
 
static void ThreadSetup (const QString &)
 This is to be called on startup in those few threads that haven't been ported to MThread. More...
 
static void ThreadCleanup (void)
 This is to be called on exit in those few threads that haven't been ported to MThread. More...
 
static void Cleanup (void)
 This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More...
 
static void GetAllThreadNames (QStringList &list)
 
static void GetAllRunningThreadNames (QStringList &list)
 
- Protected Attributes inherited from RingBuffer
RingBufferType type
 
QReadWriteLock poslock
 
long long readpos
 
long long writepos
 
long long internalreadpos
 
long long ignorereadpos
 
QReadWriteLock rbrlock
 
int rbrpos
 
QReadWriteLock rbwlock
 
int rbwpos
 
volatile bool stopreads
 
QReadWriteLock rwlock
 
QString safefilename
 
QString filename
 
QString subtitlefilename
 
QString lastError
 
ThreadedFileWritertfw
 
int fd2
 
bool writemode
 
RemoteFileremotefile
 
uint bufferSize
 
bool low_buffers
 
bool fileismatroska
 
bool unknownbitrate
 
bool startreadahead
 
char * readAheadBuffer
 
bool readaheadrunning
 
bool reallyrunning
 
bool request_pause
 
bool paused
 
bool ateof
 
bool waitforwrite
 
bool beingwritten
 
bool readsallowed
 
bool readsdesired
 
volatile bool recentseek
 
bool setswitchtonext
 
uint rawbitrate
 
float playspeed
 
int fill_threshold
 
int fill_min
 
int readblocksize
 
int wanttoread
 
int numfailures
 
bool commserror
 
bool oldfile
 
LiveTVChainlivetvchain
 
bool ignoreliveeof
 
long long readAdjust
 
int readOffset
 
bool readInternalMode
 
bool bitrateMonitorEnabled
 
QMutex decoderReadLock
 
QMap< qint64, uint64_t > decoderReads
 
QMutex storageReadLock
 
QMap< qint64, uint64_t > storageReads
 
QWaitCondition generalWait
 Condition to signal that the read ahead thread is running. More...
 
- Protected Attributes inherited from MThread
MThreadInternalm_thread
 
QRunnable * m_runnable
 
bool m_prolog_executed
 
bool m_epilog_executed
 
- Static Protected Attributes inherited from MThread
static const int kDefaultStartTimeout
 

Detailed Description

Definition at line 43 of file httplivestreambuffer.h.

Constructor & Destructor Documentation

◆ HLSRingBuffer() [1/2]

HLSRingBuffer::HLSRingBuffer ( const QString &  lfilename)
explicit

Definition at line 1567 of file httplivestreambuffer.cpp.

◆ HLSRingBuffer() [2/2]

HLSRingBuffer::HLSRingBuffer ( const QString &  lfilename,
bool  open 
)

Definition at line 1579 of file httplivestreambuffer.cpp.

◆ ~HLSRingBuffer()

HLSRingBuffer::~HLSRingBuffer ( )
virtual

Definition at line 1594 of file httplivestreambuffer.cpp.

Member Function Documentation

◆ IsOpen()

bool HLSRingBuffer::IsOpen ( void  ) const
overridevirtual

Returns true if open for either reading or writing.

Implements RingBuffer.

Definition at line 2980 of file httplivestreambuffer.cpp.

◆ GetReadPosition()

long long HLSRingBuffer::GetReadPosition ( void  ) const
overridevirtual

Returns how far into the file we have read.

Implements RingBuffer.

Definition at line 2973 of file httplivestreambuffer.cpp.

◆ OpenFile()

bool HLSRingBuffer::OpenFile ( const QString &  lfilename,
uint  retry_ms = kDefaultOpenTimeout 
)
overridevirtual

Opens an HTTP Live Stream for reading.

Parameters
lfilenameUrl of the HTTP live stream to read.
retry_msIgnored. This value is part of the API inherited from the parent class.
Returns
Returns true if the live stream was opened.

Implements RingBuffer.

Definition at line 2543 of file httplivestreambuffer.cpp.

Referenced by HLSRingBuffer().

◆ IsStreamed()

bool HLSRingBuffer::IsStreamed ( void  )
inlineoverridevirtual

Reimplemented from RingBuffer.

Definition at line 54 of file httplivestreambuffer.h.

◆ IsSeekingAllowed()

bool HLSRingBuffer::IsSeekingAllowed ( void  )
inlineoverridevirtual

Reimplemented from RingBuffer.

Definition at line 55 of file httplivestreambuffer.h.

Referenced by SeekInternal().

◆ IsBookmarkAllowed()

bool HLSRingBuffer::IsBookmarkAllowed ( void  )
inlineoverridevirtual

Reimplemented from RingBuffer.

Definition at line 56 of file httplivestreambuffer.h.

◆ IsHTTPLiveStreaming()

bool HLSRingBuffer::IsHTTPLiveStreaming ( QByteArray *  s)
static

Definition at line 1718 of file httplivestreambuffer.cpp.

Referenced by OpenFile(), and TestForHTTPLiveStreaming().

◆ TestForHTTPLiveStreaming()

bool HLSRingBuffer::TestForHTTPLiveStreaming ( const QString &  filename)
static

Definition at line 1752 of file httplivestreambuffer.cpp.

Referenced by RingBuffer::Create().

◆ SaveToDisk()

bool HLSRingBuffer::SaveToDisk ( const QString &  filename,
int  segstart = 0,
int  segend = -1 
)

Definition at line 2624 of file httplivestreambuffer.cpp.

◆ NumStreams()

int HLSRingBuffer::NumStreams ( void  ) const

◆ Read()

int HLSRingBuffer::Read ( void *  data,
uint  i_read 
)
inline

Definition at line 61 of file httplivestreambuffer.h.

◆ Interrupt()

void HLSRingBuffer::Interrupt ( void  )

Definition at line 2985 of file httplivestreambuffer.cpp.

◆ Continue()

void HLSRingBuffer::Continue ( void  )

Definition at line 2994 of file httplivestreambuffer.cpp.

◆ DurationForBytes()

int HLSRingBuffer::DurationForBytes ( uint  size)

returns an estimated duration in ms for size amount of data returns 0 if we can't estimate the duration

Definition at line 2784 of file httplivestreambuffer.cpp.

◆ safe_read()

int HLSRingBuffer::safe_read ( void *  data,
uint  i_read 
)
overrideprotectedvirtual

Implements RingBuffer.

Definition at line 2701 of file httplivestreambuffer.cpp.

Referenced by Read().

◆ GetRealFileSizeInternal()

long long HLSRingBuffer::GetRealFileSizeInternal ( void  ) const
overrideprotectedvirtual

Reimplemented from RingBuffer.

Definition at line 2808 of file httplivestreambuffer.cpp.

◆ SeekInternal()

long long HLSRingBuffer::SeekInternal ( long long  pos,
int  whence 
)
overrideprotectedvirtual

Implements RingBuffer.

Definition at line 2814 of file httplivestreambuffer.cpp.

◆ FreeStreamsList()

void HLSRingBuffer::FreeStreamsList ( QList< HLSStream * > *  streams) const
private

Definition at line 1621 of file httplivestreambuffer.cpp.

Referenced by PlaylistWorker::ReloadPlaylist(), and ~HLSRingBuffer().

◆ GetStreamForSegment()

HLSStream * HLSRingBuffer::GetStreamForSegment ( int  segid) const
private

Definition at line 1639 of file httplivestreambuffer.cpp.

Referenced by SeekInternal().

◆ GetStream()

HLSStream * HLSRingBuffer::GetStream ( const int  wanted,
const StreamsList streams = nullptr 
) const
private

◆ GetFirstStream()

HLSStream * HLSRingBuffer::GetFirstStream ( const StreamsList streams = nullptr) const
private

Definition at line 1663 of file httplivestreambuffer.cpp.

◆ GetLastStream()

HLSStream * HLSRingBuffer::GetLastStream ( const StreamsList streams = nullptr) const
private

Definition at line 1668 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ FindStream()

HLSStream * HLSRingBuffer::FindStream ( const HLSStream hls_new,
const StreamsList streams = nullptr 
) const
private

Definition at line 1681 of file httplivestreambuffer.cpp.

Referenced by PlaylistWorker::ReloadPlaylist().

◆ GetCurrentStream()

HLSStream * HLSRingBuffer::GetCurrentStream ( void  ) const
private

return the stream we are currently streaming from

Definition at line 1709 of file httplivestreambuffer.cpp.

Referenced by GetStreamForSegment(), OpenFile(), PlaylistWorker::run(), SizeMedia(), and WaitUntilBuffered().

◆ ParseAttributes()

QString HLSRingBuffer::ParseAttributes ( const QString &  line,
const char *  attr 
) const
private

Definition at line 1784 of file httplivestreambuffer.cpp.

Referenced by ParseKey(), and ParseStreamInformation().

◆ ParseDecimalValue()

int HLSRingBuffer::ParseDecimalValue ( const QString &  line,
int &  target 
) const
private

Return the decimal argument in a line of type: blah:<decimal> presence of value <decimal> is compulsory or it will return RET_ERROR.

Definition at line 1810 of file httplivestreambuffer.cpp.

Referenced by ParseMediaSequence(), ParseTargetDuration(), and ParseVersion().

◆ ParseSegmentInformation()

int HLSRingBuffer::ParseSegmentInformation ( const HLSStream hls,
const QString &  line,
int &  duration,
QString &  title 
) const
private

Definition at line 1823 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseTargetDuration()

int HLSRingBuffer::ParseTargetDuration ( HLSStream hls,
const QString &  line 
) const
private

Definition at line 1881 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseStreamInformation()

HLSStream * HLSRingBuffer::ParseStreamInformation ( const QString &  line,
const QString &  uri 
) const
private

Definition at line 1899 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseMediaSequence()

int HLSRingBuffer::ParseMediaSequence ( HLSStream hls,
const QString &  line 
) const
private

Definition at line 1943 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseKey()

int HLSRingBuffer::ParseKey ( HLSStream hls,
const QString &  line 
)
private

Definition at line 1972 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseProgramDateTime()

int HLSRingBuffer::ParseProgramDateTime ( HLSStream hls,
const QString &  line 
) const
private

Definition at line 2056 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseAllowCache()

int HLSRingBuffer::ParseAllowCache ( HLSStream hls,
const QString &  line 
) const
private

Definition at line 2067 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseVersion()

int HLSRingBuffer::ParseVersion ( const QString &  line,
int &  version 
) const
private

Definition at line 2091 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseEndList()

int HLSRingBuffer::ParseEndList ( HLSStream hls) const
private

Definition at line 2122 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseDiscontinuity()

int HLSRingBuffer::ParseDiscontinuity ( HLSStream hls,
const QString &  line 
) const
private

Definition at line 2134 of file httplivestreambuffer.cpp.

Referenced by ParseM3U8().

◆ ParseM3U8()

int HLSRingBuffer::ParseM3U8 ( const QByteArray *  buffer,
StreamsList streams = nullptr 
)
private

Definition at line 2141 of file httplivestreambuffer.cpp.

Referenced by PlaylistWorker::GetHTTPLiveMetaPlaylist(), and OpenFile().

◆ Prefetch()

int HLSRingBuffer::Prefetch ( int  count)
private

Preferetch the first x segments of the stream.

Definition at line 2328 of file httplivestreambuffer.cpp.

Referenced by OpenFile().

◆ SanityCheck()

void HLSRingBuffer::SanityCheck ( const HLSStream hls) const
private

Definition at line 2354 of file httplivestreambuffer.cpp.

Referenced by GetSegment().

◆ GetSegment()

HLSSegment * HLSRingBuffer::GetSegment ( int  segnum,
int  timeout = 1000 
)
private

Retrieve segment [segnum] from any available streams.

Assure that the segment has been downloaded Return nullptr if segment couldn't be retrieved after timeout (in ms)

Definition at line 2380 of file httplivestreambuffer.cpp.

Referenced by SaveToDisk().

◆ NumSegments()

int HLSRingBuffer::NumSegments ( void  ) const
private

◆ ChooseSegment()

int HLSRingBuffer::ChooseSegment ( int  stream) const
private

Definition at line 2432 of file httplivestreambuffer.cpp.

◆ SizeMedia()

int64_t HLSRingBuffer::SizeMedia ( void  ) const
private

Definition at line 2656 of file httplivestreambuffer.cpp.

Referenced by GetRealFileSizeInternal(), and SeekInternal().

◆ WaitUntilBuffered()

void HLSRingBuffer::WaitUntilBuffered ( void  )
private

Wait until we have enough segments buffered to allow smooth playback Do not wait if VOD and at end of buffer.

Definition at line 2671 of file httplivestreambuffer.cpp.

Referenced by safe_read().

◆ SanitizeStreams()

void HLSRingBuffer::SanitizeStreams ( StreamsList streams = nullptr)
private

Streams may not be all starting at the same sequence number, so attempt to align their starting sequence.

Definition at line 2476 of file httplivestreambuffer.cpp.

Referenced by PlaylistWorker::GetHTTPLiveMetaPlaylist(), and OpenFile().

Friends And Related Function Documentation

◆ StreamWorker

friend class StreamWorker
friend

Definition at line 128 of file httplivestreambuffer.h.

Referenced by OpenFile().

◆ PlaylistWorker

friend class PlaylistWorker
friend

Definition at line 130 of file httplivestreambuffer.h.

Referenced by OpenFile().

Member Data Documentation

◆ m_m3u8

QString HLSRingBuffer::m_m3u8
private

Definition at line 103 of file httplivestreambuffer.h.

Referenced by OpenFile(), ParseM3U8(), and ParseStreamInformation().

◆ m_peeked

QByteArray HLSRingBuffer::m_peeked
private

Definition at line 104 of file httplivestreambuffer.h.

◆ m_playback

HLSPlayback* HLSRingBuffer::m_playback
private

◆ m_streams

StreamsList HLSRingBuffer::m_streams
private

◆ m_lock

QMutex HLSRingBuffer::m_lock
mutableprivate

Definition at line 110 of file httplivestreambuffer.h.

Referenced by Continue(), and Interrupt().

◆ m_meta

bool HLSRingBuffer::m_meta
private

Definition at line 111 of file httplivestreambuffer.h.

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

◆ m_error

bool HLSRingBuffer::m_error
private

◆ m_aesmsg

bool HLSRingBuffer::m_aesmsg
private

Definition at line 113 of file httplivestreambuffer.h.

Referenced by ParseKey().

◆ m_startup

int HLSRingBuffer::m_startup
private

Definition at line 114 of file httplivestreambuffer.h.

Referenced by OpenFile(), and SeekInternal().

◆ m_bitrate

int64_t HLSRingBuffer::m_bitrate
private

assumed bitrate of playback used for the purpose of calculating length and seek position.

the value itself is irrelevant, as it's only used as a common reference

Definition at line 120 of file httplivestreambuffer.h.

Referenced by OpenFile(), SeekInternal(), and SizeMedia().

◆ m_seektoend

bool HLSRingBuffer::m_seektoend
private

FFmpeg seek to the end of the stream in order to determine the length of the video.

Set to boolean to true after we detected a seek to the end this will prevent waiting for new data in safe_read

Definition at line 126 of file httplivestreambuffer.h.

Referenced by SeekInternal(), and WaitUntilBuffered().

◆ m_streamworker

StreamWorker* HLSRingBuffer::m_streamworker
private

◆ m_playlistworker

PlaylistWorker* HLSRingBuffer::m_playlistworker
private

Definition at line 131 of file httplivestreambuffer.h.

Referenced by OpenFile(), and ~HLSRingBuffer().

◆ m_fd

FILE* HLSRingBuffer::m_fd
private

Definition at line 132 of file httplivestreambuffer.h.

Referenced by safe_read(), and ~HLSRingBuffer().

◆ m_interrupted

bool HLSRingBuffer::m_interrupted
private

◆ m_killed

bool HLSRingBuffer::m_killed
private

Definition at line 134 of file httplivestreambuffer.h.

Referenced by ParseM3U8(), Prefetch(), and ~HLSRingBuffer().


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