#include <icecast_internalthread.h>
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 |
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.
typedef QList<streamDirectoryEntry_stream *> icecast_internalThread::streamEntryList |
Defines a type for a list of pointers to streamDirectoryEntry_stream objects. This type is declared as meta type through Q_DECLARE_METATYPE.
qRegisterMetaType<icecast_internalThread::streamEntryList>();
before you can use it in queued signal-slot-connections. Definition at line 53 of file icecast_internalthread.h.
icecast_internalThread::icecast_internalThread | ( | ) |
The constructor.
Definition at line 26 of file icecast_internalthread.cpp.
icecast_internalThread::~icecast_internalThread | ( | ) | [virtual] |
The destructor.
Definition at line 30 of file icecast_internalthread.cpp.
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.
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().
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().
void icecast_internalThread::setFilename | ( | QString | newFilename | ) |
Sets the filename.
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().
void icecast_internalThread::streamlist_ready | ( | icecast_internalThread::streamEntryList | list | ) | [signal] |
This signal is emitted after the thread has prepared the data structure.
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().
QString icecast_internalThread::filename [private] |
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().
QMutex icecast_internalThread::filename_mutex [private] |
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().