mirror of
git://nv-tegra.nvidia.com/tegra/gst-src/gst-egl.git
synced 2025-12-22 09:21:31 +03:00
f29a8e1083e2fe546c68761a196b6dfd5aed14f6 - gstegl_src/gst-egl/Makefile f43858ce2d2f71d6de58ca59ff794fb026689a70 - gstegl_src/gst-egl/LICENSE.libgstnveglglessink b8b167b1729c6e6d1341d9bc61689af8b1dd5064 - gstegl_src/gst-egl/gst-libs/gst/egl/egl.h 34174463c5aa7f9b7f84878cff2f38e41cce28ac - gstegl_src/gst-egl/gst-libs/gst/egl/LICENSE.libgstnvegl-1.0 1a0c41a27bfc4e15f352ceaf07a5c88dfc1924bf - gstegl_src/gst-egl/gst-libs/gst/egl/egl.c 9a83abc5044d31ea41387ac916231ec396665c34 - gstegl_src/gst-egl/pre-gen-source_64/config.h d2f766addf49a14de24d217ca94c2698410b61c7 - gstegl_src/gst-egl/ext/eglgles/video_platform_wrapper.c a341ac6c564356940984817c53ad37a8af5ae471 - gstegl_src/gst-egl/ext/eglgles/gstegladaptation.h 80aab315fad96b237fea7b282e365b90e5185c7f - gstegl_src/gst-egl/ext/eglgles/gsteglglessink.c ba144260ea5c0b76692d05b4b062c1656293fba3 - gstegl_src/gst-egl/ext/eglgles/gstegljitter.h 08e9b3d774d0a93abf96dd711ce8d1c412af6373 - gstegl_src/gst-egl/ext/eglgles/gstegladaptation.c 8149c234efce25ef230ab00a9d6ba141678575c9 - gstegl_src/gst-egl/ext/eglgles/video_platform_wrapper.h 702531a3023833fbf940b9d8ab568b7bda1d96a7 - gstegl_src/gst-egl/ext/eglgles/gstegladaptation_egl.c a420f8c656140307d3d3c614228f609b59583c05 - gstegl_src/gst-egl/ext/eglgles/gstegljitter.c 948247d93a3b7bd800d3601ce6648cd508792054 - gstegl_src/gst-egl/ext/eglgles/gsteglglessink.h Change-Id: Id38679f1f57875cd429fbdd5e012031c47aedc2b
167 lines
5.1 KiB
C
167 lines
5.1 KiB
C
/*
|
|
* GStreamer EGL/GLES Sink
|
|
* Copyright (C) 2012 Collabora Ltd.
|
|
* @author: Reynaldo H. Verdejo Pinochet <reynaldo@collabora.com>
|
|
* @author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
|
* Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
* DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#ifndef __GST_EGLGLESSINK_H__
|
|
#define __GST_EGLGLESSINK_H__
|
|
|
|
#include <gst/gst.h>
|
|
#include <gst/video/video.h>
|
|
#include <gst/video/gstvideosink.h>
|
|
#include <gst/base/gstdataqueue.h>
|
|
|
|
#include <cuda.h>
|
|
#include <cudaGL.h>
|
|
#include <cuda_runtime.h>
|
|
|
|
#include "gstegladaptation.h"
|
|
#include "gstegljitter.h"
|
|
|
|
G_BEGIN_DECLS
|
|
#define GST_TYPE_EGLGLESSINK \
|
|
(gst_eglglessink_get_type())
|
|
#define GST_EGLGLESSINK(obj) \
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_EGLGLESSINK,GstEglGlesSink))
|
|
#define GST_EGLGLESSINK_CLASS(klass) \
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_EGLGLESSINK,GstEglGlesSinkClass))
|
|
#define GST_IS_EGLGLESSINK(obj) \
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_EGLGLESSINK))
|
|
#define GST_IS_EGLGLESSINK_CLASS(klass) \
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_EGLGLESSINK))
|
|
|
|
typedef struct _GstEglGlesSink GstEglGlesSink;
|
|
typedef struct _GstEglGlesSinkClass GstEglGlesSinkClass;
|
|
|
|
/*
|
|
* GstEglGlesSink:
|
|
* @format: Caps' video format field
|
|
* @display_region: Surface region to use as rendering canvas
|
|
* @sinkcaps: Full set of suported caps
|
|
* @current_caps: Current caps
|
|
* @rendering_path: Rendering path (Slow/Fast)
|
|
* @eglglesctx: Pointer to the associated EGL/GLESv2 rendering context
|
|
* @flow_lock: Simple concurrent access ward to the sink's runtime state
|
|
* @have_window: Set if the sink has access to a window to hold it's canvas
|
|
* @using_own_window: Set if the sink created its own window
|
|
* @egl_started: Set if the whole EGL setup has been performed
|
|
* @create_window: Property value holder to allow/forbid internal window creation
|
|
* @force_rendering_slow: Property value holder to force slow rendering path
|
|
* @force_aspect_ratio: Property value holder to consider PAR/DAR when scaling
|
|
*
|
|
* The #GstEglGlesSink data structure.
|
|
*/
|
|
struct _GstEglGlesSink
|
|
{
|
|
GstVideoSink videosink; /* Element hook */
|
|
|
|
/* Region of the surface that should be rendered */
|
|
GstVideoRectangle render_region;
|
|
gboolean render_region_changed;
|
|
gboolean render_region_user;
|
|
|
|
/* Region of render_region that should be filled
|
|
* with the video frames */
|
|
GstVideoRectangle display_region;
|
|
|
|
GstVideoRectangle crop;
|
|
gboolean crop_changed;
|
|
GstCaps *sinkcaps;
|
|
GstCaps *current_caps, *configured_caps;
|
|
GstVideoInfo configured_info;
|
|
gfloat stride[3];
|
|
GstVideoGLTextureOrientation orientation;
|
|
#ifndef HAVE_IOS
|
|
GstBufferPool *pool;
|
|
#endif
|
|
|
|
GstEglAdaptationContext *egl_context;
|
|
gint window_x;
|
|
gint window_y;
|
|
gint window_width;
|
|
gint window_height;
|
|
guint profile;
|
|
gint rows;
|
|
gint columns;
|
|
gint change_port;
|
|
|
|
/* Runtime flags */
|
|
gboolean have_window;
|
|
gboolean using_own_window;
|
|
gboolean egl_started;
|
|
gboolean is_reconfiguring;
|
|
gboolean is_closing;
|
|
gboolean using_cuda;
|
|
|
|
gpointer own_window_data;
|
|
GMutex window_lock;
|
|
|
|
GThread *thread;
|
|
gboolean thread_running;
|
|
GstDataQueue *queue;
|
|
GCond render_exit_cond;
|
|
GCond render_cond;
|
|
GMutex render_lock;
|
|
GstFlowReturn last_flow;
|
|
GstMiniObject *dequeued_object;
|
|
GThread *event_thread;
|
|
|
|
GstBuffer *last_buffer;
|
|
|
|
EGLNativeDisplayType display;
|
|
|
|
GstEglJitterTool *pDeliveryJitter;
|
|
|
|
/* Properties */
|
|
gboolean create_window;
|
|
gboolean force_aspect_ratio;
|
|
gchar* winsys;
|
|
|
|
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
|
|
|
|
GstBuffer *last_uploaded_buffer;
|
|
CUcontext cuContext;
|
|
CUgraphicsResource cuResource[3];
|
|
unsigned int gpu_id;
|
|
gboolean nvbuf_api_version_new;
|
|
|
|
/*
|
|
Pointer to a SW Buffer. This is needed in case of RGB/BGR as Cuda
|
|
doesn't support 3-channel formats. The cuda buffer (host or device)
|
|
is copied using cuMemCpy2D into this sw buffer and then fill the GL
|
|
texture from the SW buffer.
|
|
*/
|
|
uint8_t *swData;
|
|
};
|
|
|
|
struct _GstEglGlesSinkClass
|
|
{
|
|
GstVideoSinkClass parent_class;
|
|
};
|
|
|
|
GType gst_eglglessink_get_type (void);
|
|
|
|
G_END_DECLS
|
|
#endif /* __GST_EGLGLESSINK_H__ */
|