Merging gst-plugins-ugly
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / ext / wayland / wlshmallocator.h
1 /* GStreamer Wayland video sink
2  *
3  * Copyright (C) 2012 Intel Corporation
4  * Copyright (C) 2012 Sreerenj Balachandran <sreerenj.balachandran@intel.com>
5  * Copyright (C) 2014 Collabora Ltd.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifndef __GST_WL_SHM_ALLOCATOR_H__
24 #define __GST_WL_SHM_ALLOCATOR_H__
25
26 #include <gst/video/video.h>
27 #include <gst/allocators/allocators.h>
28 #include <wayland-client-protocol.h>
29 #include "wldisplay.h"
30
31 G_BEGIN_DECLS
32
33 #define GST_TYPE_WL_SHM_ALLOCATOR                  (gst_wl_shm_allocator_get_type ())
34 #define GST_WL_SHM_ALLOCATOR(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_SHM_ALLOCATOR, GstWlShmAllocator))
35 #define GST_IS_WL_SHM_ALLOCATOR(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_SHM_ALLOCATOR))
36 #define GST_WL_SHM_ALLOCATOR_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_SHM_ALLOCATOR, GstWlShmAllocatorClass))
37 #define GST_IS_WL_SHM_ALLOCATOR_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_SHM_ALLOCATOR))
38 #define GST_WL_SHM_ALLOCATOR_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_SHM_ALLOCATOR, GstWlShmAllocatorClass))
39
40 #define GST_ALLOCATOR_WL_SHM "wl_shm"
41
42 typedef struct _GstWlShmAllocator GstWlShmAllocator;
43 typedef struct _GstWlShmAllocatorClass GstWlShmAllocatorClass;
44
45 struct _GstWlShmAllocator
46 {
47   GstFdAllocator parent_instance;
48 };
49
50 struct _GstWlShmAllocatorClass
51 {
52   GstFdAllocatorClass parent_class;
53 };
54
55 GType gst_wl_shm_allocator_get_type (void);
56
57 void gst_wl_shm_allocator_register (void);
58 GstAllocator * gst_wl_shm_allocator_get (void);
59
60 gboolean gst_is_wl_shm_memory (GstMemory * mem);
61 struct wl_buffer * gst_wl_shm_memory_construct_wl_buffer (GstMemory * mem,
62     GstWlDisplay * display, const GstVideoInfo * info);
63
64 G_END_DECLS
65
66 #endif /* __GST_WL_SHM_ALLOCATOR_H__ */