Merge branch 'master' into 0.11
[platform/upstream/gstreamer.git] / gst-libs / gst / app / gstappsink.h
1 /* GStreamer
2  * Copyright (C) 2007 David Schleef <ds@schleef.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef _GST_APP_SINK_H_
21 #define _GST_APP_SINK_H_
22
23 #include <gst/gst.h>
24 #include <gst/base/gstbasesink.h>
25
26 G_BEGIN_DECLS
27
28 #define GST_TYPE_APP_SINK \
29   (gst_app_sink_get_type())
30 #define GST_APP_SINK(obj) \
31   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SINK,GstAppSink))
32 #define GST_APP_SINK_CLASS(klass) \
33   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SINK,GstAppSinkClass))
34 #define GST_IS_APP_SINK(obj) \
35   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SINK))
36 #define GST_IS_APP_SINK_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SINK))
38 /* Since 0.10.23 */
39 #define GST_APP_SINK_CAST(obj) \
40   ((GstAppSink*)(obj))
41
42 typedef struct _GstAppSink GstAppSink;
43 typedef struct _GstAppSinkClass GstAppSinkClass;
44 typedef struct _GstAppSinkPrivate GstAppSinkPrivate;
45
46 /**
47  * GstAppSinkCallbacks:
48  * @eos: Called when the end-of-stream has been reached. This callback
49  *       is called from the steaming thread.
50  * @new_preroll: Called when a new preroll sample is available.
51  *       This callback is called from the steaming thread.
52  *       The new preroll sample can be retrieved with
53  *       gst_app_sink_pull_preroll() either from this callback
54  *       or from any other thread.
55  * @new_sample: Called when a new sample is available.
56  *       This callback is called from the steaming thread.
57  *       The new sample can be retrieved with
58  *       gst_app_sink_pull_sample() either from this callback
59  *       or from any other thread.
60  *
61  * A set of callbacks that can be installed on the appsink with
62  * gst_app_sink_set_callbacks().
63  *
64  * Since: 0.10.23
65  */
66 typedef struct {
67   void          (*eos)              (GstAppSink *sink, gpointer user_data);
68   GstFlowReturn (*new_preroll)      (GstAppSink *sink, gpointer user_data);
69   GstFlowReturn (*new_sample)       (GstAppSink *sink, gpointer user_data);
70
71   /*< private >*/
72   gpointer     _gst_reserved[GST_PADDING];
73 } GstAppSinkCallbacks;
74
75 struct _GstAppSink
76 {
77   GstBaseSink basesink;
78
79   /*< private >*/
80   GstAppSinkPrivate *priv;
81
82   /*< private >*/
83   gpointer     _gst_reserved[GST_PADDING];
84 };
85
86 struct _GstAppSinkClass
87 {
88   GstBaseSinkClass basesink_class;
89
90   /* signals */
91   void        (*eos)              (GstAppSink *sink);
92   void        (*new_preroll)      (GstAppSink *sink);
93   void        (*new_sample)       (GstAppSink *sink);
94
95   /* actions */
96   GstSample     * (*pull_preroll)      (GstAppSink *sink);
97   GstSample     * (*pull_sample)       (GstAppSink *sink);
98
99   /*< private >*/
100   gpointer     _gst_reserved[GST_PADDING];
101 };
102
103 GType gst_app_sink_get_type(void);
104
105 void            gst_app_sink_set_caps         (GstAppSink *appsink, const GstCaps *caps);
106 GstCaps *       gst_app_sink_get_caps         (GstAppSink *appsink);
107
108 gboolean        gst_app_sink_is_eos           (GstAppSink *appsink);
109
110 void            gst_app_sink_set_emit_signals (GstAppSink *appsink, gboolean emit);
111 gboolean        gst_app_sink_get_emit_signals (GstAppSink *appsink);
112
113 void            gst_app_sink_set_max_buffers  (GstAppSink *appsink, guint max);
114 guint           gst_app_sink_get_max_buffers  (GstAppSink *appsink);
115
116 void            gst_app_sink_set_drop         (GstAppSink *appsink, gboolean drop);
117 gboolean        gst_app_sink_get_drop         (GstAppSink *appsink);
118
119 GstSample *     gst_app_sink_pull_preroll     (GstAppSink *appsink);
120 GstSample *     gst_app_sink_pull_sample      (GstAppSink *appsink);
121
122 void            gst_app_sink_set_callbacks    (GstAppSink * appsink,
123                                                GstAppSinkCallbacks *callbacks,
124                                                gpointer user_data,
125                                                GDestroyNotify notify);
126
127 G_END_DECLS
128
129 #endif
130