gstreamer/gst-libs/gst/vaapi/gstvaapidisplay_glx.c

100 lines
3 KiB
C
Raw Normal View History

2010-03-25 17:28:49 +00:00
/*
* gstvaapidisplay_glx.c - VA/GLX display abstraction
*
* gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* SECTION:gstvaapidisplay_glx
* @short_description: VA/GLX display abstraction
*/
#include "config.h"
#include "gstvaapiutils.h"
#include "gstvaapidisplay_glx.h"
#define DEBUG 1
#include "gstvaapidebug.h"
G_DEFINE_TYPE(GstVaapiDisplayGLX,
gst_vaapi_display_glx,
GST_VAAPI_TYPE_DISPLAY_X11);
static void
gst_vaapi_display_glx_finalize(GObject *object)
{
G_OBJECT_CLASS(gst_vaapi_display_glx_parent_class)->finalize(object);
}
static VADisplay
gst_vaapi_display_glx_get_va_display(GstVaapiDisplay *display)
{
return vaGetDisplayGLX(GST_VAAPI_DISPLAY_XDISPLAY(display));
}
static void
gst_vaapi_display_glx_class_init(GstVaapiDisplayGLXClass *klass)
{
GObjectClass * const object_class = G_OBJECT_CLASS(klass);
GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
object_class->finalize = gst_vaapi_display_glx_finalize;
dpy_class->get_display = gst_vaapi_display_glx_get_va_display;
}
static void
gst_vaapi_display_glx_init(GstVaapiDisplayGLX *display)
{
}
/**
* gst_vaapi_display_glx_new:
* @display_name: the X11 display name
*
* Opens an X11 #Display using @display_name and returns a newly
* allocated #GstVaapiDisplay object. The X11 display will be cloed
* when the reference count of the object reaches zero.
*
* Return value: a newly allocated #GstVaapiDisplay object
*/
GstVaapiDisplay *
gst_vaapi_display_glx_new(const gchar *display_name)
{
return g_object_new(GST_VAAPI_TYPE_DISPLAY_GLX,
"display-name", display_name,
NULL);
}
/**
* gst_vaapi_display_glx_new_with_display:
* @x11_display: an X11 #Display
*
* Creates a #GstVaapiDisplay based on the X11 @x11_display
* display. The caller still owns the display and must call
* XCloseDisplay() when all #GstVaapiDisplay references are
* released. Doing so too early can yield undefined behaviour.
*
* Return value: a newly allocated #GstVaapiDisplay object
*/
GstVaapiDisplay *
gst_vaapi_display_glx_new_with_display(Display *x11_display)
{
return g_object_new(GST_VAAPI_TYPE_DISPLAY_GLX,
"x11-display", x11_display,
NULL);
}