static gboolean
_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
{
+ GST_INFO_OBJECT (pad, "got %s event %p: %" GST_PTR_FORMAT,
+ GST_EVENT_TYPE_NAME (event), event, event);
+
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
if (loop) {
static gboolean
_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
- GstFormat fmt;
-
- if (GST_QUERY_TYPE (query) != GST_QUERY_DURATION)
- return FALSE;
+ gboolean res = FALSE;
- gst_query_parse_duration (query, &fmt, NULL);
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_DURATION:{
+ GstFormat fmt;
- if (fmt != GST_FORMAT_BYTES)
- return FALSE;
+ gst_query_parse_duration (query, &fmt, NULL);
+ if (fmt != GST_FORMAT_BYTES)
+ break;
- gst_query_set_duration (query, fmt, sizeof (mxf_file));
+ gst_query_set_duration (query, fmt, sizeof (mxf_file));
+ res = TRUE;
+ break;
+ }
+ case GST_QUERY_SCHEDULING:{
+ gst_query_set_scheduling (query, GST_SCHEDULING_FLAG_SEEKABLE, 1, -1, 0);
+ gst_query_add_scheduling_mode (query, GST_PAD_MODE_PULL);
+ res = TRUE;
+ break;
+ }
+ default:
+ GST_DEBUG_OBJECT (pad, "unhandled %s query", GST_QUERY_TYPE_NAME (query));
+ break;
+ }
- return TRUE;
+ return res;
}
static GstPad *
GST_START_TEST (test_pull)
{
+ GstStateChangeReturn sret;
GstElement *mxfdemux;
GstPad *sinkpad;
gst_pad_set_active (mysinkpad, TRUE);
gst_pad_set_active (mysrcpad, TRUE);
- gst_element_set_state (mxfdemux, GST_STATE_PLAYING);
+ GST_INFO ("Setting to PLAYING");
+ sret = gst_element_set_state (mxfdemux, GST_STATE_PLAYING);
+ fail_unless_equals_int (sret, GST_STATE_CHANGE_SUCCESS);
g_main_loop_run (loop);
fail_unless (have_eos == TRUE);