Doc fixes.
[platform/upstream/gstreamer.git] / libs / gst / base / gstbasesink.h
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wtay@chello.be>
4  *
5  * gstbasesink.h:
6  *
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.
11  *
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.
16  *
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.
21  */
22
23 #ifndef __GST_BASE_SINK_H__
24 #define __GST_BASE_SINK_H__
25
26 #include <gst/gst.h>
27
28 G_BEGIN_DECLS
29
30
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))
38
39 /**
40  * GST_BASE_SINK_PAD:
41  * @obj: base sink instance
42  *
43  * Gives the pointer to the #GstPad object of the element.
44  */
45 #define GST_BASE_SINK_PAD(obj)          (GST_BASE_SINK_CAST (obj)->sinkpad)
46
47 typedef struct _GstBaseSink GstBaseSink;
48 typedef struct _GstBaseSinkClass GstBaseSinkClass;
49
50 /**
51  * GstBaseSink:
52  *
53  * The opaque #GstBaseSink data structure.
54  */
55 struct _GstBaseSink {
56   GstElement     element;
57
58   /*< protected >*/
59   GstPad        *sinkpad;
60   GstActivateMode       pad_mode;
61
62   /*< protected >*/ /* with LOCK */
63   guint64        offset;
64   gboolean       can_activate_pull;
65   gboolean       can_activate_push;
66
67   /*< protected >*/ /* with PREROLL_LOCK */
68   GQueue        *preroll_queue;
69   gint           preroll_queue_max_len;
70   gint           preroll_queued;
71   gint           buffers_queued;
72   gint           events_queued;
73   gboolean       eos;
74   gboolean       eos_queued;
75   gboolean       need_preroll;
76   gboolean       have_preroll;
77   gboolean       playing_async;
78
79   /*< protected >*/ /* with STREAM_LOCK */
80   gboolean       have_newsegment;
81   GstSegment     segment;
82
83   /*< private >*/ /* with LOCK */
84   GstClockID     clock_id;
85   GstClockTime   end_time;
86   gboolean       sync;
87   gboolean       flushing;
88
89   /*< private >*/
90   gpointer       _gst_reserved[GST_PADDING];
91 };
92
93 struct _GstBaseSinkClass {
94   GstElementClass parent_class;
95
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);
100
101   /* allocate a new buffer with given caps */
102   GstFlowReturn (*buffer_alloc) (GstBaseSink *sink, guint64 offset, guint size,
103                                  GstCaps *caps, GstBuffer **buf);
104
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);
108
109   /* start and stop processing, ideal for opening/closing the resource */
110   gboolean      (*start)        (GstBaseSink *sink);
111   gboolean      (*stop)         (GstBaseSink *sink);
112
113   /* unlock any pending access to the resource. subclasses should unlock
114    * any function ASAP. */
115   gboolean      (*unlock)       (GstBaseSink *sink);
116
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);
121
122   /*< private >*/
123   gpointer       _gst_reserved[GST_PADDING];
124 };
125
126 GType gst_base_sink_get_type(void);
127
128 G_END_DECLS
129
130 #endif /* __GST_BASE_SINK_H__ */