mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
0dc003bf30
- add Since: markers where necessary. - document structs - add documentation headers for each module (short_description, see_also, etc) - reduce the number of warnings gtk-doc outputs - fix spelling mistakes
123 lines
3.3 KiB
C
123 lines
3.3 KiB
C
/*
|
|
* GStreamer
|
|
* Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* 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
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
* Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include <gst/gl/egl/gstgldisplay_egl.h>
|
|
#include <gst/gl/egl/gsteglimage.h>
|
|
#include <gst/gl/egl/gstglmemoryegl.h>
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
|
|
#define GST_CAT_DEFAULT gst_gl_display_debug
|
|
|
|
G_DEFINE_TYPE (GstGLDisplayEGL, gst_gl_display_egl, GST_TYPE_GL_DISPLAY);
|
|
|
|
static void gst_gl_display_egl_finalize (GObject * object);
|
|
static guintptr gst_gl_display_egl_get_handle (GstGLDisplay * display);
|
|
|
|
static void
|
|
gst_gl_display_egl_class_init (GstGLDisplayEGLClass * klass)
|
|
{
|
|
GST_GL_DISPLAY_CLASS (klass)->get_handle =
|
|
GST_DEBUG_FUNCPTR (gst_gl_display_egl_get_handle);
|
|
|
|
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_egl_finalize;
|
|
}
|
|
|
|
static void
|
|
gst_gl_display_egl_init (GstGLDisplayEGL * display_egl)
|
|
{
|
|
GstGLDisplay *display = (GstGLDisplay *) display_egl;
|
|
|
|
display->type = GST_GL_DISPLAY_TYPE_EGL;
|
|
display_egl->foreign_display = FALSE;
|
|
|
|
gst_gl_memory_egl_init_once ();
|
|
}
|
|
|
|
static void
|
|
gst_gl_display_egl_finalize (GObject * object)
|
|
{
|
|
GstGLDisplayEGL *display_egl = GST_GL_DISPLAY_EGL (object);
|
|
|
|
if (display_egl->display && !display_egl->foreign_display) {
|
|
eglTerminate (display_egl->display);
|
|
display_egl->display = NULL;
|
|
}
|
|
|
|
G_OBJECT_CLASS (gst_gl_display_egl_parent_class)->finalize (object);
|
|
}
|
|
|
|
/**
|
|
* gst_gl_display_egl_new:
|
|
*
|
|
* Create a new #GstGLDisplayEGL using the default EGL_DEFAULT_DISPLAY.
|
|
*
|
|
* Returns: (transfer full): a new #GstGLDisplayEGL or %NULL
|
|
*/
|
|
GstGLDisplayEGL *
|
|
gst_gl_display_egl_new (void)
|
|
{
|
|
GstGLDisplayEGL *ret;
|
|
|
|
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
|
|
|
|
ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL);
|
|
ret->display = eglGetDisplay ((EGLNativeDisplayType) EGL_DEFAULT_DISPLAY);
|
|
|
|
if (!ret->display) {
|
|
GST_ERROR ("Failed to open EGL display connection");
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* gst_gl_display_egl_new_with_display:
|
|
* @display: an existing and connected EGLDisplay
|
|
*
|
|
* Creates a new display connection from a EGLDisplay.
|
|
*
|
|
* Returns: (transfer full): a new #GstGLDisplayEGL
|
|
*/
|
|
GstGLDisplayEGL *
|
|
gst_gl_display_egl_new_with_egl_display (EGLDisplay display)
|
|
{
|
|
GstGLDisplayEGL *ret;
|
|
|
|
g_return_val_if_fail (display != NULL, NULL);
|
|
|
|
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
|
|
|
|
ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL);
|
|
|
|
ret->display = display;
|
|
ret->foreign_display = TRUE;
|
|
|
|
return ret;
|
|
}
|
|
|
|
static guintptr
|
|
gst_gl_display_egl_get_handle (GstGLDisplay * display)
|
|
{
|
|
return (guintptr) GST_GL_DISPLAY_EGL (display)->display;
|
|
}
|