+2006-03-29 Tim-Philipp Müller <tim at centricular dot net>
+
+ * plugins/elements/gsttypefindelement.c: (stop_typefinding),
+ (gst_type_find_element_handle_event),
+ (gst_type_find_element_send_cached_events),
+ (gst_type_find_element_change_state):
+ * plugins/elements/gsttypefindelement.h:
+ When typefinding is done in push mode, we should cache
+ events we receive during typefinding instead of just
+ dropping them (e.g. newsegment, custom events from
+ dvdreadsrc etc.) and then send them out once we've
+ determined the type of the stream (and decodebin
+ has had a chance to plug in a decoder/demuxer).
+
2006-03-27 Wim Taymans <wim@fluendo.com>
* docs/design/part-qos.txt:
gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active);
static GstFlowReturn
gst_type_find_element_chain_do_typefinding (GstTypeFindElement * typefind);
+static void
+gst_type_find_element_send_cached_events (GstTypeFindElement * typefind);
static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 };
GST_DEBUG_PAD_NAME (peer)));
typefind->mode = MODE_ERROR; /* make the chain function error out */
} else {
+ gst_type_find_element_send_cached_events (typefind);
gst_pad_push (typefind->src, typefind->store);
}
break;
}
default:
- gst_event_unref (event);
+ GST_DEBUG_OBJECT (typefind, "Saving %s event to send later",
+ GST_EVENT_TYPE_NAME (event));
+ typefind->cached_events =
+ g_list_append (typefind->cached_events, event);
res = TRUE;
break;
}
break;
case MODE_NORMAL:
- if (FALSE) { // GST_EVENT_TYPE (event) == GST_EVENT_DISCONTINUOUS) {
- start_typefinding (typefind);
- gst_event_unref (event);
- res = TRUE;
- } else {
- res = gst_pad_event_default (pad, event);
- }
+ res = gst_pad_event_default (pad, event);
break;
case MODE_ERROR:
break;
return res;
}
+static void
+gst_type_find_element_send_cached_events (GstTypeFindElement * typefind)
+{
+ GList *l;
+
+ for (l = typefind->cached_events; l != NULL; l = l->next) {
+ GstEvent *event = GST_EVENT (l->data);
+
+ GST_DEBUG_OBJECT (typefind, "sending cached %s event",
+ GST_EVENT_TYPE_NAME (event));
+ gst_pad_push_event (typefind->src, event);
+ }
+ g_list_free (typefind->cached_events);
+ typefind->cached_events = NULL;
+}
+
static GstFlowReturn
gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer)
{
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_caps_replace (&typefind->caps, NULL);
+ g_list_foreach (typefind->cached_events,
+ (GFunc) gst_mini_object_unref, NULL);
+ g_list_free (typefind->cached_events);
+ typefind->cached_events = NULL;
break;
default:
break;