gst: Update for GST_PLUGIN_DEFINE() API change
[platform/upstream/gstreamer.git] / sys / xvimage / xvimagepool.h
1 /* GStreamer
2  * Copyright (C) <2005> Julien Moutte <julien@moutte.net>
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_XVIMAGEPOOL_H__
21 #define __GST_XVIMAGEPOOL_H__
22
23 #ifdef HAVE_XSHM
24 #include <sys/types.h>
25 #include <sys/ipc.h>
26 #include <sys/shm.h>
27 #endif /* HAVE_XSHM */
28
29 #include <X11/Xlib.h>
30 #include <X11/Xutil.h>
31
32 #ifdef HAVE_XSHM
33 #include <X11/extensions/XShm.h>
34 #endif /* HAVE_XSHM */
35
36 #include <string.h>
37 #include <math.h>
38
39
40 G_BEGIN_DECLS
41
42 typedef struct _GstXvImageMeta GstXvImageMeta;
43
44 typedef struct _GstXvImageBufferPool GstXvImageBufferPool;
45 typedef struct _GstXvImageBufferPoolClass GstXvImageBufferPoolClass;
46 typedef struct _GstXvImageBufferPoolPrivate GstXvImageBufferPoolPrivate;
47
48 #include "xvimagesink.h"
49
50 GType gst_xvimage_meta_api_get_type (void);
51 #define GST_XVIMAGE_META_API_TYPE  (gst_xvimage_meta_api_get_type())
52 const GstMetaInfo * gst_xvimage_meta_get_info (void);
53 #define GST_XVIMAGE_META_INFO  (gst_xvimage_meta_get_info())
54
55 #define gst_buffer_get_xvimage_meta(b) ((GstXvImageMeta*)gst_buffer_get_meta((b),GST_XVIMAGE_META_API_TYPE))
56
57 /**
58  * GstXvImageMeta:
59  * @sink: a reference to the our #GstXvImageSink
60  * @xvimage: the XvImage of this buffer
61  * @width: the width in pixels of XvImage @xvimage
62  * @height: the height in pixels of XvImage @xvimage
63  * @im_format: the format of XvImage @xvimage
64  * @size: the size in bytes of XvImage @xvimage
65  *
66  * Subclass of #GstMeta containing additional information about an XvImage.
67  */
68 struct _GstXvImageMeta
69 {
70   GstMeta meta;
71
72   /* Reference to the xvimagesink we belong to */
73   GstXvImageSink *sink;
74
75   XvImage *xvimage;
76
77 #ifdef HAVE_XSHM
78   XShmSegmentInfo SHMInfo;
79 #endif                          /* HAVE_XSHM */
80
81   gint x, y;
82   gint width, height;
83   gint im_format;
84   size_t size;
85 };
86
87 /* buffer pool functions */
88 #define GST_TYPE_XVIMAGE_BUFFER_POOL      (gst_xvimage_buffer_pool_get_type())
89 #define GST_IS_XVIMAGE_BUFFER_POOL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_XVIMAGE_BUFFER_POOL))
90 #define GST_XVIMAGE_BUFFER_POOL(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_XVIMAGE_BUFFER_POOL, GstXvImageBufferPool))
91 #define GST_XVIMAGE_BUFFER_POOL_CAST(obj) ((GstXvImageBufferPool*)(obj))
92
93 struct _GstXvImageBufferPool
94 {
95   GstBufferPool bufferpool;
96
97   GstXvImageSink *sink;
98
99   GstXvImageBufferPoolPrivate *priv;
100 };
101
102 struct _GstXvImageBufferPoolClass
103 {
104   GstBufferPoolClass parent_class;
105 };
106
107 GType gst_xvimage_buffer_pool_get_type (void);
108
109 GstBufferPool *gst_xvimage_buffer_pool_new (GstXvImageSink * xvimagesink);
110
111 gboolean gst_xvimagesink_check_xshm_calls (GstXvImageSink * xvimagesink,
112       GstXContext * xcontext);
113
114 gint gst_xvimagesink_get_format_from_info (GstXvImageSink * xvimagesink,
115     GstVideoInfo * info);
116
117 G_END_DECLS
118
119 #endif /*__GST_XVIMAGEPOOL_H__*/