2 * Copyright (C) 2019, Collabora Ltd.
3 * Author: George Kiagiadakis <george.kiagiadakis@collabora.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation
8 * version 2.1 of the License.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef __GST_OMX_ALLOCATOR_H__
22 #define __GST_OMX_ALLOCATOR_H__
34 #define GST_OMX_MEMORY_QUARK gst_omx_memory_quark ()
36 #define GST_TYPE_OMX_ALLOCATOR (gst_omx_allocator_get_type())
37 #define GST_IS_OMX_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_OMX_ALLOCATOR))
38 #define GST_OMX_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OMX_ALLOCATOR, GstOMXAllocator))
40 typedef struct _GstOMXMemory GstOMXMemory;
41 typedef struct _GstOMXAllocator GstOMXAllocator;
42 typedef struct _GstOMXAllocatorClass GstOMXAllocatorClass;
45 GST_OMX_ALLOCATOR_FOREIGN_MEM_NONE,
46 GST_OMX_ALLOCATOR_FOREIGN_MEM_DMABUF,
47 #ifdef TIZEN_FEATURE_OMX
48 GST_OMX_ALLOCATOR_FOREIGN_MEM_TBM,
50 GST_OMX_ALLOCATOR_FOREIGN_MEM_OTHER_POOL,
51 } GstOMXAllocatorForeignMemMode;
58 /* TRUE if the memory is in use outside the allocator */
61 /* memory allocated from the foreign_allocator
62 * or planted externally when using a foreign buffer pool */
63 GstMemory *foreign_mem;
65 /* the original dispose function of foreign_mem */
66 GstMiniObjectDisposeFunction foreign_dispose;
69 struct _GstOMXAllocator
73 GstOMXComponent *component;
76 GstOMXAllocatorForeignMemMode foreign_mode;
77 GstAllocator *foreign_allocator;
79 /* array of GstOMXMemory */
88 #ifdef TIZEN_FEATURE_OMX
89 GstVideoInfo video_info;
93 struct _GstOMXAllocatorClass
95 GstAllocatorClass parent_class;
98 GType gst_omx_allocator_get_type (void);
100 GQuark gst_omx_memory_quark (void);
102 GstOMXBuffer * gst_omx_memory_get_omx_buf (GstMemory * mem);
104 GstOMXAllocator * gst_omx_allocator_new (GstOMXComponent * component,
107 gboolean gst_omx_allocator_configure (GstOMXAllocator * allocator, guint count,
108 GstOMXAllocatorForeignMemMode mode);
109 gboolean gst_omx_allocator_set_active (GstOMXAllocator * allocator,
111 void gst_omx_allocator_wait_inactive (GstOMXAllocator * allocator);
113 GstFlowReturn gst_omx_allocator_acquire (GstOMXAllocator * allocator,
114 GstMemory ** memory, gint index, GstOMXBuffer * omx_buf);
116 GstMemory * gst_omx_allocator_allocate (GstOMXAllocator * allocator, gint index,
117 GstMemory * foreign_mem);