8bbe1c4b119d5cc25244c06766d4cc571caa24e6
[platform/upstream/gstreamer.git] / sys / shm / gstshmsrc.h
1 /* GStreamer
2  * Copyright (C) <2009> Collabora Ltd
3  *  @author: Olivier Crete <olivier.crete@collabora.co.uk
4  * Copyright (C) <2009> Nokia Inc
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 #ifndef __GST_SHM_SRC_H__
23 #define __GST_SHM_SRC_H__
24
25 #include <gst/gst.h>
26 #include <gst/base/gstpushsrc.h>
27 #include <gst/base/gstbasesrc.h>
28
29 #include "shmpipe.h"
30 #ifdef GST_TBM_SUPPORT
31 #include <tbm_bufmgr.h>
32 #endif
33
34 G_BEGIN_DECLS
35 #define GST_TYPE_SHM_SRC \
36   (gst_shm_src_get_type())
37 #define GST_SHM_SRC(obj) \
38   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SHM_SRC,GstShmSrc))
39 #define GST_SHM_SRC_CLASS(klass) \
40   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SHM_SRC,GstShmSrcClass))
41 #define GST_IS_SHM_SRC(obj) \
42   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SHM_SRC))
43 #define GST_IS_SHM_SRC_CLASS(klass) \
44   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SHM_SRC))
45 typedef struct _GstShmSrc GstShmSrc;
46 typedef struct _GstShmSrcClass GstShmSrcClass;
47 typedef struct _GstShmPipe GstShmPipe;
48
49 struct _GstShmSrc
50 {
51   GstPushSrc element;
52
53   gchar *socket_path;
54
55   GstShmPipe *pipe;
56   GstPoll *poll;
57   GstPollFD pollfd;
58
59
60   GstFlowReturn flow_return;
61   gboolean unlocked;
62 #ifdef GST_TBM_SUPPORT
63   gboolean use_tbm;
64   tbm_bufmgr h_bufmgr;
65 #endif
66 };
67
68 struct _GstShmSrcClass
69 {
70   GstPushSrcClass parent_class;
71 };
72
73 GType gst_shm_src_get_type (void);
74
75 struct _GstShmPipe {
76   int use_count;
77
78   GstShmSrc *src;
79   ShmPipe *pipe;
80 };
81
82 G_END_DECLS
83 #endif /* __GST_SHM_SRC_H__ */