icecast_internalThread Class Reference

A thread that downloads and processes an Icecast stream list. More...

#include <icecast_internalthread.h>

List of all members.

Public Types

typedef QList
< streamDirectoryEntry_stream * > 
streamEntryList

Signals

void streamlist_ready (icecast_internalThread::streamEntryList list)

Public Member Functions

 icecast_internalThread ()
virtual ~icecast_internalThread ()
void setFilename (QString newFilename)

Protected Member Functions

virtual void run ()

Private Member Functions

void readStreamEntry (QXmlStreamReader &reader)

Private Attributes

QString filename
QMutex filename_mutex
streamEntryList streamList


Detailed Description

A thread that downloads and processes an Icecast stream list.

This class provides processing of the "yellow page" file from icecast.org which provides a list of all available Icecast streams.

For each stream it creates a streamDirectoryEntry_stream objects on the heap. After finishing, it emits the signal streamlist_ready with a list of pointers to these objects. It is up to you to make sure that these objects on the head will get deleted!

You have to setFilename() before calling start(); otherwise you will just get an emtpy data structure.

Definition at line 42 of file icecast_internalthread.h.


Member Typedef Documentation

Defines a type for a list of pointers to streamDirectoryEntry_stream objects. This type is declared as meta type through Q_DECLARE_METATYPE.

Note:
Additionally, you have to register this data type to Qt's meta object system by calling qRegisterMetaType<icecast_internalThread::streamEntryList>(); before you can use it in queued signal-slot-connections.

Definition at line 53 of file icecast_internalthread.h.


Constructor & Destructor Documentation

icecast_internalThread::icecast_internalThread (  ) 

The constructor.

Definition at line 26 of file icecast_internalthread.cpp.

icecast_internalThread::~icecast_internalThread (  )  [virtual]

The destructor.

Note:
Different from QThread, it is save to execute the desctructor on any time, also when the thread is running. However, this may take some seconds...

Definition at line 30 of file icecast_internalthread.cpp.


Member Function Documentation

void icecast_internalThread::readStreamEntry ( QXmlStreamReader &  reader  )  [private]

Helper function that expects that the actual tocken is <entry>. It reads the entry, constructs the corresponding object on the heap and adds a pointer to it at streamList.

Parameters:
reader A reference to the QXmlStreamReader object that you're using for processing.

Definition at line 59 of file icecast_internalthread.cpp.

References streamDirectoryEntry_stream::aac, streamDirectoryEntry_stream::aac_plus, streamDirectoryEntry_stream::bitrate, streamDirectoryEntry_stream::currentlyPlaying, streamDirectoryEntry_stream::mp3, streamDirectoryEntry_stream::nsv, streamDirectoryEntry_stream::ogg, streamDirectoryEntry::setName(), streamDirectoryEntry::setValue(), streamList, streamDirectoryEntry_stream::streamType, and streamDirectoryEntry_stream::unknown.

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

void icecast_internalThread::run (  )  [protected, virtual]

Internal implementation of the thread.

Definition at line 35 of file icecast_internalthread.cpp.

References filename, filename_mutex, readStreamEntry(), streamList, and streamlist_ready().

Here is the call graph for this function:

void icecast_internalThread::setFilename ( QString  newFilename  ) 

Sets the filename.

Parameters:
newFilename The path to the file which contains the list.

Definition at line 103 of file icecast_internalthread.cpp.

References filename, and filename_mutex.

Referenced by icecast::process_file().

Here is the caller graph for this function:

void icecast_internalThread::streamlist_ready ( icecast_internalThread::streamEntryList  list  )  [signal]

This signal is emitted after the thread has prepared the data structure.

Note:
This signal is emitted from within the thread. So, when you connect it, this will be a connection between thread, which is a queued connection. Because of this, you have to register the data type icecast_internalThread::streamEntryList to Qt's meta type system before the connection. See the respective documentation of the data type for details.
Parameters:
list A list with pointers the the objects on the heap. It is up to you to make sure that these objects on the head will get deleted!

Referenced by run().

Here is the caller graph for this function:


Member Data Documentation

The file name of the list. This must be accessible from within the thread and from without the thread and therefor is locked with filename_mutex.

Definition at line 82 of file icecast_internalthread.h.

Referenced by run(), and setFilename().

The mutex for filename.

Definition at line 84 of file icecast_internalthread.h.

Referenced by run(), and setFilename().

Internal list of pointers to the objects on the heap.

Definition at line 92 of file icecast_internalthread.h.

Referenced by readStreamEntry(), and run().


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

doxygen