2 * Copyright (C) 2007 David Schleef <ds@schleef.org>
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.
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.
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.
20 #ifndef _GST_APP_SINK_H_
21 #define _GST_APP_SINK_H_
24 #include <gst/base/gstbasesink.h>
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))
39 #define GST_APP_SINK_CAST(obj) \
42 typedef struct _GstAppSink GstAppSink;
43 typedef struct _GstAppSinkClass GstAppSinkClass;
44 typedef struct _GstAppSinkPrivate GstAppSinkPrivate;
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 buffer is available.
51 * This callback is called from the steaming thread.
52 * The new preroll buffer can be retrieved with
53 * gst_app_sink_pull_preroll() either from this callback
54 * or from any other thread.
55 * @new_buffer: Called when a new buffer is available.
56 * This callback is called from the steaming thread.
57 * The new buffer can be retrieved with
58 * gst_app_sink_pull_buffer() either from this callback
59 * or from any other thread.
60 * @new_buffer_list: Called when a new bufferlist is available.
61 * This callback is called from the steaming thread.
62 * The new bufferlist can be retrieved with
63 * gst_app_sink_pull_buffer_list() either from this callback
64 * or from any other thread.
66 * A set of callbacks that can be installed on the appsink with
67 * gst_app_sink_set_callbacks().
72 void (*eos) (GstAppSink *sink, gpointer user_data);
73 GstFlowReturn (*new_preroll) (GstAppSink *sink, gpointer user_data);
74 GstFlowReturn (*new_buffer) (GstAppSink *sink, gpointer user_data);
75 GstFlowReturn (*new_buffer_list) (GstAppSink *sink, gpointer user_data);
78 gpointer _gst_reserved[GST_PADDING - 1];
79 } GstAppSinkCallbacks;
86 GstAppSinkPrivate *priv;
89 gpointer _gst_reserved[GST_PADDING];
92 struct _GstAppSinkClass
94 GstBaseSinkClass basesink_class;
97 void (*eos) (GstAppSink *sink);
98 void (*new_preroll) (GstAppSink *sink);
99 void (*new_buffer) (GstAppSink *sink);
102 GstBuffer * (*pull_preroll) (GstAppSink *sink);
103 GstBuffer * (*pull_buffer) (GstAppSink *sink);
106 GstBufferList * (*new_buffer_list) (GstAppSink *sink);
107 GstBufferList * (*pull_buffer_list) (GstAppSink *sink);
110 gpointer _gst_reserved[GST_PADDING - 2];
113 GType gst_app_sink_get_type(void);
115 void gst_app_sink_set_caps (GstAppSink *appsink, const GstCaps *caps);
116 GstCaps * gst_app_sink_get_caps (GstAppSink *appsink);
118 gboolean gst_app_sink_is_eos (GstAppSink *appsink);
120 void gst_app_sink_set_emit_signals (GstAppSink *appsink, gboolean emit);
121 gboolean gst_app_sink_get_emit_signals (GstAppSink *appsink);
123 void gst_app_sink_set_max_buffers (GstAppSink *appsink, guint max);
124 guint gst_app_sink_get_max_buffers (GstAppSink *appsink);
126 void gst_app_sink_set_drop (GstAppSink *appsink, gboolean drop);
127 gboolean gst_app_sink_get_drop (GstAppSink *appsink);
129 GstBuffer * gst_app_sink_pull_preroll (GstAppSink *appsink);
130 GstBuffer * gst_app_sink_pull_buffer (GstAppSink *appsink);
131 GstBufferList * gst_app_sink_pull_buffer_list (GstAppSink *appsink);
133 void gst_app_sink_set_callbacks (GstAppSink * appsink,
134 GstAppSinkCallbacks *callbacks,
136 GDestroyNotify notify);