QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | List of all members
QGst::Bus Class Reference

#include <QGst/Bus>

Inheritance diagram for QGst::Bus:
Inheritance graph
[legend]
Collaboration diagram for QGst::Bus:
Collaboration graph
[legend]

Public Member Functions

bool post (const MessagePtr &message)
 
bool hasPendingMessages () const
 
MessagePtr peek () const
 
MessagePtr pop (ClockTime timeout=0)
 
MessagePtr pop (MessageType type, ClockTime timeout=0)
 
void setFlushing (bool flush)
 
void addSignalWatch ()
 
void removeSignalWatch ()
 
void enableSyncMessageEmission ()
 
void disableSyncMessageEmission ()
 
- Public Member Functions inherited from QGst::Object
QString name () const
 
bool setName (const char *name)
 
ObjectPtr parent () const
 
bool setParent (const ObjectPtr &parent)
 
void unparent ()
 
bool isAncestorOf (const ObjectPtr &object) const
 
QString pathString () const
 
- Public Member Functions inherited from QGlib::ObjectBase
ParamSpecPtr findProperty (const char *name) const
 
QList< ParamSpecPtrlistProperties () const
 
Value property (const char *name) const
 
template<class T >
void setProperty (const char *name, const T &value)
 
void setProperty (const char *name, const Value &value)
 
void * data (const char *key) const
 
void * stealData (const char *key) const
 
void setData (const char *key, void *data, void(*destroyCallback)(void *)=NULL)
 
void * quarkData (const Quark &quark) const
 
void * stealQuarkData (const Quark &quark) const
 
void setQuarkData (const Quark &quark, void *data, void(*destroyCallback)(void *)=NULL)
 

Static Public Member Functions

static BusPtr create ()
 

Additional Inherited Members

- Protected Member Functions inherited from QGst::Object
virtual void ref (bool increaseRef)
 
virtual void unref ()
 
- Protected Member Functions inherited from QGlib::RefCountedObject
template<class T >
T * object () const
 
- Protected Attributes inherited from QGlib::RefCountedObject
void * m_object
 

Detailed Description

Wrapper class for GstBus.

The Bus is an object responsible for delivering Message packets in a first-in first-out way from the streaming threads to the application.

Since the application typically only wants to deal with delivery of these messages from one thread, the Bus will marshall the messages between different threads. This is important since the actual streaming of media is done in another thread than the application.

There are three ways to get messages from a Bus:

Note
In this library, the bus watch is implemented using Qt's mechanisms and is not a wrapper for the GStreamer bus watch mechanism. This allows you to use a watch even if you are not running a Glib event loop. However, this requires a running Qt event loop.

Definition at line 51 of file bus.h.

Member Function Documentation

BusPtr QGst::Bus::create ( )
static

Creates a new Bus

Definition at line 113 of file bus.cpp.

bool QGst::Bus::post ( const MessagePtr message)

Posts a message to the Bus

Definition at line 143 of file bus.cpp.

bool QGst::Bus::hasPendingMessages ( ) const
Returns
whether there are pending messages in the bus' queue

Definition at line 122 of file bus.cpp.

MessagePtr QGst::Bus::peek ( ) const

Retrieves the first message from the bus' queue, but does not remove it.

Definition at line 127 of file bus.cpp.

MessagePtr QGst::Bus::pop ( ClockTime  timeout = 0)

Retrieves the first message from the bus' queue and removes it. If a timeout is specified, this function will wait for up to timeout nanoseconds for a message to get posted to the Bus and will return as soon as there is a new message or the timeout has expired.

Definition at line 132 of file bus.cpp.

MessagePtr QGst::Bus::pop ( MessageType  type,
ClockTime  timeout = 0 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This version of pop() will return only messages that match the specified message type. All other messages that have been posted before the returned message will be discarded. You may use an OR combination of MessageTypes as the type to filter multiple types.

Definition at line 137 of file bus.cpp.

void QGst::Bus::setFlushing ( bool  flush)

If flushing is enabled, the bus will discard any messages that are currently on the bus and any messages that will be posted in the future.

Definition at line 148 of file bus.cpp.

void QGst::Bus::addSignalWatch ( )

This adds a signal "watch" object, an object that will poll the bus from the event loop of the thread that called this function first. In every event loop execution, any pending messages will be popped from the bus and the "message" signal of the bus will be emitted.

The caller is responsible to cleanup by calling the removeSignalWatch() function when this functionality is no longer needed. When the bus is destroyed, the watch is removed automatically.

If this function is called multiple times, a reference count will be incremented on the same watch. You cannot have multiple watches on the same bus.

Note
  • This functionality requires a running Qt event loop.
  • This is not a wrapper for the gst_bus_add_signal_watch() function. It uses a different implementation based on Qt's event loop instead of the Glib one, so that it is possible to use it even if you are not using a Glib event loop underneath.

Definition at line 153 of file bus.cpp.

void QGst::Bus::removeSignalWatch ( )

Removes a signal "watch" object that was previously added with addSignalWatch(). If addSignalWatch() has been called multiple times, this function will decrement the watch'es reference count and will remove it only when the reference count reaches zero.

Definition at line 158 of file bus.cpp.

void QGst::Bus::enableSyncMessageEmission ( )

Enables the emission of the "sync-message" signal. This signal will be emitted synchronously from inside post() whenever a new message is posted. Be aware that messages are typically posted from a different thread.

This function may be called multiple times. To clean up, the caller is responsible for calling disableSyncMessageEmission() as many times as this function is called.

Definition at line 163 of file bus.cpp.

void QGst::Bus::disableSyncMessageEmission ( )

Disables the emission of the "sync-message" signal on the bus. If enableSyncMessageEmission() has been called multiple times, this function will decrement a reference count instead of disabling the emission, so it has to be called exactly as many times as enableSyncMessageEmission() has been called.

Definition at line 168 of file bus.cpp.


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