mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-20 19:10:18 +00:00
ce0e8ab697
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
94 lines
2.6 KiB
C
94 lines
2.6 KiB
C
/* GStreamer
|
|
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
|
|
*
|
|
* gst-qa-pad-monitor.c - QA PadMonitor 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-pad-monitor.h"
|
|
|
|
/**
|
|
* SECTION:gst-qa-pad-monitor
|
|
* @short_description: Class that wraps a #GstPad for QA checks
|
|
*
|
|
* TODO
|
|
*/
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_qa_pad_monitor_debug);
|
|
#define GST_CAT_DEFAULT gst_qa_pad_monitor_debug
|
|
|
|
#define _do_init \
|
|
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,
|
|
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)
|
|
{
|
|
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)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* gst_qa_pad_monitor_new:
|
|
* @pad: (transfer-none): a #GstPad to run QA on
|
|
*/
|
|
GstQaPadMonitor *
|
|
gst_qa_pad_monitor_new (GstPad * pad)
|
|
{
|
|
GstQaPadMonitor *monitor = g_object_new (GST_TYPE_QA_PAD_MONITOR,
|
|
"object", G_TYPE_OBJECT, pad, NULL);
|
|
|
|
if (GST_QA_PAD_MONITOR_GET_PAD (monitor) == NULL) {
|
|
g_object_unref (monitor);
|
|
return NULL;
|
|
}
|
|
return monitor;
|
|
}
|
|
|
|
static gboolean
|
|
gst_qa_pad_monitor_do_setup (GstQaMonitor * monitor)
|
|
{
|
|
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;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|