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 &, EMode mode=kPreferCache, const QByteArray &cert=QByteArray())
 Network streaming request. More...
 
virtual ~NetStream ()
 
bool IsOpen () const
 
void Abort ()
 
int safe_read (void *data, unsigned sz, unsigned millisecs=0)
 
qlonglong Seek (qlonglong)
 
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 &)
 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, QNetworkReply *)
 
void slotFinished ()
 
void slotSslErrors (const QList< QSslError > &errors)
 
void slotReadyRead ()
 

Private Member Functions

bool Request (const QUrl &)
 

Private Attributes

const int m_id
 
const QUrl m_url
 
QMutex m_mutex
 
QNetworkRequest m_request
 
enum NetStream:: { ... }  m_state
 
NetStreamRequestm_pending
 
QNetworkReply * m_reply
 
int m_nRedirections
 
qlonglong m_size
 
qlonglong m_pos
 
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,
const QByteArray &  cert = QByteArray() 
)

Network streaming request.

Definition at line 95 of file netstream.cpp.

◆ ~NetStream()

NetStream::~NetStream ( )
virtual

Definition at line 126 of file netstream.cpp.

Member Function Documentation

◆ IsSupported()

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

RingBuffer interface.

Definition at line 509 of file netstream.cpp.

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

◆ IsOpen()

bool NetStream::IsOpen ( void  ) const

Definition at line 517 of file netstream.cpp.

Referenced by ICRingBuffer::IsOpen().

◆ Abort()

void NetStream::Abort ( )

Definition at line 523 of file netstream.cpp.

Referenced by ~NetStream().

◆ safe_read()

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

Definition at line 548 of file netstream.cpp.

Referenced by ICRingBuffer::safe_read().

◆ Seek()

qlonglong NetStream::Seek ( qlonglong  pos)

Definition at line 580 of file netstream.cpp.

Referenced by ICRingBuffer::SeekInternal().

◆ GetReadPosition()

qlonglong NetStream::GetReadPosition ( void  ) const

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

◆ WaitTillFinished()

bool NetStream::WaitTillFinished ( unsigned long  milliseconds)

Definition at line 636 of file netstream.cpp.

Referenced by MHInteractionChannel::GetFile().

◆ GetError()

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

Definition at line 653 of file netstream.cpp.

Referenced by MHInteractionChannel::GetFile().

◆ GetErrorString()

QString NetStream::GetErrorString ( ) const

Definition at line 659 of file netstream.cpp.

◆ BytesAvailable()

qlonglong NetStream::BytesAvailable ( ) const

Definition at line 665 of file netstream.cpp.

◆ ReadAll()

QByteArray NetStream::ReadAll ( void  )

Definition at line 671 of file netstream.cpp.

Referenced by MHInteractionChannel::GetFile().

◆ isStarted()

bool NetStream::isStarted ( ) const

Asynchronous interface.

Definition at line 686 of file netstream.cpp.

◆ isReady()

bool NetStream::isReady ( ) const

Definition at line 692 of file netstream.cpp.

◆ isFinished()

bool NetStream::isFinished ( void  ) const

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

Referenced by isCached().

◆ isAvailable()

bool NetStream::isAvailable ( )
static

Public helpers.

Definition at line 708 of file netstream.cpp.

Referenced by MHInteractionChannel::status().

◆ slotRequestStarted

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

Definition at line 273 of file netstream.cpp.

Referenced by NetStream().

◆ slotFinished

void NetStream::slotFinished ( )
privateslot

Definition at line 406 of file netstream.cpp.

Referenced by slotRequestStarted().

◆ slotSslErrors

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

Definition at line 469 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 161 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().

◆ m_state

enum { ... } NetStream::m_state

◆ m_pending

NetStreamRequest* NetStream::m_pending
private

Definition at line 99 of file netstream.h.

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

◆ m_reply

QNetworkReply* NetStream::m_reply
private

◆ m_nRedirections

int NetStream::m_nRedirections
private

Definition at line 101 of file netstream.h.

Referenced by slotFinished().

◆ m_size

qlonglong NetStream::m_size
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
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: