• 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_SURFACE_MEM_SINK_H
17 #define GST_SURFACE_MEM_SINK_H
18 
19 #include <cstdio>
20 #include "gst_mem_sink.h"
21 
22 G_BEGIN_DECLS
23 
24 #define GST_TYPE_SURFACE_MEM_SINK (gst_surface_mem_sink_get_type())
25 #define GST_SURFACE_MEM_SINK(obj) \
26     (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_SURFACE_MEM_SINK, GstSurfaceMemSink))
27 #define GST_SURFACE_MEM_SINK_CLASS(klass) \
28     (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_SURFACE_MEM_SINK, GstSurfaceMemSinkClass))
29 #define GST_IS_SURFACE_MEM_SINK(obj) \
30     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_SURFACE_MEM_SINK))
31 #define GST_IS_SURFACE_MEM_SINK_CLASS(klass) \
32     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_SURFACE_MEM_SINK))
33 #define GST_SURFACE_MEM_SINK_CAST(obj) ((GstSurfaceMemSink*)(obj))
34 #define GST_SURFACE_MEM_SINK_GET_CLASS(obj) \
35     (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_SURFACE_MEM_SINK, GstSurfaceMemSinkClass))
36 
37 typedef struct _GstSurfaceMemSink GstSurfaceMemSink;
38 typedef struct _GstSurfaceMemSinkClass GstSurfaceMemSinkClass;
39 typedef struct _GstSurfaceMemSinkPrivate GstSurfaceMemSinkPrivate;
40 typedef struct _GstSurfaceMemSinkDump GstSurfaceMemSinkDump;
41 
42 struct _GstSurfaceMemSinkDump {
43     gboolean enable_dump;
44     FILE *dump_file;
45 };
46 
47 struct _GstSurfaceMemSink {
48     GstMemSink memsink;
49     GstBuffer *prerollBuffer;
50     gboolean firstRenderFrame;
51     gboolean setRateEvent;
52     gdouble curRate;
53     gboolean preInitPool;
54     gboolean performanceMode;
55     /* < private > */
56     GstSurfaceMemSinkPrivate *priv;
57     GstSurfaceMemSinkDump dump;
58     GstCaps *caps;
59     guint lastRate;
60     guint renderCnt;
61 };
62 
63 struct _GstSurfaceMemSinkClass {
64     GstMemSinkClass basesink_class;
65     GstFlowReturn (*do_app_render) (GstSurfaceMemSink *memsink, GstBuffer *buffer, bool is_preroll);
66 };
67 
68 GST_API_EXPORT GType gst_surface_mem_sink_get_type(void);
69 
70 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
71 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstSurfaceMemSink, gst_object_unref)
72 #endif
73 
74 G_END_DECLS
75 #endif
76