2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifndef __GST_BASE_SINK_H__
24 #define __GST_BASE_SINK_H__
31 #define GST_TYPE_BASE_SINK (gst_base_sink_get_type())
32 #define GST_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_SINK,GstBaseSink))
33 #define GST_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_SINK,GstBaseSinkClass))
34 #define GST_BASE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SINK, GstBaseSinkClass))
35 #define GST_IS_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SINK))
36 #define GST_IS_BASE_SINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SINK))
37 #define GST_BASE_SINK_CAST(obj) ((GstBaseSink *) (obj))
41 * @obj: base sink instance
43 * Gives the pointer to the #GstPad object of the element.
45 #define GST_BASE_SINK_PAD(obj) (GST_BASE_SINK_CAST (obj)->sinkpad)
47 typedef struct _GstBaseSink GstBaseSink;
48 typedef struct _GstBaseSinkClass GstBaseSinkClass;
53 * The opaque #GstBaseSink data structure.
60 GstActivateMode pad_mode;
62 /*< protected >*/ /* with LOCK */
64 gboolean can_activate_pull;
65 gboolean can_activate_push;
67 /*< protected >*/ /* with PREROLL_LOCK */
68 GQueue *preroll_queue;
69 gint preroll_queue_max_len;
75 gboolean need_preroll;
76 gboolean have_preroll;
77 gboolean playing_async;
79 /*< protected >*/ /* with STREAM_LOCK */
80 gboolean have_newsegment;
83 /*< private >*/ /* with LOCK */
85 GstClockTime end_time;
90 gpointer _gst_reserved[GST_PADDING];
93 struct _GstBaseSinkClass {
94 GstElementClass parent_class;
96 /* get caps from subclass */
97 GstCaps* (*get_caps) (GstBaseSink *sink);
98 /* notify subclass of new caps */
99 gboolean (*set_caps) (GstBaseSink *sink, GstCaps *caps);
101 /* allocate a new buffer with given caps */
102 GstFlowReturn (*buffer_alloc) (GstBaseSink *sink, guint64 offset, guint size,
103 GstCaps *caps, GstBuffer **buf);
105 /* get the start and end times for syncing on this buffer */
106 void (*get_times) (GstBaseSink *sink, GstBuffer *buffer,
107 GstClockTime *start, GstClockTime *end);
109 /* start and stop processing, ideal for opening/closing the resource */
110 gboolean (*start) (GstBaseSink *sink);
111 gboolean (*stop) (GstBaseSink *sink);
113 /* unlock any pending access to the resource. subclasses should unlock
114 * any function ASAP. */
115 gboolean (*unlock) (GstBaseSink *sink);
117 /* notify subclass of event, preroll buffer or real buffer */
118 gboolean (*event) (GstBaseSink *sink, GstEvent *event);
119 GstFlowReturn (*preroll) (GstBaseSink *sink, GstBuffer *buffer);
120 GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
123 gpointer _gst_reserved[GST_PADDING];
126 GType gst_base_sink_get_type(void);
130 #endif /* __GST_BASE_SINK_H__ */