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., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, 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 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 G_BEGIN_DECLS
31 
32 #define GST_TYPE_APP_SINK \
33  (gst_app_sink_get_type())
34 #define GST_APP_SINK(obj) \
35  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SINK,GstAppSink))
36 #define GST_APP_SINK_CLASS(klass) \
37  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SINK,GstAppSinkClass))
38 #define GST_IS_APP_SINK(obj) \
39  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SINK))
40 #define GST_IS_APP_SINK_CLASS(klass) \
41  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SINK))
42 
43 typedef struct _GstAppSink GstAppSink;
44 typedef struct _GstAppSinkClass GstAppSinkClass;
45 
47 {
48  GstBaseSink basesink;
49 
50  /*< private >*/
51  GstCaps *caps;
52 
53  GCond *cond;
54  GMutex *mutex;
55  GQueue *queue;
56  GstBuffer *preroll;
57  gboolean started;
58  gboolean is_eos;
59 };
60 
62 {
63  GstBaseSinkClass basesink_class;
64 
65  /* signals */
66  gboolean (*eos) (GstAppSink *sink);
67  gboolean (*new_preroll) (GstAppSink *sink);
68  gboolean (*new_buffer) (GstAppSink *sink);
69 
70  /* actions */
71  GstBuffer * (*pull_preroll) (GstAppSink *sink);
72  GstBuffer * (*pull_buffer) (GstAppSink *sink);
73 };
74 
75 GType gst_app_sink_get_type(void);
76 
77 GST_DEBUG_CATEGORY_EXTERN (app_sink_debug);
78 
79 void gst_app_sink_set_caps (GstAppSink *appsink, const GstCaps *caps);
80 GstCaps * gst_app_sink_get_caps (GstAppSink *appsink);
81 
82 gboolean gst_app_sink_is_eos (GstAppSink *appsink);
83 
84 GstBuffer * gst_app_sink_pull_preroll (GstAppSink *appsink);
85 GstBuffer * gst_app_sink_pull_buffer (GstAppSink *appsink);
86 GstBuffer * gst_app_sink_peek_buffer (GstAppSink *appsink);
87 
88 guint gst_app_sink_get_queue_length (GstAppSink *appsink);
89 
90 gboolean appsink_plugin_init (GstPlugin * plugin);
91 
92 G_END_DECLS
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif
99 
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:159
Generic message header.
Definition: player.h:162
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:658
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:664
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:75
const char * ReadString(int section, const char *name, const char *value)
Read a string value.
Definition: gstappsink.h:47
Definition: gstappsink.h:62
virtual void Main(void)=0
Main method for driver thread.
int ReadInt(int section, const char *name, int value)
Read an integer value.
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:95
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
Class for loading configuration file information.
Definition: configfile.h:197
A device address.
Definition: player.h:146
An autopointer for the message queue.
Definition: message.h:74
#define PLAYER_ERROR(msg)
Error message macros.
Definition: error.h:81
Base class for drivers which oeprate with a thread.
Definition: driver.h:553
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:99
Base class for all drivers.
Definition: driver.h:109
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:76