mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
Rename GstInterface to GstImplementsInterface (see bug #122423)
Original commit message from CVS: Rename GstInterface to GstImplementsInterface (see bug #122423)
This commit is contained in:
parent
7918a27650
commit
103c22dee3
2 changed files with 62 additions and 57 deletions
|
@ -28,19 +28,21 @@
|
||||||
#include "gstinterface.h"
|
#include "gstinterface.h"
|
||||||
#include "gstlog.h"
|
#include "gstlog.h"
|
||||||
|
|
||||||
static void gst_interface_class_init (GstInterfaceClass *ifklass);
|
static void
|
||||||
static gboolean gst_interface_supported_default (GstInterface *iface,
|
gst_implements_interface_class_init (GstImplementsInterfaceClass *ifklass);
|
||||||
GType iface_type);
|
static gboolean
|
||||||
|
gst_implements_interface_supported_default (GstImplementsInterface *iface,
|
||||||
|
GType iface_type);
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gst_interface_get_type (void)
|
gst_implements_interface_get_type (void)
|
||||||
{
|
{
|
||||||
static GType gst_interface_type = 0;
|
static GType gst_interface_type = 0;
|
||||||
|
|
||||||
if (!gst_interface_type) {
|
if (!gst_interface_type) {
|
||||||
static const GTypeInfo gst_interface_info = {
|
static const GTypeInfo gst_interface_info = {
|
||||||
sizeof (GstInterfaceClass),
|
sizeof (GstImplementsInterfaceClass),
|
||||||
(GBaseInitFunc) gst_interface_class_init,
|
(GBaseInitFunc) gst_implements_interface_class_init,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -52,7 +54,7 @@ gst_interface_get_type (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
gst_interface_type = g_type_register_static (G_TYPE_INTERFACE,
|
gst_interface_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||||
"GstInterface",
|
"GstImplementsInterface",
|
||||||
&gst_interface_info, 0);
|
&gst_interface_info, 0);
|
||||||
|
|
||||||
g_type_interface_add_prerequisite (gst_interface_type,
|
g_type_interface_add_prerequisite (gst_interface_type,
|
||||||
|
@ -63,14 +65,14 @@ gst_interface_get_type (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_interface_class_init (GstInterfaceClass *klass)
|
gst_implements_interface_class_init (GstImplementsInterfaceClass *klass)
|
||||||
{
|
{
|
||||||
klass->supported = gst_interface_supported_default;
|
klass->supported = gst_implements_interface_supported_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_interface_supported_default (GstInterface *interface,
|
gst_implements_interface_supported_default (GstImplementsInterface *interface,
|
||||||
GType iface_type)
|
GType iface_type)
|
||||||
{
|
{
|
||||||
/* Well, if someone didn't set the virtual function,
|
/* Well, if someone didn't set the virtual function,
|
||||||
* then something is clearly wrong. So big no-no here */
|
* then something is clearly wrong. So big no-no here */
|
||||||
|
@ -93,12 +95,12 @@ gst_element_implements_interface (GstElement *element,
|
||||||
{
|
{
|
||||||
if (G_TYPE_CHECK_INSTANCE_TYPE (G_OBJECT (element),
|
if (G_TYPE_CHECK_INSTANCE_TYPE (G_OBJECT (element),
|
||||||
iface_type)) {
|
iface_type)) {
|
||||||
GstInterface *iface;
|
GstImplementsInterface *iface;
|
||||||
GstInterfaceClass *ifclass;
|
GstImplementsInterfaceClass *ifclass;
|
||||||
|
|
||||||
iface = G_TYPE_CHECK_INSTANCE_CAST (G_OBJECT (element),
|
iface = G_TYPE_CHECK_INSTANCE_CAST (G_OBJECT (element),
|
||||||
iface_type, GstInterface);
|
iface_type, GstImplementsInterface);
|
||||||
ifclass = GST_INTERFACE_GET_CLASS (iface);
|
ifclass = GST_IMPLEMENTS_INTERFACE_GET_CLASS (iface);
|
||||||
|
|
||||||
if (ifclass->supported != NULL &&
|
if (ifclass->supported != NULL &&
|
||||||
ifclass->supported (iface, iface_type) == TRUE) {
|
ifclass->supported (iface, iface_type) == TRUE) {
|
||||||
|
@ -110,7 +112,7 @@ gst_element_implements_interface (GstElement *element,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_interface_cast:
|
* gst_implements_interface_cast:
|
||||||
* @from: the object (any sort) from which to cast to the interface
|
* @from: the object (any sort) from which to cast to the interface
|
||||||
* @type: the interface type to cast to
|
* @type: the interface type to cast to
|
||||||
*
|
*
|
||||||
|
@ -118,15 +120,15 @@ gst_element_implements_interface (GstElement *element,
|
||||||
* interface is supported for this specific instance.
|
* interface is supported for this specific instance.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GstInterface *
|
gpointer
|
||||||
gst_interface_cast (gpointer from,
|
gst_implements_interface_cast (gpointer from,
|
||||||
GType iface_type)
|
GType iface_type)
|
||||||
{
|
{
|
||||||
GstInterface *iface;
|
GstImplementsInterface *iface;
|
||||||
|
|
||||||
/* check cast, give warning+fail if it's invalid */
|
/* check cast, give warning+fail if it's invalid */
|
||||||
if (!(iface = G_TYPE_CHECK_INSTANCE_CAST (from, iface_type,
|
if (!(iface = G_TYPE_CHECK_INSTANCE_CAST (from, iface_type,
|
||||||
GstInterface))) {
|
GstImplementsInterface))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +144,7 @@ gst_interface_cast (gpointer from,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_interface_cast:
|
* gst_implements_interface_cast:
|
||||||
* @from: the object (any sort) from which to check from for the interface
|
* @from: the object (any sort) from which to check from for the interface
|
||||||
* @type: the interface type to check for
|
* @type: the interface type to check for
|
||||||
*
|
*
|
||||||
|
@ -151,17 +153,17 @@ gst_interface_cast (gpointer from,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_interface_check (gpointer from,
|
gst_implements_interface_check (gpointer from,
|
||||||
GType type)
|
GType type)
|
||||||
{
|
{
|
||||||
GstInterface *iface;
|
GstImplementsInterface *iface;
|
||||||
|
|
||||||
/* check cast, return FALSE if it fails, don't give a warning... */
|
/* check cast, return FALSE if it fails, don't give a warning... */
|
||||||
if (!G_TYPE_CHECK_INSTANCE_TYPE (from, type)) {
|
if (!G_TYPE_CHECK_INSTANCE_TYPE (from, type)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
iface = G_TYPE_CHECK_INSTANCE_CAST (from, type, GstInterface);
|
iface = G_TYPE_CHECK_INSTANCE_CAST (from, type, GstImplementsInterface);
|
||||||
|
|
||||||
/* now, if we're an element (or derivative), is this thing
|
/* now, if we're an element (or derivative), is this thing
|
||||||
* actually implemented for real? */
|
* actually implemented for real? */
|
||||||
|
|
|
@ -20,57 +20,60 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GST_INTERFACE_H__
|
#ifndef __GST_IMPLEMENTS_INTERFACE_H__
|
||||||
#define __GST_INTERFACE_H__
|
#define __GST_IMPLEMENTS_INTERFACE_H__
|
||||||
|
|
||||||
#include <gst/gstelement.h>
|
#include <gst/gstelement.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GST_TYPE_INTERFACE \
|
#define GST_TYPE_IMPLEMENTS_INTERFACE \
|
||||||
(gst_interface_get_type ())
|
(gst_implements_interface_get_type ())
|
||||||
#define GST_INTERFACE(obj) \
|
#define GST_IMPLEMENTS_INTERFACE(obj) \
|
||||||
(GST_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INTERFACE, GstInterface))
|
(GST_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_IMPLEMENTS_INTERFACE, \
|
||||||
#define GST_INTERFACE_CLASS(klass) \
|
GstImplementsInterface))
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_INTERFACE, GstInterfaceClass))
|
#define GST_IMPLEMENTS_INTERFACE_CLASS(klass) \
|
||||||
#define GST_IS_INTERFACE(obj) \
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_IMPLEMENTS_INTERFACE, \
|
||||||
(GST_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INTERFACE))
|
GstImplementsInterfaceClass))
|
||||||
#define GST_IS_INTERFACE_CLASS(klass) \
|
#define GST_IS_IMPLEMENTS_INTERFACE(obj) \
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_INTERFACE))
|
(GST_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_IMPLEMENTS_INTERFACE))
|
||||||
#define GST_INTERFACE_GET_CLASS(inst) \
|
#define GST_IS_IMPLEMENTS_INTERFACE_CLASS(klass) \
|
||||||
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_INTERFACE, GstInterfaceClass))
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_IMPLEMENTS_INTERFACE))
|
||||||
|
#define GST_IMPLEMENTS_INTERFACE_GET_CLASS(inst) \
|
||||||
|
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_IMPLEMENTS_INTERFACE, \
|
||||||
|
GstImplementsInterfaceClass))
|
||||||
|
|
||||||
typedef struct _GstInterface GstInterface;
|
typedef struct _GstImplementsInterface GstImplementsInterface;
|
||||||
|
|
||||||
/* This small extra virtual function is here to provide an
|
/* This small extra virtual function is here to provide an
|
||||||
* interface functionality on a per-instance basis rather
|
* interface functionality on a per-instance basis rather
|
||||||
* than a per-class basis, which is the case for glib.
|
* than a per-class basis, which is the case for glib.
|
||||||
*/
|
*/
|
||||||
typedef struct _GstInterfaceClass {
|
typedef struct _GstImplementsInterfaceClass {
|
||||||
GTypeInterface parent;
|
GTypeInterface parent;
|
||||||
|
|
||||||
/* virtual functions */
|
/* virtual functions */
|
||||||
gboolean (* supported) (GstInterface *iface,
|
gboolean (* supported) (GstImplementsInterface *iface,
|
||||||
GType iface_type);
|
GType iface_type);
|
||||||
|
|
||||||
GST_CLASS_PADDING
|
GST_CLASS_PADDING
|
||||||
} GstInterfaceClass;
|
} GstImplementsInterfaceClass;
|
||||||
|
|
||||||
#define GST_INTERFACE_CHECK_INSTANCE_CAST(obj, type, cast_t) \
|
#define GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST(obj, type, cast_t) \
|
||||||
((cast_t *) gst_interface_cast ((obj), (type)))
|
((cast_t *) gst_implements_interface_cast ((obj), (type)))
|
||||||
#define GST_INTERFACE_CHECK_INSTANCE_TYPE(obj, type) \
|
#define GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE(obj, type) \
|
||||||
(gst_interface_check ((obj), (type)))
|
(gst_implements_interface_check ((obj), (type)))
|
||||||
|
|
||||||
GType gst_interface_get_type (void);
|
GType gst_implements_interface_get_type (void);
|
||||||
|
|
||||||
/* wrapper functions to check for functionality implementation */
|
/* wrapper functions to check for functionality implementation */
|
||||||
gboolean gst_element_implements_interface(GstElement *element,
|
gboolean gst_element_implements_interface (GstElement *element,
|
||||||
GType iface_type);
|
GType iface_type);
|
||||||
GstInterface * gst_interface_cast (gpointer from,
|
gpointer gst_implements_interface_cast (gpointer from,
|
||||||
GType type);
|
GType type);
|
||||||
gboolean gst_interface_check (gpointer from,
|
gboolean gst_implements_interface_check (gpointer from,
|
||||||
GType type);
|
GType type);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_INTERFACE_H__ */
|
#endif /* __GST_IMPLEMENTS_INTERFACE_H__ */
|
||||||
|
|
Loading…
Reference in a new issue