• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef GST_SHMEM_WRAP_ALLOCATOR_H
17 #define GST_SHMEM_WRAP_ALLOCATOR_H
18 
19 #include <gst/gst.h>
20 #include "gst_shmem_memory.h"
21 #include "avsharedmemory.h"
22 
23 G_BEGIN_DECLS
24 
25 #define GST_TYPE_SHMEM_WRAP_ALLOCATOR (gst_shmem_wrap_allocator_get_type())
26 #define GST_SHMEM_WRAP_ALLOCATOR(obj) \
27     (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_SHMEM_WRAP_ALLOCATOR, GstShMemWrapAllocator))
28 #define GST_SHMEM_WRAP_ALLOCATOR_CLASS(klass) \
29     (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_SHMEM_WRAP_ALLOCATOR, GstShMemWrapAllocatorClass))
30 #define GST_IS_SHMEM_WRAP_ALLOCATOR(obj) \
31     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_SHMEM_WRAP_ALLOCATOR))
32 #define GST_IS_SHMEM_WRAP_ALLOCATOR_CLASS(klass) \
33     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_SHMEM_WRAP_ALLOCATOR))
34 #define GST_SHMEM_WRAP_ALLOCATOR_CAST(obj) ((GstShMemWrapAllocator*)(obj))
35 
36 using GstShMemWrapAllocator = struct _GstShMemWrapAllocator;
37 using GstShMemWrapAllocatorClass = struct _GstShMemWrapAllocatorClass;
38 
39 struct _GstShMemWrapAllocator {
40     GstAllocator parent;
41 };
42 
43 struct _GstShMemWrapAllocatorClass {
44     GstAllocatorClass parent;
45 };
46 
47 GType gst_shmem_wrap_allocator_get_type(void);
48 
49 __attribute__((visibility("default"))) GstShMemWrapAllocator *gst_shmem_wrap_allocator_new(void);
50 __attribute__((visibility("default"))) GstMemory *gst_shmem_wrap(GstAllocator *allocator,
51     std::shared_ptr<OHOS::Media::AVSharedMemory> shmem);
52 
53 G_END_DECLS
54 
55 #endif // GST_SHMEM_WRAP_ALLOCATOR_H