Files
libgstnvvideosinks/gst-plugins-nv-video-sinks/common/context.h
svcmobrel-release 43b7ad2992 Updating prebuilts and/or headers
44b0e909f18f7e2f457ba501fc47d80ecedd150b - 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
15221adcd6193b5e2c1b38cba595d48e2da6a43f - gst-plugins-nv-video-sinks/nv3dsink/gstnv3dsink.c
9b7125a2d7ebe2ea647c43d2eb43e8d04cd16c47 - gst-plugins-nv-video-sinks/nv3dsink/gstnv3dsink.h
835dc89a20f2a95bea9c4033e40bf6787148ab08 - gst-plugins-nv-video-sinks/common/window.c
a52c6765b04d69f754e5aeaa8c17f83747124150 - gst-plugins-nv-video-sinks/common/display.c
96b0b4d38692a0aecf70944749684ac938ff192f - gst-plugins-nv-video-sinks/common/display.h
718a740b0d05eeaf159bc13b6734485fd065da8e - gst-plugins-nv-video-sinks/common/renderer.c
6e77d54ffc5d1a49d5bad768cdf5cfadf458f1f7 - gst-plugins-nv-video-sinks/common/window.h
9509626b9f2d25a07ceb91b524c604089812cebb - gst-plugins-nv-video-sinks/common/context.c
9d31e8f421736ac5bd8e166db190965bf3a5e472 - gst-plugins-nv-video-sinks/common/renderer.h
d48e1dae85e3c6a0ba7623be7ee306b8e1ef6695 - gst-plugins-nv-video-sinks/common/gstnvvideofwd.h
bcce8e13c6a9efb1ee2d2a8ec24e8f7acc7c6581 - gst-plugins-nv-video-sinks/common/context.h
1e8544869e1b3720d712cc655b602f1a7559eff7 - gst-plugins-nv-video-sinks/common/renderer/renderer_gl.c
f528404a796de5a23dab281588feb72f42343e59 - gst-plugins-nv-video-sinks/common/renderer/renderer_gl.h
1e324349b3704719f411b2da8f201ffb30e89c88 - gst-plugins-nv-video-sinks/common/egl/context_egl.c
536a072a8ef84b3c91307777f88121fb88df2c4f - gst-plugins-nv-video-sinks/common/egl/context_egl.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
638b0da4ea65d02818289e89bc1d635ddbcdaec5 - gst-plugins-nv-video-sinks/common/x11/window_x11.h

Change-Id: I21ac756443e936aef0b7fbb8c9513a28182af74c
2025-08-25 10:25:21 -07:00

130 lines
4.1 KiB
C

/*
* SPDX-FileCopyrightText: Copyright (c) <2018-2025> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: LGPL-2.1-only
*
* 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/>.
*/
#ifndef __GST_NV_VIDEO_CONTEXT_H__
#define __GST_NV_VIDEO_CONTEXT_H__
#include <gst/gst.h>
#include <gst/video/gstvideosink.h>
#include <gst/video/video.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include "gstnvvideofwd.h"
#include <cuda.h>
#include <cudaGL.h>
#include <cuda_runtime.h>
G_BEGIN_DECLS
#define GST_TYPE_NV_VIDEO_CONTEXT \
(gst_nv_video_context_get_type())
#define GST_NV_VIDEO_CONTEXT(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_NV_VIDEO_CONTEXT, GstNvVideoContext))
#define GST_NV_VIDEO_CONTEXT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_NV_VIDEO_CONTEXT, GstNvVideoContextClass))
#define GST_IS_NV_VIDEO_CONTEXT(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_NV_VIDEO_CONTEXT))
#define GST_IS_NV_VIDEO_CONTEXT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_NV_VIDEO_CONTEXT))
#define GST_NV_VIDEO_CONTEXT_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_NV_VIDEO_CONTEXT, GstNvVideoContextClass))
typedef enum
{
GST_NV_VIDEO_CONTEXT_TYPE_NONE = 0,
GST_NV_VIDEO_CONTEXT_TYPE_EGL = (1 << 0),
GST_NV_VIDEO_CONTEXT_TYPE_ANY = G_MAXUINT32
} GstNvVideoContextType;
struct _GstNvVideoContextClass
{
GstObjectClass parent_class;
gboolean (*create) (GstNvVideoContext * context);
gboolean (*setup) (GstNvVideoContext * context);
void (*cleanup) (GstNvVideoContext * context);
GstCaps *(*get_caps) (GstNvVideoContext * context);
gboolean (*show_frame) (GstNvVideoContext * context, GstBuffer * buf);
void (*handle_eos) (GstNvVideoContext * context);
void (*handle_drc) (GstNvVideoContext * context);
void (*handle_tearing) (GstNvVideoContext * context);
void (*cuda_reset_resources) (GstNvVideoContext * context);
};
struct _GstNvVideoContext
{
GstObject parent;
GstNvVideoDisplay *display;
GstNvVideoWindow *window;
GstNvVideoContextType type;
GstNvVideoContextPrivate *priv;
guint using_NVMM;
guint cuda_optimized;
GstVideoInfo configured_info;
gboolean is_cuda_init;
CUcontext cuContext;
CUgraphicsResource cuResource[3];
unsigned int gpu_id;
GstCaps *configured_caps;
};
GST_EXPORT
GstNvVideoContext * gst_nv_video_context_new (GstNvVideoDisplay * display);
GST_EXPORT
gboolean gst_nv_video_context_create (GstNvVideoContext * context);
GST_EXPORT
GstCaps * gst_nv_video_context_get_caps (GstNvVideoContext * context);
GST_EXPORT
gboolean gst_nv_video_context_set_window (GstNvVideoContext * context, GstNvVideoWindow * window);
GST_EXPORT
gboolean gst_nv_video_context_show_frame (GstNvVideoContext * context, GstBuffer * buf);
GST_EXPORT
void gst_nv_video_context_handle_eos (GstNvVideoContext * context);
GST_EXPORT
void gst_nv_video_context_handle_drc (GstNvVideoContext * context);
GST_EXPORT
void gst_nv_video_context_handle_tearing (GstNvVideoContext * context);
GST_EXPORT
gboolean gst_nv_video_context_create_render_thread (GstNvVideoContext * context);
GST_EXPORT
void gst_nv_video_context_destroy_render_thread (GstNvVideoContext * context);
GST_EXPORT
void gst_nv_video_context_set_configured_caps (GstNvVideoContext * context, GstCaps * caps);
GST_EXPORT
GstNvVideoContextType gst_nv_video_context_get_handle_type (GstNvVideoContext * context);
GType gst_nv_video_context_get_type (void);
G_END_DECLS
#endif /* __GST_NV_VIDEO_CONTEXT_H__ */