mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
remove obsolete tests whitespace fixes
Original commit message from CVS: remove obsolete tests whitespace fixes
This commit is contained in:
parent
14bbecccf3
commit
2b33397ea9
92 changed files with 30 additions and 6618 deletions
|
@ -14,20 +14,20 @@ GST_DEBUG_DIRS = debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
bytestream caps cleanup controller \
|
caps \
|
||||||
$(GST_DEBUG_DIRS) \
|
$(GST_DEBUG_DIRS) \
|
||||||
dlopen \
|
dlopen \
|
||||||
elements indexers negotiation pad \
|
elements indexers \
|
||||||
$(GST_PARSE_DIRS) \
|
$(GST_PARSE_DIRS) \
|
||||||
plugin refcounting schedulers states threads trigger
|
plugin refcounting states threads trigger
|
||||||
|
|
||||||
DIST_SUBDIRS = \
|
DIST_SUBDIRS = \
|
||||||
bytestream caps cleanup controller \
|
caps \
|
||||||
debug \
|
debug \
|
||||||
dlopen \
|
dlopen \
|
||||||
elements indexers negotiation pad \
|
elements indexers \
|
||||||
parse \
|
parse \
|
||||||
plugin refcounting schedulers states threads trigger
|
plugin refcounting states threads trigger
|
||||||
|
|
||||||
tests_pass =
|
tests_pass =
|
||||||
tests_fail =
|
tests_fail =
|
||||||
|
|
9
tests/old/testsuite/bytestream/.gitignore
vendored
9
tests/old/testsuite/bytestream/.gitignore
vendored
|
@ -1,9 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
*.o
|
|
||||||
*.lo
|
|
||||||
*.la
|
|
||||||
.deps
|
|
||||||
.libs
|
|
||||||
test1
|
|
||||||
filepadsink
|
|
|
@ -1,11 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = filepadsink
|
|
||||||
tests_fail = test1
|
|
||||||
tests_ignore =
|
|
||||||
|
|
||||||
test1_SOURCES = test1.c gstbstest.c
|
|
||||||
test1_LDFLAGS = $(top_builddir)/libs/gst/bytestream/libgstbytestream.la
|
|
||||||
|
|
||||||
filepadsink_CFLAGS = $(AM_CFLAGS) -DTHE_FILE=\""$(top_srcdir)/configure.ac"\"
|
|
||||||
filepadsink_LDFLAGS = $(top_builddir)/libs/gst/bytestream/libgstbytestream.la
|
|
|
@ -1,282 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
|
|
||||||
*
|
|
||||||
* 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 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/bytestream/filepad.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define GST_TYPE_FP_SINK \
|
|
||||||
(gst_fp_sink_get_type())
|
|
||||||
#define GST_FP_SINK(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FP_SINK,GstFpSink))
|
|
||||||
#define GST_FP_SINK_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FP_SINK,GstFpSinkClass))
|
|
||||||
#define GST_IS_FP_SINK(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FP_SINK))
|
|
||||||
#define GST_IS_FP_SINK_CLASS(obj) \
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FP_SINK))
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GstFpSink GstFpSink;
|
|
||||||
typedef struct _GstFpSinkClass GstFpSinkClass;
|
|
||||||
|
|
||||||
struct _GstFpSink
|
|
||||||
{
|
|
||||||
GstElement element;
|
|
||||||
/* pads */
|
|
||||||
GstFilePad *sinkpad;
|
|
||||||
|
|
||||||
/* fd */
|
|
||||||
FILE *stream;
|
|
||||||
guint state;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstFpSinkClass
|
|
||||||
{
|
|
||||||
GstElementClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GST_BOILERPLATE (GstFpSink, gst_fp_sink, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
static void do_tests (GstFilePad * pad);
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_fp_sink_base_init (gpointer g_class)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_fp_sink_class_init (GstFpSinkClass * klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstStaticPadTemplate template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
||||||
GST_PAD_SINK,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS ("ANY")
|
|
||||||
);
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_fp_sink_init (GstFpSink * fp)
|
|
||||||
{
|
|
||||||
GST_OBJECT_FLAG_SET (fp, GST_ELEMENT_EVENT_AWARE);
|
|
||||||
|
|
||||||
fp->sinkpad =
|
|
||||||
GST_FILE_PAD (gst_file_pad_new (gst_static_pad_template_get (&template),
|
|
||||||
"sink"));
|
|
||||||
gst_file_pad_set_iterate_function (fp->sinkpad, do_tests);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (fp), GST_PAD (fp->sinkpad));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define THE_CHECK(result) G_STMT_START{ \
|
|
||||||
gint64 pos = gst_file_pad_tell(fp->sinkpad); \
|
|
||||||
if (pos >= 0) \
|
|
||||||
g_assert (pos == ftell (fp->stream)); \
|
|
||||||
g_print ("%s (%"G_GINT64_FORMAT")\n", result ? "OK" : "no", pos); \
|
|
||||||
return result; \
|
|
||||||
}G_STMT_END
|
|
||||||
#define FAIL THE_CHECK(FALSE)
|
|
||||||
#define SUCCESS THE_CHECK(TRUE)
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
fp_read (GstFpSink * fp, guint size)
|
|
||||||
{
|
|
||||||
guint8 buf[size], buf2[size];
|
|
||||||
gint64 amount;
|
|
||||||
|
|
||||||
g_print ("reading %u bytes...", size);
|
|
||||||
amount = gst_file_pad_read (fp->sinkpad, buf, size);
|
|
||||||
if (amount == -EAGAIN)
|
|
||||||
FAIL;
|
|
||||||
g_assert (amount == size);
|
|
||||||
amount = fread (buf2, 1, amount, fp->stream);
|
|
||||||
g_assert (amount == size);
|
|
||||||
if (memcmp (buf, buf2, amount) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
fp->state++;
|
|
||||||
SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
fp_try_read (GstFpSink * fp, guint size)
|
|
||||||
{
|
|
||||||
guint8 buf[size], buf2[size];
|
|
||||||
gint64 amount;
|
|
||||||
size_t amount2;
|
|
||||||
|
|
||||||
g_print ("reading %u bytes...", size);
|
|
||||||
amount = gst_file_pad_try_read (fp->sinkpad, buf, size);
|
|
||||||
if (amount == -EAGAIN)
|
|
||||||
FAIL;
|
|
||||||
g_assert (amount > 0);
|
|
||||||
amount2 = fread (buf2, 1, amount, fp->stream);
|
|
||||||
g_assert (amount == amount2);
|
|
||||||
if (memcmp (buf, buf2, amount) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
fp->state++;
|
|
||||||
SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
fp_seek (GstFpSink * fp, gint64 pos, GstSeekType whence)
|
|
||||||
{
|
|
||||||
int seek_type = whence == GST_SEEK_METHOD_SET ? SEEK_SET :
|
|
||||||
whence == GST_SEEK_METHOD_CUR ? SEEK_CUR : SEEK_END;
|
|
||||||
|
|
||||||
g_print ("seeking to %s %" G_GINT64_FORMAT " bytes...",
|
|
||||||
whence == GST_SEEK_METHOD_SET ? "" : whence ==
|
|
||||||
GST_SEEK_METHOD_CUR ? "+-" : "-", pos);
|
|
||||||
if (gst_file_pad_seek (fp->sinkpad, pos, whence) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
if (fseek (fp->stream, pos, seek_type) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
fp->state++;
|
|
||||||
SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
fp_eof (GstFpSink * fp)
|
|
||||||
{
|
|
||||||
guint8 buf;
|
|
||||||
|
|
||||||
g_print ("checking for EOF...");
|
|
||||||
if (!gst_file_pad_eof (fp->sinkpad))
|
|
||||||
FAIL;
|
|
||||||
if (fread (&buf, 1, 1, fp->stream) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
fp->state++;
|
|
||||||
SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MIN_SIZE 10050
|
|
||||||
#define MAX_SIZE 1000000
|
|
||||||
static void
|
|
||||||
do_tests (GstFilePad * pad)
|
|
||||||
{
|
|
||||||
GstFpSink *fp = GST_FP_SINK (gst_pad_get_parent (GST_PAD (pad)));
|
|
||||||
|
|
||||||
while (TRUE) {
|
|
||||||
switch (fp->state) {
|
|
||||||
case 0:
|
|
||||||
if (!fp_try_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (!fp_try_read (fp, MAX_SIZE)) /* more than file size */
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (!fp_seek (fp, 0, GST_SEEK_METHOD_SET))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (!fp_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
if (!fp_read (fp, MIN_SIZE - 50)) /* bigger than 1 buffer */
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
if (!fp_seek (fp, -200, GST_SEEK_METHOD_CUR))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
if (!fp_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
if (!fp_seek (fp, 50, GST_SEEK_METHOD_CUR))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
if (!fp_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
if (!fp_seek (fp, MIN_SIZE - 50, GST_SEEK_METHOD_SET))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
if (!fp_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
if (!fp_seek (fp, 0, GST_SEEK_METHOD_END))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
if (!fp_eof (fp))
|
|
||||||
return;
|
|
||||||
gst_element_set_eos (GST_ELEMENT (fp));
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef THE_FILE
|
|
||||||
# define THE_FILE "../../configure.ac"
|
|
||||||
#endif
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink;
|
|
||||||
long size;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
gst_library_load ("gstbytestream");
|
|
||||||
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("filesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
sink = g_object_new (GST_TYPE_FP_SINK, NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (sink), "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
||||||
if (!gst_element_link (src, sink))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
g_object_set (src, "location", THE_FILE, NULL);
|
|
||||||
GST_FP_SINK (sink)->stream = fopen (THE_FILE, "rb");
|
|
||||||
g_assert (GST_FP_SINK (sink)->stream);
|
|
||||||
/* check correct file sizes */
|
|
||||||
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_END) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
size = ftell (GST_FP_SINK (sink)->stream);
|
|
||||||
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_SET) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
g_assert (size >= MIN_SIZE);
|
|
||||||
g_assert (size <= MAX_SIZE);
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
g_assert (GST_FP_SINK (sink)->state == 13);
|
|
||||||
g_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,418 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
|
||||||
*
|
|
||||||
* gstbstest.c:
|
|
||||||
*
|
|
||||||
* 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 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/bytestream/bytestream.h>
|
|
||||||
|
|
||||||
#define GST_TYPE_BSTEST (gst_bstest_get_type())
|
|
||||||
#define GST_BSTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BSTEST,GstBsTest))
|
|
||||||
#define GST_BSTEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BSTEST,GstBsTestClass))
|
|
||||||
#define GST_IS_BSTEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BSTEST))
|
|
||||||
#define GST_IS_BSTEST_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BSTEST))
|
|
||||||
|
|
||||||
typedef struct _GstBsTest GstBsTest;
|
|
||||||
typedef struct _GstBsTestClass GstBsTestClass;
|
|
||||||
|
|
||||||
struct _GstBsTest
|
|
||||||
{
|
|
||||||
GstElement element;
|
|
||||||
|
|
||||||
GstPad *sinkpad;
|
|
||||||
GstPad *srcpad;
|
|
||||||
|
|
||||||
GstByteStream *bs;
|
|
||||||
|
|
||||||
gchar *accesspattern;
|
|
||||||
guint num_patterns;
|
|
||||||
gchar **patterns;
|
|
||||||
guint sizemin;
|
|
||||||
guint sizemax;
|
|
||||||
gint count;
|
|
||||||
gboolean silent;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstBsTestClass
|
|
||||||
{
|
|
||||||
GstElementClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType gst_bstest_get_type (void);
|
|
||||||
|
|
||||||
|
|
||||||
GstElementDetails gst_bstest_details = GST_ELEMENT_DETAILS ("ByteStreamTest",
|
|
||||||
"Filter",
|
|
||||||
"Test for the GstByteStream code",
|
|
||||||
"Erik Walthinsen <omega@temple-baptist.com>, "
|
|
||||||
"Wim Taymans <wim.taymans@chello.be>");
|
|
||||||
|
|
||||||
|
|
||||||
/* BsTest signals and args */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
/* FILL ME */
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ARG_0,
|
|
||||||
ARG_SIZEMIN,
|
|
||||||
ARG_SIZEMAX,
|
|
||||||
ARG_COUNT,
|
|
||||||
ARG_SILENT,
|
|
||||||
ARG_ACCESSPATTERN,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void gst_bstest_base_init (gpointer g_class);
|
|
||||||
static void gst_bstest_class_init (GstBsTestClass * klass);
|
|
||||||
static void gst_bstest_init (GstBsTest * bstest);
|
|
||||||
|
|
||||||
static void gst_bstest_set_property (GObject * object, guint prop_id,
|
|
||||||
const GValue * value, GParamSpec * pspec);
|
|
||||||
static void gst_bstest_get_property (GObject * object, guint prop_id,
|
|
||||||
GValue * value, GParamSpec * pspec);
|
|
||||||
|
|
||||||
static GstStateChangeReturn gst_bstest_change_state (GstElement * element,
|
|
||||||
GstStateChange transition);
|
|
||||||
static void gst_bstest_loop (GstElement * element);
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
|
||||||
|
|
||||||
/* static guint gst_bstest_signals[LAST_SIGNAL] = { 0 }; */
|
|
||||||
|
|
||||||
GType
|
|
||||||
gst_bstest_get_type (void)
|
|
||||||
{
|
|
||||||
static GType bstest_type = 0;
|
|
||||||
|
|
||||||
if (!bstest_type) {
|
|
||||||
static const GTypeInfo bstest_info = {
|
|
||||||
sizeof (GstBsTestClass),
|
|
||||||
gst_bstest_base_init,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_bstest_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstBsTest),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_bstest_init,
|
|
||||||
};
|
|
||||||
|
|
||||||
bstest_type =
|
|
||||||
g_type_register_static (GST_TYPE_ELEMENT, "BSTest", &bstest_info, 0);
|
|
||||||
}
|
|
||||||
return bstest_type;
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
gst_bstest_base_init (gpointer g_class)
|
|
||||||
{
|
|
||||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
|
||||||
|
|
||||||
gst_element_class_set_details (gstelement_class, &gst_bstest_details);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_class_init (GstBsTestClass * klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class;
|
|
||||||
GstElementClass *gstelement_class;
|
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
|
||||||
gstelement_class = (GstElementClass *) klass;
|
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMIN,
|
|
||||||
g_param_spec_int ("sizemin", "sizemin", "sizemin", 0, G_MAXINT,
|
|
||||||
0, G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX,
|
|
||||||
g_param_spec_int ("sizemax", "sizemax", "sizemax", 0, G_MAXINT,
|
|
||||||
384, G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACCESSPATTERN,
|
|
||||||
g_param_spec_string ("accesspattern", "accesspattern", "accesspattern",
|
|
||||||
"r", G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COUNT,
|
|
||||||
g_param_spec_uint ("count", "count", "count",
|
|
||||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
|
||||||
g_param_spec_boolean ("silent", "silent", "silent",
|
|
||||||
FALSE, G_PARAM_READWRITE));
|
|
||||||
|
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_bstest_set_property);
|
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_bstest_get_property);
|
|
||||||
|
|
||||||
gstelement_class->change_state = gst_bstest_change_state;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstCaps *
|
|
||||||
gst_bstest_getcaps (GstPad * pad)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad));
|
|
||||||
GstPad *otherpad;
|
|
||||||
|
|
||||||
otherpad = (pad == bstest->srcpad) ? bstest->sinkpad : bstest->srcpad;
|
|
||||||
|
|
||||||
return gst_pad_get_allowed_caps (otherpad);
|
|
||||||
}
|
|
||||||
|
|
||||||
GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
||||||
GST_PAD_SRC,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS_ANY);
|
|
||||||
|
|
||||||
GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
||||||
GST_PAD_SINK,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS_ANY);
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_init (GstBsTest * bstest)
|
|
||||||
{
|
|
||||||
bstest->sinkpad =
|
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
|
|
||||||
"sink");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (bstest), bstest->sinkpad);
|
|
||||||
gst_pad_set_getcaps_function (bstest->sinkpad, gst_bstest_getcaps);
|
|
||||||
|
|
||||||
bstest->srcpad =
|
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
|
|
||||||
"src");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (bstest), bstest->srcpad);
|
|
||||||
gst_pad_set_getcaps_function (bstest->srcpad, gst_bstest_getcaps);
|
|
||||||
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (bstest), gst_bstest_loop);
|
|
||||||
|
|
||||||
bstest->sizemin = 0;
|
|
||||||
bstest->sizemax = 384;
|
|
||||||
bstest->accesspattern = g_strdup ("r");
|
|
||||||
bstest->patterns = g_strsplit (bstest->accesspattern, ":", 0);
|
|
||||||
bstest->count = 5;
|
|
||||||
bstest->silent = FALSE;
|
|
||||||
bstest->bs = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static guint
|
|
||||||
gst_bstest_get_size (GstBsTest * bstest, gchar * sizestring, guint prevsize)
|
|
||||||
{
|
|
||||||
guint size;
|
|
||||||
|
|
||||||
if (sizestring[0] == 0) {
|
|
||||||
size = bstest->sizemax;
|
|
||||||
} else if (sizestring[0] == 'r') {
|
|
||||||
size =
|
|
||||||
bstest->sizemin +
|
|
||||||
(guint8) (((gfloat) bstest->sizemax) * rand () / (RAND_MAX +
|
|
||||||
(gfloat) bstest->sizemin));
|
|
||||||
} else if (sizestring[0] == '<') {
|
|
||||||
size = prevsize;
|
|
||||||
} else {
|
|
||||||
size = atoi (sizestring);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size == 0)
|
|
||||||
size++;
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_loop (GstElement * element)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest;
|
|
||||||
GstBuffer *buf = NULL;
|
|
||||||
|
|
||||||
g_return_if_fail (element != NULL);
|
|
||||||
g_return_if_fail (GST_IS_BSTEST (element));
|
|
||||||
|
|
||||||
bstest = GST_BSTEST (element);
|
|
||||||
|
|
||||||
do {
|
|
||||||
guint size = 0;
|
|
||||||
guint i = 0;
|
|
||||||
guint8 *ptr;
|
|
||||||
|
|
||||||
while (i < bstest->num_patterns) {
|
|
||||||
buf = NULL;
|
|
||||||
|
|
||||||
if (bstest->patterns[i][0] == 'r') {
|
|
||||||
size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size);
|
|
||||||
if (!bstest->silent)
|
|
||||||
g_print ("bstest: ***** read %d bytes\n", size);
|
|
||||||
gst_bytestream_read (bstest->bs, &buf, size);
|
|
||||||
} else if (bstest->patterns[i][0] == 'f') {
|
|
||||||
size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size);
|
|
||||||
if (!bstest->silent)
|
|
||||||
g_print ("bstest: ***** flush %d bytes\n", size);
|
|
||||||
gst_bytestream_flush (bstest->bs, size);
|
|
||||||
} else if (!strncmp (bstest->patterns[i], "pb", 2)) {
|
|
||||||
size = gst_bstest_get_size (bstest, &bstest->patterns[i][2], size);
|
|
||||||
if (!bstest->silent)
|
|
||||||
g_print ("bstest: ***** peek bytes %d bytes\n", size);
|
|
||||||
gst_bytestream_peek_bytes (bstest->bs, &ptr, size);
|
|
||||||
} else if (bstest->patterns[i][0] == 'p') {
|
|
||||||
size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size);
|
|
||||||
if (!bstest->silent)
|
|
||||||
g_print ("bstest: ***** peek %d bytes\n", size);
|
|
||||||
gst_bytestream_peek (bstest->bs, &buf, size);
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
buf = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf)
|
|
||||||
gst_pad_push (bstest->srcpad, GST_DATA (buf));
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
/* } while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element)); */
|
|
||||||
|
|
||||||
} while (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
||||||
GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest;
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_BSTEST (object));
|
|
||||||
|
|
||||||
bstest = GST_BSTEST (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case ARG_SIZEMIN:
|
|
||||||
bstest->sizemin = g_value_get_int (value);
|
|
||||||
break;
|
|
||||||
case ARG_SIZEMAX:
|
|
||||||
bstest->sizemax = g_value_get_int (value);
|
|
||||||
break;
|
|
||||||
case ARG_ACCESSPATTERN:
|
|
||||||
if (bstest->accesspattern) {
|
|
||||||
g_free (bstest->accesspattern);
|
|
||||||
g_strfreev (bstest->patterns);
|
|
||||||
}
|
|
||||||
if (g_value_get_string (value) == NULL) {
|
|
||||||
gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
|
|
||||||
bstest->accesspattern = NULL;
|
|
||||||
bstest->num_patterns = 0;
|
|
||||||
} else {
|
|
||||||
guint i = 0;
|
|
||||||
|
|
||||||
bstest->accesspattern = g_strdup (g_value_get_string (value));
|
|
||||||
bstest->patterns = g_strsplit (bstest->accesspattern, ":", 0);
|
|
||||||
while (bstest->patterns[i++]);
|
|
||||||
bstest->num_patterns = i - 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ARG_COUNT:
|
|
||||||
bstest->count = g_value_get_uint (value);
|
|
||||||
break;
|
|
||||||
case ARG_SILENT:
|
|
||||||
bstest->silent = g_value_get_boolean (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_get_property (GObject * object, guint prop_id, GValue * value,
|
|
||||||
GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest;
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_BSTEST (object));
|
|
||||||
|
|
||||||
bstest = GST_BSTEST (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case ARG_SIZEMIN:
|
|
||||||
g_value_set_int (value, bstest->sizemin);
|
|
||||||
break;
|
|
||||||
case ARG_SIZEMAX:
|
|
||||||
g_value_set_int (value, bstest->sizemax);
|
|
||||||
break;
|
|
||||||
case ARG_ACCESSPATTERN:
|
|
||||||
g_value_set_string (value, bstest->accesspattern);
|
|
||||||
break;
|
|
||||||
case ARG_COUNT:
|
|
||||||
g_value_set_uint (value, bstest->count);
|
|
||||||
break;
|
|
||||||
case ARG_SILENT:
|
|
||||||
g_value_set_boolean (value, bstest->silent);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstStateChangeReturn
|
|
||||||
gst_bstest_change_state (GstElement * element, GstStateChange transition)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_BSTEST (element), GST_STATE_CHANGE_FAILURE);
|
|
||||||
|
|
||||||
bstest = GST_BSTEST (element);
|
|
||||||
|
|
||||||
if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
|
|
||||||
if (bstest->bs) {
|
|
||||||
gst_bytestream_destroy (bstest->bs);
|
|
||||||
bstest->bs = NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!bstest->bs) {
|
|
||||||
bstest->bs = gst_bytestream_new (bstest->sinkpad);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
|
||||||
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
||||||
|
|
||||||
return GST_STATE_CHANGE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
plugin_init (GstPlugin * plugin)
|
|
||||||
{
|
|
||||||
/* We need to create an ElementFactory for each element we provide.
|
|
||||||
* This consists of the name of the element, the GType identifier,
|
|
||||||
* and a pointer to the details structure at the top of the file.
|
|
||||||
*/
|
|
||||||
return gst_element_register (plugin, "bstest", GST_RANK_PRIMARY,
|
|
||||||
GST_TYPE_BSTEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
|
||||||
"bstest",
|
|
||||||
"test for the bytestream element",
|
|
||||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|
|
|
@ -1,230 +0,0 @@
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
#define VM_THRES 1000
|
|
||||||
#define MAX_CONFIG_LINE 255
|
|
||||||
#define MAX_CONFIG_PATTERN 64
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
gint src_data;
|
|
||||||
gint src_sizetype;
|
|
||||||
|
|
||||||
gchar *bs_accesspattern;
|
|
||||||
|
|
||||||
gboolean integrity_check;
|
|
||||||
}
|
|
||||||
TestParam;
|
|
||||||
|
|
||||||
static GSList *params = NULL;
|
|
||||||
|
|
||||||
static guint8 count;
|
|
||||||
static guint iterations;
|
|
||||||
static gboolean integrity_check = TRUE;
|
|
||||||
static gboolean verbose = FALSE;
|
|
||||||
static gboolean dump = FALSE;
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff (GstElement * element, GstBuffer * buf, GstPad * pad, gpointer data)
|
|
||||||
{
|
|
||||||
if (GST_IS_BUFFER (buf)) {
|
|
||||||
if (integrity_check) {
|
|
||||||
gint i;
|
|
||||||
guint8 *ptr = GST_BUFFER_DATA (buf);
|
|
||||||
|
|
||||||
for (i = 0; i < GST_BUFFER_SIZE (buf); i++) {
|
|
||||||
if (*ptr++ != count++) {
|
|
||||||
g_print ("data error!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
g_print ("not a buffer ! %p\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static gchar *
|
|
||||||
create_desc (TestParam * param)
|
|
||||||
{
|
|
||||||
gchar *desc;
|
|
||||||
|
|
||||||
desc =
|
|
||||||
g_strdup_printf ("%s %s, pattern %s",
|
|
||||||
(param->src_sizetype == 2 ? "fixed" : "random"),
|
|
||||||
(param->src_data == 1 ? "src" : "subbuffer"), param->bs_accesspattern);
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
read_param_file (gchar * filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
gchar line[MAX_CONFIG_LINE + 1];
|
|
||||||
guint linenr = 0;
|
|
||||||
gchar pattern[MAX_CONFIG_PATTERN];
|
|
||||||
gint data, sizetype, integrity_check;
|
|
||||||
gchar *scan_str;
|
|
||||||
gboolean res = TRUE;
|
|
||||||
|
|
||||||
fp = fopen (filename, "rb");
|
|
||||||
if (fp == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
scan_str = g_strdup_printf ("%%d %%d %%%ds %%d", MAX_CONFIG_PATTERN - 1);
|
|
||||||
|
|
||||||
while (fgets (line, MAX_CONFIG_LINE, fp)) {
|
|
||||||
linenr++;
|
|
||||||
|
|
||||||
if (line[0] == '\n' || line[0] == '#')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (sscanf (line, scan_str, &data, &sizetype, pattern,
|
|
||||||
&integrity_check) != 4) {
|
|
||||||
g_print ("error on line: %d\n", linenr);
|
|
||||||
res = FALSE;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
TestParam *param = g_malloc (sizeof (TestParam));
|
|
||||||
|
|
||||||
param->src_data = data;
|
|
||||||
param->src_sizetype = sizetype;
|
|
||||||
param->bs_accesspattern = g_strdup (pattern);
|
|
||||||
param->integrity_check = (integrity_check == 0 ? FALSE : TRUE);
|
|
||||||
|
|
||||||
params = g_slist_append (params, param);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_free (scan_str);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
run_test (GstBin * pipeline, gint iters)
|
|
||||||
{
|
|
||||||
gint vm = 0;
|
|
||||||
gint maxiters = iters;
|
|
||||||
gint prev_percent = -1;
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (iters) {
|
|
||||||
gint newvm = gst_alloc_trace_live_all ();
|
|
||||||
gint percent;
|
|
||||||
|
|
||||||
percent = (gint) ((maxiters - iters + 1) * 100.0 / maxiters);
|
|
||||||
|
|
||||||
if (percent != prev_percent || newvm - vm > VM_THRES) {
|
|
||||||
g_print ("\r%d (delta %d) %.3d%% ", newvm, newvm - vm,
|
|
||||||
percent);
|
|
||||||
prev_percent = percent;
|
|
||||||
vm = newvm;
|
|
||||||
}
|
|
||||||
gst_bin_iterate (pipeline);
|
|
||||||
|
|
||||||
if (iters > 0)
|
|
||||||
iters--;
|
|
||||||
}
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
usage (char *argv[])
|
|
||||||
{
|
|
||||||
g_print ("usage: %s [--verbose] [--dump] <paramfile> <iterations>\n",
|
|
||||||
argv[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *src;
|
|
||||||
GstElement *sink;
|
|
||||||
GstElement *bs;
|
|
||||||
GstElement *pipeline;
|
|
||||||
gint testnum = 0;
|
|
||||||
GSList *walk;
|
|
||||||
gint arg_walk;
|
|
||||||
|
|
||||||
gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE);
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
arg_walk = 1;
|
|
||||||
while ((arg_walk < argc) && (argv[arg_walk][0] == '-')) {
|
|
||||||
if (!strncmp (argv[arg_walk], "--verbose", 9))
|
|
||||||
verbose = TRUE;
|
|
||||||
else if (!strncmp (argv[arg_walk], "--dump", 6))
|
|
||||||
dump = TRUE;
|
|
||||||
else {
|
|
||||||
g_print ("unknown option %s (ignored)\n", argv[arg_walk]);
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_walk++;
|
|
||||||
}
|
|
||||||
if (argc - arg_walk < 2) {
|
|
||||||
usage (argv);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (!read_param_file (argv[arg_walk])) {
|
|
||||||
g_print ("error reading file %s\n", argv[arg_walk]);
|
|
||||||
usage (argv);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
arg_walk++;
|
|
||||||
iterations = atoi (argv[arg_walk]);
|
|
||||||
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", "pipeline");
|
|
||||||
g_assert (pipeline);
|
|
||||||
|
|
||||||
src = gst_element_factory_make ("fakesrc", "src");
|
|
||||||
g_assert (src);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", "sink");
|
|
||||||
g_assert (sink);
|
|
||||||
g_object_set (sink, "signal-handoff", TRUE, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (sink), "handoff", G_CALLBACK (handoff), NULL);
|
|
||||||
|
|
||||||
bs = gst_element_factory_make ("bstest", "bs");
|
|
||||||
g_assert (bs);
|
|
||||||
|
|
||||||
gst_element_link_many (src, bs, sink, NULL);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, bs, sink, NULL);
|
|
||||||
|
|
||||||
walk = params;
|
|
||||||
|
|
||||||
while (walk) {
|
|
||||||
gchar *desc;
|
|
||||||
TestParam *param = (TestParam *) (walk->data);
|
|
||||||
|
|
||||||
integrity_check = param->integrity_check;
|
|
||||||
|
|
||||||
g_print ("\n\nrunning test %d (%d iterations):\n", testnum + 1, iterations);
|
|
||||||
desc = create_desc (param);
|
|
||||||
g_print ("%s\n", desc);
|
|
||||||
g_free (desc);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (src), "data", param->src_data,
|
|
||||||
"sizetype", param->src_sizetype,
|
|
||||||
"filltype", (integrity_check ? 5 : 0), "silent", !verbose, NULL);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (bs), "accesspattern", param->bs_accesspattern,
|
|
||||||
"silent", !verbose, NULL);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (sink), "dump", dump, "silent", !verbose, NULL);
|
|
||||||
|
|
||||||
run_test (GST_BIN (pipeline), iterations);
|
|
||||||
|
|
||||||
testnum++;
|
|
||||||
|
|
||||||
walk = g_slist_next (walk);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_print ("\n\ndone\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,93 +0,0 @@
|
||||||
# lots of parameters here. values for the columns are like:
|
|
||||||
#
|
|
||||||
# - data property in fakesrc: 1 = allocate, 2 = subbuffer
|
|
||||||
# - sizetype property in fakesrc: 2 = fixed, 3 = random
|
|
||||||
#
|
|
||||||
# - accesspattern for bstest
|
|
||||||
# <action><size>[:<action><size>...]
|
|
||||||
#
|
|
||||||
# <action> can be:
|
|
||||||
# r = read
|
|
||||||
# p = peek
|
|
||||||
# pb = peek bytes
|
|
||||||
# f = flush
|
|
||||||
# <size> can be:
|
|
||||||
# <empty> = fixed size
|
|
||||||
# r = random size
|
|
||||||
# < = previous size
|
|
||||||
# <int> = this size
|
|
||||||
#
|
|
||||||
# - integrity check: 0 = no, 1 = yes
|
|
||||||
#
|
|
||||||
1 2 r 1
|
|
||||||
1 2 rr 1
|
|
||||||
1 3 r 1
|
|
||||||
1 3 rr 1
|
|
||||||
2 2 r 1
|
|
||||||
2 2 rr 1
|
|
||||||
2 3 r 1
|
|
||||||
2 3 rr 1
|
|
||||||
1 2 p:r< 1
|
|
||||||
1 2 pr:r< 1
|
|
||||||
1 3 p:r< 1
|
|
||||||
1 3 pr:r< 1
|
|
||||||
2 2 p:r< 1
|
|
||||||
2 2 pr:r< 1
|
|
||||||
2 3 p:r< 1
|
|
||||||
2 3 pr:r< 1
|
|
||||||
1 2 p:rr 1
|
|
||||||
1 2 pr:rr 1
|
|
||||||
1 3 p:rr 1
|
|
||||||
1 3 pr:rr 1
|
|
||||||
2 2 p:rr 1
|
|
||||||
2 2 pr:rr 1
|
|
||||||
2 3 p:rr 1
|
|
||||||
2 3 pr:rr 1
|
|
||||||
1 2 pb:r 1
|
|
||||||
1 2 pbr:r 1
|
|
||||||
1 3 pb:r 1
|
|
||||||
1 3 pbr:r 1
|
|
||||||
2 2 pb:r 1
|
|
||||||
2 2 pbr:r 1
|
|
||||||
2 3 pb:r 1
|
|
||||||
2 3 pbr:r 1
|
|
||||||
1 2 pb:rr 1
|
|
||||||
1 2 pbr:rr 1
|
|
||||||
1 3 pb:rr 1
|
|
||||||
1 3 pbr:rr 1
|
|
||||||
2 2 pb:rr 1
|
|
||||||
2 2 pbr:rr 1
|
|
||||||
2 3 pb:rr 1
|
|
||||||
2 3 pbr:rr 1
|
|
||||||
1 2 p:fr:rr 0
|
|
||||||
1 2 pr:fr:rr 0
|
|
||||||
1 3 p:fr:rr 0
|
|
||||||
1 3 pr:fr:rr 0
|
|
||||||
2 2 p:fr:rr 0
|
|
||||||
2 2 pr:fr:rr 0
|
|
||||||
2 3 p:fr:rr 0
|
|
||||||
2 3 pr:fr:rr 0
|
|
||||||
1 2 fr:rr 0
|
|
||||||
1 2 fr:rr 0
|
|
||||||
1 3 fr:rr 0
|
|
||||||
1 3 fr:rr 0
|
|
||||||
2 2 fr:rr 0
|
|
||||||
2 2 fr:rr 0
|
|
||||||
2 3 fr:rr 0
|
|
||||||
2 3 fr:rr 0
|
|
||||||
1 2 fr:fr:rr 0
|
|
||||||
1 2 fr:fr:rr 0
|
|
||||||
1 3 fr:fr:rr 0
|
|
||||||
1 3 fr:fr:rr 0
|
|
||||||
2 2 fr:fr:rr 0
|
|
||||||
2 2 fr:fr:rr 0
|
|
||||||
2 3 fr:fr:rr 0
|
|
||||||
2 3 fr:fr:rr 0
|
|
||||||
1 2 pbr:pbr:rr 1
|
|
||||||
1 2 pbr:pbr:rr 1
|
|
||||||
1 3 pbr:pbr:rr 1
|
|
||||||
1 3 pbr:pbr:rr 1
|
|
||||||
2 2 pbr:pbr:rr 1
|
|
||||||
2 2 pbr:pbr:rr 1
|
|
||||||
2 3 pbr:pbr:rr 1
|
|
||||||
2 3 pbr:pbr:rr 1
|
|
10
tests/old/testsuite/cleanup/.gitignore
vendored
10
tests/old/testsuite/cleanup/.gitignore
vendored
|
@ -1,10 +0,0 @@
|
||||||
test-registry.xml
|
|
||||||
*.bb
|
|
||||||
*.bbg
|
|
||||||
*.da
|
|
||||||
|
|
||||||
cleanup1
|
|
||||||
cleanup2
|
|
||||||
cleanup3
|
|
||||||
cleanup4
|
|
||||||
cleanup5
|
|
|
@ -1,7 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = cleanup1 cleanup2 cleanup4 cleanup5
|
|
||||||
tests_fail =
|
|
||||||
|
|
||||||
# cleanup3 fails depending on the machine
|
|
||||||
tests_ignore = cleanup3
|
|
|
@ -1,60 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static GstElement *
|
|
||||||
create_pipeline (void)
|
|
||||||
{
|
|
||||||
GstElement *fakesrc, *fakesink;
|
|
||||||
GstElement *pipeline;
|
|
||||||
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
|
||||||
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL);
|
|
||||||
|
|
||||||
gst_element_link (fakesrc, fakesink);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
|
||||||
|
|
||||||
return pipeline;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar * argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
gint i = 1000;
|
|
||||||
gint step = 100;
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
while (i--) {
|
|
||||||
if (i % step == 0)
|
|
||||||
fprintf (stderr, "%10d\r", i);
|
|
||||||
pipeline = create_pipeline ();
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
}
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static GstElement *
|
|
||||||
create_pipeline (void)
|
|
||||||
{
|
|
||||||
GstElement *fakesrc, *fakesink;
|
|
||||||
GstElement *pipeline;
|
|
||||||
GstElement *bin;
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
|
||||||
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
|
||||||
bin = gst_bin_new ("bin");
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
|
||||||
gst_bin_add (GST_BIN (bin), fakesink);
|
|
||||||
gst_element_add_ghost_pad (bin, gst_element_get_pad (fakesink, "sink"),
|
|
||||||
"sink");
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), fakesrc, bin, NULL);
|
|
||||||
|
|
||||||
gst_element_link (fakesrc, bin);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
|
||||||
|
|
||||||
return pipeline;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar * argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
gint i = 1000;
|
|
||||||
gint step = 100;
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
while (i--) {
|
|
||||||
if (i % step == 0)
|
|
||||||
fprintf (stderr, "%10d\r", i);
|
|
||||||
pipeline = create_pipeline ();
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
}
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static GstElement *
|
|
||||||
create_pipeline (void)
|
|
||||||
{
|
|
||||||
GstElement *fakesrc, *fakesink;
|
|
||||||
GstElement *pipeline;
|
|
||||||
GstElement *thread, *queue;
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
|
||||||
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
|
||||||
thread = gst_thread_new ("thread");
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
|
||||||
queue = gst_element_factory_make ("queue", "queue");
|
|
||||||
gst_bin_add (GST_BIN (thread), fakesink);
|
|
||||||
gst_bin_add (GST_BIN (thread), queue);
|
|
||||||
gst_element_link (queue, fakesink);
|
|
||||||
gst_element_add_ghost_pad (thread, gst_element_get_pad (queue, "sink"),
|
|
||||||
"sink");
|
|
||||||
|
|
||||||
gst_element_link (fakesrc, thread);
|
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), thread);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
|
||||||
|
|
||||||
return pipeline;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar * argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
gint i = 10000;
|
|
||||||
gint step = 100;
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
while (i--) {
|
|
||||||
if (i % step == 0)
|
|
||||||
fprintf (stderr, "%10d\r", i);
|
|
||||||
pipeline = create_pipeline ();
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
}
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar * argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
GstElement *fakesrc;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
i = 1000;
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
|
||||||
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
|
||||||
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
while (i--) {
|
|
||||||
GstElement *bin;
|
|
||||||
GstElement *fakesink;
|
|
||||||
|
|
||||||
g_print ("+");
|
|
||||||
|
|
||||||
bin = gst_bin_new ("bin");
|
|
||||||
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (bin), fakesink);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), bin);
|
|
||||||
|
|
||||||
gst_element_link (fakesrc, fakesink);
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
g_print ("-");
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), GST_ELEMENT (bin));
|
|
||||||
|
|
||||||
}
|
|
||||||
g_print ("\n");
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *bin, *element;
|
|
||||||
gint i = 1000;
|
|
||||||
gint step = 100;
|
|
||||||
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
bin = gst_pipeline_new ("pipeline");
|
|
||||||
|
|
||||||
while (i--) {
|
|
||||||
GstPad *pad;
|
|
||||||
|
|
||||||
if (i % step == 0)
|
|
||||||
fprintf (stderr, "\r%10d", i);
|
|
||||||
|
|
||||||
element = gst_element_factory_make ("tee", "tee");
|
|
||||||
if (!element)
|
|
||||||
break;
|
|
||||||
|
|
||||||
pad = gst_element_get_request_pad (element, "src%d");
|
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (bin), element);
|
|
||||||
gst_bin_remove (GST_BIN (bin), element);
|
|
||||||
|
|
||||||
}
|
|
||||||
fprintf (stderr, "+\n");
|
|
||||||
|
|
||||||
gst_object_unref (bin);
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
2
tests/old/testsuite/negotiation/.gitignore
vendored
2
tests/old/testsuite/negotiation/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
pad_link
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = pad_link
|
|
||||||
tests_fail =
|
|
||||||
tests_ignore =
|
|
|
@ -1,35 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
/* this test checks that gst_pad_link takes into account all available
|
|
||||||
* information when trying to link two pads.
|
|
||||||
* Because identity proxies caps, the caps in the first and second link
|
|
||||||
* must be compatible for this pipeline to work.
|
|
||||||
* Since they are not, the second linkig attempt should fail.
|
|
||||||
*/
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (int argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *src, *identity, *sink;
|
|
||||||
GstCaps *one, *two;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
/* create incompatible caps */
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
identity = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (identity);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
one = gst_caps_from_string ("some/mime");
|
|
||||||
two = gst_caps_from_string ("other/mime");
|
|
||||||
|
|
||||||
g_assert (GST_PAD_LINK_SUCCESSFUL (gst_pad_link_filtered (gst_element_get_pad
|
|
||||||
(src, "src"), gst_element_get_pad (identity, "sink"), one)));
|
|
||||||
g_assert (!GST_PAD_LINK_SUCCESSFUL (gst_pad_link_filtered (gst_element_get_pad
|
|
||||||
(identity, "src"), gst_element_get_pad (sink, "sink"), two)));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = link
|
|
||||||
tests_fail = chainnopull getnopush
|
|
||||||
tests_ignore =
|
|
|
@ -1,66 +0,0 @@
|
||||||
/*
|
|
||||||
* this tests that chain-based pads don't pull.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
typedef struct _GstTestSink
|
|
||||||
{
|
|
||||||
GstElement parent;
|
|
||||||
GstPad *sinkpad;
|
|
||||||
} GstTestSink;
|
|
||||||
|
|
||||||
typedef GstElementClass GstTestSinkClass;
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_class_init (GstTestSinkClass * klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_base_init (gpointer klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_chain (GstPad * pad, GstData * data)
|
|
||||||
{
|
|
||||||
data = gst_pad_pull (pad);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_init (GstTestSink * sink)
|
|
||||||
{
|
|
||||||
sink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
||||||
gst_pad_set_chain_function (sink->sinkpad, gst_test_sink_chain);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (sink), sink->sinkpad);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_BOILERPLATE (GstTestSink, gst_test_sink, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *fakesrc, *testsink;
|
|
||||||
gint n;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("p");
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "src");
|
|
||||||
testsink = g_object_new (gst_test_sink_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (testsink), "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), fakesrc, testsink, NULL);
|
|
||||||
gst_element_link (fakesrc, testsink);
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
for (n = 0; n < 100; n++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
* this tests that get-based pads don't push.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
typedef struct _GstTestSrc
|
|
||||||
{
|
|
||||||
GstElement parent;
|
|
||||||
GstPad *srcpad;
|
|
||||||
} GstTestSrc;
|
|
||||||
|
|
||||||
typedef GstElementClass GstTestSrcClass;
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_src_class_init (GstTestSrcClass * klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
gst_test_src_base_init (gpointer klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstData *
|
|
||||||
gst_test_src_get (GstPad * pad)
|
|
||||||
{
|
|
||||||
GstEvent *event;
|
|
||||||
|
|
||||||
event = gst_event_new (GST_EVENT_INTERRUPT);
|
|
||||||
gst_event_ref (event);
|
|
||||||
gst_pad_push (pad, GST_DATA (event));
|
|
||||||
|
|
||||||
return GST_DATA (event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_src_init (GstTestSrc * src)
|
|
||||||
{
|
|
||||||
src->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
||||||
gst_pad_set_get_function (src->srcpad, gst_test_src_get);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (src), src->srcpad);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_BOILERPLATE (GstTestSrc, gst_test_src, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *testsrc, *fakesink;
|
|
||||||
gint n;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("p");
|
|
||||||
testsrc = g_object_new (gst_test_src_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (testsrc), "src");
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), testsrc, fakesink, NULL);
|
|
||||||
gst_element_link (testsrc, fakesink);
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
for (n = 0; n < 100; n++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,194 +0,0 @@
|
||||||
/*
|
|
||||||
* Test that:
|
|
||||||
* - get-based sources can return data, loop-based sources can push.
|
|
||||||
* - chain-based filters receive/push, loop-based filters can pull/push.
|
|
||||||
* - chain-based sinks receive, loop-based sinks pull.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Scary type code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct _GstTestElement
|
|
||||||
{
|
|
||||||
GstElement parent;
|
|
||||||
GstPad *srcpad, *sinkpad;
|
|
||||||
} GstTestSrc, GstTestFilter, GstTestSink, GstTestElement;
|
|
||||||
|
|
||||||
typedef GstElementClass GstTestSrcClass, GstTestFilterClass, GstTestSinkClass,
|
|
||||||
GstTestElementClass;
|
|
||||||
|
|
||||||
#define gst_test_src_class_init gst_test_element_class_init
|
|
||||||
#define gst_test_filter_class_init gst_test_element_class_init
|
|
||||||
#define gst_test_sink_class_init gst_test_element_class_init
|
|
||||||
|
|
||||||
#define gst_test_src_base_init gst_test_element_base_init
|
|
||||||
#define gst_test_filter_base_init gst_test_element_base_init
|
|
||||||
#define gst_test_sink_base_init gst_test_element_base_init
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_element_class_init (GstTestElementClass * klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
gst_test_element_base_init (gpointer klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actual element code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
gboolean loop = FALSE;
|
|
||||||
|
|
||||||
static GstData *
|
|
||||||
gst_test_src_get (GstPad * pad)
|
|
||||||
{
|
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_src_loop (GstElement * element)
|
|
||||||
{
|
|
||||||
GstTestSrc *src = (GstTestElement *) element;
|
|
||||||
|
|
||||||
gst_pad_push (src->srcpad, gst_test_src_get (src->srcpad));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_src_init (GstTestElement * src)
|
|
||||||
{
|
|
||||||
src->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
||||||
if (loop) {
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (src), gst_test_src_loop);
|
|
||||||
} else {
|
|
||||||
gst_pad_set_get_function (src->srcpad, gst_test_src_get);
|
|
||||||
}
|
|
||||||
gst_element_add_pad (GST_ELEMENT (src), src->srcpad);
|
|
||||||
|
|
||||||
GST_OBJECT_FLAG_SET (src, GST_ELEMENT_EVENT_AWARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_filter_chain (GstPad * pad, GstData * data)
|
|
||||||
{
|
|
||||||
GstTestFilter *filter = (GstTestElement *) gst_pad_get_parent (pad);
|
|
||||||
|
|
||||||
gst_pad_push (filter->srcpad, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_filter_loop (GstElement * element)
|
|
||||||
{
|
|
||||||
GstTestFilter *filter = (GstTestElement *) element;
|
|
||||||
|
|
||||||
gst_test_filter_chain (filter->sinkpad, gst_pad_pull (filter->sinkpad));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_filter_init (GstTestElement * filter)
|
|
||||||
{
|
|
||||||
filter->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
||||||
if (loop) {
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (filter), gst_test_filter_loop);
|
|
||||||
} else {
|
|
||||||
gst_pad_set_chain_function (filter->sinkpad, gst_test_filter_chain);
|
|
||||||
}
|
|
||||||
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
|
|
||||||
|
|
||||||
filter->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
|
|
||||||
|
|
||||||
GST_OBJECT_FLAG_SET (filter, GST_ELEMENT_EVENT_AWARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_chain (GstPad * pad, GstData * data)
|
|
||||||
{
|
|
||||||
gst_data_unref (data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_loop (GstElement * element)
|
|
||||||
{
|
|
||||||
GstTestSink *sink = (GstTestElement *) element;
|
|
||||||
|
|
||||||
gst_test_sink_chain (sink->sinkpad, gst_pad_pull (sink->sinkpad));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_init (GstTestElement * sink)
|
|
||||||
{
|
|
||||||
sink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
||||||
if (loop) {
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (sink), gst_test_sink_loop);
|
|
||||||
} else {
|
|
||||||
gst_pad_set_chain_function (sink->sinkpad, gst_test_sink_chain);
|
|
||||||
}
|
|
||||||
gst_element_add_pad (GST_ELEMENT (sink), sink->sinkpad);
|
|
||||||
|
|
||||||
GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_EVENT_AWARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define parent_class src_parent_class
|
|
||||||
GST_BOILERPLATE (GstTestSrc, gst_test_src, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
#undef parent_class
|
|
||||||
#define parent_class filter_parent_class
|
|
||||||
GST_BOILERPLATE (GstTestFilter, gst_test_filter, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
#undef parent_class
|
|
||||||
#define parent_class sink_parent_class
|
|
||||||
GST_BOILERPLATE (GstTestSink, gst_test_sink, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
#undef parent_class
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actual test.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
cb_error (GstElement * element)
|
|
||||||
{
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *filter, *sink;
|
|
||||||
gint n, r;
|
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
for (r = 0; r < 2; r++) {
|
|
||||||
pipeline = gst_pipeline_new ("p");
|
|
||||||
g_signal_connect (pipeline, "error", G_CALLBACK (cb_error), NULL);
|
|
||||||
src = g_object_new (gst_test_src_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (src), "src");
|
|
||||||
filter = g_object_new (gst_test_filter_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (filter), "filter");
|
|
||||||
sink = g_object_new (gst_test_sink_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (sink), "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, filter, sink, NULL);
|
|
||||||
res = gst_element_link (src, filter);
|
|
||||||
g_assert (res);
|
|
||||||
res = gst_element_link (filter, sink);
|
|
||||||
g_assert (res);
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
for (n = 0; n < 100; n++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
/* switch element types */
|
|
||||||
g_print ("Loop=%s done\n", loop ? "true" : "false");
|
|
||||||
loop = !loop;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = gst-print-formats
|
|
||||||
tests_fail =
|
|
||||||
tests_ignore =
|
|
||||||
|
|
||||||
|
|
|
@ -1,347 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
|
||||||
* 2004 Thomas Vander Stichele <thomas@apestaart.org>
|
|
||||||
*
|
|
||||||
* gst-inspect.c: tool to inspect the GStreamer registry
|
|
||||||
*
|
|
||||||
* 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 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
#include "gst/gst-i18n-app.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <glib/gprintf.h>
|
|
||||||
|
|
||||||
#define static
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_pad_templates_info (GstElement * element, GstElementFactory * factory,
|
|
||||||
GstPadDirection dir)
|
|
||||||
{
|
|
||||||
GstElementClass *gstelement_class;
|
|
||||||
const GList *pads;
|
|
||||||
GstPadTemplate *padtemplate;
|
|
||||||
|
|
||||||
if (!factory->numpadtemplates) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
|
|
||||||
|
|
||||||
pads = factory->padtemplates;
|
|
||||||
while (pads) {
|
|
||||||
padtemplate = (GstPadTemplate *) (pads->data);
|
|
||||||
pads = g_list_next (pads);
|
|
||||||
|
|
||||||
if (padtemplate->direction == dir) {
|
|
||||||
if (padtemplate->caps) {
|
|
||||||
GstStructure *structure;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < gst_caps_get_size (padtemplate->caps); i++) {
|
|
||||||
structure = gst_caps_get_structure (padtemplate->caps, i);
|
|
||||||
g_print (" %s\n", gst_structure_get_name (structure));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_element_list (const char *klass, GstPadDirection dir)
|
|
||||||
{
|
|
||||||
GList *plugins;
|
|
||||||
|
|
||||||
g_print ("Elements in %s:\n", klass);
|
|
||||||
for (plugins = gst_registry_pool_plugin_list (); plugins;
|
|
||||||
plugins = g_list_next (plugins)) {
|
|
||||||
GList *features;
|
|
||||||
GstPlugin *plugin;
|
|
||||||
|
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
|
||||||
|
|
||||||
features = gst_plugin_get_feature_list (plugin);
|
|
||||||
while (features) {
|
|
||||||
GstPluginFeature *feature;
|
|
||||||
|
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
|
||||||
|
|
||||||
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
|
||||||
GstElementFactory *factory;
|
|
||||||
GstElement *element;
|
|
||||||
|
|
||||||
factory = GST_ELEMENT_FACTORY (feature);
|
|
||||||
if (strncmp (factory->details.klass, klass, strlen (klass)) == 0) {
|
|
||||||
g_print (" %s: %s (%d)\n", GST_PLUGIN_FEATURE_NAME (factory),
|
|
||||||
factory->details.longname, gst_plugin_feature_get_rank (feature));
|
|
||||||
element = gst_element_factory_create (factory, NULL);
|
|
||||||
print_pad_templates_info (element, factory, dir);
|
|
||||||
gst_object_unref (element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
features = g_list_next (features);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_print ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_typefind_list (void)
|
|
||||||
{
|
|
||||||
GList *plugins;
|
|
||||||
|
|
||||||
g_print ("Typefind list:\n");
|
|
||||||
for (plugins = gst_registry_pool_plugin_list (); plugins;
|
|
||||||
plugins = g_list_next (plugins)) {
|
|
||||||
GList *features;
|
|
||||||
GstPlugin *plugin;
|
|
||||||
|
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
|
||||||
|
|
||||||
features = gst_plugin_get_feature_list (plugin);
|
|
||||||
while (features) {
|
|
||||||
GstPluginFeature *feature;
|
|
||||||
|
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
|
||||||
|
|
||||||
if (GST_IS_TYPE_FIND_FACTORY (feature)) {
|
|
||||||
GstTypeFindFactory *factory;
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
gst_plugin_load_file (plugin->filename, NULL);
|
|
||||||
|
|
||||||
factory = GST_TYPE_FIND_FACTORY (feature);
|
|
||||||
g_print (" %s: (%d)\n", GST_PLUGIN_FEATURE_NAME (factory),
|
|
||||||
gst_plugin_feature_get_rank (feature));
|
|
||||||
s = gst_caps_to_string (gst_type_find_factory_get_caps (factory));
|
|
||||||
g_print (" %s\n", s);
|
|
||||||
g_free (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
features = g_list_next (features);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_print ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
list_sort_func (gconstpointer a, gconstpointer b)
|
|
||||||
{
|
|
||||||
return strcmp ((const char *) a, (const char *) b);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GList *
|
|
||||||
get_typefind_mime_list (void)
|
|
||||||
{
|
|
||||||
GList *plugins;
|
|
||||||
GList *mime_list = NULL;
|
|
||||||
|
|
||||||
for (plugins = gst_registry_pool_plugin_list (); plugins;
|
|
||||||
plugins = g_list_next (plugins)) {
|
|
||||||
GList *features;
|
|
||||||
GstPlugin *plugin;
|
|
||||||
|
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
|
||||||
|
|
||||||
features = gst_plugin_get_feature_list (plugin);
|
|
||||||
while (features) {
|
|
||||||
GstPluginFeature *feature;
|
|
||||||
|
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
|
||||||
|
|
||||||
if (GST_IS_TYPE_FIND_FACTORY (feature)) {
|
|
||||||
GstTypeFindFactory *factory;
|
|
||||||
char *s;
|
|
||||||
int i;
|
|
||||||
const GstCaps *caps;
|
|
||||||
|
|
||||||
factory = GST_TYPE_FIND_FACTORY (feature);
|
|
||||||
caps = gst_type_find_factory_get_caps (factory);
|
|
||||||
|
|
||||||
if (gst_plugin_feature_get_rank (feature) > 0 && caps != NULL) {
|
|
||||||
for (i = 0; i < gst_caps_get_size (caps); i++) {
|
|
||||||
const GstStructure *structure = gst_caps_get_structure (caps, i);
|
|
||||||
|
|
||||||
s = g_strdup (gst_structure_get_name (structure));
|
|
||||||
mime_list = g_list_prepend (mime_list, s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
features = g_list_next (features);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mime_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
GList *
|
|
||||||
g_list_uniqify (GList * list)
|
|
||||||
{
|
|
||||||
GList *item;
|
|
||||||
|
|
||||||
for (item = g_list_first (list); item; item = g_list_next (item)) {
|
|
||||||
GList *next_item = g_list_next (item);
|
|
||||||
|
|
||||||
while (next_item && strcmp (item->data, next_item->data) == 0) {
|
|
||||||
g_free (next_item->data);
|
|
||||||
list = g_list_delete_link (list, next_item);
|
|
||||||
next_item = g_list_next (item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GList *
|
|
||||||
get_pad_templates_info (GstElement * element, GstElementFactory * factory,
|
|
||||||
GstPadDirection dir)
|
|
||||||
{
|
|
||||||
GstElementClass *gstelement_class;
|
|
||||||
const GList *pads;
|
|
||||||
GstPadTemplate *padtemplate;
|
|
||||||
GList *mime_list = NULL;
|
|
||||||
|
|
||||||
if (!factory->numpadtemplates) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
|
|
||||||
|
|
||||||
pads = factory->padtemplates;
|
|
||||||
while (pads) {
|
|
||||||
padtemplate = (GstPadTemplate *) (pads->data);
|
|
||||||
pads = g_list_next (pads);
|
|
||||||
|
|
||||||
if (padtemplate->direction == dir) {
|
|
||||||
if (padtemplate->caps) {
|
|
||||||
GstStructure *structure;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < gst_caps_get_size (padtemplate->caps); i++) {
|
|
||||||
structure = gst_caps_get_structure (padtemplate->caps, i);
|
|
||||||
mime_list = g_list_prepend (mime_list,
|
|
||||||
g_strdup (gst_structure_get_name (structure)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mime_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GList *
|
|
||||||
get_element_mime_list (const char *klass, GstPadDirection dir)
|
|
||||||
{
|
|
||||||
GList *mime_list = NULL;
|
|
||||||
GList *plugins;
|
|
||||||
|
|
||||||
for (plugins = gst_registry_pool_plugin_list (); plugins;
|
|
||||||
plugins = g_list_next (plugins)) {
|
|
||||||
GList *features;
|
|
||||||
GstPlugin *plugin;
|
|
||||||
|
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
|
||||||
|
|
||||||
features = gst_plugin_get_feature_list (plugin);
|
|
||||||
while (features) {
|
|
||||||
GstPluginFeature *feature;
|
|
||||||
|
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
|
||||||
|
|
||||||
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
|
||||||
GstElementFactory *factory;
|
|
||||||
GstElement *element;
|
|
||||||
|
|
||||||
factory = GST_ELEMENT_FACTORY (feature);
|
|
||||||
if (strncmp (factory->details.klass, klass, strlen (klass)) == 0) {
|
|
||||||
if (gst_plugin_feature_get_rank (feature) > 0) {
|
|
||||||
GList *list;
|
|
||||||
|
|
||||||
element = gst_element_factory_create (factory, NULL);
|
|
||||||
list = get_pad_templates_info (element, factory, dir);
|
|
||||||
mime_list = g_list_concat (mime_list, list);
|
|
||||||
gst_object_unref (element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
features = g_list_next (features);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mime_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_mime_list (void)
|
|
||||||
{
|
|
||||||
GList *list;
|
|
||||||
GList *typefind_list;
|
|
||||||
GList *item;
|
|
||||||
GList *item2;
|
|
||||||
|
|
||||||
typefind_list = get_typefind_mime_list ();
|
|
||||||
typefind_list = g_list_sort (typefind_list, list_sort_func);
|
|
||||||
typefind_list = g_list_uniqify (typefind_list);
|
|
||||||
|
|
||||||
list = get_element_mime_list ("Codec/Demuxer", GST_PAD_SINK);
|
|
||||||
list = g_list_concat (list, get_element_mime_list ("Codec/Decoder",
|
|
||||||
GST_PAD_SINK));
|
|
||||||
list = g_list_sort (list, list_sort_func);
|
|
||||||
list = g_list_uniqify (list);
|
|
||||||
|
|
||||||
g_print ("MIME media type list:\n");
|
|
||||||
for (item = g_list_first (list); item; item = g_list_next (item)) {
|
|
||||||
for (item2 = g_list_first (typefind_list); item2;
|
|
||||||
item2 = g_list_next (item2)) {
|
|
||||||
if (strcmp ((char *) item->data, (char *) item2->data) == 0) {
|
|
||||||
g_print (" %s\n", (char *) item->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef GETTEXT_PACKAGE
|
|
||||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
|
||||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
||||||
textdomain (GETTEXT_PACKAGE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
print_element_list ("Codec/Demuxer", GST_PAD_SINK);
|
|
||||||
print_element_list ("Codec/Decoder", GST_PAD_SINK);
|
|
||||||
print_element_list ("Codec/Muxer", GST_PAD_SRC);
|
|
||||||
print_element_list ("Codec/Encoder", GST_PAD_SRC);
|
|
||||||
print_typefind_list ();
|
|
||||||
print_mime_list ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
17
tests/old/testsuite/schedulers/.gitignore
vendored
17
tests/old/testsuite/schedulers/.gitignore
vendored
|
@ -1,17 +0,0 @@
|
||||||
group_link
|
|
||||||
relink_sink
|
|
||||||
relink_src
|
|
||||||
unlink_sink
|
|
||||||
unlink_src
|
|
||||||
unref_sink
|
|
||||||
unref_src
|
|
||||||
useless_iteration
|
|
||||||
143777
|
|
||||||
143777-2
|
|
||||||
142183
|
|
||||||
142183-2
|
|
||||||
147713
|
|
||||||
147819
|
|
||||||
147894
|
|
||||||
147894-2
|
|
||||||
queue_link
|
|
|
@ -1,73 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity (GstElement * element)
|
|
||||||
{
|
|
||||||
GstBin *parent;
|
|
||||||
|
|
||||||
parent = GST_BIN (gst_element_get_parent (element));
|
|
||||||
g_print ("identity handoff\n");
|
|
||||||
/* element is unreffed and destroyed here, which will cause
|
|
||||||
* an assert */
|
|
||||||
gst_bin_remove (parent, element);
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity,
|
|
||||||
NULL);
|
|
||||||
g_object_set (G_OBJECT (id), "loop-based", TRUE, NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
|
|
||||||
gst_element_link_pads (src, "src", id, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
g_print ("got past iteration, scheduler refs elements correctly\n");
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity (GstElement * element)
|
|
||||||
{
|
|
||||||
GstBin *parent;
|
|
||||||
|
|
||||||
parent = GST_BIN (gst_element_get_parent (element));
|
|
||||||
g_print ("identity handoff\n");
|
|
||||||
gst_bin_remove (parent, element);
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
/* ref object here as it will be unparented and destroyed in the
|
|
||||||
* handoff signal, normally the scheduler should keep a ref to the
|
|
||||||
* currently scheduled elements but that's another bug displayed in
|
|
||||||
* 142183-2.c */
|
|
||||||
gst_object_ref (id);
|
|
||||||
g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity,
|
|
||||||
NULL);
|
|
||||||
g_object_set (G_OBJECT (id), "loop-based", TRUE, NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
|
|
||||||
/* this is what triggers the bug */
|
|
||||||
gst_element_enable_threadsafe_properties (GST_ELEMENT (src));
|
|
||||||
gst_element_enable_threadsafe_properties (GST_ELEMENT (id));
|
|
||||||
gst_element_enable_threadsafe_properties (GST_ELEMENT (sink));
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", id, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* 'cause we're going into deadlock mode */
|
|
||||||
alarm (5);
|
|
||||||
|
|
||||||
g_print ("adding identity back...\n");
|
|
||||||
/* add identity back in */
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), id, NULL);
|
|
||||||
|
|
||||||
g_print ("going into possible deadlock... alarm at 5 seconds\n");
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
g_print ("ok, no deadlock. bug 142183 fixed!\n");
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
gst_object_unref (id);
|
|
||||||
src = id = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char **argv)
|
|
||||||
{
|
|
||||||
GstElement *src, *sink, *enc, *tee;
|
|
||||||
GstElement *pipeline;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", "pipeline");
|
|
||||||
|
|
||||||
src = gst_element_factory_make ("fakesrc", "src");
|
|
||||||
g_assert (src);
|
|
||||||
tee = gst_element_factory_make ("tee", "tee1");
|
|
||||||
g_assert (tee);
|
|
||||||
enc = gst_element_factory_make ("identity", "enc");
|
|
||||||
g_assert (enc);
|
|
||||||
sink = gst_element_factory_make ("fakesink", "sink");
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL);
|
|
||||||
if (!gst_element_link_many (src, tee, enc, sink, NULL))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
for (i = 0; i < 5; i++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
g_print ("%d\n", i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
gst_element_unlink_many (tee, enc, sink, NULL);
|
|
||||||
gst_bin_remove_many (GST_BIN (pipeline), enc, sink, NULL);
|
|
||||||
|
|
||||||
enc = gst_element_factory_make ("identity", "enc");
|
|
||||||
g_assert (enc);
|
|
||||||
sink = gst_element_factory_make ("fakesink", "sink");
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), enc, sink, NULL);
|
|
||||||
if (!gst_element_link_many (tee, enc, sink, NULL))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
for (i = 5; i < 10; i++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
g_print ("%d\n", i);
|
|
||||||
}
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file reproduces the bug in the bugreport #143777, as can be seen at
|
|
||||||
* http://bugzilla.gnome.org/show_bug.cgi?id=143777 - the issue is that when
|
|
||||||
* pausing a pipeline while the chainhandler is still running, then unlinking
|
|
||||||
* the pad that's chain function is called and relinking it clears the buffer
|
|
||||||
* that was stored for sending the event. gst_pad_call_chain_function needs
|
|
||||||
* to check that.
|
|
||||||
* The fix is in gstpad.c, revision 1.327
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id;
|
|
||||||
guint i = 0, j;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
|
|
||||||
while (i < 100) {
|
|
||||||
g_print ("running... (%d iterations)\n", i);
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
gst_element_link_many (src, id, sink, NULL);
|
|
||||||
for (j = 0; j < i; j++)
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
gst_element_unlink_many (src, id, sink, NULL);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
g_assert (i == 100);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,92 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymanse <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static gint src_handoff = 0;
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_src (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("src handoff\n");
|
|
||||||
src_handoff++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_sink (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("sink handoff\n");
|
|
||||||
g_assert (src_handoff == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id1, *id2;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
g_object_set (G_OBJECT (src), "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (src), "handoff", (GCallback) handoff_src, NULL);
|
|
||||||
id1 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id1);
|
|
||||||
|
|
||||||
id2 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id2);
|
|
||||||
g_object_set (G_OBJECT (id2), "loop-based", TRUE, NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (sink), "handoff", (GCallback) handoff_sink, NULL);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id1, NULL);
|
|
||||||
gst_element_link_pads (src, "src", id1, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
if (gst_element_set_state (id2,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
if (gst_element_set_state (sink,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), sink, NULL);
|
|
||||||
gst_element_link_pads (id2, "src", sink, "sink");
|
|
||||||
gst_element_link_pads (id1, "src", id2, "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), id2, NULL);
|
|
||||||
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id1 = id2 = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static gboolean handoff;
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity1 (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("identity1 handoff\n");
|
|
||||||
handoff = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity2 (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("identity2 handoff\n");
|
|
||||||
handoff = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id1, *id2;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id1 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id1);
|
|
||||||
g_object_set (G_OBJECT (id1), "loop-based", TRUE, NULL);
|
|
||||||
g_object_set (G_OBJECT (id1), "duplicate", 3, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (id1), "handoff", (GCallback) handoff_identity1,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
id2 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id2);
|
|
||||||
g_object_set (G_OBJECT (id2), "loop-based", TRUE, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (id2), "handoff", (GCallback) handoff_identity2,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id1, id2, sink, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", id1, "sink");
|
|
||||||
gst_element_link_pads (id1, "src", id2, "sink");
|
|
||||||
gst_element_link_pads (id2, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running...\n");
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* do ugly stuff here */
|
|
||||||
gst_object_ref (id1);
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), id1);
|
|
||||||
gst_element_link_pads (src, "src", id1, "sink");
|
|
||||||
gst_element_link_pads (id1, "src", id2, "sink");
|
|
||||||
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id1 = id2 = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,138 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static gboolean empty;
|
|
||||||
static gboolean bug;
|
|
||||||
static gboolean handoff;
|
|
||||||
static GstElement *pipeline2;
|
|
||||||
|
|
||||||
static void
|
|
||||||
queue_empty (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("queue empty\n");
|
|
||||||
if (!handoff)
|
|
||||||
bug = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
queue_filled (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("queue filled\n");
|
|
||||||
empty = FALSE;
|
|
||||||
|
|
||||||
/* read from the other end */
|
|
||||||
handoff = FALSE;
|
|
||||||
bug = FALSE;
|
|
||||||
|
|
||||||
alarm (5);
|
|
||||||
|
|
||||||
g_print ("emptying queue with 5 second timeout...\n");
|
|
||||||
while (!bug && !handoff) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("identity handoff\n");
|
|
||||||
handoff = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *queue, *id;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
queue = gst_element_factory_make ("queue", NULL);
|
|
||||||
g_assert (queue);
|
|
||||||
g_signal_connect (G_OBJECT (queue), "overrun", (GCallback) queue_filled,
|
|
||||||
NULL);
|
|
||||||
g_signal_connect (G_OBJECT (queue), "underrun", (GCallback) queue_empty,
|
|
||||||
NULL);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, queue, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", queue, "sink");
|
|
||||||
|
|
||||||
/* second pipeline for sinks */
|
|
||||||
pipeline2 = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline2);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline2), id, sink, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (queue, "src", id, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline2,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running...\n");
|
|
||||||
/* fill queue */
|
|
||||||
empty = TRUE;
|
|
||||||
while (empty) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
}
|
|
||||||
g_assert (!bug);
|
|
||||||
|
|
||||||
g_print ("relinking...\n");
|
|
||||||
/* now unlink and link id and sink */
|
|
||||||
gst_element_unlink_pads (id, "src", sink, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
g_print ("running again...\n");
|
|
||||||
/* fill queue */
|
|
||||||
empty = TRUE;
|
|
||||||
while (empty) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
}
|
|
||||||
g_assert (!bug);
|
|
||||||
|
|
||||||
/* trigger the bug */
|
|
||||||
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
gst_object_unref (pipeline2);
|
|
||||||
src = id = sink = pipeline = pipeline2 = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,146 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static gboolean empty;
|
|
||||||
static gboolean bug;
|
|
||||||
static gboolean handoff;
|
|
||||||
static GstElement *pipeline2;
|
|
||||||
|
|
||||||
static void
|
|
||||||
queue_empty (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("queue empty\n");
|
|
||||||
if (!handoff)
|
|
||||||
bug = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
queue_filled (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("queue filled\n");
|
|
||||||
empty = FALSE;
|
|
||||||
|
|
||||||
/* read from the other end */
|
|
||||||
handoff = FALSE;
|
|
||||||
bug = FALSE;
|
|
||||||
|
|
||||||
alarm (5);
|
|
||||||
|
|
||||||
g_print ("emptying queue with 5 second timeout...\n");
|
|
||||||
while (!bug && !handoff) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("identity handoff\n");
|
|
||||||
handoff = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *queue, *id;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
queue = gst_element_factory_make ("queue", NULL);
|
|
||||||
g_assert (queue);
|
|
||||||
g_signal_connect (G_OBJECT (queue), "overrun", (GCallback) queue_filled,
|
|
||||||
NULL);
|
|
||||||
g_signal_connect (G_OBJECT (queue), "underrun", (GCallback) queue_empty,
|
|
||||||
NULL);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, queue, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", queue, "sink");
|
|
||||||
|
|
||||||
/* second pipeline for sinks */
|
|
||||||
pipeline2 = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline2);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline2), id, sink, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (queue, "src", id, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline2,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running...\n");
|
|
||||||
/* fill queue */
|
|
||||||
empty = TRUE;
|
|
||||||
while (empty) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
}
|
|
||||||
g_assert (!bug);
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline2,
|
|
||||||
GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("relinking...\n");
|
|
||||||
/* now unlink and link id and sink */
|
|
||||||
gst_element_unlink_pads (id, "src", sink, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline2,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running again...\n");
|
|
||||||
/* fill queue */
|
|
||||||
empty = TRUE;
|
|
||||||
while (empty) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
}
|
|
||||||
g_assert (!bug);
|
|
||||||
|
|
||||||
/* trigger the bug */
|
|
||||||
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
gst_object_unref (pipeline2);
|
|
||||||
src = id = sink = pipeline = pipeline2 = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = \
|
|
||||||
unlink_src unlink_sink \
|
|
||||||
relink_src relink_sink \
|
|
||||||
unref_src unref_sink \
|
|
||||||
142183 142183-2 \
|
|
||||||
143777 143777-2 \
|
|
||||||
147713 \
|
|
||||||
147819 \
|
|
||||||
147894 147894-2 group_link \
|
|
||||||
queue_link
|
|
||||||
|
|
||||||
# don't enable this one unless it actually works.
|
|
||||||
# useless_iteration
|
|
||||||
tests_fail =
|
|
||||||
tests_ignore =
|
|
||||||
|
|
||||||
unlink_src_SOURCES = unlink.c
|
|
||||||
unlink_src_CFLAGS = $(AM_CFLAGS) -DELEMENT=src
|
|
||||||
unlink_sink_SOURCES = unlink.c
|
|
||||||
unlink_sink_CFLAGS = $(AM_CFLAGS) -DELEMENT=sink
|
|
||||||
relink_src_SOURCES = relink.c
|
|
||||||
relink_src_CFLAGS = $(AM_CFLAGS) -DELEMENT=src -DOTHER_ELEMENT=sink
|
|
||||||
relink_sink_SOURCES = relink.c
|
|
||||||
relink_sink_CFLAGS = $(AM_CFLAGS) -DELEMENT=sink -DOTHER_ELEMENT=src
|
|
||||||
unref_src_SOURCES = unref.c
|
|
||||||
unref_src_CFLAGS = $(AM_CFLAGS) -DELEMENT=src
|
|
||||||
unref_sink_SOURCES = unref.c
|
|
||||||
unref_sink_CFLAGS = $(AM_CFLAGS) -DELEMENT=sink
|
|
|
@ -1,67 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *id1, *id2, *sink;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id1 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id1);
|
|
||||||
id2 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id2);
|
|
||||||
g_object_set (G_OBJECT (id2), "loop-based", TRUE, NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id1, id2, sink, NULL);
|
|
||||||
|
|
||||||
/* link is not accounted for here... */
|
|
||||||
gst_element_link_pads (id1, "src", id2, "sink");
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", id1, "sink");
|
|
||||||
gst_element_link_pads (id2, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running...\n");
|
|
||||||
/* fill queue */
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id1 = id2 = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *thread, *bin, *src, *queue, *id1, *sink;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
queue = gst_element_factory_make ("queue", NULL);
|
|
||||||
g_assert (queue);
|
|
||||||
|
|
||||||
thread = gst_element_factory_make ("thread", NULL);
|
|
||||||
g_assert (thread);
|
|
||||||
bin = gst_element_factory_make ("bin", NULL);
|
|
||||||
g_assert (bin);
|
|
||||||
id1 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id1);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (bin), id1, sink, NULL);
|
|
||||||
gst_bin_add_many (GST_BIN (thread), bin, NULL);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, queue, thread, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", queue, "sink");
|
|
||||||
gst_element_link_pads (queue, "src", id1, "sink");
|
|
||||||
gst_element_link_pads (id1, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("unlinking...\n");
|
|
||||||
|
|
||||||
gst_object_ref (queue);
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), queue);
|
|
||||||
gst_object_ref (bin);
|
|
||||||
gst_bin_remove (GST_BIN (thread), bin);
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
GstElement *pipeline, *src, *sink;
|
|
||||||
|
|
||||||
static void
|
|
||||||
cb_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
|
||||||
gpointer unused)
|
|
||||||
{
|
|
||||||
if (GST_PAD_PEER (pad)) {
|
|
||||||
g_print ("relinking...\n");
|
|
||||||
gst_pad_unlink (pad, GST_PAD_PEER (pad));
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), OTHER_ELEMENT);
|
|
||||||
OTHER_ELEMENT =
|
|
||||||
gst_element_factory_make ("fake" G_STRINGIFY (OTHER_ELEMENT), NULL);
|
|
||||||
g_assert (OTHER_ELEMENT);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), OTHER_ELEMENT);
|
|
||||||
gst_element_sync_state_with_parent (OTHER_ELEMENT);
|
|
||||||
gst_element_link (ELEMENT, OTHER_ELEMENT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
guint i = 0;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
||||||
gst_element_link (src, sink);
|
|
||||||
/* setup special stuff */
|
|
||||||
g_object_set (ELEMENT, "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (ELEMENT, "handoff", (GCallback) cb_handoff, NULL);
|
|
||||||
|
|
||||||
/* run pipeline */
|
|
||||||
g_print ("running...\n");
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (i++ < 10 && gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static void
|
|
||||||
cb_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
|
||||||
gpointer unused)
|
|
||||||
{
|
|
||||||
if (GST_PAD_PEER (pad)) {
|
|
||||||
g_print ("unlinking...\n");
|
|
||||||
gst_pad_unlink (pad, GST_PAD_PEER (pad));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
||||||
gst_element_link (src, sink);
|
|
||||||
/* setup special stuff */
|
|
||||||
g_object_set (ELEMENT, "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (ELEMENT, "handoff", (GCallback) cb_handoff, NULL);
|
|
||||||
|
|
||||||
/* run pipeline */
|
|
||||||
g_print ("running...\n");
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
GstElement *pipeline, *src, *sink;
|
|
||||||
|
|
||||||
static void
|
|
||||||
cb_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
|
||||||
gpointer unused)
|
|
||||||
{
|
|
||||||
if (pipeline) {
|
|
||||||
g_print ("unreffing...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
||||||
gst_element_link (src, sink);
|
|
||||||
/* setup special stuff */
|
|
||||||
g_object_set (ELEMENT, "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (ELEMENT, "handoff", (GCallback) cb_handoff, NULL);
|
|
||||||
|
|
||||||
/* run pipeline */
|
|
||||||
g_print ("running...\n");
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (pipeline && gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
GError *error = NULL;
|
|
||||||
guint i = 0;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_parse_launch ("pipeline.( { fakesrc ! fakesink } )", &error);
|
|
||||||
g_assert (error == NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
|
|
||||||
/* run pipeline */
|
|
||||||
g_print ("running...\n");
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (i < 100 && gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
g_print ("cleaning up... (%d iterations)\n", i);
|
|
||||||
g_assert (i == 100);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -14,20 +14,20 @@ GST_DEBUG_DIRS = debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
bytestream caps cleanup controller \
|
caps \
|
||||||
$(GST_DEBUG_DIRS) \
|
$(GST_DEBUG_DIRS) \
|
||||||
dlopen \
|
dlopen \
|
||||||
elements indexers negotiation pad \
|
elements indexers \
|
||||||
$(GST_PARSE_DIRS) \
|
$(GST_PARSE_DIRS) \
|
||||||
plugin refcounting schedulers states threads trigger
|
plugin refcounting states threads trigger
|
||||||
|
|
||||||
DIST_SUBDIRS = \
|
DIST_SUBDIRS = \
|
||||||
bytestream caps cleanup controller \
|
caps \
|
||||||
debug \
|
debug \
|
||||||
dlopen \
|
dlopen \
|
||||||
elements indexers negotiation pad \
|
elements indexers \
|
||||||
parse \
|
parse \
|
||||||
plugin refcounting schedulers states threads trigger
|
plugin refcounting states threads trigger
|
||||||
|
|
||||||
tests_pass =
|
tests_pass =
|
||||||
tests_fail =
|
tests_fail =
|
||||||
|
|
9
testsuite/bytestream/.gitignore
vendored
9
testsuite/bytestream/.gitignore
vendored
|
@ -1,9 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
*.o
|
|
||||||
*.lo
|
|
||||||
*.la
|
|
||||||
.deps
|
|
||||||
.libs
|
|
||||||
test1
|
|
||||||
filepadsink
|
|
|
@ -1,11 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = filepadsink
|
|
||||||
tests_fail = test1
|
|
||||||
tests_ignore =
|
|
||||||
|
|
||||||
test1_SOURCES = test1.c gstbstest.c
|
|
||||||
test1_LDFLAGS = $(top_builddir)/libs/gst/bytestream/libgstbytestream.la
|
|
||||||
|
|
||||||
filepadsink_CFLAGS = $(AM_CFLAGS) -DTHE_FILE=\""$(top_srcdir)/configure.ac"\"
|
|
||||||
filepadsink_LDFLAGS = $(top_builddir)/libs/gst/bytestream/libgstbytestream.la
|
|
|
@ -1,282 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
|
|
||||||
*
|
|
||||||
* 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 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/bytestream/filepad.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define GST_TYPE_FP_SINK \
|
|
||||||
(gst_fp_sink_get_type())
|
|
||||||
#define GST_FP_SINK(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FP_SINK,GstFpSink))
|
|
||||||
#define GST_FP_SINK_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FP_SINK,GstFpSinkClass))
|
|
||||||
#define GST_IS_FP_SINK(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FP_SINK))
|
|
||||||
#define GST_IS_FP_SINK_CLASS(obj) \
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FP_SINK))
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GstFpSink GstFpSink;
|
|
||||||
typedef struct _GstFpSinkClass GstFpSinkClass;
|
|
||||||
|
|
||||||
struct _GstFpSink
|
|
||||||
{
|
|
||||||
GstElement element;
|
|
||||||
/* pads */
|
|
||||||
GstFilePad *sinkpad;
|
|
||||||
|
|
||||||
/* fd */
|
|
||||||
FILE *stream;
|
|
||||||
guint state;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstFpSinkClass
|
|
||||||
{
|
|
||||||
GstElementClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GST_BOILERPLATE (GstFpSink, gst_fp_sink, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
static void do_tests (GstFilePad * pad);
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_fp_sink_base_init (gpointer g_class)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_fp_sink_class_init (GstFpSinkClass * klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstStaticPadTemplate template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
||||||
GST_PAD_SINK,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS ("ANY")
|
|
||||||
);
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_fp_sink_init (GstFpSink * fp)
|
|
||||||
{
|
|
||||||
GST_OBJECT_FLAG_SET (fp, GST_ELEMENT_EVENT_AWARE);
|
|
||||||
|
|
||||||
fp->sinkpad =
|
|
||||||
GST_FILE_PAD (gst_file_pad_new (gst_static_pad_template_get (&template),
|
|
||||||
"sink"));
|
|
||||||
gst_file_pad_set_iterate_function (fp->sinkpad, do_tests);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (fp), GST_PAD (fp->sinkpad));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define THE_CHECK(result) G_STMT_START{ \
|
|
||||||
gint64 pos = gst_file_pad_tell(fp->sinkpad); \
|
|
||||||
if (pos >= 0) \
|
|
||||||
g_assert (pos == ftell (fp->stream)); \
|
|
||||||
g_print ("%s (%"G_GINT64_FORMAT")\n", result ? "OK" : "no", pos); \
|
|
||||||
return result; \
|
|
||||||
}G_STMT_END
|
|
||||||
#define FAIL THE_CHECK(FALSE)
|
|
||||||
#define SUCCESS THE_CHECK(TRUE)
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
fp_read (GstFpSink * fp, guint size)
|
|
||||||
{
|
|
||||||
guint8 buf[size], buf2[size];
|
|
||||||
gint64 amount;
|
|
||||||
|
|
||||||
g_print ("reading %u bytes...", size);
|
|
||||||
amount = gst_file_pad_read (fp->sinkpad, buf, size);
|
|
||||||
if (amount == -EAGAIN)
|
|
||||||
FAIL;
|
|
||||||
g_assert (amount == size);
|
|
||||||
amount = fread (buf2, 1, amount, fp->stream);
|
|
||||||
g_assert (amount == size);
|
|
||||||
if (memcmp (buf, buf2, amount) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
fp->state++;
|
|
||||||
SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
fp_try_read (GstFpSink * fp, guint size)
|
|
||||||
{
|
|
||||||
guint8 buf[size], buf2[size];
|
|
||||||
gint64 amount;
|
|
||||||
size_t amount2;
|
|
||||||
|
|
||||||
g_print ("reading %u bytes...", size);
|
|
||||||
amount = gst_file_pad_try_read (fp->sinkpad, buf, size);
|
|
||||||
if (amount == -EAGAIN)
|
|
||||||
FAIL;
|
|
||||||
g_assert (amount > 0);
|
|
||||||
amount2 = fread (buf2, 1, amount, fp->stream);
|
|
||||||
g_assert (amount == amount2);
|
|
||||||
if (memcmp (buf, buf2, amount) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
fp->state++;
|
|
||||||
SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
fp_seek (GstFpSink * fp, gint64 pos, GstSeekType whence)
|
|
||||||
{
|
|
||||||
int seek_type = whence == GST_SEEK_METHOD_SET ? SEEK_SET :
|
|
||||||
whence == GST_SEEK_METHOD_CUR ? SEEK_CUR : SEEK_END;
|
|
||||||
|
|
||||||
g_print ("seeking to %s %" G_GINT64_FORMAT " bytes...",
|
|
||||||
whence == GST_SEEK_METHOD_SET ? "" : whence ==
|
|
||||||
GST_SEEK_METHOD_CUR ? "+-" : "-", pos);
|
|
||||||
if (gst_file_pad_seek (fp->sinkpad, pos, whence) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
if (fseek (fp->stream, pos, seek_type) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
fp->state++;
|
|
||||||
SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
fp_eof (GstFpSink * fp)
|
|
||||||
{
|
|
||||||
guint8 buf;
|
|
||||||
|
|
||||||
g_print ("checking for EOF...");
|
|
||||||
if (!gst_file_pad_eof (fp->sinkpad))
|
|
||||||
FAIL;
|
|
||||||
if (fread (&buf, 1, 1, fp->stream) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
fp->state++;
|
|
||||||
SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MIN_SIZE 10050
|
|
||||||
#define MAX_SIZE 1000000
|
|
||||||
static void
|
|
||||||
do_tests (GstFilePad * pad)
|
|
||||||
{
|
|
||||||
GstFpSink *fp = GST_FP_SINK (gst_pad_get_parent (GST_PAD (pad)));
|
|
||||||
|
|
||||||
while (TRUE) {
|
|
||||||
switch (fp->state) {
|
|
||||||
case 0:
|
|
||||||
if (!fp_try_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (!fp_try_read (fp, MAX_SIZE)) /* more than file size */
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (!fp_seek (fp, 0, GST_SEEK_METHOD_SET))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (!fp_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
if (!fp_read (fp, MIN_SIZE - 50)) /* bigger than 1 buffer */
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
if (!fp_seek (fp, -200, GST_SEEK_METHOD_CUR))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
if (!fp_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
if (!fp_seek (fp, 50, GST_SEEK_METHOD_CUR))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
if (!fp_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
if (!fp_seek (fp, MIN_SIZE - 50, GST_SEEK_METHOD_SET))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
if (!fp_read (fp, 50))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
if (!fp_seek (fp, 0, GST_SEEK_METHOD_END))
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
if (!fp_eof (fp))
|
|
||||||
return;
|
|
||||||
gst_element_set_eos (GST_ELEMENT (fp));
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef THE_FILE
|
|
||||||
# define THE_FILE "../../configure.ac"
|
|
||||||
#endif
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink;
|
|
||||||
long size;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
gst_library_load ("gstbytestream");
|
|
||||||
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("filesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
sink = g_object_new (GST_TYPE_FP_SINK, NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (sink), "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
||||||
if (!gst_element_link (src, sink))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
g_object_set (src, "location", THE_FILE, NULL);
|
|
||||||
GST_FP_SINK (sink)->stream = fopen (THE_FILE, "rb");
|
|
||||||
g_assert (GST_FP_SINK (sink)->stream);
|
|
||||||
/* check correct file sizes */
|
|
||||||
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_END) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
size = ftell (GST_FP_SINK (sink)->stream);
|
|
||||||
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_SET) != 0)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
g_assert (size >= MIN_SIZE);
|
|
||||||
g_assert (size <= MAX_SIZE);
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
g_assert (GST_FP_SINK (sink)->state == 13);
|
|
||||||
g_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,418 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
|
||||||
*
|
|
||||||
* gstbstest.c:
|
|
||||||
*
|
|
||||||
* 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 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/bytestream/bytestream.h>
|
|
||||||
|
|
||||||
#define GST_TYPE_BSTEST (gst_bstest_get_type())
|
|
||||||
#define GST_BSTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BSTEST,GstBsTest))
|
|
||||||
#define GST_BSTEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BSTEST,GstBsTestClass))
|
|
||||||
#define GST_IS_BSTEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BSTEST))
|
|
||||||
#define GST_IS_BSTEST_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BSTEST))
|
|
||||||
|
|
||||||
typedef struct _GstBsTest GstBsTest;
|
|
||||||
typedef struct _GstBsTestClass GstBsTestClass;
|
|
||||||
|
|
||||||
struct _GstBsTest
|
|
||||||
{
|
|
||||||
GstElement element;
|
|
||||||
|
|
||||||
GstPad *sinkpad;
|
|
||||||
GstPad *srcpad;
|
|
||||||
|
|
||||||
GstByteStream *bs;
|
|
||||||
|
|
||||||
gchar *accesspattern;
|
|
||||||
guint num_patterns;
|
|
||||||
gchar **patterns;
|
|
||||||
guint sizemin;
|
|
||||||
guint sizemax;
|
|
||||||
gint count;
|
|
||||||
gboolean silent;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstBsTestClass
|
|
||||||
{
|
|
||||||
GstElementClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType gst_bstest_get_type (void);
|
|
||||||
|
|
||||||
|
|
||||||
GstElementDetails gst_bstest_details = GST_ELEMENT_DETAILS ("ByteStreamTest",
|
|
||||||
"Filter",
|
|
||||||
"Test for the GstByteStream code",
|
|
||||||
"Erik Walthinsen <omega@temple-baptist.com>, "
|
|
||||||
"Wim Taymans <wim.taymans@chello.be>");
|
|
||||||
|
|
||||||
|
|
||||||
/* BsTest signals and args */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
/* FILL ME */
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ARG_0,
|
|
||||||
ARG_SIZEMIN,
|
|
||||||
ARG_SIZEMAX,
|
|
||||||
ARG_COUNT,
|
|
||||||
ARG_SILENT,
|
|
||||||
ARG_ACCESSPATTERN,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void gst_bstest_base_init (gpointer g_class);
|
|
||||||
static void gst_bstest_class_init (GstBsTestClass * klass);
|
|
||||||
static void gst_bstest_init (GstBsTest * bstest);
|
|
||||||
|
|
||||||
static void gst_bstest_set_property (GObject * object, guint prop_id,
|
|
||||||
const GValue * value, GParamSpec * pspec);
|
|
||||||
static void gst_bstest_get_property (GObject * object, guint prop_id,
|
|
||||||
GValue * value, GParamSpec * pspec);
|
|
||||||
|
|
||||||
static GstStateChangeReturn gst_bstest_change_state (GstElement * element,
|
|
||||||
GstStateChange transition);
|
|
||||||
static void gst_bstest_loop (GstElement * element);
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
|
||||||
|
|
||||||
/* static guint gst_bstest_signals[LAST_SIGNAL] = { 0 }; */
|
|
||||||
|
|
||||||
GType
|
|
||||||
gst_bstest_get_type (void)
|
|
||||||
{
|
|
||||||
static GType bstest_type = 0;
|
|
||||||
|
|
||||||
if (!bstest_type) {
|
|
||||||
static const GTypeInfo bstest_info = {
|
|
||||||
sizeof (GstBsTestClass),
|
|
||||||
gst_bstest_base_init,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_bstest_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstBsTest),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_bstest_init,
|
|
||||||
};
|
|
||||||
|
|
||||||
bstest_type =
|
|
||||||
g_type_register_static (GST_TYPE_ELEMENT, "BSTest", &bstest_info, 0);
|
|
||||||
}
|
|
||||||
return bstest_type;
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
gst_bstest_base_init (gpointer g_class)
|
|
||||||
{
|
|
||||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
|
||||||
|
|
||||||
gst_element_class_set_details (gstelement_class, &gst_bstest_details);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_class_init (GstBsTestClass * klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class;
|
|
||||||
GstElementClass *gstelement_class;
|
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
|
||||||
gstelement_class = (GstElementClass *) klass;
|
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMIN,
|
|
||||||
g_param_spec_int ("sizemin", "sizemin", "sizemin", 0, G_MAXINT,
|
|
||||||
0, G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX,
|
|
||||||
g_param_spec_int ("sizemax", "sizemax", "sizemax", 0, G_MAXINT,
|
|
||||||
384, G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACCESSPATTERN,
|
|
||||||
g_param_spec_string ("accesspattern", "accesspattern", "accesspattern",
|
|
||||||
"r", G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COUNT,
|
|
||||||
g_param_spec_uint ("count", "count", "count",
|
|
||||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
|
||||||
g_param_spec_boolean ("silent", "silent", "silent",
|
|
||||||
FALSE, G_PARAM_READWRITE));
|
|
||||||
|
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_bstest_set_property);
|
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_bstest_get_property);
|
|
||||||
|
|
||||||
gstelement_class->change_state = gst_bstest_change_state;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstCaps *
|
|
||||||
gst_bstest_getcaps (GstPad * pad)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad));
|
|
||||||
GstPad *otherpad;
|
|
||||||
|
|
||||||
otherpad = (pad == bstest->srcpad) ? bstest->sinkpad : bstest->srcpad;
|
|
||||||
|
|
||||||
return gst_pad_get_allowed_caps (otherpad);
|
|
||||||
}
|
|
||||||
|
|
||||||
GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
||||||
GST_PAD_SRC,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS_ANY);
|
|
||||||
|
|
||||||
GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
||||||
GST_PAD_SINK,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS_ANY);
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_init (GstBsTest * bstest)
|
|
||||||
{
|
|
||||||
bstest->sinkpad =
|
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
|
|
||||||
"sink");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (bstest), bstest->sinkpad);
|
|
||||||
gst_pad_set_getcaps_function (bstest->sinkpad, gst_bstest_getcaps);
|
|
||||||
|
|
||||||
bstest->srcpad =
|
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
|
|
||||||
"src");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (bstest), bstest->srcpad);
|
|
||||||
gst_pad_set_getcaps_function (bstest->srcpad, gst_bstest_getcaps);
|
|
||||||
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (bstest), gst_bstest_loop);
|
|
||||||
|
|
||||||
bstest->sizemin = 0;
|
|
||||||
bstest->sizemax = 384;
|
|
||||||
bstest->accesspattern = g_strdup ("r");
|
|
||||||
bstest->patterns = g_strsplit (bstest->accesspattern, ":", 0);
|
|
||||||
bstest->count = 5;
|
|
||||||
bstest->silent = FALSE;
|
|
||||||
bstest->bs = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static guint
|
|
||||||
gst_bstest_get_size (GstBsTest * bstest, gchar * sizestring, guint prevsize)
|
|
||||||
{
|
|
||||||
guint size;
|
|
||||||
|
|
||||||
if (sizestring[0] == 0) {
|
|
||||||
size = bstest->sizemax;
|
|
||||||
} else if (sizestring[0] == 'r') {
|
|
||||||
size =
|
|
||||||
bstest->sizemin +
|
|
||||||
(guint8) (((gfloat) bstest->sizemax) * rand () / (RAND_MAX +
|
|
||||||
(gfloat) bstest->sizemin));
|
|
||||||
} else if (sizestring[0] == '<') {
|
|
||||||
size = prevsize;
|
|
||||||
} else {
|
|
||||||
size = atoi (sizestring);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size == 0)
|
|
||||||
size++;
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_loop (GstElement * element)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest;
|
|
||||||
GstBuffer *buf = NULL;
|
|
||||||
|
|
||||||
g_return_if_fail (element != NULL);
|
|
||||||
g_return_if_fail (GST_IS_BSTEST (element));
|
|
||||||
|
|
||||||
bstest = GST_BSTEST (element);
|
|
||||||
|
|
||||||
do {
|
|
||||||
guint size = 0;
|
|
||||||
guint i = 0;
|
|
||||||
guint8 *ptr;
|
|
||||||
|
|
||||||
while (i < bstest->num_patterns) {
|
|
||||||
buf = NULL;
|
|
||||||
|
|
||||||
if (bstest->patterns[i][0] == 'r') {
|
|
||||||
size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size);
|
|
||||||
if (!bstest->silent)
|
|
||||||
g_print ("bstest: ***** read %d bytes\n", size);
|
|
||||||
gst_bytestream_read (bstest->bs, &buf, size);
|
|
||||||
} else if (bstest->patterns[i][0] == 'f') {
|
|
||||||
size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size);
|
|
||||||
if (!bstest->silent)
|
|
||||||
g_print ("bstest: ***** flush %d bytes\n", size);
|
|
||||||
gst_bytestream_flush (bstest->bs, size);
|
|
||||||
} else if (!strncmp (bstest->patterns[i], "pb", 2)) {
|
|
||||||
size = gst_bstest_get_size (bstest, &bstest->patterns[i][2], size);
|
|
||||||
if (!bstest->silent)
|
|
||||||
g_print ("bstest: ***** peek bytes %d bytes\n", size);
|
|
||||||
gst_bytestream_peek_bytes (bstest->bs, &ptr, size);
|
|
||||||
} else if (bstest->patterns[i][0] == 'p') {
|
|
||||||
size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size);
|
|
||||||
if (!bstest->silent)
|
|
||||||
g_print ("bstest: ***** peek %d bytes\n", size);
|
|
||||||
gst_bytestream_peek (bstest->bs, &buf, size);
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
buf = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf)
|
|
||||||
gst_pad_push (bstest->srcpad, GST_DATA (buf));
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
/* } while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element)); */
|
|
||||||
|
|
||||||
} while (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
||||||
GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest;
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_BSTEST (object));
|
|
||||||
|
|
||||||
bstest = GST_BSTEST (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case ARG_SIZEMIN:
|
|
||||||
bstest->sizemin = g_value_get_int (value);
|
|
||||||
break;
|
|
||||||
case ARG_SIZEMAX:
|
|
||||||
bstest->sizemax = g_value_get_int (value);
|
|
||||||
break;
|
|
||||||
case ARG_ACCESSPATTERN:
|
|
||||||
if (bstest->accesspattern) {
|
|
||||||
g_free (bstest->accesspattern);
|
|
||||||
g_strfreev (bstest->patterns);
|
|
||||||
}
|
|
||||||
if (g_value_get_string (value) == NULL) {
|
|
||||||
gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
|
|
||||||
bstest->accesspattern = NULL;
|
|
||||||
bstest->num_patterns = 0;
|
|
||||||
} else {
|
|
||||||
guint i = 0;
|
|
||||||
|
|
||||||
bstest->accesspattern = g_strdup (g_value_get_string (value));
|
|
||||||
bstest->patterns = g_strsplit (bstest->accesspattern, ":", 0);
|
|
||||||
while (bstest->patterns[i++]);
|
|
||||||
bstest->num_patterns = i - 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ARG_COUNT:
|
|
||||||
bstest->count = g_value_get_uint (value);
|
|
||||||
break;
|
|
||||||
case ARG_SILENT:
|
|
||||||
bstest->silent = g_value_get_boolean (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_bstest_get_property (GObject * object, guint prop_id, GValue * value,
|
|
||||||
GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest;
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_BSTEST (object));
|
|
||||||
|
|
||||||
bstest = GST_BSTEST (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case ARG_SIZEMIN:
|
|
||||||
g_value_set_int (value, bstest->sizemin);
|
|
||||||
break;
|
|
||||||
case ARG_SIZEMAX:
|
|
||||||
g_value_set_int (value, bstest->sizemax);
|
|
||||||
break;
|
|
||||||
case ARG_ACCESSPATTERN:
|
|
||||||
g_value_set_string (value, bstest->accesspattern);
|
|
||||||
break;
|
|
||||||
case ARG_COUNT:
|
|
||||||
g_value_set_uint (value, bstest->count);
|
|
||||||
break;
|
|
||||||
case ARG_SILENT:
|
|
||||||
g_value_set_boolean (value, bstest->silent);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstStateChangeReturn
|
|
||||||
gst_bstest_change_state (GstElement * element, GstStateChange transition)
|
|
||||||
{
|
|
||||||
GstBsTest *bstest;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_BSTEST (element), GST_STATE_CHANGE_FAILURE);
|
|
||||||
|
|
||||||
bstest = GST_BSTEST (element);
|
|
||||||
|
|
||||||
if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
|
|
||||||
if (bstest->bs) {
|
|
||||||
gst_bytestream_destroy (bstest->bs);
|
|
||||||
bstest->bs = NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!bstest->bs) {
|
|
||||||
bstest->bs = gst_bytestream_new (bstest->sinkpad);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
|
||||||
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
||||||
|
|
||||||
return GST_STATE_CHANGE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
plugin_init (GstPlugin * plugin)
|
|
||||||
{
|
|
||||||
/* We need to create an ElementFactory for each element we provide.
|
|
||||||
* This consists of the name of the element, the GType identifier,
|
|
||||||
* and a pointer to the details structure at the top of the file.
|
|
||||||
*/
|
|
||||||
return gst_element_register (plugin, "bstest", GST_RANK_PRIMARY,
|
|
||||||
GST_TYPE_BSTEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
|
||||||
"bstest",
|
|
||||||
"test for the bytestream element",
|
|
||||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|
|
|
@ -1,230 +0,0 @@
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
#define VM_THRES 1000
|
|
||||||
#define MAX_CONFIG_LINE 255
|
|
||||||
#define MAX_CONFIG_PATTERN 64
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
gint src_data;
|
|
||||||
gint src_sizetype;
|
|
||||||
|
|
||||||
gchar *bs_accesspattern;
|
|
||||||
|
|
||||||
gboolean integrity_check;
|
|
||||||
}
|
|
||||||
TestParam;
|
|
||||||
|
|
||||||
static GSList *params = NULL;
|
|
||||||
|
|
||||||
static guint8 count;
|
|
||||||
static guint iterations;
|
|
||||||
static gboolean integrity_check = TRUE;
|
|
||||||
static gboolean verbose = FALSE;
|
|
||||||
static gboolean dump = FALSE;
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff (GstElement * element, GstBuffer * buf, GstPad * pad, gpointer data)
|
|
||||||
{
|
|
||||||
if (GST_IS_BUFFER (buf)) {
|
|
||||||
if (integrity_check) {
|
|
||||||
gint i;
|
|
||||||
guint8 *ptr = GST_BUFFER_DATA (buf);
|
|
||||||
|
|
||||||
for (i = 0; i < GST_BUFFER_SIZE (buf); i++) {
|
|
||||||
if (*ptr++ != count++) {
|
|
||||||
g_print ("data error!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
g_print ("not a buffer ! %p\n", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static gchar *
|
|
||||||
create_desc (TestParam * param)
|
|
||||||
{
|
|
||||||
gchar *desc;
|
|
||||||
|
|
||||||
desc =
|
|
||||||
g_strdup_printf ("%s %s, pattern %s",
|
|
||||||
(param->src_sizetype == 2 ? "fixed" : "random"),
|
|
||||||
(param->src_data == 1 ? "src" : "subbuffer"), param->bs_accesspattern);
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
read_param_file (gchar * filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
gchar line[MAX_CONFIG_LINE + 1];
|
|
||||||
guint linenr = 0;
|
|
||||||
gchar pattern[MAX_CONFIG_PATTERN];
|
|
||||||
gint data, sizetype, integrity_check;
|
|
||||||
gchar *scan_str;
|
|
||||||
gboolean res = TRUE;
|
|
||||||
|
|
||||||
fp = fopen (filename, "rb");
|
|
||||||
if (fp == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
scan_str = g_strdup_printf ("%%d %%d %%%ds %%d", MAX_CONFIG_PATTERN - 1);
|
|
||||||
|
|
||||||
while (fgets (line, MAX_CONFIG_LINE, fp)) {
|
|
||||||
linenr++;
|
|
||||||
|
|
||||||
if (line[0] == '\n' || line[0] == '#')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (sscanf (line, scan_str, &data, &sizetype, pattern,
|
|
||||||
&integrity_check) != 4) {
|
|
||||||
g_print ("error on line: %d\n", linenr);
|
|
||||||
res = FALSE;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
TestParam *param = g_malloc (sizeof (TestParam));
|
|
||||||
|
|
||||||
param->src_data = data;
|
|
||||||
param->src_sizetype = sizetype;
|
|
||||||
param->bs_accesspattern = g_strdup (pattern);
|
|
||||||
param->integrity_check = (integrity_check == 0 ? FALSE : TRUE);
|
|
||||||
|
|
||||||
params = g_slist_append (params, param);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_free (scan_str);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
run_test (GstBin * pipeline, gint iters)
|
|
||||||
{
|
|
||||||
gint vm = 0;
|
|
||||||
gint maxiters = iters;
|
|
||||||
gint prev_percent = -1;
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (iters) {
|
|
||||||
gint newvm = gst_alloc_trace_live_all ();
|
|
||||||
gint percent;
|
|
||||||
|
|
||||||
percent = (gint) ((maxiters - iters + 1) * 100.0 / maxiters);
|
|
||||||
|
|
||||||
if (percent != prev_percent || newvm - vm > VM_THRES) {
|
|
||||||
g_print ("\r%d (delta %d) %.3d%% ", newvm, newvm - vm,
|
|
||||||
percent);
|
|
||||||
prev_percent = percent;
|
|
||||||
vm = newvm;
|
|
||||||
}
|
|
||||||
gst_bin_iterate (pipeline);
|
|
||||||
|
|
||||||
if (iters > 0)
|
|
||||||
iters--;
|
|
||||||
}
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
usage (char *argv[])
|
|
||||||
{
|
|
||||||
g_print ("usage: %s [--verbose] [--dump] <paramfile> <iterations>\n",
|
|
||||||
argv[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *src;
|
|
||||||
GstElement *sink;
|
|
||||||
GstElement *bs;
|
|
||||||
GstElement *pipeline;
|
|
||||||
gint testnum = 0;
|
|
||||||
GSList *walk;
|
|
||||||
gint arg_walk;
|
|
||||||
|
|
||||||
gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE);
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
arg_walk = 1;
|
|
||||||
while ((arg_walk < argc) && (argv[arg_walk][0] == '-')) {
|
|
||||||
if (!strncmp (argv[arg_walk], "--verbose", 9))
|
|
||||||
verbose = TRUE;
|
|
||||||
else if (!strncmp (argv[arg_walk], "--dump", 6))
|
|
||||||
dump = TRUE;
|
|
||||||
else {
|
|
||||||
g_print ("unknown option %s (ignored)\n", argv[arg_walk]);
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_walk++;
|
|
||||||
}
|
|
||||||
if (argc - arg_walk < 2) {
|
|
||||||
usage (argv);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (!read_param_file (argv[arg_walk])) {
|
|
||||||
g_print ("error reading file %s\n", argv[arg_walk]);
|
|
||||||
usage (argv);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
arg_walk++;
|
|
||||||
iterations = atoi (argv[arg_walk]);
|
|
||||||
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", "pipeline");
|
|
||||||
g_assert (pipeline);
|
|
||||||
|
|
||||||
src = gst_element_factory_make ("fakesrc", "src");
|
|
||||||
g_assert (src);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", "sink");
|
|
||||||
g_assert (sink);
|
|
||||||
g_object_set (sink, "signal-handoff", TRUE, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (sink), "handoff", G_CALLBACK (handoff), NULL);
|
|
||||||
|
|
||||||
bs = gst_element_factory_make ("bstest", "bs");
|
|
||||||
g_assert (bs);
|
|
||||||
|
|
||||||
gst_element_link_many (src, bs, sink, NULL);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, bs, sink, NULL);
|
|
||||||
|
|
||||||
walk = params;
|
|
||||||
|
|
||||||
while (walk) {
|
|
||||||
gchar *desc;
|
|
||||||
TestParam *param = (TestParam *) (walk->data);
|
|
||||||
|
|
||||||
integrity_check = param->integrity_check;
|
|
||||||
|
|
||||||
g_print ("\n\nrunning test %d (%d iterations):\n", testnum + 1, iterations);
|
|
||||||
desc = create_desc (param);
|
|
||||||
g_print ("%s\n", desc);
|
|
||||||
g_free (desc);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (src), "data", param->src_data,
|
|
||||||
"sizetype", param->src_sizetype,
|
|
||||||
"filltype", (integrity_check ? 5 : 0), "silent", !verbose, NULL);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (bs), "accesspattern", param->bs_accesspattern,
|
|
||||||
"silent", !verbose, NULL);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (sink), "dump", dump, "silent", !verbose, NULL);
|
|
||||||
|
|
||||||
run_test (GST_BIN (pipeline), iterations);
|
|
||||||
|
|
||||||
testnum++;
|
|
||||||
|
|
||||||
walk = g_slist_next (walk);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_print ("\n\ndone\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,93 +0,0 @@
|
||||||
# lots of parameters here. values for the columns are like:
|
|
||||||
#
|
|
||||||
# - data property in fakesrc: 1 = allocate, 2 = subbuffer
|
|
||||||
# - sizetype property in fakesrc: 2 = fixed, 3 = random
|
|
||||||
#
|
|
||||||
# - accesspattern for bstest
|
|
||||||
# <action><size>[:<action><size>...]
|
|
||||||
#
|
|
||||||
# <action> can be:
|
|
||||||
# r = read
|
|
||||||
# p = peek
|
|
||||||
# pb = peek bytes
|
|
||||||
# f = flush
|
|
||||||
# <size> can be:
|
|
||||||
# <empty> = fixed size
|
|
||||||
# r = random size
|
|
||||||
# < = previous size
|
|
||||||
# <int> = this size
|
|
||||||
#
|
|
||||||
# - integrity check: 0 = no, 1 = yes
|
|
||||||
#
|
|
||||||
1 2 r 1
|
|
||||||
1 2 rr 1
|
|
||||||
1 3 r 1
|
|
||||||
1 3 rr 1
|
|
||||||
2 2 r 1
|
|
||||||
2 2 rr 1
|
|
||||||
2 3 r 1
|
|
||||||
2 3 rr 1
|
|
||||||
1 2 p:r< 1
|
|
||||||
1 2 pr:r< 1
|
|
||||||
1 3 p:r< 1
|
|
||||||
1 3 pr:r< 1
|
|
||||||
2 2 p:r< 1
|
|
||||||
2 2 pr:r< 1
|
|
||||||
2 3 p:r< 1
|
|
||||||
2 3 pr:r< 1
|
|
||||||
1 2 p:rr 1
|
|
||||||
1 2 pr:rr 1
|
|
||||||
1 3 p:rr 1
|
|
||||||
1 3 pr:rr 1
|
|
||||||
2 2 p:rr 1
|
|
||||||
2 2 pr:rr 1
|
|
||||||
2 3 p:rr 1
|
|
||||||
2 3 pr:rr 1
|
|
||||||
1 2 pb:r 1
|
|
||||||
1 2 pbr:r 1
|
|
||||||
1 3 pb:r 1
|
|
||||||
1 3 pbr:r 1
|
|
||||||
2 2 pb:r 1
|
|
||||||
2 2 pbr:r 1
|
|
||||||
2 3 pb:r 1
|
|
||||||
2 3 pbr:r 1
|
|
||||||
1 2 pb:rr 1
|
|
||||||
1 2 pbr:rr 1
|
|
||||||
1 3 pb:rr 1
|
|
||||||
1 3 pbr:rr 1
|
|
||||||
2 2 pb:rr 1
|
|
||||||
2 2 pbr:rr 1
|
|
||||||
2 3 pb:rr 1
|
|
||||||
2 3 pbr:rr 1
|
|
||||||
1 2 p:fr:rr 0
|
|
||||||
1 2 pr:fr:rr 0
|
|
||||||
1 3 p:fr:rr 0
|
|
||||||
1 3 pr:fr:rr 0
|
|
||||||
2 2 p:fr:rr 0
|
|
||||||
2 2 pr:fr:rr 0
|
|
||||||
2 3 p:fr:rr 0
|
|
||||||
2 3 pr:fr:rr 0
|
|
||||||
1 2 fr:rr 0
|
|
||||||
1 2 fr:rr 0
|
|
||||||
1 3 fr:rr 0
|
|
||||||
1 3 fr:rr 0
|
|
||||||
2 2 fr:rr 0
|
|
||||||
2 2 fr:rr 0
|
|
||||||
2 3 fr:rr 0
|
|
||||||
2 3 fr:rr 0
|
|
||||||
1 2 fr:fr:rr 0
|
|
||||||
1 2 fr:fr:rr 0
|
|
||||||
1 3 fr:fr:rr 0
|
|
||||||
1 3 fr:fr:rr 0
|
|
||||||
2 2 fr:fr:rr 0
|
|
||||||
2 2 fr:fr:rr 0
|
|
||||||
2 3 fr:fr:rr 0
|
|
||||||
2 3 fr:fr:rr 0
|
|
||||||
1 2 pbr:pbr:rr 1
|
|
||||||
1 2 pbr:pbr:rr 1
|
|
||||||
1 3 pbr:pbr:rr 1
|
|
||||||
1 3 pbr:pbr:rr 1
|
|
||||||
2 2 pbr:pbr:rr 1
|
|
||||||
2 2 pbr:pbr:rr 1
|
|
||||||
2 3 pbr:pbr:rr 1
|
|
||||||
2 3 pbr:pbr:rr 1
|
|
10
testsuite/cleanup/.gitignore
vendored
10
testsuite/cleanup/.gitignore
vendored
|
@ -1,10 +0,0 @@
|
||||||
test-registry.xml
|
|
||||||
*.bb
|
|
||||||
*.bbg
|
|
||||||
*.da
|
|
||||||
|
|
||||||
cleanup1
|
|
||||||
cleanup2
|
|
||||||
cleanup3
|
|
||||||
cleanup4
|
|
||||||
cleanup5
|
|
|
@ -1,7 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = cleanup1 cleanup2 cleanup4 cleanup5
|
|
||||||
tests_fail =
|
|
||||||
|
|
||||||
# cleanup3 fails depending on the machine
|
|
||||||
tests_ignore = cleanup3
|
|
|
@ -1,60 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static GstElement *
|
|
||||||
create_pipeline (void)
|
|
||||||
{
|
|
||||||
GstElement *fakesrc, *fakesink;
|
|
||||||
GstElement *pipeline;
|
|
||||||
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
|
||||||
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL);
|
|
||||||
|
|
||||||
gst_element_link (fakesrc, fakesink);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
|
||||||
|
|
||||||
return pipeline;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar * argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
gint i = 1000;
|
|
||||||
gint step = 100;
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
while (i--) {
|
|
||||||
if (i % step == 0)
|
|
||||||
fprintf (stderr, "%10d\r", i);
|
|
||||||
pipeline = create_pipeline ();
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
}
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static GstElement *
|
|
||||||
create_pipeline (void)
|
|
||||||
{
|
|
||||||
GstElement *fakesrc, *fakesink;
|
|
||||||
GstElement *pipeline;
|
|
||||||
GstElement *bin;
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
|
||||||
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
|
||||||
bin = gst_bin_new ("bin");
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
|
||||||
gst_bin_add (GST_BIN (bin), fakesink);
|
|
||||||
gst_element_add_ghost_pad (bin, gst_element_get_pad (fakesink, "sink"),
|
|
||||||
"sink");
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), fakesrc, bin, NULL);
|
|
||||||
|
|
||||||
gst_element_link (fakesrc, bin);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
|
||||||
|
|
||||||
return pipeline;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar * argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
gint i = 1000;
|
|
||||||
gint step = 100;
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
while (i--) {
|
|
||||||
if (i % step == 0)
|
|
||||||
fprintf (stderr, "%10d\r", i);
|
|
||||||
pipeline = create_pipeline ();
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
}
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static GstElement *
|
|
||||||
create_pipeline (void)
|
|
||||||
{
|
|
||||||
GstElement *fakesrc, *fakesink;
|
|
||||||
GstElement *pipeline;
|
|
||||||
GstElement *thread, *queue;
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
|
||||||
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
|
||||||
thread = gst_thread_new ("thread");
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
|
||||||
queue = gst_element_factory_make ("queue", "queue");
|
|
||||||
gst_bin_add (GST_BIN (thread), fakesink);
|
|
||||||
gst_bin_add (GST_BIN (thread), queue);
|
|
||||||
gst_element_link (queue, fakesink);
|
|
||||||
gst_element_add_ghost_pad (thread, gst_element_get_pad (queue, "sink"),
|
|
||||||
"sink");
|
|
||||||
|
|
||||||
gst_element_link (fakesrc, thread);
|
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), thread);
|
|
||||||
|
|
||||||
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
|
||||||
|
|
||||||
return pipeline;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar * argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
gint i = 10000;
|
|
||||||
gint step = 100;
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
while (i--) {
|
|
||||||
if (i % step == 0)
|
|
||||||
fprintf (stderr, "%10d\r", i);
|
|
||||||
pipeline = create_pipeline ();
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
}
|
|
||||||
fprintf (stderr, "\n");
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar * argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
GstElement *fakesrc;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
i = 1000;
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
|
||||||
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
|
||||||
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
while (i--) {
|
|
||||||
GstElement *bin;
|
|
||||||
GstElement *fakesink;
|
|
||||||
|
|
||||||
g_print ("+");
|
|
||||||
|
|
||||||
bin = gst_bin_new ("bin");
|
|
||||||
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (bin), fakesink);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), bin);
|
|
||||||
|
|
||||||
gst_element_link (fakesrc, fakesink);
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
g_print ("-");
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), GST_ELEMENT (bin));
|
|
||||||
|
|
||||||
}
|
|
||||||
g_print ("\n");
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *bin, *element;
|
|
||||||
gint i = 1000;
|
|
||||||
gint step = 100;
|
|
||||||
|
|
||||||
|
|
||||||
free (malloc (8)); /* -lefence */
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
|
|
||||||
bin = gst_pipeline_new ("pipeline");
|
|
||||||
|
|
||||||
while (i--) {
|
|
||||||
GstPad *pad;
|
|
||||||
|
|
||||||
if (i % step == 0)
|
|
||||||
fprintf (stderr, "\r%10d", i);
|
|
||||||
|
|
||||||
element = gst_element_factory_make ("tee", "tee");
|
|
||||||
if (!element)
|
|
||||||
break;
|
|
||||||
|
|
||||||
pad = gst_element_get_request_pad (element, "src%d");
|
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (bin), element);
|
|
||||||
gst_bin_remove (GST_BIN (bin), element);
|
|
||||||
|
|
||||||
}
|
|
||||||
fprintf (stderr, "+\n");
|
|
||||||
|
|
||||||
gst_object_unref (bin);
|
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
2
testsuite/negotiation/.gitignore
vendored
2
testsuite/negotiation/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
pad_link
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = pad_link
|
|
||||||
tests_fail =
|
|
||||||
tests_ignore =
|
|
|
@ -1,35 +0,0 @@
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
/* this test checks that gst_pad_link takes into account all available
|
|
||||||
* information when trying to link two pads.
|
|
||||||
* Because identity proxies caps, the caps in the first and second link
|
|
||||||
* must be compatible for this pipeline to work.
|
|
||||||
* Since they are not, the second linkig attempt should fail.
|
|
||||||
*/
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (int argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *src, *identity, *sink;
|
|
||||||
GstCaps *one, *two;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
/* create incompatible caps */
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
identity = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (identity);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
one = gst_caps_from_string ("some/mime");
|
|
||||||
two = gst_caps_from_string ("other/mime");
|
|
||||||
|
|
||||||
g_assert (GST_PAD_LINK_SUCCESSFUL (gst_pad_link_filtered (gst_element_get_pad
|
|
||||||
(src, "src"), gst_element_get_pad (identity, "sink"), one)));
|
|
||||||
g_assert (!GST_PAD_LINK_SUCCESSFUL (gst_pad_link_filtered (gst_element_get_pad
|
|
||||||
(identity, "src"), gst_element_get_pad (sink, "sink"), two)));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = link
|
|
||||||
tests_fail = chainnopull getnopush
|
|
||||||
tests_ignore =
|
|
|
@ -1,66 +0,0 @@
|
||||||
/*
|
|
||||||
* this tests that chain-based pads don't pull.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
typedef struct _GstTestSink
|
|
||||||
{
|
|
||||||
GstElement parent;
|
|
||||||
GstPad *sinkpad;
|
|
||||||
} GstTestSink;
|
|
||||||
|
|
||||||
typedef GstElementClass GstTestSinkClass;
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_class_init (GstTestSinkClass * klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_base_init (gpointer klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_chain (GstPad * pad, GstData * data)
|
|
||||||
{
|
|
||||||
data = gst_pad_pull (pad);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_init (GstTestSink * sink)
|
|
||||||
{
|
|
||||||
sink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
||||||
gst_pad_set_chain_function (sink->sinkpad, gst_test_sink_chain);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (sink), sink->sinkpad);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_BOILERPLATE (GstTestSink, gst_test_sink, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *fakesrc, *testsink;
|
|
||||||
gint n;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("p");
|
|
||||||
fakesrc = gst_element_factory_make ("fakesrc", "src");
|
|
||||||
testsink = g_object_new (gst_test_sink_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (testsink), "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), fakesrc, testsink, NULL);
|
|
||||||
gst_element_link (fakesrc, testsink);
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
for (n = 0; n < 100; n++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
* this tests that get-based pads don't push.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
typedef struct _GstTestSrc
|
|
||||||
{
|
|
||||||
GstElement parent;
|
|
||||||
GstPad *srcpad;
|
|
||||||
} GstTestSrc;
|
|
||||||
|
|
||||||
typedef GstElementClass GstTestSrcClass;
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_src_class_init (GstTestSrcClass * klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
gst_test_src_base_init (gpointer klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstData *
|
|
||||||
gst_test_src_get (GstPad * pad)
|
|
||||||
{
|
|
||||||
GstEvent *event;
|
|
||||||
|
|
||||||
event = gst_event_new (GST_EVENT_INTERRUPT);
|
|
||||||
gst_event_ref (event);
|
|
||||||
gst_pad_push (pad, GST_DATA (event));
|
|
||||||
|
|
||||||
return GST_DATA (event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_src_init (GstTestSrc * src)
|
|
||||||
{
|
|
||||||
src->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
||||||
gst_pad_set_get_function (src->srcpad, gst_test_src_get);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (src), src->srcpad);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_BOILERPLATE (GstTestSrc, gst_test_src, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *testsrc, *fakesink;
|
|
||||||
gint n;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("p");
|
|
||||||
testsrc = g_object_new (gst_test_src_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (testsrc), "src");
|
|
||||||
fakesink = gst_element_factory_make ("fakesink", "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), testsrc, fakesink, NULL);
|
|
||||||
gst_element_link (testsrc, fakesink);
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
for (n = 0; n < 100; n++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,194 +0,0 @@
|
||||||
/*
|
|
||||||
* Test that:
|
|
||||||
* - get-based sources can return data, loop-based sources can push.
|
|
||||||
* - chain-based filters receive/push, loop-based filters can pull/push.
|
|
||||||
* - chain-based sinks receive, loop-based sinks pull.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Scary type code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct _GstTestElement
|
|
||||||
{
|
|
||||||
GstElement parent;
|
|
||||||
GstPad *srcpad, *sinkpad;
|
|
||||||
} GstTestSrc, GstTestFilter, GstTestSink, GstTestElement;
|
|
||||||
|
|
||||||
typedef GstElementClass GstTestSrcClass, GstTestFilterClass, GstTestSinkClass,
|
|
||||||
GstTestElementClass;
|
|
||||||
|
|
||||||
#define gst_test_src_class_init gst_test_element_class_init
|
|
||||||
#define gst_test_filter_class_init gst_test_element_class_init
|
|
||||||
#define gst_test_sink_class_init gst_test_element_class_init
|
|
||||||
|
|
||||||
#define gst_test_src_base_init gst_test_element_base_init
|
|
||||||
#define gst_test_filter_base_init gst_test_element_base_init
|
|
||||||
#define gst_test_sink_base_init gst_test_element_base_init
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_element_class_init (GstTestElementClass * klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
gst_test_element_base_init (gpointer klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actual element code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
gboolean loop = FALSE;
|
|
||||||
|
|
||||||
static GstData *
|
|
||||||
gst_test_src_get (GstPad * pad)
|
|
||||||
{
|
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_src_loop (GstElement * element)
|
|
||||||
{
|
|
||||||
GstTestSrc *src = (GstTestElement *) element;
|
|
||||||
|
|
||||||
gst_pad_push (src->srcpad, gst_test_src_get (src->srcpad));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_src_init (GstTestElement * src)
|
|
||||||
{
|
|
||||||
src->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
||||||
if (loop) {
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (src), gst_test_src_loop);
|
|
||||||
} else {
|
|
||||||
gst_pad_set_get_function (src->srcpad, gst_test_src_get);
|
|
||||||
}
|
|
||||||
gst_element_add_pad (GST_ELEMENT (src), src->srcpad);
|
|
||||||
|
|
||||||
GST_OBJECT_FLAG_SET (src, GST_ELEMENT_EVENT_AWARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_filter_chain (GstPad * pad, GstData * data)
|
|
||||||
{
|
|
||||||
GstTestFilter *filter = (GstTestElement *) gst_pad_get_parent (pad);
|
|
||||||
|
|
||||||
gst_pad_push (filter->srcpad, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_filter_loop (GstElement * element)
|
|
||||||
{
|
|
||||||
GstTestFilter *filter = (GstTestElement *) element;
|
|
||||||
|
|
||||||
gst_test_filter_chain (filter->sinkpad, gst_pad_pull (filter->sinkpad));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_filter_init (GstTestElement * filter)
|
|
||||||
{
|
|
||||||
filter->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
||||||
if (loop) {
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (filter), gst_test_filter_loop);
|
|
||||||
} else {
|
|
||||||
gst_pad_set_chain_function (filter->sinkpad, gst_test_filter_chain);
|
|
||||||
}
|
|
||||||
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
|
|
||||||
|
|
||||||
filter->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
|
|
||||||
|
|
||||||
GST_OBJECT_FLAG_SET (filter, GST_ELEMENT_EVENT_AWARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_chain (GstPad * pad, GstData * data)
|
|
||||||
{
|
|
||||||
gst_data_unref (data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_loop (GstElement * element)
|
|
||||||
{
|
|
||||||
GstTestSink *sink = (GstTestElement *) element;
|
|
||||||
|
|
||||||
gst_test_sink_chain (sink->sinkpad, gst_pad_pull (sink->sinkpad));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_test_sink_init (GstTestElement * sink)
|
|
||||||
{
|
|
||||||
sink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
||||||
if (loop) {
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (sink), gst_test_sink_loop);
|
|
||||||
} else {
|
|
||||||
gst_pad_set_chain_function (sink->sinkpad, gst_test_sink_chain);
|
|
||||||
}
|
|
||||||
gst_element_add_pad (GST_ELEMENT (sink), sink->sinkpad);
|
|
||||||
|
|
||||||
GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_EVENT_AWARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define parent_class src_parent_class
|
|
||||||
GST_BOILERPLATE (GstTestSrc, gst_test_src, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
#undef parent_class
|
|
||||||
#define parent_class filter_parent_class
|
|
||||||
GST_BOILERPLATE (GstTestFilter, gst_test_filter, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
#undef parent_class
|
|
||||||
#define parent_class sink_parent_class
|
|
||||||
GST_BOILERPLATE (GstTestSink, gst_test_sink, GstElement, GST_TYPE_ELEMENT);
|
|
||||||
#undef parent_class
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actual test.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
cb_error (GstElement * element)
|
|
||||||
{
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *filter, *sink;
|
|
||||||
gint n, r;
|
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
for (r = 0; r < 2; r++) {
|
|
||||||
pipeline = gst_pipeline_new ("p");
|
|
||||||
g_signal_connect (pipeline, "error", G_CALLBACK (cb_error), NULL);
|
|
||||||
src = g_object_new (gst_test_src_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (src), "src");
|
|
||||||
filter = g_object_new (gst_test_filter_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (filter), "filter");
|
|
||||||
sink = g_object_new (gst_test_sink_get_type (), NULL);
|
|
||||||
gst_object_set_name (GST_OBJECT (sink), "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, filter, sink, NULL);
|
|
||||||
res = gst_element_link (src, filter);
|
|
||||||
g_assert (res);
|
|
||||||
res = gst_element_link (filter, sink);
|
|
||||||
g_assert (res);
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
for (n = 0; n < 100; n++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
/* switch element types */
|
|
||||||
g_print ("Loop=%s done\n", loop ? "true" : "false");
|
|
||||||
loop = !loop;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = gst-print-formats
|
|
||||||
tests_fail =
|
|
||||||
tests_ignore =
|
|
||||||
|
|
||||||
|
|
|
@ -1,347 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
|
||||||
* 2004 Thomas Vander Stichele <thomas@apestaart.org>
|
|
||||||
*
|
|
||||||
* gst-inspect.c: tool to inspect the GStreamer registry
|
|
||||||
*
|
|
||||||
* 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 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
#include "gst/gst-i18n-app.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <glib/gprintf.h>
|
|
||||||
|
|
||||||
#define static
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_pad_templates_info (GstElement * element, GstElementFactory * factory,
|
|
||||||
GstPadDirection dir)
|
|
||||||
{
|
|
||||||
GstElementClass *gstelement_class;
|
|
||||||
const GList *pads;
|
|
||||||
GstPadTemplate *padtemplate;
|
|
||||||
|
|
||||||
if (!factory->numpadtemplates) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
|
|
||||||
|
|
||||||
pads = factory->padtemplates;
|
|
||||||
while (pads) {
|
|
||||||
padtemplate = (GstPadTemplate *) (pads->data);
|
|
||||||
pads = g_list_next (pads);
|
|
||||||
|
|
||||||
if (padtemplate->direction == dir) {
|
|
||||||
if (padtemplate->caps) {
|
|
||||||
GstStructure *structure;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < gst_caps_get_size (padtemplate->caps); i++) {
|
|
||||||
structure = gst_caps_get_structure (padtemplate->caps, i);
|
|
||||||
g_print (" %s\n", gst_structure_get_name (structure));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_element_list (const char *klass, GstPadDirection dir)
|
|
||||||
{
|
|
||||||
GList *plugins;
|
|
||||||
|
|
||||||
g_print ("Elements in %s:\n", klass);
|
|
||||||
for (plugins = gst_registry_pool_plugin_list (); plugins;
|
|
||||||
plugins = g_list_next (plugins)) {
|
|
||||||
GList *features;
|
|
||||||
GstPlugin *plugin;
|
|
||||||
|
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
|
||||||
|
|
||||||
features = gst_plugin_get_feature_list (plugin);
|
|
||||||
while (features) {
|
|
||||||
GstPluginFeature *feature;
|
|
||||||
|
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
|
||||||
|
|
||||||
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
|
||||||
GstElementFactory *factory;
|
|
||||||
GstElement *element;
|
|
||||||
|
|
||||||
factory = GST_ELEMENT_FACTORY (feature);
|
|
||||||
if (strncmp (factory->details.klass, klass, strlen (klass)) == 0) {
|
|
||||||
g_print (" %s: %s (%d)\n", GST_PLUGIN_FEATURE_NAME (factory),
|
|
||||||
factory->details.longname, gst_plugin_feature_get_rank (feature));
|
|
||||||
element = gst_element_factory_create (factory, NULL);
|
|
||||||
print_pad_templates_info (element, factory, dir);
|
|
||||||
gst_object_unref (element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
features = g_list_next (features);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_print ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_typefind_list (void)
|
|
||||||
{
|
|
||||||
GList *plugins;
|
|
||||||
|
|
||||||
g_print ("Typefind list:\n");
|
|
||||||
for (plugins = gst_registry_pool_plugin_list (); plugins;
|
|
||||||
plugins = g_list_next (plugins)) {
|
|
||||||
GList *features;
|
|
||||||
GstPlugin *plugin;
|
|
||||||
|
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
|
||||||
|
|
||||||
features = gst_plugin_get_feature_list (plugin);
|
|
||||||
while (features) {
|
|
||||||
GstPluginFeature *feature;
|
|
||||||
|
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
|
||||||
|
|
||||||
if (GST_IS_TYPE_FIND_FACTORY (feature)) {
|
|
||||||
GstTypeFindFactory *factory;
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
gst_plugin_load_file (plugin->filename, NULL);
|
|
||||||
|
|
||||||
factory = GST_TYPE_FIND_FACTORY (feature);
|
|
||||||
g_print (" %s: (%d)\n", GST_PLUGIN_FEATURE_NAME (factory),
|
|
||||||
gst_plugin_feature_get_rank (feature));
|
|
||||||
s = gst_caps_to_string (gst_type_find_factory_get_caps (factory));
|
|
||||||
g_print (" %s\n", s);
|
|
||||||
g_free (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
features = g_list_next (features);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_print ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
list_sort_func (gconstpointer a, gconstpointer b)
|
|
||||||
{
|
|
||||||
return strcmp ((const char *) a, (const char *) b);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GList *
|
|
||||||
get_typefind_mime_list (void)
|
|
||||||
{
|
|
||||||
GList *plugins;
|
|
||||||
GList *mime_list = NULL;
|
|
||||||
|
|
||||||
for (plugins = gst_registry_pool_plugin_list (); plugins;
|
|
||||||
plugins = g_list_next (plugins)) {
|
|
||||||
GList *features;
|
|
||||||
GstPlugin *plugin;
|
|
||||||
|
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
|
||||||
|
|
||||||
features = gst_plugin_get_feature_list (plugin);
|
|
||||||
while (features) {
|
|
||||||
GstPluginFeature *feature;
|
|
||||||
|
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
|
||||||
|
|
||||||
if (GST_IS_TYPE_FIND_FACTORY (feature)) {
|
|
||||||
GstTypeFindFactory *factory;
|
|
||||||
char *s;
|
|
||||||
int i;
|
|
||||||
const GstCaps *caps;
|
|
||||||
|
|
||||||
factory = GST_TYPE_FIND_FACTORY (feature);
|
|
||||||
caps = gst_type_find_factory_get_caps (factory);
|
|
||||||
|
|
||||||
if (gst_plugin_feature_get_rank (feature) > 0 && caps != NULL) {
|
|
||||||
for (i = 0; i < gst_caps_get_size (caps); i++) {
|
|
||||||
const GstStructure *structure = gst_caps_get_structure (caps, i);
|
|
||||||
|
|
||||||
s = g_strdup (gst_structure_get_name (structure));
|
|
||||||
mime_list = g_list_prepend (mime_list, s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
features = g_list_next (features);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mime_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
GList *
|
|
||||||
g_list_uniqify (GList * list)
|
|
||||||
{
|
|
||||||
GList *item;
|
|
||||||
|
|
||||||
for (item = g_list_first (list); item; item = g_list_next (item)) {
|
|
||||||
GList *next_item = g_list_next (item);
|
|
||||||
|
|
||||||
while (next_item && strcmp (item->data, next_item->data) == 0) {
|
|
||||||
g_free (next_item->data);
|
|
||||||
list = g_list_delete_link (list, next_item);
|
|
||||||
next_item = g_list_next (item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GList *
|
|
||||||
get_pad_templates_info (GstElement * element, GstElementFactory * factory,
|
|
||||||
GstPadDirection dir)
|
|
||||||
{
|
|
||||||
GstElementClass *gstelement_class;
|
|
||||||
const GList *pads;
|
|
||||||
GstPadTemplate *padtemplate;
|
|
||||||
GList *mime_list = NULL;
|
|
||||||
|
|
||||||
if (!factory->numpadtemplates) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
|
|
||||||
|
|
||||||
pads = factory->padtemplates;
|
|
||||||
while (pads) {
|
|
||||||
padtemplate = (GstPadTemplate *) (pads->data);
|
|
||||||
pads = g_list_next (pads);
|
|
||||||
|
|
||||||
if (padtemplate->direction == dir) {
|
|
||||||
if (padtemplate->caps) {
|
|
||||||
GstStructure *structure;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < gst_caps_get_size (padtemplate->caps); i++) {
|
|
||||||
structure = gst_caps_get_structure (padtemplate->caps, i);
|
|
||||||
mime_list = g_list_prepend (mime_list,
|
|
||||||
g_strdup (gst_structure_get_name (structure)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mime_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GList *
|
|
||||||
get_element_mime_list (const char *klass, GstPadDirection dir)
|
|
||||||
{
|
|
||||||
GList *mime_list = NULL;
|
|
||||||
GList *plugins;
|
|
||||||
|
|
||||||
for (plugins = gst_registry_pool_plugin_list (); plugins;
|
|
||||||
plugins = g_list_next (plugins)) {
|
|
||||||
GList *features;
|
|
||||||
GstPlugin *plugin;
|
|
||||||
|
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
|
||||||
|
|
||||||
features = gst_plugin_get_feature_list (plugin);
|
|
||||||
while (features) {
|
|
||||||
GstPluginFeature *feature;
|
|
||||||
|
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
|
||||||
|
|
||||||
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
|
||||||
GstElementFactory *factory;
|
|
||||||
GstElement *element;
|
|
||||||
|
|
||||||
factory = GST_ELEMENT_FACTORY (feature);
|
|
||||||
if (strncmp (factory->details.klass, klass, strlen (klass)) == 0) {
|
|
||||||
if (gst_plugin_feature_get_rank (feature) > 0) {
|
|
||||||
GList *list;
|
|
||||||
|
|
||||||
element = gst_element_factory_create (factory, NULL);
|
|
||||||
list = get_pad_templates_info (element, factory, dir);
|
|
||||||
mime_list = g_list_concat (mime_list, list);
|
|
||||||
gst_object_unref (element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
features = g_list_next (features);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mime_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_mime_list (void)
|
|
||||||
{
|
|
||||||
GList *list;
|
|
||||||
GList *typefind_list;
|
|
||||||
GList *item;
|
|
||||||
GList *item2;
|
|
||||||
|
|
||||||
typefind_list = get_typefind_mime_list ();
|
|
||||||
typefind_list = g_list_sort (typefind_list, list_sort_func);
|
|
||||||
typefind_list = g_list_uniqify (typefind_list);
|
|
||||||
|
|
||||||
list = get_element_mime_list ("Codec/Demuxer", GST_PAD_SINK);
|
|
||||||
list = g_list_concat (list, get_element_mime_list ("Codec/Decoder",
|
|
||||||
GST_PAD_SINK));
|
|
||||||
list = g_list_sort (list, list_sort_func);
|
|
||||||
list = g_list_uniqify (list);
|
|
||||||
|
|
||||||
g_print ("MIME media type list:\n");
|
|
||||||
for (item = g_list_first (list); item; item = g_list_next (item)) {
|
|
||||||
for (item2 = g_list_first (typefind_list); item2;
|
|
||||||
item2 = g_list_next (item2)) {
|
|
||||||
if (strcmp ((char *) item->data, (char *) item2->data) == 0) {
|
|
||||||
g_print (" %s\n", (char *) item->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef GETTEXT_PACKAGE
|
|
||||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
|
||||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
||||||
textdomain (GETTEXT_PACKAGE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
print_element_list ("Codec/Demuxer", GST_PAD_SINK);
|
|
||||||
print_element_list ("Codec/Decoder", GST_PAD_SINK);
|
|
||||||
print_element_list ("Codec/Muxer", GST_PAD_SRC);
|
|
||||||
print_element_list ("Codec/Encoder", GST_PAD_SRC);
|
|
||||||
print_typefind_list ();
|
|
||||||
print_mime_list ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
17
testsuite/schedulers/.gitignore
vendored
17
testsuite/schedulers/.gitignore
vendored
|
@ -1,17 +0,0 @@
|
||||||
group_link
|
|
||||||
relink_sink
|
|
||||||
relink_src
|
|
||||||
unlink_sink
|
|
||||||
unlink_src
|
|
||||||
unref_sink
|
|
||||||
unref_src
|
|
||||||
useless_iteration
|
|
||||||
143777
|
|
||||||
143777-2
|
|
||||||
142183
|
|
||||||
142183-2
|
|
||||||
147713
|
|
||||||
147819
|
|
||||||
147894
|
|
||||||
147894-2
|
|
||||||
queue_link
|
|
|
@ -1,73 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity (GstElement * element)
|
|
||||||
{
|
|
||||||
GstBin *parent;
|
|
||||||
|
|
||||||
parent = GST_BIN (gst_element_get_parent (element));
|
|
||||||
g_print ("identity handoff\n");
|
|
||||||
/* element is unreffed and destroyed here, which will cause
|
|
||||||
* an assert */
|
|
||||||
gst_bin_remove (parent, element);
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity,
|
|
||||||
NULL);
|
|
||||||
g_object_set (G_OBJECT (id), "loop-based", TRUE, NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
|
|
||||||
gst_element_link_pads (src, "src", id, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
g_print ("got past iteration, scheduler refs elements correctly\n");
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity (GstElement * element)
|
|
||||||
{
|
|
||||||
GstBin *parent;
|
|
||||||
|
|
||||||
parent = GST_BIN (gst_element_get_parent (element));
|
|
||||||
g_print ("identity handoff\n");
|
|
||||||
gst_bin_remove (parent, element);
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
/* ref object here as it will be unparented and destroyed in the
|
|
||||||
* handoff signal, normally the scheduler should keep a ref to the
|
|
||||||
* currently scheduled elements but that's another bug displayed in
|
|
||||||
* 142183-2.c */
|
|
||||||
gst_object_ref (id);
|
|
||||||
g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity,
|
|
||||||
NULL);
|
|
||||||
g_object_set (G_OBJECT (id), "loop-based", TRUE, NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
|
|
||||||
/* this is what triggers the bug */
|
|
||||||
gst_element_enable_threadsafe_properties (GST_ELEMENT (src));
|
|
||||||
gst_element_enable_threadsafe_properties (GST_ELEMENT (id));
|
|
||||||
gst_element_enable_threadsafe_properties (GST_ELEMENT (sink));
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", id, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* 'cause we're going into deadlock mode */
|
|
||||||
alarm (5);
|
|
||||||
|
|
||||||
g_print ("adding identity back...\n");
|
|
||||||
/* add identity back in */
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), id, NULL);
|
|
||||||
|
|
||||||
g_print ("going into possible deadlock... alarm at 5 seconds\n");
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
g_print ("ok, no deadlock. bug 142183 fixed!\n");
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
gst_object_unref (id);
|
|
||||||
src = id = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char **argv)
|
|
||||||
{
|
|
||||||
GstElement *src, *sink, *enc, *tee;
|
|
||||||
GstElement *pipeline;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", "pipeline");
|
|
||||||
|
|
||||||
src = gst_element_factory_make ("fakesrc", "src");
|
|
||||||
g_assert (src);
|
|
||||||
tee = gst_element_factory_make ("tee", "tee1");
|
|
||||||
g_assert (tee);
|
|
||||||
enc = gst_element_factory_make ("identity", "enc");
|
|
||||||
g_assert (enc);
|
|
||||||
sink = gst_element_factory_make ("fakesink", "sink");
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL);
|
|
||||||
if (!gst_element_link_many (src, tee, enc, sink, NULL))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
for (i = 0; i < 5; i++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
g_print ("%d\n", i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
gst_element_unlink_many (tee, enc, sink, NULL);
|
|
||||||
gst_bin_remove_many (GST_BIN (pipeline), enc, sink, NULL);
|
|
||||||
|
|
||||||
enc = gst_element_factory_make ("identity", "enc");
|
|
||||||
g_assert (enc);
|
|
||||||
sink = gst_element_factory_make ("fakesink", "sink");
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), enc, sink, NULL);
|
|
||||||
if (!gst_element_link_many (tee, enc, sink, NULL))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
for (i = 5; i < 10; i++) {
|
|
||||||
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
g_print ("%d\n", i);
|
|
||||||
}
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file reproduces the bug in the bugreport #143777, as can be seen at
|
|
||||||
* http://bugzilla.gnome.org/show_bug.cgi?id=143777 - the issue is that when
|
|
||||||
* pausing a pipeline while the chainhandler is still running, then unlinking
|
|
||||||
* the pad that's chain function is called and relinking it clears the buffer
|
|
||||||
* that was stored for sending the event. gst_pad_call_chain_function needs
|
|
||||||
* to check that.
|
|
||||||
* The fix is in gstpad.c, revision 1.327
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id;
|
|
||||||
guint i = 0, j;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
|
|
||||||
while (i < 100) {
|
|
||||||
g_print ("running... (%d iterations)\n", i);
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
gst_element_link_many (src, id, sink, NULL);
|
|
||||||
for (j = 0; j < i; j++)
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
gst_element_unlink_many (src, id, sink, NULL);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
g_assert (i == 100);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,92 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymanse <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static gint src_handoff = 0;
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_src (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("src handoff\n");
|
|
||||||
src_handoff++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_sink (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("sink handoff\n");
|
|
||||||
g_assert (src_handoff == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id1, *id2;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
g_object_set (G_OBJECT (src), "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (src), "handoff", (GCallback) handoff_src, NULL);
|
|
||||||
id1 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id1);
|
|
||||||
|
|
||||||
id2 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id2);
|
|
||||||
g_object_set (G_OBJECT (id2), "loop-based", TRUE, NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (sink), "handoff", (GCallback) handoff_sink, NULL);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id1, NULL);
|
|
||||||
gst_element_link_pads (src, "src", id1, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
if (gst_element_set_state (id2,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
if (gst_element_set_state (sink,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), sink, NULL);
|
|
||||||
gst_element_link_pads (id2, "src", sink, "sink");
|
|
||||||
gst_element_link_pads (id1, "src", id2, "sink");
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), id2, NULL);
|
|
||||||
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id1 = id2 = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static gboolean handoff;
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity1 (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("identity1 handoff\n");
|
|
||||||
handoff = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity2 (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("identity2 handoff\n");
|
|
||||||
handoff = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *id1, *id2;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id1 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id1);
|
|
||||||
g_object_set (G_OBJECT (id1), "loop-based", TRUE, NULL);
|
|
||||||
g_object_set (G_OBJECT (id1), "duplicate", 3, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (id1), "handoff", (GCallback) handoff_identity1,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
id2 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id2);
|
|
||||||
g_object_set (G_OBJECT (id2), "loop-based", TRUE, NULL);
|
|
||||||
g_signal_connect (G_OBJECT (id2), "handoff", (GCallback) handoff_identity2,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id1, id2, sink, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", id1, "sink");
|
|
||||||
gst_element_link_pads (id1, "src", id2, "sink");
|
|
||||||
gst_element_link_pads (id2, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running...\n");
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
/* do ugly stuff here */
|
|
||||||
gst_object_ref (id1);
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), id1);
|
|
||||||
gst_element_link_pads (src, "src", id1, "sink");
|
|
||||||
gst_element_link_pads (id1, "src", id2, "sink");
|
|
||||||
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id1 = id2 = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,138 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static gboolean empty;
|
|
||||||
static gboolean bug;
|
|
||||||
static gboolean handoff;
|
|
||||||
static GstElement *pipeline2;
|
|
||||||
|
|
||||||
static void
|
|
||||||
queue_empty (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("queue empty\n");
|
|
||||||
if (!handoff)
|
|
||||||
bug = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
queue_filled (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("queue filled\n");
|
|
||||||
empty = FALSE;
|
|
||||||
|
|
||||||
/* read from the other end */
|
|
||||||
handoff = FALSE;
|
|
||||||
bug = FALSE;
|
|
||||||
|
|
||||||
alarm (5);
|
|
||||||
|
|
||||||
g_print ("emptying queue with 5 second timeout...\n");
|
|
||||||
while (!bug && !handoff) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("identity handoff\n");
|
|
||||||
handoff = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *queue, *id;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
queue = gst_element_factory_make ("queue", NULL);
|
|
||||||
g_assert (queue);
|
|
||||||
g_signal_connect (G_OBJECT (queue), "overrun", (GCallback) queue_filled,
|
|
||||||
NULL);
|
|
||||||
g_signal_connect (G_OBJECT (queue), "underrun", (GCallback) queue_empty,
|
|
||||||
NULL);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, queue, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", queue, "sink");
|
|
||||||
|
|
||||||
/* second pipeline for sinks */
|
|
||||||
pipeline2 = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline2);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline2), id, sink, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (queue, "src", id, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline2,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running...\n");
|
|
||||||
/* fill queue */
|
|
||||||
empty = TRUE;
|
|
||||||
while (empty) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
}
|
|
||||||
g_assert (!bug);
|
|
||||||
|
|
||||||
g_print ("relinking...\n");
|
|
||||||
/* now unlink and link id and sink */
|
|
||||||
gst_element_unlink_pads (id, "src", sink, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
g_print ("running again...\n");
|
|
||||||
/* fill queue */
|
|
||||||
empty = TRUE;
|
|
||||||
while (empty) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
}
|
|
||||||
g_assert (!bug);
|
|
||||||
|
|
||||||
/* trigger the bug */
|
|
||||||
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
gst_object_unref (pipeline2);
|
|
||||||
src = id = sink = pipeline = pipeline2 = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,146 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static gboolean empty;
|
|
||||||
static gboolean bug;
|
|
||||||
static gboolean handoff;
|
|
||||||
static GstElement *pipeline2;
|
|
||||||
|
|
||||||
static void
|
|
||||||
queue_empty (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("queue empty\n");
|
|
||||||
if (!handoff)
|
|
||||||
bug = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
queue_filled (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("queue filled\n");
|
|
||||||
empty = FALSE;
|
|
||||||
|
|
||||||
/* read from the other end */
|
|
||||||
handoff = FALSE;
|
|
||||||
bug = FALSE;
|
|
||||||
|
|
||||||
alarm (5);
|
|
||||||
|
|
||||||
g_print ("emptying queue with 5 second timeout...\n");
|
|
||||||
while (!bug && !handoff) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handoff_identity (GstElement * element)
|
|
||||||
{
|
|
||||||
g_print ("identity handoff\n");
|
|
||||||
handoff = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink, *queue, *id;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
queue = gst_element_factory_make ("queue", NULL);
|
|
||||||
g_assert (queue);
|
|
||||||
g_signal_connect (G_OBJECT (queue), "overrun", (GCallback) queue_filled,
|
|
||||||
NULL);
|
|
||||||
g_signal_connect (G_OBJECT (queue), "underrun", (GCallback) queue_empty,
|
|
||||||
NULL);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, queue, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", queue, "sink");
|
|
||||||
|
|
||||||
/* second pipeline for sinks */
|
|
||||||
pipeline2 = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline2);
|
|
||||||
id = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id);
|
|
||||||
g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline2), id, sink, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (queue, "src", id, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline2,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running...\n");
|
|
||||||
/* fill queue */
|
|
||||||
empty = TRUE;
|
|
||||||
while (empty) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
}
|
|
||||||
g_assert (!bug);
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline2,
|
|
||||||
GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("relinking...\n");
|
|
||||||
/* now unlink and link id and sink */
|
|
||||||
gst_element_unlink_pads (id, "src", sink, "sink");
|
|
||||||
gst_element_link_pads (id, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline2,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running again...\n");
|
|
||||||
/* fill queue */
|
|
||||||
empty = TRUE;
|
|
||||||
while (empty) {
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
}
|
|
||||||
g_assert (!bug);
|
|
||||||
|
|
||||||
/* trigger the bug */
|
|
||||||
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
gst_object_unref (pipeline2);
|
|
||||||
src = id = sink = pipeline = pipeline2 = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
include ../Rules
|
|
||||||
|
|
||||||
tests_pass = \
|
|
||||||
unlink_src unlink_sink \
|
|
||||||
relink_src relink_sink \
|
|
||||||
unref_src unref_sink \
|
|
||||||
142183 142183-2 \
|
|
||||||
143777 143777-2 \
|
|
||||||
147713 \
|
|
||||||
147819 \
|
|
||||||
147894 147894-2 group_link \
|
|
||||||
queue_link
|
|
||||||
|
|
||||||
# don't enable this one unless it actually works.
|
|
||||||
# useless_iteration
|
|
||||||
tests_fail =
|
|
||||||
tests_ignore =
|
|
||||||
|
|
||||||
unlink_src_SOURCES = unlink.c
|
|
||||||
unlink_src_CFLAGS = $(AM_CFLAGS) -DELEMENT=src
|
|
||||||
unlink_sink_SOURCES = unlink.c
|
|
||||||
unlink_sink_CFLAGS = $(AM_CFLAGS) -DELEMENT=sink
|
|
||||||
relink_src_SOURCES = relink.c
|
|
||||||
relink_src_CFLAGS = $(AM_CFLAGS) -DELEMENT=src -DOTHER_ELEMENT=sink
|
|
||||||
relink_sink_SOURCES = relink.c
|
|
||||||
relink_sink_CFLAGS = $(AM_CFLAGS) -DELEMENT=sink -DOTHER_ELEMENT=src
|
|
||||||
unref_src_SOURCES = unref.c
|
|
||||||
unref_src_CFLAGS = $(AM_CFLAGS) -DELEMENT=src
|
|
||||||
unref_sink_SOURCES = unref.c
|
|
||||||
unref_sink_CFLAGS = $(AM_CFLAGS) -DELEMENT=sink
|
|
|
@ -1,67 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *id1, *id2, *sink;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
id1 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id1);
|
|
||||||
id2 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id2);
|
|
||||||
g_object_set (G_OBJECT (id2), "loop-based", TRUE, NULL);
|
|
||||||
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, id1, id2, sink, NULL);
|
|
||||||
|
|
||||||
/* link is not accounted for here... */
|
|
||||||
gst_element_link_pads (id1, "src", id2, "sink");
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", id1, "sink");
|
|
||||||
gst_element_link_pads (id2, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("running...\n");
|
|
||||||
/* fill queue */
|
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
src = id1 = id2 = sink = pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *thread, *bin, *src, *queue, *id1, *sink;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
queue = gst_element_factory_make ("queue", NULL);
|
|
||||||
g_assert (queue);
|
|
||||||
|
|
||||||
thread = gst_element_factory_make ("thread", NULL);
|
|
||||||
g_assert (thread);
|
|
||||||
bin = gst_element_factory_make ("bin", NULL);
|
|
||||||
g_assert (bin);
|
|
||||||
id1 = gst_element_factory_make ("identity", NULL);
|
|
||||||
g_assert (id1);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (bin), id1, sink, NULL);
|
|
||||||
gst_bin_add_many (GST_BIN (thread), bin, NULL);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, queue, thread, NULL);
|
|
||||||
|
|
||||||
gst_element_link_pads (src, "src", queue, "sink");
|
|
||||||
gst_element_link_pads (queue, "src", id1, "sink");
|
|
||||||
gst_element_link_pads (id1, "src", sink, "sink");
|
|
||||||
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
g_print ("unlinking...\n");
|
|
||||||
|
|
||||||
gst_object_ref (queue);
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), queue);
|
|
||||||
gst_object_ref (bin);
|
|
||||||
gst_bin_remove (GST_BIN (thread), bin);
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
GstElement *pipeline, *src, *sink;
|
|
||||||
|
|
||||||
static void
|
|
||||||
cb_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
|
||||||
gpointer unused)
|
|
||||||
{
|
|
||||||
if (GST_PAD_PEER (pad)) {
|
|
||||||
g_print ("relinking...\n");
|
|
||||||
gst_pad_unlink (pad, GST_PAD_PEER (pad));
|
|
||||||
gst_bin_remove (GST_BIN (pipeline), OTHER_ELEMENT);
|
|
||||||
OTHER_ELEMENT =
|
|
||||||
gst_element_factory_make ("fake" G_STRINGIFY (OTHER_ELEMENT), NULL);
|
|
||||||
g_assert (OTHER_ELEMENT);
|
|
||||||
gst_bin_add (GST_BIN (pipeline), OTHER_ELEMENT);
|
|
||||||
gst_element_sync_state_with_parent (OTHER_ELEMENT);
|
|
||||||
gst_element_link (ELEMENT, OTHER_ELEMENT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
guint i = 0;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
||||||
gst_element_link (src, sink);
|
|
||||||
/* setup special stuff */
|
|
||||||
g_object_set (ELEMENT, "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (ELEMENT, "handoff", (GCallback) cb_handoff, NULL);
|
|
||||||
|
|
||||||
/* run pipeline */
|
|
||||||
g_print ("running...\n");
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (i++ < 10 && gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
static void
|
|
||||||
cb_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
|
||||||
gpointer unused)
|
|
||||||
{
|
|
||||||
if (GST_PAD_PEER (pad)) {
|
|
||||||
g_print ("unlinking...\n");
|
|
||||||
gst_pad_unlink (pad, GST_PAD_PEER (pad));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline, *src, *sink;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
||||||
gst_element_link (src, sink);
|
|
||||||
/* setup special stuff */
|
|
||||||
g_object_set (ELEMENT, "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (ELEMENT, "handoff", (GCallback) cb_handoff, NULL);
|
|
||||||
|
|
||||||
/* run pipeline */
|
|
||||||
g_print ("running...\n");
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
g_print ("cleaning up...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
GstElement *pipeline, *src, *sink;
|
|
||||||
|
|
||||||
static void
|
|
||||||
cb_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
|
||||||
gpointer unused)
|
|
||||||
{
|
|
||||||
if (pipeline) {
|
|
||||||
g_print ("unreffing...\n");
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
src = gst_element_factory_make ("fakesrc", NULL);
|
|
||||||
g_assert (src);
|
|
||||||
sink = gst_element_factory_make ("fakesink", NULL);
|
|
||||||
g_assert (sink);
|
|
||||||
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
||||||
gst_element_link (src, sink);
|
|
||||||
/* setup special stuff */
|
|
||||||
g_object_set (ELEMENT, "signal-handoffs", TRUE, NULL);
|
|
||||||
g_signal_connect (ELEMENT, "handoff", (GCallback) cb_handoff, NULL);
|
|
||||||
|
|
||||||
/* run pipeline */
|
|
||||||
g_print ("running...\n");
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (pipeline && gst_bin_iterate (GST_BIN (pipeline)));
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free
|
|
||||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
gint
|
|
||||||
main (gint argc, gchar ** argv)
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
GError *error = NULL;
|
|
||||||
guint i = 0;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
|
||||||
|
|
||||||
g_print ("setting up...\n");
|
|
||||||
/* setup pipeline */
|
|
||||||
pipeline = gst_parse_launch ("pipeline.( { fakesrc ! fakesink } )", &error);
|
|
||||||
g_assert (error == NULL);
|
|
||||||
g_assert (pipeline);
|
|
||||||
|
|
||||||
/* run pipeline */
|
|
||||||
g_print ("running...\n");
|
|
||||||
if (gst_element_set_state (pipeline,
|
|
||||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
||||||
g_assert_not_reached ();
|
|
||||||
while (i < 100 && gst_bin_iterate (GST_BIN (pipeline)))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
g_print ("cleaning up... (%d iterations)\n", i);
|
|
||||||
g_assert (i == 100);
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
pipeline = NULL;
|
|
||||||
|
|
||||||
g_print ("done.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in a new issue