mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 05:26:23 +00:00
check: Add helper that sends initial events
https://bugzilla.gnome.org/show_bug.cgi?id=700033
This commit is contained in:
parent
d500ffc300
commit
a1866e64c5
4 changed files with 33 additions and 0 deletions
|
@ -907,6 +907,7 @@ gst_check_caps_equal
|
|||
gst_check_element_push_buffer_list
|
||||
gst_check_element_push_buffer
|
||||
gst_check_run_suite
|
||||
gst_check_setup_events
|
||||
|
||||
<SUBSECTION Private>
|
||||
MAIN_INIT
|
||||
|
|
|
@ -79,6 +79,7 @@ LIBGSTCHECK_EXPORTED_FUNCS = \
|
|||
gst_check_message_error \
|
||||
gst_check_run_suite \
|
||||
gst_check_setup_element \
|
||||
gst_check_setup_events \
|
||||
gst_check_setup_sink_pad \
|
||||
gst_check_setup_sink_pad_by_name \
|
||||
gst_check_setup_src_pad \
|
||||
|
|
|
@ -718,3 +718,32 @@ _gst_check_run_test_func (const gchar * func_name)
|
|||
g_strfreev (funcs);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_check_setup_events:
|
||||
* @srcpad: The src #GstPad to push on
|
||||
* @element: The #GstElement use to create the stream id
|
||||
* @caps: (allow-none): #GstCaps in case caps event must be sent
|
||||
* @format: The #GstFormat of the default segment to send
|
||||
*
|
||||
* Push stream-start, caps and segment event, which concist of the minimum required
|
||||
* events to allow streaming. Caps is optional to allow raw src testing.
|
||||
*/
|
||||
void
|
||||
gst_check_setup_events (GstPad * srcpad, GstElement * element,
|
||||
GstCaps * caps, GstFormat format)
|
||||
{
|
||||
gchar *stream_id;
|
||||
GstSegment segment;
|
||||
|
||||
stream_id = gst_pad_create_stream_id (srcpad, element, NULL);
|
||||
gst_segment_init (&segment, format);
|
||||
|
||||
fail_unless (gst_pad_push_event (srcpad,
|
||||
gst_event_new_stream_start (stream_id)));
|
||||
if (caps)
|
||||
fail_unless (gst_pad_push_event (srcpad, gst_event_new_caps (caps)));
|
||||
fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&segment)));
|
||||
|
||||
g_free (stream_id);
|
||||
}
|
||||
|
|
|
@ -94,6 +94,8 @@ void gst_check_teardown_sink_pad (GstElement * element);
|
|||
void gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes);
|
||||
gint gst_check_run_suite (Suite * suite, const gchar * name,
|
||||
const gchar * fname);
|
||||
void gst_check_setup_events (GstPad * srcpad, GstElement * element,
|
||||
GstCaps * caps, GstFormat format);
|
||||
|
||||
#define fail_unless_message_error(msg, domain, code) \
|
||||
gst_check_message_error (msg, GST_MESSAGE_ERROR, \
|
||||
|
|
Loading…
Reference in a new issue