Files
svcmobrel-release c1ffb64e04 Updating prebuilts and/or headers
da5475c4506f0f70011e5723f4f3e1e7368a0554 - nvbufsurface.h
9a172f748a2b8f4d6d15648ea353989ccc7aeba6 - gst-plugins-nv-video-sinks/Makefile
9825d8a113dbf7dd16f791ff1ca66f2de3047b22 - gst-plugins-nv-video-sinks/LICENSE.libgstnvvideosinks
7ef56486c9e6b3e354473a2959d274517dd709da - gst-plugins-nv-video-sinks/gstnvvideosinks.c
de3e1e648709f765fbe78b5c365017f573ca1988 - gst-plugins-nv-video-sinks/common/context.c
b38008a552820bac7742888cd4bc2610bca722eb - gst-plugins-nv-video-sinks/common/display.c
3b014cb69f5042fd9752fd4bf06a5873fe08b41c - gst-plugins-nv-video-sinks/common/renderer.c
96b0b4d38692a0aecf70944749684ac938ff192f - gst-plugins-nv-video-sinks/common/display.h
6e77d54ffc5d1a49d5bad768cdf5cfadf458f1f7 - gst-plugins-nv-video-sinks/common/window.h
d48e1dae85e3c6a0ba7623be7ee306b8e1ef6695 - gst-plugins-nv-video-sinks/common/gstnvvideofwd.h
835dc89a20f2a95bea9c4033e40bf6787148ab08 - gst-plugins-nv-video-sinks/common/window.c
72f9a4b823c4162c9f22cedb7c1cb1764d06fcb6 - gst-plugins-nv-video-sinks/common/renderer.h
5e13200e9cba5f45d74cf6899dd3356d5f5d1c8e - gst-plugins-nv-video-sinks/common/context.h
638b0da4ea65d02818289e89bc1d635ddbcdaec5 - gst-plugins-nv-video-sinks/common/x11/window_x11.h
b3f1b67cae0b4643f6a676b362ceaa61abc9c40f - gst-plugins-nv-video-sinks/common/x11/display_x11.c
d692399c6d94dbc7814770b08baf9271ed97f8e0 - gst-plugins-nv-video-sinks/common/x11/display_x11.h
c98945083e215dff26507c1e10b0ebf62a2c6fb7 - gst-plugins-nv-video-sinks/common/x11/window_x11.c
536a072a8ef84b3c91307777f88121fb88df2c4f - gst-plugins-nv-video-sinks/common/egl/context_egl.h
ad6be303e104ee7fbe2845a7697bc39e575a3e52 - gst-plugins-nv-video-sinks/common/egl/context_egl.c
707a36267f329bb22afdd19b947be5a99478ec7a - gst-plugins-nv-video-sinks/common/renderer/renderer_gl.c
f528404a796de5a23dab281588feb72f42343e59 - gst-plugins-nv-video-sinks/common/renderer/renderer_gl.h
9b7125a2d7ebe2ea647c43d2eb43e8d04cd16c47 - gst-plugins-nv-video-sinks/nv3dsink/gstnv3dsink.h
f8cd771fc3695e957a02665e9eb1a1c6fb9b0572 - gst-plugins-nv-video-sinks/nv3dsink/gstnv3dsink.c

Change-Id: I134b1430c8464c60910e39aa4929e4b769639c51
2023-12-05 20:48:35 -08:00

112 lines
2.7 KiB
C

/*
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License, version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "display.h"
#include "context.h"
#include "window.h"
#if NV_VIDEO_SINKS_HAS_X11
#include "display_x11.h"
#endif
#define GST_CAT_DEFAULT gst_debug_nv_video_display
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
G_DEFINE_ABSTRACT_TYPE (GstNvVideoDisplay, gst_nv_video_display,
GST_TYPE_OBJECT);
GstNvVideoDisplayType
gst_nv_video_display_get_handle_type (GstNvVideoDisplay * display)
{
g_return_val_if_fail (GST_IS_NV_VIDEO_DISPLAY (display),
GST_NV_VIDEO_DISPLAY_TYPE_NONE);
return display->type;
}
static void
gst_nv_video_display_init (GstNvVideoDisplay * display)
{
}
gboolean
gst_nv_video_display_create_context (GstNvVideoDisplay * display,
GstNvVideoContext ** ptr_context)
{
GstNvVideoContext *context = NULL;
g_return_val_if_fail (display != NULL, FALSE);
g_return_val_if_fail (ptr_context != NULL, FALSE);
context = gst_nv_video_context_new (display);
if (!context) {
GST_ERROR ("context creation failed");
return FALSE;
}
if (!gst_nv_video_context_create (context)) {
return FALSE;
}
*ptr_context = context;
GST_DEBUG_OBJECT (display, "created context %" GST_PTR_FORMAT, context);
return TRUE;
}
GstNvVideoWindow *
gst_nv_video_display_create_window (GstNvVideoDisplay * display)
{
return gst_nv_video_window_new (display);
}
static void
gst_nv_video_display_class_init (GstNvVideoDisplayClass * klass)
{
}
gboolean
gst_nv_video_display_new (GstNvVideoDisplay ** display)
{
static gsize debug_init = 0;
const gchar *winsys_name = NULL;
if (g_once_init_enter (&debug_init)) {
GST_DEBUG_CATEGORY_INIT (gst_debug_nv_video_display, "nvvideodisplay", 0,
"nvvideodisplay");
g_once_init_leave (&debug_init, 1);
}
winsys_name = g_getenv ("GST_NV_VIDEO_WINSYS");
#if NV_VIDEO_SINKS_HAS_X11
if (!*display && (!winsys_name || g_strstr_len (winsys_name, 3, "x11"))) {
*display = GST_NV_VIDEO_DISPLAY (gst_nv_video_display_x11_new (NULL));
}
#endif
if (!*display) {
GST_ERROR ("couldn't create display. GST_NV_VIDEO_WINSYS = %s",
winsys_name ? winsys_name : NULL);
return FALSE;
}
return TRUE;
}