]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/blob - libs/gst/base/gstbasesink.h
gst/base/gstbasesink.*: Repost EOS message while going to PLAYING if still EOS.
[glsdk/gstreamer0-10.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  */
23 #ifndef __GST_BASE_SINK_H__
24 #define __GST_BASE_SINK_H__
26 #include <gst/gst.h>
28 G_BEGIN_DECLS
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))
38 /**
39  * GST_BASE_SINK_CLOCK:
40  * @obj: base sink instance
41  *
42  * Gives the pointer to the #GstClock object of the element.
43  */
44 #define GST_BASE_SINK_CLOCK(obj)        (GST_BASE_SINK (obj)->clock)
45 /**
46  * GST_BASE_SINK_PAD:
47  * @obj: base sink instance
48  *
49  * Gives the pointer to the #GstPad object of the element.
50  */
51 #define GST_BASE_SINK_PAD(obj)          (GST_BASE_SINK (obj)->sinkpad)
53 typedef struct _GstBaseSink GstBaseSink;
54 typedef struct _GstBaseSinkClass GstBaseSinkClass;
56 struct _GstBaseSink {
57   GstElement     element;
59   /*< protected >*/
60   GstPad        *sinkpad;
61   GstActivateMode       pad_mode;
63   /*< protected >*/ /* with LOCK */
64   guint64        offset;
65   gboolean       can_activate_pull;
66   gboolean       can_activate_push;
68   /*< protected >*/ /* with PREROLL_LOCK */
69   GQueue        *preroll_queue;
70   gint           preroll_queue_max_len;
71   gint           preroll_queued;
72   gint           buffers_queued;
73   gint           events_queued;
74   gboolean       eos;
75   gboolean       eos_queued;
76   gboolean       need_preroll;
77   gboolean       have_preroll;
78   gboolean       playing_async;
80   /*< protected >*/ /* with STREAM_LOCK */
81   gboolean       have_newsegment;
82   gdouble        segment_rate;
83   gint64         segment_start;
84   gint64         segment_stop;
85   gint64         segment_base;
86   gint64         segment_accum;
88   gint64         current_start;
89   gint64         current_duration;
90   gint64         current_end;
92   /*< private >*/ /* with LOCK */
93   GstClock      *clock;
94   GstClockID     clock_id;
95   GstClockTime   end_time;
96   gboolean       sync;
97   gboolean       flushing;
99   /*< private >*/
100   gpointer       _gst_reserved[GST_PADDING];
101 };
103 struct _GstBaseSinkClass {
104   GstElementClass parent_class;
106   /* get caps from subclass */
107   GstCaps*      (*get_caps)     (GstBaseSink *sink);
108   /* notify subclass of new caps */
109   gboolean      (*set_caps)     (GstBaseSink *sink, GstCaps *caps);
111   /* allocate a new buffer with given caps */
112   GstFlowReturn (*buffer_alloc) (GstBaseSink *sink, guint64 offset, guint size,
113                                  GstCaps *caps, GstBuffer **buf);
115   /* get the start and end times for syncing on this buffer */
116   void          (*get_times)    (GstBaseSink *sink, GstBuffer *buffer,
117                                  GstClockTime *start, GstClockTime *end);
119   /* start and stop processing, ideal for opening/closing the resource */
120   gboolean      (*start)        (GstBaseSink *sink);
121   gboolean      (*stop)         (GstBaseSink *sink);
123   /* unlock any pending access to the resource. subclasses should unlock
124    * any function ASAP. */
125   gboolean      (*unlock)       (GstBaseSink *sink);
127   /* notify subclass of event, preroll buffer or real buffer */
128   gboolean      (*event)        (GstBaseSink *sink, GstEvent *event);
129   GstFlowReturn (*preroll)      (GstBaseSink *sink, GstBuffer *buffer);
130   GstFlowReturn (*render)       (GstBaseSink *sink, GstBuffer *buffer);
132   /*< private >*/
133   gpointer       _gst_reserved[GST_PADDING];
134 };
136 GType gst_base_sink_get_type(void);
138 G_END_DECLS
140 #endif /* __GST_BASE_SINK_H__ */