Logo Search packages:      
Sourcecode: qt-gstreamer version File versions  Download package

Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends

QGst::Utils::ApplicationSource Class Reference

Helper class for using a GstAppSrc. More...

#include <QGst/Utils/ApplicationSource>

List of all members.

Public Member Functions

GstAppSrc * appSrc ()
bool blockEnabled () const
CapsPtr caps () const
ElementPtr element () const
void enableBlock (bool enable)
FlowReturn endOfStream ()
Format format () const
bool isLive () const
void lazyConstruct (ApplicationSource *self)
quint64 maxBytes () const
quint64 maxLatency () const
quint64 minLatency () const
uint minPercent () const
FlowReturn pushBuffer (const BufferPtr &buffer)
void setCallbacks (ApplicationSource *self)
void setCaps (const CapsPtr &caps)
void setElement (const ElementPtr &appsrc)
void setFormat (Format f)
void setLatency (quint64 min, quint64 max)
void setLive (bool islive)
void setMaxBytes (quint64 max)
void setMinPercent (uint min)
void setSize (qint64 size)
void setStreamType (AppStreamType type)
qint64 size () const
AppStreamType streamType () const

Public Attributes

ElementPtr m_appsrc

Protected Member Functions

virtual void enoughData ()
virtual void needData (uint length)
virtual bool seekData (quint64 offset)

Private Member Functions

virtual void reservedVirtual1 ()
virtual void reservedVirtual2 ()
virtual void reservedVirtual3 ()
virtual void reservedVirtual4 ()

Static Private Member Functions

static void enough_data (GstAppSrc *src, gpointer user_data)
static void enough_data_noop (GstAppSrc *, gpointer)
static void need_data (GstAppSrc *src, guint length, gpointer user_data)
static void need_data_noop (GstAppSrc *, guint, gpointer)
static gboolean seek_data (GstAppSrc *src, guint64 offset, gpointer user_data)
static gboolean seek_data_noop (GstAppSrc *, guint64, gpointer)

Private Attributes

Priv *const d


struct Priv

Detailed Description

Helper class for using a GstAppSrc.

Appsrc is an element that can be used by applications to insert data into a GStreamer pipeline. Unlike most GStreamer elements, appsrc provides external API functions. This class exports those API functions in the bindings and makes it easy to implement a custom source.

Before operating appsrc, the caps() must be set to a fixed caps describing the format of the data that will be pushed with appsrc. An exception to this is when pushing buffers with unknown caps, in which case no caps should be set. This is typically true of file-like sources that push raw byte buffers.

The main way of handing data to the appsrc element is by calling the pushBuffer() method. This will put the buffer onto a queue from which appsrc will read from in its streaming thread. It is important to note that data transport will not happen from the thread that performed the pushBuffer() call.

maxBytes() controls how much data can be queued in appsrc before appsrc considers the queue full. A filled internal queue will always cause enoughData() to be called, which signals the application that it should stop pushing data into appsrc. Use setBlock() to cause appsrc to block the pushBuffer() method until free data becomes available again.

When the internal queue is running out of data, the needData() function is called, which signals the application that it should start pushing more data into appsrc.

In addition to the needData() and enoughData() functions, appsrc can also call the seekData() function when streamMode() is set to AppStreamTypeSeekable or AppStreamTypeRandomAccess. The seekData() argument will contain the new desired position in the stream expressed in the unit set with setFormat(). After seekData() has been called, the application should push buffers from the new position.

Appsrc can operate in two different ways:

In all modes, the size() should contain the total stream size in bytes. Setting the size is mandatory in the AppStreamTypeRandomAccess mode. For the AppStreamTypeStream and AppStreamTypeSeekable modes, setting the size is optional but recommended.

When the application is finished pushing data into appsrc, it should call endOfStream(). After this call, no more buffers can be pushed into appsrc until a flushing seek happened or the state of the appsrc has gone through READY.

The actuall appsrc element can be retrieved with element() and set with setElement(). It is not necessary to set an appsrc, as this class will create one as soon as it is needed.

It is not necessary to use this class in order to use GstAppSrc. GstAppSrc also provides signals and properties that fully substitute the functionality of this class.
See also:

Definition at line 23 of file applicationsource.cpp.

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

Generated by  Doxygen 1.6.0   Back to index