Imported existing code

This commit is contained in:
Hazim Gazov
2010-04-02 02:48:44 -03:00
parent 48fbc5ae91
commit 7a86d01598
13996 changed files with 2468699 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Library <2001> Thomas Vander Stichele <thomas@apestaart.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_AUDIO_AUDIO_H__
#define __GST_AUDIO_AUDIO_H__
G_BEGIN_DECLS
/* For people that are looking at this source: the purpose of these defines is
* to make GstCaps a bit easier, in that you don't have to know all of the
* properties that need to be defined. you can just use these macros. currently
* (8/01) the only plugins that use these are the passthrough, speed, volume,
* adder, and [de]interleave plugins. These are for convenience only, and do not
* specify the 'limits' of GStreamer. you might also use these definitions as a
* base for making your own caps, if need be.
*
* For example, to make a source pad that can output streams of either mono
* float or any channel int:
*
* template = gst_pad_template_new
* ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
* gst_caps_append(gst_caps_new ("sink_int", "audio/x-raw-int",
* GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
* gst_caps_new ("sink_float", "audio/x-raw-float",
* GST_AUDIO_FLOAT_PAD_TEMPLATE_PROPS)),
* NULL);
*
* sinkpad = gst_pad_new_from_template(template, "sink");
*
* Andy Wingo, 18 August 2001
* Thomas, 6 September 2002 */
/* conversion macros */
#define GST_FRAMES_TO_CLOCK_TIME(frames, rate) \
((GstClockTime) (((gdouble) frames / rate) * GST_SECOND))
#define GST_CLOCK_TIME_TO_FRAMES(clocktime, rate) \
((gint64) ((gst_guint64_to_gdouble(clocktime) / GST_SECOND) * rate))
#define GST_AUDIO_DEF_RATE 44100
#define GST_AUDIO_INT_PAD_TEMPLATE_CAPS \
"audio/x-raw-int, " \
"rate = (int) [ 1, MAX ], " \
"channels = (int) [ 1, MAX ], " \
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
"width = (int) { 8, 16, 24, 32 }, " \
"depth = (int) [ 1, 32 ], " \
"signed = (boolean) { true, false }"
/* "standard" int audio is native order, 16 bit stereo. */
#define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS \
"audio/x-raw-int, " \
"rate = (int) [ 1, MAX ], " \
"channels = (int) 2, " \
"endianness = (int) BYTE_ORDER, " \
"width = (int) 16, " \
"depth = (int) 16, " \
"signed = (boolean) true"
#define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS \
"audio/x-raw-float, " \
"rate = (int) [ 1, MAX ], " \
"channels = (int) [ 1, MAX ], " \
"endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " \
"width = (int) { 32, 64 }"
/* "standard" float audio is native order, 32 bit mono. */
#define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS \
"audio/x-raw-float, " \
"width = (int) 32, " \
"rate = (int) [ 1, MAX ], " \
"channels = (int) 1, " \
"endianness = (int) BYTE_ORDER"
/*
* this library defines and implements some helper functions for audio
* handling
*/
/* get byte size of audio frame (based on caps of pad */
int gst_audio_frame_byte_size (GstPad* pad);
/* get length in frames of buffer */
long gst_audio_frame_length (GstPad* pad, GstBuffer* buf);
GstClockTime gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf);
/* check if the buffer size is a whole multiple of the frame size */
gboolean gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf);
/* functions useful for _getcaps functions */
typedef enum {
GST_AUDIO_FIELD_RATE = (1 << 0),
GST_AUDIO_FIELD_CHANNELS = (1 << 1),
GST_AUDIO_FIELD_ENDIANNESS = (1 << 2),
GST_AUDIO_FIELD_WIDTH = (1 << 3),
GST_AUDIO_FIELD_DEPTH = (1 << 4),
GST_AUDIO_FIELD_SIGNED = (1 << 5),
} GstAudioFieldFlag;
void gst_audio_structure_set_int (GstStructure *structure, GstAudioFieldFlag flag);
G_END_DECLS
#endif /* __GST_AUDIO_AUDIO_H__ */

View File

@@ -0,0 +1,73 @@
/* 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/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(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_CLOCK))
typedef struct _GstAudioClock GstAudioClock;
typedef struct _GstAudioClockClass GstAudioClockClass;
typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock *clock, gpointer user_data);
struct _GstAudioClock {
GstSystemClock clock;
/* --- protected --- */
GstAudioClockGetTimeFunc func;
gpointer user_data;
GstClockTime last_time;
/*< private >*/
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 (gchar *name, GstAudioClockGetTimeFunc func,
gpointer user_data);
G_END_DECLS
#endif /* __GST_AUDIO_CLOCK_H__ */

View File

@@ -0,0 +1,93 @@
/* 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>
G_BEGIN_DECLS
typedef struct _GstAudioFilter GstAudioFilter;
typedef struct _GstAudioFilterClass GstAudioFilterClass;
typedef void (*GstAudioFilterFilterFunc)(GstAudioFilter *filter,
GstBuffer *outbuf, GstBuffer *inbuf);
typedef void (*GstAudioFilterInplaceFilterFunc)(GstAudioFilter *filter,
GstBuffer *buffer);
typedef void (*GstAudioFilterSetupFunc) (GstAudioFilter *filter);
#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_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),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(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_FILTER))
struct _GstAudioFilter {
GstElement element;
GstPad *sinkpad,*srcpad;
/* audio state */
gboolean inited;
gboolean passthru;
int rate;
int width;
int channels;
int depth;
int n_samples;
int size;
int bytes_per_sample;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstAudioFilterClass {
GstElementClass parent_class;
GstCaps *caps;
GstAudioFilterSetupFunc setup;
GstAudioFilterInplaceFilterFunc filter_inplace;
GstAudioFilterFilterFunc filter;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_audio_filter_get_type(void);
void gst_audio_filter_class_add_pad_templates (GstAudioFilterClass *audiofilterclass, const GstCaps *caps);
G_END_DECLS
#endif /* __GST_AUDIO_FILTER_H__ */

View File

@@ -0,0 +1,95 @@
/* 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.
*/
/* a base class for simple audio sinks.
*
* This base class only requires subclasses to implement a set
* of simple functions.
*
* - open: open the device with the specified caps
* - write: write the samples to the audio device
* - close: close the device
* - delay: the number of samples queued in the device
* - reset: unblock a write to the device and reset.
*
* All scheduling of samples and timestamps is done in this
* base class together with the GstBaseAudioSink using a
* default implementation of a ringbuffer that uses threads.
*/
#ifndef __GST_AUDIO_SINK_H__
#define __GST_AUDIO_SINK_H__
#include <gst/gst.h>
#include <gst/audio/gstbaseaudiosink.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;
struct _GstAudioSink {
GstBaseAudioSink element;
/*< private >*/ /* with LOCK */
GThread *thread;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstAudioSinkClass {
GstBaseAudioSinkClass 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, GstRingBufferSpec *spec);
/* undo anything that was done in prepare() */
gboolean (*unprepare) (GstAudioSink *sink);
/* close the device */
gboolean (*close) (GstAudioSink *sink);
/* write samples to the device */
guint (*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__ */

View File

@@ -0,0 +1,94 @@
/* 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.
*/
/* a base class for simple audio srcs.
*
* This base class only requires subclasses to implement a set
* of simple functions.
*
* - open: open the device with the specified caps
* - read: read samples to the audio device
* - close: close the device
* - delay: the number of samples queued in the device
* - reset: unblock a read to the device and reset.
*
* All scheduling of samples and timestamps is done in this
* base class.
*/
#ifndef __GST_AUDIO_SRC_H__
#define __GST_AUDIO_SRC_H__
#include <gst/gst.h>
#include <gst/audio/gstbaseaudiosrc.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;
struct _GstAudioSrc {
GstBaseAudioSrc element;
/*< private >*/ /* with LOCK */
GThread *thread;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstAudioSrcClass {
GstBaseAudioSrcClass 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, GstRingBufferSpec *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);
/* 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__ */

View File

@@ -0,0 +1,110 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstbaseaudiosink.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 GstRingBuffer in addition to overriding
* the methods in GstBaseSink and this class.
*/
#ifndef __GST_BASE_AUDIO_SINK_H__
#define __GST_BASE_AUDIO_SINK_H__
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#include "gstringbuffer.h"
#include "gstaudioclock.h"
G_BEGIN_DECLS
#define GST_TYPE_BASE_AUDIO_SINK (gst_base_audio_sink_get_type())
#define GST_BASE_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_SINK,GstBaseAudioSink))
#define GST_BASE_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_SINK,GstBaseAudioSinkClass))
#define GST_BASE_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_AUDIO_SINK, GstBaseAudioSinkClass))
#define GST_IS_BASE_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_SINK))
#define GST_IS_BASE_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_SINK))
#define GST_BASE_AUDIO_SINK_CLOCK(obj) (GST_BASE_AUDIO_SINK (obj)->clock)
#define GST_BASE_AUDIO_SINK_PAD(obj) (GST_BASE_SINK (obj)->sinkpad)
typedef struct _GstBaseAudioSink GstBaseAudioSink;
typedef struct _GstBaseAudioSinkClass GstBaseAudioSinkClass;
struct _GstBaseAudioSink {
GstBaseSink element;
/*< protected >*/ /* with LOCK */
/* our ringbuffer */
GstRingBuffer *ringbuffer;
/* required buffer and latency */
GstClockTime buffer_time;
GstClockTime latency_time;
/* the next sample to write */
guint64 next_sample;
/* clock */
gboolean provide_clock;
GstClock *provided_clock;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstBaseAudioSinkClass {
GstBaseSinkClass parent_class;
/* subclass ringbuffer allocation */
GstRingBuffer* (*create_ringbuffer) (GstBaseAudioSink *sink);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_base_audio_sink_get_type(void);
GstRingBuffer *gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink *sink);
G_END_DECLS
#endif /* __GST_BASE_AUDIO_SINK_H__ */

View File

@@ -0,0 +1,86 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstbaseaudiosrc.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_BASE_AUDIO_SRC_H__
#define __GST_BASE_AUDIO_SRC_H__
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
#include "gstringbuffer.h"
#include "gstaudioclock.h"
G_BEGIN_DECLS
#define GST_TYPE_BASE_AUDIO_SRC (gst_base_audio_src_get_type())
#define GST_BASE_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_SRC,GstBaseAudioSrc))
#define GST_BASE_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_SRC,GstBaseAudioSrcClass))
#define GST_BASE_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_AUDIO_SRC, GstBaseAudioSrcClass))
#define GST_IS_BASE_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_SRC))
#define GST_IS_BASE_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_SRC))
#define GST_BASE_AUDIO_SRC_CLOCK(obj) (GST_BASE_AUDIO_SRC (obj)->clock)
#define GST_BASE_AUDIO_SRC_PAD(obj) (GST_BASE_SRC (obj)->srcpad)
typedef struct _GstBaseAudioSrc GstBaseAudioSrc;
typedef struct _GstBaseAudioSrcClass GstBaseAudioSrcClass;
struct _GstBaseAudioSrc {
GstPushSrc element;
/*< protected >*/ /* with LOCK */
/* our ringbuffer */
GstRingBuffer *ringbuffer;
/* required buffer and latency */
GstClockTime buffer_time;
GstClockTime latency_time;
/* the next sample to write */
guint64 next_sample;
/* clock */
GstClock *clock;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstBaseAudioSrcClass {
GstPushSrcClass parent_class;
/* subclass ringbuffer allocation */
GstRingBuffer* (*create_ringbuffer) (GstBaseAudioSrc *src);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_base_audio_src_get_type(void);
GstRingBuffer *gst_base_audio_src_create_ringbuffer (GstBaseAudioSrc *src);
G_END_DECLS
#endif /* __GST_BASE_AUDIO_SRC_H__ */

View File

@@ -0,0 +1,345 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstringbuffer.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_RING_BUFFER_H__
#define __GST_RING_BUFFER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_RING_BUFFER (gst_ring_buffer_get_type())
#define GST_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RING_BUFFER,GstRingBuffer))
#define GST_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RING_BUFFER,GstRingBufferClass))
#define GST_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RING_BUFFER, GstRingBufferClass))
#define GST_IS_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RING_BUFFER))
#define GST_IS_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RING_BUFFER))
typedef struct _GstRingBuffer GstRingBuffer;
typedef struct _GstRingBufferClass GstRingBufferClass;
typedef struct _GstRingBufferSpec GstRingBufferSpec;
/* called to fill data with len bytes of samples */
typedef void (*GstRingBufferCallback) (GstRingBuffer *rbuf, guint8* data, guint len, gpointer user_data);
/**
* GstRingBufferState:
* @GST_RING_BUFFER_STATE_STOPPED: The ringbuffer is stopped
* @GST_RING_BUFFER_STATE_PAUSED: The ringbuffer is paused
* @GST_RING_BUFFER_STATE_STARTED: The ringbuffer is started
*
* The state of the ringbuffer.
*/
typedef enum {
GST_RING_BUFFER_STATE_STOPPED,
GST_RING_BUFFER_STATE_PAUSED,
GST_RING_BUFFER_STATE_STARTED,
} GstRingBufferState;
/**
* GstRingBufferSegState:
* @GST_SEGSTATE_INVALID: The content of the segment is invalid
* @GST_SEGSTATE_EMPTY: The segment is empty
* @GST_SEGSTATE_FILLED: The segment contains valid data
* @GST_SEGSTATE_PARTIAL: The segment partially contains valid data
*
* The state of a segment in the ringbuffer.
*/
typedef enum {
GST_SEGSTATE_INVALID,
GST_SEGSTATE_EMPTY,
GST_SEGSTATE_FILLED,
GST_SEGSTATE_PARTIAL,
} GstRingBufferSegState;
/**
* GstBufferFormatType:
* @GST_BUFTYPE_LINEAR: samples in linear PCM
* @GST_BUFTYPE_FLOAT: samples in float
* @GST_BUFTYPE_MU_LAW: samples in mulaw
* @GST_BUFTYPE_A_LAW: samples in alaw
* @GST_BUFTYPE_IMA_ADPCM: samples in ima adpcm
* @GST_BUFTYPE_MPEG: samples in mpeg audio format
* @GST_BUFTYPE_GSM: samples in gsm format
*
* The format of the samples in the ringbuffer.
*/
typedef enum
{
GST_BUFTYPE_LINEAR,
GST_BUFTYPE_FLOAT,
GST_BUFTYPE_MU_LAW,
GST_BUFTYPE_A_LAW,
GST_BUFTYPE_IMA_ADPCM,
GST_BUFTYPE_MPEG,
GST_BUFTYPE_GSM,
} GstBufferFormatType;
typedef enum
{
GST_UNKNOWN,
GST_S8,
GST_U8,
GST_S16_LE,
GST_S16_BE,
GST_U16_LE,
GST_U16_BE,
GST_S24_LE,
GST_S24_BE,
GST_U24_LE,
GST_U24_BE,
GST_S32_LE,
GST_S32_BE,
GST_U32_LE,
GST_U32_BE,
GST_S24_3LE,
GST_S24_3BE,
GST_U24_3LE,
GST_U24_3BE,
GST_S20_3LE,
GST_S20_3BE,
GST_U20_3LE,
GST_U20_3BE,
GST_S18_3LE,
GST_S18_3BE,
GST_U18_3LE,
GST_U18_3BE,
GST_FLOAT32_LE,
GST_FLOAT32_BE,
GST_FLOAT64_LE,
GST_FLOAT64_BE,
GST_MU_LAW,
GST_A_LAW,
GST_IMA_ADPCM,
GST_MPEG,
GST_GSM,
/* fill me */
} GstBufferFormat;
/**
* GstRingBufferSpec:
* @caps: The caps that generated the Spec.
* @type: the sample type
* @format: the sample format
* @sign: the sample sign
* @bigend: the endianness of the samples
* @width: the width of the samples
* @depth: th depth of the samples
* @rate: the samplerate
* @channels: the number of channels
* @latency_time: the latency in time units
* @buffer_time: the total buffer size in time units
* @segsize: the size of one segment in bytes
* @segtotal: the total number of segments
* @bytes_per_sample: number of bytes in one sample
* @silence_sample: bytes representing one sample of silence
*
* The structure containing the format specification of the ringbuffer.
*/
struct _GstRingBufferSpec
{
/*< public >*/
/* in */
GstCaps *caps; /* the caps of the buffer */
/* in/out */
GstBufferFormatType type;
GstBufferFormat format;
gboolean sign;
gboolean bigend;
gint width;
gint depth;
gint rate;
gint channels;
GstClockTime latency_time; /* the required/actual latency time */
GstClockTime buffer_time; /* the required/actual time of the buffer */
gint segsize; /* size of one buffer segement */
gint segtotal; /* total number of segments */
/* out */
gint bytes_per_sample; /* number of bytes of one sample */
guint8 silence_sample[32]; /* bytes representing silence */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
#define GST_RING_BUFFER_GET_COND(buf) (((GstRingBuffer *)buf)->cond)
#define GST_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
#define GST_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_RING_BUFFER_GET_COND (buf)))
#define GST_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_RING_BUFFER_GET_COND (buf)))
/**
* GstRingBuffer:
* @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
* @data: data in the ringbuffer
* @spec: format and layout of the ringbuffer data
* @segstate: status of each segment in the ringbuffer (unused)
* @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 _GstRingBuffer {
GstObject object;
/*< public >*/ /* with LOCK */
GCond *cond;
gboolean open;
gboolean acquired;
GstBuffer *data;
GstRingBufferSpec spec;
GstRingBufferSegState *segstate;
gint samples_per_seg;
guint8 *empty_seg;
/*< public >*/ /* ATOMIC */
gint state;
gint segdone;
gint segbase;
gint waiting;
/*< private >*/
GstRingBufferCallback callback;
gpointer cb_data;
/*< private >*/
union {
struct {
gboolean flushing;
/* ATOMIC */
gint may_start;
} ABI;
/* adding + 0 to mark ABI change to be undone later */
gpointer _gst_reserved[GST_PADDING + 0];
} abidata;
};
/**
* GstRingBufferClass:
* @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
*
* The vmethods that subclasses can override to implement the ringbuffer.
*/
struct _GstRingBufferClass {
GstObjectClass parent_class;
/*< public >*/
gboolean (*open_device) (GstRingBuffer *buf);
gboolean (*acquire) (GstRingBuffer *buf, GstRingBufferSpec *spec);
gboolean (*release) (GstRingBuffer *buf);
gboolean (*close_device) (GstRingBuffer *buf);
gboolean (*start) (GstRingBuffer *buf);
gboolean (*pause) (GstRingBuffer *buf);
gboolean (*resume) (GstRingBuffer *buf);
gboolean (*stop) (GstRingBuffer *buf);
guint (*delay) (GstRingBuffer *buf);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_ring_buffer_get_type(void);
/* callback stuff */
void gst_ring_buffer_set_callback (GstRingBuffer *buf, GstRingBufferCallback cb,
gpointer user_data);
gboolean gst_ring_buffer_parse_caps (GstRingBufferSpec *spec, GstCaps *caps);
void gst_ring_buffer_debug_spec_caps (GstRingBufferSpec *spec);
void gst_ring_buffer_debug_spec_buff (GstRingBufferSpec *spec);
/* device state */
gboolean gst_ring_buffer_open_device (GstRingBuffer *buf);
gboolean gst_ring_buffer_close_device (GstRingBuffer *buf);
gboolean gst_ring_buffer_device_is_open (GstRingBuffer *buf);
/* allocate resources */
gboolean gst_ring_buffer_acquire (GstRingBuffer *buf, GstRingBufferSpec *spec);
gboolean gst_ring_buffer_release (GstRingBuffer *buf);
gboolean gst_ring_buffer_is_acquired (GstRingBuffer *buf);
/* flushing */
void gst_ring_buffer_set_flushing (GstRingBuffer *buf, gboolean flushing);
/* playback/pause */
gboolean gst_ring_buffer_start (GstRingBuffer *buf);
gboolean gst_ring_buffer_pause (GstRingBuffer *buf);
gboolean gst_ring_buffer_stop (GstRingBuffer *buf);
/* get status */
guint gst_ring_buffer_delay (GstRingBuffer *buf);
guint64 gst_ring_buffer_samples_done (GstRingBuffer *buf);
void gst_ring_buffer_set_sample (GstRingBuffer *buf, guint64 sample);
/* clear all segments */
void gst_ring_buffer_clear_all (GstRingBuffer *buf);
/* commit samples */
guint gst_ring_buffer_commit (GstRingBuffer *buf, guint64 sample,
guchar *data, guint len);
/* read samples */
guint gst_ring_buffer_read (GstRingBuffer *buf, guint64 sample,
guchar *data, guint len);
/* mostly protected */
gboolean gst_ring_buffer_prepare_write (GstRingBuffer *buf, gint *segment, guint8 **writeptr, gint *len);
gboolean gst_ring_buffer_prepare_read (GstRingBuffer *buf, gint *segment, guint8 **readptr, gint *len);
void gst_ring_buffer_clear (GstRingBuffer *buf, gint segment);
void gst_ring_buffer_advance (GstRingBuffer *buf, guint advance);
void gst_ring_buffer_may_start (GstRingBuffer *buf, gboolean allowed);
G_END_DECLS
#endif /* __GST_RING_BUFFER_H__ */

View File

@@ -0,0 +1,46 @@
/* GStreamer
* Copyright (C) 2005-2006 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_MIXERUTILS_H__
#define __GST_AUDIO_MIXERUTILS_H__
#include <gst/gst.h>
#include <gst/interfaces/mixer.h>
/**
* GstAudioMixerFilterFunc:
* @mixer: a #GstElement implementing the #GstMixer interface
* @user_data: user data
*
* Function that will be called by gst_audio_default_registry_mixer_filter()
* so the caller can decide which mixer elements should be kept and returned.
* When the mixer element is passed to the callback function, it is opened
* and in READY state. If you decide to keep the element, you need to set it
* back to NULL state yourself (unless you want to keep it opened of course).
*
* Returns: TRUE if the element should be kept, FALSE otherwise.
*/
typedef gboolean (*GstAudioMixerFilterFunc) (GstMixer * mixer, gpointer user_data);
GList * gst_audio_default_registry_mixer_filter (GstAudioMixerFilterFunc filter_func,
gboolean first,
gpointer user_data);
#endif /* __GST_AUDIO_MIXERUTILS_H__ */

View File

@@ -0,0 +1,19 @@
/* Generated data (by glib-mkenums) */
#ifndef __GST_AUDIO_ENUM_TYPES_H__
#define __GST_AUDIO_ENUM_TYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/* enumerations from "multichannel.h" */
GType gst_audio_channel_position_get_type (void);
#define GST_TYPE_AUDIO_CHANNEL_POSITION (gst_audio_channel_position_get_type())
G_END_DECLS
#endif /* __GST_AUDIO_ENUM_TYPES_H__ */
/* Generated data ends here */

View File

@@ -0,0 +1,90 @@
/* GStreamer Multichannel-Audio helper functions
* (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.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_MULTICHANNEL_H__
#define __GST_AUDIO_MULTICHANNEL_H__
#include <gst/audio/audio.h>
#include <gst/audio/multichannel-enumtypes.h>
G_BEGIN_DECLS
typedef enum {
GST_AUDIO_CHANNEL_POSITION_INVALID = -1,
/* Main front speakers. Mono and left/right are mututally exclusive! */
GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
/* rear. Left/right and center are mututally exclusive! */
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
/* subwoofer/low-frequency */
GST_AUDIO_CHANNEL_POSITION_LFE,
/* Center front speakers. Center and left/right_of_center cannot be
* used together! */
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
/* sides */
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
/* don't use - counter */
GST_AUDIO_CHANNEL_POSITION_NUM
} GstAudioChannelPosition;
/* Retrieves or sets the positions from/to a GstStructure. Only
* works with fixed caps, caller should check for that! Caller
* g_free()s result of the getter. */
GstAudioChannelPosition *
gst_audio_get_channel_positions (GstStructure *str);
void gst_audio_set_channel_positions (GstStructure *str,
const GstAudioChannelPosition *pos);
/* Sets a (non-fixed) list of possible audio channel positions
* on a structure (this requires the "channels" property to
* be fixed!) or on a caps (here, the "channels" property may be
* unfixed and the caps may even contain multiple structures). */
void gst_audio_set_structure_channel_positions_list
(GstStructure *str,
const GstAudioChannelPosition *pos,
gint num_positions);
void gst_audio_set_caps_channel_positions_list
(GstCaps *caps,
const GstAudioChannelPosition *pos,
gint num_positions);
/* Custom fixate function. Elements that implement some sort of
* channel conversion algorhithm should use this function for
* fixating on GstAudioChannelPosition properties. It will take
* care of equal channel positioning (left/right). Caller g_free()s
* the return value. The input properties may be (and are supposed
* to be) unfixed. */
GstAudioChannelPosition *
gst_audio_fixate_channel_positions (GstStructure *str);
G_END_DECLS
#endif /* __GST_AUDIO_MULTICHANNEL_H__ */

View File

@@ -0,0 +1,87 @@
/* 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))
typedef struct _GstAdapter GstAdapter;
typedef struct _GstAdapterClass GstAdapterClass;
/**
* GstAdapter:
* @object: the parent object.
*
* The opaque #GstAdapter data structure.
*/
struct _GstAdapter {
GObject object;
/*< private >*/
GSList * buflist;
guint size;
guint skip;
/* we keep state of assembled pieces */
guint8 * assembled_data;
guint assembled_size;
guint assembled_len;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstAdapterClass {
GObjectClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GstAdapter * gst_adapter_new (void);
void gst_adapter_clear (GstAdapter *adapter);
void gst_adapter_push (GstAdapter *adapter, GstBuffer* buf);
const guint8 * gst_adapter_peek (GstAdapter *adapter, guint size);
void gst_adapter_flush (GstAdapter *adapter, guint flush);
guint8* gst_adapter_take (GstAdapter *adapter, guint nbytes);
GstBuffer* gst_adapter_take_buffer (GstAdapter *adapter, guint nbytes);
guint gst_adapter_available (GstAdapter *adapter);
guint gst_adapter_available_fast (GstAdapter *adapter);
GType gst_adapter_get_type (void);
G_END_DECLS
#endif /* __GST_ADAPTER_H__ */

View File

@@ -0,0 +1,180 @@
/* 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)
typedef struct _GstBaseSink GstBaseSink;
typedef struct _GstBaseSinkClass GstBaseSinkClass;
typedef struct _GstBaseSinkPrivate GstBaseSinkPrivate;
/**
* GstBaseSink:
* @element: the parent element.
*
* The opaque #GstBaseSink data structure.
*/
struct _GstBaseSink {
GstElement element;
/*< protected >*/
GstPad *sinkpad;
GstActivateMode pad_mode;
/*< protected >*/ /* with LOCK */
guint64 offset;
gboolean can_activate_pull;
gboolean can_activate_push;
/*< protected >*/ /* with PREROLL_LOCK */
GQueue *preroll_queue;
gint preroll_queue_max_len;
gint preroll_queued;
gint buffers_queued;
gint events_queued;
gboolean eos;
gboolean eos_queued;
gboolean need_preroll;
gboolean have_preroll;
gboolean playing_async;
/*< protected >*/ /* with STREAM_LOCK */
gboolean have_newsegment;
GstSegment segment;
/*< private >*/ /* with LOCK */
GstClockID clock_id;
GstClockTime end_time;
gboolean sync;
gboolean flushing;
/*< private >*/
union {
struct {
/* segment used for clipping incomming buffers */
GstSegment *clip_segment;
/* max amount of time a buffer can be late, -1 no limit. */
gint64 max_lateness;
} ABI;
gpointer _gst_reserved[GST_PADDING_LARGE - 1];
} abidata;
GstBaseSinkPrivate *priv;
};
/**
* GstBaseSinkClass:
* @get_caps: Called to get sink pad caps from the subclass
* @set_caps: Notify subclass of changed caps
* @buffer_alloc: Subclasses can override to perform custom buffer allocations
* @get_times: Called to get the start and end times for synchronising
* the passed buffer to the clock
* @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
* @event: Override this to handle events arriving on the sink pad
* @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.
* @async_play: Subclasses should override this when they need to perform
* special processing when changing to the PLAYING state
* asynchronously. Called with the OBJECT_LOCK held.
*
* 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);
/* notify subclass of new caps */
gboolean (*set_caps) (GstBaseSink *sink, GstCaps *caps);
/* allocate a new buffer with given caps */
GstFlowReturn (*buffer_alloc) (GstBaseSink *sink, guint64 offset, guint size,
GstCaps *caps, GstBuffer **buf);
/* get the start and end times for syncing on this buffer */
void (*get_times) (GstBaseSink *sink, GstBuffer *buffer,
GstClockTime *start, GstClockTime *end);
/* 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);
/* notify subclass of event, preroll buffer or real buffer */
gboolean (*event) (GstBaseSink *sink, GstEvent *event);
GstFlowReturn (*preroll) (GstBaseSink *sink, GstBuffer *buffer);
GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
/* ABI additions */
/* when an ASYNC state change to PLAYING happens */ /* with LOCK */
GstStateChangeReturn (*async_play) (GstBaseSink *sink);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE-1];
};
GType gst_base_sink_get_type(void);
void gst_base_sink_set_sync (GstBaseSink *sink, gboolean sync);
gboolean gst_base_sink_get_sync (GstBaseSink *sink);
void gst_base_sink_set_max_lateness (GstBaseSink *sink, gint64 max_lateness);
gint64 gst_base_sink_get_max_lateness (GstBaseSink *sink);
void gst_base_sink_set_qos_enabled (GstBaseSink *sink, gboolean enabled);
gboolean gst_base_sink_is_qos_enabled (GstBaseSink *sink);
G_END_DECLS
#endif /* __GST_BASE_SINK_H__ */

View File

@@ -0,0 +1,215 @@
/* 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_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_STARTED = (GST_ELEMENT_FLAG_LAST << 0),
/* padding */
GST_BASE_SRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
} GstBaseSrcFlags;
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:
* @element: the parent element.
*
* 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) */
gint blocksize; /* size of buffers when operating push based */
gboolean can_activate_push; /* some scheduling properties */
GstActivateMode pad_mode;
gboolean seekable;
gboolean random_access;
GstClockID clock_id; /* for syncing */
GstClockTime end_time;
/* MT-protected (with STREAM_LOCK) */
GstSegment segment;
gboolean need_newsegment;
guint64 offset; /* current offset in the resource, unused */
guint64 size; /* total size of the resource, unused */
gint num_buffers;
gint num_buffers_left;
/*< private >*/
union {
struct {
/* FIXME: those fields should be moved into the private struct */
gboolean typefind;
gboolean running;
GstEvent *pending_seek;
} ABI;
gpointer _gst_reserved[GST_PADDING_LARGE-1];
} data;
GstBaseSrcPrivate *priv;
};
/**
* GstBaseSrcClass:
* @parent_class: Element parent class
* @get_caps: Called to get the caps to report
* @set_caps: Notify subclass of changed output caps
* @negotiate: Negotiated the caps with the peer.
* @newsegment: Generate and send a new_segment event.
* @start: Start processing. Subclasses should open resources and prepare
* to produce data.
* @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
* @unlock: Unlock any pending access to the resource. Subclasses should
* unblock any blocked function ASAP
* @event: Override this to implement custom event handling.
* @create: Ask the subclass to create a buffer with offset and size.
* @do_seek: Perform seeking on the resource to the indicated segment.
* @query: Handle a requested query.
* @check_get_range: Check whether the source would support pull-based
* operation if it were to be opened now. This vfunc is optional, but
* should be implemented if possible to avoid unnecessary start/stop
* cycles. The default implementation will open and close the resource
* to find out whether get_range is supported, and that is usually
* undesirable.
*/
struct _GstBaseSrcClass {
GstElementClass parent_class;
/*< public >*/
/* virtual methods for subclasses */
/* get caps from subclass */
GstCaps* (*get_caps) (GstBaseSrc *src);
/* notify the subclass of new caps */
gboolean (*set_caps) (GstBaseSrc *src, GstCaps *caps);
/* decide on caps */
gboolean (*negotiate) (GstBaseSrc *src);
/* generate and send a newsegment */
gboolean (*newsegment) (GstBaseSrc *src);
/* 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);
/* unlock any pending access to the resource. subclasses should unlock
* any function ASAP. */
gboolean (*unlock) (GstBaseSrc *src);
/* notify subclasses of an event */
gboolean (*event) (GstBaseSrc *src, GstEvent *event);
/* ask the subclass to create a buffer with offset and size */
GstFlowReturn (*create) (GstBaseSrc *src, guint64 offset, guint size,
GstBuffer **buf);
/* additions that change padding... */
/* notify subclasses of a seek */
gboolean (*do_seek) (GstBaseSrc *src, GstSegment *segment);
/* notify subclasses of a query */
gboolean (*query) (GstBaseSrc *src, GstQuery *query);
/* check whether the source would support pull-based operation if
* it were to be opened now. This vfunc is optional, but should be
* implemented if possible to avoid unnecessary start/stop cycles.
* The default implementation will open and close the resource to
* find out whether get_range is supported and that is usually
* undesirable. */
gboolean (*check_get_range) (GstBaseSrc *src);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE - 3];
};
GType gst_base_src_get_type (void);
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);
G_END_DECLS
#endif /* __GST_BASE_SRC_H__ */

View File

@@ -0,0 +1,223 @@
/* 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))
/* since 0.10.4 */
#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.
*
* Since: 0.10.4
*/
#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.
*
* Since: 0.10.4
*/
#define GST_BASE_TRANSFORM_SINK_PAD(obj) (GST_BASE_TRANSFORM_CAST (obj)->sinkpad)
typedef struct _GstBaseTransform GstBaseTransform;
typedef struct _GstBaseTransformClass GstBaseTransformClass;
typedef struct _GstBaseTransformPrivate GstBaseTransformPrivate;
/**
* GstBaseTransform:
* @element: the parent element.
*
* The opaque #GstBaseTransform data structure.
*/
struct _GstBaseTransform {
GstElement element;
/*< protected >*/
/* source and sink pads */
GstPad *sinkpad;
GstPad *srcpad;
/* Set by sub-class */
gboolean passthrough;
gboolean always_in_place;
GstCaps *cache_caps1;
guint cache_caps1_size;
GstCaps *cache_caps2;
guint cache_caps2_size;
gboolean have_same_caps;
gboolean delay_configure;
gboolean pending_configure;
gboolean negotiated;
gboolean have_newsegment;
/* MT-protected (with STREAM_LOCK) */
GstSegment segment;
GMutex *transform_lock;
/*< private >*/
GstBaseTransformPrivate *priv;
gpointer _gst_reserved[GST_PADDING_LARGE - 1];
};
/**
* GstBaseTransformClass:
* @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.
* @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.
* @set_caps: allows the subclass to be notified of the actual caps set.
* @start: Optional.
* Called when the element starts processing.
* Allows opening external resources.
* @stop: Optional.
* Called when the element stops processing.
* Allows closing external resources.
* @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.
* @event: Optional.
* Event handler on the sink pad.
* @src_event: Optional.
* Event handler on the source pad.
* @passthrough_on_same_caps: If set to TRUE, passthrough mode will be
* automatically enabled if the caps are the same.
* @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
* increment the reference to the input buffer (if in
* passthrough mode)
*/
struct _GstBaseTransformClass {
GstElementClass parent_class;
/*< public >*/
/* virtual methods for subclasses */
GstCaps* (*transform_caps) (GstBaseTransform *trans,
GstPadDirection direction,
GstCaps *caps);
void (*fixate_caps) (GstBaseTransform *trans,
GstPadDirection direction, GstCaps *caps,
GstCaps *othercaps);
gboolean (*transform_size) (GstBaseTransform *trans,
GstPadDirection direction,
GstCaps *caps, guint size,
GstCaps *othercaps, guint *othersize);
gboolean (*get_unit_size) (GstBaseTransform *trans, GstCaps *caps,
guint *size);
gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps,
GstCaps *outcaps);
gboolean (*start) (GstBaseTransform *trans);
gboolean (*stop) (GstBaseTransform *trans);
gboolean (*event) (GstBaseTransform *trans, GstEvent *event);
GstFlowReturn (*transform) (GstBaseTransform *trans, GstBuffer *inbuf,
GstBuffer *outbuf);
GstFlowReturn (*transform_ip) (GstBaseTransform *trans, GstBuffer *buf);
/* FIXME: When adjusting the padding, move these to nicer places in the class */
gboolean passthrough_on_same_caps;
GstFlowReturn (*prepare_output_buffer) (GstBaseTransform * trans,
GstBuffer *input, gint size, GstCaps *caps, GstBuffer **buf);
/* src event */
gboolean (*src_event) (GstBaseTransform *trans, GstEvent *event);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE - 1];
};
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);
G_END_DECLS
#endif /* __GST_BASE_TRANSFORM_H__ */

View File

@@ -0,0 +1,174 @@
/* GStreamer
* Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
*
* gstcollect_pads.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 _GstCollectPads GstCollectPads;
typedef struct _GstCollectPadsClass GstCollectPadsClass;
/**
* 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 LOCK of @collect */
GstCollectPads *collect;
GstPad *pad;
GstBuffer *buffer;
guint pos;
GstSegment segment;
/*< private >*/
union {
struct {
gboolean flushing;
gboolean new_segment;
gboolean eos;
} ABI;
/* adding + 0 to mark ABI change to be undone later */
gpointer _gst_reserved[GST_PADDING + 0];
} abidata;
};
/**
* 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);
#define GST_COLLECT_PADS_GET_PAD_LOCK(pads) (((GstCollectPads *)pads)->abidata.ABI.pad_lock)
#define GST_COLLECT_PADS_PAD_LOCK(pads) (g_mutex_lock(GST_COLLECT_PADS_GET_PAD_LOCK (pads)))
#define GST_COLLECT_PADS_PAD_UNLOCK(pads) (g_mutex_unlock(GST_COLLECT_PADS_GET_PAD_LOCK (pads)))
#define GST_COLLECT_PADS_GET_COND(pads) (((GstCollectPads *)pads)->cond)
#define GST_COLLECT_PADS_WAIT(pads) (g_cond_wait (GST_COLLECT_PADS_GET_COND (pads), GST_OBJECT_GET_LOCK (pads)))
#define GST_COLLECT_PADS_SIGNAL(pads) (g_cond_signal (GST_COLLECT_PADS_GET_COND (pads)))
#define GST_COLLECT_PADS_BROADCAST(pads)(g_cond_broadcast (GST_COLLECT_PADS_GET_COND (pads)))
/**
* GstCollectPads:
* @object: the #GstObject parent structure.
* @data: #GList of #GstCollectData managed by this #GstCollectPads.
*
* Collectpads object.
*/
struct _GstCollectPads {
GstObject object;
/*< public >*/ /* with LOCK */
GSList *data; /* list of CollectData items */
/*< private >*/
guint32 cookie; /* @data list cookie */
/* with LOCK */
GCond *cond; /* to signal removal of data */
GstCollectPadsFunction func; /* function and user_data for callback */
gpointer user_data;
guint numpads; /* number of pads in @data */
guint queuedpads; /* number of pads with a buffer */
guint eospads; /* number of pads that are EOS */
/* with LOCK and PAD_LOCK*/
gboolean started;
/*< private >*/
union {
struct {
/* since 0.10.6 */ /* with PAD_LOCK */
GMutex *pad_lock; /* used to serialize add/remove */
GSList *pad_list; /* updated pad list */
guint32 pad_cookie; /* updated cookie */
} ABI;
/* adding + 0 to mark ABI change to be undone later */
gpointer _gst_reserved[GST_PADDING + 0];
} abidata;
};
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 callback */
void gst_collect_pads_set_function (GstCollectPads *pads, GstCollectPadsFunction func,
gpointer user_data);
/* pad management */
GstCollectData* gst_collect_pads_add_pad (GstCollectPads *pads, GstPad *pad, guint size);
gboolean gst_collect_pads_remove_pad (GstCollectPads *pads, GstPad *pad);
gboolean gst_collect_pads_is_active (GstCollectPads *pads, GstPad *pad);
/* start/stop collection */
GstFlowReturn gst_collect_pads_collect (GstCollectPads *pads);
GstFlowReturn gst_collect_pads_collect_range (GstCollectPads *pads, guint64 offset, guint length);
void gst_collect_pads_start (GstCollectPads *pads);
void gst_collect_pads_stop (GstCollectPads *pads);
/* 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_read (GstCollectPads *pads, GstCollectData *data,
guint8 **bytes, guint size);
guint gst_collect_pads_flush (GstCollectPads *pads, GstCollectData *data,
guint size);
G_END_DECLS
#endif /* __GST_COLLECT_PADS_H__ */

View File

@@ -0,0 +1,69 @@
/* 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:
* @parent: the parent base source object.
*
* 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 */
GstFlowReturn (*create) (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__ */

View File

@@ -0,0 +1,66 @@
/* 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_buffer (GstObject *obj,
GstBuffer *buf,
GstTypeFindProbability *prob);
/**
* GstTypeFindHelperGetRangeFunction:
* @obj: a #GstObject that will handle the getrange request
* @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,
guint64 offset,
guint length,
GstBuffer **buffer);
GstCaps * gst_type_find_helper_get_range (GstObject * obj,
GstTypeFindHelperGetRangeFunction func,
guint64 size,
GstTypeFindProbability *prob);
G_END_DECLS
#endif /* __GST_TYPEFINDHELPER_H__ */

View File

@@ -0,0 +1,181 @@
/* GStreamer
* Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
* 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_CDDA_BASE_SRC_H__
#define __GST_CDDA_BASE_SRC_H__
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
G_BEGIN_DECLS
#define GST_TYPE_CDDA_BASE_SRC (gst_cdda_base_src_get_type())
#define GST_CDDA_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrc))
#define GST_CDDA_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrcClass))
#define GST_IS_CDDA_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_CDDA_BASE_SRC))
#define GST_IS_CDDA_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_CDDA_BASE_SRC))
#define GST_CDDA_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrcClass))
typedef struct _GstCddaBaseSrc GstCddaBaseSrc;
typedef struct _GstCddaBaseSrcClass GstCddaBaseSrcClass;
typedef struct _GstCddaBaseSrcTrack GstCddaBaseSrcTrack;
/**
* GstCddaBaseSrcMode:
* @GST_CDDA_BASE_SRC_MODE_NORMAL : each single track is a stream
* @GST_CDDA_BASE_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_CDDA_BASE_SRC_MODE_NORMAL, /* stream = one track */
GST_CDDA_BASE_SRC_MODE_CONTINUOUS /* stream = whole disc */
} GstCddaBaseSrcMode;
/**
* GstCddaBaseSrcTrack:
* @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.
*/
struct _GstCddaBaseSrcTrack {
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 _GstCddaBaseSrc {
GstPushSrc pushsrc;
/*< protected >*/ /* for use by sub-classes only */
GstTagList *tags; /* tags that apply to all tracks */
/*< private >*/
GstCddaBaseSrcMode mode;
gchar *device;
guint num_tracks;
guint num_all_tracks;
GstCddaBaseSrcTrack *tracks;
gint cur_track; /* current track (starting from 0) */
gint prev_track; /* current track last time */
gint cur_sector; /* current sector */
gint seek_sector; /* -1 or sector to seek to */
gint uri_track;
gchar *uri;
guint32 discid; /* cddb disc id (for unit test) */
gchar mb_discid[32]; /* musicbrainz discid */
GstIndex *index;
gint index_id;
gint toc_offset;
gboolean toc_bias;
/*< private >*/
guint _gst_reserved1[GST_PADDING/2];
gpointer _gst_reserved2[GST_PADDING/2];
};
struct _GstCddaBaseSrcClass {
GstPushSrcClass pushsrc_class;
/* open/close the CD device */
gboolean (*open) (GstCddaBaseSrc *src, const gchar *device);
void (*close) (GstCddaBaseSrc *src);
/* read one sector (LBA) */
GstBuffer * (*read_sector) (GstCddaBaseSrc *src, gint sector);
/* return default device or NULL (optional) */
gchar * (*get_default_device) (GstCddaBaseSrc *src);
/* return NULL-terminated string array of CD devices, or NULL (optional) */
gchar ** (*probe_devices) (GstCddaBaseSrc *src);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_cdda_base_src_get_type (void);
gboolean gst_cdda_base_src_add_track (GstCddaBaseSrc * src,
GstCddaBaseSrcTrack * track);
/* tags */
/**
* GST_TAG_CDDA_CDDB_DISCID:
*
* CDDB disc id in its short form (e.g. 'aa063d0f')
*/
#define GST_TAG_CDDA_CDDB_DISCID "discid"
/**
* GST_TAG_CDDA_CDDB_DISCID_FULL:
*
* CDDB disc id including all details
*/
#define GST_TAG_CDDA_CDDB_DISCID_FULL "discid-full"
/**
* GST_TAG_CDDA_MUSICBRAINZ_DISCID:
*
* Musicbrainz disc id (e.g. 'ahg7JUcfR3vCYBphSDIogOOWrr0-')
*/
#define GST_TAG_CDDA_MUSICBRAINZ_DISCID "musicbrainz-discid"
/**
* GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL:
*
* Musicbrainz disc id details
*/
#define GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL "musicbrainz-discid-full"
#if 0
/**
* GST_TAG_CDDA_TRACK_TAGS:
*
* Tag details for all available tracks
* FiXME: find out which type we want for this!
*/
#define GST_TAG_CDDA_TRACK_TAGS "track-tags"
#endif
G_END_DECLS
#endif /* __GST_CDDA_BASE_SRC_H__ */

View File

@@ -0,0 +1,266 @@
/* GStreamer
*
* Common code for GStreamer unittests
*
* 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_CHECK_H__
#define __GST_CHECK_H__
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <check.h>
#include <gst/gst.h>
GST_DEBUG_CATEGORY_EXTERN (check_debug);
#define GST_CAT_DEFAULT check_debug
/* logging function for tests
* a test uses g_message() to log a debug line
* a gst unit test can be run with GST_TEST_DEBUG env var set to see the
* messages
*/
extern gboolean _gst_check_threads_running;
extern gboolean _gst_check_raised_critical;
extern gboolean _gst_check_raised_warning;
extern gboolean _gst_check_expecting_log;
/* global variables used in test methods */
GList * buffers;
void gst_check_init (int *argc, char **argv[]);
GstFlowReturn gst_check_chain_func (GstPad *pad, GstBuffer *buffer);
void gst_check_message_error (GstMessage *message, GstMessageType type, GQuark domain, gint code);
GstElement * gst_check_setup_element (const gchar *factory);
void gst_check_teardown_element (GstElement *element);
GstPad * gst_check_setup_src_pad (GstElement *element,
GstStaticPadTemplate *template, GstCaps *caps);
void gst_check_teardown_src_pad (GstElement *element);
GstPad * gst_check_setup_sink_pad (GstElement *element,
GstStaticPadTemplate *template, GstCaps *caps);
void gst_check_teardown_sink_pad (GstElement *element);
#define fail_unless_message_error(msg, domain, code) \
gst_check_message_error (msg, GST_MESSAGE_ERROR, \
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code)
/***
* wrappers for START_TEST and END_TEST
*/
#define GST_START_TEST(__testname) \
static void __testname (void)\
{\
GST_DEBUG ("test start"); \
tcase_fn_start (""# __testname, __FILE__, __LINE__);
#define GST_END_TEST END_TEST
/* additional fail macros */
#define fail_unless_equals_int(a, b) \
G_STMT_START { \
int first = a; \
int second = b; \
fail_unless(first == second, \
"'" #a "' (%d) is not equal to '" #b"' (%d)", first, second); \
} G_STMT_END;
#define fail_unless_equals_uint64(a, b) \
G_STMT_START { \
guint64 first = a; \
guint64 second = b; \
fail_unless(first == second, \
"'" #a "' (%" G_GUINT64_FORMAT ") is not equal to '" #b"' (%" \
G_GUINT64_FORMAT ")", first, second); \
} G_STMT_END;
#define fail_unless_equals_string(a, b) \
G_STMT_START { \
gchar * first = a; \
gchar * second = b; \
fail_unless(strcmp (first, second) == 0, \
"'" #a "' (%s) is not equal to '" #b"' (%s)", first, second); \
} G_STMT_END;
/***
* thread test macros and variables
*/
extern GList *thread_list;
extern GMutex *mutex;
extern GCond *start_cond; /* used to notify main thread of thread startups */
extern GCond *sync_cond; /* used to synchronize all threads and main thread */
#define MAIN_START_THREADS(count, function, data) \
MAIN_INIT(); \
MAIN_START_THREAD_FUNCTIONS(count, function, data); \
MAIN_SYNCHRONIZE();
#define MAIN_INIT() \
G_STMT_START { \
_gst_check_threads_running = TRUE; \
\
mutex = g_mutex_new (); \
start_cond = g_cond_new (); \
sync_cond = g_cond_new (); \
} G_STMT_END;
#define MAIN_START_THREAD_FUNCTIONS(count, function, data) \
G_STMT_START { \
int i; \
for (i = 0; i < count; ++i) { \
MAIN_START_THREAD_FUNCTION (i, function, data); \
} \
} G_STMT_END;
#define MAIN_START_THREAD_FUNCTION(i, function, data) \
G_STMT_START { \
GThread *thread = NULL; \
GST_DEBUG ("MAIN: creating thread %d", i); \
g_mutex_lock (mutex); \
thread = g_thread_create ((GThreadFunc) function, data, \
TRUE, NULL); \
/* wait for thread to signal us that it's ready */ \
GST_DEBUG ("MAIN: waiting for thread %d", i); \
g_cond_wait (start_cond, mutex); \
g_mutex_unlock (mutex); \
\
thread_list = g_list_append (thread_list, thread); \
} G_STMT_END;
#define MAIN_SYNCHRONIZE() \
G_STMT_START { \
GST_DEBUG ("MAIN: synchronizing"); \
g_cond_broadcast (sync_cond); \
GST_DEBUG ("MAIN: synchronized"); \
} G_STMT_END;
#define MAIN_STOP_THREADS() \
G_STMT_START { \
_gst_check_threads_running = FALSE; \
\
/* join all threads */ \
GST_DEBUG ("MAIN: joining"); \
g_list_foreach (thread_list, (GFunc) g_thread_join, NULL); \
GST_DEBUG ("MAIN: joined"); \
} G_STMT_END;
#define THREAD_START() \
THREAD_STARTED(); \
THREAD_SYNCHRONIZE();
#define THREAD_STARTED() \
G_STMT_START { \
/* signal main thread that we started */ \
GST_DEBUG ("THREAD %p: started", g_thread_self ()); \
g_mutex_lock (mutex); \
g_cond_signal (start_cond); \
} G_STMT_END;
#define THREAD_SYNCHRONIZE() \
G_STMT_START { \
/* synchronize everyone */ \
GST_DEBUG ("THREAD %p: syncing", g_thread_self ()); \
g_cond_wait (sync_cond, mutex); \
GST_DEBUG ("THREAD %p: synced", g_thread_self ()); \
g_mutex_unlock (mutex); \
} G_STMT_END;
#define THREAD_SWITCH() \
G_STMT_START { \
/* a minimal sleep is a context switch */ \
g_usleep (1); \
} G_STMT_END;
#define THREAD_TEST_RUNNING() (_gst_check_threads_running == TRUE)
/* additional assertions */
#define ASSERT_CRITICAL(code) \
G_STMT_START { \
_gst_check_expecting_log = TRUE; \
_gst_check_raised_critical = FALSE; \
code; \
_fail_unless (_gst_check_raised_critical, __FILE__, __LINE__, \
"Expected g_critical, got nothing"); \
_gst_check_expecting_log = FALSE; \
} G_STMT_END
#define ASSERT_WARNING(code) \
G_STMT_START { \
_gst_check_expecting_log = TRUE; \
_gst_check_raised_warning = FALSE; \
code; \
_fail_unless (_gst_check_raised_warning, __FILE__, __LINE__, \
"Expected g_warning, got nothing"); \
_gst_check_expecting_log = FALSE; \
} G_STMT_END
#define ASSERT_OBJECT_REFCOUNT(object, name, value) \
G_STMT_START { \
int rc; \
rc = GST_OBJECT_REFCOUNT_VALUE (object); \
fail_unless (rc == value, \
"%s (%p) refcount is %d instead of %d", \
name, object, rc, value); \
} G_STMT_END
#define ASSERT_OBJECT_REFCOUNT_BETWEEN(object, name, lower, upper) \
G_STMT_START { \
int rc = GST_OBJECT_REFCOUNT_VALUE (object); \
int lo = lower; \
int hi = upper; \
\
fail_unless (rc >= lo, \
"%s (%p) refcount %d is smaller than %d", \
name, object, rc, lo); \
fail_unless (rc <= hi, \
"%s (%p) refcount %d is bigger than %d", \
name, object, rc, hi); \
} G_STMT_END
#define ASSERT_CAPS_REFCOUNT(caps, name, value) \
ASSERT_MINI_OBJECT_REFCOUNT(caps, name, value)
#define ASSERT_BUFFER_REFCOUNT(buffer, name, value) \
ASSERT_MINI_OBJECT_REFCOUNT(buffer, name, value)
#define ASSERT_MINI_OBJECT_REFCOUNT(caps, name, value) \
G_STMT_START { \
int rc; \
rc = GST_MINI_OBJECT_REFCOUNT_VALUE (caps); \
fail_unless (rc == value, \
name " refcount is %d instead of %d", rc, value);\
} G_STMT_END
#define ASSERT_SET_STATE(element, state, ret) \
fail_unless (gst_element_set_state (element, \
state) == ret, \
"could not change state to " #state);
#endif /* __GST_CHECK_H__ */

View File

@@ -0,0 +1,202 @@
/* GStreamer
*
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
*
* gst-controller.h: dynamic parameter control 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_CONTROLLER_H__
#define __GST_CONTROLLER_H__
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gprintf.h>
#include <gst/gst.h>
G_BEGIN_DECLS
/**
* GST_PARAM_CONTROLLABLE:
*
* Use this flag on GstElement properties you wish to be (eventually) handled
* by a GstController.
* TODO: needs to go to gstelemnt.h (to avoid clashes on G_PARAM_USER_SHIFT)
*/
#define GST_PARAM_CONTROLLABLE (1 << (G_PARAM_USER_SHIFT + 1))
/**
* GstTimedValue:
*
* a structure for value+time
*/
typedef struct _GstTimedValue
{
GstClockTime timestamp; /* timestamp of the value change */
GValue value; /* the new value */
/* TODO what about storing the difference to next timestamp and value here
+ make calculations slightly easier and faster
- determining the GType for the value_dif is not simple
e.g. if value is G_TYPE_UCHAR value_diff needs to be G_TYPE_INT
*/
} GstTimedValue;
/**
* GstValueArray:
* @property_name: the name of the property this array belongs to
* @nbsamples: number of samples requested
* @sample_interval: interval between each sample
* @values: pointer to the array
*
* Structure to receive multiple values at once.
* If the pointer to the values array is NULL, it will be allocated (CHECKME).
*/
typedef struct _GstValueArray
{
gchar *property_name;
gint nbsamples;
GstClockTime sample_interval;
gpointer *values;
} GstValueArray;
/**
* GstInterpolateMode:
* @GST_INTERPOLATE_NONE: steps-like interpolation, default
* @GST_INTERPOLATE_TRIGGER: returns the default value of the property,
* except for times with specific values
* @GST_INTERPOLATE_LINEAR: linear interpolation
* @GST_INTERPOLATE_QUADRATIC: square interpolation
* @GST_INTERPOLATE_CUBIC: cubic interpolation
* @GST_INTERPOLATE_USER: user-provided interpolation
*
* The various interpolation modes available.
*/
typedef enum
{
GST_INTERPOLATE_NONE,
GST_INTERPOLATE_TRIGGER,
GST_INTERPOLATE_LINEAR,
GST_INTERPOLATE_QUADRATIC,
GST_INTERPOLATE_CUBIC,
GST_INTERPOLATE_USER
} GstInterpolateMode;
/* type macros */
#define GST_TYPE_CONTROLLER (gst_controller_get_type ())
#define GST_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CONTROLLER, GstController))
#define GST_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CONTROLLER, GstControllerClass))
#define GST_IS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CONTROLLER))
#define GST_IS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CONTROLLERE))
#define GST_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTROLLER, GstControllerClass))
typedef struct _GstController GstController;
typedef struct _GstControllerClass GstControllerClass;
/**
* GstController:
*
* The instance structure of GstController
*/
struct _GstController
{
GObject parent;
GList *properties; /* List of GstControlledProperty */
GMutex *lock; /* Secure property access, elements will access from threads */
GObject *object; /* the object we control */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstControllerClass
{
GObjectClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_controller_get_type (void);
/* GstController functions */
GstController *gst_controller_new_valist (GObject * object, va_list var_args);
GstController *gst_controller_new_list (GObject * object, GList *list);
GstController *gst_controller_new (GObject * object, ...) G_GNUC_NULL_TERMINATED;
gboolean gst_controller_remove_properties_valist (GstController * self,
va_list var_args);
gboolean gst_controller_remove_properties_list (GstController * self,
GList *list);
gboolean gst_controller_remove_properties (GstController * self, ...) G_GNUC_NULL_TERMINATED;
gboolean gst_controller_set (GstController * self, gchar * property_name,
GstClockTime timestamp, GValue * value);
gboolean gst_controller_set_from_list (GstController * self,
gchar * property_name, GSList * timedvalues);
gboolean gst_controller_unset (GstController * self, gchar * property_name,
GstClockTime timestamp);
gboolean gst_controller_unset_all (GstController * self, gchar * property_name);
GValue *gst_controller_get (GstController * self, gchar * property_name,
GstClockTime timestamp);
const GList *gst_controller_get_all (GstController * self,
gchar * property_name);
gboolean gst_controller_sync_values (GstController * self,
GstClockTime timestamp);
gboolean gst_controller_get_value_arrays (GstController * self,
GstClockTime timestamp, GSList * value_arrays);
gboolean gst_controller_get_value_array (GstController * self,
GstClockTime timestamp, GstValueArray * value_array);
gboolean gst_controller_set_interpolation_mode (GstController * self,
gchar * property_name, GstInterpolateMode mode);
/* GObject convenience functions */
GstController *gst_object_control_properties (GObject * object, ...) G_GNUC_NULL_TERMINATED;
gboolean gst_object_uncontrol_properties (GObject * object, ...) G_GNUC_NULL_TERMINATED;
GstController *gst_object_get_controller (GObject * object);
gboolean gst_object_set_controller (GObject * object, GstController * controller);
gboolean gst_object_sync_values (GObject * object, GstClockTime timestamp);
gboolean gst_object_get_value_arrays (GObject * object,
GstClockTime timestamp, GSList * value_arrays);
gboolean gst_object_get_value_array (GObject * object,
GstClockTime timestamp, GstValueArray * value_array);
/* lib init/done */
gboolean gst_controller_init (int * argc, char ***argv);
G_END_DECLS
#endif /* __GST_CONTROLLER_H__ */

View File

@@ -0,0 +1,132 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
*
* dataprotocol.h: Functions implementing the GStreamer Data Protocol
*
* 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_DATA_PROTOCOL_H__
#define __GST_DATA_PROTOCOL_H__
#include <gst/gstbuffer.h>
#include <gst/gstevent.h>
#include <gst/gstcaps.h>
G_BEGIN_DECLS
/**
* GST_DP_VERSION_MAJOR:
*
* The major version number of the GStreamer Data Protocol.
*/
#define GST_DP_VERSION_MAJOR 0
/**
* GST_DP_VERSION_MINOR:
*
* The minor version number of the GStreamer Data Protocol.
*/
#define GST_DP_VERSION_MINOR 2
/**
* GST_DP_HEADER_LENGTH:
*
* The header size in bytes.
*/
#define GST_DP_HEADER_LENGTH 62
/**
* GstDPHeaderFlag:
* @GST_DP_HEADER_FLAG_NONE: No flag present.
* @GST_DP_HEADER_FLAG_CRC_HEADER: a header CRC field is present.
* @GST_DP_HEADER_FLAG_CRC_PAYLOAD: a payload CRC field is present.
* @GST_DP_HEADER_FLAG_CRC: a CRC for header and payload is present.
*
* header flags for the dataprotocol.
*/
typedef enum {
GST_DP_HEADER_FLAG_NONE = 0,
GST_DP_HEADER_FLAG_CRC_HEADER = (1 << 0),
GST_DP_HEADER_FLAG_CRC_PAYLOAD = (1 << 1),
GST_DP_HEADER_FLAG_CRC = (1 << 1) | (1 <<0),
} GstDPHeaderFlag;
/**
* GstDPPayloadType:
* @GST_DP_PAYLOAD_NONE: Invalid payload type.
* @GST_DP_PAYLOAD_BUFFER: #GstBuffer payload packet.
* @GST_DP_PAYLOAD_CAPS: #GstCaps payload packet.
* @GST_DP_PAYLOAD_EVENT_NONE: First value of #GstEvent payload packets.
*
* The GDP payload types. a #GstEvent payload type is encoded with the
* event type number starting from @GST_DP_PAYLOAD_EVENT_NONE.
*/
typedef enum {
GST_DP_PAYLOAD_NONE = 0,
GST_DP_PAYLOAD_BUFFER,
GST_DP_PAYLOAD_CAPS,
GST_DP_PAYLOAD_EVENT_NONE = 64,
} GstDPPayloadType;
void gst_dp_init (void);
/* payload information from header */
guint32 gst_dp_header_payload_length (const guint8 * header);
GstDPPayloadType
gst_dp_header_payload_type (const guint8 * header);
/* converting from GstBuffer/GstEvent/GstCaps */
gboolean gst_dp_header_from_buffer (const GstBuffer * buffer,
GstDPHeaderFlag flags,
guint * length,
guint8 ** header);
gboolean gst_dp_packet_from_caps (const GstCaps * caps,
GstDPHeaderFlag flags,
guint * length,
guint8 ** header,
guint8 ** payload);
gboolean gst_dp_packet_from_event (const GstEvent * event,
GstDPHeaderFlag flags,
guint * length,
guint8 ** header,
guint8 ** payload);
/* converting to GstBuffer/GstEvent/GstCaps */
GstBuffer * gst_dp_buffer_from_header (guint header_length,
const guint8 * header);
GstCaps * gst_dp_caps_from_packet (guint header_length,
const guint8 * header,
const guint8 * payload);
GstEvent * gst_dp_event_from_packet (guint header_length,
const guint8 * header,
const guint8 * payload);
/* validation */
gboolean gst_dp_validate_header (guint header_length,
const guint8 * header);
gboolean gst_dp_validate_payload (guint header_length,
const guint8 * header,
const guint8 * payload);
gboolean gst_dp_validate_packet (guint header_length,
const guint8 * header,
const guint8 * payload);
G_END_DECLS
#endif /* __GST_DATA_PROTOCOL_H__ */

View File

@@ -0,0 +1,106 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Library <2002> Steve Baker <stevebaker_org@yahoo.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 __FLOATCAST_H__
#define __FLOATCAST_H__
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include <glib/gtypes.h>
G_BEGIN_DECLS
#if (HAVE_LRINT && HAVE_LRINTF)
/* These defines enable functionality introduced with the 1999 ISO C
** standard. They must be defined before the inclusion of math.h to
** engage them. If optimisation is enabled, these functions will be
** inlined. With optimisation switched off, you have to link in the
** maths library using -lm.
*/
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC9X 1
#define __USE_ISOC99 1
#include <math.h>
#define gst_cast_float(x) ((gint)lrintf(x))
#define gst_cast_double(x) ((gint)lrint(x))
#else
/* use a standard c cast, but do rounding correctly */
#define gst_cast_float(x) ((gint)floor((x)+0.5))
#define gst_cast_double(x) ((gint)floor((x)+0.5))
#endif
inline static gfloat
GFLOAT_SWAP_LE_BE(gfloat in)
{
gint32 swap;
gfloat out;
memcpy(&swap, &in, 4);
swap = GUINT32_SWAP_LE_BE_CONSTANT (swap);
memcpy(&out, &swap, 4);
return out;
}
inline static gdouble
GDOUBLE_SWAP_LE_BE(gdouble in)
{
gint64 swap;
gdouble out;
memcpy(&swap, &in, 8);
swap = GUINT64_SWAP_LE_BE_CONSTANT (swap);
memcpy(&out, &swap, 8);
return out;
}
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define GFLOAT_TO_LE(val) ((gfloat) (val))
#define GFLOAT_TO_BE(val) (GFLOAT_SWAP_LE_BE (val))
#define GDOUBLE_TO_LE(val) ((gdouble) (val))
#define GDOUBLE_TO_BE(val) (GDOUBLE_SWAP_LE_BE (val))
#elif G_BYTE_ORDER == G_BIG_ENDIAN
#define GFLOAT_TO_LE(val) (GFLOAT_SWAP_LE_BE (val))
#define GFLOAT_TO_BE(val) ((gfloat) (val))
#define GDOUBLE_TO_LE(val) (GDOUBLE_SWAP_LE_BE (val))
#define GDOUBLE_TO_BE(val) ((gdouble) (val))
#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
#error unknown ENDIAN type
#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
#define GFLOAT_FROM_LE(val) (GFLOAT_TO_LE (val))
#define GFLOAT_FROM_BE(val) (GDOUBLE_TO_BE (val))
#define GDOUBLE_FROM_LE(val) (GFLOAT_TO_LE (val))
#define GDOUBLE_FROM_BE(val) (GDOUBLE_TO_BE (val))
G_END_DECLS
#endif /* __FLOATCAST_H__ */

View File

@@ -0,0 +1,46 @@
/* 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
/* added in GLib 2.8 */
#if !GLIB_CHECK_VERSION (2, 8, 0)
#if __GNUC__ >= 4
#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
#else
#define G_GNUC_NULL_TERMINATED
#endif
#endif
G_END_DECLS
#endif /* __GST_GLIB_COMPAT_H__ */

View File

@@ -0,0 +1,90 @@
/* 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/gstcaps.h>
#include <gst/gstchildproxy.h>
#include <gst/gstclock.h>
#include <gst/gstelement.h>
#include <gst/gsterror.h>
#include <gst/gstevent.h>
#include <gst/gstghostpad.h>
#include <gst/gstindex.h>
#include <gst/gstindexfactory.h>
#include <gst/gstinfo.h>
#include <gst/gstinterface.h>
#include <gst/gstiterator.h>
#include <gst/gstmarshal.h>
#include <gst/gstmessage.h>
#include <gst/gstminiobject.h>
#include <gst/gstobject.h>
#include <gst/gstpad.h>
#include <gst/gstpipeline.h>
#include <gst/gstplugin.h>
#include <gst/gstquery.h>
#include <gst/gstregistry.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/gsttrace.h>
#include <gst/gsttypefind.h>
#include <gst/gsttypefindfactory.h>
#include <gst/gsturi.h>
#include <gst/gstutils.h>
#include <gst/gstvalue.h>
#include <gst/gstxml.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);
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);
G_END_DECLS
#endif /* __GST_H__ */

View File

@@ -0,0 +1,178 @@
/* 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_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 {
/* padding */
GST_BIN_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 5)
} GstBinFlags;
typedef struct _GstBin GstBin;
typedef struct _GstBinClass GstBinClass;
/**
* 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: the list of children in this bin
* @children_cookie: updated whenever @children changes
* @child_bus: internal bus for handling child messages
* @messages: queued and cached messages
* @polling: the bin is currently calculating its state
* @state_dirty: the bin needs to recalculate its state
* @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 >*/
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 overriden to implement custom
* message handling.
*/
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 >*/
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 interface);
/* 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 interface);
G_END_DECLS
#endif /* __GST_BIN_H__ */

View File

@@ -0,0 +1,413 @@
/* 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/gstcaps.h>
G_BEGIN_DECLS
typedef struct _GstBuffer GstBuffer;
typedef struct _GstBufferClass GstBufferClass;
/**
* GST_BUFFER_TRACE_NAME:
*
* The name used for tracing memory allocations.
*/
#define GST_BUFFER_TRACE_NAME "GstBuffer"
#define GST_TYPE_BUFFER (gst_buffer_get_type())
#define GST_IS_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BUFFER))
#define GST_IS_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BUFFER))
#define GST_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BUFFER, GstBufferClass))
#define GST_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_BUFFER, GstBuffer))
#define GST_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BUFFER, GstBufferClass))
#define GST_BUFFER_CAST(obj) ((GstBuffer *)(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_DATA:
* @buf: a #GstBuffer.
*
* A pointer to the data element of this buffer.
*/
#define GST_BUFFER_DATA(buf) (GST_BUFFER_CAST(buf)->data)
/**
* GST_BUFFER_SIZE:
* @buf: a #GstBuffer.
*
* The size in bytes of the data in this buffer.
*/
#define GST_BUFFER_SIZE(buf) (GST_BUFFER_CAST(buf)->size)
/**
* GST_BUFFER_TIMESTAMP:
* @buf: a #GstBuffer.:
*
* The timestamp in nanoseconds (as a #GstClockTime) of the data in the buffer.
* Value will be %GST_CLOCK_TIME_NONE if the timestamp is unknown.
*
*/
#define GST_BUFFER_TIMESTAMP(buf) (GST_BUFFER_CAST(buf)->timestamp)
/**
* 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_CAPS:
* @buf: a #GstBuffer.
*
* The caps for this buffer.
*/
#define GST_BUFFER_CAPS(buf) (GST_BUFFER_CAST(buf)->caps)
/**
* 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_MALLOCDATA:
* @buf: a #GstBuffer.
*
* A pointer to any data allocated for this buffer using malloc(). If this is
* non-NULL, this memory will be freed at the end of the buffer's lifecycle
* (i.e. when its refcount becomes zero).
*/
#define GST_BUFFER_MALLOCDATA(buf) (GST_BUFFER_CAST(buf)->malloc_data)
/**
* 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_TIMESTAMP_IS_VALID:
* @buffer: a #GstBuffer
*
* Tests if the timestamp is known.
*/
#define GST_BUFFER_TIMESTAMP_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (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)
/**
* GstBufferFlag:
* @GST_BUFFER_FLAG_READONLY: the buffer is read-only. This means the data of
* the buffer should not be modified. The metadata might still be modified.
* @GST_BUFFER_FLAG_PREROLL: the buffer is part of a preroll and should not be
* displayed.
* @GST_BUFFER_FLAG_DISCONT: the buffer marks a discontinuity in the stream. This
* typically occurs after a seek or a dropped buffer from a live or network source.
* @GST_BUFFER_FLAG_IN_CAPS: the buffer has been added as a field in a #GstCaps.
* @GST_BUFFER_FLAG_GAP: the buffer has been created to fill a gap in the stream.
* @GST_BUFFER_FLAG_DELTA_UNIT: this unit cannot be decoded independently.
* @GST_BUFFER_FLAG_LAST: additional 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_READONLY = GST_MINI_OBJECT_FLAG_READONLY,
GST_BUFFER_FLAG_PREROLL = (GST_MINI_OBJECT_FLAG_LAST << 0),
GST_BUFFER_FLAG_DISCONT = (GST_MINI_OBJECT_FLAG_LAST << 1),
GST_BUFFER_FLAG_IN_CAPS = (GST_MINI_OBJECT_FLAG_LAST << 2),
GST_BUFFER_FLAG_GAP = (GST_MINI_OBJECT_FLAG_LAST << 3),
GST_BUFFER_FLAG_DELTA_UNIT = (GST_MINI_OBJECT_FLAG_LAST << 4),
/* padding */
GST_BUFFER_FLAG_LAST = (GST_MINI_OBJECT_FLAG_LAST << 8)
} GstBufferFlag;
/**
* GstBuffer:
* @mini_object: the parent structure
* @data: pointer to the buffer data
* @size: size of buffer data
* @timestamp: timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
* timestamp is not known or relevant.
* @duration: duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
* when the duration is not known or relevant.
* @caps: the #GstCaps describing the data format in this buffer
* @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.
* @malloc_data: a pointer to the allocated memory associated with this buffer.
* When the buffer is freed, this data will freed with free().
*
* The structure of a #GstBuffer. Use the associated macros to access the public
* variables.
*/
struct _GstBuffer {
GstMiniObject mini_object;
/*< public >*/ /* with COW */
/* pointer to data and its size */
guint8 *data;
guint size;
/* timestamp */
GstClockTime timestamp;
GstClockTime duration;
/* the media type of this buffer */
GstCaps *caps;
/* media specific offset */
guint64 offset;
guint64 offset_end;
guint8 *malloc_data;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstBufferClass {
GstMiniObjectClass mini_object_class;
};
/* allocation */
GType gst_buffer_get_type (void);
GstBuffer* gst_buffer_new (void);
GstBuffer* gst_buffer_new_and_alloc (guint size);
/**
* gst_buffer_set_data:
* @buf: a #GstBuffer
* @data: The data (a #guint8 *) to set on the buffer.
* @size: The size (in bytes, as a #guint) of the data being set.
*
* A convenience function to set the data and size on a buffer.
* This will replace any existing data pointer set on this buffer, but will
* not change GST_BUFFER_MALLOCDATA(), if any. Callers should ensure that
* GST_BUFFER_MALLOCDATA() is non-NULL, or should free that and set it to NULL.
*
* No checks are done on the data or size arguments passed.
*/
#define gst_buffer_set_data(buf, data, size) \
G_STMT_START { \
GST_BUFFER_DATA (buf) = data; \
GST_BUFFER_SIZE (buf) = size; \
} G_STMT_END
/* 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() and
* gst_buffer_is_metadata_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: @buf
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstBuffer * gst_buffer_ref (GstBuffer * buf);
#endif
static inline GstBuffer *
gst_buffer_ref (GstBuffer * buf)
{
/* not using a macro here because gcc-4.1 will complain
* if the return value isn't used (because of the cast) */
return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT (buf));
}
/**
* gst_buffer_unref:
* @buf: a #GstBuffer.
*
* Decreases the refcount of the buffer. If the refcount reaches 0, the buffer
* will be freed. If GST_BUFFER_MALLOCDATA() is non-NULL, this pointer will
* also be freed at this time.
*/
#define gst_buffer_unref(buf) gst_mini_object_unref (GST_MINI_OBJECT (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.
*/
#define gst_buffer_copy(buf) GST_BUFFER_CAST (gst_mini_object_copy (GST_MINI_OBJECT (buf)))
/**
* gst_buffer_is_writable:
* @buf: a #GstBuffer
*
* Tests if you can safely write data into a buffer's data array or validly
* modify the caps and timestamp metadata. Metadata in a GstBuffer is always
* writable, but it is only safe to change it when there is only one owner
* of the buffer - ie, the refcount is 1.
*/
#define gst_buffer_is_writable(buf) gst_mini_object_is_writable (GST_MINI_OBJECT (buf))
/**
* gst_buffer_make_writable:
* @buf: 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().
*/
#define gst_buffer_make_writable(buf) GST_BUFFER_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT (buf)))
/* Ensure that the metadata of the buffer is writable, even if the buffer data
* isn't */
gboolean gst_buffer_is_metadata_writable (GstBuffer *buf);
GstBuffer* gst_buffer_make_metadata_writable (GstBuffer *buf);
/**
* gst_buffer_replace:
* @obuf: pointer to a pointer to a #GstBuffer to be replaced.
* @nbuf: 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.
*/
#define gst_buffer_replace(obuf,nbuf) gst_mini_object_replace ((GstMiniObject **)(obuf), GST_MINI_OBJECT (nbuf))
GstCaps* gst_buffer_get_caps (GstBuffer *buffer);
void gst_buffer_set_caps (GstBuffer *buffer, GstCaps *caps);
/* creating a subbuffer */
GstBuffer* gst_buffer_create_sub (GstBuffer *parent, guint offset, guint size);
/* span, two buffers, intelligently */
gboolean gst_buffer_is_span_fast (GstBuffer *buf1, GstBuffer *buf2);
GstBuffer* gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2, guint32 len);
/**
* gst_value_set_buffer:
* @v: a #GstValue to receive the data
* @b: a #GstBuffer to assign to the GstValue
*
* Sets @b as the value of @v, correclty incrementing the refcount of
* the buffer.
*/
#define gst_value_set_buffer(v,b) gst_value_set_mini_object(v, GST_MINI_OBJECT(b))
/**
* gst_value_take_buffer:
* @v: a #GstValue to receive the data
* @b: a #GstBuffer to assign to the GstValue
*
* Sets @b as the value of @v, this function lets the GstValue
* take ownership of the buffer.
*/
#define gst_value_take_buffer(v,b) gst_value_take_mini_object(v, GST_MINI_OBJECT(b))
/**
* gst_value_get_buffer:
* @v: a #GstValue to qeury
*
* Receives a #GstBuffer as the value of @v. This function does not
* increase the refcount of the returned buffer so the buffer remains
* valid as long as you own a refcount to the GstValue.
*/
#define gst_value_get_buffer(v) GST_BUFFER (gst_value_get_mini_object(v))
/* --- protected --- */
void _gst_buffer_initialize (void);
G_END_DECLS
#endif /* __GST_BUFFER_H__ */

View File

@@ -0,0 +1,189 @@
/* 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
* @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 data);
/**
* GstBusFunc:
* @bus: the #GstBus that sent the message
* @message: the #GstMessage
* @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 data);
/**
* GstBus:
*
* The opaque #GstBus data structure.
*/
struct _GstBus
{
GstObject object;
/*< private > */
GQueue *queue;
GMutex *queue_lock;
GstBusSyncHandler sync_handler;
gpointer sync_handler_data;
guint signal_watch_id;
guint num_signal_watchers;
/*< private > */
GstBusPrivate *priv;
gpointer _gst_reserved[GST_PADDING - 1];
};
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);
void gst_bus_set_flushing (GstBus * bus, gboolean flushing);
/* synchronous dispatching */
void gst_bus_set_sync_handler (GstBus * bus, GstBusSyncHandler func,
gpointer data);
/* 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,
GstClockTimeDiff 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__ */

View File

@@ -0,0 +1,248 @@
/* 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/gststructure.h>
#include <gst/glib-compat.h>
G_BEGIN_DECLS
#define GST_TYPE_CAPS (gst_caps_get_type())
#define GST_CAPS(object) ((GstCaps*)object)
#define GST_IS_CAPS(object) ((object) && (GST_CAPS(object)->type == GST_TYPE_CAPS))
#define GST_TYPE_STATIC_CAPS (gst_static_caps_get_type())
/**
* GstCapsFlags:
* @GST_CAPS_FLAGS_ANY: Caps has no specific content, but can contain
* anything.
*
* Extra flags for a caps.
*/
typedef enum {
GST_CAPS_FLAGS_ANY = (1 << 0)
} GstCapsFlags;
/**
* GST_CAPS_ANY:
*
* Means that the element/pad can output 'anything'. Useful for elements
* that output unknown media, such as filesrc.
*/
#define GST_CAPS_ANY gst_caps_new_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.
*/
#define GST_CAPS_NONE gst_caps_new_empty()
/**
* 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)
#ifndef GST_DISABLE_DEPRECATED
/**
* GST_DEBUG_CAPS:
* @string: a string that should be prepended to the caps data.
* @caps: the #GstCaps instance to print
*
* Convenience macro for printing out the contents of caps with GST_DEBUG().
*
* Deprecated: do not use anymore
*/
#define GST_DEBUG_CAPS(string, caps) \
GST_DEBUG ( string "%s: " GST_PTR_FORMAT, caps)
#endif
/**
* 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 */ { 0 }, \
/* string */ string, \
}
typedef struct _GstCaps GstCaps;
typedef struct _GstStaticCaps GstStaticCaps;
/* refcount */
/**
* GST_CAPS_REFCOUNT:
* @caps: a #GstCaps
*
* Get access to the reference count field of the caps
*/
#define GST_CAPS_REFCOUNT(caps) ((GST_CAPS(caps))->refcount)
/**
* GST_CAPS_REFCOUNT_VALUE:
* @caps: a #GstCaps
*
* Get the reference count value of the caps.
*/
#define GST_CAPS_REFCOUNT_VALUE(caps) (g_atomic_int_get (&(GST_CAPS(caps))->refcount))
/**
* GstCaps:
* @type: GType of the caps
* @refcount: the atomic refcount value
* @flags: extra flags for the caps, read only.
*
* Object describing media types.
*/
struct _GstCaps {
GType type;
/*< public >*/ /* with COW */
/* refcounting */
gint refcount;
/*< public >*/ /* read only */
GstCapsFlags flags;
/*< private >*/
GPtrArray *structs;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* 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_simple (const char *media_type,
const char *fieldname,
...);
GstCaps * gst_caps_new_full (GstStructure *struct1,
...);
GstCaps * gst_caps_new_full_valist (GstStructure *structure,
va_list var_args);
/* reference counting */
GstCaps * gst_caps_ref (GstCaps* caps);
GstCaps * gst_caps_copy (const GstCaps * caps);
GstCaps * gst_caps_make_writable (GstCaps *caps);
void gst_caps_unref (GstCaps* caps);
GType gst_static_caps_get_type (void);
GstCaps * gst_static_caps_get (GstStaticCaps *static_caps);
/* manipulation */
void gst_caps_append (GstCaps *caps1,
GstCaps *caps2);
void gst_caps_append_structure (GstCaps *caps,
GstStructure *structure);
guint gst_caps_get_size (const GstCaps *caps);
GstStructure * gst_caps_get_structure (const GstCaps *caps,
guint index);
GstCaps * gst_caps_copy_nth (const GstCaps * caps, guint nth);
void gst_caps_truncate (GstCaps * caps);
void gst_caps_set_simple (GstCaps *caps,
char *field, ...) G_GNUC_NULL_TERMINATED;
void gst_caps_set_simple_valist (GstCaps *caps,
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_equal (const GstCaps *caps1,
const GstCaps *caps2);
gboolean gst_caps_is_equal_fixed (const GstCaps * caps1,
const GstCaps * caps2);
/* operations */
GstCaps * gst_caps_intersect (const GstCaps *caps1,
const GstCaps *caps2);
GstCaps * gst_caps_subtract (const GstCaps *minuend,
const GstCaps *subtrahend);
GstCaps * gst_caps_union (const GstCaps *caps1,
const GstCaps *caps2);
GstCaps * gst_caps_normalize (const GstCaps *caps);
gboolean gst_caps_do_simplify (GstCaps *caps);
#ifndef GST_DISABLE_LOADSAVE
xmlNodePtr gst_caps_save_thyself (const GstCaps *caps,
xmlNodePtr parent);
GstCaps * gst_caps_load_thyself (xmlNodePtr parent);
#endif
/* utility */
void gst_caps_replace (GstCaps **caps,
GstCaps *newcaps);
gchar * gst_caps_to_string (const GstCaps *caps);
GstCaps * gst_caps_from_string (const gchar *string);
G_END_DECLS
#endif /* __GST_CAPS_H__ */

View File

@@ -0,0 +1,76 @@
/* 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))
typedef struct _GstChildProxy GstChildProxy; /* dummy object */
typedef struct _GstChildProxyInterface GstChildProxyInterface;
struct _GstChildProxyInterface
{
GTypeInterface parent;
/* methods */
GstObject *(*get_child_by_index) (GstChildProxy * parent, guint index);
guint (*get_children_count) (GstChildProxy * parent);
/* signals */
void (*child_added) (GstChildProxy * parent, GstObject * child);
void (*child_removed) (GstChildProxy * parent, GstObject * child);
gpointer _gst_reserved[GST_PADDING];
};
GType gst_child_proxy_get_type (void);
GstObject *gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name);
GstObject *gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index);
guint gst_child_proxy_get_children_count (GstChildProxy * parent);
gboolean gst_child_proxy_lookup (GstObject *object, const gchar *name,
GstObject **target, GParamSpec **pspec);
void gst_child_proxy_get_property (GstObject * object, const gchar *name, GValue *value);
void gst_child_proxy_get_valist (GstObject * object,
const gchar * first_property_name, va_list var_args);
void gst_child_proxy_get (GstObject * object, const gchar * first_property_name,
...) G_GNUC_NULL_TERMINATED;
void gst_child_proxy_set_property (GstObject * object, const gchar *name, const GValue *value);
void gst_child_proxy_set_valist (GstObject* object,
const gchar * first_property_name, va_list var_args);
void gst_child_proxy_set (GstObject * object, const gchar * first_property_name,
...) G_GNUC_NULL_TERMINATED;
void gst_child_proxy_child_added (GstObject * object, GstObject * child);
void gst_child_proxy_child_removed (GstObject * object, GstObject * child);
G_END_DECLS
#endif /* __GST_CHILD_PROXY_H__ */

View File

@@ -0,0 +1,490 @@
/* 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__
#include <gst/gstobject.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))
#define GST_CLOCK_SLAVE_LOCK(clock) g_mutex_lock (GST_CLOCK_CAST (clock)->slave_lock)
#define GST_CLOCK_SLAVE_UNLOCK(clock) g_mutex_unlock (GST_CLOCK_CAST (clock)->slave_lock)
/**
* 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 timedifference, 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.
*/
#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)
/**
* GST_SECOND:
*
* Constant that defines one GStreamer second.
*/
#define GST_SECOND (G_USEC_PER_SEC * G_GINT64_CONSTANT (1000))
/**
* GST_MSECOND:
*
* Constant that defines one GStreamer millisecond.
*/
#define GST_MSECOND (GST_SECOND / G_GINT64_CONSTANT (1000))
/**
* GST_USECOND:
*
* Constant that defines one GStreamer microsecond.
*/
#define GST_USECOND (GST_SECOND / G_GINT64_CONSTANT (1000000))
/**
* GST_NSECOND:
*
* Constant that defines one GStreamer nanosecond
*/
#define GST_NSECOND (GST_SECOND / G_GINT64_CONSTANT (1000000000))
/**
* 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) ((tv).tv_sec * GST_SECOND + (tv).tv_usec * GST_USECOND)
/**
* GST_TIME_TO_TIMEVAL:
* @t: The GstClockTime to convert
* @tv: The target timeval
*
* 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.
*
* Convert a GstClockTime to a GTimeVal
*/
#define GST_TIME_TO_TIMEVAL(t,tv) \
G_STMT_START { \
(tv).tv_sec = ((GstClockTime) (t)) / GST_SECOND; \
(tv).tv_usec = (((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) ((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 { \
(ts).tv_sec = (t) / GST_SECOND; \
(ts).tv_nsec = ((t) - (ts).tv_sec * GST_SECOND) / GST_NSECOND; \
} G_STMT_END
/* timestamp debugging macros */
/**
* GST_TIME_FORMAT:
*
* A format that can be used in printf like format strings to format
* a GstClockTime value.
*/
#define GST_TIME_FORMAT "u:%02u:%02u.%09u"
/**
* GST_TIME_ARGS:
* @t: a #GstClockTime
*
* Format @t for the GST_TIME_FORMAT format string.
*/
#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
/**
* GST_CLOCK_ENTRY_TRACE_NAME:
*
* The name used for tracing clock entry allocations.
*/
#define GST_CLOCK_ENTRY_TRACE_NAME "GstClockEntry"
typedef struct _GstClockEntry GstClockEntry;
typedef struct _GstClock GstClock;
typedef struct _GstClockClass GstClockClass;
/* --- 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 async_wait call
*
* 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 succeded.
* @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 occured
* @GST_CLOCK_UNSUPPORTED: Operation is not supported
*
* 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,
} 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.
*/
struct _GstClockEntry {
gint refcount;
/*< protected >*/
GstClock *clock;
GstClockEntryType type;
GstClockTime time;
GstClockTime interval;
GstClockReturn status;
GstClockCallback func;
gpointer user_data;
};
/**
* 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_CLOCK(clock)->flags)
/**
* GST_CLOCK_COND:
* @clock: the clock to query
*
* Gets the #GCond that gets signaled when the entries of the clock
* changed.
*/
#define GST_CLOCK_COND(clock) (GST_CLOCK_CAST(clock)->entries_changed)
/**
* GST_CLOCK_WAIT:
* @clock: the clock to wait on
*
* Wait on the clock until the entries changed.
*/
#define GST_CLOCK_WAIT(clock) g_cond_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock))
/**
* GST_CLOCK_TIMED_WAIT:
* @clock: the clock to wait on
* @tv: a GTimeVal to wait.
*
* Wait on the clock until the entries changed or the specified timeout
* occured.
*/
#define GST_CLOCK_TIMED_WAIT(clock,tv) g_cond_timed_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock),tv)
/**
* GST_CLOCK_BROADCAST:
* @clock: the clock to broadcast
*
* Signal that the entries in the clock have changed.
*/
#define GST_CLOCK_BROADCAST(clock) g_cond_broadcast(GST_CLOCK_COND(clock))
/**
* GstClock:
* @flags: The flags specifying the capabilities of the clock.
*
* GstClock base structure. The values of this structure are
* protected for subclasses, use the methods to use the #GstClock.
*/
struct _GstClock {
GstObject object;
GMutex *slave_lock; /* order: SLAVE_LOCK, OBJECT_LOCK */
/*< protected >*/ /* with LOCK */
GstClockTime internal_calibration;
GstClockTime external_calibration;
GstClockTime rate_numerator;
GstClockTime rate_denominator;
GstClockTime last_time;
GList *entries;
GCond *entries_changed;
/*< private >*/ /* with LOCK */
GstClockTime resolution;
gboolean stats;
/* for master/slave clocks */
GstClock *master;
/* with SLAVE_LOCK */
gboolean filling;
gint window_size;
gint window_threshold;
gint time_index;
GstClockTime timeout;
GstClockTime *times;
GstClockID clockid;
/*< private >*/
GstClockTime _gst_reserved[GST_PADDING];
};
struct _GstClockClass {
GstObjectClass parent_class;
/*< protected >*/
/* 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);
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);
gboolean gst_clock_add_observation (GstClock *clock, GstClockTime slave,
GstClockTime master, gdouble *r_squared);
/* getting and adjusting internal time */
GstClockTime gst_clock_get_internal_time (GstClock *clock);
GstClockTime gst_clock_adjust_unlocked (GstClock *clock, GstClockTime internal);
/* 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);
void gst_clock_id_unschedule (GstClockID id);
G_END_DECLS
#endif /* __GST_CLOCK_H__ */

View File

@@ -0,0 +1,43 @@
/* 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
#ifndef GST_DISABLE_DEPRECATED
#endif /* not GST_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __GSTCOMPAT_H__ */

View File

@@ -0,0 +1,161 @@
/* 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>
* <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_LOADSAVE_REGISTRY 1
#define GST_DISABLE_GST_DEBUG 1
#define GST_DISABLE_LOADSAVE 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_ENUMTYPES 1
#define GST_DISABLE_INDEX 1
#define GST_DISABLE_PLUGIN 1
#define GST_DISABLE_URI 1
#define GST_HAVE_GLIB_2_8 1
#endif
/***** default padding of structures *****/
#define GST_PADDING 4
#define GST_PADDING_INIT {0}
/***** padding for very extensible base classes *****/
#define GST_PADDING_LARGE 20
/***** disabling of subsystems *****/
/* wether or not the debugging subsystem is enabled */
/* #undef GST_DISABLE_GST_DEBUG */
/* DOES NOT WORK */
/* #undef GST_DISABLE_LOADSAVE */
/* DOES NOT WORK */
/* #undef GST_DISABLE_PARSE */
/* DOES NOT WORK */
/* #undef GST_DISABLE_TRACE */
/* DOES NOT WORK */
/* #undef GST_DISABLE_ALLOC_TRACE */
/* DOES NOT WORK */
/* #undef GST_DISABLE_REGISTRY */
/* DOES NOT WORK */
/* #undef GST_DISABLE_ENUMTYPES */
/* DOES NOT WORK */
/* #undef GST_DISABLE_INDEX */
/* DOES NOT WORK */
/* #undef GST_DISABLE_PLUGIN */
/* DOES NOT WORK */
/* #undef GST_DISABLE_URI */
/* 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"
/* whether or not the CPU supports unaligned access */
#define GST_HAVE_UNALIGNED_ACCESS 1
/* whether or not we are using glib 2.8 api, e.g. atomic gobject
refcounting */
#define GST_HAVE_GLIB_2_8 1
/***** Deal with XML stuff, we have to handle both loadsave and registry *****/
#if (! (defined(GST_DISABLE_LOADSAVE) && defined(GST_DISABLE_REGISTRY)) )
# include <libxml/parser.h>
#else
# define GST_DISABLE_LOADSAVE_REGISTRY
#endif
/**
* 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.
*/
#if defined(WIN32) && (!defined(__MINGW32__))
#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 WIN32 */
#define GST_PLUGIN_EXPORT
#define GST_EXPORT extern
#endif
#endif /* __GST_CONFIG_H__ */

View File

@@ -0,0 +1,599 @@
/* 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
* @GST_STATE_PLAYING : the element is PLAYING
*
* The posible states an element can be in.
*/
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/gstindex.h>
#include <gst/gstindexfactory.h>
#include <gst/gstiterator.h>
#include <gst/gstmessage.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 cannot be prerolled
*
* the possible return values from a state change function.
*/
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_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) ((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) (((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) ((trans)>>3)
/**
* GST_STATE_TRANSITION_NEXT:
* @trans: A #GstStateChange
*
* Given a state transition @trans, extract the next #GstState.
*/
#define GST_STATE_TRANSITION_NEXT(trans) ((trans)&0x7)
/**
* GstStateChange:
* @GST_STATE_CHANGE_NULL_TO_READY : state change from NULL to READY
* @GST_STATE_CHANGE_READY_TO_PAUSED : state change from READY to PAUSED
* @GST_STATE_CHANGE_PAUSED_TO_PLAYING: state change from PAUSED to PLAYING
* @GST_STATE_CHANGE_PLAYING_TO_PAUSED: state change from PLAYING to PAUSED
* @GST_STATE_CHANGE_PAUSED_TO_READY : state change from PAUSED to READY
* @GST_STATE_CHANGE_READY_TO_NULL : state change from READY to NULL
*
* The different (interesting) state changes that are passed to the
* state change functions of elements.
*/
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_LOCKED_STATE: ignore state changes from parent
* @GST_ELEMENT_IS_SINK: the element is a sink
* @GST_ELEMENT_UNPARENTING: Child is being removed from the parent bin.
* gst_bin_remove() on a child already being removed immediately returns FALSE
* @GST_ELEMENT_FLAG_LAST: offset to define more flags
*
* The standard flags that an element may have.
*/
typedef enum
{
GST_ELEMENT_LOCKED_STATE = (GST_OBJECT_FLAG_LAST << 0),
GST_ELEMENT_IS_SINK = (GST_OBJECT_FLAG_LAST << 1),
GST_ELEMENT_UNPARENTING = (GST_OBJECT_FLAG_LAST << 2),
/* padding */
GST_ELEMENT_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
} 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_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_ERROR:
* @el: the element that throws the error
* @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #GstGError)
* @code: error code defined for that domain (see #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 throw an error signal 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 throws the error
* @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #GstGError)
* @code: error code defined for that domain (see #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 throw a warning signal 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
/* 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_static_rec_mutex_lock(GST_STATE_GET_LOCK(elem))
#define GST_STATE_TRYLOCK(elem) g_static_rec_mutex_trylock(GST_STATE_GET_LOCK(elem))
#define GST_STATE_UNLOCK(elem) g_static_rec_mutex_unlock(GST_STATE_GET_LOCK(elem))
#define GST_STATE_UNLOCK_FULL(elem) g_static_rec_mutex_unlock_full(GST_STATE_GET_LOCK(elem))
#define GST_STATE_LOCK_FULL(elem,t) g_static_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_TIMED_WAIT(elem, timeval) g_cond_timed_wait (GST_STATE_GET_COND (elem), \
GST_OBJECT_GET_LOCK (elem), timeval)
#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()
* @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 by 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 stream time.
* @numpads: number of pads of the element, includes both source and sink pads.
* @pads: list of pads
* @numsrcpads: number of source pads of the element.
* @srcpads: list of source pads
* @numsinkpads: number of sink pads of the element.
* @sinkpads: 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 */
GStaticRecMutex *state_lock;
/* element state */
GCond *state_cond;
guint32 state_cookie;
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 */
/* 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
* @details: #GstElementDetails 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
* @get_index: set a #GstIndex on the element
* @set_index: get the #GstIndex of an element
* @send_event: send a #GstEvent to the element
* @get_query_types: get the supported #GstQueryType of this element
* @query: perform a #GstQuery on the element
*
* GStreamer element class. Override the vmethods to implement the element
* functionality.
*/
struct _GstElementClass
{
GstObjectClass parent_class;
/*< public >*/
/* the element details */
GstElementDetails details;
/* 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);
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);
/* bus */
void (*set_bus) (GstElement * element, GstBus * bus);
/* set/get clocks */
GstClock* (*provide_clock) (GstElement *element);
gboolean (*set_clock) (GstElement *element, GstClock *clock);
/* index */
GstIndex* (*get_index) (GstElement *element);
void (*set_index) (GstElement *element, GstIndex *index);
/* query functions */
gboolean (*send_event) (GstElement *element, GstEvent *event);
const GstQueryType* (*get_query_types) (GstElement *element);
gboolean (*query) (GstElement *element, GstQuery *query);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* 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);
void gst_element_class_set_details (GstElementClass *klass,
const GstElementDetails *details);
/* element instance */
GType gst_element_get_type (void);
/* basic name and parentage stuff from GstObject */
/**
* gst_element_get_name:
* @elem: a #GstElement to set the name of.
*
* Gets the name of the element.
*/
#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.
*
* Gets 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 */
gboolean gst_element_requires_clock (GstElement *element);
gboolean gst_element_provides_clock (GstElement *element);
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);
/* indexes */
gboolean gst_element_is_indexable (GstElement *element);
void gst_element_set_index (GstElement *element, GstIndex *index);
GstIndex* gst_element_get_index (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_pad (GstElement *element, const gchar *name);
GstPad* gst_element_get_static_pad (GstElement *element, const gchar *name);
GstPad* gst_element_get_request_pad (GstElement *element, const gchar *name);
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 cur_type, gint64 cur,
GstSeekType stop_type, gint64 stop);
G_CONST_RETURN GstQueryType*
gst_element_get_query_types (GstElement *element);
gboolean gst_element_query (GstElement *element, GstQuery *query);
/* messages */
gboolean gst_element_post_message (GstElement * element, GstMessage * message);
/* error handling */
gchar * _gst_element_error_printf (const gchar *format, ...);
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_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__ */

View File

@@ -0,0 +1,157 @@
/* 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__
typedef struct _GstElementFactory GstElementFactory;
typedef struct _GstElementFactoryClass GstElementFactoryClass;
#include <gst/gstconfig.h>
#include <gst/gstelement.h>
#include <gst/gstobject.h>
#include <gst/gstplugin.h>
#include <gst/gstpluginfeature.h>
#include <gst/gstiterator.h>
G_BEGIN_DECLS
typedef struct _GstElementDetails GstElementDetails;
/**
* GstElementDetails:
* @longname: long, english name
* @klass: type of element, as an unordered list separated with slashes ('/')
* @description: what the element is about
* @author: who wrote this thing?
*
* This struct defines the public information about a #GstElement. It contains
* meta-data about the element that is mostly for the benefit of editors.
*
* The @klass member can be used by applications to filter elements based
* on functionality.
*/
/* FIXME: need translatable stuff in here (how handle in registry)? */
struct _GstElementDetails
{
/*< public > */
gchar *longname;
gchar *klass;
gchar *description;
gchar *author;
/*< private > */
gpointer _gst_reserved[GST_PADDING];
};
/**
* GST_ELEMENT_DETAILS:
* @longname: long, english name
* @klass: type of element, as hierarchy
* @description: what the element is about
* @author: who wrote this thing?
*
* Macro to initialize #GstElementDetails.
*/
#define GST_ELEMENT_DETAILS(longname,klass,description,author) \
{ longname, klass, description, author, {0} }
/**
* GST_IS_ELEMENT_DETAILS:
* @details: the #GstElementDetails to check
*
* Tests if element details are initialized.
*/
/* FIXME: what about adding '&& (*__gst_reserved==NULL)' */
#define GST_IS_ELEMENT_DETAILS(details) ( \
(details) && ((details)->longname != NULL) && ((details)->klass != NULL) \
&& ((details)->description != NULL) && ((details)->author != NULL))
#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))
/**
* GstElementFactory:
*
* The opaque #GstElementFactory data structure.
*/
struct _GstElementFactory {
GstPluginFeature parent;
GType type; /* unique GType of element or 0 if not loaded */
GstElementDetails details;
GList * staticpadtemplates;
guint numpadtemplates;
/* URI interface stuff */
guint uri_type;
gchar ** uri_protocols;
GList * interfaces; /* interfaces this element implements */
gpointer _gst_reserved[GST_PADDING];
};
struct _GstElementFactoryClass {
GstPluginFeatureClass parent_class;
gpointer _gst_reserved[GST_PADDING];
};
GType gst_element_factory_get_type (void);
GstElementFactory * gst_element_factory_find (const gchar *name);
GType gst_element_factory_get_element_type (GstElementFactory *factory);
G_CONST_RETURN gchar * gst_element_factory_get_longname (GstElementFactory *factory);
G_CONST_RETURN gchar * gst_element_factory_get_klass (GstElementFactory *factory);
G_CONST_RETURN gchar * gst_element_factory_get_description (GstElementFactory *factory);
G_CONST_RETURN gchar * gst_element_factory_get_author (GstElementFactory *factory);
guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory);
G_CONST_RETURN GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory);
gint gst_element_factory_get_uri_type (GstElementFactory *factory);
gchar ** gst_element_factory_get_uri_protocols (GstElementFactory *factory);
GstElement* gst_element_factory_create (GstElementFactory *factory,
const gchar *name);
GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name);
void __gst_element_factory_add_static_pad_template (GstElementFactory *elementfactory,
GstStaticPadTemplate *templ);
void __gst_element_factory_add_interface (GstElementFactory *elementfactory,
const gchar *interfacename);
gboolean gst_element_register (GstPlugin *plugin, const gchar *name,
guint rank, GType type);
G_END_DECLS
#endif /* __GST_ELEMENT_FACTORY_H__ */

View File

@@ -0,0 +1,175 @@
/* Generated data (by glib-mkenums) */
#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 "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_flag_get_type (void);
#define GST_TYPE_BUFFER_FLAG (gst_buffer_flag_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())
/* 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 "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_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())
/* enumerations from "gstformat.h" */
GType gst_format_get_type (void);
#define GST_TYPE_FORMAT (gst_format_get_type())
/* enumerations from "gstindex.h" */
GType gst_index_certainty_get_type (void);
#define GST_TYPE_INDEX_CERTAINTY (gst_index_certainty_get_type())
GType gst_index_entry_type_get_type (void);
#define GST_TYPE_INDEX_ENTRY_TYPE (gst_index_entry_type_get_type())
GType gst_index_lookup_method_get_type (void);
#define GST_TYPE_INDEX_LOOKUP_METHOD (gst_index_lookup_method_get_type())
GType gst_assoc_flags_get_type (void);
#define GST_TYPE_ASSOC_FLAGS (gst_assoc_flags_get_type())
GType gst_index_resolver_method_get_type (void);
#define GST_TYPE_INDEX_RESOLVER_METHOD (gst_index_resolver_method_get_type())
GType gst_index_flags_get_type (void);
#define GST_TYPE_INDEX_FLAGS (gst_index_flags_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())
/* enumerations from "gstminiobject.h" */
GType gst_mini_object_flags_get_type (void);
#define GST_TYPE_MINI_OBJECT_FLAGS (gst_mini_object_flags_get_type())
/* enumerations from "gstpad.h" */
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_activate_mode_get_type (void);
#define GST_TYPE_ACTIVATE_MODE (gst_activate_mode_get_type())
GType gst_pad_direction_get_type (void);
#define GST_TYPE_PAD_DIRECTION (gst_pad_direction_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())
/* 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_get_type (void);
#define GST_TYPE_QUERY_TYPE (gst_query_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())
/* enumerations from "gsttask.h" */
GType gst_task_state_get_type (void);
#define GST_TYPE_TASK_STATE (gst_task_state_get_type())
/* enumerations from "gsttrace.h" */
GType gst_alloc_trace_flags_get_type (void);
#define GST_TYPE_ALLOC_TRACE_FLAGS (gst_alloc_trace_flags_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_type_get_type (void);
#define GST_TYPE_URI_TYPE (gst_uri_type_get_type())
/* enumerations from "gstparse.h" */
GType gst_parse_error_get_type (void);
#define GST_TYPE_PARSE_ERROR (gst_parse_error_get_type())
G_END_DECLS
#endif /* __GST_ENUM_TYPES_H__ */
/* Generated data ends here */

View File

@@ -0,0 +1,242 @@
/* 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_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_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_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_NUM_ERRORS
} GstStreamError;
#define GST_TYPE_G_ERROR (gst_g_error_get_type ())
/**
* 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))
GType gst_g_error_get_type (void);
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__ */

View File

@@ -0,0 +1,423 @@
/* 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__
#include <gst/gstminiobject.h>
#include <gst/gstformat.h>
#include <gst/gstobject.h>
#include <gst/gstclock.h>
#include <gst/gststructure.h>
#include <gst/gsttaglist.h>
G_BEGIN_DECLS
/**
* 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.
*
* #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,
} 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_TYPE_SHIFT 4
/**
* 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_TYPE_SHIFT) | (flags))
#define FLAG(name) GST_EVENT_TYPE_##name
/**
* GstEventType:
* @GST_EVENT_UNKNOWN: unknown event.
* @GST_EVENT_FLUSH_START: Start a flush operation
* @GST_EVENT_FLUSH_STOP: Stop a flush operation
* @GST_EVENT_EOS: End-Of-Stream. No more data is to be expected to follow
* without a NEWSEGMENT event.
* @GST_EVENT_NEWSEGMENT: A new media segment follows in the dataflow.
* @GST_EVENT_TAG: A new set of metadata tags has been found in the stream.
* @GST_EVENT_BUFFERSIZE: Notification of buffering requirements
* @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements
* that the downstream elements are being starved of or
* flooded with data.
* @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_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_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 (1, FLAG(BOTH)),
GST_EVENT_FLUSH_STOP = GST_EVENT_MAKE_TYPE (2, FLAG(BOTH) | FLAG(SERIALIZED)),
/* downstream serialized events */
GST_EVENT_EOS = GST_EVENT_MAKE_TYPE (5, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
GST_EVENT_NEWSEGMENT = GST_EVENT_MAKE_TYPE (6, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
GST_EVENT_TAG = GST_EVENT_MAKE_TYPE (7, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
GST_EVENT_BUFFERSIZE = GST_EVENT_MAKE_TYPE (8, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
/* upstream events */
GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (15, FLAG(UPSTREAM)),
GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (16, FLAG(UPSTREAM)),
GST_EVENT_NAVIGATION = GST_EVENT_MAKE_TYPE (17, FLAG(UPSTREAM)),
/* custom events start here */
GST_EVENT_CUSTOM_UPSTREAM = GST_EVENT_MAKE_TYPE (32, FLAG(UPSTREAM)),
GST_EVENT_CUSTOM_DOWNSTREAM = GST_EVENT_MAKE_TYPE (32, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
GST_EVENT_CUSTOM_DOWNSTREAM_OOB = GST_EVENT_MAKE_TYPE (32, FLAG(DOWNSTREAM)),
GST_EVENT_CUSTOM_BOTH = GST_EVENT_MAKE_TYPE (32, FLAG(BOTH) | FLAG(SERIALIZED)),
GST_EVENT_CUSTOM_BOTH_OOB = GST_EVENT_MAKE_TYPE (32, FLAG(BOTH))
} GstEventType;
#undef FLAG
/**
* GST_EVENT_TRACE_NAME:
*
* The name used for memory allocation tracing
*/
#define GST_EVENT_TRACE_NAME "GstEvent"
typedef struct _GstEvent GstEvent;
typedef struct _GstEventClass GstEventClass;
#define GST_TYPE_EVENT (gst_event_get_type())
#define GST_IS_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_EVENT))
#define GST_IS_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_EVENT))
#define GST_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_EVENT, GstEventClass))
#define GST_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_EVENT, GstEvent))
#define GST_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_EVENT, GstEventClass))
#define GST_EVENT_CAST(obj) ((GstEvent *)(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_SRC:
* @event: the event to query
*
* The source #GstObject that generated this event.
*/
#define GST_EVENT_SRC(event) (GST_EVENT_CAST(event)->src)
/**
* 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_replace:
* @old_event: pointer to a pointer to a #GstEvent to be replaced.
* @new_event: 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.
*
* Since: 0.10.3
*/
#define gst_event_replace(old_event,new_event) \
gst_mini_object_replace ((GstMiniObject **)(old_event), GST_MINI_OBJECT (new_event))
/**
* GstSeekType:
* @GST_SEEK_TYPE_NONE: no change in position is required
* @GST_SEEK_TYPE_CUR: change relative to current position
* @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, a format,
* a seek method and optional flags are to be provided. The seek event is then
* inserted into the graph with gst_pad_send_event() or
* gst_element_send_event().
*/
typedef enum {
/* one of these */
GST_SEEK_TYPE_NONE = 0,
GST_SEEK_TYPE_CUR = 1,
GST_SEEK_TYPE_SET = 2,
GST_SEEK_TYPE_END = 3
} 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.
*
* Flags to be used with gst_element_seek() or gst_event_new_seek()
*
* 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
* 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 seemless looping
* or simple linear editing.
*/
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)
} GstSeekFlags;
/**
* GstEvent:
* @mini_object: the parent structure
* @type: the #GstEventType of the event
* @timestamp: the timestamp of the event
* @src: the src of the event
* @structure: the #GstStructure containing the event info.
*
* A #GstEvent.
*/
struct _GstEvent {
GstMiniObject mini_object;
/*< public >*/ /* with COW */
GstEventType type;
guint64 timestamp;
GstObject *src;
GstStructure *structure;
/*< private >*/
gpointer _gst_reserved;
};
struct _GstEventClass {
GstMiniObjectClass mini_object_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
void _gst_event_initialize (void);
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);
GType gst_event_get_type (void);
/* refcounting */
/**
* gst_event_ref:
* @ev: The event to refcount
*
* Increase the refcount of this event.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstEvent * gst_event_ref (GstEvent * ev);
#endif
static inline GstEvent *
gst_event_ref (GstEvent * ev)
{
/* not using a macro here because gcc-4.1 will complain
* if the return value isn't used (because of the cast) */
return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT (ev));
}
/**
* gst_event_unref:
* @ev: The event to refcount
*
* Decrease the refcount of an event, freeing it if the refcount reaches 0.
*/
#define gst_event_unref(ev) gst_mini_object_unref (GST_MINI_OBJECT (ev))
/* copy event */
/**
* gst_event_copy:
* @ev: The event to copy
*
* Copy the event using the event specific copy function.
*/
#define gst_event_copy(ev) GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT (ev)))
/* custom event */
GstEvent* gst_event_new_custom (GstEventType type, GstStructure *structure);
const GstStructure *
gst_event_get_structure (GstEvent *event);
/* flush events */
GstEvent * gst_event_new_flush_start (void);
GstEvent * gst_event_new_flush_stop (void);
/* EOS event */
GstEvent * gst_event_new_eos (void);
/* newsegment events */
GstEvent* gst_event_new_new_segment (gboolean update, gdouble rate,
GstFormat format,
gint64 start, gint64 stop,
gint64 position);
GstEvent* gst_event_new_new_segment_full (gboolean update, gdouble rate,
gdouble applied_rate,
GstFormat format,
gint64 start, gint64 stop,
gint64 position);
void gst_event_parse_new_segment (GstEvent *event,
gboolean *update,
gdouble *rate,
GstFormat *format,
gint64 *start, gint64 *stop,
gint64 *position);
void gst_event_parse_new_segment_full (GstEvent *event,
gboolean *update,
gdouble *rate,
gdouble *applied_rate,
GstFormat *format,
gint64 *start, gint64 *stop,
gint64 *position);
/* tag event */
GstEvent* gst_event_new_tag (GstTagList *taglist);
void gst_event_parse_tag (GstEvent *event, GstTagList **taglist);
/* buffer */
GstEvent * gst_event_new_buffer_size (GstFormat format, gint64 minsize, gint64 maxsize,
gboolean async);
void gst_event_parse_buffer_size (GstEvent *event, GstFormat *format, gint64 *minsize,
gint64 *maxsize, gboolean *async);
/* QOS events */
GstEvent* gst_event_new_qos (gdouble proportion, GstClockTimeDiff diff,
GstClockTime timestamp);
void gst_event_parse_qos (GstEvent *event, gdouble *proportion, GstClockTimeDiff *diff,
GstClockTime *timestamp);
/* seek event */
GstEvent* gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags,
GstSeekType cur_type, gint64 cur,
GstSeekType stop_type, gint64 stop);
void gst_event_parse_seek (GstEvent *event, gdouble *rate, GstFormat *format,
GstSeekFlags *flags,
GstSeekType *cur_type, gint64 *cur,
GstSeekType *stop_type, gint64 *stop);
/* navigation event */
GstEvent* gst_event_new_navigation (GstStructure *structure);
G_END_DECLS
#endif /* __GST_EVENT_H__ */

View File

@@ -0,0 +1,44 @@
/* 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_FILTER_H__
#define __GST_FILTER_H__
#include <glib.h>
G_BEGIN_DECLS
/**
* GstFilterFunc:
* @obj: the object
* @user_data: filter data
*
* Function prototype for a filter callback taht can be use in gst_filter_run().
* The function should apply its filtering to @obj. Additional data passed to
* gst_filter_run() are in @data.
*
* Returns: %TRUE for success.
*/
typedef gboolean (*GstFilterFunc) (gpointer obj, gpointer user_data);
GList* gst_filter_run (const GList *list, GstFilterFunc func, gboolean first, gpointer user_data);
G_END_DECLS
#endif /* __GST_FILTER_H_ */

View File

@@ -0,0 +1,111 @@
/* 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.
* @GST_FORMAT_BYTES: bytes
* @GST_FORMAT_TIME: time in nanoseconds
* @GST_FORMAT_BUFFERS: buffers
* @GST_FORMAT_PERCENT: percentage of stream
*
* 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;
gchar *nick;
gchar *description;
GQuark quark;
};
void _gst_format_initialize (void);
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 */
G_CONST_RETURN GstFormatDefinition*
gst_format_get_details (GstFormat format);
GstIterator* gst_format_iterate_definitions (void);
G_END_DECLS
#endif /* __GST_FORMAT_H__ */

View File

@@ -0,0 +1,58 @@
/* 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_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))
/**
* GstGhostPad:
*
* Opaque #GstGhostPad structure.
*/
typedef struct _GstGhostPad GstGhostPad;
typedef struct _GstGhostPadClass GstGhostPadClass;
GType gst_ghost_pad_get_type (void);
GstPad* gst_ghost_pad_new (const gchar *name, GstPad *target);
GstPad* gst_ghost_pad_new_no_target (const gchar *name, GstPadDirection dir);
GstPad* gst_ghost_pad_get_target (GstGhostPad *gpad);
gboolean gst_ghost_pad_set_target (GstGhostPad *gpad, GstPad *newtarget);
G_END_DECLS
#endif /* __GST_GHOST_PAD_H__ */

View File

@@ -0,0 +1,420 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
*
* gstindex.h: Header for GstIndex, base class to handle efficient
* storage or caching of seeking information.
*
* 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_INDEX_H__
#define __GST_INDEX_H__
#include <gst/gstobject.h>
#include <gst/gstformat.h>
#include <gst/gstpluginfeature.h>
G_BEGIN_DECLS
#define GST_TYPE_INDEX (gst_index_get_type ())
#define GST_INDEX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INDEX, GstIndex))
#define GST_IS_INDEX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INDEX))
#define GST_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_INDEX, GstIndexClass))
#define GST_IS_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_INDEX))
#define GST_INDEX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_INDEX, GstIndexClass))
#define GST_TYPE_INDEX_ENTRY (gst_index_entry_get_type())
typedef struct _GstIndexEntry GstIndexEntry;
typedef struct _GstIndexGroup GstIndexGroup;
typedef struct _GstIndex GstIndex;
typedef struct _GstIndexClass GstIndexClass;
/**
* GstIndexCertainty:
* @GST_INDEX_UNKNOWN: accuracy is not known
* @GST_INDEX_CERTAIN: accuracy is perfect
* @GST_INDEX_FUZZY: accuracy is fuzzy
*
* The certainty of a group in the index.
*/
typedef enum {
GST_INDEX_UNKNOWN,
GST_INDEX_CERTAIN,
GST_INDEX_FUZZY
} GstIndexCertainty;
/**
* GstIndexEntryType:
* @GST_INDEX_ENTRY_ID: This entry is an id that maps an index id to its owner object
* @GST_INDEX_ENTRY_ASSOCIATION: This entry is an association between formats
* @GST_INDEX_ENTRY_OBJECT: An object
* @GST_INDEX_ENTRY_FORMAT: A format definition
*
* The different types of entries in the index.
*/
typedef enum {
GST_INDEX_ENTRY_ID,
GST_INDEX_ENTRY_ASSOCIATION,
GST_INDEX_ENTRY_OBJECT,
GST_INDEX_ENTRY_FORMAT
} GstIndexEntryType;
/**
* GstIndexLookupMethod:
* @GST_INDEX_LOOKUP_EXACT: There has to be an exact indexentry with the given format/value
* @GST_INDEX_LOOKUP_BEFORE: The exact entry or the one before it
* @GST_INDEX_LOOKUP_AFTER: The exact entry or the one after it
*
* Specify the method to find an index entry in the index.
*/
typedef enum {
GST_INDEX_LOOKUP_EXACT,
GST_INDEX_LOOKUP_BEFORE,
GST_INDEX_LOOKUP_AFTER
} GstIndexLookupMethod;
/**
* GST_INDEX_NASSOCS:
* @entry: The entry to query
*
* Get the number of associations in the entry.
*/
#define GST_INDEX_NASSOCS(entry) ((entry)->data.assoc.nassocs)
/**
* GST_INDEX_ASSOC_FLAGS:
* @entry: The entry to query
*
* Get the flags for this entry.
*/
#define GST_INDEX_ASSOC_FLAGS(entry) ((entry)->data.assoc.flags)
/**
* GST_INDEX_ASSOC_FORMAT:
* @entry: The entry to query
* @i: The format index
*
* Get the i-th format of the entry.
*/
#define GST_INDEX_ASSOC_FORMAT(entry,i) ((entry)->data.assoc.assocs[(i)].format)
/**
* GST_INDEX_ASSOC_VALUE:
* @entry: The entry to query
* @i: The value index
*
* Get the i-th value of the entry.
*/
#define GST_INDEX_ASSOC_VALUE(entry,i) ((entry)->data.assoc.assocs[(i)].value)
typedef struct _GstIndexAssociation GstIndexAssociation;
/**
* GstIndexAssociation:
* @format: the format of the association
* @value: the value of the association
*
* An association in an entry.
*/
struct _GstIndexAssociation {
GstFormat format;
gint64 value;
};
/**
* GstAssocFlags:
* @GST_ASSOCIATION_FLAG_NONE: no extra flags
* @GST_ASSOCIATION_FLAG_KEY_UNIT: the entry marks a key unit, a key unit is one
* that marks a place where one can randomly seek to.
* @GST_ASSOCIATION_FLAG_DELTA_UNIT: the entry marks a delta unit, a delta unit
* is one that marks a place where one can relatively seek to.
* @GST_ASSOCIATION_FLAG_LAST: extra user defined flags should start here.
*
* Flags for an association entry.
*/
typedef enum {
GST_ASSOCIATION_FLAG_NONE = 0,
GST_ASSOCIATION_FLAG_KEY_UNIT = (1 << 0),
GST_ASSOCIATION_FLAG_DELTA_UNIT = (1 << 1),
/* new flags should start here */
GST_ASSOCIATION_FLAG_LAST = (1 << 8)
} GstAssocFlags;
/**
* GST_INDEX_FORMAT_FORMAT:
* @entry: The entry to query
*
* Get the format of the format entry
*/
#define GST_INDEX_FORMAT_FORMAT(entry) ((entry)->data.format.format)
/**
* GST_INDEX_FORMAT_KEY:
* @entry: The entry to query
*
* Get the key of the format entry
*/
#define GST_INDEX_FORMAT_KEY(entry) ((entry)->data.format.key)
/**
* GST_INDEX_ID_INVALID:
*
* Constant for an invalid index id
*/
#define GST_INDEX_ID_INVALID (-1)
/**
* GST_INDEX_ID_DESCRIPTION:
* @entry: The entry to query
*
* Get the description of the id entry
*/
#define GST_INDEX_ID_DESCRIPTION(entry) ((entry)->data.id.description)
/**
* GstIndexEntry:
*
* The basic element of an index.
*/
struct _GstIndexEntry {
/*< private >*/
GstIndexEntryType type;
gint id;
union {
struct {
gchar *description;
} id;
struct {
gint nassocs;
GstIndexAssociation
*assocs;
GstAssocFlags flags;
} assoc;
struct {
gchar *key;
GType type;
gpointer object;
} object;
struct {
GstFormat format;
gchar *key;
} format;
} data;
};
/**
* GstIndexGroup:
*
* A group of related entries in an index.
*/
struct _GstIndexGroup {
/*< private >*/
/* unique ID of group in index */
gint groupnum;
/* list of entries */
GList *entries;
/* the certainty level of the group */
GstIndexCertainty certainty;
/* peer group that contains more certain entries */
gint peergroup;
};
/**
* GstIndexFilter:
* @index: The index being queried
* @entry: The entry to be added.
* @user_data: User data passed to the function.
*
* Function to filter out entries in the index.
*
* Returns: This function should return %TRUE if the entry is to be added
* to the index, %FALSE otherwise.
*
*/
typedef gboolean (*GstIndexFilter) (GstIndex *index,
GstIndexEntry *entry,
gpointer user_data);
/**
* GstIndexResolverMethod:
* @GST_INDEX_RESOLVER_CUSTOM: Use a custom resolver
* @GST_INDEX_RESOLVER_GTYPE: Resolve based on the GType of the object
* @GST_INDEX_RESOLVER_PATH: Resolve on the path in graph
*
* The method used to resolve index writers
*/
typedef enum {
GST_INDEX_RESOLVER_CUSTOM,
GST_INDEX_RESOLVER_GTYPE,
GST_INDEX_RESOLVER_PATH
} GstIndexResolverMethod;
/**
* GstIndexResolver:
* @index: the index being queried.
* @writer: The object that wants to write
* @writer_string: A description of the writer.
* @user_data: user_data as registered
*
* Function to resolve ids to writer descriptions.
*
* Returns: %TRUE if an id could be assigned to the writer.
*/
typedef gboolean (*GstIndexResolver) (GstIndex *index,
GstObject *writer,
gchar **writer_string,
gpointer user_data);
/**
* GstIndexFlags:
* @GST_INDEX_WRITABLE: The index is writable
* @GST_INDEX_READABLE: The index is readable
* @GST_INDEX_FLAG_LAST: First flag that can be used by subclasses
*
* Flags for this index
*/
typedef enum {
GST_INDEX_WRITABLE = (GST_OBJECT_FLAG_LAST << 0),
GST_INDEX_READABLE = (GST_OBJECT_FLAG_LAST << 1),
GST_INDEX_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8)
} GstIndexFlags;
/**
* GST_INDEX_IS_READABLE:
* @obj: The index to check
*
* Check if the index can be read from
*/
#define GST_INDEX_IS_READABLE(obj) (GST_OBJECT_FLAG_IS_SET (obj, GST_INDEX_READABLE))
/**
* GST_INDEX_IS_WRITABLE:
* @obj: The index to check
*
* Check if the index can be written to
*/
#define GST_INDEX_IS_WRITABLE(obj) (GST_OBJECT_FLAG_IS_SET (obj, GST_INDEX_WRITABLE))
/**
* GstIndex:
*
* Opaque #GstIndex structure.
*/
struct _GstIndex {
GstObject object;
/*< private >*/
GList *groups;
GstIndexGroup *curgroup;
gint maxgroup;
GstIndexResolverMethod method;
GstIndexResolver resolver;
gpointer resolver_user_data;
GstIndexFilter filter;
gpointer filter_user_data;
GDestroyNotify filter_user_data_destroy;
GHashTable *writers;
gint last_id;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstIndexClass {
GstObjectClass parent_class;
/*< protected >*/
gboolean (*get_writer_id) (GstIndex *index, gint *writer_id, gchar *writer_string);
void (*commit) (GstIndex *index, gint id);
/* abstract methods */
void (*add_entry) (GstIndex *index, GstIndexEntry *entry);
GstIndexEntry* (*get_assoc_entry) (GstIndex *index, gint id,
GstIndexLookupMethod method, GstAssocFlags flags,
GstFormat format, gint64 value,
GCompareDataFunc func,
gpointer user_data);
/* signals */
void (*entry_added) (GstIndex *index, GstIndexEntry *entry);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_index_get_type (void);
GstIndex* gst_index_new (void);
void gst_index_commit (GstIndex *index, gint id);
gint gst_index_get_group (GstIndex *index);
gint gst_index_new_group (GstIndex *index);
gboolean gst_index_set_group (GstIndex *index, gint groupnum);
void gst_index_set_certainty (GstIndex *index,
GstIndexCertainty certainty);
GstIndexCertainty gst_index_get_certainty (GstIndex *index);
void gst_index_set_filter (GstIndex *index,
GstIndexFilter filter, gpointer user_data);
void gst_index_set_filter_full (GstIndex *index,
GstIndexFilter filter, gpointer user_data,
GDestroyNotify user_data_destroy);
void gst_index_set_resolver (GstIndex *index,
GstIndexResolver resolver, gpointer user_data);
gboolean gst_index_get_writer_id (GstIndex *index, GstObject *writer, gint *id);
GstIndexEntry* gst_index_add_format (GstIndex *index, gint id, GstFormat format);
GstIndexEntry* gst_index_add_associationv (GstIndex * index, gint id, GstAssocFlags flags,
gint n, const GstIndexAssociation * list);
GstIndexEntry* gst_index_add_association (GstIndex *index, gint id, GstAssocFlags flags,
GstFormat format, gint64 value, ...);
GstIndexEntry* gst_index_add_object (GstIndex *index, gint id, gchar *key,
GType type, gpointer object);
GstIndexEntry* gst_index_add_id (GstIndex *index, gint id,
gchar *description);
GstIndexEntry* gst_index_get_assoc_entry (GstIndex *index, gint id,
GstIndexLookupMethod method, GstAssocFlags flags,
GstFormat format, gint64 value);
GstIndexEntry* gst_index_get_assoc_entry_full (GstIndex *index, gint id,
GstIndexLookupMethod method, GstAssocFlags flags,
GstFormat format, gint64 value,
GCompareDataFunc func,
gpointer user_data);
/* working with index entries */
GType gst_index_entry_get_type (void);
GstIndexEntry * gst_index_entry_copy (GstIndexEntry *entry);
void gst_index_entry_free (GstIndexEntry *entry);
gboolean gst_index_entry_assoc_map (GstIndexEntry *entry,
GstFormat format, gint64 *value);
G_END_DECLS
#endif /* __GST_INDEX_H__ */

View File

@@ -0,0 +1,76 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
*
* gstindexfactory.h: Header for GstIndexFactory, base class to handle efficient
* storage or caching of seeking information.
*
* 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_INDEX_FACTORY_H__
#define __GST_INDEX_FACTORY_H__
#include <gst/gstobject.h>
#include <gst/gstformat.h>
#include <gst/gstpluginfeature.h>
G_BEGIN_DECLS
#define GST_TYPE_INDEX_FACTORY (gst_index_factory_get_type())
#define GST_INDEX_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INDEX_FACTORY, GstIndexFactory))
#define GST_IS_INDEX_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INDEX_FACTORY))
#define GST_INDEX_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_INDEX_FACTORY, GstIndexFactoryClass))
#define GST_IS_INDEX_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_INDEX_FACTORY))
#define GST_INDEX_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_INDEX_FACTORY, GstIndexFactoryClass))
typedef struct _GstIndexFactory GstIndexFactory;
typedef struct _GstIndexFactoryClass GstIndexFactoryClass;
/**
* GstIndexFactory:
*
* The GstIndexFactory object
*/
struct _GstIndexFactory {
GstPluginFeature feature;
gchar *longdesc; /* long description of the index (well, don't overdo it..) */
GType type; /* unique GType of the index */
gpointer _gst_reserved[GST_PADDING];
};
struct _GstIndexFactoryClass {
GstPluginFeatureClass parent;
gpointer _gst_reserved[GST_PADDING];
};
GType gst_index_factory_get_type (void);
GstIndexFactory* gst_index_factory_new (const gchar *name,
const gchar *longdesc, GType type);
void gst_index_factory_destroy (GstIndexFactory *factory);
GstIndexFactory* gst_index_factory_find (const gchar *name);
GstIndex* gst_index_factory_create (GstIndexFactory *factory);
GstIndex* gst_index_factory_make (const gchar *name);
G_END_DECLS
#endif /* __GST_INDEX_FACTORY_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstinterface.h: Declarations of interface 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.
*/
#ifndef __GST_IMPLEMENTS_INTERFACE_H__
#define __GST_IMPLEMENTS_INTERFACE_H__
#include <gst/gstelement.h>
G_BEGIN_DECLS
#define GST_TYPE_IMPLEMENTS_INTERFACE \
(gst_implements_interface_get_type ())
#define GST_IMPLEMENTS_INTERFACE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_IMPLEMENTS_INTERFACE, \
GstImplementsInterface))
#define GST_IMPLEMENTS_INTERFACE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_IMPLEMENTS_INTERFACE, \
GstImplementsInterfaceClass))
#define GST_IS_IMPLEMENTS_INTERFACE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_IMPLEMENTS_INTERFACE))
#define GST_IS_IMPLEMENTS_INTERFACE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_IMPLEMENTS_INTERFACE))
#define GST_IMPLEMENTS_INTERFACE_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_IMPLEMENTS_INTERFACE, \
GstImplementsInterfaceClass))
/**
* GstImplementsInterface:
*
* Opaque #GstImplementsInterface structure.
*/
typedef struct _GstImplementsInterface GstImplementsInterface;
typedef struct _GstImplementsInterfaceClass GstImplementsInterfaceClass;
/* This small extra virtual function is here to provide an
* interface functionality on a per-instance basis rather
* than a per-class basis, which is the case for glib.
*/
struct _GstImplementsInterfaceClass {
GTypeInterface parent;
/* virtual functions */
gboolean (* supported) (GstImplementsInterface *iface,
GType iface_type);
gpointer _gst_reserved[GST_PADDING];
};
#define GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST(obj, type, cast_t) \
((cast_t *) gst_implements_interface_cast ((obj), (type)))
#define GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE(obj, type) \
(gst_implements_interface_check ((obj), (type)))
GType gst_implements_interface_get_type (void);
/* wrapper functions to check for functionality implementation */
gboolean gst_element_implements_interface (GstElement *element,
GType iface_type);
gpointer gst_implements_interface_cast (gpointer from,
GType type);
gboolean gst_implements_interface_check (gpointer from,
GType type);
G_END_DECLS
#endif /* __GST_IMPLEMENTS_INTERFACE_H__ */

View File

@@ -0,0 +1,249 @@
/* GStreamer
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
*
* 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
/**
* 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;
/**
* GstIteratorDisposeFunction:
* @owner: the owner of the iterator
*
* The function that will be called when a GList iterator is freed. The
* owner of the GList iterator can then clean up its resources.
*/
typedef void (*GstIteratorDisposeFunction) (gpointer owner);
/**
* 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, gpointer *result);
/**
* 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 will typically increase the refcount
* of the item or make a copy.
*
* 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 GstIteratorItem (*GstIteratorItemFunction) (GstIterator *it, gpointer item);
/**
* 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);
/**
* 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) (gpointer 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:
* @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.
*
* GstIterator base structure. The values of this structure are
* protected for subclasses, use the methods to use the #GstIterator.
*/
struct _GstIterator {
/*< protected >*/
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 */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* creating iterators */
GstIterator* gst_iterator_new (guint size,
GType type,
GMutex *lock,
guint32 *master_cookie,
GstIteratorNextFunction next,
GstIteratorItemFunction item,
GstIteratorResyncFunction resync,
GstIteratorFreeFunction free);
GstIterator* gst_iterator_new_list (GType type,
GMutex *lock,
guint32 *master_cookie,
GList **list,
gpointer owner,
GstIteratorItemFunction item,
GstIteratorDisposeFunction free);
/* using iterators */
GstIteratorResult gst_iterator_next (GstIterator *it, gpointer *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,
gpointer user_data);
GstIteratorResult gst_iterator_fold (GstIterator *it,
GstIteratorFoldFunction func,
GValue *ret, gpointer user_data);
GstIteratorResult gst_iterator_foreach (GstIterator *it,
GFunc func, gpointer user_data);
gpointer gst_iterator_find_custom (GstIterator *it, GCompareFunc func,
gpointer user_data);
G_END_DECLS
#endif /* __GST_ITERATOR_H__ */

View File

@@ -0,0 +1,52 @@
/* 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.
*/
/**
* SECTION:gstmacros
* @short_description: Various portabillity helper macros
*
*/
#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
G_END_DECLS
#endif /* __GST_MACROS_H__ */

View File

@@ -0,0 +1,164 @@
#ifndef __gst_marshal_MARSHAL_H__
#define __gst_marshal_MARSHAL_H__
#include <glib-object.h>
G_BEGIN_DECLS
/* VOID:VOID (./gstmarshal.list:1) */
#define gst_marshal_VOID__VOID g_cclosure_marshal_VOID__VOID
/* VOID:BOOLEAN (./gstmarshal.list:2) */
#define gst_marshal_VOID__BOOLEAN g_cclosure_marshal_VOID__BOOLEAN
/* VOID:INT (./gstmarshal.list:3) */
#define gst_marshal_VOID__INT g_cclosure_marshal_VOID__INT
/* VOID:STRING (./gstmarshal.list:4) */
#define gst_marshal_VOID__STRING g_cclosure_marshal_VOID__STRING
/* VOID:BOXED (./gstmarshal.list:5) */
#define gst_marshal_VOID__BOXED g_cclosure_marshal_VOID__BOXED
/* VOID:BOXED,OBJECT (./gstmarshal.list:6) */
extern void gst_marshal_VOID__BOXED_OBJECT (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:POINTER (./gstmarshal.list:7) */
#define gst_marshal_VOID__POINTER g_cclosure_marshal_VOID__POINTER
/* VOID:POINTER,OBJECT (./gstmarshal.list:8) */
extern void gst_marshal_VOID__POINTER_OBJECT (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:OBJECT (./gstmarshal.list:9) */
#define gst_marshal_VOID__OBJECT g_cclosure_marshal_VOID__OBJECT
/* VOID:OBJECT,OBJECT (./gstmarshal.list:10) */
extern void gst_marshal_VOID__OBJECT_OBJECT (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:OBJECT,PARAM (./gstmarshal.list:11) */
extern void gst_marshal_VOID__OBJECT_PARAM (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:OBJECT,POINTER (./gstmarshal.list:12) */
extern void gst_marshal_VOID__OBJECT_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:OBJECT,BOXED (./gstmarshal.list:13) */
extern void gst_marshal_VOID__OBJECT_BOXED (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:OBJECT,BOXED,STRING (./gstmarshal.list:14) */
extern void gst_marshal_VOID__OBJECT_BOXED_STRING (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:OBJECT,OBJECT,STRING (./gstmarshal.list:15) */
extern void gst_marshal_VOID__OBJECT_OBJECT_STRING (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:OBJECT,STRING (./gstmarshal.list:16) */
extern void gst_marshal_VOID__OBJECT_STRING (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:INT,INT (./gstmarshal.list:17) */
extern void gst_marshal_VOID__INT_INT (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:INT64 (./gstmarshal.list:18) */
extern void gst_marshal_VOID__INT64 (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:UINT,BOXED (./gstmarshal.list:19) */
extern void gst_marshal_VOID__UINT_BOXED (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* VOID:UINT,POINTER (./gstmarshal.list:20) */
#define gst_marshal_VOID__UINT_POINTER g_cclosure_marshal_VOID__UINT_POINTER
/* BOOLEAN:VOID (./gstmarshal.list:21) */
extern void gst_marshal_BOOLEAN__VOID (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* BOOLEAN:POINTER (./gstmarshal.list:22) */
extern void gst_marshal_BOOLEAN__POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* POINTER:POINTER (./gstmarshal.list:23) */
extern void gst_marshal_POINTER__POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/* BOXED:BOXED (./gstmarshal.list:24) */
extern void gst_marshal_BOXED__BOXED (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
G_END_DECLS
#endif /* __gst_marshal_MARSHAL_H__ */

View File

@@ -0,0 +1,278 @@
/* 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;
typedef struct _GstMessageClass GstMessageClass;
/**
* GstMessageType:
* @GST_MESSAGE_UNKNOWN: an undefined message
* @GST_MESSAGE_EOS: end-of-stream reached in a pipeline
* @GST_MESSAGE_ERROR: an error occured
* @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
* @GST_MESSAGE_STATE_CHANGED: a state change happened
* @GST_MESSAGE_STATE_DIRTY: an element changed state in a streaming thread
* @GST_MESSAGE_STEP_DONE: a framestep finished.
* @GST_MESSAGE_CLOCK_PROVIDE: an element notifies its capability of providing
* a clock.
* @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.
* @GST_MESSAGE_NEW_CLOCK: a new clock was selected in the pipeline
* @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed.
* @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.
* @GST_MESSAGE_SEGMENT_DONE: pipeline completed playback of a segment.
* @GST_MESSAGE_DURATION: The duration of a pipeline changed.
* @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 */
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 = (1 << 18),
GST_MESSAGE_ANY = 0xffffffff
} GstMessageType;
#include <gst/gstminiobject.h>
#include <gst/gstobject.h>
#include <gst/gstelement.h>
#include <gst/gsttaglist.h>
#include <gst/gststructure.h>
/**
* GST_MESSAGE_TRACE_NAME:
*
* The name used for memory allocation tracing
*/
#define GST_MESSAGE_TRACE_NAME "GstMessage"
#define GST_TYPE_MESSAGE (gst_message_get_type())
#define GST_IS_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MESSAGE))
#define GST_IS_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MESSAGE))
#define GST_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MESSAGE, GstMessageClass))
#define GST_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MESSAGE, GstMessage))
#define GST_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MESSAGE, GstMessageClass))
#define GST_MESSAGE_CAST(obj) ((GstMessage*)(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(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_COND(message) (GST_MESSAGE(message)->cond)
#define GST_MESSAGE_WAIT(message) g_cond_wait(GST_MESSAGE_COND(message),GST_MESSAGE_GET_LOCK(message))
#define GST_MESSAGE_SIGNAL(message) g_cond_signal(GST_MESSAGE_COND(message))
/**
* GST_MESSAGE_TYPE:
* @message: a #GstMessage
*
* Get the #GstMessageType of @message.
*/
#define GST_MESSAGE_TYPE(message) (GST_MESSAGE(message)->type)
/**
* GST_MESSAGE_TYPE_NAME:
* @message: a #GstMessage
*
* Get a constant string representation of the #GstMessageType of @message.
*
* Since: 0.10.4
*/
#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(message)->timestamp)
/**
* GST_MESSAGE_SRC:
* @message: a #GstMessage
*
* Get the object that posted @message.
*/
#define GST_MESSAGE_SRC(message) (GST_MESSAGE(message)->src)
/**
* GstMessage:
* @mini_object: the parent structure
* @type: the #GstMessageType of the message
* @timestamp: the timestamp of the message
* @src: the src of the message
* @structure: the #GstStructure containing the message info.
*
* A #GstMessage.
*/
struct _GstMessage
{
GstMiniObject mini_object;
/*< private > *//* with MESSAGE_LOCK */
GMutex *lock; /* lock and cond for async delivery */
GCond *cond;
/*< public > *//* with COW */
GstMessageType type;
guint64 timestamp;
GstObject *src;
GstStructure *structure;
/*< private > */
gpointer _gst_reserved[GST_PADDING];
};
struct _GstMessageClass {
GstMiniObjectClass mini_object_class;
/*< private > */
gpointer _gst_reserved[GST_PADDING];
};
void _gst_message_initialize (void);
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 the
* reffed message.
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstMessage * gst_message_ref (GstMessage * msg);
#endif
static inline GstMessage *
gst_message_ref (GstMessage * msg)
{
/* not using a macro here because gcc-4.1 will complain
* if the return value isn't used (because of the cast) */
return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT (msg));
}
/**
* gst_message_unref:
* @msg: the message to unref
*
* Convenience macro to decrease the reference count of the message, possibly freeing
* the it.
*/
#define gst_message_unref(msg) gst_mini_object_unref (GST_MINI_OBJECT (msg))
/* copy message */
/**
* gst_message_copy:
* @msg: the message to copy
*
* Creates a copy of the message. Returns a copy of the message.
*
* MT safe
*/
#define gst_message_copy(msg) GST_MESSAGE (gst_mini_object_copy (GST_MINI_OBJECT (msg)))
/**
* gst_message_make_writable:
* @msg: the message to make writable
*
* Checks if a message is writable. If not, a writable copy is made and
* returned. Returns a message (possibly a duplicate) that is writable.
*
* MT safe
*/
#define gst_message_make_writable(msg) GST_MESSAGE (gst_mini_object_make_writable (GST_MINI_OBJECT (msg)))
GstMessage * gst_message_new_eos (GstObject * src);
GstMessage * gst_message_new_error (GstObject * src, GError * error, gchar * debug);
GstMessage * gst_message_new_warning (GstObject * src, GError * error, gchar * debug);
GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list);
GstMessage * gst_message_new_state_changed (GstObject * src, GstState oldstate,
GstState newstate, GstState pending);
GstMessage * gst_message_new_state_dirty (GstObject * src);
GstMessage * gst_message_new_clock_provide (GstObject * src, GstClock *clock, gboolean ready);
GstMessage * gst_message_new_clock_lost (GstObject * src, GstClock *clock);
GstMessage * gst_message_new_new_clock (GstObject * src, GstClock *clock);
GstMessage * gst_message_new_application (GstObject * src, GstStructure * structure);
GstMessage * gst_message_new_element (GstObject * src, GstStructure * structure);
GstMessage * gst_message_new_segment_start (GstObject * src, GstFormat format, gint64 position);
GstMessage * gst_message_new_segment_done (GstObject * src, GstFormat format, gint64 position);
GstMessage * gst_message_new_duration (GstObject * src, GstFormat format, gint64 duration);
GstMessage * gst_message_new_custom (GstMessageType type,
GstObject * src,
GstStructure * structure);
void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug);
void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug);
void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list);
void gst_message_parse_state_changed (GstMessage *message, GstState *oldstate,
GstState *newstate, GstState *pending);
void gst_message_parse_clock_provide (GstMessage *message, GstClock **clock, gboolean *ready);
void gst_message_parse_clock_lost (GstMessage *message, GstClock **clock);
void gst_message_parse_new_clock (GstMessage *message, GstClock **clock);
void gst_message_parse_segment_start (GstMessage *message, GstFormat *format, gint64 *position);
void gst_message_parse_segment_done (GstMessage *message, GstFormat *format, gint64 *position);
void gst_message_parse_duration (GstMessage *message, GstFormat *format, gint64 *duration);
const GstStructure * gst_message_get_structure (GstMessage *message);
G_END_DECLS
#endif /* __GST_MESSAGE_H__ */

View File

@@ -0,0 +1,188 @@
/* 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_TYPE_MINI_OBJECT (gst_mini_object_get_type())
#define GST_IS_MINI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MINI_OBJECT))
#define GST_IS_MINI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MINI_OBJECT))
#define GST_MINI_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MINI_OBJECT, GstMiniObjectClass))
#define GST_MINI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MINI_OBJECT, GstMiniObject))
#define GST_MINI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MINI_OBJECT, GstMiniObjectClass))
#define GST_MINI_OBJECT_CAST(obj) ((GstMiniObject*)(obj))
typedef struct _GstMiniObject GstMiniObject;
typedef struct _GstMiniObjectClass GstMiniObjectClass;
/**
* GstMiniObjectCopyFunction:
* @obj: MiniObject to copy
*
* Virtual function prototype for methods to create copies of instances.
*
* Returns: reference to cloned instance.
*/
typedef GstMiniObject * (*GstMiniObjectCopyFunction) (const GstMiniObject *obj);
/**
* GstMiniObjectFinalizeFunction:
* @obj: MiniObject to finalize
*
* Virtual function prototype for methods to free ressources used by
* mini-objects. Subclasses 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 finalize function, the memory associated with the
* object is freed.
*/
typedef void (*GstMiniObjectFinalizeFunction) (GstMiniObject *obj);
/**
* 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(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))
/**
* GST_VALUE_HOLDS_MINI_OBJECT:
* @value: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_MINI_OBJECT value.
*/
#define GST_VALUE_HOLDS_MINI_OBJECT(value) (G_VALUE_HOLDS(value, GST_TYPE_MINI_OBJECT))
/**
* GstMiniObjectFlags:
* @GST_MINI_OBJECT_FLAG_READONLY: is the miniobject readonly or writable
* @GST_MINI_OBJECT_FLAG_LAST: first flag that can be used by subclasses.
*
* Flags for the padtemplate
*/
typedef enum
{
GST_MINI_OBJECT_FLAG_READONLY = (1<<0),
/* padding */
GST_MINI_OBJECT_FLAG_LAST = (1<<4)
} GstMiniObjectFlags;
/**
* 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:
* @instance: type instance
* @refcount: atomic refcount
* @flags: extra flags.
*
* Base class for refcounted lightweight objects.
*/
struct _GstMiniObject {
GTypeInstance instance;
/*< public >*/ /* with COW */
gint refcount;
guint flags;
/*< private >*/
gpointer _gst_reserved;
};
struct _GstMiniObjectClass {
GTypeClass type_class;
GstMiniObjectCopyFunction copy;
GstMiniObjectFinalizeFunction finalize;
/*< private >*/
gpointer _gst_reserved;
};
GType gst_mini_object_get_type (void);
GstMiniObject* gst_mini_object_new (GType type);
GstMiniObject* gst_mini_object_copy (const GstMiniObject *mini_object);
gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
GstMiniObject* gst_mini_object_make_writable (GstMiniObject *mini_object);
/* refcounting */
GstMiniObject* gst_mini_object_ref (GstMiniObject *mini_object);
void gst_mini_object_unref (GstMiniObject *mini_object);
void gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata);
/* GParamSpec */
GParamSpec* gst_param_spec_mini_object (const char *name, const char *nick,
const char *blurb, GType object_type,
GParamFlags flags);
/* GValue stuff */
void gst_value_set_mini_object (GValue *value, GstMiniObject *mini_object);
void gst_value_take_mini_object (GValue *value, GstMiniObject *mini_object);
GstMiniObject* gst_value_get_mini_object (const GValue *value);
G_END_DECLS
#endif

View File

@@ -0,0 +1,333 @@
/* 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))
/* make sure we don't change the object size but still make it compile
* without libxml */
#ifdef GST_DISABLE_LOADSAVE_REGISTRY
#define xmlNodePtr gpointer
#endif
/**
* GstObjectFlags:
* @GST_OBJECT_DISPOSING: the object is been destroyed, do use it anymore
* @GST_OBJECT_FLOATING: the object has a floating reference count (e.g. its
* not assigned to a bin)
* @GST_OBJECT_FLAG_LAST: subclasses can add additional flags starting from this flag
*
* The standard flags that an gstobject may have.
*/
typedef enum
{
GST_OBJECT_DISPOSING = (1<<0),
GST_OBJECT_FLOATING = (1<<1),
/* 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 (&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 #Object.
*
* 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))
/**
* GST_OBJECT_IS_DISPOSING:
* @obj: a #GstObject
*
* Check if the given object is beeing destroyed.
*/
#define GST_OBJECT_IS_DISPOSING(obj) (GST_OBJECT_FLAG_IS_SET (obj, GST_OBJECT_DISPOSING))
/**
* GST_OBJECT_IS_FLOATING:
* @obj: a #GstObject
*
* Check if the given object is floating (has no owner).
*/
#define GST_OBJECT_IS_FLOATING(obj) (GST_OBJECT_FLAG_IS_SET (obj, GST_OBJECT_FLOATING))
typedef struct _GstObject GstObject;
typedef struct _GstObjectClass GstObjectClass;
/**
* GstObject:
* @refcount: unused
* @lock: object LOCK
* @name: The name of the object
* @name_prefix: used for debugging
* @parent: this object's parent, weak ref
* @flags: use GST_OBJECT_IS_XXX macros to access the flags
*
* GStreamer base object class.
*/
struct _GstObject {
GObject object;
/*< public >*/
gint refcount;
/*< public >*/ /* with LOCK */
GMutex *lock; /* object LOCK */
gchar *name; /* object name */
gchar *name_prefix; /* used for debugging */
GstObject *parent; /* this object's parent, weak ref */
guint32 flags;
/*< private >*/
gpointer _gst_reserved;
};
/**
* GST_CLASS_GET_LOCK:
* @obj: a #GstObjectClass
*
* This macro will return the class lock used to protect deep_notify signal
* emission on thread-unsafe glib versions (glib < 2.8).
*/
#define GST_CLASS_GET_LOCK(obj) (GST_OBJECT_CLASS_CAST(obj)->lock)
/**
* GST_CLASS_LOCK:
* @obj: a #GstObjectClass
*
* Lock the class.
*/
#define GST_CLASS_LOCK(obj) (g_static_rec_mutex_lock(GST_CLASS_GET_LOCK(obj)))
/**
* GST_CLASS_TRYLOCK:
* @obj: a #GstObjectClass
*
* Try to lock the class, returns TRUE if class could be locked.
*/
#define GST_CLASS_TRYLOCK(obj) (g_static_rec_mutex_trylock(GST_CLASS_GET_LOCK(obj)))
/**
* GST_CLASS_UNLOCK:
* @obj: a #GstObjectClass
*
* Unlock the class.
*/
#define GST_CLASS_UNLOCK(obj) (g_static_rec_mutex_unlock(GST_CLASS_GET_LOCK(obj)))
/*
* GstObjectClass:
*
* @signal_object: is used to signal to the whole class
* @save_thyself: xml serialisation
* @restore_thyself: xml de-serialisation
*/
struct _GstObjectClass {
GObjectClass parent_class;
gchar *path_string_separator;
GObject *signal_object;
GStaticRecMutex *lock;
/* signals */
void (*parent_set) (GstObject *object, GstObject *parent);
void (*parent_unset) (GstObject *object, GstObject *parent);
void (*object_saved) (GstObject *object, xmlNodePtr parent);
void (*deep_notify) (GstObject *object, GstObject *orig, GParamSpec *pspec);
/*< public >*/
/* virtual methods for subclasses */
xmlNodePtr (*save_thyself) (GstObject *object, xmlNodePtr parent);
void (*restore_thyself) (GstObject *object, xmlNodePtr self);
/*< 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);
void gst_object_set_name_prefix (GstObject *object, const gchar *name_prefix);
gchar* gst_object_get_name_prefix (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);
void gst_object_sink (gpointer object);
/* replace object pointer */
void 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);
/* load/save */
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
xmlNodePtr gst_object_save_thyself (GstObject *object, xmlNodePtr parent);
void gst_object_restore_thyself (GstObject *object, xmlNodePtr self);
#else
#if defined _GNUC_ && _GNUC_ >= 3
#pragma GCC poison gst_object_save_thyself
#pragma GCC poison gst_object_restore_thyself
#endif
#endif
/* class signal stuff */
guint gst_class_signal_connect (GstObjectClass *klass,
const gchar *name,
gpointer func,
gpointer func_data);
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
void gst_class_signal_emit_by_name (GstObject *object,
const gchar *name,
xmlNodePtr self);
#else
#if defined _GNUC_ && _GNUC_ >= 3
#pragma GCC poison gst_class_signal_emit_by_name
#endif
#endif
G_END_DECLS
#endif /* __GST_OBJECT_H__ */

View File

@@ -0,0 +1,804 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
*
* gstpad.h: Header for GstPad 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_H__
#define __GST_PAD_H__
#include <gst/gstconfig.h>
#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
/*
* Pad base class
*/
#define GST_TYPE_PAD (gst_pad_get_type ())
#define GST_IS_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
#define GST_IS_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
#define GST_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
#define GST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
#define GST_PAD_CAST(obj) ((GstPad*)(obj))
typedef struct _GstPad GstPad;
typedef struct _GstPadClass GstPadClass;
/**
* GstPadLinkReturn:
* @GST_PAD_LINK_OK : link succeeded
* @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent
* @GST_PAD_LINK_WAS_LINKED : pad was already linked
* @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction
* @GST_PAD_LINK_NOFORMAT : pads do not have common format
* @GST_PAD_LINK_NOSCHED : pads cannot cooperate in scheduling
* @GST_PAD_LINK_REFUSED : refused for some reason
*
* Result values from gst_pad_link and friends.
*/
typedef enum {
GST_PAD_LINK_OK = 0,
GST_PAD_LINK_WRONG_HIERARCHY = -1,
GST_PAD_LINK_WAS_LINKED = -2,
GST_PAD_LINK_WRONG_DIRECTION = -3,
GST_PAD_LINK_NOFORMAT = -4,
GST_PAD_LINK_NOSCHED = -5,
GST_PAD_LINK_REFUSED = -6,
} GstPadLinkReturn;
/**
* GST_PAD_LINK_FAILED:
* @ret: the #GstPadLinkReturn value
*
* Macro to test if the given #GstPadLinkReturn value indicates a failed
* link step.
*/
#define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
/**
* GST_PAD_LINK_SUCCESSFUL:
* @ret: the #GstPadLinkReturn value
*
* Macro to test if the given #GstPadLinkReturn value indicates a successful
* link step.
*/
#define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
/**
* GstFlowReturn:
* @GST_FLOW_RESEND: Resend buffer, possibly with new caps.
* @GST_FLOW_OK: Data passing was ok.
* @GST_FLOW_NOT_LINKED: Pad is not linked.
* @GST_FLOW_WRONG_STATE: Pad is in wrong state.
* @GST_FLOW_UNEXPECTED: Did not expect anything, like after EOS.
* @GST_FLOW_NOT_NEGOTIATED: Pad is not negotiated.
* @GST_FLOW_ERROR: Some (fatal) error occured.
* @GST_FLOW_NOT_SUPPORTED: This operation is not supported.
*
* The result of passing data to a linked pad.
*/
typedef enum {
GST_FLOW_RESEND = 1,
GST_FLOW_OK = 0,
/* expected failures */
GST_FLOW_NOT_LINKED = -1,
GST_FLOW_WRONG_STATE = -2,
/* error cases */
GST_FLOW_UNEXPECTED = -3,
GST_FLOW_NOT_NEGOTIATED = -4,
GST_FLOW_ERROR = -5,
GST_FLOW_NOT_SUPPORTED = -6
} GstFlowReturn;
/**
* GST_FLOW_IS_FATAL:
* @ret: a #GstFlowReturn value
*
* Macro to test if the given #GstFlowReturn value indicates a fatal
* error. This macro is mainly used in elements to decide when an error
* message should be posted on the bus.
*/
#define GST_FLOW_IS_FATAL(ret) ((ret) <= GST_FLOW_UNEXPECTED)
G_CONST_RETURN gchar* gst_flow_get_name (GstFlowReturn ret);
GQuark gst_flow_to_quark (GstFlowReturn ret);
/**
* GstActivateMode:
* @GST_ACTIVATE_NONE: Pad will not handle dataflow
* @GST_ACTIVATE_PUSH: Pad handles dataflow in downstream push mode
* @GST_ACTIVATE_PULL: Pad handles dataflow in upstream pull mode
*
* The status of a GstPad. After activating a pad, which usually happens when the
* parent element goes from READY to PAUSED, the GstActivateMode defines if the
* pad operates in push or pull mode.
*/
typedef enum {
GST_ACTIVATE_NONE,
GST_ACTIVATE_PUSH,
GST_ACTIVATE_PULL,
} GstActivateMode;
/**
* GST_PAD_MODE_ACTIVATE:
* @mode: a #GstActivateMode
*
* Macro to test if the given #GstActivateMode value indicates that datapassing
* is possible or not.
*/
#define GST_PAD_MODE_ACTIVATE(mode) ((mode) != GST_ACTIVATE_NONE)
/* pad states */
/**
* GstPadActivateFunction:
* @pad: a #GstPad
*
* This function is called when the pad is activated during the element
* READY to PAUSED state change. By default this function will call the
* activate function that puts the pad in push mode but elements can
* override this function to activate the pad in pull mode if they wish.
*
* Returns: TRUE if the pad could be activated.
*/
typedef gboolean (*GstPadActivateFunction) (GstPad *pad);
/**
* GstPadActivateModeFunction:
* @pad: a #GstPad
* @active: activate or deactivate the pad.
*
* The prototype of the push and pull activate functions.
*
* Returns: TRUE if the pad could be activated or deactivated.
*/
typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, gboolean active);
/* data passing */
/**
* GstPadChainFunction:
* @pad: the #GstPad that performed the chain.
* @buffer: the #GstBuffer that is chained.
*
* A function that will be called on sinkpads when chaining buffers.
*
* Returns: GST_FLOW_OK for success
*/
typedef GstFlowReturn (*GstPadChainFunction) (GstPad *pad, GstBuffer *buffer);
/**
* GstPadGetRangeFunction:
* @pad: the #GstPad to perform the getrange on.
* @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 on sourcepads when a peer element
* request a buffer at the specified offset and length. 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.
*
* Returns: GST_FLOW_OK for success
*/
typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, guint64 offset,
guint length, GstBuffer **buffer);
/**
* GstPadEventFunction:
* @pad: the #GstPad to handle the event.
* @event: the #GstEvent to handle.
*
* Function signature to handle an event for the pad.
*
* Returns: TRUE if the pad could handle the event.
*/
typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
/* FIXME: 0.11: deprecate me, check range should use seeking query */
/**
* GstPadCheckGetRangeFunction:
* @pad: a #GstPad
*
* Check if @pad can be activated in pull mode.
*
* This function will be deprecated after 0.10; use the seeking query to check
* if a pad can support random access.
*
* Returns: TRUE if the pad can operate in pull mode.
*/
typedef gboolean (*GstPadCheckGetRangeFunction) (GstPad *pad);
/* internal links */
/**
* GstPadIntLinkFunction:
* @pad: The #GstPad to query.
*
* The signature of the internal pad link function.
*
* Returns: a newly allocated #GList of pads that are linked to the given pad on
* the inside of the parent element.
* The caller must call g_list_free() on it after use.
*/
typedef GList* (*GstPadIntLinkFunction) (GstPad *pad);
/* generic query function */
/**
* GstPadQueryTypeFunction:
* @pad: a #GstPad to query
*
* The signature of the query types function.
*
* Returns: a constant array of query types
*/
typedef const GstQueryType* (*GstPadQueryTypeFunction) (GstPad *pad);
/**
* GstPadQueryFunction:
* @pad: the #GstPad to query.
* @query: the #GstQuery object to execute
*
* The signature of the query function.
*
* Returns: TRUE if the query could be performed.
*/
typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstQuery *query);
/* linking */
/**
* GstPadLinkFunction
* @pad: the #GstPad that is linked.
* @peer: the peer #GstPad of the link
*
* Function signature to handle a new link on the pad.
*
* Returns: the result of the link with the specified peer.
*/
typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstPad *peer);
/**
* GstPadUnlinkFunction
* @pad: the #GstPad that is linked.
*
* Function signature to handle a unlinking the pad prom its peer.
*/
typedef void (*GstPadUnlinkFunction) (GstPad *pad);
/* caps nego */
/**
* GstPadGetCapsFunction:
* @pad: the #GstPad to get the capabilities of.
*
* Returns a copy of the capabilities of the specified pad. By default this
* function will return the pad template capabilities, but can optionally
* be overridden by elements.
*
* Returns: a newly allocated copy #GstCaps of the pad.
*/
typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad);
/**
* GstPadSetCapsFunction:
* @pad: the #GstPad to set the capabilities of.
* @caps: the #GstCaps to set
*
* Set @caps on @pad. By default this function updates the caps of the
* pad but the function can be overriden by elements to perform extra
* actions or verifications.
*
* Returns: TRUE if the caps could be set on the pad.
*/
typedef gboolean (*GstPadSetCapsFunction) (GstPad *pad, GstCaps *caps);
/**
* GstPadAcceptCapsFunction:
* @pad: the #GstPad to check
* @caps: the #GstCaps to check
*
* Check if @pad can accept @caps. By default this function will see if @caps
* intersect with the result from gst_pad_get_caps() by can be overridden to
* perform extra checks.
*
* Returns: TRUE if the caps can be accepted by the pad.
*/
typedef gboolean (*GstPadAcceptCapsFunction) (GstPad *pad, GstCaps *caps);
/**
* GstPadFixateCapsFunction:
* @pad: a #GstPad
* @caps: the #GstCaps to fixate
*
* Given possibly unfixed caps @caps, let @pad use its default prefered
* format to make a fixed caps. @caps should be writable. By default this
* function will pick the first value of any ranges or lists in the caps but
* elements can override this function to perform other behaviour.
*/
typedef void (*GstPadFixateCapsFunction) (GstPad *pad, GstCaps *caps);
/**
* GstPadBufferAllocFunction:
* @pad: a sink #GstPad
* @offset: the desired offset of the buffer
* @size: the desired size of the buffer
* @caps: the desired caps of the buffer
* @buf: pointer to hold the allocated buffer.
*
* Ask the sinkpad @pad to allocate a buffer with @offset, @size and @caps.
* The result will be stored in @buf.
*
* The purpose of this function is to allocate a buffer that is optimal to
* be processed by @pad. The function is mostly overridden by elements that can
* provide a hardware buffer in order to avoid additional memcpy operations.
*
* The function can return a buffer that does not have @caps, in which case the
* upstream element requests a format change.
*
* When this function returns anything else than GST_FLOW_OK, the buffer allocation
* failed and @buf does not contain valid data.
*
* By default this function returns a new buffer of @size and with @caps containing
* purely malloced data.
*
* Returns: GST_FLOW_OK if @buf contains a valid buffer, any other return
* value means @buf does not hold a valid buffer.
*/
typedef GstFlowReturn (*GstPadBufferAllocFunction) (GstPad *pad, guint64 offset, guint size,
GstCaps *caps, GstBuffer **buf);
/* misc */
/**
* GstPadDispatcherFunction:
* @pad: the #GstPad that is dispatched.
* @data: the gpointer to optional user data.
*
* A dispatcher function is called for all internally linked pads, see
* gst_pad_dispatcher().
*
* Returns: TRUE if the dispatching procedure has to be stopped.
*/
typedef gboolean (*GstPadDispatcherFunction) (GstPad *pad, gpointer data);
/**
* GstPadBlockCallback:
* @pad: the #GstPad that is blockend or unblocked.
* @blocked: blocking state for the pad
* @user_data: the gpointer to optional user data.
*
* Callback used by gst_pad_set_blocked_async(). Gets called when the blocking
* operation succeeds.
*/
typedef void (*GstPadBlockCallback) (GstPad *pad, gboolean blocked, gpointer user_data);
/**
* GstPadDirection:
* @GST_PAD_UNKNOWN: direction is unknown.
* @GST_PAD_SRC: the pad is a source pad.
* @GST_PAD_SINK: the pad is a sink pad.
*
* The direction of a pad.
*/
typedef enum {
GST_PAD_UNKNOWN,
GST_PAD_SRC,
GST_PAD_SINK
} GstPadDirection;
/**
* GstPadFlags:
* @GST_PAD_BLOCKED: is dataflow on a pad blocked
* @GST_PAD_FLUSHING: is pad refusing buffers
* @GST_PAD_IN_GETCAPS: GstPadGetCapsFunction() is running now
* @GST_PAD_IN_SETCAPS: GstPadSetCapsFunction() is running now
* @GST_PAD_FLAG_LAST: offset to define more flags
*
* Pad state flags
*/
typedef enum {
GST_PAD_BLOCKED = (GST_OBJECT_FLAG_LAST << 0),
GST_PAD_FLUSHING = (GST_OBJECT_FLAG_LAST << 1),
GST_PAD_IN_GETCAPS = (GST_OBJECT_FLAG_LAST << 2),
GST_PAD_IN_SETCAPS = (GST_OBJECT_FLAG_LAST << 3),
/* padding */
GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8)
} GstPadFlags;
/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
typedef struct _GstPadTemplate GstPadTemplate;
/**
* GstPad:
* @element_private: private data owned by the parent element
* @padtemplate: padtemplate for this pad
* @direction: the direction of the pad, cannot change after creating
* the pad.
* @stream_rec_lock: recursive stream lock of the pad, used to protect
* the data used in streaming.
* @task: task for this pad if the pad is actively driving dataflow.
* @preroll_lock: lock used when prerolling
* @preroll_cond: conf to signal preroll
* @block_cond: conditional to signal pad block
* @block_callback: callback for the pad block if any
* @block_data: user data for @block_callback
* @caps: the current caps of the pad
* @getcapsfunc: function to get caps of the pad
* @setcapsfunc: function to set caps on the pad
* @acceptcapsfunc: function to check if pad can accept caps
* @fixatecapsfunc: function to fixate caps
* @activatefunc: pad activation function
* @activatepushfunc: function to activate/deactivate pad in push mode
* @activatepullfunc: function to activate/deactivate pad in pull mode
* @linkfunc: function called when pad is linked
* @unlinkfunc: function called when pad is unlinked
* @peer: the pad this pad is linked to
* @sched_private: private storage for the scheduler
* @chainfunc: function to chain data to pad
* @checkgetrangefunc: function to check if pad can operate in pull mode
* @getrangefunc: function to get a range of data from a pad
* @eventfunc: function to send an event to a pad
* @mode: current activation mode of the pad
* @querytypefunc: get list of supported queries
* @queryfunc: perform a query on the pad
* @intlinkfunc: get the internal links of this pad
* @bufferallocfunc: function to allocate a buffer for this pad
* @do_buffer_signals: counter counting installed buffer signals
* @do_event_signals: counter counting installed event signals
*
* The #GstPad structure. Use the functions to update the variables.
*/
struct _GstPad {
GstObject object;
/*< public >*/
gpointer element_private;
GstPadTemplate *padtemplate;
GstPadDirection direction;
/*< public >*/ /* with STREAM_LOCK */
/* streaming rec_lock */
GStaticRecMutex *stream_rec_lock;
GstTask *task;
/*< public >*/ /* with PREROLL_LOCK */
GMutex *preroll_lock;
GCond *preroll_cond;
/*< public >*/ /* with LOCK */
/* block cond, mutex is from the object */
GCond *block_cond;
GstPadBlockCallback block_callback;
gpointer block_data;
/* the pad capabilities */
GstCaps *caps;
GstPadGetCapsFunction getcapsfunc;
GstPadSetCapsFunction setcapsfunc;
GstPadAcceptCapsFunction acceptcapsfunc;
GstPadFixateCapsFunction fixatecapsfunc;
GstPadActivateFunction activatefunc;
GstPadActivateModeFunction activatepushfunc;
GstPadActivateModeFunction activatepullfunc;
/* pad link */
GstPadLinkFunction linkfunc;
GstPadUnlinkFunction unlinkfunc;
GstPad *peer;
gpointer sched_private;
/* data transport functions */
GstPadChainFunction chainfunc;
GstPadCheckGetRangeFunction checkgetrangefunc;
GstPadGetRangeFunction getrangefunc;
GstPadEventFunction eventfunc;
GstActivateMode mode;
/* generic query method */
GstPadQueryTypeFunction querytypefunc;
GstPadQueryFunction queryfunc;
/* internal links */
GstPadIntLinkFunction intlinkfunc;
GstPadBufferAllocFunction bufferallocfunc;
/* whether to emit signals for have-data. counts number
* of handlers attached. */
gint do_buffer_signals;
gint do_event_signals;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstPadClass {
GstObjectClass parent_class;
/* signal callbacks */
void (*linked) (GstPad *pad, GstPad *peer);
void (*unlinked) (GstPad *pad, GstPad *peer);
void (*request_link) (GstPad *pad);
gboolean (*have_data) (GstPad *pad, GstMiniObject *data);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/***** helper macros *****/
/* GstPad */
#define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad))
#define GST_PAD_PARENT(pad) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
#define GST_PAD_ELEMENT_PRIVATE(pad) (GST_PAD_CAST(pad)->element_private)
#define GST_PAD_PAD_TEMPLATE(pad) (GST_PAD_CAST(pad)->padtemplate)
#define GST_PAD_DIRECTION(pad) (GST_PAD_CAST(pad)->direction)
#define GST_PAD_TASK(pad) (GST_PAD_CAST(pad)->task)
#define GST_PAD_ACTIVATE_MODE(pad) (GST_PAD_CAST(pad)->mode)
#define GST_PAD_ACTIVATEFUNC(pad) (GST_PAD_CAST(pad)->activatefunc)
#define GST_PAD_ACTIVATEPUSHFUNC(pad) (GST_PAD_CAST(pad)->activatepushfunc)
#define GST_PAD_ACTIVATEPULLFUNC(pad) (GST_PAD_CAST(pad)->activatepullfunc)
#define GST_PAD_CHAINFUNC(pad) (GST_PAD_CAST(pad)->chainfunc)
#define GST_PAD_CHECKGETRANGEFUNC(pad) (GST_PAD_CAST(pad)->checkgetrangefunc)
#define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc)
#define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc)
#define GST_PAD_QUERYTYPEFUNC(pad) (GST_PAD_CAST(pad)->querytypefunc)
#define GST_PAD_QUERYFUNC(pad) (GST_PAD_CAST(pad)->queryfunc)
#define GST_PAD_INTLINKFUNC(pad) (GST_PAD_CAST(pad)->intlinkfunc)
#define GST_PAD_PEER(pad) (GST_PAD_CAST(pad)->peer)
#define GST_PAD_LINKFUNC(pad) (GST_PAD_CAST(pad)->linkfunc)
#define GST_PAD_UNLINKFUNC(pad) (GST_PAD_CAST(pad)->unlinkfunc)
#define GST_PAD_CAPS(pad) (GST_PAD_CAST(pad)->caps)
#define GST_PAD_GETCAPSFUNC(pad) (GST_PAD_CAST(pad)->getcapsfunc)
#define GST_PAD_SETCAPSFUNC(pad) (GST_PAD_CAST(pad)->setcapsfunc)
#define GST_PAD_ACCEPTCAPSFUNC(pad) (GST_PAD_CAST(pad)->acceptcapsfunc)
#define GST_PAD_FIXATECAPSFUNC(pad) (GST_PAD_CAST(pad)->fixatecapsfunc)
#define GST_PAD_BUFFERALLOCFUNC(pad) (GST_PAD_CAST(pad)->bufferallocfunc)
#define GST_PAD_DO_BUFFER_SIGNALS(pad) (GST_PAD_CAST(pad)->do_buffer_signals)
#define GST_PAD_DO_EVENT_SIGNALS(pad) (GST_PAD_CAST(pad)->do_event_signals)
#define GST_PAD_IS_LINKED(pad) (GST_PAD_PEER(pad) != NULL)
#define GST_PAD_IS_BLOCKED(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKED))
#define GST_PAD_IS_FLUSHING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLUSHING))
#define GST_PAD_IS_IN_GETCAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_GETCAPS))
#define GST_PAD_IS_IN_SETCAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_SETCAPS))
#define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
#define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
#define GST_PAD_SET_FLUSHING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLUSHING))
#define GST_PAD_UNSET_FLUSHING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLUSHING))
/**
* GST_PAD_GET_STREAM_LOCK:
* @pad: a #GstPad
*
* Get the stream lock of @pad. The stream lock is protecting the
* resources used in the data processing functions of @pad.
*/
#define GST_PAD_GET_STREAM_LOCK(pad) (GST_PAD_CAST(pad)->stream_rec_lock)
/**
* GST_PAD_STREAM_LOCK:
* @pad: a #GstPad
*
* Lock the stream lock of @pad.
*/
#define GST_PAD_STREAM_LOCK(pad) (g_static_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad)))
/**
* GST_PAD_STREAM_LOCK_FULL:
* @pad: a #GstPad
* @t: the number of times to recursively lock
*
* Lock the stream lock of @pad @t times.
*/
#define GST_PAD_STREAM_LOCK_FULL(pad,t) (g_static_rec_mutex_lock_full(GST_PAD_GET_STREAM_LOCK(pad), t))
/**
* GST_PAD_STREAM_TRYLOCK:
* @pad: a #GstPad
*
* Try to Lock the stream lock of the pad, return TRUE if the lock could be
* taken.
*/
#define GST_PAD_STREAM_TRYLOCK(pad) (g_static_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad)))
/**
* GST_PAD_STREAM_UNLOCK:
* @pad: a #GstPad
*
* Unlock the stream lock of @pad.
*/
#define GST_PAD_STREAM_UNLOCK(pad) (g_static_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad)))
/**
* GST_PAD_STREAM_UNLOCK_FULL:
* @pad: a #GstPad
*
* Fully unlock the recursive stream lock of @pad, return the number of times
* @pad was locked.
*/
#define GST_PAD_STREAM_UNLOCK_FULL(pad) (g_static_rec_mutex_unlock_full(GST_PAD_GET_STREAM_LOCK(pad)))
#define GST_PAD_GET_PREROLL_LOCK(pad) (GST_PAD_CAST(pad)->preroll_lock)
#define GST_PAD_PREROLL_LOCK(pad) (g_mutex_lock(GST_PAD_GET_PREROLL_LOCK(pad)))
#define GST_PAD_PREROLL_TRYLOCK(pad) (g_mutex_trylock(GST_PAD_GET_PREROLL_LOCK(pad)))
#define GST_PAD_PREROLL_UNLOCK(pad) (g_mutex_unlock(GST_PAD_GET_PREROLL_LOCK(pad)))
#define GST_PAD_GET_PREROLL_COND(pad) (GST_PAD_CAST(pad)->preroll_cond)
#define GST_PAD_PREROLL_WAIT(pad) \
g_cond_wait (GST_PAD_GET_PREROLL_COND (pad), GST_PAD_GET_PREROLL_LOCK (pad))
#define GST_PAD_PREROLL_TIMED_WAIT(pad, timeval) \
g_cond_timed_wait (GST_PAD_GET_PREROLL_COND (pad), GST_PAD_GET_PREROLL_LOCK (pad), timeval)
#define GST_PAD_PREROLL_SIGNAL(pad) g_cond_signal (GST_PAD_GET_PREROLL_COND (pad));
#define GST_PAD_PREROLL_BROADCAST(pad) g_cond_broadcast (GST_PAD_GET_PREROLL_COND (pad));
#define GST_PAD_BLOCK_GET_COND(pad) (GST_PAD_CAST(pad)->block_cond)
#define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
#define GST_PAD_BLOCK_SIGNAL(pad) (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
#include <gst/gstpadtemplate.h>
GType gst_pad_get_type (void);
/* creating pads */
GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
/**
* gst_pad_get_name:
* @pad: the pad to get the name from
*
* Get a copy of the name of the pad. g_free() after usage.
*
* MT safe.
*/
#define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
/**
* gst_pad_get_parent:
* @pad: the pad to get the parent of
*
* Get the parent of @pad. This function increases the refcount
* of the parent object so you should gst_object_unref() it after usage.
* Can return NULL if the pad did not have a parent.
*
* MT safe.
*/
#define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
GstPadDirection gst_pad_get_direction (GstPad *pad);
gboolean gst_pad_set_active (GstPad *pad, gboolean active);
gboolean gst_pad_is_active (GstPad *pad);
gboolean gst_pad_activate_pull (GstPad *pad, gboolean active);
gboolean gst_pad_activate_push (GstPad *pad, gboolean active);
gboolean gst_pad_set_blocked (GstPad *pad, gboolean blocked);
gboolean gst_pad_set_blocked_async (GstPad *pad, gboolean blocked,
GstPadBlockCallback callback, gpointer user_data);
gboolean gst_pad_is_blocked (GstPad *pad);
void gst_pad_set_element_private (GstPad *pad, gpointer priv);
gpointer gst_pad_get_element_private (GstPad *pad);
GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
void gst_pad_set_bufferalloc_function (GstPad *pad, GstPadBufferAllocFunction bufalloc);
GstFlowReturn gst_pad_alloc_buffer (GstPad *pad, guint64 offset, gint size,
GstCaps *caps, GstBuffer **buf);
GstFlowReturn gst_pad_alloc_buffer_and_set_caps (GstPad *pad, guint64 offset, gint size,
GstCaps *caps, GstBuffer **buf);
/* data passing setup functions */
void gst_pad_set_activate_function (GstPad *pad, GstPadActivateFunction activate);
void gst_pad_set_activatepull_function (GstPad *pad, GstPadActivateModeFunction activatepull);
void gst_pad_set_activatepush_function (GstPad *pad, GstPadActivateModeFunction activatepush);
void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain);
void gst_pad_set_getrange_function (GstPad *pad, GstPadGetRangeFunction get);
void gst_pad_set_checkgetrange_function (GstPad *pad, GstPadCheckGetRangeFunction check);
void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event);
/* pad links */
void gst_pad_set_link_function (GstPad *pad, GstPadLinkFunction link);
void gst_pad_set_unlink_function (GstPad *pad, GstPadUnlinkFunction unlink);
GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
gboolean gst_pad_is_linked (GstPad *pad);
GstPad* gst_pad_get_peer (GstPad *pad);
/* capsnego functions */
void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps);
void gst_pad_set_acceptcaps_function (GstPad *pad, GstPadAcceptCapsFunction acceptcaps);
void gst_pad_set_fixatecaps_function (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps);
G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
/* capsnego function for connected/unconnected pads */
GstCaps * gst_pad_get_caps (GstPad * pad);
void gst_pad_fixate_caps (GstPad * pad, GstCaps *caps);
gboolean gst_pad_accept_caps (GstPad * pad, GstCaps *caps);
gboolean gst_pad_set_caps (GstPad * pad, GstCaps *caps);
GstCaps * gst_pad_peer_get_caps (GstPad * pad);
gboolean gst_pad_peer_accept_caps (GstPad * pad, GstCaps *caps);
/* capsnego for connected pads */
GstCaps * gst_pad_get_allowed_caps (GstPad * srcpad);
GstCaps * gst_pad_get_negotiated_caps (GstPad * pad);
/* data passing functions to peer */
GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
gboolean gst_pad_check_pull_range (GstPad *pad);
GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size,
GstBuffer **buffer);
gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
gboolean gst_pad_event_default (GstPad *pad, GstEvent *event);
/* data passing functions on pad */
GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size,
GstBuffer **buffer);
gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
/* pad tasks */
gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func,
gpointer data);
gboolean gst_pad_pause_task (GstPad *pad);
gboolean gst_pad_stop_task (GstPad *pad);
/* internal links */
void gst_pad_set_internal_link_function (GstPad *pad, GstPadIntLinkFunction intlink);
GList* gst_pad_get_internal_links (GstPad *pad);
GList* gst_pad_get_internal_links_default (GstPad *pad);
/* generic query function */
void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func);
G_CONST_RETURN GstQueryType*
gst_pad_get_query_types (GstPad *pad);
G_CONST_RETURN GstQueryType*
gst_pad_get_query_types_default (GstPad *pad);
gboolean gst_pad_query (GstPad *pad, GstQuery *query);
void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query);
gboolean gst_pad_query_default (GstPad *pad, GstQuery *query);
/* misc helper functions */
gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch,
gpointer data);
#ifndef GST_DISABLE_LOADSAVE
void gst_pad_load_and_link (xmlNodePtr self, GstObject *parent);
#endif
G_END_DECLS
#endif /* __GST_PAD_H__ */

View File

@@ -0,0 +1,195 @@
/* 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>
#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
/* FIXME: this awful circular dependency need to be resolved properly (see pad.h) */
/*typedef struct _GstPadTemplate GstPadTemplate; */
typedef struct _GstPadTemplateClass GstPadTemplateClass;
typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
#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_request_pad_by_name() or gst_element_request_compatible_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 direction of the padtemplate.
*/
#define GST_PAD_TEMPLATE_DIRECTION(templ) (((GstPadTemplate *)(templ))->direction)
/**
* GST_PAD_TEMPLATE_PRESENCE:
* @templ: the template to query
*
* Get the presence 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_FIXED: the padtemplate has no variable properties
* @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
*
* Flags for the padtemplate
*/
typedef enum {
GST_PAD_TEMPLATE_FIXED = (GST_OBJECT_FLAG_LAST << 0),
/* 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;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstPadTemplateClass {
GstObjectClass parent_class;
/* signal callbacks */
void (*pad_created) (GstPadTemplate *templ, GstPad *pad);
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 {
gchar *name_template;
GstPadDirection direction;
GstPadPresence presence;
GstStaticCaps static_caps;
};
/**
* GST_STATIC_PAD_TEMPLATE:
* @padname: the name template of 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);
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__ */

View File

@@ -0,0 +1,80 @@
/* 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/gstconfig.h>
#include <gst/gstelement.h>
G_BEGIN_DECLS
#ifndef GST_DISABLE_PARSE
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;
GstElement* gst_parse_launch (const gchar *pipeline_description, GError **error);
GstElement* gst_parse_launchv (const gchar **argv, GError **error);
#else /* GST_DISABLE_PARSE */
#if defined _GNUC_ && _GNUC_ >= 3
#pragma GCC poison gst_parse_launch
#pragma GCC poison gst_parse_launchv
#endif
#endif /* GST_DISABLE_PARSE */
G_END_DECLS
#endif /* __GST_PARSE_H__ */

View File

@@ -0,0 +1,108 @@
/* 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))
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.
* @delay: Extra delay added to base time to compensate for delay
* when setting elements to PLAYING.
*
* The #GstPipeline structure.
*/
struct _GstPipeline {
GstBin bin;
/*< public >*/ /* with LOCK */
GstClock *fixed_clock; /* fixed clock if any */
GstClockTime stream_time;
GstClockTime delay;
/*< private >*/
GstPipelinePrivate *priv;
gpointer _gst_reserved[GST_PADDING-1];
};
struct _GstPipelineClass {
GstBinClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_pipeline_get_type (void);
GstElement* gst_pipeline_new (const gchar *name);
GstBus* gst_pipeline_get_bus (GstPipeline *pipeline);
void gst_pipeline_set_new_stream_time (GstPipeline *pipeline, GstClockTime time);
GstClockTime gst_pipeline_get_last_stream_time (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__ */

View File

@@ -0,0 +1,283 @@
/* 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 <time.h> /* time_t */
#include <sys/types.h> /* off_t */
#include <sys/stat.h> /* off_t */
#include <gmodule.h>
#include <gst/gstobject.h>
#include <gst/gstmacros.h>
G_BEGIN_DECLS
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;
typedef enum
{
GST_PLUGIN_FLAG_CACHED = (1<<0),
} GstPluginFlags;
/**
* GstPluginInitFunc:
* @plugin: The plugin object that can be used to register #GstPluginFeatures for this plugin.
*
* 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.
*
* Returns: %TRUE if plugin initialised successfully
*/
typedef gboolean (*GstPluginInitFunc) (GstPlugin *plugin);
/**
* 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
* @_gst_reserved: private, for later expansion
*
*
* A plugins should export a variable of this type called plugin_desc. This plugin
* loaded will use this variable to initialize the plugin.
*/
struct _GstPluginDesc {
gint major_version;
gint minor_version;
gchar *name;
gchar *description;
GstPluginInitFunc plugin_init;
gchar *version;
gchar *license;
gchar *source;
gchar *package;
gchar *origin;
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))
/**
* GstPlugin:
*
* The plugin object
*/
struct _GstPlugin {
GstObject object;
/*< private >*/
GstPluginDesc desc;
GstPluginDesc *orig_desc;
unsigned int flags;
gchar * filename;
gchar * basename; /* base name (non-dir part) of plugin path */
GModule * module; /* contains the module if plugin is loaded */
off_t file_size;
time_t file_mtime;
gboolean registered; /* TRUE when the registry has seen a filename
* that matches the plugin's basename */
gpointer _gst_reserved[GST_PADDING];
};
struct _GstPluginClass {
GstObjectClass object_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* 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
*/
#define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,package,origin) \
GST_PLUGIN_EXPORT GstPluginDesc gst_plugin_desc = { \
major, \
minor, \
name, \
description, \
init, \
version, \
license, \
PACKAGE, \
package, \
origin, \
GST_PADDING_INIT \
};
/**
* GST_PLUGIN_DEFINE_STATIC:
* @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
* local plugin. One would use this macro to define a local plugin that can only
* be used by the own application.
*/
#define GST_PLUGIN_DEFINE_STATIC(major,minor,name,description,init,version,license,package,origin) \
static void GST_GNUC_CONSTRUCTOR \
_gst_plugin_static_init__ ##init (void) \
{ \
static GstPluginDesc plugin_desc_ = { \
major, \
minor, \
name, \
description, \
init, \
version, \
license, \
PACKAGE, \
package, \
origin, \
GST_PADDING_INIT \
}; \
_gst_plugin_register_static (&plugin_desc_); \
}
/**
* GST_LICENSE_UNKNOWN:
*
* To be used in GST_PLUGIN_DEFINE or GST_PLUGIN_DEFINE_STATIC 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);
void _gst_plugin_initialize (void);
void _gst_plugin_register_static (GstPluginDesc *desc);
G_CONST_RETURN gchar* gst_plugin_get_name (GstPlugin *plugin);
G_CONST_RETURN gchar* gst_plugin_get_description (GstPlugin *plugin);
G_CONST_RETURN gchar* gst_plugin_get_filename (GstPlugin *plugin);
G_CONST_RETURN gchar* gst_plugin_get_version (GstPlugin *plugin);
G_CONST_RETURN gchar* gst_plugin_get_license (GstPlugin *plugin);
G_CONST_RETURN gchar* gst_plugin_get_source (GstPlugin *plugin);
G_CONST_RETURN gchar* gst_plugin_get_package (GstPlugin *plugin);
G_CONST_RETURN gchar* gst_plugin_get_origin (GstPlugin *plugin);
GModule * gst_plugin_get_module (GstPlugin *plugin);
gboolean gst_plugin_is_loaded (GstPlugin *plugin);
gboolean gst_plugin_name_filter (GstPlugin *plugin, const gchar *name);
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_list_free (GList *list);
G_END_DECLS
#endif /* __GST_PLUGIN_H__ */

View File

@@ -0,0 +1,149 @@
/* 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>
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))
/**
* GST_PLUGIN_FEATURE_NAME:
* @feature: The feature to query
*
* Get the name of the feature
*/
#define GST_PLUGIN_FEATURE_NAME(feature) (GST_PLUGIN_FEATURE (feature)->name)
typedef struct _GstPluginFeature GstPluginFeature;
typedef struct _GstPluginFeatureClass GstPluginFeatureClass;
/**
* GstRank:
* @GST_RANK_NONE: will be chosen last or not at all
* @GST_RANK_MARGINAL: unlikly 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) will choose this element over an alternative
* one with the same function.
*
* The rank is a unsigned integer ranging from 0 (GST_RANK_NONE) to 256
* (GST_RANK_PRIMARY). These constants serve as a rough guidiance for defining
* the rank of a #GstPlugin using gst_plugin_feature_set_rank().
*/
typedef enum {
GST_RANK_NONE = 0,
GST_RANK_MARGINAL = 64,
GST_RANK_SECONDARY = 128,
GST_RANK_PRIMARY = 256
} GstRank;
/**
* GstPluginFeature:
*
* Opaque #GstPluginFeature structure.
*/
struct _GstPluginFeature {
GstObject object;
/*< private >*/
gboolean loaded;
gchar *name;
guint rank;
gchar *plugin_name;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstPluginFeatureClass {
GstObjectClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstTypeNameData:
* @name: a name
* @type: a GType
*
* Structure used for filtering based on @name and @type.
*/
typedef struct {
const gchar *name;
GType type;
} GstTypeNameData;
/**
* 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);
gboolean gst_plugin_feature_type_name_filter (GstPluginFeature *feature,
GstTypeNameData *data);
void gst_plugin_feature_set_rank (GstPluginFeature *feature, guint rank);
void gst_plugin_feature_set_name (GstPluginFeature *feature, const gchar *name);
guint gst_plugin_feature_get_rank (GstPluginFeature *feature);
G_CONST_RETURN gchar *gst_plugin_feature_get_name (GstPluginFeature *feature);
void gst_plugin_feature_list_free (GList *list);
gboolean gst_plugin_feature_check_version (GstPluginFeature *feature,
guint min_major,
guint min_minor,
guint min_micro);
G_END_DECLS
#endif /* __GST_PLUGIN_FEATURE_H__ */

View File

@@ -0,0 +1,256 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
* 2005 Wim Taymans <wim@fluendo.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>
G_BEGIN_DECLS
/**
* GstQueryType:
* @GST_QUERY_NONE: invalid 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
*
* Standard predefined Query types
*/
/* NOTE: don't forget to update the table in gstquery.c when changing
* this enum */
typedef enum {
GST_QUERY_NONE = 0,
GST_QUERY_POSITION,
GST_QUERY_DURATION,
GST_QUERY_LATENCY,
GST_QUERY_JITTER, /* not in draft-query, necessary? */
GST_QUERY_RATE,
GST_QUERY_SEEKING,
GST_QUERY_SEGMENT,
GST_QUERY_CONVERT,
GST_QUERY_FORMATS
} GstQueryType;
/**
* GST_QUERY_TYPE_RATE_DEN:
*
* Rates are relative to this value
*/
#define GST_QUERY_TYPE_RATE_DEN G_GINT64_CONSTANT (1000000)
typedef struct _GstQueryTypeDefinition GstQueryTypeDefinition;
typedef struct _GstQuery GstQuery;
typedef struct _GstQueryClass GstQueryClass;
/**
* GstQueryTypeDefinition:
* @value: the unique id of the Query type
* @nick: a short nick
* @description: a longer description of the query type
* @quark: the quark for the nick
*
* A Query Type definition
*/
struct _GstQueryTypeDefinition
{
GstQueryType value;
gchar *nick;
gchar *description;
GQuark quark;
};
#define GST_TYPE_QUERY (gst_query_get_type())
#define GST_IS_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QUERY))
#define GST_IS_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QUERY))
#define GST_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QUERY, GstQueryClass))
#define GST_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QUERY, GstQuery))
#define GST_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QUERY, GstQueryClass))
/**
* 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.
*
* Since: 0.10.4
*/
#define GST_QUERY_TYPE_NAME(query) (gst_query_type_get_name(GST_QUERY_TYPE(query)))
/**
* GstQuery:
* @mini_object: The parent #GstMiniObject type
* @type: the #GstQueryType
* @structure: the #GstStructure containing the query details.
*
* The #GstQuery structure.
*/
struct _GstQuery
{
GstMiniObject mini_object;
/*< public > *//* with COW */
GstQueryType type;
GstStructure *structure;
/*< private > */
gpointer _gst_reserved;
};
struct _GstQueryClass {
GstMiniObjectClass mini_object_class;
/*< private > */
gpointer _gst_reserved[GST_PADDING];
};
void _gst_query_initialize (void);
const gchar* gst_query_type_get_name (GstQueryType query);
GQuark gst_query_type_to_quark (GstQueryType query);
GType gst_query_get_type (void);
/* register a new query */
GstQueryType gst_query_type_register (const gchar *nick,
const gchar *description);
GstQueryType gst_query_type_get_by_nick (const gchar *nick);
/* check if a query is in an array of querys */
gboolean gst_query_types_contains (const GstQueryType *types,
GstQueryType type);
/* query for query details */
G_CONST_RETURN GstQueryTypeDefinition*
gst_query_type_get_details (GstQueryType type);
GstIterator* gst_query_type_iterate_definitions (void);
/* refcounting */
/**
* gst_query_ref:
* @q: a #GstQuery to increase the refcount of.
*
* Increases the refcount of the given query by one.
*/
#define gst_query_ref(q) GST_QUERY (gst_mini_object_ref (GST_MINI_OBJECT (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.
*/
#define gst_query_unref(q) gst_mini_object_unref (GST_MINI_OBJECT (q))
/* copy query */
/**
* gst_query_copy:
* @q: a #GstQuery to copy.
*
* Copies the given query using the copy function of the parent #GstData
* structure.
*/
#define gst_query_copy(q) GST_QUERY (gst_mini_object_copy (GST_MINI_OBJECT (q)))
/**
* gst_query_make_writable:
* @q: a #GstQuery to make writable
*
* Makes a writable query from the given query.
*/
#define gst_query_make_writable(q) GST_QUERY (gst_mini_object_make_writable (GST_MINI_OBJECT (q)))
/* position query */
GstQuery* gst_query_new_position (GstFormat format);
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);
void gst_query_set_duration (GstQuery *query, GstFormat format, gint64 duration);
void gst_query_parse_duration (GstQuery *query, GstFormat *format, gint64 *duration);
/* convert query */
GstQuery* gst_query_new_convert (GstFormat src_format, gint64 value, GstFormat dest_format);
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);
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);
/* application specific query */
GstQuery * gst_query_new_application (GstQueryType type,
GstStructure *structure);
GstStructure * gst_query_get_structure (GstQuery *query);
/* moved from old gstqueryutils.h */
GstQuery* gst_query_new_seeking (GstFormat format);
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);
GstQuery* gst_query_new_formats (void);
void gst_query_set_formats (GstQuery *query, gint n_formats, ...);
void gst_query_set_formatsv (GstQuery *query, gint n_formats, GstFormat *formats);
void gst_query_parse_formats_length (GstQuery *query, guint *n_formats);
void gst_query_parse_formats_nth (GstQuery *query, guint nth, GstFormat *format);
G_END_DECLS
#endif /* __GST_QUERY_H__ */

View File

@@ -0,0 +1,209 @@
/* 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 <stdio.h> /* FIXME: because of cache_file below */
#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;
/**
* GstRegistry:
*
* Opaque #GstRegistry structure.
*/
struct _GstRegistry {
GstObject object;
/*< private >*/
GList *plugins;
GList *features;
GList *paths;
/* FIXME move these elsewhere */
int cache_file;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstRegistryClass {
GstObjectClass parent_class;
/* signals */
void (*plugin_added) (GstRegistry *registry, GstPlugin *plugin);
void (*feature_added) (GstRegistry *registry, GstPluginFeature *feature);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* normal GObject stuff */
GType gst_registry_get_type (void);
GstRegistry * gst_registry_get_default (void);
gboolean gst_registry_scan_path (GstRegistry *registry, const gchar *path);
GList* gst_registry_get_path_list (GstRegistry *registry);
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);
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_xml_read_cache (GstRegistry * registry, const char *location);
gboolean gst_registry_xml_write_cache (GstRegistry * registry, const char *location);
void _gst_registry_remove_cache_plugins (GstRegistry *registry);
void _gst_registry_cleanup (void);
/* convinience defines for the default registry */
/**
* gst_default_registry_add_plugin:
* @plugin: the plugin to add
*
* Add the plugin to the default registry.
* The plugin-added signal will be emitted.
*
* Returns: TRUE on success.
*/
#define gst_default_registry_add_plugin(plugin) \
gst_registry_add_plugin (gst_registry_get_default(), plugin)
/**
* gst_default_registry_add_path:
* @path: the path to add to the registry
*
* Add the given path to the default registry. The syntax of the
* path is specific to the registry. If the path has already been
* added, do nothing.
*/
#define gst_default_registry_add_path(path) \
gst_registry_add_path (gst_registry_get_default(), path)
/**
* gst_default_registry_get_path_list:
*
* Get the list of paths for the default registry.
*
* Returns: A Glist of paths as strings. g_list_free after use.
*/
#define gst_default_registry_get_path_list() \
gst_registry_get_path_list (gst_registry_get_default())
/**
* gst_default_registry_get_plugin_list:
*
* Get a copy of all plugins registered in the default registry.
*
* Returns: a copy of the list. Free after use.
*/
#define gst_default_registry_get_plugin_list() \
gst_registry_get_plugin_list (gst_registry_get_default())
/**
* gst_default_registry_find_feature:
* @name: the pluginfeature name to find
* @type: the pluginfeature type to find
*
* Find the pluginfeature with the given name and type in the default registry.
*
* Returns: The pluginfeature with the given name and type or NULL
* if the plugin was not found.
*/
#define gst_default_registry_find_feature(name,type) \
gst_registry_find_feature (gst_registry_get_default(),name,type)
/**
* gst_default_registry_find_plugin:
* @name: the plugin name to find
*
* Find the plugin with the given name in the default registry.
* The plugin will be reffed; caller is responsible for unreffing.
*
* Returns: The plugin with the given name or NULL if the plugin was not found.
*/
#define gst_default_registry_find_plugin(name) \
gst_registry_find_plugin (gst_registry_get_default(),name)
/**
* gst_default_registry_feature_filter:
* @filter: the filter to use
* @first: only return first match
* @user_data: user data passed to the filter function
*
* Runs a filter against all features of the plugins in the default registry
* and returns a GList with the results.
* If the first flag is set, only the first match is
* returned (as a list with a single object).
*
* Returns: a GList of plugin features, gst_plugin_feature_list_free after use.
*/
#define gst_default_registry_feature_filter(filter,first,user_data) \
gst_registry_feature_filter (gst_registry_get_default(),filter,first,user_data)
gboolean gst_default_registry_check_feature_version (const gchar *feature_name,
guint min_major,
guint min_minor,
guint min_micro);
G_END_DECLS
#endif /* __GST_REGISTRY_H__ */

View File

@@ -0,0 +1,104 @@
/* 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/gstevent.h>
#include <gst/gstformat.h>
G_BEGIN_DECLS
#define GST_TYPE_SEGMENT (gst_segment_get_type())
typedef struct _GstSegment GstSegment;
/**
* GstSegment:
* @rate: the rate of the segment
* @abs_rate: absolute value of @rate
* @format: the format of the segment values
* @flags: flags for this segment
* @start: the start of the segment
* @stop: the stop of the segment
* @time: the stream time of the segment
* @accum: accumulated segment
* @last_stop: last known stop time
* @duration: total duration of segment
* @applied_rate: the already applied rate to the segment
*
* A helper structure that holds the configured region of
* interest in a media file.
*/
struct _GstSegment {
/*< public >*/
gdouble rate;
gdouble abs_rate;
GstFormat format;
GstSeekFlags flags;
gint64 start;
gint64 stop;
gint64 time;
gint64 accum;
gint64 last_stop;
gint64 duration;
/* API added 0.10.6 */
gdouble applied_rate;
/*< private >*/
//gpointer _gst_reserved[GST_PADDING-2];
guint8 _gst_reserved[(sizeof (gpointer) * GST_PADDING) - sizeof (gdouble)];
};
GType gst_segment_get_type (void);
GstSegment * gst_segment_new (void);
void gst_segment_free (GstSegment *segment);
void gst_segment_init (GstSegment *segment, GstFormat format);
void gst_segment_set_duration (GstSegment *segment, GstFormat format, gint64 duration);
void gst_segment_set_last_stop (GstSegment *segment, GstFormat format, gint64 position);
void gst_segment_set_seek (GstSegment *segment, gdouble rate,
GstFormat format, GstSeekFlags flags,
GstSeekType cur_type, gint64 cur,
GstSeekType stop_type, gint64 stop,
gboolean *update);
void gst_segment_set_newsegment (GstSegment *segment, gboolean update, gdouble rate,
GstFormat format, gint64 start, gint64 stop, gint64 time);
void gst_segment_set_newsegment_full (GstSegment *segment, gboolean update, gdouble rate,
gdouble applied_rate, GstFormat format, gint64 start,
gint64 stop, gint64 time);
gint64 gst_segment_to_stream_time (GstSegment *segment, GstFormat format, gint64 position);
gint64 gst_segment_to_running_time (GstSegment *segment, GstFormat format, gint64 position);
gboolean gst_segment_clip (GstSegment *segment, GstFormat format, gint64 start,
gint64 stop, gint64 *clip_start, gint64 *clip_stop);
G_END_DECLS
#endif /* __GST_SEGMENT_H__ */

View File

@@ -0,0 +1,204 @@
/* 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/glib-compat.h>
G_BEGIN_DECLS
#define GST_TYPE_STRUCTURE (gst_structure_get_type ())
#define GST_STRUCTURE(object) ((GstStructure *)(object))
#define GST_IS_STRUCTURE(object) ((object) && (GST_STRUCTURE(object)->type == GST_TYPE_STRUCTURE))
typedef struct _GstStructure GstStructure;
/**
* 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;
/* owned by parent structure, NULL if no parent */
gint *parent_refcount;
GArray *fields;
gpointer _gst_reserved;
};
GType gst_structure_get_type (void);
GstStructure * gst_structure_empty_new (const gchar * name);
GstStructure * gst_structure_id_empty_new (GQuark quark);
GstStructure * gst_structure_new (const gchar * name,
const gchar * firstfield,
...);
GstStructure * gst_structure_new_valist (const gchar * name,
const gchar * firstfield,
va_list varargs);
GstStructure * gst_structure_copy (const GstStructure *structure);
void gst_structure_set_parent_refcount (GstStructure *structure,
gint *refcount);
void gst_structure_free (GstStructure *structure);
G_CONST_RETURN 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_set (GstStructure *structure,
const gchar *fieldname,
...) G_GNUC_NULL_TERMINATED;
void gst_structure_set_valist (GstStructure *structure,
const gchar *fieldname,
va_list varargs);
G_CONST_RETURN GValue * gst_structure_id_get_value (const GstStructure *structure,
GQuark field);
G_CONST_RETURN 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_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_fourcc (const GstStructure *structure,
const gchar *fieldname,
guint32 *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_clock_time (const GstStructure *structure,
const gchar *fieldname,
GstClockTime *value);
G_CONST_RETURN 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);
GstStructure * gst_structure_from_string (const gchar *string,
gchar **end);
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_nearest_fraction (GstStructure *structure,
const char *field_name,
const gint target_numerator,
const gint target_denominator);
G_END_DECLS
#endif

View File

@@ -0,0 +1,72 @@
/* 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_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;
/**
* GstSystemClock:
* @clock: The parent clock
*
* The default implementation of a #GstClock that uses the system time.
*/
struct _GstSystemClock {
GstClock clock;
/*< private >*/
GThread *thread; /* thread for async notify */
gboolean stopping;
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__ */

View File

@@ -0,0 +1,502 @@
/* GStreamer
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* gsttaglist.h: Header for tag support
*
* 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_TAGLIST_H__
#define __GST_TAGLIST_H__
#include <gst/gststructure.h>
#include <gst/glib-compat.h>
G_BEGIN_DECLS
/**
* GstTagMergeMode:
* @GST_TAG_MERGE_UNDEFINED: undefined merge mode
* @GST_TAG_MERGE_REPLACE_ALL: replace all tags
* @GST_TAG_MERGE_REPLACE: replace tags
* @GST_TAG_MERGE_APPEND: append tags
* @GST_TAG_MERGE_PREPEND: prepend tags
* @GST_TAG_MERGE_KEEP: keep existing tags
* @GST_TAG_MERGE_KEEP_ALL: keep all existing tags
* @GST_TAG_MERGE_COUNT: the number of merge modes
*
* The different tag merging modes.
*/
typedef enum {
GST_TAG_MERGE_UNDEFINED,
GST_TAG_MERGE_REPLACE_ALL,
GST_TAG_MERGE_REPLACE,
GST_TAG_MERGE_APPEND,
GST_TAG_MERGE_PREPEND,
GST_TAG_MERGE_KEEP,
GST_TAG_MERGE_KEEP_ALL,
/* add more */
GST_TAG_MERGE_COUNT
} GstTagMergeMode;
#define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT))
/**
* GstTagFlag:
* @GST_TAG_FLAG_UNDEFINED: undefined flag
* @GST_TAG_FLAG_META: tag is meta data
* @GST_TAG_FLAG_ENCODED: tag is encoded
* @GST_TAG_FLAG_DECODED: tag is decoded
* @GST_TAG_FLAG_COUNT: number of tag flags
*
* Extra tag flags used when registering tags.
*/
typedef enum {
GST_TAG_FLAG_UNDEFINED,
GST_TAG_FLAG_META,
GST_TAG_FLAG_ENCODED,
GST_TAG_FLAG_DECODED,
GST_TAG_FLAG_COUNT
} GstTagFlag;
#define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
/**
* GstTagList:
*
* Opaque #GstTagList data structure.
*/
typedef GstStructure GstTagList;
#define GST_TAG_LIST(x) ((GstTagList *) (x))
#define GST_IS_TAG_LIST(x) (gst_is_tag_list (GST_TAG_LIST (x)))
#define GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
/**
* GstTagForeachFunc:
* @list: the #GstTagList
* @tag: a name of a tag in @list
* @user_data: user data
*
* A function that will be called in gst_tag_list_foreach(). The function may
* not modify the tag list.
*/
typedef void (*GstTagForeachFunc) (const GstTagList *list,
const gchar * tag,
gpointer user_data);
/**
* GstTagMergeFunc:
* @dest: the destination #GValue
* @src: the source #GValue
*
* A function for merging multiple values of a tag used when registering
* tags.
*/
typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
/* initialize tagging system */
void _gst_tag_initialize (void);
GType gst_tag_list_get_type (void);
void gst_tag_register (const gchar * name,
GstTagFlag flag,
GType type,
const gchar * nick,
const gchar * blurb,
GstTagMergeFunc func);
/* some default merging functions */
void gst_tag_merge_use_first (GValue * dest,
const GValue * src);
void gst_tag_merge_strings_with_comma (GValue * dest,
const GValue * src);
/* basic tag support */
gboolean gst_tag_exists (const gchar * tag);
GType gst_tag_get_type (const gchar * tag);
G_CONST_RETURN gchar *
gst_tag_get_nick (const gchar * tag);
G_CONST_RETURN gchar *
gst_tag_get_description (const gchar * tag);
GstTagFlag gst_tag_get_flag (const gchar * tag);
gboolean gst_tag_is_fixed (const gchar * tag);
/* tag lists */
GstTagList * gst_tag_list_new (void);
gboolean gst_is_tag_list (gconstpointer p);
GstTagList * gst_tag_list_copy (const GstTagList * list);
void gst_tag_list_insert (GstTagList * into,
const GstTagList * from,
GstTagMergeMode mode);
GstTagList * gst_tag_list_merge (const GstTagList * list1,
const GstTagList * list2,
GstTagMergeMode mode);
void gst_tag_list_free (GstTagList * list);
guint gst_tag_list_get_tag_size (const GstTagList * list,
const gchar * tag);
void gst_tag_list_add (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
...) G_GNUC_NULL_TERMINATED;
void gst_tag_list_add_values (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
...) G_GNUC_NULL_TERMINATED;
void gst_tag_list_add_valist (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_list_add_valist_values (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_list_remove_tag (GstTagList * list,
const gchar * tag);
void gst_tag_list_foreach (const GstTagList * list,
GstTagForeachFunc func,
gpointer user_data);
G_CONST_RETURN GValue *
gst_tag_list_get_value_index (const GstTagList * list,
const gchar * tag,
guint index);
gboolean gst_tag_list_copy_value (GValue * dest,
const GstTagList * list,
const gchar * tag);
/* simplifications (FIXME: do we want them?) */
gboolean gst_tag_list_get_char (const GstTagList * list,
const gchar * tag,
gchar * value);
gboolean gst_tag_list_get_char_index (const GstTagList * list,
const gchar * tag,
guint index,
gchar * value);
gboolean gst_tag_list_get_uchar (const GstTagList * list,
const gchar * tag,
guchar * value);
gboolean gst_tag_list_get_uchar_index (const GstTagList * list,
const gchar * tag,
guint index,
guchar * value);
gboolean gst_tag_list_get_boolean (const GstTagList * list,
const gchar * tag,
gboolean * value);
gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
const gchar * tag,
guint index,
gboolean * value);
gboolean gst_tag_list_get_int (const GstTagList * list,
const gchar * tag,
gint * value);
gboolean gst_tag_list_get_int_index (const GstTagList * list,
const gchar * tag,
guint index,
gint * value);
gboolean gst_tag_list_get_uint (const GstTagList * list,
const gchar * tag,
guint * value);
gboolean gst_tag_list_get_uint_index (const GstTagList * list,
const gchar * tag,
guint index,
guint * value);
gboolean gst_tag_list_get_long (const GstTagList * list,
const gchar * tag,
glong * value);
gboolean gst_tag_list_get_long_index (const GstTagList * list,
const gchar * tag,
guint index,
glong * value);
gboolean gst_tag_list_get_ulong (const GstTagList * list,
const gchar * tag,
gulong * value);
gboolean gst_tag_list_get_ulong_index (const GstTagList * list,
const gchar * tag,
guint index,
gulong * value);
gboolean gst_tag_list_get_int64 (const GstTagList * list,
const gchar * tag,
gint64 * value);
gboolean gst_tag_list_get_int64_index (const GstTagList * list,
const gchar * tag,
guint index,
gint64 * value);
gboolean gst_tag_list_get_uint64 (const GstTagList * list,
const gchar * tag,
guint64 * value);
gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
const gchar * tag,
guint index,
guint64 * value);
gboolean gst_tag_list_get_float (const GstTagList * list,
const gchar * tag,
gfloat * value);
gboolean gst_tag_list_get_float_index (const GstTagList * list,
const gchar * tag,
guint index,
gfloat * value);
gboolean gst_tag_list_get_double (const GstTagList * list,
const gchar * tag,
gdouble * value);
gboolean gst_tag_list_get_double_index (const GstTagList * list,
const gchar * tag,
guint index,
gdouble * value);
gboolean gst_tag_list_get_string (const GstTagList * list,
const gchar * tag,
gchar ** value);
gboolean gst_tag_list_get_string_index (const GstTagList * list,
const gchar * tag,
guint index,
gchar ** value);
gboolean gst_tag_list_get_pointer (const GstTagList * list,
const gchar * tag,
gpointer * value);
gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
const gchar * tag,
guint index,
gpointer * value);
gboolean gst_tag_list_get_date (const GstTagList * list,
const gchar * tag,
GDate ** value);
gboolean gst_tag_list_get_date_index (const GstTagList * list,
const gchar * tag,
guint index,
GDate ** value);
/* GStreamer core tags */
/**
* GST_TAG_TITLE:
*
* commonly used title (string)
*/
#define GST_TAG_TITLE "title"
/**
* GST_TAG_ARTIST:
*
* person(s) responsible for the recording (string)
*/
#define GST_TAG_ARTIST "artist"
/**
* GST_TAG_ALBUM:
*
* album containing this data (string)
*/
#define GST_TAG_ALBUM "album"
/**
* GST_TAG_DATE:
*
* date the data was created (#GDate structure)
*/
#define GST_TAG_DATE "date"
/**
* GST_TAG_GENRE:
*
* genre this data belongs to (string)
*/
#define GST_TAG_GENRE "genre"
/**
* GST_TAG_COMMENT:
*
* free text commenting the data (string)
*/
#define GST_TAG_COMMENT "comment"
/**
* GST_TAG_TRACK_NUMBER:
*
* track number inside a collection (unsigned integer)
*/
#define GST_TAG_TRACK_NUMBER "track-number"
/**
* GST_TAG_TRACK_COUNT:
*
* count of tracks inside collection this track belongs to (unsigned integer)
*/
#define GST_TAG_TRACK_COUNT "track-count"
/**
* GST_TAG_ALBUM_VOLUME_NUMBER:
*
* disc number inside a collection (unsigned integer)
*/
#define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
/**
* GST_TAG_ALBUM_VOLUME_COUNT:
*
* count of discs inside collection this disc belongs to (unsigned integer)
*/
#define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
/**
* GST_TAG_LOCATION:
*
* original location of file as a URI (string)
*/
#define GST_TAG_LOCATION "location"
/**
* GST_TAG_DESCRIPTION:
*
* short text describing the content of the data (string)
*/
#define GST_TAG_DESCRIPTION "description"
/**
* GST_TAG_VERSION:
*
* version of this data (string)
*/
#define GST_TAG_VERSION "version"
/**
* GST_TAG_ISRC:
*
* International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
*/
#define GST_TAG_ISRC "isrc"
/**
* GST_TAG_ORGANIZATION:
*
* organization (string)
*/
#define GST_TAG_ORGANIZATION "organization"
/**
* GST_TAG_COPYRIGHT:
*
* copyright notice of the data (string)
*/
#define GST_TAG_COPYRIGHT "copyright"
/**
* GST_TAG_CONTACT:
*
* contact information (string)
*/
#define GST_TAG_CONTACT "contact"
/**
* GST_TAG_LICENSE:
*
* license of data (string)
*/
#define GST_TAG_LICENSE "license"
/**
* GST_TAG_PERFORMER:
*
* person(s) performing (string)
*/
#define GST_TAG_PERFORMER "performer"
/**
* GST_TAG_DURATION:
*
* length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
*/
#define GST_TAG_DURATION "duration"
/**
* GST_TAG_CODEC:
*
* codec the data is stored in (string)
*/
#define GST_TAG_CODEC "codec"
/**
* GST_TAG_VIDEO_CODEC:
*
* codec the video data is stored in (string)
*/
#define GST_TAG_VIDEO_CODEC "video-codec"
/**
* GST_TAG_AUDIO_CODEC:
*
* codec the audio data is stored in (string)
*/
#define GST_TAG_AUDIO_CODEC "audio-codec"
/**
* GST_TAG_BITRATE:
*
* exact or average bitrate in bits/s (unsigned integer)
*/
#define GST_TAG_BITRATE "bitrate"
/**
* GST_TAG_NOMINAL_BITRATE:
*
* nominal bitrate in bits/s (unsigned integer)
*/
#define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
/**
* GST_TAG_MINIMUM_BITRATE:
*
* minimum bitrate in bits/s (unsigned integer)
*/
#define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
/**
* GST_TAG_MAXIMUM_BITRATE:
*
* maximum bitrate in bits/s (unsigned integer)
*/
#define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
/**
* GST_TAG_SERIAL:
*
* serial number of track (unsigned integer)
*/
#define GST_TAG_SERIAL "serial"
/**
* GST_TAG_ENCODER:
*
* encoder used to encode this stream (string)
*/
#define GST_TAG_ENCODER "encoder"
/**
* GST_TAG_ENCODER_VERSION:
*
* version of the encoder used to encode this stream (unsigned integer)
*/
#define GST_TAG_ENCODER_VERSION "encoder-version"
/**
* GST_TAG_TRACK_GAIN:
*
* track gain in db (double)
*/
#define GST_TAG_TRACK_GAIN "replaygain-track-gain"
/**
* GST_TAG_TRACK_PEAK:
*
* peak of the track (double)
*/
#define GST_TAG_TRACK_PEAK "replaygain-track-peak"
/**
* GST_TAG_ALBUM_GAIN:
*
* album gain in db (double)
*/
#define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
/**
* GST_TAG_ALBUM_PEAK:
*
* peak of the album (double)
*/
#define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
/**
* GST_TAG_LANGUAGE_CODE:
*
* Language code (ISO-639-1) (string)
*/
#define GST_TAG_LANGUAGE_CODE "language-code"
/**
* GST_TAG_IMAGE:
*
* image (buffer) (buffer caps should specify the content type)
*
* Since: 0.10.6
*/
#define GST_TAG_IMAGE "image"
G_END_DECLS
#endif /* __GST_TAGLIST_H__ */

View File

@@ -0,0 +1,94 @@
/* 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_TAG_SETTER_CLASS(obj) (G_TYPE_CHECK_CLASS_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_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_TAG_SETTER, GstTagSetterIFace))
/**
* GstTagSetter:
*
* Opaque #GstTagSetter data structure.
*/
typedef struct _GstTagSetter GstTagSetter; /* Dummy typedef */
typedef struct _GstTagSetterIFace GstTagSetterIFace;
/**
* GstTagSetterIFace:
* @g_iface: parent interface type.
*
* #GstTagSetterIFace interface.
*/
/* use an empty interface here to allow detection of elements using user-set
tags */
struct _GstTagSetterIFace
{
GTypeInterface g_iface;
/* signals */
/* virtual table */
};
GType gst_tag_setter_get_type (void);
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);
G_CONST_RETURN 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__ */

View File

@@ -0,0 +1,175 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* <2005> Wim Taymans <wim@fluendo.com>
*
* gsttask.h: Streaming tasks
*
* 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_TASK_H__
#define __GST_TASK_H__
#include <gst/gstobject.h>
G_BEGIN_DECLS
/**
* GstTaskFunction:
* @data: user data passed to the function
*
* A function that will repeadedly be called in the thread created by
* a GstTask.
*/
typedef void (*GstTaskFunction) (void *data);
/* --- standard type macros --- */
#define GST_TYPE_TASK (gst_task_get_type ())
#define GST_TASK(task) (G_TYPE_CHECK_INSTANCE_CAST ((task), GST_TYPE_TASK, GstTask))
#define GST_IS_TASK(task) (G_TYPE_CHECK_INSTANCE_TYPE ((task), GST_TYPE_TASK))
#define GST_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), GST_TYPE_TASK, GstTaskClass))
#define GST_IS_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), GST_TYPE_TASK))
#define GST_TASK_GET_CLASS(task) (G_TYPE_INSTANCE_GET_CLASS ((task), GST_TYPE_TASK, GstTaskClass))
#define GST_TASK_CAST(task) ((GstTask*)(task))
typedef struct _GstTask GstTask;
typedef struct _GstTaskClass GstTaskClass;
/**
* GstTaskState:
* @GST_TASK_STARTED: the task is started and running
* @GST_TASK_STOPPED: the task is stopped
* @GST_TASK_PAUSED: the task is paused
*
* The different states a task can be in
*/
typedef enum {
GST_TASK_STARTED,
GST_TASK_STOPPED,
GST_TASK_PAUSED,
} GstTaskState;
/**
* GST_TASK_STATE:
* @task: Task to get the state of
*
* Get access to the state of the task.
*/
#define GST_TASK_STATE(task) (GST_TASK_CAST(task)->state)
/**
* GST_TASK_GET_COND:
* @task: Task to get the cond of
*
* Get access to the cond of the task.
*/
#define GST_TASK_GET_COND(task) (GST_TASK_CAST(task)->cond)
/**
* GST_TASK_WAIT:
* @task: Task to wait for
*
* Wait for the task cond to be signalled
*/
#define GST_TASK_WAIT(task) g_cond_wait(GST_TASK_GET_COND (task), GST_OBJECT_GET_LOCK (task))
/**
* GST_TASK_SIGNAL:
* @task: Task to signal
*
* Signal the task cond
*/
#define GST_TASK_SIGNAL(task) g_cond_signal(GST_TASK_GET_COND (task))
/**
* GST_TASK_BROADCAST:
* @task: Task to broadcast
*
* Send a broadcast signal to all waiting task conds
*/
#define GST_TASK_BROADCAST(task) g_cond_breadcast(GST_TASK_GET_COND (task))
/**
* GST_TASK_GET_LOCK:
* @task: Task to get the lock of
*
* Get access to the task lock.
*/
#define GST_TASK_GET_LOCK(task) (GST_TASK_CAST(task)->lock)
/**
* GstTask:
* @state: the state of the task
* @cond: used to pause/resume the task
* @lock: The lock taken when iterating the taskfunction
* @func: the function executed by this task
* @data: data passed to the task function
* @running: a flag indicating that the task is running.
*
* The #GstTask object.
*/
struct _GstTask {
GstObject object;
/*< public >*/ /* with LOCK */
GstTaskState state;
GCond *cond;
GStaticRecMutex *lock;
GstTaskFunction func;
gpointer data;
gboolean running;
/*< private >*/
union {
struct {
/* thread this task is currently running in */
GThread *thread;
} ABI;
/* adding + 0 to mark ABI change to be undone later */
gpointer _gst_reserved[GST_PADDING + 0];
} abidata;
};
struct _GstTaskClass {
GstObjectClass parent_class;
/*< private >*/
GThreadPool *pool;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
void gst_task_cleanup_all (void);
GType gst_task_get_type (void);
GstTask* gst_task_create (GstTaskFunction func, gpointer data);
void gst_task_set_lock (GstTask *task, GStaticRecMutex *mutex);
GstTaskState gst_task_get_state (GstTask *task);
gboolean gst_task_start (GstTask *task);
gboolean gst_task_stop (GstTask *task);
gboolean gst_task_pause (GstTask *task);
gboolean gst_task_join (GstTask *task);
G_END_DECLS
#endif /* __GST_TASK_H__ */

View File

@@ -0,0 +1,242 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gsttrace.h: Header for tracing functions (deprecated)
*
* 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_TRACE_H__
#define __GST_TRACE_H__
#include <glib.h>
G_BEGIN_DECLS
#ifndef GST_DISABLE_TRACE
typedef struct _GstTrace GstTrace;
typedef struct _GstTraceEntry GstTraceEntry;
/**
* GstTrace:
*
* Opaque #GstTrace structure.
*/
struct _GstTrace {
/*< private >*/
/* where this trace is going */
gchar *filename;
int fd;
/* current buffer, size, head offset */
GstTraceEntry *buf;
gint bufsize;
gint bufoffset;
};
struct _GstTraceEntry {
gint64 timestamp;
guint32 sequence;
guint32 data;
gchar message[112];
};
GstTrace* gst_trace_new (gchar *filename, gint size);
void gst_trace_destroy (GstTrace *trace);
void gst_trace_flush (GstTrace *trace);
void gst_trace_text_flush (GstTrace *trace);
/**
* gst_trace_get_size:
* @trace: a #GstTrace
*
* Retrieve the buffer size of @trace.
*/
#define gst_trace_get_size(trace) ((trace)->bufsize)
/**
* gst_trace_get_offset:
* @trace: a #GstTrace
*
* Retrieve the current buffer offset of @trace.
*/
#define gst_trace_get_offset(trace) ((trace)->bufoffset)
/**
* gst_trace_get_remaining:
* @trace: a #GstTrace
*
* Retrieve the remaining size in the @trace buffer.
*/
#define gst_trace_get_remaining(trace) ((trace)->bufsize - (trace)->bufoffset)
void gst_trace_set_default (GstTrace *trace);
void _gst_trace_add_entry (GstTrace *trace, guint32 seq,
guint32 data, gchar *msg);
void gst_trace_read_tsc (gint64 *dst);
/**
* GstAllocTraceFlags:
* @GST_ALLOC_TRACE_LIVE: Trace number of non-freed memory
* @GST_ALLOC_TRACE_MEM_LIVE: trace pointers of unfreed memory
*
* Flags indicating which tracing feature to enable.
*/
typedef enum {
GST_ALLOC_TRACE_LIVE = (1 << 0),
GST_ALLOC_TRACE_MEM_LIVE = (1 << 1)
} GstAllocTraceFlags;
typedef struct _GstAllocTrace GstAllocTrace;
/**
* GstAllocTrace:
* @name: The name of the tracing object
* @flags: Flags for this object
* @live: counter for live memory
* @mem_live: list with pointers to unfreed memory
*
* The main tracing object
*/
struct _GstAllocTrace {
gchar *name;
gint flags;
gint live;
GSList *mem_live;
};
gboolean gst_alloc_trace_available (void);
G_CONST_RETURN GList* gst_alloc_trace_list (void);
GstAllocTrace* _gst_alloc_trace_register (const gchar *name);
int gst_alloc_trace_live_all (void);
void gst_alloc_trace_print_all (void);
void gst_alloc_trace_print_live (void);
void gst_alloc_trace_set_flags_all (GstAllocTraceFlags flags);
GstAllocTrace* gst_alloc_trace_get (const gchar *name);
void gst_alloc_trace_print (const GstAllocTrace *trace);
void gst_alloc_trace_set_flags (GstAllocTrace *trace, GstAllocTraceFlags flags);
#ifndef GST_DISABLE_ALLOC_TRACE
/**
* gst_alloc_trace_register:
* @name: The name of the tracer object
*
* Register a new alloc tracer with the given name
*/
#define gst_alloc_trace_register(name) _gst_alloc_trace_register (name);
/**
* gst_alloc_trace_new:
* @trace: The tracer to use
* @mem: The memory allocated
*
* Use the tracer to trace a new memory allocation
*/
#define gst_alloc_trace_new(trace, mem) \
G_STMT_START { \
if ((trace)->flags & GST_ALLOC_TRACE_LIVE) \
(trace)->live++; \
if ((trace)->flags & GST_ALLOC_TRACE_MEM_LIVE) \
(trace)->mem_live = \
g_slist_prepend ((trace)->mem_live, mem); \
} G_STMT_END
/**
* gst_alloc_trace_free:
* @trace: The tracer to use
* @mem: The memory that is freed
*
* Trace a memory free operation
*/
#define gst_alloc_trace_free(trace, mem) \
G_STMT_START { \
if ((trace)->flags & GST_ALLOC_TRACE_LIVE) \
(trace)->live--; \
if ((trace)->flags & GST_ALLOC_TRACE_MEM_LIVE) \
(trace)->mem_live = \
g_slist_remove ((trace)->mem_live, mem); \
} G_STMT_END
#else
#define gst_alloc_trace_register(name) (NULL)
#define gst_alloc_trace_new(trace, mem)
#define gst_alloc_trace_free(trace, mem)
#endif
extern gint _gst_trace_on;
/**
* gst_trace_add_entry:
* @trace: a #GstTrace
* @seq: a sequence number
* @data: the data to trace
* @msg: the trace message
*
* Add an entry to @trace with sequence number @seq, @data and @msg.
* If @trace is NULL, the entry will be added to the default #GstTrace.
*/
#define gst_trace_add_entry(trace,seq,data,msg) \
if (_gst_trace_on) { \
_gst_trace_add_entry(trace,(guint32)seq,(guint32)data,msg); \
}
#else /* GST_DISABLE_TRACE */
#if defined _GNUC_ && _GNUC_ >= 3
#pragma GCC poison gst_trace_new
#pragma GCC poison gst_trace_destroy
#pragma GCC poison gst_trace_flush
#pragma GCC poison gst_trace_text_flush
#pragma GCC poison gst_trace_get_size
#pragma GCC poison gst_trace_get_offset
#pragma GCC poison gst_trace_get_remaining
#pragma GCC poison gst_trace_set_default
#pragma GCC poison _gst_trace_add_entry
#pragma GCC poison gst_trace_read_tsc
#pragma GCC poison gst_trace_add_entry
#endif
#define gst_alloc_trace_register(name)
#define gst_alloc_trace_new(trace, mem)
#define gst_alloc_trace_free(trace, mem)
#define gst_alloc_trace_available() (FALSE)
#define gst_alloc_trace_list() (NULL)
#define _gst_alloc_trace_register(name) (NULL)
#define gst_alloc_trace_print_all()
#define gst_alloc_trace_set_flags_all(flags)
#define gst_alloc_trace_get(name) (NULL)
#define gst_alloc_trace_print(trace)
#define gst_alloc_trace_set_flags(trace,flags)
#define gst_trace_add_entry(trace,seq,data,msg)
#endif /* GST_DISABLE_TRACE */
G_END_DECLS
#endif /* __GST_TRACE_H__ */

View File

@@ -0,0 +1,110 @@
/* GStreamer
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* gsttypefind.h: typefinding 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_TYPE_FIND_H__
#define __GST_TYPE_FIND_H__
#include <gst/gstcaps.h>
#include <gst/gstplugin.h>
#include <gst/gstpluginfeature.h>
G_BEGIN_DECLS
typedef struct _GstTypeFind GstTypeFind;
/**
* GstTypeFindFunction:
* @find: A #GstTypeFind structure
* @data: optionnal data to pass to the function
*
* A function that will be called by typefinding.
*/
typedef void (* GstTypeFindFunction) (GstTypeFind *find, gpointer data);
/**
* GstTypeFindProbability:
* @GST_TYPE_FIND_MINIMUM: unlikely typefind
* @GST_TYPE_FIND_POSSIBLE: possible type detected
* @GST_TYPE_FIND_LIKELY: likely a type was detected
* @GST_TYPE_FIND_NEARLY_CERTAIN: nearly certain that a type was detected
* @GST_TYPE_FIND_MAXIMUM: very certain a type was detected.
*
* The probability of the typefind function. Higher values have more certainty
* in doing a reliable typefind.
*/
typedef enum {
GST_TYPE_FIND_MINIMUM = 1,
GST_TYPE_FIND_POSSIBLE = 50,
GST_TYPE_FIND_LIKELY = 80,
GST_TYPE_FIND_NEARLY_CERTAIN = 99,
GST_TYPE_FIND_MAXIMUM = 100
} GstTypeFindProbability;
/**
* GstTypeFind:
* @peek: Method to peek data.
* @suggest: Method to suggest #GstCaps with a given probability.
* @data: The data used by the caller of the typefinding function.
* @get_length: Returns the length of current data.
*
* Object that stores typefind callbacks. To use with #GstTypeFindFactory.
*/
struct _GstTypeFind {
/* private to the caller of the typefind function */
guint8 * (* peek) (gpointer data,
gint64 offset,
guint size);
void (* suggest) (gpointer data,
guint probability,
const GstCaps * caps);
gpointer data;
/* optional */
guint64 (* get_length) (gpointer data);
/* <private> */
gpointer _gst_reserved[GST_PADDING];
};
/* typefind function interface */
guint8 * gst_type_find_peek (GstTypeFind * find,
gint64 offset,
guint size);
void gst_type_find_suggest (GstTypeFind * find,
guint probability,
const GstCaps * caps);
guint64 gst_type_find_get_length (GstTypeFind * find);
/* registration interface */
gboolean gst_type_find_register (GstPlugin * plugin,
const gchar * name,
guint rank,
GstTypeFindFunction func,
gchar ** extensions,
const GstCaps * possible_caps,
gpointer data,
GDestroyNotify data_notify);
G_END_DECLS
#endif /* __GST_TYPE_FIND_H__ */

View File

@@ -0,0 +1,81 @@
/* GStreamer
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* gsttypefindfactory.h: typefinding 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_TYPE_FIND_FACTORY_H__
#define __GST_TYPE_FIND_FACTORY_H__
#include <gst/gstcaps.h>
#include <gst/gstplugin.h>
#include <gst/gstpluginfeature.h>
#include <gst/gsttypefind.h>
G_BEGIN_DECLS
#define GST_TYPE_TYPE_FIND_FACTORY (gst_type_find_factory_get_type())
#define GST_TYPE_FIND_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactory))
#define GST_IS_TYPE_FIND_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TYPE_FIND_FACTORY))
#define GST_TYPE_FIND_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass))
#define GST_IS_TYPE_FIND_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TYPE_FIND_FACTORY))
#define GST_TYPE_FIND_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass))
typedef struct _GstTypeFindFactory GstTypeFindFactory;
typedef struct _GstTypeFindFactoryClass GstTypeFindFactoryClass;
/**
* GstTypeFindFactory:
*
* Object that stores information about a typefind function.
*/
struct _GstTypeFindFactory {
GstPluginFeature feature;
/* <private> */
GstTypeFindFunction function;
gchar ** extensions;
GstCaps * caps; /* FIXME: not yet saved in registry */
gpointer user_data;
GDestroyNotify user_data_notify;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstTypeFindFactoryClass {
GstPluginFeatureClass parent;
/* <private> */
gpointer _gst_reserved[GST_PADDING];
};
/* typefinding interface */
GType gst_type_find_factory_get_type (void);
GList * gst_type_find_factory_get_list (void);
gchar ** gst_type_find_factory_get_extensions (GstTypeFindFactory *factory);
GstCaps * gst_type_find_factory_get_caps (GstTypeFindFactory *factory);
void gst_type_find_factory_call_function (GstTypeFindFactory *factory,
GstTypeFind *find);
G_END_DECLS
#endif /* __GST_TYPE_FIND_FACTORY_H__ */

View File

@@ -0,0 +1,142 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gsturi.h: Header for uri to element mappings
*
* 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_URI_H__
#define __GST_URI_H__
#include <glib.h>
#include <gst/gstelement.h>
#include <gst/gstpluginfeature.h>
G_BEGIN_DECLS
/**
* GstURIType:
* @GST_URI_UNKNOWN : The URI direction is unknown
* @GST_URI_SINK : The URI is a consumer.
* @GST_URI_SRC : The URI is a producer.
*
* The different types of URI direction.
*/
typedef enum {
GST_URI_UNKNOWN,
GST_URI_SINK,
GST_URI_SRC
} GstURIType;
/**
* GST_URI_TYPE_IS_VALID:
* @type: A #GstURIType
*
* Tests if the type direction is valid.
*/
#define GST_URI_TYPE_IS_VALID(type) ((type) == GST_URI_SRC || (type) == GST_URI_SINK)
/* uri handler functions */
#define GST_TYPE_URI_HANDLER (gst_uri_handler_get_type ())
#define GST_URI_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_URI_HANDLER, GstURIHandler))
#define GST_IS_URI_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_URI_HANDLER))
#define GST_URI_HANDLER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_URI_HANDLER, GstURIHandlerInterface))
#define GST_URI_HANDLER_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GST_TYPE_URI_HANDLER, GstURIHandler))
/**
* GstURIHandler:
*
* Opaque #GstURIHandler structure.
*/
typedef struct _GstURIHandler GstURIHandler;
typedef struct _GstURIHandlerInterface GstURIHandlerInterface;
/**
* GstURIHandlerInterface:
* @parent: The parent interface type
* @get_type: Method to tell wether the element handles source or sink URI.
* @get_protocols: Method to return the list of protocols handled by the element.
* @get_uri: Method to return the URI currently handled by the element.
* @set_uri: Method to set a new URI.
*
* #GstElements using this interface should implement these methods.
*/
struct _GstURIHandlerInterface {
GTypeInterface parent;
/*< private >*/
/* signals */
void (* new_uri) (GstURIHandler * handler,
const gchar * uri);
/* idea for the future ?
gboolean (* require_password) (GstURIHandler * handler,
gchar ** username,
gchar ** password);
*/
/* vtable */
/*< public >*/
/* querying capabilities */
GstURIType (* get_type) (void);
gchar ** (* get_protocols) (void);
/* using the interface */
G_CONST_RETURN gchar *(* get_uri) (GstURIHandler * handler);
gboolean (* set_uri) (GstURIHandler * handler,
const gchar * uri);
/*< private >*/
/* we might want to add functions here to query features,
* someone with gnome-vfs knowledge go ahead */
gpointer _gst_reserved[GST_PADDING];
};
/* general URI functions */
gboolean gst_uri_protocol_is_valid (const gchar * protocol);
gboolean gst_uri_is_valid (const gchar * uri);
gchar * gst_uri_get_protocol (const gchar * uri);
gboolean gst_uri_has_protocol (const gchar * uri,
const gchar * protocol);
gchar * gst_uri_get_location (const gchar * uri);
gchar * gst_uri_construct (const gchar * protocol,
const gchar * location);
GstElement * gst_element_make_from_uri (const GstURIType type,
const gchar * uri,
const gchar * elementname);
/* accessing the interface */
GType gst_uri_handler_get_type (void);
guint gst_uri_handler_get_uri_type (GstURIHandler * handler);
gchar ** gst_uri_handler_get_protocols (GstURIHandler * handler);
G_CONST_RETURN
gchar * gst_uri_handler_get_uri (GstURIHandler * handler);
gboolean gst_uri_handler_set_uri (GstURIHandler * handler,
const gchar * uri);
void gst_uri_handler_new_uri (GstURIHandler * handler,
const gchar * uri);
G_END_DECLS
#endif /* __GST_URI_H__ */

View File

@@ -0,0 +1,626 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2002 Thomas Vander Stichele <thomas@apestaart.org>
*
* gstutils.h: Header for various utility functions
*
* 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_UTILS_H__
#define __GST_UTILS_H__
#include <gst/gstconfig.h>
#include <glib.h>
#include <gst/gstbin.h>
G_BEGIN_DECLS
void gst_util_set_value_from_string (GValue *value, const gchar *value_str);
void gst_util_set_object_arg (GObject *object, const gchar *name, const gchar *value);
void gst_util_dump_mem (const guchar *mem, guint size);
guint64 gst_util_gdouble_to_guint64 (gdouble value);
gdouble gst_util_guint64_to_gdouble (guint64 value);
/**
* gst_guint64_to_gdouble:
* @value: the #guint64 value to convert
*
* Convert @value to a gdouble.
*
* Returns: @value converted to a #gdouble.
*/
/**
* gst_gdouble_to_guint64:
* @value: the #gdouble value to convert
*
* Convert @value to a guint64.
*
* Returns: @value converted to a #guint64.
*/
#ifdef WIN32
#define gst_gdouble_to_guint64(value) gst_util_gdouble_to_guint64(value)
#define gst_guint64_to_gdouble(value) gst_util_guint64_to_gdouble(value)
#else
#define gst_gdouble_to_guint64(value) ((guint64) (value))
#define gst_guint64_to_gdouble(value) ((gdouble) (value))
#endif
guint64 gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom);
guint64 gst_util_uint64_scale_int (guint64 val, gint num, gint denom);
void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad);
void gst_print_element_args (GString *buf, gint indent, GstElement *element);
/* Macros for defining classes. Ideas taken from Bonobo, which took theirs
from Nautilus and GOB. */
/**
* GST_BOILERPLATE_FULL:
* @type: the name of the type struct
* @type_as_function: the prefix for the functions
* @parent_type: the parent type struct name
* @parent_type_macro: the parent type macro
* @additional_initializations: function pointer in the form of
* void additional_initializations (GType type) that can be used for
* initializing interfaces and the like
*
* Define the boilerplate type stuff to reduce typos and code size. Defines
* the get_type method and the parent_class static variable.
*
* <informalexample>
* <programlisting>
* GST_BOILERPLATE_FULL (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT, _do_init);
* </programlisting>
* </informalexample>
*/
#define GST_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations) \
\
static void type_as_function ## _base_init (gpointer g_class); \
static void type_as_function ## _class_init (type ## Class *g_class);\
static void type_as_function ## _init (type *object, \
type ## Class *g_class);\
static parent_type ## Class *parent_class = NULL; \
static void \
type_as_function ## _class_init_trampoline (gpointer g_class, \
gpointer data) \
{ \
parent_class = (parent_type ## Class *) \
g_type_class_peek_parent (g_class); \
type_as_function ## _class_init ((type ## Class *)g_class); \
} \
\
GType type_as_function ## _get_type (void); \
\
GType \
type_as_function ## _get_type (void) \
{ \
static GType object_type = 0; \
if (G_UNLIKELY (object_type == 0)) { \
static const GTypeInfo object_info = { \
sizeof (type ## Class), \
type_as_function ## _base_init, \
NULL, /* base_finalize */ \
type_as_function ## _class_init_trampoline, \
NULL, /* class_finalize */ \
NULL, /* class_data */ \
sizeof (type), \
0, /* n_preallocs */ \
(GInstanceInitFunc) type_as_function ## _init \
}; \
object_type = g_type_register_static (parent_type_macro, #type, \
&object_info, (GTypeFlags) 0); \
additional_initializations (object_type); \
} \
return object_type; \
}
#define __GST_DO_NOTHING(type) /* NOP */
/**
* GST_BOILERPLATE:
* @type: the name of the type struct
* @type_as_function: the prefix for the functions
* @parent_type: the parent type struct name
* @parent_type_macro: the parent type macro
*
* Define the boilerplate type stuff to reduce typos and code size. Defines
* the get_type method and the parent_class static variable.
*
* <informalexample>
* <programlisting>
* GST_BOILERPLATE (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT);
* </programlisting>
* </informalexample>
*/
#define GST_BOILERPLATE(type,type_as_function,parent_type,parent_type_macro) \
GST_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \
__GST_DO_NOTHING)
/* Like GST_BOILERPLATE, but makes the type 1) implement an interface, and 2)
* implement GstImplementsInterface for that type
*
* After this you will need to implement interface_as_function ## _supported
* and interface_as_function ## _interface_init
*/
/**
* GST_BOILERPLATE_WITH_INTERFACE:
* @type: the name of the type struct
* @type_as_function: the prefix for the functions
* @parent_type: the parent type struct name
* @parent_type_as_macro: the parent type macro
* @interface_type: the name of the interface type struct
* @interface_type_as_macro: the interface type macro
* @interface_as_function: the interface function name prefix
*
* Like GST_BOILERPLATE, but makes the type 1) implement an interface, and 2)
* implement GstImplementsInterface for that type.
*
* After this you will need to implement interface_as_function ## _supported
* and interface_as_function ## _interface_init
*/
#define GST_BOILERPLATE_WITH_INTERFACE(type, type_as_function, \
parent_type, parent_type_as_macro, interface_type, \
interface_type_as_macro, interface_as_function) \
\
static void interface_as_function ## _interface_init (interface_type ## Class *klass); \
static gboolean interface_as_function ## _supported (type *object, GType iface_type); \
\
static void \
type_as_function ## _implements_interface_init (GstImplementsInterfaceClass *klass) \
{ \
klass->supported = (gboolean (*)(GstImplementsInterface*, GType))interface_as_function ## _supported; \
} \
\
static void \
type_as_function ## _init_interfaces (GType type) \
{ \
static const GInterfaceInfo implements_iface_info = { \
(GInterfaceInitFunc) type_as_function ## _implements_interface_init,\
NULL, \
NULL, \
}; \
static const GInterfaceInfo iface_info = { \
(GInterfaceInitFunc) interface_as_function ## _interface_init, \
NULL, \
NULL, \
}; \
\
g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, \
&implements_iface_info); \
g_type_add_interface_static (type, interface_type_as_macro, \
&iface_info); \
} \
\
GST_BOILERPLATE_FULL (type, type_as_function, parent_type, \
parent_type_as_macro, type_as_function ## _init_interfaces)
/**
* GST_CALL_PARENT:
* @parent_class_cast: the name of the class cast macro for the parent type
* @name: name of the function to call
* @args: arguments enclosed in '( )'
*
* Just call the parent handler. This assumes that there is a variable
* named parent_class that points to the (duh!) parent class. Note that
* this macro is not to be used with things that return something, use
* the _WITH_DEFAULT version for that
*/
#define GST_CALL_PARENT(parent_class_cast, name, args) \
((parent_class_cast(parent_class)->name != NULL) ? \
parent_class_cast(parent_class)->name args : (void) 0)
/**
* GST_CALL_PARENT_WITH_DEFAULT:
* @parent_class_cast: the name of the class cast macro for the parent type
* @name: name of the function to call
* @args: arguments enclosed in '( )'
* @def_return: default result
*
* Same as GST_CALL_PARENT(), but in case there is no implementation, it
* evaluates to @def_return.
*/
#define GST_CALL_PARENT_WITH_DEFAULT(parent_class_cast, name, args, def_return)\
((parent_class_cast(parent_class)->name != NULL) ? \
parent_class_cast(parent_class)->name args : def_return)
/* Define possibly unaligned memory access method whether the type of
* architecture. */
#if GST_HAVE_UNALIGNED_ACCESS
#define _GST_GET(__data, __size, __end) \
(GUINT##__size##_FROM_##__end (* ((guint##__size *) (__data))))
/**
* GST_READ_UINT64_BE:
* @data: memory location
*
* Read a 64 bit unsigned integer value in big endian format from the memory buffer.
*/
#define GST_READ_UINT64_BE(data) _GST_GET (data, 64, BE)
/**
* GST_READ_UINT64_LE:
* @data: memory location
*
* Read a 64 bit unsigned integer value in little endian format from the memory buffer.
*/
#define GST_READ_UINT64_LE(data) _GST_GET (data, 64, LE)
/**
* GST_READ_UINT32_BE:
* @data: memory location
*
* Read a 32 bit unsigned integer value in big endian format from the memory buffer.
*/
#define GST_READ_UINT32_BE(data) _GST_GET (data, 32, BE)
/**
* GST_READ_UINT32_LE:
* @data: memory location
*
* Read a 32 bit unsigned integer value in little endian format from the memory buffer.
*/
#define GST_READ_UINT32_LE(data) _GST_GET (data, 32, LE)
/**
* GST_READ_UINT16_BE:
* @data: memory location
*
* Read a 16 bit unsigned integer value in big endian format from the memory buffer.
*/
#define GST_READ_UINT16_BE(data) _GST_GET (data, 16, BE)
/**
* GST_READ_UINT16_LE:
* @data: memory location
*
* Read a 16 bit unsigned integer value in little endian format from the memory buffer.
*/
#define GST_READ_UINT16_LE(data) _GST_GET (data, 16, LE)
/**
* GST_READ_UINT8:
* @data: memory location
*
* Read an 8 bit unsigned integer value from the memory buffer.
*/
#define GST_READ_UINT8(data) (* ((guint8 *) (data)))
#define _GST_PUT(__data, __size, __end, __num) \
((* (guint##__size *) (__data)) = GUINT##__size##_TO_##__end (__num))
/**
* GST_WRITE_UINT64_BE:
* @data: memory location
* @num: value to store
*
* Store a 64 bit unsigned integer value in big endian format into the memory buffer.
*/
#define GST_WRITE_UINT64_BE(data, num) _GST_PUT(data, 64, BE, num)
/**
* GST_WRITE_UINT64_LE:
* @data: memory location
* @num: value to store
*
* Store a 64 bit unsigned integer value in little endian format into the memory buffer.
*/
#define GST_WRITE_UINT64_LE(data, num) _GST_PUT(data, 64, LE, num)
/**
* GST_WRITE_UINT32_BE:
* @data: memory location
* @num: value to store
*
* Store a 32 bit unsigned integer value in big endian format into the memory buffer.
*/
#define GST_WRITE_UINT32_BE(data, num) _GST_PUT(data, 32, BE, num)
/**
* GST_WRITE_UINT32_LE:
* @data: memory location
* @num: value to store
*
* Store a 32 bit unsigned integer value in little endian format into the memory buffer.
*/
#define GST_WRITE_UINT32_LE(data, num) _GST_PUT(data, 32, LE, num)
/**
* GST_WRITE_UINT16_BE:
* @data: memory location
* @num: value to store
*
* Store a 16 bit unsigned integer value in big endian format into the memory buffer.
*/
#define GST_WRITE_UINT16_BE(data, num) _GST_PUT(data, 16, BE, num)
/**
* GST_WRITE_UINT16_LE:
* @data: memory location
* @num: value to store
*
* Store a 16 bit unsigned integer value in little endian format into the memory buffer.
*/
#define GST_WRITE_UINT16_LE(data, num) _GST_PUT(data, 16, LE, num)
/**
* GST_WRITE_UINT8:
* @data: memory location
* @num: value to store
*
* Store an 8 bit unsigned integer value into the memory buffer.
*/
#define GST_WRITE_UINT8(data, num) ((* (guint8 *) (data)) = (num))
#else /* GST_HAVE_UNALIGNED_ACCESS */
#define _GST_GET(__data, __idx, __size, __shift) \
(((guint##__size) (((guint8 *) (__data))[__idx])) << __shift)
#define GST_READ_UINT64_BE(data) (_GST_GET (data, 0, 64, 56) | \
_GST_GET (data, 1, 64, 48) | \
_GST_GET (data, 2, 64, 40) | \
_GST_GET (data, 3, 64, 32) | \
_GST_GET (data, 4, 64, 24) | \
_GST_GET (data, 5, 64, 16) | \
_GST_GET (data, 6, 64, 8) | \
_GST_GET (data, 7, 64, 0))
#define GST_READ_UINT64_LE(data) (_GST_GET (data, 7, 64, 56) | \
_GST_GET (data, 6, 64, 48) | \
_GST_GET (data, 5, 64, 40) | \
_GST_GET (data, 4, 64, 32) | \
_GST_GET (data, 3, 64, 24) | \
_GST_GET (data, 2, 64, 16) | \
_GST_GET (data, 1, 64, 8) | \
_GST_GET (data, 0, 64, 0))
#define GST_READ_UINT32_BE(data) (_GST_GET (data, 0, 32, 24) | \
_GST_GET (data, 1, 32, 16) | \
_GST_GET (data, 2, 32, 8) | \
_GST_GET (data, 3, 32, 0))
#define GST_READ_UINT32_LE(data) (_GST_GET (data, 3, 32, 24) | \
_GST_GET (data, 2, 32, 16) | \
_GST_GET (data, 1, 32, 8) | \
_GST_GET (data, 0, 32, 0))
#define GST_READ_UINT16_BE(data) (_GST_GET (data, 0, 16, 8) | \
_GST_GET (data, 1, 16, 0))
#define GST_READ_UINT16_LE(data) (_GST_GET (data, 1, 16, 8) | \
_GST_GET (data, 0, 16, 0))
#define GST_READ_UINT8(data) (_GST_GET (data, 0, 8, 0))
#define _GST_PUT(__data, __idx, __size, __shift, __num) \
(((guint8 *) (__data))[__idx] = (((guint##__size) __num) >> __shift) & 0xff)
#define GST_WRITE_UINT64_BE(data, num) do { \
_GST_PUT (data, 0, 64, 56, num); \
_GST_PUT (data, 1, 64, 48, num); \
_GST_PUT (data, 2, 64, 40, num); \
_GST_PUT (data, 3, 64, 32, num); \
_GST_PUT (data, 4, 64, 24, num); \
_GST_PUT (data, 5, 64, 16, num); \
_GST_PUT (data, 6, 64, 8, num); \
_GST_PUT (data, 7, 64, 0, num); \
} while (0)
#define GST_WRITE_UINT64_LE(data, num) do { \
_GST_PUT (data, 0, 64, 0, num); \
_GST_PUT (data, 1, 64, 8, num); \
_GST_PUT (data, 2, 64, 16, num); \
_GST_PUT (data, 3, 64, 24, num); \
_GST_PUT (data, 4, 64, 32, num); \
_GST_PUT (data, 5, 64, 40, num); \
_GST_PUT (data, 6, 64, 48, num); \
_GST_PUT (data, 7, 64, 56, num); \
} while (0)
#define GST_WRITE_UINT32_BE(data, num) do { \
_GST_PUT (data, 0, 32, 24, num); \
_GST_PUT (data, 1, 32, 16, num); \
_GST_PUT (data, 2, 32, 8, num); \
_GST_PUT (data, 3, 32, 0, num); \
} while (0)
#define GST_WRITE_UINT32_LE(data, num) do { \
_GST_PUT (data, 0, 32, 0, num); \
_GST_PUT (data, 1, 32, 8, num); \
_GST_PUT (data, 2, 32, 16, num); \
_GST_PUT (data, 3, 32, 24, num); \
} while (0)
#define GST_WRITE_UINT16_BE(data, num) do { \
_GST_PUT (data, 0, 16, 8, num); \
_GST_PUT (data, 1, 16, 0, num); \
} while (0)
#define GST_WRITE_UINT16_LE(data, num) do { \
_GST_PUT (data, 0, 16, 0, num); \
_GST_PUT (data, 1, 16, 8, num); \
} while (0)
#define GST_WRITE_UINT8(data, num) do { \
_GST_PUT (data, 0, 8, 0, num); \
} while (0)
#endif /* GST_HAVE_UNALIGNED_ACCESS */
/* Miscellaneous utility macros */
/**
* GST_ROUND_UP_2:
* @num: value round up
*
* Make number divideable by two without a rest.
*/
#define GST_ROUND_UP_2(num) (((num)+1)&~1)
/**
* GST_ROUND_UP_4:
* @num: value round up
*
* Make number divideable by four without a rest.
*/
#define GST_ROUND_UP_4(num) (((num)+3)&~3)
/**
* GST_ROUND_UP_8:
* @num: value round up
*
* Make number divideable by eight without a rest.
*/
#define GST_ROUND_UP_8(num) (((num)+7)&~7)
/**
* GST_ROUND_UP_16:
* @num: value round up
*
* Make number divideable by 16 without a rest.
*/
#define GST_ROUND_UP_16(num) (((num)+15)&~15)
/**
* GST_ROUND_UP_32:
* @num: value round up
*
* Make number divideable by 32 without a rest.
*/
#define GST_ROUND_UP_32(num) (((num)+31)&~31)
/**
* GST_ROUND_UP_64:
* @num: value round up
*
* Make number divideable by 64 without a rest.
*/
#define GST_ROUND_UP_64(num) (((num)+63)&~63)
void gst_object_default_error (GstObject * source,
GError * error, gchar * debug);
/* element functions */
void gst_element_create_all_pads (GstElement *element);
GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad,
const GstCaps *caps);
GstPadTemplate* gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl);
G_CONST_RETURN gchar* gst_element_state_get_name (GstState state);
gboolean gst_element_link (GstElement *src, GstElement *dest);
gboolean gst_element_link_many (GstElement *element_1,
GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
gboolean gst_element_link_filtered (GstElement * src,
GstElement * dest,
GstCaps *filter);
void gst_element_unlink (GstElement *src, GstElement *dest);
void gst_element_unlink_many (GstElement *element_1,
GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
gboolean gst_element_link_pads (GstElement *src, const gchar *srcpadname,
GstElement *dest, const gchar *destpadname);
void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname,
GstElement *dest, const gchar *destpadname);
gboolean gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
GstElement * dest, const gchar * destpadname,
GstCaps *filter);
/* util elementfactory functions */
gboolean gst_element_factory_can_src_caps(GstElementFactory *factory, const GstCaps *caps);
gboolean gst_element_factory_can_sink_caps(GstElementFactory *factory, const GstCaps *caps);
/* util query functions */
gboolean gst_element_query_position (GstElement *element, GstFormat *format,
gint64 *cur);
gboolean gst_element_query_duration (GstElement *element, GstFormat *format,
gint64 *duration);
gboolean gst_element_query_convert (GstElement *element, GstFormat src_format, gint64 src_val,
GstFormat *dest_format, gint64 *dest_val);
/* element class functions */
void gst_element_class_install_std_props (GstElementClass * klass,
const gchar * first_name, ...) G_GNUC_NULL_TERMINATED;
/* pad functions */
gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_use_fixed_caps (GstPad *pad);
GstCaps* gst_pad_get_fixed_caps_func (GstPad *pad);
GstCaps* gst_pad_proxy_getcaps (GstPad * pad);
gboolean gst_pad_proxy_setcaps (GstPad * pad, GstCaps * caps);
GstElement* gst_pad_get_parent_element (GstPad *pad);
/* util query functions */
gboolean gst_pad_query_position (GstPad *pad, GstFormat *format,
gint64 *cur);
gboolean gst_pad_query_duration (GstPad *pad, GstFormat *format,
gint64 *duration);
gboolean gst_pad_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val,
GstFormat *dest_format, gint64 *dest_val);
gboolean gst_pad_query_peer_position (GstPad *pad, GstFormat *format,
gint64 *cur);
gboolean gst_pad_query_peer_duration (GstPad *pad, GstFormat *format,
gint64 *duration);
gboolean gst_pad_query_peer_convert (GstPad *pad, GstFormat src_format, gint64 src_val,
GstFormat *dest_format, gint64 *dest_val);
/* bin functions */
void gst_bin_add_many (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
void gst_bin_remove_many (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
GstPad * gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction);
/* buffer functions */
GstBuffer * gst_buffer_merge (GstBuffer * buf1, GstBuffer * buf2);
GstBuffer * gst_buffer_join (GstBuffer * buf1, GstBuffer * buf2);
void gst_buffer_stamp (GstBuffer * dest, const GstBuffer * src);
/* atomic functions */
void gst_atomic_int_set (gint * atomic_int, gint value);
/* probes */
gulong gst_pad_add_data_probe (GstPad * pad,
GCallback handler,
gpointer data);
void gst_pad_remove_data_probe (GstPad * pad, guint handler_id);
gulong gst_pad_add_event_probe (GstPad * pad,
GCallback handler,
gpointer data);
void gst_pad_remove_event_probe (GstPad * pad, guint handler_id);
gulong gst_pad_add_buffer_probe (GstPad * pad,
GCallback handler,
gpointer data);
void gst_pad_remove_buffer_probe (GstPad * pad, guint handler_id);
/* tag emission utility functions */
void gst_element_found_tags_for_pad (GstElement * element,
GstPad * pad,
GstTagList * list);
void gst_element_found_tags (GstElement * element,
GstTagList * list);
#ifndef GST_DISABLE_PARSE
/* parse utility functions */
GstElement * gst_parse_bin_from_description (const gchar * bin_description,
gboolean ghost_unconnected_pads,
GError ** err);
#else /* GST_DISABLE_PARSE */
#if defined _GNUC_ && _GNUC_ >= 3
#pragma GCC poison gst_parse_bin_from_description
#endif
#endif
G_END_DECLS
#endif /* __GST_UTILS_H__ */

View File

@@ -0,0 +1,520 @@
/* 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_VALUE_H__
#define __GST_VALUE_H__
#include <gst/gstconfig.h>
#include <gst/gstcaps.h>
G_BEGIN_DECLS
/**
* GST_MAKE_FOURCC:
* @a: the first character
* @b: the second character
* @c: the third character
* @d: the fourth character
*
* Transform four characters into a #guint32 fourcc value with host
* endianness.
* <informalexample>
* <programlisting>
* guint32 fourcc = GST_MAKE_FOURCC ('M', 'J', 'P', 'G');
* </programlisting>
* </informalexample>
*/
#define GST_MAKE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
/**
* GST_STR_FOURCC:
* @f: a string with at least four characters
*
* Transform an input string into a #guint32 fourcc value with host
* endianness.
* Caller is responsible for ensuring the input string consists of at least
* four characters.
* <informalexample>
* <programlisting>
* guint32 fourcc = GST_STR_FOURCC ("MJPG");
* </programlisting>
* </informalexample>
*/
#define GST_STR_FOURCC(f) (guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24))
/**
* GST_FOURCC_FORMAT:
*
* Can be used together with #GST_FOURCC_ARGS to properly output a
* #guint32 fourcc value in a printf()-style text message.
* <informalexample>
* <programlisting>
* printf ("fourcc: %" GST_FOURCC_FORMAT "\n", GST_FOURCC_ARGS (fcc));
* </programlisting>
* </informalexample>
*/
#define GST_FOURCC_FORMAT "c%c%c%c"
/**
* GST_FOURCC_ARGS:
* @fourcc: a #guint32 fourcc value to output
*
* Can be used together with #GST_FOURCC_FORMAT to properly output a
* #guint32 fourcc value in a printf()-style text message.
*/
#define GST_FOURCC_ARGS(fourcc) \
((gchar) ((fourcc) &0xff)), \
((gchar) (((fourcc)>>8 )&0xff)), \
((gchar) (((fourcc)>>16)&0xff)), \
((gchar) (((fourcc)>>24)&0xff))
/**
* GST_VALUE_HOLDS_FOURCC:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_FOURCC value.
*/
#define GST_VALUE_HOLDS_FOURCC(x) (G_VALUE_HOLDS(x, gst_fourcc_get_type ()))
/**
* GST_VALUE_HOLDS_INT_RANGE:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_INT_RANGE value.
*/
#define GST_VALUE_HOLDS_INT_RANGE(x) (G_VALUE_HOLDS(x, gst_int_range_get_type ()))
/**
* GST_VALUE_HOLDS_DOUBLE_RANGE:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_DOUBLE_RANGE value.
*/
#define GST_VALUE_HOLDS_DOUBLE_RANGE(x) (G_VALUE_HOLDS(x, gst_double_range_get_type ()))
/**
* GST_VALUE_HOLDS_FRACTION_RANGE:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_FRACTION_RANGE value.
*/
#define GST_VALUE_HOLDS_FRACTION_RANGE(x) (G_VALUE_HOLDS(x, gst_fraction_range_get_type ()))
/**
* GST_VALUE_HOLDS_LIST:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_LIST value.
*/
#define GST_VALUE_HOLDS_LIST(x) (G_VALUE_HOLDS(x, gst_value_list_get_type ()))
/**
* GST_VALUE_HOLDS_ARRAY:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_ARRAY value.
*/
#define GST_VALUE_HOLDS_ARRAY(x) (G_VALUE_HOLDS(x, gst_value_array_get_type ()))
/**
* GST_VALUE_HOLDS_CAPS:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_CAPS value.
*/
#define GST_VALUE_HOLDS_CAPS(x) (G_VALUE_HOLDS(x, GST_TYPE_CAPS))
/**
* GST_VALUE_HOLDS_BUFFER:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_BUFFER value.
*/
#define GST_VALUE_HOLDS_BUFFER(x) (G_VALUE_HOLDS(x, GST_TYPE_BUFFER))
/**
* GST_VALUE_HOLDS_FRACTION:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_FRACTION value.
*/
#define GST_VALUE_HOLDS_FRACTION(x) (G_VALUE_HOLDS(x, gst_fraction_get_type ()))
/**
* GST_VALUE_HOLDS_DATE:
* @x: the #GValue to check
*
* Checks if the given #GValue contains a #GST_TYPE_DATE value.
*/
#define GST_VALUE_HOLDS_DATE(x) (G_VALUE_HOLDS(x, gst_date_get_type ()))
/**
* GST_TYPE_FOURCC:
*
* a #GValue type that represents 4 byte identifier (e.g. used for codecs)
*
* Returns: the #GType of GstFourcc
*/
#define GST_TYPE_FOURCC gst_fourcc_get_type ()
/**
* GST_TYPE_INT_RANGE:
*
* a #GValue type that represents an integer range
*
* Returns: the #GType of GstIntRange
*/
#define GST_TYPE_INT_RANGE gst_int_range_get_type ()
/**
* GST_TYPE_DOUBLE_RANGE:
*
* a #GValue type that represents a floating point range with double precission
*
* Returns: the #GType of GstIntRange
*/
#define GST_TYPE_DOUBLE_RANGE gst_double_range_get_type ()
/**
* GST_TYPE_FRACTION_RANGE:
*
* a #GValue type that represents a GstFraction range
*
* Returns: the #GType of GstFractionRange
*/
#define GST_TYPE_FRACTION_RANGE gst_fraction_range_get_type ()
/**
* GST_TYPE_LIST:
*
* a #GValue type that represents an unordered list of #GValue values
*
* Returns: the #GType of GstValueList (which is not explicitly typed)
*/
#define GST_TYPE_LIST gst_value_list_get_type ()
/**
* GST_TYPE_ARRAY:
*
* a #GValue type that represents an ordered list of #GValue values
*
* Returns: the #GType of GstArrayList (which is not explicitly typed)
*/
#define GST_TYPE_ARRAY gst_value_array_get_type ()
/**
* GST_TYPE_FRACTION:
*
* a #GValue type that represents a fraction of an integer numerator over
* an integer denominator
*
* Returns: the #GType of GstFraction (which is not explicitly typed)
*/
#define GST_TYPE_FRACTION gst_fraction_get_type ()
/**
* GST_TYPE_DATE:
*
* a boxed #GValue type for #GDate that represents a date.
*
* Returns: the #GType of GstDate
*/
#define GST_TYPE_DATE gst_date_get_type ()
/**
* GST_VALUE_LESS_THAN:
*
* Indicates that the first value provided to a comparison function
* (gst_value_compare()) is lesser than the second one.
*/
#define GST_VALUE_LESS_THAN (-1)
/**
* GST_VALUE_EQUAL:
*
* Indicates that the first value provided to a comparison function
* (gst_value_compare()) is equal to the second one.
*/
#define GST_VALUE_EQUAL 0
/**
* GST_VALUE_GREATER_THAN:
*
* Indicates that the first value provided to a comparison function
* (gst_value_compare()) is greater than the second one.
*/
#define GST_VALUE_GREATER_THAN 1
/**
* GST_VALUE_UNORDERED:
*
* Indicates that the comparison function (gst_value_compare()) can not
* determine a order for the two provided values.
*/
#define GST_VALUE_UNORDERED 2
/**
* GstValueCompareFunc:
* @value1: first value for comparission
* @value2: second value for comparission
*
* Used together with gst_value_compare() to compare #GValues.
*
* Returns: one of GST_VALUE_LESS_THAN, GST_VALUE_EQUAL, GST_VALUE_GREATER_THAN
* or GST_VALUE_UNORDERED
*/
typedef gint (* GstValueCompareFunc) (const GValue *value1,
const GValue *value2);
/**
* GstValueSerializeFunc:
* @value1: a #GValue
*
* Used by gst_value_serialize() to obtain a non-binary form of the #GValue.
*
* Returns: the string representation of the value
*/
typedef gchar * (* GstValueSerializeFunc) (const GValue *value1);
/**
* GstValueDeserializeFunc:
* @dest: a #GValue
* @s: a string
*
* Used by gst_value_deserialize() to parse a non-binary form into the #GValue.
*
* Returns: %TRUE for success
*/
typedef gboolean (* GstValueDeserializeFunc) (GValue *dest,
const gchar *s);
/**
* GstValueUnionFunc:
* @dest: a #GValue for the result
* @value1: a #GValue operand
* @value2: a #GValue operand
*
* Used by gst_value_union() to perform unification for a specific #GValue
* type. Register a new implementation with gst_value_register_union_func().
*
* Returns: %TRUE if a union was successful
*/
typedef gboolean (* GstValueUnionFunc) (GValue *dest,
const GValue *value1,
const GValue *value2);
/**
* GstValueIntersectFunc:
* @dest: a #GValue for the result
* @value1: a #GValue operand
* @value2: a #GValue operand
*
* Used by gst_value_intersect() to perform intersection for a specific #GValue
* type. If the intersection is non-empty, the result is
* placed in @dest and TRUE is returned. If the intersection is
* empty, @dest is unmodified and FALSE is returned.
* Register a new implementation with gst_value_register_intersection_func().
*
* Returns: %TRUE if the values can intersect
*/
typedef gboolean (* GstValueIntersectFunc) (GValue *dest,
const GValue *value1,
const GValue *value2);
/**
* GstValueSubtractFunc:
* @dest: a #GValue for the result
* @minuend: a #GValue operand
* @subtrahend: a #GValue operand
*
* Used by gst_value_subtract() to perform subtraction for a specific #GValue
* type. Register a new implementation with gst_value_register_subtract_func().
*
* Returns: %TRUE if the subtraction is not empty
*/
typedef gboolean (* GstValueSubtractFunc) (GValue *dest,
const GValue *minuend,
const GValue *subtrahend);
typedef struct _GstValueTable GstValueTable;
/**
* GstValueTable:
* @type: a #GType
* @compare: a #GstValueCompareFunc
* @serialize: a #GstValueSerializeFunc
* @deserialize: a #GstValueDeserializeFunc
*
* VTable for the #GValue @type.
*/
struct _GstValueTable {
GType type;
GstValueCompareFunc compare;
GstValueSerializeFunc serialize;
GstValueDeserializeFunc deserialize;
/*< private >*/
void *_gst_reserved [GST_PADDING];
};
GType gst_int_range_get_type (void);
GType gst_double_range_get_type (void);
GType gst_fraction_range_get_type (void);
GType gst_fourcc_get_type (void);
GType gst_fraction_get_type (void);
GType gst_value_list_get_type (void);
GType gst_value_array_get_type (void);
GType gst_date_get_type (void);
void gst_value_register (const GstValueTable *table);
void gst_value_init_and_copy (GValue *dest,
const GValue *src);
gchar * gst_value_serialize (const GValue *value);
gboolean gst_value_deserialize (GValue *dest,
const gchar *src);
/* list */
void gst_value_list_append_value (GValue *value,
const GValue *append_value);
void gst_value_list_prepend_value (GValue *value,
const GValue *prepend_value);
void gst_value_list_concat (GValue *dest,
const GValue *value1,
const GValue *value2);
guint gst_value_list_get_size (const GValue *value);
G_CONST_RETURN GValue *
gst_value_list_get_value (const GValue *value,
guint index);
/* array */
void gst_value_array_append_value (GValue *value,
const GValue *append_value);
void gst_value_array_prepend_value (GValue *value,
const GValue *prepend_value);
guint gst_value_array_get_size (const GValue *value);
G_CONST_RETURN GValue *
gst_value_array_get_value (const GValue *value,
guint index);
/* fourcc */
void gst_value_set_fourcc (GValue *value,
guint32 fourcc);
guint32 gst_value_get_fourcc (const GValue *value);
/* int range */
void gst_value_set_int_range (GValue *value,
gint start,
gint end);
gint gst_value_get_int_range_min (const GValue *value);
gint gst_value_get_int_range_max (const GValue *value);
/* double range */
void gst_value_set_double_range (GValue *value,
gdouble start,
gdouble end);
gdouble gst_value_get_double_range_min (const GValue *value);
gdouble gst_value_get_double_range_max (const GValue *value);
/* caps */
G_CONST_RETURN GstCaps *
gst_value_get_caps (const GValue *value);
void gst_value_set_caps (GValue *value,
const GstCaps *caps);
/* fraction */
void gst_value_set_fraction (GValue *value,
gint numerator,
gint denominator);
gint gst_value_get_fraction_numerator (const GValue *value);
gint gst_value_get_fraction_denominator(const GValue *value);
gboolean gst_value_fraction_multiply (GValue *product,
const GValue *factor1,
const GValue *factor2);
gboolean gst_value_fraction_subtract (GValue * dest,
const GValue * minuend,
const GValue * subtrahend);
/* fraction range */
void gst_value_set_fraction_range (GValue *value,
const GValue *start,
const GValue *end);
void gst_value_set_fraction_range_full (GValue *value,
gint numerator_start,
gint denominator_start,
gint numerator_end,
gint denominator_end);
const GValue *gst_value_get_fraction_range_min (const GValue *value);
const GValue *gst_value_get_fraction_range_max (const GValue *value);
/* date */
G_CONST_RETURN GDate *
gst_value_get_date (const GValue *value);
void gst_value_set_date (GValue *value,
const GDate *date);
/* compare */
gint gst_value_compare (const GValue *value1,
const GValue *value2);
gboolean gst_value_can_compare (const GValue *value1,
const GValue *value2);
/* union */
gboolean gst_value_union (GValue *dest,
const GValue *value1,
const GValue *value2);
gboolean gst_value_can_union (const GValue *value1,
const GValue *value2);
void gst_value_register_union_func (GType type1,
GType type2,
GstValueUnionFunc func);
/* intersection */
gboolean gst_value_intersect (GValue *dest,
const GValue *value1,
const GValue *value2);
gboolean gst_value_can_intersect (const GValue *value1,
const GValue *value2);
void gst_value_register_intersect_func (GType type1,
GType type2,
GstValueIntersectFunc func);
/* subtraction */
gboolean gst_value_subtract (GValue *dest,
const GValue *minuend,
const GValue *subtrahend);
gboolean gst_value_can_subtract (const GValue *minuend,
const GValue *subtrahend);
void gst_value_register_subtract_func (GType minuend_type,
GType subtrahend_type,
GstValueSubtractFunc func);
/* fixation */
gboolean gst_value_is_fixed (const GValue *value);
/* private */
void _gst_value_initialize (void);
G_END_DECLS
#endif

View File

@@ -0,0 +1,71 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstversion.h: Version information for GStreamer
*
* 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:gstversion
* @short_description: GStreamer version macros.
*
* Use the GST_VERSION_* macros e.g. when defining own plugins. The GStreamer
* runtime checks if these plugin and core version match and refuses to use a
* plugin compiled against a different version of GStreamer.
* You can also use the macros to keep the GStreamer version information in
* your application.
*
* Use the gst_version() function if you want to know which version of
* GStreamer you are currently linked against.
*
* The version macros get defined by including "gst/gst.h".
*/
#ifndef __GST_VERSION_H__
#define __GST_VERSION_H__
G_BEGIN_DECLS
/**
* GST_VERSION_MAJOR:
*
* The major version of GStreamer at compile time:
*/
#define GST_VERSION_MAJOR (0)
/**
* GST_VERSION_MINOR:
*
* The minor version of GStreamer at compile time:
*/
#define GST_VERSION_MINOR (10)
/**
* GST_VERSION_MICRO:
*
* The micro version of GStreamer at compile time:
*/
#define GST_VERSION_MICRO (6)
/**
* GST_VERSION_NANO:
*
* The nano version of GStreamer at compile time:
* Actual releases have 0, CVS versions have 1, prerelease versions have 2-...
*/
#define GST_VERSION_NANO (0)
G_END_DECLS
#endif /* __GST_VERSION_H__ */

View File

@@ -0,0 +1,107 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
*
* gstxml.h: Header for XML save/restore operations of pipelines
*
* 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_XML_H__
#define __GST_XML_H__
#include <gst/gstconfig.h>
#ifndef GST_DISABLE_LOADSAVE
#include <gst/gstelement.h>
G_BEGIN_DECLS
#define GST_TYPE_XML (gst_xml_get_type ())
#define GST_XML(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_XML, GstXML))
#define GST_IS_XML(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_XML))
#define GST_XML_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_XML, GstXMLClass))
#define GST_IS_XML_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_XML))
#define GST_XML_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_XML, GstXMLClass))
typedef struct _GstXML GstXML;
typedef struct _GstXMLClass GstXMLClass;
/**
* GstXML:
*
* XML parser object
*/
struct _GstXML {
GstObject object;
GList *topelements;
xmlNsPtr ns;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstXMLClass {
GstObjectClass parent_class;
/* signal callbacks */
void (*object_loaded) (GstXML *xml, GstObject *object, xmlNodePtr self);
void (*object_saved) (GstXML *xml, GstObject *object, xmlNodePtr self);
gpointer _gst_reserved[GST_PADDING];
};
GType gst_xml_get_type (void);
/* create an XML document out of a pipeline */
xmlDocPtr gst_xml_write (GstElement *element);
/* write a formatted representation of a pipeline to an open file */
gint gst_xml_write_file (GstElement *element, FILE *out);
GstXML* gst_xml_new (void);
gboolean gst_xml_parse_doc (GstXML *xml, xmlDocPtr doc, const guchar *root);
gboolean gst_xml_parse_file (GstXML *xml, const guchar *fname, const guchar *root);
gboolean gst_xml_parse_memory (GstXML *xml, guchar *buffer, guint size, const gchar *root);
GstElement* gst_xml_get_element (GstXML *xml, const guchar *name);
GList* gst_xml_get_topelements (GstXML *xml);
GstElement* gst_xml_make_element (xmlNodePtr cur, GstObject *parent);
G_END_DECLS
#else /* GST_DISABLE_LOADSAVE */
#if defined _GNUC_ && _GNUC_ >= 3
#pragma GCC poison gst_xml_write
#pragma GCC poison gst_xml_new
#pragma GCC poison gst_xml_parse_doc
#pragma GCC poison gst_xml_parse_file
#pragma GCC poison gst_xml_parse_memory
#pragma GCC poison gst_xml_get_element
#pragma GCC poison gst_xml_get_topelements
#endif
#endif /* GST_DISABLE_LOADSAVE */
#endif /* __GST_XML_H__ */

View File

@@ -0,0 +1,96 @@
/* GStreamer Color Balance
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* color-balance.h: image color balance interface design
*
* 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_COLOR_BALANCE_H__
#define __GST_COLOR_BALANCE_H__
#include <gst/gst.h>
#include <gst/interfaces/colorbalancechannel.h>
#include <gst/interfaces/interfaces-enumtypes.h>
G_BEGIN_DECLS
#define GST_TYPE_COLOR_BALANCE \
(gst_color_balance_get_type ())
#define GST_COLOR_BALANCE(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE, \
GstColorBalance))
#define GST_COLOR_BALANCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_COLOR_BALANCE, \
GstColorBalanceClass))
#define GST_IS_COLOR_BALANCE(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE))
#define GST_IS_COLOR_BALANCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE))
#define GST_COLOR_BALANCE_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_COLOR_BALANCE, GstColorBalanceClass))
#define GST_COLOR_BALANCE_TYPE(klass) (klass->balance_type)
typedef struct _GstColorBalance GstColorBalance;
typedef enum
{
GST_COLOR_BALANCE_HARDWARE,
GST_COLOR_BALANCE_SOFTWARE
} GstColorBalanceType;
typedef struct _GstColorBalanceClass {
GTypeInterface klass;
GstColorBalanceType balance_type;
/* virtual functions */
const GList * (* list_channels) (GstColorBalance *balance);
void (* set_value) (GstColorBalance *balance,
GstColorBalanceChannel *channel,
gint value);
gint (* get_value) (GstColorBalance *balance,
GstColorBalanceChannel *channel);
/* signals */
void (* value_changed) (GstColorBalance *balance,
GstColorBalanceChannel *channel,
gint value);
gpointer _gst_reserved[GST_PADDING];
} GstColorBalanceClass;
GType gst_color_balance_get_type (void);
/* virtual class function wrappers */
const GList *
gst_color_balance_list_channels (GstColorBalance *balance);
void gst_color_balance_set_value (GstColorBalance *balance,
GstColorBalanceChannel *channel,
gint value);
gint gst_color_balance_get_value (GstColorBalance *balance,
GstColorBalanceChannel *channel);
/* trigger signal */
void gst_color_balance_value_changed (GstColorBalance *balance,
GstColorBalanceChannel *channel,
gint value);
G_END_DECLS
#endif /* __GST_COLOR_BALANCE_H__ */

View File

@@ -0,0 +1,64 @@
/* GStreamer Color Balance
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* colorbalancechannel.h: individual channel 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_COLOR_BALANCE_CHANNEL_H__
#define __GST_COLOR_BALANCE_CHANNEL_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_COLOR_BALANCE_CHANNEL \
(gst_color_balance_channel_get_type ())
#define GST_COLOR_BALANCE_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE_CHANNEL, \
GstColorBalanceChannel))
#define GST_COLOR_BALANCE_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_COLOR_BALANCE_CHANNEL, \
GstColorBalanceChannelClass))
#define GST_IS_COLOR_BALANCE_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE_CHANNEL))
#define GST_IS_COLOR_BALANCE_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE_CHANNEL))
typedef struct _GstColorBalanceChannel {
GObject parent;
gchar *label;
gint min_value,
max_value;
} GstColorBalanceChannel;
typedef struct _GstColorBalanceChannelClass {
GObjectClass parent;
/* signals */
void (* value_changed) (GstColorBalanceChannel *channel,
gint value);
gpointer _gst_reserved[GST_PADDING];
} GstColorBalanceChannelClass;
GType gst_color_balance_channel_get_type (void);
G_END_DECLS
#endif /* __GST_COLOR_BALANCE_CHANNEL_H__ */

View File

@@ -0,0 +1,31 @@
/* Generated data (by glib-mkenums) */
#ifndef __GST_INTERFACES_ENUM_TYPES_H__
#define __GST_INTERFACES_ENUM_TYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/* enumerations from "colorbalance.h" */
GType gst_color_balance_type_get_type (void);
#define GST_TYPE_COLOR_BALANCE_TYPE (gst_color_balance_type_get_type())
/* enumerations from "mixer.h" */
GType gst_mixer_type_get_type (void);
#define GST_TYPE_MIXER_TYPE (gst_mixer_type_get_type())
/* enumerations from "mixertrack.h" */
GType gst_mixer_track_flags_get_type (void);
#define GST_TYPE_MIXER_TRACK_FLAGS (gst_mixer_track_flags_get_type())
/* enumerations from "tunerchannel.h" */
GType gst_tuner_channel_flags_get_type (void);
#define GST_TYPE_TUNER_CHANNEL_FLAGS (gst_tuner_channel_flags_get_type())
G_END_DECLS
#endif /* __GST_INTERFACES_ENUM_TYPES_H__ */
/* Generated data ends here */

View File

@@ -0,0 +1,141 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixer.h: mixer interface design
*
* 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_MIXER_H__
#define __GST_MIXER_H__
#include <gst/gst.h>
#include <gst/interfaces/mixeroptions.h>
#include <gst/interfaces/mixertrack.h>
#include <gst/interfaces/interfaces-enumtypes.h>
G_BEGIN_DECLS
#define GST_TYPE_MIXER \
(gst_mixer_get_type ())
#define GST_MIXER(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
#define GST_MIXER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER, GstMixerClass))
#define GST_IS_MIXER(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
#define GST_IS_MIXER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER))
#define GST_MIXER_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass))
#define GST_MIXER_TYPE(klass) (klass->mixer_type)
typedef struct _GstMixer GstMixer;
typedef struct _GstMixerClass GstMixerClass;
typedef enum
{
GST_MIXER_HARDWARE,
GST_MIXER_SOFTWARE
} GstMixerType;
struct _GstMixerClass {
GTypeInterface klass;
GstMixerType mixer_type;
/* virtual functions */
const GList * (* list_tracks) (GstMixer *mixer);
void (* set_volume) (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void (* get_volume) (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void (* set_mute) (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void (* set_record) (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
/* signals */
void (* mute_toggled) (GstMixer *mixer,
GstMixerTrack *channel,
gboolean mute);
void (* record_toggled) (GstMixer *mixer,
GstMixerTrack *channel,
gboolean record);
void (* volume_changed) (GstMixer *mixer,
GstMixerTrack *channel,
gint *volumes);
void (* set_option) (GstMixer *mixer,
GstMixerOptions *opts,
gchar *value);
const gchar * (* get_option) (GstMixer *mixer,
GstMixerOptions *opts);
void (* option_changed) (GstMixer *mixer,
GstMixerOptions *opts,
gchar *option);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_mixer_get_type (void);
/* virtual class function wrappers */
const GList * gst_mixer_list_tracks (GstMixer *mixer);
void gst_mixer_set_volume (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void gst_mixer_get_volume (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void gst_mixer_set_mute (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void gst_mixer_set_record (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
void gst_mixer_set_option (GstMixer *mixer,
GstMixerOptions *opts,
gchar *value);
const gchar * gst_mixer_get_option (GstMixer *mixer,
GstMixerOptions *opts);
/* trigger signals */
void gst_mixer_mute_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void gst_mixer_record_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
void gst_mixer_volume_changed (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void gst_mixer_option_changed (GstMixer *mixer,
GstMixerOptions *opts,
gchar *value);
G_END_DECLS
#endif /* __GST_MIXER_H__ */

View File

@@ -0,0 +1,73 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixeroptions.h: mixer track options object
* This should be a subclass of MixerItem, along with MixerOptions,
* but that's not possible because of API/ABI in 0.8.x. FIXME.
*
* 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_MIXER_OPTIONS_H__
#define __GST_MIXER_OPTIONS_H__
#include <gst/gst.h>
#include <gst/interfaces/mixertrack.h>
G_BEGIN_DECLS
#define GST_TYPE_MIXER_OPTIONS \
(gst_mixer_options_get_type ())
#define GST_MIXER_OPTIONS(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER_OPTIONS, \
GstMixerOptions))
#define GST_MIXER_OPTIONS_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER_OPTIONS, \
GstMixerOptionsClass))
#define GST_IS_MIXER_OPTIONS(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_OPTIONS))
#define GST_IS_MIXER_OPTIONS_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_OPTIONS))
typedef struct _GstMixerOptions GstMixerOptions;
typedef struct _GstMixerOptionsClass GstMixerOptionsClass;
struct _GstMixerOptions {
GstMixerTrack parent;
/* list of strings */
GList *values;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstMixerOptionsClass {
GstMixerTrackClass parent;
/* signals */
void (* option_changed) (GstMixerOptions *opts,
gchar *value);
gpointer _gst_reserved[GST_PADDING];
};
GType gst_mixer_options_get_type (void);
GList * gst_mixer_options_get_values (GstMixerOptions *mixer_options);
G_END_DECLS
#endif /* __GST_MIXER_OPTIONS_H__ */

View File

@@ -0,0 +1,102 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixertrack.h: mixer track 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_MIXER_TRACK_H__
#define __GST_MIXER_TRACK_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_MIXER_TRACK \
(gst_mixer_track_get_type ())
#define GST_MIXER_TRACK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER_TRACK, \
GstMixerTrack))
#define GST_MIXER_TRACK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER_TRACK, \
GstMixerTrackClass))
#define GST_IS_MIXER_TRACK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_TRACK))
#define GST_IS_MIXER_TRACK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_TRACK))
/*
* Naming:
*
* A track is a single input/output stream (e.g. line-in,
* microphone, etc.). Channels are then single streams
* within a track. A mono stream has one channel, a stereo
* stream has two, etc.
*
* Input tracks can have 'recording' enabled, which means
* that any input will be hearable into the speakers that
* are attached to the output. Mute is obvious. A track
* flagged as master is the master volume track on this
* mixer, which means that setting this track will change
* the hearable volume on any output.
*/
typedef enum {
GST_MIXER_TRACK_INPUT = (1<<0),
GST_MIXER_TRACK_OUTPUT = (1<<1),
GST_MIXER_TRACK_MUTE = (1<<2),
GST_MIXER_TRACK_RECORD = (1<<3),
GST_MIXER_TRACK_MASTER = (1<<4),
GST_MIXER_TRACK_SOFTWARE = (1<<5)
} GstMixerTrackFlags;
#define GST_MIXER_TRACK_HAS_FLAG(channel, flag) \
((channel)->flags & flag)
typedef struct _GstMixerTrack GstMixerTrack;
typedef struct _GstMixerTrackClass GstMixerTrackClass;
struct _GstMixerTrack {
GObject parent;
gchar *label;
/* FIXME: flags should be guint32. Change in 0.9 */
GstMixerTrackFlags flags;
gint num_channels;
gint min_volume;
gint max_volume;
};
struct _GstMixerTrackClass {
GObjectClass parent;
/* signals */
void (* mute_toggled) (GstMixerTrack *channel,
gboolean mute);
void (* record_toggled) (GstMixerTrack *channel,
gboolean record);
void (* volume_changed) (GstMixerTrack *channel,
gint *volumes);
gpointer _gst_reserved[GST_PADDING];
};
GType gst_mixer_track_get_type (void);
G_END_DECLS
#endif /* __GST_MIXER_TRACK_H__ */

View File

@@ -0,0 +1,62 @@
/* GStreamer Navigation
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2003 David A. Schleef <ds@schleef.org>
*
* navigation.h: navigation interface design
*
* 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_NAVIGATION_H__
#define __GST_NAVIGATION_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_NAVIGATION \
(gst_navigation_get_type ())
#define GST_NAVIGATION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NAVIGATION, GstNavigation))
#define GST_IS_NAVIGATION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NAVIGATION))
#define GST_NAVIGATION_GET_IFACE(obj) \
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_NAVIGATION, GstNavigationInterface))
typedef struct _GstNavigation GstNavigation;
typedef struct _GstNavigationInterface {
GTypeInterface g_iface;
/* virtual functions */
void (*send_event) (GstNavigation *navigation, GstStructure *structure);
gpointer _gst_reserved[GST_PADDING];
} GstNavigationInterface;
GType gst_navigation_get_type (void);
/* virtual class function wrappers */
void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure);
void gst_navigation_send_key_event (GstNavigation *navigation,
const char *event, const char *key);
void gst_navigation_send_mouse_event (GstNavigation *navigation,
const char *event, int button, double x, double y);
G_END_DECLS
#endif /* __GST_NAVIGATION_H__ */

View File

@@ -0,0 +1,97 @@
/* GStreamer PropertyProbe
* Copyright (C) 2003 David A. Schleef <ds@schleef.org>
*
* property_probe.h: property_probe interface design
*
* 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_PROPERTY_PROBE_H__
#define __GST_PROPERTY_PROBE_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_PROPERTY_PROBE \
(gst_property_probe_get_type ())
#define GST_PROPERTY_PROBE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbe))
#define GST_IS_PROPERTY_PROBE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROPERTY_PROBE))
#define GST_PROPERTY_PROBE_GET_IFACE(obj) \
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbeInterface))
typedef struct _GstPropertyProbe GstPropertyProbe; /* dummy typedef */
typedef struct _GstPropertyProbeInterface {
GTypeInterface klass;
/* signals */
void (*probe_needed) (GstPropertyProbe *probe,
const GParamSpec *pspec);
/* virtual functions */
const GList * (*get_properties) (GstPropertyProbe *probe);
gboolean (*needs_probe) (GstPropertyProbe *probe,
guint prop_id,
const GParamSpec *pspec);
void (*probe_property) (GstPropertyProbe *probe,
guint prop_id,
const GParamSpec *pspec);
GValueArray * (*get_values) (GstPropertyProbe *probe,
guint prop_id,
const GParamSpec *pspec);
gpointer _gst_reserved[GST_PADDING];
} GstPropertyProbeInterface;
GType gst_property_probe_get_type (void);
/* virtual class function wrappers */
/* returns list of GParamSpecs */
const GList * gst_property_probe_get_properties (GstPropertyProbe *probe);
const GParamSpec *gst_property_probe_get_property (GstPropertyProbe *probe,
const gchar *name);
/* probe one property */
void gst_property_probe_probe_property (GstPropertyProbe *probe,
const GParamSpec *pspec);
void gst_property_probe_probe_property_name (GstPropertyProbe *probe,
const gchar *name);
/* do we need a probe? */
gboolean gst_property_probe_needs_probe (GstPropertyProbe *probe,
const GParamSpec *pspec);
gboolean gst_property_probe_needs_probe_name (GstPropertyProbe *probe,
const gchar *name);
/* returns list of GValues */
GValueArray * gst_property_probe_get_values (GstPropertyProbe *probe,
const GParamSpec *pspec);
GValueArray * gst_property_probe_get_values_name (GstPropertyProbe *probe,
const gchar *name);
/* sugar */
GValueArray * gst_property_probe_probe_and_get_values (GstPropertyProbe *probe,
const GParamSpec *pspec);
GValueArray * gst_property_probe_probe_and_get_values_name (GstPropertyProbe *probe,
const gchar *name);
G_END_DECLS
#endif /* __GST_PROPERTY_PROBE_H__ */

View File

@@ -0,0 +1,127 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tuner.h: tuner interface design
*
* 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_TUNER_H__
#define __GST_TUNER_H__
#include <gst/gst.h>
#include <gst/interfaces/tunernorm.h>
#include <gst/interfaces/tunerchannel.h>
#include <gst/interfaces/interfaces-enumtypes.h>
G_BEGIN_DECLS
#define GST_TYPE_TUNER \
(gst_tuner_get_type ())
#define GST_TUNER(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER, GstTuner))
#define GST_TUNER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER, GstTunerClass))
#define GST_IS_TUNER(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER))
#define GST_IS_TUNER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER))
#define GST_TUNER_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_TUNER, GstTunerClass))
typedef struct _GstTuner GstTuner;
typedef struct _GstTunerClass {
GTypeInterface klass;
/* virtual functions */
const GList * (* list_channels) (GstTuner *tuner);
void (* set_channel) (GstTuner *tuner,
GstTunerChannel *channel);
GstTunerChannel *
(* get_channel) (GstTuner *tuner);
const GList * (* list_norms) (GstTuner *tuner);
void (* set_norm) (GstTuner *tuner,
GstTunerNorm *norm);
GstTunerNorm *(* get_norm) (GstTuner *tuner);
void (* set_frequency) (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
gulong (* get_frequency) (GstTuner *tuner,
GstTunerChannel *channel);
gint (* signal_strength) (GstTuner *tuner,
GstTunerChannel *channel);
/* signals */
void (*channel_changed) (GstTuner *tuner,
GstTunerChannel *channel);
void (*norm_changed) (GstTuner *tuner,
GstTunerNorm *norm);
void (*frequency_changed) (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
void (*signal_changed) (GstTuner *tuner,
GstTunerChannel *channel,
gint signal);
gpointer _gst_reserved[GST_PADDING];
} GstTunerClass;
GType gst_tuner_get_type (void);
/* virtual class function wrappers */
const GList * gst_tuner_list_channels (GstTuner *tuner);
void gst_tuner_set_channel (GstTuner *tuner,
GstTunerChannel *channel);
GstTunerChannel *
gst_tuner_get_channel (GstTuner *tuner);
const GList * gst_tuner_list_norms (GstTuner *tuner);
void gst_tuner_set_norm (GstTuner *tuner,
GstTunerNorm *norm);
GstTunerNorm * gst_tuner_get_norm (GstTuner *tuner);
void gst_tuner_set_frequency (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
gulong gst_tuner_get_frequency (GstTuner *tuner,
GstTunerChannel *channel);
gint gst_tuner_signal_strength (GstTuner *tuner,
GstTunerChannel *channel);
/* helper functions */
GstTunerNorm * gst_tuner_find_norm_by_name (GstTuner *tuner,
gchar *norm);
GstTunerChannel *gst_tuner_find_channel_by_name (GstTuner *tuner,
gchar *channel);
/* trigger signals */
void gst_tuner_channel_changed (GstTuner *tuner,
GstTunerChannel *channel);
void gst_tuner_norm_changed (GstTuner *tuner,
GstTunerNorm *norm);
void gst_tuner_frequency_changed (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
void gst_tuner_signal_changed (GstTuner *tuner,
GstTunerChannel *channel,
gint signal);
G_END_DECLS
#endif /* __GST_TUNER_H__ */

View File

@@ -0,0 +1,80 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunerchannel.h: tuner channel object design
*
* 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_TUNER_CHANNEL_H__
#define __GST_TUNER_CHANNEL_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_TUNER_CHANNEL \
(gst_tuner_channel_get_type ())
#define GST_TUNER_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER_CHANNEL, \
GstTunerChannel))
#define GST_TUNER_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER_CHANNEL, \
GstTunerChannelClass))
#define GST_IS_TUNER_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_CHANNEL))
#define GST_IS_TUNER_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_CHANNEL))
typedef enum {
GST_TUNER_CHANNEL_INPUT = (1<<0),
GST_TUNER_CHANNEL_OUTPUT = (1<<1),
GST_TUNER_CHANNEL_FREQUENCY = (1<<2),
GST_TUNER_CHANNEL_AUDIO = (1<<3)
} GstTunerChannelFlags;
#define GST_TUNER_CHANNEL_HAS_FLAG(channel, flag) \
((channel)->flags & flag)
typedef struct _GstTunerChannel {
GObject parent;
gchar *label;
GstTunerChannelFlags flags;
gfloat freq_multiplicator;
gulong min_frequency,
max_frequency;
gint min_signal,
max_signal;
} GstTunerChannel;
typedef struct _GstTunerChannelClass {
GObjectClass parent;
/* signals */
void (*frequency_changed) (GstTunerChannel *channel,
gulong frequency);
void (*signal_changed) (GstTunerChannel *channel,
gint signal);
gpointer _gst_reserved[GST_PADDING];
} GstTunerChannelClass;
GType gst_tuner_channel_get_type (void);
G_END_DECLS
#endif /* __GST_TUNER_CHANNEL_H__ */

View File

@@ -0,0 +1,57 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunernorm.h: tuner norm object design
*
* 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_TUNER_NORM_H__
#define __GST_TUNER_NORM_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_TUNER_NORM \
(gst_tuner_norm_get_type ())
#define GST_TUNER_NORM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER_NORM, GstTunerNorm))
#define GST_TUNER_NORM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER_NORM, GstTunerNormClass))
#define GST_IS_TUNER_NORM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_NORM))
#define GST_IS_TUNER_NORM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_NORM))
typedef struct _GstTunerNorm {
GObject parent;
gchar *label;
GValue framerate;
} GstTunerNorm;
typedef struct _GstTunerNormClass {
GObjectClass parent;
gpointer _gst_reserved[GST_PADDING];
} GstTunerNormClass;
GType gst_tuner_norm_get_type (void);
G_END_DECLS
#endif /* __GST_TUNER_NORM_H__ */

View File

@@ -0,0 +1,73 @@
/* GStreamer X-based Overlay
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2003 Julien Moutte <julien@moutte.net>
*
* x-overlay.h: X-based overlay interface design
*
* 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_X_OVERLAY_H__
#define __GST_X_OVERLAY_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_X_OVERLAY \
(gst_x_overlay_get_type ())
#define GST_X_OVERLAY(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_X_OVERLAY, \
GstXOverlay))
#define GST_X_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_X_OVERLAY, GstXOverlayClass))
#define GST_IS_X_OVERLAY(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_X_OVERLAY))
#define GST_IS_X_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_X_OVERLAY))
#define GST_X_OVERLAY_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_X_OVERLAY, GstXOverlayClass))
typedef struct _GstXOverlay GstXOverlay;
typedef struct _GstXOverlayClass {
GTypeInterface klass;
/* virtual functions */
void (* set_xwindow_id) (GstXOverlay *overlay,
gulong xwindow_id);
void (* expose) (GstXOverlay *overlay);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
} GstXOverlayClass;
GType gst_x_overlay_get_type (void);
/* virtual class function wrappers */
void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
void gst_x_overlay_expose (GstXOverlay *overlay);
/* public methods to dispatch bus messages */
void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
void gst_x_overlay_prepare_xwindow_id (GstXOverlay *overlay);
G_END_DECLS
#endif /* __GST_X_OVERLAY_H__ */

View File

@@ -0,0 +1,30 @@
/* GStreamer
* Copyright (C) 2005 Andy Wingo <wingo@pobox.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_NET_H__
#define __GST_NET_H__
#include <gst/net/gstnetclientclock.h>
#include <gst/net/gstnettimepacket.h>
#include <gst/net/gstnettimeprovider.h>
#endif /* __GST_NET_H__ */

View File

@@ -0,0 +1,98 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2005 Wim Taymans <wim@fluendo.com>
* 2005 Andy Wingo <wingo@pobox.com>
*
* gstnetclientclock.h: clock that synchronizes itself to a time provider over
* the network
*
* 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_NET_CLIENT_CLOCK_H__
#define __GST_NET_CLIENT_CLOCK_H__
#include <gst/gst.h>
#include <gst/gstsystemclock.h>
G_BEGIN_DECLS
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#define GST_TYPE_NET_CLIENT_CLOCK \
(gst_net_client_clock_get_type())
#define GST_NET_CLIENT_CLOCK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NET_CLIENT_CLOCK,GstNetClientClock))
#define GST_NET_CLIENT_CLOCK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NET_CLIENT_CLOCK,GstNetClientClockClass))
#define GST_IS_NET_CLIENT_CLOCK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NET_CLIENT_CLOCK))
#define GST_IS_NET_CLIENT_CLOCK_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NET_CLIENT_CLOCK))
typedef struct _GstNetClientClock GstNetClientClock;
typedef struct _GstNetClientClockClass GstNetClientClockClass;
/**
* GstNetClientClock:
* @clock: the parent clock structure.
*
* Opaque #GstNetClientClock structure.
*/
struct _GstNetClientClock {
GstSystemClock clock;
/*< protected >*/
gchar *address;
gint port;
/*< private >*/
int sock;
int control_sock[2];
GstClockTime current_timeout;
struct sockaddr_id *servaddr;
GThread *thread;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstNetClientClockClass {
GstSystemClockClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_net_client_clock_get_type (void);
GstClock* gst_net_client_clock_new (gchar *name, const gchar *remote_address,
gint remote_port, GstClockTime base_time);
G_END_DECLS
#endif /* __GST_NET_CLIENT_CLOCK_H__ */

View File

@@ -0,0 +1,69 @@
/* GStreamer
* Copyright (C) 2005 Andy Wingo <wingo@pobox.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_NET_TIME_PACKET_H__
#define __GST_NET_TIME_PACKET_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
/**
* GST_NET_TIME_PACKET_SIZE:
*
* The size of the packets sent between network clocks.
*/
#define GST_NET_TIME_PACKET_SIZE 16
typedef struct _GstNetTimePacket GstNetTimePacket;
/**
* GstNetTimePacket:
* @local_time: the local time when this packet was sent
* @remote_time: the remote time observation
*
* Content of a #GstNetTimePacket.
*/
struct _GstNetTimePacket {
GstClockTime local_time;
GstClockTime remote_time;
};
GstNetTimePacket* gst_net_time_packet_new (const guint8 *buffer);
guint8* gst_net_time_packet_serialize (const GstNetTimePacket *packet);
GstNetTimePacket* gst_net_time_packet_receive (gint fd, struct sockaddr *addr,
socklen_t *len);
gint gst_net_time_packet_send (const GstNetTimePacket *packet,
gint fd, struct sockaddr *addr,
socklen_t len);
G_END_DECLS
#endif /* __GST_NET_TIME_PACKET_H__ */

View File

@@ -0,0 +1,94 @@
/* GStreamer
* Copyright (C) 2005 Andy Wingo <wingo@pobox.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_NET_TIME_PROVIDER_H__
#define __GST_NET_TIME_PROVIDER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#define GST_TYPE_NET_TIME_PROVIDER \
(gst_net_time_provider_get_type())
#define GST_NET_TIME_PROVIDER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NET_TIME_PROVIDER,GstNetTimeProvider))
#define GST_NET_TIME_PROVIDER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NET_TIME_PROVIDER,GstNetTimeProvider))
#define GST_IS_NET_TIME_PROVIDER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NET_TIME_PROVIDER))
#define GST_IS_NET_TIME_PROVIDER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NET_TIME_PROVIDER))
typedef struct _GstNetTimeProvider GstNetTimeProvider;
typedef struct _GstNetTimeProviderClass GstNetTimeProviderClass;
/**
* GstNetTimeProvider:
* @parent: the parent object structure.
*
* Opaque #GstNetTimeProvider structure.
*/
struct _GstNetTimeProvider {
GstObject parent;
/*< private >*/
gchar *address;
int port;
int sock;
int control_sock[2];
GThread *thread;
GstClock *clock;
union {
gpointer _gst_reserved1;
/* has to be a gint, we use atomic ops here */
gint active;
} active;
/*< private >*/
gpointer _gst_reserved[GST_PADDING - 1];
};
struct _GstNetTimeProviderClass {
GstObjectClass parent_class;
};
GType gst_net_time_provider_get_type (void);
GstNetTimeProvider* gst_net_time_provider_new (GstClock *clock,
const gchar *address,
gint port);
G_END_DECLS
#endif /* __GST_NET_TIME_PROVIDER_H__ */

View File

@@ -0,0 +1,92 @@
/* GStreamer
* Copyright (C) <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_NETBUFFER_H__
#define __GST_NETBUFFER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
typedef struct _GstNetBuffer GstNetBuffer;
typedef struct _GstNetBufferClass GstNetBufferClass;
#define GST_TYPE_NETBUFFER (gst_netbuffer_get_type())
#define GST_IS_NETBUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NETBUFFER))
#define GST_IS_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NETBUFFER))
#define GST_NETBUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_NETBUFFER, GstNetBufferClass))
#define GST_NETBUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NETBUFFER, GstNetBuffer))
#define GST_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NETBUFFER, GstNetBufferClass))
/* buffer for use in network sources and sinks.
*
* It contains the source or destination address of the buffer.
*/
typedef enum {
GST_NET_TYPE_UNKNOWN,
GST_NET_TYPE_IP4,
GST_NET_TYPE_IP6,
} GstNetType;
typedef struct
{
GstNetType type;
union {
guint8 ip6[16];
guint32 ip4;
} address;
guint16 port;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
} GstNetAddress;
struct _GstNetBuffer {
GstBuffer buffer;
GstNetAddress from;
GstNetAddress to;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstNetBufferClass {
GstBufferClass buffer_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* creating buffers */
GType gst_netbuffer_get_type (void);
GstNetBuffer* gst_netbuffer_new (void);
/* address operations */
void gst_netaddress_set_ip4_address (GstNetAddress *nadd, guint32 address, guint16 port);
void gst_netaddress_set_ip6_address (GstNetAddress *nadd, guint8 address[16], guint16 port);
GstNetType gst_netaddress_get_net_type (GstNetAddress *nadd);
gboolean gst_netaddress_get_ip4_address (GstNetAddress *nadd, guint32 *address, guint16 *port);
gboolean gst_netaddress_get_ip6_address (GstNetAddress *nadd, guint8 address[16], guint16 *port);
G_END_DECLS
#endif /* __GST_NETBUFFER_H__ */

View File

@@ -0,0 +1,337 @@
/* GStreamer RIFF I/O
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* riff-ids.h: RIFF IDs and structs
*
* 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_RIFF_IDS_H__
#define __GST_RIFF_IDS_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* RIFF types */
#define GST_RIFF_RIFF_WAVE GST_MAKE_FOURCC ('W','A','V','E')
#define GST_RIFF_RIFF_AVI GST_MAKE_FOURCC ('A','V','I',' ')
#define GST_RIFF_RIFF_CDXA GST_MAKE_FOURCC ('C','D','X','A')
/* tags */
#define GST_RIFF_TAG_RIFF GST_MAKE_FOURCC ('R','I','F','F')
#define GST_RIFF_TAG_RIFX GST_MAKE_FOURCC ('R','I','F','X')
#define GST_RIFF_TAG_LIST GST_MAKE_FOURCC ('L','I','S','T')
#define GST_RIFF_TAG_avih GST_MAKE_FOURCC ('a','v','i','h')
#define GST_RIFF_TAG_strd GST_MAKE_FOURCC ('s','t','r','d')
#define GST_RIFF_TAG_strn GST_MAKE_FOURCC ('s','t','r','n')
#define GST_RIFF_TAG_strh GST_MAKE_FOURCC ('s','t','r','h')
#define GST_RIFF_TAG_strf GST_MAKE_FOURCC ('s','t','r','f')
#define GST_RIFF_TAG_vedt GST_MAKE_FOURCC ('v','e','d','t')
#define GST_RIFF_TAG_JUNK GST_MAKE_FOURCC ('J','U','N','K')
#define GST_RIFF_TAG_idx1 GST_MAKE_FOURCC ('i','d','x','1')
#define GST_RIFF_TAG_dmlh GST_MAKE_FOURCC ('d','m','l','h')
/* WAV stuff */
#define GST_RIFF_TAG_fmt GST_MAKE_FOURCC ('f','m','t',' ')
#define GST_RIFF_TAG_data GST_MAKE_FOURCC ('d','a','t','a')
#define GST_RIFF_TAG_plst GST_MAKE_FOURCC ('p','l','s','t')
#define GST_RIFF_TAG_cue GST_MAKE_FOURCC ('c','u','e',' ')
/* LIST types */
#define GST_RIFF_LIST_movi GST_MAKE_FOURCC ('m','o','v','i')
#define GST_RIFF_LIST_hdrl GST_MAKE_FOURCC ('h','d','r','l')
#define GST_RIFF_LIST_odml GST_MAKE_FOURCC ('o','d','m','l')
#define GST_RIFF_LIST_strl GST_MAKE_FOURCC ('s','t','r','l')
#define GST_RIFF_LIST_INFO GST_MAKE_FOURCC ('I','N','F','O')
#define GST_RIFF_LIST_AVIX GST_MAKE_FOURCC ('A','V','I','X')
#define GST_RIFF_LIST_adtl GST_MAKE_FOURCC ('a','d','t','l')
/* fcc types */
#define GST_RIFF_FCC_vids GST_MAKE_FOURCC ('v','i','d','s')
#define GST_RIFF_FCC_auds GST_MAKE_FOURCC ('a','u','d','s')
#define GST_RIFF_FCC_pads GST_MAKE_FOURCC ('p','a','d','s')
#define GST_RIFF_FCC_txts GST_MAKE_FOURCC ('t','x','t','s')
#define GST_RIFF_FCC_vidc GST_MAKE_FOURCC ('v','i','d','c')
#define GST_RIFF_FCC_iavs GST_MAKE_FOURCC ('i','a','v','s')
/* fcc handlers */
#define GST_RIFF_FCCH_RLE GST_MAKE_FOURCC ('R','L','E',' ')
#define GST_RIFF_FCCH_msvc GST_MAKE_FOURCC ('m','s','v','c')
#define GST_RIFF_FCCH_MSVC GST_MAKE_FOURCC ('M','S','V','C')
/* INFO types - see http://www.saettler.com/RIFFMCI/riffmci.html */
#define GST_RIFF_INFO_IARL GST_MAKE_FOURCC ('I','A','R','L') /* location */
#define GST_RIFF_INFO_IART GST_MAKE_FOURCC ('I','A','R','T') /* artist */
#define GST_RIFF_INFO_ICMS GST_MAKE_FOURCC ('I','C','M','S') /* commissioned */
#define GST_RIFF_INFO_ICMT GST_MAKE_FOURCC ('I','C','M','T') /* comment */
#define GST_RIFF_INFO_ICOP GST_MAKE_FOURCC ('I','C','O','P') /* copyright */
#define GST_RIFF_INFO_ICRD GST_MAKE_FOURCC ('I','C','R','D') /* creation date */
#define GST_RIFF_INFO_ICRP GST_MAKE_FOURCC ('I','C','R','P') /* cropped */
#define GST_RIFF_INFO_IDIM GST_MAKE_FOURCC ('I','D','I','M') /* dimensions */
#define GST_RIFF_INFO_IDPI GST_MAKE_FOURCC ('I','D','P','I') /* dots-per-inch */
#define GST_RIFF_INFO_IENG GST_MAKE_FOURCC ('I','E','N','G') /* engineer(s) */
#define GST_RIFF_INFO_IGNR GST_MAKE_FOURCC ('I','G','N','R') /* genre */
#define GST_RIFF_INFO_IKEY GST_MAKE_FOURCC ('I','K','E','Y') /* keywords */
#define GST_RIFF_INFO_ILGT GST_MAKE_FOURCC ('I','L','G','T') /* lightness */
#define GST_RIFF_INFO_IMED GST_MAKE_FOURCC ('I','M','E','D') /* medium */
#define GST_RIFF_INFO_INAM GST_MAKE_FOURCC ('I','N','A','M') /* name */
#define GST_RIFF_INFO_IPLT GST_MAKE_FOURCC ('I','P','L','T') /* palette setting */
#define GST_RIFF_INFO_IPRD GST_MAKE_FOURCC ('I','P','R','D') /* product */
#define GST_RIFF_INFO_ISBJ GST_MAKE_FOURCC ('I','S','B','J') /* subject */
#define GST_RIFF_INFO_ISFT GST_MAKE_FOURCC ('I','S','F','T') /* software */
#define GST_RIFF_INFO_ISHP GST_MAKE_FOURCC ('I','S','H','P') /* sharpness */
#define GST_RIFF_INFO_ISRC GST_MAKE_FOURCC ('I','S','R','C') /* source */
#define GST_RIFF_INFO_ISRF GST_MAKE_FOURCC ('I','S','R','F') /* source form */
#define GST_RIFF_INFO_ITCH GST_MAKE_FOURCC ('I','T','C','H') /* technician(s) */
/*********Chunk Names***************/
#define GST_RIFF_FF00 GST_MAKE_FOURCC (0xFF,0xFF,0x00,0x00)
#define GST_RIFF_00 GST_MAKE_FOURCC ('0', '0',0x00,0x00)
#define GST_RIFF_01 GST_MAKE_FOURCC ('0', '1',0x00,0x00)
#define GST_RIFF_02 GST_MAKE_FOURCC ('0', '2',0x00,0x00)
#define GST_RIFF_03 GST_MAKE_FOURCC ('0', '3',0x00,0x00)
#define GST_RIFF_04 GST_MAKE_FOURCC ('0', '4',0x00,0x00)
#define GST_RIFF_05 GST_MAKE_FOURCC ('0', '5',0x00,0x00)
#define GST_RIFF_06 GST_MAKE_FOURCC ('0', '6',0x00,0x00)
#define GST_RIFF_07 GST_MAKE_FOURCC ('0', '7',0x00,0x00)
#define GST_RIFF_00pc GST_MAKE_FOURCC ('0', '0', 'p', 'c')
#define GST_RIFF_01pc GST_MAKE_FOURCC ('0', '1', 'p', 'c')
#define GST_RIFF_00dc GST_MAKE_FOURCC ('0', '0', 'd', 'c')
#define GST_RIFF_00dx GST_MAKE_FOURCC ('0', '0', 'd', 'x')
#define GST_RIFF_00db GST_MAKE_FOURCC ('0', '0', 'd', 'b')
#define GST_RIFF_00xx GST_MAKE_FOURCC ('0', '0', 'x', 'x')
#define GST_RIFF_00id GST_MAKE_FOURCC ('0', '0', 'i', 'd')
#define GST_RIFF_00rt GST_MAKE_FOURCC ('0', '0', 'r', 't')
#define GST_RIFF_0021 GST_MAKE_FOURCC ('0', '0', '2', '1')
#define GST_RIFF_00iv GST_MAKE_FOURCC ('0', '0', 'i', 'v')
#define GST_RIFF_0031 GST_MAKE_FOURCC ('0', '0', '3', '1')
#define GST_RIFF_0032 GST_MAKE_FOURCC ('0', '0', '3', '2')
#define GST_RIFF_00vc GST_MAKE_FOURCC ('0', '0', 'v', 'c')
#define GST_RIFF_00xm GST_MAKE_FOURCC ('0', '0', 'x', 'm')
#define GST_RIFF_01wb GST_MAKE_FOURCC ('0', '1', 'w', 'b')
#define GST_RIFF_01dc GST_MAKE_FOURCC ('0', '1', 'd', 'c')
#define GST_RIFF_00__ GST_MAKE_FOURCC ('0', '0', '_', '_')
/*********VIDEO CODECS**************/
#define GST_RIFF_cram GST_MAKE_FOURCC ('c', 'r', 'a', 'm')
#define GST_RIFF_CRAM GST_MAKE_FOURCC ('C', 'R', 'A', 'M')
#define GST_RIFF_wham GST_MAKE_FOURCC ('w', 'h', 'a', 'm')
#define GST_RIFF_WHAM GST_MAKE_FOURCC ('W', 'H', 'A', 'M')
#define GST_RIFF_rgb GST_MAKE_FOURCC (0x00,0x00,0x00,0x00)
#define GST_RIFF_RGB GST_MAKE_FOURCC ('R', 'G', 'B', ' ')
#define GST_RIFF_rle8 GST_MAKE_FOURCC (0x01,0x00,0x00,0x00)
#define GST_RIFF_RLE8 GST_MAKE_FOURCC ('R', 'L', 'E', '8')
#define GST_RIFF_rle4 GST_MAKE_FOURCC (0x02,0x00,0x00,0x00)
#define GST_RIFF_RLE4 GST_MAKE_FOURCC ('R', 'L', 'E', '4')
#define GST_RIFF_none GST_MAKE_FOURCC (0x00,0x00,0xFF,0xFF)
#define GST_RIFF_NONE GST_MAKE_FOURCC ('N', 'O', 'N', 'E')
#define GST_RIFF_pack GST_MAKE_FOURCC (0x01,0x00,0xFF,0xFF)
#define GST_RIFF_PACK GST_MAKE_FOURCC ('P', 'A', 'C', 'K')
#define GST_RIFF_tran GST_MAKE_FOURCC (0x02,0x00,0xFF,0xFF)
#define GST_RIFF_TRAN GST_MAKE_FOURCC ('T', 'R', 'A', 'N')
#define GST_RIFF_ccc GST_MAKE_FOURCC (0x03,0x00,0xFF,0xFF)
#define GST_RIFF_CCC GST_MAKE_FOURCC ('C', 'C', 'C', ' ')
#define GST_RIFF_cyuv GST_MAKE_FOURCC ('c', 'y', 'u', 'v')
#define GST_RIFF_CYUV GST_MAKE_FOURCC ('C', 'Y', 'U', 'V')
#define GST_RIFF_jpeg GST_MAKE_FOURCC (0x04,0x00,0xFF,0xFF)
#define GST_RIFF_JPEG GST_MAKE_FOURCC ('J', 'P', 'E', 'G')
#define GST_RIFF_MJPG GST_MAKE_FOURCC ('M', 'J', 'P', 'G')
#define GST_RIFF_mJPG GST_MAKE_FOURCC ('m', 'J', 'P', 'G')
#define GST_RIFF_IJPG GST_MAKE_FOURCC ('I', 'J', 'P', 'G')
#define GST_RIFF_rt21 GST_MAKE_FOURCC ('r', 't', '2', '1')
#define GST_RIFF_RT21 GST_MAKE_FOURCC ('R', 'T', '2', '1')
#define GST_RIFF_iv31 GST_MAKE_FOURCC ('i', 'v', '3', '1')
#define GST_RIFF_IV31 GST_MAKE_FOURCC ('I', 'V', '3', '1')
#define GST_RIFF_iv32 GST_MAKE_FOURCC ('i', 'v', '3', '2')
#define GST_RIFF_IV32 GST_MAKE_FOURCC ('I', 'V', '3', '2')
#define GST_RIFF_iv41 GST_MAKE_FOURCC ('i', 'v', '4', '1')
#define GST_RIFF_IV41 GST_MAKE_FOURCC ('I', 'V', '4', '1')
#define GST_RIFF_iv50 GST_MAKE_FOURCC ('i', 'v', '5', '0')
#define GST_RIFF_IV50 GST_MAKE_FOURCC ('I', 'V', '5', '0')
#define GST_RIFF_cvid GST_MAKE_FOURCC ('c', 'v', 'i', 'd')
#define GST_RIFF_CVID GST_MAKE_FOURCC ('C', 'V', 'I', 'D')
#define GST_RIFF_ULTI GST_MAKE_FOURCC ('U', 'L', 'T', 'I')
#define GST_RIFF_ulti GST_MAKE_FOURCC ('u', 'l', 't', 'i')
#define GST_RIFF_YUV9 GST_MAKE_FOURCC ('Y', 'V', 'U', '9')
#define GST_RIFF_YVU9 GST_MAKE_FOURCC ('Y', 'U', 'V', '9')
#define GST_RIFF_XMPG GST_MAKE_FOURCC ('X', 'M', 'P', 'G')
#define GST_RIFF_xmpg GST_MAKE_FOURCC ('x', 'm', 'p', 'g')
#define GST_RIFF_VDOW GST_MAKE_FOURCC ('V', 'D', 'O', 'W')
#define GST_RIFF_MVI1 GST_MAKE_FOURCC ('M', 'V', 'I', '1')
#define GST_RIFF_v422 GST_MAKE_FOURCC ('v', '4', '2', '2')
#define GST_RIFF_V422 GST_MAKE_FOURCC ('V', '4', '2', '2')
#define GST_RIFF_mvi1 GST_MAKE_FOURCC ('m', 'v', 'i', '1')
#define GST_RIFF_MPIX GST_MAKE_FOURCC (0x04,0x00, 'i', '1') /* MotionPixels munged their id */
#define GST_RIFF_AURA GST_MAKE_FOURCC ('A', 'U', 'R', 'A')
#define GST_RIFF_DMB1 GST_MAKE_FOURCC ('D', 'M', 'B', '1')
#define GST_RIFF_dmb1 GST_MAKE_FOURCC ('d', 'm', 'b', '1')
#define GST_RIFF_BW10 GST_MAKE_FOURCC ('B', 'W', '1', '0')
#define GST_RIFF_bw10 GST_MAKE_FOURCC ('b', 'w', '1', '0')
#define GST_RIFF_yuy2 GST_MAKE_FOURCC ('y', 'u', 'y', '2')
#define GST_RIFF_YUY2 GST_MAKE_FOURCC ('Y', 'U', 'Y', '2')
#define GST_RIFF_YUV8 GST_MAKE_FOURCC ('Y', 'U', 'V', '8')
#define GST_RIFF_WINX GST_MAKE_FOURCC ('W', 'I', 'N', 'X')
#define GST_RIFF_WPY2 GST_MAKE_FOURCC ('W', 'P', 'Y', '2')
#define GST_RIFF_m263 GST_MAKE_FOURCC ('m', '2', '6', '3')
#define GST_RIFF_M263 GST_MAKE_FOURCC ('M', '2', '6', '3')
#define GST_RIFF_H263 GST_MAKE_FOURCC ('H', '2', '6', '3')
#define GST_RIFF_h263 GST_MAKE_FOURCC ('h', '2', '6', '3')
#define GST_RIFF_i263 GST_MAKE_FOURCC ('i', '2', '6', '3')
#define GST_RIFF_L263 GST_MAKE_FOURCC ('L', '2', '6', '3')
#define GST_RIFF_x263 GST_MAKE_FOURCC ('x', '2', '6', '3')
#define GST_RIFF_VSSH GST_MAKE_FOURCC ( 'V', 'S', 'S', 'H') /* H2.64 */
#define GST_RIFF_Q1_0 GST_MAKE_FOURCC ('Q', '1',0x2e, '0')
#define GST_RIFF_SFMC GST_MAKE_FOURCC ('S', 'F', 'M', 'C')
#define GST_RIFF_y41p GST_MAKE_FOURCC ('y', '4', '1', 'p')
#define GST_RIFF_Y41P GST_MAKE_FOURCC ('Y', '4', '1', 'P')
#define GST_RIFF_yv12 GST_MAKE_FOURCC ('y', 'v', '1', '2')
#define GST_RIFF_YV12 GST_MAKE_FOURCC ('Y', 'V', '1', '2')
#define GST_RIFF_vixl GST_MAKE_FOURCC ('v', 'i', 'x', 'l')
#define GST_RIFF_VIXL GST_MAKE_FOURCC ('V', 'I', 'X', 'L')
#define GST_RIFF_iyuv GST_MAKE_FOURCC ('i', 'y', 'u', 'v')
#define GST_RIFF_IYUV GST_MAKE_FOURCC ('I', 'Y', 'U', 'V')
#define GST_RIFF_i420 GST_MAKE_FOURCC ('i', '4', '2', '0')
#define GST_RIFF_I420 GST_MAKE_FOURCC ('I', '4', '2', '0')
#define GST_RIFF_vyuy GST_MAKE_FOURCC ('v', 'y', 'u', 'y')
#define GST_RIFF_VYUY GST_MAKE_FOURCC ('V', 'Y', 'U', 'Y')
#define GST_RIFF_DIV3 GST_MAKE_FOURCC ('D', 'I', 'V', '3')
#define GST_RIFF_rpza GST_MAKE_FOURCC ('r', 'p', 'z', 'a')
/* And this here's the mistakes that need to be supported */
#define GST_RIFF_azpr GST_MAKE_FOURCC ('a', 'z', 'p', 'r') /* recognize Apple's rpza mangled? */
/*********** FND in MJPG **********/
#define GST_RIFF_ISFT GST_MAKE_FOURCC ('I', 'S', 'F', 'T')
#define GST_RIFF_IDIT GST_MAKE_FOURCC ('I', 'D', 'I', 'T')
#define GST_RIFF_00AM GST_MAKE_FOURCC ('0', '0', 'A', 'M')
#define GST_RIFF_DISP GST_MAKE_FOURCC ('D', 'I', 'S', 'P')
#define GST_RIFF_ISBJ GST_MAKE_FOURCC ('I', 'S', 'B', 'J')
#define GST_RIFF_rec GST_MAKE_FOURCC ('r', 'e', 'c', ' ')
/* common data structures */
typedef struct _gst_riff_strh {
guint32 type; /* stream type */
guint32 fcc_handler; /* fcc_handler */
guint32 flags;
/* flags values */
#define GST_RIFF_STRH_DISABLED 0x000000001
#define GST_RIFF_STRH_VIDEOPALCHANGES 0x000010000
guint32 priority;
guint32 init_frames; /* initial frames (???) */
guint32 scale;
guint32 rate;
guint32 start;
guint32 length;
guint32 bufsize; /* suggested buffer size */
guint32 quality;
guint32 samplesize;
/* XXX 16 bytes ? */
} gst_riff_strh;
typedef struct _gst_riff_strf_vids { /* == BitMapInfoHeader */
guint32 size;
guint32 width;
guint32 height;
guint16 planes;
guint16 bit_cnt;
guint32 compression;
guint32 image_size;
guint32 xpels_meter;
guint32 ypels_meter;
guint32 num_colors; /* used colors */
guint32 imp_colors; /* important colors */
/* may be more for some codecs */
} gst_riff_strf_vids;
typedef struct _gst_riff_strf_auds { /* == WaveHeader (?) */
guint16 format;
/**** from public Microsoft RIFF docs ******/
#define GST_RIFF_WAVE_FORMAT_UNKNOWN (0x0000)
#define GST_RIFF_WAVE_FORMAT_PCM (0x0001)
#define GST_RIFF_WAVE_FORMAT_ADPCM (0x0002)
#define GST_RIFF_WAVE_FORMAT_IBM_CVSD (0x0005)
#define GST_RIFF_WAVE_FORMAT_ALAW (0x0006)
#define GST_RIFF_WAVE_FORMAT_MULAW (0x0007)
#define GST_RIFF_WAVE_FORMAT_OKI_ADPCM (0x0010)
#define GST_RIFF_WAVE_FORMAT_DVI_ADPCM (0x0011)
#define GST_RIFF_WAVE_FORMAT_DIGISTD (0x0015)
#define GST_RIFF_WAVE_FORMAT_DIGIFIX (0x0016)
#define GST_RIFF_WAVE_FORMAT_YAMAHA_ADPCM (0x0020)
#define GST_RIFF_WAVE_FORMAT_DSP_TRUESPEECH (0x0022)
#define GST_RIFF_WAVE_FORMAT_GSM610 (0x0031)
#define GST_RIFF_WAVE_FORMAT_MSN (0x0032)
#define GST_RIFF_WAVE_FORMAT_ITU_G721_ADPCM (0x0040)
#define GST_RIFF_WAVE_FORMAT_MPEGL12 (0x0050)
#define GST_RIFF_WAVE_FORMAT_MPEGL3 (0x0055)
#define GST_RIFF_IBM_FORMAT_MULAW (0x0101)
#define GST_RIFF_IBM_FORMAT_ALAW (0x0102)
#define GST_RIFF_IBM_FORMAT_ADPCM (0x0103)
#define GST_RIFF_WAVE_FORMAT_WMAV1 (0x0160)
#define GST_RIFF_WAVE_FORMAT_WMAV2 (0x0161)
#define GST_RIFF_WAVE_FORMAT_WMAV3 (0x0162)
#define GST_RIFF_WAVE_FORMAT_SONY_ATRAC3 (0x0270)
#define GST_RIFF_WAVE_FORMAT_A52 (0x2000)
#define GST_RIFF_WAVE_FORMAT_VORBIS1 (0x674f)
#define GST_RIFF_WAVE_FORMAT_VORBIS2 (0x6750)
#define GST_RIFF_WAVE_FORMAT_VORBIS3 (0x6751)
#define GST_RIFF_WAVE_FORMAT_VORBIS1PLUS (0x676f)
#define GST_RIFF_WAVE_FORMAT_VORBIS2PLUS (0x6770)
#define GST_RIFF_WAVE_FORMAT_VORBIS3PLUS (0x6771)
#define GST_RIFF_WAVE_FORMAT_GSM_AMR_CBR (0x7A21)
#define GST_RIFF_WAVE_FORMAT_GSM_AMR_VBR (0x7A22)
#define GST_RIFF_WAVE_FORMAT_EXTENSIBLE (0xFFFE)
guint16 channels;
guint32 rate;
guint32 av_bps;
guint16 blockalign;
guint16 size;
} gst_riff_strf_auds;
typedef struct _gst_riff_strf_iavs {
guint32 DVAAuxSrc;
guint32 DVAAuxCtl;
guint32 DVAAuxSrc1;
guint32 DVAAuxCtl1;
guint32 DVVAuxSrc;
guint32 DVVAuxCtl;
guint32 DVReserved1;
guint32 DVReserved2;
} gst_riff_strf_iavs;
typedef struct _gst_riff_index_entry {
guint32 id;
guint32 flags;
#define GST_RIFF_IF_LIST (0x00000001L)
#define GST_RIFF_IF_KEYFRAME (0x00000010L)
#define GST_RIFF_IF_NO_TIME (0x00000100L)
#define GST_RIFF_IF_COMPUSE (0x0FFF0000L)
guint32 offset;
guint32 size;
} gst_riff_index_entry;
typedef struct _gst_riff_dmlh {
guint32 totalframes;
} gst_riff_dmlh;
G_END_DECLS
#endif /* __GST_RIFF_IDS_H__ */

View File

@@ -0,0 +1,65 @@
/* GStreamer RIFF I/O
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* riff-media.h: RIFF-id to/from caps routines
*
* 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_RIFF_MEDIA_H__
#define __GST_RIFF_MEDIA_H__
#include <glib.h>
#include <gst/gst.h>
#include "riff-ids.h"
G_BEGIN_DECLS
/*
* Create caos. strh/strf, strf/strd_data and codec_name can be NULL.
*/
GstCaps * gst_riff_create_video_caps (guint32 codec_fcc,
gst_riff_strh * strh,
gst_riff_strf_vids * strf,
GstBuffer * strf_data,
GstBuffer * strd_data,
char ** codec_name);
GstCaps * gst_riff_create_audio_caps (guint16 codec_id,
gst_riff_strh * strh,
gst_riff_strf_auds * strf,
GstBuffer * strf_data,
GstBuffer * strd_data,
char ** codec_name);
GstCaps * gst_riff_create_iavs_caps (guint32 codec_fcc,
gst_riff_strh * strh,
gst_riff_strf_iavs * strf,
GstBuffer * strf_data,
GstBuffer * strd_data,
char ** codec_name);
/*
* Create template caps (includes all known types).
*/
GstCaps * gst_riff_create_video_template_caps (void);
GstCaps * gst_riff_create_audio_template_caps (void);
GstCaps * gst_riff_create_iavs_template_caps (void);
G_END_DECLS
#endif /* __GST_RIFF_READ_H__ */

View File

@@ -0,0 +1,87 @@
/* GStreamer RIFF I/O
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* riff-read.h: function declarations for parsing a RIFF file
*
* 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_RIFF_READ_H__
#define __GST_RIFF_READ_H__
#include <glib.h>
#include <gst/gst.h>
#include "riff-ids.h"
G_BEGIN_DECLS
/*
* Operate using pull_range().
*/
GstFlowReturn gst_riff_read_chunk (GstElement * element,
GstPad * pad,
guint64 * offset,
guint32 * fourcc,
GstBuffer ** chunk_data);
/*
* These functions operate on provided data (the caller is
* supposed to strip the chunk headers). The buffer is
* provided by the caller, the strf/strh/data are filled in
* by the function.
*/
gboolean gst_riff_parse_chunk (GstElement * element,
GstBuffer * buf,
guint * offset,
guint32 * fourcc,
GstBuffer ** chunk_data);
gboolean gst_riff_parse_file_header (GstElement * element,
GstBuffer * buf,
guint32 * doctype);
gboolean gst_riff_parse_strh (GstElement * element,
GstBuffer * buf,
gst_riff_strh ** strh);
gboolean gst_riff_parse_strf_vids (GstElement * element,
GstBuffer * buf,
gst_riff_strf_vids ** strf,
GstBuffer ** data);
gboolean gst_riff_parse_strf_auds (GstElement * element,
GstBuffer * buf,
gst_riff_strf_auds ** strf,
GstBuffer ** data);
gboolean gst_riff_parse_strf_iavs (GstElement * element,
GstBuffer * buf,
gst_riff_strf_iavs ** strf,
GstBuffer ** data);
void gst_riff_parse_info (GstElement * element,
GstBuffer * buf,
GstTagList ** taglist);
/*
* Init.
*/
void gst_riff_init (void);
G_END_DECLS
#endif /* __GST_RIFF_READ_H__ */

View File

@@ -0,0 +1,118 @@
/* GStreamer
* Copyright (C) <2005> Philippe Khalaf <burger@speedy.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_BASE_RTP_DEPAYLOAD_H__
#define __GST_BASE_RTP_DEPAYLOAD_H__
#include <gst/gst.h>
#include <gst/rtp/gstrtpbuffer.h>
G_BEGIN_DECLS
/* #define's don't like whitespacey bits */
#define GST_TYPE_BASE_RTP_DEPAYLOAD (gst_base_rtp_depayload_get_type())
#define GST_BASE_RTP_DEPAYLOAD(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayload))
#define GST_BASE_RTP_DEPAYLOAD_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass))
#define GST_BASE_RTP_DEPAYLOAD_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass))
#define GST_IS_BASE_RTP_DEPAYLOAD(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_DEPAYLOAD))
#define GST_IS_BASE_RTP_DEPAYLOAD_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_DEPAYLOAD))
#define GST_BASE_RTP_DEPAYLOAD_SINKPAD(depayload) (GST_BASE_RTP_DEPAYLOAD (depayload)->sinkpad)
#define GST_BASE_RTP_DEPAYLOAD_SRCPAD(depayload) (GST_BASE_RTP_DEPAYLOAD (depayload)->srcpad)
/* in milliseconds */
#define RTP_QUEUE_DELAY 100;
#define QUEUE_LOCK_INIT(base) (g_static_rec_mutex_init(&base->queuelock))
#define QUEUE_LOCK_FREE(base) (g_static_rec_mutex_free(&base->queuelock))
#define QUEUE_LOCK(base) (g_static_rec_mutex_lock(&base->queuelock))
#define QUEUE_UNLOCK(base) (g_static_rec_mutex_unlock(&base->queuelock))
typedef struct _GstBaseRTPDepayload GstBaseRTPDepayload;
typedef struct _GstBaseRTPDepayloadClass GstBaseRTPDepayloadClass;
struct _GstBaseRTPDepayload
{
GstElement parent;
GstPad *sinkpad, *srcpad;
/* lock to protect the queue */
GStaticRecMutex queuelock;
gboolean thread_running;
/* the releaser thread */
GThread *thread;
/* this attribute must be set by the child */
guint clock_rate;
/* this value can be modified by the child if needed */
guint queue_delay;
/* we will queue up to RTP_QUEUEDELAY ms of packets,
* reordering them if necessary
* dropping any packets that are more than
* RTP_QUEUEDELAY ms late
*/
GQueue *queue;
GstSegment segment;
gboolean need_newsegment;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstBaseRTPDepayloadClass
{
GstElementClass parent_class;
/* virtuals */
gboolean (*set_caps) (GstBaseRTPDepayload *filter, GstCaps *caps);
/* non-pure function, default implementation in base class
* this does buffering, reordering and dropping
*/
GstFlowReturn (*add_to_queue) (GstBaseRTPDepayload *filter, GstBuffer *in);
/* pure virtual function, child must use this to process incoming
* rtp packets
*/
GstBuffer * (*process) (GstBaseRTPDepayload *base, GstBuffer *in);
/* non-pure function used to convert from RTP timestamp to GST timestamp
* this function is used by the child class before gst_pad_pushing
*/
void (*set_gst_timestamp) (GstBaseRTPDepayload *filter, guint32 timestamp, GstBuffer *buf);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_base_rtp_depayload_get_type (void);
G_END_DECLS
#endif /* __GST_BASE_RTP_DEPAYLOAD_H__ */

View File

@@ -0,0 +1,118 @@
/* GStreamer
* Copyright (C) <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_RTP_PAYLOAD_H__
#define __GST_BASE_RTP_PAYLOAD_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_BASE_RTP_PAYLOAD \
(gst_basertppayload_get_type())
#define GST_BASE_RTP_PAYLOAD(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_PAYLOAD,GstBaseRTPPayload))
#define GST_BASE_RTP_PAYLOAD_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_PAYLOAD,GstBaseRTPPayloadClass))
#define GST_BASE_RTP_PAYLOAD_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_RTP_PAYLOAD, GstBaseRTPPayloadClass))
#define GST_IS_BASE_RTP_PAYLOAD(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_PAYLOAD))
#define GST_IS_BASE_RTP_PAYLOAD_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_PAYLOAD))
typedef struct _GstBaseRTPPayload GstBaseRTPPayload;
typedef struct _GstBaseRTPPayloadClass GstBaseRTPPayloadClass;
#define GST_BASE_RTP_PAYLOAD_SINKPAD(payload) (GST_BASE_RTP_PAYLOAD (payload)->sinkpad)
#define GST_BASE_RTP_PAYLOAD_SRCPAD(payload) (GST_BASE_RTP_PAYLOAD (payload)->srcpad)
#define GST_BASE_RTP_PAYLOAD_PT(payload) (GST_BASE_RTP_PAYLOAD (payload)->pt)
#define GST_BASE_RTP_PAYLOAD_MTU(payload) (GST_BASE_RTP_PAYLOAD (payload)->mtu)
struct _GstBaseRTPPayload
{
GstElement element;
/*< private >*/
GstPad *sinkpad;
GstPad *srcpad;
GRand *seq_rand;
GRand *ssrc_rand;
GRand *ts_rand;
guint32 ts_base;
guint16 seqnum_base;
gchar *media;
gchar *encoding_name;
gboolean dynamic;
guint32 clock_rate;
gint32 ts_offset;
guint32 timestamp;
gint16 seqnum_offset;
guint16 seqnum;
gint64 max_ptime;
guint pt;
guint ssrc;
guint current_ssrc;
guint mtu;
GstSegment segment;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstBaseRTPPayloadClass
{
GstElementClass parent_class;
/* receive caps on the sink pad, configure the payloader. */
gboolean (*set_caps) (GstBaseRTPPayload *payload, GstCaps *caps);
/* handle a buffer, perform 0 or more gst_basertppayload_push() on
* the RTP buffers */
GstFlowReturn (*handle_buffer) (GstBaseRTPPayload *payload,
GstBuffer *buffer);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_basertppayload_get_type (void);
void gst_basertppayload_set_options (GstBaseRTPPayload *payload,
gchar *media, gboolean dynamic,
gchar *encoding_name,
guint32 clock_rate);
gboolean gst_basertppayload_set_outcaps (GstBaseRTPPayload *payload,
gchar *fieldname, ...);
gboolean gst_basertppayload_is_filled (GstBaseRTPPayload *payload,
guint size, GstClockTime duration);
GstFlowReturn gst_basertppayload_push (GstBaseRTPPayload *payload,
GstBuffer *buffer);
G_END_DECLS
#endif /* __GST_BASE_RTP_PAYLOAD_H__ */

View File

@@ -0,0 +1,130 @@
/* GStreamer
* Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
* <2005> Wim Taymans <wim@fluendo.com>
*
* gstrtpbuffer.h: various helper functions to manipulate buffers
* with RTP payload.
*
* 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_RTPBUFFER_H__
#define __GST_RTPBUFFER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_RTP_VERSION 2
typedef enum
{
/* Audio: */
GST_RTP_PAYLOAD_PCMU = 0, /* ITU-T G.711. mu-law audio (RFC 3551) */
GST_RTP_PAYLOAD_GSM = 3,
GST_RTP_PAYLOAD_PCMA = 8, /* ITU-T G.711 A-law audio (RFC 3551) */
GST_RTP_PAYLOAD_L16_STEREO = 10,
GST_RTP_PAYLOAD_L16_MONO = 11,
GST_RTP_PAYLOAD_MPA = 14, /* Audio MPEG 1-3 */
GST_RTP_PAYLOAD_G723_63 = 16, /* Not standard */
GST_RTP_PAYLOAD_G723_53 = 17, /* Not standard */
GST_RTP_PAYLOAD_TS48 = 18, /* Not standard */
GST_RTP_PAYLOAD_TS41 = 19, /* Not standard */
GST_RTP_PAYLOAD_G728 = 20, /* Not standard */
GST_RTP_PAYLOAD_G729 = 21, /* Not standard */
/* Video: */
GST_RTP_PAYLOAD_MPV = 32, /* Video MPEG 1 & 2 */
GST_RTP_PAYLOAD_H263 = 34,
/* BOTH */
} GstRTPPayload;
/* Defining the above as strings, to make the declaration of pad_templates
* easier. So if please keep these synchronized with the above.
*/
#define GST_RTP_PAYLOAD_PCMU_STRING "0"
#define GST_RTP_PAYLOAD_GSM_STRING "3"
#define GST_RTP_PAYLOAD_PCMA_STRING "8"
#define GST_RTP_PAYLOAD_L16_STEREO_STRING "10"
#define GST_RTP_PAYLOAD_L16_MONO_STRING "11"
#define GST_RTP_PAYLOAD_MPA_STRING "14"
#define GST_RTP_PAYLOAD_G723_63_STRING "16"
#define GST_RTP_PAYLOAD_G723_53_STRING "17"
#define GST_RTP_PAYLOAD_TS48_STRING "18"
#define GST_RTP_PAYLOAD_TS41_STRING "19"
#define GST_RTP_PAYLOAD_G728_STRING "20"
#define GST_RTP_PAYLOAD_G729_STRING "21"
#define GST_RTP_PAYLOAD_MPV_STRING "32"
#define GST_RTP_PAYLOAD_H263_STRING "34"
/* creating buffers */
GstBuffer* gst_rtp_buffer_new (void);
void gst_rtp_buffer_allocate_data (GstBuffer *buffer, guint payload_len,
guint8 pad_len, guint8 csrc_count);
GstBuffer* gst_rtp_buffer_new_take_data (gpointer data, guint len);
GstBuffer* gst_rtp_buffer_new_copy_data (gpointer data, guint len);
GstBuffer* gst_rtp_buffer_new_allocate (guint payload_len, guint8 pad_len, guint8 csrc_count);
GstBuffer* gst_rtp_buffer_new_allocate_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
guint gst_rtp_buffer_calc_header_len (guint8 csrc_count);
guint gst_rtp_buffer_calc_packet_len (guint payload_len, guint8 pad_len, guint8 csrc_count);
guint gst_rtp_buffer_calc_payload_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
gboolean gst_rtp_buffer_validate_data (guint8 *data, guint len);
gboolean gst_rtp_buffer_validate (GstBuffer *buffer);
void gst_rtp_buffer_set_packet_len (GstBuffer *buffer, guint len);
guint gst_rtp_buffer_get_packet_len (GstBuffer *buffer);
guint8 gst_rtp_buffer_get_version (GstBuffer *buffer);
void gst_rtp_buffer_set_version (GstBuffer *buffer, guint8 version);
gboolean gst_rtp_buffer_get_padding (GstBuffer *buffer);
void gst_rtp_buffer_set_padding (GstBuffer *buffer, gboolean padding);
void gst_rtp_buffer_pad_to (GstBuffer *buffer, guint len);
gboolean gst_rtp_buffer_get_extension (GstBuffer *buffer);
void gst_rtp_buffer_set_extension (GstBuffer *buffer, gboolean extension);
guint32 gst_rtp_buffer_get_ssrc (GstBuffer *buffer);
void gst_rtp_buffer_set_ssrc (GstBuffer *buffer, guint32 ssrc);
guint8 gst_rtp_buffer_get_csrc_count (GstBuffer *buffer);
guint32 gst_rtp_buffer_get_csrc (GstBuffer *buffer, guint8 idx);
void gst_rtp_buffer_set_csrc (GstBuffer *buffer, guint8 idx, guint32 csrc);
gboolean gst_rtp_buffer_get_marker (GstBuffer *buffer);
void gst_rtp_buffer_set_marker (GstBuffer *buffer, gboolean marker);
guint8 gst_rtp_buffer_get_payload_type (GstBuffer *buffer);
void gst_rtp_buffer_set_payload_type (GstBuffer *buffer, guint8 payload_type);
guint16 gst_rtp_buffer_get_seq (GstBuffer *buffer);
void gst_rtp_buffer_set_seq (GstBuffer *buffer, guint16 seq);
guint32 gst_rtp_buffer_get_timestamp (GstBuffer *buffer);
void gst_rtp_buffer_set_timestamp (GstBuffer *buffer, guint32 timestamp);
GstBuffer* gst_rtp_buffer_get_payload_buffer (GstBuffer *buffer);
guint gst_rtp_buffer_get_payload_len (GstBuffer *buffer);
gpointer gst_rtp_buffer_get_payload (GstBuffer *buffer);
G_END_DECLS
#endif /* __GST_RTPBUFFER_H__ */

View File

@@ -0,0 +1,123 @@
/* GStreamer
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* 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_TAG_H__
#define __GST_TAG_TAG_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* Tag names */
/**
* GST_TAG_MUSICBRAINZ_TRACKID
*
* MusicBrainz track ID
*/
#define GST_TAG_MUSICBRAINZ_TRACKID "musicbrainz-trackid"
/**
* GST_TAG_MUSICBRAINZ_ARTISTID
*
* MusicBrainz artist ID
*/
#define GST_TAG_MUSICBRAINZ_ARTISTID "musicbrainz-artistid"
/**
* GST_TAG_MUSICBRAINZ_ALBUMID
*
* MusicBrainz album ID
*/
#define GST_TAG_MUSICBRAINZ_ALBUMID "musicbrainz-albumid"
/**
* GST_TAG_MUSICBRAINZ_ALBUMARTISTID
*
* MusicBrainz album artist ID
*/
#define GST_TAG_MUSICBRAINZ_ALBUMARTISTID "musicbrainz-albumartistid"
/**
* GST_TAG_MUSICBRAINZ_TRMID
*
* MusicBrainz track TRM ID
*/
#define GST_TAG_MUSICBRAINZ_TRMID "musicbrainz-trmid"
/**
* GST_TAG_MUSICBRAINZ_SORTNAME
*
* MusicBrainz artist sort name
*/
#define GST_TAG_MUSICBRAINZ_SORTNAME "musicbrainz-sortname"
/**
* GST_TAG_CMML_STREAM
*
* Annodex CMML stream element tag
*/
#define GST_TAG_CMML_STREAM "cmml-stream"
/**
* GST_TAG_CMML_HEAD
*
* Annodex CMML head element tag
*/
#define GST_TAG_CMML_HEAD "cmml-head"
/**
* GST_TAG_CMML_CLIP
*
* Annodex CMML clip element tag
*/
#define GST_TAG_CMML_CLIP "cmml-clip"
/* functions for vorbis comment manipulation */
G_CONST_RETURN gchar * gst_tag_from_vorbis_tag (const gchar * vorbis_tag);
G_CONST_RETURN gchar * gst_tag_to_vorbis_tag (const gchar * gst_tag);
void gst_vorbis_tag_add (GstTagList * list,
const gchar * tag,
const gchar * value);
GList * gst_tag_to_vorbis_comments (const GstTagList * list,
const gchar * tag);
/* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */
GstTagList * gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,
const guint8 * id_data,
const guint id_data_length,
gchar ** vendor_string);
GstBuffer * gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
const guint8 * id_data,
const guint id_data_length,
const gchar * vendor_string);
/* functions for ID3 tag manipulation */
guint gst_tag_id3_genre_count (void);
G_CONST_RETURN gchar * gst_tag_id3_genre_get (const guint id);
GstTagList * gst_tag_list_new_from_id3v1 (const guint8 * data);
G_CONST_RETURN gchar * gst_tag_from_id3_tag (const gchar * id3_tag);
G_CONST_RETURN gchar * gst_tag_from_id3_user_tag (const gchar * type,
const gchar * id3_user_tag);
G_CONST_RETURN gchar * gst_tag_to_id3_tag (const gchar * gst_tag);
void gst_tag_register_musicbrainz_tags (void);
G_END_DECLS
#endif /* __GST_TAG_TAG_H__ */

View File

@@ -0,0 +1,58 @@
/* 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_VIDEO_FILTER_H__
#define __GST_VIDEO_FILTER_H__
#include <gst/base/gstbasetransform.h>
G_BEGIN_DECLS
typedef struct _GstVideoFilter GstVideoFilter;
typedef struct _GstVideoFilterClass GstVideoFilterClass;
#define GST_TYPE_VIDEO_FILTER \
(gst_video_filter_get_type())
#define GST_VIDEO_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_FILTER,GstVideoFilter))
#define GST_VIDEO_FILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_FILTER,GstVideoFilterClass))
#define GST_VIDEO_FILTER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VIDEO_FILTER, GstVideoFilterClass))
#define GST_IS_VIDEO_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_FILTER))
#define GST_IS_VIDEO_FILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_FILTER))
struct _GstVideoFilter {
GstBaseTransform element;
gboolean inited;
};
struct _GstVideoFilterClass {
GstBaseTransformClass parent_class;
};
GType gst_video_filter_get_type (void);
G_END_DECLS
#endif /* __GST_VIDEO_FILTER_H__ */

View File

@@ -0,0 +1,88 @@
/*
* GStreamer Video sink.
*
* Copyright (C) <2003> Julien Moutte <julien@moutte.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_VIDEO_SINK_H__
#define __GST_VIDEO_SINK_H__
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
G_BEGIN_DECLS
#define GST_TYPE_VIDEO_SINK (gst_video_sink_get_type())
#define GST_VIDEO_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_SINK, GstVideoSink))
#define GST_VIDEO_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
#define GST_IS_VIDEO_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_SINK))
#define GST_IS_VIDEO_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_SINK))
#define GST_VIDEO_SINK_GET_CLASS(klass) \
(G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
#define GST_VIDEO_SINK_PAD GST_BASE_SINK_PAD
#define GST_VIDEO_SINK_CLOCK GST_BASE_SINK_CLOCK
#define GST_VIDEO_SINK_WIDTH(obj) (GST_VIDEO_SINK (obj)->width)
#define GST_VIDEO_SINK_HEIGHT(obj) (GST_VIDEO_SINK (obj)->height)
typedef struct _GstVideoSink GstVideoSink;
typedef struct _GstVideoSinkClass GstVideoSinkClass;
typedef struct _GstVideoRectangle GstVideoRectangle;
/**
* GstVideoRectangle:
* @x: X coordinate of rectangle's top-left point
* @y: Y coordinate of rectangle's top-left point
* @w: width of the rectangle
* @h: height of the rectangle
*
* Helper structure representing a rectangular area.
*/
struct _GstVideoRectangle {
gint x;
gint y;
gint w;
gint h;
};
struct _GstVideoSink {
GstBaseSink element;
gint width, height;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstVideoSinkClass {
GstBaseSinkClass parent_class;
gpointer _gst_reserved[GST_PADDING];
};
GType gst_video_sink_get_type (void);
void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
GstVideoRectangle *result, gboolean scaling);
G_END_DECLS
#endif /* __GST_VIDEO_SINK_H__ */

View File

@@ -0,0 +1,199 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Library <2002> Ronald Bultje <rbultje@ronald.bitfreak.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_VIDEO_H__
#define __GST_VIDEO_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_VIDEO_BYTE1_MASK_32 "0xFF000000"
#define GST_VIDEO_BYTE2_MASK_32 "0x00FF0000"
#define GST_VIDEO_BYTE3_MASK_32 "0x0000FF00"
#define GST_VIDEO_BYTE4_MASK_32 "0x000000FF"
#define GST_VIDEO_BYTE1_MASK_24 "0x00FF0000"
#define GST_VIDEO_BYTE2_MASK_24 "0x0000FF00"
#define GST_VIDEO_BYTE3_MASK_24 "0x000000FF"
#define GST_VIDEO_BYTE1_MASK_32_INT 0xFF000000
#define GST_VIDEO_BYTE2_MASK_32_INT 0x00FF0000
#define GST_VIDEO_BYTE3_MASK_32_INT 0x0000FF00
#define GST_VIDEO_BYTE4_MASK_32_INT 0x000000FF
#define GST_VIDEO_BYTE1_MASK_24_INT 0x00FF0000
#define GST_VIDEO_BYTE2_MASK_24_INT 0x0000FF00
#define GST_VIDEO_BYTE3_MASK_24_INT 0x000000FF
#define GST_VIDEO_RED_MASK_16 "0xf800"
#define GST_VIDEO_GREEN_MASK_16 "0x07e0"
#define GST_VIDEO_BLUE_MASK_16 "0x001f"
#define GST_VIDEO_RED_MASK_15 "0x7c00"
#define GST_VIDEO_GREEN_MASK_15 "0x03e0"
#define GST_VIDEO_BLUE_MASK_15 "0x001f"
#define GST_VIDEO_RED_MASK_16_INT 0xf800
#define GST_VIDEO_GREEN_MASK_16_INT 0x07e0
#define GST_VIDEO_BLUE_MASK_16_INT 0x001f
#define GST_VIDEO_RED_MASK_15_INT 0x7c00
#define GST_VIDEO_GREEN_MASK_15_INT 0x03e0
#define GST_VIDEO_BLUE_MASK_15_INT 0x001f
#define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
#define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
/* consider the next 2 protected */
#define __GST_VIDEO_CAPS_MAKE_32A(R, G, B, A) \
"video/x-raw-rgb, " \
"bpp = (int) 32, " \
"depth = (int) 32, " \
"endianness = (int) BIG_ENDIAN, " \
"red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", " \
"green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", " \
"blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", " \
"alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE
#define __GST_VIDEO_CAPS_MAKE_32(R, G, B) \
"video/x-raw-rgb, " \
"bpp = (int) 32, " \
"depth = (int) 24, " \
"endianness = (int) BIG_ENDIAN, " \
"red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", " \
"green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", " \
"blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE
#define __GST_VIDEO_CAPS_MAKE_24(R, G, B) \
"video/x-raw-rgb, " \
"bpp = (int) 24, " \
"depth = (int) 24, " \
"endianness = (int) BIG_ENDIAN, " \
"red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_24 ", " \
"green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_24 ", " \
"blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_24 ", " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE
/* 24 bit */
#define GST_VIDEO_CAPS_RGB \
__GST_VIDEO_CAPS_MAKE_24 (1, 2, 3)
#define GST_VIDEO_CAPS_BGR \
__GST_VIDEO_CAPS_MAKE_24 (3, 2, 1)
/* 32 bit */
#define GST_VIDEO_CAPS_RGBx \
__GST_VIDEO_CAPS_MAKE_32 (1, 2, 3)
#define GST_VIDEO_CAPS_xRGB \
__GST_VIDEO_CAPS_MAKE_32 (2, 3, 4)
#define GST_VIDEO_CAPS_BGRx \
__GST_VIDEO_CAPS_MAKE_32 (3, 2, 1)
#define GST_VIDEO_CAPS_xBGR \
__GST_VIDEO_CAPS_MAKE_32 (4, 3, 2)
/* 32 bit alpha */
#define GST_VIDEO_CAPS_RGBA \
__GST_VIDEO_CAPS_MAKE_32A (1, 2, 3, 4)
#define GST_VIDEO_CAPS_ARGB \
__GST_VIDEO_CAPS_MAKE_32A (2, 3, 4, 1)
#define GST_VIDEO_CAPS_BGRA \
__GST_VIDEO_CAPS_MAKE_32A (3, 2, 1, 4)
#define GST_VIDEO_CAPS_ABGR \
__GST_VIDEO_CAPS_MAKE_32A (4, 3, 2, 1)
/* note: the macro name uses the order on BE systems */
#if G_BYTE_ORDER == G_BIG_ENDIAN
#define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
GST_VIDEO_CAPS_xRGB
#define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
GST_VIDEO_CAPS_BGRx
#else
#define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
GST_VIDEO_CAPS_BGRx
#define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
GST_VIDEO_CAPS_xRGB
#endif
/* 15/16 bit */
#define GST_VIDEO_CAPS_RGB_16 \
"video/x-raw-rgb, " \
"bpp = (int) 16, " \
"depth = (int) 16, " \
"endianness = (int) BYTE_ORDER, " \
"red_mask = (int) " GST_VIDEO_RED_MASK_16 ", " \
"green_mask = (int) " GST_VIDEO_GREEN_MASK_16 ", " \
"blue_mask = (int) " GST_VIDEO_BLUE_MASK_16 ", " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE
#define GST_VIDEO_CAPS_RGB_15 \
"video/x-raw-rgb, " \
"bpp = (int) 16, " \
"depth = (int) 15, " \
"endianness = (int) BYTE_ORDER, " \
"red_mask = (int) " GST_VIDEO_RED_MASK_15 ", " \
"green_mask = (int) " GST_VIDEO_GREEN_MASK_15 ", " \
"blue_mask = (int) " GST_VIDEO_BLUE_MASK_15 ", " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE
#define GST_VIDEO_CAPS_YUV(fourcc) \
"video/x-raw-yuv, " \
"format = (fourcc) " fourcc ", " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE
/* functions */
const GValue *gst_video_frame_rate (GstPad *pad);
gboolean gst_video_get_size (GstPad *pad,
gint *width,
gint *height);
gboolean gst_video_calculate_display_ratio (guint *dar_n, guint *dar_d,
guint video_width, guint video_height,
guint video_par_n, guint video_par_d,
guint display_par_n, guint display_par_d);
G_END_DECLS
#endif /* __GST_VIDEO_H__ */