Added initial gstreamer audio playback.

x86 might not work due to misconfiguration because I could not test it since acinerella is broken in x86 currenty. Gstreamer video support is yet to follow.
Please report back any bugs you experience. To compile you will need Visual C++, I hope all files are included
This commit is contained in:
Stephan Sundermann committed 2013-02-09 23:32:02 +01:00
1 parent 8a11b0eff0
commit e653ac87a2
1326 files changed
+154559 -4

No files matched your search

@@ -0,0 +1,127 @@
/* GStreamer
* Copyright (C) 2007 David Schleef <ds@schleef.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _GST_APP_SINK_H_
#define _GST_APP_SINK_H_
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
G_BEGIN_DECLS
#define GST_TYPE_APP_SINK \
(gst_app_sink_get_type())
#define GST_APP_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SINK,GstAppSink))
#define GST_APP_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SINK,GstAppSinkClass))
#define GST_IS_APP_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SINK))
#define GST_IS_APP_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SINK))
#define GST_APP_SINK_CAST(obj) \
((GstAppSink*)(obj))
typedef struct _GstAppSink GstAppSink;
typedef struct _GstAppSinkClass GstAppSinkClass;
typedef struct _GstAppSinkPrivate GstAppSinkPrivate;
/**
* GstAppSinkCallbacks: (skip)
* @eos: Called when the end-of-stream has been reached. This callback
* is called from the steaming thread.
* @new_preroll: Called when a new preroll sample is available.
* This callback is called from the steaming thread.
* The new preroll sample can be retrieved with
* gst_app_sink_pull_preroll() either from this callback
* or from any other thread.
* @new_sample: Called when a new sample is available.
* This callback is called from the steaming thread.
* The new sample can be retrieved with
* gst_app_sink_pull_sample() either from this callback
* or from any other thread.
*
* A set of callbacks that can be installed on the appsink with
* gst_app_sink_set_callbacks().
*/
typedef struct {
void (*eos) (GstAppSink *appsink, gpointer user_data);
GstFlowReturn (*new_preroll) (GstAppSink *appsink, gpointer user_data);
GstFlowReturn (*new_sample) (GstAppSink *appsink, gpointer user_data);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
} GstAppSinkCallbacks;
struct _GstAppSink
{
GstBaseSink basesink;
/*< private >*/
GstAppSinkPrivate *priv;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstAppSinkClass
{
GstBaseSinkClass basesink_class;
/* signals */
void (*eos) (GstAppSink *appsink);
GstFlowReturn (*new_preroll) (GstAppSink *appsink);
GstFlowReturn (*new_sample) (GstAppSink *appsink);
/* actions */
GstSample * (*pull_preroll) (GstAppSink *appsink);
GstSample * (*pull_sample) (GstAppSink *appsink);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_app_sink_get_type(void);
void gst_app_sink_set_caps (GstAppSink *appsink, const GstCaps *caps);
GstCaps * gst_app_sink_get_caps (GstAppSink *appsink);
gboolean gst_app_sink_is_eos (GstAppSink *appsink);
void gst_app_sink_set_emit_signals (GstAppSink *appsink, gboolean emit);
gboolean gst_app_sink_get_emit_signals (GstAppSink *appsink);
void gst_app_sink_set_max_buffers (GstAppSink *appsink, guint max);
guint gst_app_sink_get_max_buffers (GstAppSink *appsink);
void gst_app_sink_set_drop (GstAppSink *appsink, gboolean drop);
gboolean gst_app_sink_get_drop (GstAppSink *appsink);
GstSample * gst_app_sink_pull_preroll (GstAppSink *appsink);
GstSample * gst_app_sink_pull_sample (GstAppSink *appsink);
void gst_app_sink_set_callbacks (GstAppSink * appsink,
GstAppSinkCallbacks *callbacks,
gpointer user_data,
GDestroyNotify notify);
G_END_DECLS
#endif
@@ -0,0 +1,150 @@
/* GStreamer
* Copyright (C) 2007 David Schleef <ds@schleef.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _GST_APP_SRC_H_
#define _GST_APP_SRC_H_
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
G_BEGIN_DECLS
#define GST_TYPE_APP_SRC \
(gst_app_src_get_type())
#define GST_APP_SRC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SRC,GstAppSrc))
#define GST_APP_SRC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SRC,GstAppSrcClass))
#define GST_IS_APP_SRC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SRC))
#define GST_IS_APP_SRC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SRC))
#define GST_APP_SRC_CAST(obj) \
((GstAppSrc*)(obj))
typedef struct _GstAppSrc GstAppSrc;
typedef struct _GstAppSrcClass GstAppSrcClass;
typedef struct _GstAppSrcPrivate GstAppSrcPrivate;
/**
* GstAppSrcCallbacks: (skip)
* @need_data: Called when the appsrc needs more data. A buffer or EOS should be
* pushed to appsrc from this thread or another thread. @length is just a hint
* and when it is set to -1, any number of bytes can be pushed into @appsrc.
* @enough_data: Called when appsrc has enough data. It is recommended that the
* application stops calling push-buffer until the need_data callback is
* emitted again to avoid excessive buffer queueing.
* @seek_data: Called when a seek should be performed to the offset.
* The next push-buffer should produce buffers from the new @offset.
* This callback is only called for seekable stream types.
*
* A set of callbacks that can be installed on the appsrc with
* gst_app_src_set_callbacks().
*/
typedef struct {
void (*need_data) (GstAppSrc *src, guint length, gpointer user_data);
void (*enough_data) (GstAppSrc *src, gpointer user_data);
gboolean (*seek_data) (GstAppSrc *src, guint64 offset, gpointer user_data);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
} GstAppSrcCallbacks;
/**
* GstAppStreamType:
* @GST_APP_STREAM_TYPE_STREAM: No seeking is supported in the stream, such as a
* live stream.
* @GST_APP_STREAM_TYPE_SEEKABLE: The stream is seekable but seeking might not
* be very fast, such as data from a webserver.
* @GST_APP_STREAM_TYPE_RANDOM_ACCESS: The stream is seekable and seeking is fast,
* such as in a local file.
*
* The stream type.
*/
typedef enum
{
GST_APP_STREAM_TYPE_STREAM,
GST_APP_STREAM_TYPE_SEEKABLE,
GST_APP_STREAM_TYPE_RANDOM_ACCESS
} GstAppStreamType;
struct _GstAppSrc
{
GstBaseSrc basesrc;
/*< private >*/
GstAppSrcPrivate *priv;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstAppSrcClass
{
GstBaseSrcClass basesrc_class;
/* signals */
void (*need_data) (GstAppSrc *appsrc, guint length);
void (*enough_data) (GstAppSrc *appsrc);
gboolean (*seek_data) (GstAppSrc *appsrc, guint64 offset);
/* actions */
GstFlowReturn (*push_buffer) (GstAppSrc *appsrc, GstBuffer *buffer);
GstFlowReturn (*end_of_stream) (GstAppSrc *appsrc);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_app_src_get_type(void);
/* GType getter for GstAppStreamType */
#define GST_TYPE_APP_STREAM_TYPE (gst_app_stream_type_get_type ())
GType gst_app_stream_type_get_type (void);
void gst_app_src_set_caps (GstAppSrc *appsrc, const GstCaps *caps);
GstCaps* gst_app_src_get_caps (GstAppSrc *appsrc);
void gst_app_src_set_size (GstAppSrc *appsrc, gint64 size);
gint64 gst_app_src_get_size (GstAppSrc *appsrc);
void gst_app_src_set_stream_type (GstAppSrc *appsrc, GstAppStreamType type);
GstAppStreamType gst_app_src_get_stream_type (GstAppSrc *appsrc);
void gst_app_src_set_max_bytes (GstAppSrc *appsrc, guint64 max);
guint64 gst_app_src_get_max_bytes (GstAppSrc *appsrc);
void gst_app_src_set_latency (GstAppSrc *appsrc, guint64 min, guint64 max);
void gst_app_src_get_latency (GstAppSrc *appsrc, guint64 *min, guint64 *max);
void gst_app_src_set_emit_signals (GstAppSrc *appsrc, gboolean emit);
gboolean gst_app_src_get_emit_signals (GstAppSrc *appsrc);
GstFlowReturn gst_app_src_push_buffer (GstAppSrc *appsrc, GstBuffer *buffer);
GstFlowReturn gst_app_src_end_of_stream (GstAppSrc *appsrc);
void gst_app_src_set_callbacks (GstAppSrc * appsrc,
GstAppSrcCallbacks *callbacks,
gpointer user_data,
GDestroyNotify notify);
G_END_DECLS
#endif
@@ -0,0 +1,166 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Library <2001> Thomas Vander Stichele <thomas@apestaart.org>
* <2011> Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_CHANNELS_H__
#define __GST_AUDIO_CHANNELS_H__
#include <gst/gst.h>
#include <gst/audio/audio-format.h>
G_BEGIN_DECLS
/**
* GstAudioChannelPosition:
* @GST_AUDIO_CHANNEL_POSITION_MONO: Mono without direction;
* can only be used with 1 channel
* @GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT: Front left
* @GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT: Front right
* @GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER: Front center
* @GST_AUDIO_CHANNEL_POSITION_LFE1: Low-frequency effects 1 (subwoofer)
* @GST_AUDIO_CHANNEL_POSITION_REAR_LEFT: Rear left
* @GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT: Rear right
* @GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER: Front left of center
* @GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER: Front right of center
* @GST_AUDIO_CHANNEL_POSITION_REAR_CENTER: Rear center
* @GST_AUDIO_CHANNEL_POSITION_LFE2: Low-frequency effects 2 (subwoofer)
* @GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT: Side left
* @GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT: Side right
* @GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT: Top front left
* @GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT: Top front right
* @GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER: Top front center
* @GST_AUDIO_CHANNEL_POSITION_TOP_CENTER: Top center
* @GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT: Top rear left
* @GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT: Top rear right
* @GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT: Top side right
* @GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT: Top rear right
* @GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER: Top rear center
* @GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER: Bottom front center
* @GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT: Bottom front left
* @GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT: Bottom front right
* @GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT: Wide left (between front left and side left)
* @GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT: Wide right (between front right and side right)
* @GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT: Surround left (between rear left and side left)
* @GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT: Surround right (between rear right and side right)
* @GST_AUDIO_CHANNEL_POSITION_NONE: used for position-less channels, e.g.
* from a sound card that records 1024 channels; mutually exclusive with
* any other channel position
* @GST_AUDIO_CHANNEL_POSITION_INVALID: invalid position
*
* Audio channel positions.
*
* These are the channels defined in SMPTE 2036-2-2008
* Table 1 for 22.2 audio systems with the Surround and Wide channels from
* DTS Coherent Acoustics (v.1.3.1) and 10.2 and 7.1 layouts. In the caps the
* actual channel layout is expressed with a channel count and a channel mask,
* which describes the existing channels. The positions in the bit mask correspond
* to the enum values.
* For negotiation it is allowed to have more bits set in the channel mask than
* the number of channels to specify the allowed channel positions but this is
* not allowed in negotiated caps. It is not allowed in any situation other
* than the one mentioned below to have less bits set in the channel mask than
* the number of channels.
*
* @GST_AUDIO_CHANNEL_POSITION_MONO can only be used with a single mono channel that
* has no direction information and would be mixed into all directional channels.
* This is expressed in caps by having a single channel and no channel mask.
*
* @GST_AUDIO_CHANNEL_POSITION_NONE can only be used if all channels have this position.
* This is expressed in caps by having a channel mask with no bits set.
*
* As another special case it is allowed to have two channels without a channel mask.
* This implicitely means that this is a stereo stream with a front left and front right
* channel.
*/
typedef enum {
/* These get negative indices to allow to use
* the enum values of the normal cases for the
* bit-mask position */
GST_AUDIO_CHANNEL_POSITION_NONE = -3,
GST_AUDIO_CHANNEL_POSITION_MONO = -2,
GST_AUDIO_CHANNEL_POSITION_INVALID = -1,
/* Normal cases */
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT = 0,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_LFE1,
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
GST_AUDIO_CHANNEL_POSITION_LFE2,
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_TOP_CENTER,
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT,
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT,
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT,
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT,
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER,
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT,
GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT,
GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT,
GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT
} GstAudioChannelPosition;
#define GST_AUDIO_CHANNEL_POSITION_MASK(pos) (G_GUINT64_CONSTANT(1)<< GST_AUDIO_CHANNEL_POSITION_ ## pos)
gboolean gst_audio_buffer_reorder_channels (GstBuffer * buffer,
GstAudioFormat format,
gint channels,
const GstAudioChannelPosition * from,
const GstAudioChannelPosition * to);
gboolean gst_audio_reorder_channels (gpointer data, gsize size,
GstAudioFormat format,
gint channels,
const GstAudioChannelPosition * from,
const GstAudioChannelPosition * to);
gboolean gst_audio_channel_positions_to_valid_order (GstAudioChannelPosition *position,
gint channels);
gboolean gst_audio_check_valid_channel_positions (const GstAudioChannelPosition *position,
gint channels, gboolean force_order);
gboolean gst_audio_channel_positions_to_mask (const GstAudioChannelPosition *position,
gint channels, gboolean force_order,
guint64 *channel_mask);
gboolean gst_audio_channel_positions_from_mask (gint channels, guint64 channel_mask,
GstAudioChannelPosition * position);
gboolean gst_audio_get_channel_reorder_map (gint channels,
const GstAudioChannelPosition * from,
const GstAudioChannelPosition * to,
gint *reorder_map);
G_END_DECLS
#endif /* __GST_AUDIO_CHANNELS_H__ */
@@ -0,0 +1,39 @@
#ifndef __GST_AUDIO_ENUM_TYPES_H__
#define __GST_AUDIO_ENUM_TYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/* enumerations from "audio-format.h" */
GType gst_audio_format_get_type (void);
#define GST_TYPE_AUDIO_FORMAT (gst_audio_format_get_type())
GType gst_audio_format_flags_get_type (void);
#define GST_TYPE_AUDIO_FORMAT_FLAGS (gst_audio_format_flags_get_type())
GType gst_audio_pack_flags_get_type (void);
#define GST_TYPE_AUDIO_PACK_FLAGS (gst_audio_pack_flags_get_type())
/* enumerations from "audio-channels.h" */
GType gst_audio_channel_position_get_type (void);
#define GST_TYPE_AUDIO_CHANNEL_POSITION (gst_audio_channel_position_get_type())
/* enumerations from "audio-info.h" */
GType gst_audio_flags_get_type (void);
#define GST_TYPE_AUDIO_FLAGS (gst_audio_flags_get_type())
GType gst_audio_layout_get_type (void);
#define GST_TYPE_AUDIO_LAYOUT (gst_audio_layout_get_type())
/* enumerations from "gstaudioringbuffer.h" */
GType gst_audio_ring_buffer_state_get_type (void);
#define GST_TYPE_AUDIO_RING_BUFFER_STATE (gst_audio_ring_buffer_state_get_type())
GType gst_audio_ring_buffer_format_type_get_type (void);
#define GST_TYPE_AUDIO_RING_BUFFER_FORMAT_TYPE (gst_audio_ring_buffer_format_type_get_type())
G_END_DECLS
#endif /* __GST_AUDIO_ENUM_TYPES_H__ */
@@ -0,0 +1,330 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Library <2001> Thomas Vander Stichele <thomas@apestaart.org>
* <2011> Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
#ifndef __GST_AUDIO_FORMAT_H__
#define __GST_AUDIO_FORMAT_H__
G_BEGIN_DECLS
#include <gst/audio/audio-enumtypes.h>
#if G_BYTE_ORDER == G_BIG_ENDIAN
#define _GST_AUDIO_FORMAT_NE(fmt) GST_AUDIO_FORMAT_ ## fmt ## BE
#define _GST_AUDIO_FORMAT_OE(fmt) GST_AUDIO_FORMAT_ ## fmt ## LE
#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
#define _GST_AUDIO_FORMAT_NE(fmt) GST_AUDIO_FORMAT_ ## fmt ## LE
#define _GST_AUDIO_FORMAT_OE(fmt) GST_AUDIO_FORMAT_ ## fmt ## BE
#endif
/**
* GstAudioFormat:
* @GST_AUDIO_FORMAT_UNKNOWN: unknown or unset audio format
* @GST_AUDIO_FORMAT_ENCODED: encoded audio format
* @GST_AUDIO_FORMAT_S8: 8 bits in 8 bits, signed
* @GST_AUDIO_FORMAT_U8: 8 bits in 8 bits, unsigned
* @GST_AUDIO_FORMAT_S16LE: 16 bits in 16 bits, signed, little endian
* @GST_AUDIO_FORMAT_S16BE: 16 bits in 16 bits, signed, big endian
* @GST_AUDIO_FORMAT_U16LE: 16 bits in 16 bits, unsigned, little endian
* @GST_AUDIO_FORMAT_U16BE: 16 bits in 16 bits, unsigned, big endian
* @GST_AUDIO_FORMAT_S24_32LE: 24 bits in 32 bits, signed, little endian
* @GST_AUDIO_FORMAT_S24_32BE: 24 bits in 32 bits, signed, big endian
* @GST_AUDIO_FORMAT_U24_32LE: 24 bits in 32 bits, unsigned, little endian
* @GST_AUDIO_FORMAT_U24_32BE: 24 bits in 32 bits, unsigned, big endian
* @GST_AUDIO_FORMAT_S32LE: 32 bits in 32 bits, signed, little endian
* @GST_AUDIO_FORMAT_S32BE: 32 bits in 32 bits, signed, big endian
* @GST_AUDIO_FORMAT_U32LE: 32 bits in 32 bits, unsigned, little endian
* @GST_AUDIO_FORMAT_U32BE: 32 bits in 32 bits, unsigned, big endian
* @GST_AUDIO_FORMAT_S24LE: 24 bits in 24 bits, signed, little endian
* @GST_AUDIO_FORMAT_S24BE: 24 bits in 24 bits, signed, big endian
* @GST_AUDIO_FORMAT_U24LE: 24 bits in 24 bits, unsigned, little endian
* @GST_AUDIO_FORMAT_U24BE: 24 bits in 24 bits, unsigned, big endian
* @GST_AUDIO_FORMAT_S20LE: 20 bits in 24 bits, signed, little endian
* @GST_AUDIO_FORMAT_S20BE: 20 bits in 24 bits, signed, big endian
* @GST_AUDIO_FORMAT_U20LE: 20 bits in 24 bits, unsigned, little endian
* @GST_AUDIO_FORMAT_U20BE: 20 bits in 24 bits, unsigned, big endian
* @GST_AUDIO_FORMAT_S18LE: 18 bits in 24 bits, signed, little endian
* @GST_AUDIO_FORMAT_S18BE: 18 bits in 24 bits, signed, big endian
* @GST_AUDIO_FORMAT_U18LE: 18 bits in 24 bits, unsigned, little endian
* @GST_AUDIO_FORMAT_U18BE: 18 bits in 24 bits, unsigned, big endian
* @GST_AUDIO_FORMAT_F32LE: 32-bit floating point samples, little endian
* @GST_AUDIO_FORMAT_F32BE: 32-bit floating point samples, big endian
* @GST_AUDIO_FORMAT_F64LE: 64-bit floating point samples, little endian
* @GST_AUDIO_FORMAT_F64BE: 64-bit floating point samples, big endian
* @GST_AUDIO_FORMAT_S16: 16 bits in 16 bits, signed, native endianness
* @GST_AUDIO_FORMAT_U16: 16 bits in 16 bits, unsigned, native endianness
* @GST_AUDIO_FORMAT_S24_32: 24 bits in 32 bits, signed, native endianness
* @GST_AUDIO_FORMAT_U24_32: 24 bits in 32 bits, unsigned, native endianness
* @GST_AUDIO_FORMAT_S32: 32 bits in 32 bits, signed, native endianness
* @GST_AUDIO_FORMAT_U32: 32 bits in 32 bits, unsigned, native endianness
* @GST_AUDIO_FORMAT_S24: 24 bits in 24 bits, signed, native endianness
* @GST_AUDIO_FORMAT_U24: 24 bits in 24 bits, unsigned, native endianness
* @GST_AUDIO_FORMAT_S20: 20 bits in 24 bits, signed, native endianness
* @GST_AUDIO_FORMAT_U20: 20 bits in 24 bits, unsigned, native endianness
* @GST_AUDIO_FORMAT_S18: 18 bits in 24 bits, signed, native endianness
* @GST_AUDIO_FORMAT_U18: 18 bits in 24 bits, unsigned, native endianness
* @GST_AUDIO_FORMAT_F32: 32-bit floating point samples, native endianness
* @GST_AUDIO_FORMAT_F64: 64-bit floating point samples, native endianness
*
* Enum value describing the most common audio formats.
*/
typedef enum {
GST_AUDIO_FORMAT_UNKNOWN,
GST_AUDIO_FORMAT_ENCODED,
/* 8 bit */
GST_AUDIO_FORMAT_S8,
GST_AUDIO_FORMAT_U8,
/* 16 bit */
GST_AUDIO_FORMAT_S16LE,
GST_AUDIO_FORMAT_S16BE,
GST_AUDIO_FORMAT_U16LE,
GST_AUDIO_FORMAT_U16BE,
/* 24 bit in low 3 bytes of 32 bits*/
GST_AUDIO_FORMAT_S24_32LE,
GST_AUDIO_FORMAT_S24_32BE,
GST_AUDIO_FORMAT_U24_32LE,
GST_AUDIO_FORMAT_U24_32BE,
/* 32 bit */
GST_AUDIO_FORMAT_S32LE,
GST_AUDIO_FORMAT_S32BE,
GST_AUDIO_FORMAT_U32LE,
GST_AUDIO_FORMAT_U32BE,
/* 24 bit in 3 bytes*/
GST_AUDIO_FORMAT_S24LE,
GST_AUDIO_FORMAT_S24BE,
GST_AUDIO_FORMAT_U24LE,
GST_AUDIO_FORMAT_U24BE,
/* 20 bit in 3 bytes*/
GST_AUDIO_FORMAT_S20LE,
GST_AUDIO_FORMAT_S20BE,
GST_AUDIO_FORMAT_U20LE,
GST_AUDIO_FORMAT_U20BE,
/* 18 bit in 3 bytes*/
GST_AUDIO_FORMAT_S18LE,
GST_AUDIO_FORMAT_S18BE,
GST_AUDIO_FORMAT_U18LE,
GST_AUDIO_FORMAT_U18BE,
/* float */
GST_AUDIO_FORMAT_F32LE,
GST_AUDIO_FORMAT_F32BE,
GST_AUDIO_FORMAT_F64LE,
GST_AUDIO_FORMAT_F64BE,
/* native endianness equivalents */
GST_AUDIO_FORMAT_S16 = _GST_AUDIO_FORMAT_NE(S16),
GST_AUDIO_FORMAT_U16 = _GST_AUDIO_FORMAT_NE(U16),
GST_AUDIO_FORMAT_S24_32 = _GST_AUDIO_FORMAT_NE(S24_32),
GST_AUDIO_FORMAT_U24_32 = _GST_AUDIO_FORMAT_NE(U24_32),
GST_AUDIO_FORMAT_S32 = _GST_AUDIO_FORMAT_NE(S32),
GST_AUDIO_FORMAT_U32 = _GST_AUDIO_FORMAT_NE(U32),
GST_AUDIO_FORMAT_S24 = _GST_AUDIO_FORMAT_NE(S24),
GST_AUDIO_FORMAT_U24 = _GST_AUDIO_FORMAT_NE(U24),
GST_AUDIO_FORMAT_S20 = _GST_AUDIO_FORMAT_NE(S20),
GST_AUDIO_FORMAT_U20 = _GST_AUDIO_FORMAT_NE(U20),
GST_AUDIO_FORMAT_S18 = _GST_AUDIO_FORMAT_NE(S18),
GST_AUDIO_FORMAT_U18 = _GST_AUDIO_FORMAT_NE(U18),
GST_AUDIO_FORMAT_F32 = _GST_AUDIO_FORMAT_NE(F32),
GST_AUDIO_FORMAT_F64 = _GST_AUDIO_FORMAT_NE(F64)
} GstAudioFormat;
typedef struct _GstAudioFormatInfo GstAudioFormatInfo;
/**
* GstAudioFormatFlags:
* @GST_AUDIO_FORMAT_FLAG_INTEGER: integer samples
* @GST_AUDIO_FORMAT_FLAG_FLOAT: float samples
* @GST_AUDIO_FORMAT_FLAG_SIGNED: signed samples
* @GST_AUDIO_FORMAT_FLAG_COMPLEX: complex layout
* @GST_AUDIO_FORMAT_FLAG_UNPACK: the format can be used in
* #GstAudioFormatUnpack and #GstAudioFormatPack functions
*
* The different audio flags that a format info can have.
*/
typedef enum
{
GST_AUDIO_FORMAT_FLAG_INTEGER = (1 << 0),
GST_AUDIO_FORMAT_FLAG_FLOAT = (1 << 1),
GST_AUDIO_FORMAT_FLAG_SIGNED = (1 << 2),
GST_AUDIO_FORMAT_FLAG_COMPLEX = (1 << 4),
GST_AUDIO_FORMAT_FLAG_UNPACK = (1 << 5)
} GstAudioFormatFlags;
/**
* GstAudioPackFlags:
* @GST_AUDIO_PACK_FLAG_NONE: No flag
*
* The different flags that can be used when packing and unpacking.
*/
typedef enum
{
GST_AUDIO_PACK_FLAG_NONE = 0
} GstAudioPackFlags;
/**
* GstAudioFormatUnpack:
* @info: a #GstAudioFormatInfo
* @dest: (array) (element-type guint8): a destination array
* @data: (array) (element-type guint8): pointer to the audio data
* @length: the amount of samples to unpack.
*
* Unpacks @length samples from the given data of format @info.
* The samples will be unpacked into @dest which each channel
* interleaved. @dest should at least be big enough to hold @length *
* channels * size(unpack_format) bytes.
*/
typedef void (*GstAudioFormatUnpack) (const GstAudioFormatInfo *info,
GstAudioPackFlags flags, gpointer dest,
const gpointer data, gint length);
/**
* GstAudioFormatPack:
* @info: a #GstAudioFormatInfo
* @src: (array) (element-type guint8): a source array
* @data: (array) (element-type guint8): pointer to the destination
* data
* @length: the amount of samples to pack.
*
* Packs @length samples from @src to the data array in format @info.
* The samples from source have each channel interleaved
* and will be packed into @data.
*/
typedef void (*GstAudioFormatPack) (const GstAudioFormatInfo *info,
GstAudioPackFlags flags, const gpointer src,
gpointer data, gint length);
/**
* GstAudioFormatInfo:
* @format: #GstAudioFormat
* @name: string representation of the format
* @description: user readable description of the format
* @flags: #GstAudioFormatFlags
* @endianness: the endianness
* @width: amount of bits used for one sample
* @depth: amount of valid bits in @width
* @silence: @width/8 bytes with 1 silent sample
* @unpack_format: the format of the unpacked samples
* @unpack_func: function to unpack samples
* @pack_func: function to pack samples
*
* Information for an audio format.
*/
struct _GstAudioFormatInfo {
GstAudioFormat format;
const gchar *name;
const gchar *description;
GstAudioFormatFlags flags;
gint endianness;
gint width;
gint depth;
guint8 silence[8];
GstAudioFormat unpack_format;
GstAudioFormatUnpack unpack_func;
GstAudioFormatPack pack_func;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_format_info_get_type (void);
#define GST_AUDIO_FORMAT_INFO_FORMAT(info) ((info)->format)
#define GST_AUDIO_FORMAT_INFO_NAME(info) ((info)->name)
#define GST_AUDIO_FORMAT_INFO_FLAGS(info) ((info)->flags)
#define GST_AUDIO_FORMAT_INFO_IS_INTEGER(info) !!((info)->flags & GST_AUDIO_FORMAT_FLAG_INTEGER)
#define GST_AUDIO_FORMAT_INFO_IS_FLOAT(info) !!((info)->flags & GST_AUDIO_FORMAT_FLAG_FLOAT)
#define GST_AUDIO_FORMAT_INFO_IS_SIGNED(info) !!((info)->flags & GST_AUDIO_FORMAT_FLAG_SIGNED)
#define GST_AUDIO_FORMAT_INFO_ENDIANNESS(info) ((info)->endianness)
#define GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN(info) ((info)->endianness == G_LITTLE_ENDIAN)
#define GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN(info) ((info)->endianness == G_BIG_ENDIAN)
#define GST_AUDIO_FORMAT_INFO_WIDTH(info) ((info)->width)
#define GST_AUDIO_FORMAT_INFO_DEPTH(info) ((info)->depth)
GstAudioFormat gst_audio_format_build_integer (gboolean sign, gint endianness,
gint width, gint depth) G_GNUC_CONST;
GstAudioFormat gst_audio_format_from_string (const gchar *format) G_GNUC_CONST;
const gchar * gst_audio_format_to_string (GstAudioFormat format) G_GNUC_CONST;
const GstAudioFormatInfo *
gst_audio_format_get_info (GstAudioFormat format) G_GNUC_CONST;
void gst_audio_format_fill_silence (const GstAudioFormatInfo *info,
gpointer dest, gsize length);
#define GST_AUDIO_RATE_RANGE "(int) [ 1, max ]"
#define GST_AUDIO_CHANNELS_RANGE "(int) [ 1, max ]"
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
# define GST_AUDIO_NE(s) G_STRINGIFY(s)"LE"
# define GST_AUDIO_OE(s) G_STRINGIFY(s)"BE"
#else
# define GST_AUDIO_NE(s) G_STRINGIFY(s)"BE"
# define GST_AUDIO_OE(s) G_STRINGIFY(s)"LE"
#endif
#define GST_AUDIO_FORMATS_ALL " { S8, U8, " \
"S16LE, S16BE, U16LE, U16BE, " \
"S24_32LE, S24_32BE, U24_32LE, U24_32BE, " \
"S32LE, S32BE, U32LE, U32BE, " \
"S24LE, S24BE, U24LE, U24BE, " \
"S20LE, S20BE, U20LE, U20BE, " \
"S18LE, S18BE, U18LE, U18BE, " \
"F32LE, F32BE, F64LE, F64BE }"
/**
* GST_AUDIO_CAPS_MAKE:
* @format: string format that describes the sample layout, as string
* (e.g. "S16LE", "S8", etc.)
*
* Generic caps string for audio, for use in pad templates.
*/
#define GST_AUDIO_CAPS_MAKE(format) \
"audio/x-raw, " \
"format = (string) " format ", " \
"rate = " GST_AUDIO_RATE_RANGE ", " \
"channels = " GST_AUDIO_CHANNELS_RANGE
/**
* GST_AUDIO_DEF_RATE:
*
* Standard sampling rate used in consumer audio.
*/
#define GST_AUDIO_DEF_RATE 44100
/**
* GST_AUDIO_DEF_CHANNELS:
*
* Standard number of channels used in consumer audio.
*/
#define GST_AUDIO_DEF_CHANNELS 2
/**
* GST_AUDIO_DEF_FORMAT:
*
* Standard format used in consumer audio.
*/
#define GST_AUDIO_DEF_FORMAT "S16LE"
G_END_DECLS
#endif /* __GST_AUDIO_FORMAT_H__ */
@@ -0,0 +1,133 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Library <2001> Thomas Vander Stichele <thomas@apestaart.org>
* <2011> Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_INFO_H__
#define __GST_AUDIO_INFO_H__
#include <gst/gst.h>
#include <gst/audio/audio-enumtypes.h>
#include <gst/audio/audio-format.h>
#include <gst/audio/audio-channels.h>
G_BEGIN_DECLS
typedef struct _GstAudioInfo GstAudioInfo;
/**
* GstAudioFlags:
* @GST_AUDIO_FLAG_NONE: no valid flag
* @GST_AUDIO_FLAG_UNPOSITIONED: the position array explicitly
* contains unpositioned channels.
*
* Extra audio flags
*/
typedef enum {
GST_AUDIO_FLAG_NONE = 0,
GST_AUDIO_FLAG_UNPOSITIONED = (1 << 0)
} GstAudioFlags;
/**
* GstAudioLayout:
* @GST_AUDIO_LAYOUT_INTERLEAVED: interleaved audio
* @GST_AUDIO_LAYOUT_NON_INTERLEAVED: non-interleaved audio
*
* Layout of the audio samples for the different channels.
*/
typedef enum {
GST_AUDIO_LAYOUT_INTERLEAVED = 0,
GST_AUDIO_LAYOUT_NON_INTERLEAVED
} GstAudioLayout;
/**
* GstAudioInfo:
* @finfo: the format info of the audio
* @flags: additional audio flags
* @layout: audio layout
* @rate: the audio sample rate
* @channels: the number of channels
* @bpf: the number of bytes for one frame, this is the size of one
* sample * @channels
* @position: the positions for each channel
*
* Information describing audio properties. This information can be filled
* in from GstCaps with gst_audio_info_from_caps().
*
* Use the provided macros to access the info in this structure.
*/
struct _GstAudioInfo {
const GstAudioFormatInfo *finfo;
GstAudioFlags flags;
GstAudioLayout layout;
gint rate;
gint channels;
gint bpf;
GstAudioChannelPosition position[64];
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_info_get_type (void);
#define GST_AUDIO_INFO_IS_VALID(i) ((i)->finfo != NULL && (i)->rate > 0 && (i)->channels > 0 && (i)->bpf > 0)
#define GST_AUDIO_INFO_FORMAT(i) (GST_AUDIO_FORMAT_INFO_FORMAT((i)->finfo))
#define GST_AUDIO_INFO_NAME(i) (GST_AUDIO_FORMAT_INFO_NAME((i)->finfo))
#define GST_AUDIO_INFO_WIDTH(i) (GST_AUDIO_FORMAT_INFO_WIDTH((i)->finfo))
#define GST_AUDIO_INFO_DEPTH(i) (GST_AUDIO_FORMAT_INFO_DEPTH((i)->finfo))
#define GST_AUDIO_INFO_BPS(info) (GST_AUDIO_INFO_DEPTH(info) >> 3)
#define GST_AUDIO_INFO_IS_INTEGER(i) (GST_AUDIO_FORMAT_INFO_IS_INTEGER((i)->finfo))
#define GST_AUDIO_INFO_IS_FLOAT(i) (GST_AUDIO_FORMAT_INFO_IS_FLOAT((i)->finfo))
#define GST_AUDIO_INFO_IS_SIGNED(i) (GST_AUDIO_FORMAT_INFO_IS_SIGNED((i)->finfo))
#define GST_AUDIO_INFO_ENDIANNESS(i) (GST_AUDIO_FORMAT_INFO_ENDIANNES((i)->finfo))
#define GST_AUDIO_INFO_IS_LITTLE_ENDIAN(i) (GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN((i)->finfo))
#define GST_AUDIO_INFO_IS_BIG_ENDIAN(i) (GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN((i)->finfo))
#define GST_AUDIO_INFO_FLAGS(info) ((info)->flags)
#define GST_AUDIO_INFO_IS_UNPOSITIONED(info) ((info)->flags & GST_AUDIO_FLAG_UNPOSITIONED)
#define GST_AUDIO_INFO_LAYOUT(info) ((info)->layout)
#define GST_AUDIO_INFO_RATE(info) ((info)->rate)
#define GST_AUDIO_INFO_CHANNELS(info) ((info)->channels)
#define GST_AUDIO_INFO_BPF(info) ((info)->bpf)
#define GST_AUDIO_INFO_POSITION(info,c) ((info)->position[c])
GstAudioInfo * gst_audio_info_new (void);
void gst_audio_info_init (GstAudioInfo *info);
GstAudioInfo * gst_audio_info_copy (const GstAudioInfo *info);
void gst_audio_info_free (GstAudioInfo *info);
void gst_audio_info_set_format (GstAudioInfo *info, GstAudioFormat format,
gint rate, gint channels,
const GstAudioChannelPosition *position);
gboolean gst_audio_info_from_caps (GstAudioInfo *info, const GstCaps *caps);
GstCaps * gst_audio_info_to_caps (const GstAudioInfo *info);
gboolean gst_audio_info_convert (const GstAudioInfo * info,
GstFormat src_fmt, gint64 src_val,
GstFormat dest_fmt, gint64 * dest_val);
G_END_DECLS
#endif /* __GST_AUDIO_INFO_H__ */
@@ -0,0 +1,65 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Library <2001> Thomas Vander Stichele <thomas@apestaart.org>
* <2011> Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_AUDIO_H__
#define __GST_AUDIO_AUDIO_H__
#include <gst/gst.h>
#include <gst/audio/audio-enumtypes.h>
#include <gst/audio/audio-format.h>
#include <gst/audio/audio-channels.h>
#include <gst/audio/audio-info.h>
G_BEGIN_DECLS
/* conversion macros */
/**
* GST_FRAMES_TO_CLOCK_TIME:
* @frames: sample frames
* @rate: sampling rate
*
* Calculate clocktime from sample @frames and @rate.
*/
#define GST_FRAMES_TO_CLOCK_TIME(frames, rate) \
((GstClockTime) gst_util_uint64_scale_round (frames, GST_SECOND, rate))
/**
* GST_CLOCK_TIME_TO_FRAMES:
* @clocktime: clock time
* @rate: sampling rate
*
* Calculate frames from @clocktime and sample @rate.
*/
#define GST_CLOCK_TIME_TO_FRAMES(clocktime, rate) \
gst_util_uint64_scale_round (clocktime, rate, GST_SECOND)
/*
* this library defines and implements some helper functions for audio
* handling
*/
GstBuffer * gst_audio_buffer_clip (GstBuffer *buffer, GstSegment *segment,
gint rate, gint bpf);
G_END_DECLS
#endif /* __GST_AUDIO_AUDIO_H__ */
@@ -0,0 +1,190 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstaudiobasesink.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* a base class for audio sinks.
*
* It uses a ringbuffer to schedule playback of samples. This makes
* it very easy to drop or insert samples to align incoming
* buffers to the exact playback timestamp.
*
* Subclasses must provide a ringbuffer pointing to either DMA
* memory or regular memory. A subclass should also call a callback
* function when it has played N segments in the buffer. The subclass
* is free to use a thread to signal this callback, use EIO or any
* other mechanism.
*
* The base class is able to operate in push or pull mode. The chain
* mode will queue the samples in the ringbuffer as much as possible.
* The available space is calculated in the callback function.
*
* The pull mode will pull_range() a new buffer of N samples with a
* configurable latency. This allows for high-end real time
* audio processing pipelines driven by the audiosink. The callback
* function will be used to perform a pull_range() on the sinkpad.
* The thread scheduling the callback can be a real-time thread.
*
* Subclasses must implement a GstAudioRingBuffer in addition to overriding
* the methods in GstBaseSink and this class.
*/
#ifndef __GST_AUDIO_BASE_SINK_H__
#define __GST_AUDIO_BASE_SINK_H__
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#include "gstaudioringbuffer.h"
#include "gstaudioclock.h"
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_BASE_SINK (gst_audio_base_sink_get_type())
#define GST_AUDIO_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_BASE_SINK,GstAudioBaseSink))
#define GST_AUDIO_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_BASE_SINK,GstAudioBaseSinkClass))
#define GST_AUDIO_BASE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_BASE_SINK, GstAudioBaseSinkClass))
#define GST_IS_AUDIO_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_BASE_SINK))
#define GST_IS_AUDIO_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_BASE_SINK))
/**
* GST_AUDIO_BASE_SINK_CLOCK:
* @obj: a #GstAudioBaseSink
*
* Get the #GstClock of @obj.
*/
#define GST_AUDIO_BASE_SINK_CLOCK(obj) (GST_AUDIO_BASE_SINK (obj)->clock)
/**
* GST_AUDIO_BASE_SINK_PAD:
* @obj: a #GstAudioBaseSink
*
* Get the sink #GstPad of @obj.
*/
#define GST_AUDIO_BASE_SINK_PAD(obj) (GST_BASE_SINK (obj)->sinkpad)
/**
* GstAudioBaseSinkSlaveMethod:
* @GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE: Resample to match the master clock
* @GST_AUDIO_BASE_SINK_SLAVE_SKEW: Adjust playout pointer when master clock
* drifts too much.
* @GST_AUDIO_BASE_SINK_SLAVE_NONE: No adjustment is done.
*
* Different possible clock slaving algorithms used when the internal audio
* clock is not selected as the pipeline master clock.
*/
typedef enum
{
GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE,
GST_AUDIO_BASE_SINK_SLAVE_SKEW,
GST_AUDIO_BASE_SINK_SLAVE_NONE
} GstAudioBaseSinkSlaveMethod;
#define GST_TYPE_AUDIO_BASE_SINK_SLAVE_METHOD (gst_audio_base_sink_slave_method_get_type ())
typedef struct _GstAudioBaseSink GstAudioBaseSink;
typedef struct _GstAudioBaseSinkClass GstAudioBaseSinkClass;
typedef struct _GstAudioBaseSinkPrivate GstAudioBaseSinkPrivate;
/**
* GstAudioBaseSink:
*
* Opaque #GstAudioBaseSink.
*/
struct _GstAudioBaseSink {
GstBaseSink element;
/*< protected >*/ /* with LOCK */
/* our ringbuffer */
GstAudioRingBuffer *ringbuffer;
/* required buffer and latency in microseconds */
guint64 buffer_time;
guint64 latency_time;
/* the next sample to write */
guint64 next_sample;
/* clock */
GstClock *provided_clock;
/* with g_atomic_; currently rendering eos */
gboolean eos_rendering;
/*< private >*/
GstAudioBaseSinkPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstAudioBaseSinkClass:
* @parent_class: the parent class.
* @create_ringbuffer: create and return a #GstAudioRingBuffer to write to.
* @payload: payload data in a format suitable to write to the sink. If no
* payloading is required, returns a reffed copy of the original
* buffer, else returns the payloaded buffer with all other metadata
* copied.
*
* #GstAudioBaseSink class. Override the vmethod to implement
* functionality.
*/
struct _GstAudioBaseSinkClass {
GstBaseSinkClass parent_class;
/* subclass ringbuffer allocation */
GstAudioRingBuffer* (*create_ringbuffer) (GstAudioBaseSink *sink);
/* subclass payloader */
GstBuffer* (*payload) (GstAudioBaseSink *sink,
GstBuffer *buffer);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_base_sink_get_type(void);
GType gst_audio_base_sink_slave_method_get_type (void);
GstAudioRingBuffer *
gst_audio_base_sink_create_ringbuffer (GstAudioBaseSink *sink);
void gst_audio_base_sink_set_provide_clock (GstAudioBaseSink *sink, gboolean provide);
gboolean gst_audio_base_sink_get_provide_clock (GstAudioBaseSink *sink);
void gst_audio_base_sink_set_slave_method (GstAudioBaseSink *sink,
GstAudioBaseSinkSlaveMethod method);
GstAudioBaseSinkSlaveMethod
gst_audio_base_sink_get_slave_method (GstAudioBaseSink *sink);
void gst_audio_base_sink_set_drift_tolerance (GstAudioBaseSink *sink,
gint64 drift_tolerance);
gint64 gst_audio_base_sink_get_drift_tolerance (GstAudioBaseSink *sink);
void gst_audio_base_sink_set_alignment_threshold (GstAudioBaseSink * sink,
GstClockTime alignment_threshold);
GstClockTime
gst_audio_base_sink_get_alignment_threshold (GstAudioBaseSink * sink);
void gst_audio_base_sink_set_discont_wait (GstAudioBaseSink * sink,
GstClockTime discont_wait);
GstClockTime
gst_audio_base_sink_get_discont_wait (GstAudioBaseSink * sink);
G_END_DECLS
#endif /* __GST_AUDIO_BASE_SINK_H__ */
@@ -0,0 +1,147 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstaudiobasesrc.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* a base class for audio sources.
*/
#ifndef __GST_AUDIO_BASE_SRC_H__
#define __GST_AUDIO_BASE_SRC_H__
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
#include "gstaudioringbuffer.h"
#include "gstaudioclock.h"
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_BASE_SRC (gst_audio_base_src_get_type())
#define GST_AUDIO_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_BASE_SRC,GstAudioBaseSrc))
#define GST_AUDIO_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_BASE_SRC,GstAudioBaseSrcClass))
#define GST_AUDIO_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_BASE_SRC, GstAudioBaseSrcClass))
#define GST_IS_AUDIO_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_BASE_SRC))
#define GST_IS_AUDIO_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_BASE_SRC))
/**
* GST_AUDIO_BASE_SRC_CLOCK:
* @obj: a #GstAudioBaseSrc
*
* Get the #GstClock of @obj.
*/
#define GST_AUDIO_BASE_SRC_CLOCK(obj) (GST_AUDIO_BASE_SRC (obj)->clock)
/**
* GST_AUDIO_BASE_SRC_PAD:
* @obj: a #GstAudioBaseSrc
*
* Get the source #GstPad of @obj.
*/
#define GST_AUDIO_BASE_SRC_PAD(obj) (GST_BASE_SRC (obj)->srcpad)
typedef struct _GstAudioBaseSrc GstAudioBaseSrc;
typedef struct _GstAudioBaseSrcClass GstAudioBaseSrcClass;
typedef struct _GstAudioBaseSrcPrivate GstAudioBaseSrcPrivate;
/**
* GstAudioBaseSrcSlaveMethod:
* @GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE: Resample to match the master clock.
* @GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP: Retimestamp output buffers with master
* clock time.
* @GST_AUDIO_BASE_SRC_SLAVE_SKEW: Adjust capture pointer when master clock
* drifts too much.
* @GST_AUDIO_BASE_SRC_SLAVE_NONE: No adjustment is done.
*
* Different possible clock slaving algorithms when the internal audio clock was
* not selected as the pipeline clock.
*/
typedef enum
{
GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE,
GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP,
GST_AUDIO_BASE_SRC_SLAVE_SKEW,
GST_AUDIO_BASE_SRC_SLAVE_NONE
} GstAudioBaseSrcSlaveMethod;
#define GST_TYPE_AUDIO_BASE_SRC_SLAVE_METHOD (gst_audio_base_src_slave_method_get_type ())
/**
* GstAudioBaseSrc:
*
* Opaque #GstAudioBaseSrc.
*/
struct _GstAudioBaseSrc {
GstPushSrc element;
/*< protected >*/ /* with LOCK */
/* our ringbuffer */
GstAudioRingBuffer *ringbuffer;
/* required buffer and latency */
GstClockTime buffer_time;
GstClockTime latency_time;
/* the next sample to write */
guint64 next_sample;
/* clock */
GstClock *clock;
/*< private >*/
GstAudioBaseSrcPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstAudioBaseSrcClass:
* @parent_class: the parent class.
* @create_ringbuffer: create and return a #GstAudioRingBuffer to read from.
*
* #GstAudioBaseSrc class. Override the vmethod to implement
* functionality.
*/
struct _GstAudioBaseSrcClass {
GstPushSrcClass parent_class;
/* subclass ringbuffer allocation */
GstAudioRingBuffer* (*create_ringbuffer) (GstAudioBaseSrc *src);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_base_src_get_type(void);
GType gst_audio_base_src_slave_method_get_type (void);
GstAudioRingBuffer *
gst_audio_base_src_create_ringbuffer (GstAudioBaseSrc *src);
void gst_audio_base_src_set_provide_clock (GstAudioBaseSrc *src, gboolean provide);
gboolean gst_audio_base_src_get_provide_clock (GstAudioBaseSrc *src);
void gst_audio_base_src_set_slave_method (GstAudioBaseSrc *src,
GstAudioBaseSrcSlaveMethod method);
GstAudioBaseSrcSlaveMethod
gst_audio_base_src_get_slave_method (GstAudioBaseSrc *src);
G_END_DECLS
#endif /* __GST_AUDIO_BASE_SRC_H__ */
@@ -0,0 +1,140 @@
/* GStreamer Audio CD Source Base Class
* Copyright (C) 2005 Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_CD_SRC_H__
#define __GST_AUDIO_CD_SRC_H__
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_CD_SRC (gst_audio_cd_src_get_type())
#define GST_AUDIO_CD_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrc))
#define GST_AUDIO_CD_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrcClass))
#define GST_IS_AUDIO_CD_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AUDIO_CD_SRC))
#define GST_IS_AUDIO_CD_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AUDIO_CD_SRC))
#define GST_AUDIO_CD_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrcClass))
typedef struct _GstAudioCdSrc GstAudioCdSrc;
typedef struct _GstAudioCdSrcClass GstAudioCdSrcClass;
typedef struct _GstAudioCdSrcTrack GstAudioCdSrcTrack;
typedef struct _GstAudioCdSrcPrivate GstAudioCdSrcPrivate;
/**
* GstAudioCdSrcMode:
* @GST_AUDIO_CD_SRC_MODE_NORMAL : each single track is a stream
* @GST_AUDIO_CD_SRC_MODE_CONTINUOUS : the entire disc is a single stream
*
* Mode in which the CD audio source operates. Influences timestamping,
* EOS handling and seeking.
*/
typedef enum {
GST_AUDIO_CD_SRC_MODE_NORMAL, /* stream = one track */
GST_AUDIO_CD_SRC_MODE_CONTINUOUS /* stream = whole disc */
} GstAudioCdSrcMode;
#define GST_TYPE_AUDIO_CD_SRC_MODE (gst_audio_cd_src_mode_get_type ())
/**
* GstAudioCdSrcTrack:
* @is_audio: Whether this is an audio track
* @num: Track number in TOC (usually starts from 1, but not always)
* @start: The first sector of this track (LBA)
* @end: The last sector of this track (LBA)
* @tags: Track-specific tags (e.g. from cd-text information), or NULL
*
* CD track abstraction to communicate TOC entries to the base class.
*
* This structure is only for use by sub-classed in connection with
* gst_audio_cd_src_add_track().
*
* Applications will be informed of the available tracks via a TOC message
* on the pipeline's #GstBus instead.
*/
/* FIXME 2.0: remove this struct and pass values directly to _add_track() */
struct _GstAudioCdSrcTrack {
gboolean is_audio; /* TRUE if this is an audio track */
guint num; /* real track number (usually starts from 1) */
guint start; /* first sector of track (LBA, not LSN!) */
guint end; /* last sector of track (LBA, not LSN!) */
GstTagList *tags; /* NULL or tags for track (e.g. from cd-text) */
/*< private >*/
guint _gst_reserved1[GST_PADDING/2];
gpointer _gst_reserved2[GST_PADDING/2];
};
struct _GstAudioCdSrc {
GstPushSrc pushsrc;
/*< protected >*/ /* for use by sub-classes only */
GstTagList *tags; /* tags that apply to all tracks */
/*< private >*/
GstAudioCdSrcPrivate *priv;
/*< private >*/
guint _gst_reserved1[GST_PADDING/2];
gpointer _gst_reserved2[GST_PADDING/2];
};
/**
* GstAudioCdSrcClass:
* @pushsrc_class: the parent class
* @open: opening the device
* @close: closing the device
* @read_sector: reading a sector
* @get_default_device: getting the default device
* @probe_devices: probing possible devices
*
* Audio CD source base class.
*/
struct _GstAudioCdSrcClass {
GstPushSrcClass pushsrc_class;
/* open/close the CD device */
gboolean (*open) (GstAudioCdSrc *src, const gchar *device);
void (*close) (GstAudioCdSrc *src);
/* read one sector (LBA) */
GstBuffer * (*read_sector) (GstAudioCdSrc *src, gint sector);
#if 0
/* return default device or NULL (optional) */
gchar * (*get_default_device) (GstAudioCdSrc *src);
/* return NULL-terminated string array of CD devices, or NULL (optional) */
/* FIXME 0.11: reconsider for new probing/device discovery API, remove if in doubt */
gchar ** (*probe_devices) (GstAudioCdSrc *src);
#endif
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
GType gst_audio_cd_src_get_type (void);
GType gst_audio_cd_src_mode_get_type (void);
gboolean gst_audio_cd_src_add_track (GstAudioCdSrc * src,
GstAudioCdSrcTrack * track);
G_END_DECLS
#endif /* __GST_AUDIO_CD_SRC_H__ */
@@ -0,0 +1,100 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstaudioclock.h: Clock for use by audio plugins
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_CLOCK_H__
#define __GST_AUDIO_CLOCK_H__
#include <gst/gst.h>
#include <gst/gstsystemclock.h>
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_CLOCK \
(gst_audio_clock_get_type())
#define GST_AUDIO_CLOCK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CLOCK,GstAudioClock))
#define GST_AUDIO_CLOCK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_CLOCK,GstAudioClockClass))
#define GST_IS_AUDIO_CLOCK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CLOCK))
#define GST_IS_AUDIO_CLOCK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_CLOCK))
#define GST_AUDIO_CLOCK_CAST(obj) \
((GstAudioClock*)(obj))
typedef struct _GstAudioClock GstAudioClock;
typedef struct _GstAudioClockClass GstAudioClockClass;
/**
* GstAudioClockGetTimeFunc:
* @clock: the #GstAudioClock
* @user_data: user data
*
* This function will be called whenever the current clock time needs to be
* calculated. If this function returns #GST_CLOCK_TIME_NONE, the last reported
* time will be returned by the clock.
*
* Returns: the current time or #GST_CLOCK_TIME_NONE if the previous time should
* be used.
*/
typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock *clock, gpointer user_data);
/**
* GstAudioClock:
*
* Opaque #GstAudioClock.
*/
struct _GstAudioClock {
GstSystemClock clock;
/*< protected >*/
GstAudioClockGetTimeFunc func;
gpointer user_data;
GDestroyNotify destroy_notify;
/*< private >*/
GstClockTime last_time;
GstClockTimeDiff time_offset;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstAudioClockClass {
GstSystemClockClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_clock_get_type (void);
GstClock* gst_audio_clock_new (const gchar *name, GstAudioClockGetTimeFunc func,
gpointer user_data, GDestroyNotify destroy_notify);
void gst_audio_clock_reset (GstAudioClock *clock, GstClockTime time);
GstClockTime gst_audio_clock_get_time (GstClock * clock);
GstClockTime gst_audio_clock_adjust (GstClock * clock, GstClockTime time);
void gst_audio_clock_invalidate (GstClock * clock);
G_END_DECLS
#endif /* __GST_AUDIO_CLOCK_H__ */
@@ -0,0 +1,362 @@
/* GStreamer
* Copyright (C) 2009 Igalia S.L.
* Author: Iago Toral Quiroga <itoral@igalia.com>
* Copyright (C) 2011 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>.
* Copyright (C) 2011 Nokia Corporation. All rights reserved.
* Contact: Stefan Kost <stefan.kost@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _GST_AUDIO_DECODER_H_
#define _GST_AUDIO_DECODER_H_
#include <gst/gst.h>
#include <gst/audio/audio.h>
#include <gst/base/gstadapter.h>
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_DECODER \
(gst_audio_decoder_get_type())
#define GST_AUDIO_DECODER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_DECODER,GstAudioDecoder))
#define GST_AUDIO_DECODER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_DECODER,GstAudioDecoderClass))
#define GST_AUDIO_DECODER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_DECODER,GstAudioDecoderClass))
#define GST_IS_AUDIO_DECODER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_DECODER))
#define GST_IS_AUDIO_DECODER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_DECODER))
#define GST_AUDIO_DECODER_CAST(obj) \
((GstAudioDecoder *)(obj))
/**
* GST_AUDIO_DECODER_SINK_NAME:
*
* The name of the templates for the sink pad.
*/
#define GST_AUDIO_DECODER_SINK_NAME "sink"
/**
* GST_AUDIO_DECODER_SRC_NAME:
*
* The name of the templates for the source pad.
*/
#define GST_AUDIO_DECODER_SRC_NAME "src"
/**
* GST_AUDIO_DECODER_SRC_PAD:
* @obj: base audio codec instance
*
* Gives the pointer to the source #GstPad object of the element.
*/
#define GST_AUDIO_DECODER_SRC_PAD(obj) (((GstAudioDecoder *) (obj))->srcpad)
/**
* GST_AUDIO_DECODER_SINK_PAD:
* @obj: base audio codec instance
*
* Gives the pointer to the sink #GstPad object of the element.
*/
#define GST_AUDIO_DECODER_SINK_PAD(obj) (((GstAudioDecoder *) (obj))->sinkpad)
#define GST_AUDIO_DECODER_STREAM_LOCK(dec) g_rec_mutex_lock (&GST_AUDIO_DECODER (dec)->stream_lock)
#define GST_AUDIO_DECODER_STREAM_UNLOCK(dec) g_rec_mutex_unlock (&GST_AUDIO_DECODER (dec)->stream_lock)
/**
* GST_AUDIO_DECODER_INPUT_SEGMENT:
* @obj: audio decoder instance
*
* Gives the input segment of the element.
*/
#define GST_AUDIO_DECODER_INPUT_SEGMENT(obj) (GST_AUDIO_DECODER_CAST (obj)->input_segment)
/**
* GST_AUDIO_DECODER_OUTPUT_SEGMENT:
* @obj: audio decoder instance
*
* Gives the output segment of the element.
*/
#define GST_AUDIO_DECODER_OUTPUT_SEGMENT(obj) (GST_AUDIO_DECODER_CAST (obj)->output_segment)
typedef struct _GstAudioDecoder GstAudioDecoder;
typedef struct _GstAudioDecoderClass GstAudioDecoderClass;
typedef struct _GstAudioDecoderPrivate GstAudioDecoderPrivate;
/* do not use this one, use macro below */
GstFlowReturn _gst_audio_decoder_error (GstAudioDecoder *dec, gint weight,
GQuark domain, gint code,
gchar *txt, gchar *debug,
const gchar *file, const gchar *function,
gint line);
/**
* GST_AUDIO_DECODER_ERROR:
* @el: the base audio decoder element that generates the error
* @weight: element defined weight of the error, added to error count
* @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
* @code: error code defined for that domain (see #gstreamer-GstGError)
* @text: the message to display (format string and args enclosed in
* parentheses)
* @debug: debugging information for the message (format string and args
* enclosed in parentheses)
* @ret: variable to receive return value
*
* Utility function that audio decoder elements can use in case they encountered
* a data processing error that may be fatal for the current "data unit" but
* need not prevent subsequent decoding. Such errors are counted and if there
* are too many, as configured in the context's max_errors, the pipeline will
* post an error message and the application will be requested to stop further
* media processing. Otherwise, it is considered a "glitch" and only a warning
* is logged. In either case, @ret is set to the proper value to
* return to upstream/caller (indicating either GST_FLOW_ERROR or GST_FLOW_OK).
*/
#define GST_AUDIO_DECODER_ERROR(el, weight, domain, code, text, debug, ret) \
G_STMT_START { \
gchar *__txt = _gst_element_error_printf text; \
gchar *__dbg = _gst_element_error_printf debug; \
GstAudioDecoder *dec = GST_AUDIO_DECODER (el); \
ret = _gst_audio_decoder_error (dec, weight, GST_ ## domain ## _ERROR, \
GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
GST_FUNCTION, __LINE__); \
} G_STMT_END
/**
* GST_AUDIO_DECODER_MAX_ERRORS:
*
* Default maximum number of errors tolerated before signaling error.
*/
#define GST_AUDIO_DECODER_MAX_ERRORS 10
/**
* GstAudioDecoder:
*
* The opaque #GstAudioDecoder data structure.
*/
struct _GstAudioDecoder
{
GstElement element;
/*< protected >*/
/* source and sink pads */
GstPad *sinkpad;
GstPad *srcpad;
/* protects all data processing, i.e. is locked
* in the chain function, finish_frame and when
* processing serialized events */
GRecMutex stream_lock;
/* MT-protected (with STREAM_LOCK) */
GstSegment input_segment;
GstSegment output_segment;
/*< private >*/
GstAudioDecoderPrivate *priv;
gpointer _gst_reserved[GST_PADDING_LARGE];
};
/**
* GstAudioDecoderClass:
* @element_class: The parent class structure
* @start: Optional.
* Called when the element starts processing.
* Allows opening external resources.
* @stop: Optional.
* Called when the element stops processing.
* Allows closing external resources.
* @set_format: Notifies subclass of incoming data format (caps).
* @parse: Optional.
* Allows chopping incoming data into manageable units (frames)
* for subsequent decoding. This division is at subclass
* discretion and may or may not correspond to 1 (or more)
* frames as defined by audio format.
* @handle_frame: Provides input data (or NULL to clear any remaining data)
* to subclass. Input data ref management is performed by
* base class, subclass should not care or intervene,
* and input data is only valid until next call to base class,
* most notably a call to gst_audio_decoder_finish_frame().
* @flush: Optional.
* Instructs subclass to clear any codec caches and discard
* any pending samples and not yet returned decoded data.
* @hard indicates whether a FLUSH is being processed,
* or otherwise a DISCONT (or conceptually similar).
* @sink_event: Optional.
* Event handler on the sink pad. Subclasses should chain up to
* the parent implementation to invoke the default handler.
* @src_event: Optional.
* Event handler on the src pad. Subclasses should chain up to
* the parent implementation to invoke the default handler.
* @pre_push: Optional.
* Called just prior to pushing (encoded data) buffer downstream.
* Subclass has full discretionary access to buffer,
* and a not OK flow return will abort downstream pushing.
* @open: Optional.
* Called when the element changes to GST_STATE_READY.
* Allows opening external resources.
* @close: Optional.
* Called when the element changes to GST_STATE_NULL.
* Allows closing external resources.
* @negotiate: Optional.
* Negotiate with downstream and configure buffer pools, etc.
* Subclasses should chain up to the parent implementation to
* invoke the default handler.
* @decide_allocation: Optional.
* Setup the allocation parameters for allocating output
* buffers. The passed in query contains the result of the
* downstream allocation query.
* Subclasses should chain up to the parent implementation to
* invoke the default handler.
* @propose_allocation: Optional.
* Propose buffer allocation parameters for upstream elements.
* Subclasses should chain up to the parent implementation to
* invoke the default handler.
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum @handle_frame (and likely @set_format) needs to be
* overridden.
*/
struct _GstAudioDecoderClass
{
GstElementClass element_class;
/*< public >*/
/* virtual methods for subclasses */
gboolean (*start) (GstAudioDecoder *dec);
gboolean (*stop) (GstAudioDecoder *dec);
gboolean (*set_format) (GstAudioDecoder *dec,
GstCaps *caps);
GstFlowReturn (*parse) (GstAudioDecoder *dec,
GstAdapter *adapter,
gint *offset, gint *length);
GstFlowReturn (*handle_frame) (GstAudioDecoder *dec,
GstBuffer *buffer);
void (*flush) (GstAudioDecoder *dec, gboolean hard);
GstFlowReturn (*pre_push) (GstAudioDecoder *dec,
GstBuffer **buffer);
gboolean (*sink_event) (GstAudioDecoder *dec,
GstEvent *event);
gboolean (*src_event) (GstAudioDecoder *dec,
GstEvent *event);
gboolean (*open) (GstAudioDecoder *dec);
gboolean (*close) (GstAudioDecoder *dec);
gboolean (*negotiate) (GstAudioDecoder *dec);
gboolean (*decide_allocation) (GstAudioDecoder *dec, GstQuery *query);
gboolean (*propose_allocation) (GstAudioDecoder *dec,
GstQuery * query);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
GType gst_audio_decoder_get_type (void);
gboolean gst_audio_decoder_set_output_format (GstAudioDecoder * dec,
const GstAudioInfo * info);
gboolean gst_audio_decoder_negotiate (GstAudioDecoder * dec);
GstFlowReturn gst_audio_decoder_finish_frame (GstAudioDecoder * dec,
GstBuffer * buf, gint frames);
GstBuffer * gst_audio_decoder_allocate_output_buffer (GstAudioDecoder * dec,
gsize size);
/* context parameters */
GstAudioInfo * gst_audio_decoder_get_audio_info (GstAudioDecoder * dec);
void gst_audio_decoder_set_plc_aware (GstAudioDecoder * dec,
gboolean plc);
gint gst_audio_decoder_get_plc_aware (GstAudioDecoder * dec);
void gst_audio_decoder_set_estimate_rate (GstAudioDecoder * dec,
gboolean enabled);
gint gst_audio_decoder_get_estimate_rate (GstAudioDecoder * dec);
gint gst_audio_decoder_get_delay (GstAudioDecoder * dec);
void gst_audio_decoder_set_max_errors (GstAudioDecoder * dec,
gint num);
gint gst_audio_decoder_get_max_errors (GstAudioDecoder * dec);
void gst_audio_decoder_set_latency (GstAudioDecoder * dec,
GstClockTime min,
GstClockTime max);
void gst_audio_decoder_get_latency (GstAudioDecoder * dec,
GstClockTime * min,
GstClockTime * max);
void gst_audio_decoder_get_parse_state (GstAudioDecoder * dec,
gboolean * sync,
gboolean * eos);
/* object properties */
void gst_audio_decoder_set_plc (GstAudioDecoder * dec,
gboolean enabled);
gboolean gst_audio_decoder_get_plc (GstAudioDecoder * dec);
void gst_audio_decoder_set_min_latency (GstAudioDecoder * dec,
GstClockTime num);
GstClockTime gst_audio_decoder_get_min_latency (GstAudioDecoder * dec);
void gst_audio_decoder_set_tolerance (GstAudioDecoder * dec,
GstClockTime tolerance);
GstClockTime gst_audio_decoder_get_tolerance (GstAudioDecoder * dec);
void gst_audio_decoder_set_drainable (GstAudioDecoder * dec,
gboolean enabled);
gboolean gst_audio_decoder_get_drainable (GstAudioDecoder * dec);
void gst_audio_decoder_set_needs_format (GstAudioDecoder * dec,
gboolean enabled);
gboolean gst_audio_decoder_get_needs_format (GstAudioDecoder * dec);
void gst_audio_decoder_get_allocator (GstAudioDecoder * dec,
GstAllocator ** allocator,
GstAllocationParams * params);
void gst_audio_decoder_merge_tags (GstAudioDecoder * dec,
const GstTagList * tags, GstTagMergeMode mode);
G_END_DECLS
#endif /* _GST_AUDIO_DECODER_H_ */
@@ -0,0 +1,311 @@
/* GStreamer
* Copyright (C) 2011 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>.
* Copyright (C) 2011 Nokia Corporation. All rights reserved.
* Contact: Stefan Kost <stefan.kost@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_ENCODER_H__
#define __GST_AUDIO_ENCODER_H__
#include <gst/gst.h>
#include <gst/audio/audio.h>
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_ENCODER (gst_audio_encoder_get_type())
#define GST_AUDIO_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_ENCODER,GstAudioEncoder))
#define GST_AUDIO_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_ENCODER,GstAudioEncoderClass))
#define GST_AUDIO_ENCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_ENCODER,GstAudioEncoderClass))
#define GST_IS_AUDIO_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_ENCODER))
#define GST_IS_AUDIO_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_ENCODER))
#define GST_AUDIO_ENCODER_CAST(obj) ((GstAudioEncoder *)(obj))
/**
* GST_AUDIO_ENCODER_SINK_NAME:
*
* the name of the templates for the sink pad
*/
#define GST_AUDIO_ENCODER_SINK_NAME "sink"
/**
* GST_AUDIO_ENCODER_SRC_NAME:
*
* the name of the templates for the source pad
*/
#define GST_AUDIO_ENCODER_SRC_NAME "src"
/**
* GST_AUDIO_ENCODER_SRC_PAD:
* @obj: audio encoder instance
*
* Gives the pointer to the source #GstPad object of the element.
*/
#define GST_AUDIO_ENCODER_SRC_PAD(obj) (GST_AUDIO_ENCODER_CAST (obj)->srcpad)
/**
* GST_AUDIO_ENCODER_SINK_PAD:
* @obj: audio encoder instance
*
* Gives the pointer to the sink #GstPad object of the element.
*/
#define GST_AUDIO_ENCODER_SINK_PAD(obj) (GST_AUDIO_ENCODER_CAST (obj)->sinkpad)
/**
* GST_AUDIO_ENCODER_INPUT_SEGMENT:
* @obj: base parse instance
*
* Gives the input segment of the element.
*/
#define GST_AUDIO_ENCODER_INPUT_SEGMENT(obj) (GST_AUDIO_ENCODER_CAST (obj)->input_segment)
/**
* GST_AUDIO_ENCODER_OUTPUT_SEGMENT:
* @obj: base parse instance
*
* Gives the output segment of the element.
*/
#define GST_AUDIO_ENCODER_OUTPUT_SEGMENT(obj) (GST_AUDIO_ENCODER_CAST (obj)->output_segment)
#define GST_AUDIO_ENCODER_STREAM_LOCK(enc) g_rec_mutex_lock (&GST_AUDIO_ENCODER (enc)->stream_lock)
#define GST_AUDIO_ENCODER_STREAM_UNLOCK(enc) g_rec_mutex_unlock (&GST_AUDIO_ENCODER (enc)->stream_lock)
typedef struct _GstAudioEncoder GstAudioEncoder;
typedef struct _GstAudioEncoderClass GstAudioEncoderClass;
typedef struct _GstAudioEncoderPrivate GstAudioEncoderPrivate;
/**
* GstAudioEncoder:
*
* The opaque #GstAudioEncoder data structure.
*/
struct _GstAudioEncoder {
GstElement element;
/*< protected >*/
/* source and sink pads */
GstPad *sinkpad;
GstPad *srcpad;
/* protects all data processing, i.e. is locked
* in the chain function, finish_frame and when
* processing serialized events */
GRecMutex stream_lock;
/* MT-protected (with STREAM_LOCK) */
GstSegment input_segment;
GstSegment output_segment;
/*< private >*/
GstAudioEncoderPrivate *priv;
gpointer _gst_reserved[GST_PADDING_LARGE];
};
/**
* GstAudioEncoderClass:
* @element_class: The parent class structure
* @start: Optional.
* Called when the element starts processing.
* Allows opening external resources.
* @stop: Optional.
* Called when the element stops processing.
* Allows closing external resources.
* @set_format: Notifies subclass of incoming data format.
* GstAudioInfo contains the format according to provided caps.
* @handle_frame: Provides input samples (or NULL to clear any remaining data)
* according to directions as configured by the subclass
* using the API. Input data ref management is performed
* by base class, subclass should not care or intervene,
* and input data is only valid until next call to base class,
* most notably a call to gst_audio_encoder_finish_frame().
* @flush: Optional.
* Instructs subclass to clear any codec caches and discard
* any pending samples and not yet returned encoded data.
* @sink_event: Optional.
* Event handler on the sink pad. Subclasses should chain up to
* the parent implementation to invoke the default handler.
* @src_event: Optional.
* Event handler on the src pad. Subclasses should chain up to
* the parent implementation to invoke the default handler.
* @pre_push: Optional.
* Called just prior to pushing (encoded data) buffer downstream.
* Subclass has full discretionary access to buffer,
* and a not OK flow return will abort downstream pushing.
* @getcaps: Optional.
* Allows for a custom sink getcaps implementation (e.g.
* for multichannel input specification). If not implemented,
* default returns gst_audio_encoder_proxy_getcaps
* applied to sink template caps.
* @open: Optional.
* Called when the element changes to GST_STATE_READY.
* Allows opening external resources.
* @close: Optional.
* Called when the element changes to GST_STATE_NULL.
* Allows closing external resources.
* @negotiate: Optional.
* Negotiate with downstream and configure buffer pools, etc.
* Subclasses should chain up to the parent implementation to
* invoke the default handler.
* @decide_allocation: Optional.
* Setup the allocation parameters for allocating output
* buffers. The passed in query contains the result of the
* downstream allocation query.
* Subclasses should chain up to the parent implementation to
* invoke the default handler.
* @propose_allocation: Optional.
* Propose buffer allocation parameters for upstream elements.
* Subclasses should chain up to the parent implementation to
* invoke the default handler.
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum @set_format and @handle_frame needs to be overridden.
*/
struct _GstAudioEncoderClass {
GstElementClass element_class;
/*< public >*/
/* virtual methods for subclasses */
gboolean (*start) (GstAudioEncoder *enc);
gboolean (*stop) (GstAudioEncoder *enc);
gboolean (*set_format) (GstAudioEncoder *enc,
GstAudioInfo *info);
GstFlowReturn (*handle_frame) (GstAudioEncoder *enc,
GstBuffer *buffer);
void (*flush) (GstAudioEncoder *enc);
GstFlowReturn (*pre_push) (GstAudioEncoder *enc,
GstBuffer **buffer);
gboolean (*sink_event) (GstAudioEncoder *enc,
GstEvent *event);
gboolean (*src_event) (GstAudioEncoder *enc,
GstEvent *event);
GstCaps * (*getcaps) (GstAudioEncoder *enc, GstCaps *filter);
gboolean (*open) (GstAudioEncoder *enc);
gboolean (*close) (GstAudioEncoder *enc);
gboolean (*negotiate) (GstAudioEncoder *enc);
gboolean (*decide_allocation) (GstAudioEncoder *enc, GstQuery *query);
gboolean (*propose_allocation) (GstAudioEncoder * enc,
GstQuery * query);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
GType gst_audio_encoder_get_type (void);
GstFlowReturn gst_audio_encoder_finish_frame (GstAudioEncoder * enc,
GstBuffer * buffer,
gint samples);
GstCaps * gst_audio_encoder_proxy_getcaps (GstAudioEncoder * enc,
GstCaps * caps,
GstCaps * filter);
gboolean gst_audio_encoder_set_output_format (GstAudioEncoder * enc,
GstCaps * caps);
gboolean gst_audio_encoder_negotiate (GstAudioEncoder * enc);
GstBuffer * gst_audio_encoder_allocate_output_buffer (GstAudioEncoder * enc,
gsize size);
/* context parameters */
GstAudioInfo * gst_audio_encoder_get_audio_info (GstAudioEncoder * enc);
gint gst_audio_encoder_get_frame_samples_min (GstAudioEncoder * enc);
void gst_audio_encoder_set_frame_samples_min (GstAudioEncoder * enc, gint num);
gint gst_audio_encoder_get_frame_samples_max (GstAudioEncoder * enc);
void gst_audio_encoder_set_frame_samples_max (GstAudioEncoder * enc, gint num);
gint gst_audio_encoder_get_frame_max (GstAudioEncoder * enc);
void gst_audio_encoder_set_frame_max (GstAudioEncoder * enc, gint num);
gint gst_audio_encoder_get_lookahead (GstAudioEncoder * enc);
void gst_audio_encoder_set_lookahead (GstAudioEncoder * enc, gint num);
void gst_audio_encoder_get_latency (GstAudioEncoder * enc,
GstClockTime * min,
GstClockTime * max);
void gst_audio_encoder_set_latency (GstAudioEncoder * enc,
GstClockTime min,
GstClockTime max);
void gst_audio_encoder_set_headers (GstAudioEncoder * enc,
GList * headers);
/* object properties */
void gst_audio_encoder_set_mark_granule (GstAudioEncoder * enc,
gboolean enabled);
gboolean gst_audio_encoder_get_mark_granule (GstAudioEncoder * enc);
void gst_audio_encoder_set_perfect_timestamp (GstAudioEncoder * enc,
gboolean enabled);
gboolean gst_audio_encoder_get_perfect_timestamp (GstAudioEncoder * enc);
void gst_audio_encoder_set_hard_resync (GstAudioEncoder * enc,
gboolean enabled);
gboolean gst_audio_encoder_get_hard_resync (GstAudioEncoder * enc);
void gst_audio_encoder_set_tolerance (GstAudioEncoder * enc,
GstClockTime tolerance);
GstClockTime gst_audio_encoder_get_tolerance (GstAudioEncoder * enc);
void gst_audio_encoder_set_hard_min (GstAudioEncoder * enc,
gboolean enabled);
gboolean gst_audio_encoder_get_hard_min (GstAudioEncoder * enc);
void gst_audio_encoder_set_drainable (GstAudioEncoder * enc,
gboolean enabled);
gboolean gst_audio_encoder_get_drainable (GstAudioEncoder * enc);
void gst_audio_encoder_get_allocator (GstAudioEncoder * enc,
GstAllocator ** allocator,
GstAllocationParams * params);
void gst_audio_encoder_merge_tags (GstAudioEncoder * enc,
const GstTagList * tags, GstTagMergeMode mode);
G_END_DECLS
#endif /* __GST_AUDIO_ENCODER_H__ */
@@ -0,0 +1,101 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_FILTER_H__
#define __GST_AUDIO_FILTER_H__
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include <gst/audio/audio.h>
G_BEGIN_DECLS
typedef struct _GstAudioFilter GstAudioFilter;
typedef struct _GstAudioFilterClass GstAudioFilterClass;
#define GST_TYPE_AUDIO_FILTER \
(gst_audio_filter_get_type())
#define GST_AUDIO_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_FILTER,GstAudioFilter))
#define GST_AUDIO_FILTER_CAST(obj) \
((GstAudioFilter *) (obj))
#define GST_AUDIO_FILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_FILTER,GstAudioFilterClass))
#define GST_AUDIO_FILTER_CLASS_CAST(klass) \
((GstAudioFilterClass *) (klass))
#define GST_AUDIO_FILTER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_FILTER,GstAudioFilterClass))
#define GST_IS_AUDIO_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_FILTER))
#define GST_IS_AUDIO_FILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_FILTER))
/**
* GstAudioFilter:
*
* Base class for audio filters with the same format for input and output.
*/
struct _GstAudioFilter {
GstBaseTransform basetransform;
/*< protected >*/
GstAudioInfo info; /* currently configured format */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
#define GST_AUDIO_FILTER_INFO(filter) (&GST_AUDIO_FILTER_CAST(filter)->info)
#define GST_AUDIO_FILTER_FORMAT(filter) (GST_AUDIO_INFO_FORMAT(GST_AUDIO_FILTER_INFO(filter)))
#define GST_AUDIO_FILTER_RATE(filter) (GST_AUDIO_INFO_RATE(GST_AUDIO_FILTER_INFO(filter)))
#define GST_AUDIO_FILTER_CHANNELS(filter) (GST_AUDIO_INFO_CHANNELS(GST_AUDIO_FILTER_INFO(filter)))
#define GST_AUDIO_FILTER_BPF(filter) (GST_AUDIO_INFO_BPF(GST_AUDIO_FILTER_INFO(filter)))
#define GST_AUDIO_FILTER_BPS(filter) (GST_AUDIO_INFO_BPS(GST_AUDIO_FILTER_INFO(filter)))
/**
* GstAudioFilterClass:
* @basetransformclass: parent class
* @setup: virtual function called whenever the format changes
*
* In addition to the @setup virtual function, you should also override the
* GstBaseTransform::transform and/or GstBaseTransform::transform_ip virtual
* function.
*/
struct _GstAudioFilterClass {
GstBaseTransformClass basetransformclass;
/* virtual function, called whenever the format changes */
gboolean (*setup) (GstAudioFilter * filter, const GstAudioInfo * info);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_filter_get_type (void);
void gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass,
GstCaps * allowed_caps);
G_END_DECLS
#endif /* __GST_AUDIO_FILTER_H__ */
@@ -0,0 +1,33 @@
/* GStreamer audio helper functions for IEC 61937 payloading
* (c) 2011 Intel Corporation
* 2011 Collabora Multimedia
* 2011 Arun Raghavan <arun.raghavan@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_IEC61937_H__
#define __GST_AUDIO_IEC61937_H__
#include <gst/audio/gstaudioringbuffer.h>
guint gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec);
gboolean gst_audio_iec61937_payload (const guint8 * src, guint src_n,
guint8 * dst, guint dst_n,
const GstAudioRingBufferSpec * spec,
gint endianness);
#endif /* __GST_AUDIO_IEC61937_H__ */
@@ -0,0 +1,78 @@
/* GStreamer
* Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_META_H__
#define __GST_AUDIO_META_H__
#include <gst/gst.h>
#include <gst/audio/audio.h>
G_BEGIN_DECLS
#define GST_AUDIO_DOWNMIX_META_API_TYPE (gst_audio_downmix_meta_api_get_type())
#define GST_AUDIO_DOWNMIX_META_INFO (gst_audio_downmix_meta_get_info())
typedef struct _GstAudioDownmixMeta GstAudioDownmixMeta;
/**
* GstAudioDownmixMeta:
* @meta: parent #GstMeta
* @from_position: the channel positions of the source
* @to_position: the channel positions of the destination
* @from_channels: the number of channels of the source
* @to_channels: the number of channels of the destination
* @matrix: the matrix coefficients.
*
* Extra buffer metadata describing audio downmixing matrix. This metadata is
* attached to audio buffers and contains a matrix to downmix the buffer number
* of channels to @channels.
*
* @matrix is an two-dimensional array of @to_channels times @from_channels
* coefficients, i.e. the i-th output channels is constructed by multiplicating
* the input channels with the coefficients in @matrix[i] and taking the sum
* of the results.
*/
struct _GstAudioDownmixMeta {
GstMeta meta;
GstAudioChannelPosition *from_position;
GstAudioChannelPosition *to_position;
gint from_channels, to_channels;
gfloat **matrix;
};
GType gst_audio_downmix_meta_api_get_type (void);
const GstMetaInfo * gst_audio_downmix_meta_get_info (void);
#define gst_buffer_get_audio_downmix_meta(b) ((GstAudioDownmixMeta*)gst_buffer_get_meta((b),GST_AUDIO_DOWNMIX_META_INFO))
GstAudioDownmixMeta * gst_buffer_get_audio_downmix_meta_for_channels (GstBuffer *buffer,
const GstAudioChannelPosition *to_position,
gint to_channels);
GstAudioDownmixMeta * gst_buffer_add_audio_downmix_meta (GstBuffer *buffer,
const GstAudioChannelPosition *from_position,
gint from_channels,
const GstAudioChannelPosition *to_position,
gint to_channels,
const gfloat **matrix);
G_END_DECLS
#endif /* __GST_AUDIO_META_H__ */
@@ -0,0 +1,333 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstaudioringbuffer.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_RING_BUFFER_H__
#define __GST_AUDIO_RING_BUFFER_H__
#include <gst/gst.h>
#include <gst/audio/audio.h>
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_RING_BUFFER (gst_audio_ring_buffer_get_type())
#define GST_AUDIO_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_RING_BUFFER,GstAudioRingBuffer))
#define GST_AUDIO_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_RING_BUFFER,GstAudioRingBufferClass))
#define GST_AUDIO_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_RING_BUFFER, GstAudioRingBufferClass))
#define GST_AUDIO_RING_BUFFER_CAST(obj) ((GstAudioRingBuffer *)obj)
#define GST_IS_AUDIO_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_RING_BUFFER))
#define GST_IS_AUDIO_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_RING_BUFFER))
typedef struct _GstAudioRingBuffer GstAudioRingBuffer;
typedef struct _GstAudioRingBufferClass GstAudioRingBufferClass;
typedef struct _GstAudioRingBufferSpec GstAudioRingBufferSpec;
/**
* GstAudioRingBufferCallback:
* @rbuf: a #GstAudioRingBuffer
* @data: (array length=len): target to fill
* @len: amount to fill
* @user_data: user data
*
* This function is set with gst_audio_ring_buffer_set_callback() and is
* called to fill the memory at @data with @len bytes of samples.
*/
typedef void (*GstAudioRingBufferCallback) (GstAudioRingBuffer *rbuf, guint8* data, guint len, gpointer user_data);
/**
* GstAudioRingBufferState:
* @GST_AUDIO_RING_BUFFER_STATE_STOPPED: The ringbuffer is stopped
* @GST_AUDIO_RING_BUFFER_STATE_PAUSED: The ringbuffer is paused
* @GST_AUDIO_RING_BUFFER_STATE_STARTED: The ringbuffer is started
*
* The state of the ringbuffer.
*/
typedef enum {
GST_AUDIO_RING_BUFFER_STATE_STOPPED,
GST_AUDIO_RING_BUFFER_STATE_PAUSED,
GST_AUDIO_RING_BUFFER_STATE_STARTED
} GstAudioRingBufferState;
/**
* GstAudioRingBufferFormatType:
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW: samples in linear or float
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW: samples in mulaw
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW: samples in alaw
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM: samples in ima adpcm
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG: samples in mpeg audio (but not AAC) format
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM: samples in gsm format
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958: samples in IEC958 frames (e.g. AC3)
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3: samples in AC3 format
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3: samples in EAC3 format
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS: samples in DTS format
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC: samples in MPEG-2 AAC format
* @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC: samples in MPEG-4 AAC format
*
* The format of the samples in the ringbuffer.
*/
typedef enum
{
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC,
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC
} GstAudioRingBufferFormatType;
/**
* GstAudioRingBufferSpec:
* @caps: The caps that generated the Spec.
* @type: the sample type
* @info: the #GstAudioInfo
* @latency_time: the latency in microseconds
* @buffer_time: the total buffer size in microseconds
* @segsize: the size of one segment in bytes
* @segtotal: the total number of segments
* @seglatency: number of segments queued in the lower level device,
* defaults to segtotal
*
* The structure containing the format specification of the ringbuffer.
*/
struct _GstAudioRingBufferSpec
{
/*< public >*/
/* in */
GstCaps *caps; /* the caps of the buffer */
/* in/out */
GstAudioRingBufferFormatType type;
GstAudioInfo info;
guint64 latency_time; /* the required/actual latency time, this is the
* actual the size of one segment and the
* minimum possible latency we can achieve. */
guint64 buffer_time; /* the required/actual time of the buffer, this is
* the total size of the buffer and maximum
* latency we can compensate for. */
gint segsize; /* size of one buffer segment in bytes, this value
* should be chosen to match latency_time as
* well as possible. */
gint segtotal; /* total number of segments, this value is the
* number of segments of @segsize and should be
* chosen so that it matches buffer_time as
* close as possible. */
/* ABI added 0.10.20 */
gint seglatency; /* number of segments queued in the lower
* level device, defaults to segtotal. */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
#define GST_AUDIO_RING_BUFFER_GET_COND(buf) (&(((GstAudioRingBuffer *)buf)->cond))
#define GST_AUDIO_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIO_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
#define GST_AUDIO_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIO_RING_BUFFER_GET_COND (buf)))
#define GST_AUDIO_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIO_RING_BUFFER_GET_COND (buf)))
/**
* GstAudioRingBuffer:
* @cond: used to signal start/stop/pause/resume actions
* @open: boolean indicating that the ringbuffer is open
* @acquired: boolean indicating that the ringbuffer is acquired
* @memory: data in the ringbuffer
* @size: size of data in the ringbuffer
* @spec: format and layout of the ringbuffer data
* @samples_per_seg: number of samples in one segment
* @empty_seg: pointer to memory holding one segment of silence samples
* @state: state of the buffer
* @segdone: readpointer in the ringbuffer
* @segbase: segment corresponding to segment 0 (unused)
* @waiting: is a reader or writer waiting for a free segment
*
* The ringbuffer base class structure.
*/
struct _GstAudioRingBuffer {
GstObject object;
/*< public >*/ /* with LOCK */
GCond cond;
gboolean open;
gboolean acquired;
guint8 *memory;
gsize size;
GstClockTime *timestamps;
GstAudioRingBufferSpec spec;
gint samples_per_seg;
guint8 *empty_seg;
/*< public >*/ /* ATOMIC */
gint state;
gint segdone;
gint segbase;
gint waiting;
/*< private >*/
GstAudioRingBufferCallback callback;
gpointer cb_data;
gboolean need_reorder;
/* gst[channel_reorder_map[i]] = device[i] */
gint channel_reorder_map[64];
gboolean flushing;
/* ATOMIC */
gint may_start;
gboolean active;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstAudioRingBufferClass:
* @parent_class: parent class
* @open_device: open the device, don't set any params or allocate anything
* @acquire: allocate the resources for the ringbuffer using the given spec
* @release: free resources of the ringbuffer
* @close_device: close the device
* @start: start processing of samples
* @pause: pause processing of samples
* @resume: resume processing of samples after pause
* @stop: stop processing of samples
* @delay: get number of samples queued in device
* @activate: activate the thread that starts pulling and monitoring the
* consumed segments in the device.
* @commit: write samples into the ringbuffer
* @clear_all: clear the entire ringbuffer.
*
* The vmethods that subclasses can override to implement the ringbuffer.
*/
struct _GstAudioRingBufferClass {
GstObjectClass parent_class;
/*< public >*/
gboolean (*open_device) (GstAudioRingBuffer *buf);
gboolean (*acquire) (GstAudioRingBuffer *buf, GstAudioRingBufferSpec *spec);
gboolean (*release) (GstAudioRingBuffer *buf);
gboolean (*close_device) (GstAudioRingBuffer *buf);
gboolean (*start) (GstAudioRingBuffer *buf);
gboolean (*pause) (GstAudioRingBuffer *buf);
gboolean (*resume) (GstAudioRingBuffer *buf);
gboolean (*stop) (GstAudioRingBuffer *buf);
guint (*delay) (GstAudioRingBuffer *buf);
/* ABI added */
gboolean (*activate) (GstAudioRingBuffer *buf, gboolean active);
guint (*commit) (GstAudioRingBuffer * buf, guint64 *sample,
guint8 * data, gint in_samples,
gint out_samples, gint * accum);
void (*clear_all) (GstAudioRingBuffer * buf);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_ring_buffer_get_type(void);
/* callback stuff */
void gst_audio_ring_buffer_set_callback (GstAudioRingBuffer *buf,
GstAudioRingBufferCallback cb,
gpointer user_data);
gboolean gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec *spec, GstCaps *caps);
void gst_audio_ring_buffer_debug_spec_caps (GstAudioRingBufferSpec *spec);
void gst_audio_ring_buffer_debug_spec_buff (GstAudioRingBufferSpec *spec);
gboolean gst_audio_ring_buffer_convert (GstAudioRingBuffer * buf, GstFormat src_fmt,
gint64 src_val, GstFormat dest_fmt,
gint64 * dest_val);
/* device state */
gboolean gst_audio_ring_buffer_open_device (GstAudioRingBuffer *buf);
gboolean gst_audio_ring_buffer_close_device (GstAudioRingBuffer *buf);
gboolean gst_audio_ring_buffer_device_is_open (GstAudioRingBuffer *buf);
/* allocate resources */
gboolean gst_audio_ring_buffer_acquire (GstAudioRingBuffer *buf, GstAudioRingBufferSpec *spec);
gboolean gst_audio_ring_buffer_release (GstAudioRingBuffer *buf);
gboolean gst_audio_ring_buffer_is_acquired (GstAudioRingBuffer *buf);
/* set the device channel positions */
void gst_audio_ring_buffer_set_channel_positions (GstAudioRingBuffer *buf, const GstAudioChannelPosition *position);
/* activating */
gboolean gst_audio_ring_buffer_activate (GstAudioRingBuffer *buf, gboolean active);
gboolean gst_audio_ring_buffer_is_active (GstAudioRingBuffer *buf);
/* flushing */
void gst_audio_ring_buffer_set_flushing (GstAudioRingBuffer *buf, gboolean flushing);
gboolean gst_audio_ring_buffer_is_flushing (GstAudioRingBuffer *buf);
/* playback/pause */
gboolean gst_audio_ring_buffer_start (GstAudioRingBuffer *buf);
gboolean gst_audio_ring_buffer_pause (GstAudioRingBuffer *buf);
gboolean gst_audio_ring_buffer_stop (GstAudioRingBuffer *buf);
/* get status */
guint gst_audio_ring_buffer_delay (GstAudioRingBuffer *buf);
guint64 gst_audio_ring_buffer_samples_done (GstAudioRingBuffer *buf);
void gst_audio_ring_buffer_set_sample (GstAudioRingBuffer *buf, guint64 sample);
/* clear all segments */
void gst_audio_ring_buffer_clear_all (GstAudioRingBuffer *buf);
/* commit samples */
guint gst_audio_ring_buffer_commit (GstAudioRingBuffer * buf, guint64 *sample,
guint8 * data, gint in_samples,
gint out_samples, gint * accum);
/* read samples */
guint gst_audio_ring_buffer_read (GstAudioRingBuffer *buf, guint64 sample,
guint8 *data, guint len, GstClockTime *timestamp);
/* Set timestamp on buffer */
void gst_audio_ring_buffer_set_timestamp (GstAudioRingBuffer * buf, gint readseg, GstClockTime
timestamp);
/* mostly protected */
/* not yet implemented
gboolean gst_audio_ring_buffer_prepare_write (GstAudioRingBuffer *buf, gint *segment, guint8 **writeptr, gint *len);
*/
gboolean gst_audio_ring_buffer_prepare_read (GstAudioRingBuffer *buf, gint *segment,
guint8 **readptr, gint *len);
void gst_audio_ring_buffer_clear (GstAudioRingBuffer *buf, gint segment);
void gst_audio_ring_buffer_advance (GstAudioRingBuffer *buf, guint advance);
void gst_audio_ring_buffer_may_start (GstAudioRingBuffer *buf, gboolean allowed);
G_END_DECLS
#endif /* __GST_AUDIO_RING_BUFFER_H__ */
@@ -0,0 +1,100 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstaudiosink.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_SINK_H__
#define __GST_AUDIO_SINK_H__
#include <gst/gst.h>
#include <gst/audio/gstaudiobasesink.h>
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_SINK (gst_audio_sink_get_type())
#define GST_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SINK,GstAudioSink))
#define GST_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
#define GST_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
#define GST_IS_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SINK))
#define GST_IS_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SINK))
typedef struct _GstAudioSink GstAudioSink;
typedef struct _GstAudioSinkClass GstAudioSinkClass;
/**
* GstAudioSink:
*
* Opaque #GstAudioSink.
*/
struct _GstAudioSink {
GstAudioBaseSink element;
/*< private >*/ /* with LOCK */
GThread *thread;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstAudioSinkClass:
* @parent_class: the parent class structure.
* @open: Open the device. No configuration needs to be done at this point.
* This function is also used to check if the device is available.
* @prepare: Prepare the device to operate with the specified parameters.
* @unprepare: Undo operations done in prepare.
* @close: Close the device.
* @write: Write data to the device.
* @delay: Return how many samples are still in the device. This is used to
* drive the synchronisation.
* @reset: Returns as quickly as possible from a write and flush any pending
* samples from the device.
*
* #GstAudioSink class. Override the vmethods to implement functionality.
*/
struct _GstAudioSinkClass {
GstAudioBaseSinkClass parent_class;
/* vtable */
/* open the device with given specs */
gboolean (*open) (GstAudioSink *sink);
/* prepare resources and state to operate with the given specs */
gboolean (*prepare) (GstAudioSink *sink, GstAudioRingBufferSpec *spec);
/* undo anything that was done in prepare() */
gboolean (*unprepare) (GstAudioSink *sink);
/* close the device */
gboolean (*close) (GstAudioSink *sink);
/* write samples to the device */
gint (*write) (GstAudioSink *sink, gpointer data, guint length);
/* get number of samples queued in the device */
guint (*delay) (GstAudioSink *sink);
/* reset the audio device, unblock from a write */
void (*reset) (GstAudioSink *sink);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_sink_get_type(void);
G_END_DECLS
#endif /* __GST_AUDIO_SINK_H__ */
@@ -0,0 +1,99 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstaudiosrc.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_SRC_H__
#define __GST_AUDIO_SRC_H__
#include <gst/gst.h>
#include <gst/audio/gstaudiobasesrc.h>
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_SRC (gst_audio_src_get_type())
#define GST_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SRC,GstAudioSrc))
#define GST_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
#define GST_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
#define GST_IS_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SRC))
#define GST_IS_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SRC))
typedef struct _GstAudioSrc GstAudioSrc;
typedef struct _GstAudioSrcClass GstAudioSrcClass;
/**
* GstAudioSrc:
*
* Base class for simple audio sources.
*/
struct _GstAudioSrc {
GstAudioBaseSrc element;
/*< private >*/ /* with LOCK */
GThread *thread;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstAudioSrcClass:
* @parent_class: the parent class.
* @open: open the device with the specified caps
* @prepare: configure device with format
* @unprepare: undo the configuration
* @close: close the device
* @read: read samples to the audio device
* @delay: the number of samples queued in the device
* @reset: unblock a read to the device and reset.
*
* #GstAudioSrc class. Override the vmethod to implement
* functionality.
*/
struct _GstAudioSrcClass {
GstAudioBaseSrcClass parent_class;
/* vtable */
/* open the device with given specs */
gboolean (*open) (GstAudioSrc *src);
/* prepare resources and state to operate with the given specs */
gboolean (*prepare) (GstAudioSrc *src, GstAudioRingBufferSpec *spec);
/* undo anything that was done in prepare() */
gboolean (*unprepare) (GstAudioSrc *src);
/* close the device */
gboolean (*close) (GstAudioSrc *src);
/* read samples from the device */
guint (*read) (GstAudioSrc *src, gpointer data, guint length,
GstClockTime *timestamp);
/* get number of samples queued in the device */
guint (*delay) (GstAudioSrc *src);
/* reset the audio device, unblock from a write */
void (*reset) (GstAudioSrc *src);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_src_get_type(void);
G_END_DECLS
#endif /* __GST_AUDIO_SRC_H__ */
@@ -0,0 +1,82 @@
/* GStreamer StreamVolume
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_STREAM_VOLUME_H__
#define __GST_STREAM_VOLUME_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_STREAM_VOLUME \
(gst_stream_volume_get_type ())
#define GST_STREAM_VOLUME(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM_VOLUME, GstStreamVolume))
#define GST_STREAM_VOLUME_INTERFACE(iface) \
(G_TYPE_CHECK_INTERFACE_CAST ((iface), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface))
#define GST_IS_STREAM_VOLUME(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM_VOLUME))
#define GST_IS_STREAM_VOLUME_INTERFACE(iface) \
(G_TYPE_CHECK_INTERFACE_TYPE ((iface), GST_TYPE_STREAM_VOLUME))
#define GST_STREAM_VOLUME_GET_INTERFACE(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface))
typedef struct _GstStreamVolume GstStreamVolume;
typedef struct _GstStreamVolumeInterface GstStreamVolumeInterface;
struct _GstStreamVolumeInterface {
GTypeInterface iface;
};
/**
* GstStreamVolumeFormat:
* @GST_STREAM_VOLUME_FORMAT_LINEAR: Linear scale factor, 1.0 = 100%
* @GST_STREAM_VOLUME_FORMAT_CUBIC: Cubic volume scale
* @GST_STREAM_VOLUME_FORMAT_DB: Logarithmic volume scale (dB, amplitude not power)
*
* Different representations of a stream volume. gst_stream_volume_convert_volume()
* allows to convert between the different representations.
*
* Formulas to convert from a linear to a cubic or dB volume are
* cbrt(val) and 20 * log10 (val).
*/
typedef enum {
GST_STREAM_VOLUME_FORMAT_LINEAR = 0,
GST_STREAM_VOLUME_FORMAT_CUBIC,
GST_STREAM_VOLUME_FORMAT_DB
} GstStreamVolumeFormat;
GType gst_stream_volume_get_type (void);
void gst_stream_volume_set_volume (GstStreamVolume *volume,
GstStreamVolumeFormat format,
gdouble val);
gdouble gst_stream_volume_get_volume (GstStreamVolume *volume,
GstStreamVolumeFormat format);
void gst_stream_volume_set_mute (GstStreamVolume *volume,
gboolean mute);
gboolean gst_stream_volume_get_mute (GstStreamVolume *volume);
gdouble gst_stream_volume_convert_volume (GstStreamVolumeFormat from,
GstStreamVolumeFormat to,
gdouble val) G_GNUC_CONST;
G_END_DECLS
#endif /* __GST_STREAM_VOLUME_H__ */
@@ -0,0 +1,77 @@
/* GStreamer
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
#ifndef __GST_ADAPTER_H__
#define __GST_ADAPTER_H__
G_BEGIN_DECLS
#define GST_TYPE_ADAPTER \
(gst_adapter_get_type())
#define GST_ADAPTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ADAPTER, GstAdapter))
#define GST_ADAPTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ADAPTER, GstAdapterClass))
#define GST_ADAPTER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ADAPTER, GstAdapterClass))
#define GST_IS_ADAPTER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ADAPTER))
#define GST_IS_ADAPTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ADAPTER))
/**
* GstAdapter:
*
* The opaque #GstAdapter data structure.
*/
typedef struct _GstAdapter GstAdapter;
typedef struct _GstAdapterClass GstAdapterClass;
GType gst_adapter_get_type (void);
GstAdapter * gst_adapter_new (void) G_GNUC_MALLOC;
void gst_adapter_clear (GstAdapter *adapter);
void gst_adapter_push (GstAdapter *adapter, GstBuffer* buf);
gconstpointer gst_adapter_map (GstAdapter *adapter, gsize size);
void gst_adapter_unmap (GstAdapter *adapter);
void gst_adapter_copy (GstAdapter *adapter, gpointer dest,
gsize offset, gsize size);
void gst_adapter_flush (GstAdapter *adapter, gsize flush);
gpointer gst_adapter_take (GstAdapter *adapter, gsize nbytes);
GstBuffer* gst_adapter_take_buffer (GstAdapter *adapter, gsize nbytes);
GList* gst_adapter_take_list (GstAdapter *adapter, gsize nbytes);
gsize gst_adapter_available (GstAdapter *adapter);
gsize gst_adapter_available_fast (GstAdapter *adapter);
GstClockTime gst_adapter_prev_pts (GstAdapter *adapter, guint64 *distance);
GstClockTime gst_adapter_prev_dts (GstAdapter *adapter, guint64 *distance);
gsize gst_adapter_masked_scan_uint32 (GstAdapter * adapter, guint32 mask,
guint32 pattern, gsize offset, gsize size);
gsize gst_adapter_masked_scan_uint32_peek (GstAdapter * adapter, guint32 mask,
guint32 pattern, gsize offset, gsize size, guint32 * value);
G_END_DECLS
#endif /* __GST_ADAPTER_H__ */
@@ -0,0 +1,329 @@
/* GStreamer
* Copyright (C) 2008 Nokia Corporation. All rights reserved.
*
* Contact: Stefan Kost <stefan.kost@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BASE_PARSE_H__
#define __GST_BASE_PARSE_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_BASE_PARSE (gst_base_parse_get_type())
#define GST_BASE_PARSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_PARSE,GstBaseParse))
#define GST_BASE_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_PARSE,GstBaseParseClass))
#define GST_BASE_PARSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_PARSE,GstBaseParseClass))
#define GST_IS_BASE_PARSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_PARSE))
#define GST_IS_BASE_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_PARSE))
#define GST_BASE_PARSE_CAST(obj) ((GstBaseParse *)(obj))
/**
* GST_BASE_PARSE_SRC_PAD:
* @obj: base parse instance
*
* Gives the pointer to the source #GstPad object of the element.
*/
#define GST_BASE_PARSE_SRC_PAD(obj) (GST_BASE_PARSE_CAST (obj)->srcpad)
/**
* GST_BASE_PARSE_SINK_PAD:
* @obj: base parse instance
*
* Gives the pointer to the sink #GstPad object of the element.
*/
#define GST_BASE_PARSE_SINK_PAD(obj) (GST_BASE_PARSE_CAST (obj)->sinkpad)
/**
* GST_BASE_PARSE_FLOW_DROPPED:
*
* A #GstFlowReturn that can be returned from parse_frame to
* indicate that no output buffer was generated, or from pre_push_frame to
* to forego pushing buffer.
*/
#define GST_BASE_PARSE_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS
/* not public API, use accessor macros below */
#define GST_BASE_PARSE_FLAG_LOST_SYNC (1 << 0)
#define GST_BASE_PARSE_FLAG_DRAINING (1 << 1)
/**
* GST_BASE_PARSE_LOST_SYNC:
* @parse: base parse instance
*
* Obtains current sync status.
*/
#define GST_BASE_PARSE_LOST_SYNC(parse) (!!(GST_BASE_PARSE_CAST(parse)->flags & GST_BASE_PARSE_FLAG_LOST_SYNC))
/**
* GST_BASE_PARSE_DRAINING:
* @parse: base parse instance
*
* Obtains current drain status (ie. whether EOS has been received and
* the parser is now processing the frames at the end of the stream)
*/
#define GST_BASE_PARSE_DRAINING(parse) (!!(GST_BASE_PARSE_CAST(parse)->flags & GST_BASE_PARSE_FLAG_DRAINING))
/**
* GstBaseParseFrameFlags:
* @GST_BASE_PARSE_FRAME_FLAG_NONE: no flag
* @GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME: set by baseclass if current frame
* is passed for processing to the subclass for the first time
* (and not set on subsequent calls with same data).
* @GST_BASE_PARSE_FRAME_FLAG_NO_FRAME: set to indicate this buffer should not be
* counted as frame, e.g. if this frame is dependent on a previous one.
* As it is not counted as a frame, bitrate increases but frame to time
* conversions are maintained.
* @GST_BASE_PARSE_FRAME_FLAG_CLIP: @pre_push_frame can set this to indicate
* that regular segment clipping can still be performed (as opposed to
* any custom one having been done).
* @GST_BASE_PARSE_FRAME_FLAG_DROP: indicates to @finish_frame that the
* the frame should be dropped (and might be handled internall by subclass)
* @GST_BASE_PARSE_FRAME_FLAG_QUEUE: indicates to @finish_frame that the
* the frame should be queued for now and processed fully later
* when the first non-queued frame is finished
*
* Flags to be used in a #GstBaseParseFrame.
*/
typedef enum {
GST_BASE_PARSE_FRAME_FLAG_NONE = 0,
GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME = (1 << 0),
GST_BASE_PARSE_FRAME_FLAG_NO_FRAME = (1 << 1),
GST_BASE_PARSE_FRAME_FLAG_CLIP = (1 << 2),
GST_BASE_PARSE_FRAME_FLAG_DROP = (1 << 3),
GST_BASE_PARSE_FRAME_FLAG_QUEUE = (1 << 4)
} GstBaseParseFrameFlags;
/**
* GstBaseParseFrame:
* @buffer: input data to be parsed for frames.
* @out_buffer: (optional) (replacement) output data.
* @offset: media specific offset of input frame
* Note that a converter may have a different one on the frame's buffer.
* @overhead: subclass can set this to indicates the metadata overhead
* for the given frame, which is then used to enable more accurate bitrate
* computations. If this is -1, it is assumed that this frame should be
* skipped in bitrate calculation.
* @flags: a combination of input and output #GstBaseParseFrameFlags that
* convey additional context to subclass or allow subclass to tune
* subsequent #GstBaseParse actions.
*
* Frame (context) data passed to each frame parsing virtual methods. In
* addition to providing the data to be checked for a valid frame or an already
* identified frame, it conveys additional metadata or control information
* from and to the subclass w.r.t. the particular frame in question (rather
* than global parameters). Some of these may apply to each parsing stage, others
* only to some a particular one. These parameters are effectively zeroed at start
* of each frame's processing, i.e. parsing virtual method invocation sequence.
*/
typedef struct {
GstBuffer * buffer;
GstBuffer * out_buffer;
guint flags;
guint64 offset;
gint overhead;
/*< private >*/
gint size;
guint _gst_reserved_i[2];
gpointer _gst_reserved_p[2];
guint _private_flags;
} GstBaseParseFrame;
typedef struct _GstBaseParse GstBaseParse;
typedef struct _GstBaseParseClass GstBaseParseClass;
typedef struct _GstBaseParsePrivate GstBaseParsePrivate;
/**
* GstBaseParse:
* @element: the parent element.
*
* The opaque #GstBaseParse data structure.
*/
struct _GstBaseParse {
GstElement element;
/*< protected >*/
/* source and sink pads */
GstPad *sinkpad;
GstPad *srcpad;
guint flags;
/* MT-protected (with STREAM_LOCK) */
GstSegment segment;
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
GstBaseParsePrivate *priv;
};
/**
* GstBaseParseClass:
* @parent_class: the parent class
* @start: Optional.
* Called when the element starts processing.
* Allows opening external resources.
* @stop: Optional.
* Called when the element stops processing.
* Allows closing external resources.
* @set_sink_caps: allows the subclass to be notified of the actual caps set.
* @get_sink_caps: allows the subclass to do its own sink get caps if needed.
* @handle_frame: Parses the input data into valid frames as defined by subclass
* which should be passed to gst_base_parse_finish_frame().
* The frame's input buffer is guaranteed writable,
* whereas the input frame ownership is held by caller
* (so subclass should make a copy if it needs to hang on).
* Input buffer (data) is provided by baseclass with as much
* metadata set as possible by baseclass according to upstream
* information and/or subclass settings,
* though subclass may still set buffer timestamp and duration
* if desired.
* @convert: Optional.
* Convert between formats.
* @sink_event: Optional.
* Event handler on the sink pad. This function should chain
* up to the parent implementation to let the default handler
* run.
* @src_event: Optional.
* Event handler on the source pad. Should chain up to the
* parent to let the default handler run.
* @pre_push_frame: Optional.
* Called just prior to pushing a frame (after any pending
* events have been sent) to give subclass a chance to perform
* additional actions at this time (e.g. tag sending) or to
* decide whether this buffer should be dropped or not
* (e.g. custom segment clipping).
* @detect: Optional.
* Called until it doesn't return GST_FLOW_OK anymore for
* the first buffers. Can be used by the subclass to detect
* the stream format.
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum @check_valid_frame and @parse_frame needs to be
* overridden.
*/
struct _GstBaseParseClass {
GstElementClass parent_class;
/*< public >*/
/* virtual methods for subclasses */
gboolean (*start) (GstBaseParse * parse);
gboolean (*stop) (GstBaseParse * parse);
gboolean (*set_sink_caps) (GstBaseParse * parse,
GstCaps * caps);
GstFlowReturn (*handle_frame) (GstBaseParse * parse,
GstBaseParseFrame * frame,
gint * skipsize);
GstFlowReturn (*pre_push_frame) (GstBaseParse * parse,
GstBaseParseFrame * frame);
gboolean (*convert) (GstBaseParse * parse,
GstFormat src_format,
gint64 src_value,
GstFormat dest_format,
gint64 * dest_value);
gboolean (*sink_event) (GstBaseParse * parse,
GstEvent * event);
gboolean (*src_event) (GstBaseParse * parse,
GstEvent * event);
GstCaps * (*get_sink_caps) (GstBaseParse * parse,
GstCaps * filter);
GstFlowReturn (*detect) (GstBaseParse * parse,
GstBuffer * buffer);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
GType gst_base_parse_get_type (void);
GType gst_base_parse_frame_get_type (void);
GstBaseParseFrame * gst_base_parse_frame_new (GstBuffer * buffer,
GstBaseParseFrameFlags flags,
gint overhead);
void gst_base_parse_frame_init (GstBaseParseFrame * frame);
void gst_base_parse_frame_free (GstBaseParseFrame * frame);
GstFlowReturn gst_base_parse_push_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
GstFlowReturn gst_base_parse_finish_frame (GstBaseParse * parse,
GstBaseParseFrame * frame,
gint size);
void gst_base_parse_set_duration (GstBaseParse * parse,
GstFormat fmt,
gint64 duration,
gint interval);
void gst_base_parse_set_average_bitrate (GstBaseParse * parse,
guint bitrate);
void gst_base_parse_set_min_frame_size (GstBaseParse * parse,
guint min_size);
void gst_base_parse_set_has_timing_info (GstBaseParse * parse,
gboolean has_timing);
void gst_base_parse_set_syncable (GstBaseParse * parse,
gboolean syncable);
void gst_base_parse_set_passthrough (GstBaseParse * parse,
gboolean passthrough);
void gst_base_parse_set_pts_interpolation (GstBaseParse * parse,
gboolean pts_interpolate);
void gst_base_parse_set_frame_rate (GstBaseParse * parse,
guint fps_num,
guint fps_den,
guint lead_in,
guint lead_out);
void gst_base_parse_set_latency (GstBaseParse * parse,
GstClockTime min_latency,
GstClockTime max_latency);
gboolean gst_base_parse_convert_default (GstBaseParse * parse,
GstFormat src_format,
gint64 src_value,
GstFormat dest_format,
gint64 * dest_value);
gboolean gst_base_parse_add_index_entry (GstBaseParse * parse,
guint64 offset,
GstClockTime ts,
gboolean key,
gboolean force);
G_END_DECLS
#endif /* __GST_BASE_PARSE_H__ */
@@ -0,0 +1,255 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstbasesink.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BASE_SINK_H__
#define __GST_BASE_SINK_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_BASE_SINK (gst_base_sink_get_type())
#define GST_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_SINK,GstBaseSink))
#define GST_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_SINK,GstBaseSinkClass))
#define GST_BASE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SINK, GstBaseSinkClass))
#define GST_IS_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SINK))
#define GST_IS_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SINK))
#define GST_BASE_SINK_CAST(obj) ((GstBaseSink *) (obj))
/**
* GST_BASE_SINK_PAD:
* @obj: base sink instance
*
* Gives the pointer to the #GstPad object of the element.
*/
#define GST_BASE_SINK_PAD(obj) (GST_BASE_SINK_CAST (obj)->sinkpad)
#define GST_BASE_SINK_GET_PREROLL_LOCK(pad) (&GST_BASE_SINK_CAST(pad)->preroll_lock)
#define GST_BASE_SINK_PREROLL_LOCK(pad) (g_mutex_lock(GST_BASE_SINK_GET_PREROLL_LOCK(pad)))
#define GST_BASE_SINK_PREROLL_TRYLOCK(pad) (g_mutex_trylock(GST_BASE_SINK_GET_PREROLL_LOCK(pad)))
#define GST_BASE_SINK_PREROLL_UNLOCK(pad) (g_mutex_unlock(GST_BASE_SINK_GET_PREROLL_LOCK(pad)))
#define GST_BASE_SINK_GET_PREROLL_COND(pad) (&GST_BASE_SINK_CAST(pad)->preroll_cond)
#define GST_BASE_SINK_PREROLL_WAIT(pad) \
g_cond_wait (GST_BASE_SINK_GET_PREROLL_COND (pad), GST_BASE_SINK_GET_PREROLL_LOCK (pad))
#define GST_BASE_SINK_PREROLL_WAIT_UNTIL(pad, end_time) \
g_cond_wait_until (GST_BASE_SINK_GET_PREROLL_COND (pad), GST_BASE_SINK_GET_PREROLL_LOCK (pad), end_time)
#define GST_BASE_SINK_PREROLL_SIGNAL(pad) g_cond_signal (GST_BASE_SINK_GET_PREROLL_COND (pad));
#define GST_BASE_SINK_PREROLL_BROADCAST(pad) g_cond_broadcast (GST_BASE_SINK_GET_PREROLL_COND (pad));
typedef struct _GstBaseSink GstBaseSink;
typedef struct _GstBaseSinkClass GstBaseSinkClass;
typedef struct _GstBaseSinkPrivate GstBaseSinkPrivate;
/**
* GstBaseSink:
*
* The opaque #GstBaseSink data structure.
*/
struct _GstBaseSink {
GstElement element;
/*< protected >*/
GstPad *sinkpad;
GstPadMode pad_mode;
/*< protected >*/ /* with LOCK */
guint64 offset;
gboolean can_activate_pull;
gboolean can_activate_push;
/*< protected >*/ /* with PREROLL_LOCK */
GMutex preroll_lock;
GCond preroll_cond;
gboolean eos;
gboolean need_preroll;
gboolean have_preroll;
gboolean playing_async;
/*< protected >*/ /* with STREAM_LOCK */
gboolean have_newsegment;
GstSegment segment;
/*< private >*/ /* with LOCK */
GstClockID clock_id;
gboolean sync;
gboolean flushing;
gboolean running;
gint64 max_lateness;
/*< private >*/
GstBaseSinkPrivate *priv;
gpointer _gst_reserved[GST_PADDING_LARGE];
};
/**
* GstBaseSinkClass:
* @parent_class: Element parent class
* @get_caps: Called to get sink pad caps from the subclass
* @set_caps: Notify subclass of changed caps
* @fixate: Only useful in pull mode. Implement if you have
* ideas about what should be the default values for the caps you support.
* @activate_pull: Subclasses should override this when they can provide an
* alternate method of spawning a thread to drive the pipeline in pull mode.
* Should start or stop the pulling thread, depending on the value of the
* "active" argument. Called after actually activating the sink pad in pull
* mode. The default implementation starts a task on the sink pad.
* @get_times: Called to get the start and end times for synchronising
* the passed buffer to the clock
* @propose_allocation: configure the allocation query
* @start: Start processing. Ideal for opening resources in the subclass
* @stop: Stop processing. Subclasses should use this to close resources.
* @unlock: Unlock any pending access to the resource. Subclasses should
* unblock any blocked function ASAP
* @unlock_stop: Clear the previous unlock request. Subclasses should clear
* any state they set during unlock(), such as clearing command queues.
* @query: perform a #GstQuery on the element.
* @event: Override this to handle events arriving on the sink pad
* @wait_event: Override this to implement custom logic to wait for the event
* time (for events like EOS and GAP). Subclasses should always first
* chain up to the default implementation.
* @prepare: Called to prepare the buffer for @render and @preroll. This
* function is called before synchronisation is performed.
* @prepare_list: Called to prepare the buffer list for @render_list. This
* function is called before synchronisation is performed.
* @preroll: Called to present the preroll buffer if desired.
* @render: Called when a buffer should be presented or output, at the
* correct moment if the #GstBaseSink has been set to sync to the clock.
* @render_list: Same as @render but used whith buffer lists instead of
* buffers.
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At the minimum, the @render method should be overridden to
* output/present buffers.
*/
struct _GstBaseSinkClass {
GstElementClass parent_class;
/* get caps from subclass */
GstCaps* (*get_caps) (GstBaseSink *sink, GstCaps *filter);
/* notify subclass of new caps */
gboolean (*set_caps) (GstBaseSink *sink, GstCaps *caps);
/* fixate sink caps during pull-mode negotiation */
GstCaps * (*fixate) (GstBaseSink *sink, GstCaps *caps);
/* start or stop a pulling thread */
gboolean (*activate_pull)(GstBaseSink *sink, gboolean active);
/* get the start and end times for syncing on this buffer */
void (*get_times) (GstBaseSink *sink, GstBuffer *buffer,
GstClockTime *start, GstClockTime *end);
/* propose allocation parameters for upstream */
gboolean (*propose_allocation) (GstBaseSink *sink, GstQuery *query);
/* start and stop processing, ideal for opening/closing the resource */
gboolean (*start) (GstBaseSink *sink);
gboolean (*stop) (GstBaseSink *sink);
/* unlock any pending access to the resource. subclasses should unlock
* any function ASAP. */
gboolean (*unlock) (GstBaseSink *sink);
/* Clear a previously indicated unlock request not that unlocking is
* complete. Sub-classes should clear any command queue or indicator they
* set during unlock */
gboolean (*unlock_stop) (GstBaseSink *sink);
/* notify subclass of query */
gboolean (*query) (GstBaseSink *sink, GstQuery *query);
/* notify subclass of event */
gboolean (*event) (GstBaseSink *sink, GstEvent *event);
/* wait for eos or gap, subclasses should chain up to parent first */
GstFlowReturn (*wait_event) (GstBaseSink *sink, GstEvent *event);
/* notify subclass of buffer or list before doing sync */
GstFlowReturn (*prepare) (GstBaseSink *sink, GstBuffer *buffer);
GstFlowReturn (*prepare_list) (GstBaseSink *sink, GstBufferList *buffer_list);
/* notify subclass of preroll buffer or real buffer */
GstFlowReturn (*preroll) (GstBaseSink *sink, GstBuffer *buffer);
GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
/* Render a BufferList */
GstFlowReturn (*render_list) (GstBaseSink *sink, GstBufferList *buffer_list);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
GType gst_base_sink_get_type(void);
GstFlowReturn gst_base_sink_do_preroll (GstBaseSink *sink, GstMiniObject *obj);
GstFlowReturn gst_base_sink_wait_preroll (GstBaseSink *sink);
/* synchronizing against the clock */
void gst_base_sink_set_sync (GstBaseSink *sink, gboolean sync);
gboolean gst_base_sink_get_sync (GstBaseSink *sink);
/* dropping late buffers */
void gst_base_sink_set_max_lateness (GstBaseSink *sink, gint64 max_lateness);
gint64 gst_base_sink_get_max_lateness (GstBaseSink *sink);
/* performing QoS */
void gst_base_sink_set_qos_enabled (GstBaseSink *sink, gboolean enabled);
gboolean gst_base_sink_is_qos_enabled (GstBaseSink *sink);
/* doing async state changes */
void gst_base_sink_set_async_enabled (GstBaseSink *sink, gboolean enabled);
gboolean gst_base_sink_is_async_enabled (GstBaseSink *sink);
/* tuning synchronisation */
void gst_base_sink_set_ts_offset (GstBaseSink *sink, GstClockTimeDiff offset);
GstClockTimeDiff gst_base_sink_get_ts_offset (GstBaseSink *sink);
/* last sample */
GstSample * gst_base_sink_get_last_sample (GstBaseSink *sink);
void gst_base_sink_set_last_sample_enabled (GstBaseSink *sink, gboolean enabled);
gboolean gst_base_sink_is_last_sample_enabled (GstBaseSink *sink);
/* latency */
gboolean gst_base_sink_query_latency (GstBaseSink *sink, gboolean *live, gboolean *upstream_live,
GstClockTime *min_latency, GstClockTime *max_latency);
GstClockTime gst_base_sink_get_latency (GstBaseSink *sink);
/* render delay */
void gst_base_sink_set_render_delay (GstBaseSink *sink, GstClockTime delay);
GstClockTime gst_base_sink_get_render_delay (GstBaseSink *sink);
/* blocksize */
void gst_base_sink_set_blocksize (GstBaseSink *sink, guint blocksize);
guint gst_base_sink_get_blocksize (GstBaseSink *sink);
/* throttle-time */
void gst_base_sink_set_throttle_time (GstBaseSink *sink, guint64 throttle);
guint64 gst_base_sink_get_throttle_time (GstBaseSink *sink);
GstClockReturn gst_base_sink_wait_clock (GstBaseSink *sink, GstClockTime time,
GstClockTimeDiff * jitter);
GstFlowReturn gst_base_sink_wait (GstBaseSink *sink, GstClockTime time,
GstClockTimeDiff *jitter);
G_END_DECLS
#endif /* __GST_BASE_SINK_H__ */
@@ -0,0 +1,270 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstbasesrc.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BASE_SRC_H__
#define __GST_BASE_SRC_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_BASE_SRC (gst_base_src_get_type())
#define GST_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_SRC,GstBaseSrc))
#define GST_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_SRC,GstBaseSrcClass))
#define GST_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SRC, GstBaseSrcClass))
#define GST_IS_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SRC))
#define GST_IS_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SRC))
#define GST_BASE_SRC_CAST(obj) ((GstBaseSrc *)(obj))
/**
* GstBaseSrcFlags:
* @GST_BASE_SRC_FLAG_STARTING: has source is starting
* @GST_BASE_SRC_FLAG_STARTED: has source been started
* @GST_BASE_SRC_FLAG_LAST: offset to define more flags
*
* The #GstElement flags that a basesrc element may have.
*/
typedef enum {
GST_BASE_SRC_FLAG_STARTING = (GST_ELEMENT_FLAG_LAST << 0),
GST_BASE_SRC_FLAG_STARTED = (GST_ELEMENT_FLAG_LAST << 1),
/* padding */
GST_BASE_SRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 6)
} GstBaseSrcFlags;
#define GST_BASE_SRC_IS_STARTING(obj) GST_OBJECT_FLAG_IS_SET ((obj), GST_BASE_SRC_FLAG_STARTING)
#define GST_BASE_SRC_IS_STARTED(obj) GST_OBJECT_FLAG_IS_SET ((obj), GST_BASE_SRC_FLAG_STARTED)
typedef struct _GstBaseSrc GstBaseSrc;
typedef struct _GstBaseSrcClass GstBaseSrcClass;
typedef struct _GstBaseSrcPrivate GstBaseSrcPrivate;
/**
* GST_BASE_SRC_PAD:
* @obj: base source instance
*
* Gives the pointer to the #GstPad object of the element.
*/
#define GST_BASE_SRC_PAD(obj) (GST_BASE_SRC_CAST (obj)->srcpad)
/**
* GstBaseSrc:
*
* The opaque #GstBaseSrc data structure.
*/
struct _GstBaseSrc {
GstElement element;
/*< protected >*/
GstPad *srcpad;
/* available to subclass implementations */
/* MT-protected (with LIVE_LOCK) */
GMutex live_lock;
GCond live_cond;
gboolean is_live;
gboolean live_running;
/* MT-protected (with LOCK) */
guint blocksize; /* size of buffers when operating push based */
gboolean can_activate_push; /* some scheduling properties */
gboolean random_access;
GstClockID clock_id; /* for syncing */
/* MT-protected (with STREAM_LOCK *and* OBJECT_LOCK) */
GstSegment segment;
/* MT-protected (with STREAM_LOCK) */
gboolean need_newsegment;
gint num_buffers;
gint num_buffers_left;
gboolean typefind;
gboolean running;
GstEvent *pending_seek;
GstBaseSrcPrivate *priv;
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
/**
* GstBaseSrcClass:
* @parent_class: Element parent class
* @get_caps: Called to get the caps to report
* @negotiate: Negotiated the caps with the peer.
* @fixate: Called during negotiation if caps need fixating. Implement instead of
* setting a fixate function on the source pad.
* @set_caps: Notify subclass of changed output caps
* @decide_allocation: configure the allocation query
* @start: Start processing. Subclasses should open resources and prepare
* to produce data. Implementation should call gst_base_src_start_complete()
* when the operation completes, either from the current thread or any other
* thread that finishes the start operation asynchronously.
* @stop: Stop processing. Subclasses should use this to close resources.
* @get_times: Given a buffer, return the start and stop time when it
* should be pushed out. The base class will sync on the clock using
* these times.
* @get_size: Return the total size of the resource, in the configured format.
* @is_seekable: Check if the source can seek
* @prepare_seek_segment: Prepare the GstSegment that will be passed to the
* do_seek vmethod for executing a seek request. Sub-classes should override
* this if they support seeking in formats other than the configured native
* format. By default, it tries to convert the seek arguments to the
* configured native format and prepare a segment in that format.
* @do_seek: Perform seeking on the resource to the indicated segment.
* @unlock: Unlock any pending access to the resource. Subclasses should
* unblock any blocked function ASAP. In particular, any create() function in
* progress should be unblocked and should return GST_FLOW_FLUSHING. Any
* future @create<!-- -->() function call should also return GST_FLOW_FLUSHING
* until the @unlock_stop<!-- -->() function has been called.
* @unlock_stop: Clear the previous unlock request. Subclasses should clear
* any state they set during unlock(), such as clearing command queues.
* @query: Handle a requested query.
* @event: Override this to implement custom event handling.
* @create: Ask the subclass to create a buffer with offset and size.
* When the subclass returns GST_FLOW_OK, it MUST return a buffer of the
* requested size unless fewer bytes are available because an EOS condition
* is near. No buffer should be returned when the return value is different
* from GST_FLOW_OK. A return value of GST_FLOW_EOS signifies that the
* end of stream is reached. The default implementation will call @alloc and
* then call @fill.
* @alloc: Ask the subclass to allocate a buffer with for offset and size. The
* default implementation will create a new buffer from the negotiated allocator.
* @fill: Ask the subclass to fill the buffer with data for offset and size. The
* passed buffer is guaranteed to hold the requested amount of bytes.
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At the minimum, the @create method should be overridden to produce
* buffers.
*/
struct _GstBaseSrcClass {
GstElementClass parent_class;
/*< public >*/
/* virtual methods for subclasses */
/* get caps from subclass */
GstCaps* (*get_caps) (GstBaseSrc *src, GstCaps *filter);
/* decide on caps */
gboolean (*negotiate) (GstBaseSrc *src);
/* called if, in negotiation, caps need fixating */
GstCaps * (*fixate) (GstBaseSrc *src, GstCaps *caps);
/* notify the subclass of new caps */
gboolean (*set_caps) (GstBaseSrc *src, GstCaps *caps);
/* setup allocation query */
gboolean (*decide_allocation) (GstBaseSrc *src, GstQuery *query);
/* start and stop processing, ideal for opening/closing the resource */
gboolean (*start) (GstBaseSrc *src);
gboolean (*stop) (GstBaseSrc *src);
/* given a buffer, return start and stop time when it should be pushed
* out. The base class will sync on the clock using these times. */
void (*get_times) (GstBaseSrc *src, GstBuffer *buffer,
GstClockTime *start, GstClockTime *end);
/* get the total size of the resource in bytes */
gboolean (*get_size) (GstBaseSrc *src, guint64 *size);
/* check if the resource is seekable */
gboolean (*is_seekable) (GstBaseSrc *src);
/* Prepare the segment on which to perform do_seek(), converting to the
* current basesrc format. */
gboolean (*prepare_seek_segment) (GstBaseSrc *src, GstEvent *seek,
GstSegment *segment);
/* notify subclasses of a seek */
gboolean (*do_seek) (GstBaseSrc *src, GstSegment *segment);
/* unlock any pending access to the resource. subclasses should unlock
* any function ASAP. */
gboolean (*unlock) (GstBaseSrc *src);
/* Clear any pending unlock request, as we succeeded in unlocking */
gboolean (*unlock_stop) (GstBaseSrc *src);
/* notify subclasses of a query */
gboolean (*query) (GstBaseSrc *src, GstQuery *query);
/* notify subclasses of an event */
gboolean (*event) (GstBaseSrc *src, GstEvent *event);
/* ask the subclass to create a buffer with offset and size, the default
* implementation will call alloc and fill. */
GstFlowReturn (*create) (GstBaseSrc *src, guint64 offset, guint size,
GstBuffer **buf);
/* ask the subclass to allocate an output buffer. The default implementation
* will use the negotiated allocator. */
GstFlowReturn (*alloc) (GstBaseSrc *src, guint64 offset, guint size,
GstBuffer **buf);
/* ask the subclass to fill the buffer with data from offset and size */
GstFlowReturn (*fill) (GstBaseSrc *src, guint64 offset, guint size,
GstBuffer *buf);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
GType gst_base_src_get_type (void);
GstFlowReturn gst_base_src_wait_playing (GstBaseSrc *src);
void gst_base_src_set_live (GstBaseSrc *src, gboolean live);
gboolean gst_base_src_is_live (GstBaseSrc *src);
void gst_base_src_set_format (GstBaseSrc *src, GstFormat format);
void gst_base_src_set_dynamic_size (GstBaseSrc * src, gboolean dynamic);
void gst_base_src_set_async (GstBaseSrc *src, gboolean async);
gboolean gst_base_src_is_async (GstBaseSrc *src);
void gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret);
GstFlowReturn gst_base_src_start_wait (GstBaseSrc * basesrc);
gboolean gst_base_src_query_latency (GstBaseSrc *src, gboolean * live,
GstClockTime * min_latency,
GstClockTime * max_latency);
void gst_base_src_set_blocksize (GstBaseSrc *src, guint blocksize);
guint gst_base_src_get_blocksize (GstBaseSrc *src);
void gst_base_src_set_do_timestamp (GstBaseSrc *src, gboolean timestamp);
gboolean gst_base_src_get_do_timestamp (GstBaseSrc *src);
gboolean gst_base_src_new_seamless_segment (GstBaseSrc *src, gint64 start, gint64 stop, gint64 time);
gboolean gst_base_src_set_caps (GstBaseSrc *src, GstCaps *caps);
GstBufferPool * gst_base_src_get_buffer_pool (GstBaseSrc *src);
void gst_base_src_get_allocator (GstBaseSrc *src,
GstAllocator **allocator,
GstAllocationParams *params);
G_END_DECLS
#endif /* __GST_BASE_SRC_H__ */
@@ -0,0 +1,298 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BASE_TRANSFORM_H__
#define __GST_BASE_TRANSFORM_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_BASE_TRANSFORM (gst_base_transform_get_type())
#define GST_BASE_TRANSFORM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransform))
#define GST_BASE_TRANSFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass))
#define GST_BASE_TRANSFORM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass))
#define GST_IS_BASE_TRANSFORM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_TRANSFORM))
#define GST_IS_BASE_TRANSFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_TRANSFORM))
#define GST_BASE_TRANSFORM_CAST(obj) ((GstBaseTransform *)(obj))
/**
* GST_BASE_TRANSFORM_SINK_NAME:
*
* The name of the templates for the sink pad.
*/
#define GST_BASE_TRANSFORM_SINK_NAME "sink"
/**
* GST_BASE_TRANSFORM_SRC_NAME:
*
* The name of the templates for the source pad.
*/
#define GST_BASE_TRANSFORM_SRC_NAME "src"
/**
* GST_BASE_TRANSFORM_SRC_PAD:
* @obj: base transform instance
*
* Gives the pointer to the source #GstPad object of the element.
*/
#define GST_BASE_TRANSFORM_SRC_PAD(obj) (GST_BASE_TRANSFORM_CAST (obj)->srcpad)
/**
* GST_BASE_TRANSFORM_SINK_PAD:
* @obj: base transform instance
*
* Gives the pointer to the sink #GstPad object of the element.
*/
#define GST_BASE_TRANSFORM_SINK_PAD(obj) (GST_BASE_TRANSFORM_CAST (obj)->sinkpad)
/**
* GST_BASE_TRANSFORM_FLOW_DROPPED:
*
* A #GstFlowReturn that can be returned from transform and transform_ip to
* indicate that no output buffer was generated.
*/
#define GST_BASE_TRANSFORM_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS
typedef struct _GstBaseTransform GstBaseTransform;
typedef struct _GstBaseTransformClass GstBaseTransformClass;
typedef struct _GstBaseTransformPrivate GstBaseTransformPrivate;
/**
* GstBaseTransform:
*
* The opaque #GstBaseTransform data structure.
*/
struct _GstBaseTransform {
GstElement element;
/*< protected >*/
/* source and sink pads */
GstPad *sinkpad;
GstPad *srcpad;
/* MT-protected (with STREAM_LOCK) */
gboolean have_segment;
GstSegment segment;
/*< private >*/
GstBaseTransformPrivate *priv;
gpointer _gst_reserved[GST_PADDING_LARGE];
};
/**
* GstBaseTransformClass:
* @parent_class: Element parent class
* @passthrough_on_same_caps: If set to %TRUE, passthrough mode will be
* automatically enabled if the caps are the same.
* Set to %FALSE by default.
* @transform_ip_on_passthrough: If set to %TRUE, @transform_ip will be called in
* passthrough mode. The passed buffer might not be
* writable. When %FALSE, neither @transform nor
* @transform_ip will be called in passthrough mode.
* Set to %TRUE by default.
* @transform_caps: Optional. Given the pad in this direction and the given
* caps, what caps are allowed on the other pad in this
* element ?
* @fixate_caps: Optional. Given the pad in this direction and the given
* caps, fixate the caps on the other pad. The function takes
* ownership of @othercaps and returns a fixated version of
* @othercaps. @othercaps is not guaranteed to be writable.
* @accept_caps: Optional.
* Subclasses can override this method to check if @caps can be
* handled by the element. The default implementation might not be
* the most optimal way to check this in all cases.
* @set_caps: allows the subclass to be notified of the actual caps set.
* @query: Optional.
* Handle a requested query. Subclasses that implement this
* should must chain up to the parent if they didn't handle the
* query
* @decide_allocation: Setup the allocation parameters for allocating output
* buffers. The passed in query contains the result of the
* downstream allocation query. This function is only called
* when not operating in passthrough mode. The default
* implementation will remove all memory dependent metadata.
* If there is ia @filter_meta method implementation, it will
* be called for all metadata API in the downstream query,
* otherwise the metadata API is removed.
* @filter_meta: Return TRUE if the metadata API should be proposed in the
* upstream allocation query. The default implementation is NULL
* and will cause all metadata to be removed.
* @propose_allocation: Propose buffer allocation parameters for upstream elements.
* This function must be implemented if the element reads or
* writes the buffer content. The query that was passed to
* the decide_allocation is passed in this method (or NULL
* when the element is in passthrough mode). The default
* implementation will pass the query downstream when in
* passthrough mode and will copy all the filtered metadata
* API in non-passthrough mode.
* @transform_size: Optional. Given the size of a buffer in the given direction
* with the given caps, calculate the size in bytes of a buffer
* on the other pad with the given other caps.
* The default implementation uses get_unit_size and keeps
* the number of units the same.
* @get_unit_size: Required if the transform is not in-place.
* get the size in bytes of one unit for the given caps.
* @start: Optional.
* Called when the element starts processing.
* Allows opening external resources.
* @stop: Optional.
* Called when the element stops processing.
* Allows closing external resources.
* @sink_event: Optional.
* Event handler on the sink pad. The default implementation
* handles the event and forwards it downstream.
* @src_event: Optional.
* Event handler on the source pad. The default implementation
* handles the event and forwards it upstream.
* @prepare_output_buffer: Optional.
* Subclasses can override this to do their own
* allocation of output buffers. Elements that only do
* analysis can return a subbuffer or even just
* return a reference to the input buffer (if in
* passthrough mode). The default implementation will
* use the negotiated allocator or bufferpool and
* transform_size to allocate an output buffer or it
* will return the input buffer in passthrough mode.
* @copy_metadata: Optional.
* Copy the metadata from the input buffer to the output buffer.
* The default implementation will copy the flags, timestamps and
* offsets of the buffer.
* @transform_meta: Optional. Transform the metadata on the input buffer to the
* output buffer. By default this method is NULL and no
* metadata is copied. subclasses can implement this method and
* return TRUE if the metadata is to be copied.
* @before_transform: Optional.
* This method is called right before the base class will
* start processing. Dynamic properties or other delayed
* configuration could be performed in this method.
* @transform: Required if the element does not operate in-place.
* Transforms one incoming buffer to one outgoing buffer.
* The function is allowed to change size/timestamp/duration
* of the outgoing buffer.
* @transform_ip: Required if the element operates in-place.
* Transform the incoming buffer in-place.
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum either @transform or @transform_ip need to be overridden.
* If the element can overwrite the input data with the results (data is of the
* same type and quantity) it should provide @transform_ip.
*/
struct _GstBaseTransformClass {
GstElementClass parent_class;
/*< public >*/
gboolean passthrough_on_same_caps;
gboolean transform_ip_on_passthrough;
/* virtual methods for subclasses */
GstCaps* (*transform_caps) (GstBaseTransform *trans,
GstPadDirection direction,
GstCaps *caps, GstCaps *filter);
GstCaps* (*fixate_caps) (GstBaseTransform *trans,
GstPadDirection direction, GstCaps *caps,
GstCaps *othercaps);
gboolean (*accept_caps) (GstBaseTransform *trans, GstPadDirection direction,
GstCaps *caps);
gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps,
GstCaps *outcaps);
gboolean (*query) (GstBaseTransform *trans, GstPadDirection direction,
GstQuery *query);
/* decide allocation query for output buffers */
gboolean (*decide_allocation) (GstBaseTransform *trans, GstQuery *query);
gboolean (*filter_meta) (GstBaseTransform *trans, GstQuery *query,
GType api, const GstStructure *params);
/* propose allocation query parameters for input buffers */
gboolean (*propose_allocation) (GstBaseTransform *trans, GstQuery *decide_query,
GstQuery *query);
/* transform size */
gboolean (*transform_size) (GstBaseTransform *trans,
GstPadDirection direction,
GstCaps *caps, gsize size,
GstCaps *othercaps, gsize *othersize);
gboolean (*get_unit_size) (GstBaseTransform *trans, GstCaps *caps,
gsize *size);
/* states */
gboolean (*start) (GstBaseTransform *trans);
gboolean (*stop) (GstBaseTransform *trans);
/* sink and src pad event handlers */
gboolean (*sink_event) (GstBaseTransform *trans, GstEvent *event);
gboolean (*src_event) (GstBaseTransform *trans, GstEvent *event);
GstFlowReturn (*prepare_output_buffer) (GstBaseTransform * trans,
GstBuffer *input, GstBuffer **outbuf);
/* metadata */
gboolean (*copy_metadata) (GstBaseTransform *trans, GstBuffer *input,
GstBuffer *outbuf);
gboolean (*transform_meta) (GstBaseTransform *trans, GstBuffer *outbuf,
GstMeta *meta, GstBuffer *inbuf);
void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer);
/* transform */
GstFlowReturn (*transform) (GstBaseTransform *trans, GstBuffer *inbuf,
GstBuffer *outbuf);
GstFlowReturn (*transform_ip) (GstBaseTransform *trans, GstBuffer *buf);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
GType gst_base_transform_get_type (void);
void gst_base_transform_set_passthrough (GstBaseTransform *trans,
gboolean passthrough);
gboolean gst_base_transform_is_passthrough (GstBaseTransform *trans);
void gst_base_transform_set_in_place (GstBaseTransform *trans,
gboolean in_place);
gboolean gst_base_transform_is_in_place (GstBaseTransform *trans);
void gst_base_transform_update_qos (GstBaseTransform *trans,
gdouble proportion,
GstClockTimeDiff diff,
GstClockTime timestamp);
void gst_base_transform_set_qos_enabled (GstBaseTransform *trans,
gboolean enabled);
gboolean gst_base_transform_is_qos_enabled (GstBaseTransform *trans);
void gst_base_transform_set_gap_aware (GstBaseTransform *trans,
gboolean gap_aware);
void gst_base_transform_set_prefer_passthrough (GstBaseTransform *trans,
gboolean prefer_passthrough);
GstBufferPool * gst_base_transform_get_buffer_pool (GstBaseTransform *trans);
void gst_base_transform_get_allocator (GstBaseTransform *trans,
GstAllocator **allocator,
GstAllocationParams *params);
void gst_base_transform_reconfigure_sink (GstBaseTransform *trans);
void gst_base_transform_reconfigure_src (GstBaseTransform *trans);
G_END_DECLS
#endif /* __GST_BASE_TRANSFORM_H__ */
@@ -0,0 +1,301 @@
/* GStreamer
*
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BIT_READER_H__
#define __GST_BIT_READER_H__
#include <gst/gst.h>
/* FIXME: inline functions */
G_BEGIN_DECLS
#define GST_BIT_READER(reader) ((GstBitReader *) (reader))
/**
* GstBitReader:
* @data: (array length=size): Data from which the bit reader will
* read
* @size: Size of @data in bytes
* @byte: Current byte position
* @bit: Bit position in the current byte
*
* A bit reader instance.
*/
typedef struct {
const guint8 *data;
guint size;
guint byte; /* Byte position */
guint bit; /* Bit position in the current byte */
/* < private > */
gpointer _gst_reserved[GST_PADDING];
} GstBitReader;
GstBitReader * gst_bit_reader_new (const guint8 *data, guint size) G_GNUC_MALLOC;
void gst_bit_reader_free (GstBitReader *reader);
void gst_bit_reader_init (GstBitReader *reader, const guint8 *data, guint size);
gboolean gst_bit_reader_set_pos (GstBitReader *reader, guint pos);
guint gst_bit_reader_get_pos (const GstBitReader *reader);
guint gst_bit_reader_get_remaining (const GstBitReader *reader);
guint gst_bit_reader_get_size (const GstBitReader *reader);
gboolean gst_bit_reader_skip (GstBitReader *reader, guint nbits);
gboolean gst_bit_reader_skip_to_byte (GstBitReader *reader);
gboolean gst_bit_reader_get_bits_uint8 (GstBitReader *reader, guint8 *val, guint nbits);
gboolean gst_bit_reader_get_bits_uint16 (GstBitReader *reader, guint16 *val, guint nbits);
gboolean gst_bit_reader_get_bits_uint32 (GstBitReader *reader, guint32 *val, guint nbits);
gboolean gst_bit_reader_get_bits_uint64 (GstBitReader *reader, guint64 *val, guint nbits);
gboolean gst_bit_reader_peek_bits_uint8 (const GstBitReader *reader, guint8 *val, guint nbits);
gboolean gst_bit_reader_peek_bits_uint16 (const GstBitReader *reader, guint16 *val, guint nbits);
gboolean gst_bit_reader_peek_bits_uint32 (const GstBitReader *reader, guint32 *val, guint nbits);
gboolean gst_bit_reader_peek_bits_uint64 (const GstBitReader *reader, guint64 *val, guint nbits);
/**
* GST_BIT_READER_INIT:
* @data: Data from which the #GstBitReader should read
* @size: Size of @data in bytes
*
* A #GstBitReader must be initialized with this macro, before it can be
* used. This macro can used be to initialize a variable, but it cannot
* be assigned to a variable. In that case you have to use
* gst_bit_reader_init().
*/
#define GST_BIT_READER_INIT(data, size) {data, size, 0, 0}
/* Unchecked variants */
static inline void
gst_bit_reader_skip_unchecked (GstBitReader * reader, guint nbits)
{
reader->bit += nbits;
reader->byte += reader->bit / 8;
reader->bit = reader->bit % 8;
}
static inline void
gst_bit_reader_skip_to_byte_unchecked (GstBitReader * reader)
{
if (reader->bit) {
reader->bit = 0;
reader->byte++;
}
}
#define __GST_BIT_READER_READ_BITS_UNCHECKED(bits) \
static inline guint##bits \
gst_bit_reader_peek_bits_uint##bits##_unchecked (const GstBitReader *reader, guint nbits) \
{ \
guint##bits ret = 0; \
const guint8 *data; \
guint byte, bit; \
\
data = reader->data; \
byte = reader->byte; \
bit = reader->bit; \
\
while (nbits > 0) { \
guint toread = MIN (nbits, 8 - bit); \
\
ret <<= toread; \
ret |= (data[byte] & (0xff >> bit)) >> (8 - toread - bit); \
\
bit += toread; \
if (bit >= 8) { \
byte++; \
bit = 0; \
} \
nbits -= toread; \
} \
\
return ret; \
} \
\
static inline guint##bits \
gst_bit_reader_get_bits_uint##bits##_unchecked (GstBitReader *reader, guint nbits) \
{ \
guint##bits ret; \
\
ret = gst_bit_reader_peek_bits_uint##bits##_unchecked (reader, nbits); \
\
gst_bit_reader_skip_unchecked (reader, nbits); \
\
return ret; \
}
__GST_BIT_READER_READ_BITS_UNCHECKED (8)
__GST_BIT_READER_READ_BITS_UNCHECKED (16)
__GST_BIT_READER_READ_BITS_UNCHECKED (32)
__GST_BIT_READER_READ_BITS_UNCHECKED (64)
#undef __GST_BIT_READER_READ_BITS_UNCHECKED
/* unchecked variants -- do not use */
static inline guint
_gst_bit_reader_get_size_unchecked (const GstBitReader * reader)
{
return reader->size * 8;
}
static inline guint
_gst_bit_reader_get_pos_unchecked (const GstBitReader * reader)
{
return reader->byte * 8 + reader->bit;
}
static inline guint
_gst_bit_reader_get_remaining_unchecked (const GstBitReader * reader)
{
return reader->size * 8 - (reader->byte * 8 + reader->bit);
}
/* inlined variants -- do not use directly */
static inline guint
_gst_bit_reader_get_size_inline (const GstBitReader * reader)
{
g_return_val_if_fail (reader != NULL, 0);
return _gst_bit_reader_get_size_unchecked (reader);
}
static inline guint
_gst_bit_reader_get_pos_inline (const GstBitReader * reader)
{
g_return_val_if_fail (reader != NULL, 0);
return _gst_bit_reader_get_pos_unchecked (reader);
}
static inline guint
_gst_bit_reader_get_remaining_inline (const GstBitReader * reader)
{
g_return_val_if_fail (reader != NULL, 0);
return _gst_bit_reader_get_remaining_unchecked (reader);
}
static inline gboolean
_gst_bit_reader_skip_inline (GstBitReader * reader, guint nbits)
{
g_return_val_if_fail (reader != NULL, FALSE);
if (_gst_bit_reader_get_remaining_unchecked (reader) < nbits)
return FALSE;
gst_bit_reader_skip_unchecked (reader, nbits);
return TRUE;
}
static inline gboolean
_gst_bit_reader_skip_to_byte_inline (GstBitReader * reader)
{
g_return_val_if_fail (reader != NULL, FALSE);
if (reader->byte > reader->size)
return FALSE;
gst_bit_reader_skip_to_byte_unchecked (reader);
return TRUE;
}
#define __GST_BIT_READER_READ_BITS_INLINE(bits) \
static inline gboolean \
_gst_bit_reader_get_bits_uint##bits##_inline (GstBitReader *reader, guint##bits *val, guint nbits) \
{ \
g_return_val_if_fail (reader != NULL, FALSE); \
g_return_val_if_fail (val != NULL, FALSE); \
g_return_val_if_fail (nbits <= bits, FALSE); \
\
if (_gst_bit_reader_get_remaining_unchecked (reader) < nbits) \
return FALSE; \
\
*val = gst_bit_reader_get_bits_uint##bits##_unchecked (reader, nbits); \
return TRUE; \
} \
\
static inline gboolean \
_gst_bit_reader_peek_bits_uint##bits##_inline (const GstBitReader *reader, guint##bits *val, guint nbits) \
{ \
g_return_val_if_fail (reader != NULL, FALSE); \
g_return_val_if_fail (val != NULL, FALSE); \
g_return_val_if_fail (nbits <= bits, FALSE); \
\
if (_gst_bit_reader_get_remaining_unchecked (reader) < nbits) \
return FALSE; \
\
*val = gst_bit_reader_peek_bits_uint##bits##_unchecked (reader, nbits); \
return TRUE; \
}
__GST_BIT_READER_READ_BITS_INLINE (8)
__GST_BIT_READER_READ_BITS_INLINE (16)
__GST_BIT_READER_READ_BITS_INLINE (32)
__GST_BIT_READER_READ_BITS_INLINE (64)
#undef __GST_BIT_READER_READ_BITS_INLINE
#ifndef GST_BIT_READER_DISABLE_INLINES
#define gst_bit_reader_get_size(reader) \
_gst_bit_reader_get_size_inline (reader)
#define gst_bit_reader_get_pos(reader) \
_gst_bit_reader_get_pos_inline (reader)
#define gst_bit_reader_get_remaining(reader) \
_gst_bit_reader_get_remaining_inline (reader)
/* we use defines here so we can add the G_LIKELY() */
#define gst_bit_reader_skip(reader, nbits)\
G_LIKELY (_gst_bit_reader_skip_inline(reader, nbits))
#define gst_bit_reader_skip_to_byte(reader)\
G_LIKELY (_gst_bit_reader_skip_to_byte_inline(reader))
#define gst_bit_reader_get_bits_uint8(reader, val, nbits) \
G_LIKELY (_gst_bit_reader_get_bits_uint8_inline (reader, val, nbits))
#define gst_bit_reader_get_bits_uint16(reader, val, nbits) \
G_LIKELY (_gst_bit_reader_get_bits_uint16_inline (reader, val, nbits))
#define gst_bit_reader_get_bits_uint32(reader, val, nbits) \
G_LIKELY (_gst_bit_reader_get_bits_uint32_inline (reader, val, nbits))
#define gst_bit_reader_get_bits_uint64(reader, val, nbits) \
G_LIKELY (_gst_bit_reader_get_bits_uint64_inline (reader, val, nbits))
#define gst_bit_reader_peek_bits_uint8(reader, val, nbits) \
G_LIKELY (_gst_bit_reader_peek_bits_uint8_inline (reader, val, nbits))
#define gst_bit_reader_peek_bits_uint16(reader, val, nbits) \
G_LIKELY (_gst_bit_reader_peek_bits_uint16_inline (reader, val, nbits))
#define gst_bit_reader_peek_bits_uint32(reader, val, nbits) \
G_LIKELY (_gst_bit_reader_peek_bits_uint32_inline (reader, val, nbits))
#define gst_bit_reader_peek_bits_uint64(reader, val, nbits) \
G_LIKELY (_gst_bit_reader_peek_bits_uint64_inline (reader, val, nbits))
#endif
G_END_DECLS
#endif /* __GST_BIT_READER_H__ */
@@ -0,0 +1,513 @@
/* GStreamer byte reader
*
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
* Copyright (C) 2009 Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BYTE_READER_H__
#define __GST_BYTE_READER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_BYTE_READER(reader) ((GstByteReader *) (reader))
/**
* GstByteReader:
* @data: (array length=size): Data from which the bit reader will
* read
* @size: Size of @data in bytes
* @byte: Current byte position
*
* A byte reader instance.
*/
typedef struct {
const guint8 *data;
guint size;
guint byte; /* Byte position */
/* < private > */
gpointer _gst_reserved[GST_PADDING];
} GstByteReader;
GstByteReader * gst_byte_reader_new (const guint8 *data, guint size) G_GNUC_MALLOC;
void gst_byte_reader_free (GstByteReader *reader);
void gst_byte_reader_init (GstByteReader *reader, const guint8 *data, guint size);
gboolean gst_byte_reader_set_pos (GstByteReader *reader, guint pos);
guint gst_byte_reader_get_pos (const GstByteReader *reader);
guint gst_byte_reader_get_remaining (const GstByteReader *reader);
guint gst_byte_reader_get_size (const GstByteReader *reader);
gboolean gst_byte_reader_skip (GstByteReader *reader, guint nbytes);
gboolean gst_byte_reader_get_uint8 (GstByteReader *reader, guint8 *val);
gboolean gst_byte_reader_get_int8 (GstByteReader *reader, gint8 *val);
gboolean gst_byte_reader_get_uint16_le (GstByteReader *reader, guint16 *val);
gboolean gst_byte_reader_get_int16_le (GstByteReader *reader, gint16 *val);
gboolean gst_byte_reader_get_uint16_be (GstByteReader *reader, guint16 *val);
gboolean gst_byte_reader_get_int16_be (GstByteReader *reader, gint16 *val);
gboolean gst_byte_reader_get_uint24_le (GstByteReader *reader, guint32 *val);
gboolean gst_byte_reader_get_int24_le (GstByteReader *reader, gint32 *val);
gboolean gst_byte_reader_get_uint24_be (GstByteReader *reader, guint32 *val);
gboolean gst_byte_reader_get_int24_be (GstByteReader *reader, gint32 *val);
gboolean gst_byte_reader_get_uint32_le (GstByteReader *reader, guint32 *val);
gboolean gst_byte_reader_get_int32_le (GstByteReader *reader, gint32 *val);
gboolean gst_byte_reader_get_uint32_be (GstByteReader *reader, guint32 *val);
gboolean gst_byte_reader_get_int32_be (GstByteReader *reader, gint32 *val);
gboolean gst_byte_reader_get_uint64_le (GstByteReader *reader, guint64 *val);
gboolean gst_byte_reader_get_int64_le (GstByteReader *reader, gint64 *val);
gboolean gst_byte_reader_get_uint64_be (GstByteReader *reader, guint64 *val);
gboolean gst_byte_reader_get_int64_be (GstByteReader *reader, gint64 *val);
gboolean gst_byte_reader_peek_uint8 (const GstByteReader *reader, guint8 *val);
gboolean gst_byte_reader_peek_int8 (const GstByteReader *reader, gint8 *val);
gboolean gst_byte_reader_peek_uint16_le (const GstByteReader *reader, guint16 *val);
gboolean gst_byte_reader_peek_int16_le (const GstByteReader *reader, gint16 *val);
gboolean gst_byte_reader_peek_uint16_be (const GstByteReader *reader, guint16 *val);
gboolean gst_byte_reader_peek_int16_be (const GstByteReader *reader, gint16 *val);
gboolean gst_byte_reader_peek_uint24_le (const GstByteReader *reader, guint32 *val);
gboolean gst_byte_reader_peek_int24_le (const GstByteReader *reader, gint32 *val);
gboolean gst_byte_reader_peek_uint24_be (const GstByteReader *reader, guint32 *val);
gboolean gst_byte_reader_peek_int24_be (const GstByteReader *reader, gint32 *val);
gboolean gst_byte_reader_peek_uint32_le (const GstByteReader *reader, guint32 *val);
gboolean gst_byte_reader_peek_int32_le (const GstByteReader *reader, gint32 *val);
gboolean gst_byte_reader_peek_uint32_be (const GstByteReader *reader, guint32 *val);
gboolean gst_byte_reader_peek_int32_be (const GstByteReader *reader, gint32 *val);
gboolean gst_byte_reader_peek_uint64_le (const GstByteReader *reader, guint64 *val);
gboolean gst_byte_reader_peek_int64_le (const GstByteReader *reader, gint64 *val);
gboolean gst_byte_reader_peek_uint64_be (const GstByteReader *reader, guint64 *val);
gboolean gst_byte_reader_peek_int64_be (const GstByteReader *reader, gint64 *val);
gboolean gst_byte_reader_get_float32_le (GstByteReader *reader, gfloat *val);
gboolean gst_byte_reader_get_float32_be (GstByteReader *reader, gfloat *val);
gboolean gst_byte_reader_get_float64_le (GstByteReader *reader, gdouble *val);
gboolean gst_byte_reader_get_float64_be (GstByteReader *reader, gdouble *val);
gboolean gst_byte_reader_peek_float32_le (const GstByteReader *reader, gfloat *val);
gboolean gst_byte_reader_peek_float32_be (const GstByteReader *reader, gfloat *val);
gboolean gst_byte_reader_peek_float64_le (const GstByteReader *reader, gdouble *val);
gboolean gst_byte_reader_peek_float64_be (const GstByteReader *reader, gdouble *val);
gboolean gst_byte_reader_dup_data (GstByteReader * reader, guint size, guint8 ** val);
gboolean gst_byte_reader_get_data (GstByteReader * reader, guint size, const guint8 ** val);
gboolean gst_byte_reader_peek_data (const GstByteReader * reader, guint size, const guint8 ** val);
#define gst_byte_reader_dup_string(reader,str) \
gst_byte_reader_dup_string_utf8(reader,str)
gboolean gst_byte_reader_dup_string_utf8 (GstByteReader * reader, gchar ** str);
gboolean gst_byte_reader_dup_string_utf16 (GstByteReader * reader, guint16 ** str);
gboolean gst_byte_reader_dup_string_utf32 (GstByteReader * reader, guint32 ** str);
#define gst_byte_reader_skip_string(reader) \
gst_byte_reader_skip_string_utf8(reader)
gboolean gst_byte_reader_skip_string_utf8 (GstByteReader * reader);
gboolean gst_byte_reader_skip_string_utf16 (GstByteReader * reader);
gboolean gst_byte_reader_skip_string_utf32 (GstByteReader * reader);
#define gst_byte_reader_get_string(reader,str) \
gst_byte_reader_get_string_utf8(reader,str)
#define gst_byte_reader_peek_string(reader,str) \
gst_byte_reader_peek_string_utf8(reader,str)
gboolean gst_byte_reader_get_string_utf8 (GstByteReader * reader, const gchar ** str);
gboolean gst_byte_reader_peek_string_utf8 (const GstByteReader * reader, const gchar ** str);
guint gst_byte_reader_masked_scan_uint32 (const GstByteReader * reader,
guint32 mask,
guint32 pattern,
guint offset,
guint size);
/**
* GST_BYTE_READER_INIT:
* @data: Data from which the #GstByteReader should read
* @size: Size of @data in bytes
*
* A #GstByteReader must be initialized with this macro, before it can be
* used. This macro can used be to initialize a variable, but it cannot
* be assigned to a variable. In that case you have to use
* gst_byte_reader_init().
*/
#define GST_BYTE_READER_INIT(data, size) {data, size, 0}
/* unchecked variants */
static inline void
gst_byte_reader_skip_unchecked (GstByteReader * reader, guint nbytes)
{
reader->byte += nbytes;
}
#define __GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(bits,type,lower,upper,adj) \
\
static inline type \
gst_byte_reader_peek_##lower##_unchecked (const GstByteReader * reader) \
{ \
type val = (type) GST_READ_##upper (reader->data + reader->byte); \
adj \
return val; \
} \
\
static inline type \
gst_byte_reader_get_##lower##_unchecked (GstByteReader * reader) \
{ \
type val = gst_byte_reader_peek_##lower##_unchecked (reader); \
reader->byte += bits / 8; \
return val; \
}
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(8,guint8,uint8,UINT8,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(8,gint8,int8,UINT8,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,guint16,uint16_le,UINT16_LE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,guint16,uint16_be,UINT16_BE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,gint16,int16_le,UINT16_LE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,gint16,int16_be,UINT16_BE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,guint32,uint32_le,UINT32_LE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,guint32,uint32_be,UINT32_BE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gint32,int32_le,UINT32_LE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gint32,int32_be,UINT32_BE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,guint32,uint24_le,UINT24_LE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,guint32,uint24_be,UINT24_BE,/* */)
/* fix up the sign for 24-bit signed ints stored in 32-bit signed ints */
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,gint32,int24_le,UINT24_LE,
if (val & 0x00800000) val |= 0xff000000;)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,gint32,int24_be,UINT24_BE,
if (val & 0x00800000) val |= 0xff000000;)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,guint64,uint64_le,UINT64_LE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,guint64,uint64_be,UINT64_BE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gint64,int64_le,UINT64_LE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gint64,int64_be,UINT64_BE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gfloat,float32_le,FLOAT_LE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gfloat,float32_be,FLOAT_BE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gdouble,float64_le,DOUBLE_LE,/* */)
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gdouble,float64_be,DOUBLE_BE,/* */)
#undef __GET_PEEK_BITS_UNCHECKED
static inline const guint8 *
gst_byte_reader_peek_data_unchecked (const GstByteReader * reader)
{
return (const guint8 *) (reader->data + reader->byte);
}
static inline const guint8 *
gst_byte_reader_get_data_unchecked (GstByteReader * reader, guint size)
{
const guint8 *data;
data = gst_byte_reader_peek_data_unchecked (reader);
gst_byte_reader_skip_unchecked (reader, size);
return data;
}
static inline guint8 *
gst_byte_reader_dup_data_unchecked (GstByteReader * reader, guint size)
{
gconstpointer data = gst_byte_reader_get_data_unchecked (reader, size);
return (guint8 *) g_memdup (data, size);
}
/* Unchecked variants that should not be used */
static inline guint
_gst_byte_reader_get_pos_unchecked (const GstByteReader * reader)
{
return reader->byte;
}
static inline guint
_gst_byte_reader_get_remaining_unchecked (const GstByteReader * reader)
{
return reader->size - reader->byte;
}
static inline guint
_gst_byte_reader_get_size_unchecked (const GstByteReader * reader)
{
return reader->size;
}
/* inlined variants (do not use directly) */
static inline guint
_gst_byte_reader_get_remaining_inline (const GstByteReader * reader)
{
g_return_val_if_fail (reader != NULL, 0);
return _gst_byte_reader_get_remaining_unchecked (reader);
}
static inline guint
_gst_byte_reader_get_size_inline (const GstByteReader * reader)
{
g_return_val_if_fail (reader != NULL, 0);
return _gst_byte_reader_get_size_unchecked (reader);
}
#define __GST_BYTE_READER_GET_PEEK_BITS_INLINE(bits,type,name) \
\
static inline gboolean \
_gst_byte_reader_peek_##name##_inline (const GstByteReader * reader, type * val) \
{ \
g_return_val_if_fail (reader != NULL, FALSE); \
g_return_val_if_fail (val != NULL, FALSE); \
\
if (_gst_byte_reader_get_remaining_unchecked (reader) < (bits / 8)) \
return FALSE; \
\
*val = gst_byte_reader_peek_##name##_unchecked (reader); \
return TRUE; \
} \
\
static inline gboolean \
_gst_byte_reader_get_##name##_inline (GstByteReader * reader, type * val) \
{ \
g_return_val_if_fail (reader != NULL, FALSE); \
g_return_val_if_fail (val != NULL, FALSE); \
\
if (_gst_byte_reader_get_remaining_unchecked (reader) < (bits / 8)) \
return FALSE; \
\
*val = gst_byte_reader_get_##name##_unchecked (reader); \
return TRUE; \
}
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(8,guint8,uint8)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(8,gint8,int8)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(16,guint16,uint16_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(16,guint16,uint16_be)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(16,gint16,int16_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(16,gint16,int16_be)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,guint32,uint32_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,guint32,uint32_be)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,gint32,int32_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,gint32,int32_be)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(24,guint32,uint24_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(24,guint32,uint24_be)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(24,gint32,int24_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(24,gint32,int24_be)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,guint64,uint64_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,guint64,uint64_be)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,gint64,int64_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,gint64,int64_be)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,gfloat,float32_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,gfloat,float32_be)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,gdouble,float64_le)
__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,gdouble,float64_be)
#undef __GST_BYTE_READER_GET_PEEK_BITS_INLINE
#ifndef GST_BYTE_READER_DISABLE_INLINES
#define gst_byte_reader_get_remaining(reader) \
_gst_byte_reader_get_remaining_inline(reader)
#define gst_byte_reader_get_size(reader) \
_gst_byte_reader_get_size_inline(reader)
#define gst_byte_reader_get_pos(reader) \
_gst_byte_reader_get_pos_inline(reader)
/* we use defines here so we can add the G_LIKELY() */
#define gst_byte_reader_get_uint8(reader,val) \
G_LIKELY(_gst_byte_reader_get_uint8_inline(reader,val))
#define gst_byte_reader_get_int8(reader,val) \
G_LIKELY(_gst_byte_reader_get_int8_inline(reader,val))
#define gst_byte_reader_get_uint16_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_uint16_le_inline(reader,val))
#define gst_byte_reader_get_int16_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_int16_le_inline(reader,val))
#define gst_byte_reader_get_uint16_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_uint16_be_inline(reader,val))
#define gst_byte_reader_get_int16_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_int16_be_inline(reader,val))
#define gst_byte_reader_get_uint24_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_uint24_le_inline(reader,val))
#define gst_byte_reader_get_int24_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_int24_le_inline(reader,val))
#define gst_byte_reader_get_uint24_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_uint24_be_inline(reader,val))
#define gst_byte_reader_get_int24_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_int24_be_inline(reader,val))
#define gst_byte_reader_get_uint32_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_uint32_le_inline(reader,val))
#define gst_byte_reader_get_int32_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_int32_le_inline(reader,val))
#define gst_byte_reader_get_uint32_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_uint32_be_inline(reader,val))
#define gst_byte_reader_get_int32_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_int32_be_inline(reader,val))
#define gst_byte_reader_get_uint64_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_uint64_le_inline(reader,val))
#define gst_byte_reader_get_int64_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_int64_le_inline(reader,val))
#define gst_byte_reader_get_uint64_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_uint64_be_inline(reader,val))
#define gst_byte_reader_get_int64_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_int64_be_inline(reader,val))
#define gst_byte_reader_peek_uint8(reader,val) \
G_LIKELY(_gst_byte_reader_peek_uint8_inline(reader,val))
#define gst_byte_reader_peek_int8(reader,val) \
G_LIKELY(_gst_byte_reader_peek_int8_inline(reader,val))
#define gst_byte_reader_peek_uint16_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_uint16_le_inline(reader,val))
#define gst_byte_reader_peek_int16_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_int16_le_inline(reader,val))
#define gst_byte_reader_peek_uint16_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_uint16_be_inline(reader,val))
#define gst_byte_reader_peek_int16_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_int16_be_inline(reader,val))
#define gst_byte_reader_peek_uint24_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_uint24_le_inline(reader,val))
#define gst_byte_reader_peek_int24_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_int24_le_inline(reader,val))
#define gst_byte_reader_peek_uint24_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_uint24_be_inline(reader,val))
#define gst_byte_reader_peek_int24_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_int24_be_inline(reader,val))
#define gst_byte_reader_peek_uint32_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_uint32_le_inline(reader,val))
#define gst_byte_reader_peek_int32_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_int32_le_inline(reader,val))
#define gst_byte_reader_peek_uint32_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_uint32_be_inline(reader,val))
#define gst_byte_reader_peek_int32_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_int32_be_inline(reader,val))
#define gst_byte_reader_peek_uint64_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_uint64_le_inline(reader,val))
#define gst_byte_reader_peek_int64_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_int64_le_inline(reader,val))
#define gst_byte_reader_peek_uint64_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_uint64_be_inline(reader,val))
#define gst_byte_reader_peek_int64_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_int64_be_inline(reader,val))
#define gst_byte_reader_get_float32_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_float32_le_inline(reader,val))
#define gst_byte_reader_get_float32_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_float32_be_inline(reader,val))
#define gst_byte_reader_get_float64_le(reader,val) \
G_LIKELY(_gst_byte_reader_get_float64_le_inline(reader,val))
#define gst_byte_reader_get_float64_be(reader,val) \
G_LIKELY(_gst_byte_reader_get_float64_be_inline(reader,val))
#define gst_byte_reader_peek_float32_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_float32_le_inline(reader,val))
#define gst_byte_reader_peek_float32_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_float32_be_inline(reader,val))
#define gst_byte_reader_peek_float64_le(reader,val) \
G_LIKELY(_gst_byte_reader_peek_float64_le_inline(reader,val))
#define gst_byte_reader_peek_float64_be(reader,val) \
G_LIKELY(_gst_byte_reader_peek_float64_be_inline(reader,val))
#endif /* GST_BYTE_READER_DISABLE_INLINES */
static inline gboolean
_gst_byte_reader_dup_data_inline (GstByteReader * reader, guint size, guint8 ** val)
{
g_return_val_if_fail (reader != NULL, FALSE);
g_return_val_if_fail (val != NULL, FALSE);
if (G_UNLIKELY (size > reader->size || _gst_byte_reader_get_remaining_inline (reader) < size))
return FALSE;
*val = gst_byte_reader_dup_data_unchecked (reader, size);
return TRUE;
}
static inline gboolean
_gst_byte_reader_get_data_inline (GstByteReader * reader, guint size, const guint8 ** val)
{
g_return_val_if_fail (reader != NULL, FALSE);
g_return_val_if_fail (val != NULL, FALSE);
if (G_UNLIKELY (size > reader->size || _gst_byte_reader_get_remaining_inline (reader) < size))
return FALSE;
*val = gst_byte_reader_get_data_unchecked (reader, size);
return TRUE;
}
static inline gboolean
_gst_byte_reader_peek_data_inline (const GstByteReader * reader, guint size, const guint8 ** val)
{
g_return_val_if_fail (reader != NULL, FALSE);
g_return_val_if_fail (val != NULL, FALSE);
if (G_UNLIKELY (size > reader->size || _gst_byte_reader_get_remaining_inline (reader) < size))
return FALSE;
*val = gst_byte_reader_peek_data_unchecked (reader);
return TRUE;
}
static inline guint
_gst_byte_reader_get_pos_inline (const GstByteReader * reader)
{
g_return_val_if_fail (reader != NULL, 0);
return _gst_byte_reader_get_pos_unchecked (reader);
}
static inline gboolean
_gst_byte_reader_skip_inline (GstByteReader * reader, guint nbytes)
{
g_return_val_if_fail (reader != NULL, FALSE);
if (G_UNLIKELY (_gst_byte_reader_get_remaining_unchecked (reader) < nbytes))
return FALSE;
reader->byte += nbytes;
return TRUE;
}
#ifndef GST_BYTE_READER_DISABLE_INLINES
#define gst_byte_reader_dup_data(reader,size,val) \
G_LIKELY(_gst_byte_reader_dup_data_inline(reader,size,val))
#define gst_byte_reader_get_data(reader,size,val) \
G_LIKELY(_gst_byte_reader_get_data_inline(reader,size,val))
#define gst_byte_reader_peek_data(reader,size,val) \
G_LIKELY(_gst_byte_reader_peek_data_inline(reader,size,val))
#define gst_byte_reader_skip(reader,nbytes) \
G_LIKELY(_gst_byte_reader_skip_inline(reader,nbytes))
#endif /* GST_BYTE_READER_DISABLE_INLINES */
G_END_DECLS
#endif /* __GST_BYTE_READER_H__ */
@@ -0,0 +1,401 @@
/* GStreamer byte writer
*
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BYTE_WRITER_H__
#define __GST_BYTE_WRITER_H__
#include <gst/gst.h>
#include <gst/base/gstbytereader.h>
#include <string.h>
G_BEGIN_DECLS
#define GST_BYTE_WRITER(writer) ((GstByteWriter *) (writer))
/**
* GstByteWriter:
* @parent: #GstByteReader parent
* @alloc_size: Allocation size of the data
* @fixed: If %TRUE no reallocations are allowed
* @owned: If %FALSE no reallocations are allowed and copies of data are returned
*
* A byte writer instance.
*/
typedef struct {
GstByteReader parent;
guint alloc_size;
gboolean fixed;
gboolean owned;
/* < private > */
gpointer _gst_reserved[GST_PADDING];
} GstByteWriter;
GstByteWriter * gst_byte_writer_new (void) G_GNUC_MALLOC;
GstByteWriter * gst_byte_writer_new_with_size (guint size, gboolean fixed) G_GNUC_MALLOC;
GstByteWriter * gst_byte_writer_new_with_data (guint8 *data, guint size, gboolean initialized) G_GNUC_MALLOC;
void gst_byte_writer_init (GstByteWriter *writer);
void gst_byte_writer_init_with_size (GstByteWriter *writer, guint size, gboolean fixed);
void gst_byte_writer_init_with_data (GstByteWriter *writer, guint8 *data,
guint size, gboolean initialized);
void gst_byte_writer_free (GstByteWriter *writer);
guint8 * gst_byte_writer_free_and_get_data (GstByteWriter *writer);
GstBuffer * gst_byte_writer_free_and_get_buffer (GstByteWriter *writer) G_GNUC_MALLOC;
void gst_byte_writer_reset (GstByteWriter *writer);
guint8 * gst_byte_writer_reset_and_get_data (GstByteWriter *writer);
GstBuffer * gst_byte_writer_reset_and_get_buffer (GstByteWriter *writer) G_GNUC_MALLOC;
/**
* gst_byte_writer_get_pos:
* @writer: #GstByteWriter instance
*
* Returns: The current position of the read/write cursor
*/
/**
* gst_byte_writer_set_pos:
* @writer: #GstByteWriter instance
* @pos: new position
*
* Sets the current read/write cursor of @writer. The new position
* can only be between 0 and the current size.
*
* Returns: %TRUE if the new position could be set
*/
/**
* gst_byte_writer_get_size:
* @writer: #GstByteWriter instance
*
* Returns: The current, initialized size of the data
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC guint gst_byte_writer_get_pos (const GstByteWriter *writer);
G_INLINE_FUNC gboolean gst_byte_writer_set_pos (GstByteWriter *writer, guint pos);
G_INLINE_FUNC guint gst_byte_writer_get_size (const GstByteWriter *writer);
#else
static inline guint
gst_byte_writer_get_pos (const GstByteWriter *writer)
{
return gst_byte_reader_get_pos ((const GstByteReader *) writer);
}
static inline gboolean
gst_byte_writer_set_pos (GstByteWriter *writer, guint pos)
{
return gst_byte_reader_set_pos (GST_BYTE_READER (writer), pos);
}
static inline guint
gst_byte_writer_get_size (const GstByteWriter *writer)
{
return gst_byte_reader_get_size ((const GstByteReader *) writer);
}
#endif
guint gst_byte_writer_get_remaining (const GstByteWriter *writer);
gboolean gst_byte_writer_ensure_free_space (GstByteWriter *writer, guint size);
gboolean gst_byte_writer_put_uint8 (GstByteWriter *writer, guint8 val);
gboolean gst_byte_writer_put_int8 (GstByteWriter *writer, gint8 val);
gboolean gst_byte_writer_put_uint16_be (GstByteWriter *writer, guint16 val);
gboolean gst_byte_writer_put_uint16_le (GstByteWriter *writer, guint16 val);
gboolean gst_byte_writer_put_int16_be (GstByteWriter *writer, gint16 val);
gboolean gst_byte_writer_put_int16_le (GstByteWriter *writer, gint16 val);
gboolean gst_byte_writer_put_uint24_be (GstByteWriter *writer, guint32 val);
gboolean gst_byte_writer_put_uint24_le (GstByteWriter *writer, guint32 val);
gboolean gst_byte_writer_put_int24_be (GstByteWriter *writer, gint32 val);
gboolean gst_byte_writer_put_int24_le (GstByteWriter *writer, gint32 val);
gboolean gst_byte_writer_put_uint32_be (GstByteWriter *writer, guint32 val);
gboolean gst_byte_writer_put_uint32_le (GstByteWriter *writer, guint32 val);
gboolean gst_byte_writer_put_int32_be (GstByteWriter *writer, gint32 val);
gboolean gst_byte_writer_put_int32_le (GstByteWriter *writer, gint32 val);
gboolean gst_byte_writer_put_uint64_be (GstByteWriter *writer, guint64 val);
gboolean gst_byte_writer_put_uint64_le (GstByteWriter *writer, guint64 val);
gboolean gst_byte_writer_put_int64_be (GstByteWriter *writer, gint64 val);
gboolean gst_byte_writer_put_int64_le (GstByteWriter *writer, gint64 val);
gboolean gst_byte_writer_put_float32_be (GstByteWriter *writer, gfloat val);
gboolean gst_byte_writer_put_float32_le (GstByteWriter *writer, gfloat val);
gboolean gst_byte_writer_put_float64_be (GstByteWriter *writer, gdouble val);
gboolean gst_byte_writer_put_float64_le (GstByteWriter *writer, gdouble val);
gboolean gst_byte_writer_put_data (GstByteWriter *writer, const guint8 *data, guint size);
gboolean gst_byte_writer_fill (GstByteWriter *writer, guint8 value, guint size);
gboolean gst_byte_writer_put_string_utf8 (GstByteWriter *writer, const gchar *data);
gboolean gst_byte_writer_put_string_utf16 (GstByteWriter *writer, const guint16 *data);
gboolean gst_byte_writer_put_string_utf32 (GstByteWriter *writer, const guint32 *data);
gboolean gst_byte_writer_put_buffer (GstByteWriter *writer, GstBuffer * buffer, gsize offset, gssize size);
/**
* gst_byte_writer_put_string:
* @writer: #GstByteWriter instance
* @data: (in) (array zero-terminated=1): Null terminated string
*
* Write a NUL-terminated string to @writer (including the terminator). The
* string is assumed to be in an 8-bit encoding (e.g. ASCII,UTF-8 or
* ISO-8859-1).
*
* Returns: %TRUE if the string could be written
*/
#define gst_byte_writer_put_string(writer, data) \
gst_byte_writer_put_string_utf8(writer, data)
static inline guint
_gst_byte_writer_next_pow2 (guint n)
{
guint ret = 16;
/* We start with 16, smaller allocations make no sense */
while (ret < n && ret > 0)
ret <<= 1;
return ret ? ret : n;
}
static inline gboolean
_gst_byte_writer_ensure_free_space_inline (GstByteWriter * writer, guint size)
{
gpointer data;
if (G_LIKELY (size <= writer->alloc_size - writer->parent.byte))
return TRUE;
if (G_UNLIKELY (writer->fixed || !writer->owned))
return FALSE;
if (G_UNLIKELY (writer->parent.byte > G_MAXUINT - size))
return FALSE;
writer->alloc_size = _gst_byte_writer_next_pow2 (writer->parent.byte + size);
data = g_try_realloc ((guint8 *) writer->parent.data, writer->alloc_size);
if (G_UNLIKELY (data == NULL))
return FALSE;
writer->parent.data = (guint8 *) data;
return TRUE;
}
#define __GST_BYTE_WRITER_CREATE_WRITE_FUNC(bits,type,name,write_func) \
static inline void \
gst_byte_writer_put_##name##_unchecked (GstByteWriter *writer, type val) \
{ \
guint8 *write_data; \
\
write_data = (guint8 *) writer->parent.data + writer->parent.byte; \
write_func (write_data, val); \
writer->parent.byte += bits/8; \
writer->parent.size = MAX (writer->parent.size, writer->parent.byte); \
} \
\
static inline gboolean \
_gst_byte_writer_put_##name##_inline (GstByteWriter *writer, type val) \
{ \
g_return_val_if_fail (writer != NULL, FALSE); \
\
if (G_UNLIKELY (!_gst_byte_writer_ensure_free_space_inline(writer, bits/8))) \
return FALSE; \
\
gst_byte_writer_put_##name##_unchecked (writer, val); \
\
return TRUE; \
}
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (8, guint8, uint8, GST_WRITE_UINT8)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (8, gint8, int8, GST_WRITE_UINT8)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (16, guint16, uint16_le, GST_WRITE_UINT16_LE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (16, guint16, uint16_be, GST_WRITE_UINT16_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (16, gint16, int16_le, GST_WRITE_UINT16_LE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (16, gint16, int16_be, GST_WRITE_UINT16_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (24, guint32, uint24_le, GST_WRITE_UINT24_LE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (24, guint32, uint24_be, GST_WRITE_UINT24_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (24, gint32, int24_le, GST_WRITE_UINT24_LE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (24, gint32, int24_be, GST_WRITE_UINT24_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, guint32, uint32_le, GST_WRITE_UINT32_LE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, guint32, uint32_be, GST_WRITE_UINT32_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, gint32, int32_le, GST_WRITE_UINT32_LE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, gint32, int32_be, GST_WRITE_UINT32_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, guint64, uint64_le, GST_WRITE_UINT64_LE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, guint64, uint64_be, GST_WRITE_UINT64_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, gint64, int64_le, GST_WRITE_UINT64_LE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, gint64, int64_be, GST_WRITE_UINT64_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, gfloat, float32_be, GST_WRITE_FLOAT_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, gfloat, float32_le, GST_WRITE_FLOAT_LE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, gdouble, float64_be, GST_WRITE_DOUBLE_BE)
__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, gdouble, float64_le, GST_WRITE_DOUBLE_LE)
#undef __GST_BYTE_WRITER_CREATE_WRITE_FUNC
static inline void
gst_byte_writer_put_data_unchecked (GstByteWriter * writer, const guint8 * data,
guint size)
{
memcpy ((guint8 *) & writer->parent.data[writer->parent.byte], data, size);
writer->parent.byte += size;
writer->parent.size = MAX (writer->parent.size, writer->parent.byte);
}
static inline gboolean
_gst_byte_writer_put_data_inline (GstByteWriter * writer, const guint8 * data,
guint size)
{
g_return_val_if_fail (writer != NULL, FALSE);
if (G_UNLIKELY (!_gst_byte_writer_ensure_free_space_inline (writer, size)))
return FALSE;
gst_byte_writer_put_data_unchecked (writer, data, size);
return TRUE;
}
static inline void
gst_byte_writer_fill_unchecked (GstByteWriter * writer, guint8 value, guint size)
{
memset ((guint8 *) & writer->parent.data[writer->parent.byte], value, size);
writer->parent.byte += size;
writer->parent.size = MAX (writer->parent.size, writer->parent.byte);
}
static inline gboolean
_gst_byte_writer_fill_inline (GstByteWriter * writer, guint8 value, guint size)
{
g_return_val_if_fail (writer != NULL, FALSE);
if (G_UNLIKELY (!_gst_byte_writer_ensure_free_space_inline (writer, size)))
return FALSE;
gst_byte_writer_fill_unchecked (writer, value, size);
return TRUE;
}
static inline void
gst_byte_writer_put_buffer_unchecked (GstByteWriter * writer, GstBuffer * buffer,
gsize offset, gssize size)
{
if (size == -1) {
size = gst_buffer_get_size (buffer);
if (offset >= (gsize) size)
return;
size -= offset;
}
gst_buffer_extract (buffer, offset,
(guint8 *) & writer->parent.data[writer->parent.byte], size);
writer->parent.byte += size;
writer->parent.size = MAX (writer->parent.size, writer->parent.byte);
}
static inline gboolean
_gst_byte_writer_put_buffer_inline (GstByteWriter * writer, GstBuffer * buffer,
gsize offset, gssize size)
{
g_return_val_if_fail (writer != NULL, FALSE);
g_return_val_if_fail (size >= -1, FALSE);
if (size == -1) {
size = gst_buffer_get_size (buffer);
if (offset >= (gsize) size)
return TRUE;
size -= offset;
}
if (G_UNLIKELY (!_gst_byte_writer_ensure_free_space_inline (writer, size)))
return FALSE;
gst_byte_writer_put_buffer_unchecked (writer, buffer, offset, size);
return TRUE;
}
#ifndef GST_BYTE_WRITER_DISABLE_INLINES
/* we use defines here so we can add the G_LIKELY() */
#define gst_byte_writer_ensure_free_space(writer, size) \
G_LIKELY (_gst_byte_writer_ensure_free_space_inline (writer, size))
#define gst_byte_writer_put_uint8(writer, val) \
G_LIKELY (_gst_byte_writer_put_uint8_inline (writer, val))
#define gst_byte_writer_put_int8(writer, val) \
G_LIKELY (_gst_byte_writer_put_int8_inline (writer, val))
#define gst_byte_writer_put_uint16_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_uint16_be_inline (writer, val))
#define gst_byte_writer_put_uint16_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_uint16_le_inline (writer, val))
#define gst_byte_writer_put_int16_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_int16_be_inline (writer, val))
#define gst_byte_writer_put_int16_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_int16_le_inline (writer, val))
#define gst_byte_writer_put_uint24_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_uint24_be_inline (writer, val))
#define gst_byte_writer_put_uint24_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_uint24_le_inline (writer, val))
#define gst_byte_writer_put_int24_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_int24_be_inline (writer, val))
#define gst_byte_writer_put_int24_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_int24_le_inline (writer, val))
#define gst_byte_writer_put_uint32_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_uint32_be_inline (writer, val))
#define gst_byte_writer_put_uint32_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_uint32_le_inline (writer, val))
#define gst_byte_writer_put_int32_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_int32_be_inline (writer, val))
#define gst_byte_writer_put_int32_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_int32_le_inline (writer, val))
#define gst_byte_writer_put_uint64_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_uint64_be_inline (writer, val))
#define gst_byte_writer_put_uint64_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_uint64_le_inline (writer, val))
#define gst_byte_writer_put_int64_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_int64_be_inline (writer, val))
#define gst_byte_writer_put_int64_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_int64_le_inline (writer, val))
#define gst_byte_writer_put_float32_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_float32_be_inline (writer, val))
#define gst_byte_writer_put_float32_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_float32_le_inline (writer, val))
#define gst_byte_writer_put_float64_be(writer, val) \
G_LIKELY (_gst_byte_writer_put_float64_be_inline (writer, val))
#define gst_byte_writer_put_float64_le(writer, val) \
G_LIKELY (_gst_byte_writer_put_float64_le_inline (writer, val))
#define gst_byte_writer_put_data(writer, data, size) \
G_LIKELY (_gst_byte_writer_put_data_inline (writer, data, size))
#define gst_byte_writer_fill(writer, val, size) \
G_LIKELY (_gst_byte_writer_fill_inline (writer, val, size))
#define gst_byte_writer_put_buffer(writer, buffer, offset, size) \
G_LIKELY (_gst_byte_writer_put_buffer_inline (writer, buffer, offset, size))
#endif
G_END_DECLS
#endif /* __GST_BYTE_WRITER_H__ */
@@ -0,0 +1,358 @@
/* GStreamer
* Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
* Copyright (C) 2008 Mark Nauwelaerts <mnauw@users.sourceforge.net>
*
* gstcollectpads.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_COLLECT_PADS_H__
#define __GST_COLLECT_PADS_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_COLLECT_PADS (gst_collect_pads_get_type())
#define GST_COLLECT_PADS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COLLECT_PADS,GstCollectPads))
#define GST_COLLECT_PADS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COLLECT_PADS,GstCollectPadsClass))
#define GST_COLLECT_PADS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_COLLECT_PADS,GstCollectPadsClass))
#define GST_IS_COLLECT_PADS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COLLECT_PADS))
#define GST_IS_COLLECT_PADS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COLLECT_PADS))
typedef struct _GstCollectData GstCollectData;
typedef struct _GstCollectDataPrivate GstCollectDataPrivate;
typedef struct _GstCollectPads GstCollectPads;
typedef struct _GstCollectPadsPrivate GstCollectPadsPrivate;
typedef struct _GstCollectPadsClass GstCollectPadsClass;
/**
* GstCollectDataDestroyNotify:
* @data: the #GstCollectData that will be freed
*
* A function that will be called when the #GstCollectData will be freed.
* It is passed the pointer to the structure and should free any custom
* memory and resources allocated for it.
*/
typedef void (*GstCollectDataDestroyNotify) (GstCollectData *data);
/**
* GstCollectPadsStateFlags:
* @GST_COLLECT_PADS_STATE_EOS: Set if collectdata's pad is EOS.
* @GST_COLLECT_PADS_STATE_FLUSHING: Set if collectdata's pad is flushing.
* @GST_COLLECT_PADS_STATE_NEW_SEGMENT: Set if collectdata's pad received a
* new_segment event.
* @GST_COLLECT_PADS_STATE_WAITING: Set if collectdata's pad must be waited
* for when collecting.
* @GST_COLLECT_PADS_STATE_LOCKED: Set collectdata's pad WAITING state must
* not be changed.
* #GstCollectPadsStateFlags indicate private state of a collectdata('s pad).
*/
typedef enum {
GST_COLLECT_PADS_STATE_EOS = 1 << 0,
GST_COLLECT_PADS_STATE_FLUSHING = 1 << 1,
GST_COLLECT_PADS_STATE_NEW_SEGMENT = 1 << 2,
GST_COLLECT_PADS_STATE_WAITING = 1 << 3,
GST_COLLECT_PADS_STATE_LOCKED = 1 << 4
} GstCollectPadsStateFlags;
/**
* GST_COLLECT_PADS_STATE:
* @data: a #GstCollectData.
*
* A flags word containing #GstCollectPadsStateFlags flags set
* on this collected pad.
*/
#define GST_COLLECT_PADS_STATE(data) (((GstCollectData *) data)->state)
/**
* GST_COLLECT_PADS_STATE_IS_SET:
* @data: a #GstCollectData.
* @flag: the #GstCollectPadsStateFlags to check.
*
* Gives the status of a specific flag on a collected pad.
*/
#define GST_COLLECT_PADS_STATE_IS_SET(data,flag) !!(GST_COLLECT_PADS_STATE (data) & flag)
/**
* GST_COLLECT_PADS_STATE_SET:
* @data: a #GstCollectData.
* @flag: the #GstCollectPadsStateFlags to set.
*
* Sets a state flag on a collected pad.
*/
#define GST_COLLECT_PADS_STATE_SET(data,flag) (GST_COLLECT_PADS_STATE (data) |= flag)
/**
* GST_COLLECT_PADS_STATE_UNSET:
* @data: a #GstCollectData.
* @flag: the #GstCollectPadsStateFlags to clear.
*
* Clears a state flag on a collected pad.
*/
#define GST_COLLECT_PADS_STATE_UNSET(data,flag) (GST_COLLECT_PADS_STATE (data) &= ~(flag))
/**
* GstCollectData:
* @collect: owner #GstCollectPads
* @pad: #GstPad managed by this data
* @buffer: currently queued buffer.
* @pos: position in the buffer
* @segment: last segment received.
*
* Structure used by the collect_pads.
*/
struct _GstCollectData
{
/* with STREAM_LOCK of @collect */
GstCollectPads *collect;
GstPad *pad;
GstBuffer *buffer;
guint pos;
GstSegment segment;
/*< private >*/
/* state: bitfield for easier extension;
* eos, flushing, new_segment, waiting */
GstCollectPadsStateFlags state;
GstCollectDataPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstCollectPadsFunction:
* @pads: the #GstCollectPads that trigered the callback
* @user_data: user data passed to gst_collect_pads_set_function()
*
* A function that will be called when all pads have received data.
*
* Returns: #GST_FLOW_OK for success
*/
typedef GstFlowReturn (*GstCollectPadsFunction) (GstCollectPads *pads, gpointer user_data);
/**
* GstCollectPadsBufferFunction:
* @pads: the #GstCollectPads that trigered the callback
* @data: the #GstCollectData of pad that has received the buffer
* @buffer: (transfer full): the #GstBuffer
* @user_data: user data passed to gst_collect_pads_set_buffer_function()
*
* A function that will be called when a (considered oldest) buffer can be muxed.
* If all pads have reached EOS, this function is called with NULL @buffer
* and NULL @data.
*
* Returns: #GST_FLOW_OK for success
*/
typedef GstFlowReturn (*GstCollectPadsBufferFunction) (GstCollectPads *pads, GstCollectData *data,
GstBuffer *buffer, gpointer user_data);
/**
* GstCollectPadsCompareFunction:
* @pads: the #GstCollectPads that is comparing the timestamps
* @data1: the first #GstCollectData
* @timestamp1: the first timestamp
* @data2: the second #GstCollectData
* @timestamp2: the second timestamp
* @user_data: user data passed to gst_collect_pads_set_compare_function()
*
* A function for comparing two timestamps of buffers or newsegments collected on one pad.
*
* Returns: Integer less than zero when first timestamp is deemed older than the second one.
* Zero if the timestamps are deemed equally old.
* Integer greate than zero when second timestamp is deemed older than the first one.
*/
typedef gint (*GstCollectPadsCompareFunction) (GstCollectPads *pads,
GstCollectData * data1, GstClockTime timestamp1,
GstCollectData * data2, GstClockTime timestamp2,
gpointer user_data);
/**
* GstCollectPadsEventFunction:
* @pads: the #GstCollectPads that trigered the callback
* @pad: the #GstPad that received an event
* @event: the #GstEvent received
* @user_data: user data passed to gst_collect_pads_set_event_function()
*
* A function that will be called while processing an event. It takes
* ownership of the event and is responsible for chaining up (to
* gst_collect_pads_event_default()) or dropping events (such typical cases
* being handled by the default handler).
*
* Returns: %TRUE if the pad could handle the event
*/
typedef gboolean (*GstCollectPadsEventFunction) (GstCollectPads *pads, GstCollectData * pad,
GstEvent * event, gpointer user_data);
/**
* GstCollectPadsQueryFunction:
* @pads: the #GstCollectPads that trigered the callback
* @pad: the #GstPad that received an event
* @query: the #GstEvent received
* @user_data: user data passed to gst_collect_pads_set_query_function()
*
* A function that will be called while processing a query. It takes
* ownership of the query and is responsible for chaining up (to
* events downstream (with gst_pad_event_default()).
*
* Returns: %TRUE if the pad could handle the event
*/
typedef gboolean (*GstCollectPadsQueryFunction) (GstCollectPads *pads, GstCollectData * pad,
GstQuery * query, gpointer user_data);
/**
* GstCollectPadsClipFunction:
* @pads: a #GstCollectPads
* @data: a #GstCollectData
* @inbuffer: (transfer full): the input #GstBuffer
* @outbuffer: the output #GstBuffer
* @user_data: user data
*
* A function that will be called when @inbuffer is received on the pad managed
* by @data in the collecpad object @pads.
*
* The function should use the segment of @data and the negotiated media type on
* the pad to perform clipping of @inbuffer.
*
* This function takes ownership of @inbuffer and should output a buffer in
* @outbuffer or return %NULL in @outbuffer if the buffer should be dropped.
*
* Returns: a #GstFlowReturn that corresponds to the result of clipping.
*/
typedef GstFlowReturn (*GstCollectPadsClipFunction) (GstCollectPads *pads, GstCollectData *data,
GstBuffer *inbuffer, GstBuffer **outbuffer,
gpointer user_data);
/**
* GST_COLLECT_PADS_GET_STREAM_LOCK:
* @pads: a #GstCollectPads
*
* Get the stream lock of @pads. The stream lock is used to coordinate and
* serialize execution among the various streams being collected, and in
* protecting the resources used to accomplish this.
*/
#define GST_COLLECT_PADS_GET_STREAM_LOCK(pads) (&((GstCollectPads *)pads)->stream_lock)
/**
* GST_COLLECT_PADS_STREAM_LOCK:
* @pads: a #GstCollectPads
*
* Lock the stream lock of @pads.
*/
#define GST_COLLECT_PADS_STREAM_LOCK(pads) g_rec_mutex_lock(GST_COLLECT_PADS_GET_STREAM_LOCK (pads))
/**
* GST_COLLECT_PADS_STREAM_UNLOCK:
* @pads: a #GstCollectPads
*
* Unlock the stream lock of @pads.
*/
#define GST_COLLECT_PADS_STREAM_UNLOCK(pads) g_rec_mutex_unlock(GST_COLLECT_PADS_GET_STREAM_LOCK (pads))
/**
* GstCollectPads:
* @data: #GList of #GstCollectData managed by this #GstCollectPads.
*
* Collectpads object.
*/
struct _GstCollectPads {
GstObject object;
/*< public >*/ /* with LOCK and/or STREAM_LOCK */
GSList *data; /* list of CollectData items */
/*< private >*/
GRecMutex stream_lock; /* used to serialize collection among several streams */
GstCollectPadsPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstCollectPadsClass {
GstObjectClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_collect_pads_get_type(void);
/* creating the object */
GstCollectPads* gst_collect_pads_new (void);
/* set the callbacks */
void gst_collect_pads_set_function (GstCollectPads *pads,
GstCollectPadsFunction func,
gpointer user_data);
void gst_collect_pads_set_buffer_function (GstCollectPads *pads,
GstCollectPadsBufferFunction func,
gpointer user_data);
void gst_collect_pads_set_event_function (GstCollectPads *pads,
GstCollectPadsEventFunction func,
gpointer user_data);
void gst_collect_pads_set_query_function (GstCollectPads *pads,
GstCollectPadsQueryFunction func,
gpointer user_data);
void gst_collect_pads_set_compare_function (GstCollectPads *pads,
GstCollectPadsCompareFunction func,
gpointer user_data);
void gst_collect_pads_set_clip_function (GstCollectPads *pads,
GstCollectPadsClipFunction clipfunc,
gpointer user_data);
/* pad management */
GstCollectData* gst_collect_pads_add_pad (GstCollectPads *pads, GstPad *pad, guint size,
GstCollectDataDestroyNotify destroy_notify,
gboolean lock);
gboolean gst_collect_pads_remove_pad (GstCollectPads *pads, GstPad *pad);
/* start/stop collection */
void gst_collect_pads_start (GstCollectPads *pads);
void gst_collect_pads_stop (GstCollectPads *pads);
void gst_collect_pads_set_flushing (GstCollectPads *pads, gboolean flushing);
/* get collected buffers */
GstBuffer* gst_collect_pads_peek (GstCollectPads *pads, GstCollectData *data);
GstBuffer* gst_collect_pads_pop (GstCollectPads *pads, GstCollectData *data);
/* get collected bytes */
guint gst_collect_pads_available (GstCollectPads *pads);
guint gst_collect_pads_flush (GstCollectPads *pads, GstCollectData *data,
guint size);
GstBuffer* gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data,
guint size);
GstBuffer* gst_collect_pads_take_buffer (GstCollectPads * pads, GstCollectData * data,
guint size);
/* setting and unsetting waiting mode */
void gst_collect_pads_set_waiting (GstCollectPads *pads, GstCollectData *data,
gboolean waiting);
/* convenience helper */
GstFlowReturn gst_collect_pads_clip_running_time (GstCollectPads * pads,
GstCollectData * cdata,
GstBuffer * buf, GstBuffer ** outbuf,
gpointer user_data);
/* default handlers */
gboolean gst_collect_pads_event_default (GstCollectPads * pads, GstCollectData * data,
GstEvent * event, gboolean discard);
gboolean gst_collect_pads_query_default (GstCollectPads * pads, GstCollectData * data,
GstQuery * query, gboolean discard);
G_END_DECLS
#endif /* __GST_COLLECT_PADS_H__ */
@@ -0,0 +1,73 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstpushsrc.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PUSH_SRC_H__
#define __GST_PUSH_SRC_H__
#include <gst/gst.h>
#include <gst/base/gstbasesrc.h>
G_BEGIN_DECLS
#define GST_TYPE_PUSH_SRC (gst_push_src_get_type())
#define GST_PUSH_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PUSH_SRC,GstPushSrc))
#define GST_PUSH_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PUSH_SRC,GstPushSrcClass))
#define GST_PUSH_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PUSH_SRC, GstPushSrcClass))
#define GST_IS_PUSH_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PUSH_SRC))
#define GST_IS_PUSH_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PUSH_SRC))
typedef struct _GstPushSrc GstPushSrc;
typedef struct _GstPushSrcClass GstPushSrcClass;
/**
* GstPushSrc:
*
* The opaque #GstPushSrc data structure.
*/
struct _GstPushSrc {
GstBaseSrc parent;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstPushSrcClass {
GstBaseSrcClass parent_class;
/* ask the subclass to create a buffer, the default implementation
* uses alloc and fill */
GstFlowReturn (*create) (GstPushSrc *src, GstBuffer **buf);
/* allocate memory for a buffer */
GstFlowReturn (*alloc) (GstPushSrc *src, GstBuffer **buf);
/* ask the subclass to fill a buffer */
GstFlowReturn (*fill) (GstPushSrc *src, GstBuffer *buf);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_push_src_get_type(void);
G_END_DECLS
#endif /* __GST_PUSH_SRC_H__ */
@@ -0,0 +1,77 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) 2000,2005 Wim Taymans <wim@fluendo.com>
* Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
*
* gsttypefindhelper.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_TYPEFINDHELPER_H__
#define __GST_TYPEFINDHELPER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
GstCaps * gst_type_find_helper (GstPad *src, guint64 size);
GstCaps * gst_type_find_helper_for_data (GstObject *obj,
const guint8 *data,
gsize size,
GstTypeFindProbability *prob);
GstCaps * gst_type_find_helper_for_buffer (GstObject *obj,
GstBuffer *buf,
GstTypeFindProbability *prob);
GstCaps * gst_type_find_helper_for_extension (GstObject * obj,
const gchar * extension);
/**
* GstTypeFindHelperGetRangeFunction:
* @obj: a #GstObject that will handle the getrange request
* @parent: the parent of @obj or NULL
* @offset: the offset of the range
* @length: the length of the range
* @buffer: a memory location to hold the result buffer
*
* This function will be called by gst_type_find_helper_get_range() when
* typefinding functions request to peek at the data of a stream at certain
* offsets. If this function returns GST_FLOW_OK, the result buffer will be
* stored in @buffer. The contents of @buffer is invalid for any other
* return value.
*
* This function is supposed to behave exactly like a #GstPadGetRangeFunction.
*
* Returns: GST_FLOW_OK for success
*/
typedef GstFlowReturn (*GstTypeFindHelperGetRangeFunction) (GstObject *obj,
GstObject *parent,
guint64 offset,
guint length,
GstBuffer **buffer);
GstCaps * gst_type_find_helper_get_range (GstObject *obj,
GstObject *parent,
GstTypeFindHelperGetRangeFunction func,
guint64 size,
const gchar *extension,
GstTypeFindProbability *prob);
G_END_DECLS
#endif /* __GST_TYPEFINDHELPER_H__ */
@@ -0,0 +1,142 @@
/*
* GStreamer
* Copyright (C) 2010 Texas Instruments, Inc
* Copyright (C) 2011 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BASE_CAMERA_SRC_H__
#define __GST_BASE_CAMERA_SRC_H__
#ifndef GST_USE_UNSTABLE_API
#warning "GstBaseCameraSrc is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
#include <gst/gstbin.h>
#include "gstcamerabin-enum.h"
#include "gstcamerabinpreview.h"
G_BEGIN_DECLS
#define GST_TYPE_BASE_CAMERA_SRC \
(gst_base_camera_src_get_type())
#define GST_BASE_CAMERA_SRC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_CAMERA_SRC,GstBaseCameraSrc))
#define GST_BASE_CAMERA_SRC_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_CAMERA_SRC, GstBaseCameraSrcClass))
#define GST_BASE_CAMERA_SRC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_CAMERA_SRC,GstBaseCameraSrcClass))
#define GST_IS_BASE_CAMERA_SRC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_CAMERA_SRC))
#define GST_IS_BASE_CAMERA_SRC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_CAMERA_SRC))
#define GST_BASE_CAMERA_SRC_CAST(obj) \
((GstBaseCameraSrc *) (obj))
GType gst_base_camera_src_get_type (void);
typedef struct _GstBaseCameraSrc GstBaseCameraSrc;
typedef struct _GstBaseCameraSrcClass GstBaseCameraSrcClass;
#define GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME "vfsrc"
#define GST_BASE_CAMERA_SRC_IMAGE_PAD_NAME "imgsrc"
#define GST_BASE_CAMERA_SRC_VIDEO_PAD_NAME "vidsrc"
#define GST_BASE_CAMERA_SRC_PREVIEW_MESSAGE_NAME "preview-image"
/**
* GstBaseCameraSrc:
*/
struct _GstBaseCameraSrc
{
GstBin parent;
GstCameraBinMode mode;
gboolean capturing;
GMutex capturing_mutex;
/* Preview convert pipeline */
GstCaps *preview_caps;
gboolean post_preview;
GstElement *preview_filter;
GstCameraBinPreviewPipelineData *preview_pipeline;
/* Resolution of the buffers configured to camerabin */
gint width;
gint height;
gfloat zoom;
gfloat max_zoom;
gpointer _gst_reserved[GST_PADDING_LARGE];
};
/**
* GstBaseCameraSrcClass:
* @construct_pipeline: construct pipeline
* @setup_pipeline: configure pipeline for the chosen settings
* @set_zoom: set the zoom
* @set_mode: set the mode
*/
struct _GstBaseCameraSrcClass
{
GstBinClass parent;
/* Construct pipeline. (called in GST_STATE_CHANGE_NULL_TO_READY) Optional. */
gboolean (*construct_pipeline) (GstBaseCameraSrc *self);
/* (called in GST_STATE_CHANGE_READY_TO_PAUSED). Optional. */
gboolean (*setup_pipeline) (GstBaseCameraSrc *self);
/* Set the zoom. If set, called when changing 'zoom' property. Optional. */
void (*set_zoom) (GstBaseCameraSrc *self, gfloat zoom);
/* Set the mode. If set, called when changing 'mode' property. Optional. */
gboolean (*set_mode) (GstBaseCameraSrc *self,
GstCameraBinMode mode);
/* Set preview caps. If set, called called when setting new 'preview-caps'. Optional. */
gboolean (*set_preview) (GstBaseCameraSrc *self,
GstCaps *preview_caps);
/* Called by the handler for 'start-capture'. Mandatory. */
gboolean (*start_capture) (GstBaseCameraSrc * src);
/* Called by the handler for 'stop-capture'. Mandatory. */
void (*stop_capture) (GstBaseCameraSrc * src);
gpointer _gst_reserved[GST_PADDING_LARGE];
};
#define MIN_ZOOM 1.0f
#define MAX_ZOOM 10.0f
#define ZOOM_1X MIN_ZOOM
gboolean gst_base_camera_src_set_mode (GstBaseCameraSrc *self, GstCameraBinMode mode);
void gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self);
void gst_base_camera_src_setup_preview (GstBaseCameraSrc * self, GstCaps * preview_caps);
void gst_base_camera_src_finish_capture (GstBaseCameraSrc *self);
void gst_base_camera_src_post_preview (GstBaseCameraSrc *self, GstSample * sample);
// XXX add methods to get/set img capture and vid capture caps..
#endif /* __GST_BASE_CAMERA_SRC_H__ */
@@ -0,0 +1,62 @@
/*
* GStreamer
* Copyright (C) 2009 Nokia Corporation <multimedia@maemo.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CAMERABIN_ENUM_H__
#define __GST_CAMERABIN_ENUM_H__
#ifndef GST_USE_UNSTABLE_API
#warning "camerabin enums are unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
G_BEGIN_DECLS
#define DEFAULT_WIDTH 640
#define DEFAULT_HEIGHT 480
#define DEFAULT_CAPTURE_WIDTH 800
#define DEFAULT_CAPTURE_HEIGHT 600
#define DEFAULT_FPS_N 0 /* makes it use the default */
#define DEFAULT_FPS_D 1
#define DEFAULT_ZOOM MIN_ZOOM
/**
* GstCameraBinMode:
* @MODE_IMAGE: image capture
* @MODE_VIDEO: video capture
*
* Capture mode to use.
*/
typedef enum
{
/* MODE_PREVIEW = 0, No use for this */
MODE_IMAGE = 1,
MODE_VIDEO = 2,
} GstCameraBinMode;
#define GST_TYPE_CAMERABIN_MODE (gst_camerabin_mode_get_type ())
GType gst_camerabin_mode_get_type (void);
G_END_DECLS
#endif /* #ifndef __GST_CAMERABIN_ENUM_H__ */
@@ -0,0 +1,56 @@
/*
* GStreamer
* Copyright (C) 2008 Nokia Corporation <multimedia@maemo.org>
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __CAMERABIN_PREVIEW_H_
#define __CAMERABIN_PREVIEW_H_
#ifndef GST_USE_UNSTABLE_API
#warning "camera bin preview is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
typedef struct
{
GstElement *pipeline;
GstElement *appsrc;
GstElement *filter;
GstElement *appsink;
GstElement *vscale;
GstElement *element;
GstCaps *pending_preview_caps;
guint processing;
GMutex processing_lock;
GCond processing_cond;
} GstCameraBinPreviewPipelineData;
GstCameraBinPreviewPipelineData *gst_camerabin_create_preview_pipeline (GstElement * element, GstElement * filter);
void gst_camerabin_destroy_preview_pipeline (GstCameraBinPreviewPipelineData * preview);
gboolean gst_camerabin_preview_pipeline_post (GstCameraBinPreviewPipelineData * preview, GstSample * sample);
void gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview, GstCaps * caps);
gboolean gst_camerabin_preview_set_filter (GstCameraBinPreviewPipelineData * preview, GstElement * filter);
#endif /* #ifndef __CAMERABIN_PREVIEW_H_ */
@@ -0,0 +1,723 @@
/* Gstreamer
* Copyright (C) <2011> Intel Corporation
* Copyright (C) <2011> Collabora Ltd.
* Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
*
* Some bits C-c,C-v'ed and s/4/3 from h264parse and videoparsers/h264parse.c:
* Copyright (C) <2010> Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
* Copyright (C) <2010> Collabora Multimedia
* Copyright (C) <2010> Nokia Corporation
*
* (C) 2005 Michal Benes <michal.benes@itonis.tv>
* (C) 2008 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_H264_PARSER_H__
#define __GST_H264_PARSER_H__
#ifndef GST_USE_UNSTABLE_API
#warning "The H.264 parsing library is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_H264_MAX_SPS_COUNT 32
#define GST_H264_MAX_PPS_COUNT 256
#define GST_H264_IS_P_SLICE(slice) (((slice)->type % 5) == GST_H264_P_SLICE)
#define GST_H264_IS_B_SLICE(slice) (((slice)->type % 5) == GST_H264_B_SLICE)
#define GST_H264_IS_I_SLICE(slice) (((slice)->type % 5) == GST_H264_I_SLICE)
#define GST_H264_IS_SP_SLICE(slice) (((slice)->type % 5) == GST_H264_SP_SLICE)
#define GST_H264_IS_SI_SLICE(slice) (((slice)->type % 5) == GST_H264_SI_SLICE)
/**
* GstH264NalUnitType:
* @GST_H264_NAL_UNKNOWN: Unknown nal type
* @GST_H264_NAL_SLICE: Slice nal
* @GST_H264_NAL_SLICE_DPA: DPA slice nal
* @GST_H264_NAL_SLICE_DPB: DPB slice nal
* @GST_H264_NAL_SLICE_DPC: DPC slice nal
* @GST_H264_NAL_SLICE_IDR: DPR slice nal
* @GST_H264_NAL_SEI: Supplemental enhancement information (SEI) nal unit
* @GST_H264_NAL_SPS: Sequence parameter set (SPS) nal unit
* @GST_H264_NAL_PPS: Picture parameter set (PPS) nal unit
* @GST_H264_NAL_AU_DELIMITER: Access unit (AU) delimiter nal unit
* @GST_H264_NAL_SEQ_END: End of sequence nal unit
* @GST_H264_NAL_STREAM_END: End of stream nal unit
* @GST_H264_NAL_FILLER_DATA: Filler data nal lunit
*
* Indicates the type of H264 Nal Units
*/
typedef enum
{
GST_H264_NAL_UNKNOWN = 0,
GST_H264_NAL_SLICE = 1,
GST_H264_NAL_SLICE_DPA = 2,
GST_H264_NAL_SLICE_DPB = 3,
GST_H264_NAL_SLICE_DPC = 4,
GST_H264_NAL_SLICE_IDR = 5,
GST_H264_NAL_SEI = 6,
GST_H264_NAL_SPS = 7,
GST_H264_NAL_PPS = 8,
GST_H264_NAL_AU_DELIMITER = 9,
GST_H264_NAL_SEQ_END = 10,
GST_H264_NAL_STREAM_END = 11,
GST_H264_NAL_FILLER_DATA = 12
} GstH264NalUnitType;
/**
* GstH264ParserResult:
* @GST_H264_PARSER_OK: The parsing succeded
* @GST_H264_PARSER_BROKEN_DATA: The data to parse is broken
* @GST_H264_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
* @GST_H264_PARSER_ERROR: An error accured when parsing
* @GST_H264_PARSER_NO_NAL: No nal found during the parsing
* @GST_H264_PARSER_NO_NAL_END: Start of the nal found, but not the end.
*
* The result of parsing H264 data.
*/
typedef enum
{
GST_H264_PARSER_OK,
GST_H264_PARSER_BROKEN_DATA,
GST_H264_PARSER_BROKEN_LINK,
GST_H264_PARSER_ERROR,
GST_H264_PARSER_NO_NAL,
GST_H264_PARSER_NO_NAL_END
} GstH264ParserResult;
/**
* GstH264SEIPayloadType:
* @GST_H264_SEI_BUF_PERIOD: Buffering Period SEI Message
* @GST_H264_SEI_PIC_TIMING: Picture Timing SEI Message
* ...
*
* The type of SEI message.
*/
typedef enum
{
GST_H264_SEI_BUF_PERIOD = 0,
GST_H264_SEI_PIC_TIMING = 1
/* and more... */
} GstH264SEIPayloadType;
/**
* GstH264SEIPicStructType:
* @GST_H264_SEI_PIC_STRUCT_FRAME: Picture is a frame
* @GST_H264_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame
* @GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD: Botom field of frame
* @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame
* @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame
* @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame
* @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame
* @GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should
* be displayed two times consecutively
* @GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be
* displayed three times consecutively
*
* SEI pic_struct type
*/
typedef enum
{
GST_H264_SEI_PIC_STRUCT_FRAME = 0,
GST_H264_SEI_PIC_STRUCT_TOP_FIELD = 1,
GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2,
GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3,
GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4,
GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5,
GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6,
GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8
} GstH264SEIPicStructType;
/**
* GstH264SliceType:
*
* Type of Picture slice
*/
typedef enum
{
GST_H264_P_SLICE = 0,
GST_H264_B_SLICE = 1,
GST_H264_I_SLICE = 2,
GST_H264_SP_SLICE = 3,
GST_H264_SI_SLICE = 4,
GST_H264_S_P_SLICE = 5,
GST_H264_S_B_SLICE = 6,
GST_H264_S_I_SLICE = 7,
GST_H264_S_SP_SLICE = 8,
GST_H264_S_SI_SLICE = 9
} GstH264SliceType;
typedef struct _GstH264NalParser GstH264NalParser;
typedef struct _GstH264NalUnit GstH264NalUnit;
typedef struct _GstH264SPS GstH264SPS;
typedef struct _GstH264PPS GstH264PPS;
typedef struct _GstH264HRDParams GstH264HRDParams;
typedef struct _GstH264VUIParams GstH264VUIParams;
typedef struct _GstH264RefPicListModification GstH264RefPicListModification;
typedef struct _GstH264DecRefPicMarking GstH264DecRefPicMarking;
typedef struct _GstH264RefPicMarking GstH264RefPicMarking;
typedef struct _GstH264PredWeightTable GstH264PredWeightTable;
typedef struct _GstH264SliceHdr GstH264SliceHdr;
typedef struct _GstH264ClockTimestamp GstH264ClockTimestamp;
typedef struct _GstH264PicTiming GstH264PicTiming;
typedef struct _GstH264BufferingPeriod GstH264BufferingPeriod;
typedef struct _GstH264SEIMessage GstH264SEIMessage;
/**
* GstH264NalUnit:
* @ref_idc: not equal to 0 specifies that the content of the NAL unit contains a sequence
* parameter set, a sequence * parameter set extension, a subset sequence parameter set, a
* picture parameter set, a slice of a reference picture, a slice data partition of a
* reference picture, or a prefix NAL unit preceding a slice of a reference picture.
* @type: A #GstH264NalUnitType
* @idr_pic_flag: calculated idr_pic_flag
* @size: The size of the nal unit starting from @offset
* @offset: The offset of the actual start of the nal unit
* @sc_offset:The offset of the start code of the nal unit
* @valid: If the nal unit is valid, which mean it has
* already been parsed
* @data: The data from which the Nalu has been parsed
*
* Structure defining the Nal unit headers
*/
struct _GstH264NalUnit
{
guint16 ref_idc;
guint16 type;
/* calculated values */
guint8 idr_pic_flag;
guint size;
guint offset;
guint sc_offset;
gboolean valid;
guint8 *data;
};
/**
* GstH264HRDParams:
* @cpb_cnt_minus1: plus 1 specifies the number of alternative
* CPB specifications in the bitstream
* @bit_rate_scale: specifies the maximum input bit rate of the
* SchedSelIdx-th CPB
* @cpb_size_scale: specifies the CPB size of the SchedSelIdx-th CPB
* @guint32 bit_rate_value_minus1: specifies the maximum input bit rate for the
* SchedSelIdx-th CPB
* @cpb_size_value_minus1: is used together with cpb_size_scale to specify the
* SchedSelIdx-th CPB size
* @cbr_flag: Specifies if running in itermediate bitrate mode or constant
* @initial_cpb_removal_delay_length_minus1: specifies the length in bits of
* the cpb_removal_delay syntax element
* @cpb_removal_delay_length_minus1: specifies the length in bits of the
* dpb_output_delay syntax element
* @dpb_output_delay_length_minus1: >0 specifies the length in bits of the time_offset syntax element.
* =0 specifies that the time_offset syntax element is not present
* @time_offset_length: Length of the time offset
*
* Defines the HRD parameters
*/
struct _GstH264HRDParams
{
guint8 cpb_cnt_minus1;
guint8 bit_rate_scale;
guint8 cpb_size_scale;
guint32 bit_rate_value_minus1[32];
guint32 cpb_size_value_minus1[32];
guint8 cbr_flag[32];
guint8 initial_cpb_removal_delay_length_minus1;
guint8 cpb_removal_delay_length_minus1;
guint8 dpb_output_delay_length_minus1;
guint8 time_offset_length;
};
/**
* GstH264VUIParams:
* @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present.
* %FALSE specifies that aspect_ratio_idc is not present
* @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples
* @sar_width indicates the horizontal size of the sample aspect ratio
* @sar_height indicates the vertical size of the sample aspect ratio
* @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwize
* @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures
* output are suitable for display using overscan. %FALSE the cropped decoded pictures
* output contain visually important information
* @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and
* colour_description_present_flag are present.
* @video_format: indicates the representation of the picture
* @video_full_range_flag: indicates the black level and range of the luma and chroma signals
* @colour_description_present_flag: %TRUE specifies that colour_primaries,
* transfer_characteristics and matrix_coefficients are present
* @colour_primaries: indicates the chromaticity coordinates of the source primaries
* @transfer_characteristics: indicates the opto-electronic transfer characteristic
* @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals
* @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and
* chroma_sample_loc_type_bottom_field are present, %FALSE otherwize
* @chroma_sample_loc_type_top_field: specify the location of chroma for top field
* @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field
* @timing_info_present_flag: %TRUE specifies that num_units_in_tick,
* time_scale and fixed_frame_rate_flag are present in the bitstream
* @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz
* time_scale: is the number of time units that pass in one second
* @fixed_frame_rate_flag: %TRUE indicates that the temporal distance between the HRD output times
* of any two consecutive pictures in output order is constrained as specified in the spec, %FALSE
* otherwize.
* @nal_hrd_parameters_present_flag: %TRUE if nal hrd parameters present in the bitstream
* @vcl_hrd_parameters_present_flag: %TRUE if nal vlc hrd parameters present in the bitstream
* @low_delay_hrd_flag: specifies the HRD operational mode
* @pic_struct_present_flag: %TRUE specifies that picture timing SEI messages are present or not
* @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction
* parameters are present
* @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the
* picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more
* samples outside picture boundaries may be used in inter prediction
* @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of
* the VCL NAL units associated with any coded picture in the coded video sequence.
* @max_bits_per_mb_denom: indicates the maximum number of coded bits of macroblock_layer
* @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal
* motion vector component
* @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical
* motion vector component
* @num_reorder_frames: indicates the maximum number of frames, complementary field pairs,
* or non-paired fields that precede any frame,
* @max_dec_frame_buffering: specifies the required size of the HRD decoded picture buffer in
* units of frame buffers.
*
* The structure representing the VUI parameters.
*/
struct _GstH264VUIParams
{
guint8 aspect_ratio_info_present_flag;
guint8 aspect_ratio_idc;
/* if aspect_ratio_idc == 255 */
guint16 sar_width;
guint16 sar_height;
guint8 overscan_info_present_flag;
/* if overscan_info_present_flag */
guint8 overscan_appropriate_flag;
guint8 video_signal_type_present_flag;
guint8 video_format;
guint8 video_full_range_flag;
guint8 colour_description_present_flag;
guint8 colour_primaries;
guint8 transfer_characteristics;
guint8 matrix_coefficients;
guint8 chroma_loc_info_present_flag;
guint8 chroma_sample_loc_type_top_field;
guint8 chroma_sample_loc_type_bottom_field;
guint8 timing_info_present_flag;
/* if timing_info_present_flag */
guint32 num_units_in_tick;
guint32 time_scale;
guint8 fixed_frame_rate_flag;
guint8 nal_hrd_parameters_present_flag;
/* if nal_hrd_parameters_present_flag */
GstH264HRDParams nal_hrd_parameters;
guint8 vcl_hrd_parameters_present_flag;
/* if nal_hrd_parameters_present_flag */
GstH264HRDParams vcl_hrd_parameters;
guint8 low_delay_hrd_flag;
guint8 pic_struct_present_flag;
guint8 bitstream_restriction_flag;
/* if bitstream_restriction_flag */
guint8 motion_vectors_over_pic_boundaries_flag;
guint32 max_bytes_per_pic_denom;
guint32 max_bits_per_mb_denom;
guint32 log2_max_mv_length_horizontal;
guint32 log2_max_mv_length_vertical;
guint32 num_reorder_frames;
guint32 max_dec_frame_buffering;
/* calculated values */
guint par_n;
guint par_d;
};
/**
* GstH264SPS:
* @id: The ID of the sequence parameter set
* @profile_idc: indicate the profile to which the coded video sequence conforms
*
* H264 Sequence Parameter Set (SPS)
*/
struct _GstH264SPS
{
gint id;
guint8 profile_idc;
guint8 constraint_set0_flag;
guint8 constraint_set1_flag;
guint8 constraint_set2_flag;
guint8 constraint_set3_flag;
guint8 level_idc;
guint8 chroma_format_idc;
guint8 separate_colour_plane_flag;
guint8 bit_depth_luma_minus8;
guint8 bit_depth_chroma_minus8;
guint8 qpprime_y_zero_transform_bypass_flag;
guint8 scaling_matrix_present_flag;
guint8 scaling_lists_4x4[6][16];
guint8 scaling_lists_8x8[6][64];
guint8 log2_max_frame_num_minus4;
guint8 pic_order_cnt_type;
/* if pic_order_cnt_type == 0 */
guint8 log2_max_pic_order_cnt_lsb_minus4;
/* else if pic_order_cnt_type == 1 */
guint8 delta_pic_order_always_zero_flag;
gint32 offset_for_non_ref_pic;
gint32 offset_for_top_to_bottom_field;
guint8 num_ref_frames_in_pic_order_cnt_cycle;
gint32 offset_for_ref_frame[255];
guint32 num_ref_frames;
guint8 gaps_in_frame_num_value_allowed_flag;
guint32 pic_width_in_mbs_minus1;
guint32 pic_height_in_map_units_minus1;
guint8 frame_mbs_only_flag;
guint8 mb_adaptive_frame_field_flag;
guint8 direct_8x8_inference_flag;
guint8 frame_cropping_flag;
/* if frame_cropping_flag */
guint32 frame_crop_left_offset;
guint32 frame_crop_right_offset;
guint32 frame_crop_top_offset;
guint32 frame_crop_bottom_offset;
guint8 vui_parameters_present_flag;
/* if vui_parameters_present_flag */
GstH264VUIParams vui_parameters;
/* calculated values */
guint8 chroma_array_type;
guint32 max_frame_num;
gint width, height;
gint fps_num, fps_den;
gboolean valid;
};
/**
* GstH264PPS:
*
* H264 Picture Parameter Set
*/
struct _GstH264PPS
{
gint id;
GstH264SPS *sequence;
guint8 entropy_coding_mode_flag;
guint8 pic_order_present_flag;
guint32 num_slice_groups_minus1;
/* if num_slice_groups_minus1 > 0 */
guint8 slice_group_map_type;
/* and if slice_group_map_type == 0 */
guint32 run_length_minus1[8];
/* or if slice_group_map_type == 2 */
guint32 top_left[8];
guint32 bottom_right[8];
/* or if slice_group_map_type == (3, 4, 5) */
guint8 slice_group_change_direction_flag;
guint32 slice_group_change_rate_minus1;
/* or if slice_group_map_type == 6 */
guint32 pic_size_in_map_units_minus1;
guint8 *slice_group_id;
guint8 num_ref_idx_l0_active_minus1;
guint8 num_ref_idx_l1_active_minus1;
guint8 weighted_pred_flag;
guint8 weighted_bipred_idc;
gint8 pic_init_qp_minus26;
gint8 pic_init_qs_minus26;
gint8 chroma_qp_index_offset;
guint8 deblocking_filter_control_present_flag;
guint8 constrained_intra_pred_flag;
guint8 redundant_pic_cnt_present_flag;
guint8 transform_8x8_mode_flag;
guint8 scaling_lists_4x4[6][16];
guint8 scaling_lists_8x8[6][64];
guint8 second_chroma_qp_index_offset;
gboolean valid;
};
struct _GstH264RefPicListModification
{
guint8 modification_of_pic_nums_idc;
union
{
/* if modification_of_pic_nums_idc == 0 || 1 */
guint32 abs_diff_pic_num_minus1;
/* if modification_of_pic_nums_idc == 2 */
guint32 long_term_pic_num;
} value;
};
struct _GstH264PredWeightTable
{
guint8 luma_log2_weight_denom;
guint8 chroma_log2_weight_denom;
gint16 luma_weight_l0[32];
gint8 luma_offset_l0[32];
/* if seq->ChromaArrayType != 0 */
gint16 chroma_weight_l0[32][2];
gint8 chroma_offset_l0[32][2];
/* if slice->slice_type % 5 == 1 */
gint16 luma_weight_l1[32];
gint8 luma_offset_l1[32];
/* and if seq->ChromaArrayType != 0 */
gint16 chroma_weight_l1[32][2];
gint8 chroma_offset_l1[32][2];
};
struct _GstH264RefPicMarking
{
guint8 memory_management_control_operation;
guint32 difference_of_pic_nums_minus1;
guint32 long_term_pic_num;
guint32 long_term_frame_idx;
guint32 max_long_term_frame_idx_plus1;
};
struct _GstH264DecRefPicMarking
{
/* if slice->nal_unit.IdrPicFlag */
guint8 no_output_of_prior_pics_flag;
guint8 long_term_reference_flag;
guint8 adaptive_ref_pic_marking_mode_flag;
GstH264RefPicMarking ref_pic_marking[10];
guint8 n_ref_pic_marking;
};
struct _GstH264SliceHdr
{
guint32 first_mb_in_slice;
guint32 type;
GstH264PPS *pps;
/* if seq->separate_colour_plane_flag */
guint8 colour_plane_id;
guint16 frame_num;
guint8 field_pic_flag;
guint8 bottom_field_flag;
/* if nal_unit.type == 5 */
guint16 idr_pic_id;
/* if seq->pic_order_cnt_type == 0 */
guint16 pic_order_cnt_lsb;
/* if seq->pic_order_present_flag && !field_pic_flag */
gint32 delta_pic_order_cnt_bottom;
gint32 delta_pic_order_cnt[2];
guint8 redundant_pic_cnt;
/* if slice_type == B_SLICE */
guint8 direct_spatial_mv_pred_flag;
guint8 num_ref_idx_l0_active_minus1;
guint8 num_ref_idx_l1_active_minus1;
guint8 ref_pic_list_modification_flag_l0;
guint8 n_ref_pic_list_modification_l0;
GstH264RefPicListModification ref_pic_list_modification_l0[32];
guint8 ref_pic_list_modification_flag_l1;
guint8 n_ref_pic_list_modification_l1;
GstH264RefPicListModification ref_pic_list_modification_l1[32];
GstH264PredWeightTable pred_weight_table;
/* if nal_unit.ref_idc != 0 */
GstH264DecRefPicMarking dec_ref_pic_marking;
guint8 cabac_init_idc;
gint8 slice_qp_delta;
gint8 slice_qs_delta;
guint8 disable_deblocking_filter_idc;
gint8 slice_alpha_c0_offset_div2;
gint8 slice_beta_offset_div2;
guint16 slice_group_change_cycle;
/* calculated values */
guint32 max_pic_num;
gboolean valid;
/* Size of the slice_header() in bits */
guint header_size;
/* Number of emulation prevention bytes (EPB) in this slice_header() */
guint n_emulation_prevention_bytes;
};
struct _GstH264ClockTimestamp
{
guint8 ct_type;
guint8 nuit_field_based_flag;
guint8 counting_type;
guint8 discontinuity_flag;
guint8 cnt_dropped_flag;
guint8 n_frames;
guint8 seconds_flag;
guint8 seconds_value;
guint8 minutes_flag;
guint8 minutes_value;
guint8 hours_flag;
guint8 hours_value;
guint32 time_offset;
};
struct _GstH264PicTiming
{
guint32 cpb_removal_delay;
guint32 dpb_output_delay;
guint8 pic_struct_present_flag;
/* if pic_struct_present_flag */
guint8 pic_struct;
guint8 clock_timestamp_flag[3];
GstH264ClockTimestamp clock_timestamp[3];
};
struct _GstH264BufferingPeriod
{
GstH264SPS *sps;
/* seq->vui_parameters->nal_hrd_parameters_present_flag */
guint8 nal_initial_cpb_removal_delay[32];
guint8 nal_initial_cpb_removal_delay_offset[32];
/* seq->vui_parameters->vcl_hrd_parameters_present_flag */
guint8 vcl_initial_cpb_removal_delay[32];
guint8 vcl_initial_cpb_removal_delay_offset[32];
};
struct _GstH264SEIMessage
{
GstH264SEIPayloadType payloadType;
union {
GstH264BufferingPeriod buffering_period;
GstH264PicTiming pic_timing;
/* ... could implement more */
} payload;
};
/**
* GstH264NalParser:
*
* H264 NAL Parser (opaque structure).
*/
struct _GstH264NalParser
{
/*< private >*/
GstH264SPS sps[GST_H264_MAX_SPS_COUNT];
GstH264PPS pps[GST_H264_MAX_PPS_COUNT];
GstH264SPS *last_sps;
GstH264PPS *last_pps;
};
GstH264NalParser *gst_h264_nal_parser_new (void);
GstH264ParserResult gst_h264_parser_identify_nalu (GstH264NalParser *nalparser,
const guint8 *data, guint offset,
gsize size, GstH264NalUnit *nalu);
GstH264ParserResult gst_h264_parser_identify_nalu_unchecked (GstH264NalParser *nalparser,
const guint8 *data, guint offset,
gsize size, GstH264NalUnit *nalu);
GstH264ParserResult gst_h264_parser_identify_nalu_avc (GstH264NalParser *nalparser, const guint8 *data,
guint offset, gsize size, guint8 nal_length_size,
GstH264NalUnit *nalu);
GstH264ParserResult gst_h264_parser_parse_nal (GstH264NalParser *nalparser,
GstH264NalUnit *nalu);
GstH264ParserResult gst_h264_parser_parse_slice_hdr (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
GstH264SliceHdr *slice, gboolean parse_pred_weight_table,
gboolean parse_dec_ref_pic_marking);
GstH264ParserResult gst_h264_parser_parse_sps (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
GstH264SPS *sps, gboolean parse_vui_params);
GstH264ParserResult gst_h264_parser_parse_pps (GstH264NalParser *nalparser,
GstH264NalUnit *nalu, GstH264PPS *pps);
GstH264ParserResult gst_h264_parser_parse_sei (GstH264NalParser *nalparser,
GstH264NalUnit *nalu, GstH264SEIMessage *sei);
void gst_h264_nal_parser_free (GstH264NalParser *nalparser);
GstH264ParserResult gst_h264_parse_sps (GstH264NalUnit *nalu,
GstH264SPS *sps, gboolean parse_vui_params);
GstH264ParserResult gst_h264_parse_pps (GstH264NalParser *nalparser,
GstH264NalUnit *nalu, GstH264PPS *pps);
G_END_DECLS
#endif
@@ -0,0 +1,578 @@
/*
* GStreamer
* Copyright (C) 2009 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MPEG4UTIL_H__
#define __GST_MPEG4UTIL_H__
#include <gst/gst.h>
#include <gst/base/gstbitreader.h>
typedef struct _GstMpeg4VisualObjectSequence GstMpeg4VisualObjectSequence;
typedef struct _GstMpeg4VisualObject GstMpeg4VisualObject;
typedef struct _GstMpeg4VideoObjectLayer GstMpeg4VideoObjectLayer;
typedef struct _GstMpeg4GroupOfVOP GstMpeg4GroupOfVOP;
typedef struct _GstMpeg4VideoObjectPlane GstMpeg4VideoObjectPlane;
typedef struct _GstMpeg4VideoSignalType GstMpeg4VideoSignalType;
typedef struct _GstMpeg4VideoPlaneShortHdr GstMpeg4VideoPlaneShortHdr;
typedef struct _GstMpeg4VideoPacketHdr GstMpeg4VideoPacketHdr;
typedef struct _GstMpeg4SpriteTrajectory GstMpeg4SpriteTrajectory;
typedef struct _GstMpeg4Packet GstMpeg4Packet;
/**
* GstMpeg4StartCode:
*
* Defines the different startcodes present in the bitstream as
* defined in: Table 6-3 — Start code values
*/
typedef enum
{
GST_MPEG4_VIDEO_OBJ_FIRST = 0x00,
GST_MPEG4_VIDEO_OBJ_LAST = 0x1f,
GST_MPEG4_VIDEO_LAYER_FIRST = 0x20,
GST_MPEG4_VIDEO_LAYER_LAST = 0x2f,
GST_MPEG4_VISUAL_OBJ_SEQ_START = 0xb0,
GST_MPEG4_VISUAL_OBJ_SEQ_END = 0xb1,
GST_MPEG4_USER_DATA = 0xb2,
GST_MPEG4_GROUP_OF_VOP = 0xb3,
GST_MPEG4_VIDEO_SESSION_ERR = 0xb4,
GST_MPEG4_VISUAL_OBJ = 0xb5,
GST_MPEG4_VIDEO_OBJ_PLANE = 0xb6,
GST_MPEG4_FBA = 0xba,
GST_MPEG4_FBA_PLAN = 0xbb,
GST_MPEG4_MESH = 0xbc,
GST_MPEG4_MESH_PLAN = 0xbd,
GST_MPEG4_STILL_TEXTURE_OBJ = 0xbe,
GST_MPEG4_TEXTURE_SPATIAL = 0xbf,
GST_MPEG4_TEXTURE_SNR_LAYER = 0xc0,
GST_MPEG4_TEXTURE_TILE = 0xc1,
GST_MPEG4_SHAPE_LAYER = 0xc2,
GST_MPEG4_STUFFING = 0xc3,
GST_MPEG4_SYSTEM_FIRST = 0xc6,
GST_MPEG4_SYSTEM_LAST = 0xff,
GST_MPEG4_RESYNC = 0xfff
} GstMpeg4StartCode;
/**
* GstMpeg4VisualObjectType:
*
* Defines the different visual object types as
* defined in: Table 6-5 -- Meaning of visual object type
*/
typedef enum {
GST_MPEG4_VIDEO_ID = 0x01,
GST_MPEG4_STILL_TEXTURE_ID = 0x02,
GST_MPEG4_STILL_MESH_ID = 0x03,
GST_MPEG4_STILL_FBA_ID = 0x04,
GST_MPEG4_STILL_3D_MESH_ID = 0x05,
/*... reserved */
} GstMpeg4VisualObjectType;
/**
* GstMpeg4AspectRatioInfo:
* @GST_MPEG4_SQUARE: 1:1 square
* @GST_MPEG4_625_TYPE_4_3: 12:11 (625-type for 4:3 picture)
* @GST_MPEG4_525_TYPE_4_3: 10:11 (525-type for 4:3 picture)
* @GST_MPEG4_625_TYPE_16_9: 16:11 (625-type stretched for 16:9 picture)
* @GST_MPEG4_525_TYPE_16_9: 40:33 (525-type stretched for 16:9 picture)
* @GST_MPEG4_EXTENDED_PAR: Extended par
*
* Defines the different pixel aspect ratios as
* defined in: Table 6-12 -- Meaning of pixel aspect ratio
*/
typedef enum {
GST_MPEG4_SQUARE = 0x01,
GST_MPEG4_625_TYPE_4_3 = 0x02,
GST_MPEG4_525_TYPE_4_3 = 0x03,
GST_MPEG4_625_TYPE_16_9 = 0x04,
GST_MPEG4_525_TYPE_16_9 = 0x05,
GST_MPEG4_EXTENDED_PAR = 0x0f,
} GstMpeg4AspectRatioInfo;
/**
* GstMpeg4ParseResult:
* @GST_MPEG4_PARSER_OK: The parsing went well
* @GST_MPEG4_PARSER_BROKEN_DATA: The bitstream was broken
* @GST_MPEG4_PARSER_NO_PACKET: There was no packet in the buffer
* @GST_MPEG4_PARSER_NO_PACKET_END: There was no packet end in the buffer
* @GST_MPEG4_PARSER_NO_PACKET_ERROR: An error accured durint the parsing
*
* Result type of any parsing function.
*/
typedef enum {
GST_MPEG4_PARSER_OK,
GST_MPEG4_PARSER_BROKEN_DATA,
GST_MPEG4_PARSER_NO_PACKET,
GST_MPEG4_PARSER_NO_PACKET_END,
GST_MPEG4_PARSER_ERROR,
} GstMpeg4ParseResult;
/**
* GstMpeg4VideoObjectCodingType:
* @GST_MPEG4_I_VOP: intra-coded (I)
* @GST_MPEG4_P_VOP: predictive-coded (P)
* @GST_MPEG4_B_VOP: bidirectionally-predictive-coded (B)
* @GST_MPEG4_S_VOP: sprite (S)
*
* The vop coding types as defined in:
* Table 6-20 -- Meaning of vop_coding_type
*/
typedef enum {
GST_MPEG4_I_VOP = 0x0,
GST_MPEG4_P_VOP = 0x1,
GST_MPEG4_B_VOP = 0x2,
GST_MPEG4_S_VOP = 0x3
} GstMpeg4VideoObjectCodingType;
/**
* GstMpeg4ChromaFormat
*
* The chroma format in use as
* defined in: Table 6-13 -- Meaning of chroma_format
*/
typedef enum {
/* Other value are reserved */
GST_MPEG4_CHROMA_4_2_0 = 0x01
} GstMpeg4ChromaFormat;
/**
* GstMpeg4VideoObjectLayerShape:
*
* The different video object layer shapes as defined in:
* Table 6-16 — Video Object Layer shape type
*/
typedef enum {
GST_MPEG4_RECTANGULAR,
GST_MPEG4_BINARY,
GST_MPEG4_BINARY_ONLY,
GST_MPEG4_GRAYSCALE
} GstMpeg4VideoObjectLayerShape;
/**
* GstMpeg4SpriteEnable:
*
* Indicates the usage of static sprite coding
* or global motion compensation (GMC) as defined in:
* Table V2 - 2 -- Meaning of sprite_enable codewords
*/
typedef enum {
GST_MPEG4_SPRITE_UNUSED,
GST_MPEG4_SPRITE_STATIC,
GST_MPEG4_SPRITE_GMG
} GstMpeg4SpriteEnable;
/**
* GstMpeg4Profile:
*
* Different defined profiles as defined in:
* 9- Profiles and levels
*
* It is computed using:
* Table G.1 — FLC table for profile_and_level_indication
*/
typedef enum {
GST_MPEG4_PROFILE_CORE,
GST_MPEG4_PROFILE_MAIN,
GST_MPEG4_PROFILE_N_BIT,
GST_MPEG4_PROFILE_SIMPLE,
GST_MPEG4_PROFILE_HYBRID,
GST_MPEG4_PROFILE_RESERVED,
GST_MPEG4_PROFILE_SIMPLE_FBA,
GST_MPEG4_PROFILE_CORE_STUDIO,
GST_MPEG4_PROFILE_SIMPLE_STUDIO,
GST_MPEG4_PROFILE_CORE_SCALABLE,
GST_MPEG4_PROFILE_ADVANCED_CORE,
GST_MPEG4_PROFILE_ADVANCED_SIMPLE,
GST_MPEG4_PROFILE_SIMPLE_SCALABLE,
GST_MPEG4_PROFILE_SCALABLE_TEXTURE,
GST_MPEG4_PROFILE_SIMPLE_FACE_ANIMATION,
GST_MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE,
GST_MPEG4_PROFILE_ADVANCED_REALTIME_SIMPLE,
GST_MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE,
GST_MPEG4_PROFILE_FINE_GRANULARITY_SCALABLE,
GST_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY
} GstMpeg4Profile;
/**
* GstMpeg4Level:
*
* Different levels as defined in:
* 9- Profiles and levels
*
* It is computed using:
* Table G.1 — FLC table for profile_and_level_indication
*/
typedef enum {
GST_MPEG4_LEVEL0,
GST_MPEG4_LEVEL1,
GST_MPEG4_LEVEL2,
GST_MPEG4_LEVEL3,
GST_MPEG4_LEVEL3b,
GST_MPEG4_LEVEL4,
GST_MPEG4_LEVEL5,
GST_MPEG4_LEVEL_RESERVED
} GstMpeg4Level;
/**
* GstMpeg4VisualObjectSequence:
*
* The visual object sequence structure as defined in:
* 6.2.2 Visual Object Sequence and Visual Object
*/
struct _GstMpeg4VisualObjectSequence {
guint8 profile_and_level_indication;
/* Computed according to:
* Table G.1 — FLC table for profile_and_level_indication */
GstMpeg4Level level;
GstMpeg4Profile profile;
};
/**
* The visual object structure as defined in:
* 6.2.2 Visual Object Sequence and Visual Object
*/
struct _GstMpeg4VisualObject {
guint8 is_identifier;
/* If is_identifier */
guint8 verid;
guint8 priority;
GstMpeg4VisualObjectType type;
};
/**
* GstMpeg4VideoSignalType:
*
* The video signal type structure as defined in:
* 6.2.2 Visual Object Sequence and Visual Object.
*/
struct _GstMpeg4VideoSignalType {
guint8 type;
guint8 format;
guint8 range;
guint8 color_description;
guint8 color_primaries;
guint8 transfer_characteristics;
guint8 matrix_coefficients;
};
/**
* GstMpeg4VideoPlaneShortHdr:
*
* The video plane short header structure as defined in:
* 6.2.5.2 Video Plane with Short Header
*/
struct _GstMpeg4VideoPlaneShortHdr {
guint8 temporal_reference;
guint8 split_screen_indicator;
guint8 document_camera_indicator;
guint8 full_picture_freeze_release;
guint8 source_format;
guint8 picture_coding_type;
guint8 vop_quant;
guint8 pei;
guint8 psupp;
/* Gob layer specific fields */
guint8 gob_header_empty;
guint8 gob_number;
guint8 gob_frame_id;
guint8 quant_scale;
/* Computed
* If all the values are set to 0, then it is reserved
* Table 6-25 -- Parameters Defined by source_format Field
*/
guint16 vop_width;
guint16 vop_height;
guint16 num_macroblocks_in_gob;
guint8 num_gobs_in_vop;
/* The size in bits */
guint size;
};
/**
* GstMpeg4VideoObjectLayer:
*
* The video object layer structure as defined in:
* 6.2.3 Video Object Layer
*/
struct _GstMpeg4VideoObjectLayer {
guint8 random_accessible_vol;
guint8 video_object_type_indication;
guint8 is_object_layer_identifier;
/* if is_object_layer_identifier */
guint8 verid;
guint8 priority;
GstMpeg4AspectRatioInfo aspect_ratio_info;
guint8 par_width;
guint8 par_height;
guint8 control_parameters;
/* if control_parameters */
GstMpeg4ChromaFormat chroma_format;
guint8 low_delay;
guint8 vbv_parameters;
/* if vbv_parameters */
guint16 first_half_bitrate;
guint16 latter_half_bitrate;
guint16 first_half_vbv_buffer_size;
guint16 latter_half_vbv_buffer_size;
guint16 first_half_vbv_occupancy;
guint16 latter_half_vbv_occupancy;
/* Computed values */
guint32 bit_rate;
guint32 vbv_buffer_size;
GstMpeg4VideoObjectLayerShape shape;
/* if shape == GST_MPEG4_GRAYSCALE && verid =! 1 */
guint8 shape_extension;
guint16 vop_time_increment_resolution;
guint8 vop_time_increment_bits;
guint8 fixed_vop_rate;
/* if fixed_vop_rate */
guint16 fixed_vop_time_increment;
guint16 width;
guint16 height;
guint8 interlaced;
guint8 obmc_disable;
GstMpeg4SpriteEnable sprite_enable;
/* if vol->sprite_enable == SPRITE_GMG or SPRITE_STATIC*/
/* if vol->sprite_enable != GST_MPEG4_SPRITE_GMG */
guint16 sprite_width;
guint16 sprite_height;
guint16 sprite_left_coordinate;
guint16 sprite_top_coordinate;
guint8 no_of_sprite_warping_points;
guint8 sprite_warping_accuracy;
guint8 sprite_brightness_change;
/* if vol->sprite_enable != GST_MPEG4_SPRITE_GMG */
guint8 low_latency_sprite_enable;
/* if shape != GST_MPEG4_RECTANGULAR */
guint8 sadct_disable;
guint8 not_8_bit;
/* if no_8_bit */
guint8 quant_precision;
guint8 bits_per_pixel;
/* if shape == GRAYSCALE */
guint8 no_gray_quant_update;
guint8 composition_method;
guint8 linear_composition;
guint8 quant_type;
/* if quant_type */
guint8 load_intra_quant_mat;
guint8 intra_quant_mat[64];
guint8 load_non_intra_quant_mat;
guint8 non_intra_quant_mat[64];
guint8 quarter_sample;
guint8 complexity_estimation_disable;
guint8 resync_marker_disable;
guint8 data_partitioned;
guint8 reversible_vlc;
guint8 newpred_enable;
guint8 reduced_resolution_vop_enable;
guint8 scalability;
guint8 enhancement_type;
GstMpeg4VideoPlaneShortHdr short_hdr;
};
/**
* GstMpeg4SpriteTrajectory:
*
* The sprite trajectory structure as defined in:
* 7.8.4 Sprite reference point decoding and
* 6.2.5.4 Sprite coding
*/
struct _GstMpeg4SpriteTrajectory {
guint16 vop_ref_points[63]; /* Defined as "du" in 6.2.5.4 */
guint16 sprite_ref_points[63]; /* Defined as "dv" in 6.2.5.4 */
};
/**
* GstMpeg4GroupOfVOP:
*
* The group of video object plane structure as defined in:
* 6.2.4 Group of Video Object Plane
*/
struct _GstMpeg4GroupOfVOP {
guint8 hours;
guint8 minutes;
guint8 seconds;
guint8 closed;
guint8 broken_link;
};
/**
* GstMpeg4VideoObjectPlane:
*
* The Video object plane structure as defined in:
* 6.2.5 Video Object Plane and Video Plane with Short Header
*/
struct _GstMpeg4VideoObjectPlane {
GstMpeg4VideoObjectCodingType coding_type;
guint8 modulo_time_base;
guint16 time_increment;
guint8 coded;
/* if newpred_enable */
guint16 id;
guint8 id_for_prediction_indication;
guint16 id_for_prediction;
guint16 width;
guint16 height;
guint16 horizontal_mc_spatial_ref;
guint16 vertical_mc_spatial_ref;
guint8 rounding_type;
/*if vol->shape != GST_MPEG4_RECTANGULAR */
guint8 background_composition;
guint8 change_conv_ratio_disable;
guint8 constant_alpha;
guint8 constant_alpha_value;
guint8 reduced_resolution;
guint8 intra_dc_vlc_thr;
guint8 top_field_first;
guint8 alternate_vertical_scan_flag;
guint16 quant;
guint8 fcode_forward;
guint8 fcode_backward;
guint8 shape_coding_type;
guint8 load_backward_shape;
guint8 ref_select_code;
/* Computed macroblock informations */
guint16 mb_height;
guint16 mb_width;
guint mb_num;
/* The size of the header */
guint size;
};
/**
* GstMpeg4VideoPacketHdr:
* @size: Size of the header in bit.
*
* The video packet header structure as defined in:
* 6.2.5.2 Video Plane with Short Header
*/
struct _GstMpeg4VideoPacketHdr {
guint8 header_extension_code;
guint16 macroblock_number;
guint16 quant_scale;
guint size;
};
/**
* GstMpeg4Packet:
* @type: the type of the packet that start at @offset
* @data: the data containing packet starting at @offset
* @offset: offset of the start of the packet (without the 3 bytes startcode), but
* including the #GstMpeg4StartCode byte.
* @size: The size in bytes of the packet or %G_MAXUINT if the end wasn't found.
* @marker_size: The size in bit of the resync marker.
*
* A structure that contains the type of a packet, its offset and its size
*/
struct _GstMpeg4Packet
{
const guint8 *data;
guint offset;
gsize size;
guint marker_size;
GstMpeg4StartCode type;
};
GstMpeg4ParseResult gst_h263_parse (GstMpeg4Packet * packet,
const guint8 * data, guint offset,
gsize size);
GstMpeg4ParseResult gst_mpeg4_parse (GstMpeg4Packet * packet,
gboolean skip_user_data,
GstMpeg4VideoObjectPlane *vop,
const guint8 * data, guint offset,
gsize size);
GstMpeg4ParseResult
gst_mpeg4_parse_video_object_plane (GstMpeg4VideoObjectPlane *vop,
GstMpeg4SpriteTrajectory *sprite_trajectory,
GstMpeg4VideoObjectLayer *vol,
const guint8 * data,
gsize size);
GstMpeg4ParseResult
gst_mpeg4_parse_group_of_vop (GstMpeg4GroupOfVOP *gov,
const guint8 * data, gsize size);
GstMpeg4ParseResult
gst_mpeg4_parse_video_object_layer (GstMpeg4VideoObjectLayer *vol,
GstMpeg4VisualObject *vo,
const guint8 * data, gsize size);
GstMpeg4ParseResult
gst_mpeg4_parse_visual_object (GstMpeg4VisualObject *vo,
GstMpeg4VideoSignalType *signal_type,
const guint8 * data, gsize size);
GstMpeg4ParseResult
gst_mpeg4_parse_visual_object_sequence (GstMpeg4VisualObjectSequence *vos,
const guint8 * data, gsize size);
GstMpeg4ParseResult
gst_mpeg4_parse_video_plane_short_header (GstMpeg4VideoPlaneShortHdr * shorthdr,
const guint8 * data, gsize size);
GstMpeg4ParseResult
gst_mpeg4_parse_video_packet_header (GstMpeg4VideoPacketHdr * videopackethdr,
GstMpeg4VideoObjectLayer * vol,
GstMpeg4VideoObjectPlane * vop,
GstMpeg4SpriteTrajectory * sprite_trajectory,
const guint8 * data, gsize size);
#endif /* __GST_MPEG4UTIL_H__ */
@@ -0,0 +1,431 @@
/* Gstreamer
* Copyright (C) <2011> Intel Corporation
* Copyright (C) <2011> Collabora Ltd.
* Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
*
* From bad/sys/vdpau/mpeg/mpegutil.c:
* Copyright (C) <2007> Jan Schmidt <thaytan@mad.scientist.com>
* Copyright (C) <2009> Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MPEG_VIDEO_UTILS_H__
#define __GST_MPEG_VIDEO_UTILS_H__
#ifndef GST_USE_UNSTABLE_API
#warning "The Mpeg video parsing library is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
G_BEGIN_DECLS
/**
* GstMpegVideoPacketTypeCode:
* @GST_MPEG_VIDEO_PACKET_PICTURE: Picture packet starting code
* @GST_MPEG_VIDEO_PACKET_SLICE_MIN: Slice min packet starting code
* @GST_MPEG_VIDEO_PACKET_SLICE_MAX: Slice max packet starting code
* @GST_MPEG_VIDEO_PACKET_USER_DATA: User data packet starting code
* @GST_MPEG_VIDEO_PACKET_SEQUENCE : Sequence packet starting code
* @GST_MPEG_VIDEO_PACKET_EXTENSION: Extension packet starting code
* @GST_MPEG_VIDEO_PACKET_SEQUENCE_END: Sequence end packet code
* @GST_MPEG_VIDEO_PACKET_GOP: Group of Picture packet starting code
* @GST_MPEG_VIDEO_PACKET_NONE: None packet code
*
* Indicates the type of MPEG packet
*/
typedef enum {
GST_MPEG_VIDEO_PACKET_PICTURE = 0x00,
GST_MPEG_VIDEO_PACKET_SLICE_MIN = 0x01,
GST_MPEG_VIDEO_PACKET_SLICE_MAX = 0xaf,
GST_MPEG_VIDEO_PACKET_USER_DATA = 0xb2,
GST_MPEG_VIDEO_PACKET_SEQUENCE = 0xb3,
GST_MPEG_VIDEO_PACKET_EXTENSION = 0xb5,
GST_MPEG_VIDEO_PACKET_SEQUENCE_END = 0xb7,
GST_MPEG_VIDEO_PACKET_GOP = 0xb8,
GST_MPEG_VIDEO_PACKET_NONE = 0xff
} GstMpegVideoPacketTypeCode;
/**
* GST_MPEG_VIDEO_PACKET_IS_SLICE:
* @typecode: The MPEG video packet type code
*
* Checks whether a packet type code is a slice.
*
* Returns: %TRUE if the packet type code corresponds to a slice,
* else %FALSE.
*/
#define GST_MPEG_VIDEO_PACKET_IS_SLICE(typecode) ((typecode) >= GST_MPEG_VIDEO_PACKET_SLICE_MIN && \
(typecode) <= GST_MPEG_VIDEO_PACKET_SLICE_MAX)
/**
* GstMpegVideoPacketExtensionCode:
* @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE: Sequence extension code
* @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_DISPLAY: Sequence Display extension code
* @GST_MPEG_VIDEO_PACKET_EXT_QUANT_MATRIX: Quantization Matrix extension code
* @GST_MPEG_VIDEO_PACKET_EXT_PICTURE: Picture coding extension
*
* Indicates what type of packets are in this block, some are mutually
* exclusive though - ie, sequence packs are accumulated separately. GOP &
* Picture may occur together or separately.
*/
typedef enum {
GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE = 0x01,
GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_DISPLAY = 0x02,
GST_MPEG_VIDEO_PACKET_EXT_QUANT_MATRIX = 0x03,
GST_MPEG_VIDEO_PACKET_EXT_PICTURE = 0x08
} GstMpegVideoPacketExtensionCode;
/**
* GstMpegVideoLevel:
* @GST_MPEG_VIDEO_LEVEL_LOW: Low level (LL)
* @GST_MPEG_VIDEO_LEVEL_MAIN: Main level (ML)
* @GST_MPEG_VIDEO_LEVEL_HIGH_1440: High 1440 level (H-14)
* @GST_MPEG_VIDEO_LEVEL_HIGH: High level (HL)
*
* Mpeg-2 Levels.
**/
typedef enum {
GST_MPEG_VIDEO_LEVEL_HIGH = 0x04,
GST_MPEG_VIDEO_LEVEL_HIGH_1440 = 0x06,
GST_MPEG_VIDEO_LEVEL_MAIN = 0x08,
GST_MPEG_VIDEO_LEVEL_LOW = 0x0a
} GstMpegVideoLevel;
/**
* GstMpegVideoProfile:
* @GST_MPEG_VIDEO_PROFILE_422: 4:2:2 profile (422)
* @GST_MPEG_VIDEO_PROFILE_HIGH: High profile (HP)
* @GST_MPEG_VIDEO_PROFILE_SPATIALLY_SCALABLE: Spatially Scalable profile (Spatial)
* @GST_MPEG_VIDEO_PROFILE_SNR_SCALABLE: SNR Scalable profile (SNR)
* @GST_MPEG_VIDEO_PROFILE_MAIN: Main profile (MP)
* @GST_MPEG_VIDEO_PROFILE_SIMPLE: Simple profile (SP)
*
* Mpeg-2 Profiles.
**/
typedef enum {
GST_MPEG_VIDEO_PROFILE_422 = 0x00,
GST_MPEG_VIDEO_PROFILE_HIGH = 0x01,
GST_MPEG_VIDEO_PROFILE_SPATIALLY_SCALABLE = 0x02,
GST_MPEG_VIDEO_PROFILE_SNR_SCALABLE = 0x03,
GST_MPEG_VIDEO_PROFILE_MAIN = 0x04,
GST_MPEG_VIDEO_PROFILE_SIMPLE = 0x05
} GstMpegVideoProfile;
/**
* GstMpegVideoChromaFormat:
* @GST_MPEG_VIDEO_CHROMA_RES: Invalid (reserved for future use)
* @GST_MPEG_VIDEO_CHROMA_420: 4:2:0 subsampling
* @GST_MPEG_VIDEO_CHROMA_422: 4:2:2 subsampling
* @GST_MPEG_VIDEO_CHROMA_444: 4:4:4 (non-subsampled)
*
* Chroma subsampling type.
*/
typedef enum {
GST_MPEG_VIDEO_CHROMA_RES = 0x00,
GST_MPEG_VIDEO_CHROMA_420 = 0x01,
GST_MPEG_VIDEO_CHROMA_422 = 0x02,
GST_MPEG_VIDEO_CHROMA_444 = 0x03,
} GstMpegVideoChromaFormat;
/**
* GstMpegVideoPictureType:
* @GST_MPEG_VIDEO_PICTURE_TYPE_I: Intra-coded (I) frame
* @GST_MPEG_VIDEO_PICTURE_TYPE_P: Predictive-codec (P) frame
* @GST_MPEG_VIDEO_PICTURE_TYPE_B: Bidirectionally predictive-coded (B) frame
* @GST_MPEG_VIDEO_PICTURE_TYPE_D: D frame
*
* Picture type.
*/
typedef enum {
GST_MPEG_VIDEO_PICTURE_TYPE_I = 0x01,
GST_MPEG_VIDEO_PICTURE_TYPE_P = 0x02,
GST_MPEG_VIDEO_PICTURE_TYPE_B = 0x03,
GST_MPEG_VIDEO_PICTURE_TYPE_D = 0x04
} GstMpegVideoPictureType;
/**
* GstMpegVideoPictureStructure:
* @GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD: Top field
* @GST_MPEG_VIDEO_PICTURE_STRUCTURE_BOTTOM_FIELD: Bottom field
* @GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME: Frame picture
*
* Picture structure type.
*/
typedef enum {
GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD = 0x01,
GST_MPEG_VIDEO_PICTURE_STRUCTURE_BOTTOM_FIELD = 0x02,
GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME = 0x03
} GstMpegVideoPictureStructure;
typedef struct _GstMpegVideoSequenceHdr GstMpegVideoSequenceHdr;
typedef struct _GstMpegVideoSequenceExt GstMpegVideoSequenceExt;
typedef struct _GstMpegVideoSequenceDisplayExt GstMpegVideoSequenceDisplayExt;
typedef struct _GstMpegVideoPictureHdr GstMpegVideoPictureHdr;
typedef struct _GstMpegVideoGop GstMpegVideoGop;
typedef struct _GstMpegVideoPictureExt GstMpegVideoPictureExt;
typedef struct _GstMpegVideoQuantMatrixExt GstMpegVideoQuantMatrixExt;
typedef struct _GstMpegVideoPacket GstMpegVideoPacket;
/**
* GstMpegVideoSequenceHdr:
* @width: Width of each frame
* @height: Height of each frame
* @par_w: Calculated Pixel Aspect Ratio width
* @par_h: Calculated Pixel Aspect Ratio height
* @fps_n: Calculated Framrate nominator
* @fps_d: Calculated Framerate denominator
* @bitrate_value: Value of the bitrate as is in the stream (400bps unit)
* @bitrate: the real bitrate of the Mpeg video stream in bits per second, 0 if VBR stream
* @constrained_parameters_flag: %TRUE if this stream uses contrained parameters.
* @intra_quantizer_matrix: intra-quantization table
* @non_intra_quantizer_matrix: non-intra quantization table
*
* The Mpeg2 Video Sequence Header structure.
*/
struct _GstMpegVideoSequenceHdr
{
guint16 width, height;
guint8 aspect_ratio_info;
guint8 frame_rate_code;
guint32 bitrate_value;
guint16 vbv_buffer_size_value;
guint8 constrained_parameters_flag;
guint8 intra_quantizer_matrix[64];
guint8 non_intra_quantizer_matrix[64];
/* Calculated values */
guint par_w, par_h;
guint fps_n, fps_d;
guint bitrate;
};
/**
* GstMpegVideoSequenceExt:
* @profile: mpeg2 decoder profile
* @level: mpeg2 decoder level
* @progressive: %TRUE if the frames are progressive %FALSE otherwise
* @chroma_format: indicates the chrominance format
* @horiz_size_ext: Horizontal size
* @vert_size_ext: Vertical size
* @bitrate_ext: The bitrate
* @vbv_buffer_size_extension: VBV vuffer size
* @low_delay: %TRUE if the sequence doesn't contain any B-pictures, %FALSE
* otherwise
* @fps_n_ext: Framerate nominator code
* @fps_d_ext: Framerate denominator code
*
* The Mpeg2 Video Sequence Extension structure.
**/
struct _GstMpegVideoSequenceExt
{
/* mpeg2 decoder profile */
guint8 profile;
/* mpeg2 decoder level */
guint8 level;
guint8 progressive;
guint8 chroma_format;
guint8 horiz_size_ext, vert_size_ext;
guint16 bitrate_ext;
guint8 vbv_buffer_size_extension;
guint8 low_delay;
guint8 fps_n_ext, fps_d_ext;
};
/**
* GstMpegVideoSequenceDisplayExt:
* @profile: mpeg2 decoder profil
*/
struct _GstMpegVideoSequenceDisplayExt
{
guint8 video_format;
guint8 colour_description_flag;
/* if colour_description_flag: */
guint8 colour_primaries;
guint8 transfer_characteristics;
guint8 matrix_coefficients;
guint16 display_horizontal_size;
guint16 display_vertical_size;
};
/**
* GstMpegVideoQuantMatrixExt:
* @load_intra_quantiser_matrix:
* @intra_quantiser_matrix:
* @load_non_intra_quantiser_matrix:
* @non_intra_quantiser_matrix:
* @load_chroma_intra_quantiser_matrix:
* @chroma_intra_quantiser_matrix:
* @load_chroma_non_intra_quantiser_matrix:
* @chroma_non_intra_quantiser_matrix:
*
* The Quant Matrix Extension structure
*/
struct _GstMpegVideoQuantMatrixExt
{
guint8 load_intra_quantiser_matrix;
guint8 intra_quantiser_matrix[64];
guint8 load_non_intra_quantiser_matrix;
guint8 non_intra_quantiser_matrix[64];
guint8 load_chroma_intra_quantiser_matrix;
guint8 chroma_intra_quantiser_matrix[64];
guint8 load_chroma_non_intra_quantiser_matrix;
guint8 chroma_non_intra_quantiser_matrix[64];
};
/**
* GstMpegVideoPictureHdr:
* @tsn: Temporal Sequence Number
* @pic_type: Type of the frame
* @full_pel_forward_vector: the full pel forward flag of
* the frame: 0 or 1.
* @full_pel_backward_vector: the full pel backward flag
* of the frame: 0 or 1.
* @f_code: F code
*
* The Mpeg2 Video Picture Header structure.
*/
struct _GstMpegVideoPictureHdr
{
guint16 tsn;
guint8 pic_type;
guint8 full_pel_forward_vector, full_pel_backward_vector;
guint8 f_code[2][2];
};
/**
* GstMpegVideoPictureExt:
* @intra_dc_precision: Intra DC precision
* @picture_structure: Structure of the picture
* @top_field_first: Top field first
* @frame_pred_frame_dct: Frame
* @concealment_motion_vectors: Concealment Motion Vectors
* @q_scale_type: Q Scale Type
* @intra_vlc_format: Intra Vlc Format
* @alternate_scan: Alternate Scan
* @repeat_first_field: Repeat First Field
* @chroma_420_type: Chroma 420 Type
* @progressive_frame: %TRUE if the frame is progressive %FALSE otherwize
*
* The Mpeg2 Video Picture Extension structure.
*/
struct _GstMpegVideoPictureExt
{
guint8 f_code[2][2];
guint8 intra_dc_precision;
guint8 picture_structure;
guint8 top_field_first;
guint8 frame_pred_frame_dct;
guint8 concealment_motion_vectors;
guint8 q_scale_type;
guint8 intra_vlc_format;
guint8 alternate_scan;
guint8 repeat_first_field;
guint8 chroma_420_type;
guint8 progressive_frame;
guint8 composite_display;
guint8 v_axis;
guint8 field_sequence;
guint8 sub_carrier;
guint8 burst_amplitude;
guint8 sub_carrier_phase;
};
/**
* GstMpegVideoGop:
* @drop_frame_flag: Drop Frame Flag
* @hour: Hour (0-23)
* @minute: Minute (O-59)
* @second: Second (0-59)
* @frame: Frame (0-59)
* @closed_gop: Closed Gop
* @broken_link: Broken link
*
* The Mpeg Video Group of Picture structure.
*/
struct _GstMpegVideoGop
{
guint8 drop_frame_flag;
guint8 hour, minute, second, frame;
guint8 closed_gop;
guint8 broken_link;
};
/**
* GstMpegVideoTypeOffsetSize:
*
* @type: the type of the packet that start at @offset
* @data: the data containing the packet starting at @offset
* @offset: the offset of the packet start in bytes, it is the exact, start of the packet, no sync code included
* @size: The size in bytes of the packet or -1 if the end wasn't found. It is the exact size of the packet, no sync code included
*
* A structure that contains the type of a packet, its offset and its size
*/
struct _GstMpegVideoPacket
{
const guint8 *data;
guint8 type;
guint offset;
gint size;
};
gboolean gst_mpeg_video_parse (GstMpegVideoPacket * packet,
const guint8 * data, gsize size, guint offset);
gboolean gst_mpeg_video_parse_sequence_header (GstMpegVideoSequenceHdr * params,
const guint8 * data, gsize size, guint offset);
/* seqext and displayext may be NULL if not received */
gboolean gst_mpeg_video_finalise_mpeg2_sequence_header (GstMpegVideoSequenceHdr *hdr,
GstMpegVideoSequenceExt *seqext, GstMpegVideoSequenceDisplayExt *displayext);
gboolean gst_mpeg_video_parse_picture_header (GstMpegVideoPictureHdr* hdr,
const guint8 * data, gsize size, guint offset);
gboolean gst_mpeg_video_parse_picture_extension (GstMpegVideoPictureExt *ext,
const guint8 * data, gsize size, guint offset);
gboolean gst_mpeg_video_parse_gop (GstMpegVideoGop * gop,
const guint8 * data, gsize size, guint offset);
gboolean gst_mpeg_video_parse_sequence_extension (GstMpegVideoSequenceExt * seqext,
const guint8 * data, gsize size, guint offset);
gboolean gst_mpeg_video_parse_sequence_display_extension (GstMpegVideoSequenceDisplayExt * seqdisplayext,
const guint8 * data, gsize size, guint offset);
gboolean gst_mpeg_video_parse_quant_matrix_extension (GstMpegVideoQuantMatrixExt * quant,
const guint8 * data, gsize size, guint offset);
G_END_DECLS
#endif
@@ -0,0 +1,622 @@
/* Gstreamer
* Copyright (C) <2011> Intel
* Copyright (C) <2011> Collabora Ltd.
* Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_VC1_PARSER_H__
#define __GST_VC1_PARSER_H__
#ifndef GST_USE_UNSTABLE_API
#warning "The VC1 parsing library is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
G_BEGIN_DECLS
#define MAX_HRD_NUM_LEAKY_BUCKETS 31
/**
* @GST_VC1_BFRACTION_BASIS: The @bfraction variable should be divided
* by this constant to have the actual value.
*/
#define GST_VC1_BFRACTION_BASIS 840
#define GST_VC1_BFRACTION_RESERVED (GST_VC1_BFRACTION_BASIS + 1)
#define GST_VC1_BFRACTION_PTYPE_BI (GST_VC1_BFRACTION_BASIS + 2)
typedef enum {
GST_VC1_END_OF_SEQ = 0x0A,
GST_VC1_SLICE = 0x0B,
GST_VC1_FIELD = 0x0C,
GST_VC1_FRAME = 0x0D,
GST_VC1_ENTRYPOINT = 0x0E,
GST_VC1_SEQUENCE = 0x0F,
GST_VC1_SLICE_USER = 0x1B,
GST_VC1_FIELD_USER = 0x1C,
GST_VC1_FRAME_USER = 0x1D,
GST_VC1_ENTRY_POINT_USER = 0x1E,
GST_VC1_SEQUENCE_USER = 0x1F
} GstVC1StartCode;
typedef enum {
GST_VC1_PROFILE_SIMPLE,
GST_VC1_PROFILE_MAIN,
GST_VC1_PROFILE_RESERVED,
GST_VC1_PROFILE_ADVANCED
} GstVC1Profile;
typedef enum {
GST_VC1_PARSER_OK,
GST_VC1_PARSER_BROKEN_DATA,
GST_VC1_PARSER_NO_BDU,
GST_VC1_PARSER_NO_BDU_END,
GST_VC1_PARSER_ERROR,
} GstVC1ParserResult;
typedef enum
{
GST_VC1_PICTURE_TYPE_P,
GST_VC1_PICTURE_TYPE_B,
GST_VC1_PICTURE_TYPE_I,
GST_VC1_PICTURE_TYPE_BI,
GST_VC1_PICTURE_TYPE_SKIPPED
} GstVC1PictureType;
typedef enum
{
GST_VC1_LEVEL_LOW = 0, /* Simple/Main profile low level */
GST_VC1_LEVEL_MEDIUM = 1, /* Simple/Main profile medium level */
GST_VC1_LEVEL_HIGH = 2, /* Main profile high level */
GST_VC1_LEVEL_L0 = 0, /* Advanced profile level 0 */
GST_VC1_LEVEL_L1 = 1, /* Advanced profile level 1 */
GST_VC1_LEVEL_L2 = 2, /* Advanced profile level 2 */
GST_VC1_LEVEL_L3 = 3, /* Advanced profile level 3 */
GST_VC1_LEVEL_L4 = 4, /* Advanced profile level 4 */
/* 5 to 7 reserved */
GST_VC1_LEVEL_UNKNOWN = 255 /* Unknown profile */
} GstVC1Level;
typedef enum
{
GST_VC1_QUANTIZER_IMPLICITLY,
GST_VC1_QUANTIZER_EXPLICITLY,
GST_VC1_QUANTIZER_NON_UNIFORM,
GST_VC1_QUANTIZER_UNIFORM
} GstVC1QuantizerSpec;
typedef enum {
GST_VC1_DQPROFILE_FOUR_EDGES,
GST_VC1_DQPROFILE_DOUBLE_EDGES,
GST_VC1_DQPROFILE_SINGLE_EDGE,
GST_VC1_DQPROFILE_ALL_MBS
} GstVC1DQProfile;
typedef enum {
GST_VC1_CONDOVER_NONE,
GST_VC1_CONDOVER_ALL,
GST_VC1_CONDOVER_SELECT
} GstVC1Condover;
/**
* GstVC1MvMode:
*
*/
typedef enum
{
GST_VC1_MVMODE_1MV_HPEL_BILINEAR,
GST_VC1_MVMODE_1MV,
GST_VC1_MVMODE_1MV_HPEL,
GST_VC1_MVMODE_MIXED_MV,
GST_VC1_MVMODE_INTENSITY_COMP
} GstVC1MvMode;
typedef enum
{
GST_VC1_FRAME_PROGRESSIVE = 0x0,
GST_VC1_FRAME_INTERLACE = 0x10,
GST_VC1_FIELD_INTERLACE = 0x11
} GstVC1FrameCodingMode;
typedef struct _GstVC1SeqHdr GstVC1SeqHdr;
typedef struct _GstVC1AdvancedSeqHdr GstVC1AdvancedSeqHdr;
typedef struct _GstVC1HrdParam GstVC1HrdParam;
typedef struct _GstVC1EntryPointHdr GstVC1EntryPointHdr;
typedef struct _GstVC1SeqLayer GstVC1SeqLayer;
typedef struct _GstVC1SeqStructA GstVC1SeqStructA;
typedef struct _GstVC1SeqStructB GstVC1SeqStructB;
typedef struct _GstVC1SeqStructC GstVC1SeqStructC;
/* Pictures Structures */
typedef struct _GstVC1FrameLayer GstVC1FrameLayer;
typedef struct _GstVC1FrameHdr GstVC1FrameHdr;
typedef struct _GstVC1PicAdvanced GstVC1PicAdvanced;
typedef struct _GstVC1PicSimpleMain GstVC1PicSimpleMain;
typedef struct _GstVC1Picture GstVC1Picture;
typedef struct _GstVC1VopDquant GstVC1VopDquant;
typedef struct _GstVC1BitPlanes GstVC1BitPlanes;
typedef struct _GstVC1BDU GstVC1BDU;
struct _GstVC1HrdParam
{
guint8 hrd_num_leaky_buckets;
guint8 bit_rate_exponent;
guint8 buffer_size_exponent;
guint16 hrd_rate[MAX_HRD_NUM_LEAKY_BUCKETS];
guint16 hrd_buffer[MAX_HRD_NUM_LEAKY_BUCKETS];
};
/**
* GstVC1EntryPointHdr:
*
* Structure for entrypoint header, this will be used only in advanced profiles
*/
struct _GstVC1EntryPointHdr
{
guint8 broken_link;
guint8 closed_entry;
guint8 panscan_flag;
guint8 refdist_flag;
guint8 loopfilter;
guint8 fastuvmc;
guint8 extended_mv;
guint8 dquant;
guint8 vstransform;
guint8 overlap;
guint8 quantizer;
guint8 coded_size_flag;
guint16 coded_width;
guint16 coded_height;
guint8 extended_dmv;
guint8 range_mapy_flag;
guint8 range_mapy;
guint8 range_mapuv_flag;
guint8 range_mapuv;
guint8 hrd_full[MAX_HRD_NUM_LEAKY_BUCKETS];
};
/**
* GstVC1AdvancedSeqHdr:
*
* Structure for the advanced profile sequence headers specific parameters.
*/
struct _GstVC1AdvancedSeqHdr
{
GstVC1Level level;
guint8 frmrtq_postproc;
guint8 bitrtq_postproc;
guint8 postprocflag;
guint16 max_coded_width;
guint16 max_coded_height;
guint8 pulldown;
guint8 interlace;
guint8 tfcntrflag;
guint8 finterpflag;
guint8 psf;
guint8 display_ext;
guint16 disp_horiz_size;
guint16 disp_vert_size;
guint8 aspect_ratio_flag;
guint8 aspect_ratio;
guint8 aspect_horiz_size;
guint8 aspect_vert_size;
guint8 framerate_flag;
guint8 framerateind;
guint8 frameratenr;
guint8 frameratedr;
guint16 framerateexp;
guint8 color_format_flag;
guint8 color_prim;
guint8 transfer_char;
guint8 matrix_coef;
guint8 hrd_param_flag;
guint8 colordiff_format;
GstVC1HrdParam hrd_param;
/* computed */
guint framerate; /* Around in fps, 0 if unknown*/
guint bitrate; /* Around in kpbs, 0 if unknown*/
guint par_n;
guint par_d;
guint fps_n;
guint fps_d;
/* The last parsed entry point */
GstVC1EntryPointHdr entrypoint;
};
struct _GstVC1SeqStructA
{
guint32 vert_size;
guint32 horiz_size;
};
struct _GstVC1SeqStructB
{
GstVC1Level level;
guint8 cbr;
guint32 framerate;
/* In simple and main profiles only */
guint32 hrd_buffer;
guint32 hrd_rate;
};
struct _GstVC1SeqStructC
{
GstVC1Profile profile;
/* Only in simple and main profiles */
guint8 frmrtq_postproc;
guint8 bitrtq_postproc;
guint8 res_sprite;
guint8 loop_filter;
guint8 multires;
guint8 fastuvmc;
guint8 extended_mv;
guint8 dquant;
guint8 vstransform;
guint8 overlap;
guint8 syncmarker;
guint8 rangered;
guint8 maxbframes;
guint8 quantizer;
guint8 finterpflag;
/* Computed */
guint framerate; /* Around in fps, 0 if unknown*/
guint bitrate; /* Around in kpbs, 0 if unknown*/
/* This should be filled by user if previously known */
guint16 coded_width;
/* This should be filled by user if previously known */
guint16 coded_height;
/* Wmvp specific */
guint8 wmvp; /* Specify if the stream is wmp or not */
/* In the wmvp case, the framerate is not computed but in the bistream */
guint8 slice_code;
};
struct _GstVC1SeqLayer
{
guint32 numframes;
GstVC1SeqStructA struct_a;
GstVC1SeqStructB struct_b;
GstVC1SeqStructC struct_c;
};
/**
* GstVC1SeqHdr:
*
* Structure for sequence headers in any profile.
*/
struct _GstVC1SeqHdr
{
GstVC1Profile profile;
GstVC1SeqStructC struct_c;
/* calculated */
guint mb_height;
guint mb_width;
guint mb_stride;
GstVC1AdvancedSeqHdr advanced;
};
/**
* GstVC1PicSimpleMain:
* @bfaction: Should be divided by #GST_VC1_BFRACTION_BASIS
* to get the real value.
*/
struct _GstVC1PicSimpleMain
{
guint8 frmcnt;
guint8 mvrange;
guint8 rangeredfrm;
/* I and P pic simple and main profiles only */
guint8 respic;
/* I and BI pic simple and main profiles only */
guint8 transacfrm2;
guint8 bf;
/* B and P pic simple and main profiles only */
guint8 mvmode;
guint8 mvtab;
guint8 ttmbf;
/* P pic simple and main profiles only */
guint8 mvmode2;
guint8 lumscale;
guint8 lumshift;
guint8 cbptab;
guint8 ttfrm;
/* B and BI picture only
* Should be divided by #GST_VC1_BFRACTION_BASIS
* to get the real value. */
guint16 bfraction;
/* Biplane value, those fields only mention the fact
* that the bitplane is in raw mode or not */
guint8 mvtypemb;
guint8 skipmb;
guint8 directmb; /* B pic main profile only */
};
/**
* GstVC1PicAdvanced:
* @bfaction: Should be divided by #GST_VC1_BFRACTION_BASIS
* to get the real value.
*/
struct _GstVC1PicAdvanced
{
GstVC1FrameCodingMode fcm;
guint8 tfcntr;
guint8 rptfrm;
guint8 tff;
guint8 rff;
guint8 ps_present;
guint32 ps_hoffset;
guint32 ps_voffset;
guint16 ps_width;
guint16 ps_height;
guint8 rndctrl;
guint8 uvsamp;
guint8 postproc;
/* B and P picture specific */
guint8 mvrange;
guint8 mvmode;
guint8 mvtab;
guint8 cbptab;
guint8 ttmbf;
guint8 ttfrm;
/* B and BI picture only
* Should be divided by #GST_VC1_BFRACTION_BASIS
* to get the real value. */
guint16 bfraction;
/* ppic */
guint8 mvmode2;
guint8 lumscale;
guint8 lumshift;
/* bipic */
guint8 bf;
guint8 condover;
guint8 transacfrm2;
/* Biplane value, those fields only mention the fact
* that the bitplane is in raw mode or not */
guint8 acpred;
guint8 overflags;
guint8 mvtypemb;
guint8 skipmb;
guint8 directmb;
guint8 forwardmb; /* B pic interlace field only */
/* For interlaced pictures only */
guint8 fieldtx;
/* P and B pictures */
guint8 intcomp;
guint8 dmvrange;
guint8 mbmodetab;
guint8 imvtab;
guint8 icbptab;
guint8 mvbptab2;
guint8 mvbptab4; /* If 4mvswitch in ppic */
/* P picture */
guint8 mvswitch4;
/* For interlaced fields only */
guint16 refdist;
guint8 fptype; /* Raw value */
/* P pic */
guint8 numref;
guint8 reffield;
guint8 lumscale2;
guint8 lumshift2;
guint8 intcompfield;
};
struct _GstVC1BitPlanes
{
guint8 *acpred;
guint8 *fieldtx;
guint8 *overflags;
guint8 *mvtypemb;
guint8 *skipmb;
guint8 *directmb;
guint8 *forwardmb;
guint size; /* Size of the arrays */
};
struct _GstVC1VopDquant
{
guint8 pqdiff;
guint8 abspq;
/* Computed */
guint8 altpquant;
/* if dqant != 2*/
guint8 dquantfrm;
guint8 dqprofile;
/* if dqprofile == GST_VC1_DQPROFILE_SINGLE_EDGE
* or GST_VC1_DQPROFILE_DOUBLE_EDGE:*/
guint8 dqsbedge;
/* if dqprofile == GST_VC1_DQPROFILE_SINGLE_EDGE
* or GST_VC1_DQPROFILE_DOUBLE_EDGE:*/
guint8 dqbedge;
/* if dqprofile == GST_VC1_DQPROFILE_ALL_MBS */
guint8 dqbilevel;
};
struct _GstVC1FrameLayer
{
guint8 key;
guint32 framesize;
guint32 timestamp;
/* calculated */
guint32 next_framelayer_offset;
guint8 skiped_p_frame;
};
/**
* GstVC1FrameHdr:
*
* Structure that represent picture in any profile or mode.
* You should look at @ptype and @profile to know what is currently
* in use.
*/
struct _GstVC1FrameHdr
{
/* common fields */
GstVC1PictureType ptype;
guint8 interpfrm;
guint8 halfqp;
guint8 transacfrm;
guint8 transdctab;
guint8 pqindex;
guint8 pquantizer;
/* Computed */
guint8 pquant;
/* Convenience fields */
guint8 profile;
guint8 dquant;
/* If dquant */
GstVC1VopDquant vopdquant;
union {
GstVC1PicSimpleMain simple;
GstVC1PicAdvanced advanced;
} pic;
/* Size of the picture layer in bits */
guint header_size;
};
/**
* GstVC1BDU:
*
* Structure that represents a Bitstream Data Unit.
*/
struct _GstVC1BDU
{
GstVC1StartCode type;
guint size;
guint sc_offset;
guint offset;
guint8 * data;
};
GstVC1ParserResult gst_vc1_identify_next_bdu (const guint8 *data,
gsize size,
GstVC1BDU *bdu);
GstVC1ParserResult gst_vc1_parse_sequence_header (const guint8 *data,
gsize size,
GstVC1SeqHdr * seqhdr);
GstVC1ParserResult gst_vc1_parse_entry_point_header (const guint8 *data,
gsize size,
GstVC1EntryPointHdr * entrypoint,
GstVC1SeqHdr *seqhdr);
GstVC1ParserResult gst_vc1_parse_sequence_layer (const guint8 *data,
gsize size,
GstVC1SeqLayer * seqlayer);
GstVC1ParserResult
gst_vc1_parse_sequence_header_struct_a (const guint8 *data,
gsize size,
GstVC1SeqStructA *structa);
GstVC1ParserResult
gst_vc1_parse_sequence_header_struct_b (const guint8 *data,
gsize size,
GstVC1SeqStructB *structb);
GstVC1ParserResult
gst_vc1_parse_sequence_header_struct_c (const guint8 *data,
gsize size,
GstVC1SeqStructC *structc);
GstVC1ParserResult gst_vc1_parse_frame_layer (const guint8 *data,
gsize size,
GstVC1FrameLayer * framelayer);
GstVC1ParserResult gst_vc1_parse_frame_header (const guint8 *data,
gsize size,
GstVC1FrameHdr * framehdr,
GstVC1SeqHdr *seqhdr,
GstVC1BitPlanes *bitplanes);
GstVC1ParserResult gst_vc1_parse_field_header (const guint8 *data,
gsize size,
GstVC1FrameHdr * fieldhdr,
GstVC1SeqHdr *seqhdr,
GstVC1BitPlanes *bitplanes);
GstVC1BitPlanes * gst_vc1_bitplanes_new (void);
void gst_vc1_bitplanes_free (GstVC1BitPlanes *bitplanes);
void gst_vc1_bitplanes_free_1 (GstVC1BitPlanes *bitplanes);
gboolean gst_vc1_bitplanes_ensure_size (GstVC1BitPlanes *bitplanes,
GstVC1SeqHdr *seqhdr);
G_END_DECLS
#endif
@@ -0,0 +1,98 @@
/* GStreamer
*
* Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
*
* gstargbcontrolbinding.h: Attachment for multiple control sources to gargb
* properties
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_ARGB_CONTROL_BINDING_H__
#define __GST_ARGB_CONTROL_BINDING_H__
#include <gst/gstconfig.h>
#include <glib-object.h>
#include <gst/gstcontrolsource.h>
G_BEGIN_DECLS
#define GST_TYPE_ARGB_CONTROL_BINDING \
(gst_argb_control_binding_get_type())
#define GST_ARGB_CONTROL_BINDING(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ARGB_CONTROL_BINDING,GstARGBControlBinding))
#define GST_ARGB_CONTROL_BINDING_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ARGB_CONTROL_BINDING,GstARGBControlBindingClass))
#define GST_IS_ARGB_CONTROL_BINDING(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ARGB_CONTROL_BINDING))
#define GST_IS_ARGB_CONTROL_BINDING_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ARGB_CONTROL_BINDING))
#define GST_ARGB_CONTROL_BINDING_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstARGBControlBindingClass))
typedef struct _GstARGBControlBinding GstARGBControlBinding;
typedef struct _GstARGBControlBindingClass GstARGBControlBindingClass;
/**
* GstARGBControlBinding:
* @name: name of the property of this binding
*
* The instance structure of #GstARGBControlBinding.
*/
struct _GstARGBControlBinding {
GstControlBinding parent;
/*< private >*/
GstControlSource *cs_a; /* GstControlSources for this property */
GstControlSource *cs_r;
GstControlSource *cs_g;
GstControlSource *cs_b;
GValue cur_value;
guint32 last_value;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstARGBControlBindingClass:
* @parent_class: Parent class
* @convert: Class method to convert control-values
*
* The class structure of #GstARGBControlBinding.
*/
struct _GstARGBControlBindingClass
{
GstControlBindingClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_argb_control_binding_get_type (void);
/* Functions */
GstControlBinding * gst_argb_control_binding_new (GstObject * object, const gchar * property_name,
GstControlSource * cs_a, GstControlSource * cs_r,
GstControlSource * cs_g, GstControlSource * cs_b);
G_END_DECLS
#endif /* __GST_ARGB_CONTROL_BINDING_H__ */
@@ -0,0 +1,115 @@
/* GStreamer
*
* Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
*
* gstdirectcontrolbinding.h: Direct attachment for control sources
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_DIRECT_CONTROL_BINDING_H__
#define __GST_DIRECT_CONTROL_BINDING_H__
#include <gst/gstconfig.h>
#include <glib-object.h>
#include <gst/gstcontrolsource.h>
G_BEGIN_DECLS
#define GST_TYPE_DIRECT_CONTROL_BINDING \
(gst_direct_control_binding_get_type())
#define GST_DIRECT_CONTROL_BINDING(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DIRECT_CONTROL_BINDING,GstDirectControlBinding))
#define GST_DIRECT_CONTROL_BINDING_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DIRECT_CONTROL_BINDING,GstDirectControlBindingClass))
#define GST_IS_DIRECT_CONTROL_BINDING(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DIRECT_CONTROL_BINDING))
#define GST_IS_DIRECT_CONTROL_BINDING_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DIRECT_CONTROL_BINDING))
#define GST_DIRECT_CONTROL_BINDING_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstDirectControlBindingClass))
typedef struct _GstDirectControlBinding GstDirectControlBinding;
typedef struct _GstDirectControlBindingClass GstDirectControlBindingClass;
/**
* GstDirectControlBindingConvertValue:
* @self: the #GstDirectControlBinding instance
* @src_value: the value returned by the cotnrol source
* @dest_value: the target location
*
* Function to map a control-value to the target plain data type.
*/
typedef void (* GstDirectControlBindingConvertValue) (GstDirectControlBinding *self, gdouble src_value, gpointer dest_value);
/**
* GstDirectControlBindingConvertGValue:
* @self: the #GstDirectControlBinding instance
* @src_value: the value returned by the cotnrol source
* @dest_value: the target GValue
*
* Function to map a control-value to the target GValue.
*/
typedef void (* GstDirectControlBindingConvertGValue) (GstDirectControlBinding *self, gdouble src_value, GValue *dest_value);
/**
* GstDirectControlBinding:
* @name: name of the property of this binding
*
* The instance structure of #GstDirectControlBinding.
*/
struct _GstDirectControlBinding {
GstControlBinding parent;
/*< private >*/
GstControlSource *cs; /* GstControlSource for this property */
GValue cur_value;
gdouble last_value;
gint byte_size;
GstDirectControlBindingConvertValue convert_value;
GstDirectControlBindingConvertGValue convert_g_value;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstDirectControlBindingClass:
* @parent_class: Parent class
* @convert: Class method to convert control-values
*
* The class structure of #GstDirectControlBinding.
*/
struct _GstDirectControlBindingClass
{
GstControlBindingClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_direct_control_binding_get_type (void);
/* Functions */
GstControlBinding * gst_direct_control_binding_new (GstObject * object, const gchar * property_name,
GstControlSource * cs);
G_END_DECLS
#endif /* __GST_DIRECT_CONTROL_BINDING_H__ */
@@ -0,0 +1,97 @@
/* GStreamer
*
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
*
* gstinterpolationcontrolsource.h: Control source that provides several
* interpolation methods
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_INTERPOLATION_CONTROL_SOURCE_H__
#define __GST_INTERPOLATION_CONTROL_SOURCE_H__
#include <glib-object.h>
#include <gst/gst.h>
#include <gst/controller/gsttimedvaluecontrolsource.h>
G_BEGIN_DECLS
#define GST_TYPE_INTERPOLATION_CONTROL_SOURCE \
(gst_interpolation_control_source_get_type ())
#define GST_INTERPOLATION_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INTERPOLATION_CONTROL_SOURCE, GstInterpolationControlSource))
#define GST_INTERPOLATION_CONTROL_SOURCE_CLASS(vtable) \
(G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_INTERPOLATION_CONTROL_SOURCE, GstInterpolationControlSourceClass))
#define GST_IS_INTERPOLATION_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INTERPOLATION_CONTROL_SOURCE))
#define GST_IS_INTERPOLATION_CONTROL_SOURCE_CLASS(vtable) \
(G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_INTERPOLATION_CONTROL_SOURCE))
#define GST_INTERPOLATION_CONTROL_SOURCE_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_INTERPOLATION_CONTROL_SOURCE, GstInterpolationControlSourceClass))
#define GST_TYPE_INTERPOLATION_MODE (gst_interpolation_mode_get_type ())
typedef struct _GstInterpolationControlSource GstInterpolationControlSource;
typedef struct _GstInterpolationControlSourceClass GstInterpolationControlSourceClass;
typedef struct _GstInterpolationControlSourcePrivate GstInterpolationControlSourcePrivate;
/**
* GstInterpolationMode:
* @GST_INTERPOLATION_MODE_NONE: steps-like interpolation, default
* @GST_INTERPOLATION_MODE_LINEAR: linear interpolation
* @GST_INTERPOLATION_MODE_CUBIC: cubic interpolation
*
* The various interpolation modes available.
*/
typedef enum
{
GST_INTERPOLATION_MODE_NONE,
GST_INTERPOLATION_MODE_LINEAR,
GST_INTERPOLATION_MODE_CUBIC
} GstInterpolationMode;
/**
* GstInterpolationControlSource:
*
* The instance structure of #GstControlSource.
*/
struct _GstInterpolationControlSource {
GstTimedValueControlSource parent;
/*< private >*/
GstInterpolationControlSourcePrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstInterpolationControlSourceClass {
GstTimedValueControlSourceClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_interpolation_control_source_get_type (void);
GType gst_interpolation_mode_get_type (void);
/* Functions */
GstControlSource * gst_interpolation_control_source_new (void);
G_END_DECLS
#endif /* __GST_INTERPOLATION_CONTROL_SOURCE_H__ */
@@ -0,0 +1,100 @@
/* GStreamer
*
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
*
* gstlfocontrolsource.h: Control source that provides some periodic waveforms
* as control values.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_LFO_CONTROL_SOURCE_H__
#define __GST_LFO_CONTROL_SOURCE_H__
#include <glib-object.h>
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_LFO_CONTROL_SOURCE \
(gst_lfo_control_source_get_type ())
#define GST_LFO_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_LFO_CONTROL_SOURCE, GstLFOControlSource))
#define GST_LFO_CONTROL_SOURCE_CLASS(vtable) \
(G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_LFO_CONTROL_SOURCE, GstLFOControlSourceClass))
#define GST_IS_LFO_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_LFO_CONTROL_SOURCE))
#define GST_IS_LFO_CONTROL_SOURCE_CLASS(vtable) \
(G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_LFO_CONTROL_SOURCE))
#define GST_LFO_CONTROL_SOURCE_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_LFO_CONTROL_SOURCE, GstLFOControlSourceClass))
#define GST_TYPE_LFO_WAVEFORM (gst_lfo_waveform_get_type ())
typedef struct _GstLFOControlSource GstLFOControlSource;
typedef struct _GstLFOControlSourceClass GstLFOControlSourceClass;
typedef struct _GstLFOControlSourcePrivate GstLFOControlSourcePrivate;
/**
* GstLFOWaveform:
* @GST_LFO_WAVEFORM_SINE: sine waveform
* @GST_LFO_WAVEFORM_SQUARE: square waveform
* @GST_LFO_WAVEFORM_SAW: saw waveform
* @GST_LFO_WAVEFORM_REVERSE_SAW: reverse saw waveform
* @GST_LFO_WAVEFORM_TRIANGLE: triangle waveform
*
* The various waveform modes available.
*/
typedef enum
{
GST_LFO_WAVEFORM_SINE,
GST_LFO_WAVEFORM_SQUARE,
GST_LFO_WAVEFORM_SAW,
GST_LFO_WAVEFORM_REVERSE_SAW,
GST_LFO_WAVEFORM_TRIANGLE
} GstLFOWaveform;
/**
* GstLFOControlSource:
*
* The instance structure of #GstControlSource.
*/
struct _GstLFOControlSource {
GstControlSource parent;
/* <private> */
GstLFOControlSourcePrivate *priv;
GMutex lock;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstLFOControlSourceClass {
GstControlSourceClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_lfo_control_source_get_type (void);
GType gst_lfo_waveform_get_type (void);
/* Functions */
GstControlSource *gst_lfo_control_source_new (void);
G_END_DECLS
#endif /* __GST_LFO_CONTROL_SOURCE_H__ */
@@ -0,0 +1,133 @@
/* GStreamer
*
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
* 2011 Stefan Sauer <ensonic@users.sf.net>
*
* gsttimedvaluecontrolsource.h: Base class for timeed value based control
* sources
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_TIMED_VALUE_CONTROL_SOURCE_H__
#define __GST_TIMED_VALUE_CONTROL_SOURCE_H__
#include <glib-object.h>
#include <gst/gst.h>
#include <gst/gstcontrolsource.h>
G_BEGIN_DECLS
#define GST_TYPE_TIMED_VALUE_CONTROL_SOURCE \
(gst_timed_value_control_source_get_type ())
#define GST_TIMED_VALUE_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSource))
#define GST_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \
(G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass))
#define GST_IS_TIMED_VALUE_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE))
#define GST_IS_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \
(G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE))
#define GST_TIMED_VALUE_CONTROL_SOURCE_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass))
typedef struct _GstTimedValueControlSource GstTimedValueControlSource;
typedef struct _GstTimedValueControlSourceClass GstTimedValueControlSourceClass;
typedef struct _GstTimedValueControlSourcePrivate GstTimedValueControlSourcePrivate;
typedef struct _GstControlPoint GstControlPoint;
/**
* GstControlPoint:
*
* a internal structure for value+time and various temporary
* values used for interpolation. This "inherits" from
* GstTimedValue.
*/
struct _GstControlPoint
{
/* fields from GstTimedValue. DO NOT CHANGE! */
GstClockTime timestamp; /* timestamp of the value change */
gdouble value; /* the new value */
/* internal fields */
/* Caches for the interpolators */
/* FIXME: we should not have this here already ... */
union {
struct {
gdouble h;
gdouble z;
} cubic;
} cache;
};
/**
* GstTimedValueControlSource:
*
* The instance structure of #GstControlSource.
*/
struct _GstTimedValueControlSource {
GstControlSource parent;
/*< protected >*/
GMutex lock;
GSequence *values; /* List of GstControlPoint */
gint nvalues; /* Number of control points */
gboolean valid_cache;
/*< private >*/
GstTimedValueControlSourcePrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstTimedValueControlSourceClass {
GstControlSourceClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
#define GST_TIMED_VALUE_CONTROL_SOURCE_LOCK(o) \
g_mutex_lock(&((GstTimedValueControlSource *)o)->lock)
#define GST_TIMED_VALUE_CONTROL_SOURCE_UNLOCK(o) \
g_mutex_unlock(&((GstTimedValueControlSource *)o)->lock)
GType gst_timed_value_control_source_get_type (void);
/* Functions */
GSequenceIter * gst_timed_value_control_source_find_control_point_iter (
GstTimedValueControlSource * self,
GstClockTime timestamp);
gboolean gst_timed_value_control_source_set (GstTimedValueControlSource * self,
GstClockTime timestamp,
const gdouble value);
gboolean gst_timed_value_control_source_set_from_list (GstTimedValueControlSource * self,
const GSList * timedvalues);
gboolean gst_timed_value_control_source_unset (GstTimedValueControlSource * self,
GstClockTime timestamp);
void gst_timed_value_control_source_unset_all (GstTimedValueControlSource *self);
GList * gst_timed_value_control_source_get_all (GstTimedValueControlSource * self);
gint gst_timed_value_control_source_get_count (GstTimedValueControlSource * self);
void gst_timed_value_control_invalidate_cache (GstTimedValueControlSource * self);
G_END_DECLS
#endif /* __GST_TIMED_VALUE_CONTROL_SOURCE_H__ */
@@ -0,0 +1,83 @@
/* GStreamer
*
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
* 2011 Stefan Sauer <ensonic@users.sf.net>
*
* gsttriggercontrolsource.h: Control source that provides some values at time-
* stamps
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_TRIGGER_CONTROL_SOURCE_H__
#define __GST_TRIGGER_CONTROL_SOURCE_H__
#include <glib-object.h>
#include <gst/gst.h>
#include <gst/controller/gsttimedvaluecontrolsource.h>
G_BEGIN_DECLS
#define GST_TYPE_TRIGGER_CONTROL_SOURCE \
(gst_trigger_control_source_get_type ())
#define GST_TRIGGER_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TRIGGER_CONTROL_SOURCE, GstTriggerControlSource))
#define GST_TRIGGER_CONTROL_SOURCE_CLASS(vtable) \
(G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_TRIGGER_CONTROL_SOURCE, GstTriggerControlSourceClass))
#define GST_IS_TRIGGER_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TRIGGER_CONTROL_SOURCE))
#define GST_IS_TRIGGER_CONTROL_SOURCE_CLASS(vtable) \
(G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_TRIGGER_CONTROL_SOURCE))
#define GST_TRIGGER_CONTROL_SOURCE_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_TRIGGER_CONTROL_SOURCE, GstTriggerControlSourceClass))
#define GST_TYPE_TRIGGER_WAVEFORM (gst_trigger_waveform_get_type ())
typedef struct _GstTriggerControlSource GstTriggerControlSource;
typedef struct _GstTriggerControlSourceClass GstTriggerControlSourceClass;
typedef struct _GstTriggerControlSourcePrivate GstTriggerControlSourcePrivate;
/**
* GstTriggerControlSource:
*
* The instance structure of #GstControlSource.
*/
struct _GstTriggerControlSource {
GstTimedValueControlSource parent;
/*< private >*/
GstTriggerControlSourcePrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstTriggerControlSourceClass {
GstTimedValueControlSourceClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_trigger_control_source_get_type (void);
/* Functions */
GstControlSource *gst_trigger_control_source_new (void);
G_END_DECLS
#endif /* __GST_TRIGGER_CONTROL_SOURCE_H__ */
@@ -0,0 +1,53 @@
/* GStreamer
* Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <glib.h>
#include <math.h>
#ifndef __GST_FFT_H__
#define __GST_FFT_H__
G_BEGIN_DECLS
/**
* GstFFTWindow:
* @GST_FFT_WINDOW_RECTANGULAR: Rectangular window
* @GST_FFT_WINDOW_HAMMING: Hamming window
* @GST_FFT_WINDOW_HANN: Hann (sometimes also called Hanning) window
* @GST_FFT_WINDOW_BARTLETT: Bartlett window
* @GST_FFT_WINDOW_BLACKMAN: Blackman window
*
* The various window functions available.
*/
typedef enum
{
GST_FFT_WINDOW_RECTANGULAR,
GST_FFT_WINDOW_HAMMING,
GST_FFT_WINDOW_HANN,
GST_FFT_WINDOW_BARTLETT,
GST_FFT_WINDOW_BLACKMAN
} GstFFTWindow;
/* Functions */
gint gst_fft_next_fast_length (gint n) G_GNUC_CONST;
G_END_DECLS
#endif /* __GST_FFT_H__ */
@@ -0,0 +1,63 @@
/* GStreamer
* Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_FFT_F32_H__
#define __GST_FFT_F32_H__
#include <glib.h>
#include <gst/gst.h>
#include "gstfft.h"
G_BEGIN_DECLS
typedef struct _GstFFTF32 GstFFTF32;
typedef struct _GstFFTF32Complex GstFFTF32Complex;
/* Copy of kiss_fft_f32_cpx for documentation reasons,
* do NOT change! */
/**
* GstFFTF32Complex:
* @r: Real part
* @i: Imaginary part
*
* Data type for complex numbers composed of
* 32 bit float.
*/
struct _GstFFTF32Complex
{
gfloat r;
gfloat i;
};
/* Functions */
GstFFTF32 * gst_fft_f32_new (gint len, gboolean inverse);
void gst_fft_f32_free (GstFFTF32 *self);
void gst_fft_f32_fft (GstFFTF32 *self, const gfloat *timedata,
GstFFTF32Complex *freqdata);
void gst_fft_f32_inverse_fft (GstFFTF32 *self, const GstFFTF32Complex *freqdata,
gfloat *timedata);
void gst_fft_f32_window (GstFFTF32 *self, gfloat *timedata, GstFFTWindow window);
G_END_DECLS
#endif /* __GST_FFT_F32_H__ */
@@ -0,0 +1,63 @@
/* GStreamer
* Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_FFT_F64_H__
#define __GST_FFT_F64_H__
#include <glib.h>
#include <gst/gst.h>
#include "gstfft.h"
G_BEGIN_DECLS
typedef struct _GstFFTF64 GstFFTF64;
typedef struct _GstFFTF64Complex GstFFTF64Complex;
/* Copy of kiss_fft_f64_cpx for documentation reasons,
* do NOT change! */
/**
* GstFFTF64Complex:
* @r: Real part
* @i: Imaginary part
*
* Data type for complex numbers composed of
* 64 bit float.
*/
struct _GstFFTF64Complex
{
gdouble r;
gdouble i;
};
/* Functions */
GstFFTF64 * gst_fft_f64_new (gint len, gboolean inverse);
void gst_fft_f64_free (GstFFTF64 *self);
void gst_fft_f64_fft (GstFFTF64 *self, const gdouble *timedata,
GstFFTF64Complex *freqdata);
void gst_fft_f64_inverse_fft (GstFFTF64 *self, const GstFFTF64Complex *freqdata,
gdouble *timedata);
void gst_fft_f64_window (GstFFTF64 *self, gdouble *timedata, GstFFTWindow window);
G_END_DECLS
#endif /* __GST_FFT_F64_H__ */
@@ -0,0 +1,63 @@
/* GStreamer
* Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_FFT_S16_H__
#define __GST_FFT_S16_H__
#include <glib.h>
#include <gst/gst.h>
#include "gstfft.h"
G_BEGIN_DECLS
typedef struct _GstFFTS16 GstFFTS16;
typedef struct _GstFFTS16Complex GstFFTS16Complex;
/* Copy of kiss_fft_s16_cpx for documentation reasons,
* do NOT change! */
/**
* GstFFTS16Complex:
* @r: Real part
* @i: Imaginary part
*
* Data type for complex numbers composed of
* signed 16 bit integers.
*/
struct _GstFFTS16Complex
{
gint16 r;
gint16 i;
};
/* Functions */
GstFFTS16 * gst_fft_s16_new (gint len, gboolean inverse);
void gst_fft_s16_free (GstFFTS16 *self);
void gst_fft_s16_fft (GstFFTS16 *self, const gint16 *timedata,
GstFFTS16Complex *freqdata);
void gst_fft_s16_inverse_fft (GstFFTS16 *self, const GstFFTS16Complex *freqdata,
gint16 *timedata);
void gst_fft_s16_window (GstFFTS16 *self, gint16 *timedata, GstFFTWindow window);
G_END_DECLS
#endif /* __GST_FFT_S16_H__ */
@@ -0,0 +1,63 @@
/* GStreamer
* Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_FFT_S32_H__
#define __GST_FFT_S32_H__
#include <glib.h>
#include <gst/gst.h>
#include "gstfft.h"
G_BEGIN_DECLS
typedef struct _GstFFTS32 GstFFTS32;
typedef struct _GstFFTS32Complex GstFFTS32Complex;
/* Copy of kiss_fft_s32_cpx for documentation reasons,
* do NOT change! */
/**
* GstFFTS32Complex:
* @r: Real part
* @i: Imaginary part
*
* Data type for complex numbers composed of
* signed 32 bit integers.
*/
struct _GstFFTS32Complex
{
gint32 r;
gint32 i;
};
/* Functions */
GstFFTS32 * gst_fft_s32_new (gint len, gboolean inverse);
void gst_fft_s32_free (GstFFTS32 *self);
void gst_fft_s32_fft (GstFFTS32 *self, const gint32 *timedata,
GstFFTS32Complex *freqdata);
void gst_fft_s32_inverse_fft (GstFFTS32 *self, const GstFFTS32Complex *freqdata,
gint32 *timedata);
void gst_fft_s32_window (GstFFTS32 *self, gint32 *timedata, GstFFTWindow window);
G_END_DECLS
#endif /* __GST_FFT_S32_H__ */
@@ -0,0 +1,37 @@
/* GStreamer
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* glib-compat.h: Public GLib compatibility shims
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-2000. See the AUTHORS file from
* glib-2.8.0 for a list of people on the GLib Team. See the ChangeLog files
* from glib-2.8.0 for a list of changes. These files are distributed with GLib
* at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GST_GLIB_COMPAT_H__
#define __GST_GLIB_COMPAT_H__
G_BEGIN_DECLS
G_END_DECLS
#endif /* __GST_GLIB_COMPAT_H__ */
@@ -0,0 +1,108 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gst.h: Main header for GStreamer, apps should include this
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_H__
#define __GST_H__
#include <glib.h>
#include <gst/glib-compat.h>
#include <gst/gstenumtypes.h>
#include <gst/gstversion.h>
#include <gst/gstbin.h>
#include <gst/gstbuffer.h>
#include <gst/gstbufferlist.h>
#include <gst/gstbufferpool.h>
#include <gst/gstcaps.h>
#include <gst/gstchildproxy.h>
#include <gst/gstclock.h>
#include <gst/gstcontrolsource.h>
#include <gst/gstdatetime.h>
#include <gst/gstdebugutils.h>
#include <gst/gstelement.h>
#include <gst/gstelementmetadata.h>
#include <gst/gsterror.h>
#include <gst/gstevent.h>
#include <gst/gstghostpad.h>
#include <gst/gstinfo.h>
#include <gst/gstiterator.h>
#include <gst/gstmessage.h>
#include <gst/gstmemory.h>
#include <gst/gstmeta.h>
#include <gst/gstminiobject.h>
#include <gst/gstobject.h>
#include <gst/gstpad.h>
#include <gst/gstparamspecs.h>
#include <gst/gstpipeline.h>
#include <gst/gstplugin.h>
#include <gst/gstpoll.h>
#include <gst/gstpreset.h>
#include <gst/gstquery.h>
#include <gst/gstregistry.h>
#include <gst/gstsample.h>
#include <gst/gstsegment.h>
#include <gst/gststructure.h>
#include <gst/gstsystemclock.h>
#include <gst/gsttaglist.h>
#include <gst/gsttagsetter.h>
#include <gst/gsttask.h>
#include <gst/gsttaskpool.h>
#include <gst/gsttoc.h>
#include <gst/gsttocsetter.h>
#include <gst/gsttypefind.h>
#include <gst/gsttypefindfactory.h>
#include <gst/gsturi.h>
#include <gst/gstutils.h>
#include <gst/gstvalue.h>
#include <gst/gstparse.h>
/* API compatibility stuff */
#include <gst/gstcompat.h>
G_BEGIN_DECLS
void gst_init (int *argc, char **argv[]);
gboolean gst_init_check (int *argc, char **argv[],
GError ** err);
gboolean gst_is_initialized (void);
GOptionGroup * gst_init_get_option_group (void);
void gst_deinit (void);
void gst_version (guint *major, guint *minor,
guint *micro, guint *nano);
gchar * gst_version_string (void);
gboolean gst_segtrap_is_enabled (void);
void gst_segtrap_set_enabled (gboolean enabled);
gboolean gst_registry_fork_is_enabled (void);
void gst_registry_fork_set_enabled (gboolean enabled);
gboolean gst_update_registry (void);
G_END_DECLS
#endif /* __GST_H__ */
@@ -0,0 +1,159 @@
/* GStreamer
* Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.be>
*
* gstallocator.h: Header for memory allocation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_ALLOCATOR_H__
#define __GST_ALLOCATOR_H__
#include <gst/gstmemory.h>
G_BEGIN_DECLS
typedef struct _GstAllocatorPrivate GstAllocatorPrivate;
typedef struct _GstAllocatorClass GstAllocatorClass;
#define GST_TYPE_ALLOCATOR (gst_allocator_get_type())
#define GST_IS_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_ALLOCATOR))
#define GST_IS_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_ALLOCATOR))
#define GST_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ALLOCATOR, GstAllocatorClass))
#define GST_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_ALLOCATOR, GstAllocator))
#define GST_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_ALLOCATOR, GstAllocatorClass))
#define GST_ALLOCATOR_CAST(obj) ((GstAllocator *)(obj))
#define GST_TYPE_ALLOCATION_PARAMS (gst_allocation_params_get_type())
GType gst_allocation_params_get_type(void);
typedef struct _GstAllocationParams GstAllocationParams;
/**
* gst_memory_alignment:
*
* The default memory alignment in bytes - 1
* an alignment of 7 would be the same as what malloc() guarantees.
*/
GST_EXPORT gsize gst_memory_alignment;
/**
* GST_ALLOCATOR_SYSMEM:
*
* The allocator name for the default system memory allocator
*/
#define GST_ALLOCATOR_SYSMEM "SystemMemory"
/**
* GstAllocationParams:
* @flags: flags to control allocation
* @align: the desired alignment of the memory
* @prefix: the desired prefix
* @padding: the desired padding
*
* Parameters to control the allocation of memory
*/
struct _GstAllocationParams {
GstMemoryFlags flags;
gsize align;
gsize prefix;
gsize padding;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstAllocatorFlags:
* @GST_ALLOCATOR_FLAG_CUSTOM_ALLOC: The allocator has a custom alloc function.
* @GST_ALLOCATOR_FLAG_LAST: first flag that can be used for custom purposes
*
* Flags for allocators.
*/
typedef enum {
GST_ALLOCATOR_FLAG_CUSTOM_ALLOC = (GST_OBJECT_FLAG_LAST << 0),
GST_ALLOCATOR_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
} GstAllocatorFlags;
/**
* GstAllocator:
* @object: parent structure
* @mem_type: the memory type this allocator provides
* @mem_map: the implementation of the GstMemoryMapFunction
* @mem_unmap: the implementation of the GstMemoryUnmapFunction
* @mem_copy: the implementation of the GstMemoryCopyFunction
* @mem_share: the implementation of the GstMemoryShareFunction
* @mem_is_span: the implementation of the GstMemoryIsSpanFunction
*
* The #GstAllocator is used to create new memory.
*/
struct _GstAllocator
{
GstObject object;
const gchar *mem_type;
GstMemoryMapFunction mem_map;
GstMemoryUnmapFunction mem_unmap;
GstMemoryCopyFunction mem_copy;
GstMemoryShareFunction mem_share;
GstMemoryIsSpanFunction mem_is_span;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
GstAllocatorPrivate *priv;
};
struct _GstAllocatorClass {
GstObjectClass object_class;
GstMemory * (*alloc) (GstAllocator *allocator, gsize size,
GstAllocationParams *params);
void (*free) (GstAllocator *allocator, GstMemory *memory);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_allocator_get_type(void);
/* allocators */
void gst_allocator_register (const gchar *name, GstAllocator *allocator);
GstAllocator * gst_allocator_find (const gchar *name);
void gst_allocator_set_default (GstAllocator * allocator);
/* allocation parameters */
void gst_allocation_params_init (GstAllocationParams *params);
GstAllocationParams *
gst_allocation_params_copy (const GstAllocationParams *params) G_GNUC_MALLOC;
void gst_allocation_params_free (GstAllocationParams *params);
/* allocating memory blocks */
GstMemory * gst_allocator_alloc (GstAllocator * allocator, gsize size,
GstAllocationParams *params);
void gst_allocator_free (GstAllocator * allocator, GstMemory *memory);
GstMemory * gst_memory_new_wrapped (GstMemoryFlags flags, gpointer data, gsize maxsize,
gsize offset, gsize size, gpointer user_data,
GDestroyNotify notify);
G_END_DECLS
#endif /* __GST_ALLOCATOR_H__ */
@@ -0,0 +1,57 @@
/* GStreamer
* Copyright (C) 2009-2010 Edward Hervey <bilboed@bilboed.com>
* (C) 2011 Wim Taymans <wim.taymans@gmail.com>
*
* gstatomicqueue.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <glib.h>
#ifndef __GST_ATOMIC_QUEUE_H__
#define __GST_ATOMIC_QUEUE_H__
G_BEGIN_DECLS
#define GST_TYPE_ATOMIC_QUEUE (gst_atomic_queue_get_type())
/**
* GstAtomicQueue:
*
* Opaque atomic data queue.
*
* Use the acessor functions to get the stored values.
*/
typedef struct _GstAtomicQueue GstAtomicQueue;
GType gst_atomic_queue_get_type (void);
GstAtomicQueue * gst_atomic_queue_new (guint initial_size) G_GNUC_MALLOC;
void gst_atomic_queue_ref (GstAtomicQueue * queue);
void gst_atomic_queue_unref (GstAtomicQueue * queue);
void gst_atomic_queue_push (GstAtomicQueue* queue, gpointer data);
gpointer gst_atomic_queue_pop (GstAtomicQueue* queue);
gpointer gst_atomic_queue_peek (GstAtomicQueue* queue);
guint gst_atomic_queue_length (GstAtomicQueue * queue);
G_END_DECLS
#endif /* __GST_ATOMIC_QUEUE_H__ */
@@ -0,0 +1,204 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstbin.h: Header for GstBin container object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BIN_H__
#define __GST_BIN_H__
#include <gst/gstelement.h>
#include <gst/gstiterator.h>
#include <gst/gstbus.h>
G_BEGIN_DECLS
#define GST_TYPE_BIN (gst_bin_get_type ())
#define GST_IS_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BIN))
#define GST_IS_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BIN))
#define GST_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BIN, GstBinClass))
#define GST_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_BIN, GstBin))
#define GST_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BIN, GstBinClass))
#define GST_BIN_CAST(obj) ((GstBin*)(obj))
/**
* GstBinFlags:
* @GST_BIN_FLAG_NO_RESYNC: don't resync a state change when elements are
* added or linked in the bin (Since 1.0.5)
* @GST_BIN_FLAG_LAST: the last enum in the series of flags for bins.
* Derived classes can use this as first value in a list of flags.
*
* GstBinFlags are a set of flags specific to bins. Most are set/used
* internally. They can be checked using the GST_OBJECT_FLAG_IS_SET () macro,
* and (un)set using GST_OBJECT_FLAG_SET () and GST_OBJECT_FLAG_UNSET ().
*/
typedef enum {
GST_BIN_FLAG_NO_RESYNC = (GST_ELEMENT_FLAG_LAST << 0),
/* padding */
GST_BIN_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 5)
} GstBinFlags;
/**
* GST_BIN_IS_NO_RESYNC:
* @bin: A #GstBin
*
* Check if @bin will resync its state change when elements are added and
* removed.
*
* Since: 1.0.5
*/
#define GST_BIN_IS_NO_RESYNC(bin) (GST_OBJECT_FLAG_IS_SET(bin,GST_BIN_FLAG_NO_RESYNC))
typedef struct _GstBin GstBin;
typedef struct _GstBinClass GstBinClass;
typedef struct _GstBinPrivate GstBinPrivate;
/**
* GST_BIN_NUMCHILDREN:
* @bin: a #GstBin
*
* Gets the number of children in a bin.
*/
#define GST_BIN_NUMCHILDREN(bin) (GST_BIN_CAST(bin)->numchildren)
/**
* GST_BIN_CHILDREN:
* @bin: a #GstBin
*
* Gets the list with children in a bin.
*/
#define GST_BIN_CHILDREN(bin) (GST_BIN_CAST(bin)->children)
/**
* GST_BIN_CHILDREN_COOKIE:
* @bin: a #GstBin
*
* Gets the children cookie that watches the children list.
*/
#define GST_BIN_CHILDREN_COOKIE(bin) (GST_BIN_CAST(bin)->children_cookie)
/**
* GstBin:
* @numchildren: the number of children in this bin
* @children: (element-type Gst.Element): the list of children in this bin
* @children_cookie: updated whenever @children changes
* @child_bus: internal bus for handling child messages
* @messages: (element-type Gst.Message): queued and cached messages
* @polling: the bin is currently calculating its state
* @state_dirty: the bin needs to recalculate its state (deprecated)
* @clock_dirty: the bin needs to select a new clock
* @provided_clock: the last clock selected
* @clock_provider: the element that provided @provided_clock
*
* The GstBin base class. Subclasses can access these fields provided
* the LOCK is taken.
*/
struct _GstBin {
GstElement element;
/*< public >*/ /* with LOCK */
/* our children, subclass are supposed to update these
* fields to reflect their state with _iterate_*() */
gint numchildren;
GList *children;
guint32 children_cookie;
GstBus *child_bus;
GList *messages;
gboolean polling;
gboolean state_dirty;
gboolean clock_dirty;
GstClock *provided_clock;
GstElement *clock_provider;
/*< private >*/
GstBinPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstBinClass:
* @parent_class: bin parent class
* @add_element: method to add an element to a bin
* @remove_element: method to remove an element from a bin
* @handle_message: method to handle a message from the children
*
* Subclasses can override the @add_element and @remove_element to
* update the list of children in the bin.
*
* The @handle_message method can be overridden to implement custom
* message handling. @handle_message takes ownership of the message, just like
* #gst_element_post_message.
*/
struct _GstBinClass {
GstElementClass parent_class;
/*< private >*/
GThreadPool *pool;
/* signals */
void (*element_added) (GstBin *bin, GstElement *child);
void (*element_removed) (GstBin *bin, GstElement *child);
/*< public >*/
/* virtual methods for subclasses */
gboolean (*add_element) (GstBin *bin, GstElement *element);
gboolean (*remove_element) (GstBin *bin, GstElement *element);
void (*handle_message) (GstBin *bin, GstMessage *message);
/*< private >*/
/* signal */
gboolean (*do_latency) (GstBin *bin);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_bin_get_type (void);
GstElement* gst_bin_new (const gchar *name);
/* add and remove elements from the bin */
gboolean gst_bin_add (GstBin *bin, GstElement *element);
gboolean gst_bin_remove (GstBin *bin, GstElement *element);
/* retrieve a single child */
GstElement* gst_bin_get_by_name (GstBin *bin, const gchar *name);
GstElement* gst_bin_get_by_name_recurse_up (GstBin *bin, const gchar *name);
GstElement* gst_bin_get_by_interface (GstBin *bin, GType iface);
/* retrieve multiple children */
GstIterator* gst_bin_iterate_elements (GstBin *bin);
GstIterator* gst_bin_iterate_sorted (GstBin *bin);
GstIterator* gst_bin_iterate_recurse (GstBin *bin);
GstIterator* gst_bin_iterate_sinks (GstBin *bin);
GstIterator* gst_bin_iterate_sources (GstBin *bin);
GstIterator* gst_bin_iterate_all_by_interface (GstBin *bin, GType iface);
/* latency */
gboolean gst_bin_recalculate_latency (GstBin * bin);
G_END_DECLS
#endif /* __GST_BIN_H__ */
@@ -0,0 +1,543 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstbuffer.h: Header for GstBuffer object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BUFFER_H__
#define __GST_BUFFER_H__
#include <gst/gstminiobject.h>
#include <gst/gstclock.h>
#include <gst/gstallocator.h>
G_BEGIN_DECLS
GST_EXPORT GType _gst_buffer_type;
typedef struct _GstBuffer GstBuffer;
typedef struct _GstBufferPool GstBufferPool;
#define GST_TYPE_BUFFER (_gst_buffer_type)
#define GST_IS_BUFFER(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_BUFFER))
#define GST_BUFFER_CAST(obj) ((GstBuffer *)(obj))
#define GST_BUFFER(obj) (GST_BUFFER_CAST(obj))
/**
* GST_BUFFER_FLAGS:
* @buf: a #GstBuffer.
*
* A flags word containing #GstBufferFlag flags set on this buffer.
*/
#define GST_BUFFER_FLAGS(buf) GST_MINI_OBJECT_FLAGS(buf)
/**
* GST_BUFFER_FLAG_IS_SET:
* @buf: a #GstBuffer.
* @flag: the #GstBufferFlag to check.
*
* Gives the status of a specific flag on a buffer.
*/
#define GST_BUFFER_FLAG_IS_SET(buf,flag) GST_MINI_OBJECT_FLAG_IS_SET (buf, flag)
/**
* GST_BUFFER_FLAG_SET:
* @buf: a #GstBuffer.
* @flag: the #GstBufferFlag to set.
*
* Sets a buffer flag on a buffer.
*/
#define GST_BUFFER_FLAG_SET(buf,flag) GST_MINI_OBJECT_FLAG_SET (buf, flag)
/**
* GST_BUFFER_FLAG_UNSET:
* @buf: a #GstBuffer.
* @flag: the #GstBufferFlag to clear.
*
* Clears a buffer flag.
*/
#define GST_BUFFER_FLAG_UNSET(buf,flag) GST_MINI_OBJECT_FLAG_UNSET (buf, flag)
/**
* GST_BUFFER_PTS:
* @buf: a #GstBuffer.:
*
* The presentation timestamp (pts) in nanoseconds (as a #GstClockTime)
* of the data in the buffer. This is the timestamp when the media should be
* presented to the user.
* Value will be %GST_CLOCK_TIME_NONE if the pts is unknown.
*/
#define GST_BUFFER_PTS(buf) (GST_BUFFER_CAST(buf)->pts)
/**
* GST_BUFFER_DTS:
* @buf: a #GstBuffer.:
*
* The decoding timestamp (dts) in nanoseconds (as a #GstClockTime)
* of the data in the buffer. This is the timestamp when the media should be
* decoded or processed otherwise.
* Value will be %GST_CLOCK_TIME_NONE if the dts is unknown.
*/
#define GST_BUFFER_DTS(buf) (GST_BUFFER_CAST(buf)->dts)
/**
* GST_BUFFER_DURATION:
* @buf: a #GstBuffer.
*
* The duration in nanoseconds (as a #GstClockTime) of the data in the buffer.
* Value will be %GST_CLOCK_TIME_NONE if the duration is unknown.
*/
#define GST_BUFFER_DURATION(buf) (GST_BUFFER_CAST(buf)->duration)
/**
* GST_BUFFER_OFFSET:
* @buf: a #GstBuffer.
*
* The offset in the source file of the beginning of this buffer.
*/
#define GST_BUFFER_OFFSET(buf) (GST_BUFFER_CAST(buf)->offset)
/**
* GST_BUFFER_OFFSET_END:
* @buf: a #GstBuffer.
*
* The offset in the source file of the end of this buffer.
*/
#define GST_BUFFER_OFFSET_END(buf) (GST_BUFFER_CAST(buf)->offset_end)
/**
* GST_BUFFER_OFFSET_NONE:
*
* Constant for no-offset return results.
*/
#define GST_BUFFER_OFFSET_NONE ((guint64)-1)
/**
* GST_BUFFER_DURATION_IS_VALID:
* @buffer: a #GstBuffer
*
* Tests if the duration is known.
*/
#define GST_BUFFER_DURATION_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)))
/**
* GST_BUFFER_PTS_IS_VALID:
* @buffer: a #GstBuffer
*
* Tests if the pts is known.
*/
#define GST_BUFFER_PTS_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (buffer)))
/**
* GST_BUFFER_DTS_IS_VALID:
* @buffer: a #GstBuffer
*
* Tests if the dts is known.
*/
#define GST_BUFFER_DTS_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buffer)))
/**
* GST_BUFFER_OFFSET_IS_VALID:
* @buffer: a #GstBuffer
*
* Tests if the start offset is known.
*/
#define GST_BUFFER_OFFSET_IS_VALID(buffer) (GST_BUFFER_OFFSET (buffer) != GST_BUFFER_OFFSET_NONE)
/**
* GST_BUFFER_OFFSET_END_IS_VALID:
* @buffer: a #GstBuffer
*
* Tests if the end offset is known.
*/
#define GST_BUFFER_OFFSET_END_IS_VALID(buffer) (GST_BUFFER_OFFSET_END (buffer) != GST_BUFFER_OFFSET_NONE)
/**
* GST_BUFFER_IS_DISCONT:
* @buffer: a #GstBuffer
*
* Tests if the buffer marks a discontinuity in the stream.
*/
#define GST_BUFFER_IS_DISCONT(buffer) (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT))
/**
* GstBufferFlags:
* @GST_BUFFER_FLAG_LIVE: the buffer is live data and should be discarded in
* the PAUSED state.
* @GST_BUFFER_FLAG_DECODE_ONLY: the buffer contains data that should be dropped
* because it will be clipped against the segment
* boundaries or because it does not contain data
* that should be shown to the user.
* @GST_BUFFER_FLAG_DISCONT: the buffer marks a data discontinuity in the stream.
* This typically occurs after a seek or a dropped buffer
* from a live or network source.
* @GST_BUFFER_FLAG_RESYNC: the buffer timestamps might have a discontinuity
* and this buffer is a good point to resynchronize.
* @GST_BUFFER_FLAG_CORRUPTED: the buffer data is corrupted.
* @GST_BUFFER_FLAG_MARKER: the buffer contains a media specific marker. for
* video this is typically the end of a frame boundary, for audio
* this is usually the start of a talkspurt.
* @GST_BUFFER_FLAG_HEADER: the buffer contains header information that is
* needed to decode the following data.
* @GST_BUFFER_FLAG_GAP: the buffer has been created to fill a gap in the
* stream and contains media neutral data (elements can
* switch to optimized code path that ignores the buffer
* content).
* @GST_BUFFER_FLAG_DROPPABLE: the buffer can be dropped without breaking the
* stream, for example to reduce bandwidth.
* @GST_BUFFER_FLAG_DELTA_UNIT: this unit cannot be decoded independently.
* @GST_BUFFER_FLAG_LAST: additional media specific flags can be added starting from
* this flag.
*
* A set of buffer flags used to describe properties of a #GstBuffer.
*/
typedef enum {
GST_BUFFER_FLAG_LIVE = (GST_MINI_OBJECT_FLAG_LAST << 0),
GST_BUFFER_FLAG_DECODE_ONLY = (GST_MINI_OBJECT_FLAG_LAST << 1),
GST_BUFFER_FLAG_DISCONT = (GST_MINI_OBJECT_FLAG_LAST << 2),
GST_BUFFER_FLAG_RESYNC = (GST_MINI_OBJECT_FLAG_LAST << 3),
GST_BUFFER_FLAG_CORRUPTED = (GST_MINI_OBJECT_FLAG_LAST << 4),
GST_BUFFER_FLAG_MARKER = (GST_MINI_OBJECT_FLAG_LAST << 5),
GST_BUFFER_FLAG_HEADER = (GST_MINI_OBJECT_FLAG_LAST << 6),
GST_BUFFER_FLAG_GAP = (GST_MINI_OBJECT_FLAG_LAST << 7),
GST_BUFFER_FLAG_DROPPABLE = (GST_MINI_OBJECT_FLAG_LAST << 8),
GST_BUFFER_FLAG_DELTA_UNIT = (GST_MINI_OBJECT_FLAG_LAST << 9),
GST_BUFFER_FLAG_LAST = (GST_MINI_OBJECT_FLAG_LAST << 16)
} GstBufferFlags;
/**
* GstBuffer:
* @mini_object: the parent structure
* @pool: pointer to the pool owner of the buffer
* @pts: presentation timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
* pts is not known or relevant. The pts contains the timestamp when the
* media should be presented to the user.
* @dts: decoding timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
* dts is not known or relevant. The dts contains the timestamp when the
* media should be processed.
* @duration: duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
* when the duration is not known or relevant.
* @offset: a media specific offset for the buffer data.
* For video frames, this is the frame number of this buffer.
* For audio samples, this is the offset of the first sample in this buffer.
* For file data or compressed data this is the byte offset of the first
* byte in this buffer.
* @offset_end: the last offset contained in this buffer. It has the same
* format as @offset.
*
* The structure of a #GstBuffer. Use the associated macros to access the public
* variables.
*/
struct _GstBuffer {
GstMiniObject mini_object;
/*< public >*/ /* with COW */
GstBufferPool *pool;
/* timestamp */
GstClockTime pts;
GstClockTime dts;
GstClockTime duration;
/* media specific offset */
guint64 offset;
guint64 offset_end;
};
GType gst_buffer_get_type (void);
/* allocation */
GstBuffer * gst_buffer_new (void);
GstBuffer * gst_buffer_new_allocate (GstAllocator * allocator, gsize size,
GstAllocationParams * params);
GstBuffer * gst_buffer_new_wrapped_full (GstMemoryFlags flags, gpointer data, gsize maxsize,
gsize offset, gsize size, gpointer user_data,
GDestroyNotify notify);
GstBuffer * gst_buffer_new_wrapped (gpointer data, gsize size);
/* memory blocks */
guint gst_buffer_n_memory (GstBuffer *buffer);
void gst_buffer_insert_memory (GstBuffer *buffer, gint idx, GstMemory *mem);
void gst_buffer_replace_memory_range (GstBuffer *buffer, guint idx, gint length, GstMemory *mem);
GstMemory * gst_buffer_peek_memory (GstBuffer *buffer, guint idx);
GstMemory * gst_buffer_get_memory_range (GstBuffer *buffer, guint idx, gint length);
void gst_buffer_remove_memory_range (GstBuffer *buffer, guint idx, gint length);
void gst_buffer_prepend_memory (GstBuffer *buffer, GstMemory *mem);
void gst_buffer_append_memory (GstBuffer *buffer, GstMemory *mem);
void gst_buffer_replace_memory (GstBuffer *buffer, guint idx, GstMemory *mem);
void gst_buffer_replace_all_memory (GstBuffer *buffer, GstMemory *mem);
GstMemory * gst_buffer_get_memory (GstBuffer *buffer, guint idx);
GstMemory * gst_buffer_get_all_memory (GstBuffer *buffer);
void gst_buffer_remove_memory (GstBuffer *buffer, guint idx);
void gst_buffer_remove_all_memory (GstBuffer *buffer);
gboolean gst_buffer_find_memory (GstBuffer *buffer, gsize offset, gsize size,
guint *idx, guint *length, gsize *skip);
gsize gst_buffer_fill (GstBuffer *buffer, gsize offset,
gconstpointer src, gsize size);
gsize gst_buffer_extract (GstBuffer *buffer, gsize offset,
gpointer dest, gsize size);
gint gst_buffer_memcmp (GstBuffer *buffer, gsize offset,
gconstpointer mem, gsize size);
gsize gst_buffer_memset (GstBuffer *buffer, gsize offset,
guint8 val, gsize size);
gsize gst_buffer_get_sizes_range (GstBuffer *buffer, guint idx, gint length,
gsize *offset, gsize *maxsize);
void gst_buffer_resize_range (GstBuffer *buffer, guint idx, gint length,
gssize offset, gssize size);
gsize gst_buffer_get_sizes (GstBuffer *buffer, gsize *offset, gsize *maxsize);
gsize gst_buffer_get_size (GstBuffer *buffer);
void gst_buffer_resize (GstBuffer *buffer, gssize offset, gssize size);
void gst_buffer_set_size (GstBuffer *buffer, gssize size);
gboolean gst_buffer_map_range (GstBuffer *buffer, guint idx, gint length,
GstMapInfo *info, GstMapFlags flags);
gboolean gst_buffer_map (GstBuffer *buffer, GstMapInfo *info, GstMapFlags flags);
void gst_buffer_unmap (GstBuffer *buffer, GstMapInfo *info);
/* refcounting */
/**
* gst_buffer_ref:
* @buf: a #GstBuffer.
*
* Increases the refcount of the given buffer by one.
*
* Note that the refcount affects the writeability
* of @buf and its metadata, see gst_buffer_is_writable().
* It is important to note that keeping additional references to
* GstBuffer instances can potentially increase the number
* of memcpy operations in a pipeline.
*
* Returns: (transfer full): @buf
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstBuffer * gst_buffer_ref (GstBuffer * buf);
#endif
static inline GstBuffer *
gst_buffer_ref (GstBuffer * buf)
{
return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf));
}
/**
* gst_buffer_unref:
* @buf: (transfer full): a #GstBuffer.
*
* Decreases the refcount of the buffer. If the refcount reaches 0, the buffer
* with the associated metadata and memory will be freed.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void gst_buffer_unref (GstBuffer * buf);
#endif
static inline void
gst_buffer_unref (GstBuffer * buf)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (buf));
}
/* copy buffer */
/**
* gst_buffer_copy:
* @buf: a #GstBuffer.
*
* Create a copy of the given buffer. This will also make a newly allocated
* copy of the data the source buffer contains.
*
* Returns: (transfer full): a new copy of @buf.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstBuffer * gst_buffer_copy (const GstBuffer * buf);
#endif
static inline GstBuffer *
gst_buffer_copy (const GstBuffer * buf)
{
return GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
}
/**
* GstBufferCopyFlags:
* @GST_BUFFER_COPY_NONE: copy nothing
* @GST_BUFFER_COPY_FLAGS: flag indicating that buffer flags should be copied
* @GST_BUFFER_COPY_TIMESTAMPS: flag indicating that buffer pts, dts,
* duration, offset and offset_end should be copied
* @GST_BUFFER_COPY_MEMORY: flag indicating that buffer memory should be copied
* and appended to already existing memory
* @GST_BUFFER_COPY_MERGE: flag indicating that buffer memory should be
* merged
* @GST_BUFFER_COPY_META: flag indicating that buffer meta should be
* copied
*
* A set of flags that can be provided to the gst_buffer_copy_into()
* function to specify which items should be copied.
*/
typedef enum {
GST_BUFFER_COPY_NONE = 0,
GST_BUFFER_COPY_FLAGS = (1 << 0),
GST_BUFFER_COPY_TIMESTAMPS = (1 << 1),
GST_BUFFER_COPY_META = (1 << 2),
GST_BUFFER_COPY_MEMORY = (1 << 3),
GST_BUFFER_COPY_MERGE = (1 << 4)
} GstBufferCopyFlags;
/**
* GST_BUFFER_COPY_METADATA:
*
* Combination of all possible metadata fields that can be copied with
* gst_buffer_copy_into().
*/
#define GST_BUFFER_COPY_METADATA (GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS |\
GST_BUFFER_COPY_META)
/**
* GST_BUFFER_COPY_ALL:
*
* Combination of all possible fields that can be copied with
* gst_buffer_copy_into().
*/
#define GST_BUFFER_COPY_ALL ((GstBufferCopyFlags)(GST_BUFFER_COPY_METADATA | GST_BUFFER_COPY_MEMORY))
/* copies memory or metadata into newly allocated buffer */
void gst_buffer_copy_into (GstBuffer *dest, GstBuffer *src,
GstBufferCopyFlags flags,
gsize offset, gsize size);
/**
* gst_buffer_is_writable:
* @buf: a #GstBuffer
*
* Tests if you can safely write to a buffer's metadata or its memory array.
* It is only safe to change buffer metadata when the current reference is
* writable, i.e. nobody can see the modifications you will make.
*/
#define gst_buffer_is_writable(buf) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (buf))
/**
* gst_buffer_make_writable:
* @buf: (transfer full): a #GstBuffer
*
* Makes a writable buffer from the given buffer. If the source buffer is
* already writable, this will simply return the same buffer. A copy will
* otherwise be made using gst_buffer_copy().
*
* Returns: (transfer full): a writable buffer which may or may not be the
* same as @buf
*/
#define gst_buffer_make_writable(buf) GST_BUFFER_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (buf)))
/**
* gst_buffer_replace:
* @obuf: (inout) (transfer full): pointer to a pointer to a #GstBuffer to be
* replaced.
* @nbuf: (transfer none) (allow-none): pointer to a #GstBuffer that will
* replace the buffer pointed to by @obuf.
*
* Modifies a pointer to a #GstBuffer to point to a different #GstBuffer. The
* modification is done atomically (so this is useful for ensuring thread safety
* in some cases), and the reference counts are updated appropriately (the old
* buffer is unreffed, the new is reffed).
*
* Either @nbuf or the #GstBuffer pointed to by @obuf may be NULL.
*
* Returns: TRUE when @obuf was different from @nbuf.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC gboolean gst_buffer_replace (GstBuffer **obuf, GstBuffer *nbuf);
#endif
static inline gboolean
gst_buffer_replace (GstBuffer **obuf, GstBuffer *nbuf)
{
return gst_mini_object_replace ((GstMiniObject **) obuf, (GstMiniObject *) nbuf);
}
/* creating a region */
GstBuffer* gst_buffer_copy_region (GstBuffer *parent, GstBufferCopyFlags flags,
gsize offset, gsize size);
/* append two buffers */
GstBuffer* gst_buffer_append_region (GstBuffer *buf1, GstBuffer *buf2,
gssize offset, gssize size);
GstBuffer* gst_buffer_append (GstBuffer *buf1, GstBuffer *buf2);
/* metadata */
#include <gst/gstmeta.h>
/**
* GstBufferForeachMetaFunc:
* @buffer: a #GstBuffer
* @meta: a pointer to a #GstMeta
* @user_data: user data passed to gst_buffer_foreach_meta()
*
* A function that will be called from gst_buffer_foreach_meta(). The @meta
* field will point to a the reference of the meta.
*
* @buffer should not be modified from this callback.
*
* When this function returns %TRUE, the next meta will be
* returned. When %FALSE is returned, gst_buffer_foreach_meta() will return.
*
* When @meta is set to NULL, the item will be removed from the buffer.
*
* Returns: %FALSE when gst_buffer_foreach_meta() should stop
*/
typedef gboolean (*GstBufferForeachMetaFunc) (GstBuffer *buffer, GstMeta **meta,
gpointer user_data);
GstMeta * gst_buffer_get_meta (GstBuffer *buffer, GType api);
GstMeta * gst_buffer_add_meta (GstBuffer *buffer, const GstMetaInfo *info,
gpointer params);
gboolean gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta);
GstMeta * gst_buffer_iterate_meta (GstBuffer *buffer, gpointer *state);
gboolean gst_buffer_foreach_meta (GstBuffer *buffer,
GstBufferForeachMetaFunc func,
gpointer user_data);
/**
* gst_value_set_buffer:
* @v: a #GValue to receive the data
* @b: (transfer none): a #GstBuffer to assign to the GstValue
*
* Sets @b as the value of @v. Caller retains reference to buffer.
*/
#define gst_value_set_buffer(v,b) g_value_set_boxed((v),(b))
/**
* gst_value_take_buffer:
* @v: a #GValue to receive the data
* @b: (transfer full): a #GstBuffer to assign to the GstValue
*
* Sets @b as the value of @v. Caller gives away reference to buffer.
*/
#define gst_value_take_buffer(v,b) g_value_take_boxed(v,(b))
/**
* gst_value_get_buffer:
* @v: a #GValue to query
*
* Receives a #GstBuffer as the value of @v. Does not return a reference to
* the buffer, so the pointer is only valid for as long as the caller owns
* a reference to @v.
*
* Returns: (transfer none): buffer
*/
#define gst_value_get_buffer(v) GST_BUFFER_CAST (g_value_get_boxed(v))
G_END_DECLS
#endif /* __GST_BUFFER_H__ */
@@ -0,0 +1,166 @@
/* GStreamer
* Copyright (C) 2009 Axis Communications <dev-gstreamer at axis dot com>
* @author Jonas Holmberg <jonas dot holmberg at axis dot com>
*
* gstbufferlist.h: Header for GstBufferList object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BUFFER_LIST_H__
#define __GST_BUFFER_LIST_H__
#include <gst/gstbuffer.h>
G_BEGIN_DECLS
GST_EXPORT GType _gst_buffer_list_type;
#define GST_TYPE_BUFFER_LIST (_gst_buffer_list_type)
#define GST_IS_BUFFER_LIST(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_BUFFER_LIST))
#define GST_BUFFER_LIST_CAST(obj) ((GstBufferList *)obj)
#define GST_BUFFER_LIST(obj) (GST_BUFFER_LIST_CAST(obj))
typedef struct _GstBufferList GstBufferList;
/**
* GstBufferListFunc:
* @buffer: pointer the buffer
* @idx: the index of @buffer
* @user_data: user data passed to gst_buffer_list_foreach()
*
* A function that will be called from gst_buffer_list_foreach(). The @buffer
* field will point to a the reference of the buffer at @idx.
*
* When this function returns %TRUE, the next buffer will be
* returned. When %FALSE is returned, gst_buffer_list_foreach() will return.
*
* When @buffer is set to NULL, the item will be removed from the bufferlist.
* When @buffer has been made writable, the new buffer reference can be assigned
* to @buffer. This function is responsible for unreffing the old buffer when
* removing or modifying.
*
* Returns: %FALSE when gst_buffer_list_foreach() should stop
*/
typedef gboolean (*GstBufferListFunc) (GstBuffer **buffer, guint idx,
gpointer user_data);
/* refcounting */
/**
* gst_buffer_list_ref:
* @list: a #GstBufferList
*
* Increases the refcount of the given buffer list by one.
*
* Note that the refcount affects the writeability of @list and its data, see
* gst_buffer_list_make_writable(). It is important to note that keeping
* additional references to GstBufferList instances can potentially increase
* the number of memcpy operations in a pipeline.
*
* Returns: (transfer full): @list
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstBufferList * gst_buffer_list_ref (GstBufferList * list);
#endif
static inline GstBufferList *
gst_buffer_list_ref (GstBufferList * list)
{
return GST_BUFFER_LIST_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (
list)));
}
/**
* gst_buffer_list_unref:
* @list: (transfer full): a #GstBufferList
*
* Decreases the refcount of the buffer list. If the refcount reaches 0, the
* buffer list will be freed.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void gst_buffer_list_unref (GstBufferList * list);
#endif
static inline void
gst_buffer_list_unref (GstBufferList * list)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (list));
}
/* copy */
/**
* gst_buffer_list_copy:
* @list: a #GstBufferList
*
* Create a shallow copy of the given buffer list. This will make a newly
* allocated copy of the source list with copies of buffer pointers. The
* refcount of buffers pointed to will be increased by one.
*
* Returns: (transfer full): a new copy of @list.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstBufferList * gst_buffer_list_copy (const GstBufferList * list);
#endif
static inline GstBufferList *
gst_buffer_list_copy (const GstBufferList * list)
{
return GST_BUFFER_LIST_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (list)));
}
/**
* gst_buffer_list_is_writable:
* @list: a #GstBufferList
*
* Tests if you can safely add buffers and groups into a buffer list.
*/
#define gst_buffer_list_is_writable(list) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (list))
/**
* gst_buffer_list_make_writable:
* @list: (transfer full): a #GstBufferList
*
* Makes a writable buffer list from the given buffer list. If the source buffer
* list is already writable, this will simply return the same buffer list. A
* copy will otherwise be made using gst_buffer_list_copy().
*
* Returns: (transfer full): a writable list, which may or may not be the
* same as @list
*/
#define gst_buffer_list_make_writable(list) GST_BUFFER_LIST_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (list)))
GType gst_buffer_list_get_type (void);
/* allocation */
GstBufferList * gst_buffer_list_new (void) G_GNUC_MALLOC;
GstBufferList * gst_buffer_list_new_sized (guint size) G_GNUC_MALLOC;
guint gst_buffer_list_length (GstBufferList *list);
GstBuffer * gst_buffer_list_get (GstBufferList *list, guint idx);
void gst_buffer_list_insert (GstBufferList *list, gint idx, GstBuffer *buffer);
void gst_buffer_list_remove (GstBufferList *list, guint idx, guint length);
gboolean gst_buffer_list_foreach (GstBufferList *list,
GstBufferListFunc func,
gpointer user_data);
#define gst_buffer_list_add(l,b) gst_buffer_list_insert((l),-1,(b));
G_END_DECLS
#endif /* __GST_BUFFER_LIST_H__ */
@@ -0,0 +1,208 @@
/* GStreamer
* Copyright (C) 2010 Wim Taymans <wim.taymans@gmail.com>
*
* gstbufferpool.h: Header for GstBufferPool object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BUFFER_POOL_H__
#define __GST_BUFFER_POOL_H__
#include <gst/gstminiobject.h>
#include <gst/gstpad.h>
#include <gst/gstbuffer.h>
G_BEGIN_DECLS
typedef struct _GstBufferPoolPrivate GstBufferPoolPrivate;
typedef struct _GstBufferPoolClass GstBufferPoolClass;
#define GST_TYPE_BUFFER_POOL (gst_buffer_pool_get_type())
#define GST_IS_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BUFFER_POOL))
#define GST_IS_BUFFER_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BUFFER_POOL))
#define GST_BUFFER_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BUFFER_POOL, GstBufferPoolClass))
#define GST_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_BUFFER_POOL, GstBufferPool))
#define GST_BUFFER_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BUFFER_POOL, GstBufferPoolClass))
#define GST_BUFFER_POOL_CAST(obj) ((GstBufferPool *)(obj))
/**
* GstBufferPoolAcquireFlags:
* @GST_BUFFER_POOL_ACQUIRE_FLAG_NONE: no flags
* @GST_BUFFER_POOL_ACQUIRE_FLAG_KEY_UNIT: buffer is keyframe
* @GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT: when the bufferpool is empty, acquire_buffer
* will by default block until a buffer is released into the pool again. Setting
* this flag makes acquire_buffer return #GST_FLOW_EOS instead of blocking.
* @GST_BUFFER_POOL_ACQUIRE_FLAG_DISCONT: buffer is discont
* @GST_BUFFER_POOL_ACQUIRE_FLAG_LAST: last flag, subclasses can use private flags
* starting from this value.
*
* Additional flags to control the allocation of a buffer
*/
typedef enum {
GST_BUFFER_POOL_ACQUIRE_FLAG_NONE = 0,
GST_BUFFER_POOL_ACQUIRE_FLAG_KEY_UNIT = (1 << 0),
GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT = (1 << 1),
GST_BUFFER_POOL_ACQUIRE_FLAG_DISCONT = (1 << 2),
GST_BUFFER_POOL_ACQUIRE_FLAG_LAST = (1 << 16),
} GstBufferPoolAcquireFlags;
typedef struct _GstBufferPoolAcquireParams GstBufferPoolAcquireParams;
/**
* GstBufferPoolAcquireParams:
* @format: the format of @start and @stop
* @start: the start position
* @stop: the stop position
* @flags: additional flags
*
* Parameters passed to the gst_buffer_pool_acquire_buffer() function to control the
* allocation of the buffer.
*
* The default implementation ignores the @start and @stop members but other
* implementations can use this extra information to decide what buffer to
* return.
*/
struct _GstBufferPoolAcquireParams {
GstFormat format;
gint64 start;
gint64 stop;
GstBufferPoolAcquireFlags flags;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GST_BUFFER_POOL_IS_FLUSHING:
* @pool: a GstBufferPool
*
* Check if the bufferpool is flushing. Subclasses might want to check the
* state of the pool in the acquire function.
*/
#define GST_BUFFER_POOL_IS_FLUSHING(pool) (g_atomic_int_get (&pool->flushing))
/**
* GstBufferPool:
* @object: the parent structure
*
* The structure of a #GstBufferPool. Use the associated macros to access the public
* variables.
*/
struct _GstBufferPool {
GstObject object;
/*< protected >*/
gint flushing;
/*< private >*/
GstBufferPoolPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstBufferPoolClass:
* @object_class: Object parent class
* @get_options: get a list of options supported by this pool
* @set_config: apply the bufferpool configuration. The default configuration
* will parse the default config parameters
* @start: start the bufferpool. The default implementation will preallocate
* min-buffers buffers and put them in the queue
* @stop: stop the bufferpool. the default implementation will free the
* preallocated buffers. This function is called when all the buffers are
* returned to the pool.
* @acquire_buffer: get a new buffer from the pool. The default implementation
* will take a buffer from the queue and optionally wait for a buffer to
* be released when there are no buffers available.
* @alloc_buffer: allocate a buffer. the default implementation allocates
* buffers from the configured memory allocator and with the configured
* parameters. All metadata that is present on the allocated buffer will
* be marked as #GST_META_FLAG_POOLED and #GST_META_FLAG_LOCKED and will
* not be removed from the buffer in @reset_buffer.
* @reset_buffer: reset the buffer to its state when it was freshly allocated.
* The default implementation will clear the flags, timestamps and
* will remove the metadata without the #GST_META_FLAG_POOLED flag (even
* the metadata with #GST_META_FLAG_LOCKED).
* @release_buffer: release a buffer back in the pool. The default
* implementation will put the buffer back in the queue and notify any
* blocking acquire_buffer calls.
* @free_buffer: free a buffer. The default implementation unrefs the buffer.
*
* The GstBufferPool class.
*/
struct _GstBufferPoolClass {
GstObjectClass object_class;
/* vmethods */
const gchar ** (*get_options) (GstBufferPool *pool);
gboolean (*set_config) (GstBufferPool *pool, GstStructure *config);
gboolean (*start) (GstBufferPool *pool);
gboolean (*stop) (GstBufferPool *pool);
GstFlowReturn (*acquire_buffer) (GstBufferPool *pool, GstBuffer **buffer,
GstBufferPoolAcquireParams *params);
GstFlowReturn (*alloc_buffer) (GstBufferPool *pool, GstBuffer **buffer,
GstBufferPoolAcquireParams *params);
void (*reset_buffer) (GstBufferPool *pool, GstBuffer *buffer);
void (*release_buffer) (GstBufferPool *pool, GstBuffer *buffer);
void (*free_buffer) (GstBufferPool *pool, GstBuffer *buffer);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_buffer_pool_get_type (void);
/* allocation */
GstBufferPool * gst_buffer_pool_new (void);
/* state management */
gboolean gst_buffer_pool_set_active (GstBufferPool *pool, gboolean active);
gboolean gst_buffer_pool_is_active (GstBufferPool *pool);
gboolean gst_buffer_pool_set_config (GstBufferPool *pool, GstStructure *config);
GstStructure * gst_buffer_pool_get_config (GstBufferPool *pool);
const gchar ** gst_buffer_pool_get_options (GstBufferPool *pool);
gboolean gst_buffer_pool_has_option (GstBufferPool *pool, const gchar *option);
/* helpers for configuring the config structure */
void gst_buffer_pool_config_set_params (GstStructure *config, GstCaps *caps,
guint size, guint min_buffers, guint max_buffers);
gboolean gst_buffer_pool_config_get_params (GstStructure *config, GstCaps **caps,
guint *size, guint *min_buffers, guint *max_buffers);
void gst_buffer_pool_config_set_allocator (GstStructure *config, GstAllocator *allocator,
const GstAllocationParams *params);
gboolean gst_buffer_pool_config_get_allocator (GstStructure *config, GstAllocator **allocator,
GstAllocationParams *params);
/* options */
guint gst_buffer_pool_config_n_options (GstStructure *config);
void gst_buffer_pool_config_add_option (GstStructure *config, const gchar *option);
const gchar * gst_buffer_pool_config_get_option (GstStructure *config, guint index);
gboolean gst_buffer_pool_config_has_option (GstStructure *config, const gchar *option);
/* buffer management */
GstFlowReturn gst_buffer_pool_acquire_buffer (GstBufferPool *pool, GstBuffer **buffer,
GstBufferPoolAcquireParams *params);
void gst_buffer_pool_release_buffer (GstBufferPool *pool, GstBuffer *buffer);
G_END_DECLS
#endif /* __GST_BUFFER_POOL_H__ */
@@ -0,0 +1,183 @@
/* GStreamer
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
*
* gstbus.h: Header for GstBus subsystem
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BUS_H__
#define __GST_BUS_H__
typedef struct _GstBus GstBus;
typedef struct _GstBusPrivate GstBusPrivate;
typedef struct _GstBusClass GstBusClass;
#include <gst/gstmessage.h>
#include <gst/gstclock.h>
G_BEGIN_DECLS
/* --- standard type macros --- */
#define GST_TYPE_BUS (gst_bus_get_type ())
#define GST_BUS(bus) (G_TYPE_CHECK_INSTANCE_CAST ((bus), GST_TYPE_BUS, GstBus))
#define GST_IS_BUS(bus) (G_TYPE_CHECK_INSTANCE_TYPE ((bus), GST_TYPE_BUS))
#define GST_BUS_CLASS(bclass) (G_TYPE_CHECK_CLASS_CAST ((bclass), GST_TYPE_BUS, GstBusClass))
#define GST_IS_BUS_CLASS(bclass) (G_TYPE_CHECK_CLASS_TYPE ((bclass), GST_TYPE_BUS))
#define GST_BUS_GET_CLASS(bus) (G_TYPE_INSTANCE_GET_CLASS ((bus), GST_TYPE_BUS, GstBusClass))
#define GST_BUS_CAST(bus) ((GstBus*)(bus))
/**
* GstBusFlags:
* @GST_BUS_FLUSHING: The bus is currently dropping all messages
* @GST_BUS_FLAG_LAST: offset to define more flags
*
* The standard flags that a bus may have.
*/
typedef enum {
GST_BUS_FLUSHING = (GST_OBJECT_FLAG_LAST << 0),
/* padding */
GST_BUS_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 1)
} GstBusFlags;
/**
* GstBusSyncReply:
* @GST_BUS_DROP: drop the message
* @GST_BUS_PASS: pass the message to the async queue
* @GST_BUS_ASYNC: pass message to async queue, continue if message is handled
*
* The result values for a GstBusSyncHandler.
*/
typedef enum
{
GST_BUS_DROP = 0,
GST_BUS_PASS = 1,
GST_BUS_ASYNC = 2
} GstBusSyncReply;
/**
* GstBusSyncHandler:
* @bus: the #GstBus that sent the message
* @message: the #GstMessage
* @user_data: user data that has been given, when registering the handler
*
* Handler will be invoked synchronously, when a new message has been injected
* into the bus. This function is mostly used internally. Only one sync handler
* can be attached to a given bus.
*
* If the handler returns GST_BUS_DROP, it should unref the message, else the
* message should not be unreffed by the sync handler.
*
* Returns: #GstBusSyncReply stating what to do with the message
*/
typedef GstBusSyncReply (*GstBusSyncHandler) (GstBus * bus, GstMessage * message, gpointer user_data);
/**
* GstBusFunc:
* @bus: the #GstBus that sent the message
* @message: the #GstMessage
* @user_data: user data that has been given, when registering the handler
*
* Specifies the type of function passed to gst_bus_add_watch() or
* gst_bus_add_watch_full(), which is called from the mainloop when a message
* is available on the bus.
*
* The message passed to the function will be unreffed after execution of this
* function so it should not be freed in the function.
*
* Note that this function is used as a GSourceFunc which means that returning
* FALSE will remove the GSource from the mainloop.
*
* Returns: %FALSE if the event source should be removed.
*/
typedef gboolean (*GstBusFunc) (GstBus * bus, GstMessage * message, gpointer user_data);
/**
* GstBus:
*
* The opaque #GstBus data structure.
*/
struct _GstBus
{
GstObject object;
/*< private >*/
GstBusPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstBusClass
{
GstObjectClass parent_class;
/* signals */
void (*message) (GstBus *bus, GstMessage *message);
void (*sync_message) (GstBus *bus, GstMessage *message);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_bus_get_type (void);
GstBus* gst_bus_new (void);
gboolean gst_bus_post (GstBus * bus, GstMessage * message);
gboolean gst_bus_have_pending (GstBus * bus);
GstMessage * gst_bus_peek (GstBus * bus);
GstMessage * gst_bus_pop (GstBus * bus);
GstMessage * gst_bus_pop_filtered (GstBus * bus, GstMessageType types);
GstMessage * gst_bus_timed_pop (GstBus * bus, GstClockTime timeout);
GstMessage * gst_bus_timed_pop_filtered (GstBus * bus, GstClockTime timeout, GstMessageType types);
void gst_bus_set_flushing (GstBus * bus, gboolean flushing);
/* synchronous dispatching */
void gst_bus_set_sync_handler (GstBus * bus, GstBusSyncHandler func,
gpointer user_data, GDestroyNotify notify);
/* GSource based dispatching */
GSource * gst_bus_create_watch (GstBus * bus);
guint gst_bus_add_watch_full (GstBus * bus,
gint priority,
GstBusFunc func,
gpointer user_data,
GDestroyNotify notify);
guint gst_bus_add_watch (GstBus * bus,
GstBusFunc func,
gpointer user_data);
/* polling the bus */
GstMessage* gst_bus_poll (GstBus *bus, GstMessageType events,
GstClockTime timeout);
/* signal based dispatching helper functions. */
gboolean gst_bus_async_signal_func (GstBus *bus, GstMessage *message,
gpointer data);
GstBusSyncReply gst_bus_sync_signal_handler (GstBus *bus, GstMessage *message,
gpointer data);
/* convenience api to add/remove a gsource that emits the async signals */
void gst_bus_add_signal_watch (GstBus * bus);
void gst_bus_add_signal_watch_full (GstBus * bus, gint priority);
void gst_bus_remove_signal_watch (GstBus * bus);
void gst_bus_enable_sync_message_emission (GstBus * bus);
void gst_bus_disable_sync_message_emission (GstBus * bus);
G_END_DECLS
#endif /* __GST_BUS_H__ */
@@ -0,0 +1,447 @@
/* GStreamer
* Copyright (C) 2003 David A. Schleef <ds@schleef.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CAPS_H__
#define __GST_CAPS_H__
#include <gst/gstconfig.h>
#include <gst/gstminiobject.h>
#include <gst/gststructure.h>
#include <gst/glib-compat.h>
G_BEGIN_DECLS
GST_EXPORT GType _gst_caps_type;
#define GST_TYPE_CAPS (_gst_caps_type)
#define GST_IS_CAPS(obj) (GST_IS_MINI_OBJECT_TYPE((obj), GST_TYPE_CAPS))
#define GST_CAPS_CAST(obj) ((GstCaps*)(obj))
#define GST_CAPS(obj) (GST_CAPS_CAST(obj))
#define GST_TYPE_STATIC_CAPS (gst_static_caps_get_type())
/**
* GstCapsFlags:
* @GST_CAPS_FLAG_ANY: Caps has no specific content, but can contain
* anything.
*
* Extra flags for a caps.
*/
typedef enum {
GST_CAPS_FLAG_ANY = (GST_MINI_OBJECT_FLAG_LAST << 0)
} GstCapsFlags;
/**
* GstCapsIntersectMode:
* @GST_CAPS_INTERSECT_ZIG_ZAG : Zig-zags over both caps.
* @GST_CAPS_INTERSECT_FIRST : Keeps the first caps order.
*
* Modes of caps intersection
*
* @GST_CAPS_INTERSECT_ZIG_ZAG tries to preserve overall order of both caps
* by iterating on the caps' structures as the following matrix shows:
* |[
* caps1
* +-------------
* | 1 2 4 7
* caps2 | 3 5 8 10
* | 6 9 11 12
* ]|
* Used when there is no explicit precedence of one caps over the other. e.g.
* tee's sink pad getcaps function, it will probe its src pad peers' for their
* caps and intersect them with this mode.
*
* @GST_CAPS_INTERSECT_FIRST is useful when an element wants to preserve
* another element's caps priority order when intersecting with its own caps.
* Example: If caps1 is [A, B, C] and caps2 is [E, B, D, A], the result
* would be [A, B], maintaining the first caps priority on the intersection.
*/
typedef enum {
GST_CAPS_INTERSECT_ZIG_ZAG = 0,
GST_CAPS_INTERSECT_FIRST = 1
} GstCapsIntersectMode;
/**
* GST_CAPS_ANY:
*
* Means that the element/pad can output 'anything'. Useful for elements
* that output unknown media, such as filesrc. This macro returns a singleton and
* should not be unreffed.
*/
#define GST_CAPS_ANY _gst_caps_any
/**
* GST_CAPS_NONE:
*
* The opposite of %GST_CAPS_ANY: it means that the pad/element outputs an
* undefined media type that can not be detected. This macro returns a singleton
* and should not be unreffed.
*/
#define GST_CAPS_NONE _gst_caps_none
/**
* GST_STATIC_CAPS_ANY:
*
* Creates a new #GstCaps static caps that matches anything.
* This can be used in pad templates.
*/
#define GST_STATIC_CAPS_ANY GST_STATIC_CAPS("ANY")
/**
* GST_STATIC_CAPS_NONE:
*
* Creates a new #GstCaps static caps that matches nothing.
* This can be used in pad templates.
*/
#define GST_STATIC_CAPS_NONE GST_STATIC_CAPS("NONE")
/**
* GST_CAPS_IS_SIMPLE:
* @caps: the #GstCaps instance to check
*
* Convenience macro that checks if the number of structures in the given caps
* is exactly one.
*/
#define GST_CAPS_IS_SIMPLE(caps) (gst_caps_get_size(caps) == 1)
/**
* GST_STATIC_CAPS:
* @string: the string describing the caps
*
* Creates a new #GstCaps static caps from an input string.
* This can be used in pad templates.
*/
#define GST_STATIC_CAPS(string) \
{ \
/* caps */ NULL, \
/* string */ string, \
GST_PADDING_INIT \
}
typedef struct _GstCaps GstCaps;
typedef struct _GstStaticCaps GstStaticCaps;
GST_EXPORT GstCaps * _gst_caps_any;
GST_EXPORT GstCaps * _gst_caps_none;
/**
* GST_CAPS_FLAGS:
* @caps: a #GstCaps.
*
* A flags word containing #GstCapsFlags flags set on this caps.
*/
#define GST_CAPS_FLAGS(caps) GST_MINI_OBJECT_FLAGS(caps)
/* refcount */
/**
* GST_CAPS_REFCOUNT:
* @caps: a #GstCaps
*
* Get access to the reference count field of the caps
*/
#define GST_CAPS_REFCOUNT(caps) GST_MINI_OBJECT_REFCOUNT(caps)
/**
* GST_CAPS_REFCOUNT_VALUE:
* @caps: a #GstCaps
*
* Get the reference count value of the caps.
*/
#define GST_CAPS_REFCOUNT_VALUE(caps) GST_MINI_OBJECT_REFCOUNT_VALUE(caps)
/**
* GST_CAPS_FLAG_IS_SET:
* @caps: a #GstCaps.
* @flag: the #GstCapsFlags to check.
*
* Gives the status of a specific flag on a caps.
*/
#define GST_CAPS_FLAG_IS_SET(caps,flag) GST_MINI_OBJECT_FLAG_IS_SET (caps, flag)
/**
* GST_CAPS_FLAG_SET:
* @caps: a #GstCaps.
* @flag: the #GstCapsFlags to set.
*
* Sets a caps flag on a caps.
*/
#define GST_CAPS_FLAG_SET(caps,flag) GST_MINI_OBJECT_FLAG_SET (caps, flag)
/**
* GST_CAPS_FLAG_UNSET:
* @caps: a #GstCaps.
* @flag: the #GstCapsFlags to clear.
*
* Clears a caps flag.
*/
#define GST_CAPS_FLAG_UNSET(caps,flag) GST_MINI_OBJECT_FLAG_UNSET (caps, flag)
/* refcounting */
/**
* gst_caps_ref:
* @caps: the #GstCaps to reference
*
* Add a reference to a #GstCaps object.
*
* From this point on, until the caller calls gst_caps_unref() or
* gst_caps_make_writable(), it is guaranteed that the caps object will not
* change. This means its structures won't change, etc. To use a #GstCaps
* object, you must always have a refcount on it -- either the one made
* implicitly by e.g. gst_caps_new_simple(), or via taking one explicitly with
* this function.
*
* Returns: the same #GstCaps object.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstCaps * gst_caps_ref (GstCaps * caps);
#endif
static inline GstCaps *
gst_caps_ref (GstCaps * caps)
{
return (GstCaps *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (caps));
}
/**
* gst_caps_unref:
* @caps: a #GstCaps.
*
* Unref a #GstCaps and and free all its structures and the
* structures' values when the refcount reaches 0.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void gst_caps_unref (GstCaps * caps);
#endif
static inline void
gst_caps_unref (GstCaps * caps)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (caps));
}
/* copy caps */
/**
* gst_caps_copy:
* @caps: a #GstCaps.
*
* Creates a new #GstCaps as a copy of the old @caps. The new caps will have a
* refcount of 1, owned by the caller. The structures are copied as well.
*
* Note that this function is the semantic equivalent of a gst_caps_ref()
* followed by a gst_caps_make_writable(). If you only want to hold on to a
* reference to the data, you should use gst_caps_ref().
*
* When you are finished with the caps, call gst_caps_unref() on it.
*
* Returns: the new #GstCaps
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstCaps * gst_caps_copy (const GstCaps * caps);
#endif
static inline GstCaps *
gst_caps_copy (const GstCaps * caps)
{
return GST_CAPS (gst_mini_object_copy (GST_MINI_OBJECT_CAST (caps)));
}
/**
* gst_caps_is_writable:
* @caps: a #GstCaps
*
* Tests if you can safely modify @caps. It is only safe to modify caps when
* there is only one owner of the caps - ie, the object is writable.
*/
#define gst_caps_is_writable(caps) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (caps))
/**
* gst_caps_make_writable:
* @caps: (transfer full): a #GstCaps
*
* Returns a writable copy of @caps.
*
* If there is only one reference count on @caps, the caller must be the owner,
* and so this function will return the caps object unchanged. If on the other
* hand there is more than one reference on the object, a new caps object will
* be returned. The caller's reference on @caps will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the caps in the argument and refs the caps
* that it returns. Don't access the argument after calling this function. See
* also: gst_caps_ref().
*
* Returns: (transfer full): a writable caps which may or may not be the
* same as @caps
*/
#define gst_caps_make_writable(caps) GST_CAPS_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (caps)))
/**
* gst_caps_replace:
* @old_caps: (inout) (transfer full): pointer to a pointer to a #GstCaps to be
* replaced.
* @new_caps: (transfer none) (allow-none): pointer to a #GstCaps that will
* replace the caps pointed to by @ocaps.
*
* Modifies a pointer to a #GstCaps to point to a different #GstCaps. The
* modification is done atomically (so this is useful for ensuring thread safety
* in some cases), and the reference counts are updated appropriately (the old
* caps is unreffed, the new is reffed).
*
* Either @ncaps or the #GstCaps pointed to by @ocaps may be NULL.
*
* Returns: TRUE if @new_caps was different from @old_caps
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC gboolean gst_caps_replace (GstCaps **old_caps, GstCaps *new_caps);
#endif
static inline gboolean
gst_caps_replace (GstCaps **old_caps, GstCaps *new_caps)
{
return gst_mini_object_replace ((GstMiniObject **) old_caps, (GstMiniObject *) new_caps);
}
/**
* gst_caps_take:
* @old_caps: (inout) (transfer full): pointer to a pointer to a #GstCaps to be
* replaced.
* @new_caps: (transfer full) (allow-none): pointer to a #GstCaps that will
* replace the caps pointed to by @ocaps.
*
* Modifies a pointer to a #GstCaps to point to a different #GstCaps. This
* function is similar to gst_caps_replace() except that it takes ownership
* of @new_caps.
*
* Returns: TRUE if @new_caps was different from @old_caps
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC gboolean gst_caps_take (GstCaps **old_caps, GstCaps *new_caps);
#endif
static inline gboolean
gst_caps_take (GstCaps **old_caps, GstCaps *new_caps)
{
return gst_mini_object_take ((GstMiniObject **) old_caps, (GstMiniObject *) new_caps);
}
/**
* GstCaps:
* @mini_object: the parent type
*
* Object describing media types.
*/
struct _GstCaps {
GstMiniObject mini_object;
};
/**
* GstStaticCaps:
* @caps: the cached #GstCaps
* @string: a string describing a caps
*
* Datastructure to initialize #GstCaps from a string description usually
* used in conjunction with GST_STATIC_CAPS() and gst_static_caps_get() to
* instantiate a #GstCaps.
*/
struct _GstStaticCaps {
/*< public >*/
GstCaps *caps;
const char *string;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_caps_get_type (void);
GstCaps * gst_caps_new_empty (void);
GstCaps * gst_caps_new_any (void);
GstCaps * gst_caps_new_empty_simple (const char *media_type) G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_new_simple (const char *media_type,
const char *fieldname,
...) G_GNUC_NULL_TERMINATED G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_new_full (GstStructure *struct1,
...) G_GNUC_NULL_TERMINATED G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_new_full_valist (GstStructure *structure,
va_list var_args) G_GNUC_WARN_UNUSED_RESULT;
GType gst_static_caps_get_type (void);
GstCaps * gst_static_caps_get (GstStaticCaps *static_caps);
void gst_static_caps_cleanup (GstStaticCaps *static_caps);
/* manipulation */
void gst_caps_append (GstCaps *caps1,
GstCaps *caps2);
void gst_caps_append_structure (GstCaps *caps,
GstStructure *structure);
void gst_caps_remove_structure (GstCaps *caps, guint idx);
GstCaps * gst_caps_merge (GstCaps *caps1,
GstCaps *caps2) G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_merge_structure (GstCaps *caps,
GstStructure *structure) G_GNUC_WARN_UNUSED_RESULT;
guint gst_caps_get_size (const GstCaps *caps);
GstStructure * gst_caps_get_structure (const GstCaps *caps,
guint index);
GstStructure * gst_caps_steal_structure (GstCaps *caps,
guint index) G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_copy_nth (const GstCaps *caps, guint nth) G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_truncate (GstCaps *caps) G_GNUC_WARN_UNUSED_RESULT;
void gst_caps_set_value (GstCaps *caps,
const char *field,
const GValue *value);
void gst_caps_set_simple (GstCaps *caps,
const char *field, ...) G_GNUC_NULL_TERMINATED;
void gst_caps_set_simple_valist (GstCaps *caps,
const char *field,
va_list varargs);
/* tests */
gboolean gst_caps_is_any (const GstCaps *caps);
gboolean gst_caps_is_empty (const GstCaps *caps);
gboolean gst_caps_is_fixed (const GstCaps *caps);
gboolean gst_caps_is_always_compatible (const GstCaps *caps1,
const GstCaps *caps2);
gboolean gst_caps_is_subset (const GstCaps *subset,
const GstCaps *superset);
gboolean gst_caps_is_subset_structure (const GstCaps *caps,
const GstStructure *structure);
gboolean gst_caps_is_equal (const GstCaps *caps1,
const GstCaps *caps2);
gboolean gst_caps_is_equal_fixed (const GstCaps *caps1,
const GstCaps *caps2);
gboolean gst_caps_can_intersect (const GstCaps * caps1,
const GstCaps * caps2);
gboolean gst_caps_is_strictly_equal (const GstCaps *caps1,
const GstCaps *caps2);
/* operations */
GstCaps * gst_caps_intersect (GstCaps *caps1,
GstCaps *caps2) G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_intersect_full (GstCaps *caps1,
GstCaps *caps2,
GstCapsIntersectMode mode) G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_subtract (GstCaps *minuend,
GstCaps *subtrahend) G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_normalize (GstCaps *caps) G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_simplify (GstCaps *caps) G_GNUC_WARN_UNUSED_RESULT;
GstCaps * gst_caps_fixate (GstCaps *caps) G_GNUC_WARN_UNUSED_RESULT;
/* utility */
gchar * gst_caps_to_string (const GstCaps *caps) G_GNUC_MALLOC;
GstCaps * gst_caps_from_string (const gchar *string) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
#endif /* __GST_CAPS_H__ */
@@ -0,0 +1,105 @@
/* GStreamer
* Copyright (C) 2005 Stefan Kost <ensonic@users.sf.net>
*
* gstchildproxy.h: interface header for multi child elements
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CHILD_PROXY_H__
#define __GST_CHILD_PROXY_H__
#include <glib-object.h>
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_CHILD_PROXY (gst_child_proxy_get_type ())
#define GST_CHILD_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CHILD_PROXY, GstChildProxy))
#define GST_IS_CHILD_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CHILD_PROXY))
#define GST_CHILD_PROXY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_CHILD_PROXY, GstChildProxyInterface))
/**
* GstChildProxy:
*
* Opaque #GstChildProxy data structure.
*/
typedef struct _GstChildProxy GstChildProxy; /* dummy object */
typedef struct _GstChildProxyInterface GstChildProxyInterface;
/**
* GstChildProxyInterface:
* @parent: parent interface type.
* @get_child_by_name: virtual method to fetch the child by name
* @get_child_by_index: virtual method to fetch the child by index
* @get_children_count: virtual method to get the children count
*
* #GstChildProxy interface.
*/
struct _GstChildProxyInterface
{
GTypeInterface parent;
/* methods */
GObject * (*get_child_by_name) (GstChildProxy * parent, const gchar * name);
GObject * (*get_child_by_index) (GstChildProxy * parent, guint index);
guint (*get_children_count) (GstChildProxy * parent);
/*< private >*/
/* signals */
void (*child_added) (GstChildProxy * parent, GObject * child, const gchar * name);
void (*child_removed) (GstChildProxy * parent, GObject * child, const gchar * name);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_child_proxy_get_type (void);
GObject * gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name);
guint gst_child_proxy_get_children_count (GstChildProxy * parent);
GObject * gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index);
gboolean gst_child_proxy_lookup (GstChildProxy *object, const gchar *name,
GObject **target, GParamSpec **pspec);
void gst_child_proxy_get_property (GstChildProxy * object, const gchar *name,
GValue *value);
void gst_child_proxy_get_valist (GstChildProxy * object,
const gchar * first_property_name,
va_list var_args);
void gst_child_proxy_get (GstChildProxy * object,
const gchar * first_property_name,
...) G_GNUC_NULL_TERMINATED;
void gst_child_proxy_set_property (GstChildProxy * object, const gchar *name,
const GValue *value);
void gst_child_proxy_set_valist (GstChildProxy* object,
const gchar * first_property_name,
va_list var_args);
void gst_child_proxy_set (GstChildProxy * object,
const gchar * first_property_name,
...) G_GNUC_NULL_TERMINATED;
void gst_child_proxy_child_added (GstChildProxy * parent, GObject * child,
const gchar *name);
void gst_child_proxy_child_removed (GstChildProxy * parent, GObject * child,
const gchar *name);
G_END_DECLS
#endif /* __GST_CHILD_PROXY_H__ */
@@ -0,0 +1,521 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstclock.h: Header for clock subsystem
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CLOCK_H__
#define __GST_CLOCK_H__
G_BEGIN_DECLS
/* --- standard type macros --- */
#define GST_TYPE_CLOCK (gst_clock_get_type ())
#define GST_CLOCK(clock) (G_TYPE_CHECK_INSTANCE_CAST ((clock), GST_TYPE_CLOCK, GstClock))
#define GST_IS_CLOCK(clock) (G_TYPE_CHECK_INSTANCE_TYPE ((clock), GST_TYPE_CLOCK))
#define GST_CLOCK_CLASS(cclass) (G_TYPE_CHECK_CLASS_CAST ((cclass), GST_TYPE_CLOCK, GstClockClass))
#define GST_IS_CLOCK_CLASS(cclass) (G_TYPE_CHECK_CLASS_TYPE ((cclass), GST_TYPE_CLOCK))
#define GST_CLOCK_GET_CLASS(clock) (G_TYPE_INSTANCE_GET_CLASS ((clock), GST_TYPE_CLOCK, GstClockClass))
#define GST_CLOCK_CAST(clock) ((GstClock*)(clock))
/**
* GstClockTime:
*
* A datatype to hold a time, measured in nanoseconds.
*/
typedef guint64 GstClockTime;
/**
* GST_TYPE_CLOCK_TIME:
*
* The #GType of a #GstClockTime.
*/
#define GST_TYPE_CLOCK_TIME G_TYPE_UINT64
/**
* GstClockTimeDiff:
*
* A datatype to hold a time difference, measured in nanoseconds.
*/
typedef gint64 GstClockTimeDiff;
/**
* GstClockID:
*
* A datatype to hold the handle to an outstanding sync or async clock callback.
*/
typedef gpointer GstClockID;
/**
* GST_CLOCK_TIME_NONE:
*
* Constant to define an undefined clock time.
*
* Value: 18446744073709551615
* Type: GstClockTime
*/
#define GST_CLOCK_TIME_NONE ((GstClockTime) -1)
/**
* GST_CLOCK_TIME_IS_VALID:
* @time: clock time to validate
*
* Tests if a given #GstClockTime represents a valid defined time.
*/
#define GST_CLOCK_TIME_IS_VALID(time) (((GstClockTime)(time)) != GST_CLOCK_TIME_NONE)
/* FIXME: still need to explicitly force types on the defines below */
/**
* GST_SECOND:
*
* Constant that defines one GStreamer second.
*
* Value: 1000000000
* Type: GstClockTime
*/
#define GST_SECOND (G_USEC_PER_SEC * G_GINT64_CONSTANT (1000))
/**
* GST_MSECOND:
*
* Constant that defines one GStreamer millisecond.
*
* Value: 1000000
* Type: GstClockTime
*/
#define GST_MSECOND (GST_SECOND / G_GINT64_CONSTANT (1000))
/**
* GST_USECOND:
*
* Constant that defines one GStreamer microsecond.
*
* Value: 1000
* Type: GstClockTime
*/
#define GST_USECOND (GST_SECOND / G_GINT64_CONSTANT (1000000))
/**
* GST_NSECOND:
*
* Constant that defines one GStreamer nanosecond
*
* Value: 1
* Type: GstClockTime
*/
#define GST_NSECOND (GST_SECOND / G_GINT64_CONSTANT (1000000000))
/**
* GST_TIME_AS_SECONDS:
* @time: the time
*
* Convert a #GstClockTime to seconds.
*/
#define GST_TIME_AS_SECONDS(time) ((time) / GST_SECOND)
/**
* GST_TIME_AS_MSECONDS:
* @time: the time
*
* Convert a #GstClockTime to milliseconds (1/1000 of a second).
*/
#define GST_TIME_AS_MSECONDS(time) ((time) / G_GINT64_CONSTANT (1000000))
/**
* GST_TIME_AS_USECONDS:
* @time: the time
*
* Convert a #GstClockTime to microseconds (1/1000000 of a second).
*/
#define GST_TIME_AS_USECONDS(time) ((time) / G_GINT64_CONSTANT (1000))
/**
* GST_TIME_AS_NSECONDS:
* @time: the time
*
* Convert a #GstClockTime to nanoseconds (1/1000000000 of a second).
*/
#define GST_TIME_AS_NSECONDS(time) (time)
/**
* GST_CLOCK_DIFF:
* @s: the first time
* @e: the second time
*
* Calculate a difference between two clock times as a #GstClockTimeDiff.
* The difference is calculated as @e - @s.
*/
#define GST_CLOCK_DIFF(s, e) (GstClockTimeDiff)((e) - (s))
/**
* GST_TIMEVAL_TO_TIME:
* @tv: the timeval to convert
*
* Convert a #GTimeVal to a #GstClockTime.
*/
#define GST_TIMEVAL_TO_TIME(tv) (GstClockTime)((tv).tv_sec * GST_SECOND + (tv).tv_usec * GST_USECOND)
/**
* GST_TIME_TO_TIMEVAL:
* @t: The #GstClockTime to convert
* @tv: The target timeval
*
* Convert a #GstClockTime to a #GTimeVal
*
* <note>on 32-bit systems, a timeval has a range of only 2^32 - 1 seconds,
* which is about 68 years. Expect trouble if you want to schedule stuff
* in your pipeline for 2038.</note>
*/
#define GST_TIME_TO_TIMEVAL(t,tv) \
G_STMT_START { \
g_assert ("Value of time " #t " is out of timeval's range" && \
((t) / GST_SECOND) < G_MAXLONG); \
(tv).tv_sec = (glong) (((GstClockTime) (t)) / GST_SECOND); \
(tv).tv_usec = (glong) ((((GstClockTime) (t)) - \
((GstClockTime) (tv).tv_sec) * GST_SECOND) \
/ GST_USECOND); \
} G_STMT_END
/**
* GST_TIMESPEC_TO_TIME:
* @ts: the timespec to convert
*
* Convert a struct timespec (see man pselect) to a #GstClockTime.
*/
#define GST_TIMESPEC_TO_TIME(ts) (GstClockTime)((ts).tv_sec * GST_SECOND + (ts).tv_nsec * GST_NSECOND)
/**
* GST_TIME_TO_TIMESPEC:
* @t: The #GstClockTime to convert
* @ts: The target timespec
*
* Convert a #GstClockTime to a struct timespec (see man pselect)
*/
#define GST_TIME_TO_TIMESPEC(t,ts) \
G_STMT_START { \
g_assert ("Value of time " #t " is out of timespec's range" && \
((t) / GST_SECOND) < G_MAXLONG); \
(ts).tv_sec = (glong) ((t) / GST_SECOND); \
(ts).tv_nsec = (glong) (((t) - (ts).tv_sec * GST_SECOND) / GST_NSECOND); \
} G_STMT_END
/* timestamp debugging macros */
/**
* GST_TIME_FORMAT:
*
* A string that can be used in printf-like format strings to display a
* #GstClockTime value in h:m:s format. Use GST_TIME_ARGS() to construct
* the matching arguments.
*
* Example:
* |[
* printf("%" GST_TIME_FORMAT "\n", GST_TIME_ARGS(ts));
* ]|
*/
#define GST_TIME_FORMAT "u:%02u:%02u.%09u"
/**
* GST_TIME_ARGS:
* @t: a #GstClockTime
*
* Format @t for the #GST_TIME_FORMAT format string. Note: @t will be
* evaluated more than once.
*/
#define GST_TIME_ARGS(t) \
GST_CLOCK_TIME_IS_VALID (t) ? \
(guint) (((GstClockTime)(t)) / (GST_SECOND * 60 * 60)) : 99, \
GST_CLOCK_TIME_IS_VALID (t) ? \
(guint) ((((GstClockTime)(t)) / (GST_SECOND * 60)) % 60) : 99, \
GST_CLOCK_TIME_IS_VALID (t) ? \
(guint) ((((GstClockTime)(t)) / GST_SECOND) % 60) : 99, \
GST_CLOCK_TIME_IS_VALID (t) ? \
(guint) (((GstClockTime)(t)) % GST_SECOND) : 999999999
typedef struct _GstClockEntry GstClockEntry;
typedef struct _GstClock GstClock;
typedef struct _GstClockClass GstClockClass;
typedef struct _GstClockPrivate GstClockPrivate;
/* --- prototype for async callbacks --- */
/**
* GstClockCallback:
* @clock: The clock that triggered the callback
* @time: The time it was triggered
* @id: The #GstClockID that expired
* @user_data: user data passed in the gst_clock_id_wait_async() function
*
* The function prototype of the callback.
*
* Returns: %TRUE or %FALSE (currently unused)
*/
typedef gboolean (*GstClockCallback) (GstClock *clock, GstClockTime time,
GstClockID id, gpointer user_data);
/**
* GstClockReturn:
* @GST_CLOCK_OK: The operation succeeded.
* @GST_CLOCK_EARLY: The operation was scheduled too late.
* @GST_CLOCK_UNSCHEDULED: The clockID was unscheduled
* @GST_CLOCK_BUSY: The ClockID is busy
* @GST_CLOCK_BADTIME: A bad time was provided to a function.
* @GST_CLOCK_ERROR: An error occurred
* @GST_CLOCK_UNSUPPORTED: Operation is not supported
* @GST_CLOCK_DONE: The ClockID is done waiting
*
* The return value of a clock operation.
*/
typedef enum
{
GST_CLOCK_OK = 0,
GST_CLOCK_EARLY = 1,
GST_CLOCK_UNSCHEDULED = 2,
GST_CLOCK_BUSY = 3,
GST_CLOCK_BADTIME = 4,
GST_CLOCK_ERROR = 5,
GST_CLOCK_UNSUPPORTED = 6,
GST_CLOCK_DONE = 7
} GstClockReturn;
/**
* GstClockEntryType:
* @GST_CLOCK_ENTRY_SINGLE: a single shot timeout
* @GST_CLOCK_ENTRY_PERIODIC: a periodic timeout request
*
* The type of the clock entry
*/
typedef enum {
GST_CLOCK_ENTRY_SINGLE,
GST_CLOCK_ENTRY_PERIODIC
} GstClockEntryType;
/**
* GST_CLOCK_ENTRY:
* @entry: the entry to cast
*
* Cast to a clock entry
*/
#define GST_CLOCK_ENTRY(entry) ((GstClockEntry *)(entry))
/**
* GST_CLOCK_ENTRY_CLOCK:
* @entry: the entry to query
*
* Get the owner clock of the entry
*/
#define GST_CLOCK_ENTRY_CLOCK(entry) ((entry)->clock)
/**
* GST_CLOCK_ENTRY_TYPE:
* @entry: the entry to query
*
* Get the type of the clock entry
*/
#define GST_CLOCK_ENTRY_TYPE(entry) ((entry)->type)
/**
* GST_CLOCK_ENTRY_TIME:
* @entry: the entry to query
*
* Get the requested time of this entry
*/
#define GST_CLOCK_ENTRY_TIME(entry) ((entry)->time)
/**
* GST_CLOCK_ENTRY_INTERVAL:
* @entry: the entry to query
*
* Get the interval of this periodic entry
*/
#define GST_CLOCK_ENTRY_INTERVAL(entry) ((entry)->interval)
/**
* GST_CLOCK_ENTRY_STATUS:
* @entry: the entry to query
*
* The status of the entry
*/
#define GST_CLOCK_ENTRY_STATUS(entry) ((entry)->status)
/**
* GstClockEntry:
* @refcount: reference counter (read-only)
*
* All pending timeouts or periodic notifies are converted into
* an entry.
* Note that GstClockEntry should be treated as an opaque structure. It must
* not be extended or allocated using a custom allocator.
*/
struct _GstClockEntry {
gint refcount;
/*< protected >*/
GstClock *clock;
GstClockEntryType type;
GstClockTime time;
GstClockTime interval;
GstClockReturn status;
GstClockCallback func;
gpointer user_data;
GDestroyNotify destroy_data;
gboolean unscheduled;
gboolean woken_up;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
#include <gst/gstobject.h>
/**
* GstClockFlags:
* @GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC: clock can do a single sync timeout request
* @GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC: clock can do a single async timeout request
* @GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC: clock can do sync periodic timeout requests
* @GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC: clock can do async periodic timeout callbacks
* @GST_CLOCK_FLAG_CAN_SET_RESOLUTION: clock's resolution can be changed
* @GST_CLOCK_FLAG_CAN_SET_MASTER: clock can be slaved to a master clock
* @GST_CLOCK_FLAG_LAST: subclasses can add additional flags starting from this flag
*
* The capabilities of this clock
*/
typedef enum {
GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC = (GST_OBJECT_FLAG_LAST << 0),
GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC = (GST_OBJECT_FLAG_LAST << 1),
GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC = (GST_OBJECT_FLAG_LAST << 2),
GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC = (GST_OBJECT_FLAG_LAST << 3),
GST_CLOCK_FLAG_CAN_SET_RESOLUTION = (GST_OBJECT_FLAG_LAST << 4),
GST_CLOCK_FLAG_CAN_SET_MASTER = (GST_OBJECT_FLAG_LAST << 5),
/* padding */
GST_CLOCK_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8)
} GstClockFlags;
/**
* GST_CLOCK_FLAGS:
* @clock: the clock to query
*
* Gets the #GstClockFlags clock flags.
*/
#define GST_CLOCK_FLAGS(clock) GST_OBJECT_FLAGS(clock)
/**
* GstClock:
*
* #GstClock base structure. The values of this structure are
* protected for subclasses, use the methods to use the #GstClock.
*/
struct _GstClock {
GstObject object;
/*< private >*/
GstClockPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstClockClass:
* @parent_class: the parent class structure
* @change_resolution: change the resolution of the clock. Not all values might
* be acceptable. The new resolution should be returned.
* @get_resolution: get the resolution of the clock.
* @get_internal_time: get the internal unadjusted time of the clock.
* implement @wait_jitter instead.
* @wait: perform a blocking wait on the given #GstClockEntry and return
* the jitter.
* @wait_async: perform an asynchronous wait for the given #GstClockEntry.
* @unschedule: unblock a blocking or async wait operation.
*
* GStreamer clock class. Override the vmethods to implement the clock
* functionality.
*/
struct _GstClockClass {
GstObjectClass parent_class;
/*< public >*/
/* vtable */
GstClockTime (*change_resolution) (GstClock *clock,
GstClockTime old_resolution,
GstClockTime new_resolution);
GstClockTime (*get_resolution) (GstClock *clock);
GstClockTime (*get_internal_time) (GstClock *clock);
/* waiting on an ID */
GstClockReturn (*wait) (GstClock *clock, GstClockEntry *entry,
GstClockTimeDiff *jitter);
GstClockReturn (*wait_async) (GstClock *clock, GstClockEntry *entry);
void (*unschedule) (GstClock *clock, GstClockEntry *entry);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_clock_get_type (void);
GstClockTime gst_clock_set_resolution (GstClock *clock,
GstClockTime resolution);
GstClockTime gst_clock_get_resolution (GstClock *clock);
GstClockTime gst_clock_get_time (GstClock *clock);
void gst_clock_set_calibration (GstClock *clock, GstClockTime internal,
GstClockTime external,
GstClockTime rate_num,
GstClockTime rate_denom);
void gst_clock_get_calibration (GstClock *clock, GstClockTime *internal,
GstClockTime *external,
GstClockTime *rate_num,
GstClockTime *rate_denom);
/* master/slave clocks */
gboolean gst_clock_set_master (GstClock *clock, GstClock *master);
GstClock* gst_clock_get_master (GstClock *clock);
void gst_clock_set_timeout (GstClock *clock,
GstClockTime timeout);
GstClockTime gst_clock_get_timeout (GstClock *clock);
gboolean gst_clock_add_observation (GstClock *clock, GstClockTime slave,
GstClockTime master, gdouble *r_squared);
/* getting and adjusting internal/external time */
GstClockTime gst_clock_get_internal_time (GstClock *clock);
GstClockTime gst_clock_adjust_unlocked (GstClock *clock, GstClockTime internal);
GstClockTime gst_clock_unadjust_unlocked (GstClock * clock, GstClockTime external);
/* creating IDs that can be used to get notifications */
GstClockID gst_clock_new_single_shot_id (GstClock *clock,
GstClockTime time);
GstClockID gst_clock_new_periodic_id (GstClock *clock,
GstClockTime start_time,
GstClockTime interval);
/* reference counting */
GstClockID gst_clock_id_ref (GstClockID id);
void gst_clock_id_unref (GstClockID id);
/* operations on IDs */
gint gst_clock_id_compare_func (gconstpointer id1, gconstpointer id2);
GstClockTime gst_clock_id_get_time (GstClockID id);
GstClockReturn gst_clock_id_wait (GstClockID id,
GstClockTimeDiff *jitter);
GstClockReturn gst_clock_id_wait_async (GstClockID id,
GstClockCallback func,
gpointer user_data,
GDestroyNotify destroy_data);
void gst_clock_id_unschedule (GstClockID id);
gboolean gst_clock_single_shot_id_reinit (GstClock * clock,
GstClockID id,
GstClockTime time);
gboolean gst_clock_periodic_id_reinit (GstClock * clock,
GstClockID id,
GstClockTime start_time,
GstClockTime interval);
G_END_DECLS
#endif /* __GST_CLOCK_H__ */
@@ -0,0 +1,98 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2004 Wim Taymans <wim@fluendo.com>
*
* gstcompat.h: backwards compatibility stuff
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:gstcompat
* @short_description: Deprecated API entries
*
* Please do not use these in new code.
* These symbols are only available by defining GST_DISABLE_DEPRECATED.
* This can be done in CFLAGS for compiling old code.
*/
/* API compatibility stuff */
#ifndef __GSTCOMPAT_H__
#define __GSTCOMPAT_H__
G_BEGIN_DECLS
/* added to ease the transition to 0.11 */
#define gst_element_class_set_details_simple gst_element_class_set_metadata
#define gst_element_factory_get_longname(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_LONGNAME)
#define gst_element_factory_get_klass(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_KLASS)
#define gst_element_factory_get_description(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_DESCRIPTION)
#define gst_element_factory_get_author(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_AUTHOR)
#define gst_element_factory_get_documentation_uri(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_DOC_URI)
#define gst_element_factory_get_icon_name(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_ICON_NAME)
#define gst_pad_get_caps_reffed(p) gst_pad_get_caps(p)
#define gst_pad_peer_get_caps_reffed(p) gst_pad_peer_get_caps(p)
#define gst_buffer_new_and_alloc(s) gst_buffer_new_allocate(NULL, s, NULL)
#define GST_BUFFER_TIMESTAMP GST_BUFFER_PTS
#define GST_BUFFER_TIMESTAMP_IS_VALID GST_BUFFER_PTS_IS_VALID
#define gst_adapter_prev_timestamp gst_adapter_prev_pts
#define gst_tag_list_free(taglist) gst_tag_list_unref(taglist)
static inline gboolean
gst_pad_set_caps (GstPad * pad, GstCaps * caps)
{
GstEvent *event;
gboolean res = TRUE;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (caps != NULL && gst_caps_is_fixed (caps), FALSE);
event = gst_event_new_caps (caps);
if (GST_PAD_IS_SRC (pad))
res = gst_pad_push_event (pad, event);
else
res = gst_pad_send_event (pad, event);
return res;
}
#ifndef GST_DISABLE_DEPRECATED
#define GST_MESSAGE_DURATION GST_MESSAGE_DURATION_CHANGED
#define gst_message_new_duration(src,fmt,dur) \
gst_message_new_duration_changed(src)
#define gst_message_parse_duration(msg,fmt,dur) \
G_STMT_START { \
GstFormat *p_fmt = fmt; \
gint64 *p_dur = dur; \
if (p_fmt) \
*p_fmt = GST_FORMAT_TIME; \
if (p_dur) \
*p_dur = GST_CLOCK_TIME_NONE; \
} G_STMT_END
#endif /* not GST_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __GSTCOMPAT_H__ */
@@ -0,0 +1,201 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2004,2005 Wim Taymans <wim@fluendo.com>
*
* gstconfig.h: GST_DISABLE_* macros for build configuration
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:gstconfig
* @short_description: Build configuration options
*
* This describes the configuration options for GStreamer. When building
* GStreamer there are a lot of parts (known internally as "subsystems" ) that
* can be disabled for various reasons. The most common reasons are speed and
* size, which is important because GStreamer is designed to run on embedded
* systems.
*
* If a subsystem is disabled, most of this changes are done in an API
* compatible way, so you don't need to adapt your code in most cases. It is
* never done in an ABI compatible way though. So if you want to disable a
* suybsystem, you have to rebuild all programs depending on GStreamer, too.
*
* If a subsystem is disabled in GStreamer, a value is defined in
* &lt;gst/gst.h&gt;. You can check this if you do subsystem-specific stuff.
* <example id="example-gstconfig">
* <title>Doing subsystem specific things</title>
* <programlisting>
* &hash;ifndef GST_DISABLE_GST_DEBUG
* // do stuff specific to the debugging subsystem
* &hash;endif // GST_DISABLE_GST_DEBUG
* </programlisting>
* </example>
*/
#ifndef __GST_CONFIG_H__
#define __GST_CONFIG_H__
/* trick gtk-doc into believing these symbols are defined (yes, it's ugly) */
#if 0
#define GST_DISABLE_GST_DEBUG 1
#define GST_DISABLE_PARSE 1
#define GST_DISABLE_TRACE 1
#define GST_DISABLE_ALLOC_TRACE 1
#define GST_DISABLE_REGISTRY 1
#define GST_DISABLE_PLUGIN 1
#define GST_HAVE_GLIB_2_8 1
#endif
/***** default padding of structures *****/
#define GST_PADDING 4
#define GST_PADDING_INIT { NULL }
/***** padding for very extensible base classes *****/
#define GST_PADDING_LARGE 20
/***** disabling of subsystems *****/
/**
* GST_DISABLE_GST_DEBUG:
*
* Configures the inclusion of the debugging subsystem
*/
/* #undef GST_DISABLE_GST_DEBUG */
/**
* GST_DISABLE_PARSE:
*
* Configures the inclusion of the gst-lauch parser
*/
/* #undef GST_DISABLE_PARSE */
/**
* GST_DISABLE_TRACE:
*
* Configures the inclusion of a resource tracing facillity
* (seems to be unused)
*/
/* #undef GST_DISABLE_TRACE */
/**
* GST_DISABLE_ALLOC_TRACE:
*
* Configures the use of a memory tracer based on the resource tracer
* if TRACE is disabled, ALLOC_TRACE is disabled as well
*/
/* #undef GST_DISABLE_ALLOC_TRACE */
/**
* GST_DISABLE_REGISTRY:
*
* Configures the use of the plugin registry.
* If one disables this, required plugins need to be loaded and registered
* manually
*/
/* #undef GST_DISABLE_REGISTRY */
/* FIXME: test and document these! */
/* Configures the use of external plugins */
/* #undef GST_DISABLE_PLUGIN */
/* printf extension format */
/**
* GST_PTR_FORMAT:
*
* printf format type used to debug GStreamer types.
* This can only be used on types whose size is >= sizeof(gpointer).
*/
#define GST_PTR_FORMAT "p"
/**
* GST_SEGMENT_FORMAT:
*
* printf format type used to debug GStreamer segments.
* This can only be used on pointers to GstSegment structures.
*/
#define GST_SEGMENT_FORMAT "p"
/* whether or not GST_PTR_FORMAT or GST_SEGMENT_FORMAT are using
* the printf extension mechanism. This is for internal use in our
* header files so we know whether we can use G_GNUC_PRINTF or not */
#undef GST_USING_PRINTF_EXTENSION
/* GST_DISABLE_PRINTF_EXTENSION:
*
* Define this to debug your debug log messages and make gcc spew warnings
* if printf format string and arguments don't match up (this is usually
* not the case when libc and gcc are used because printf format warnings
* have to be disabled when the printf extension mechanism is in use).
*
* Note that using this option disables 'pretty logging' of GStreamer objects
* like caps, tags, structures, events, pads etc., so that only their address
* will be printed in the log.
*
* This define only disables use of the special registered printf format
* extensions in the code compiled with it defined. It does not stop
* GStreamer from registering these extensions in the first place if it
* was compiled against a libc that supports this.
*
* (not official API)
*/
/* If GLib is not using the system printf, we can't use the registered
* extensions because the GLib-internal printf won't know how to parse them */
#if defined(GST_DISABLE_PRINTF_EXTENSION) || !defined(GLIB_USING_SYSTEM_PRINTF)
#undef GST_PTR_FORMAT
#define GST_PTR_FORMAT "p"
#undef GST_SEGMENT_FORMAT
#define GST_SEGMENT_FORMAT "p"
#undef GST_USING_PRINTF_EXTENSION
#endif
/* whether or not the CPU supports unaligned access */
#define GST_HAVE_UNALIGNED_ACCESS 1
/**
* GST_EXPORT:
*
* Export the given variable from the built shared object.
*
* On Windows, this exports the variable from the DLL.
* On other platforms, this gets defined to "extern".
*/
/**
* GST_PLUGIN_EXPORT:
*
* Export the plugin's definition.
*
* On Windows, this exports the plugin definition from the DLL.
* On other platforms, this gets defined as a no-op.
*/
#ifdef _MSC_VER
#define GST_PLUGIN_EXPORT __declspec(dllexport) extern
#ifdef GST_EXPORTS
#define GST_EXPORT __declspec(dllexport) extern
#else
#define GST_EXPORT __declspec(dllimport) extern
#endif
#else /* not _MSC_VER */
#define GST_PLUGIN_EXPORT
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
#define GST_EXPORT extern __attribute__ ((visibility ("default")))
#else
#define GST_EXPORT extern
#endif
#endif
#endif /* __GST_CONFIG_H__ */
@@ -0,0 +1,122 @@
/* GStreamer
*
* Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
*
* gstcontrolbinding.h: Attachment for control sources
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CONTROL_BINDING_H__
#define __GST_CONTROL_BINDING_H__
#include <gst/gstconfig.h>
#include <glib-object.h>
#include <gst/gstcontrolsource.h>
G_BEGIN_DECLS
#define GST_TYPE_CONTROL_BINDING \
(gst_control_binding_get_type())
#define GST_CONTROL_BINDING(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CONTROL_BINDING,GstControlBinding))
#define GST_CONTROL_BINDING_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CONTROL_BINDING,GstControlBindingClass))
#define GST_IS_CONTROL_BINDING(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CONTROL_BINDING))
#define GST_IS_CONTROL_BINDING_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CONTROL_BINDING))
#define GST_CONTROL_BINDING_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstControlBindingClass))
typedef struct _GstControlBinding GstControlBinding;
typedef struct _GstControlBindingClass GstControlBindingClass;
/**
* GstControlBindingConvert:
* @binding: the #GstControlBinding instance
* @src_value: the value returned by the cotnrol source
* @dest_value: the target GValue
*
* Function to map a control-value to the target GValue.
*/
typedef void (* GstControlBindingConvert) (GstControlBinding *binding, gdouble src_value, GValue *dest_value);
/**
* GstControlBinding:
* @name: name of the property of this binding
* @pspec: #GParamSpec for this property
*
* The instance structure of #GstControlBinding.
*/
struct _GstControlBinding {
GstObject parent;
/*< public >*/
gchar *name;
GParamSpec *pspec;
/*< private >*/
GstObject *object; /* GstObject owning the property
* (== parent when bound) */
gboolean disabled;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstControlBindingClass:
* @parent_class: Parent class
*
* The class structure of #GstControlBinding.
*/
struct _GstControlBindingClass
{
GstObjectClass parent_class;
/* virtual methods */
gboolean (* sync_values) (GstControlBinding *binding, GstObject *object, GstClockTime timestamp, GstClockTime last_sync);
GValue * (* get_value) (GstControlBinding *binding, GstClockTime timestamp);
gboolean (* get_value_array) (GstControlBinding *binding, GstClockTime timestamp,GstClockTime interval, guint n_values, gpointer values);
gboolean (* get_g_value_array) (GstControlBinding *binding, GstClockTime timestamp,GstClockTime interval, guint n_values, GValue *values);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
#define GST_CONTROL_BINDING_PSPEC(cb) (((GstControlBinding *) cb)->pspec)
GType gst_control_binding_get_type (void);
/* Functions */
gboolean gst_control_binding_sync_values (GstControlBinding * binding, GstObject *object,
GstClockTime timestamp, GstClockTime last_sync);
GValue * gst_control_binding_get_value (GstControlBinding *binding,
GstClockTime timestamp);
gboolean gst_control_binding_get_value_array (GstControlBinding *binding, GstClockTime timestamp,
GstClockTime interval, guint n_values, gpointer values);
gboolean gst_control_binding_get_g_value_array (GstControlBinding *binding, GstClockTime timestamp,
GstClockTime interval, guint n_values, GValue *values);
void gst_control_binding_set_disabled (GstControlBinding * binding, gboolean disabled);
gboolean gst_control_binding_is_disabled (GstControlBinding * binding);
G_END_DECLS
#endif /* __GST_CONTROL_BINDING_H__ */
@@ -0,0 +1,139 @@
/* GStreamer
*
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
*
* gstcontrolsource.h: Interface declaration for control sources
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CONTROL_SOURCE_H__
#define __GST_CONTROL_SOURCE_H__
#include <gst/gstconfig.h>
#include <glib-object.h>
#include <gst/gstclock.h>
G_BEGIN_DECLS
#define GST_TYPE_CONTROL_SOURCE \
(gst_control_source_get_type())
#define GST_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CONTROL_SOURCE,GstControlSource))
#define GST_CONTROL_SOURCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CONTROL_SOURCE,GstControlSourceClass))
#define GST_IS_CONTROL_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CONTROL_SOURCE))
#define GST_IS_CONTROL_SOURCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CONTROL_SOURCE))
#define GST_CONTROL_SOURCE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstControlSourceClass))
typedef struct _GstControlSource GstControlSource;
typedef struct _GstControlSourceClass GstControlSourceClass;
typedef struct _GstTimedValue GstTimedValue;
typedef struct _GstValueArray GstValueArray;
/**
* GstTimedValue:
* @timestamp: timestamp of the value change
* @value: the corresponding value
*
* Structure for saving a timestamp and a value.
*/
struct _GstTimedValue
{
GstClockTime timestamp;
gdouble value;
};
/**
* GstControlSourceGetValue:
* @self: the #GstControlSource instance
* @timestamp: timestamp for which a value should be calculated
* @value: a #GValue which will be set to the result. It must be initialized to the correct type.
*
* Function for returning a value for a given timestamp.
*
* Returns: %TRUE if the value was successfully calculated.
*
*/
typedef gboolean (* GstControlSourceGetValue) (GstControlSource *self,
GstClockTime timestamp, gdouble *value);
/**
* GstControlSourceGetValueArray:
* @self: the #GstControlSource instance
* @timestamp: timestamp for which a value should be calculated
* @interval: the time spacing between subsequent values
* @n_values: the number of values
* @values: array to put control-values in
*
* Function for returning an array of values for starting at a given timestamp.
*
* Returns: %TRUE if the values were successfully calculated.
*
*/
typedef gboolean (* GstControlSourceGetValueArray) (GstControlSource *self,
GstClockTime timestamp, GstClockTime interval, guint n_values, gdouble *values);
/**
* GstControlSource:
* @get_value: Function for returning a value for a given timestamp
* @get_value_array: Function for returning a #GstValueArray for a given timestamp
*
* The instance structure of #GstControlSource.
*/
struct _GstControlSource {
GstObject parent;
/*< public >*/
GstControlSourceGetValue get_value; /* Returns the value for a property at a given timestamp */
GstControlSourceGetValueArray get_value_array; /* Returns values for a property in a given timespan */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstControlSourceClass:
* @parent_class: Parent class
* @bind: Class method for binding the #GstControlSource to a specific GParamSpec
*
* The class structure of #GstControlSource.
*/
struct _GstControlSourceClass
{
GstObjectClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_control_source_get_type (void);
/* Functions */
gboolean gst_control_source_get_value (GstControlSource *self, GstClockTime timestamp,
gdouble *value);
gboolean gst_control_source_get_value_array (GstControlSource *self, GstClockTime timestamp,
GstClockTime interval, guint n_values,
gdouble *values);
G_END_DECLS
#endif /* __GST_CONTROL_SOURCE_H__ */
@@ -0,0 +1,106 @@
/* GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_DATE_TIME_H__
#define __GST_DATE_TIME_H__
#include <time.h>
#include <glib.h>
G_BEGIN_DECLS
/**
* GstDateTime:
*
* Opaque, immutable, refcounted struct that stores date, time and timezone
* information. It currently supports ranges from 0001-01-01 to
* 9999-12-31 in the Gregorian proleptic calendar.
*
* Use the acessor functions to get the stored values.
*/
typedef struct _GstDateTime GstDateTime;
/* query which fields are set */
gboolean gst_date_time_has_year (const GstDateTime * datetime);
gboolean gst_date_time_has_month (const GstDateTime * datetime);
gboolean gst_date_time_has_day (const GstDateTime * datetime);
gboolean gst_date_time_has_time (const GstDateTime * datetime);
gboolean gst_date_time_has_second (const GstDateTime * datetime);
/* field getters */
gint gst_date_time_get_year (const GstDateTime * datetime);
gint gst_date_time_get_month (const GstDateTime * datetime);
gint gst_date_time_get_day (const GstDateTime * datetime);
gint gst_date_time_get_hour (const GstDateTime * datetime);
gint gst_date_time_get_minute (const GstDateTime * datetime);
gint gst_date_time_get_second (const GstDateTime * datetime);
gint gst_date_time_get_microsecond (const GstDateTime * datetime);
gfloat gst_date_time_get_time_zone_offset (const GstDateTime * datetime);
/* constructors */
GstDateTime * gst_date_time_new_from_unix_epoch_local_time (gint64 secs) G_GNUC_MALLOC;
GstDateTime * gst_date_time_new_from_unix_epoch_utc (gint64 secs) G_GNUC_MALLOC;
GstDateTime * gst_date_time_new_local_time (gint year,
gint month,
gint day,
gint hour,
gint minute,
gdouble seconds) G_GNUC_MALLOC;
GstDateTime * gst_date_time_new_y (gint year) G_GNUC_MALLOC;
GstDateTime * gst_date_time_new_ym (gint year,
gint month) G_GNUC_MALLOC;
GstDateTime * gst_date_time_new_ymd (gint year,
gint month,
gint day) G_GNUC_MALLOC;
GstDateTime * gst_date_time_new (gfloat tzoffset,
gint year, gint month,
gint day, gint hour,
gint minute,
gdouble seconds) G_GNUC_MALLOC;
GstDateTime * gst_date_time_new_now_local_time (void) G_GNUC_MALLOC;
GstDateTime * gst_date_time_new_now_utc (void) G_GNUC_MALLOC;
gchar * gst_date_time_to_iso8601_string (GstDateTime * datetime) G_GNUC_MALLOC;
GstDateTime * gst_date_time_new_from_iso8601_string (const gchar * string) G_GNUC_MALLOC;
GDateTime * gst_date_time_to_g_date_time (GstDateTime * datetime);
GstDateTime * gst_date_time_new_from_g_date_time (GDateTime * dt);
/* refcounting */
GstDateTime * gst_date_time_ref (GstDateTime * datetime);
void gst_date_time_unref (GstDateTime * datetime);
G_END_DECLS
#endif /* __GST_DATE_TIME_H__ */
@@ -0,0 +1,103 @@
/* GStreamer
* Copyright (C) 2007 Stefan Kost <ensonic@users.sf.net>
*
* gstdebugutils.h: debugging and analysis utillities
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GSTDEBUGUTILS_H__
#define __GSTDEBUGUTILS_H__
#include <glib.h>
#include <glib-object.h>
#include <gst/gstconfig.h>
#include <gst/gstbin.h>
G_BEGIN_DECLS
/**
* GstDebugGraphDetails:
* @GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE: show caps-name on edges
* @GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS: show caps-details on edges
* @GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS: show modified parameters on elements
* @GST_DEBUG_GRAPH_SHOW_STATES: show element states
* @GST_DEBUG_GRAPH_SHOW_ALL: show all details
*
* Available details for pipeline graphs produced by GST_DEBUG_BIN_TO_DOT_FILE()
* and GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS().
*/
typedef enum {
GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE = (1<<0),
GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS = (1<<1),
GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS = (1<<2),
GST_DEBUG_GRAPH_SHOW_STATES = (1<<3),
GST_DEBUG_GRAPH_SHOW_ALL = ((1<<4)-1)
} GstDebugGraphDetails;
/********** pipeline graphs **********/
void gst_debug_bin_to_dot_file (GstBin *bin, GstDebugGraphDetails details, const gchar *file_name);
void gst_debug_bin_to_dot_file_with_ts (GstBin *bin, GstDebugGraphDetails details, const gchar *file_name);
#ifndef GST_DISABLE_GST_DEBUG
/**
* GST_DEBUG_BIN_TO_DOT_FILE:
* @bin: the top-level pipeline that should be analyzed
* @details: details to show in the graph, e.g. #GST_DEBUG_GRAPH_SHOW_ALL or
* one or more other #GstDebugGraphDetails flags.
* @file_name: output base filename (e.g. "myplayer")
*
* To aid debugging applications one can use this method to write out the whole
* network of gstreamer elements that form the pipeline into an dot file.
* This file can be processed with graphviz to get an image.
* <informalexample><programlisting>
* dot -Tpng -oimage.png graph_lowlevel.dot
* </programlisting></informalexample>
*
* The macro is only active if gstreamer is configured with
* &quot;--gst-enable-gst-debug&quot; and the environment variable
* GST_DEBUG_DUMP_DOT_DIR is set to a basepath (e.g. /tmp).
*/
#define GST_DEBUG_BIN_TO_DOT_FILE(bin, details, file_name) gst_debug_bin_to_dot_file (bin, details, file_name)
/**
* GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS:
* @bin: the top-level pipeline that should be analyzed
* @details: details to show in the graph, e.g. #GST_DEBUG_GRAPH_SHOW_ALL or
* one or more other #GstDebugGraphDetails flags.
* @file_name: output base filename (e.g. "myplayer")
*
* This works like GST_DEBUG_BIN_TO_DOT_FILE(), but adds the current timestamp
* to the filename, so that it can be used to take multiple snapshots.
*/
#define GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(bin, details, file_name) gst_debug_bin_to_dot_file_with_ts (bin, details, file_name)
#else /* GST_DISABLE_GST_DEBUG */
#define GST_DEBUG_BIN_TO_DOT_FILE(bin, details, file_name)
#define GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(bin, details, file_name)
#endif /* GST_DISABLE_GST_DEBUG */
G_END_DECLS
#endif /* __GSTDEBUGUTILS_H__ */
@@ -0,0 +1,801 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000,2004 Wim Taymans <wim@fluendo.com>
*
* gstelement.h: Header for GstElement
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_ELEMENT_H__
#define __GST_ELEMENT_H__
/* gstelement.h and gstelementfactory.h include eachother */
typedef struct _GstElement GstElement;
typedef struct _GstElementClass GstElementClass;
/* gstmessage.h needs State */
/**
* GstState:
* @GST_STATE_VOID_PENDING: no pending state.
* @GST_STATE_NULL : the NULL state or initial state of an element.
* @GST_STATE_READY : the element is ready to go to PAUSED.
* @GST_STATE_PAUSED : the element is PAUSED, it is ready to accept and
* process data. Sink elements however only accept one
* buffer and then block.
* @GST_STATE_PLAYING : the element is PLAYING, the #GstClock is running and
* the data is flowing.
*
* The possible states an element can be in. States can be changed using
* gst_element_set_state() and checked using gst_element_get_state().
*/
typedef enum {
GST_STATE_VOID_PENDING = 0,
GST_STATE_NULL = 1,
GST_STATE_READY = 2,
GST_STATE_PAUSED = 3,
GST_STATE_PLAYING = 4
} GstState;
#include <gst/gstconfig.h>
#include <gst/gstobject.h>
#include <gst/gstpad.h>
#include <gst/gstbus.h>
#include <gst/gstclock.h>
#include <gst/gstelementfactory.h>
#include <gst/gstplugin.h>
#include <gst/gstpluginfeature.h>
#include <gst/gstiterator.h>
#include <gst/gstmessage.h>
#include <gst/gstquery.h>
#include <gst/gsttaglist.h>
G_BEGIN_DECLS
#define GST_TYPE_ELEMENT (gst_element_get_type ())
#define GST_IS_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_ELEMENT))
#define GST_IS_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_ELEMENT))
#define GST_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ELEMENT, GstElementClass))
#define GST_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_ELEMENT, GstElement))
#define GST_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_ELEMENT, GstElementClass))
#define GST_ELEMENT_CAST(obj) ((GstElement*)(obj))
/**
* GstStateChangeReturn:
* @GST_STATE_CHANGE_FAILURE : the state change failed
* @GST_STATE_CHANGE_SUCCESS : the state change succeeded
* @GST_STATE_CHANGE_ASYNC : the state change will happen asynchronously
* @GST_STATE_CHANGE_NO_PREROLL: the state change succeeded but the element
* cannot produce data in %GST_STATE_PAUSED.
* This typically happens with live sources.
*
* The possible return values from a state change function such as
* gst_element_set_state(). Only @GST_STATE_CHANGE_FAILURE is a real failure.
*/
typedef enum {
GST_STATE_CHANGE_FAILURE = 0,
GST_STATE_CHANGE_SUCCESS = 1,
GST_STATE_CHANGE_ASYNC = 2,
GST_STATE_CHANGE_NO_PREROLL = 3
} GstStateChangeReturn;
/* NOTE: this probably should be done with an #ifdef to decide
* whether to safe-cast or to just do the non-checking cast.
*/
/**
* GST_STATE:
* @elem: a #GstElement to return state for.
*
* This macro returns the current #GstState of the element.
*/
#define GST_STATE(elem) (GST_ELEMENT_CAST(elem)->current_state)
/**
* GST_STATE_NEXT:
* @elem: a #GstElement to return the next state for.
*
* This macro returns the next #GstState of the element.
*/
#define GST_STATE_NEXT(elem) (GST_ELEMENT_CAST(elem)->next_state)
/**
* GST_STATE_PENDING:
* @elem: a #GstElement to return the pending state for.
*
* This macro returns the currently pending #GstState of the element.
*/
#define GST_STATE_PENDING(elem) (GST_ELEMENT_CAST(elem)->pending_state)
/**
* GST_STATE_TARGET:
* @elem: a #GstElement to return the target state for.
*
* This macro returns the target #GstState of the element.
*/
#define GST_STATE_TARGET(elem) (GST_ELEMENT_CAST(elem)->target_state)
/**
* GST_STATE_RETURN:
* @elem: a #GstElement to return the last state result for.
*
* This macro returns the last #GstStateChangeReturn value.
*/
#define GST_STATE_RETURN(elem) (GST_ELEMENT_CAST(elem)->last_return)
#define __GST_SIGN(val) ((val) < 0 ? -1 : ((val) > 0 ? 1 : 0))
/**
* GST_STATE_GET_NEXT:
* @cur: A starting #GstState
* @pending: A target #GstState
*
* Given a current state @cur and a target state @pending, calculate the next (intermediate)
* #GstState.
*/
#define GST_STATE_GET_NEXT(cur,pending) ((GstState)((cur) + __GST_SIGN ((gint)(pending) - (gint)(cur))))
/**
* GST_STATE_TRANSITION:
* @cur: A current state
* @next: A next state
*
* Given a current state @cur and a next state @next, calculate the associated
* #GstStateChange transition.
*/
#define GST_STATE_TRANSITION(cur,next) ((GstStateChange)(((cur)<<3)|(next)))
/**
* GST_STATE_TRANSITION_CURRENT:
* @trans: A #GstStateChange
*
* Given a state transition @trans, extract the current #GstState.
*/
#define GST_STATE_TRANSITION_CURRENT(trans) ((GstState)((trans)>>3))
/**
* GST_STATE_TRANSITION_NEXT:
* @trans: A #GstStateChange
*
* Given a state transition @trans, extract the next #GstState.
*/
#define GST_STATE_TRANSITION_NEXT(trans) ((GstState)((trans)&0x7))
/**
* GstStateChange:
* @GST_STATE_CHANGE_NULL_TO_READY : state change from NULL to READY.
* <itemizedlist>
* <listitem><para>
* The element must check if the resources it needs are available. Device
* sinks and -sources typically try to probe the device to constrain their
* caps.
* </para></listitem>
* <listitem><para>
* The element opens the device (in case feature need to be probed).
* </para></listitem>
* </itemizedlist>
* @GST_STATE_CHANGE_READY_TO_PAUSED : state change from READY to PAUSED.
* <itemizedlist>
* <listitem><para>
* The element pads are activated in order to receive data in PAUSED.
* Streaming threads are started.
* </para></listitem>
* <listitem><para>
* Some elements might need to return %GST_STATE_CHANGE_ASYNC and complete
* the state change when they have enough information. It is a requirement
* for sinks to return %GST_STATE_CHANGE_ASYNC and complete the state change
* when they receive the first buffer or %GST_EVENT_EOS (preroll).
* Sinks also block the dataflow when in PAUSED.
* </para></listitem>
* <listitem><para>
* A pipeline resets the running_time to 0.
* </para></listitem>
* <listitem><para>
* Live sources return %GST_STATE_CHANGE_NO_PREROLL and don't generate data.
* </para></listitem>
* </itemizedlist>
* @GST_STATE_CHANGE_PAUSED_TO_PLAYING: state change from PAUSED to PLAYING.
* <itemizedlist>
* <listitem><para>
* Most elements ignore this state change.
* </para></listitem>
* <listitem><para>
* The pipeline selects a #GstClock and distributes this to all the children
* before setting them to PLAYING. This means that it is only alowed to
* synchronize on the #GstClock in the PLAYING state.
* </para></listitem>
* <listitem><para>
* The pipeline uses the #GstClock and the running_time to calculate the
* base_time. The base_time is distributed to all children when performing
* the state change.
* </para></listitem>
* <listitem><para>
* Sink elements stop blocking on the preroll buffer or event and start
* rendering the data.
* </para></listitem>
* <listitem><para>
* Sinks can post %GST_MESSAGE_EOS in the PLAYING state. It is not allowed
* to post %GST_MESSAGE_EOS when not in the PLAYING state.
* </para></listitem>
* <listitem><para>
* While streaming in PAUSED or PLAYING elements can create and remove
* sometimes pads.
* </para></listitem>
* <listitem><para>
* Live sources start generating data and return %GST_STATE_CHANGE_SUCCESS.
* </para></listitem>
* </itemizedlist>
* @GST_STATE_CHANGE_PLAYING_TO_PAUSED: state change from PLAYING to PAUSED.
* <itemizedlist>
* <listitem><para>
* Most elements ignore this state change.
* </para></listitem>
* <listitem><para>
* The pipeline calculates the running_time based on the last selected
* #GstClock and the base_time. It stores this information to continue
* playback when going back to the PLAYING state.
* </para></listitem>
* <listitem><para>
* Sinks unblock any #GstClock wait calls.
* </para></listitem>
* <listitem><para>
* When a sink does not have a pending buffer to play, it returns
* %GST_STATE_CHANGE_ASYNC from this state change and completes the state
* change when it receives a new buffer or an %GST_EVENT_EOS.
* </para></listitem>
* <listitem><para>
* Any queued %GST_MESSAGE_EOS items are removed since they will be reposted
* when going back to the PLAYING state. The EOS messages are queued in
* #GstBin containers.
* </para></listitem>
* <listitem><para>
* Live sources stop generating data and return %GST_STATE_CHANGE_NO_PREROLL.
* </para></listitem>
* </itemizedlist>
* @GST_STATE_CHANGE_PAUSED_TO_READY : state change from PAUSED to READY.
* <itemizedlist>
* <listitem><para>
* Sinks unblock any waits in the preroll.
* </para></listitem>
* <listitem><para>
* Elements unblock any waits on devices
* </para></listitem>
* <listitem><para>
* Chain or get_range functions return %GST_FLOW_FLUSHING.
* </para></listitem>
* <listitem><para>
* The element pads are deactivated so that streaming becomes impossible and
* all streaming threads are stopped.
* </para></listitem>
* <listitem><para>
* The sink forgets all negotiated formats
* </para></listitem>
* <listitem><para>
* Elements remove all sometimes pads
* </para></listitem>
* </itemizedlist>
* @GST_STATE_CHANGE_READY_TO_NULL : state change from READY to NULL.
* <itemizedlist>
* <listitem><para>
* Elements close devices
* </para></listitem>
* <listitem><para>
* Elements reset any internal state.
* </para></listitem>
* </itemizedlist>
*
* These are the different state changes an element goes through.
* %GST_STATE_NULL &rArr; %GST_STATE_PLAYING is called an upwards state change
* and %GST_STATE_PLAYING &rArr; %GST_STATE_NULL a downwards state change.
*/
typedef enum /*< flags=0 >*/
{
GST_STATE_CHANGE_NULL_TO_READY = (GST_STATE_NULL<<3) | GST_STATE_READY,
GST_STATE_CHANGE_READY_TO_PAUSED = (GST_STATE_READY<<3) | GST_STATE_PAUSED,
GST_STATE_CHANGE_PAUSED_TO_PLAYING = (GST_STATE_PAUSED<<3) | GST_STATE_PLAYING,
GST_STATE_CHANGE_PLAYING_TO_PAUSED = (GST_STATE_PLAYING<<3) | GST_STATE_PAUSED,
GST_STATE_CHANGE_PAUSED_TO_READY = (GST_STATE_PAUSED<<3) | GST_STATE_READY,
GST_STATE_CHANGE_READY_TO_NULL = (GST_STATE_READY<<3) | GST_STATE_NULL
} GstStateChange;
/**
* GstElementFlags:
* @GST_ELEMENT_FLAG_LOCKED_STATE: ignore state changes from parent
* @GST_ELEMENT_FLAG_SINK: the element is a sink
* @GST_ELEMENT_FLAG_SOURCE: the element is a source.
* @GST_ELEMENT_FLAG_PROVIDE_CLOCK: the element can provide a clock
* @GST_ELEMENT_FLAG_REQUIRE_CLOCK: the element requires a clock
* @GST_ELEMENT_FLAG_INDEXABLE: the element can use an index
* @GST_ELEMENT_FLAG_LAST: offset to define more flags
*
* The standard flags that an element may have.
*/
typedef enum
{
GST_ELEMENT_FLAG_LOCKED_STATE = (GST_OBJECT_FLAG_LAST << 0),
GST_ELEMENT_FLAG_SINK = (GST_OBJECT_FLAG_LAST << 1),
GST_ELEMENT_FLAG_SOURCE = (GST_OBJECT_FLAG_LAST << 2),
GST_ELEMENT_FLAG_PROVIDE_CLOCK = (GST_OBJECT_FLAG_LAST << 3),
GST_ELEMENT_FLAG_REQUIRE_CLOCK = (GST_OBJECT_FLAG_LAST << 4),
GST_ELEMENT_FLAG_INDEXABLE = (GST_OBJECT_FLAG_LAST << 5),
/* padding */
GST_ELEMENT_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 10)
} GstElementFlags;
/**
* GST_ELEMENT_IS_LOCKED_STATE:
* @elem: A #GstElement to query
*
* Check if the element is in the locked state and therefore will ignore state
* changes from its parent object.
*/
#define GST_ELEMENT_IS_LOCKED_STATE(elem) (GST_OBJECT_FLAG_IS_SET(elem,GST_ELEMENT_FLAG_LOCKED_STATE))
/**
* GST_ELEMENT_NAME:
* @elem: A #GstElement to query
*
* Gets the name of this element. Use only in core as this is not
* ABI-compatible. Others use gst_element_get_name()
*/
#define GST_ELEMENT_NAME(elem) (GST_OBJECT_NAME(elem))
/**
* GST_ELEMENT_PARENT:
* @elem: A #GstElement to query
*
* Get the parent object of this element.
*/
#define GST_ELEMENT_PARENT(elem) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(elem)))
/**
* GST_ELEMENT_BUS:
* @elem: A #GstElement to query
*
* Get the message bus of this element.
*/
#define GST_ELEMENT_BUS(elem) (GST_ELEMENT_CAST(elem)->bus)
/**
* GST_ELEMENT_CLOCK:
* @elem: A #GstElement to query
*
* Get the clock of this element
*/
#define GST_ELEMENT_CLOCK(elem) (GST_ELEMENT_CAST(elem)->clock)
/**
* GST_ELEMENT_PADS:
* @elem: A #GstElement to query
*
* Get the pads of this elements.
*/
#define GST_ELEMENT_PADS(elem) (GST_ELEMENT_CAST(elem)->pads)
/**
* GST_ELEMENT_START_TIME:
* @elem: a #GstElement to return the start time for.
*
* This macro returns the start_time of the @elem. The start_time is the
* running_time of the pipeline when the element went to PAUSED.
*/
#define GST_ELEMENT_START_TIME(elem) (GST_ELEMENT_CAST(elem)->start_time)
/**
* GST_ELEMENT_ERROR:
* @el: the element that generates the error
* @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
* @code: error code defined for that domain (see #gstreamer-GstGError)
* @text: the message to display (format string and args enclosed in
parentheses)
* @debug: debugging information for the message (format string and args
enclosed in parentheses)
*
* Utility function that elements can use in case they encountered a fatal
* data processing error. The pipeline will post an error message and the
* application will be requested to stop further media processing.
*/
#define GST_ELEMENT_ERROR(el, domain, code, text, debug) \
G_STMT_START { \
gchar *__txt = _gst_element_error_printf text; \
gchar *__dbg = _gst_element_error_printf debug; \
if (__txt) \
GST_WARNING_OBJECT (el, "error: %s", __txt); \
if (__dbg) \
GST_WARNING_OBJECT (el, "error: %s", __dbg); \
gst_element_message_full (GST_ELEMENT(el), GST_MESSAGE_ERROR, \
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \
__txt, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
} G_STMT_END
/**
* GST_ELEMENT_WARNING:
* @el: the element that generates the warning
* @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
* @code: error code defined for that domain (see #gstreamer-GstGError)
* @text: the message to display (format string and args enclosed in
parentheses)
* @debug: debugging information for the message (format string and args
enclosed in parentheses)
*
* Utility function that elements can use in case they encountered a non-fatal
* data processing problem. The pipeline will post a warning message and the
* application will be informed.
*/
#define GST_ELEMENT_WARNING(el, domain, code, text, debug) \
G_STMT_START { \
gchar *__txt = _gst_element_error_printf text; \
gchar *__dbg = _gst_element_error_printf debug; \
if (__txt) \
GST_WARNING_OBJECT (el, "warning: %s", __txt); \
if (__dbg) \
GST_WARNING_OBJECT (el, "warning: %s", __dbg); \
gst_element_message_full (GST_ELEMENT(el), GST_MESSAGE_WARNING, \
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \
__txt, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
} G_STMT_END
/**
* GST_ELEMENT_INFO:
* @el: the element that generates the information
* @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
* @code: error code defined for that domain (see #gstreamer-GstGError)
* @text: the message to display (format string and args enclosed in
parentheses)
* @debug: debugging information for the message (format string and args
enclosed in parentheses)
*
* Utility function that elements can use in case they want to inform
* the application of something noteworthy that is not an error.
* The pipeline will post a info message and the
* application will be informed.
*/
#define GST_ELEMENT_INFO(el, domain, code, text, debug) \
G_STMT_START { \
gchar *__txt = _gst_element_error_printf text; \
gchar *__dbg = _gst_element_error_printf debug; \
if (__txt) \
GST_INFO_OBJECT (el, "info: %s", __txt); \
if (__dbg) \
GST_INFO_OBJECT (el, "info: %s", __dbg); \
gst_element_message_full (GST_ELEMENT(el), GST_MESSAGE_INFO, \
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \
__txt, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
} G_STMT_END
/* the state change mutexes and conds */
/**
* GST_STATE_GET_LOCK:
* @elem: a #GstElement
*
* Get a reference to the state lock of @elem.
* This lock is used by the core. It is taken while getting or setting
* the state, during state changes, and while finalizing.
*/
#define GST_STATE_GET_LOCK(elem) (&(GST_ELEMENT_CAST(elem)->state_lock))
/**
* GST_STATE_GET_COND:
* @elem: a #GstElement
*
* Get the conditional used to signal the completion of a state change.
*/
#define GST_STATE_GET_COND(elem) (&GST_ELEMENT_CAST(elem)->state_cond)
#define GST_STATE_LOCK(elem) g_rec_mutex_lock(GST_STATE_GET_LOCK(elem))
#define GST_STATE_TRYLOCK(elem) g_rec_mutex_trylock(GST_STATE_GET_LOCK(elem))
#define GST_STATE_UNLOCK(elem) g_rec_mutex_unlock(GST_STATE_GET_LOCK(elem))
#define GST_STATE_UNLOCK_FULL(elem) g_rec_mutex_unlock_full(GST_STATE_GET_LOCK(elem))
#define GST_STATE_LOCK_FULL(elem,t) g_rec_mutex_lock_full(GST_STATE_GET_LOCK(elem), t)
#define GST_STATE_WAIT(elem) g_cond_wait (GST_STATE_GET_COND (elem), \
GST_OBJECT_GET_LOCK (elem))
#define GST_STATE_WAIT_UNTIL(elem, end_time) g_cond_wait_until (GST_STATE_GET_COND (elem), \
GST_OBJECT_GET_LOCK (elem), end_time)
#define GST_STATE_SIGNAL(elem) g_cond_signal (GST_STATE_GET_COND (elem));
#define GST_STATE_BROADCAST(elem) g_cond_broadcast (GST_STATE_GET_COND (elem));
/**
* GstElement:
* @state_lock: Used to serialize execution of gst_element_set_state()
* @state_cond: Used to signal completion of a state change
* @state_cookie: Used to detect concurrent execution of
* gst_element_set_state() and gst_element_get_state()
* @target_state: the target state of an element as set by the application
* @current_state: the current state of an element
* @next_state: the next state of an element, can be #GST_STATE_VOID_PENDING if
* the element is in the correct state.
* @pending_state: the final state the element should go to, can be
* #GST_STATE_VOID_PENDING if the element is in the correct state
* @last_return: the last return value of an element state change
* @bus: the bus of the element. This bus is provided to the element by the
* parent element or the application. A #GstPipeline has a bus of its own.
* @clock: the clock of the element. This clock is usually provided to the
* element by the toplevel #GstPipeline.
* @base_time: the time of the clock right before the element is set to
* PLAYING. Subtracting @base_time from the current clock time in the PLAYING
* state will yield the running_time against the clock.
* @start_time: the running_time of the last PAUSED state
* @numpads: number of pads of the element, includes both source and sink pads.
* @pads: (element-type Gst.Pad): list of pads
* @numsrcpads: number of source pads of the element.
* @srcpads: (element-type Gst.Pad): list of source pads
* @numsinkpads: number of sink pads of the element.
* @sinkpads: (element-type Gst.Pad): list of sink pads
* @pads_cookie: updated whenever the a pad is added or removed
*
* GStreamer element abstract base class.
*/
struct _GstElement
{
GstObject object;
/*< public >*/ /* with LOCK */
GRecMutex state_lock;
/* element state */
GCond state_cond;
guint32 state_cookie;
GstState target_state;
GstState current_state;
GstState next_state;
GstState pending_state;
GstStateChangeReturn last_return;
GstBus *bus;
/* allocated clock */
GstClock *clock;
GstClockTimeDiff base_time; /* NULL/READY: 0 - PAUSED: current time - PLAYING: difference to clock */
GstClockTime start_time;
/* element pads, these lists can only be iterated while holding
* the LOCK or checking the cookie after each LOCK. */
guint16 numpads;
GList *pads;
guint16 numsrcpads;
GList *srcpads;
guint16 numsinkpads;
GList *sinkpads;
guint32 pads_cookie;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstElementClass:
* @parent_class: the parent class structure
* @metadata: metadata for elements of this class
* @elementfactory: the #GstElementFactory that creates these elements
* @padtemplates: a #GList of #GstPadTemplate
* @numpadtemplates: the number of padtemplates
* @pad_templ_cookie: changed whenever the padtemplates change
* @request_new_pad: called when a new pad is requested
* @release_pad: called when a request pad is to be released
* @get_state: get the state of the element
* @set_state: set a new state on the element
* @change_state: called by @set_state to perform an incremental state change
* @set_bus: set a #GstBus on the element
* @provide_clock: gets the #GstClock provided by the element
* @set_clock: set the #GstClock on the element
* @send_event: send a #GstEvent to the element
* @query: perform a #GstQuery on the element
* @state_changed: called immediately after a new state was set.
* @post_message: called when a message is posted on the element. Chain up to
* the parent class' handler to have it posted on the bus.
*
* GStreamer element class. Override the vmethods to implement the element
* functionality.
*/
struct _GstElementClass
{
GstObjectClass parent_class;
/*< public >*/
/* the element metadata */
gpointer metadata;
/* factory that the element was created from */
GstElementFactory *elementfactory;
/* templates for our pads */
GList *padtemplates;
gint numpadtemplates;
guint32 pad_templ_cookie;
/*< private >*/
/* signal callbacks */
void (*pad_added) (GstElement *element, GstPad *pad);
void (*pad_removed) (GstElement *element, GstPad *pad);
void (*no_more_pads) (GstElement *element);
/*< public >*/
/* virtual methods for subclasses */
/* request/release pads */
GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ,
const gchar* name, const GstCaps *caps);
void (*release_pad) (GstElement *element, GstPad *pad);
/* state changes */
GstStateChangeReturn (*get_state) (GstElement * element, GstState * state,
GstState * pending, GstClockTime timeout);
GstStateChangeReturn (*set_state) (GstElement *element, GstState state);
GstStateChangeReturn (*change_state) (GstElement *element, GstStateChange transition);
void (*state_changed) (GstElement *element, GstState oldstate,
GstState newstate, GstState pending);
/* bus */
void (*set_bus) (GstElement * element, GstBus * bus);
/* set/get clocks */
GstClock* (*provide_clock) (GstElement *element);
gboolean (*set_clock) (GstElement *element, GstClock *clock);
/* query functions */
gboolean (*send_event) (GstElement *element, GstEvent *event);
gboolean (*query) (GstElement *element, GstQuery *query);
gboolean (*post_message) (GstElement *element, GstMessage *message);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE-1];
};
/* element class pad templates */
void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ);
GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name);
GList* gst_element_class_get_pad_template_list (GstElementClass *element_class);
/* element class meta data */
void gst_element_class_set_metadata (GstElementClass *klass,
const gchar *longname,
const gchar *classification,
const gchar *description,
const gchar *author);
void gst_element_class_set_static_metadata (GstElementClass *klass,
const gchar *longname,
const gchar *classification,
const gchar *description,
const gchar *author);
void gst_element_class_add_metadata (GstElementClass * klass,
const gchar * key, const gchar * value);
void gst_element_class_add_static_metadata (GstElementClass * klass,
const gchar * key, const gchar * value);
const gchar * gst_element_class_get_metadata (GstElementClass * klass,
const gchar * key);
/* element instance */
GType gst_element_get_type (void);
/* basic name and parentage stuff from GstObject */
/**
* gst_element_get_name:
* @elem: a #GstElement to get the name of @elem.
*
* Returns a copy of the name of @elem.
* Caller should g_free() the return value after usage.
* For a nameless element, this returns NULL, which you can safely g_free()
* as well.
*
* Returns: (transfer full): the name of @elem. g_free() after usage. MT safe.
*
*/
#define gst_element_get_name(elem) gst_object_get_name(GST_OBJECT_CAST(elem))
/**
* gst_element_set_name:
* @elem: a #GstElement to set the name of.
* @name: the new name
*
* Sets the name of the element, getting rid of the old name if there was one.
*/
#define gst_element_set_name(elem,name) gst_object_set_name(GST_OBJECT_CAST(elem),name)
/**
* gst_element_get_parent:
* @elem: a #GstElement to get the parent of.
*
* Get the parent of an element.
*
* Returns: (transfer full): the parent of an element.
*/
#define gst_element_get_parent(elem) gst_object_get_parent(GST_OBJECT_CAST(elem))
/**
* gst_element_set_parent:
* @elem: a #GstElement to set the parent of.
* @parent: the new parent #GstObject of the element.
*
* Sets the parent of an element.
*/
#define gst_element_set_parent(elem,parent) gst_object_set_parent(GST_OBJECT_CAST(elem),parent)
/* clocking */
GstClock* gst_element_provide_clock (GstElement *element);
GstClock* gst_element_get_clock (GstElement *element);
gboolean gst_element_set_clock (GstElement *element, GstClock *clock);
void gst_element_set_base_time (GstElement *element, GstClockTime time);
GstClockTime gst_element_get_base_time (GstElement *element);
void gst_element_set_start_time (GstElement *element, GstClockTime time);
GstClockTime gst_element_get_start_time (GstElement *element);
/* bus */
void gst_element_set_bus (GstElement * element, GstBus * bus);
GstBus * gst_element_get_bus (GstElement * element);
/* pad management */
gboolean gst_element_add_pad (GstElement *element, GstPad *pad);
gboolean gst_element_remove_pad (GstElement *element, GstPad *pad);
void gst_element_no_more_pads (GstElement *element);
GstPad* gst_element_get_static_pad (GstElement *element, const gchar *name);
GstPad* gst_element_get_request_pad (GstElement *element, const gchar *name);
GstPad* gst_element_request_pad (GstElement *element, GstPadTemplate *templ,
const gchar * name, const GstCaps *caps);
void gst_element_release_request_pad (GstElement *element, GstPad *pad);
GstIterator * gst_element_iterate_pads (GstElement * element);
GstIterator * gst_element_iterate_src_pads (GstElement * element);
GstIterator * gst_element_iterate_sink_pads (GstElement * element);
/* event/query/format stuff */
gboolean gst_element_send_event (GstElement *element, GstEvent *event);
gboolean gst_element_seek (GstElement *element, gdouble rate,
GstFormat format, GstSeekFlags flags,
GstSeekType start_type, gint64 start,
GstSeekType stop_type, gint64 stop);
gboolean gst_element_query (GstElement *element, GstQuery *query);
/* messages */
gboolean gst_element_post_message (GstElement * element, GstMessage * message);
/* error handling */
/* gcc versions < 3.3 warn about NULL being passed as format to printf */
#if (defined(GST_USING_PRINTF_EXTENSION) || !defined(__GNUC__) || (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 3))
gchar * _gst_element_error_printf (const gchar *format, ...);
#else
gchar * _gst_element_error_printf (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
#endif
void gst_element_message_full (GstElement * element, GstMessageType type,
GQuark domain, gint code, gchar * text,
gchar * debug, const gchar * file,
const gchar * function, gint line);
/* state management */
gboolean gst_element_is_locked_state (GstElement *element);
gboolean gst_element_set_locked_state (GstElement *element, gboolean locked_state);
gboolean gst_element_sync_state_with_parent (GstElement *element);
GstStateChangeReturn gst_element_get_state (GstElement * element,
GstState * state,
GstState * pending,
GstClockTime timeout);
GstStateChangeReturn gst_element_set_state (GstElement *element, GstState state);
void gst_element_abort_state (GstElement * element);
GstStateChangeReturn gst_element_change_state (GstElement * element,
GstStateChange transition);
GstStateChangeReturn gst_element_continue_state (GstElement * element,
GstStateChangeReturn ret);
void gst_element_lost_state (GstElement * element);
/* factory management */
GstElementFactory* gst_element_get_factory (GstElement *element);
G_END_DECLS
#endif /* __GST_ELEMENT_H__ */
@@ -0,0 +1,222 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000,2004 Wim Taymans <wim@fluendo.com>
*
* gstelement.h: Header for GstElement
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_ELEMENT_FACTORY_H__
#define __GST_ELEMENT_FACTORY_H__
/**
* GstElementFactory:
*
* The opaque #GstElementFactory data structure.
*/
typedef struct _GstElementFactory GstElementFactory;
typedef struct _GstElementFactoryClass GstElementFactoryClass;
#include <gst/gstconfig.h>
#include <gst/gstelement.h>
#include <gst/gstpad.h>
#include <gst/gstplugin.h>
#include <gst/gstpluginfeature.h>
#include <gst/gsturi.h>
G_BEGIN_DECLS
#define GST_TYPE_ELEMENT_FACTORY (gst_element_factory_get_type())
#define GST_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ELEMENT_FACTORY,\
GstElementFactory))
#define GST_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ELEMENT_FACTORY,\
GstElementFactoryClass))
#define GST_IS_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ELEMENT_FACTORY))
#define GST_IS_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT_FACTORY))
#define GST_ELEMENT_FACTORY_CAST(obj) ((GstElementFactory *)(obj))
GType gst_element_factory_get_type (void);
GstElementFactory * gst_element_factory_find (const gchar *name);
GType gst_element_factory_get_element_type (GstElementFactory *factory);
const gchar * gst_element_factory_get_metadata (GstElementFactory *factory, const gchar *key);
gchar ** gst_element_factory_get_metadata_keys (GstElementFactory *factory);
guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory);
const GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory);
GstURIType gst_element_factory_get_uri_type (GstElementFactory *factory);
const gchar * const * gst_element_factory_get_uri_protocols (GstElementFactory *factory);
gboolean gst_element_factory_has_interface (GstElementFactory *factory,
const gchar *interfacename);
GstElement* gst_element_factory_create (GstElementFactory *factory,
const gchar *name) G_GNUC_MALLOC;
GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name) G_GNUC_MALLOC;
gboolean gst_element_register (GstPlugin *plugin, const gchar *name,
guint rank, GType type);
/* Factory list functions */
/**
* GstFactoryListType:
* @GST_ELEMENT_FACTORY_TYPE_DECODER: Decoder elements
* @GST_ELEMENT_FACTORY_TYPE_ENCODER: Encoder elements
* @GST_ELEMENT_FACTORY_TYPE_SINK: Sink elements
* @GST_ELEMENT_FACTORY_TYPE_SRC: Source elements
* @GST_ELEMENT_FACTORY_TYPE_MUXER: Muxer elements
* @GST_ELEMENT_FACTORY_TYPE_DEMUXER: Demuxer elements
* @GST_ELEMENT_FACTORY_TYPE_PARSER: Parser elements
* @GST_ELEMENT_FACTORY_TYPE_PAYLOADER: Payloader elements
* @GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER: Depayloader elements
* @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS: Private, do not use
* @GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO: Elements handling video media types
* @GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO: Elements handling audio media types
* @GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE: Elements handling image media types
* @GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE: Elements handling subtitle media types
* @GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA: Elements handling metadata media types
*
* The type of #GstElementFactory to filter.
*
* All @GstFactoryListType up to @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS are exclusive.
*
* If one or more of the MEDIA types are specified, then only elements
* matching the specified media types will be selected.
*/
typedef guint64 GstElementFactoryListType;
#define GST_ELEMENT_FACTORY_TYPE_DECODER (G_GUINT64_CONSTANT (1) << 0)
#define GST_ELEMENT_FACTORY_TYPE_ENCODER (G_GUINT64_CONSTANT (1) << 1)
#define GST_ELEMENT_FACTORY_TYPE_SINK (G_GUINT64_CONSTANT (1) << 2)
#define GST_ELEMENT_FACTORY_TYPE_SRC (G_GUINT64_CONSTANT (1) << 3)
#define GST_ELEMENT_FACTORY_TYPE_MUXER (G_GUINT64_CONSTANT (1) << 4)
#define GST_ELEMENT_FACTORY_TYPE_DEMUXER (G_GUINT64_CONSTANT (1) << 5)
#define GST_ELEMENT_FACTORY_TYPE_PARSER (G_GUINT64_CONSTANT (1) << 6)
#define GST_ELEMENT_FACTORY_TYPE_PAYLOADER (G_GUINT64_CONSTANT (1) << 7)
#define GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER (G_GUINT64_CONSTANT (1) << 8)
#define GST_ELEMENT_FACTORY_TYPE_FORMATTER (G_GUINT64_CONSTANT (1) << 9)
#define GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS (G_GUINT64_CONSTANT (1) << 48)
#define GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO (G_GUINT64_CONSTANT (1) << 49)
#define GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO (G_GUINT64_CONSTANT (1) << 50)
#define GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE (G_GUINT64_CONSTANT (1) << 51)
#define GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE (G_GUINT64_CONSTANT (1) << 52)
#define GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA (G_GUINT64_CONSTANT (1) << 53)
/**
* GST_ELEMENT_FACTORY_TYPE_ANY:
*
* Elements of any of the defined GST_ELEMENT_FACTORY_LIST types
*
* Value: 562949953421311
* Type: GstElementFactoryListType
*/
#define GST_ELEMENT_FACTORY_TYPE_ANY ((G_GUINT64_CONSTANT (1) << 49) - 1)
/**
* GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY:
*
* Elements matching any of the defined GST_ELEMENT_FACTORY_TYPE_MEDIA types
*
* Note: Do not use this if you wish to not filter against any of the defined
* media types. If you wish to do this, simply don't specify any
* GST_ELEMENT_FACTORY_TYPE_MEDIA flag.
*
* Value: 18446462598732840960
* Type: GstElementFactoryListType
*/
#define GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY (~G_GUINT64_CONSTANT (0) << 48)
/**
* GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER:
*
* All encoders handling video or image media types
*
* Value: 2814749767106562
* Type: GstElementFactoryListType
*/
#define GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER (GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE)
/**
* GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER:
*
* All encoders handling audio media types
*
* Value: 1125899906842626
* Type: GstElementFactoryListType
*/
#define GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER (GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO)
/**
* GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS:
*
* All sinks handling audio, video or image media types
*
* Value: 3940649673949188
* Type: GstElementFactoryListType
*/
#define GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS (GST_ELEMENT_FACTORY_TYPE_SINK | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE)
/**
* GST_ELEMENT_FACTORY_TYPE_DECODABLE:
*
* All elements used to 'decode' streams (decoders, demuxers, parsers, depayloaders)
*
* Value: 353
* Type: GstElementFactoryListType
*/
#define GST_ELEMENT_FACTORY_TYPE_DECODABLE \
(GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_DEMUXER | GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER | GST_ELEMENT_FACTORY_TYPE_PARSER)
/* Element klass defines */
#define GST_ELEMENT_FACTORY_KLASS_DECODER "Decoder"
#define GST_ELEMENT_FACTORY_KLASS_ENCODER "Encoder"
#define GST_ELEMENT_FACTORY_KLASS_SINK "Sink"
#define GST_ELEMENT_FACTORY_KLASS_SRC "Source"
#define GST_ELEMENT_FACTORY_KLASS_MUXER "Muxer"
#define GST_ELEMENT_FACTORY_KLASS_DEMUXER "Demuxer"
#define GST_ELEMENT_FACTORY_KLASS_PARSER "Parser"
#define GST_ELEMENT_FACTORY_KLASS_PAYLOADER "Payloader"
#define GST_ELEMENT_FACTORY_KLASS_DEPAYLOADER "Depayloader"
#define GST_ELEMENT_FACTORY_KLASS_FORMATTER "Formatter"
#define GST_ELEMENT_FACTORY_KLASS_MEDIA_VIDEO "Video"
#define GST_ELEMENT_FACTORY_KLASS_MEDIA_AUDIO "Audio"
#define GST_ELEMENT_FACTORY_KLASS_MEDIA_IMAGE "Image"
#define GST_ELEMENT_FACTORY_KLASS_MEDIA_SUBTITLE "Subtitle"
#define GST_ELEMENT_FACTORY_KLASS_MEDIA_METADATA "Metadata"
gboolean gst_element_factory_list_is_type (GstElementFactory *factory,
GstElementFactoryListType type);
GList * gst_element_factory_list_get_elements (GstElementFactoryListType type,
GstRank minrank) G_GNUC_MALLOC;
GList * gst_element_factory_list_filter (GList *list, const GstCaps *caps,
GstPadDirection direction,
gboolean subsetonly) G_GNUC_MALLOC;
G_END_DECLS
#endif /* __GST_ELEMENT_FACTORY_H__ */
@@ -0,0 +1,77 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000,2004 Wim Taymans <wim@fluendo.com>
*
* gstelementmetadata.h: Metadata for GstElement classes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_ELEMENT_METADATA_H__
#define __GST_ELEMENT_METADATA_H__
G_BEGIN_DECLS
/**
* GST_ELEMENT_METADATA_LONGNAME:
*
* The long English name of the element. E.g. "File Sink"
*/
#define GST_ELEMENT_METADATA_LONGNAME "long-name"
/**
* GST_ELEMENT_METADATA_KLASS:
*
* String describing the type of element, as an unordered list
* separated with slashes ('/'). See draft-klass.txt of the design docs
* for more details and common types. E.g: "Sink/File"
*/
#define GST_ELEMENT_METADATA_KLASS "klass"
/**
* GST_ELEMENT_METADATA_DESCRIPTION:
*
* Sentence describing the purpose of the element.
* E.g: "Write stream to a file"
*/
#define GST_ELEMENT_METADATA_DESCRIPTION "description"
/**
* GST_ELEMENT_METADATA_AUTHOR:
*
* Name and contact details of the author(s). Use \n to separate
* multiple author details.
* E.g: "Joe Bloggs &lt;joe.blogs at foo.com&gt;"
*/
#define GST_ELEMENT_METADATA_AUTHOR "author"
/**
* GST_ELEMENT_METADATA_DOC_URI:
*
* Set uri pointing to user documentation. Applications can use this to show
* help for e.g. effects to users.
*/
#define GST_ELEMENT_METADATA_DOC_URI "doc-uri"
/**
* GST_ELEMENT_METADATA_ICON_NAME:
*
* Elements that bridge to certain other products can include an icon of that
* used product. Application can show the icon in menus/selectors to help
* identifying specific elements.
*/
#define GST_ELEMENT_METADATA_ICON_NAME "icon-name"
G_END_DECLS
#endif /* __GST_ELEMENT_METADATA_H__ */
@@ -0,0 +1,231 @@
#ifndef __GST_ENUM_TYPES_H__
#define __GST_ENUM_TYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/* enumerations from "gstobject.h" */
GType gst_object_flags_get_type (void);
#define GST_TYPE_OBJECT_FLAGS (gst_object_flags_get_type())
/* enumerations from "gstallocator.h" */
GType gst_allocator_flags_get_type (void);
#define GST_TYPE_ALLOCATOR_FLAGS (gst_allocator_flags_get_type())
/* enumerations from "gstbin.h" */
GType gst_bin_flags_get_type (void);
#define GST_TYPE_BIN_FLAGS (gst_bin_flags_get_type())
/* enumerations from "gstbuffer.h" */
GType gst_buffer_flags_get_type (void);
#define GST_TYPE_BUFFER_FLAGS (gst_buffer_flags_get_type())
GType gst_buffer_copy_flags_get_type (void);
#define GST_TYPE_BUFFER_COPY_FLAGS (gst_buffer_copy_flags_get_type())
/* enumerations from "gstbufferpool.h" */
GType gst_buffer_pool_acquire_flags_get_type (void);
#define GST_TYPE_BUFFER_POOL_ACQUIRE_FLAGS (gst_buffer_pool_acquire_flags_get_type())
/* enumerations from "gstbus.h" */
GType gst_bus_flags_get_type (void);
#define GST_TYPE_BUS_FLAGS (gst_bus_flags_get_type())
GType gst_bus_sync_reply_get_type (void);
#define GST_TYPE_BUS_SYNC_REPLY (gst_bus_sync_reply_get_type())
/* enumerations from "gstcaps.h" */
GType gst_caps_flags_get_type (void);
#define GST_TYPE_CAPS_FLAGS (gst_caps_flags_get_type())
GType gst_caps_intersect_mode_get_type (void);
#define GST_TYPE_CAPS_INTERSECT_MODE (gst_caps_intersect_mode_get_type())
/* enumerations from "gstclock.h" */
GType gst_clock_return_get_type (void);
#define GST_TYPE_CLOCK_RETURN (gst_clock_return_get_type())
GType gst_clock_entry_type_get_type (void);
#define GST_TYPE_CLOCK_ENTRY_TYPE (gst_clock_entry_type_get_type())
GType gst_clock_flags_get_type (void);
#define GST_TYPE_CLOCK_FLAGS (gst_clock_flags_get_type())
/* enumerations from "gstdebugutils.h" */
GType gst_debug_graph_details_get_type (void);
#define GST_TYPE_DEBUG_GRAPH_DETAILS (gst_debug_graph_details_get_type())
/* enumerations from "gstelement.h" */
GType gst_state_get_type (void);
#define GST_TYPE_STATE (gst_state_get_type())
GType gst_state_change_return_get_type (void);
#define GST_TYPE_STATE_CHANGE_RETURN (gst_state_change_return_get_type())
GType gst_state_change_get_type (void);
#define GST_TYPE_STATE_CHANGE (gst_state_change_get_type())
GType gst_element_flags_get_type (void);
#define GST_TYPE_ELEMENT_FLAGS (gst_element_flags_get_type())
/* enumerations from "gsterror.h" */
GType gst_core_error_get_type (void);
#define GST_TYPE_CORE_ERROR (gst_core_error_get_type())
GType gst_library_error_get_type (void);
#define GST_TYPE_LIBRARY_ERROR (gst_library_error_get_type())
GType gst_resource_error_get_type (void);
#define GST_TYPE_RESOURCE_ERROR (gst_resource_error_get_type())
GType gst_stream_error_get_type (void);
#define GST_TYPE_STREAM_ERROR (gst_stream_error_get_type())
/* enumerations from "gstevent.h" */
GType gst_event_type_flags_get_type (void);
#define GST_TYPE_EVENT_TYPE_FLAGS (gst_event_type_flags_get_type())
GType gst_event_type_get_type (void);
#define GST_TYPE_EVENT_TYPE (gst_event_type_get_type())
GType gst_qos_type_get_type (void);
#define GST_TYPE_QOS_TYPE (gst_qos_type_get_type())
/* enumerations from "gstformat.h" */
GType gst_format_get_type (void);
#define GST_TYPE_FORMAT (gst_format_get_type())
/* enumerations from "gstinfo.h" */
GType gst_debug_level_get_type (void);
#define GST_TYPE_DEBUG_LEVEL (gst_debug_level_get_type())
GType gst_debug_color_flags_get_type (void);
#define GST_TYPE_DEBUG_COLOR_FLAGS (gst_debug_color_flags_get_type())
/* enumerations from "gstiterator.h" */
GType gst_iterator_result_get_type (void);
#define GST_TYPE_ITERATOR_RESULT (gst_iterator_result_get_type())
GType gst_iterator_item_get_type (void);
#define GST_TYPE_ITERATOR_ITEM (gst_iterator_item_get_type())
/* enumerations from "gstmessage.h" */
GType gst_message_type_get_type (void);
#define GST_TYPE_MESSAGE_TYPE (gst_message_type_get_type())
GType gst_structure_change_type_get_type (void);
#define GST_TYPE_STRUCTURE_CHANGE_TYPE (gst_structure_change_type_get_type())
GType gst_stream_status_type_get_type (void);
#define GST_TYPE_STREAM_STATUS_TYPE (gst_stream_status_type_get_type())
GType gst_progress_type_get_type (void);
#define GST_TYPE_PROGRESS_TYPE (gst_progress_type_get_type())
/* enumerations from "gstmeta.h" */
GType gst_meta_flags_get_type (void);
#define GST_TYPE_META_FLAGS (gst_meta_flags_get_type())
/* enumerations from "gstmemory.h" */
GType gst_memory_flags_get_type (void);
#define GST_TYPE_MEMORY_FLAGS (gst_memory_flags_get_type())
GType gst_map_flags_get_type (void);
#define GST_TYPE_MAP_FLAGS (gst_map_flags_get_type())
/* enumerations from "gstminiobject.h" */
GType gst_mini_object_flags_get_type (void);
#define GST_TYPE_MINI_OBJECT_FLAGS (gst_mini_object_flags_get_type())
GType gst_lock_flags_get_type (void);
#define GST_TYPE_LOCK_FLAGS (gst_lock_flags_get_type())
/* enumerations from "gstpad.h" */
GType gst_pad_direction_get_type (void);
#define GST_TYPE_PAD_DIRECTION (gst_pad_direction_get_type())
GType gst_pad_mode_get_type (void);
#define GST_TYPE_PAD_MODE (gst_pad_mode_get_type())
GType gst_pad_link_return_get_type (void);
#define GST_TYPE_PAD_LINK_RETURN (gst_pad_link_return_get_type())
GType gst_flow_return_get_type (void);
#define GST_TYPE_FLOW_RETURN (gst_flow_return_get_type())
GType gst_pad_link_check_get_type (void);
#define GST_TYPE_PAD_LINK_CHECK (gst_pad_link_check_get_type())
GType gst_pad_probe_type_get_type (void);
#define GST_TYPE_PAD_PROBE_TYPE (gst_pad_probe_type_get_type())
GType gst_pad_probe_return_get_type (void);
#define GST_TYPE_PAD_PROBE_RETURN (gst_pad_probe_return_get_type())
GType gst_pad_flags_get_type (void);
#define GST_TYPE_PAD_FLAGS (gst_pad_flags_get_type())
/* enumerations from "gstpadtemplate.h" */
GType gst_pad_presence_get_type (void);
#define GST_TYPE_PAD_PRESENCE (gst_pad_presence_get_type())
GType gst_pad_template_flags_get_type (void);
#define GST_TYPE_PAD_TEMPLATE_FLAGS (gst_pad_template_flags_get_type())
/* enumerations from "gstpipeline.h" */
GType gst_pipeline_flags_get_type (void);
#define GST_TYPE_PIPELINE_FLAGS (gst_pipeline_flags_get_type())
/* enumerations from "gstplugin.h" */
GType gst_plugin_error_get_type (void);
#define GST_TYPE_PLUGIN_ERROR (gst_plugin_error_get_type())
GType gst_plugin_flags_get_type (void);
#define GST_TYPE_PLUGIN_FLAGS (gst_plugin_flags_get_type())
GType gst_plugin_dependency_flags_get_type (void);
#define GST_TYPE_PLUGIN_DEPENDENCY_FLAGS (gst_plugin_dependency_flags_get_type())
/* enumerations from "gstpluginfeature.h" */
GType gst_rank_get_type (void);
#define GST_TYPE_RANK (gst_rank_get_type())
/* enumerations from "gstquery.h" */
GType gst_query_type_flags_get_type (void);
#define GST_TYPE_QUERY_TYPE_FLAGS (gst_query_type_flags_get_type())
GType gst_query_type_get_type (void);
#define GST_TYPE_QUERY_TYPE (gst_query_type_get_type())
GType gst_buffering_mode_get_type (void);
#define GST_TYPE_BUFFERING_MODE (gst_buffering_mode_get_type())
GType gst_scheduling_flags_get_type (void);
#define GST_TYPE_SCHEDULING_FLAGS (gst_scheduling_flags_get_type())
/* enumerations from "gstsegment.h" */
GType gst_seek_type_get_type (void);
#define GST_TYPE_SEEK_TYPE (gst_seek_type_get_type())
GType gst_seek_flags_get_type (void);
#define GST_TYPE_SEEK_FLAGS (gst_seek_flags_get_type())
GType gst_segment_flags_get_type (void);
#define GST_TYPE_SEGMENT_FLAGS (gst_segment_flags_get_type())
/* enumerations from "gstsystemclock.h" */
GType gst_clock_type_get_type (void);
#define GST_TYPE_CLOCK_TYPE (gst_clock_type_get_type())
/* enumerations from "gsttaglist.h" */
GType gst_tag_merge_mode_get_type (void);
#define GST_TYPE_TAG_MERGE_MODE (gst_tag_merge_mode_get_type())
GType gst_tag_flag_get_type (void);
#define GST_TYPE_TAG_FLAG (gst_tag_flag_get_type())
GType gst_tag_scope_get_type (void);
#define GST_TYPE_TAG_SCOPE (gst_tag_scope_get_type())
/* enumerations from "gsttask.h" */
GType gst_task_state_get_type (void);
#define GST_TYPE_TASK_STATE (gst_task_state_get_type())
/* enumerations from "gsttoc.h" */
GType gst_toc_scope_get_type (void);
#define GST_TYPE_TOC_SCOPE (gst_toc_scope_get_type())
GType gst_toc_entry_type_get_type (void);
#define GST_TYPE_TOC_ENTRY_TYPE (gst_toc_entry_type_get_type())
/* enumerations from "gsttypefind.h" */
GType gst_type_find_probability_get_type (void);
#define GST_TYPE_TYPE_FIND_PROBABILITY (gst_type_find_probability_get_type())
/* enumerations from "gsturi.h" */
GType gst_uri_error_get_type (void);
#define GST_TYPE_URI_ERROR (gst_uri_error_get_type())
GType gst_uri_type_get_type (void);
#define GST_TYPE_URI_TYPE (gst_uri_type_get_type())
/* enumerations from "gstutils.h" */
GType gst_search_mode_get_type (void);
#define GST_TYPE_SEARCH_MODE (gst_search_mode_get_type())
/* enumerations from "gstparse.h" */
GType gst_parse_error_get_type (void);
#define GST_TYPE_PARSE_ERROR (gst_parse_error_get_type())
GType gst_parse_flags_get_type (void);
#define GST_TYPE_PARSE_FLAGS (gst_parse_flags_get_type())
G_END_DECLS
#endif /* __GST_ENUM_TYPES_H__ */
@@ -0,0 +1,248 @@
/* GStreamer
* Copyright (C) 2004 Thomas Vander Stichele <thomas at apestaart dot org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_ERROR_H__
#define __GST_ERROR_H__
#include <glib.h>
#include <glib-object.h>
#include <errno.h>
G_BEGIN_DECLS
/*
* we define FIXME error domains:
* GST_CORE_ERROR
* GST_LIBRARY_ERROR
* GST_RESOURCE_ERROR
* GST_STREAM_ERROR
*
* Check GError API docs for rationale for naming.
*/
/**
* GstCoreError:
* @GST_CORE_ERROR_FAILED: a general error which doesn't fit in any other
* category. Make sure you add a custom message to the error call.
* @GST_CORE_ERROR_TOO_LAZY: do not use this except as a placeholder for
* deciding where to go while developing code.
* @GST_CORE_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
* this functionality yet.
* @GST_CORE_ERROR_STATE_CHANGE: used for state change errors.
* @GST_CORE_ERROR_PAD: used for pad-related errors.
* @GST_CORE_ERROR_THREAD: used for thread-related errors.
* @GST_CORE_ERROR_NEGOTIATION: used for negotiation-related errors.
* @GST_CORE_ERROR_EVENT: used for event-related errors.
* @GST_CORE_ERROR_SEEK: used for seek-related errors.
* @GST_CORE_ERROR_CAPS: used for caps-related errors.
* @GST_CORE_ERROR_TAG: used for negotiation-related errors.
* @GST_CORE_ERROR_MISSING_PLUGIN: used if a plugin is missing.
* @GST_CORE_ERROR_CLOCK: used for clock related errors.
* @GST_CORE_ERROR_DISABLED: used if functionality has been disabled at
* compile time.
* @GST_CORE_ERROR_NUM_ERRORS: the number of core error types.
*
* Core errors are errors inside the core GStreamer library.
*/
/* FIXME: should we divide in numerical blocks so we can easily add
for example PAD errors later ? */
typedef enum
{
GST_CORE_ERROR_FAILED = 1,
GST_CORE_ERROR_TOO_LAZY,
GST_CORE_ERROR_NOT_IMPLEMENTED,
GST_CORE_ERROR_STATE_CHANGE,
GST_CORE_ERROR_PAD,
GST_CORE_ERROR_THREAD,
GST_CORE_ERROR_NEGOTIATION,
GST_CORE_ERROR_EVENT,
GST_CORE_ERROR_SEEK,
GST_CORE_ERROR_CAPS,
GST_CORE_ERROR_TAG,
GST_CORE_ERROR_MISSING_PLUGIN,
GST_CORE_ERROR_CLOCK,
GST_CORE_ERROR_DISABLED,
GST_CORE_ERROR_NUM_ERRORS
} GstCoreError;
/**
* GstLibraryError:
* @GST_LIBRARY_ERROR_FAILED: a general error which doesn't fit in any other
* category. Make sure you add a custom message to the error call.
* @GST_LIBRARY_ERROR_TOO_LAZY: do not use this except as a placeholder for
* deciding where to go while developing code.
* @GST_LIBRARY_ERROR_INIT: used when the library could not be opened.
* @GST_LIBRARY_ERROR_SHUTDOWN: used when the library could not be closed.
* @GST_LIBRARY_ERROR_SETTINGS: used when the library doesn't accept settings.
* @GST_LIBRARY_ERROR_ENCODE: used when the library generated an encoding error.
* @GST_LIBRARY_ERROR_NUM_ERRORS: the number of library error types.
*
* Library errors are for errors from the library being used by elements
* (initializing, finalizing, settings, ...)
*/
typedef enum
{
GST_LIBRARY_ERROR_FAILED = 1,
GST_LIBRARY_ERROR_TOO_LAZY,
GST_LIBRARY_ERROR_INIT,
GST_LIBRARY_ERROR_SHUTDOWN,
GST_LIBRARY_ERROR_SETTINGS,
GST_LIBRARY_ERROR_ENCODE,
GST_LIBRARY_ERROR_NUM_ERRORS
} GstLibraryError;
/**
* GstResourceError:
* @GST_RESOURCE_ERROR_FAILED: a general error which doesn't fit in any other
* category. Make sure you add a custom message to the error call.
* @GST_RESOURCE_ERROR_TOO_LAZY: do not use this except as a placeholder for
* deciding where to go while developing code.
* @GST_RESOURCE_ERROR_NOT_FOUND: used when the resource could not be found.
* @GST_RESOURCE_ERROR_BUSY: used when resource is busy.
* @GST_RESOURCE_ERROR_OPEN_READ: used when resource fails to open for reading.
* @GST_RESOURCE_ERROR_OPEN_WRITE: used when resource fails to open for writing.
* @GST_RESOURCE_ERROR_OPEN_READ_WRITE: used when resource cannot be opened for
* both reading and writing, or either (but unspecified which).
* @GST_RESOURCE_ERROR_CLOSE: used when the resource can't be closed.
* @GST_RESOURCE_ERROR_READ: used when the resource can't be read from.
* @GST_RESOURCE_ERROR_WRITE: used when the resource can't be written to.
* @GST_RESOURCE_ERROR_SEEK: used when a seek on the resource fails.
* @GST_RESOURCE_ERROR_SYNC: used when a synchronize on the resource fails.
* @GST_RESOURCE_ERROR_SETTINGS: used when settings can't be manipulated on.
* @GST_RESOURCE_ERROR_NO_SPACE_LEFT: used when the resource has no space left.
* @GST_RESOURCE_ERROR_NUM_ERRORS: the number of resource error types.
*
* Resource errors are for any resource used by an element:
* memory, files, network connections, process space, ...
* They're typically used by source and sink elements.
*/
typedef enum
{
GST_RESOURCE_ERROR_FAILED = 1,
GST_RESOURCE_ERROR_TOO_LAZY,
GST_RESOURCE_ERROR_NOT_FOUND,
GST_RESOURCE_ERROR_BUSY,
GST_RESOURCE_ERROR_OPEN_READ,
GST_RESOURCE_ERROR_OPEN_WRITE,
GST_RESOURCE_ERROR_OPEN_READ_WRITE,
GST_RESOURCE_ERROR_CLOSE,
GST_RESOURCE_ERROR_READ,
GST_RESOURCE_ERROR_WRITE,
GST_RESOURCE_ERROR_SEEK,
GST_RESOURCE_ERROR_SYNC,
GST_RESOURCE_ERROR_SETTINGS,
GST_RESOURCE_ERROR_NO_SPACE_LEFT,
GST_RESOURCE_ERROR_NUM_ERRORS
} GstResourceError;
/**
* GstStreamError:
* @GST_STREAM_ERROR_FAILED: a general error which doesn't fit in any other
* category. Make sure you add a custom message to the error call.
* @GST_STREAM_ERROR_TOO_LAZY: do not use this except as a placeholder for
* deciding where to go while developing code.
* @GST_STREAM_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
* this functionality yet.
* @GST_STREAM_ERROR_TYPE_NOT_FOUND: used when the element doesn't know the
* stream's type.
* @GST_STREAM_ERROR_WRONG_TYPE: used when the element doesn't handle this type
* of stream.
* @GST_STREAM_ERROR_CODEC_NOT_FOUND: used when there's no codec to handle the
* stream's type.
* @GST_STREAM_ERROR_DECODE: used when decoding fails.
* @GST_STREAM_ERROR_ENCODE: used when encoding fails.
* @GST_STREAM_ERROR_DEMUX: used when demuxing fails.
* @GST_STREAM_ERROR_MUX: used when muxing fails.
* @GST_STREAM_ERROR_FORMAT: used when the stream is of the wrong format
* (for example, wrong caps).
* @GST_STREAM_ERROR_DECRYPT: used when the stream is encrypted and can't be
* decrypted because this is not supported by the element.
* @GST_STREAM_ERROR_DECRYPT_NOKEY: used when the stream is encrypted and
* can't be decrypted because no suitable key is available.
* @GST_STREAM_ERROR_NUM_ERRORS: the number of stream error types.
*
* Stream errors are for anything related to the stream being processed:
* format errors, media type errors, ...
* They're typically used by decoders, demuxers, converters, ...
*/
typedef enum
{
GST_STREAM_ERROR_FAILED = 1,
GST_STREAM_ERROR_TOO_LAZY,
GST_STREAM_ERROR_NOT_IMPLEMENTED,
GST_STREAM_ERROR_TYPE_NOT_FOUND,
GST_STREAM_ERROR_WRONG_TYPE,
GST_STREAM_ERROR_CODEC_NOT_FOUND,
GST_STREAM_ERROR_DECODE,
GST_STREAM_ERROR_ENCODE,
GST_STREAM_ERROR_DEMUX,
GST_STREAM_ERROR_MUX,
GST_STREAM_ERROR_FORMAT,
GST_STREAM_ERROR_DECRYPT,
GST_STREAM_ERROR_DECRYPT_NOKEY,
GST_STREAM_ERROR_NUM_ERRORS
} GstStreamError;
/**
* GST_LIBRARY_ERROR:
*
* Error domain for library loading. Errors in this domain will
* be from the #GstLibraryError enumeration.
* See #GError for information on error domains.
*/
#define GST_LIBRARY_ERROR gst_library_error_quark ()
/**
* GST_RESOURCE_ERROR:
*
* Error domain for resource handling. Errors in this domain will
* be from the #GstResourceError enumeration.
* See #GError for information on error domains.
*/
#define GST_RESOURCE_ERROR gst_resource_error_quark ()
/**
* GST_CORE_ERROR:
*
* Error domain for core system. Errors in this domain will
* be from the #GstCoreError enumeration.
* See #GError for information on error domains.
*/
#define GST_CORE_ERROR gst_core_error_quark ()
/**
* GST_STREAM_ERROR:
*
* Error domain for media stream processing. Errors in this domain will
* be from the #GstStreamError enumeration.
* See #GError for information on error domains.
*/
#define GST_STREAM_ERROR gst_stream_error_quark ()
/**
* GST_ERROR_SYSTEM:
*
* Builds a string using errno describing the previously failed system
* call. To be used as the debug argument in #GST_ELEMENT_ERROR.
*/
#define GST_ERROR_SYSTEM ("system error: %s", g_strerror (errno))
gchar *gst_error_get_message (GQuark domain, gint code);
GQuark gst_stream_error_quark (void);
GQuark gst_core_error_quark (void);
GQuark gst_resource_error_quark (void);
GQuark gst_library_error_quark (void);
G_END_DECLS
#endif /* __GST_ERROR_H__ */
@@ -0,0 +1,550 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstevent.h: Header for GstEvent subsystem
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_EVENT_H__
#define __GST_EVENT_H__
typedef struct _GstEvent GstEvent;
/**
* GstEventTypeFlags:
* @GST_EVENT_TYPE_UPSTREAM: Set if the event can travel upstream.
* @GST_EVENT_TYPE_DOWNSTREAM: Set if the event can travel downstream.
* @GST_EVENT_TYPE_SERIALIZED: Set if the event should be serialized with data
* flow.
* @GST_EVENT_TYPE_STICKY: Set if the event is sticky on the pads.
* @GST_EVENT_TYPE_STICKY_MULTI: Multiple sticky events can be on a pad, each
* identified by the event name.
*
* #GstEventTypeFlags indicate the aspects of the different #GstEventType
* values. You can get the type flags of a #GstEventType with the
* gst_event_type_get_flags() function.
*/
typedef enum {
GST_EVENT_TYPE_UPSTREAM = 1 << 0,
GST_EVENT_TYPE_DOWNSTREAM = 1 << 1,
GST_EVENT_TYPE_SERIALIZED = 1 << 2,
GST_EVENT_TYPE_STICKY = 1 << 3,
GST_EVENT_TYPE_STICKY_MULTI = 1 << 4
} GstEventTypeFlags;
/**
* GST_EVENT_TYPE_BOTH:
*
* The same thing as #GST_EVENT_TYPE_UPSTREAM | #GST_EVENT_TYPE_DOWNSTREAM.
*/
#define GST_EVENT_TYPE_BOTH \
(GST_EVENT_TYPE_UPSTREAM | GST_EVENT_TYPE_DOWNSTREAM)
#define GST_EVENT_NUM_SHIFT (8)
/**
* GST_EVENT_MAKE_TYPE:
* @num: the event number to create
* @flags: the event flags
*
* when making custom event types, use this macro with the num and
* the given flags
*/
#define GST_EVENT_MAKE_TYPE(num,flags) \
(((num) << GST_EVENT_NUM_SHIFT) | (flags))
#define FLAG(name) GST_EVENT_TYPE_##name
/**
* GstEventType:
* @GST_EVENT_UNKNOWN: unknown event.
* @GST_EVENT_FLUSH_START: Start a flush operation. This event clears all data
* from the pipeline and unblock all streaming threads.
* @GST_EVENT_FLUSH_STOP: Stop a flush operation. This event resets the
* running-time of the pipeline.
* @GST_EVENT_STREAM_START: Event to mark the start of a new stream. Sent before any
* other serialized event and only sent at the start of a new stream,
* not after flushing seeks.
* @GST_EVENT_CAPS: #GstCaps event. Notify the pad of a new media type.
* @GST_EVENT_SEGMENT: A new media segment follows in the dataflow. The
* segment events contains information for clipping buffers and
* converting buffer timestamps to running-time and
* stream-time.
* @GST_EVENT_TAG: A new set of metadata tags has been found in the stream.
* @GST_EVENT_BUFFERSIZE: Notification of buffering requirements. Currently not
* used yet.
* @GST_EVENT_SINK_MESSAGE: An event that sinks turn into a message. Used to
* send messages that should be emitted in sync with
* rendering.
* @GST_EVENT_EOS: End-Of-Stream. No more data is to be expected to follow
* without a SEGMENT event.
* @GST_EVENT_SEGMENT_DONE: Marks the end of a segment playback.
* @GST_EVENT_GAP: Marks a gap in the datastream.
* @GST_EVENT_TOC: An event which indicates that a new table of contents (TOC)
* was found or updated.
* @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements
* that the downstream elements should adjust their processing
* rate.
* @GST_EVENT_SEEK: A request for a new playback position and rate.
* @GST_EVENT_NAVIGATION: Navigation events are usually used for communicating
* user requests, such as mouse or keyboard movements,
* to upstream elements.
* @GST_EVENT_LATENCY: Notification of new latency adjustment. Sinks will use
* the latency information to adjust their synchronisation.
* @GST_EVENT_STEP: A request for stepping through the media. Sinks will usually
* execute the step operation.
* @GST_EVENT_RECONFIGURE: A request for upstream renegotiating caps and reconfiguring.
* @GST_EVENT_TOC_SELECT: A request for a new playback position based on TOC
* entry's UID.
* @GST_EVENT_CUSTOM_UPSTREAM: Upstream custom event
* @GST_EVENT_CUSTOM_DOWNSTREAM: Downstream custom event that travels in the
* data flow.
* @GST_EVENT_CUSTOM_DOWNSTREAM_OOB: Custom out-of-band downstream event.
* @GST_EVENT_CUSTOM_DOWNSTREAM_STICKY: Custom sticky downstream event.
* @GST_EVENT_CUSTOM_BOTH: Custom upstream or downstream event.
* In-band when travelling downstream.
* @GST_EVENT_CUSTOM_BOTH_OOB: Custom upstream or downstream out-of-band event.
*
* #GstEventType lists the standard event types that can be sent in a pipeline.
*
* The custom event types can be used for private messages between elements
* that can't be expressed using normal
* GStreamer buffer passing semantics. Custom events carry an arbitrary
* #GstStructure.
* Specific custom events are distinguished by the name of the structure.
*/
/* NOTE: keep in sync with quark registration in gstevent.c */
typedef enum {
GST_EVENT_UNKNOWN = GST_EVENT_MAKE_TYPE (0, 0),
/* bidirectional events */
GST_EVENT_FLUSH_START = GST_EVENT_MAKE_TYPE (10, FLAG(BOTH)),
GST_EVENT_FLUSH_STOP = GST_EVENT_MAKE_TYPE (20, FLAG(BOTH) | FLAG(SERIALIZED)),
/* downstream serialized events */
GST_EVENT_STREAM_START = GST_EVENT_MAKE_TYPE (40, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
GST_EVENT_CAPS = GST_EVENT_MAKE_TYPE (50, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
GST_EVENT_SEGMENT = GST_EVENT_MAKE_TYPE (70, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
GST_EVENT_TAG = GST_EVENT_MAKE_TYPE (80, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
GST_EVENT_BUFFERSIZE = GST_EVENT_MAKE_TYPE (90, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
GST_EVENT_SINK_MESSAGE = GST_EVENT_MAKE_TYPE (100, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
GST_EVENT_EOS = GST_EVENT_MAKE_TYPE (110, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
GST_EVENT_TOC = GST_EVENT_MAKE_TYPE (120, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
/* non-sticky downstream serialized */
GST_EVENT_SEGMENT_DONE = GST_EVENT_MAKE_TYPE (150, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
GST_EVENT_GAP = GST_EVENT_MAKE_TYPE (160, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
/* upstream events */
GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (190, FLAG(UPSTREAM)),
GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (200, FLAG(UPSTREAM)),
GST_EVENT_NAVIGATION = GST_EVENT_MAKE_TYPE (210, FLAG(UPSTREAM)),
GST_EVENT_LATENCY = GST_EVENT_MAKE_TYPE (220, FLAG(UPSTREAM)),
GST_EVENT_STEP = GST_EVENT_MAKE_TYPE (230, FLAG(UPSTREAM)),
GST_EVENT_RECONFIGURE = GST_EVENT_MAKE_TYPE (240, FLAG(UPSTREAM)),
GST_EVENT_TOC_SELECT = GST_EVENT_MAKE_TYPE (250, FLAG(UPSTREAM)),
/* custom events start here */
GST_EVENT_CUSTOM_UPSTREAM = GST_EVENT_MAKE_TYPE (270, FLAG(UPSTREAM)),
GST_EVENT_CUSTOM_DOWNSTREAM = GST_EVENT_MAKE_TYPE (280, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
GST_EVENT_CUSTOM_DOWNSTREAM_OOB = GST_EVENT_MAKE_TYPE (290, FLAG(DOWNSTREAM)),
GST_EVENT_CUSTOM_DOWNSTREAM_STICKY = GST_EVENT_MAKE_TYPE (300, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
GST_EVENT_CUSTOM_BOTH = GST_EVENT_MAKE_TYPE (310, FLAG(BOTH) | FLAG(SERIALIZED)),
GST_EVENT_CUSTOM_BOTH_OOB = GST_EVENT_MAKE_TYPE (320, FLAG(BOTH))
} GstEventType;
#undef FLAG
#include <gst/gstminiobject.h>
#include <gst/gstformat.h>
#include <gst/gstobject.h>
#include <gst/gstclock.h>
#include <gst/gststructure.h>
#include <gst/gsttaglist.h>
#include <gst/gstsegment.h>
#include <gst/gstsegment.h>
#include <gst/gstmessage.h>
G_BEGIN_DECLS
GST_EXPORT GType _gst_event_type;
#define GST_TYPE_EVENT (_gst_event_type)
#define GST_IS_EVENT(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_EVENT))
#define GST_EVENT_CAST(obj) ((GstEvent *)(obj))
#define GST_EVENT(obj) (GST_EVENT_CAST(obj))
/**
* GST_EVENT_TYPE:
* @event: the event to query
*
* Get the #GstEventType of the event.
*/
#define GST_EVENT_TYPE(event) (GST_EVENT_CAST(event)->type)
/**
* GST_EVENT_TYPE_NAME:
* @event: the event to query
*
* Get a constant string representation of the #GstEventType of the event.
*/
#define GST_EVENT_TYPE_NAME(event) (gst_event_type_get_name(GST_EVENT_TYPE(event)))
/**
* GST_EVENT_TIMESTAMP:
* @event: the event to query
*
* Get the #GstClockTime timestamp of the event. This is the time when the event
* was created.
*/
#define GST_EVENT_TIMESTAMP(event) (GST_EVENT_CAST(event)->timestamp)
/**
* GST_EVENT_SEQNUM:
* @event: the event to query
*
* The sequence number of @event.
*/
#define GST_EVENT_SEQNUM(event) (GST_EVENT_CAST(event)->seqnum)
/**
* GST_EVENT_IS_UPSTREAM:
* @ev: the event to query
*
* Check if an event can travel upstream.
*/
#define GST_EVENT_IS_UPSTREAM(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_UPSTREAM)
/**
* GST_EVENT_IS_DOWNSTREAM:
* @ev: the event to query
*
* Check if an event can travel downstream.
*/
#define GST_EVENT_IS_DOWNSTREAM(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_DOWNSTREAM)
/**
* GST_EVENT_IS_SERIALIZED:
* @ev: the event to query
*
* Check if an event is serialized with the data stream.
*/
#define GST_EVENT_IS_SERIALIZED(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_SERIALIZED)
/**
* GST_EVENT_IS_STICKY:
* @ev: the event to query
*
* Check if an event is sticky on the pads.
*/
#define GST_EVENT_IS_STICKY(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_STICKY)
/**
* gst_event_is_writable:
* @ev: a #GstEvent
*
* Tests if you can safely write data into a event's structure or validly
* modify the seqnum and timestamp field.
*/
#define gst_event_is_writable(ev) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (ev))
/**
* gst_event_make_writable:
* @ev: (transfer full): a #GstEvent
*
* Makes a writable event from the given event. If the source event is
* already writable, this will simply return the same event. A copy will
* otherwise be made using gst_event_copy().
*
* Returns: (transfer full): a writable event which may or may not be the
* same as @ev
*/
#define gst_event_make_writable(ev) GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (ev)))
/**
* gst_event_replace:
* @old_event: (inout) (transfer full): pointer to a pointer to a #GstEvent
* to be replaced.
* @new_event: (allow-none) (transfer none): pointer to a #GstEvent that will
* replace the event pointed to by @old_event.
*
* Modifies a pointer to a #GstEvent to point to a different #GstEvent. The
* modification is done atomically (so this is useful for ensuring thread safety
* in some cases), and the reference counts are updated appropriately (the old
* event is unreffed, the new one is reffed).
*
* Either @new_event or the #GstEvent pointed to by @old_event may be NULL.
*
* Returns: TRUE if @new_event was different from @old_event
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC gboolean gst_event_replace (GstEvent **old_event, GstEvent *new_event);
#endif
static inline gboolean
gst_event_replace (GstEvent **old_event, GstEvent *new_event)
{
return gst_mini_object_replace ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
}
/**
* gst_event_steal:
* @old_event: (inout) (transfer full): pointer to a pointer to a #GstEvent
* to be stolen.
*
* Atomically replace the #GstEvent pointed to by @old_event with NULL and
* return the original event.
*
* Returns: the #GstEvent that was in @old_event
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstEvent * gst_event_steal (GstEvent **old_event);
#endif
static inline GstEvent *
gst_event_steal (GstEvent **old_event)
{
return GST_EVENT_CAST (gst_mini_object_steal ((GstMiniObject **) old_event));
}
/**
* gst_event_take:
* @old_event: (inout) (transfer full): pointer to a pointer to a #GstEvent
* to be stolen.
* @new_event: (allow-none) (transfer full): pointer to a #GstEvent that will
* replace the event pointed to by @old_event.
*
* Modifies a pointer to a #GstEvent to point to a different #GstEvent. This
* function is similar to gst_event_replace() except that it takes ownership of
* @new_event.
*
* Either @new_event or the #GstEvent pointed to by @old_event may be NULL.
*
* Returns: TRUE if @new_event was different from @old_event
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC gboolean gst_event_take (GstEvent **old_event, GstEvent *new_event);
#endif
static inline gboolean
gst_event_take (GstEvent **old_event, GstEvent *new_event)
{
return gst_mini_object_take ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
}
/**
* GstQOSType:
* @GST_QOS_TYPE_OVERFLOW: The QoS event type that is produced when downstream
* elements are producing data too quickly and the element can't keep up
* processing the data. Upstream should reduce their processing rate. This
* type is also used when buffers arrive early or in time.
* @GST_QOS_TYPE_UNDERFLOW: The QoS event type that is produced when downstream
* elements are producing data too slowly and need to speed up their processing
* rate.
* @GST_QOS_TYPE_THROTTLE: The QoS event type that is produced when the
* application enabled throttling to limit the datarate.
*
* The different types of QoS events that can be given to the
* gst_event_new_qos() method.
*/
typedef enum {
GST_QOS_TYPE_OVERFLOW = 0,
GST_QOS_TYPE_UNDERFLOW = 1,
GST_QOS_TYPE_THROTTLE = 2
} GstQOSType;
/**
* GstEvent:
* @mini_object: the parent structure
* @type: the #GstEventType of the event
* @timestamp: the timestamp of the event
* @seqnum: the sequence number of the event
*
* A #GstEvent.
*/
struct _GstEvent {
GstMiniObject mini_object;
/*< public >*/ /* with COW */
GstEventType type;
guint64 timestamp;
guint32 seqnum;
};
const gchar* gst_event_type_get_name (GstEventType type);
GQuark gst_event_type_to_quark (GstEventType type);
GstEventTypeFlags
gst_event_type_get_flags (GstEventType type);
/* refcounting */
/**
* gst_event_ref:
* @event: The event to refcount
*
* Increase the refcount of this event.
*
* Returns: (transfer full): @event (for convenience when doing assignments)
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstEvent * gst_event_ref (GstEvent * event);
#endif
static inline GstEvent *
gst_event_ref (GstEvent * event)
{
return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (event));
}
/**
* gst_event_unref:
* @event: (transfer full): the event to refcount
*
* Decrease the refcount of an event, freeing it if the refcount reaches 0.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void gst_event_unref (GstEvent * event);
#endif
static inline void
gst_event_unref (GstEvent * event)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (event));
}
/* copy event */
/**
* gst_event_copy:
* @event: The event to copy
*
* Copy the event using the event specific copy function.
*
* Returns: (transfer full): the new event
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstEvent * gst_event_copy (const GstEvent * event);
#endif
static inline GstEvent *
gst_event_copy (const GstEvent * event)
{
return GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (event)));
}
GType gst_event_get_type (void);
/* custom event */
GstEvent* gst_event_new_custom (GstEventType type, GstStructure *structure) G_GNUC_MALLOC;
const GstStructure *
gst_event_get_structure (GstEvent *event);
GstStructure * gst_event_writable_structure (GstEvent *event);
gboolean gst_event_has_name (GstEvent *event, const gchar *name);
/* identifiers for events and messages */
guint32 gst_event_get_seqnum (GstEvent *event);
void gst_event_set_seqnum (GstEvent *event, guint32 seqnum);
/* Stream start event */
GstEvent * gst_event_new_stream_start (const gchar *stream_id) G_GNUC_MALLOC;
void gst_event_parse_stream_start (GstEvent *event, const gchar **stream_id);
/* flush events */
GstEvent * gst_event_new_flush_start (void) G_GNUC_MALLOC;
GstEvent * gst_event_new_flush_stop (gboolean reset_time) G_GNUC_MALLOC;
void gst_event_parse_flush_stop (GstEvent *event, gboolean *reset_time);
/* EOS event */
GstEvent * gst_event_new_eos (void) G_GNUC_MALLOC;
/* GAP event */
GstEvent * gst_event_new_gap (GstClockTime timestamp,
GstClockTime duration) G_GNUC_MALLOC;
void gst_event_parse_gap (GstEvent * event,
GstClockTime * timestamp,
GstClockTime * duration);
/* Caps events */
GstEvent * gst_event_new_caps (GstCaps *caps) G_GNUC_MALLOC;
void gst_event_parse_caps (GstEvent *event, GstCaps **caps);
/* segment event */
GstEvent* gst_event_new_segment (const GstSegment *segment) G_GNUC_MALLOC;
void gst_event_parse_segment (GstEvent *event, const GstSegment **segment);
void gst_event_copy_segment (GstEvent *event, GstSegment *segment);
/* tag event */
GstEvent* gst_event_new_tag (GstTagList *taglist) G_GNUC_MALLOC;
void gst_event_parse_tag (GstEvent *event, GstTagList **taglist);
/* TOC event */
GstEvent* gst_event_new_toc (GstToc *toc, gboolean updated);
void gst_event_parse_toc (GstEvent *event, GstToc **toc, gboolean *updated);
/* buffer */
GstEvent * gst_event_new_buffer_size (GstFormat format, gint64 minsize, gint64 maxsize,
gboolean async) G_GNUC_MALLOC;
void gst_event_parse_buffer_size (GstEvent *event, GstFormat *format, gint64 *minsize,
gint64 *maxsize, gboolean *async);
/* sink message */
GstEvent* gst_event_new_sink_message (const gchar *name, GstMessage *msg) G_GNUC_MALLOC;
void gst_event_parse_sink_message (GstEvent *event, GstMessage **msg);
/* QOS events */
GstEvent* gst_event_new_qos (GstQOSType type, gdouble proportion,
GstClockTimeDiff diff, GstClockTime timestamp) G_GNUC_MALLOC;
void gst_event_parse_qos (GstEvent *event, GstQOSType *type,
gdouble *proportion, GstClockTimeDiff *diff,
GstClockTime *timestamp);
/* seek event */
GstEvent* gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags,
GstSeekType start_type, gint64 start,
GstSeekType stop_type, gint64 stop) G_GNUC_MALLOC;
void gst_event_parse_seek (GstEvent *event, gdouble *rate, GstFormat *format,
GstSeekFlags *flags,
GstSeekType *start_type, gint64 *start,
GstSeekType *stop_type, gint64 *stop);
/* navigation event */
GstEvent* gst_event_new_navigation (GstStructure *structure) G_GNUC_MALLOC;
/* latency event */
GstEvent* gst_event_new_latency (GstClockTime latency) G_GNUC_MALLOC;
void gst_event_parse_latency (GstEvent *event, GstClockTime *latency);
/* step event */
GstEvent* gst_event_new_step (GstFormat format, guint64 amount, gdouble rate,
gboolean flush, gboolean intermediate) G_GNUC_MALLOC;
void gst_event_parse_step (GstEvent *event, GstFormat *format, guint64 *amount,
gdouble *rate, gboolean *flush, gboolean *intermediate);
/* renegotiate event */
GstEvent* gst_event_new_reconfigure (void) G_GNUC_MALLOC;
/* TOC select event */
GstEvent* gst_event_new_toc_select (const gchar *uid) G_GNUC_MALLOC;
void gst_event_parse_toc_select (GstEvent *event, gchar **uid);
/* segment-done event */
GstEvent* gst_event_new_segment_done (GstFormat format, gint64 position) G_GNUC_MALLOC;
void gst_event_parse_segment_done (GstEvent *event, GstFormat *format, gint64 *position);
G_END_DECLS
#endif /* __GST_EVENT_H__ */
@@ -0,0 +1,113 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
*
* gstformat.h: Header for GstFormat types used in queries and
* seeking.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_FORMAT_H__
#define __GST_FORMAT_H__
#include <glib.h>
#include <gst/gstiterator.h>
G_BEGIN_DECLS
/**
* GstFormat:
* @GST_FORMAT_UNDEFINED: undefined format
* @GST_FORMAT_DEFAULT: the default format of the pad/element. This can be
* samples for raw audio, frames/fields for raw video (some, but not all,
* elements support this; use @GST_FORMAT_TIME if you don't have a good
* reason to query for samples/frames)
* @GST_FORMAT_BYTES: bytes
* @GST_FORMAT_TIME: time in nanoseconds
* @GST_FORMAT_BUFFERS: buffers (few, if any, elements implement this as of
* May 2009)
* @GST_FORMAT_PERCENT: percentage of stream (few, if any, elements implement
* this as of May 2009)
*
* Standard predefined formats
*/
/* NOTE: don't forget to update the table in gstformat.c when changing
* this enum */
typedef enum {
GST_FORMAT_UNDEFINED = 0, /* must be first in list */
GST_FORMAT_DEFAULT = 1,
GST_FORMAT_BYTES = 2,
GST_FORMAT_TIME = 3,
GST_FORMAT_BUFFERS = 4,
GST_FORMAT_PERCENT = 5
} GstFormat;
/* a percentage is always relative to 1000000 */
/**
* GST_FORMAT_PERCENT_MAX:
*
* The PERCENT format is between 0 and this value
*/
#define GST_FORMAT_PERCENT_MAX G_GINT64_CONSTANT (1000000)
/**
* GST_FORMAT_PERCENT_SCALE:
*
* The value used to scale down the reported PERCENT format value to
* its real value.
*/
#define GST_FORMAT_PERCENT_SCALE G_GINT64_CONSTANT (10000)
typedef struct _GstFormatDefinition GstFormatDefinition;
/**
* GstFormatDefinition:
* @value: The unique id of this format
* @nick: A short nick of the format
* @description: A longer description of the format
* @quark: A quark for the nick
*
* A format definition
*/
struct _GstFormatDefinition
{
GstFormat value;
const gchar *nick;
const gchar *description;
GQuark quark;
};
const gchar* gst_format_get_name (GstFormat format);
GQuark gst_format_to_quark (GstFormat format);
/* register a new format */
GstFormat gst_format_register (const gchar *nick,
const gchar *description);
GstFormat gst_format_get_by_nick (const gchar *nick);
/* check if a format is in an array of formats */
gboolean gst_formats_contains (const GstFormat *formats, GstFormat format);
/* query for format details */
const GstFormatDefinition*
gst_format_get_details (GstFormat format);
GstIterator* gst_format_iterate_definitions (void);
G_END_DECLS
#endif /* __GST_FORMAT_H__ */
@@ -0,0 +1,128 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
* 2005 Andy Wingo <wingo@pobox.com>
*
* gstghostpad.h: Proxy pads
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_GHOST_PAD_H__
#define __GST_GHOST_PAD_H__
#include <gst/gstpad.h>
G_BEGIN_DECLS
#define GST_TYPE_PROXY_PAD (gst_proxy_pad_get_type ())
#define GST_IS_PROXY_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROXY_PAD))
#define GST_IS_PROXY_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PROXY_PAD))
#define GST_PROXY_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PROXY_PAD, GstProxyPad))
#define GST_PROXY_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PROXY_PAD, GstProxyPadClass))
typedef struct _GstProxyPad GstProxyPad;
typedef struct _GstProxyPadPrivate GstProxyPadPrivate;
typedef struct _GstProxyPadClass GstProxyPadClass;
struct _GstProxyPad
{
GstPad pad;
/*< private >*/
GstProxyPadPrivate *priv;
};
struct _GstProxyPadClass
{
GstPadClass parent_class;
/*< private >*/
gpointer _gst_reserved[1];
};
GType gst_proxy_pad_get_type (void);
GstProxyPad* gst_proxy_pad_get_internal (GstProxyPad *pad);
GstIterator* gst_proxy_pad_iterate_internal_links_default (GstPad *pad, GstObject *parent) G_GNUC_MALLOC;
GstFlowReturn gst_proxy_pad_chain_default (GstPad *pad, GstObject *parent,
GstBuffer *buffer);
GstFlowReturn gst_proxy_pad_chain_list_default (GstPad *pad, GstObject *parent,
GstBufferList *list);
GstFlowReturn gst_proxy_pad_getrange_default (GstPad *pad, GstObject *parent,
guint64 offset, guint size,
GstBuffer **buffer);
#define GST_TYPE_GHOST_PAD (gst_ghost_pad_get_type ())
#define GST_IS_GHOST_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GHOST_PAD))
#define GST_IS_GHOST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GHOST_PAD))
#define GST_GHOST_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GHOST_PAD, GstGhostPad))
#define GST_GHOST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GHOST_PAD, GstGhostPadClass))
#define GST_GHOST_PAD_CAST(obj) ((GstGhostPad*)(obj))
/**
* GstGhostPad:
*
* Opaque #GstGhostPad structure.
*/
typedef struct _GstGhostPad GstGhostPad;
typedef struct _GstGhostPadPrivate GstGhostPadPrivate;
typedef struct _GstGhostPadClass GstGhostPadClass;
struct _GstGhostPad
{
GstProxyPad pad;
/*< private >*/
GstGhostPadPrivate *priv;
};
struct _GstGhostPadClass
{
GstProxyPadClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_ghost_pad_get_type (void);
GstPad* gst_ghost_pad_new (const gchar *name, GstPad *target) G_GNUC_MALLOC;
GstPad* gst_ghost_pad_new_no_target (const gchar *name, GstPadDirection dir) G_GNUC_MALLOC;
GstPad* gst_ghost_pad_new_from_template (const gchar *name, GstPad * target, GstPadTemplate * templ) G_GNUC_MALLOC;
GstPad* gst_ghost_pad_new_no_target_from_template (const gchar *name, GstPadTemplate * templ) G_GNUC_MALLOC;
GstPad* gst_ghost_pad_get_target (GstGhostPad *gpad);
gboolean gst_ghost_pad_set_target (GstGhostPad *gpad, GstPad *newtarget);
gboolean gst_ghost_pad_construct (GstGhostPad *gpad);
gboolean gst_ghost_pad_activate_mode_default (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
gboolean gst_ghost_pad_internal_activate_mode_default (GstPad * pad, GstObject * parent,
GstPadMode mode, gboolean active);
G_END_DECLS
#endif /* __GST_GHOST_PAD_H__ */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,273 @@
/* GStreamer
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
* Copyright (C) 2011 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* gstiterator.h: Header for GstIterator
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_ITERATOR_H__
#define __GST_ITERATOR_H__
#include <glib-object.h> /* for GValue in the fold */
#include <gst/gstconfig.h>
G_BEGIN_DECLS
#define GST_TYPE_ITERATOR (gst_iterator_get_type ())
/**
* GstIteratorResult:
* @GST_ITERATOR_DONE: No more items in the iterator
* @GST_ITERATOR_OK: An item was retrieved
* @GST_ITERATOR_RESYNC: Datastructure changed while iterating
* @GST_ITERATOR_ERROR: An error happened
*
* The result of gst_iterator_next().
*/
typedef enum {
GST_ITERATOR_DONE = 0,
GST_ITERATOR_OK = 1,
GST_ITERATOR_RESYNC = 2,
GST_ITERATOR_ERROR = 3
} GstIteratorResult;
typedef struct _GstIterator GstIterator;
/**
* GstIteratorItem:
* @GST_ITERATOR_ITEM_SKIP: Skip this item
* @GST_ITERATOR_ITEM_PASS: Return item
* @GST_ITERATOR_ITEM_END: Stop after this item.
*
* The result of a #GstIteratorItemFunction.
*/
typedef enum {
GST_ITERATOR_ITEM_SKIP = 0,
GST_ITERATOR_ITEM_PASS = 1,
GST_ITERATOR_ITEM_END = 2
} GstIteratorItem;
/**
* GstIteratorCopyFunction:
* @it: The original iterator
* @copy: The copied iterator
*
* This function will be called when creating a copy of @it and should
* create a copy of all custom iterator fields or increase their
* reference counts.
*/
typedef void (*GstIteratorCopyFunction) (const GstIterator *it, GstIterator *copy);
/**
* GstIteratorItemFunction:
* @it: the iterator
* @item: the item being retrieved.
*
* The function that will be called after the next item of the iterator
* has been retrieved. This function can be used to skip items or stop
* the iterator.
*
* The function will be called with the iterator lock held.
*
* Returns: the result of the operation.
*/
typedef GstIteratorItem (*GstIteratorItemFunction) (GstIterator *it, const GValue * item);
/**
* GstIteratorNextFunction:
* @it: the iterator
* @result: a pointer to hold the next item
*
* The function that will be called when the next element of the iterator
* should be retrieved.
*
* Implementors of a #GstIterator should implement this
* function and pass it to the constructor of the custom iterator.
* The function will be called with the iterator lock held.
*
* Returns: the result of the operation.
*/
typedef GstIteratorResult (*GstIteratorNextFunction) (GstIterator *it, GValue *result);
/**
* GstIteratorResyncFunction:
* @it: the iterator
*
* This function will be called whenever a concurrent update happened
* to the iterated datastructure. The implementor of the iterator should
* restart the iterator from the beginning and clean up any state it might
* have.
*
* Implementors of a #GstIterator should implement this
* function and pass it to the constructor of the custom iterator.
* The function will be called with the iterator lock held.
*/
typedef void (*GstIteratorResyncFunction) (GstIterator *it);
/**
* GstIteratorFreeFunction:
* @it: the iterator
*
* This function will be called when the iterator is freed.
*
* Implementors of a #GstIterator should implement this
* function and pass it to the constructor of the custom iterator.
* The function will be called with the iterator lock held.
*/
typedef void (*GstIteratorFreeFunction) (GstIterator *it);
/**
* GstIteratorForeachFunction:
* @item: The item
* @user_data: User data
*
* A function that is called by gst_iterator_foreach() for every element.
*/
typedef void (*GstIteratorForeachFunction) (const GValue * item, gpointer user_data);
/**
* GstIteratorFoldFunction:
* @item: the item to fold
* @ret: a #GValue collecting the result
* @user_data: data passed to gst_iterator_fold()
*
* A function to be passed to gst_iterator_fold().
*
* Returns: TRUE if the fold should continue, FALSE if it should stop.
*/
typedef gboolean (*GstIteratorFoldFunction) (const GValue * item, GValue * ret, gpointer user_data);
/**
* GST_ITERATOR:
* @it: the #GstIterator value
*
* Macro to cast to a #GstIterator
*/
#define GST_ITERATOR(it) ((GstIterator*)(it))
/**
* GST_ITERATOR_LOCK:
* @it: the #GstIterator to get the lock of
*
* Macro to get the lock protecting the datastructure being iterated.
*/
#define GST_ITERATOR_LOCK(it) (GST_ITERATOR(it)->lock)
/**
* GST_ITERATOR_COOKIE:
* @it: the #GstIterator to get the cookie of
*
* Macro to get the cookie of a #GstIterator. The cookie of the
* iterator is the value of the master cookie when the iterator
* was created.
* Whenever the iterator is iterated, the value is compared to the
* value of the master cookie. If they are different, a concurrent
* modification happened to the iterator and a resync is needed.
*/
#define GST_ITERATOR_COOKIE(it) (GST_ITERATOR(it)->cookie)
/**
* GST_ITERATOR_ORIG_COOKIE:
* @it: the #GstIterator to get the master cookie of
*
* Macro to get a pointer to where the master cookie is stored. The
* master cookie protects the structure being iterated and gets updated
* whenever the datastructure changes.
*/
#define GST_ITERATOR_ORIG_COOKIE(it) (GST_ITERATOR(it)->master_cookie)
/**
* GstIterator:
* @copy: The function to copy the iterator
* @next: The function to get the next item in the iterator
* @item: The function to be called for each item retrieved
* @resync: The function to call when a resync is needed.
* @free: The function to call when the iterator is freed
* @pushed: The iterator that is currently pushed with gst_iterator_push()
* @type: The type of the object that this iterator will return
* @lock: The lock protecting the data structure and the cookie.
* @cookie: The cookie; the value of the master_cookie when this iterator was
* created.
* @master_cookie: A pointer to the master cookie.
* @size: the size of the iterator
*
* #GstIterator base structure. The values of this structure are
* protected for subclasses, use the methods to use the #GstIterator.
*/
struct _GstIterator {
/*< protected >*/
GstIteratorCopyFunction copy;
GstIteratorNextFunction next;
GstIteratorItemFunction item;
GstIteratorResyncFunction resync;
GstIteratorFreeFunction free;
GstIterator *pushed; /* pushed iterator */
GType type;
GMutex *lock;
guint32 cookie; /* cookie of the iterator */
guint32 *master_cookie; /* pointer to guint32 holding the cookie when this
iterator was created */
guint size;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_iterator_get_type (void);
/* creating iterators */
GstIterator* gst_iterator_new (guint size,
GType type,
GMutex *lock,
guint32 *master_cookie,
GstIteratorCopyFunction copy,
GstIteratorNextFunction next,
GstIteratorItemFunction item,
GstIteratorResyncFunction resync,
GstIteratorFreeFunction free) G_GNUC_MALLOC;
GstIterator* gst_iterator_new_list (GType type,
GMutex *lock,
guint32 *master_cookie,
GList **list,
GObject * owner,
GstIteratorItemFunction item) G_GNUC_MALLOC;
GstIterator* gst_iterator_new_single (GType type,
const GValue * object) G_GNUC_MALLOC;
GstIterator* gst_iterator_copy (const GstIterator *it) G_GNUC_MALLOC;
/* using iterators */
GstIteratorResult gst_iterator_next (GstIterator *it, GValue * elem);
void gst_iterator_resync (GstIterator *it);
void gst_iterator_free (GstIterator *it);
void gst_iterator_push (GstIterator *it, GstIterator *other);
/* higher-order functions that operate on iterators */
GstIterator* gst_iterator_filter (GstIterator *it, GCompareFunc func,
const GValue * user_data) G_GNUC_MALLOC;
GstIteratorResult gst_iterator_fold (GstIterator *it,
GstIteratorFoldFunction func,
GValue *ret, gpointer user_data);
GstIteratorResult gst_iterator_foreach (GstIterator *it,
GstIteratorForeachFunction func, gpointer user_data);
gboolean gst_iterator_find_custom (GstIterator *it, GCompareFunc func,
GValue *elem, gpointer user_data);
G_END_DECLS
#endif /* __GST_ITERATOR_H__ */
@@ -0,0 +1,54 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MACROS_H__
#define __GST_MACROS_H__
G_BEGIN_DECLS
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
# define GST_GNUC_CONSTRUCTOR \
__attribute__ ((constructor))
#else /* !__GNUC__ */
# define GST_GNUC_CONSTRUCTOR
#endif /* !__GNUC__ */
#if defined (__GNUC__) && !defined (GST_IMPLEMENT_INLINES)
# define GST_INLINE_FUNC extern __inline__
# define GST_CAN_INLINE 1
#elif defined(_MSC_VER)
# define GST_INLINE_FUNC extern __inline
# define GST_CAN_INLINE 1
#else
# define GST_INLINE_FUNC extern
# undef GST_CAN_INLINE
#endif
#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) && !defined(restrict)
# if defined(__GNUC__) && __GNUC__ >= 4
# define restrict __restrict__
# else
# define restrict
# endif
#endif
G_END_DECLS
#endif /* __GST_MACROS_H__ */
@@ -0,0 +1,325 @@
/* GStreamer
* Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.be>
*
* gstmemory.h: Header for memory blocks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MEMORY_H__
#define __GST_MEMORY_H__
#include <gst/gstconfig.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define GST_TYPE_MEMORY (gst_memory_get_type())
GType gst_memory_get_type(void);
typedef struct _GstMemory GstMemory;
typedef struct _GstAllocator GstAllocator;
#define GST_MEMORY_CAST(mem) ((GstMemory *)(mem))
/**
* GstMemoryFlags:
* @GST_MEMORY_FLAG_READONLY: memory is readonly. It is not allowed to map the
* memory with #GST_MAP_WRITE.
* @GST_MEMORY_FLAG_NO_SHARE: memory must not be shared. Copies will have to be
* made when this memory needs to be shared between buffers.
* @GST_MEMORY_FLAG_ZERO_PREFIXED: the memory prefix is filled with 0 bytes
* @GST_MEMORY_FLAG_ZERO_PADDED: the memory padding is filled with 0 bytes
* @GST_MEMORY_FLAG_LAST: first flag that can be used for custom purposes
*
* Flags for wrapped memory.
*/
typedef enum {
GST_MEMORY_FLAG_READONLY = GST_MINI_OBJECT_FLAG_LOCK_READONLY,
GST_MEMORY_FLAG_NO_SHARE = (GST_MINI_OBJECT_FLAG_LAST << 0),
GST_MEMORY_FLAG_ZERO_PREFIXED = (GST_MINI_OBJECT_FLAG_LAST << 1),
GST_MEMORY_FLAG_ZERO_PADDED = (GST_MINI_OBJECT_FLAG_LAST << 2),
GST_MEMORY_FLAG_LAST = (GST_MINI_OBJECT_FLAG_LAST << 16)
} GstMemoryFlags;
/**
* GST_MEMORY_FLAGS:
* @mem: a #GstMemory.
*
* A flags word containing #GstMemoryFlags flags set on @mem
*/
#define GST_MEMORY_FLAGS(mem) GST_MINI_OBJECT_FLAGS (mem)
/**
* GST_MEMORY_FLAG_IS_SET:
* @mem: a #GstMemory.
* @flag: the #GstMemoryFlags to check.
*
* Gives the status of a specific flag on a @mem.
*/
#define GST_MEMORY_FLAG_IS_SET(mem,flag) GST_MINI_OBJECT_FLAG_IS_SET (mem,flag)
/**
* GST_MEMORY_FLAG_UNSET:
* @mem: a #GstMemory.
* @flag: the #GstMemoryFlags to clear.
*
* Clear a specific flag on a @mem.
*/
#define GST_MEMORY_FLAG_UNSET(mem,flag) GST_MINI_OBJECT_FLAG_UNSET (mem, flag)
/**
* GST_MEMORY_IS_READONLY:
* @mem: a #GstMemory.
*
* Check if @mem is readonly.
*/
#define GST_MEMORY_IS_READONLY(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_READONLY)
/**
* GST_MEMORY_IS_NO_SHARE:
* @mem: a #GstMemory.
*
* Check if @mem cannot be shared between buffers
*/
#define GST_MEMORY_IS_NO_SHARE(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_NO_SHARE)
/**
* GST_MEMORY_IS_ZERO_PREFIXED:
* @mem: a #GstMemory.
*
* Check if the prefix in @mem is 0 filled.
*/
#define GST_MEMORY_IS_ZERO_PREFIXED(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_ZERO_PREFIXED)
/**
* GST_MEMORY_IS_ZERO_PADDED:
* @mem: a #GstMemory.
*
* Check if the padding in @mem is 0 filled.
*/
#define GST_MEMORY_IS_ZERO_PADDED(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_ZERO_PADDED)
/**
* GstMemory:
* @mini_object: parent structure
* @allocator: pointer to the #GstAllocator
* @parent: parent memory block
* @maxsize: the maximum size allocated
* @align: the alignment of the memory
* @offset: the offset where valid data starts
* @size: the size of valid data
*
* Base structure for memory implementations. Custom memory will put this structure
* as the first member of their structure.
*/
struct _GstMemory {
GstMiniObject mini_object;
GstAllocator *allocator;
GstMemory *parent;
gsize maxsize;
gsize align;
gsize offset;
gsize size;
};
/**
* GstMapFlags:
* @GST_MAP_READ: map for read access
* @GST_MAP_WRITE: map for write access
* @GST_MAP_FLAG_LAST: first flag that can be used for custom purposes
*
* Flags used when mapping memory
*/
typedef enum {
GST_MAP_READ = GST_LOCK_FLAG_READ,
GST_MAP_WRITE = GST_LOCK_FLAG_WRITE,
GST_MAP_FLAG_LAST = (1 << 16)
} GstMapFlags;
/**
* GST_MAP_READWRITE:
*
* GstMapFlags value alias for GST_MAP_READ | GST_MAP_WRITE
*/
#define GST_MAP_READWRITE (GST_MAP_READ | GST_MAP_WRITE)
/**
* GstMapInfo:
* @memory: a pointer to the mapped memory
* @flags: flags used when mapping the memory
* @data: (array length=size): a pointer to the mapped data
* @size: the valid size in @data
* @maxsize: the maximum bytes in @data
* @user_data: extra private user_data that the implementation of the memory
* can use to store extra info.
*
* A structure containing the result of a map operation such as
* gst_memory_map(). It contains the data and size.
*/
typedef struct {
GstMemory *memory;
GstMapFlags flags;
guint8 *data;
gsize size;
gsize maxsize;
/*< protected >*/
gpointer user_data[4];
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
} GstMapInfo;
/**
* GST_MAP_INFO_INIT:
*
* Initializer for #GstMapInfo
*/
#define GST_MAP_INFO_INIT { NULL, 0, NULL, 0, 0, }
/**
* GstMemoryMapFunction:
* @mem: a #GstMemory
* @maxsize: size to map
* @flags: access mode for the memory
*
* Get the memory of @mem that can be accessed according to the mode specified
* in @flags. The function should return a pointer that contains at least
* @maxsize bytes.
*
* Returns: a pointer to memory of which at least @maxsize bytes can be
* accessed according to the access pattern in @flags.
*/
typedef gpointer (*GstMemoryMapFunction) (GstMemory *mem, gsize maxsize, GstMapFlags flags);
/**
* GstMemoryUnmapFunction:
* @mem: a #GstMemory
*
* Return the pointer previously retrieved with gst_memory_map().
*
* Returns: %TRUE on success.
*/
typedef void (*GstMemoryUnmapFunction) (GstMemory *mem);
/**
* GstMemoryCopyFunction:
* @mem: a #GstMemory
* @offset: an offset
* @size: a size or -1
*
* Copy @size bytes from @mem starting at @offset and return them wrapped in a
* new GstMemory object.
* If @size is set to -1, all bytes starting at @offset are copied.
*
* Returns: a new #GstMemory object wrapping a copy of the requested region in
* @mem.
*/
typedef GstMemory * (*GstMemoryCopyFunction) (GstMemory *mem, gssize offset, gssize size);
/**
* GstMemoryShareFunction:
* @mem: a #GstMemory
* @offset: an offset
* @size: a size or -1
*
* Share @size bytes from @mem starting at @offset and return them wrapped in a
* new GstMemory object. If @size is set to -1, all bytes starting at @offset are
* shared. This function does not make a copy of the bytes in @mem.
*
* Returns: a new #GstMemory object sharing the requested region in @mem.
*/
typedef GstMemory * (*GstMemoryShareFunction) (GstMemory *mem, gssize offset, gssize size);
/**
* GstMemoryIsSpanFunction:
* @mem1: a #GstMemory
* @mem2: a #GstMemory
* @offset: a result offset
*
* Check if @mem1 and @mem2 occupy contiguous memory and return the offset of
* @mem1 in the parent buffer in @offset.
*
* Returns: %TRUE if @mem1 and @mem2 are in contiguous memory.
*/
typedef gboolean (*GstMemoryIsSpanFunction) (GstMemory *mem1, GstMemory *mem2, gsize *offset);
void gst_memory_init (GstMemory *mem, GstMemoryFlags flags,
GstAllocator *allocator, GstMemory *parent,
gsize maxsize, gsize align,
gsize offset, gsize size);
/* refcounting */
/**
* gst_memory_ref:
* @memory: The memory to refcount
*
* Increase the refcount of this memory.
*
* Returns: (transfer full): @memory (for convenience when doing assignments)
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstMemory * gst_memory_ref (GstMemory * memory);
#endif
static inline GstMemory *
gst_memory_ref (GstMemory * memory)
{
return (GstMemory *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (memory));
}
/**
* gst_memory_unref:
* @memory: (transfer full): the memory to refcount
*
* Decrease the refcount of an memory, freeing it if the refcount reaches 0.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void gst_memory_unref (GstMemory * memory);
#endif
static inline void
gst_memory_unref (GstMemory * memory)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (memory));
}
/* getting/setting memory properties */
gsize gst_memory_get_sizes (GstMemory *mem, gsize *offset, gsize *maxsize);
void gst_memory_resize (GstMemory *mem, gssize offset, gsize size);
#define gst_memory_lock(m,f) gst_mini_object_lock (GST_MINI_OBJECT_CAST (m), (f))
#define gst_memory_unlock(m,f) gst_mini_object_unlock (GST_MINI_OBJECT_CAST (m), (f))
#define gst_memory_is_writable(m) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (m))
#define gst_memory_make_writable(m) GST_MEMORY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (m)))
/* retrieving data */
GstMemory * gst_memory_make_mapped (GstMemory *mem, GstMapInfo *info, GstMapFlags flags);
gboolean gst_memory_map (GstMemory *mem, GstMapInfo *info, GstMapFlags flags);
void gst_memory_unmap (GstMemory *mem, GstMapInfo *info);
/* copy and subregions */
GstMemory * gst_memory_copy (GstMemory *mem, gssize offset, gssize size);
GstMemory * gst_memory_share (GstMemory *mem, gssize offset, gssize size);
/* span memory */
gboolean gst_memory_is_span (GstMemory *mem1, GstMemory *mem2, gsize *offset);
G_END_DECLS
#endif /* __GST_MEMORY_H__ */
@@ -0,0 +1,562 @@
/* GStreamer
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
*
* gstmessage.h: Header for GstMessage subsystem
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MESSAGE_H__
#define __GST_MESSAGE_H__
G_BEGIN_DECLS
typedef struct _GstMessage GstMessage;
/**
* GstMessageType:
* @GST_MESSAGE_UNKNOWN: an undefined message
* @GST_MESSAGE_EOS: end-of-stream reached in a pipeline. The application will
* only receive this message in the PLAYING state and every time it sets a
* pipeline to PLAYING that is in the EOS state. The application can perform a
* flushing seek in the pipeline, which will undo the EOS state again.
* @GST_MESSAGE_ERROR: an error occured. When the application receives an error
* message it should stop playback of the pipeline and not assume that more
* data will be played.
* @GST_MESSAGE_WARNING: a warning occured.
* @GST_MESSAGE_INFO: an info message occured
* @GST_MESSAGE_TAG: a tag was found.
* @GST_MESSAGE_BUFFERING: the pipeline is buffering. When the application
* receives a buffering message in the PLAYING state for a non-live pipeline it
* must PAUSE the pipeline until the buffering completes, when the percentage
* field in the message is 100%. For live pipelines, no action must be
* performed and the buffering percentage can be used to inform the user about
* the progress.
* @GST_MESSAGE_STATE_CHANGED: a state change happened
* @GST_MESSAGE_STATE_DIRTY: an element changed state in a streaming thread.
* This message is deprecated.
* @GST_MESSAGE_STEP_DONE: a stepping operation finished.
* @GST_MESSAGE_CLOCK_PROVIDE: an element notifies its capability of providing
* a clock. This message is used internally and
* never forwarded to the application.
* @GST_MESSAGE_CLOCK_LOST: The current clock as selected by the pipeline became
* unusable. The pipeline will select a new clock on
* the next PLAYING state change. The application
* should set the pipeline to PAUSED and back to
* PLAYING when this message is received.
* @GST_MESSAGE_NEW_CLOCK: a new clock was selected in the pipeline.
* @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed. This
* message is used internally and never forwarded to the application.
* @GST_MESSAGE_STREAM_STATUS: status about a stream, emitted when it starts,
* stops, errors, etc..
* @GST_MESSAGE_APPLICATION: message posted by the application, possibly
* via an application-specific element.
* @GST_MESSAGE_ELEMENT: element-specific message, see the specific element's
* documentation
* @GST_MESSAGE_SEGMENT_START: pipeline started playback of a segment. This
* message is used internally and never forwarded to the application.
* @GST_MESSAGE_SEGMENT_DONE: pipeline completed playback of a segment. This
* message is forwarded to the application after all elements that posted
* @GST_MESSAGE_SEGMENT_START posted a GST_MESSAGE_SEGMENT_DONE message.
* @GST_MESSAGE_DURATION_CHANGED: The duration of a pipeline changed. The
* application can get the new duration with a duration query.
* @GST_MESSAGE_ASYNC_START: Posted by elements when they start an ASYNC
* #GstStateChange. This message is not forwarded to the application but is used
* internally.
* @GST_MESSAGE_ASYNC_DONE: Posted by elements when they complete an ASYNC
* #GstStateChange. The application will only receive this message from the toplevel
* pipeline.
* @GST_MESSAGE_LATENCY: Posted by elements when their latency changes. The
* application should recalculate and distribute a new latency.
* @GST_MESSAGE_REQUEST_STATE: Posted by elements when they want the pipeline to
* change state. This message is a suggestion to the application which can
* decide to perform the state change on (part of) the pipeline.
* @GST_MESSAGE_STEP_START: A stepping operation was started.
* @GST_MESSAGE_QOS: A buffer was dropped or an element changed its processing
* strategy for Quality of Service reasons.
* @GST_MESSAGE_PROGRESS: A progress message.
* @GST_MESSAGE_TOC: A new table of contents (TOC) was found or previously found TOC
* was updated.
* @GST_MESSAGE_RESET_TIME: Message to request resetting the pipeline's
* running time from the pipeline. This is an internal message which
* applications will likely never receive.
* @GST_MESSAGE_STREAM_START: Message indicating start of a new stream. Useful
* e.g. when using playbin in gapless playback mode, to get notified when
* the next title actually starts playing (which will be some time after
* the URI for the next title has been set).
* @GST_MESSAGE_ANY: mask for all of the above messages.
*
* The different message types that are available.
*/
/* NOTE: keep in sync with quark registration in gstmessage.c
* NOTE: keep GST_MESSAGE_ANY a valid gint to avoid compiler warnings.
*/
typedef enum
{
GST_MESSAGE_UNKNOWN = 0,
GST_MESSAGE_EOS = (1 << 0),
GST_MESSAGE_ERROR = (1 << 1),
GST_MESSAGE_WARNING = (1 << 2),
GST_MESSAGE_INFO = (1 << 3),
GST_MESSAGE_TAG = (1 << 4),
GST_MESSAGE_BUFFERING = (1 << 5),
GST_MESSAGE_STATE_CHANGED = (1 << 6),
GST_MESSAGE_STATE_DIRTY = (1 << 7),
GST_MESSAGE_STEP_DONE = (1 << 8),
GST_MESSAGE_CLOCK_PROVIDE = (1 << 9),
GST_MESSAGE_CLOCK_LOST = (1 << 10),
GST_MESSAGE_NEW_CLOCK = (1 << 11),
GST_MESSAGE_STRUCTURE_CHANGE = (1 << 12),
GST_MESSAGE_STREAM_STATUS = (1 << 13),
GST_MESSAGE_APPLICATION = (1 << 14),
GST_MESSAGE_ELEMENT = (1 << 15),
GST_MESSAGE_SEGMENT_START = (1 << 16),
GST_MESSAGE_SEGMENT_DONE = (1 << 17),
GST_MESSAGE_DURATION_CHANGED = (1 << 18),
GST_MESSAGE_LATENCY = (1 << 19),
GST_MESSAGE_ASYNC_START = (1 << 20),
GST_MESSAGE_ASYNC_DONE = (1 << 21),
GST_MESSAGE_REQUEST_STATE = (1 << 22),
GST_MESSAGE_STEP_START = (1 << 23),
GST_MESSAGE_QOS = (1 << 24),
GST_MESSAGE_PROGRESS = (1 << 25),
GST_MESSAGE_TOC = (1 << 26),
GST_MESSAGE_RESET_TIME = (1 << 27),
GST_MESSAGE_STREAM_START = (1 << 28),
GST_MESSAGE_ANY = ~0
} GstMessageType;
#include <gst/gstminiobject.h>
#include <gst/gstobject.h>
#include <gst/gstelement.h>
#include <gst/gsttaglist.h>
#include <gst/gststructure.h>
#include <gst/gstquery.h>
#include <gst/gsttoc.h>
#define GST_TYPE_MESSAGE (gst_message_get_type())
#define GST_IS_MESSAGE(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_MESSAGE))
#define GST_MESSAGE_CAST(obj) ((GstMessage*)(obj))
#define GST_MESSAGE(obj) (GST_MESSAGE_CAST(obj))
/* the lock is used to handle the synchronous handling of messages,
* the emiting thread is block until the handling thread processed
* the message using this mutex/cond pair */
#define GST_MESSAGE_GET_LOCK(message) (&GST_MESSAGE_CAST(message)->lock)
#define GST_MESSAGE_LOCK(message) g_mutex_lock(GST_MESSAGE_GET_LOCK(message))
#define GST_MESSAGE_UNLOCK(message) g_mutex_unlock(GST_MESSAGE_GET_LOCK(message))
#define GST_MESSAGE_GET_COND(message) (&GST_MESSAGE_CAST(message)->cond)
#define GST_MESSAGE_WAIT(message) g_cond_wait(GST_MESSAGE_GET_COND(message),GST_MESSAGE_GET_LOCK(message))
#define GST_MESSAGE_SIGNAL(message) g_cond_signal(GST_MESSAGE_GET_COND(message))
/**
* GST_MESSAGE_TYPE:
* @message: a #GstMessage
*
* Get the #GstMessageType of @message.
*/
#define GST_MESSAGE_TYPE(message) (GST_MESSAGE_CAST(message)->type)
/**
* GST_MESSAGE_TYPE_NAME:
* @message: a #GstMessage
*
* Get a constant string representation of the #GstMessageType of @message.
*/
#define GST_MESSAGE_TYPE_NAME(message) gst_message_type_get_name(GST_MESSAGE_TYPE(message))
/**
* GST_MESSAGE_TIMESTAMP:
* @message: a #GstMessage
*
* Get the timestamp of @message. This is the timestamp when the message
* was created.
*/
#define GST_MESSAGE_TIMESTAMP(message) (GST_MESSAGE_CAST(message)->timestamp)
/**
* GST_MESSAGE_SRC:
* @message: a #GstMessage
*
* Get the object that posted @message.
*/
#define GST_MESSAGE_SRC(message) (GST_MESSAGE_CAST(message)->src)
/**
* GST_MESSAGE_SEQNUM:
* @message: a #GstMessage
*
* Get the sequence number of @message.
*/
#define GST_MESSAGE_SEQNUM(message) (GST_MESSAGE_CAST(message)->seqnum)
/**
* GST_MESSAGE_SRC_NAME:
* @message: a #GstMessage
*
* Get the name of the object that posted @message. Returns "(NULL)" if
* the message has no source object set.
*/
#define GST_MESSAGE_SRC_NAME(message) (GST_MESSAGE_SRC(message) ? \
GST_OBJECT_NAME (GST_MESSAGE_SRC(message)) : "(NULL)")
/**
* GstStructureChangeType:
* @GST_STRUCTURE_CHANGE_TYPE_PAD_LINK: Pad linking is starting or done.
* @GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK: Pad unlinking is starting or done.
*
* The type of a %GST_MESSAGE_STRUCTURE_CHANGE.
*/
typedef enum {
GST_STRUCTURE_CHANGE_TYPE_PAD_LINK = 0,
GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK = 1
} GstStructureChangeType;
/**
* GstStreamStatusType:
* @GST_STREAM_STATUS_TYPE_CREATE: A new thread need to be created.
* @GST_STREAM_STATUS_TYPE_ENTER: a thread entered its loop function
* @GST_STREAM_STATUS_TYPE_LEAVE: a thread left its loop function
* @GST_STREAM_STATUS_TYPE_DESTROY: a thread is destroyed
* @GST_STREAM_STATUS_TYPE_START: a thread is started
* @GST_STREAM_STATUS_TYPE_PAUSE: a thread is paused
* @GST_STREAM_STATUS_TYPE_STOP: a thread is stopped
*
* The type of a %GST_MESSAGE_STREAM_STATUS. The stream status messages inform the
* application of new streaming threads and their status.
*/
typedef enum {
GST_STREAM_STATUS_TYPE_CREATE = 0,
GST_STREAM_STATUS_TYPE_ENTER = 1,
GST_STREAM_STATUS_TYPE_LEAVE = 2,
GST_STREAM_STATUS_TYPE_DESTROY = 3,
GST_STREAM_STATUS_TYPE_START = 8,
GST_STREAM_STATUS_TYPE_PAUSE = 9,
GST_STREAM_STATUS_TYPE_STOP = 10
} GstStreamStatusType;
/**
* GstProgressType:
* @GST_PROGRESS_TYPE_START: A new task started.
* @GST_PROGRESS_TYPE_CONTINUE: A task completed and a new one continues.
* @GST_PROGRESS_TYPE_COMPLETE: A task completed.
* @GST_PROGRESS_TYPE_CANCELED: A task was canceled.
* @GST_PROGRESS_TYPE_ERROR: A task caused an error. An error message is also
* posted on the bus.
*
* The type of a %GST_MESSAGE_PROGRESS. The progress messages inform the
* application of the status of assynchronous tasks.
*/
typedef enum {
GST_PROGRESS_TYPE_START = 0,
GST_PROGRESS_TYPE_CONTINUE = 1,
GST_PROGRESS_TYPE_COMPLETE = 2,
GST_PROGRESS_TYPE_CANCELED = 3,
GST_PROGRESS_TYPE_ERROR = 4
} GstProgressType;
/**
* GstMessage:
* @mini_object: the parent structure
* @type: the #GstMessageType of the message
* @timestamp: the timestamp of the message
* @src: the src of the message
* @seqnum: the sequence number of the message
*
* A #GstMessage.
*/
struct _GstMessage
{
GstMiniObject mini_object;
/*< public > *//* with COW */
GstMessageType type;
guint64 timestamp;
GstObject *src;
guint32 seqnum;
/*< private >*//* with MESSAGE_LOCK */
GMutex lock; /* lock and cond for async delivery */
GCond cond;
};
GType gst_message_get_type (void);
const gchar* gst_message_type_get_name (GstMessageType type);
GQuark gst_message_type_to_quark (GstMessageType type);
/* refcounting */
/**
* gst_message_ref:
* @msg: the message to ref
*
* Convenience macro to increase the reference count of the message.
*
* Returns: @msg (for convenience when doing assignments)
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstMessage * gst_message_ref (GstMessage * msg);
#endif
static inline GstMessage *
gst_message_ref (GstMessage * msg)
{
return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg));
}
/**
* gst_message_unref:
* @msg: the message to unref
*
* Convenience macro to decrease the reference count of the message, possibly
* freeing it.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void gst_message_unref (GstMessage * msg);
#endif
static inline void
gst_message_unref (GstMessage * msg)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (msg));
}
/* copy message */
/**
* gst_message_copy:
* @msg: the message to copy
*
* Creates a copy of the message. Returns a copy of the message.
*
* Returns: (transfer full): a new copy of @msg.
*
* MT safe
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstMessage * gst_message_copy (const GstMessage * msg);
#endif
static inline GstMessage *
gst_message_copy (const GstMessage * msg)
{
return GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (msg)));
}
/**
* gst_message_is_writable:
* @msg: a #GstMessage
*
* Tests if you can safely write into a message's structure or validly
* modify the seqnum and timestamp fields.
*/
#define gst_message_is_writable(msg) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (msg))
/**
* gst_message_make_writable:
* @msg: (transfer full): the message to make writable
*
* Checks if a message is writable. If not, a writable copy is made and
* returned.
*
* Returns: (transfer full): a message (possibly a duplicate) that is writable.
*
* MT safe
*/
#define gst_message_make_writable(msg) GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg)))
/**
* gst_message_replace:
* @old_message: (inout) (transfer full): pointer to a pointer to a #GstMessage
* to be replaced.
* @new_message: (allow-none) (transfer none): pointer to a #GstMessage that will
* replace the message pointed to by @old_message.
*
* Modifies a pointer to a #GstMessage to point to a different #GstMessage. The
* modification is done atomically (so this is useful for ensuring thread safety
* in some cases), and the reference counts are updated appropriately (the old
* message is unreffed, the new one is reffed).
*
* Either @new_message or the #GstMessage pointed to by @old_message may be NULL.
*
* Returns: TRUE if @new_message was different from @old_message
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC gboolean gst_message_replace (GstMessage **old_message, GstMessage *new_message);
#endif
static inline gboolean
gst_message_replace (GstMessage **old_message, GstMessage *new_message)
{
return gst_mini_object_replace ((GstMiniObject **) old_message, (GstMiniObject *) new_message);
}
/* custom messages */
GstMessage * gst_message_new_custom (GstMessageType type,
GstObject * src,
GstStructure * structure) G_GNUC_MALLOC;
const GstStructure *
gst_message_get_structure (GstMessage *message);
gboolean gst_message_has_name (GstMessage *message, const gchar *name);
/* identifiers for events and messages */
guint32 gst_message_get_seqnum (GstMessage *message);
void gst_message_set_seqnum (GstMessage *message, guint32 seqnum);
/* EOS */
GstMessage * gst_message_new_eos (GstObject * src) G_GNUC_MALLOC;
/* ERROR */
GstMessage * gst_message_new_error (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug);
/* WARNING */
GstMessage * gst_message_new_warning (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug);
/* INFO */
GstMessage * gst_message_new_info (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
void gst_message_parse_info (GstMessage *message, GError **gerror, gchar **debug);
/* TAG */
GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list) G_GNUC_MALLOC;
void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list);
/* BUFFERING */
GstMessage * gst_message_new_buffering (GstObject * src, gint percent) G_GNUC_MALLOC;
void gst_message_parse_buffering (GstMessage *message, gint *percent);
void gst_message_set_buffering_stats (GstMessage *message, GstBufferingMode mode,
gint avg_in, gint avg_out,
gint64 buffering_left);
void gst_message_parse_buffering_stats (GstMessage *message, GstBufferingMode *mode,
gint *avg_in, gint *avg_out,
gint64 *buffering_left);
/* STATE_CHANGED */
GstMessage * gst_message_new_state_changed (GstObject * src, GstState oldstate,
GstState newstate, GstState pending) G_GNUC_MALLOC;
void gst_message_parse_state_changed (GstMessage *message, GstState *oldstate,
GstState *newstate, GstState *pending);
/* STATE_DIRTY */
GstMessage * gst_message_new_state_dirty (GstObject * src) G_GNUC_MALLOC;
/* STEP_DONE */
GstMessage * gst_message_new_step_done (GstObject * src, GstFormat format, guint64 amount,
gdouble rate, gboolean flush, gboolean intermediate,
guint64 duration, gboolean eos) G_GNUC_MALLOC;
void gst_message_parse_step_done (GstMessage * message, GstFormat *format, guint64 *amount,
gdouble *rate, gboolean *flush, gboolean *intermediate,
guint64 *duration, gboolean *eos);
/* CLOCK_PROVIDE */
GstMessage * gst_message_new_clock_provide (GstObject * src, GstClock *clock, gboolean ready) G_GNUC_MALLOC;
void gst_message_parse_clock_provide (GstMessage *message, GstClock **clock,
gboolean *ready);
/* CLOCK_LOST */
GstMessage * gst_message_new_clock_lost (GstObject * src, GstClock *clock) G_GNUC_MALLOC;
void gst_message_parse_clock_lost (GstMessage *message, GstClock **clock);
/* NEW_CLOCK */
GstMessage * gst_message_new_new_clock (GstObject * src, GstClock *clock) G_GNUC_MALLOC;
void gst_message_parse_new_clock (GstMessage *message, GstClock **clock);
/* APPLICATION */
GstMessage * gst_message_new_application (GstObject * src, GstStructure * structure) G_GNUC_MALLOC;
/* ELEMENT */
GstMessage * gst_message_new_element (GstObject * src, GstStructure * structure) G_GNUC_MALLOC;
/* SEGMENT_START */
GstMessage * gst_message_new_segment_start (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC;
void gst_message_parse_segment_start (GstMessage *message, GstFormat *format,
gint64 *position);
/* SEGMENT_DONE */
GstMessage * gst_message_new_segment_done (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC;
void gst_message_parse_segment_done (GstMessage *message, GstFormat *format,
gint64 *position);
/* DURATION_CHANGED */
GstMessage * gst_message_new_duration_changed (GstObject * src) G_GNUC_MALLOC;
/* LATENCY */
GstMessage * gst_message_new_latency (GstObject * src) G_GNUC_MALLOC;
/* ASYNC_START */
GstMessage * gst_message_new_async_start (GstObject * src) G_GNUC_MALLOC;
/* ASYNC_DONE */
GstMessage * gst_message_new_async_done (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
void gst_message_parse_async_done (GstMessage *message, GstClockTime *running_time);
/* STRUCTURE CHANGE */
GstMessage * gst_message_new_structure_change (GstObject * src, GstStructureChangeType type,
GstElement *owner, gboolean busy) G_GNUC_MALLOC;
void gst_message_parse_structure_change (GstMessage *message, GstStructureChangeType *type,
GstElement **owner, gboolean *busy);
/* STREAM STATUS */
GstMessage * gst_message_new_stream_status (GstObject * src, GstStreamStatusType type,
GstElement *owner) G_GNUC_MALLOC;
void gst_message_parse_stream_status (GstMessage *message, GstStreamStatusType *type,
GstElement **owner);
void gst_message_set_stream_status_object (GstMessage *message, const GValue *object);
const GValue * gst_message_get_stream_status_object (GstMessage *message);
/* REQUEST_STATE */
GstMessage * gst_message_new_request_state (GstObject * src, GstState state) G_GNUC_MALLOC;
void gst_message_parse_request_state (GstMessage * message, GstState *state);
/* STEP_START */
GstMessage * gst_message_new_step_start (GstObject * src, gboolean active, GstFormat format,
guint64 amount, gdouble rate, gboolean flush,
gboolean intermediate) G_GNUC_MALLOC;
void gst_message_parse_step_start (GstMessage * message, gboolean *active, GstFormat *format,
guint64 *amount, gdouble *rate, gboolean *flush,
gboolean *intermediate);
/* QOS */
GstMessage * gst_message_new_qos (GstObject * src, gboolean live, guint64 running_time,
guint64 stream_time, guint64 timestamp, guint64 duration) G_GNUC_MALLOC;
void gst_message_set_qos_values (GstMessage * message, gint64 jitter, gdouble proportion,
gint quality);
void gst_message_set_qos_stats (GstMessage * message, GstFormat format, guint64 processed,
guint64 dropped);
void gst_message_parse_qos (GstMessage * message, gboolean * live, guint64 * running_time,
guint64 * stream_time, guint64 * timestamp, guint64 * duration);
void gst_message_parse_qos_values (GstMessage * message, gint64 * jitter, gdouble * proportion,
gint * quality);
void gst_message_parse_qos_stats (GstMessage * message, GstFormat * format, guint64 * processed,
guint64 * dropped);
/* PROGRESS */
GstMessage * gst_message_new_progress (GstObject * src, GstProgressType type, const gchar *code,
const gchar *text) G_GNUC_MALLOC;
void gst_message_parse_progress (GstMessage * message, GstProgressType * type, gchar ** code,
gchar ** text);
/* TOC */
GstMessage * gst_message_new_toc (GstObject *src, GstToc *toc, gboolean updated);
void gst_message_parse_toc (GstMessage *message, GstToc **toc, gboolean *updated);
/* RESET_TIME */
GstMessage * gst_message_new_reset_time (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
void gst_message_parse_reset_time (GstMessage *message, GstClockTime *running_time);
/* STREAM_START */
GstMessage * gst_message_new_stream_start (GstObject * src) G_GNUC_MALLOC;
G_END_DECLS
#endif /* __GST_MESSAGE_H__ */
@@ -0,0 +1,216 @@
/* GStreamer
* Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.be>
*
* gstmeta.h: Header for Metadata structures
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_META_H__
#define __GST_META_H__
G_BEGIN_DECLS
typedef struct _GstMeta GstMeta;
typedef struct _GstMetaInfo GstMetaInfo;
#define GST_META_CAST(meta) ((GstMeta *)(meta))
/**
* GstMetaFlags:
* @GST_META_FLAG_NONE: no flags
* @GST_META_FLAG_READONLY: metadata should not be modified
* @GST_META_FLAG_POOLED: metadata is managed by a bufferpool
* @GST_META_FLAG_LOCKED: metadata should not be removed
* @GST_META_FLAG_LAST: additional flags can be added starting from this flag.
*
* Extra metadata flags.
*/
typedef enum {
GST_META_FLAG_NONE = 0,
GST_META_FLAG_READONLY = (1 << 0),
GST_META_FLAG_POOLED = (1 << 1),
GST_META_FLAG_LOCKED = (1 << 2),
GST_META_FLAG_LAST = (1 << 16)
} GstMetaFlags;
/**
* GST_META_FLAGS:
* @meta: a #GstMeta.
*
* A flags word containing #GstMetaFlags flags set on @meta
*/
#define GST_META_FLAGS(meta) (GST_META_CAST (meta)->flags)
/**
* GST_META_FLAG_IS_SET:
* @meta: a #GstMeta.
* @flag: the #GstMetaFlags to check.
*
* Gives the status of a specific flag on a metadata.
*/
#define GST_META_FLAG_IS_SET(meta,flag) !!(GST_META_FLAGS (meta) & (flag))
/**
* GST_META_FLAG_SET:
* @meta: a #GstMeta.
* @flag: the #GstMetaFlags to set.
*
* Sets a metadata flag on a metadata.
*/
#define GST_META_FLAG_SET(meta,flag) (GST_META_FLAGS (meta) |= (flag))
/**
* GST_META_FLAG_UNSET:
* @meta: a #GstMeta.
* @flag: the #GstMetaFlags to clear.
*
* Clears a metadata flag.
*/
#define GST_META_FLAG_UNSET(meta,flag) (GST_META_FLAGS (meta) &= ~(flag))
/**
* GstMeta:
* @flags: extra flags for the metadata
* @info: pointer to the #GstMetaInfo
*
* Base structure for metadata. Custom metadata will put this structure
* as the first member of their structure.
*/
struct _GstMeta {
GstMetaFlags flags;
const GstMetaInfo *info;
};
/**
* GstMetaInitFunction:
* @meta: a #GstMeta
* @params: parameters passed to the init function
* @buffer: a #GstBuffer
*
* Function called when @meta is initialized in @buffer.
*/
typedef gboolean (*GstMetaInitFunction) (GstMeta *meta, gpointer params, GstBuffer *buffer);
/**
* GstMetaFreeFunction:
* @meta: a #GstMeta
* @buffer: a #GstBuffer
*
* Function called when @meta is freed in @buffer.
*/
typedef void (*GstMetaFreeFunction) (GstMeta *meta, GstBuffer *buffer);
/**
* gst_meta_transform_copy:
*
* GQuark for the "gst-copy" transform.
*/
GST_EXPORT GQuark _gst_meta_transform_copy;
/**
* GST_META_TRANSFORM_IS_COPY:
* @type: a transform type
*
* Check if the transform type is a copy transform
*/
#define GST_META_TRANSFORM_IS_COPY(type) ((type) == _gst_meta_transform_copy)
/**
* GstMetaTransformCopy:
* @region: %TRUE if only region is copied
* @offset: the offset to copy, 0 if @region is %FALSE, otherwise > 0
* @size: the size to copy, -1 or the buffer size when @region is %FALSE
*
* Extra data passed to a "gst-copy" transform #GstMetaTransformFunction.
*/
typedef struct {
gboolean region;
gsize offset;
gsize size;
} GstMetaTransformCopy;
/**
* GstMetaTransformFunction:
* @transbuf: a #GstBuffer
* @meta: a #GstMeta
* @buffer: a #GstBuffer
* @type: the transform type
* @data: transform specific data.
*
* Function called for each @meta in @buffer as a result of performing a
* transformation on @transbuf. Additional @type specific transform data
* is passed to the function as @data.
*
* Implementations should check the @type of the transform and parse
* additional type specific fields in @data that should be used to update
* the metadata on @transbuf.
*
* Returns: %TRUE if the transform could be performed
*/
typedef gboolean (*GstMetaTransformFunction) (GstBuffer *transbuf,
GstMeta *meta, GstBuffer *buffer,
GQuark type, gpointer data);
/**
* GstMetaInfo:
* @api: tag indentifying the metadata structure and api
* @type: type indentifying the implementor of the api
* @size: size of the metadata
* @init_func: function for initializing the metadata
* @free_func: function for freeing the metadata
* @transform_func: function for transforming the metadata
*
* The #GstMetaInfo provides information about a specific metadata
* structure.
*/
struct _GstMetaInfo {
GType api;
GType type;
gsize size;
GstMetaInitFunction init_func;
GstMetaFreeFunction free_func;
GstMetaTransformFunction transform_func;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_meta_api_type_register (const gchar *api,
const gchar **tags);
gboolean gst_meta_api_type_has_tag (GType api, GQuark tag);
const GstMetaInfo * gst_meta_register (GType api, const gchar *impl,
gsize size,
GstMetaInitFunction init_func,
GstMetaFreeFunction free_func,
GstMetaTransformFunction transform_func);
const GstMetaInfo * gst_meta_get_info (const gchar * impl);
/* some default tags */
GST_EXPORT GQuark _gst_meta_tag_memory;
/**
* GST_META_TAG_MEMORY:
*
* Metadata tagged with this tag depends on the particular memory
* or buffer that it is on.
*/
#define GST_META_TAG_MEMORY (_gst_meta_tag_memory)
G_END_DECLS
#endif /* __GST_META_H__ */
@@ -0,0 +1,275 @@
/* GStreamer
* Copyright (C) 2005 David Schleef <ds@schleef.org>
*
* gstminiobject.h: Header for GstMiniObject
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MINI_OBJECT_H__
#define __GST_MINI_OBJECT_H__
#include <gst/gstconfig.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define GST_IS_MINI_OBJECT_TYPE(obj,type) ((obj) && GST_MINI_OBJECT_TYPE(obj) == (type))
#define GST_MINI_OBJECT_CAST(obj) ((GstMiniObject*)(obj))
#define GST_MINI_OBJECT_CONST_CAST(obj) ((const GstMiniObject*)(obj))
#define GST_MINI_OBJECT(obj) (GST_MINI_OBJECT_CAST(obj))
typedef struct _GstMiniObject GstMiniObject;
/**
* GstMiniObjectCopyFunction:
* @obj: MiniObject to copy
*
* Function prototype for methods to create copies of instances.
*
* Returns: reference to cloned instance.
*/
typedef GstMiniObject * (*GstMiniObjectCopyFunction) (const GstMiniObject *obj);
/**
* GstMiniObjectDisposeFunction:
* @obj: MiniObject to dispose
*
* Function prototype for when a miniobject has lost its last refcount.
* Implementation of the mini object are allowed to revive the
* passed object by doing a gst_mini_object_ref(). If the object is not
* revived after the dispose function, the function should return %TRUE
* and the memory associated with the object is freed.
*
* Returns: %TRUE if the object should be cleaned up.
*/
typedef gboolean (*GstMiniObjectDisposeFunction) (GstMiniObject *obj);
/**
* GstMiniObjectFreeFunction:
* @obj: MiniObject to free
*
* Virtual function prototype for methods to free ressources used by
* mini-objects.
*/
typedef void (*GstMiniObjectFreeFunction) (GstMiniObject *obj);
/**
* GstMiniObjectNotify:
* @user_data: data that was provided when the notify was added
* @obj: the mini object
*
* A #GstMiniObjectNotify function can be added to a mini object as a
* callback that gets triggered when gst_mini_object_unref() drops the
* last ref and @obj is about to be freed.
*/
typedef void (*GstMiniObjectNotify) (gpointer user_data, GstMiniObject * obj);
/**
* GST_MINI_OBJECT_TYPE:
* @obj: MiniObject to return type for.
*
* This macro returns the type of the mini-object.
*/
#define GST_MINI_OBJECT_TYPE(obj) (GST_MINI_OBJECT_CAST(obj)->type)
/**
* GST_MINI_OBJECT_FLAGS:
* @obj: MiniObject to return flags for.
*
* This macro returns the entire set of flags for the mini-object.
*/
#define GST_MINI_OBJECT_FLAGS(obj) (GST_MINI_OBJECT_CAST(obj)->flags)
/**
* GST_MINI_OBJECT_FLAG_IS_SET:
* @obj: MiniObject to check for flags.
* @flag: Flag to check for
*
* This macro checks to see if the given flag is set.
*/
#define GST_MINI_OBJECT_FLAG_IS_SET(obj,flag) !!(GST_MINI_OBJECT_FLAGS (obj) & (flag))
/**
* GST_MINI_OBJECT_FLAG_SET:
* @obj: MiniObject to set flag in.
* @flag: Flag to set, can by any number of bits in guint32.
*
* This macro sets the given bits.
*/
#define GST_MINI_OBJECT_FLAG_SET(obj,flag) (GST_MINI_OBJECT_FLAGS (obj) |= (flag))
/**
* GST_MINI_OBJECT_FLAG_UNSET:
* @obj: MiniObject to unset flag in.
* @flag: Flag to set, must be a single bit in guint32.
*
* This macro usets the given bits.
*/
#define GST_MINI_OBJECT_FLAG_UNSET(obj,flag) (GST_MINI_OBJECT_FLAGS (obj) &= ~(flag))
/**
* GstMiniObjectFlags:
* @GST_MINI_OBJECT_FLAG_LOCKABLE: the object can be locked and unlocked with
* gst_mini_object_lock() and gst_mini_object_unlock().
* @GST_MINI_OBJECT_FLAG_LOCK_READONLY: the object is permanently locked in
* READONLY mode. Only read locks can be performed on the object.
* @GST_MINI_OBJECT_FLAG_LAST: first flag that can be used by subclasses.
*
* Flags for the mini object
*/
typedef enum
{
GST_MINI_OBJECT_FLAG_LOCKABLE = (1 << 0),
GST_MINI_OBJECT_FLAG_LOCK_READONLY = (1 << 1),
/* padding */
GST_MINI_OBJECT_FLAG_LAST = (1 << 4)
} GstMiniObjectFlags;
/**
* GST_MINI_OBJECT_IS_LOCKABLE:
* @obj: a #GstMiniObject
*
* Check if @obj is lockable. A lockable object can be locked and unlocked with
* gst_mini_object_lock() and gst_mini_object_unlock().
*/
#define GST_MINI_OBJECT_IS_LOCKABLE(obj) GST_MINI_OBJECT_FLAG_IS_SET(obj, GST_MINI_OBJECT_FLAG_LOCKABLE)
/**
* GstLockFlags:
* @GST_LOCK_FLAG_READ: lock for read access
* @GST_LOCK_FLAG_WRITE: lock for write access
* @GST_LOCK_FLAG_EXCLUSIVE: lock for exclusive access
* @GST_LOCK_FLAG_LAST: first flag that can be used for custom purposes
*
* Flags used when locking miniobjects
*/
typedef enum {
GST_LOCK_FLAG_READ = (1 << 0),
GST_LOCK_FLAG_WRITE = (1 << 1),
GST_LOCK_FLAG_EXCLUSIVE = (1 << 2),
GST_LOCK_FLAG_LAST = (1 << 8)
} GstLockFlags;
/**
* GST_LOCK_FLAG_READWRITE:
*
* GstLockFlags value alias for GST_LOCK_FLAG_READ | GST_LOCK_FLAG_WRITE
*/
#define GST_LOCK_FLAG_READWRITE (GST_LOCK_FLAG_READ | GST_LOCK_FLAG_WRITE)
/**
* GST_MINI_OBJECT_REFCOUNT:
* @obj: a #GstMiniObject
*
* Get access to the reference count field of the mini-object.
*/
#define GST_MINI_OBJECT_REFCOUNT(obj) ((GST_MINI_OBJECT_CAST(obj))->refcount)
/**
* GST_MINI_OBJECT_REFCOUNT_VALUE:
* @obj: a #GstMiniObject
*
* Get the reference count value of the mini-object.
*/
#define GST_MINI_OBJECT_REFCOUNT_VALUE(obj) (g_atomic_int_get (&(GST_MINI_OBJECT_CAST(obj))->refcount))
/**
* GstMiniObject:
* @type: the GType of the object
* @refcount: atomic refcount
* @lockstate: atomic state of the locks
* @flags: extra flags.
* @copy: a copy function
* @dispose: a dispose function
* @free: the free function
*
* Base class for refcounted lightweight objects.
* Ref Func: gst_mini_object_ref
* Unref Func: gst_mini_object_unref
* Set Value Func: g_value_set_boxed
* Get Value Func: g_value_get_boxed
*/
struct _GstMiniObject {
GType type;
/*< public >*/ /* with COW */
gint refcount;
gint lockstate;
guint flags;
GstMiniObjectCopyFunction copy;
GstMiniObjectDisposeFunction dispose;
GstMiniObjectFreeFunction free;
/* < private > */
/* Used to keep track of weak ref notifies and qdata */
guint n_qdata;
gpointer qdata;
};
void gst_mini_object_init (GstMiniObject *mini_object,
guint flags, GType type,
GstMiniObjectCopyFunction copy_func,
GstMiniObjectDisposeFunction dispose_func,
GstMiniObjectFreeFunction free_func);
/* refcounting */
GstMiniObject * gst_mini_object_ref (GstMiniObject *mini_object);
void gst_mini_object_unref (GstMiniObject *mini_object);
void gst_mini_object_weak_ref (GstMiniObject *object,
GstMiniObjectNotify notify,
gpointer data);
void gst_mini_object_weak_unref (GstMiniObject *object,
GstMiniObjectNotify notify,
gpointer data);
/* locking */
gboolean gst_mini_object_lock (GstMiniObject *object, GstLockFlags flags);
void gst_mini_object_unlock (GstMiniObject *object, GstLockFlags flags);
gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object);
/* copy */
GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object) G_GNUC_MALLOC;
void gst_mini_object_set_qdata (GstMiniObject *object, GQuark quark,
gpointer data, GDestroyNotify destroy);
gpointer gst_mini_object_get_qdata (GstMiniObject *object, GQuark quark);
gpointer gst_mini_object_steal_qdata (GstMiniObject *object, GQuark quark);
gboolean gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata);
gboolean gst_mini_object_take (GstMiniObject **olddata, GstMiniObject *newdata);
GstMiniObject * gst_mini_object_steal (GstMiniObject **olddata);
/**
* GST_DEFINE_MINI_OBJECT_TYPE:
* @TypeName: name of the new type in CamelCase
* @type_name: name of the new type
*
* Define a new mini-object type with the given name
*/
#define GST_DEFINE_MINI_OBJECT_TYPE(TypeName,type_name) \
G_DEFINE_BOXED_TYPE(TypeName,type_name, \
(GBoxedCopyFunc) gst_mini_object_ref, \
(GBoxedFreeFunc) gst_mini_object_unref)
G_END_DECLS
#endif
@@ -0,0 +1,267 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstobject.h: Header for base GstObject
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_OBJECT_H__
#define __GST_OBJECT_H__
#include <gst/gstconfig.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define GST_TYPE_OBJECT (gst_object_get_type ())
#define GST_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_OBJECT))
#define GST_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_OBJECT))
#define GST_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_OBJECT, GstObjectClass))
#define GST_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OBJECT, GstObject))
#define GST_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_OBJECT, GstObjectClass))
#define GST_OBJECT_CAST(obj) ((GstObject*)(obj))
#define GST_OBJECT_CLASS_CAST(klass) ((GstObjectClass*)(klass))
/**
* GstObjectFlags:
* @GST_OBJECT_FLAG_LAST: subclasses can add additional flags starting from this flag
*
* The standard flags that an gstobject may have.
*/
typedef enum
{
/* padding */
GST_OBJECT_FLAG_LAST = (1<<4)
} GstObjectFlags;
/**
* GST_OBJECT_REFCOUNT:
* @obj: a #GstObject
*
* Get access to the reference count field of the object.
*/
#define GST_OBJECT_REFCOUNT(obj) (((GObject*)(obj))->ref_count)
/**
* GST_OBJECT_REFCOUNT_VALUE:
* @obj: a #GstObject
*
* Get the reference count value of the object.
*/
#define GST_OBJECT_REFCOUNT_VALUE(obj) g_atomic_int_get ((gint *) &GST_OBJECT_REFCOUNT(obj))
/* we do a GST_OBJECT_CAST to avoid type checking, better call these
* function with a valid object! */
/**
* GST_OBJECT_GET_LOCK:
* @obj: a #GstObject
*
* Acquire a reference to the mutex of this object.
*/
#define GST_OBJECT_GET_LOCK(obj) (&GST_OBJECT_CAST(obj)->lock)
/**
* GST_OBJECT_LOCK:
* @obj: a #GstObject to lock
*
* This macro will obtain a lock on the object, making serialization possible.
* It blocks until the lock can be obtained.
*/
#define GST_OBJECT_LOCK(obj) g_mutex_lock(GST_OBJECT_GET_LOCK(obj))
/**
* GST_OBJECT_TRYLOCK:
* @obj: a #GstObject.
*
* This macro will try to obtain a lock on the object, but will return with
* FALSE if it can't get it immediately.
*/
#define GST_OBJECT_TRYLOCK(obj) g_mutex_trylock(GST_OBJECT_GET_LOCK(obj))
/**
* GST_OBJECT_UNLOCK:
* @obj: a #GstObject to unlock.
*
* This macro releases a lock on the object.
*/
#define GST_OBJECT_UNLOCK(obj) g_mutex_unlock(GST_OBJECT_GET_LOCK(obj))
/**
* GST_OBJECT_NAME:
* @obj: a #GstObject
*
* Get the name of this object
*/
#define GST_OBJECT_NAME(obj) (GST_OBJECT_CAST(obj)->name)
/**
* GST_OBJECT_PARENT:
* @obj: a #GstObject
*
* Get the parent of this object
*/
#define GST_OBJECT_PARENT(obj) (GST_OBJECT_CAST(obj)->parent)
/**
* GST_OBJECT_FLAGS:
* @obj: a #GstObject
*
* This macro returns the entire set of flags for the object.
*/
#define GST_OBJECT_FLAGS(obj) (GST_OBJECT_CAST (obj)->flags)
/**
* GST_OBJECT_FLAG_IS_SET:
* @obj: a #GstObject
* @flag: Flag to check for
*
* This macro checks to see if the given flag is set.
*/
#define GST_OBJECT_FLAG_IS_SET(obj,flag) ((GST_OBJECT_FLAGS (obj) & (flag)) == (flag))
/**
* GST_OBJECT_FLAG_SET:
* @obj: a #GstObject
* @flag: Flag to set
*
* This macro sets the given bits.
*/
#define GST_OBJECT_FLAG_SET(obj,flag) (GST_OBJECT_FLAGS (obj) |= (flag))
/**
* GST_OBJECT_FLAG_UNSET:
* @obj: a #GstObject
* @flag: Flag to set
*
* This macro usets the given bits.
*/
#define GST_OBJECT_FLAG_UNSET(obj,flag) (GST_OBJECT_FLAGS (obj) &= ~(flag))
typedef struct _GstObject GstObject;
typedef struct _GstObjectClass GstObjectClass;
/**
* GstObject:
* @lock: object LOCK
* @name: The name of the object
* @parent: this object's parent, weak ref
* @flags: flags for this object
*
* GStreamer base object class.
*/
struct _GstObject {
GInitiallyUnowned object;
/*< public >*/ /* with LOCK */
GMutex lock; /* object LOCK */
gchar *name; /* object name */
GstObject *parent; /* this object's parent, weak ref */
guint32 flags;
/*< private >*/
GList *control_bindings; /* List of GstControlBinding */
guint64 control_rate;
guint64 last_sync;
gpointer _gst_reserved;
};
/**
* GstObjectClass:
* @parent_class: parent
* @path_string_separator: separator used by gst_object_get_path_string()
* @deep_notify: default signal handler
*
* GStreamer base object class.
*/
struct _GstObjectClass {
GInitiallyUnownedClass parent_class;
const gchar *path_string_separator;
/* signals */
void (*deep_notify) (GstObject * object, GstObject * orig, GParamSpec * pspec);
/*< public >*/
/* virtual methods for subclasses */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* normal GObject stuff */
GType gst_object_get_type (void);
/* name routines */
gboolean gst_object_set_name (GstObject *object, const gchar *name);
gchar* gst_object_get_name (GstObject *object);
/* parentage routines */
gboolean gst_object_set_parent (GstObject *object, GstObject *parent);
GstObject* gst_object_get_parent (GstObject *object);
void gst_object_unparent (GstObject *object);
gboolean gst_object_has_ancestor (GstObject *object, GstObject *ancestor);
void gst_object_default_deep_notify (GObject *object, GstObject *orig,
GParamSpec *pspec, gchar **excluded_props);
/* refcounting + life cycle */
gpointer gst_object_ref (gpointer object);
void gst_object_unref (gpointer object);
gpointer gst_object_ref_sink (gpointer object);
/* replace object pointer */
gboolean gst_object_replace (GstObject **oldobj, GstObject *newobj);
/* printing out the 'path' of the object */
gchar * gst_object_get_path_string (GstObject *object);
/* misc utils */
gboolean gst_object_check_uniqueness (GList *list, const gchar *name);
/* controller functions */
#include <gst/gstcontrolbinding.h>
#include <gst/gstcontrolsource.h>
GstClockTime gst_object_suggest_next_sync (GstObject * object);
gboolean gst_object_sync_values (GstObject * object, GstClockTime timestamp);
gboolean gst_object_has_active_control_bindings (GstObject *object);
void gst_object_set_control_bindings_disabled (GstObject *object, gboolean disabled);
void gst_object_set_control_binding_disabled (GstObject *object,
const gchar * property_name,
gboolean disabled);
gboolean gst_object_add_control_binding (GstObject * object, GstControlBinding * binding);
GstControlBinding *
gst_object_get_control_binding (GstObject *object, const gchar * property_name);
gboolean gst_object_remove_control_binding (GstObject * object, GstControlBinding * binding);
GValue * gst_object_get_value (GstObject * object, const gchar * property_name,
GstClockTime timestamp);
gboolean gst_object_get_value_array (GstObject * object, const gchar * property_name,
GstClockTime timestamp, GstClockTime interval,
guint n_values, gpointer values);
gboolean gst_object_get_g_value_array (GstObject * object, const gchar * property_name,
GstClockTime timestamp, GstClockTime interval,
guint n_values, GValue *values);
GstClockTime gst_object_get_control_rate (GstObject * object);
void gst_object_set_control_rate (GstObject * object, GstClockTime control_rate);
G_END_DECLS
#endif /* __GST_OBJECT_H__ */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,194 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
*
* gstpadtemplate.h: Header for GstPadTemplate object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PAD_TEMPLATE_H__
#define __GST_PAD_TEMPLATE_H__
#include <gst/gstconfig.h>
typedef struct _GstPadTemplate GstPadTemplate;
typedef struct _GstPadTemplateClass GstPadTemplateClass;
typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
#include <gst/gstobject.h>
#include <gst/gstbuffer.h>
#include <gst/gstcaps.h>
#include <gst/gstevent.h>
#include <gst/gstquery.h>
#include <gst/gsttask.h>
G_BEGIN_DECLS
#define GST_TYPE_STATIC_PAD_TEMPLATE (gst_static_pad_template_get_type ())
#define GST_TYPE_PAD_TEMPLATE (gst_pad_template_get_type ())
#define GST_PAD_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
#define GST_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD_TEMPLATE,GstPadTemplateClass))
#define GST_IS_PAD_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD_TEMPLATE))
#define GST_IS_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD_TEMPLATE))
/**
* GstPadPresence:
* @GST_PAD_ALWAYS: the pad is always available
* @GST_PAD_SOMETIMES: the pad will become available depending on the media stream
* @GST_PAD_REQUEST: the pad is only available on request with
* gst_element_get_request_pad().
*
* Indicates when this pad will become available.
*/
typedef enum {
GST_PAD_ALWAYS,
GST_PAD_SOMETIMES,
GST_PAD_REQUEST
} GstPadPresence;
/**
* GST_PAD_TEMPLATE_NAME_TEMPLATE:
* @templ: the template to query
*
* Get the nametemplate of the padtemplate.
*/
#define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ) (((GstPadTemplate *)(templ))->name_template)
/**
* GST_PAD_TEMPLATE_DIRECTION:
* @templ: the template to query
*
* Get the #GstPadDirection of the padtemplate.
*/
#define GST_PAD_TEMPLATE_DIRECTION(templ) (((GstPadTemplate *)(templ))->direction)
/**
* GST_PAD_TEMPLATE_PRESENCE:
* @templ: the template to query
*
* Get the #GstPadPresence of the padtemplate.
*/
#define GST_PAD_TEMPLATE_PRESENCE(templ) (((GstPadTemplate *)(templ))->presence)
/**
* GST_PAD_TEMPLATE_CAPS:
* @templ: the template to query
*
* Get a handle to the padtemplate #GstCaps
*/
#define GST_PAD_TEMPLATE_CAPS(templ) (((GstPadTemplate *)(templ))->caps)
/**
* GstPadTemplateFlags:
* @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
*
* Flags for the padtemplate
*/
typedef enum {
/* padding */
GST_PAD_TEMPLATE_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 4)
} GstPadTemplateFlags;
/**
* GST_PAD_TEMPLATE_IS_FIXED:
* @templ: the template to query
*
* Check if the properties of the padtemplate are fixed
*/
#define GST_PAD_TEMPLATE_IS_FIXED(templ) (GST_OBJECT_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
/**
* GstPadTemplate:
*
* The padtemplate object.
*/
struct _GstPadTemplate {
GstObject object;
gchar *name_template;
GstPadDirection direction;
GstPadPresence presence;
GstCaps *caps;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstPadTemplateClass {
GstObjectClass parent_class;
/* signal callbacks */
void (*pad_created) (GstPadTemplate *templ, GstPad *pad);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstStaticPadTemplate:
* @name_template: the name of the template
* @direction: the direction of the template
* @presence: the presence of the template
* @static_caps: the caps of the template.
*
* Structure describing the #GstStaticPadTemplate.
*/
struct _GstStaticPadTemplate {
const gchar *name_template;
GstPadDirection direction;
GstPadPresence presence;
GstStaticCaps static_caps;
};
/**
* GST_STATIC_PAD_TEMPLATE:
* @padname: the name template of the pad
* @dir: the GstPadDirection of the pad
* @pres: the GstPadPresence of the pad
* @caps: the GstStaticCaps of the pad
*
* Convenience macro to fill the values of a GstStaticPadTemplate
* structure.
*/
#define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
{ \
/* name_template */ padname, \
/* direction */ dir, \
/* presence */ pres, \
/* caps */ caps \
}
/* templates and factories */
GType gst_pad_template_get_type (void);
GType gst_static_pad_template_get_type (void);
GstPadTemplate* gst_pad_template_new (const gchar *name_template,
GstPadDirection direction, GstPadPresence presence,
GstCaps *caps) G_GNUC_MALLOC;
GstPadTemplate * gst_static_pad_template_get (GstStaticPadTemplate *pad_template);
GstCaps* gst_static_pad_template_get_caps (GstStaticPadTemplate *templ);
GstCaps* gst_pad_template_get_caps (GstPadTemplate *templ);
void gst_pad_template_pad_created (GstPadTemplate * templ, GstPad * pad);
G_END_DECLS
#endif /* __GST_PAD_TEMPLATE_H__ */
@@ -0,0 +1,122 @@
/* GStreamer - GParamSpecs for some of our types
* Copyright (C) 2007 Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PARAMSPECS_H__
#define __GST_PARAMSPECS_H__
#include <gst/gstvalue.h>
G_BEGIN_DECLS
/* --- paramspec flags */
/**
* GST_PARAM_CONTROLLABLE:
*
* Use this flag on GObject properties to signal they can make sense to be.
* controlled over time. This hint is used by the GstController.
*/
#define GST_PARAM_CONTROLLABLE (1 << (G_PARAM_USER_SHIFT + 1))
/**
* GST_PARAM_MUTABLE_READY:
*
* Use this flag on GObject properties of GstElements to indicate that
* they can be changed when the element is in the READY or lower state.
*/
#define GST_PARAM_MUTABLE_READY (1 << (G_PARAM_USER_SHIFT + 2))
/**
* GST_PARAM_MUTABLE_PAUSED:
*
* Use this flag on GObject properties of GstElements to indicate that
* they can be changed when the element is in the PAUSED or lower state.
* This flag implies GST_PARAM_MUTABLE_READY.
*/
#define GST_PARAM_MUTABLE_PAUSED (1 << (G_PARAM_USER_SHIFT + 3))
/**
* GST_PARAM_MUTABLE_PLAYING:
*
* Use this flag on GObject properties of GstElements to indicate that
* they can be changed when the element is in the PLAYING or lower state.
* This flag implies GST_PARAM_MUTABLE_PAUSED.
*/
#define GST_PARAM_MUTABLE_PLAYING (1 << (G_PARAM_USER_SHIFT + 4))
/**
* GST_PARAM_USER_SHIFT:
*
* Bits based on GST_PARAM_USER_SHIFT can be used by 3rd party applications.
*/
#define GST_PARAM_USER_SHIFT (1 << (G_PARAM_USER_SHIFT + 8))
/* --- type macros --- */
#define GST_TYPE_PARAM_FRACTION (gst_param_spec_fraction_get_type ())
#define GST_IS_PARAM_SPEC_FRACTION(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GST_TYPE_PARAM_FRACTION))
#define GST_PARAM_SPEC_FRACTION(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GST_TYPE_PARAM_FRACTION, GstParamSpecFraction))
/* --- get_type functions --- */
GType gst_param_spec_fraction_get_type (void);
/* --- typedefs & structures --- */
typedef struct _GstParamSpecFraction GstParamSpecFraction;
/**
* GstParamSpecFraction:
* @parent_instance: super class
* @min_num: minimal numerator
* @min_den: minimal denominator
* @max_num: maximal numerator
* @max_den: maximal denominator
* @def_num: default numerator
* @def_den: default denominator
*
* A GParamSpec derived structure that contains the meta data for fractional
* properties.
*/
struct _GstParamSpecFraction {
GParamSpec parent_instance;
gint min_num, min_den;
gint max_num, max_den;
gint def_num, def_den;
};
/* --- GParamSpec prototypes --- */
GParamSpec * gst_param_spec_fraction (const gchar * name,
const gchar * nick,
const gchar * blurb,
gint min_num, gint min_denom,
gint max_num, gint max_denom,
gint default_num, gint default_denom,
GParamFlags flags) G_GNUC_MALLOC;
G_END_DECLS
#endif /* __GST_PARAMSPECS_H__ */
@@ -0,0 +1,115 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstparse.h: get a pipeline from a text pipeline description
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PARSE_H__
#define __GST_PARSE_H__
#include <gst/gstelement.h>
G_BEGIN_DECLS
GQuark gst_parse_error_quark (void);
/**
* GST_PARSE_ERROR:
*
* Get access to the error quark of the parse subsystem.
*/
#define GST_PARSE_ERROR gst_parse_error_quark ()
/**
* GstParseError:
* @GST_PARSE_ERROR_SYNTAX: A syntax error occured.
* @GST_PARSE_ERROR_NO_SUCH_ELEMENT: The description contained an unknown element
* @GST_PARSE_ERROR_NO_SUCH_PROPERTY: An element did not have a specified property
* @GST_PARSE_ERROR_LINK: There was an error linking two pads.
* @GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY: There was an error setting a property
* @GST_PARSE_ERROR_EMPTY_BIN: An empty bin was specified.
* @GST_PARSE_ERROR_EMPTY: An empty description was specified
*
* The different parsing errors that can occur.
*/
typedef enum
{
GST_PARSE_ERROR_SYNTAX,
GST_PARSE_ERROR_NO_SUCH_ELEMENT,
GST_PARSE_ERROR_NO_SUCH_PROPERTY,
GST_PARSE_ERROR_LINK,
GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
GST_PARSE_ERROR_EMPTY_BIN,
GST_PARSE_ERROR_EMPTY
} GstParseError;
/**
* GstParseFlags:
* @GST_PARSE_FLAG_NONE: Do not use any special parsing options.
* @GST_PARSE_FLAG_FATAL_ERRORS: Always return NULL when an error occurs
* (default behaviour is to return partially constructed bins or elements
* in some cases)
*
* Parsing options.
*/
typedef enum
{
GST_PARSE_FLAG_NONE = 0,
GST_PARSE_FLAG_FATAL_ERRORS = (1 << 0)
} GstParseFlags;
#define GST_TYPE_PARSE_CONTEXT (gst_parse_context_get_type())
/**
* GstParseContext:
*
* Opaque structure.
*/
typedef struct _GstParseContext GstParseContext;
/* create, process and free a parse context */
GType gst_parse_context_get_type (void);
GstParseContext * gst_parse_context_new (void) G_GNUC_MALLOC;
gchar ** gst_parse_context_get_missing_elements (GstParseContext * context) G_GNUC_MALLOC;
void gst_parse_context_free (GstParseContext * context);
/* parse functions */
GstElement * gst_parse_launch (const gchar * pipeline_description,
GError ** error) G_GNUC_MALLOC;
GstElement * gst_parse_launchv (const gchar ** argv,
GError ** error) G_GNUC_MALLOC;
GstElement * gst_parse_launch_full (const gchar * pipeline_description,
GstParseContext * context,
GstParseFlags flags,
GError ** error) G_GNUC_MALLOC;
GstElement * gst_parse_launchv_full (const gchar ** argv,
GstParseContext * context,
GstParseFlags flags,
GError ** error) G_GNUC_MALLOC;
G_END_DECLS
#endif /* __GST_PARSE_H__ */
@@ -0,0 +1,110 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstpipeline.h: Header for GstPipeline element
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PIPELINE_H__
#define __GST_PIPELINE_H__
#include <gst/gstbin.h>
G_BEGIN_DECLS
#define GST_TYPE_PIPELINE (gst_pipeline_get_type ())
#define GST_PIPELINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PIPELINE, GstPipeline))
#define GST_IS_PIPELINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PIPELINE))
#define GST_PIPELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PIPELINE, GstPipelineClass))
#define GST_IS_PIPELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PIPELINE))
#define GST_PIPELINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PIPELINE, GstPipelineClass))
#define GST_PIPELINE_CAST(obj) ((GstPipeline*)(obj))
typedef struct _GstPipeline GstPipeline;
typedef struct _GstPipelineClass GstPipelineClass;
typedef struct _GstPipelinePrivate GstPipelinePrivate;
/**
* GstPipelineFlags:
* @GST_PIPELINE_FLAG_FIXED_CLOCK: this pipeline works with a fixed clock
* @GST_PIPELINE_FLAG_LAST: offset to define more flags
*
* Pipeline flags
*/
typedef enum {
GST_PIPELINE_FLAG_FIXED_CLOCK = (GST_BIN_FLAG_LAST << 0),
/* padding */
GST_PIPELINE_FLAG_LAST = (GST_BIN_FLAG_LAST << 4)
} GstPipelineFlags;
/**
* GstPipeline:
* @fixed_clock: The fixed clock of the pipeline, used when
* GST_PIPELINE_FLAG_FIXED_CLOCK is set.
* @stream_time: The stream time of the pipeline. A better name for this
* property would be the running_time, the total time spent in the
* PLAYING state without being flushed. (deprecated, use the start_time
* on GstElement).
* @delay: Extra delay added to base_time to compensate for computing delays
* when setting elements to PLAYING.
*
* The #GstPipeline structure.
*/
struct _GstPipeline {
GstBin bin;
/*< public >*/ /* with LOCK */
GstClock *fixed_clock;
GstClockTime stream_time;
GstClockTime delay;
/*< private >*/
GstPipelinePrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstPipelineClass {
GstBinClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_pipeline_get_type (void);
GstElement* gst_pipeline_new (const gchar *name) G_GNUC_MALLOC;
GstBus* gst_pipeline_get_bus (GstPipeline *pipeline);
void gst_pipeline_use_clock (GstPipeline *pipeline, GstClock *clock);
gboolean gst_pipeline_set_clock (GstPipeline *pipeline, GstClock *clock);
GstClock* gst_pipeline_get_clock (GstPipeline *pipeline);
void gst_pipeline_auto_clock (GstPipeline *pipeline);
void gst_pipeline_set_delay (GstPipeline *pipeline, GstClockTime delay);
GstClockTime gst_pipeline_get_delay (GstPipeline *pipeline);
void gst_pipeline_set_auto_flush_bus (GstPipeline *pipeline, gboolean auto_flush);
gboolean gst_pipeline_get_auto_flush_bus (GstPipeline *pipeline);
G_END_DECLS
#endif /* __GST_PIPELINE_H__ */
@@ -0,0 +1,315 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstplugin.h: Header for plugin subsystem
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PLUGIN_H__
#define __GST_PLUGIN_H__
#include <gst/gstconfig.h>
#include <gst/gstobject.h>
#include <gst/gstmacros.h>
#include <gst/gststructure.h>
G_BEGIN_DECLS
/**
* GstPlugin:
*
* The opaque plugin object
*/
typedef struct _GstPlugin GstPlugin;
typedef struct _GstPluginClass GstPluginClass;
typedef struct _GstPluginDesc GstPluginDesc;
/**
* gst_plugin_error_quark:
*
* Get the error quark.
*
* Returns: The error quark used in GError messages
*/
GQuark gst_plugin_error_quark (void);
/**
* GST_PLUGIN_ERROR:
*
* The error message category quark
*/
#define GST_PLUGIN_ERROR gst_plugin_error_quark ()
/**
* GstPluginError:
* @GST_PLUGIN_ERROR_MODULE: The plugin could not be loaded
* @GST_PLUGIN_ERROR_DEPENDENCIES: The plugin has unresolved dependencies
* @GST_PLUGIN_ERROR_NAME_MISMATCH: The plugin has already be loaded from a different file
*
* The plugin loading errors
*/
typedef enum
{
GST_PLUGIN_ERROR_MODULE,
GST_PLUGIN_ERROR_DEPENDENCIES,
GST_PLUGIN_ERROR_NAME_MISMATCH
} GstPluginError;
/**
* GstPluginFlags:
* @GST_PLUGIN_FLAG_CACHED: Temporarily loaded plugins
* @GST_PLUGIN_FLAG_BLACKLISTED: The plugin won't be scanned (again)
*
* The plugin loading state
*/
typedef enum
{
GST_PLUGIN_FLAG_CACHED = (GST_OBJECT_FLAG_LAST << 0),
GST_PLUGIN_FLAG_BLACKLISTED = (GST_OBJECT_FLAG_LAST << 1)
} GstPluginFlags;
/**
* GstPluginDependencyFlags:
* @GST_PLUGIN_DEPENDENCY_FLAG_NONE : no special flags
* @GST_PLUGIN_DEPENDENCY_FLAG_RECURSE : recurse into subdirectories
* @GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY : use paths
* argument only if none of the environment variables is set
* @GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX : interpret
* filename argument as filter suffix and check all matching files in
* the directory
*
* Flags used in connection with gst_plugin_add_dependency().
*/
typedef enum {
GST_PLUGIN_DEPENDENCY_FLAG_NONE = 0,
GST_PLUGIN_DEPENDENCY_FLAG_RECURSE = (1 << 0),
GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY = (1 << 1),
GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX = (1 << 2)
} GstPluginDependencyFlags;
/**
* GstPluginInitFunc:
* @plugin: The plugin object
*
* A plugin should provide a pointer to a function of this type in the
* plugin_desc struct.
* This function will be called by the loader at startup. One would then
* register each #GstPluginFeature.
*
* Returns: %TRUE if plugin initialised successfully
*/
/* FIXME 0.11: Make return void */
typedef gboolean (*GstPluginInitFunc) (GstPlugin *plugin);
/**
* GstPluginInitFullFunc:
* @plugin: The plugin object
* @user_data: extra data
*
* A plugin should provide a pointer to a function of either #GstPluginInitFunc
* or this type in the plugin_desc struct.
* The function will be called by the loader at startup. One would then
* register each #GstPluginFeature. This version allows
* user data to be passed to init function (useful for bindings).
*
* Returns: %TRUE if plugin initialised successfully
*/
/* FIXME 0.11: Merge with GstPluginInitFunc */
typedef gboolean (*GstPluginInitFullFunc) (GstPlugin *plugin, gpointer user_data);
/**
* GstPluginDesc:
* @major_version: the major version number of core that plugin was compiled for
* @minor_version: the minor version number of core that plugin was compiled for
* @name: a unique name of the plugin
* @description: description of plugin
* @plugin_init: pointer to the init function of this plugin.
* @version: version of the plugin
* @license: effective license of plugin
* @source: source module plugin belongs to
* @package: shipped package plugin belongs to
* @origin: URL to provider of plugin
* @release_datetime: date time string in ISO 8601 format (or rather, a
* subset thereof), or NULL. Allowed are the following formats:
* "YYYY-MM-DD" and "YYY-MM-DDTHH:MMZ" (with 'T' a separator and 'Z'
* indicating UTC/Zulu time). This field should be set via the
* GST_PACKAGE_RELEASE_DATETIME preprocessor macro.
*
* A plugin should export a variable of this type called plugin_desc. The plugin
* loader will use the data provided there to initialize the plugin.
*
* The @licence parameter must be one of: LGPL, GPL, QPL, GPL/QPL, MPL,
* BSD, MIT/X11, Proprietary, unknown.
*/
struct _GstPluginDesc {
gint major_version;
gint minor_version;
const gchar *name;
const gchar *description;
GstPluginInitFunc plugin_init;
const gchar *version;
const gchar *license;
const gchar *source;
const gchar *package;
const gchar *origin;
const gchar *release_datetime;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
#define GST_TYPE_PLUGIN (gst_plugin_get_type())
#define GST_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLUGIN))
#define GST_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLUGIN))
#define GST_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLUGIN, GstPluginClass))
#define GST_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLUGIN, GstPlugin))
#define GST_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLUGIN, GstPluginClass))
#define GST_PLUGIN_CAST(obj) ((GstPlugin*)(obj))
#ifdef GST_PACKAGE_RELEASE_DATETIME
#define __GST_PACKAGE_RELEASE_DATETIME GST_PACKAGE_RELEASE_DATETIME
#else
#define __GST_PACKAGE_RELEASE_DATETIME NULL
#endif
/**
* GST_PLUGIN_DEFINE:
* @major: major version number of the gstreamer-core that plugin was compiled for
* @minor: minor version number of the gstreamer-core that plugin was compiled for
* @name: short, but unique name of the plugin
* @description: information about the purpose of the plugin
* @init: function pointer to the plugin_init method with the signature of <code>static gboolean plugin_init (GstPlugin * plugin)</code>.
* @version: full version string (e.g. VERSION from config.h)
* @license: under which licence the package has been released, e.g. GPL, LGPL.
* @package: the package-name (e.g. PACKAGE_NAME from config.h)
* @origin: a description from where the package comes from (e.g. the homepage URL)
*
* This macro needs to be used to define the entry point and meta data of a
* plugin. One would use this macro to export a plugin, so that it can be used
* by other applications.
*
* The macro uses a define named PACKAGE for the #GstPluginDesc,source field.
* When using autoconf, this is usually set automatically via the AC_INIT
* macro, and set in config.h. If you are not using autoconf, you will need to
* define PACKAGE yourself and set it to a short mnemonic string identifying
* your application/package, e.g. 'someapp' or 'my-plugins-foo.
*
* If defined, the GST_PACKAGE_RELEASE_DATETIME will also be used for the
* #GstPluginDesc,release_datetime field.
*/
#define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,package,origin) \
G_BEGIN_DECLS \
GST_PLUGIN_EXPORT GstPluginDesc gst_plugin_desc = { \
major, \
minor, \
#name, \
(gchar *) description, \
init, \
version, \
license, \
PACKAGE, \
package, \
origin, \
__GST_PACKAGE_RELEASE_DATETIME, \
GST_PADDING_INIT \
}; \
G_END_DECLS
/**
* GST_LICENSE_UNKNOWN:
*
* To be used in GST_PLUGIN_DEFINE if usure about the licence.
*/
#define GST_LICENSE_UNKNOWN "unknown"
/* function for filters */
/**
* GstPluginFilter:
* @plugin: the plugin to check
* @user_data: the user_data that has been passed on e.g. gst_registry_plugin_filter()
*
* A function that can be used with e.g. gst_registry_plugin_filter()
* to get a list of plugins that match certain criteria.
*
* Returns: TRUE for a positive match, FALSE otherwise
*/
typedef gboolean (*GstPluginFilter) (GstPlugin *plugin,
gpointer user_data);
GType gst_plugin_get_type (void);
gboolean gst_plugin_register_static (gint major_version,
gint minor_version,
const gchar *name,
const gchar *description,
GstPluginInitFunc init_func,
const gchar *version,
const gchar *license,
const gchar *source,
const gchar *package,
const gchar *origin);
gboolean gst_plugin_register_static_full (gint major_version,
gint minor_version,
const gchar *name,
const gchar *description,
GstPluginInitFullFunc init_full_func,
const gchar *version,
const gchar *license,
const gchar *source,
const gchar *package,
const gchar *origin,
gpointer user_data);
const gchar* gst_plugin_get_name (GstPlugin *plugin);
const gchar* gst_plugin_get_description (GstPlugin *plugin);
const gchar* gst_plugin_get_filename (GstPlugin *plugin);
const gchar* gst_plugin_get_version (GstPlugin *plugin);
const gchar* gst_plugin_get_license (GstPlugin *plugin);
const gchar* gst_plugin_get_source (GstPlugin *plugin);
const gchar* gst_plugin_get_package (GstPlugin *plugin);
const gchar* gst_plugin_get_origin (GstPlugin *plugin);
const gchar* gst_plugin_get_release_date_string (GstPlugin *plugin);
const GstStructure* gst_plugin_get_cache_data (GstPlugin * plugin);
void gst_plugin_set_cache_data (GstPlugin * plugin, GstStructure *cache_data);
gboolean gst_plugin_is_loaded (GstPlugin *plugin);
GstPlugin * gst_plugin_load_file (const gchar *filename, GError** error);
GstPlugin * gst_plugin_load (GstPlugin *plugin);
GstPlugin * gst_plugin_load_by_name (const gchar *name);
void gst_plugin_add_dependency (GstPlugin * plugin,
const gchar ** env_vars,
const gchar ** paths,
const gchar ** names,
GstPluginDependencyFlags flags);
void gst_plugin_add_dependency_simple (GstPlugin * plugin,
const gchar * env_vars,
const gchar * paths,
const gchar * names,
GstPluginDependencyFlags flags);
void gst_plugin_list_free (GList *list);
G_END_DECLS
#endif /* __GST_PLUGIN_H__ */
@@ -0,0 +1,145 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstpluginfeature.h: Header for base GstPluginFeature
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PLUGIN_FEATURE_H__
#define __GST_PLUGIN_FEATURE_H__
#include <glib-object.h>
#include <gst/gstobject.h>
#include <gst/gstplugin.h>
G_BEGIN_DECLS
#define GST_TYPE_PLUGIN_FEATURE (gst_plugin_feature_get_type())
#define GST_PLUGIN_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLUGIN_FEATURE, GstPluginFeature))
#define GST_IS_PLUGIN_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLUGIN_FEATURE))
#define GST_PLUGIN_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLUGIN_FEATURE, GstPluginFeatureClass))
#define GST_IS_PLUGIN_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLUGIN_FEATURE))
#define GST_PLUGIN_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLUGIN_FEATURE, GstPluginFeatureClass))
#define GST_PLUGIN_FEATURE_CAST(obj) ((GstPluginFeature*)(obj))
/**
* GstPluginFeature:
*
* Opaque #GstPluginFeature structure.
*/
typedef struct _GstPluginFeature GstPluginFeature;
typedef struct _GstPluginFeatureClass GstPluginFeatureClass;
/**
* GstRank:
* @GST_RANK_NONE: will be chosen last or not at all
* @GST_RANK_MARGINAL: unlikely to be chosen
* @GST_RANK_SECONDARY: likely to be chosen
* @GST_RANK_PRIMARY: will be chosen first
*
* Element priority ranks. Defines the order in which the autoplugger (or
* similar rank-picking mechanisms, such as e.g. gst_element_make_from_uri())
* will choose this element over an alternative one with the same function.
*
* These constants serve as a rough guidance for defining the rank of a
* #GstPluginFeature. Any value is valid, including values bigger than
* @GST_RANK_PRIMARY.
*/
typedef enum {
GST_RANK_NONE = 0,
GST_RANK_MARGINAL = 64,
GST_RANK_SECONDARY = 128,
GST_RANK_PRIMARY = 256
} GstRank;
/**
* gst_plugin_feature_get_name:
* @feature: a #GstPluginFeature to get the name of @feature.
*
* Returns the name of @feature.
* For a nameless plugin feature, this returns NULL.
*
* Returns: (transfer none): the name of @feature. MT safe.
*
*/
#define gst_plugin_feature_get_name(feature) GST_OBJECT_NAME(feature)
/**
* gst_plugin_feature_set_name:
* @feature: a #GstPluginFeature to set the name of.
* @name: the new name
*
* Sets the name of the plugin feature, getting rid of the old name if there was one.
*/
#define gst_plugin_feature_set_name(feature,name) gst_object_set_name(GST_OBJECT_CAST(feature),name)
/**
* GstPluginFeatureFilter:
* @feature: the pluginfeature to check
* @user_data: the user_data that has been passed on e.g.
* gst_registry_feature_filter()
*
* A function that can be used with e.g. gst_registry_feature_filter()
* to get a list of pluginfeature that match certain criteria.
*
* Returns: %TRUE for a positive match, %FALSE otherwise
*/
typedef gboolean (*GstPluginFeatureFilter) (GstPluginFeature *feature,
gpointer user_data);
/* normal GObject stuff */
GType gst_plugin_feature_get_type (void);
GstPluginFeature *
gst_plugin_feature_load (GstPluginFeature *feature);
void gst_plugin_feature_set_rank (GstPluginFeature *feature, guint rank);
guint gst_plugin_feature_get_rank (GstPluginFeature *feature);
GstPlugin * gst_plugin_feature_get_plugin (GstPluginFeature *feature);
void gst_plugin_feature_list_free (GList *list);
GList *gst_plugin_feature_list_copy (GList *list) G_GNUC_MALLOC;
void gst_plugin_feature_list_debug (GList *list);
/**
* GST_PLUGIN_FEATURE_LIST_DEBUG:
* @list: (transfer none) (element-type Gst.PluginFeature): a #GList of
* plugin features
*
* Debug the plugin feature names in @list.
*/
#ifndef GST_DISABLE_GST_DEBUG
#define GST_PLUGIN_FEATURE_LIST_DEBUG(list) gst_plugin_feature_list_debug(list)
#else
#define GST_PLUGIN_FEATURE_LIST_DEBUG(list)
#endif
gboolean gst_plugin_feature_check_version (GstPluginFeature *feature,
guint min_major,
guint min_minor,
guint min_micro);
gint gst_plugin_feature_rank_compare_func (gconstpointer p1,
gconstpointer p2);
G_END_DECLS
#endif /* __GST_PLUGIN_FEATURE_H__ */
@@ -0,0 +1,95 @@
/* GStreamer
* Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) 2004 Wim Taymans <wim.taymans@gmail.com>
* Copyright (C) 2007 Peter Kjellerstedt <pkj@axis.com>
*
* gstpoll.h: File descriptor set
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_POLL_H__
#define __GST_POLL_H__
#include <glib.h>
#include <glib-object.h>
#include <gst/gstclock.h>
G_BEGIN_DECLS
/**
* GstPoll:
*
* A set of file/network descriptors.
*/
typedef struct _GstPoll GstPoll;
/**
* GstPollFD:
* @fd: a file descriptor
*
* A file descriptor object.
*/
typedef struct {
int fd;
/*< private >*/
gint idx;
} GstPollFD;
/**
* GST_POLL_FD_INIT:
*
* A #GstPollFD must be initialized with this macro, before it can be
* used. This macro can used be to initialize a variable, but it cannot
* be assigned to a variable. In that case you have to use
* gst_poll_fd_init().
*/
#define GST_POLL_FD_INIT { -1, -1 }
GstPoll* gst_poll_new (gboolean controllable) G_GNUC_MALLOC;
GstPoll* gst_poll_new_timer (void) G_GNUC_MALLOC;
void gst_poll_free (GstPoll *set);
void gst_poll_get_read_gpollfd (GstPoll *set, GPollFD *fd);
void gst_poll_fd_init (GstPollFD *fd);
gboolean gst_poll_add_fd (GstPoll *set, GstPollFD *fd);
gboolean gst_poll_remove_fd (GstPoll *set, GstPollFD *fd);
gboolean gst_poll_fd_ctl_write (GstPoll *set, GstPollFD *fd, gboolean active);
gboolean gst_poll_fd_ctl_read (GstPoll *set, GstPollFD *fd, gboolean active);
void gst_poll_fd_ignored (GstPoll *set, GstPollFD *fd);
gboolean gst_poll_fd_has_closed (const GstPoll *set, GstPollFD *fd);
gboolean gst_poll_fd_has_error (const GstPoll *set, GstPollFD *fd);
gboolean gst_poll_fd_can_read (const GstPoll *set, GstPollFD *fd);
gboolean gst_poll_fd_can_write (const GstPoll *set, GstPollFD *fd);
gint gst_poll_wait (GstPoll *set, GstClockTime timeout);
gboolean gst_poll_set_controllable (GstPoll *set, gboolean controllable);
void gst_poll_restart (GstPoll *set);
void gst_poll_set_flushing (GstPoll *set, gboolean flushing);
gboolean gst_poll_write_control (GstPoll *set);
gboolean gst_poll_read_control (GstPoll *set);
G_END_DECLS
#endif /* __GST_POLL_H__ */
@@ -0,0 +1,102 @@
/* GStreamer
* Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
*
* gstpreset.h: helper interface header for element presets
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PRESET_H__
#define __GST_PRESET_H__
#include <glib-object.h>
#include <gst/gstconfig.h>
G_BEGIN_DECLS
#define GST_TYPE_PRESET (gst_preset_get_type())
#define GST_PRESET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PRESET, GstPreset))
#define GST_IS_PRESET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PRESET))
#define GST_PRESET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PRESET, GstPresetInterface))
/**
* GstPreset:
*
* Opaque #GstPreset data structure.
*/
typedef struct _GstPreset GstPreset; /* dummy object */
typedef struct _GstPresetInterface GstPresetInterface;
/**
* GstPresetInterface:
* @parent: parent interface type.
* @get_preset_names: virtual method to get list of presets
* @get_property_names: virtual methods to get properties that are persistent
* @load_preset: virtual methods to load a preset into properties
* @save_preset: virtual methods to save properties into a preset
* @rename_preset: virtual methods to rename a preset
* @delete_preset: virtual methods to remove a preset
* @set_meta: virtual methods to set textual meta data to a preset
* @get_meta: virtual methods to get textual meta data from a preset
*
* #GstPreset interface.
*/
struct _GstPresetInterface
{
GTypeInterface parent;
/* methods */
gchar** (*get_preset_names) (GstPreset *preset);
gchar** (*get_property_names) (GstPreset *preset);
gboolean (*load_preset) (GstPreset *preset, const gchar *name);
gboolean (*save_preset) (GstPreset *preset, const gchar *name);
gboolean (*rename_preset) (GstPreset *preset, const gchar *old_name,
const gchar *new_name);
gboolean (*delete_preset) (GstPreset *preset, const gchar *name);
gboolean (*set_meta) (GstPreset *preset, const gchar *name,
const gchar *tag, const gchar *value);
gboolean (*get_meta) (GstPreset *preset, const gchar *name,
const gchar *tag, gchar **value);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_preset_get_type(void);
gchar** gst_preset_get_preset_names (GstPreset *preset) G_GNUC_MALLOC;
gchar** gst_preset_get_property_names (GstPreset *preset) G_GNUC_MALLOC;
gboolean gst_preset_load_preset (GstPreset *preset, const gchar *name);
gboolean gst_preset_save_preset (GstPreset *preset, const gchar *name);
gboolean gst_preset_rename_preset (GstPreset *preset, const gchar *old_name,
const gchar *new_name);
gboolean gst_preset_delete_preset (GstPreset *preset, const gchar *name);
gboolean gst_preset_set_meta (GstPreset *preset, const gchar *name,
const gchar *tag, const gchar *value);
gboolean gst_preset_get_meta (GstPreset *preset, const gchar *name,
const gchar *tag, gchar **value);
gboolean gst_preset_set_app_dir (const gchar *app_dir);
const gchar *gst_preset_get_app_dir (void);
G_END_DECLS
#endif /* __GST_PRESET_H__ */
@@ -0,0 +1,481 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
* 2005 Wim Taymans <wim@fluendo.com>
* 2011 Wim Taymans <wim.taymans@gmail.com>
*
* gstquery.h: GstQuery API declaration
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_QUERY_H__
#define __GST_QUERY_H__
#include <glib.h>
#include <gst/gstiterator.h>
#include <gst/gstminiobject.h>
#include <gst/gststructure.h>
#include <gst/gstformat.h>
#include <gst/gstpad.h>
#include <gst/gstallocator.h>
#include <gst/gsttoc.h>
G_BEGIN_DECLS
typedef struct _GstQuery GstQuery;
/**
* GstQueryTypeFlags:
* @GST_QUERY_TYPE_UPSTREAM: Set if the query can travel upstream.
* @GST_QUERY_TYPE_DOWNSTREAM: Set if the query can travel downstream.
* @GST_QUERY_TYPE_SERIALIZED: Set if the query should be serialized with data
* flow.
*
* #GstQueryTypeFlags indicate the aspects of the different #GstQueryType
* values. You can get the type flags of a #GstQueryType with the
* gst_query_type_get_flags() function.
*/
typedef enum {
GST_QUERY_TYPE_UPSTREAM = 1 << 0,
GST_QUERY_TYPE_DOWNSTREAM = 1 << 1,
GST_QUERY_TYPE_SERIALIZED = 1 << 2
} GstQueryTypeFlags;
/**
* GST_QUERY_TYPE_BOTH:
*
* The same thing as #GST_QUERY_TYPE_UPSTREAM | #GST_QUERY_TYPE_DOWNSTREAM.
*/
#define GST_QUERY_TYPE_BOTH \
(GST_QUERY_TYPE_UPSTREAM | GST_QUERY_TYPE_DOWNSTREAM)
#define GST_QUERY_NUM_SHIFT (8)
/**
* GST_QUERY_MAKE_TYPE:
* @num: the query number to create
* @flags: the query flags
*
* when making custom query types, use this macro with the num and
* the given flags
*/
#define GST_QUERY_MAKE_TYPE(num,flags) \
(((num) << GST_QUERY_NUM_SHIFT) | (flags))
#define FLAG(name) GST_QUERY_TYPE_##name
/**
* GstQueryType:
* @GST_QUERY_UNKNOWN: unknown query type
* @GST_QUERY_POSITION: current position in stream
* @GST_QUERY_DURATION: total duration of the stream
* @GST_QUERY_LATENCY: latency of stream
* @GST_QUERY_JITTER: current jitter of stream
* @GST_QUERY_RATE: current rate of the stream
* @GST_QUERY_SEEKING: seeking capabilities
* @GST_QUERY_SEGMENT: segment start/stop positions
* @GST_QUERY_CONVERT: convert values between formats
* @GST_QUERY_FORMATS: query supported formats for convert
* @GST_QUERY_BUFFERING: query available media for efficient seeking.
* @GST_QUERY_CUSTOM: a custom application or element defined query.
* @GST_QUERY_URI: query the URI of the source or sink.
* @GST_QUERY_ALLOCATION: the buffer allocation properties
* @GST_QUERY_SCHEDULING: the scheduling properties
* @GST_QUERY_ACCEPT_CAPS: the accept caps query
* @GST_QUERY_CAPS: the caps query
* @GST_QUERY_DRAIN: wait till all serialized data is consumed downstream
*
* Standard predefined Query types
*/
/* NOTE: don't forget to update the table in gstquery.c when changing
* this enum */
typedef enum {
GST_QUERY_UNKNOWN = GST_QUERY_MAKE_TYPE (0, 0),
GST_QUERY_POSITION = GST_QUERY_MAKE_TYPE (10, FLAG(BOTH)),
GST_QUERY_DURATION = GST_QUERY_MAKE_TYPE (20, FLAG(BOTH)),
GST_QUERY_LATENCY = GST_QUERY_MAKE_TYPE (30, FLAG(BOTH)),
GST_QUERY_JITTER = GST_QUERY_MAKE_TYPE (40, FLAG(BOTH)),
GST_QUERY_RATE = GST_QUERY_MAKE_TYPE (50, FLAG(BOTH)),
GST_QUERY_SEEKING = GST_QUERY_MAKE_TYPE (60, FLAG(BOTH)),
GST_QUERY_SEGMENT = GST_QUERY_MAKE_TYPE (70, FLAG(BOTH)),
GST_QUERY_CONVERT = GST_QUERY_MAKE_TYPE (80, FLAG(BOTH)),
GST_QUERY_FORMATS = GST_QUERY_MAKE_TYPE (90, FLAG(BOTH)),
GST_QUERY_BUFFERING = GST_QUERY_MAKE_TYPE (110, FLAG(BOTH)),
GST_QUERY_CUSTOM = GST_QUERY_MAKE_TYPE (120, FLAG(BOTH)),
GST_QUERY_URI = GST_QUERY_MAKE_TYPE (130, FLAG(BOTH)),
GST_QUERY_ALLOCATION = GST_QUERY_MAKE_TYPE (140, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
GST_QUERY_SCHEDULING = GST_QUERY_MAKE_TYPE (150, FLAG(UPSTREAM)),
GST_QUERY_ACCEPT_CAPS = GST_QUERY_MAKE_TYPE (160, FLAG(BOTH)),
GST_QUERY_CAPS = GST_QUERY_MAKE_TYPE (170, FLAG(BOTH)),
GST_QUERY_DRAIN = GST_QUERY_MAKE_TYPE (180, FLAG(DOWNSTREAM) | FLAG(SERIALIZED))
} GstQueryType;
#undef FLAG
#define GST_TYPE_QUERY (gst_query_get_type())
#define GST_IS_QUERY(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_QUERY))
#define GST_QUERY_CAST(obj) ((GstQuery*)(obj))
#define GST_QUERY(obj) (GST_QUERY_CAST(obj))
/**
* GST_QUERY_TYPE:
* @query: the query to query
*
* Get the #GstQueryType of the query.
*/
#define GST_QUERY_TYPE(query) (((GstQuery*)(query))->type)
/**
* GST_QUERY_TYPE_NAME:
* @query: the query to query
*
* Get a constant string representation of the #GstQueryType of the query.
*/
#define GST_QUERY_TYPE_NAME(query) (gst_query_type_get_name(GST_QUERY_TYPE(query)))
/**
* GST_QUERY_IS_UPSTREAM:
* @ev: the query to query
*
* Check if an query can travel upstream.
*/
#define GST_QUERY_IS_UPSTREAM(ev) !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_UPSTREAM)
/**
* GST_QUERY_IS_DOWNSTREAM:
* @ev: the query to query
*
* Check if an query can travel downstream.
*/
#define GST_QUERY_IS_DOWNSTREAM(ev) !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_DOWNSTREAM)
/**
* GST_QUERY_IS_SERIALIZED:
* @ev: the query to query
*
* Check if an query is serialized with the data stream.
*/
#define GST_QUERY_IS_SERIALIZED(ev) !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_SERIALIZED)
/**
* GstQuery:
* @mini_object: The parent #GstMiniObject type
* @type: the #GstQueryType
*
* The #GstQuery structure.
*/
struct _GstQuery
{
GstMiniObject mini_object;
/*< public > *//* with COW */
GstQueryType type;
};
const gchar* gst_query_type_get_name (GstQueryType type);
GQuark gst_query_type_to_quark (GstQueryType type);
GstQueryTypeFlags
gst_query_type_get_flags (GstQueryType type);
GType gst_query_get_type (void);
/* refcounting */
/**
* gst_query_ref:
* @q: a #GstQuery to increase the refcount of.
*
* Increases the refcount of the given query by one.
*
* Returns: @q
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstQuery * gst_query_ref (GstQuery * q);
#endif
static inline GstQuery *
gst_query_ref (GstQuery * q)
{
return GST_QUERY_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (q)));
}
/**
* gst_query_unref:
* @q: a #GstQuery to decrease the refcount of.
*
* Decreases the refcount of the query. If the refcount reaches 0, the query
* will be freed.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void gst_query_unref (GstQuery * q);
#endif
static inline void
gst_query_unref (GstQuery * q)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (q));
}
/* copy query */
/**
* gst_query_copy:
* @q: a #GstQuery to copy.
*
* Copies the given query using the copy function of the parent #GstStructure.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new copy of @q.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstQuery * gst_query_copy (const GstQuery * q);
#endif
static inline GstQuery *
gst_query_copy (const GstQuery * q)
{
return GST_QUERY_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (q)));
}
/**
* gst_query_is_writable:
* @q: a #GstQuery
*
* Tests if you can safely write data into a query's structure.
*/
#define gst_query_is_writable(q) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (q))
/**
* gst_query_make_writable:
* @q: (transfer full): a #GstQuery to make writable
*
* Makes a writable query from the given query.
*
* Returns: (transfer full): a new writable query (possibly same as @q)
*/
#define gst_query_make_writable(q) GST_QUERY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (q)))
/**
* gst_query_replace:
* @old_query: (inout) (transfer full): pointer to a pointer to a #GstQuery
* to be replaced.
* @new_query: (allow-none) (transfer none): pointer to a #GstQuery that will
* replace the query pointed to by @old_query.
*
* Modifies a pointer to a #GstQuery to point to a different #GstQuery. The
* modification is done atomically (so this is useful for ensuring thread safety
* in some cases), and the reference counts are updated appropriately (the old
* query is unreffed, the new one is reffed).
*
* Either @new_query or the #GstQuery pointed to by @old_query may be NULL.
*
* Returns: TRUE if @new_query was different from @old_query
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC gboolean gst_query_replace (GstQuery **old_query, GstQuery *new_query);
#endif
static inline gboolean
gst_query_replace (GstQuery **old_query, GstQuery *new_query)
{
return gst_mini_object_replace ((GstMiniObject **) old_query, (GstMiniObject *) new_query);
}
/* application specific query */
GstQuery * gst_query_new_custom (GstQueryType type, GstStructure *structure) G_GNUC_MALLOC;
const GstStructure *
gst_query_get_structure (GstQuery *query);
GstStructure * gst_query_writable_structure (GstQuery *query);
/* position query */
GstQuery* gst_query_new_position (GstFormat format) G_GNUC_MALLOC;
void gst_query_set_position (GstQuery *query, GstFormat format, gint64 cur);
void gst_query_parse_position (GstQuery *query, GstFormat *format, gint64 *cur);
/* duration query */
GstQuery* gst_query_new_duration (GstFormat format) G_GNUC_MALLOC;
void gst_query_set_duration (GstQuery *query, GstFormat format, gint64 duration);
void gst_query_parse_duration (GstQuery *query, GstFormat *format, gint64 *duration);
/* latency query */
GstQuery* gst_query_new_latency (void) G_GNUC_MALLOC;
void gst_query_set_latency (GstQuery *query, gboolean live, GstClockTime min_latency,
GstClockTime max_latency);
void gst_query_parse_latency (GstQuery *query, gboolean *live, GstClockTime *min_latency,
GstClockTime *max_latency);
/* convert query */
GstQuery* gst_query_new_convert (GstFormat src_format, gint64 value, GstFormat dest_format) G_GNUC_MALLOC;
void gst_query_set_convert (GstQuery *query, GstFormat src_format, gint64 src_value,
GstFormat dest_format, gint64 dest_value);
void gst_query_parse_convert (GstQuery *query, GstFormat *src_format, gint64 *src_value,
GstFormat *dest_format, gint64 *dest_value);
/* segment query */
GstQuery* gst_query_new_segment (GstFormat format) G_GNUC_MALLOC;
void gst_query_set_segment (GstQuery *query, gdouble rate, GstFormat format,
gint64 start_value, gint64 stop_value);
void gst_query_parse_segment (GstQuery *query, gdouble *rate, GstFormat *format,
gint64 *start_value, gint64 *stop_value);
/* seeking query */
GstQuery* gst_query_new_seeking (GstFormat format) G_GNUC_MALLOC;
void gst_query_set_seeking (GstQuery *query, GstFormat format,
gboolean seekable,
gint64 segment_start,
gint64 segment_end);
void gst_query_parse_seeking (GstQuery *query, GstFormat *format,
gboolean *seekable,
gint64 *segment_start,
gint64 *segment_end);
/* formats query */
GstQuery* gst_query_new_formats (void) G_GNUC_MALLOC;
void gst_query_set_formats (GstQuery *query, gint n_formats, ...);
void gst_query_set_formatsv (GstQuery *query, gint n_formats, const GstFormat *formats);
void gst_query_parse_n_formats (GstQuery *query, guint *n_formats);
void gst_query_parse_nth_format (GstQuery *query, guint nth, GstFormat *format);
/* buffering query */
/**
* GstBufferingMode:
* @GST_BUFFERING_STREAM: a small amount of data is buffered
* @GST_BUFFERING_DOWNLOAD: the stream is being downloaded
* @GST_BUFFERING_TIMESHIFT: the stream is being downloaded in a ringbuffer
* @GST_BUFFERING_LIVE: the stream is a live stream
*
* The different types of buffering methods.
*/
typedef enum {
GST_BUFFERING_STREAM,
GST_BUFFERING_DOWNLOAD,
GST_BUFFERING_TIMESHIFT,
GST_BUFFERING_LIVE
} GstBufferingMode;
GstQuery* gst_query_new_buffering (GstFormat format) G_GNUC_MALLOC;
void gst_query_set_buffering_percent (GstQuery *query, gboolean busy, gint percent);
void gst_query_parse_buffering_percent (GstQuery *query, gboolean *busy, gint *percent);
void gst_query_set_buffering_stats (GstQuery *query, GstBufferingMode mode,
gint avg_in, gint avg_out,
gint64 buffering_left);
void gst_query_parse_buffering_stats (GstQuery *query, GstBufferingMode *mode,
gint *avg_in, gint *avg_out,
gint64 *buffering_left);
void gst_query_set_buffering_range (GstQuery *query, GstFormat format,
gint64 start, gint64 stop,
gint64 estimated_total);
void gst_query_parse_buffering_range (GstQuery *query, GstFormat *format,
gint64 *start, gint64 *stop,
gint64 *estimated_total);
gboolean gst_query_add_buffering_range (GstQuery *query,
gint64 start, gint64 stop);
guint gst_query_get_n_buffering_ranges (GstQuery *query);
gboolean gst_query_parse_nth_buffering_range (GstQuery *query,
guint index, gint64 *start,
gint64 *stop);
/* URI query */
GstQuery * gst_query_new_uri (void) G_GNUC_MALLOC;
void gst_query_parse_uri (GstQuery *query, gchar **uri);
void gst_query_set_uri (GstQuery *query, const gchar *uri);
/* allocation query */
GstQuery * gst_query_new_allocation (GstCaps *caps, gboolean need_pool) G_GNUC_MALLOC;
void gst_query_parse_allocation (GstQuery *query, GstCaps **caps, gboolean *need_pool);
/* pools */
void gst_query_add_allocation_pool (GstQuery *query, GstBufferPool *pool,
guint size, guint min_buffers,
guint max_buffers);
guint gst_query_get_n_allocation_pools (GstQuery *query);
void gst_query_parse_nth_allocation_pool (GstQuery *query, guint index,
GstBufferPool **pool,
guint *size, guint *min_buffers,
guint *max_buffers);
void gst_query_set_nth_allocation_pool (GstQuery *query, guint index,
GstBufferPool *pool,
guint size, guint min_buffers,
guint max_buffers);
/* allocators */
void gst_query_add_allocation_param (GstQuery *query, GstAllocator *allocator,
const GstAllocationParams *params);
guint gst_query_get_n_allocation_params (GstQuery *query);
void gst_query_parse_nth_allocation_param (GstQuery *query, guint index,
GstAllocator **allocator,
GstAllocationParams *params);
void gst_query_set_nth_allocation_param (GstQuery *query, guint index,
GstAllocator *allocator,
const GstAllocationParams *params);
/* metadata */
void gst_query_add_allocation_meta (GstQuery *query, GType api, const GstStructure *params);
guint gst_query_get_n_allocation_metas (GstQuery *query);
GType gst_query_parse_nth_allocation_meta (GstQuery *query, guint index,
const GstStructure **params);
void gst_query_remove_nth_allocation_meta (GstQuery *query, guint index);
gboolean gst_query_find_allocation_meta (GstQuery *query, GType api, guint *index);
/* scheduling query */
/**
* GstSchedulingFlags:
* @GST_SCHEDULING_FLAG_SEEKABLE: if seeking is possible
* @GST_SCHEDULING_FLAG_SEQUENTIAL: if sequential access is recommended
*
* The different scheduling flags.
*/
typedef enum {
GST_SCHEDULING_FLAG_SEEKABLE = (1 << 0),
GST_SCHEDULING_FLAG_SEQUENTIAL = (1 << 1)
} GstSchedulingFlags;
GstQuery * gst_query_new_scheduling (void) G_GNUC_MALLOC;
void gst_query_set_scheduling (GstQuery *query, GstSchedulingFlags flags,
gint minsize, gint maxsize, gint align);
void gst_query_parse_scheduling (GstQuery *query, GstSchedulingFlags *flags,
gint *minsize, gint *maxsize, gint *align);
void gst_query_add_scheduling_mode (GstQuery *query, GstPadMode mode);
guint gst_query_get_n_scheduling_modes (GstQuery *query);
GstPadMode gst_query_parse_nth_scheduling_mode (GstQuery *query, guint index);
gboolean gst_query_has_scheduling_mode (GstQuery *query, GstPadMode mode);
gboolean gst_query_has_scheduling_mode_with_flags (GstQuery * query, GstPadMode mode,
GstSchedulingFlags flags);
/* accept-caps query */
GstQuery * gst_query_new_accept_caps (GstCaps *caps) G_GNUC_MALLOC;
void gst_query_parse_accept_caps (GstQuery *query, GstCaps **caps);
void gst_query_set_accept_caps_result (GstQuery *query, gboolean result);
void gst_query_parse_accept_caps_result (GstQuery *query, gboolean *result);
/* caps query */
GstQuery * gst_query_new_caps (GstCaps *filter) G_GNUC_MALLOC;
void gst_query_parse_caps (GstQuery *query, GstCaps **filter);
void gst_query_set_caps_result (GstQuery *query, GstCaps *caps);
void gst_query_parse_caps_result (GstQuery *query, GstCaps **caps);
/* drain query */
GstQuery * gst_query_new_drain (void) G_GNUC_MALLOC;
G_END_DECLS
#endif /* __GST_QUERY_H__ */
@@ -0,0 +1,105 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
*
* gstregistry.h: Header for registry handling
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_REGISTRY_H__
#define __GST_REGISTRY_H__
#include <gst/gstconfig.h>
#include <gst/gstplugin.h>
#include <gst/gstpluginfeature.h>
G_BEGIN_DECLS
#define GST_TYPE_REGISTRY (gst_registry_get_type ())
#define GST_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_REGISTRY, GstRegistry))
#define GST_IS_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_REGISTRY))
#define GST_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_REGISTRY, GstRegistryClass))
#define GST_IS_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_REGISTRY))
#define GST_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_REGISTRY, GstRegistryClass))
typedef struct _GstRegistry GstRegistry;
typedef struct _GstRegistryClass GstRegistryClass;
typedef struct _GstRegistryPrivate GstRegistryPrivate;
/**
* GstRegistry:
*
* Opaque #GstRegistry structure.
*/
struct _GstRegistry {
GstObject object;
/*< private >*/
GstRegistryPrivate *priv;
};
struct _GstRegistryClass {
GstObjectClass parent_class;
};
GType gst_registry_get_type (void);
GstRegistry * gst_registry_get (void);
gboolean gst_registry_scan_path (GstRegistry *registry, const gchar *path);
#if 0
void gst_registry_add_path (GstRegistry * registry, const gchar * path);
GList* gst_registry_get_path_list (GstRegistry *registry);
#endif
gboolean gst_registry_add_plugin (GstRegistry *registry, GstPlugin *plugin);
void gst_registry_remove_plugin (GstRegistry *registry, GstPlugin *plugin);
gboolean gst_registry_add_feature (GstRegistry * registry, GstPluginFeature * feature);
void gst_registry_remove_feature (GstRegistry * registry, GstPluginFeature * feature);
GList* gst_registry_get_plugin_list (GstRegistry *registry);
GList* gst_registry_plugin_filter (GstRegistry *registry,
GstPluginFilter filter,
gboolean first,
gpointer user_data);
GList* gst_registry_feature_filter (GstRegistry *registry,
GstPluginFeatureFilter filter,
gboolean first,
gpointer user_data);
GList * gst_registry_get_feature_list (GstRegistry *registry,
GType type);
GList * gst_registry_get_feature_list_by_plugin (GstRegistry *registry, const gchar *name);
guint32 gst_registry_get_feature_list_cookie (GstRegistry *registry);
GstPlugin* gst_registry_find_plugin (GstRegistry *registry, const gchar *name);
GstPluginFeature* gst_registry_find_feature (GstRegistry *registry, const gchar *name, GType type);
GstPlugin * gst_registry_lookup (GstRegistry *registry, const char *filename);
GstPluginFeature * gst_registry_lookup_feature (GstRegistry *registry, const char *name);
gboolean gst_registry_check_feature_version (GstRegistry *registry,
const gchar *feature_name,
guint min_major,
guint min_minor,
guint min_micro);
G_END_DECLS
#endif /* __GST_REGISTRY_H__ */
@@ -0,0 +1,129 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstsample.h: Header for GstSample object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_SAMPLE_H__
#define __GST_SAMPLE_H__
#include <gst/gstbuffer.h>
#include <gst/gstcaps.h>
#include <gst/gstsegment.h>
G_BEGIN_DECLS
GST_EXPORT GType _gst_sample_type;
#define GST_TYPE_SAMPLE (_gst_sample_type)
#define GST_IS_SAMPLE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_SAMPLE))
#define GST_SAMPLE_CAST(obj) ((GstSample *)obj)
#define GST_SAMPLE(obj) (GST_SAMPLE_CAST(obj))
/**
* GstSample:
*
* The opaque structure of a #GstSample. A sample contains a typed memory
* block and the associated timing information. It is mainly used to
* exchange buffers with an application.
*/
typedef struct _GstSample GstSample;
GType gst_sample_get_type (void);
/* allocation */
GstSample * gst_sample_new (GstBuffer *buffer,
GstCaps *caps,
const GstSegment *segment,
GstStructure *info);
GstBuffer * gst_sample_get_buffer (GstSample *sample);
GstCaps * gst_sample_get_caps (GstSample *sample);
GstSegment * gst_sample_get_segment (GstSample *sample);
const GstStructure * gst_sample_get_info (GstSample *sample);
/* refcounting */
/**
* gst_sample_ref:
* @sample: a #GstSample
*
* Increases the refcount of the given sample by one.
*
* Returns: (transfer full): @sample
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstSample * gst_sample_ref (GstSample * sample);
#endif
static inline GstSample *
gst_sample_ref (GstSample * sample)
{
return GST_SAMPLE_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (
sample)));
}
/**
* gst_sample_unref:
* @sample: (transfer full): a #GstSample
*
* Decreases the refcount of the sample. If the refcount reaches 0, the
* sample will be freed.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void gst_sample_unref (GstSample * sample);
#endif
static inline void
gst_sample_unref (GstSample * sample)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (sample));
}
/**
* gst_value_set_sample:
* @v: a #GValue to receive the data
* @b: (transfer none): a #GstSample to assign to the GstValue
*
* Sets @b as the value of @v. Caller retains reference to sample.
*/
#define gst_value_set_sample(v,b) g_value_set_boxed((v),(b))
/**
* gst_value_take_sample:
* @v: a #GValue to receive the data
* @b: (transfer full): a #GstSample to assign to the GstValue
*
* Sets @b as the value of @v. Caller gives away reference to sample.
*/
#define gst_value_take_sample(v,b) g_value_take_boxed(v,(b))
/**
* gst_value_get_sample:
* @v: a #GValue to query
*
* Receives a #GstSample as the value of @v. Does not return a reference to
* the sample, so the pointer is only valid for as long as the caller owns
* a reference to @v.
*
* Returns: (transfer none): sample
*/
#define gst_value_get_sample(v) GST_SAMPLE_CAST (g_value_get_boxed(v))
G_END_DECLS
#endif /* __GST_SAMPLE_H__ */
@@ -0,0 +1,205 @@
/* GStreamer
* Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
*
* gstsegment.h: Header for GstSegment subsystem
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_SEGMENT_H__
#define __GST_SEGMENT_H__
#include <gst/gstformat.h>
G_BEGIN_DECLS
#define GST_TYPE_SEGMENT (gst_segment_get_type())
typedef struct _GstSegment GstSegment;
/**
* GstSeekType:
* @GST_SEEK_TYPE_NONE: no change in position is required
* @GST_SEEK_TYPE_SET: absolute position is requested
* @GST_SEEK_TYPE_END: relative position to duration is requested
*
* The different types of seek events. When constructing a seek event with
* gst_event_new_seek() or when doing gst_segment_do_seek ().
*/
typedef enum {
/* one of these */
GST_SEEK_TYPE_NONE = 0,
GST_SEEK_TYPE_SET = 1,
GST_SEEK_TYPE_END = 2
} GstSeekType;
/**
* GstSeekFlags:
* @GST_SEEK_FLAG_NONE: no flag
* @GST_SEEK_FLAG_FLUSH: flush pipeline
* @GST_SEEK_FLAG_ACCURATE: accurate position is requested, this might
* be considerably slower for some formats.
* @GST_SEEK_FLAG_KEY_UNIT: seek to the nearest keyframe. This might be
* faster but less accurate.
* @GST_SEEK_FLAG_SEGMENT: perform a segment seek.
* @GST_SEEK_FLAG_SKIP: when doing fast foward or fast reverse playback, allow
* elements to skip frames instead of generating all
* frames.
* @GST_SEEK_FLAG_SNAP_BEFORE: go to a location before the requested position,
* if KEY_UNIT this means the keyframe at or before the
* requested position the one at or before the seek target.
* @GST_SEEK_FLAG_SNAP_AFTER: go to a location after the requested position,
* if KEY_UNIT this means the keyframe at of after the
* requested position.
* @GST_SEEK_FLAG_SNAP_NEAREST: go to a position near the requested position,
* if KEY_UNIT this means the keyframe closest to the
* requested position, if both keyframes are at an equal
* distance, behaves like SNAP_BEFORE.
*
* Flags to be used with gst_element_seek() or gst_event_new_seek(). All flags
* can be used together.
*
* A non flushing seek might take some time to perform as the currently
* playing data in the pipeline will not be cleared.
*
* An accurate seek might be slower for formats that don't have any indexes
* or timestamp markers in the stream. Specifying this flag might require a
* complete scan of the file in those cases.
*
* When performing a segment seek: after the playback of the segment completes,
* no EOS will be emmited by the element that performed the seek, but a
* #GST_MESSAGE_SEGMENT_DONE message will be posted on the bus by the element.
* When this message is posted, it is possible to send a new seek event to
* continue playback. With this seek method it is possible to perform seamless
* looping or simple linear editing.
*
* When doing fast forward (rate > 1.0) or fast reverse (rate < -1.0) trickmode
* playback, the @GST_SEEK_FLAG_SKIP flag can be used to instruct decoders
* and demuxers to adjust the playback rate by skipping frames. This can improve
* performance and decrease CPU usage because not all frames need to be decoded.
*
* The @GST_SEEK_FLAG_SNAP_BEFORE flag can be used to snap to the previous
* relevant location, and the @GST_SEEK_FLAG_SNAP_AFTER flag can be used to
* select the next relevant location. If KEY_UNIT is specified, the relevant
* location is a keyframe. If both flags are specified, the nearest of these
* locations will be selected. If none are specified, the implementation is
* free to select whichever it wants.
* The before and after here are in running time, so when playing backwards,
* the next location refers to the one that will played in next, and not the
* one that is located after in the actual source stream.
*
* Also see part-seeking.txt in the GStreamer design documentation for more
* details on the meaning of these flags and the behaviour expected of
* elements that handle them.
*/
typedef enum {
GST_SEEK_FLAG_NONE = 0,
GST_SEEK_FLAG_FLUSH = (1 << 0),
GST_SEEK_FLAG_ACCURATE = (1 << 1),
GST_SEEK_FLAG_KEY_UNIT = (1 << 2),
GST_SEEK_FLAG_SEGMENT = (1 << 3),
GST_SEEK_FLAG_SKIP = (1 << 4),
GST_SEEK_FLAG_SNAP_BEFORE = (1 << 5),
GST_SEEK_FLAG_SNAP_AFTER = (1 << 6),
GST_SEEK_FLAG_SNAP_NEAREST = GST_SEEK_FLAG_SNAP_BEFORE | GST_SEEK_FLAG_SNAP_AFTER,
/* Careful to restart next flag with 1<<7 here */
} GstSeekFlags;
/**
* GstSegmentFlags:
* @GST_SEGMENT_FLAG_NONE: no flags
* @GST_SEGMENT_FLAG_RESET: reset the pipeline running_time to the segment
* running_time
* @GST_SEGMENT_FLAG_SKIP: perform skip playback
* @GST_SEGMENT_FLAG_SEGMENT: send SEGMENT_DONE instead of EOS
*
* Flags for the GstSegment structure. Currently mapped to the corresponding
* values of the seek flags.
*/
/* Note: update gst_segment_do_seek() when adding new flags here */
typedef enum { /*< flags >*/
GST_SEGMENT_FLAG_NONE = GST_SEEK_FLAG_NONE,
GST_SEGMENT_FLAG_RESET = GST_SEEK_FLAG_FLUSH,
GST_SEGMENT_FLAG_SKIP = GST_SEEK_FLAG_SKIP,
GST_SEGMENT_FLAG_SEGMENT = GST_SEEK_FLAG_SEGMENT
} GstSegmentFlags;
/**
* GstSegment:
* @flags: flags for this segment
* @rate: the rate of the segment
* @applied_rate: the already applied rate to the segment
* @format: the format of the segment values
* @base: the base of the segment
* @offset: the offset to apply to @start or @stop
* @start: the start of the segment
* @stop: the stop of the segment
* @time: the stream time of the segment
* @position: the position in the segment
* @duration: the duration of the segment
*
* A helper structure that holds the configured region of
* interest in a media file.
*/
struct _GstSegment {
/*< public >*/
GstSegmentFlags flags;
gdouble rate;
gdouble applied_rate;
GstFormat format;
guint64 base;
guint64 offset;
guint64 start;
guint64 stop;
guint64 time;
guint64 position;
guint64 duration;
/* < private > */
gpointer _gst_reserved[GST_PADDING];
};
GType gst_segment_get_type (void);
GstSegment * gst_segment_new (void) G_GNUC_MALLOC;
GstSegment * gst_segment_copy (const GstSegment *segment) G_GNUC_MALLOC;
void gst_segment_copy_into (const GstSegment *src, GstSegment *dest);
void gst_segment_free (GstSegment *segment);
void gst_segment_init (GstSegment *segment, GstFormat format);
guint64 gst_segment_to_stream_time (const GstSegment *segment, GstFormat format, guint64 position);
guint64 gst_segment_to_running_time (const GstSegment *segment, GstFormat format, guint64 position);
guint64 gst_segment_to_position (const GstSegment *segment, GstFormat format, guint64 running_time);
gboolean gst_segment_set_running_time (GstSegment *segment, GstFormat format, guint64 running_time);
gboolean gst_segment_clip (const GstSegment *segment, GstFormat format, guint64 start,
guint64 stop, guint64 *clip_start, guint64 *clip_stop);
gboolean gst_segment_do_seek (GstSegment * segment, gdouble rate,
GstFormat format, GstSeekFlags flags,
GstSeekType start_type, guint64 start,
GstSeekType stop_type, guint64 stop, gboolean * update);
G_END_DECLS
#endif /* __GST_SEGMENT_H__ */
@@ -0,0 +1,260 @@
/* GStreamer
* Copyright (C) 2003 David A. Schleef <ds@schleef.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_STRUCTURE_H__
#define __GST_STRUCTURE_H__
#include <gst/gstconfig.h>
#include <glib-object.h>
#include <gst/gstclock.h>
#include <gst/gstdatetime.h>
#include <gst/glib-compat.h>
G_BEGIN_DECLS
GST_EXPORT GType _gst_structure_type;
typedef struct _GstStructure GstStructure;
#define GST_TYPE_STRUCTURE (_gst_structure_type)
#define GST_IS_STRUCTURE(object) ((object) && (GST_STRUCTURE(object)->type == GST_TYPE_STRUCTURE))
#define GST_STRUCTURE_CAST(object) ((GstStructure *)(object))
#define GST_STRUCTURE(object) (GST_STRUCTURE_CAST(object))
/**
* GstStructureForeachFunc:
* @field_id: the #GQuark of the field name
* @value: the #GValue of the field
* @user_data: user data
*
* A function that will be called in gst_structure_foreach(). The function may
* not modify @value.
*
* Returns: TRUE if the foreach operation should continue, FALSE if
* the foreach operation should stop with FALSE.
*/
typedef gboolean (*GstStructureForeachFunc) (GQuark field_id,
const GValue * value,
gpointer user_data);
/**
* GstStructureMapFunc:
* @field_id: the #GQuark of the field name
* @value: the #GValue of the field
* @user_data: user data
*
* A function that will be called in gst_structure_map_in_place(). The function
* may modify @value.
*
* Returns: TRUE if the map operation should continue, FALSE if
* the map operation should stop with FALSE.
*/
typedef gboolean (*GstStructureMapFunc) (GQuark field_id,
GValue * value,
gpointer user_data);
/**
* GstStructure:
* @type: the GType of a structure
*
* The GstStructure object. Most fields are private.
*/
struct _GstStructure {
GType type;
/*< private >*/
GQuark name;
};
GType gst_structure_get_type (void);
GstStructure * gst_structure_new_empty (const gchar * name) G_GNUC_MALLOC;
GstStructure * gst_structure_new_id_empty (GQuark quark) G_GNUC_MALLOC;
GstStructure * gst_structure_new (const gchar * name,
const gchar * firstfield,
...) G_GNUC_NULL_TERMINATED G_GNUC_MALLOC;
GstStructure * gst_structure_new_valist (const gchar * name,
const gchar * firstfield,
va_list varargs) G_GNUC_MALLOC;
GstStructure * gst_structure_new_id (GQuark name_quark,
GQuark field_quark,
...) G_GNUC_MALLOC;
GstStructure * gst_structure_copy (const GstStructure *structure) G_GNUC_MALLOC;
gboolean gst_structure_set_parent_refcount (GstStructure *structure,
gint *refcount);
void gst_structure_free (GstStructure *structure);
const gchar * gst_structure_get_name (const GstStructure *structure);
GQuark gst_structure_get_name_id (const GstStructure *structure);
gboolean gst_structure_has_name (const GstStructure *structure,
const gchar *name);
void gst_structure_set_name (GstStructure *structure,
const gchar *name);
void gst_structure_id_set_value (GstStructure *structure,
GQuark field,
const GValue *value);
void gst_structure_set_value (GstStructure *structure,
const gchar *fieldname,
const GValue *value);
void gst_structure_id_take_value (GstStructure *structure,
GQuark field,
GValue *value);
void gst_structure_take_value (GstStructure *structure,
const gchar *fieldname,
GValue *value);
void gst_structure_set (GstStructure *structure,
const gchar *fieldname,
...) G_GNUC_NULL_TERMINATED;
void gst_structure_set_valist (GstStructure *structure,
const gchar *fieldname,
va_list varargs);
void gst_structure_id_set (GstStructure *structure,
GQuark fieldname,
...) G_GNUC_NULL_TERMINATED;
void gst_structure_id_set_valist (GstStructure *structure,
GQuark fieldname,
va_list varargs);
gboolean gst_structure_get_valist (const GstStructure *structure,
const char *first_fieldname,
va_list args);
gboolean gst_structure_get (const GstStructure *structure,
const char *first_fieldname,
...) G_GNUC_NULL_TERMINATED;
gboolean gst_structure_id_get_valist (const GstStructure *structure,
GQuark first_field_id,
va_list args);
gboolean gst_structure_id_get (const GstStructure *structure,
GQuark first_field_id,
...) G_GNUC_NULL_TERMINATED;
const GValue * gst_structure_id_get_value (const GstStructure *structure,
GQuark field);
const GValue * gst_structure_get_value (const GstStructure *structure,
const gchar *fieldname);
void gst_structure_remove_field (GstStructure *structure,
const gchar *fieldname);
void gst_structure_remove_fields (GstStructure *structure,
const gchar *fieldname,
...) G_GNUC_NULL_TERMINATED;
void gst_structure_remove_fields_valist (GstStructure *structure,
const gchar *fieldname,
va_list varargs);
void gst_structure_remove_all_fields (GstStructure *structure);
GType gst_structure_get_field_type (const GstStructure *structure,
const gchar *fieldname);
gboolean gst_structure_foreach (const GstStructure *structure,
GstStructureForeachFunc func,
gpointer user_data);
gboolean gst_structure_map_in_place (GstStructure *structure,
GstStructureMapFunc func,
gpointer user_data);
gint gst_structure_n_fields (const GstStructure *structure);
const gchar * gst_structure_nth_field_name (const GstStructure *structure, guint index);
gboolean gst_structure_id_has_field (const GstStructure *structure,
GQuark field);
gboolean gst_structure_id_has_field_typed (const GstStructure *structure,
GQuark field,
GType type);
gboolean gst_structure_has_field (const GstStructure *structure,
const gchar *fieldname);
gboolean gst_structure_has_field_typed (const GstStructure *structure,
const gchar *fieldname,
GType type);
/* utility functions */
gboolean gst_structure_get_boolean (const GstStructure *structure,
const gchar *fieldname,
gboolean *value);
gboolean gst_structure_get_int (const GstStructure *structure,
const gchar *fieldname,
gint *value);
gboolean gst_structure_get_uint (const GstStructure *structure,
const gchar *fieldname,
guint *value);
gboolean gst_structure_get_double (const GstStructure *structure,
const gchar *fieldname,
gdouble *value);
gboolean gst_structure_get_date (const GstStructure *structure,
const gchar *fieldname,
GDate **value);
gboolean gst_structure_get_date_time (const GstStructure *structure,
const gchar *fieldname,
GstDateTime **value);
gboolean gst_structure_get_clock_time (const GstStructure *structure,
const gchar *fieldname,
GstClockTime *value);
const gchar * gst_structure_get_string (const GstStructure *structure,
const gchar *fieldname);
gboolean gst_structure_get_enum (const GstStructure *structure,
const gchar *fieldname,
GType enumtype,
gint *value);
gboolean gst_structure_get_fraction (const GstStructure *structure,
const gchar *fieldname,
gint *value_numerator,
gint *value_denominator);
gchar * gst_structure_to_string (const GstStructure *structure) G_GNUC_MALLOC;
GstStructure * gst_structure_from_string (const gchar *string,
gchar **end) G_GNUC_MALLOC;
gboolean gst_structure_fixate_field_nearest_int (GstStructure *structure,
const char *field_name,
int target);
gboolean gst_structure_fixate_field_nearest_double (GstStructure *structure,
const char *field_name,
double target);
gboolean gst_structure_fixate_field_boolean (GstStructure *structure,
const char *field_name,
gboolean target);
gboolean gst_structure_fixate_field_string (GstStructure *structure,
const char *field_name,
const gchar *target);
gboolean gst_structure_fixate_field_nearest_fraction (GstStructure *structure,
const char *field_name,
const gint target_numerator,
const gint target_denominator);
gboolean gst_structure_fixate_field (GstStructure *structure,
const char *field_name);
gboolean gst_structure_is_equal(const GstStructure *structure1,
const GstStructure *structure2);
gboolean gst_structure_is_subset(const GstStructure *subset,
const GstStructure *superset);
gboolean gst_structure_can_intersect(const GstStructure *struct1,
const GstStructure *struct2);
GstStructure* gst_structure_intersect (const GstStructure *struct1,
const GstStructure *struct2) G_GNUC_MALLOC;
void gst_structure_fixate (GstStructure *structure);
G_END_DECLS
#endif
@@ -0,0 +1,87 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstsystemclock.h: A clock implementation based on system time
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_SYSTEM_CLOCK_H__
#define __GST_SYSTEM_CLOCK_H__
#include <gst/gstclock.h>
G_BEGIN_DECLS
#define GST_TYPE_SYSTEM_CLOCK (gst_system_clock_get_type ())
#define GST_SYSTEM_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SYSTEM_CLOCK, GstSystemClock))
#define GST_SYSTEM_CLOCK_CAST(obj) ((GstSystemClock *)(obj))
#define GST_IS_SYSTEM_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SYSTEM_CLOCK))
#define GST_SYSTEM_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SYSTEM_CLOCK, GstSystemClockClass))
#define GST_IS_SYSTEM_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SYSTEM_CLOCK))
#define GST_SYSTEM_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_SYSTEM_CLOCK, GstSystemClockClass))
typedef struct _GstSystemClock GstSystemClock;
typedef struct _GstSystemClockClass GstSystemClockClass;
typedef struct _GstSystemClockPrivate GstSystemClockPrivate;
/**
* GstClockType:
* @GST_CLOCK_TYPE_REALTIME: time since Epoch
* @GST_CLOCK_TYPE_MONOTONIC: monotonic time since some unspecified starting
* point
* @GST_CLOCK_TYPE_OTHER: some other time source is used (Since: 1.0.5)
*
* The different kind of clocks.
*/
typedef enum {
GST_CLOCK_TYPE_REALTIME = 0,
GST_CLOCK_TYPE_MONOTONIC = 1,
GST_CLOCK_TYPE_OTHER = 2
} GstClockType;
/**
* GstSystemClock:
*
* The default implementation of a #GstClock that uses the system time.
*/
struct _GstSystemClock {
GstClock clock;
/*< private >*/
GstSystemClockPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstSystemClockClass {
GstClockClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_system_clock_get_type (void);
GstClock* gst_system_clock_obtain (void);
G_END_DECLS
#endif /* __GST_SYSTEM_CLOCK_H__ */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,100 @@
/* GStreamer
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* gsttagsetter.h: Interfaces for tagging
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_TAG_SETTER_H__
#define __GST_TAG_SETTER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_TAG_SETTER (gst_tag_setter_get_type ())
#define GST_TAG_SETTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TAG_SETTER, GstTagSetter))
#define GST_IS_TAG_SETTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TAG_SETTER))
#define GST_TAG_SETTER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_TAG_SETTER, GstTagSetterInterface))
/**
* GstTagSetter:
*
* Opaque #GstTagSetter data structure.
*/
typedef struct _GstTagSetter GstTagSetter; /* Dummy typedef */
typedef struct _GstTagSetterInterface GstTagSetterInterface;
/**
* GstTagSetterInterface:
* @g_iface: parent interface type.
*
* #GstTagSetterInterface interface.
*/
/* use an empty interface here to allow detection of elements using user-set
tags */
struct _GstTagSetterInterface
{
GTypeInterface g_iface;
/* signals */
/* virtual table */
};
GType gst_tag_setter_get_type (void);
void gst_tag_setter_reset_tags (GstTagSetter * setter);
void gst_tag_setter_merge_tags (GstTagSetter * setter,
const GstTagList * list,
GstTagMergeMode mode);
void gst_tag_setter_add_tags (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
...) G_GNUC_NULL_TERMINATED;
void gst_tag_setter_add_tag_values (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
...) G_GNUC_NULL_TERMINATED;
void gst_tag_setter_add_tag_valist (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_setter_add_tag_valist_values(GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_setter_add_tag_value (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
const GValue * value);
const GstTagList *
gst_tag_setter_get_tag_list (GstTagSetter * setter);
void gst_tag_setter_set_tag_merge_mode (GstTagSetter * setter,
GstTagMergeMode mode);
GstTagMergeMode gst_tag_setter_get_tag_merge_mode (GstTagSetter * setter);
G_END_DECLS
#endif /* __GST_TAG_SETTER_H__ */
Loaded 100 of 1326 files, more files were not shown because too many files have changed in this diff. Show more