tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
|
|
|
|
#include <gst/base/gstbasetransform.h>
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstPad *sinkpad;
|
|
|
|
GList *events;
|
|
|
|
GList *buffers;
|
|
|
|
GstElement *trans;
|
|
|
|
GstBaseTransformClass *klass;
|
|
|
|
} TestTransData;
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_test_trans_src_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("foo/x-bar")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_test_trans_sink_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("foo/x-bar")
|
|
|
|
);
|
|
|
|
|
|
|
|
typedef struct _GstTestTrans GstTestTrans;
|
|
|
|
typedef struct _GstTestTransClass GstTestTransClass;
|
|
|
|
|
|
|
|
#define GST_TYPE_TEST_TRANS \
|
|
|
|
(gst_test_trans_get_type())
|
|
|
|
#define GST_TEST_TRANS(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TEST_TRANS,GstTestTrans))
|
|
|
|
#define GST_TEST_TRANS_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TEST_TRANS,GstTestTransClass))
|
|
|
|
#define GST_TEST_TRANS_GET_CLASS(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_TEST_TRANS, GstTestTransClass))
|
|
|
|
#define GST_IS_TEST_TRANS(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TEST_TRANS))
|
|
|
|
#define GST_IS_TEST_TRANS_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TEST_TRANS))
|
|
|
|
|
|
|
|
struct _GstTestTrans
|
|
|
|
{
|
|
|
|
GstBaseTransform element;
|
|
|
|
|
|
|
|
TestTransData *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstTestTransClass
|
|
|
|
{
|
|
|
|
GstBaseTransformClass parent_class;
|
|
|
|
};
|
|
|
|
|
2010-03-02 22:51:18 +00:00
|
|
|
GType gst_test_trans_get_type (void);
|
|
|
|
|
2011-04-18 16:19:51 +00:00
|
|
|
G_DEFINE_TYPE (GstTestTrans, gst_test_trans, GST_TYPE_BASE_TRANSFORM);
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
static GstFlowReturn (*klass_transform) (GstBaseTransform * trans,
|
|
|
|
GstBuffer * inbuf, GstBuffer * outbuf) = NULL;
|
|
|
|
static GstFlowReturn (*klass_transform_ip) (GstBaseTransform * trans,
|
|
|
|
GstBuffer * buf) = NULL;
|
|
|
|
static gboolean (*klass_set_caps) (GstBaseTransform * trans, GstCaps * incaps,
|
|
|
|
GstCaps * outcaps) = NULL;
|
|
|
|
static GstCaps *(*klass_transform_caps) (GstBaseTransform * trans,
|
2011-05-13 06:34:33 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * filter) = NULL;
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
static gboolean (*klass_transform_size) (GstBaseTransform * trans,
|
2011-03-22 19:51:06 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps, gsize size, GstCaps * othercaps,
|
|
|
|
gsize * othersize) = NULL;
|
tests/check/libs/: More tests, prepare for tests with switching caps in buffer_alloc.
Original commit message from CVS:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(set_caps_ct2), (transform_ct2), (transform_caps_ct2),
(transform_size_ct2), (buffer_alloc_ct2),
(gst_basetransform_suite):
More tests, prepare for tests with switching caps in buffer_alloc.
2008-06-25 17:27:30 +00:00
|
|
|
static gboolean klass_passthrough_on_same_caps = FALSE;
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate *sink_template = &gst_test_trans_sink_template;
|
|
|
|
static GstStaticPadTemplate *src_template = &gst_test_trans_src_template;
|
|
|
|
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
static void
|
2011-04-18 16:19:51 +00:00
|
|
|
gst_test_trans_class_init (GstTestTransClass * klass)
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class;
|
2011-04-18 16:19:51 +00:00
|
|
|
GstBaseTransformClass *trans_class;
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
|
2011-04-18 16:19:51 +00:00
|
|
|
element_class = (GstElementClass *) klass;
|
|
|
|
trans_class = (GstBaseTransformClass *) klass;
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
|
|
|
|
gst_element_class_set_details_simple (element_class, "TestTrans",
|
|
|
|
"Filter/Test", "Test transform", "Wim Taymans <wim.taymans@gmail.com>");
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
gst_static_pad_template_get (sink_template));
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
gst_static_pad_template_get (src_template));
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
|
tests/check/libs/: More tests, prepare for tests with switching caps in buffer_alloc.
Original commit message from CVS:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(set_caps_ct2), (transform_ct2), (transform_caps_ct2),
(transform_size_ct2), (buffer_alloc_ct2),
(gst_basetransform_suite):
More tests, prepare for tests with switching caps in buffer_alloc.
2008-06-25 17:27:30 +00:00
|
|
|
trans_class->passthrough_on_same_caps = klass_passthrough_on_same_caps;
|
2011-11-10 12:37:12 +00:00
|
|
|
if (klass_transform_ip != NULL)
|
|
|
|
trans_class->transform_ip = klass_transform_ip;
|
|
|
|
if (klass_transform != NULL)
|
|
|
|
trans_class->transform = klass_transform;
|
|
|
|
if (klass_transform_caps != NULL)
|
|
|
|
trans_class->transform_caps = klass_transform_caps;
|
|
|
|
if (klass_transform_size != NULL)
|
|
|
|
trans_class->transform_size = klass_transform_size;
|
|
|
|
if (klass_set_caps != NULL)
|
|
|
|
trans_class->set_caps = klass_set_caps;
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-18 16:19:51 +00:00
|
|
|
gst_test_trans_init (GstTestTrans * this)
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_test_trans_set_data (GstTestTrans * this, TestTransData * data)
|
|
|
|
{
|
|
|
|
this->data = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2011-11-17 11:40:45 +00:00
|
|
|
result_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
{
|
|
|
|
TestTransData *data;
|
|
|
|
|
|
|
|
data = gst_pad_get_element_private (pad);
|
|
|
|
|
|
|
|
data->buffers = g_list_append (data->buffers, buffer);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2011-04-29 11:26:19 +00:00
|
|
|
#if 0
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
result_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
|
|
|
|
GstBuffer ** buf)
|
|
|
|
{
|
|
|
|
GstFlowReturn res;
|
|
|
|
TestTransData *data;
|
|
|
|
|
|
|
|
data = gst_pad_get_element_private (pad);
|
|
|
|
|
2011-04-29 11:26:19 +00:00
|
|
|
*buf = gst_buffer_new_and_alloc (size);
|
|
|
|
gst_buffer_set_caps (*buf, caps);
|
|
|
|
res = GST_FLOW_OK;
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
2011-04-29 11:26:19 +00:00
|
|
|
#endif
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
static TestTransData *
|
|
|
|
gst_test_trans_new (void)
|
|
|
|
{
|
|
|
|
TestTransData *res;
|
|
|
|
GstPad *tmp;
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
GstPadTemplate *templ;
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
|
|
|
|
res = g_new0 (TestTransData, 1);
|
|
|
|
res->trans = g_object_new (GST_TYPE_TEST_TRANS, NULL);
|
docs/design/part-block.txt: Fix typo.
Original commit message from CVS:
* docs/design/part-block.txt:
Fix typo.
* docs/design/part-element-transform.txt:
Add notes about why transform needs to know input/output sizes.
Add some issues that need to be solved.
Add some more use cases.
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (result_sink_chain),
(result_buffer_alloc), (gst_test_trans_new), (gst_test_trans_free),
(gst_test_trans_push), (gst_test_trans_pop):
* tests/check/libs/transform1.c: (buffer_alloc_pt1),
(set_caps_pt1), (GST_START_TEST), (set_caps_pt2), (transform_ip_1),
(set_caps_1), (set_caps_ct1), (transform_ct1),
(transform_caps_ct1), (transform_size_ct1), (buffer_alloc_ct1),
(gst_basetransform_suite):
Add suport for different pad templates and buffer-alloc.
Add more checks for caps and buffer-alloc.
Add checks for proxy buffer alloc.
Add unit test for copy transform.
2008-06-25 10:53:52 +00:00
|
|
|
|
|
|
|
templ = gst_static_pad_template_get (sink_template);
|
|
|
|
templ->direction = GST_PAD_SRC;
|
|
|
|
res->srcpad = gst_pad_new_from_template (templ, "src");
|
|
|
|
gst_object_unref (templ);
|
|
|
|
|
|
|
|
templ = gst_static_pad_template_get (src_template);
|
|
|
|
templ->direction = GST_PAD_SINK;
|
|
|
|
res->sinkpad = gst_pad_new_from_template (templ, "sink");
|
|
|
|
gst_object_unref (templ);
|
|
|
|
|
tests/check/: Add some test basetransform element and the beginnings of various unit tests for it.
Original commit message from CVS:
* tests/check/Makefile.am:
* tests/check/libs/test_transform.c: (gst_test_trans_base_init),
(gst_test_trans_class_init), (gst_test_trans_init),
(gst_test_trans_set_data), (result_sink_chain),
(gst_test_trans_new), (gst_test_trans_free), (gst_test_trans_push),
(gst_test_trans_pop):
* tests/check/libs/transform1.c: (GST_START_TEST),
(transform_ip_1), (set_caps_1), (gst_basetransform_suite):
Add some test basetransform element and the beginnings of various
unit tests for it.
2008-06-20 12:06:54 +00:00
|
|
|
res->klass = GST_BASE_TRANSFORM_GET_CLASS (res->trans);
|
|
|
|
|
|
|
|
gst_test_trans_set_data (GST_TEST_TRANS (res->trans), res);
|
|
|
|
gst_pad_set_element_private (res->sinkpad, res);
|
|
|
|
|
|
|
|
gst_pad_set_chain_function (res->sinkpad, result_sink_chain);
|
|
|
|
|
|
|
|
tmp = gst_element_get_static_pad (res->trans, "sink");
|
|
|
|
gst_pad_link (res->srcpad, tmp);
|
|
|
|
gst_object_unref (tmp);
|
|
|
|
|
|
|
|
tmp = gst_element_get_static_pad (res->trans, "src");
|
|
|
|
gst_pad_link (tmp, res->sinkpad);
|
|
|
|
gst_object_unref (tmp);
|
|
|
|
|
|
|
|
gst_pad_set_active (res->sinkpad, TRUE);
|
|
|
|
gst_element_set_state (res->trans, GST_STATE_PAUSED);
|
|
|
|
gst_pad_set_active (res->srcpad, TRUE);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_test_trans_free (TestTransData * data)
|
|
|
|
{
|
|
|
|
GstPad *tmp;
|
|
|
|
|
|
|
|
gst_pad_set_active (data->sinkpad, FALSE);
|
|
|
|
gst_element_set_state (data->trans, GST_STATE_NULL);
|
|
|
|
gst_pad_set_active (data->srcpad, FALSE);
|
|
|
|
|
|
|
|
tmp = gst_element_get_static_pad (data->trans, "src");
|
|
|
|
gst_pad_unlink (tmp, data->sinkpad);
|
|
|
|
gst_object_unref (tmp);
|
|
|
|
|
|
|
|
tmp = gst_element_get_static_pad (data->trans, "sink");
|
|
|
|
gst_pad_link (data->srcpad, tmp);
|
|
|
|
gst_object_unref (tmp);
|
|
|
|
|
|
|
|
gst_object_unref (data->srcpad);
|
|
|
|
gst_object_unref (data->sinkpad);
|
|
|
|
gst_object_unref (data->trans);
|
|
|
|
|
|
|
|
g_free (data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_test_trans_push (TestTransData * data, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
ret = gst_pad_push (data->srcpad, buffer);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstBuffer *
|
|
|
|
gst_test_trans_pop (TestTransData * data)
|
|
|
|
{
|
|
|
|
GstBuffer *ret;
|
|
|
|
|
|
|
|
if (data->buffers) {
|
|
|
|
ret = data->buffers->data;
|
|
|
|
data->buffers = g_list_delete_link (data->buffers, data->buffers);
|
|
|
|
} else {
|
|
|
|
ret = NULL;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|