2013-12-13 09:24:26 +00:00
|
|
|
/*
|
|
|
|
* gstvaapipluginbase.h - Base GStreamer VA-API Plugin element
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010-2011 Splitted-Desktop Systems
|
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
|
|
|
|
* Copyright (C) 2011-2013 Intel Corporation
|
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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 library; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GST_VAAPI_PLUGIN_BASE_H
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_H
|
|
|
|
|
|
|
|
#include <gst/base/gstbasetransform.h>
|
|
|
|
#include <gst/video/gstvideodecoder.h>
|
|
|
|
#include <gst/video/gstvideoencoder.h>
|
|
|
|
#include <gst/video/gstvideosink.h>
|
|
|
|
#include <gst/vaapi/gstvaapidisplay.h>
|
|
|
|
|
2016-01-29 14:51:49 +00:00
|
|
|
#ifdef USE_GST_GL_HELPERS
|
2014-12-03 13:14:30 +00:00
|
|
|
# include <gst/gl/gstglcontext.h>
|
|
|
|
#endif
|
|
|
|
|
2013-12-13 09:24:26 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef struct _GstVaapiPluginBase GstVaapiPluginBase;
|
|
|
|
typedef struct _GstVaapiPluginBaseClass GstVaapiPluginBaseClass;
|
|
|
|
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE(plugin) \
|
|
|
|
((GstVaapiPluginBase *)(plugin))
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_CLASS(plugin) \
|
|
|
|
((GstVaapiPluginBaseClass *)(plugin))
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_GET_CLASS(plugin) \
|
|
|
|
GST_VAAPI_PLUGIN_BASE_CLASS(GST_ELEMENT_GET_CLASS( \
|
|
|
|
GST_VAAPI_PLUGIN_BASE_ELEMENT(plugin)))
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_PARENT(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE(plugin)->parent_instance)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_PARENT_CLASS(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_CLASS(plugin)->parent_class)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_ELEMENT(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT(plugin)->element)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_ELEMENT_CLASS(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT_CLASS(plugin)->element)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_DECODER(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT(plugin)->decoder)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_DECODER_CLASS(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT_CLASS(plugin)->decoder)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_ENCODER(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT(plugin)->encoder)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_ENCODER_CLASS(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT_CLASS(plugin)->encoder)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_TRANSFORM(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT(plugin)->transform)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_TRANSFORM_CLASS(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT_CLASS(plugin)->transform)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SINK(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT(plugin)->sink)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SINK_CLASS(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE_PARENT_CLASS(plugin)->sink)
|
|
|
|
|
2013-12-13 12:24:24 +00:00
|
|
|
#define GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES \
|
|
|
|
gst_vaapi_plugin_base_init_interfaces(g_define_type_id);
|
|
|
|
|
2013-12-17 17:46:07 +00:00
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SINK_PAD(plugin) \
|
|
|
|
(GST_VAAPI_PLUGIN_BASE(plugin)->sinkpad)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SINK_PAD_CAPS(plugin) \
|
|
|
|
(GST_VAAPI_PLUGIN_BASE(plugin)->sinkpad_caps)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SINK_PAD_INFO(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE(plugin)->sinkpad_info)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SINK_PAD_QUERYFUNC(plugin) \
|
|
|
|
(GST_VAAPI_PLUGIN_BASE(plugin)->sinkpad_query)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SRC_PAD(plugin) \
|
|
|
|
(GST_VAAPI_PLUGIN_BASE(plugin)->srcpad)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAPS(plugin) \
|
|
|
|
(GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_caps)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SRC_PAD_INFO(plugin) \
|
|
|
|
(&GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_info)
|
|
|
|
#define GST_VAAPI_PLUGIN_BASE_SRC_PAD_QUERYFYNC(plugin) \
|
|
|
|
(GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_query)
|
|
|
|
|
2013-12-13 09:24:26 +00:00
|
|
|
#define GST_VAAPI_PLUGIN_BASE_DISPLAY(plugin) \
|
|
|
|
(GST_VAAPI_PLUGIN_BASE(plugin)->display)
|
2013-12-13 10:52:47 +00:00
|
|
|
#define GST_VAAPI_PLUGIN_BASE_DISPLAY_TYPE(plugin) \
|
|
|
|
(GST_VAAPI_PLUGIN_BASE(plugin)->display_type)
|
2014-07-25 09:13:29 +00:00
|
|
|
#define GST_VAAPI_PLUGIN_BASE_DISPLAY_NAME(plugin) \
|
|
|
|
(GST_VAAPI_PLUGIN_BASE(plugin)->display_name)
|
2013-12-13 09:24:26 +00:00
|
|
|
#define GST_VAAPI_PLUGIN_BASE_DISPLAY_REPLACE(plugin, new_display) \
|
|
|
|
(gst_vaapi_display_replace(&GST_VAAPI_PLUGIN_BASE_DISPLAY(plugin), \
|
|
|
|
(new_display)))
|
|
|
|
|
|
|
|
struct _GstVaapiPluginBase
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
union
|
|
|
|
{
|
|
|
|
GstElement element;
|
|
|
|
GstVideoDecoder decoder;
|
|
|
|
GstVideoEncoder encoder;
|
|
|
|
GstBaseTransform transform;
|
|
|
|
GstVideoSink sink;
|
|
|
|
} parent_instance;
|
|
|
|
|
|
|
|
GstDebugCategory *debug_category;
|
|
|
|
|
2013-12-17 17:46:07 +00:00
|
|
|
GstPad *sinkpad;
|
|
|
|
GstCaps *sinkpad_caps;
|
|
|
|
gboolean sinkpad_caps_changed;
|
2014-08-20 09:43:08 +00:00
|
|
|
gboolean sinkpad_caps_is_raw;
|
2013-12-17 17:46:07 +00:00
|
|
|
GstVideoInfo sinkpad_info;
|
2013-12-17 17:52:23 +00:00
|
|
|
GstBufferPool *sinkpad_buffer_pool;
|
|
|
|
guint sinkpad_buffer_size;
|
2013-12-17 17:46:07 +00:00
|
|
|
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstCaps *srcpad_caps;
|
|
|
|
gboolean srcpad_caps_changed;
|
|
|
|
GstVideoInfo srcpad_info;
|
2014-08-21 12:10:36 +00:00
|
|
|
GstBufferPool *srcpad_buffer_pool;
|
2013-12-17 17:46:07 +00:00
|
|
|
|
2013-12-13 09:24:26 +00:00
|
|
|
GstVaapiDisplay *display;
|
2013-12-13 10:52:47 +00:00
|
|
|
GstVaapiDisplayType display_type;
|
|
|
|
GstVaapiDisplayType display_type_req;
|
2014-07-25 09:13:29 +00:00
|
|
|
gchar *display_name;
|
2013-12-17 17:52:23 +00:00
|
|
|
|
2014-12-03 13:14:30 +00:00
|
|
|
GstObject *gl_context;
|
|
|
|
|
2015-07-23 11:11:40 +00:00
|
|
|
GstCaps *allowed_raw_caps;
|
2013-12-13 09:24:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstVaapiPluginBaseClass
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
union
|
|
|
|
{
|
|
|
|
GstElementClass element;
|
|
|
|
GstVideoDecoderClass decoder;
|
|
|
|
GstVideoEncoderClass encoder;
|
|
|
|
GstBaseTransformClass transform;
|
|
|
|
GstVideoSinkClass sink;
|
|
|
|
} parent_class;
|
2013-12-13 10:52:47 +00:00
|
|
|
|
2013-12-13 12:24:24 +00:00
|
|
|
gboolean (*has_interface) (GstVaapiPluginBase * plugin, GType type);
|
2013-12-13 10:52:47 +00:00
|
|
|
void (*display_changed) (GstVaapiPluginBase * plugin);
|
2013-12-13 09:24:26 +00:00
|
|
|
};
|
|
|
|
|
2013-12-13 12:24:24 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_plugin_base_init_interfaces (GType type);
|
|
|
|
|
2013-12-13 09:24:26 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass);
|
|
|
|
|
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_plugin_base_init (GstVaapiPluginBase * plugin,
|
|
|
|
GstDebugCategory * debug_category);
|
|
|
|
|
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_plugin_base_finalize (GstVaapiPluginBase * plugin);
|
|
|
|
|
|
|
|
G_GNUC_INTERNAL
|
|
|
|
gboolean
|
|
|
|
gst_vaapi_plugin_base_open (GstVaapiPluginBase * plugin);
|
|
|
|
|
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_plugin_base_close (GstVaapiPluginBase * plugin);
|
|
|
|
|
2014-12-03 14:45:52 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
gboolean
|
|
|
|
gst_vaapi_plugin_base_has_display_type (GstVaapiPluginBase * plugin,
|
|
|
|
GstVaapiDisplayType display_type_req);
|
|
|
|
|
2013-12-13 10:52:47 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_plugin_base_set_display_type (GstVaapiPluginBase * plugin,
|
|
|
|
GstVaapiDisplayType display_type);
|
|
|
|
|
2014-07-25 09:13:29 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_plugin_base_set_display_name (GstVaapiPluginBase * plugin,
|
|
|
|
const gchar * display_name);
|
|
|
|
|
2013-12-13 10:52:47 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
gboolean
|
|
|
|
gst_vaapi_plugin_base_ensure_display (GstVaapiPluginBase * plugin);
|
|
|
|
|
2013-12-17 17:46:07 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
gboolean
|
|
|
|
gst_vaapi_plugin_base_set_caps (GstVaapiPluginBase * plugin, GstCaps * incaps,
|
|
|
|
GstCaps * outcaps);
|
|
|
|
|
2013-12-17 17:52:23 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
gboolean
|
|
|
|
gst_vaapi_plugin_base_propose_allocation (GstVaapiPluginBase * plugin,
|
|
|
|
GstQuery * query);
|
|
|
|
|
2014-08-21 12:10:36 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
gboolean
|
|
|
|
gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin,
|
2016-04-14 13:46:32 +00:00
|
|
|
GstQuery * query, guint feature);
|
2014-08-21 12:10:36 +00:00
|
|
|
|
2013-12-17 17:52:23 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
GstFlowReturn
|
|
|
|
gst_vaapi_plugin_base_get_input_buffer (GstVaapiPluginBase * plugin,
|
|
|
|
GstBuffer * inbuf, GstBuffer ** outbuf_ptr);
|
|
|
|
|
2014-12-03 13:14:30 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_plugin_base_set_gl_context (GstVaapiPluginBase * plugin,
|
|
|
|
GstObject * object);
|
|
|
|
|
2015-07-23 11:11:40 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
GstCaps *
|
|
|
|
gst_vaapi_plugin_base_get_allowed_raw_caps (GstVaapiPluginBase * plugin);
|
|
|
|
|
2013-12-13 09:24:26 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* GST_VAAPI_PLUGIN_BASE_H */
|