Sets up a pipeline for buffer sucking. This will allow you to call
gst_buffer_straw_get_buffer() to access buffers as they pass over pad
.
This function is normally used in unit tests that want to verify that a
particular element is outputting correct buffers. For example, you would make
a pipeline via gst_parse_launch(), pull out the pad you want to monitor, then
call gst_buffer_straw_get_buffer() to get the buffers that pass through pad
.
The pipeline will block until you have sucked off the buffers.
This function will set the state of bin
to PLAYING; to clean up, be sure to
call gst_buffer_straw_stop_pipeline().
Note that you may not start two buffer straws at the same time. This function is intended for unit tests, not general API use. In fact it calls fail_if from libcheck, so you cannot use it outside unit tests.
Set bin
to #GST_STATE_NULL and release resource allocated in
gst_buffer_straw_start_pipeline().
You must have previously called gst_buffer_straw_start_pipeline() on
pipeline
and pad
.
the pipeline previously started via gst_buffer_straw_start_pipeline()
the pad previously passed to gst_buffer_straw_start_pipeline()
Verifies that reference values and current values are equals in list
.
A list of GstCheckABIStruct to be verified
Whether there is a reference ABI size already specified, if it is %FALSE and the GST_ABI
environment variable is set, usable code for list
will be printed.
Clear all filters added by gst_check_add_log_filter
.
MT safe.
Unref and remove all buffers that are in the global buffers
GList,
emptying the list.
Create an element using the factory providing the element_name
and
push the buffer_in
to this element. The element should create one buffer
and this will be compared with buffer_out
. We only check the caps
and the data of the buffers. This function unrefs the buffers.
name of the element that needs to be created
push this buffer to the element
the #GstCaps expected of the sinkpad of the element
compare the result with this buffer
the #GstCaps expected of the srcpad of the element
Create an element using the factory providing the element_name
and push the
buffers in buffer_in
to this element. The element should create the buffers
equal to the buffers in buffer_out
. We only check the size and the data of
the buffers. This function unrefs the buffers in the two lists.
The last_flow_return parameter indicates the expected flow return value from
pushing the final buffer in the list.
This can be used to set up a test which pushes some buffers and then an
invalid buffer, when the final buffer is expected to fail, for example.
name of the element that needs to be created
a list of buffers that needs to be pushed to the element
the #GstCaps expected of the sinkpad of the element
a list of buffers that we expect from the element
the #GstCaps expected of the srcpad of the element
the last buffer push needs to give this GstFlowReturn
Unrefs object_to_unref
and checks that is has properly been
destroyed.
The #GObject to unref
Remove a filter that has been added by gst_check_add_log_filter
.
MT safe.
Filter returned by gst_check_add_log_filter
Push stream-start, caps and segment event, which consist of the minimum
required events to allow streaming. Caps is optional to allow raw src
testing. If element
has more than one src or sink pad, use
gst_check_setup_events_with_stream_id() instead.
The src #GstPad to push on
The #GstElement use to create the stream id
#GstCaps in case caps event must be sent
The #GstFormat of the default segment to send
Push stream-start, caps and segment event, which consist of the minimum required events to allow streaming. Caps is optional to allow raw src testing.
The src #GstPad to push on
The #GstElement use to create the stream id
#GstCaps in case caps event must be sent
The #GstFormat of the default segment to send
A unique identifier for the stream
Creates a new sink pad (based on the given tmpl)
and links it to the given element
src pad
(the pad that matches the given name)
.
You can set event/chain/query functions on this pad to check the output of the element
.
element to setup pad on
pad template
Name of the element
src pad that will be linked to the sink pad that will be setup
Creates a new src pad (based on the given tmpl)
and links it to the given element
sink pad (the pad that matches the given name)
.
Before using the src pad to push data on element
you need to call #gst_check_setup_events on the created src pad.
Example of how to push a buffer on element:
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (YOUR_CAPS_TEMPLATE_STRING)
);
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (YOUR_CAPS_TEMPLATE_STRING)
);
GstElement * element = gst_check_setup_element ("element");
GstPad * mysrcpad = gst_check_setup_src_pad (element, &srctemplate);
GstPad * mysinkpad = gst_check_setup_sink_pad (element, &sinktemplate);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
fail_unless (gst_element_set_state (element, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing");
GstCaps * caps = gst_caps_from_string (YOUR_DESIRED_SINK_CAPS);
gst_check_setup_events (mysrcpad, element, caps, GST_FORMAT_TIME);
gst_caps_unref (caps);
fail_unless (gst_pad_push (mysrcpad, gst_buffer_new_and_alloc(2)) == GST_FLOW_OK);
For very simple input/output test scenarios checkout #gst_check_element_push_buffer_list and #gst_check_element_push_buffer.
element to setup src pad on
pad template
Name of the element
sink pad that will be linked to the src pad that will be setup
Sets up a data probe on the given pad which will raise assertions if the data flow is inconsistent.
The #GstStreamConsistency handle
The #GstPad on which the dataflow will be checked.
Frees the allocated data and probes associated with consist
.
The #GstStreamConsistency to free.
Reset the stream checker's internal variables.
The #GstStreamConsistency to reset.
Stop the running #GstHarnessThread
MT safe.
a #GstHarnessThread
Get one buffer from
pad
. Implemented via buffer probes. This function will block until the pipeline passes a buffer overpad,
so for robust behavior in unit tests, you need to use check's timeout to fail out in the case that a buffer never arrives.You must have previously called gst_buffer_straw_start_pipeline() on
pipeline
andpad
.