summaryrefslogtreecommitdiff
path: root/gst/debugutils/gstchecksumsink.c
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-02-02 23:21:50 +0100
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-02-02 23:21:50 +0100
commitbc0dd274ee9a79a9ded0e1bdfa54e77ce32ac8dd (patch)
tree2c0f6221f4c25a14ee1114a40c8a30315c6736fb /gst/debugutils/gstchecksumsink.c
parent260e2e74271664868e36e44131ae214a06f12aed (diff)
downloadgstreamer-plugins-bad-bc0dd274ee9a79a9ded0e1bdfa54e77ce32ac8dd.tar.gz
debugutils: port to 0.11
Diffstat (limited to 'gst/debugutils/gstchecksumsink.c')
-rw-r--r--gst/debugutils/gstchecksumsink.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/gst/debugutils/gstchecksumsink.c b/gst/debugutils/gstchecksumsink.c
index bf9fba6f2..62f620810 100644
--- a/gst/debugutils/gstchecksumsink.c
+++ b/gst/debugutils/gstchecksumsink.c
@@ -47,28 +47,14 @@ GST_STATIC_PAD_TEMPLATE ("src",
/* class initialization */
-GST_BOILERPLATE (GstChecksumSink, gst_checksum_sink, GstBaseSink,
- GST_TYPE_BASE_SINK);
-
-static void
-gst_checksum_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_checksum_sink_src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_checksum_sink_sink_template));
-
- gst_element_class_set_details_simple (element_class, "Checksum sink",
- "Debug/Sink", "Calculates a checksum for buffers",
- "David Schleef <ds@schleef.org>");
-}
+#define gst_checksum_sink_parent_class parent_class
+G_DEFINE_TYPE (GstChecksumSink, gst_checksum_sink, GST_TYPE_BASE_SINK);
static void
gst_checksum_sink_class_init (GstChecksumSinkClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
gobject_class->dispose = gst_checksum_sink_dispose;
@@ -76,11 +62,19 @@ gst_checksum_sink_class_init (GstChecksumSinkClass * klass)
base_sink_class->start = GST_DEBUG_FUNCPTR (gst_checksum_sink_start);
base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_checksum_sink_stop);
base_sink_class->render = GST_DEBUG_FUNCPTR (gst_checksum_sink_render);
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_checksum_sink_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_checksum_sink_sink_template));
+
+ gst_element_class_set_details_simple (element_class, "Checksum sink",
+ "Debug/Sink", "Calculates a checksum for buffers",
+ "David Schleef <ds@schleef.org>");
}
static void
-gst_checksum_sink_init (GstChecksumSink * checksumsink,
- GstChecksumSinkClass * checksumsink_class)
+gst_checksum_sink_init (GstChecksumSink * checksumsink)
{
gst_base_sink_set_sync (GST_BASE_SINK (checksumsink), FALSE);
}
@@ -113,9 +107,11 @@ static GstFlowReturn
gst_checksum_sink_render (GstBaseSink * sink, GstBuffer * buffer)
{
gchar *s;
+ GstMapInfo map;
- s = g_compute_checksum_for_data (G_CHECKSUM_SHA1, GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
+ gst_buffer_map (buffer, &map, GST_MAP_READ);
+ s = g_compute_checksum_for_data (G_CHECKSUM_SHA1, map.data, map.size);
+ gst_buffer_unmap (buffer, &map);
g_print ("%" GST_TIME_FORMAT " %s\n",
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)), s);