+2005-07-18 Wim Taymans <wim@fluendo.com>
+
+ * examples/seeking/seek.c: (make_vorbis_theora_pipeline),
+ (query_rates), (query_positions_elems), (query_positions_pads),
+ (do_seek), (seek_cb), (stop_seek):
+ Updated seek example.
+
+ * gst/playback/gstdecodebin.c: (remove_element_chain), (unlinked):
+ * gst/playback/gstplaybasebin.c: (queue_threshold_reached),
+ (queue_out_of_data), (gen_preroll_element), (new_decoded_pad):
+ * gst/playback/gstplaybin.c: (add_sink):
+ * gst/playback/gststreaminfo.c: (gst_stream_info_dispose),
+ (gst_stream_info_set_mute):
+ Some refcount leak fixes.
+
2005-07-16 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/audio/gstbaseaudiosink.c:
static void
seek_cb (GtkWidget * widget)
{
-#ifdef SCRUB
+#ifndef SCRUB
+ GTimeVal timeval;
+#else
/* If the timer hasn't expired yet, then the pipeline is running */
if (seek_timeout_id != 0) {
gst_element_set_state (pipeline, GST_STATE_PAUSED);
do_seek (widget);
+#ifndef SCRUB
+ /* wait for preroll */
+ GST_TIME_TO_TIMEVAL (50 * GST_MSECOND, timeval);
+ gst_element_get_state (pipeline, NULL, NULL, &timeval);
+#endif
+
#ifdef SCRUB
gst_element_set_state (pipeline, GST_STATE_PLAYING);
gtk_timeout_remove (seek_timeout_id);
seek_timeout_id = 0;
/* Still scrubbing, so the pipeline is already playing */
- } else
+ } else {
gst_element_set_state (pipeline, GST_STATE_PLAYING);
+ }
update_id =
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer));
{
- GstElement *parent = gst_pad_get_parent (peer);
+ GstObject *parent = gst_pad_get_parent (peer);
if (parent) {
- if (parent != GST_ELEMENT (decode_bin)) {
- GST_DEBUG_OBJECT (decode_bin, "dead end pad %s:%s",
- GST_DEBUG_PAD_NAME (peer));
- } else {
- GST_DEBUG_OBJECT (decode_bin, "recursing element %s on pad %s:%s",
- GST_ELEMENT_NAME (elem), GST_DEBUG_PAD_NAME (pad));
- remove_element_chain (decode_bin, peer);
+ if (GST_IS_ELEMENT (parent)) {
+ if (parent != GST_OBJECT (decode_bin)) {
+ GST_DEBUG_OBJECT (decode_bin, "dead end pad %s:%s",
+ GST_DEBUG_PAD_NAME (peer));
+ } else {
+ GST_DEBUG_OBJECT (decode_bin, "recursing element %s on pad %s:%s",
+ GST_ELEMENT_NAME (elem), GST_DEBUG_PAD_NAME (pad));
+ remove_element_chain (decode_bin, peer);
+ }
}
gst_object_unref (parent);
}
/* inactivate pad */
gst_pad_set_active (pad, GST_ACTIVATE_NONE);
- element = gst_pad_get_parent (pad);
- peer = gst_pad_get_parent (peerpad);
+ element = gst_pad_get_parent_element (pad);
+ peer = gst_pad_get_parent_element (peerpad);
if (!is_our_kid (peer, decode_bin))
goto exit;
g_object_set_data (G_OBJECT (queue), "probe", NULL);
gst_pad_remove_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue);
- g_object_unref (G_OBJECT (sinkpad));
+ gst_object_unref (sinkpad);
}
}
GST_DEBUG_OBJECT (play_base_bin,
"Re-attaching buffering probe to pad %s:%s",
GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
- g_object_unref (G_OBJECT (sinkpad));
+ gst_object_unref (sinkpad);
fill_buffer (play_base_bin, 0);
}
gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll);
GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)",
GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
- g_object_unref (G_OBJECT (sinkpad));
+ gst_object_unref (sinkpad);
g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin);
g_object_set_data (G_OBJECT (preroll), "probe", (gpointer) 0x1);
/* keep a ref to the signal id so that we can disconnect the signal callback */
g_object_set_data (G_OBJECT (sinkpad), "unlinked_id", GINT_TO_POINTER (sig));
gst_pad_link (pad, sinkpad);
- g_object_unref (G_OBJECT (sinkpad));
+ gst_object_unref (sinkpad);
/* add the stream to the list */
gst_caps_unref (caps);
{
GstPad *sinkpad;
GstPadLinkReturn res;
- GstElement *parent;
+ GstObject *parent;
gst_bin_add (GST_BIN (play_bin), sink);
res = gst_pad_link (srcpad, sinkpad);
gst_object_unref (sinkpad);
+ /* this is only for debugging */
parent = gst_pad_get_parent (srcpad);
- GST_DEBUG ("Adding sink with state %d (parent: %d, peer: %d)\n",
- GST_STATE (sink), GST_STATE (play_bin), GST_STATE (parent));
- gst_object_unref (parent);
+ if (parent) {
+ if (GST_IS_ELEMENT (parent)) {
+ GST_DEBUG ("Adding sink with state %d (parent: %d, peer: %d)\n",
+ GST_STATE (sink), GST_STATE (play_bin), GST_STATE (parent));
+ }
+ gst_object_unref (parent);
+ }
/* try to link the pad of the sink to the stream */
if (res < 0) {
stream_info = GST_STREAM_INFO (object);
if (stream_info->object) {
- GstElement *parent;
+ GstObject *parent;
parent = gst_pad_get_parent ((GstPad *)
GST_PAD_CAST (stream_info->object));
if (parent != NULL) {
- g_signal_handlers_disconnect_by_func (parent,
- G_CALLBACK (stream_info_change_state), stream_info);
- g_object_unref (G_OBJECT (parent));
+ if (GST_IS_ELEMENT (parent)) {
+ g_signal_handlers_disconnect_by_func (parent,
+ G_CALLBACK (stream_info_change_state), stream_info);
+ }
+ gst_object_unref (parent);
}
gst_object_unref (stream_info->object);
}
if (mute != stream_info->mute) {
- GstElement *element;
+ GstObject *element;
stream_info->mute = mute;
//gst_pad_set_active_recursive ((GstPad *)
element = gst_pad_get_parent ((GstPad *)
GST_PAD_CAST (stream_info->object));
- if (mute) {
- g_signal_connect (element, "state-change",
- G_CALLBACK (stream_info_change_state), stream_info);
- } else {
- g_signal_handlers_disconnect_by_func (element,
- G_CALLBACK (stream_info_change_state), stream_info);
+ if (element) {
+ if (GST_IS_ELEMENT (element)) {
+ if (mute) {
+ g_signal_connect (element, "state-change",
+ G_CALLBACK (stream_info_change_state), stream_info);
+ } else {
+ g_signal_handlers_disconnect_by_func (element,
+ G_CALLBACK (stream_info_change_state), stream_info);
+ }
+ }
+ gst_object_unref (element);
}
- g_object_unref (G_OBJECT (element));
}
return TRUE;
}
static void
seek_cb (GtkWidget * widget)
{
-#ifdef SCRUB
+#ifndef SCRUB
+ GTimeVal timeval;
+#else
/* If the timer hasn't expired yet, then the pipeline is running */
if (seek_timeout_id != 0) {
gst_element_set_state (pipeline, GST_STATE_PAUSED);
do_seek (widget);
+#ifndef SCRUB
+ /* wait for preroll */
+ GST_TIME_TO_TIMEVAL (50 * GST_MSECOND, timeval);
+ gst_element_get_state (pipeline, NULL, NULL, &timeval);
+#endif
+
#ifdef SCRUB
gst_element_set_state (pipeline, GST_STATE_PLAYING);
gtk_timeout_remove (seek_timeout_id);
seek_timeout_id = 0;
/* Still scrubbing, so the pipeline is already playing */
- } else
+ } else {
gst_element_set_state (pipeline, GST_STATE_PLAYING);
+ }
update_id =
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);