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_SRC_H__ 17 #define __GST_SURFACE_SRC_H__ 18 19 #include "gst_mem_src.h" 20 #include "iconsumer_surface.h" 21 #include "surface.h" 22 23 G_BEGIN_DECLS 24 25 #define GST_TYPE_SURFACE_SRC (gst_surface_src_get_type()) 26 #define GST_SURFACE_SRC(obj) \ 27 (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_SURFACE_SRC, GstSurfaceSrc)) 28 #define GST_SURFACE_SRC_CLASS(klass) \ 29 (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_SURFACE_SRC, GstSurfaceSrcClass)) 30 #define GST_IS_SURFACE_SRC(obj) \ 31 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_SURFACE_SRC)) 32 #define GST_IS_SURFACE_SRC_CLASS(klass) \ 33 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_SURFACE_SRC)) 34 #define GST_SURFACE_SRC_CAST(obj) ((GstSurfaceSrc*)(obj)) 35 36 typedef struct _GstSurfaceSrc GstSurfaceSrc; 37 typedef struct _GstSurfaceSrcClass GstSurfaceSrcClass; 38 typedef struct _GstSurfaceMemSrcDump GstSurfaceMemSrcDump; 39 40 struct _GstSurfaceMemSrcDump { 41 gboolean enable_dump; 42 FILE *dump_file; 43 }; 44 45 struct _GstSurfaceSrc { 46 GstMemSrc memsrc; 47 OHOS::sptr<OHOS::IConsumerSurface> consumerSurface; 48 OHOS::sptr<OHOS::Surface> producerSurface; 49 GstBufferPool *pool; 50 guint stride; 51 gboolean need_flush; 52 gboolean flushing; 53 GstSurfaceMemSrcDump dump; 54 }; 55 56 struct _GstSurfaceSrcClass { 57 GstMemSrcClass parent_class; 58 }; 59 60 GST_API_EXPORT GType gst_surface_src_get_type(void); 61 62 G_END_DECLS 63 #endif