/* for dynamic sources */
guint src_np_sig_id; /* new-pad signal id */
- gboolean async_pending; /* async-start has been emitted */
-
guint64 ring_buffer_max_size; /* 0 means disabled */
GList *pending_pads; /* Pads we have blocked pending assignment
}
}
-static void
-do_async_start (GstURISourceBin * dbin)
-{
- GstMessage *message;
-
- dbin->async_pending = TRUE;
-
- message = gst_message_new_async_start (GST_OBJECT_CAST (dbin));
- GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (dbin), message);
-}
-
-static void
-do_async_done (GstURISourceBin * dbin)
-{
- GstMessage *message;
-
- if (dbin->async_pending) {
- GST_DEBUG_OBJECT (dbin, "posting ASYNC_DONE");
- message =
- gst_message_new_async_done (GST_OBJECT_CAST (dbin),
- GST_CLOCK_TIME_NONE);
- GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (dbin), message);
-
- dbin->async_pending = FALSE;
- }
-}
#define DEFAULT_QUEUE_SIZE (3 * GST_SECOND)
#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100)
gst_pad_set_active (pad, TRUE);
gst_element_add_pad (GST_ELEMENT_CAST (urisrc), pad);
-
- /* Once we expose a pad, we're no longer async */
- do_async_done (urisrc);
}
static void
GST_ELEMENT_ERROR (dec, CORE, MISSING_PLUGIN,
(_("Missing element '%s' - check your GStreamer installation."),
element_name), (NULL));
- do_async_done (GST_URI_SOURCE_BIN (dec));
}
/**
/* FIXME: Fire the right error */
GST_ELEMENT_ERROR (urisrc, CORE, MISSING_PLUGIN, (NULL),
("No demuxer element, check your installation"));
- do_async_done (urisrc);
return NULL;
}
}
{
GST_ELEMENT_ERROR (urisrc, CORE, NEGOTIATION,
(NULL), ("Adaptive demuxer element has no 'sink' pad"));
- do_async_done (urisrc);
return;
}
could_not_link:
GST_URI_SOURCE_BIN_UNLOCK (urisrc);
GST_ELEMENT_ERROR (urisrc, CORE, NEGOTIATION,
(NULL), ("Can't link typefind to adaptive demuxer element"));
- do_async_done (urisrc);
return;
}
}
post_missing_plugin_error (GST_ELEMENT_CAST (urisrc), "typefind");
GST_ELEMENT_ERROR (urisrc, CORE, MISSING_PLUGIN, (NULL),
("No typefind element, check your installation"));
- do_async_done (urisrc);
return FALSE;
}
could_not_link:
GST_ELEMENT_ERROR (urisrc, CORE, NEGOTIATION,
(NULL), ("Can't link source to typefind element"));
gst_bin_remove (GST_BIN_CAST (urisrc), typefind);
- do_async_done (urisrc);
return FALSE;
}
}
/* source provides raw data, we added the pads and we can now signal a
* no_more pads because we are done. */
gst_element_no_more_pads (GST_ELEMENT_CAST (urisrc));
- do_async_done (urisrc);
return TRUE;
}
if (!have_out && !is_dynamic) {
return res;
}
-static void
-sync_slot_queue (OutputSlotInfo * slot)
-{
- gst_element_sync_state_with_parent (slot->queue);
-}
-
static GstStateChangeReturn
gst_uri_source_bin_change_state (GstElement * element,
GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
- do_async_start (urisrc);
+ GST_DEBUG ("ready to paused");
+ if (!setup_source (urisrc))
+ goto source_failed;
break;
default:
break;
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (ret == GST_STATE_CHANGE_FAILURE)
goto setup_failed;
- else if (ret == GST_STATE_CHANGE_NO_PREROLL)
- do_async_done (urisrc);
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_DEBUG ("ready to paused");
- if (!setup_source (urisrc))
- goto source_failed;
-
- ret = GST_STATE_CHANGE_ASYNC;
-
- /* And now sync the states of everything we added */
- g_slist_foreach (urisrc->out_slots, (GFunc) sync_slot_queue, NULL);
- if (urisrc->typefinds) {
- GList *iter;
- for (iter = urisrc->typefinds; iter; iter = iter->next) {
- GstElement *typefind = iter->data;
- ret = gst_element_set_state (typefind, GST_STATE_PAUSED);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto setup_failed;
- }
- }
- if (urisrc->source)
- ret = gst_element_set_state (urisrc->source, GST_STATE_PAUSED);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto setup_failed;
-
- if (ret == GST_STATE_CHANGE_SUCCESS)
- ret = GST_STATE_CHANGE_ASYNC;
- else if (ret == GST_STATE_CHANGE_NO_PREROLL)
- do_async_done (urisrc);
-
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_DEBUG ("paused to ready");
remove_demuxer (urisrc);
remove_source (urisrc);
- do_async_done (urisrc);
g_list_free_full (urisrc->buffering_status,
(GDestroyNotify) gst_message_unref);
urisrc->buffering_status = NULL;
/* ERRORS */
source_failed:
{
- do_async_done (urisrc);
return GST_STATE_CHANGE_FAILURE;
}
setup_failed:
{
/* clean up leftover groups */
- do_async_done (urisrc);
return GST_STATE_CHANGE_FAILURE;
}
}