debug: port to 0.11, disable others

Diasable the efence and capsdebug elements, port them later.
This commit is contained in:
Wim Taymans 2011-07-10 11:40:40 +02:00
parent 3b4afcb8df
commit 1c4ec02be9
11 changed files with 150 additions and 84 deletions

View file

@ -1,7 +1,7 @@
if GST_HAVE_MMAP
EFENCE_PLUGIN=libgstefence.la
else
EFENCE_PLUGIN=
else
EFENCE_PLUGIN=libgstefence.la
endif
plugin_LTLIBRARIES = $(EFENCE_PLUGIN) libgstdebug.la libgstnavigationtest.la
@ -35,7 +35,6 @@ libgstnavigationtest_la_LIBTOOLFLAGS = --tag=disable-static
libgstdebug_la_SOURCES = \
gstdebug.c \
breakmydata.c \
gstcapsdebug.c \
gstcapssetter.c \
gstnavseek.c \
gstpushfilesrc.c \
@ -46,6 +45,8 @@ libgstdebug_la_SOURCES = \
cpureport.c \
testplugin.c
# gstcapsdebug.c
libgstdebug_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS)
libgstdebug_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
libgstdebug_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)

View file

@ -222,7 +222,8 @@ static GstFlowReturn
gst_break_my_data_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
{
GstBreakMyData *bmd = GST_BREAK_MY_DATA (trans);
guint i, size;
guint8 *data;
gsize i, size;
g_return_val_if_fail (gst_buffer_is_writable (buf), GST_FLOW_ERROR);
@ -234,7 +235,7 @@ gst_break_my_data_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
i = 0;
}
size = GST_BUFFER_SIZE (buf);
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE);
GST_LOG_OBJECT (bmd,
"got buffer %p (size %u, timestamp %" G_GUINT64_FORMAT ", offset %"
@ -251,13 +252,14 @@ gst_break_my_data_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
new = bmd->set;
}
GST_INFO_OBJECT (bmd, "changing byte %u from 0x%02X to 0x%02X", i,
(guint) GST_READ_UINT8 (GST_BUFFER_DATA (buf) + i),
(guint) ((guint8) new));
GST_BUFFER_DATA (buf)[i] = new;
(guint) GST_READ_UINT8 (data + i), (guint) ((guint8) new));
data[i] = new;
}
}
/* don't overflow */
bmd->skipped += MIN (G_MAXUINT - bmd->skipped, GST_BUFFER_SIZE (buf));
bmd->skipped += MIN (G_MAXUINT - bmd->skipped, size);
gst_buffer_unmap (buf, data, size);
GST_OBJECT_UNLOCK (bmd);

View file

@ -102,8 +102,7 @@ gst_meta_fenced_get_info (void)
sizeof (GstMetaFenced),
(GstMetaInitFunction) NULL,
(GstMetaFreeFunction) NULL,
(GstMetaTransformFunction) NULL,
(GstMetaSerializeFunction) NULL, (GstMetaDeserializeFunction) NULL);
(GstMetaCopyFunction) NULL, (GstMetaTransformFunction) NULL);
}
return meta_fenced_info;
}

View file

@ -97,10 +97,10 @@ GST_STATIC_PAD_TEMPLATE (GST_BASE_TRANSFORM_SINK_NAME,
static gboolean gst_caps_setter_transform_size (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, guint size,
GstCaps * othercaps, guint * othersize);
GstPadDirection direction, GstCaps * caps, gsize size,
GstCaps * othercaps, gsize * othersize);
static GstCaps *gst_caps_setter_transform_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps);
GstPadDirection direction, GstCaps * caps, GstCaps * cfilter);
static GstFlowReturn gst_caps_setter_transform_ip (GstBaseTransform * btrans,
GstBuffer * in);
@ -179,8 +179,8 @@ gst_caps_setter_finalize (GObject * object)
static gboolean
gst_caps_setter_transform_size (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, guint size,
GstCaps * othercaps, guint * othersize)
GstPadDirection direction, GstCaps * caps, gsize size,
GstCaps * othercaps, gsize * othersize)
{
*othersize = size;
@ -189,7 +189,7 @@ gst_caps_setter_transform_size (GstBaseTransform * trans,
static GstCaps *
gst_caps_setter_transform_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps)
GstPadDirection direction, GstCaps * caps, GstCaps * cfilter)
{
GstCapsSetter *filter = GST_CAPS_SETTER (trans);
GstCaps *ret, *filter_caps;

View file

@ -24,7 +24,7 @@
#include <gst/gst.h>
GType gst_break_my_data_get_type (void);
GType gst_caps_debug_get_type (void);
//GType gst_caps_debug_get_type (void);
GType gst_caps_setter_get_type (void);
GType gst_rnd_buffer_size_get_type (void);
GType gst_navseek_get_type (void);
@ -57,8 +57,10 @@ plugin_init (GstPlugin * plugin)
gst_tag_inject_get_type ())
|| !gst_element_register (plugin, "testsink", GST_RANK_NONE,
gst_test_get_type ())
#if 0
|| !gst_element_register (plugin, "capsdebug", GST_RANK_NONE,
gst_caps_debug_get_type ())
#endif
|| !gst_element_register (plugin, "cpureport", GST_RANK_NONE,
gst_cpu_report_get_type ()))

View file

@ -39,14 +39,14 @@ static GstStaticPadTemplate gst_navigationtest_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
);
static GstStaticPadTemplate gst_navigationtest_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
);
static GstVideoFilterClass *parent_class = NULL;
@ -65,8 +65,8 @@ gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event)
const GstStructure *s = gst_event_get_structure (event);
gint fps_n, fps_d;
fps_n = gst_value_get_fraction_numerator ((&navtest->framerate));
fps_d = gst_value_get_fraction_denominator ((&navtest->framerate));
fps_n = GST_VIDEO_INFO_FPS_N (&navtest->info);
fps_d = GST_VIDEO_INFO_FPS_D (&navtest->info);
type = gst_structure_get_string (s, "event");
if (g_str_equal (type, "mouse-move")) {
@ -116,7 +116,7 @@ gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event)
static gboolean
gst_navigationtest_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
guint * size)
gsize * size)
{
GstNavigationtest *navtest;
GstStructure *structure;
@ -143,31 +143,34 @@ gst_navigationtest_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
{
GstNavigationtest *navtest = GST_NAVIGATIONTEST (btrans);
gboolean ret = FALSE;
GstStructure *structure;
GstVideoInfo info;
structure = gst_caps_get_structure (incaps, 0);
if (!gst_video_info_from_caps (&info, incaps))
goto invalid_caps;
if (gst_structure_get_int (structure, "width", &navtest->width) &&
gst_structure_get_int (structure, "height", &navtest->height)) {
const GValue *framerate;
navtest->info = info;
framerate = gst_structure_get_value (structure, "framerate");
if (framerate && GST_VALUE_HOLDS_FRACTION (framerate)) {
g_value_copy (framerate, &navtest->framerate);
ret = TRUE;
}
return TRUE;
/* ERRORS */
invalid_caps:
{
GST_ERROR_OBJECT (navtest, "invalid caps");
return FALSE;
}
return ret;
}
static void
draw_box_planar411 (guint8 * dest, int width, int height, int x, int y,
draw_box_planar411 (GstVideoFrame * frame, int x, int y,
guint8 colory, guint8 coloru, guint8 colorv)
{
gint width, height;
int x1, x2, y1, y2;
guint8 *d = dest;
guint8 *d;
gint stride;
width = GST_VIDEO_FRAME_WIDTH (frame);
height = GST_VIDEO_FRAME_HEIGHT (frame);
if (x < 0 || y < 0 || x >= width || y >= height)
return;
@ -177,27 +180,34 @@ draw_box_planar411 (guint8 * dest, int width, int height, int x, int y,
y1 = MAX (y - 5, 0);
y2 = MIN (y + 5, height);
d = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
((guint8 *) d)[y * GST_VIDEO_I420_Y_ROWSTRIDE (width) + x] = colory;
d[y * stride + x] = colory;
}
}
d = dest + GST_VIDEO_I420_U_OFFSET (width, height);
d = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
x1 /= 2;
x2 /= 2;
y1 /= 2;
y2 /= 2;
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
((guint8 *) d)[y * GST_VIDEO_I420_U_ROWSTRIDE (width) + x] = coloru;
d[y * stride + x] = coloru;
}
}
d = dest + GST_VIDEO_I420_V_OFFSET (width, height);
d = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
((guint8 *) d)[y * GST_VIDEO_I420_V_ROWSTRIDE (width) + x] = colorv;
d[y * stride + x] = colorv;
}
}
}
@ -208,31 +218,48 @@ gst_navigationtest_transform (GstBaseTransform * trans, GstBuffer * in,
{
GstNavigationtest *navtest = GST_NAVIGATIONTEST (trans);
GSList *walk;
GstFlowReturn ret = GST_FLOW_OK;
GstVideoFrame in_frame, out_frame;
/* do something interesting here. This simply copies the source
* to the destination. */
gst_buffer_copy_metadata (out, in, GST_BUFFER_COPY_TIMESTAMPS);
if (!gst_video_frame_map (&in_frame, &navtest->info, in, GST_MAP_READ))
goto invalid_in;
memcpy (GST_BUFFER_DATA (out), GST_BUFFER_DATA (in),
MIN (GST_BUFFER_SIZE (in), GST_BUFFER_SIZE (out)));
if (!gst_video_frame_map (&out_frame, &navtest->info, out, GST_MAP_WRITE))
goto invalid_out;
gst_video_frame_copy (&out_frame, &in_frame);
walk = navtest->clicks;
while (walk) {
ButtonClick *click = walk->data;
walk = g_slist_next (walk);
draw_box_planar411 (GST_BUFFER_DATA (out), navtest->width, navtest->height,
draw_box_planar411 (&out_frame,
rint (click->x), rint (click->y), click->cy, click->cu, click->cv);
if (--click->images_left < 1) {
navtest->clicks = g_slist_remove (navtest->clicks, click);
g_free (click);
}
}
draw_box_planar411 (GST_BUFFER_DATA (out), navtest->width, navtest->height,
draw_box_planar411 (&out_frame,
rint (navtest->x), rint (navtest->y), 0, 128, 128);
return ret;
gst_video_frame_unmap (&out_frame);
gst_video_frame_unmap (&in_frame);
return GST_FLOW_OK;
/* ERRORS */
invalid_in:
{
GST_ERROR_OBJECT (navtest, "received invalid input buffer");
return GST_FLOW_OK;
}
invalid_out:
{
GST_ERROR_OBJECT (navtest, "received invalid output buffer");
gst_video_frame_unmap (&in_frame);
return GST_FLOW_OK;
}
}
static GstStateChangeReturn
@ -308,7 +335,6 @@ gst_navigationtest_init (GTypeInstance * instance, gpointer g_class)
navtest->x = -1;
navtest->y = -1;
g_value_init (&navtest->framerate, GST_TYPE_FRACTION);
}
GType

View file

@ -21,6 +21,7 @@
#ifndef __GST_NAVIGATIONTEST_H__
#define __GST_NAVIGATIONTEST_H__
#include <gst/video/video.h>
#include <gst/video/gstvideofilter.h>
G_BEGIN_DECLS
@ -49,11 +50,9 @@ struct _GstNavigationtest
{
GstVideoFilter videofilter;
gint width, height;
GstVideoInfo info;
GValue framerate;
gdouble x, y;
GSList *clicks;
};

View file

@ -102,9 +102,20 @@ gst_push_file_src_class_init (GstPushFileSrcClass * g_class)
}
static gboolean
gst_push_file_src_ghostpad_checkgetrange (GstPad * pad)
gst_push_file_src_ghostpad_query (GstPad * pad, GstQuery * query)
{
return FALSE;
gboolean res;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_SCHEDULING:
gst_query_set_scheduling (query, FALSE, TRUE, FALSE, 1, -1, 1);
res = TRUE;
break;
default:
res = gst_proxy_pad_query_default (pad, query);
break;
}
return res;
}
static void
@ -120,8 +131,8 @@ gst_push_file_src_init (GstPushFileSrc * src)
src->srcpad = gst_ghost_pad_new ("src", pad);
/* FIXME^H^HCORE: try pushfile:///foo/bar.ext ! typefind ! fakesink without
* this and watch core bugginess (some pad stays in flushing state) */
gst_pad_set_checkgetrange_function (src->srcpad,
GST_DEBUG_FUNCPTR (gst_push_file_src_ghostpad_checkgetrange));
gst_pad_set_query_function (src->srcpad,
GST_DEBUG_FUNCPTR (gst_push_file_src_ghostpad_query));
gst_element_add_pad (GST_ELEMENT (src), src->srcpad);
gst_object_unref (pad);
}
@ -130,13 +141,13 @@ gst_push_file_src_init (GstPushFileSrc * src)
/*** GSTURIHANDLER INTERFACE *************************************************/
static GstURIType
gst_push_file_src_uri_get_type (void)
gst_push_file_src_uri_get_type (GType type)
{
return GST_URI_SRC;
}
static gchar **
gst_push_file_src_uri_get_protocols (void)
gst_push_file_src_uri_get_protocols (GType type)
{
static gchar *protocols[] = { (char *) "pushfile", NULL };

View file

@ -247,8 +247,7 @@ gst_progress_report_do_query (GstProgressReport * filter, GstFormat format,
GstBaseTransform *base = GST_BASE_TRANSFORM (filter);
GST_LOG_OBJECT (filter, "using buffer metadata");
if (format == GST_FORMAT_TIME && base->have_newsegment &&
base->segment.format == GST_FORMAT_TIME) {
if (format == GST_FORMAT_TIME && base->segment.format == GST_FORMAT_TIME) {
cur = gst_segment_to_stream_time (&base->segment, format,
GST_BUFFER_TIMESTAMP (buf));
total = base->segment.duration;
@ -276,17 +275,20 @@ gst_progress_report_do_query (GstProgressReport * filter, GstFormat format,
GstCaps *caps;
format_name = "bogounits";
caps = GST_PAD_CAPS (GST_BASE_TRANSFORM (filter)->sinkpad);
if (caps && gst_caps_is_fixed (caps) && !gst_caps_is_any (caps)) {
GstStructure *s = gst_caps_get_structure (caps, 0);
const gchar *mime_type = gst_structure_get_name (s);
caps = gst_pad_get_current_caps (GST_BASE_TRANSFORM (filter)->sinkpad);
if (caps) {
if (gst_caps_is_fixed (caps) && !gst_caps_is_any (caps)) {
GstStructure *s = gst_caps_get_structure (caps, 0);
const gchar *mime_type = gst_structure_get_name (s);
if (g_str_has_prefix (mime_type, "video/") ||
g_str_has_prefix (mime_type, "image/")) {
format_name = "frames";
} else if (g_str_has_prefix (mime_type, "audio/")) {
format_name = "samples";
if (g_str_has_prefix (mime_type, "video/") ||
g_str_has_prefix (mime_type, "image/")) {
format_name = "frames";
} else if (g_str_has_prefix (mime_type, "audio/")) {
format_name = "samples";
}
}
gst_caps_unref (caps);
}
break;
}

View file

@ -217,10 +217,28 @@ gst_rnd_buffer_size_get_property (GObject * object, guint prop_id,
static gboolean
gst_rnd_buffer_size_activate (GstPad * pad)
{
if (gst_pad_check_pull_range (pad)) {
return gst_pad_activate_pull (pad, TRUE);
} else {
GST_INFO_OBJECT (pad, "push mode not supported");
GstQuery *query;
gboolean pull_mode;
query = gst_query_new_scheduling ();
if (!gst_pad_peer_query (pad, query)) {
gst_query_unref (query);
goto no_pull;
}
gst_query_parse_scheduling (query, &pull_mode, NULL, NULL, NULL, NULL, NULL);
if (!pull_mode)
goto no_pull;
GST_DEBUG_OBJECT (pad, "activating pull");
return gst_pad_activate_pull (pad, TRUE);
/* ERRORS */
no_pull:
{
GST_DEBUG_OBJECT (pad, "pull mode not supported");
return FALSE;
}
}
@ -247,7 +265,7 @@ gst_rnd_buffer_size_loop (GstRndBufferSize * self)
{
GstBuffer *buf = NULL;
GstFlowReturn ret;
guint num_bytes;
guint num_bytes, size;
if (G_UNLIKELY (self->min > self->max))
goto bogus_minmax;
@ -266,11 +284,13 @@ gst_rnd_buffer_size_loop (GstRndBufferSize * self)
if (ret != GST_FLOW_OK)
goto pull_failed;
if (GST_BUFFER_SIZE (buf) < num_bytes) {
GST_WARNING_OBJECT (self, "short buffer: %u bytes", GST_BUFFER_SIZE (buf));
size = gst_buffer_get_size (buf);
if (size < num_bytes) {
GST_WARNING_OBJECT (self, "short buffer: %u bytes", size);
}
self->offset += GST_BUFFER_SIZE (buf);
self->offset += size;
ret = gst_pad_push (self->srcpad, buf);

View file

@ -64,7 +64,7 @@ length_add (gpointer test, GstBuffer * buffer)
{
LengthTest *t = test;
t->value += GST_BUFFER_SIZE (buffer);
t->value += gst_buffer_get_size (buffer);
}
static gboolean
@ -214,8 +214,12 @@ md5_new (const GstTestInfo * info)
static void
md5_add (gpointer checksum, GstBuffer * buffer)
{
g_checksum_update (checksum, GST_BUFFER_DATA (buffer),
GST_BUFFER_SIZE (buffer));
guint8 *data;
gsize size;
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
g_checksum_update (checksum, data, size);
gst_buffer_unmap (buffer, data, size);
}
static gboolean