+2005-06-27 Andy Wingo <wingo@pobox.com>
+
+ * gst/videotestsrc/gstvideotestsrc.c
+ (gst_videotestsrc_activate_push): Activation API changes.
+
+ * gst/playback/gstdecodebin.c (gst_decode_bin_change_state)
+ (gst_decode_bin_dispose): Free dynamics in READY->NULL, because
+ they have refs on the decodebin.
+
+ * ext/ogg/gstoggdemux.c (gst_ogg_pad_class_init): Ref the right
+ parent class.
+ (gst_ogg_pad_typefind): Don't leak a pad ref.
+ (gst_ogg_chain_new_stream): gst_object_unref, not g_object_unref.
+ (gst_ogg_demux_sink_activate, gst_ogg_demux_sink_activate_push)
+ (gst_ogg_demux_sink_activate_pull): Changes for activation API.
+
2005-06-27 Edward Hervey <edward@fluendo.com>
* ext/theora/theoradec.c: (theora_dec_change_state):
gobject_class = (GObjectClass *) klass;
- ogg_pad_parent_class = g_type_class_ref (G_TYPE_OBJECT);
+ ogg_pad_parent_class = g_type_class_ref (GST_TYPE_PAD);
gobject_class->dispose = gst_ogg_pad_dispose;
gobject_class->finalize = gst_ogg_pad_finalize;
gst_pad_set_active (pad->elem_out, TRUE);
/* and this pad may not be named src.. */
- gst_pad_link (gst_element_get_pad (element, "src"), pad->elem_out);
+ {
+ GstPad *p;
+
+ p = gst_element_get_pad (element, "src");
+ gst_pad_link (p, pad->elem_out);
+ gst_object_unref (GST_OBJECT (p));
+ }
}
}
g_list_free (factories);
if (ogg_stream_init (&ret->stream, serialno) != 0) {
GST_ERROR ("Could not initialize ogg_stream struct for serial %08lx.",
serialno);
- g_object_unref (G_OBJECT (ret));
+ gst_object_unref (GST_OBJECT (ret));
return NULL;
}
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_SERIAL, serialno,
static gboolean gst_ogg_demux_handle_event (GstPad * pad, GstEvent * event);
static void gst_ogg_demux_loop (GstOggPad * pad);
static GstFlowReturn gst_ogg_demux_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_ogg_demux_sink_activate (GstPad * sinkpad,
- GstActivateMode mode);
+static gboolean gst_ogg_demux_sink_activate (GstPad * sinkpad);
+static gboolean gst_ogg_demux_sink_activate_pull (GstPad * sinkpad,
+ gboolean active);
+static gboolean gst_ogg_demux_sink_activate_push (GstPad * sinkpad,
+ gboolean active);
static GstElementStateReturn gst_ogg_demux_change_state (GstElement * element);
static void gst_ogg_print (GstOggDemux * demux);
gst_pad_set_event_function (ogg->sinkpad, gst_ogg_demux_handle_event);
gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_demux_chain);
gst_pad_set_activate_function (ogg->sinkpad, gst_ogg_demux_sink_activate);
+ gst_pad_set_activatepull_function (ogg->sinkpad,
+ gst_ogg_demux_sink_activate_pull);
+ gst_pad_set_activatepush_function (ogg->sinkpad,
+ gst_ogg_demux_sink_activate_push);
gst_element_add_pad (GST_ELEMENT (ogg), ogg->sinkpad);
ogg->chain_lock = g_mutex_new ();
}
static gboolean
-gst_ogg_demux_sink_activate (GstPad * sinkpad, GstActivateMode mode)
+gst_ogg_demux_sink_activate (GstPad * sinkpad)
+{
+ if (gst_pad_check_pull_range (sinkpad)) {
+ return gst_pad_activate_pull (sinkpad, TRUE);
+ } else {
+ return gst_pad_activate_push (sinkpad, TRUE);
+ }
+}
+
+static gboolean
+gst_ogg_demux_sink_activate_push (GstPad * sinkpad, gboolean active)
{
- gboolean result = FALSE;
GstOggDemux *ogg;
ogg = GST_OGG_DEMUX (GST_OBJECT_PARENT (sinkpad));
- switch (mode) {
- case GST_ACTIVATE_PUSH:
- ogg->seekable = FALSE;
- result = TRUE;
- break;
- case GST_ACTIVATE_PULL:
- /* if we have a scheduler we can start the task */
- gst_pad_peer_set_active (sinkpad, mode);
- ogg->need_chains = TRUE;
- ogg->seekable = TRUE;
- result =
- gst_pad_start_task (sinkpad, (GstTaskFunction) gst_ogg_demux_loop,
- sinkpad);
- break;
- case GST_ACTIVATE_NONE:
- /* step 1, unblock clock sync (if any) */
+ ogg->seekable = FALSE;
- /* step 2, make sure streaming finishes */
- result = gst_pad_stop_task (sinkpad);
- break;
+ return TRUE;
+}
+
+static gboolean
+gst_ogg_demux_sink_activate_pull (GstPad * sinkpad, gboolean active)
+{
+ GstOggDemux *ogg;
+
+ ogg = GST_OGG_DEMUX (GST_OBJECT_PARENT (sinkpad));
+
+ if (active) {
+ ogg->need_chains = TRUE;
+ ogg->seekable = TRUE;
+
+ return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_ogg_demux_loop,
+ sinkpad);
+ } else {
+ return gst_pad_stop_task (sinkpad);
}
- return result;
}
static GstElementStateReturn
gst_decode_bin_dispose (GObject * object)
{
GstDecodeBin *decode_bin;
- GList *dyns;
decode_bin = GST_DECODE_BIN (object);
g_list_free (decode_bin->factories);
- for (dyns = decode_bin->dynamics; dyns; dyns = g_list_next (dyns)) {
- GstDynamic *dynamic = (GstDynamic *) dyns->data;
-
- dynamic_free (dynamic);
- }
- g_list_free (decode_bin->dynamics);
- decode_bin->dynamics = NULL;
-
G_OBJECT_CLASS (parent_class)->dispose (object);
}
{
GstElementStateReturn ret;
GstDecodeBin *decode_bin;
+ GList *dyns;
gint transition;
decode_bin = GST_DECODE_BIN (element);
switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_PAUSED_TO_READY:
+ break;
case GST_STATE_READY_TO_NULL:
+ for (dyns = decode_bin->dynamics; dyns; dyns = g_list_next (dyns)) {
+ GstDynamic *dynamic = (GstDynamic *) dyns->data;
+
+ dynamic_free (dynamic);
+ }
+ g_list_free (decode_bin->dynamics);
+ decode_bin->dynamics = NULL;
+ break;
default:
break;
}
}
static gboolean
-gst_videotestsrc_activate (GstPad * pad, GstActivateMode mode)
+gst_videotestsrc_activate_push (GstPad * pad, gboolean active)
{
- gboolean result = FALSE;
- GstVideotestsrc *videotestsrc;
-
- videotestsrc = GST_VIDEOTESTSRC (GST_OBJECT_PARENT (pad));
-
- switch (mode) {
- case GST_ACTIVATE_PULL:
- break;
- case GST_ACTIVATE_PUSH:
- result = gst_pad_start_task (pad,
- (GstTaskFunction) gst_videotestsrc_loop, pad);
- break;
- case GST_ACTIVATE_NONE:
- /* step 1, unblock clock sync (if any) */
-
- /* step 2, make sure streaming finishes */
- result = gst_pad_stop_task (pad);
- break;
- default:
- result = FALSE;
- break;
+ if (active) {
+ return gst_pad_start_task (pad,
+ (GstTaskFunction) gst_videotestsrc_loop, pad);
+ } else {
+ return gst_pad_stop_task (pad);
}
- return result;
}
-
static GstElementStateReturn
gst_videotestsrc_change_state (GstElement * element)
{
gst_pad_set_getcaps_function (videotestsrc->srcpad, gst_videotestsrc_getcaps);
gst_pad_set_setcaps_function (videotestsrc->srcpad, gst_videotestsrc_setcaps);
gst_element_add_pad (GST_ELEMENT (videotestsrc), videotestsrc->srcpad);
- gst_pad_set_activate_function (videotestsrc->srcpad,
- gst_videotestsrc_activate);
+ gst_pad_set_activatepush_function (videotestsrc->srcpad,
+ gst_videotestsrc_activate_push);
gst_pad_set_loop_function (videotestsrc->srcpad, gst_videotestsrc_loop);
gst_pad_set_link_function (videotestsrc->srcpad, gst_videotestsrc_src_link);
gst_pad_set_unlink_function (videotestsrc->srcpad,