qa-monitor: add base class for monitors

The base class adds a 'object' property to hold the monitored object,
it can only be set on construction. Also the constructor now
automatically calls the element set up
This commit is contained in:
Thiago Santos 2013-07-10 14:03:49 -03:00
parent e04fe10eab
commit ce0e8ab697
10 changed files with 340 additions and 84 deletions

View file

@ -3,6 +3,7 @@ public_headers = \
c_sources = \
gst-qa-runner.c \
gst-qa-monitor.c \
gst-qa-element-monitor.c \
gst-qa-bin-monitor.c \
gst-qa-pad-monitor.c \

View file

@ -40,7 +40,7 @@ G_DEFINE_TYPE_WITH_CODE (GstQaBinMonitor, gst_qa_bin_monitor,
static void
gst_qa_bin_monitor_wrap_element (GstQaBinMonitor * monitor,
GstElement * element);
static gboolean gst_qa_bin_monitor_setup (GstQaElementMonitor * monitor);
static gboolean gst_qa_bin_monitor_setup (GstQaMonitor * monitor);
static void
_qa_bin_element_added (GstBin * bin, GstElement * pad,
@ -50,8 +50,7 @@ static void
gst_qa_bin_monitor_dispose (GObject * object)
{
GstQaBinMonitor *monitor = GST_QA_BIN_MONITOR_CAST (object);
GstQaElementMonitor *element_monitor = GST_QA_ELEMENT_MONITOR_CAST (object);
GstElement *bin = element_monitor->element;
GstElement *bin = GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor);
if (monitor->element_added_id)
g_signal_handler_disconnect (bin, monitor->element_added_id);
@ -66,14 +65,14 @@ static void
gst_qa_bin_monitor_class_init (GstQaBinMonitorClass * klass)
{
GObjectClass *gobject_class;
GstQaElementMonitorClass *gstqaelementmonitor_class;
GstQaMonitorClass *qamonitor_class;
gobject_class = G_OBJECT_CLASS (klass);
gstqaelementmonitor_class = GST_QA_ELEMENT_MONITOR_CLASS_CAST (klass);
qamonitor_class = GST_QA_MONITOR_CLASS_CAST (klass);
gobject_class->dispose = gst_qa_bin_monitor_dispose;
gstqaelementmonitor_class->setup = gst_qa_bin_monitor_setup;
qamonitor_class->setup = gst_qa_bin_monitor_setup;
}
static void
@ -88,36 +87,44 @@ gst_qa_bin_monitor_init (GstQaBinMonitor * bin_monitor)
GstQaBinMonitor *
gst_qa_bin_monitor_new (GstBin * bin)
{
GstQaBinMonitor *monitor = g_object_new (GST_TYPE_QA_BIN_MONITOR, NULL);
GstQaElementMonitor *element_monitor = GST_QA_ELEMENT_MONITOR_CAST (bin);
GstQaBinMonitor *monitor = g_object_new (GST_TYPE_QA_BIN_MONITOR, "object",
G_TYPE_OBJECT, bin, NULL);
g_return_val_if_fail (bin != NULL, NULL);
element_monitor->element = gst_object_ref (bin);
if (GST_QA_MONITOR_GET_OBJECT (monitor) == NULL) {
g_object_unref (monitor);
return NULL;
}
return monitor;
}
static gboolean
gst_qa_bin_monitor_setup (GstQaElementMonitor * element_monitor)
gst_qa_bin_monitor_setup (GstQaMonitor * monitor)
{
GstIterator *iterator;
gboolean done;
GstElement *element;
GstQaBinMonitor *monitor = GST_QA_BIN_MONITOR_CAST (element_monitor);
GstQaBinMonitor *bin_monitor = GST_QA_BIN_MONITOR_CAST (monitor);
GstBin *bin = GST_QA_BIN_MONITOR_GET_BIN (bin_monitor);
GST_DEBUG_OBJECT (monitor, "Setting up monitor for bin %" GST_PTR_FORMAT,
element_monitor->element);
if (!GST_IS_BIN (bin)) {
GST_WARNING_OBJECT (monitor, "Trying to create bin monitor with other "
"type of object");
return FALSE;
}
monitor->element_added_id =
g_signal_connect (GST_BIN_CAST (element_monitor->element),
"element-added", G_CALLBACK (_qa_bin_element_added), monitor);
GST_DEBUG_OBJECT (bin_monitor, "Setting up monitor for bin %" GST_PTR_FORMAT,
bin);
iterator = gst_bin_iterate_elements (GST_BIN_CAST (element_monitor->element));
bin_monitor->element_added_id =
g_signal_connect (bin, "element-added",
G_CALLBACK (_qa_bin_element_added), monitor);
iterator = gst_bin_iterate_elements (bin);
done = FALSE;
while (!done) {
switch (gst_iterator_next (iterator, (gpointer *) & element)) {
case GST_ITERATOR_OK:
gst_qa_bin_monitor_wrap_element (monitor, element);
gst_qa_bin_monitor_wrap_element (bin_monitor, element);
gst_object_unref (element);
break;
case GST_ITERATOR_RESYNC:
@ -149,7 +156,7 @@ static void
_qa_bin_element_added (GstBin * bin, GstElement * element,
GstQaBinMonitor * monitor)
{
GstQaElementMonitor *element_monitor = GST_QA_ELEMENT_MONITOR_CAST (monitor);
g_return_if_fail (element_monitor->element == GST_ELEMENT_CAST (bin));
g_return_if_fail (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor) ==
GST_ELEMENT_CAST (bin));
gst_qa_bin_monitor_wrap_element (monitor, element);
}

View file

@ -37,6 +37,8 @@ G_BEGIN_DECLS
#define GST_QA_BIN_MONITOR_CAST(obj) ((GstQaBinMonitor*)(obj))
#define GST_QA_BIN_MONITOR_CLASS_CAST(klass) ((GstQaBinMonitorClass*)(klass))
#define GST_QA_BIN_MONITOR_GET_BIN(m) (GST_BIN_CAST (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (m)))
typedef struct _GstQaBinMonitor GstQaBinMonitor;
typedef struct _GstQaBinMonitorClass GstQaBinMonitorClass;

View file

@ -35,11 +35,11 @@ GST_DEBUG_CATEGORY_STATIC (gst_qa_element_monitor_debug);
GST_DEBUG_CATEGORY_INIT (gst_qa_element_monitor_debug, "qa_element_monitor", 0, "QA ElementMonitor");
#define gst_qa_element_monitor_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstQaElementMonitor, gst_qa_element_monitor,
G_TYPE_OBJECT, _do_init);
GST_TYPE_QA_MONITOR, _do_init);
static void
gst_qa_element_monitor_wrap_pad (GstQaElementMonitor * monitor, GstPad * pad);
static gboolean gst_qa_element_monitor_do_setup (GstQaElementMonitor * monitor);
static gboolean gst_qa_element_monitor_do_setup (GstQaMonitor * monitor);
static void
_qa_element_pad_added (GstElement * element, GstPad * pad,
@ -51,13 +51,11 @@ gst_qa_element_monitor_dispose (GObject * object)
GstQaElementMonitor *monitor = GST_QA_ELEMENT_MONITOR_CAST (object);
if (monitor->pad_added_id)
g_signal_handler_disconnect (monitor->element, monitor->pad_added_id);
g_signal_handler_disconnect (GST_QA_MONITOR_GET_OBJECT (monitor),
monitor->pad_added_id);
g_list_free_full (monitor->pad_monitors, g_object_unref);
if (monitor->element)
gst_object_unref (monitor->element);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@ -66,18 +64,19 @@ static void
gst_qa_element_monitor_class_init (GstQaElementMonitorClass * klass)
{
GObjectClass *gobject_class;
GstQaMonitorClass *monitor_klass;
gobject_class = G_OBJECT_CLASS (klass);
monitor_klass = GST_QA_MONITOR_CLASS (klass);
gobject_class->dispose = gst_qa_element_monitor_dispose;
klass->setup = gst_qa_element_monitor_do_setup;
monitor_klass->setup = gst_qa_element_monitor_do_setup;
}
static void
gst_qa_element_monitor_init (GstQaElementMonitor * element_monitor)
{
element_monitor->setup = FALSE;
}
/**
@ -87,34 +86,52 @@ gst_qa_element_monitor_init (GstQaElementMonitor * element_monitor)
GstQaElementMonitor *
gst_qa_element_monitor_new (GstElement * element)
{
GstQaElementMonitor *monitor =
g_object_new (GST_TYPE_QA_ELEMENT_MONITOR, NULL);
GstQaElementMonitor *monitor;
g_return_val_if_fail (element != NULL, NULL);
monitor->element = gst_object_ref (element);
monitor =
g_object_new (GST_TYPE_QA_ELEMENT_MONITOR, "object",
G_TYPE_OBJECT, element, NULL);
if (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor) == NULL) {
g_object_unref (monitor);
return NULL;
}
return monitor;
}
static gboolean
gst_qa_element_monitor_do_setup (GstQaElementMonitor * monitor)
gst_qa_element_monitor_do_setup (GstQaMonitor * monitor)
{
GstIterator *iterator;
gboolean done;
GstPad *pad;
GstQaElementMonitor *elem_monitor;
if (!GST_IS_ELEMENT (GST_QA_MONITOR_GET_OBJECT (monitor))) {
GST_WARNING_OBJECT (monitor, "Trying to create element monitor with other "
"type of object");
return FALSE;
}
elem_monitor = GST_QA_ELEMENT_MONITOR_CAST (monitor);
GST_DEBUG_OBJECT (monitor, "Setting up monitor for element %" GST_PTR_FORMAT,
monitor->element);
GST_QA_MONITOR_GET_OBJECT (monitor));
monitor->pad_added_id = g_signal_connect (monitor->element, "pad-added",
elem_monitor->pad_added_id =
g_signal_connect (GST_QA_MONITOR_GET_OBJECT (monitor), "pad-added",
G_CALLBACK (_qa_element_pad_added), monitor);
iterator = gst_element_iterate_pads (monitor->element);
iterator =
gst_element_iterate_pads (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor));
done = FALSE;
while (!done) {
switch (gst_iterator_next (iterator, (gpointer *) & pad)) {
case GST_ITERATOR_OK:
gst_qa_element_monitor_wrap_pad (monitor, pad);
gst_qa_element_monitor_wrap_pad (elem_monitor, pad);
gst_object_unref (pad);
break;
case GST_ITERATOR_RESYNC:
@ -133,19 +150,6 @@ gst_qa_element_monitor_do_setup (GstQaElementMonitor * monitor)
return TRUE;
}
gboolean
gst_qa_element_monitor_setup (GstQaElementMonitor * monitor)
{
gboolean ret;
if (monitor->setup)
return TRUE;
ret = GST_QA_ELEMENT_MONITOR_GET_CLASS (monitor)->setup (monitor);
if (ret)
monitor->setup = TRUE;
return ret;
}
static void
gst_qa_element_monitor_wrap_pad (GstQaElementMonitor * monitor, GstPad * pad)
{
@ -157,6 +161,6 @@ static void
_qa_element_pad_added (GstElement * element, GstPad * pad,
GstQaElementMonitor * monitor)
{
g_return_if_fail (monitor->element == element);
g_return_if_fail (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor) == element);
gst_qa_element_monitor_wrap_pad (monitor, pad);
}

View file

@ -25,6 +25,8 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-qa-monitor.h"
G_BEGIN_DECLS
#define GST_TYPE_QA_ELEMENT_MONITOR (gst_qa_element_monitor_get_type ())
@ -36,6 +38,8 @@ G_BEGIN_DECLS
#define GST_QA_ELEMENT_MONITOR_CAST(obj) ((GstQaElementMonitor*)(obj))
#define GST_QA_ELEMENT_MONITOR_CLASS_CAST(klass) ((GstQaElementMonitorClass*)(klass))
#define GST_QA_ELEMENT_MONITOR_GET_ELEMENT(m) (GST_ELEMENT_CAST (GST_QA_MONITOR_GET_OBJECT (m)))
typedef struct _GstQaElementMonitor GstQaElementMonitor;
typedef struct _GstQaElementMonitorClass GstQaElementMonitorClass;
@ -47,10 +51,7 @@ typedef struct _GstQaElementMonitorClass GstQaElementMonitorClass;
* Class that wraps a #GstElement for QA checks
*/
struct _GstQaElementMonitor {
GObject object;
gboolean setup;
GstElement *element;
GstQaMonitor parent;
/*< private >*/
gulong pad_added_id;
@ -64,16 +65,13 @@ struct _GstQaElementMonitor {
* GStreamer QA ElementMonitor object class.
*/
struct _GstQaElementMonitorClass {
GObjectClass parent_class;
gboolean (* setup) (GstQaElementMonitor * monitor);
GstQaMonitorClass parent_class;
};
/* normal GObject stuff */
GType gst_qa_element_monitor_get_type (void);
GstQaElementMonitor * gst_qa_element_monitor_new (GstElement * element);
gboolean gst_qa_element_monitor_setup (GstQaElementMonitor * element_monitor);
G_END_DECLS

View file

@ -28,7 +28,9 @@ gst_qa_monitor_factory_create (GstElement * element)
g_return_val_if_fail (element != NULL, NULL);
if (GST_IS_BIN (element)) {
return gst_qa_bin_monitor_new (GST_BIN_CAST (element));
return
GST_QA_ELEMENT_MONITOR_CAST (gst_qa_bin_monitor_new (GST_BIN_CAST
(element)));
}
return gst_qa_element_monitor_new (element);

View file

@ -0,0 +1,160 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-element-monitor.c - QA Monitor class
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gst-qa-monitor.h"
/**
* SECTION:gst-qa-monitor
* @short_description: Base class that wraps a #GObject for QA checks
*
* TODO
*/
enum
{
PROP_0,
PROP_OBJECT,
PROP_LAST
};
GST_DEBUG_CATEGORY_STATIC (gst_qa_monitor_debug);
#define GST_CAT_DEFAULT gst_qa_monitor_debug
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_qa_monitor_debug, "qa_monitor", 0, "QA Monitor");
#define gst_qa_monitor_parent_class parent_class
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstQaMonitor, gst_qa_monitor,
G_TYPE_OBJECT, _do_init);
static gboolean gst_qa_monitor_do_setup (GstQaMonitor * monitor);
static void
gst_qa_monitor_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void
gst_qa_monitor_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void
gst_qa_monitor_dispose (GObject * object)
{
GstQaMonitor *monitor = GST_QA_MONITOR_CAST (object);
g_mutex_clear (&monitor->mutex);
if (monitor->object)
g_object_unref (monitor->object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_qa_monitor_class_init (GstQaMonitorClass * klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = gst_qa_monitor_get_property;
gobject_class->set_property = gst_qa_monitor_set_property;
gobject_class->dispose = gst_qa_monitor_dispose;
klass->setup = gst_qa_monitor_do_setup;
g_object_class_install_property (gobject_class, PROP_OBJECT,
g_param_spec_object ("object", "Object", "The object to be monitored",
G_TYPE_OBJECT, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE));
}
static void
gst_qa_monitor_init (GstQaMonitor * monitor)
{
g_mutex_init (&monitor->mutex);
}
/**
* gst_qa_monitor_new:
* @element: (transfer-none): a #GObject to run QA on
*/
GstQaMonitor *
gst_qa_monitor_new (GObject * object)
{
GstQaMonitor *monitor = g_object_new (GST_TYPE_QA_MONITOR, "object",
G_TYPE_OBJECT, object, NULL);
if (GST_QA_MONITOR_GET_OBJECT (monitor) == NULL) {
/* setup failed, no use on returning this monitor */
g_object_unref (monitor);
return NULL;
}
return monitor;
}
static gboolean
gst_qa_monitor_do_setup (GstQaMonitor * monitor)
{
/* NOP */
return TRUE;
}
gboolean
gst_qa_monitor_setup (GstQaMonitor * monitor)
{
return GST_QA_MONITOR_GET_CLASS (monitor)->setup (monitor);
}
static void
gst_qa_monitor_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstQaMonitor *monitor;
monitor = GST_QA_MONITOR_CAST (object);
switch (prop_id) {
case PROP_OBJECT:
g_assert (monitor->object == NULL);
monitor->object = g_value_get_object (value);
gst_qa_monitor_setup (monitor);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_qa_monitor_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstQaMonitor *monitor;
monitor = GST_QA_MONITOR_CAST (object);
switch (prop_id) {
case PROP_OBJECT:
g_value_set_object (value, GST_QA_MONITOR_GET_OBJECT (monitor));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}

View file

@ -0,0 +1,80 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-monitor.h - QA Monitor abstract base class
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_QA_MONITOR_H__
#define __GST_QA_MONITOR_H__
#include <glib-object.h>
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_QA_MONITOR (gst_qa_monitor_get_type ())
#define GST_IS_QA_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QA_MONITOR))
#define GST_IS_QA_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QA_MONITOR))
#define GST_QA_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QA_MONITOR, GstQaMonitorClass))
#define GST_QA_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QA_MONITOR, GstQaMonitor))
#define GST_QA_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QA_MONITOR, GstQaMonitorClass))
#define GST_QA_MONITOR_CAST(obj) ((GstQaMonitor*)(obj))
#define GST_QA_MONITOR_CLASS_CAST(klass) ((GstQaMonitorClass*)(klass))
#define GST_QA_MONITOR_GET_OBJECT(m) (GST_QA_MONITOR_CAST (m)->object)
#define GST_QA_MONITOR_LOCK(m) (g_mutex_lock (&GST_QA_MONITOR_CAST(m)->mutex))
#define GST_QA_MONITOR_UNLOCK(m) (g_mutex_unlock (&GST_QA_MONITOR_CAST(m)->mutex))
typedef struct _GstQaMonitor GstQaMonitor;
typedef struct _GstQaMonitorClass GstQaMonitorClass;
/**
* GstQaMonitor:
*
* GStreamer QA Monitor class.
*
* Class that wraps a #GObject for QA checks
*/
struct _GstQaMonitor {
GObject parent;
GObject *object;
GMutex mutex;
/*< private >*/
};
/**
* GstQaMonitorClass:
* @parent_class: parent
*
* GStreamer QA Monitor object class.
*/
struct _GstQaMonitorClass {
GObjectClass parent_class;
gboolean (* setup) (GstQaMonitor * monitor);
};
/* normal GObject stuff */
GType gst_qa_monitor_get_type (void);
G_END_DECLS
#endif /* __GST_QA_MONITOR_H__ */

View file

@ -35,35 +35,33 @@ GST_DEBUG_CATEGORY_STATIC (gst_qa_pad_monitor_debug);
GST_DEBUG_CATEGORY_INIT (gst_qa_pad_monitor_debug, "qa_pad_monitor", 0, "QA PadMonitor");
#define gst_qa_pad_monitor_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstQaPadMonitor, gst_qa_pad_monitor,
G_TYPE_OBJECT, _do_init);
GST_TYPE_QA_MONITOR, _do_init);
static gboolean gst_qa_pad_monitor_do_setup (GstQaMonitor * monitor);
static void
gst_qa_pad_monitor_dispose (GObject * object)
{
GstQaPadMonitor *monitor = GST_QA_PAD_MONITOR_CAST (object);
if (monitor->pad)
gst_object_unref (monitor->pad);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_qa_pad_monitor_class_init (GstQaPadMonitorClass * klass)
{
GObjectClass *gobject_class;
GstQaMonitorClass *monitor_klass;
gobject_class = G_OBJECT_CLASS (klass);
monitor_klass = GST_QA_MONITOR_CLASS (klass);
gobject_class->dispose = gst_qa_pad_monitor_dispose;
monitor_klass->setup = gst_qa_pad_monitor_do_setup;
}
static void
gst_qa_pad_monitor_init (GstQaPadMonitor * pad_monitor)
{
pad_monitor->setup = FALSE;
}
/**
@ -73,23 +71,24 @@ gst_qa_pad_monitor_init (GstQaPadMonitor * pad_monitor)
GstQaPadMonitor *
gst_qa_pad_monitor_new (GstPad * pad)
{
GstQaPadMonitor *monitor = g_object_new (GST_TYPE_QA_PAD_MONITOR, NULL);
GstQaPadMonitor *monitor = g_object_new (GST_TYPE_QA_PAD_MONITOR,
"object", G_TYPE_OBJECT, pad, NULL);
g_return_val_if_fail (pad != NULL, NULL);
monitor->pad = gst_object_ref (pad);
if (GST_QA_PAD_MONITOR_GET_PAD (monitor) == NULL) {
g_object_unref (monitor);
return NULL;
}
return monitor;
}
gboolean
gst_qa_pad_monitor_setup (GstQaPadMonitor * monitor)
static gboolean
gst_qa_pad_monitor_do_setup (GstQaMonitor * monitor)
{
if (monitor->setup)
return TRUE;
if (!GST_IS_PAD (GST_QA_MONITOR_GET_OBJECT (monitor))) {
GST_WARNING_OBJECT (monitor, "Trying to create pad monitor with other "
"type of object");
return FALSE;
}
GST_DEBUG_OBJECT (monitor, "Setting up monitor for pad %" GST_PTR_FORMAT,
monitor->pad);
monitor->setup = TRUE;
return TRUE;
}

View file

@ -25,6 +25,8 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-qa-monitor.h"
G_BEGIN_DECLS
#define GST_TYPE_QA_PAD_MONITOR (gst_qa_pad_monitor_get_type ())
@ -36,6 +38,8 @@ G_BEGIN_DECLS
#define GST_QA_PAD_MONITOR_CAST(obj) ((GstQaPadMonitor*)(obj))
#define GST_QA_PAD_MONITOR_CLASS_CAST(klass) ((GstQaPadMonitorClass*)(klass))
#define GST_QA_PAD_MONITOR_GET_PAD(m) (GST_PAD_CAST (GST_QA_MONITOR_GET_OBJECT (m)))
typedef struct _GstQaPadMonitor GstQaPadMonitor;
typedef struct _GstQaPadMonitorClass GstQaPadMonitorClass;
@ -47,7 +51,7 @@ typedef struct _GstQaPadMonitorClass GstQaPadMonitorClass;
* Class that wraps a #GstPad for QA checks
*/
struct _GstQaPadMonitor {
GObject object;
GstQaMonitor parent;
gboolean setup;
GstPad *pad;
@ -62,14 +66,13 @@ struct _GstQaPadMonitor {
* GStreamer QA PadMonitor object class.
*/
struct _GstQaPadMonitorClass {
GObjectClass parent_class;
GstQaMonitorClass parent_class;
};
/* normal GObject stuff */
GType gst_qa_pad_monitor_get_type (void);
GstQaPadMonitor * gst_qa_pad_monitor_new (GstPad * pad);
gboolean gst_qa_pad_monitor_setup (GstQaPadMonitor * pad_monitor);
G_END_DECLS