| GStreamer 0.9 Core Reference Manual |
|---|
GstBaseSrcGstBaseSrc — Base class for getrange based source elements |
#include <gst/base/gstbasesrc.h>
GstBaseSrc;
GstBaseSrcClass;
enum GstBaseSrcFlags;
gboolean gst_base_src_is_live (GstBaseSrc *src);
void gst_base_src_set_live (GstBaseSrc *src,
gboolean live);
#define GST_BASE_SRC_PAD (obj)
GObject +----GstObject +----GstElement +----GstBaseSrc +----GstFakeSrc +----GstFileSrc +----GstPushSrc
This class is mostly useful for elements that do byte based access to a random access resource, like files. If random access is not possible, the live-mode should be set to TRUE.
one sinkpad
handles state changes
does flushing
preroll with optional preview
pull/push mode
EOS handling
typedef struct {
/* 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) */
gint64 segment_start; /* start and end positions for seeking */
gint64 segment_end;
gboolean segment_loop;
gboolean need_discont;
guint64 offset; /* current offset in the resource */
guint64 size; /* total size of the resource */
gint num_buffers;
gint num_buffers_left;
} GstBaseSrc;
typedef struct {
GstElementClass parent_class;
/* 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);
/* 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);
} GstBaseSrcClass;
typedef enum {
GST_BASE_SRC_STARTED = GST_ELEMENT_FLAG_LAST,
GST_BASE_SRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2
} GstBaseSrcFlags;
gboolean gst_base_src_is_live (GstBaseSrc *src);
Check if an element is in live mode.
src : |
base source instance |
| Returns : | TRUE if element is in live mode.
|
void gst_base_src_set_live (GstBaseSrc *src, gboolean live);
If the element listens to a live source, the livemode should
be set to TRUE. This declares that this source can't seek.
src : |
base source instance |
live : |
new live-mode |
| << GstAdapter | GstBaseSink >> |