mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
debug: port to 0.11, disable others
Diasable the efence and capsdebug elements, port them later.
This commit is contained in:
parent
3b4afcb8df
commit
1c4ec02be9
11 changed files with 150 additions and 84 deletions
|
@ -1,7 +1,7 @@
|
||||||
if GST_HAVE_MMAP
|
if GST_HAVE_MMAP
|
||||||
EFENCE_PLUGIN=libgstefence.la
|
|
||||||
else
|
|
||||||
EFENCE_PLUGIN=
|
EFENCE_PLUGIN=
|
||||||
|
else
|
||||||
|
EFENCE_PLUGIN=libgstefence.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
plugin_LTLIBRARIES = $(EFENCE_PLUGIN) libgstdebug.la libgstnavigationtest.la
|
plugin_LTLIBRARIES = $(EFENCE_PLUGIN) libgstdebug.la libgstnavigationtest.la
|
||||||
|
@ -35,7 +35,6 @@ libgstnavigationtest_la_LIBTOOLFLAGS = --tag=disable-static
|
||||||
libgstdebug_la_SOURCES = \
|
libgstdebug_la_SOURCES = \
|
||||||
gstdebug.c \
|
gstdebug.c \
|
||||||
breakmydata.c \
|
breakmydata.c \
|
||||||
gstcapsdebug.c \
|
|
||||||
gstcapssetter.c \
|
gstcapssetter.c \
|
||||||
gstnavseek.c \
|
gstnavseek.c \
|
||||||
gstpushfilesrc.c \
|
gstpushfilesrc.c \
|
||||||
|
@ -46,6 +45,8 @@ libgstdebug_la_SOURCES = \
|
||||||
cpureport.c \
|
cpureport.c \
|
||||||
testplugin.c
|
testplugin.c
|
||||||
|
|
||||||
|
# gstcapsdebug.c
|
||||||
|
|
||||||
libgstdebug_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS)
|
libgstdebug_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS)
|
||||||
libgstdebug_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
|
libgstdebug_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
|
||||||
libgstdebug_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
libgstdebug_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
|
|
|
@ -222,7 +222,8 @@ static GstFlowReturn
|
||||||
gst_break_my_data_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
gst_break_my_data_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstBreakMyData *bmd = GST_BREAK_MY_DATA (trans);
|
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);
|
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;
|
i = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = GST_BUFFER_SIZE (buf);
|
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE);
|
||||||
|
|
||||||
GST_LOG_OBJECT (bmd,
|
GST_LOG_OBJECT (bmd,
|
||||||
"got buffer %p (size %u, timestamp %" G_GUINT64_FORMAT ", offset %"
|
"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;
|
new = bmd->set;
|
||||||
}
|
}
|
||||||
GST_INFO_OBJECT (bmd, "changing byte %u from 0x%02X to 0x%02X", i,
|
GST_INFO_OBJECT (bmd, "changing byte %u from 0x%02X to 0x%02X", i,
|
||||||
(guint) GST_READ_UINT8 (GST_BUFFER_DATA (buf) + i),
|
(guint) GST_READ_UINT8 (data + i), (guint) ((guint8) new));
|
||||||
(guint) ((guint8) new));
|
data[i] = new;
|
||||||
GST_BUFFER_DATA (buf)[i] = new;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* don't overflow */
|
/* 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);
|
GST_OBJECT_UNLOCK (bmd);
|
||||||
|
|
||||||
|
|
|
@ -102,8 +102,7 @@ gst_meta_fenced_get_info (void)
|
||||||
sizeof (GstMetaFenced),
|
sizeof (GstMetaFenced),
|
||||||
(GstMetaInitFunction) NULL,
|
(GstMetaInitFunction) NULL,
|
||||||
(GstMetaFreeFunction) NULL,
|
(GstMetaFreeFunction) NULL,
|
||||||
(GstMetaTransformFunction) NULL,
|
(GstMetaCopyFunction) NULL, (GstMetaTransformFunction) NULL);
|
||||||
(GstMetaSerializeFunction) NULL, (GstMetaDeserializeFunction) NULL);
|
|
||||||
}
|
}
|
||||||
return meta_fenced_info;
|
return meta_fenced_info;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,10 +97,10 @@ GST_STATIC_PAD_TEMPLATE (GST_BASE_TRANSFORM_SINK_NAME,
|
||||||
|
|
||||||
|
|
||||||
static gboolean gst_caps_setter_transform_size (GstBaseTransform * trans,
|
static gboolean gst_caps_setter_transform_size (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * caps, guint size,
|
GstPadDirection direction, GstCaps * caps, gsize size,
|
||||||
GstCaps * othercaps, guint * othersize);
|
GstCaps * othercaps, gsize * othersize);
|
||||||
static GstCaps *gst_caps_setter_transform_caps (GstBaseTransform * trans,
|
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,
|
static GstFlowReturn gst_caps_setter_transform_ip (GstBaseTransform * btrans,
|
||||||
GstBuffer * in);
|
GstBuffer * in);
|
||||||
|
|
||||||
|
@ -179,8 +179,8 @@ gst_caps_setter_finalize (GObject * object)
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_caps_setter_transform_size (GstBaseTransform * trans,
|
gst_caps_setter_transform_size (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * caps, guint size,
|
GstPadDirection direction, GstCaps * caps, gsize size,
|
||||||
GstCaps * othercaps, guint * othersize)
|
GstCaps * othercaps, gsize * othersize)
|
||||||
{
|
{
|
||||||
*othersize = size;
|
*othersize = size;
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ gst_caps_setter_transform_size (GstBaseTransform * trans,
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_caps_setter_transform_caps (GstBaseTransform * trans,
|
gst_caps_setter_transform_caps (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * caps)
|
GstPadDirection direction, GstCaps * caps, GstCaps * cfilter)
|
||||||
{
|
{
|
||||||
GstCapsSetter *filter = GST_CAPS_SETTER (trans);
|
GstCapsSetter *filter = GST_CAPS_SETTER (trans);
|
||||||
GstCaps *ret, *filter_caps;
|
GstCaps *ret, *filter_caps;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
GType gst_break_my_data_get_type (void);
|
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_caps_setter_get_type (void);
|
||||||
GType gst_rnd_buffer_size_get_type (void);
|
GType gst_rnd_buffer_size_get_type (void);
|
||||||
GType gst_navseek_get_type (void);
|
GType gst_navseek_get_type (void);
|
||||||
|
@ -57,8 +57,10 @@ plugin_init (GstPlugin * plugin)
|
||||||
gst_tag_inject_get_type ())
|
gst_tag_inject_get_type ())
|
||||||
|| !gst_element_register (plugin, "testsink", GST_RANK_NONE,
|
|| !gst_element_register (plugin, "testsink", GST_RANK_NONE,
|
||||||
gst_test_get_type ())
|
gst_test_get_type ())
|
||||||
|
#if 0
|
||||||
|| !gst_element_register (plugin, "capsdebug", GST_RANK_NONE,
|
|| !gst_element_register (plugin, "capsdebug", GST_RANK_NONE,
|
||||||
gst_caps_debug_get_type ())
|
gst_caps_debug_get_type ())
|
||||||
|
#endif
|
||||||
|| !gst_element_register (plugin, "cpureport", GST_RANK_NONE,
|
|| !gst_element_register (plugin, "cpureport", GST_RANK_NONE,
|
||||||
gst_cpu_report_get_type ()))
|
gst_cpu_report_get_type ()))
|
||||||
|
|
||||||
|
|
|
@ -39,14 +39,14 @@ static GstStaticPadTemplate gst_navigationtest_src_template =
|
||||||
GST_STATIC_PAD_TEMPLATE ("src",
|
GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
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 =
|
static GstStaticPadTemplate gst_navigationtest_sink_template =
|
||||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
|
||||||
);
|
);
|
||||||
|
|
||||||
static GstVideoFilterClass *parent_class = NULL;
|
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);
|
const GstStructure *s = gst_event_get_structure (event);
|
||||||
gint fps_n, fps_d;
|
gint fps_n, fps_d;
|
||||||
|
|
||||||
fps_n = gst_value_get_fraction_numerator ((&navtest->framerate));
|
fps_n = GST_VIDEO_INFO_FPS_N (&navtest->info);
|
||||||
fps_d = gst_value_get_fraction_denominator ((&navtest->framerate));
|
fps_d = GST_VIDEO_INFO_FPS_D (&navtest->info);
|
||||||
|
|
||||||
type = gst_structure_get_string (s, "event");
|
type = gst_structure_get_string (s, "event");
|
||||||
if (g_str_equal (type, "mouse-move")) {
|
if (g_str_equal (type, "mouse-move")) {
|
||||||
|
@ -116,7 +116,7 @@ gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_navigationtest_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
gst_navigationtest_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
||||||
guint * size)
|
gsize * size)
|
||||||
{
|
{
|
||||||
GstNavigationtest *navtest;
|
GstNavigationtest *navtest;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
@ -143,31 +143,34 @@ gst_navigationtest_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
GstCaps * outcaps)
|
GstCaps * outcaps)
|
||||||
{
|
{
|
||||||
GstNavigationtest *navtest = GST_NAVIGATIONTEST (btrans);
|
GstNavigationtest *navtest = GST_NAVIGATIONTEST (btrans);
|
||||||
gboolean ret = FALSE;
|
GstVideoInfo info;
|
||||||
GstStructure *structure;
|
|
||||||
|
|
||||||
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) &&
|
navtest->info = info;
|
||||||
gst_structure_get_int (structure, "height", &navtest->height)) {
|
|
||||||
const GValue *framerate;
|
|
||||||
|
|
||||||
framerate = gst_structure_get_value (structure, "framerate");
|
return TRUE;
|
||||||
if (framerate && GST_VALUE_HOLDS_FRACTION (framerate)) {
|
|
||||||
g_value_copy (framerate, &navtest->framerate);
|
/* ERRORS */
|
||||||
ret = TRUE;
|
invalid_caps:
|
||||||
}
|
{
|
||||||
|
GST_ERROR_OBJECT (navtest, "invalid caps");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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)
|
guint8 colory, guint8 coloru, guint8 colorv)
|
||||||
{
|
{
|
||||||
|
gint width, height;
|
||||||
int x1, x2, y1, y2;
|
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)
|
if (x < 0 || y < 0 || x >= width || y >= height)
|
||||||
return;
|
return;
|
||||||
|
@ -177,27 +180,34 @@ draw_box_planar411 (guint8 * dest, int width, int height, int x, int y,
|
||||||
y1 = MAX (y - 5, 0);
|
y1 = MAX (y - 5, 0);
|
||||||
y2 = MIN (y + 5, height);
|
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 (y = y1; y < y2; y++) {
|
||||||
for (x = x1; x < x2; x++) {
|
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;
|
x1 /= 2;
|
||||||
x2 /= 2;
|
x2 /= 2;
|
||||||
y1 /= 2;
|
y1 /= 2;
|
||||||
y2 /= 2;
|
y2 /= 2;
|
||||||
for (y = y1; y < y2; y++) {
|
for (y = y1; y < y2; y++) {
|
||||||
for (x = x1; x < x2; x++) {
|
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 (y = y1; y < y2; y++) {
|
||||||
for (x = x1; x < x2; x++) {
|
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);
|
GstNavigationtest *navtest = GST_NAVIGATIONTEST (trans);
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstVideoFrame in_frame, out_frame;
|
||||||
|
|
||||||
/* do something interesting here. This simply copies the source
|
if (!gst_video_frame_map (&in_frame, &navtest->info, in, GST_MAP_READ))
|
||||||
* to the destination. */
|
goto invalid_in;
|
||||||
gst_buffer_copy_metadata (out, in, GST_BUFFER_COPY_TIMESTAMPS);
|
|
||||||
|
|
||||||
memcpy (GST_BUFFER_DATA (out), GST_BUFFER_DATA (in),
|
if (!gst_video_frame_map (&out_frame, &navtest->info, out, GST_MAP_WRITE))
|
||||||
MIN (GST_BUFFER_SIZE (in), GST_BUFFER_SIZE (out)));
|
goto invalid_out;
|
||||||
|
|
||||||
|
gst_video_frame_copy (&out_frame, &in_frame);
|
||||||
|
|
||||||
walk = navtest->clicks;
|
walk = navtest->clicks;
|
||||||
while (walk) {
|
while (walk) {
|
||||||
ButtonClick *click = walk->data;
|
ButtonClick *click = walk->data;
|
||||||
|
|
||||||
walk = g_slist_next (walk);
|
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);
|
rint (click->x), rint (click->y), click->cy, click->cu, click->cv);
|
||||||
if (--click->images_left < 1) {
|
if (--click->images_left < 1) {
|
||||||
navtest->clicks = g_slist_remove (navtest->clicks, click);
|
navtest->clicks = g_slist_remove (navtest->clicks, click);
|
||||||
g_free (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);
|
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
|
static GstStateChangeReturn
|
||||||
|
@ -308,7 +335,6 @@ gst_navigationtest_init (GTypeInstance * instance, gpointer g_class)
|
||||||
|
|
||||||
navtest->x = -1;
|
navtest->x = -1;
|
||||||
navtest->y = -1;
|
navtest->y = -1;
|
||||||
g_value_init (&navtest->framerate, GST_TYPE_FRACTION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#ifndef __GST_NAVIGATIONTEST_H__
|
#ifndef __GST_NAVIGATIONTEST_H__
|
||||||
#define __GST_NAVIGATIONTEST_H__
|
#define __GST_NAVIGATIONTEST_H__
|
||||||
|
|
||||||
|
#include <gst/video/video.h>
|
||||||
#include <gst/video/gstvideofilter.h>
|
#include <gst/video/gstvideofilter.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -49,11 +50,9 @@ struct _GstNavigationtest
|
||||||
{
|
{
|
||||||
GstVideoFilter videofilter;
|
GstVideoFilter videofilter;
|
||||||
|
|
||||||
gint width, height;
|
GstVideoInfo info;
|
||||||
|
|
||||||
GValue framerate;
|
|
||||||
gdouble x, y;
|
gdouble x, y;
|
||||||
|
|
||||||
GSList *clicks;
|
GSList *clicks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -102,9 +102,20 @@ gst_push_file_src_class_init (GstPushFileSrcClass * g_class)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
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
|
static void
|
||||||
|
@ -120,8 +131,8 @@ gst_push_file_src_init (GstPushFileSrc * src)
|
||||||
src->srcpad = gst_ghost_pad_new ("src", pad);
|
src->srcpad = gst_ghost_pad_new ("src", pad);
|
||||||
/* FIXME^H^HCORE: try pushfile:///foo/bar.ext ! typefind ! fakesink without
|
/* FIXME^H^HCORE: try pushfile:///foo/bar.ext ! typefind ! fakesink without
|
||||||
* this and watch core bugginess (some pad stays in flushing state) */
|
* this and watch core bugginess (some pad stays in flushing state) */
|
||||||
gst_pad_set_checkgetrange_function (src->srcpad,
|
gst_pad_set_query_function (src->srcpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_push_file_src_ghostpad_checkgetrange));
|
GST_DEBUG_FUNCPTR (gst_push_file_src_ghostpad_query));
|
||||||
gst_element_add_pad (GST_ELEMENT (src), src->srcpad);
|
gst_element_add_pad (GST_ELEMENT (src), src->srcpad);
|
||||||
gst_object_unref (pad);
|
gst_object_unref (pad);
|
||||||
}
|
}
|
||||||
|
@ -130,13 +141,13 @@ gst_push_file_src_init (GstPushFileSrc * src)
|
||||||
/*** GSTURIHANDLER INTERFACE *************************************************/
|
/*** GSTURIHANDLER INTERFACE *************************************************/
|
||||||
|
|
||||||
static GstURIType
|
static GstURIType
|
||||||
gst_push_file_src_uri_get_type (void)
|
gst_push_file_src_uri_get_type (GType type)
|
||||||
{
|
{
|
||||||
return GST_URI_SRC;
|
return GST_URI_SRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar **
|
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 };
|
static gchar *protocols[] = { (char *) "pushfile", NULL };
|
||||||
|
|
||||||
|
|
|
@ -247,8 +247,7 @@ gst_progress_report_do_query (GstProgressReport * filter, GstFormat format,
|
||||||
GstBaseTransform *base = GST_BASE_TRANSFORM (filter);
|
GstBaseTransform *base = GST_BASE_TRANSFORM (filter);
|
||||||
|
|
||||||
GST_LOG_OBJECT (filter, "using buffer metadata");
|
GST_LOG_OBJECT (filter, "using buffer metadata");
|
||||||
if (format == GST_FORMAT_TIME && base->have_newsegment &&
|
if (format == GST_FORMAT_TIME && base->segment.format == GST_FORMAT_TIME) {
|
||||||
base->segment.format == GST_FORMAT_TIME) {
|
|
||||||
cur = gst_segment_to_stream_time (&base->segment, format,
|
cur = gst_segment_to_stream_time (&base->segment, format,
|
||||||
GST_BUFFER_TIMESTAMP (buf));
|
GST_BUFFER_TIMESTAMP (buf));
|
||||||
total = base->segment.duration;
|
total = base->segment.duration;
|
||||||
|
@ -276,17 +275,20 @@ gst_progress_report_do_query (GstProgressReport * filter, GstFormat format,
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
format_name = "bogounits";
|
format_name = "bogounits";
|
||||||
caps = GST_PAD_CAPS (GST_BASE_TRANSFORM (filter)->sinkpad);
|
caps = gst_pad_get_current_caps (GST_BASE_TRANSFORM (filter)->sinkpad);
|
||||||
if (caps && gst_caps_is_fixed (caps) && !gst_caps_is_any (caps)) {
|
if (caps) {
|
||||||
GstStructure *s = gst_caps_get_structure (caps, 0);
|
if (gst_caps_is_fixed (caps) && !gst_caps_is_any (caps)) {
|
||||||
const gchar *mime_type = gst_structure_get_name (s);
|
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/") ||
|
if (g_str_has_prefix (mime_type, "video/") ||
|
||||||
g_str_has_prefix (mime_type, "image/")) {
|
g_str_has_prefix (mime_type, "image/")) {
|
||||||
format_name = "frames";
|
format_name = "frames";
|
||||||
} else if (g_str_has_prefix (mime_type, "audio/")) {
|
} else if (g_str_has_prefix (mime_type, "audio/")) {
|
||||||
format_name = "samples";
|
format_name = "samples";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,10 +217,28 @@ gst_rnd_buffer_size_get_property (GObject * object, guint prop_id,
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rnd_buffer_size_activate (GstPad * pad)
|
gst_rnd_buffer_size_activate (GstPad * pad)
|
||||||
{
|
{
|
||||||
if (gst_pad_check_pull_range (pad)) {
|
GstQuery *query;
|
||||||
return gst_pad_activate_pull (pad, TRUE);
|
gboolean pull_mode;
|
||||||
} else {
|
|
||||||
GST_INFO_OBJECT (pad, "push mode not supported");
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,7 +265,7 @@ gst_rnd_buffer_size_loop (GstRndBufferSize * self)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = NULL;
|
GstBuffer *buf = NULL;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
guint num_bytes;
|
guint num_bytes, size;
|
||||||
|
|
||||||
if (G_UNLIKELY (self->min > self->max))
|
if (G_UNLIKELY (self->min > self->max))
|
||||||
goto bogus_minmax;
|
goto bogus_minmax;
|
||||||
|
@ -266,11 +284,13 @@ gst_rnd_buffer_size_loop (GstRndBufferSize * self)
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
goto pull_failed;
|
goto pull_failed;
|
||||||
|
|
||||||
if (GST_BUFFER_SIZE (buf) < num_bytes) {
|
size = gst_buffer_get_size (buf);
|
||||||
GST_WARNING_OBJECT (self, "short buffer: %u bytes", GST_BUFFER_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);
|
ret = gst_pad_push (self->srcpad, buf);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ length_add (gpointer test, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
LengthTest *t = test;
|
LengthTest *t = test;
|
||||||
|
|
||||||
t->value += GST_BUFFER_SIZE (buffer);
|
t->value += gst_buffer_get_size (buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -214,8 +214,12 @@ md5_new (const GstTestInfo * info)
|
||||||
static void
|
static void
|
||||||
md5_add (gpointer checksum, GstBuffer * buffer)
|
md5_add (gpointer checksum, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
g_checksum_update (checksum, GST_BUFFER_DATA (buffer),
|
guint8 *data;
|
||||||
GST_BUFFER_SIZE (buffer));
|
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
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue