mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
Add helper interface that all VA-API sinks must implement. e.g. vaapisink.
This commit is contained in:
parent
5c5b45f4d8
commit
224d06a03d
3 changed files with 159 additions and 0 deletions
|
@ -4,6 +4,7 @@ libgstvaapi_source_c = \
|
|||
gstvaapidisplay.c \
|
||||
gstvaapiimage.c \
|
||||
gstvaapiimageformat.c \
|
||||
gstvaapisinkbase.c \
|
||||
gstvaapisubpicture.c \
|
||||
gstvaapisurface.c \
|
||||
vaapi_utils.c \
|
||||
|
@ -13,6 +14,7 @@ libgstvaapi_source_h = \
|
|||
gstvaapidisplay.h \
|
||||
gstvaapiimage.h \
|
||||
gstvaapiimageformat.h \
|
||||
gstvaapisinkbase.h \
|
||||
gstvaapisubpicture.h \
|
||||
gstvaapisurface.h \
|
||||
vaapi_debug.h \
|
||||
|
|
91
gst-libs/gst/vaapi/gstvaapisinkbase.c
Normal file
91
gst-libs/gst/vaapi/gstvaapisinkbase.c
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* gstvaapisinkbase.c - VA sink interface
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gstvaapisinkbase.h"
|
||||
|
||||
static void
|
||||
gst_vaapisink_base_base_init(gpointer g_class)
|
||||
{
|
||||
static gboolean is_initialized = FALSE;
|
||||
|
||||
if (!is_initialized) {
|
||||
is_initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
GType
|
||||
gst_vaapisink_base_get_type(void)
|
||||
{
|
||||
static GType iface_type = 0;
|
||||
|
||||
if (G_UNLIKELY(!iface_type)) {
|
||||
static const GTypeInfo info = {
|
||||
sizeof(GstVaapiSinkBaseInterface),
|
||||
gst_vaapisink_base_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
};
|
||||
|
||||
iface_type = g_type_register_static(
|
||||
G_TYPE_INTERFACE,
|
||||
"GstVaapiSinkBase",
|
||||
&info,
|
||||
0
|
||||
);
|
||||
}
|
||||
return iface_type;
|
||||
}
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapisink_base_get_display(GstVaapiSinkBase *sink)
|
||||
{
|
||||
g_return_val_if_fail(GST_IS_VAAPISINK_BASE(sink), NULL);
|
||||
|
||||
return GST_VAAPISINK_BASE_GET_INTERFACE(sink)->get_display(sink);
|
||||
}
|
||||
|
||||
GstVaapiSinkBase *
|
||||
gst_vaapisink_base_lookup(GstElement *element)
|
||||
{
|
||||
GstVaapiSinkBase *sink = NULL;
|
||||
GstPad *pad, *peer;
|
||||
|
||||
g_return_val_if_fail(GST_IS_ELEMENT(element), NULL);
|
||||
|
||||
while (!sink) {
|
||||
pad = gst_element_get_static_pad(element, "src");
|
||||
if (!pad)
|
||||
break;
|
||||
|
||||
peer = gst_pad_get_peer(pad);
|
||||
g_object_unref(pad);
|
||||
if (!peer)
|
||||
break;
|
||||
|
||||
element = gst_pad_get_parent_element(peer);
|
||||
if (element) {
|
||||
if (GST_IS_VAAPISINK_BASE(element))
|
||||
sink = GST_VAAPISINK_BASE(element);
|
||||
g_object_unref(element);
|
||||
}
|
||||
g_object_unref(peer);
|
||||
}
|
||||
return sink;
|
||||
}
|
66
gst-libs/gst/vaapi/gstvaapisinkbase.h
Normal file
66
gst-libs/gst/vaapi/gstvaapisinkbase.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* gstvaapisinkbase.h - VA sink interface
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef GST_VAAPISINK_BASE_H
|
||||
#define GST_VAAPISINK_BASE_H
|
||||
|
||||
#include <gst/gstelement.h>
|
||||
#include <gst/vaapi/gstvaapidisplay.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_VAAPISINK_BASE \
|
||||
(gst_vaapisink_base_get_type())
|
||||
|
||||
#define GST_VAAPISINK_BASE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
|
||||
GST_TYPE_VAAPISINK_BASE, \
|
||||
GstVaapiSinkBase))
|
||||
|
||||
#define GST_IS_VAAPISINK_BASE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VAAPISINK_BASE))
|
||||
|
||||
#define GST_VAAPISINK_BASE_GET_INTERFACE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE((obj), \
|
||||
GST_TYPE_VAAPISINK_BASE, \
|
||||
GstVaapiSinkBaseInterface))
|
||||
|
||||
typedef struct _GstVaapiSinkBase GstVaapiSinkBase; /* dummy */
|
||||
typedef struct _GstVaapiSinkBaseInterface GstVaapiSinkBaseInterface;
|
||||
|
||||
struct _GstVaapiSinkBaseInterface {
|
||||
/*< private >*/
|
||||
GTypeInterface g_iface;
|
||||
|
||||
GstVaapiDisplay *(*get_display)(GstVaapiSinkBase *sink);
|
||||
};
|
||||
|
||||
GType
|
||||
gst_vaapisink_base_get_type(void);
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapisink_base_get_display(GstVaapiSinkBase *sink);
|
||||
|
||||
GstVaapiSinkBase *
|
||||
gst_vaapisink_base_lookup(GstElement *element);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_VAAPISINK_BASE_H */
|
Loading…
Reference in a new issue