• 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 #include "config.h"
16 #include "gst_surface_mem_sink.h"
17 #include "gst_shared_mem_sink.h"
18 #include "gst_video_display_sink.h"
19 
check_and_log(gboolean need_log,const char * log)20 static inline void check_and_log(gboolean need_log, const char *log)
21 {
22     if (need_log) {
23         GST_WARNING_OBJECT(nullptr, "pulgin %s", log);
24     }
25 }
26 
plugin_init(GstPlugin * plugin)27 static gboolean plugin_init(GstPlugin *plugin)
28 {
29     g_return_val_if_fail(plugin != nullptr, false);
30     gboolean ret = gst_element_register(plugin, "surfacememsink", GST_RANK_PRIMARY, GST_TYPE_SURFACE_MEM_SINK);
31     check_and_log(ret == FALSE, "register surfacememsink failed");
32     ret = gst_element_register(plugin, "sharedmemsink", GST_RANK_PRIMARY, GST_TYPE_SHARED_MEM_SINK);
33     check_and_log(ret == FALSE, "register sharedmemsink failed");
34     ret = gst_element_register(plugin, "videodisplaysink", GST_RANK_PRIMARY, GST_TYPE_VIDEO_DISPLAY_SINK);
35     check_and_log(ret == FALSE, "register videodisplaysink failed");
36     return TRUE;
37 }
38 
39 GST_PLUGIN_DEFINE(GST_VERSION_MAJOR,
40     GST_VERSION_MINOR,
41     _mem_sink,
42     "GStreamer Memory Sink",
43     plugin_init,
44     PACKAGE_VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
45