• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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_CONSUMER_SURFACE_POOL_H
17 #define GST_CONSUMER_SURFACE_POOL_H
18 
19 #include <gst/gst.h>
20 #include <gst/video/gstvideopool.h>
21 #include "surface.h"
22 
23 G_BEGIN_DECLS
24 
25 #define GST_TYPE_CONSUMER_SURFACE_POOL (gst_consumer_surface_pool_get_type())
26 #define GST_CONSUMER_SURFACE_POOL(obj) \
27     (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_CONSUMER_SURFACE_POOL, GstConsumerSurfacePool))
28 #define GST_CONSUMER_SURFACE_POOL_CLASS(klass) \
29     (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_CONSUMER_SURFACE_POOL, GstConsumerSurfacePoolClass))
30 #define GST_IS_CONSUMER_SURFACE_POOL(obj) \
31     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_CONSUMER_SURFACE_POOL))
32 #define GST_IS_CONSUMER_SURFACE_POOL_CLASS(klass) \
33     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_CONSUMER_SURFACE_POOL))
34 #define GST_CONSUMER_SURFACE_POOL_CAST(obj) ((GstConsumerSurfacePool*)(obj))
35 
36 typedef struct _GstConsumerSurfacePool GstConsumerSurfacePool;
37 typedef struct _GstConsumerSurfacePoolClass GstConsumerSurfacePoolClass;
38 typedef struct _GstConsumerSurfacePoolPrivate GstConsumerSurfacePoolPrivate;
39 
40 /* 1. The acquire and release functions are overloaded and the queue is no longer used.
41  * 2. GstConsumerSurfacePool is mainly used to maintain the surface buffer.
42  */
43 struct _GstConsumerSurfacePool {
44     GstVideoBufferPool basepool;
45 
46     /* < private > */
47     GstConsumerSurfacePoolPrivate *priv;
48 };
49 
50 struct _GstConsumerSurfacePoolClass {
51     GstVideoBufferPoolClass parent_class;
52 };
53 
54 GType gst_consumer_surface_pool_get_type(void);
55 
56 GstBufferPool *gst_consumer_surface_pool_new();
57 
58 GstCaps *gst_consumer_surface_pool_get_caps(GstConsumerSurfacePool *pool);
59 
60 void gst_consumer_surface_pool_set_surface(GstBufferPool *surfacePool,
61     OHOS::sptr<OHOS::Surface> &consumerSurface);
62 
63 G_END_DECLS
64 
65 #endif
66