gst/videotestsrc/gstvideotestsrc.c

Original commit message from CVS:
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.
This commit is contained in:
Andy Wingo 2005-06-27 18:41:22 +00:00
parent 6ec852f662
commit 97697df71d
4 changed files with 82 additions and 62 deletions

View file

@ -1,3 +1,19 @@
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):

View file

@ -232,7 +232,7 @@ gst_ogg_pad_class_init (GstOggPadClass * klass)
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;
@ -578,7 +578,13 @@ gst_ogg_pad_typefind (GstOggPad * pad, ogg_packet * packet)
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);
@ -797,7 +803,7 @@ gst_ogg_chain_new_stream (GstOggChain * chain, glong serialno)
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,
@ -872,8 +878,11 @@ static gint gst_ogg_demux_read_end_chain (GstOggDemux * ogg,
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);
@ -920,6 +929,10 @@ gst_ogg_demux_init (GstOggDemux * ogg)
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 ();
@ -1972,35 +1985,43 @@ gst_ogg_demux_clear_chains (GstOggDemux * ogg)
}
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

View file

@ -344,20 +344,11 @@ static void
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);
}
@ -1055,6 +1046,7 @@ gst_decode_bin_change_state (GstElement * element)
{
GstElementStateReturn ret;
GstDecodeBin *decode_bin;
GList *dyns;
gint transition;
decode_bin = GST_DECODE_BIN (element);
@ -1077,7 +1069,16 @@ gst_decode_bin_change_state (GstElement * 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;
}

View file

@ -312,34 +312,16 @@ gst_videotestsrc_src_unlink (GstPad * pad)
}
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)
{
@ -443,8 +425,8 @@ gst_videotestsrc_init (GstVideotestsrc * videotestsrc)
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,