2010-04-01 09:47:59 +00:00
|
|
|
/*
|
|
|
|
* gstvaapidisplay_priv.h - Base VA display (private definitions)
|
|
|
|
*
|
2012-01-16 09:41:10 +00:00
|
|
|
* Copyright (C) 2010-2011 Splitted-Desktop Systems
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
|
2013-11-22 05:37:12 +00:00
|
|
|
* Copyright (C) 2011-2013 Intel Corporation
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
|
2010-04-01 09:47:59 +00:00
|
|
|
*
|
2010-05-03 07:07:27 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2.1
|
|
|
|
* of the License, or (at your option) any later version.
|
2010-04-01 09:47:59 +00:00
|
|
|
*
|
2010-05-03 07:07:27 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2010-04-01 09:47:59 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-05-03 07:07:27 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2010-04-01 09:47:59 +00:00
|
|
|
*
|
2010-05-03 07:07:27 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA
|
2010-04-01 09:47:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GST_VAAPI_DISPLAY_PRIV_H
|
|
|
|
#define GST_VAAPI_DISPLAY_PRIV_H
|
|
|
|
|
|
|
|
#include <gst/vaapi/gstvaapidisplay.h>
|
2014-12-10 17:12:24 +00:00
|
|
|
#include <gst/vaapi/gstvaapiwindow.h>
|
2014-12-04 13:36:35 +00:00
|
|
|
#include <gst/vaapi/gstvaapitexture.h>
|
2016-09-22 07:34:38 +00:00
|
|
|
#include <gst/vaapi/gstvaapitexturemap.h>
|
2013-05-07 09:39:34 +00:00
|
|
|
#include "gstvaapiminiobject.h"
|
2010-04-01 09:47:59 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2013-05-07 09:39:34 +00:00
|
|
|
#define GST_VAAPI_DISPLAY_CAST(display) \
|
2016-10-13 03:53:17 +00:00
|
|
|
((GstVaapiDisplay *)(display))
|
2010-04-01 09:47:59 +00:00
|
|
|
|
2013-05-07 09:39:34 +00:00
|
|
|
#define GST_VAAPI_DISPLAY_GET_PRIVATE(display) \
|
2016-10-13 03:53:17 +00:00
|
|
|
(GST_VAAPI_DISPLAY_CAST (display)->priv)
|
2013-05-07 09:39:34 +00:00
|
|
|
|
|
|
|
#define GST_VAAPI_DISPLAY_CLASS(klass) \
|
2016-10-13 03:53:17 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VAAPI_DISPLAY, GstVaapiDisplayClass))
|
2013-05-07 09:39:34 +00:00
|
|
|
|
|
|
|
#define GST_VAAPI_IS_DISPLAY_CLASS(klass) \
|
2016-10-13 03:53:17 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VAAPI_DISPLAY))
|
2013-05-07 09:39:34 +00:00
|
|
|
|
|
|
|
#define GST_VAAPI_DISPLAY_GET_CLASS(obj) \
|
2016-10-13 03:53:17 +00:00
|
|
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VAAPI_DISPLAY, GstVaapiDisplayClass))
|
2013-05-07 09:39:34 +00:00
|
|
|
|
|
|
|
typedef struct _GstVaapiDisplayPrivate GstVaapiDisplayPrivate;
|
|
|
|
typedef struct _GstVaapiDisplayClass GstVaapiDisplayClass;
|
|
|
|
typedef enum _GstVaapiDisplayInitType GstVaapiDisplayInitType;
|
|
|
|
|
2014-12-10 17:02:55 +00:00
|
|
|
/**
|
|
|
|
* GST_VAAPI_DISPLAY_GET_CLASS_TYPE:
|
|
|
|
* @display: a #GstVaapiDisplay
|
|
|
|
*
|
|
|
|
* Returns the #display class type
|
|
|
|
* This is an internal macro that does not do any run-time type check.
|
|
|
|
*/
|
|
|
|
#undef GST_VAAPI_DISPLAY_GET_CLASS_TYPE
|
|
|
|
#define GST_VAAPI_DISPLAY_GET_CLASS_TYPE(display) \
|
|
|
|
(GST_VAAPI_DISPLAY_GET_CLASS (display)->display_type)
|
|
|
|
|
2014-12-01 16:08:29 +00:00
|
|
|
/**
|
|
|
|
* GST_VAAPI_DISPLAY_NATIVE:
|
2014-12-02 10:23:29 +00:00
|
|
|
* @display: a #GstVaapiDisplay
|
2014-12-01 16:08:29 +00:00
|
|
|
*
|
|
|
|
* Macro that evaluates to the native display of @display.
|
|
|
|
* This is an internal macro that does not do any run-time type check.
|
|
|
|
*/
|
|
|
|
#undef GST_VAAPI_DISPLAY_NATIVE
|
2014-12-02 10:23:29 +00:00
|
|
|
#define GST_VAAPI_DISPLAY_NATIVE(display) \
|
|
|
|
(GST_VAAPI_DISPLAY_GET_PRIVATE (display)->native_display)
|
2014-12-01 16:08:29 +00:00
|
|
|
|
2010-04-01 09:47:59 +00:00
|
|
|
/**
|
|
|
|
* GST_VAAPI_DISPLAY_VADISPLAY:
|
|
|
|
* @display_: a #GstVaapiDisplay
|
|
|
|
*
|
2014-12-02 10:23:29 +00:00
|
|
|
* Macro that evaluates to the #VADisplay of @display_.
|
2010-04-01 09:47:59 +00:00
|
|
|
* This is an internal macro that does not do any run-time type check.
|
|
|
|
*/
|
2010-04-01 13:41:24 +00:00
|
|
|
#undef GST_VAAPI_DISPLAY_VADISPLAY
|
2010-04-01 09:47:59 +00:00
|
|
|
#define GST_VAAPI_DISPLAY_VADISPLAY(display_) \
|
2014-12-02 10:23:29 +00:00
|
|
|
(GST_VAAPI_DISPLAY_GET_PRIVATE (display_)->display)
|
2010-04-01 09:47:59 +00:00
|
|
|
|
2013-05-27 15:18:40 +00:00
|
|
|
/**
|
2014-12-10 17:02:55 +00:00
|
|
|
* GST_VAAPI_DISPLAY_VADISPLAY_TYPE:
|
2013-05-27 15:18:40 +00:00
|
|
|
* @display: a #GstVaapiDisplay
|
|
|
|
*
|
2014-12-10 17:02:55 +00:00
|
|
|
* Returns the underlying VADisplay @display type
|
2014-12-02 10:23:29 +00:00
|
|
|
* This is an internal macro that does not do any run-time type check.
|
2013-05-27 15:18:40 +00:00
|
|
|
*/
|
2014-12-10 17:02:55 +00:00
|
|
|
#undef GST_VAAPI_DISPLAY_VADISPLAY_TYPE
|
|
|
|
#define GST_VAAPI_DISPLAY_VADISPLAY_TYPE(display) \
|
2014-12-02 10:23:29 +00:00
|
|
|
(GST_VAAPI_DISPLAY_GET_PRIVATE (display)->display_type)
|
2013-05-27 15:18:40 +00:00
|
|
|
|
2013-07-23 13:52:45 +00:00
|
|
|
/**
|
|
|
|
* GST_VAAPI_DISPLAY_HAS_VPP:
|
|
|
|
* @display: a @GstVaapiDisplay
|
|
|
|
*
|
|
|
|
* Returns whether the @display supports video processing (VA/VPP)
|
2014-12-02 10:23:29 +00:00
|
|
|
* This is an internal macro that does not do any run-time type check.
|
2013-07-23 13:52:45 +00:00
|
|
|
*/
|
|
|
|
#undef GST_VAAPI_DISPLAY_HAS_VPP
|
|
|
|
#define GST_VAAPI_DISPLAY_HAS_VPP(display) \
|
2014-12-02 10:23:29 +00:00
|
|
|
gst_vaapi_display_has_video_processing (GST_VAAPI_DISPLAY_CAST (display))
|
2013-07-23 13:52:45 +00:00
|
|
|
|
2013-12-20 12:27:07 +00:00
|
|
|
struct _GstVaapiDisplayPrivate
|
|
|
|
{
|
|
|
|
GstVaapiDisplay *parent;
|
|
|
|
GRecMutex mutex;
|
|
|
|
GstVaapiDisplayType display_type;
|
2014-07-25 09:24:39 +00:00
|
|
|
gchar *display_name;
|
2013-12-20 12:27:07 +00:00
|
|
|
VADisplay display;
|
2014-12-01 16:08:29 +00:00
|
|
|
gpointer native_display;
|
2013-12-20 12:27:07 +00:00
|
|
|
guint width;
|
|
|
|
guint height;
|
|
|
|
guint width_mm;
|
|
|
|
guint height_mm;
|
|
|
|
guint par_n;
|
|
|
|
guint par_d;
|
|
|
|
GArray *decoders;
|
|
|
|
GArray *encoders;
|
|
|
|
GArray *image_formats;
|
|
|
|
GArray *subpicture_formats;
|
|
|
|
GArray *properties;
|
2014-05-20 09:36:40 +00:00
|
|
|
gchar *vendor_string;
|
2013-12-20 12:27:07 +00:00
|
|
|
guint use_foreign_display:1;
|
|
|
|
guint has_vpp:1;
|
2013-12-20 13:01:45 +00:00
|
|
|
guint has_profiles:1;
|
2010-04-01 09:47:59 +00:00
|
|
|
};
|
|
|
|
|
2013-05-07 09:39:34 +00:00
|
|
|
/**
|
|
|
|
* GstVaapiDisplay:
|
|
|
|
*
|
|
|
|
* Base class for VA displays.
|
|
|
|
*/
|
2013-12-20 12:27:07 +00:00
|
|
|
struct _GstVaapiDisplay
|
|
|
|
{
|
|
|
|
/*< private >*/
|
2016-10-13 03:53:17 +00:00
|
|
|
GstObject parent_instance;
|
2013-05-07 09:39:34 +00:00
|
|
|
|
2016-10-13 03:53:17 +00:00
|
|
|
GstVaapiDisplayPrivate *priv;
|
2013-05-07 09:39:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstVaapiDisplayClass:
|
|
|
|
* @open_display: virtual function to open a display
|
|
|
|
* @close_display: virtual function to close a display
|
|
|
|
* @lock: (optional) virtual function to lock a display
|
|
|
|
* @unlock: (optional) virtual function to unlock a display
|
|
|
|
* @sync: (optional) virtual function to sync a display
|
|
|
|
* @flush: (optional) virtual function to flush pending requests of a display
|
|
|
|
* @get_display: virtual function to retrieve the #GstVaapiDisplayInfo
|
|
|
|
* @get_size: virtual function to retrieve the display dimensions, in pixels
|
|
|
|
* @get_size_mm: virtual function to retrieve the display dimensions, in millimeters
|
2014-12-10 19:13:21 +00:00
|
|
|
* @get_visual_id: (optional) virtual function to retrieve the window visual id
|
|
|
|
* @get_colormap: (optional) virtual function to retrieve the window colormap
|
2014-12-10 17:12:24 +00:00
|
|
|
* @create_window: (optional) virtual function to create a window
|
2014-12-04 13:36:35 +00:00
|
|
|
* @create_texture: (optional) virtual function to create a texture
|
2016-10-13 03:53:17 +00:00
|
|
|
* @get_texture_map: (optional) virtual function to get texture map
|
2013-05-07 09:39:34 +00:00
|
|
|
*
|
|
|
|
* Base class for VA displays.
|
|
|
|
*/
|
2013-12-20 12:27:07 +00:00
|
|
|
struct _GstVaapiDisplayClass
|
|
|
|
{
|
|
|
|
/*< private >*/
|
2016-10-13 03:53:17 +00:00
|
|
|
GstObjectClass parent_class;
|
2013-12-20 12:27:07 +00:00
|
|
|
|
|
|
|
/*< protected >*/
|
2014-12-10 17:02:55 +00:00
|
|
|
guint display_type;
|
2013-12-20 12:27:07 +00:00
|
|
|
|
|
|
|
/*< public >*/
|
2016-10-13 03:53:17 +00:00
|
|
|
void (*init) (GstVaapiDisplay * display);
|
|
|
|
gboolean (*bind_display) (GstVaapiDisplay * display, gpointer native_dpy);
|
|
|
|
gboolean (*open_display) (GstVaapiDisplay * display, const gchar * name);
|
|
|
|
void (*close_display) (GstVaapiDisplay * display);
|
|
|
|
void (*lock) (GstVaapiDisplay * display);
|
|
|
|
void (*unlock) (GstVaapiDisplay * display);
|
|
|
|
void (*sync) (GstVaapiDisplay * display);
|
|
|
|
void (*flush) (GstVaapiDisplay * display);
|
|
|
|
gboolean (*get_display) (GstVaapiDisplay * display, GstVaapiDisplayInfo * info);
|
|
|
|
void (*get_size) (GstVaapiDisplay * display, guint * pwidth, guint * pheight);
|
|
|
|
void (*get_size_mm) (GstVaapiDisplay * display, guint * pwidth, guint * pheight);
|
|
|
|
guintptr (*get_visual_id) (GstVaapiDisplay * display, GstVaapiWindow * window);
|
|
|
|
guintptr (*get_colormap) (GstVaapiDisplay * display, GstVaapiWindow * window);
|
|
|
|
GstVaapiWindow *(*create_window) (GstVaapiDisplay * display, GstVaapiID id, guint width, guint height);
|
|
|
|
GstVaapiTexture *(*create_texture) (GstVaapiDisplay * display, GstVaapiID id, guint target, guint format,
|
|
|
|
guint width, guint height);
|
|
|
|
GstVaapiTextureMap *(*get_texture_map) (GstVaapiDisplay * display);
|
2013-05-07 09:39:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Initialization types */
|
2013-12-20 12:27:07 +00:00
|
|
|
enum _GstVaapiDisplayInitType
|
|
|
|
{
|
|
|
|
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME = 1,
|
|
|
|
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY,
|
|
|
|
GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY
|
2013-05-07 09:39:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GstVaapiDisplay *
|
2016-10-13 03:53:17 +00:00
|
|
|
gst_vaapi_display_new (GstVaapiDisplay * display,
|
2013-05-07 09:39:34 +00:00
|
|
|
GstVaapiDisplayInitType init_type, gpointer init_value);
|
|
|
|
|
|
|
|
/* Inline reference counting for core libgstvaapi library */
|
2014-01-23 09:20:40 +00:00
|
|
|
#ifdef IN_LIBGSTVAAPI_CORE
|
2013-05-07 09:39:34 +00:00
|
|
|
#define gst_vaapi_display_ref_internal(display) \
|
2016-10-13 03:53:17 +00:00
|
|
|
((gpointer) gst_object_ref (GST_OBJECT (display)))
|
2013-05-07 09:39:34 +00:00
|
|
|
|
|
|
|
#define gst_vaapi_display_unref_internal(display) \
|
2016-10-13 03:53:17 +00:00
|
|
|
gst_object_unref (GST_OBJECT (display))
|
2013-05-07 09:39:34 +00:00
|
|
|
|
|
|
|
#define gst_vaapi_display_replace_internal(old_display_ptr, new_display) \
|
2016-10-13 03:53:17 +00:00
|
|
|
gst_object_replace ((GstObject **)(old_display_ptr), GST_OBJECT (new_display))
|
2013-05-07 09:39:34 +00:00
|
|
|
|
|
|
|
#undef gst_vaapi_display_ref
|
|
|
|
#define gst_vaapi_display_ref(display) \
|
2016-10-13 03:53:17 +00:00
|
|
|
gst_vaapi_display_ref_internal ((display))
|
2013-05-07 09:39:34 +00:00
|
|
|
|
|
|
|
#undef gst_vaapi_display_unref
|
|
|
|
#define gst_vaapi_display_unref(display) \
|
2016-10-13 03:53:17 +00:00
|
|
|
gst_vaapi_display_unref_internal ((display))
|
2013-05-07 09:39:34 +00:00
|
|
|
|
|
|
|
#undef gst_vaapi_display_replace
|
|
|
|
#define gst_vaapi_display_replace(old_display_ptr, new_display) \
|
2016-10-13 03:53:17 +00:00
|
|
|
gst_vaapi_display_replace_internal ((old_display_ptr), (new_display))
|
2013-05-07 09:39:34 +00:00
|
|
|
#endif
|
|
|
|
|
2010-04-01 09:47:59 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* GST_VAAPI_DISPLAY_PRIV_H */
|