MythTV  master
Public Types | Signals | Public Member Functions | Static Public Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes | List of all members
NetStream Class Reference

Stream content from a URI. More...

#include <netstream.h>

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

Public Types

enum  EMode { kNeverCache, kPreferCache, kAlwaysCache }
 

Signals

void ReadyRead (QObject *)
 
void Finished (QObject *)
 

Public Member Functions

 NetStream (const QUrl &url, EMode mode=kPreferCache, QByteArray cert=QByteArray())
 Network streaming request. More...
 
 ~NetStream () override
 
bool IsOpen () const
 
void Abort ()
 
int safe_read (void *data, unsigned sz, unsigned millisecs=0)
 
qlonglong Seek (qlonglong pos)
 
qlonglong GetReadPosition () const
 
qlonglong GetSize () const
 
const QUrl & Url () const
 
bool WaitTillReady (unsigned long milliseconds)
 Synchronous interface. More...
 
bool WaitTillFinished (unsigned long milliseconds)
 
QNetworkReply::NetworkError GetError () const
 
QString GetErrorString () const
 
qlonglong BytesAvailable () const
 
QByteArray ReadAll ()
 
bool isStarted () const
 Asynchronous interface. More...
 
bool isReady () const
 
bool isFinished () const
 

Static Public Member Functions

static bool IsSupported (const QUrl &url)
 RingBuffer interface. More...
 
static QDateTime GetLastModified (const QUrl &url)
 
static bool isAvailable ()
 Public helpers. More...
 

Private Types

enum  {
  kClosed, kPending, kStarted, kReady,
  kFinished
}
 

Private Slots

void slotRequestStarted (int id, QNetworkReply *reply)
 
void slotFinished ()
 
void slotSslErrors (const QList< QSslError > &errors)
 
void slotReadyRead ()
 

Private Member Functions

bool Request (const QUrl &url)
 

Private Attributes

const int m_id
 
const QUrl m_url
 
QMutex m_mutex
 
QNetworkRequest m_request
 
enum NetStream:: { ... }  kClosed
 
NetStreamRequestm_pending {nullptr}
 
QNetworkReply * m_reply {nullptr}
 
int m_nRedirections {0}
 
qlonglong m_size {-1}
 
qlonglong m_pos {0}
 
QByteArray m_cert
 
QWaitCondition m_ready
 
QWaitCondition m_finished
 

Detailed Description

Stream content from a URI.

Definition at line 30 of file netstream.h.

Member Enumeration Documentation

◆ EMode

Enumerator
kNeverCache 
kPreferCache 
kAlwaysCache 

Definition at line 35 of file netstream.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kClosed 
kPending 
kStarted 
kReady 
kFinished 

Definition at line 98 of file netstream.h.

Constructor & Destructor Documentation

◆ NetStream()

NetStream::NetStream ( const QUrl &  url,
EMode  mode = kPreferCache,
QByteArray  cert = QByteArray() 
)
explicit

Network streaming request.

Definition at line 97 of file netstream.cpp.

◆ ~NetStream()

NetStream::~NetStream ( )
override

Definition at line 122 of file netstream.cpp.

Member Function Documentation

◆ IsSupported()

bool NetStream::IsSupported ( const QUrl &  url)
static

RingBuffer interface.

Definition at line 515 of file netstream.cpp.

Referenced by ICRingBuffer::OpenFile(), and Request().

◆ IsOpen()

bool NetStream::IsOpen ( void  ) const

Definition at line 523 of file netstream.cpp.

Referenced by ICRingBuffer::IsOpen().

◆ Abort()

void NetStream::Abort ( )

Definition at line 529 of file netstream.cpp.

Referenced by ~NetStream().

◆ safe_read()

int NetStream::safe_read ( void *  data,
unsigned  sz,
unsigned  millisecs = 0 
)

Definition at line 554 of file netstream.cpp.

Referenced by ICRingBuffer::safe_read().

◆ Seek()

qlonglong NetStream::Seek ( qlonglong  pos)

Definition at line 586 of file netstream.cpp.

Referenced by ICRingBuffer::SeekInternal().

◆ GetReadPosition()

qlonglong NetStream::GetReadPosition ( void  ) const

Definition at line 607 of file netstream.cpp.

Referenced by ICRingBuffer::GetReadPosition(), and ICRingBuffer::SeekInternal().

◆ GetSize()

qlonglong NetStream::GetSize ( void  ) const

◆ Url()

const QUrl& NetStream::Url ( void  ) const
inline

Definition at line 51 of file netstream.h.

◆ WaitTillReady()

bool NetStream::WaitTillReady ( unsigned long  milliseconds)

Synchronous interface.

Definition at line 625 of file netstream.cpp.

◆ WaitTillFinished()

bool NetStream::WaitTillFinished ( unsigned long  milliseconds)

Definition at line 642 of file netstream.cpp.

Referenced by MHInteractionChannel::GetFile().

◆ GetError()

QNetworkReply::NetworkError NetStream::GetError ( void  ) const

Definition at line 659 of file netstream.cpp.

Referenced by MHInteractionChannel::GetFile().

◆ GetErrorString()

QString NetStream::GetErrorString ( ) const

Definition at line 665 of file netstream.cpp.

◆ BytesAvailable()

qlonglong NetStream::BytesAvailable ( ) const

Definition at line 671 of file netstream.cpp.

◆ ReadAll()

QByteArray NetStream::ReadAll ( void  )

Definition at line 677 of file netstream.cpp.

Referenced by MHInteractionChannel::GetFile().

◆ isStarted()

bool NetStream::isStarted ( ) const

Asynchronous interface.

Definition at line 692 of file netstream.cpp.

◆ isReady()

bool NetStream::isReady ( ) const

Definition at line 698 of file netstream.cpp.

◆ isFinished()

bool NetStream::isFinished ( void  ) const

Definition at line 704 of file netstream.cpp.

◆ ReadyRead

void NetStream::ReadyRead ( QObject *  )
signal

Referenced by slotReadyRead().

◆ Finished

void NetStream::Finished ( QObject *  )
signal

Referenced by slotFinished().

◆ GetLastModified()

QDateTime NetStream::GetLastModified ( const QUrl &  url)
static

Definition at line 721 of file netstream.cpp.

Referenced by isCached().

◆ isAvailable()

bool NetStream::isAvailable ( )
static

Public helpers.

Definition at line 714 of file netstream.cpp.

Referenced by MHInteractionChannel::status().

◆ slotRequestStarted

void NetStream::slotRequestStarted ( int  id,
QNetworkReply *  reply 
)
privateslot

Definition at line 277 of file netstream.cpp.

Referenced by NetStream().

◆ slotFinished

void NetStream::slotFinished ( )
privateslot

Definition at line 412 of file netstream.cpp.

Referenced by slotRequestStarted().

◆ slotSslErrors

void NetStream::slotSslErrors ( const QList< QSslError > &  errors)
privateslot

Definition at line 475 of file netstream.cpp.

Referenced by slotRequestStarted().

◆ slotReadyRead

void NetStream::slotReadyRead ( )
privateslot

Definition at line 362 of file netstream.cpp.

Referenced by slotRequestStarted().

◆ Request()

bool NetStream::Request ( const QUrl &  url)
private

Definition at line 157 of file netstream.cpp.

Referenced by NetStream(), Seek(), and slotFinished().

Member Data Documentation

◆ m_id

const int NetStream::m_id
private

◆ m_url

const QUrl NetStream::m_url
private

Definition at line 94 of file netstream.h.

Referenced by Url().

◆ m_mutex

QMutex NetStream::m_mutex
mutableprivate

◆ m_request

QNetworkRequest NetStream::m_request
private

Definition at line 97 of file netstream.h.

Referenced by NetStream(), Request(), Seek(), and slotFinished().

◆ kClosed

enum { ... } NetStream::kClosed

Referenced by IsOpen().

◆ m_pending

NetStreamRequest* NetStream::m_pending {nullptr}
private

Definition at line 99 of file netstream.h.

Referenced by Abort(), Request(), and slotRequestStarted().

◆ m_reply

QNetworkReply* NetStream::m_reply {nullptr}
private

◆ m_nRedirections

int NetStream::m_nRedirections {0}
private

Definition at line 101 of file netstream.h.

Referenced by slotFinished().

◆ m_size

qlonglong NetStream::m_size {-1}
private

Definition at line 102 of file netstream.h.

Referenced by GetSize(), Request(), safe_read(), Seek(), slotFinished(), and slotReadyRead().

◆ m_pos

qlonglong NetStream::m_pos {0}
private

Definition at line 103 of file netstream.h.

Referenced by GetReadPosition(), ReadAll(), Request(), safe_read(), Seek(), and slotFinished().

◆ m_cert

QByteArray NetStream::m_cert
private

Definition at line 104 of file netstream.h.

Referenced by Request().

◆ m_ready

QWaitCondition NetStream::m_ready
private

Definition at line 105 of file netstream.h.

Referenced by safe_read(), slotReadyRead(), and WaitTillReady().

◆ m_finished

QWaitCondition NetStream::m_finished
private

Definition at line 106 of file netstream.h.

Referenced by slotFinished(), and WaitTillFinished().


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