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 (std::chrono::milliseconds timeout)
 Synchronous interface. More...
 
bool WaitTillFinished (std::chrono::milliseconds timeout)
 
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 31 of file netstream.h.

Member Enumeration Documentation

◆ EMode

Enumerator
kNeverCache 
kPreferCache 
kAlwaysCache 

Definition at line 36 of file netstream.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kClosed 
kPending 
kStarted 
kReady 
kFinished 

Definition at line 99 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 94 of file netstream.cpp.

◆ ~NetStream()

NetStream::~NetStream ( )
override

Definition at line 119 of file netstream.cpp.

Member Function Documentation

◆ IsSupported()

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

RingBuffer interface.

Definition at line 517 of file netstream.cpp.

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

◆ IsOpen()

bool NetStream::IsOpen ( ) const

Definition at line 525 of file netstream.cpp.

Referenced by MythInteractiveBuffer::IsOpen().

◆ Abort()

void NetStream::Abort ( )

Definition at line 531 of file netstream.cpp.

Referenced by ~NetStream().

◆ safe_read()

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

Definition at line 556 of file netstream.cpp.

Referenced by MythInteractiveBuffer::SafeRead().

◆ Seek()

qlonglong NetStream::Seek ( qlonglong  pos)

Definition at line 588 of file netstream.cpp.

Referenced by MythInteractiveBuffer::SeekInternal().

◆ GetReadPosition()

qlonglong NetStream::GetReadPosition ( ) const

◆ GetSize()

qlonglong NetStream::GetSize ( ) const

◆ Url()

const QUrl& NetStream::Url ( ) const
inline

Definition at line 52 of file netstream.h.

◆ WaitTillReady()

bool NetStream::WaitTillReady ( std::chrono::milliseconds  timeout)

Synchronous interface.

Definition at line 627 of file netstream.cpp.

◆ WaitTillFinished()

bool NetStream::WaitTillFinished ( std::chrono::milliseconds  timeout)

Definition at line 644 of file netstream.cpp.

Referenced by MHInteractionChannel::GetFile().

◆ GetError()

QNetworkReply::NetworkError NetStream::GetError ( ) const

Definition at line 661 of file netstream.cpp.

Referenced by MHInteractionChannel::GetFile().

◆ GetErrorString()

QString NetStream::GetErrorString ( ) const

Definition at line 667 of file netstream.cpp.

◆ BytesAvailable()

qlonglong NetStream::BytesAvailable ( ) const

Definition at line 673 of file netstream.cpp.

◆ ReadAll()

QByteArray NetStream::ReadAll ( )

Definition at line 679 of file netstream.cpp.

Referenced by MHInteractionChannel::GetFile().

◆ isStarted()

bool NetStream::isStarted ( ) const

Asynchronous interface.

Definition at line 694 of file netstream.cpp.

◆ isReady()

bool NetStream::isReady ( ) const

Definition at line 700 of file netstream.cpp.

◆ isFinished()

bool NetStream::isFinished ( ) const

Definition at line 706 of file netstream.cpp.

◆ ReadyRead

void NetStream::ReadyRead ( QObject *  )
signal

Referenced by slotReadyRead().

◆ Finished

void NetStream::Finished ( QObject *  )
signal

◆ GetLastModified()

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

Definition at line 723 of file netstream.cpp.

Referenced by isCached().

◆ isAvailable()

bool NetStream::isAvailable ( )
static

Public helpers.

Definition at line 716 of file netstream.cpp.

Referenced by MHInteractionChannel::status().

◆ slotRequestStarted

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

Definition at line 274 of file netstream.cpp.

Referenced by NetStream().

◆ slotFinished

void NetStream::slotFinished ( )
privateslot

Definition at line 410 of file netstream.cpp.

Referenced by slotRequestStarted().

◆ slotSslErrors

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

Definition at line 477 of file netstream.cpp.

Referenced by slotRequestStarted().

◆ slotReadyRead

void NetStream::slotReadyRead ( )
privateslot

Definition at line 360 of file netstream.cpp.

Referenced by slotRequestStarted().

◆ Request()

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

Definition at line 154 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 95 of file netstream.h.

Referenced by Url().

◆ m_mutex

QMutex NetStream::m_mutex
mutableprivate

◆ m_request

QNetworkRequest NetStream::m_request
private

Definition at line 98 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 100 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 102 of file netstream.h.

Referenced by slotFinished().

◆ m_size

qlonglong NetStream::m_size {-1}
private

Definition at line 103 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 104 of file netstream.h.

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

◆ m_cert

QByteArray NetStream::m_cert
private

Definition at line 105 of file netstream.h.

Referenced by Request().

◆ m_ready

QWaitCondition NetStream::m_ready
private

Definition at line 106 of file netstream.h.

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

◆ m_finished

QWaitCondition NetStream::m_finished
private

Definition at line 107 of file netstream.h.

Referenced by slotFinished(), and WaitTillFinished().


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