gstappsink.h 4.12 KB
Newer Older
David Schleef's avatar
David Schleef committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* GStreamer
 * Copyright (C) 2007 David Schleef <ds@schleef.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef _GST_APP_SINK_H_
#define _GST_APP_SINK_H_

#include <gst/gst.h>
#include <gst/base/gstbasesink.h>

G_BEGIN_DECLS

#define GST_TYPE_APP_SINK \
  (gst_app_sink_get_type())
#define GST_APP_SINK(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SINK,GstAppSink))
#define GST_APP_SINK_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SINK,GstAppSinkClass))
#define GST_IS_APP_SINK(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SINK))
#define GST_IS_APP_SINK_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SINK))

typedef struct _GstAppSink GstAppSink;
typedef struct _GstAppSinkClass GstAppSinkClass;
41
typedef struct _GstAppSinkPrivate GstAppSinkPrivate;
David Schleef's avatar
David Schleef committed
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
 * GstAppSinkCallbacks:
 * @eos: Signal that the end-of-stream has been reached. This signal is
 *       emited from the steaming thread.
 * @new_preroll: Signal that a new preroll buffer is available. 
 *       This signal is emited from the steaming thread.
 *       The new preroll buffer can be retrieved with
 *       gst_app_sink_pull_preroll() either from this callback
 *       or from any other thread.
 * @new_buffer: Signal that a new buffer is available. 
 *       This signal is emited from the steaming thread.
 *       The new buffer can be retrieved with
 *       gst_app_sink_pull_buffer() either from this callback
 *       or from any other thread.
 *
 * A set of callbacks that can be installed on the appsink with
 * gst_app_sink_set_callbacks().
 *
 * Since: 0.10.23
 */
typedef struct {
  void (*eos)           (GstAppSink *sink, gpointer user_data);
  void (*new_preroll)   (GstAppSink *sink, gpointer user_data);
  void (*new_buffer)    (GstAppSink *sink, gpointer user_data);
} GstAppSinkCallbacks;

David Schleef's avatar
David Schleef committed
69
70
71
72
73
struct _GstAppSink
{
  GstBaseSink basesink;

  /*< private >*/
74
75
76
77
  GstAppSinkPrivate *priv;

  /*< private >*/
  gpointer     _gst_reserved[GST_PADDING];
David Schleef's avatar
David Schleef committed
78
79
80
81
82
};

struct _GstAppSinkClass
{
  GstBaseSinkClass basesink_class;
83
84

  /* signals */
85
86
87
  void        (*eos)          (GstAppSink *sink);
  void        (*new_preroll)  (GstAppSink *sink);
  void        (*new_buffer)   (GstAppSink *sink);
88
89
90
91

  /* actions */
  GstBuffer * (*pull_preroll)  (GstAppSink *sink);
  GstBuffer * (*pull_buffer)   (GstAppSink *sink);
92
93
94

  /*< private >*/
  gpointer     _gst_reserved[GST_PADDING];
David Schleef's avatar
David Schleef committed
95
96
97
98
};

GType gst_app_sink_get_type(void);

99
100
void            gst_app_sink_set_caps         (GstAppSink *appsink, const GstCaps *caps);
GstCaps *       gst_app_sink_get_caps         (GstAppSink *appsink);
101

102
gboolean        gst_app_sink_is_eos           (GstAppSink *appsink);
103

104
105
106
107
108
109
void            gst_app_sink_set_emit_signals (GstAppSink *appsink, gboolean emit);
gboolean        gst_app_sink_get_emit_signals (GstAppSink *appsink);

void            gst_app_sink_set_max_buffers  (GstAppSink *appsink, guint max);
guint           gst_app_sink_get_max_buffers  (GstAppSink *appsink);

110
111
112
void            gst_app_sink_set_drop         (GstAppSink *appsink, gboolean drop);
gboolean        gst_app_sink_get_drop         (GstAppSink *appsink);

113
114
GstBuffer *     gst_app_sink_pull_preroll     (GstAppSink *appsink);
GstBuffer *     gst_app_sink_pull_buffer      (GstAppSink *appsink);
David Schleef's avatar
David Schleef committed
115

116
117
118
119
120
void            gst_app_sink_set_callbacks    (GstAppSink * appsink,
                                               GstAppSinkCallbacks *callbacks,
					       gpointer user_data,
					       GDestroyNotify notify);

David Schleef's avatar
David Schleef committed
121
122
123
124
G_END_DECLS

#endif