From: <wt...@ke...> - 2006-06-02 10:34:29
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Fri Jun 02 2006 10:34:24 UTC Log message: * gst/playback/gstplaybasebin.c: (group_create), (group_commit), (setup_source): * gst/playback/gstplaybasebin.h: Make the subtitle detection work from any thread so we don't deadlock. Fixes #343397. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c gstplaybasebin.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2690&r2=1.2691 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.111&r2=1.112 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.h.diff?r1=1.21&r2=1.22 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2690 retrieving revision 1.2691 diff -u -d -r1.2690 -r1.2691 --- ChangeLog 1 Jun 2006 23:04:31 -0000 1.2690 +++ ChangeLog 2 Jun 2006 10:34:12 -0000 1.2691 @@ -1,3 +1,11 @@ +2006-06-02 Wim Taymans <wi...@fl...> + + * gst/playback/gstplaybasebin.c: (group_create), (group_commit), + (setup_source): + * gst/playback/gstplaybasebin.h: + Make the subtitle detection work from any thread so we don't + deadlock. Fixes #343397. 2006-06-02 Thomas Vander Stichele <thomas at apestaart dot org> * gst/volume/Makefile.am: Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.111 retrieving revision 1.112 diff -u -d -r1.111 -r1.112 --- gstplaybasebin.c 30 May 2006 19:00:39 -0000 1.111 +++ gstplaybasebin.c 2 Jun 2006 10:34:12 -0000 1.112 @@ -271,6 +271,8 @@ group->bin = play_base_bin; group->streaminfo_value_array = g_value_array_new (0); + GST_DEBUG_OBJECT (play_base_bin, "created new group %p", group); return group; } @@ -400,6 +402,9 @@ group = play_base_bin->building_group; had_active_group = (get_active_group (play_base_bin) != NULL); + GST_DEBUG_OBJECT (play_base_bin, "commit group %p, had active %d", + group, had_active_group); /* if an element signalled a no-more-pads after we stopped due * to preroll, the group is NULL. This is not an error */ if (group == NULL) { @@ -407,40 +412,49 @@ GROUP_UNLOCK (play_base_bin); return; } else { - GST_DEBUG ("Group loading failed, bailing out"); + GST_DEBUG_OBJECT (play_base_bin, "Group loading failed, bailing out"); } - } else if (!subtitle) { - gint n; + } else { + if (!subtitle) { + gint n; - GST_DEBUG ("group %p done", group); + GST_DEBUG_OBJECT (play_base_bin, "group %p done", group); - play_base_bin->queued_groups = g_list_append (play_base_bin->queued_groups, - group); + play_base_bin->queued_groups = + g_list_append (play_base_bin->queued_groups, group); - play_base_bin->building_group = NULL; + play_base_bin->building_group = NULL; - /* remove signals. We don't want anymore signals from the preroll - * elements at this stage. */ - for (n = 0; n < NUM_TYPES; n++) { - GstElement *element = group->type[n].preroll; - guint sig_id; + /* remove signals. We don't want anymore signals from the preroll + * elements at this stage. */ + for (n = 0; n < NUM_TYPES; n++) { + GstElement *element = group->type[n].preroll; + guint sig_id; - if (!element) - continue; + if (!element) + continue; - sig_id = - GPOINTER_TO_INT (g_object_get_data (G_OBJECT (element), "signal_id")); + sig_id = + GPOINTER_TO_INT (g_object_get_data (G_OBJECT (element), + "signal_id")); - if (sig_id) { - GST_LOG ("removing preroll signal %s", GST_ELEMENT_NAME (element)); - g_signal_handler_disconnect (G_OBJECT (element), sig_id); + if (sig_id) { + GST_LOG_OBJECT (play_base_bin, "removing preroll signal %s", + GST_ELEMENT_NAME (element)); + g_signal_handler_disconnect (G_OBJECT (element), sig_id); + } } + } else { + /* this is a special subtitle bin, we don't commit the group but + * mark the subtitles as detected before se signal. */ + GST_DEBUG_OBJECT (play_base_bin, "marking subtitle bin as complete"); + play_base_bin->subtitle_done = TRUE; } - GST_DEBUG ("signal group done"); + GST_DEBUG_OBJECT (play_base_bin, "signal group done"); GROUP_SIGNAL (play_base_bin); - GST_DEBUG ("signaled group done"); + GST_DEBUG_OBJECT (play_base_bin, "signaled group done"); if (!subtitle && !had_active_group) { if (!prepare_output (play_base_bin)) { @@ -449,10 +463,10 @@ setup_substreams (play_base_bin); - GST_DEBUG ("Emitting signal"); + GST_DEBUG_OBJECT (play_base_bin, "Emitting signal"); res = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)-> setup_output_pads (play_base_bin, group); - GST_DEBUG ("done"); + GST_DEBUG_OBJECT (play_base_bin, "done"); GROUP_UNLOCK (play_base_bin); @@ -1346,6 +1360,8 @@ if (!play_base_bin->need_rebuild) return TRUE; + GST_DEBUG_OBJECT (play_base_bin, "setup source"); /* delete old src */ if (play_base_bin->source) { GST_DEBUG_OBJECT (play_base_bin, "removing old src element"); @@ -1394,12 +1410,20 @@ * has no more dynamic streams, the cond is unlocked. We can remove * the signal handlers then */ + GST_DEBUG_OBJECT (play_base_bin, "starting subtitle bin"); + /* for subtitles in a separate bin we will not commit the + * current building group since we need to add the other + * audio/video streams to the group. We check if we managed + * to commit the subtitle group using an extra flag. */ + play_base_bin->subtitle_done = FALSE; gst_element_set_state (subbin, GST_STATE_PAUSED); GROUP_LOCK (play_base_bin); - GST_DEBUG ("waiting for first group..."); - GROUP_WAIT (play_base_bin); + GST_DEBUG ("waiting for subtitle to complete..."); + while (!play_base_bin->subtitle_done) + GROUP_WAIT (play_base_bin); GST_DEBUG ("group done !"); Index: gstplaybasebin.h RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- gstplaybasebin.h 29 May 2006 13:20:59 -0000 1.21 +++ gstplaybasebin.h 2 Jun 2006 10:34:12 -0000 1.22 @@ -80,6 +80,7 @@ GstElement *source; GstElement *decoder; GstElement *subtitle; /* additional filesrc ! subparse bin */ + gboolean subtitle_done; GSList *subtitle_elements; /* subtitle elements that have 'subtitle-encoding' property */ gchar *subencoding; /* encoding to propagate to the above subtitle elements */ gboolean need_rebuild; |
From: <wt...@ke...> - 2006-07-04 14:06:16
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Tue Jul 04 2006 14:06:15 UTC Log message: * gst/playback/gstplaybasebin.c: (is_stream), (gen_source_element): Improve checking if we are dealing with a stream. Added some more uris that need buffering. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2745&r2=1.2746 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.112&r2=1.113 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2745 retrieving revision 1.2746 diff -u -d -r1.2745 -r1.2746 --- ChangeLog 3 Jul 2006 10:43:31 -0000 1.2745 +++ ChangeLog 4 Jul 2006 14:06:02 -0000 1.2746 @@ -1,3 +1,9 @@ +2006-07-04 Wim Taymans <wi...@fl...> + + * gst/playback/gstplaybasebin.c: (is_stream), (gen_source_element): + Improve checking if we are dealing with a stream. Added some + more uris that need buffering. 2006-07-03 Edward Hervey <ed...@fl...> * ext/vorbis/vorbisdec.c: (vorbis_do_clip): Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.112 retrieving revision 1.113 diff -u -d -r1.112 -r1.113 --- gstplaybasebin.c 2 Jun 2006 10:34:12 -0000 1.112 +++ gstplaybasebin.c 4 Jul 2006 14:06:03 -0000 1.113 @@ -1244,6 +1244,22 @@ return subbin; } +/* lame - FIXME, maybe we can use seek_types/mask here? */ +static gboolean +is_stream (GstPlayBaseBin * play_base_bin, gchar * uri) +{ + static const gchar *uris[] = { "http://", "mms://", "mmsh://", + "mmsu://", "mmst://", "rtp://", "rtsp://", NULL + }; + gint i; + for (i = 0; uris[i]; i++) { + if (g_str_has_prefix (uri, uris[i])) + return TRUE; + } + return FALSE; +} /* * Generate a source element that does caching for network streams. */ @@ -1276,11 +1292,7 @@ if (!source) return NULL; - /* lame - FIXME, maybe we can use seek_types/mask here? */ - play_base_bin->is_stream = !strncmp (play_base_bin->uri, "http://", 7) || - !strncmp (play_base_bin->uri, "mms://", 6) || - !strncmp (play_base_bin->uri, "rtp://", 6) || - !strncmp (play_base_bin->uri, "rtsp://", 7); + play_base_bin->is_stream = is_stream (play_base_bin, play_base_bin->uri); /* make HTTP sources send extra headers so we get icecast * metadata in case the stream is an icecast stream */ |
From: <wt...@ke...> - 2006-07-20 10:42:34
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Thu Jul 20 2006 10:42:33 UTC Log message: * gst/playback/test.c: (gen_video_element), (gen_audio_element), (cb_newpad), (main): Example of a small audio/video player using decodebin. Modified files: . : ChangeLog gst/playback : test.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2781&r2=1.2782 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/test.c.diff?r1=1.8&r2=1.9 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2781 retrieving revision 1.2782 diff -u -d -r1.2781 -r1.2782 --- ChangeLog 20 Jul 2006 05:56:48 -0000 1.2781 +++ ChangeLog 20 Jul 2006 10:42:21 -0000 1.2782 @@ -1,3 +1,9 @@ +2006-07-20 Wim Taymans <wi...@fl...> + + * gst/playback/test.c: (gen_video_element), (gen_audio_element), + (cb_newpad), (main): + Example of a small audio/video player using decodebin. 2006-07-20 Stefan Kost <en...@us...> * gst-libs/gst/riff/riff-ids.h: Index: test.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/test.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- test.c 2 May 2006 18:15:25 -0000 1.8 +++ test.c 20 Jul 2006 10:42:21 -0000 1.9 @@ -1,5 +1,6 @@ /* GStreamer * Copyright (C) <1999> Erik Walthinsen <om...@cs...> + * Copyright (C) <2006> Wim Taymans <wi...@fl...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,12 +22,15 @@ #endif #include <gst/gst.h> +static GMainLoop *loop; static GstElement * gen_video_element () { GstElement *element; GstElement *conv; GstElement *sink; + GstPad *pad; element = gst_bin_new ("vbin"); conv = gst_element_factory_make ("ffmpegcolorspace", "conv"); @@ -36,8 +40,9 @@ gst_bin_add (GST_BIN (element), sink); gst_element_link_pads (conv, "src", sink, "sink"); - gst_element_add_pad (element, - gst_ghost_pad_new ("sink", gst_element_get_pad (conv, "sink"))); + pad = gst_element_get_pad (conv, "sink"); + gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad)); + gst_object_unref (pad); return element; } @@ -48,6 +53,7 @@ element = gst_bin_new ("abin"); conv = gst_element_factory_make ("audioconvert", "conv"); @@ -57,83 +63,129 @@ +static void +cb_newpad (GstElement * decodebin, GstPad * pad, gboolean last, gpointer data) +{ + GstCaps *caps; + GstStructure *str; + GstPad *sinkpad; + GstElement *sink; + GstElement *pipeline; + const gchar *name; + GstStateChangeReturn ret; + GstPadLinkReturn lret; + /* check media type */ + caps = gst_pad_get_caps (pad); + str = gst_caps_get_structure (caps, 0); + name = gst_structure_get_name (str); + g_print ("name: %s\n", name); + if (g_strrstr (name, "audio")) { + sink = gen_audio_element (); + } else if (g_strrstr (name, "video")) { + sink = gen_video_element (); + } else { + sink = NULL; + } + gst_caps_unref (caps); + if (sink) { + pipeline = GST_ELEMENT_CAST (data); + /* add new sink to the pipeline */ + gst_bin_add (GST_BIN_CAST (pipeline), sink); + /* set the new sink tp PAUSED as well */ + ret = gst_element_set_state (sink, GST_STATE_PAUSED); + if (ret == GST_STATE_CHANGE_FAILURE) + goto state_error; + /* get the ghostpad of the sink bin */ + sinkpad = gst_element_get_pad (sink, "sink"); + /* link'n'play */ + lret = gst_pad_link (pad, sinkpad); + if (lret != GST_PAD_LINK_OK) + goto link_failed; + gst_object_unref (sinkpad); + return; + /* ERRORS */ +state_error: + { + gst_bin_remove (GST_BIN_CAST (pipeline), sink); + g_warning ("could not change state of new sink (%d)", ret); + return; +link_failed: + g_warning ("could not link pad and sink (%d)", lret); +} gint main (gint argc, gchar * argv[]) - GstElement *player; + GstElement *pipeline, *filesrc, *decodebin; GstStateChangeReturn res; - gint streams; - GList *streaminfo; - GList *s; gst_init (&argc, &argv); - player = gst_element_factory_make ("playbin", "player"); - g_assert (player); - - g_object_set (G_OBJECT (player), "uri", argv[1], NULL); - res = gst_element_set_state (player, GST_STATE_PAUSED); - if (res != GST_STATE_CHANGE_SUCCESS) { - g_print ("could not pause\n"); - return -1; - } - /* get info about the stream */ - g_print ("stream info:\n"); - g_object_get (G_OBJECT (player), "nstreams", &streams, NULL); - g_print (" number of streams: %d\n", streams); - g_object_get (G_OBJECT (player), "stream-info", &streaminfo, NULL); + pipeline = gst_pipeline_new ("pipeline"); - for (s = streaminfo; s; s = g_list_next (s)) { - GObject *obj = G_OBJECT (s->data); - int type; - GstPad *srcpad, *sinkpad; - GstElement *sink; - gboolean res; + filesrc = gst_element_factory_make ("filesrc", "filesrc"); + g_assert (filesrc); + decodebin = gst_element_factory_make ("decodebin", "decodebin"); + g_assert (decodebin); - g_object_get (obj, "type", &type, NULL); - g_print (" type: %d\n", type); - g_object_get (obj, "pad", &srcpad, NULL); - g_print (" pad: %p\n", srcpad); + g_signal_connect (G_OBJECT (decodebin), "new-decoded-pad", + G_CALLBACK (cb_newpad), pipeline); - if (type == 1) { - sink = gen_audio_element (); - } else if (type == 2) { - sink = gen_video_element (); - } else { - g_warning ("unknown stream found"); - continue; - } + gst_bin_add_many (GST_BIN (pipeline), filesrc, decodebin, NULL); + gst_element_link (filesrc, decodebin); - gst_bin_add (GST_BIN (player), sink); - sinkpad = gst_element_get_pad (sink, "sink"); - res = gst_pad_link (srcpad, sinkpad); - if (!res) { - GstCaps *caps; - gchar *capsstr; + if (argc < 2) { + g_print ("usage: %s <uri>\n", argv[0]); + exit (-1); + g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - caps = gst_pad_get_caps (srcpad); - capsstr = gst_caps_to_string (caps); - g_warning ("could not link %s", capsstr); - g_free (capsstr); - gst_caps_unref (caps); - //g_signal_emit_by_name (G_OBJECT (player), "link_stream", obj, sinkpad); + /* set to paused, decodebin will autoplug and signal new_pad callbacks */ + res = gst_element_set_state (pipeline, GST_STATE_PAUSED); + if (res == GST_STATE_CHANGE_FAILURE) { + g_print ("could not pause\n"); + return -1; + /* wait for paused to complete */ + res = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); } - /* set effects sinks */ - res = gst_element_set_state (player, GST_STATE_PLAYING); + /* play, now all the sinks are added to the pipeline and are prerolled and + * ready to play. */ + res = gst_element_set_state (pipeline, GST_STATE_PLAYING); g_print ("could not play\n"); return -1; - //gst_main (); + /* go in the mainloop now */ + loop = g_main_loop_new (NULL, TRUE); + g_main_loop_run (loop); return 0; |
From: <wt...@ke...> - 2006-09-15 11:17:16
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Fri Sep 15 2006 11:17:14 UTC Log message: * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (gst_play_base_bin_init), (fill_buffer), (check_queue), (queue_threshold_reached), (gst_play_base_bin_set_property), (gst_play_base_bin_get_property): * gst/playback/gstplaybasebin.h: Don't use a 0 low watermark when buffering, it is catching starvation way too late. Instead, use a 3 second queue with 30 and 95 percent low/high watermarks. Added queue-min-threshold property to configure low watermark. Use new _buffering message API. Make queue_threshold variable big enough to store a uint64 time value. API: playbin::queue-min-threshold property. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c gstplaybasebin.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2877&r2=1.2878 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.115&r2=1.116 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.h.diff?r1=1.23&r2=1.24 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2877 retrieving revision 1.2878 diff -u -d -r1.2877 -r1.2878 --- ChangeLog 15 Sep 2006 09:13:50 -0000 1.2877 +++ ChangeLog 15 Sep 2006 11:17:02 -0000 1.2878 @@ -1,5 +1,20 @@ 2006-09-15 Wim Taymans <wi...@fl...> + * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), + (gst_play_base_bin_init), (fill_buffer), (check_queue), + (queue_threshold_reached), (gst_play_base_bin_set_property), + (gst_play_base_bin_get_property): + * gst/playback/gstplaybasebin.h: + Don't use a 0 low watermark when buffering, it is catching starvation + way too late. Instead, use a 3 second queue with 30 and 95 + percent low/high watermarks. + Added queue-min-threshold property to configure low watermark. + Use new _buffering message API. + Make queue_threshold variable big enough to store a uint64 time value. + API: playbin::queue-min-threshold property. + +2006-09-15 Wim Taymans <wi...@fl...> * configure.ac: We require 0.10.10.1 now because of _wait_preroll(). Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.115 retrieving revision 1.116 diff -u -d -r1.115 -r1.116 --- gstplaybasebin.c 26 Jul 2006 10:31:06 -0000 1.115 +++ gstplaybasebin.c 15 Sep 2006 11:17:02 -0000 1.116 @@ -30,13 +30,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_play_base_bin_debug); #define GST_CAT_DEFAULT gst_play_base_bin_debug -#if 0 -#define DEFAULT_QUEUE_THRESHOLD ((2 * GST_SECOND) / 3) -#define DEFAULT_QUEUE_SIZE (GST_SECOND / 2) -#else -#define DEFAULT_QUEUE_THRESHOLD (2 * GST_SECOND) -#define DEFAULT_QUEUE_SIZE (3 * GST_SECOND) -#endif +#define DEFAULT_QUEUE_SIZE (3 * GST_SECOND) +#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30)/100) +#define DEFAULT_QUEUE_THRESHOLD ((DEFAULT_QUEUE_SIZE * 95) / 100) #define GROUP_LOCK(pbb) g_mutex_lock (pbb->group_lock) #define GROUP_UNLOCK(pbb) g_mutex_unlock (pbb->group_lock) @@ -51,6 +47,7 @@ ARG_SUBURI, ARG_QUEUE_SIZE, ARG_QUEUE_THRESHOLD, + ARG_QUEUE_MIN_THRESHOLD, ARG_NSTREAMS, ARG_STREAMINFO, ARG_STREAMINFO_VALUES, @@ -146,6 +143,10 @@ g_param_spec_uint64 ("queue-threshold", "Queue threshold", "Buffering threshold of internal queues in nanoseconds", 0, G_MAXINT64, DEFAULT_QUEUE_THRESHOLD, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_klass, ARG_QUEUE_MIN_THRESHOLD, + g_param_spec_uint64 ("queue-min-threshold", "Queue min threshold", + "Buffering low threshold of internal queues in nanoseconds", 0, + G_MAXINT64, DEFAULT_QUEUE_MIN_THRESHOLD, G_PARAM_READWRITE)); g_object_class_install_property (gobject_klass, ARG_NSTREAMS, g_param_spec_int ("nstreams", "NStreams", "number of streams", @@ -213,6 +214,7 @@ play_base_bin->queue_size = DEFAULT_QUEUE_SIZE; play_base_bin->queue_threshold = DEFAULT_QUEUE_THRESHOLD; + play_base_bin->queue_min_threshold = DEFAULT_QUEUE_MIN_THRESHOLD; } static void @@ -490,11 +492,8 @@ static inline void fill_buffer (GstPlayBaseBin * play_base_bin, gint percent) { - gst_element_post_message (GST_ELEMENT (play_base_bin), - gst_message_new_custom (GST_MESSAGE_BUFFERING, - GST_OBJECT (play_base_bin), - gst_structure_new ("GstMessageBuffering", - "buffer-percent", G_TYPE_INT, percent, NULL))); + gst_element_post_message (GST_ELEMENT_CAST (play_base_bin), + gst_message_new_buffering (GST_OBJECT_CAST (play_base_bin), percent)); static gboolean @@ -509,11 +508,11 @@ g_object_get (G_OBJECT (queue), "current-level-time", &level, NULL); GST_DEBUG ("Queue size: %" GST_TIME_FORMAT, GST_TIME_ARGS (level)); if (play_base_bin->queue_threshold > 0) { - level = level * 100 / play_base_bin->queue_threshold; - if (level > 100) - level = 100; + level = level * 99 / play_base_bin->queue_threshold; + if (level > 99) + level = 99; } else - level = 100; + level = 99; fill_buffer (play_base_bin, level); @@ -580,7 +579,8 @@ /* play */ g_signal_handlers_disconnect_by_func (queue, G_CALLBACK (queue_threshold_reached), play_base_bin); - g_object_set (queue, "min-threshold-time", (guint64) 0, NULL); + g_object_set (queue, "min-threshold-time", play_base_bin->queue_min_threshold, + NULL); data = g_object_get_data (G_OBJECT (queue), "probe"); if (data) { @@ -591,13 +591,12 @@ "Removing buffer probe from pad %s:%s (%p)", GST_DEBUG_PAD_NAME (sinkpad), sinkpad); - fill_buffer (play_base_bin, 100); - g_object_set_data (G_OBJECT (queue), "probe", NULL); gst_pad_remove_buffer_probe (sinkpad, GPOINTER_TO_INT (data)); gst_object_unref (sinkpad); } + fill_buffer (play_base_bin, 100); /* this signal is only added when in streaming mode to catch underruns @@ -1881,6 +1880,9 @@ case ARG_QUEUE_THRESHOLD: play_base_bin->queue_threshold = g_value_get_uint64 (value); break; + case ARG_QUEUE_MIN_THRESHOLD: + play_base_bin->queue_min_threshold = g_value_get_uint64 (value); + break; case ARG_VIDEO: GROUP_LOCK (play_base_bin); set_active_source (play_base_bin, @@ -1970,6 +1972,9 @@ g_value_set_uint64 (value, play_base_bin->queue_threshold); + g_value_set_uint64 (value, play_base_bin->queue_min_threshold); case ARG_STREAMINFO: /* FIXME: hold some kind of lock here, use iterator */ g_value_set_pointer (value, Index: gstplaybasebin.h RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- gstplaybasebin.h 6 Jul 2006 13:04:24 -0000 1.23 +++ gstplaybasebin.h 15 Sep 2006 11:17:02 -0000 1.24 @@ -71,7 +71,8 @@ /* properties */ guint64 queue_size; - guint queue_threshold; + guint64 queue_threshold; + guint64 queue_min_threshold; /* currently loaded media */ gint current[NUM_TYPES]; |
From: <wt...@ke...> - 2006-09-21 07:02:01
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Thu Sep 21 2006 07:02:00 UTC Log message: * gst/playback/gstplaybasebin.c: (group_commit), (queue_deadlock_check), (queue_overrun), (queue_threshold_reached), (queue_out_of_data), (gen_preroll_element), (preroll_remove_overrun), (probe_triggered): Refactor handling of overrun detection. Separate handling of group completion and deadlock detection when doing network buffering. This should fix some deadlocks that were not detected because the group was completed. Add more comments, improve debugging. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2900&r2=1.2901 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.117&r2=1.118 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2900 retrieving revision 1.2901 diff -u -d -r1.2900 -r1.2901 --- ChangeLog 21 Sep 2006 05:30:59 -0000 1.2900 +++ ChangeLog 21 Sep 2006 07:01:48 -0000 1.2901 @@ -1,5 +1,17 @@ 2006-09-21 Wim Taymans <wi...@fl...> + * gst/playback/gstplaybasebin.c: (group_commit), + (queue_deadlock_check), (queue_overrun), (queue_threshold_reached), + (queue_out_of_data), (gen_preroll_element), + (preroll_remove_overrun), (probe_triggered): + Refactor handling of overrun detection. + Separate handling of group completion and deadlock detection when doing + network buffering. This should fix some deadlocks that were not detected + because the group was completed. + Add more comments, improve debugging. + +2006-09-21 Wim Taymans <wi...@fl...> * tests/check/elements/gdpdepay.c: (GST_START_TEST): * tests/check/libs/audio.c: Some more compilation fixes. Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.117 retrieving revision 1.118 diff -u -d -r1.117 -r1.118 --- gstplaybasebin.c 17 Sep 2006 20:32:09 -0000 1.117 +++ gstplaybasebin.c 21 Sep 2006 07:01:48 -0000 1.118 @@ -31,7 +31,7 @@ #define GST_CAT_DEFAULT gst_play_base_bin_debug #define DEFAULT_QUEUE_SIZE (3 * GST_SECOND) -#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30)/100) +#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100) #define DEFAULT_QUEUE_THRESHOLD ((DEFAULT_QUEUE_SIZE * 95) / 100) #define GROUP_LOCK(pbb) g_mutex_lock (pbb->group_lock) @@ -72,6 +72,8 @@ const GList *gst_play_base_bin_get_streaminfo (GstPlayBaseBin * play_base_bin); const GValueArray *gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin * play_base_bin); +static void preroll_remove_overrun (GstElement * element, + GstPlayBaseBin * play_base_bin); static gboolean prepare_output (GstPlayBaseBin * play_base_bin); static void set_active_source (GstPlayBaseBin * play_base_bin, @@ -420,20 +422,11 @@ * elements at this stage. */ for (n = 0; n < NUM_TYPES; n++) { GstElement *element = group->type[n].preroll; - guint sig_id; if (!element) continue; - sig_id = - GPOINTER_TO_INT (g_object_get_data (G_OBJECT (element), - "signal_id")); - - if (sig_id) { - GST_LOG_OBJECT (play_base_bin, "removing preroll signal %s", - GST_ELEMENT_NAME (element)); - g_signal_handler_disconnect (G_OBJECT (element), sig_id); - } + preroll_remove_overrun (element, play_base_bin); } } else { /* this is a special subtitle bin, we don't commit the group but @@ -520,68 +513,96 @@ return TRUE; } -/* this signal will be fired when one of the queues with raw - * data is filled. This means that the group building stage is over - * and playback of the new queued group should start - * - * If this queue overruns we can potentially create a deadlock when: +/* If a queue overruns and we are buffer in streaming mode (we have a min-time) + * we can potentially create a deadlock when: * * 1) the max-bytes is hit and * 2) the min-time is not hit. - * We recover from this situation in the overrun callback by + * We recover from this situation in this callback by * setting the max-bytes to unlimited if we see that there is * a current-time-level (which means some sort of timestamping is * done). */ static void -queue_overrun (GstElement * queue, GstPlayBaseBin * play_base_bin) +queue_deadlock_check (GstElement * queue, GstPlayBaseBin * play_base_bin) { - GST_DEBUG ("queue %s overrun", GST_ELEMENT_NAME (queue)); + guint64 time, min_time; + guint bytes; - /* if we're streaming, check if we had a deadlock with the - * max-bytes <> min-time thresholds */ - if (play_base_bin->is_stream) { - guint64 time, min_time; + GST_DEBUG_OBJECT (play_base_bin, "overrun signal received from queue %s", + GST_ELEMENT_NAME (queue)); - g_object_get (G_OBJECT (queue), "current-level-time", &time, - "min-threshold-time", &min_time, NULL); + /* figure out where we are */ + g_object_get (G_OBJECT (queue), "current-level-time", &time, + "current-level-bytes", &bytes, "min-threshold-time", &min_time, NULL); - GST_DEBUG_OBJECT (play_base_bin, "streaming mode, queue %s current %" - GST_TIME_FORMAT ", min %" GST_TIME_FORMAT, - GST_ELEMENT_NAME (queue), - GST_TIME_ARGS (time), GST_TIME_ARGS (min_time)); - if (time != 0) { - /* queue knows about time, disable bytes checking. */ - g_object_set (G_OBJECT (queue), "max-size-bytes", 0, NULL); - } + GST_DEBUG_OBJECT (play_base_bin, "streaming mode, queue %s current %" + GST_TIME_FORMAT ", min %" GST_TIME_FORMAT + ", bytes %d", GST_ELEMENT_NAME (queue), + GST_TIME_ARGS (time), GST_TIME_ARGS (min_time), bytes); + /* if the bytes in the queue represent time, we disable bytes + * overrun checking to not cause deadlocks. + */ + if (bytes && time != 0 && time < min_time) { + GST_DEBUG_OBJECT (play_base_bin, + "possible deadlock found, removing byte limit"); + /* queue knows about time but is filled with bytes that do + * not represent min-threshold time, disable bytes checking so + * the queue can grow some more. */ + g_object_set (G_OBJECT (queue), "max-size-bytes", 0, NULL); + /* bytes limit is removed, we cannot deadlock anymore */ + g_signal_handlers_disconnect_by_func (queue, + G_CALLBACK (queue_deadlock_check), play_base_bin); + } else { + GST_DEBUG_OBJECT (play_base_bin, "no deadlock"); } +} +/* this signal will be fired when one of the queues with raw + * data is filled. This means that the group building stage is over + * and playback of the new queued group should start. This is a rather unusual + * situation because normally the group is commited when the "no_more_pads" + * signal is fired. + */ +static void +queue_overrun (GstElement * queue, GstPlayBaseBin * play_base_bin) +{ + GST_DEBUG_OBJECT (play_base_bin, "queue %s overrun", + preroll_remove_overrun (queue, play_base_bin); group_commit (play_base_bin, FALSE, GST_OBJECT_PARENT (GST_OBJECT_CAST (queue)) == GST_OBJECT (play_base_bin->subtitle)); - g_signal_handlers_disconnect_by_func (queue, - G_CALLBACK (queue_overrun), play_base_bin); - /* We have disconnected this signal, remove the signal_id from the object - data */ - g_object_set_data (G_OBJECT (queue), "signal_id", NULL); -/* Used for time-based buffering. */ +/* Used for time-based buffering in streaming mode and is called when a queue + * emits the running signal. This means that the high watermark threshold is + * reached and the buffering is completed. */ queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin) gpointer data; - GST_DEBUG ("Running"); + GST_DEBUG_OBJECT (play_base_bin, "running signal received from queue %s", - /* play */ + /* we disconnect the signal so that we don't get called for every buffer. */ g_signal_handlers_disconnect_by_func (queue, G_CALLBACK (queue_threshold_reached), play_base_bin); + /* now place the limits at the low threshold. When we hit this limit, the + * underrun signal will be called. The underrun signal is always connected. */ g_object_set (queue, "min-threshold-time", play_base_bin->queue_min_threshold, NULL); + /* we remove the probe now because we don't need it anymore to give progress + * about the buffering. */ data = g_object_get_data (G_OBJECT (queue), "probe"); if (data) { GstPad *sinkpad; @@ -596,6 +617,9 @@ gst_object_unref (sinkpad); + /* we post a 100% buffering message to notify the app that buffering is + * completed and playback can start/continue */ fill_buffer (play_base_bin, 100); @@ -604,40 +628,22 @@ queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin) - guint64 time, min_time; - guint bytes, max_bytes; - GST_DEBUG ("Underrun, re-caching"); - g_object_get (G_OBJECT (queue), "current-level-time", &time, - "current-level-bytes", &bytes, - "max-size-bytes", &max_bytes, "min-threshold-time", &min_time, NULL); - GST_DEBUG_OBJECT (play_base_bin, "streaming mode, queue %s current %" - GST_TIME_FORMAT ", min %" GST_TIME_FORMAT - ", bytes %d", - GST_ELEMENT_NAME (queue), - GST_TIME_ARGS (time), GST_TIME_ARGS (min_time), bytes); - /* if the bytes in the queue represent time, we disable bytes - * overrun checking to not cause deadlocks. - */ - if (bytes && time != 0 && time < min_time) { - /* queue knows about time but is filled with bytes that do - * not represent min-threshold time, disable bytes checking so - * the queue can grow some more. */ - g_object_set (G_OBJECT (queue), "max-size-bytes", 0, NULL); - } + GST_DEBUG_OBJECT (play_base_bin, "underrun signal received from queue %s", /* On underrun, we want to temoprarily pause playback, set a "min-size" - * threshold and wait for the running signal and then play again. Take - * care of possible deadlocks and so on, */ + * threshold and wait for the running signal and then play again. + * + * This signal could never be called because the queue max-size limits are set + * too low. We take care of this possible deadlock in the the overrun signal + * handler. */ g_signal_connect (G_OBJECT (queue), "running", g_object_set (queue, "min-threshold-time", (guint64) play_base_bin->queue_threshold, NULL); - /* re-connect probe */ + /* re-connect probe, this will five feedback about the percentage that we + * buffered and is posted in the BUFFERING message. */ if (!g_object_get_data (G_OBJECT (queue), "probe")) { guint id; @@ -670,7 +676,7 @@ GstElement *selector, *preroll; gchar *name, *padname; const gchar *prename; - guint sig; + guint overrun_sig; GstPad *preroll_pad; if (type == GST_STREAM_TYPE_VIDEO) @@ -699,23 +705,41 @@ * very small amount of buffers since the memory used by * this raw data can be enormously huge. * + * We use an upper limit of typically a few seconds here but + * cap in case no timestamps are set on the raw data (bad!). * FIXME: we abuse this buffer to do network buffering since * we can then easily do time-based buffering. The better * solution would be to add a specific network queue right * after the source that measures the datarate and scales this * queue of encoded data instead. - * - * We use an upper limit of typically a few seconds here but - * cap in case no timestamps are set on the raw data (bad!). */ g_object_set (G_OBJECT (preroll), "max-size-buffers", 0, "max-size-bytes", ((type == GST_STREAM_TYPE_VIDEO) ? 25 : 1) * 1024 * 1024, "max-size-time", play_base_bin->queue_size, NULL); - sig = g_signal_connect (G_OBJECT (preroll), "overrun", + /* the overrun signal is always attached and serves two pusposes: + * 1) when we are building a group and the overrun is called, we commit the + * group. The reason being that if we fill the entire queue without a + * normal group commit (with _no_more_pads()) we can assume the + * audio/video is completely wacked or the element just does not know when + * it is ready with all the pads (mpeg). + * 2) When we are doing network buffering, we keep track of low/high + * watermarks in the queue. It is possible that we set the high watermark + * higher than the max-size limits to trigger an overrun. In this case we + * will never get a running signal but we can use the overrun signal to + * detect this deadlock and correct it. + overrun_sig = g_signal_connect (G_OBJECT (preroll), "overrun", G_CALLBACK (queue_overrun), play_base_bin); + /* keep a ref to the signal id so that we can disconnect the signal callback + * when we are done with the preroll */ + g_object_set_data (G_OBJECT (preroll), "overrun_signal_id", + GINT_TO_POINTER (overrun_sig)); if (play_base_bin->is_stream && ((type == GST_STREAM_TYPE_VIDEO && group->type[GST_STREAM_TYPE_AUDIO - 1].npads == 0) || @@ -724,10 +748,10 @@ - g_signal_connect (G_OBJECT (preroll), "running", - G_CALLBACK (queue_threshold_reached), play_base_bin); - g_object_set (G_OBJECT (preroll), - "min-threshold-time", (guint64) play_base_bin->queue_threshold, NULL); + /* catch deadlocks when we are network buffering in time but the max-limit + * in bytes is hit. */ + g_signal_connect (G_OBJECT (preroll), "overrun", /* give updates on queue size */ sinkpad = gst_element_get_pad (preroll, "sink"); @@ -738,28 +762,14 @@ g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin); g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id)); - /* - * When we connect this queue, it will start running and immediatly - * fire an underrun when: - * - * 1) the max-bytes is hit - * 2) the min-time is not hit. - * We recover from this situation in the out_of_data callback by - * setting the max-bytes to unlimited if we see that there is - * a current-time-level (which means some sort of timestamping is - * done). - */ + /* When we connect this queue, it will start running and immediatly + * fire an underrun. */ g_signal_connect (G_OBJECT (preroll), "underrun", G_CALLBACK (queue_out_of_data), play_base_bin); - /* keep a ref to the signal id so that we can disconnect the signal callback - * when we are done with the preroll */ - g_object_set_data (G_OBJECT (preroll), "signal_id", GINT_TO_POINTER (sig)); - /* listen for EOS */ preroll_pad = gst_element_get_pad (preroll, "src"); + /* listen for EOS */ gst_pad_add_event_probe (preroll_pad, G_CALLBACK (probe_triggered), info); gst_object_unref (preroll_pad); @@ -793,6 +803,23 @@ +preroll_remove_overrun (GstElement * element, GstPlayBaseBin * play_base_bin) + GObject *obj = G_OBJECT (element); + overrun_sig = GPOINTER_TO_INT (g_object_get_data (obj, "overrun_signal_id")); + if (overrun_sig) { + GST_LOG_OBJECT (play_base_bin, "removing preroll signal %s", + GST_ELEMENT_NAME (element)); + g_signal_handler_disconnect (obj, overrun_sig); + /* We have disconnected this signal, remove the signal_id from the object + * data */ + g_object_set_data (obj, "overrun_signal_id", NULL); + } remove_groups (GstPlayBaseBin * play_base_bin) GROUP_LOCK (play_base_bin); @@ -918,19 +945,27 @@ GstPlayBaseGroup *group; GstPlayBaseBin *play_base_bin; - GstStreamInfo *info = GST_STREAM_INFO (user_data); + GstStreamInfo *info; gboolean res; + GstEventType type; + type = GST_EVENT_TYPE (event); + GST_DEBUG ("probe triggered, (%d) %s", type, gst_event_type_get_name (type)); + /* we only care about EOS */ + if (type != GST_EVENT_EOS) + return TRUE; + info = GST_STREAM_INFO (user_data); group = (GstPlayBaseGroup *) g_object_get_data (G_OBJECT (info), "group"); play_base_bin = group->bin; - GST_DEBUG ("probe triggered"); - if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + if (type == GST_EVENT_EOS) { gint num_groups = 0; gboolean have_left; - GST_DEBUG ("probe got EOS in group %p", group); + GST_DEBUG_OBJECT (play_base_bin, "probe got EOS in group %p", group); GROUP_LOCK (play_base_bin); |
From: <wt...@ke...> - 2006-09-23 08:53:43
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Sat Sep 23 2006 08:53:42 UTC Log message: * gst/playback/gstplaybasebin.c: (gen_preroll_element): Improve buffering a bit by avoiding a deadlock because we cannot assume the underrun is always called. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2907&r2=1.2908 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.118&r2=1.119 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2907 retrieving revision 1.2908 diff -u -d -r1.2907 -r1.2908 --- ChangeLog 23 Sep 2006 08:51:13 -0000 1.2907 +++ ChangeLog 23 Sep 2006 08:53:30 -0000 1.2908 @@ -1,5 +1,11 @@ 2006-09-23 Wim Taymans <wi...@fl...> + * gst/playback/gstplaybasebin.c: (gen_preroll_element): + Improve buffering a bit by avoiding a deadlock because we cannot assume + the underrun is always called. + +2006-09-23 Wim Taymans <wi...@fl...> Patch by: Young-Ho Cha <ganadist at chollian dot net> * gst-libs/gst/riff/riff-ids.h: Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.118 retrieving revision 1.119 diff -u -d -r1.118 -r1.119 --- gstplaybasebin.c 21 Sep 2006 07:01:48 -0000 1.118 +++ gstplaybasebin.c 23 Sep 2006 08:53:30 -0000 1.119 @@ -766,6 +766,8 @@ * fire an underrun. */ g_signal_connect (G_OBJECT (preroll), "underrun", G_CALLBACK (queue_out_of_data), play_base_bin); + /* configure threshold and callbacks */ + queue_out_of_data (preroll, play_base_bin); } preroll_pad = gst_element_get_pad (preroll, "src"); |
From: <wt...@ke...> - 2006-09-25 13:25:17
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Mon Sep 25 2006 13:25:11 UTC Log message: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (gst_play_bin_vis_blocked), (gst_play_bin_set_property), (gen_video_element), (gen_text_element), (gen_audio_element), (gen_vis_element), (remove_sinks), (add_sink), (setup_sinks), (gst_play_bin_set_clock_func), (gst_play_bin_change_state): Detect NO_PREROLL state change returns and disable clock distribution to the sinks so that sync is disabled. Avoid some type checking and do simple casts instead. Small cleanups, fix some FIXMEs. Be more robust when linking user specified elements, catch an report errors. Fixes #357404. Fix some leaks in the error paths. Modified files: . : ChangeLog gst/playback : gstplaybin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2916&r2=1.2917 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c.diff?r1=1.95&r2=1.96 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2916 retrieving revision 1.2917 diff -u -d -r1.2916 -r1.2917 --- ChangeLog 25 Sep 2006 12:55:04 -0000 1.2916 +++ ChangeLog 25 Sep 2006 13:24:59 -0000 1.2917 @@ -1,3 +1,18 @@ +2006-09-25 Wim Taymans <wi...@fl...> + + * gst/playback/gstplaybin.c: (gst_play_bin_class_init), + (gst_play_bin_vis_blocked), (gst_play_bin_set_property), + (gen_video_element), (gen_text_element), (gen_audio_element), + (gen_vis_element), (remove_sinks), (add_sink), (setup_sinks), + (gst_play_bin_set_clock_func), (gst_play_bin_change_state): + Detect NO_PREROLL state change returns and disable clock distribution to + the sinks so that sync is disabled. + Avoid some type checking and do simple casts instead. + Small cleanups, fix some FIXMEs. + Be more robust when linking user specified elements, catch an report + errors. Fixes #357404. + Fix some leaks in the error paths. 2006-09-25 Stefan Kost <en...@us...> * ChangeLog: Index: gstplaybin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c,v retrieving revision 1.95 retrieving revision 1.96 diff -u -d -r1.95 -r1.96 --- gstplaybin.c 14 Sep 2006 20:09:18 -0000 1.95 +++ gstplaybin.c 25 Sep 2006 13:24:59 -0000 1.96 @@ -285,6 +285,9 @@ /* connection speed in bits/sec (0 = unknown) */ guint connection_speed; + /* indication if the pipeline is live */ + gboolean is_live; }; struct _GstPlayBinClass @@ -326,8 +329,11 @@ static gboolean gst_play_bin_send_event (GstElement * element, GstEvent * event); +static gboolean gst_play_bin_set_clock_func (GstElement * element, + GstClock * clock); static GstStateChangeReturn gst_play_bin_change_state (GstElement * element, GstStateChange transition); static void gst_play_bin_handle_message (GstBin * bin, GstMessage * message); static GstElementClass *parent_class; @@ -427,6 +433,7 @@ gstelement_klass->change_state = GST_DEBUG_FUNCPTR (gst_play_bin_change_state); gstelement_klass->send_event = GST_DEBUG_FUNCPTR (gst_play_bin_send_event); + gstelement_klass->set_clock = GST_DEBUG_FUNCPTR (gst_play_bin_set_clock_func); gstbin_klass->handle_message = GST_DEBUG_FUNCPTR (gst_play_bin_handle_message); @@ -518,7 +525,8 @@ } vis_bin = - GST_BIN (gst_object_get_parent (GST_OBJECT (play_bin->visualisation))); + GST_BIN_CAST (gst_object_get_parent (GST_OBJECT_CAST (play_bin-> + visualisation))); if (!GST_IS_BIN (vis_bin) || !GST_IS_PAD (tee_pad)) { goto beach; @@ -620,7 +628,7 @@ play_bin->video_sink = g_value_get_object (value); if (play_bin->video_sink != NULL) { gst_object_ref (play_bin->video_sink); - gst_object_sink (GST_OBJECT (play_bin->video_sink)); + gst_object_sink (GST_OBJECT_CAST (play_bin->video_sink)); } /* when changing the videosink, we just remove the * video pipeline from the cache so that it will be @@ -634,7 +642,7 @@ play_bin->audio_sink = g_value_get_object (value); if (play_bin->audio_sink != NULL) { gst_object_ref (play_bin->audio_sink); - gst_object_sink (GST_OBJECT (play_bin->audio_sink)); + gst_object_sink (GST_OBJECT_CAST (play_bin->audio_sink)); g_hash_table_remove (play_bin->cache, "abin"); break; @@ -647,7 +655,7 @@ /* Take ownership */ if (play_bin->pending_visualisation) { gst_object_ref (play_bin->pending_visualisation); - gst_object_sink (GST_OBJECT (play_bin->pending_visualisation)); + gst_object_sink (GST_OBJECT_CAST (play_bin->pending_visualisation)); } } else { play_bin->pending_visualisation = g_value_get_object (value); @@ -655,7 +663,7 @@ /* Was there a visualisation already set ? */ @@ -663,7 +671,7 @@ GstBin *vis_bin = NULL; vis_bin = - GST_BIN (gst_object_get_parent (GST_OBJECT (play_bin-> + GST_BIN_CAST (gst_object_get_parent (GST_OBJECT_CAST (play_bin-> visualisation))); /* Check if the visualisation is already in a bin */ @@ -798,8 +806,6 @@ * +----------|--------------------------------------------------+ * handoff */ -/* FIXME: this might return NULL if no videosink was found, handle - * this in callers */ static GstElement * gen_video_element (GstPlayBin * play_bin) { @@ -824,36 +830,38 @@ if (sink == NULL) { sink = gst_element_factory_make ("xvimagesink", "videosink"); } - /* FIXME: this warrants adding a CORE error category for missing - * elements/plugins */ - if (sink == NULL) { - GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN, - (_("Both autovideosink and xvimagesink elements are missing.")), - (NULL)); - return NULL; - } + if (sink == NULL) + goto no_sinks; gst_object_ref (sink); g_hash_table_insert (play_bin->cache, "video_sink", sink); - + /* create a bin to hold objects, as we create them we add them to this bin so + * that when something goes wrong we only need to unref the bin */ element = gst_bin_new ("vbin"); - identity = gst_element_factory_make ("identity", "id"); - g_object_set (identity, "silent", TRUE, NULL); - g_signal_connect (identity, "handoff", G_CALLBACK (handoff), play_bin); - gst_bin_add (GST_BIN (element), identity); + gst_bin_add (GST_BIN_CAST (element), sink); conv = gst_element_factory_make ("ffmpegcolorspace", "vconv"); if (conv == NULL) goto no_colorspace; + gst_bin_add (GST_BIN_CAST (element), conv); scale = gst_element_factory_make ("videoscale", "vscale"); if (scale == NULL) goto no_videoscale; - gst_bin_add (GST_BIN (element), conv); - gst_bin_add (GST_BIN (element), scale); - gst_bin_add (GST_BIN (element), sink); + gst_bin_add (GST_BIN_CAST (element), scale); + identity = gst_element_factory_make ("identity", "id"); + g_object_set (identity, "silent", TRUE, NULL); + g_signal_connect (identity, "handoff", G_CALLBACK (handoff), play_bin); + gst_bin_add (GST_BIN_CAST (element), identity); gst_element_link_pads (identity, "src", conv, "sink"); gst_element_link_pads (conv, "src", scale, "sink"); - gst_element_link_pads (scale, "src", sink, "sink"); + /* be more careful with the pad from the custom sink element, it might not + * be named 'sink' */ + if (!gst_element_link_pads (scale, "src", sink, NULL)) + goto link_failed; pad = gst_element_get_pad (identity, "sink"); gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad)); @@ -868,6 +876,16 @@ return element; + /* ERRORS */ +no_sinks: + { + /* FIXME: this warrants adding a CORE error category for missing + * elements/plugins */ + GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN, + (_("Both autovideosink and xvimagesink elements are missing.")), + (NULL)); + return NULL; + } no_colorspace: { GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN, @@ -885,6 +903,13 @@ gst_object_unref (element); return NULL; +link_failed: + GST_ELEMENT_ERROR (play_bin, CORE, PAD, + (NULL), ("Failed to configure the video sink.")); + gst_object_unref (element); } /* make an element for playback of video with subtitles embedded. @@ -897,28 +922,30 @@ * | +-----+ | +-------------+ +------+ | * text_sink-------------+ | * +--------------------------------------------------+ + * + * If there is no subtitle renderer this function will simply return the + * videosink without the text_sink pad. gen_text_element (GstPlayBin * play_bin) GstElement *element, *csp, *overlay, *vbin; GstPad *pad; - /* Create our bin */ - element = gst_bin_new ("textbin"); + /* Create the video rendering bin, error is posted when this fails. */ + vbin = gen_video_element (play_bin); + if (!vbin) /* Text overlay */ overlay = gst_element_factory_make ("textoverlay", "overlay"); - /* Create the video rendering bin */ - vbin = gen_video_element (play_bin); + /* If no overlay return the video bin without subtitle support. */ + if (!overlay) + goto no_overlay; - /* If no overlay return the video bin */ - if (!overlay) { - GST_WARNING ("No overlay (pango) element, subtitles disabled"); - return vbin; - } + /* Create our bin */ + element = gst_bin_new ("textbin"); /* Set some parameters */ g_object_set (G_OBJECT (overlay), @@ -928,13 +955,13 @@ /* Take a ref */ - play_bin->textoverlay_element = GST_ELEMENT (gst_object_ref (overlay)); + play_bin->textoverlay_element = GST_ELEMENT_CAST (gst_object_ref (overlay)); /* we know this will succeed, as the video bin already created one before */ csp = gst_element_factory_make ("ffmpegcolorspace", "subtitlecsp"); /* Add our elements */ - gst_bin_add_many (GST_BIN (element), csp, overlay, vbin, NULL); + gst_bin_add_many (GST_BIN_CAST (element), csp, overlay, vbin, NULL); /* Link */ gst_element_link_pads (csp, "src", overlay, "video_sink"); @@ -953,6 +980,14 @@ gst_element_set_state (element, GST_STATE_READY); +no_overlay: + GST_WARNING_OBJECT (play_bin, + "No overlay (pango) element, subtitles disabled"); + return vbin; /* make the element (bin) that contains the elements needed to perform @@ -966,11 +1001,11 @@ * | | +---------+ +----------+ +---------+ +---------+ | * sink-+ | * +-------------------------------------------------------------+ - * gen_audio_element (GstPlayBin * play_bin) + gboolean res; GstElement *element; GstElement *conv; GstElement *scale; @@ -979,21 +1014,8 @@ element = g_hash_table_lookup (play_bin->cache, "abin"); - if (element != NULL) { + if (element != NULL) return element; - element = gst_bin_new ("abin"); - conv = gst_element_factory_make ("audioconvert", "aconv"); - if (conv == NULL) - goto no_audioconvert; - scale = gst_element_factory_make ("audioresample", "aresample"); - if (scale == NULL) - goto no_audioresample; - volume = gst_element_factory_make ("volume", "volume"); - g_object_set (G_OBJECT (volume), "volume", play_bin->volume, NULL); - play_bin->volume_element = volume; if (play_bin->audio_sink) { sink = play_bin->audio_sink; @@ -1002,25 +1024,38 @@ sink = gst_element_factory_make ("alsasink", "audiosink"); - (_("Both autoaudiosink and alsasink elements are missing.")), (NULL)); - play_bin->audio_sink = GST_ELEMENT (gst_object_ref (sink)); + play_bin->audio_sink = GST_ELEMENT_CAST (gst_object_ref (sink)); g_hash_table_insert (play_bin->cache, "audio_sink", sink); - gst_bin_add (GST_BIN (element), volume); + element = gst_bin_new ("abin"); - gst_element_link_pads (conv, "src", scale, "sink"); - gst_element_link_pads (scale, "src", volume, "sink"); - gst_element_link_pads (volume, "src", sink, "sink"); + conv = gst_element_factory_make ("audioconvert", "aconv"); + if (conv == NULL) + goto no_audioconvert; + scale = gst_element_factory_make ("audioresample", "aresample"); + if (scale == NULL) + goto no_audioresample; + volume = gst_element_factory_make ("volume", "volume"); + g_object_set (G_OBJECT (volume), "volume", play_bin->volume, NULL); + play_bin->volume_element = volume; + gst_bin_add (GST_BIN_CAST (element), volume); + res = gst_element_link_pads (conv, "src", scale, "sink"); + res &= gst_element_link_pads (scale, "src", volume, "sink"); + res &= gst_element_link_pads (volume, "src", sink, NULL); + if (!res) pad = gst_element_get_pad (conv, "sink"); @@ -1035,6 +1070,13 @@ + (_("Both autoaudiosink and alsasink elements are missing.")), (NULL)); no_audioconvert: @@ -1052,6 +1094,13 @@ + (NULL), ("Failed to configure the audio sink.")); @@ -1080,6 +1129,7 @@ gen_vis_element (GstPlayBin * play_bin) GstElement *tee; GstElement *asink; @@ -1089,6 +1139,7 @@ GstElement *vqueue, *aqueue; GstPad *pad, *rpad; + /* errors are already posted when these fail. */ asink = gen_audio_element (play_bin); if (!asink) @@ -1104,29 +1155,32 @@ vqueue = gst_element_factory_make ("queue", "vqueue"); aqueue = gst_element_factory_make ("queue", "aqueue"); - gst_bin_add (GST_BIN (element), asink); - gst_bin_add (GST_BIN (element), vqueue); - gst_bin_add (GST_BIN (element), aqueue); - gst_bin_add (GST_BIN (element), vsink); - gst_bin_add (GST_BIN (element), tee); + gst_bin_add (GST_BIN_CAST (element), asink); + gst_bin_add (GST_BIN_CAST (element), vqueue); + gst_bin_add (GST_BIN_CAST (element), aqueue); + gst_bin_add (GST_BIN_CAST (element), vsink); + gst_bin_add (GST_BIN_CAST (element), tee); conv = gst_element_factory_make ("audioconvert", "aconv"); goto no_audioconvert; if (play_bin->visualisation) { gst_object_ref (play_bin->visualisation); vis = play_bin->visualisation; } else { vis = gst_element_factory_make ("goom", "vis"); + if (!vis) + goto no_goom; + gst_bin_add (GST_BIN_CAST (element), vis); - gst_bin_add (GST_BIN (element), vis); - gst_element_link_pads (vqueue, "src", conv, "sink"); - gst_element_link_pads (conv, "src", vis, "sink"); - gst_element_link_pads (vis, "src", vsink, "sink"); + res = gst_element_link_pads (vqueue, "src", conv, "sink"); + res &= gst_element_link_pads (conv, "src", vis, "sink"); + res &= gst_element_link_pads (vis, "src", vsink, "sink"); pad = gst_element_get_pad (aqueue, "sink"); rpad = gst_element_get_request_pad (tee, "src%d"); @@ -1147,6 +1201,7 @@ @@ -1155,6 +1210,21 @@ +no_goom: + (_("Missing element '%s' - check your GStreamer installation."), + "goom"), (NULL)); + (NULL), ("Failed to configure the visualisation element.")); /* get rid of all installed sinks */ @@ -1166,6 +1236,9 @@ GstPad *pad, *peer; + if (play_bin->cache == NULL) + return; GST_DEBUG ("removesinks"); if (element != NULL) { @@ -1176,7 +1249,7 @@ * is disposed */ play_bin->sinks = g_list_remove (play_bin->sinks, element); gst_element_set_state (element, GST_STATE_NULL); - gst_bin_remove (GST_BIN (parent), element); + gst_bin_remove (GST_BIN_CAST (parent), element); gst_object_unref (parent); pad = gst_element_get_pad (element, "sink"); @@ -1195,7 +1268,7 @@ if (parent != NULL) { @@ -1210,7 +1283,7 @@ for (sinks = play_bin->sinks; sinks; sinks = g_list_next (sinks)) { - GstElement *element = GST_ELEMENT (sinks->data); + GstElement *element = GST_ELEMENT_CAST (sinks->data); GstPad *pad; GstPad *peer; @@ -1226,16 +1299,21 @@ gst_object_unref (pad); gst_element_set_state (element, GST_STATE_NULL); - gst_bin_remove (GST_BIN (play_bin), element); + gst_bin_remove (GST_BIN_CAST (play_bin), element); g_list_free (play_bin->sinks); play_bin->sinks = NULL; - /* FIXME: this is probably some refcounting problem */ - if (play_bin->visualisation && GST_OBJECT_PARENT (play_bin->visualisation)) { + if (play_bin->visualisation) { + GstElement *vis_bin; + vis_bin = + GST_ELEMENT_CAST (gst_element_get_parent (play_bin->visualisation)); gst_element_set_state (play_bin->visualisation, GST_STATE_NULL); - gst_bin_remove (GST_BIN (GST_OBJECT_PARENT (play_bin->visualisation)), - play_bin->visualisation); + gst_bin_remove (GST_BIN_CAST (vis_bin), play_bin->visualisation); + gst_object_unref (vis_bin); if (play_bin->frame) { @@ -1257,6 +1335,8 @@ * Also make sure to only connect the first audio and video pad. FIXME * this should eventually be handled with a tuner interface so that * one can switch the streams. + * This function takes ownership of @sink.* static gboolean add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad, @@ -1266,8 +1346,17 @@ GstPadLinkReturn linkres; GstElement *parent; GstStateChangeReturn stateret; + GstState state; g_return_val_if_fail (sink != NULL, FALSE); + /* For live pipelines we need to add the bin in the same state as the + * parent so that it starts as soon as it is prerolled. */ + if (play_bin->is_live) + state = GST_STATE_PLAYING; + else + state = GST_STATE_PAUSED; /* this is only for debugging */ parent = gst_pad_get_parent_element (srcpad); if (parent) { @@ -1275,15 +1364,19 @@ GST_STATE (sink), GST_STATE (play_bin), GST_STATE (parent)); gst_object_unref (parent); + gst_bin_add (GST_BIN_CAST (play_bin), sink); + /* for live pipelines, disable the sync in the sinks until core handles this + * correctly. */ + gst_element_set_clock (sink, NULL); /* bring it to the PAUSED state so we can link to the peer without * breaking the flow */ - if ((stateret = gst_element_set_state (sink, GST_STATE_PAUSED)) == - GST_STATE_CHANGE_FAILURE) + stateret = gst_element_set_state (sink, state); + if (stateret == GST_STATE_CHANGE_FAILURE) goto state_failed; - gst_bin_add (GST_BIN (play_bin), sink); /* we found a sink for this stream, now try to install it */ sinkpad = gst_element_get_pad (sink, "sink"); linkres = gst_pad_link (srcpad, sinkpad); @@ -1299,11 +1392,12 @@ gst_object_unref (sinkpad); - /* try to link the subtitle pad of the sink to the stream */ - if (GST_PAD_LINK_FAILED (linkres)) { + /* try to link the subtitle pad of the sink to the stream, this is not + * fatal. */ + if (GST_PAD_LINK_FAILED (linkres)) goto subtitle_failed; +done: /* we got the sink succesfully linked, now keep the sink * in our internal list */ play_bin->sinks = g_list_prepend (play_bin->sinks, sink); @@ -1313,6 +1407,8 @@ /* ERRORS */ state_failed: + gst_element_set_state (sink, GST_STATE_NULL); + gst_bin_remove (GST_BIN_CAST (play_bin), sink); GST_DEBUG_OBJECT (play_bin, "state change failure when adding sink"); return FALSE; @@ -1331,7 +1427,7 @@ gst_caps_unref (caps); gst_element_set_state (sink, GST_STATE_NULL); - gst_bin_remove (GST_BIN (play_bin), sink); subtitle_failed: @@ -1348,7 +1444,8 @@ g_free (capsstr); - return TRUE; + /* not fatal */ + goto done; @@ -1399,6 +1496,7 @@ if (!sink) return FALSE; pad = gst_element_get_pad (group->type[GST_STREAM_TYPE_AUDIO - 1].preroll, "src"); res = add_sink (play_bin, sink, pad, NULL); @@ -1417,7 +1515,7 @@ "src"); /* This pad is from subtitle-bin, we need to create a ghost pad to have common grandparents */ - parent = gst_object_get_parent (GST_OBJECT (textsrcpad)); + parent = gst_object_get_parent (GST_OBJECT_CAST (textsrcpad)); if (!parent) { GST_WARNING_OBJECT (textsrcpad, "subtitle pad has no parent !"); gst_object_unref (textsrcpad); @@ -1450,7 +1548,7 @@ goto beach; - if (gst_element_add_pad (GST_ELEMENT (grandparent), ghost)) { + if (gst_element_add_pad (GST_ELEMENT_CAST (grandparent), ghost)) { gst_object_unref (textsrcpad); textsrcpad = gst_object_ref (ghost); } else { @@ -1476,16 +1574,15 @@ res = add_sink (play_bin, sink, pad, textsrcpad); - if (textsrcpad) { + if (textsrcpad) gst_object_unref (textsrcpad); /* remove the sinks now, pipeline get_state will now wait for the * sinks to preroll */ if (play_bin->fakesink) { gst_element_set_state (play_bin->fakesink, GST_STATE_NULL); - gst_bin_remove (GST_BIN (play_bin), play_bin->fakesink); + gst_bin_remove (GST_BIN_CAST (play_bin), play_bin->fakesink); play_bin->fakesink = NULL; @@ -1585,6 +1682,42 @@ return res; +/* Override the set_clock function, we don't want to set a clock on the sinks + * when we are live pipeline so that they don't synchronize until this is + * fixed in core. */ +static gboolean +gst_play_bin_set_clock_func (GstElement * element, GstClock * clock) +{ + GList *children; + GstBin *bin; + GstPlayBin *play_bin; + gboolean res = TRUE; + GstElement *asink, *vsink; + bin = GST_BIN (element); + play_bin = GST_PLAY_BIN (element); + asink = g_hash_table_lookup (play_bin->cache, "audio_sink"); + vsink = g_hash_table_lookup (play_bin->cache, "video_sink"); + GST_DEBUG_OBJECT (play_bin, "setting clock, is_live %d", play_bin->is_live); + GST_OBJECT_LOCK (bin); + if (element->clock != clock) { + for (children = bin->children; children; children = g_list_next (children)) { + GstElement *child = GST_ELEMENT (children->data); + if (play_bin->is_live && (child == asink || child == vsink)) + res &= gst_element_set_clock (child, NULL); + else + res &= gst_element_set_clock (child, clock); + } + GST_OBJECT_UNLOCK (bin); + return res; +} static void value_list_append_structure_list (GValue * list_val, GstStructure ** first, GList * structure_list) @@ -1698,7 +1831,7 @@ * ASYNC until we added the sinks */ if (!play_bin->fakesink) { play_bin->fakesink = gst_element_factory_make ("fakesink", "test"); - gst_bin_add (GST_BIN (play_bin), play_bin->fakesink); + gst_bin_add (GST_BIN_CAST (play_bin), play_bin->fakesink); default: @@ -1710,27 +1843,21 @@ return ret; switch (transition) { + case GST_STATE_CHANGE_READY_TO_PAUSED: + /* remember us being a live pipeline */ + play_bin->is_live = (ret == GST_STATE_CHANGE_NO_PREROLL); + GST_DEBUG_OBJECT (play_bin, "is live: %d", play_bin->is_live); + break; case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - /* Set audio sink state to NULL to release the sound device, - * but only if we own it (else we might be in chain-transition). */ - //if (play_bin->audio_sink != NULL && - // GST_STATE (play_bin->audio_sink) == GST_STATE_PAUSED) { - // gst_element_set_state (play_bin->audio_sink, GST_STATE_NULL); - //} + /* FIXME Release audio device when we implement that */ case GST_STATE_CHANGE_PAUSED_TO_READY: - /* Check for NULL because the state transition may be done by - * gst_bin_dispose which is called by gst_play_bin_dispose, and in that - * case, we don't want to run remove_sinks. - * FIXME: should the NULL test be done in remove_sinks? Should we just - * set the state to NULL in gst_play_bin_dispose? - */ - if (play_bin->cache != NULL) { - remove_sinks (play_bin); - } + /* remove sinks we added */ + remove_sinks (play_bin); + /* and there might be a fakesink we need to clean up now */ if (play_bin->fakesink) { gst_element_set_state (play_bin->fakesink, GST_STATE_NULL); - gst_bin_remove (GST_BIN (play_bin), play_bin->fakesink); + gst_bin_remove (GST_BIN_CAST (play_bin), play_bin->fakesink); play_bin->fakesink = NULL; |
From: <wt...@ke...> - 2006-09-25 15:47:41
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Mon Sep 25 2006 15:47:37 UTC Log message: * gst/playback/gstdecodebin.c: (gst_decode_bin_factory_filter), (add_fakesink), (remove_fakesink), (pad_probe), (close_pad_link), (is_demuxer_element), (try_to_link_1), (get_our_ghost_pad), (new_pad): Cleanups and small leak fixes. Added Depayloaders to valid list of autopluggable elements. Modified files: . : ChangeLog gst/playback : gstdecodebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2917&r2=1.2918 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c.diff?r1=1.77&r2=1.78 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2917 retrieving revision 1.2918 diff -u -d -r1.2917 -r1.2918 --- ChangeLog 25 Sep 2006 13:24:59 -0000 1.2917 +++ ChangeLog 25 Sep 2006 15:47:24 -0000 1.2918 @@ -1,5 +1,14 @@ 2006-09-25 Wim Taymans <wi...@fl...> + * gst/playback/gstdecodebin.c: (gst_decode_bin_factory_filter), + (add_fakesink), (remove_fakesink), (pad_probe), (close_pad_link), + (is_demuxer_element), (try_to_link_1), (get_our_ghost_pad), + (new_pad): + Cleanups and small leak fixes. + Added Depayloaders to valid list of autopluggable elements. + +2006-09-25 Wim Taymans <wi...@fl...> * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (gst_play_bin_vis_blocked), (gst_play_bin_set_property), (gen_video_element), (gen_text_element), (gen_audio_element), Index: gstdecodebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c,v retrieving revision 1.77 retrieving revision 1.78 diff -u -d -r1.77 -r1.78 --- gstdecodebin.c 13 Jul 2006 14:38:15 -0000 1.77 +++ gstdecodebin.c 25 Sep 2006 15:47:25 -0000 1.78 @@ -238,6 +238,8 @@ return decode_bin->dynamics != NULL; } /* the filter function for selecting the elements we can use in * autoplugging */ static gboolean @@ -254,7 +256,8 @@ klass = gst_element_factory_get_klass (GST_ELEMENT_FACTORY (feature)); /* only demuxers, decoders and parsers can play */ if (strstr (klass, "Demux") == NULL && - strstr (klass, "Decoder") == NULL && strstr (klass, "Parse") == NULL) { + strstr (klass, "Decoder") == NULL && strstr (klass, "Parse") == NULL && + strstr (klass, "Depayloader") == NULL) { return FALSE; } @@ -513,17 +516,28 @@ g_mutex_lock (decode_bin->cb_mutex); decode_bin->fakesink = gst_element_factory_make ("fakesink", "fakesink"); - if (!decode_bin->fakesink) { - g_warning ("can't find fakesink element, decodebin will not work"); - } else { - GST_OBJECT_FLAG_UNSET (decode_bin->fakesink, GST_ELEMENT_IS_SINK); - if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->fakesink)) { - g_warning ("Could not add fakesink element, decodebin will not work"); - gst_object_unref (decode_bin->fakesink); - decode_bin->fakesink = NULL; - } + if (!decode_bin->fakesink) + goto no_fakesink; + /* hacky, remove sink flag, we don't want our decodebin to become a sink + * just because we add a fakesink element to make us ASYNC */ + GST_OBJECT_FLAG_UNSET (decode_bin->fakesink, GST_ELEMENT_IS_SINK); + /* takes ownership */ + if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->fakesink)) { + g_warning ("Could not add fakesink element, decodebin will not work"); + gst_object_unref (decode_bin->fakesink); + decode_bin->fakesink = NULL; g_mutex_unlock (decode_bin->cb_mutex); + return; + /* ERRORS */ +no_fakesink: + { + g_warning ("can't find fakesink element, decodebin will not work"); + g_mutex_unlock (decode_bin->cb_mutex); + return; + } static void @@ -537,14 +551,10 @@ if (decode_bin->fakesink) { GST_DEBUG_OBJECT (decode_bin, "Removing fakesink and marking state dirty"); - gst_object_ref (decode_bin->fakesink); - gst_bin_remove (GST_BIN (decode_bin), decode_bin->fakesink); + /* setting the state to NULL is never async */ gst_element_set_state (decode_bin->fakesink, GST_STATE_NULL); - gst_element_get_state (decode_bin->fakesink, NULL, NULL, - GST_CLOCK_TIME_NONE); - - gst_object_unref (decode_bin->fakesink); + gst_bin_remove (GST_BIN (decode_bin), decode_bin->fakesink); decode_bin->fakesink = NULL; removed_fakesink = TRUE; @@ -559,6 +569,7 @@ +/* this should be implemented with _pad_block() */ pad_probe (GstPad * pad, GstMiniObject * data, GstDecodeBin * decode_bin) { @@ -577,6 +588,7 @@ ((GST_EVENT_TYPE (data) == GST_EVENT_EOS) || (GST_EVENT_TYPE (data) == GST_EVENT_TAG) || (GST_EVENT_TYPE (data) == GST_EVENT_FLUSH_START))) { + /* FIXME, what about NEWSEGMENT? really, use _pad_block()... */ if (!pdata->done) decode_bin->numwaiting--; pdata->done = TRUE; @@ -639,7 +651,8 @@ mimetype = gst_structure_get_name (structure); /* first see if this is raw. If the type is raw, we can - * create a ghostpad for this pad. */ + * create a ghostpad for this pad. It's possible that the caps are not + * fixed. */ if (mimetype_is_raw (mimetype)) { gchar *padname; GstPad *ghost; @@ -657,6 +670,7 @@ data->pad = pad; data->done = FALSE; + /* FIXME, use _pad_block() */ data->sigid = gst_pad_add_data_probe (pad, G_CALLBACK (pad_probe), decode_bin); decode_bin->numwaiting++; @@ -676,6 +690,8 @@ GList *to_try; /* if the caps has many types, we need to delay */ + /* FIXME, implement delay. Listen to the ::caps property change on the pad + * and continue to link. */ if (gst_caps_get_size (caps) != 1) goto many_types; @@ -686,6 +702,7 @@ goto unknown_type; if (try_to_link_1 (decode_bin, element, pad, to_try) == NULL) { + g_list_free (to_try); GST_LOG_OBJECT (pad, "none of the allegedly available elements usable"); } @@ -695,6 +712,7 @@ return; unknown_type: { GST_LOG_OBJECT (pad, "unkown type found, fire signal"); @@ -704,12 +722,18 @@ dont_know_yet: - GST_LOG_OBJECT (pad, "type is not known yet, waiting to close link"); + /* FIXME, actually wait */ + GST_LOG_OBJECT (pad, "type is not known yet, implement delayed linking"); + g_signal_emit (G_OBJECT (decode_bin), + gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps); return; many_types: - GST_LOG_OBJECT (pad, "many possible types, waiting to close link"); + GST_LOG_OBJECT (pad, "many possible types, implement delayed linking!"); @@ -721,7 +745,7 @@ GstElementFactory *srcfactory; GstElementClass *elemclass; - GList *templates, *walk; + GList *walk; const gchar *klass; gint potential_src_pads = 0; @@ -736,7 +760,7 @@ * might produce */ elemclass = GST_ELEMENT_GET_CLASS (srcelement); - walk = templates = gst_element_class_get_pad_template_list (elemclass); + walk = gst_element_class_get_pad_template_list (elemclass); while (walk != NULL) { GstPadTemplate *templ; @@ -839,7 +863,7 @@ GST_DEBUG_OBJECT (decode_bin, "adding %s", GST_OBJECT_NAME (element)); gst_bin_add (GST_BIN (decode_bin), element); - /* set to ready first so it is ready */ + /* set to READY first so it is ready, duh. */ gst_element_set_state (element, GST_STATE_READY); if ((ret = gst_pad_link (usedsrcpad, sinkpad)) != GST_PAD_LINK_OK) { @@ -851,13 +875,13 @@ * other elements, the element will be disposed. */ gst_element_set_state (element, GST_STATE_NULL); gst_bin_remove (GST_BIN (decode_bin), element); } else { guint sig; GST_DEBUG_OBJECT (decode_bin, "linked on pad %s:%s", GST_DEBUG_PAD_NAME (usedsrcpad)); + /* configure the queue some more */ if (queue != NULL) { decode_bin->queues = g_list_append (decode_bin->queues, queue); g_signal_connect (G_OBJECT (queue), @@ -920,31 +944,30 @@ return NULL; - pad_it = gst_element_iterate_pads (GST_ELEMENT (decode_bin)); + /* our ghostpads are the sourcepads */ + pad_it = gst_element_iterate_src_pads (GST_ELEMENT (decode_bin)); while (!done) { switch (gst_iterator_next (pad_it, (gpointer) & db_pad)) { case GST_ITERATOR_OK: GST_DEBUG_OBJECT (decode_bin, "looking at pad %s:%s", GST_DEBUG_PAD_NAME (db_pad)); - if (GST_IS_GHOST_PAD (db_pad) && GST_PAD_IS_SRC (db_pad)) { + if (GST_IS_GHOST_PAD (db_pad)) { GstPad *target_pad = NULL; target_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (db_pad)); + done = (target_pad == pad); + if (target_pad) + gst_object_unref (target_pad); - if (target_pad == pad) { /* Found our ghost pad */ + if (done) { + /* Found our ghost pad */ GST_DEBUG_OBJECT (decode_bin, "found ghostpad %s:%s for pad %s:%s", GST_DEBUG_PAD_NAME (db_pad), GST_DEBUG_PAD_NAME (pad)); - done = TRUE; break; - } else { /* Not the right one */ - gst_object_unref (db_pad); - db_pad = NULL; } - } else { - gst_object_unref (db_pad); - db_pad = NULL; } + /* Not the right one */ + gst_object_unref (db_pad); break; case GST_ITERATOR_RESYNC: gst_iterator_resync (pad_it); @@ -1173,12 +1196,15 @@ shutting_down1: - GST_OBJECT_UNLOCK (decode_bin); - return; + GST_OBJECT_UNLOCK (decode_bin); shutting_down2: - GST_STATE_UNLOCK (decode_bin); + GST_STATE_UNLOCK (decode_bin); /* this signal is fired when an element signals the no_more_pads signal. |
From: <wt...@ke...> - 2006-09-28 15:29:30
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Thu Sep 28 2006 15:29:29 UTC Log message: * gst/playback/gstdecodebin.c: (dynamic_create), (dynamic_free), (close_pad_link), (dynamic_remove), (no_more_pads), (new_caps), (find_dynamic), (unlinked), (close_link): Implement delayed caps linking needed for element with a lot of different caps on the src pads that get fixed at runtime. Improve management of dynamic elements. * gst/playback/gstplaybasebin.c: (gst_play_base_bin_init), (group_destroy), (group_commit), (check_queue), (queue_overrun), (gen_preroll_element), (remove_groups), (unknown_type), (add_element_stream), (no_more_pads_full), (no_more_pads), (sub_no_more_pads), (source_no_more_pads), (preroll_unlinked), (new_decoded_pad), (setup_subtitle), (array_has_value), (gen_source_element), (source_new_pad), (has_all_raw_caps), (analyse_source), (remove_decoders), (make_decoder), (remove_source), (setup_source), (finish_source), (prepare_output), (gst_play_base_bin_change_state): * gst/playback/gstplaybasebin.h: Use more _CAST instead of full type checking casts. Small cleanups, plug some leaks. Handle dynamic sources. Add some helper functions to create lists of strings used for blacklisting and other stuff. Refactor some code dealing with analysing the source. Re-enable sources without pads (like cd:// or other selfcontained elements). Modified files: . : ChangeLog gst/playback : gstdecodebin.c gstplaybasebin.c gstplaybasebin.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2931&r2=1.2932 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c.diff?r1=1.78&r2=1.79 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.119&r2=1.120 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.h.diff?r1=1.24&r2=1.25 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2931 retrieving revision 1.2932 diff -u -d -r1.2931 -r1.2932 --- ChangeLog 28 Sep 2006 15:08:15 -0000 1.2931 +++ ChangeLog 28 Sep 2006 15:29:17 -0000 1.2932 @@ -1,5 +1,34 @@ 2006-09-28 Wim Taymans <wi...@fl...> + * gst/playback/gstdecodebin.c: (dynamic_create), (dynamic_free), + (close_pad_link), (dynamic_remove), (no_more_pads), (new_caps), + (find_dynamic), (unlinked), (close_link): + Implement delayed caps linking needed for element with a lot of + different caps on the src pads that get fixed at runtime. + Improve management of dynamic elements. + + * gst/playback/gstplaybasebin.c: (gst_play_base_bin_init), + (group_destroy), (group_commit), (check_queue), (queue_overrun), + (gen_preroll_element), (remove_groups), (unknown_type), + (add_element_stream), (no_more_pads_full), (no_more_pads), + (sub_no_more_pads), (source_no_more_pads), (preroll_unlinked), + (new_decoded_pad), (setup_subtitle), (array_has_value), + (gen_source_element), (source_new_pad), (has_all_raw_caps), + (analyse_source), (remove_decoders), (make_decoder), + (remove_source), (setup_source), (finish_source), (prepare_output), + (gst_play_base_bin_change_state): + * gst/playback/gstplaybasebin.h: + Use more _CAST instead of full type checking casts. + Small cleanups, plug some leaks. + Handle dynamic sources. + Add some helper functions to create lists of strings used for + blacklisting and other stuff. + Refactor some code dealing with analysing the source. + Re-enable sources without pads (like cd:// or other selfcontained + elements). +2006-09-28 Wim Taymans <wi...@fl...> * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_render): When we have a timestamp, we can still perform clipping. Index: gstdecodebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- gstdecodebin.c 25 Sep 2006 15:47:25 -0000 1.78 +++ gstdecodebin.c 28 Sep 2006 15:29:17 -0000 1.79 @@ -111,11 +111,14 @@ * at runtime */ typedef struct { + GstDecodeBin *decode_bin; /* pointer to ourself */ + GstElement *element; /* the element sending the signal */ gint np_sig_id; /* signal id of new_pad */ - gint unlink_sig_id; /* signal id of unlinked */ gint nmp_sig_id; /* signal id of no_more_pads */ - GstElement *element; /* the element sending the signal */ - GstDecodeBin *decode_bin; /* pointer to ourself */ + GstPad *pad; /* the pad sending the signal */ + gint caps_sig_id; /* signal id of caps */ } GstDynamic; @@ -130,6 +133,7 @@ static void add_fakesink (GstDecodeBin * decode_bin); static void remove_fakesink (GstDecodeBin * decode_bin); +static void dynamic_free (GstDynamic * dyn); static void free_dynamics (GstDecodeBin * decode_bin); static void type_found (GstElement * typefind, guint probability, GstCaps * caps, GstDecodeBin * decode_bin); @@ -142,6 +146,7 @@ GstDecodeBin * decode_bin); static void new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic); static void no_more_pads (GstElement * element, GstDynamic * dynamic); +static void new_caps (GstPad * pad, GParamSpec * unused, GstDynamic * dynamic); static void queue_filled_cb (GstElement * queue, GstDecodeBin * decode_bin); static void queue_underrun_cb (GstElement * queue, GstDecodeBin * decode_bin); @@ -238,8 +243,6 @@ return decode_bin->dynamics != NULL; - /* the filter function for selecting the elements we can use in * autoplugging */ static gboolean @@ -351,8 +354,6 @@ decode_bin->probes = NULL; -static void dynamic_free (GstDynamic * dyn); static void gst_decode_bin_dispose (GObject * object) @@ -383,23 +384,33 @@ static GstDynamic * -dynamic_create (GstElement * element, GstDecodeBin * decode_bin) +dynamic_create (GstElement * element, GstPad * pad, GstDecodeBin * decode_bin) GstDynamic *dyn; GST_DEBUG_OBJECT (element, "dynamic create"); /* take refs */ - gst_object_ref (element); - gst_object_ref (decode_bin); dyn = g_new0 (GstDynamic, 1); dyn->element = element; - dyn->decode_bin = decode_bin; - dyn->np_sig_id = g_signal_connect (G_OBJECT (element), "pad-added", - G_CALLBACK (new_pad), dyn); - dyn->nmp_sig_id = g_signal_connect (G_OBJECT (element), "no-more-pads", - G_CALLBACK (no_more_pads), dyn); + dyn->pad = pad; + dyn->decode_bin = gst_object_ref (decode_bin); + if (element) { + gst_object_ref (element); + dyn->np_sig_id = g_signal_connect (G_OBJECT (element), "pad-added", + G_CALLBACK (new_pad), dyn); + dyn->nmp_sig_id = g_signal_connect (G_OBJECT (element), "no-more-pads", + G_CALLBACK (no_more_pads), dyn); + } + if (pad) { + gst_object_ref (pad); + dyn->caps_sig_id = g_signal_connect (G_OBJECT (pad), "notify::caps", + G_CALLBACK (new_caps), dyn); + /* and add this element to the dynamic elements */ + decode_bin->dynamics = g_list_prepend (decode_bin->dynamics, dyn); return dyn; @@ -410,13 +421,23 @@ GST_DEBUG_OBJECT (dyn->decode_bin, "dynamic free"); /* disconnect signals */ - g_signal_handler_disconnect (G_OBJECT (dyn->element), dyn->np_sig_id); - g_signal_handler_disconnect (G_OBJECT (dyn->element), dyn->nmp_sig_id); + if (dyn->np_sig_id) + g_signal_handler_disconnect (G_OBJECT (dyn->element), dyn->np_sig_id); + if (dyn->nmp_sig_id) + g_signal_handler_disconnect (G_OBJECT (dyn->element), dyn->nmp_sig_id); + if (dyn->caps_sig_id) + g_signal_handler_disconnect (G_OBJECT (dyn->pad), dyn->caps_sig_id); - gst_object_unref (dyn->element); - gst_object_unref (dyn->decode_bin); + if (dyn->pad) + gst_object_unref (dyn->pad); + dyn->pad = NULL; + if (dyn->element) + gst_object_unref (dyn->element); dyn->element = NULL; + gst_object_unref (dyn->decode_bin); dyn->decode_bin = NULL; g_free (dyn); @@ -732,8 +753,12 @@ { /* FIXME, actually wait */ GST_LOG_OBJECT (pad, "many possible types, implement delayed linking!"); - g_signal_emit (G_OBJECT (decode_bin), - gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps); + goto setup_caps_delay; +setup_caps_delay: + { + GST_LOG_OBJECT (pad, "many possible types, delay link"); + dynamic_create (element, pad, decode_bin); return; } @@ -1207,20 +1232,12 @@ -/* this signal is fired when an element signals the no_more_pads signal. - * This means that the element will not generate more dynamic pads and - * we can remove the element from the list of dynamic elements. When we - * have no more dynamic elements in the pipeline, we can fire a no_more_pads - * signal ourselves. */ -no_more_pads (GstElement * element, GstDynamic * dynamic) +dynamic_remove (GstDynamic * dynamic) GstDecodeBin *decode_bin = dynamic->decode_bin; - GST_DEBUG_OBJECT (decode_bin, "no more pads on element %s", - GST_ELEMENT_NAME (element)); - /* remove the element from the list of dynamic elements */ + /* remove the dynamic from the list of dynamics */ decode_bin->dynamics = g_list_remove (decode_bin->dynamics, dynamic); dynamic_free (dynamic); @@ -1240,6 +1257,34 @@ +/* this signal is fired when an element signals the no_more_pads signal. + * This means that the element will not generate more dynamic pads and + * we can remove the element from the list of dynamic elements. When we + * have no more dynamic elements in the pipeline, we can fire a no_more_pads + * signal ourselves. */ +static void +no_more_pads (GstElement * element, GstDynamic * dynamic) +{ + GstDecodeBin *decode_bin = dynamic->decode_bin; + GST_DEBUG_OBJECT (decode_bin, "no more pads on element %s", + GST_ELEMENT_NAME (element)); + dynamic_remove (dynamic); +} +new_caps (GstPad * pad, GParamSpec * unused, GstDynamic * dynamic) + g_print ("delayed link triggered\n"); + new_pad (dynamic->element, pad, dynamic); + /* assume it worked and remove the dynamic */ + return; is_our_kid (GstElement * e, GstDecodeBin * decode_bin) @@ -1255,6 +1300,12 @@ return ret; +static gint +find_dynamic (GstDynamic * dyn, GstElement * elem) + return (dyn->element == elem ? 0 : 1); /* This function will be called when a pad is disconnected for some reason */ unlinked (GstPad * pad, GstPad * peerpad, GstDecodeBin * decode_bin) @@ -1278,14 +1329,11 @@ remove_element_chain (decode_bin, peerpad); /* if an element removes two pads, then we don't want this twice */ - /* FIXME: decode_bin->dynamics doesn't contain a list of GstElements, it - * has GstDynamic structures */ - if (g_list_find (decode_bin->dynamics, element) != NULL) + if (g_list_find_custom (decode_bin->dynamics, element, + (GCompareFunc) find_dynamic) != NULL) goto exit; - dyn = dynamic_create (element, decode_bin); - /* and add this element to the dynamic elements */ - decode_bin->dynamics = g_list_prepend (decode_bin->dynamics, dyn); + dyn = dynamic_create (element, NULL, decode_bin); exit: gst_object_unref (element); @@ -1372,9 +1420,7 @@ /* ok, this element has dynamic pads, set up the signal handlers to be * notified of them */ - dyn = dynamic_create (element, decode_bin); - /* and add this element to the dynamic elements */ - decode_bin->dynamics = g_list_prepend (decode_bin->dynamics, dyn); + dyn = dynamic_create (element, NULL, decode_bin); /* Check if this is an element with more than 1 pad. If this element Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.119 retrieving revision 1.120 diff -u -d -r1.119 -r1.120 --- gstplaybasebin.c 23 Sep 2006 08:53:30 -0000 1.119 +++ gstplaybasebin.c 28 Sep 2006 15:29:17 -0000 1.120 @@ -67,13 +67,17 @@ const GValue * value, GParamSpec * spec); static void gst_play_base_bin_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * spec); static GstStateChangeReturn gst_play_base_bin_change_state (GstElement * element, GstStateChange transition); const GList *gst_play_base_bin_get_streaminfo (GstPlayBaseBin * play_base_bin); const GValueArray *gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin * play_base_bin); static void preroll_remove_overrun (GstElement * element, [...1023 lines suppressed...] remove_groups (play_base_bin); + remove_source (play_base_bin); break; default: @@ -2100,6 +2364,14 @@ return GST_STATE_CHANGE_FAILURE; +cleanup_groups: + /* clean up leftover groups */ + remove_groups (play_base_bin); + play_base_bin->need_rebuild = TRUE; + return GST_STATE_CHANGE_FAILURE; const GList * Index: gstplaybasebin.h RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- gstplaybasebin.h 15 Sep 2006 11:17:02 -0000 1.24 +++ gstplaybasebin.h 28 Sep 2006 15:29:17 -0000 1.25 @@ -79,7 +79,7 @@ gchar *uri, *suburi; gboolean is_stream; GstElement *source; - GstElement *decoder; + GSList *decoders; GstElement *subtitle; /* additional filesrc ! subparse bin */ gboolean subtitle_done; gboolean need_rebuild; @@ -93,6 +93,11 @@ GCond *group_cond; GstPlayBaseGroup *building_group; /* the group that we are constructing */ GList *queued_groups; /* the constructed groups, head is the active one */ + /* for dynamic sources */ + guint src_np_sig_id; /* new-pad signal id */ + guint src_nmp_sig_id; /* no-more-pads signal id */ + gint pending; }; struct _GstPlayBaseBinClass { |
From: <wt...@ke...> - 2006-09-29 13:47:01
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Fri Sep 29 2006 13:46:57 UTC Log message: * gst/playback/gstplaybasebin.c: (setup_subtitle), (gen_source_element): Handle invalid URIs a bit more gracefully. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2935&r2=1.2936 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.120&r2=1.121 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2935 retrieving revision 1.2936 diff -u -d -r1.2935 -r1.2936 --- ChangeLog 29 Sep 2006 12:54:28 -0000 1.2935 +++ ChangeLog 29 Sep 2006 13:46:44 -0000 1.2936 @@ -1,3 +1,9 @@ +2006-09-29 Wim Taymans <wi...@fl...> + + * gst/playback/gstplaybasebin.c: (setup_subtitle), + (gen_source_element): + Handle invalid URIs a bit more gracefully. 2006-09-29 Tim-Philipp Müller <tim at centricular dot net> * tests/check/pipelines/oggmux.c: Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.120 retrieving revision 1.121 diff -u -d -r1.120 -r1.121 --- gstplaybasebin.c 28 Sep 2006 15:29:17 -0000 1.120 +++ gstplaybasebin.c 29 Sep 2006 13:46:45 -0000 1.121 @@ -1293,9 +1293,13 @@ { GstElement *source, *subdecodebin, *subbin; + if (!gst_uri_is_valid (sub_uri)) + goto invalid_uri; source = gst_element_make_from_uri (GST_URI_SRC, sub_uri, NULL); if (!source) - return NULL; + goto unknown_uri; subdecodebin = gst_element_factory_make ("decodebin", "subtitle-decoder"); g_signal_connect (subdecodebin, "element-added", G_CALLBACK (decodebin_element_added_cb), play_base_bin); @@ -1308,6 +1312,28 @@ /* return the subtitle GstElement object */ return subbin; + /* WARNINGS */ +invalid_uri: + { + GST_ELEMENT_WARNING (play_base_bin, RESOURCE, NOT_FOUND, + (_("Invalid subtitle URI \"%s\", subtitles disabled."), sub_uri), + (NULL)); + return NULL; + } +unknown_uri: + gchar *prot = gst_uri_get_protocol (sub_uri); + if (prot) { + GST_ELEMENT_ERROR (play_base_bin, RESOURCE, FAILED, + (_("No URI handler implemented for \"%s\"."), prot), (NULL)); + g_free (prot); + } else + goto invalid_uri; } /* helper function to lookup stuff in lists */ @@ -1323,14 +1349,13 @@ return FALSE; -/* list of URIs that we consider to be streams. We have no mechanism yet to - * figure this out with a query. */ +/* list of URIs that we consider to be streams and that need buffering. + * We have no mechanism yet to figure this out with a query. */ static const gchar *stream_uris[] = { "http://", "mms://", "mmsh://", "mmsu://", "mmst://", NULL }; /* blacklisted URIs, we know they will always fail. */ -//static const gchar *blacklisted_uris[] = { "rtsp://", NULL }; static const gchar *blacklisted_uris[] = { NULL }; /* mime types that we don't consider to be media types */ @@ -1360,10 +1385,12 @@ if (!play_base_bin->uri) goto no_uri; + if (!gst_uri_is_valid (play_base_bin->uri)) if (IS_BLACKLISTED_URI (play_base_bin->uri)) goto uri_blacklisted; - /* strip subtitle from uri */ if (play_base_bin->suburi) { /* subtitle specified */ *subbin = setup_subtitle (play_base_bin, play_base_bin->suburi); @@ -1395,6 +1422,12 @@ (_("No URI specified to play from.")), (NULL)); return NULL; } + GST_ELEMENT_ERROR (play_base_bin, RESOURCE, NOT_FOUND, + (_("Invalid URI \"%s\"."), play_base_bin->uri), (NULL)); uri_blacklisted: { GST_ELEMENT_ERROR (play_base_bin, RESOURCE, FAILED, @@ -1403,19 +1436,17 @@ no_source: - gchar *prot; + gchar *prot = gst_uri_get_protocol (play_base_bin->uri); /* whoops, could not create the source element, dig a little deeper to * figure out what might be wrong. */ - prot = gst_uri_get_protocol (play_base_bin->uri); if (prot) { GST_ELEMENT_ERROR (play_base_bin, RESOURCE, FAILED, (_("No URI handler implemented for \"%s\"."), prot), (NULL)); g_free (prot); - } else { - GST_ELEMENT_ERROR (play_base_bin, RESOURCE, NOT_FOUND, - (_("Invalid URI \"%s\"."), play_base_bin->uri), (NULL)); - } |
From: <wt...@ke...> - 2006-09-29 16:04:20
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Fri Sep 29 2006 16:04:18 UTC Log message: * gst/playback/gstdecodebin.c: (new_caps): Remove g_print * gst/playback/gstplaybin.c: Add some docs. Modified files: . : ChangeLog gst/playback : gstdecodebin.c gstplaybin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2937&r2=1.2938 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c.diff?r1=1.79&r2=1.80 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c.diff?r1=1.97&r2=1.98 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2937 retrieving revision 1.2938 diff -u -d -r1.2937 -r1.2938 --- ChangeLog 29 Sep 2006 15:16:32 -0000 1.2937 +++ ChangeLog 29 Sep 2006 16:04:05 -0000 1.2938 @@ -1,3 +1,11 @@ +2006-09-29 Wim Taymans <wi...@fl...> + + * gst/playback/gstdecodebin.c: (new_caps): + Remove g_print + * gst/playback/gstplaybin.c: + Add some docs. 2006-09-29 Tim-Philipp Müller <tim at centricular dot net> * tests/check/Makefile.am: Index: gstdecodebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- gstdecodebin.c 28 Sep 2006 15:29:17 -0000 1.79 +++ gstdecodebin.c 29 Sep 2006 16:04:05 -0000 1.80 @@ -1276,7 +1276,8 @@ static void new_caps (GstPad * pad, GParamSpec * unused, GstDynamic * dynamic) { - g_print ("delayed link triggered\n"); + GST_DEBUG_OBJECT (dynamic->decode_bin, "delayed link triggered\n"); new_pad (dynamic->element, pad, dynamic); /* assume it worked and remove the dynamic */ Index: gstplaybin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c,v retrieving revision 1.97 retrieving revision 1.98 diff -u -d -r1.97 -r1.98 --- gstplaybin.c 28 Sep 2006 09:41:20 -0000 1.97 +++ gstplaybin.c 29 Sep 2006 16:04:05 -0000 1.98 @@ -181,6 +181,8 @@ * ... * } * </programlisting> + * Note that application should keep the pipeline in the PAUSED state when a + * GST_MESSAGE_BUFFERING message is received with a buffer-percent < 100. * </para> * <title>Embedding the video window in your application</title> * <para> |
From: <wt...@ke...> - 2006-09-29 17:35:14
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Fri Sep 29 2006 17:35:13 UTC Log message: * gst/playback/gstdecodebin.c: (no_more_pads): Fix compilation. Modified files: . : ChangeLog gst/playback : gstdecodebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2938&r2=1.2939 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c.diff?r1=1.80&r2=1.81 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2938 retrieving revision 1.2939 diff -u -d -r1.2938 -r1.2939 --- ChangeLog 29 Sep 2006 16:04:05 -0000 1.2938 +++ ChangeLog 29 Sep 2006 17:35:01 -0000 1.2939 @@ -1,5 +1,10 @@ 2006-09-29 Wim Taymans <wi...@fl...> + * gst/playback/gstdecodebin.c: (no_more_pads): + Fix compilation. + +2006-09-29 Wim Taymans <wi...@fl...> * gst/playback/gstdecodebin.c: (new_caps): Remove g_print Index: gstdecodebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -r1.80 -r1.81 --- gstdecodebin.c 29 Sep 2006 16:04:05 -0000 1.80 +++ gstdecodebin.c 29 Sep 2006 17:35:01 -0000 1.81 @@ -1265,9 +1265,7 @@ static void no_more_pads (GstElement * element, GstDynamic * dynamic) { - GstDecodeBin *decode_bin = dynamic->decode_bin; - - GST_DEBUG_OBJECT (decode_bin, "no more pads on element %s", + GST_DEBUG_OBJECT (dynamic->decode_bin, "no more pads on element %s", GST_ELEMENT_NAME (element)); dynamic_remove (dynamic); |
From: <wt...@ke...> - 2006-10-06 14:37:56
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Fri Oct 06 2006 14:37:55 UTC Log message: * gst/playback/gstdecodebin.c: (gst_decode_bin_init), (close_pad_link): * gst/playback/gstplaybasebin.c: (new_decoded_pad_full): Activate dynamic pads before adding them to the element. Modified files: . : ChangeLog gst/playback : gstdecodebin.c gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2951&r2=1.2952 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c.diff?r1=1.82&r2=1.83 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.123&r2=1.124 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2951 retrieving revision 1.2952 diff -u -d -r1.2951 -r1.2952 --- ChangeLog 6 Oct 2006 14:04:53 -0000 1.2951 +++ ChangeLog 6 Oct 2006 14:37:43 -0000 1.2952 @@ -1,3 +1,10 @@ +2006-10-06 Wim Taymans <wi...@fl...> + + * gst/playback/gstdecodebin.c: (gst_decode_bin_init), + (close_pad_link): + * gst/playback/gstplaybasebin.c: (new_decoded_pad_full): + Activate dynamic pads before adding them to the element. 2006-10-06 Michael Smith <ms...@fl...> * gst-libs/gst/floatcast/floatcast.h: Index: gstdecodebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c,v retrieving revision 1.82 retrieving revision 1.83 diff -u -d -r1.82 -r1.83 --- gstdecodebin.c 30 Sep 2006 15:30:07 -0000 1.82 +++ gstdecodebin.c 6 Oct 2006 14:37:43 -0000 1.83 @@ -323,7 +323,7 @@ if (!decode_bin->typefind) { g_warning ("can't find typefind element, decodebin will not work"); } else { - GstPad *pad; + GstPad *pad, *gpad; /* add the typefind element */ if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) { @@ -336,8 +336,9 @@ pad = gst_element_get_pad (decode_bin->typefind, "sink"); /* ghost the sink pad to ourself */ - gst_element_add_pad (GST_ELEMENT (decode_bin), - gst_ghost_pad_new ("sink", pad)); + gpad = gst_ghost_pad_new ("sink", pad); + gst_pad_set_active (gpad, TRUE); + gst_element_add_pad (GST_ELEMENT (decode_bin), gpad); gst_object_unref (pad); @@ -685,6 +686,7 @@ /* make it a ghostpad */ ghost = gst_ghost_pad_new (padname, pad); + gst_pad_set_active (ghost, TRUE); gst_element_add_pad (GST_ELEMENT (decode_bin), ghost); data = g_new0 (PadProbeData, 1); Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.123 retrieving revision 1.124 diff -u -d -r1.123 -r1.124 --- gstplaybasebin.c 5 Oct 2006 15:55:20 -0000 1.123 +++ gstplaybasebin.c 6 Oct 2006 14:37:43 -0000 1.124 @@ -1194,7 +1194,9 @@ } /* add to stream selector */ - sinkpad = gst_element_get_pad (group->type[type - 1].selector, "sink%d"); + sinkpad = + gst_element_get_request_pad (group->type[type - 1].selector, "sink%d"); /* make sure we catch unlink signals */ sig = g_signal_connect (G_OBJECT (sinkpad), "unlinked", G_CALLBACK (preroll_unlinked), play_base_bin); @@ -1203,6 +1205,7 @@ /* Store a pointer to the stream selector pad for this stream */ g_object_set_data (G_OBJECT (pad), "pb_sel_pad", sinkpad); + gst_pad_set_active (sinkpad, TRUE); gst_pad_link (pad, sinkpad); gst_object_unref (sinkpad); |
From: <wt...@ke...> - 2006-11-28 10:45:54
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Tue Nov 28 2006 10:45:53 UTC Log message: * gst/playback/gstplaybasebin.c: (setup_source), (gst_play_base_bin_change_state): Disable rtsp:// uris for the release, it's not good enough yet. Remove unused var. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3032&r2=1.3033 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.128&r2=1.129 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3032 retrieving revision 1.3033 diff -u -d -r1.3032 -r1.3033 --- ChangeLog 26 Nov 2006 16:39:41 -0000 1.3032 +++ ChangeLog 28 Nov 2006 10:45:40 -0000 1.3033 @@ -1,3 +1,10 @@ +2006-11-28 Wim Taymans <wi...@fl...> + + * gst/playback/gstplaybasebin.c: (setup_source), + (gst_play_base_bin_change_state): + Disable rtsp:// uris for the release, it's not good enough yet. + Remove unused var. 2006-11-26 Wim Taymans <wi...@fl...> * ext/theora/theoradec.c: (gst_theora_dec_reset), Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.128 retrieving revision 1.129 diff -u -d -r1.128 -r1.129 --- gstplaybasebin.c 18 Oct 2006 12:57:54 -0000 1.128 +++ gstplaybasebin.c 28 Nov 2006 10:45:40 -0000 1.129 @@ -1373,7 +1373,7 @@ }; /* blacklisted URIs, we know they will always fail. */ -static const gchar *blacklisted_uris[] = { NULL }; +static const gchar *blacklisted_uris[] = { "rtsp://", NULL }; /* mime types that we don't consider to be media types */ static const gchar *no_media_mimes[] = { @@ -1808,7 +1808,7 @@ * all the streams or until a preroll queue has been filled. */ static gboolean -setup_source (GstPlayBaseBin * play_base_bin, gchar ** new_location) +setup_source (GstPlayBaseBin * play_base_bin) { GstElement *subbin = NULL; gboolean is_raw, have_out, is_dynamic; @@ -2414,13 +2414,12 @@ GstStateChangeReturn ret; GstPlayBaseBin *play_base_bin; - gchar *new_location = NULL; play_base_bin = GST_PLAY_BASE_BIN (element); switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: - if (!setup_source (play_base_bin, &new_location)) + if (!setup_source (play_base_bin)) goto source_failed; break; default: |
From: <wt...@ke...> - 2006-11-28 16:22:16
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Tue Nov 28 2006 16:21:39 UTC Log message: * gst/playback/gstplaybasebin.c: (check_queue_event), (queue_threshold_reached), (queue_out_of_data), (gen_preroll_element): Add event probe to see when EOS is in a queue and we can disable the underrun signals. Fixes #357577. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3034&r2=1.3035 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.130&r2=1.131 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3034 retrieving revision 1.3035 diff -u -d -r1.3034 -r1.3035 --- ChangeLog 28 Nov 2006 14:40:36 -0000 1.3034 +++ ChangeLog 28 Nov 2006 16:21:27 -0000 1.3035 @@ -1,3 +1,11 @@ +2006-11-28 Wim Taymans <wi...@fl...> + + * gst/playback/gstplaybasebin.c: (check_queue_event), + (queue_threshold_reached), (queue_out_of_data), + (gen_preroll_element): + Add event probe to see when EOS is in a queue and we can disable the + underrun signals. Fixes #357577. 2006-11-28 Edward Hervey <ed...@fl...> * gst/playback/Makefile.am: Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.130 retrieving revision 1.131 diff -u -d -r1.130 -r1.131 --- gstplaybasebin.c 28 Nov 2006 14:40:39 -0000 1.130 +++ gstplaybasebin.c 28 Nov 2006 16:21:27 -0000 1.131 @@ -494,6 +494,27 @@ } static gboolean +check_queue_event (GstPad * pad, GstEvent * event, gpointer user_data) +{ + GstElement *queue = GST_ELEMENT_CAST (user_data); + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_EOS: + GST_DEBUG ("EOS event, mark EOS"); + g_object_set_data (G_OBJECT (queue), "eos", "1"); + break; + case GST_EVENT_FLUSH_STOP: + GST_DEBUG ("FLUSH_STOP event, remove EOS"); + g_object_set_data (G_OBJECT (queue), "eos", NULL); + default: + GST_DEBUG ("uninteresting event"); + } + return TRUE; +} +static gboolean check_queue (GstPad * pad, GstBuffer * data, gpointer user_data) { GstElement *queue = GST_ELEMENT_CAST (user_data); @@ -600,10 +621,19 @@ g_signal_handlers_disconnect_by_func (queue, (gpointer) queue_threshold_reached, play_base_bin); - /* now place the limits at the low threshold. When we hit this limit, the - * underrun signal will be called. The underrun signal is always connected. */ - g_object_set (queue, "min-threshold-time", play_base_bin->queue_min_threshold, - NULL); + data = g_object_get_data (G_OBJECT (queue), "eos"); + if (data) { + GST_DEBUG_OBJECT (play_base_bin, "disable min threshold time, we are EOS"); + g_object_set (queue, "min-threshold-time", (guint64) 0, NULL); + } else { + /* now place the limits at the low threshold. When we hit this limit, the + * underrun signal will be called. The underrun signal is always connected. */ + GST_DEBUG_OBJECT (play_base_bin, + "setting min threshold time to %" G_GUINT64_FORMAT, + play_base_bin->queue_min_threshold); + g_object_set (queue, "min-threshold-time", + play_base_bin->queue_min_threshold, NULL); /* we remove the probe now because we don't need it anymore to give progress * about the buffering. */ @@ -643,6 +673,9 @@ * handler. */ g_signal_connect (G_OBJECT (queue), "running", G_CALLBACK (queue_threshold_reached), play_base_bin); + GST_DEBUG_OBJECT (play_base_bin, + "setting min threshold time to %" G_GUINT64_FORMAT, + (guint64) play_base_bin->queue_threshold); g_object_set (queue, "min-threshold-time", (guint64) play_base_bin->queue_threshold, NULL); @@ -759,15 +792,22 @@ g_signal_connect (G_OBJECT (preroll), "overrun", G_CALLBACK (queue_deadlock_check), play_base_bin); + /* attach pointer to playbasebin */ + g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin); /* give updates on queue size */ sinkpad = gst_element_get_pad (preroll, "sink"); id = 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); gst_object_unref (sinkpad); - g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin); g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id)); + /* catch eos and flush events so that we can ignore underruns */ + id = gst_pad_add_event_probe (sinkpad, G_CALLBACK (check_queue_event), + preroll); + g_object_set_data (G_OBJECT (preroll), "eos_probe", GINT_TO_POINTER (id)); /* When we connect this queue, it will start running and immediatly * fire an underrun. */ g_signal_connect (G_OBJECT (preroll), "underrun", @@ -776,8 +816,8 @@ queue_out_of_data (preroll, play_base_bin); } + /* listen for EOS so we can switch groups when one ended. */ preroll_pad = gst_element_get_pad (preroll, "src"); - /* listen for EOS */ gst_pad_add_event_probe (preroll_pad, G_CALLBACK (probe_triggered), info); gst_object_unref (preroll_pad); |
From: <wt...@ke...> - 2006-12-04 13:02:55
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Mon Dec 04 2006 13:02:49 UTC Log message: * gst/playback/gstdecodebin.c: (close_pad_link): Fix #382223, add more dynamic caps handling. Modified files: . : ChangeLog gst/playback : gstdecodebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3039&r2=1.3040 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c.diff?r1=1.85&r2=1.86 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3039 retrieving revision 1.3040 diff -u -d -r1.3039 -r1.3040 --- ChangeLog 1 Dec 2006 10:36:50 -0000 1.3039 +++ ChangeLog 4 Dec 2006 13:02:37 -0000 1.3040 @@ -1,3 +1,25 @@ +2006-12-04 Wim Taymans <wi...@fl...> + + * gst/playback/gstdecodebin.c: (close_pad_link): + Fix #382223, add more dynamic caps handling. + reviewed by: <delete if not using a buddy> + * gst-libs/gst/audio/gstringbuffer.h: + * gst-libs/gst/netbuffer/gstnetbuffer.c: (gst_netbuffer_init), + (gst_netaddress_set_ip4_interface), + (gst_netaddress_set_ip6_interface), (gst_netaddress_set_loopback), + (gst_netaddress_set_ttl), (gst_netaddress_get_ip4_interface), + (gst_netaddress_get_ip6_interface), (gst_netaddress_get_loopback), + (gst_netaddress_get_ttl): + * gst-libs/gst/netbuffer/gstnetbuffer.h: + * tests/examples/seek/seek.c: (end_scrub), (end_seek), (do_seek), + (seek_cb), (stop_seek), (rate_spinbutton_changed_cb): + * win32/common/config.h: 2006-12-01 Michael Smith <ms...@fl...> * gst/audiorate/gstaudiorate.c: (gst_audio_rate_chain): Index: gstdecodebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c,v retrieving revision 1.85 retrieving revision 1.86 diff -u -d -r1.85 -r1.86 --- gstdecodebin.c 17 Oct 2006 11:34:32 -0000 1.85 +++ gstdecodebin.c 4 Dec 2006 13:02:37 -0000 1.86 @@ -713,8 +713,6 @@ GList *to_try; /* if the caps has many types, we need to delay */ - /* FIXME, implement delay. Listen to the ::caps property change on the pad - * and continue to link. */ if (gst_caps_get_size (caps) != 1) goto many_types; @@ -745,21 +743,17 @@ } dont_know_yet: { - /* FIXME, actually wait */ - GST_LOG_OBJECT (pad, "type is not known yet, implement delayed linking"); - g_signal_emit (G_OBJECT (decode_bin), - gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps); - return; + GST_LOG_OBJECT (pad, "type is not known yet"); + goto setup_caps_delay; many_types: - GST_LOG_OBJECT (pad, "many possible types, implement delayed linking!"); + GST_LOG_OBJECT (pad, "many possible types"); goto setup_caps_delay; setup_caps_delay: - GST_LOG_OBJECT (pad, "many possible types, delay link"); + GST_LOG_OBJECT (pad, "setting up a delayed link"); dynamic_create (element, pad, decode_bin); return; |
From: <wt...@ke...> - 2007-01-10 16:08:35
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Wed Jan 10 2007 16:08:30 UTC Log message: * gst/playback/gstdecodebin.c: (dynamic_add), (close_pad_link), (is_demuxer_element), (new_caps): * gst/playback/gstplaybasebin.c: (source_new_pad): Fix the case where we try to ref a NULL element when we delay a link because of unfixed caps. Set the state of autoplugged decodebins to PAUSED. RTSP now works in playbin, we can remove it from the blacklist. Modified files: . : ChangeLog gst/playback : gstdecodebin.c gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3078&r2=1.3079 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c.diff?r1=1.89&r2=1.90 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.133&r2=1.134 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3078 retrieving revision 1.3079 diff -u -d -r1.3078 -r1.3079 --- ChangeLog 9 Jan 2007 14:33:24 -0000 1.3078 +++ ChangeLog 10 Jan 2007 16:08:18 -0000 1.3079 @@ -1,3 +1,13 @@ +2007-01-10 Wim Taymans <wi...@fl...> + + * gst/playback/gstdecodebin.c: (dynamic_add), (close_pad_link), + (is_demuxer_element), (new_caps): + * gst/playback/gstplaybasebin.c: (source_new_pad): + Fix the case where we try to ref a NULL element when we delay a link + because of unfixed caps. + Set the state of autoplugged decodebins to PAUSED. + RTSP now works in playbin, we can remove it from the blacklist. 2007-01-09 Tim-Philipp Müller <tim at centricular dot net> * gst/playback/Makefile.am: Index: gstdecodebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- gstdecodebin.c 16 Dec 2006 13:59:09 -0000 1.89 +++ gstdecodebin.c 10 Jan 2007 16:08:18 -0000 1.90 @@ -409,7 +409,7 @@ struct DynFind find_info; GList *found; - g_return_if_fail (element != NULL || pad != NULL); + g_return_if_fail (element != NULL); /* do a search that this entry doesn't already exist */ find_info.elem = element; @@ -421,25 +421,21 @@ /* take refs */ dyn = g_new0 (GstDynamic, 1); - dyn->element = element; - dyn->pad = pad; + dyn->element = gst_object_ref (element); dyn->decode_bin = gst_object_ref (decode_bin); - if (element) { + if (pad) { + dyn->pad = gst_object_ref (pad); + GST_DEBUG_OBJECT (decode_bin, "dynamic create for pad %" GST_PTR_FORMAT, + pad); + dyn->caps_sig_id = g_signal_connect (G_OBJECT (pad), "notify::caps", + G_CALLBACK (new_caps), dyn); + } else { GST_DEBUG_OBJECT (decode_bin, "dynamic create for element %" GST_PTR_FORMAT, element); - - gst_object_ref (element); dyn->np_sig_id = g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (new_pad), dyn); dyn->nmp_sig_id = g_signal_connect (G_OBJECT (element), "no-more-pads", G_CALLBACK (no_more_pads), dyn); - } else { - GST_DEBUG_OBJECT (decode_bin, "dynamic create for pad %" GST_PTR_FORMAT, - pad); - gst_object_ref (pad); - dyn->caps_sig_id = g_signal_connect (G_OBJECT (pad), "notify::caps", - G_CALLBACK (new_caps), dyn); } /* and add this element to the dynamic elements */ @@ -794,7 +790,7 @@ setup_caps_delay: { GST_LOG_OBJECT (pad, "setting up a delayed link"); - dynamic_add (NULL, pad, decode_bin); + dynamic_add (element, pad, decode_bin); return; } @@ -814,7 +810,7 @@ klass = gst_element_factory_get_klass (srcfactory); /* Can't be a demuxer unless it has Demux in the klass name */ - if (!strstr (klass, "Demux")) + if (klass == NULL || !strstr (klass, "Demux")) return FALSE; /* Walk the src pad templates and count how many the element @@ -1311,7 +1307,7 @@ static void new_caps (GstPad * pad, GParamSpec * unused, GstDynamic * dynamic) { - GST_DEBUG_OBJECT (dynamic->decode_bin, "delayed link triggered\n"); + GST_DEBUG_OBJECT (dynamic->decode_bin, "delayed link triggered"); new_pad (dynamic->element, pad, dynamic); Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.133 retrieving revision 1.134 diff -u -d -r1.133 -r1.134 --- gstplaybasebin.c 9 Jan 2007 14:33:24 -0000 1.133 +++ gstplaybasebin.c 10 Jan 2007 16:08:18 -0000 1.134 @@ -1451,7 +1451,7 @@ }; /* blacklisted URIs, we know they will always fail. */ -static const gchar *blacklisted_uris[] = { "rtsp://", NULL }; +static const gchar *blacklisted_uris[] = { NULL }; /* mime types that we don't consider to be media types */ static const gchar *no_media_mimes[] = { @@ -1580,6 +1580,8 @@ if (!gst_element_link (bin->source, decoder)) goto could_not_link; + gst_element_set_state (decoder, GST_STATE_PAUSED); return; /* ERRORS */ |
From: <wt...@ke...> - 2007-01-25 16:03:04
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Thu Jan 25 2007 16:02:53 UTC Log message: * gst/playback/gstplaybasebin.c: (remove_source): Don't try to disconnect a signal from a finalized object. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3112&r2=1.3113 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.137&r2=1.138 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3112 retrieving revision 1.3113 diff -u -d -r1.3112 -r1.3113 --- ChangeLog 25 Jan 2007 14:29:21 -0000 1.3112 +++ ChangeLog 25 Jan 2007 16:02:41 -0000 1.3113 @@ -1,3 +1,8 @@ +2007-01-25 Wim Taymans <wi...@fl...> + + * gst/playback/gstplaybasebin.c: (remove_source): + Don't try to disconnect a signal from a finalized object. 2007-01-25 Tim-Philipp Müller <tim at centricular dot net> * gst/playback/gstdecodebin2.c: (gst_decode_bin_dispose): Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.137 retrieving revision 1.138 diff -u -d -r1.137 -r1.138 --- gstplaybasebin.c 19 Jan 2007 19:09:05 -0000 1.137 +++ gstplaybasebin.c 25 Jan 2007 16:02:41 -0000 1.138 @@ -1899,7 +1899,6 @@ if (source) { GST_DEBUG_OBJECT (bin, "removing old src element"); gst_element_set_state (source, GST_STATE_NULL); - gst_bin_remove (GST_BIN_CAST (bin), source); if (bin->src_np_sig_id) { g_signal_handler_disconnect (G_OBJECT (source), bin->src_np_sig_id); @@ -1909,6 +1908,7 @@ g_signal_handler_disconnect (G_OBJECT (source), bin->src_nmp_sig_id); bin->src_nmp_sig_id = 0; } + gst_bin_remove (GST_BIN_CAST (bin), source); bin->source = NULL; } } |
From: <wt...@ke...> - 2007-02-28 15:17:44
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Wed Feb 28 2007 15:17:33 UTC Log message: Patch by: Ed Catmur <ed at catmur dot co dot uk> * gst/playback/gstplaybin.c: (gst_play_bin_vis_unblocked), (gst_play_bin_vis_blocked), (gst_play_bin_set_property): Fix race condition when rapidly switching visualisations in playbin. Fixes #401029. Modified files: . : ChangeLog gst/playback : gstplaybin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3180&r2=1.3181 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c.diff?r1=1.105&r2=1.106 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3180 retrieving revision 1.3181 diff -u -d -r1.3180 -r1.3181 --- ChangeLog 28 Feb 2007 15:11:58 -0000 1.3180 +++ ChangeLog 28 Feb 2007 15:17:20 -0000 1.3181 @@ -1,3 +1,12 @@ +2007-02-28 Wim Taymans <wi...@fl...> + + Patch by: Ed Catmur <ed at catmur dot co dot uk> + * gst/playback/gstplaybin.c: (gst_play_bin_vis_unblocked), + (gst_play_bin_vis_blocked), (gst_play_bin_set_property): + Fix race condition when rapidly switching visualisations in playbin. + Fixes #401029. 2007-02-28 Jan Schmidt <th...@ma...> * tests/check/Makefile.am: Index: gstplaybin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c,v retrieving revision 1.105 retrieving revision 1.106 diff -u -d -r1.105 -r1.106 --- gstplaybin.c 23 Feb 2007 18:49:29 -0000 1.105 +++ gstplaybin.c 28 Feb 2007 15:17:20 -0000 1.106 @@ -513,7 +513,11 @@ gst_play_bin_vis_unblocked (GstPad * tee_pad, gboolean blocked, gpointer user_data) { - /* Unblocked */ + GstPlayBin *play_bin = GST_PLAY_BIN (user_data); + if (play_bin->pending_visualisation) + gst_pad_set_blocked_async (tee_pad, FALSE, gst_play_bin_vis_unblocked, + play_bin); } static void @@ -524,9 +528,15 @@ GstBin *vis_bin = NULL; GstPad *vis_sink_pad = NULL, *vis_src_pad = NULL, *vqueue_pad = NULL; GstState bin_state; + GstElement *pending_visualisation; + GST_OBJECT_LOCK (play_bin); + pending_visualisation = play_bin->pending_visualisation; + play_bin->pending_visualisation = NULL; + GST_OBJECT_UNLOCK (play_bin); /* We want to disable visualisation */ - if (!GST_IS_ELEMENT (play_bin->pending_visualisation)) { + if (!GST_IS_ELEMENT (pending_visualisation)) { /* Set visualisation element to READY */ gst_element_set_state (play_bin->visualisation, GST_STATE_READY); goto beach; @@ -575,17 +585,16 @@ /* And loose our ref */ gst_object_unref (play_bin->visualisation); - if (play_bin->pending_visualisation) { + if (pending_visualisation) { /* Ref this new visualisation element before adding to the bin */ - gst_object_ref (play_bin->pending_visualisation); + gst_object_ref (pending_visualisation); /* Add the new one */ - gst_bin_add (vis_bin, play_bin->pending_visualisation); + gst_bin_add (vis_bin, pending_visualisation); /* Synchronizing state */ - gst_element_set_state (play_bin->pending_visualisation, bin_state); + gst_element_set_state (pending_visualisation, bin_state); - vis_sink_pad = gst_element_get_pad (play_bin->pending_visualisation, - "sink"); - vis_src_pad = gst_element_get_pad (play_bin->pending_visualisation, "src"); + vis_sink_pad = gst_element_get_pad (pending_visualisation, "sink"); + vis_src_pad = gst_element_get_pad (pending_visualisation, "src"); if (!GST_IS_PAD (vis_sink_pad) || !GST_IS_PAD (vis_src_pad)) { goto beach; @@ -598,8 +607,7 @@ /* We are done */ - play_bin->visualisation = play_bin->pending_visualisation; - play_bin->pending_visualisation = NULL; + play_bin->visualisation = pending_visualisation; beach: if (vis_sink_pad) { @@ -656,24 +664,23 @@ break; case ARG_VIS_PLUGIN: { + GstElement *pending_visualisation = + GST_ELEMENT_CAST (g_value_get_object (value)); + /* Take ownership */ + if (pending_visualisation) { + gst_object_ref (pending_visualisation); + gst_object_sink (pending_visualisation); + } /* Do we already have a visualisation change pending ? */ + GST_OBJECT_LOCK (play_bin); if (play_bin->pending_visualisation) { gst_object_unref (play_bin->pending_visualisation); - play_bin->pending_visualisation = g_value_get_object (value); - /* Take ownership */ - if (play_bin->pending_visualisation) { - gst_object_ref (play_bin->pending_visualisation); - gst_object_sink (GST_OBJECT_CAST (play_bin->pending_visualisation)); - } + play_bin->pending_visualisation = pending_visualisation; + GST_OBJECT_UNLOCK (play_bin); } else { - /* Was there a visualisation already set ? */ if (play_bin->visualisation != NULL) { GstBin *vis_bin = NULL; @@ -697,6 +704,7 @@ goto beach; } + play_bin->pending_visualisation = pending_visualisation; /* Block with callback */ gst_pad_set_blocked_async (tee_pad, TRUE, gst_play_bin_vis_blocked, play_bin); @@ -709,12 +717,10 @@ gst_object_unref (vis_bin); } else { - play_bin->visualisation = play_bin->pending_visualisation; - play_bin->pending_visualisation = NULL; + play_bin->visualisation = pending_visualisation; } } else { - play_bin->visualisation = play_bin->pending_visualisation; - play_bin->pending_visualisation = NULL; + play_bin->visualisation = pending_visualisation; } } |
From: <wt...@ke...> - 2007-03-19 10:53:06
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Mon Mar 19 2007 10:53:02 UTC Log message: * gst/playback/gstdecodebin.c: (remove_fakesink): Don't post STATE_DIRTY anymore. * gst/playback/gstplaybin.c: (add_sink), (gst_play_bin_send_event), (gst_play_bin_change_state): Remove stream_time reset in seek handling, core does that now. Disable clocking for live pipelines by forcing a NULL clock to the complete pipeline, core is too smart now for our previous hack. We can always autoplug in PAUSED now. Modified files: . : ChangeLog gst/playback : gstdecodebin.c gstplaybin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3225&r2=1.3226 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c.diff?r1=1.93&r2=1.94 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c.diff?r1=1.107&r2=1.108 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3225 retrieving revision 1.3226 diff -u -d -r1.3225 -r1.3226 --- ChangeLog 18 Mar 2007 03:14:01 -0000 1.3225 +++ ChangeLog 19 Mar 2007 10:52:50 -0000 1.3226 @@ -1,3 +1,15 @@ +2007-03-19 Wim Taymans <wi...@fl...> + + * gst/playback/gstdecodebin.c: (remove_fakesink): + Don't post STATE_DIRTY anymore. + * gst/playback/gstplaybin.c: (add_sink), (gst_play_bin_send_event), + (gst_play_bin_change_state): + Remove stream_time reset in seek handling, core does that now. + Disable clocking for live pipelines by forcing a NULL clock to the + complete pipeline, core is too smart now for our previous hack. + We can always autoplug in PAUSED now. 2007-03-17 David Schleef <ds...@sc...> * REQUIREMENTS: Update this file, change the formatting to make Index: gstdecodebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin.c,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- gstdecodebin.c 4 Mar 2007 23:39:50 -0000 1.93 +++ gstdecodebin.c 19 Mar 2007 10:52:50 -0000 1.94 @@ -622,9 +622,6 @@ if (removed_fakesink) { free_pad_probes (decode_bin); - - gst_element_post_message (GST_ELEMENT_CAST (decode_bin), - gst_message_new_state_dirty (GST_OBJECT_CAST (decode_bin))); } } Index: gstplaybin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c,v retrieving revision 1.107 retrieving revision 1.108 diff -u -d -r1.107 -r1.108 --- gstplaybin.c 4 Mar 2007 23:39:51 -0000 1.107 +++ gstplaybin.c 19 Mar 2007 10:52:50 -0000 1.108 @@ -1137,8 +1137,8 @@ * visualisation ouput. The idea is to split the audio using tee, then * sending the output to the regular audio bin and the other output to * the vis plugin that transforms it into a video that is rendered with the - * normal video bin. The video bin is run in a thread to make sure it does - * not block the audio playback pipeline. + * normal video bin. The video and audio bins are run in threads to make sure + * they don't block eachother. * * +-----------------------------------------------------------------------+ * | visbin | @@ -1154,7 +1154,7 @@ * | | | | | * | | +------+ | * sink-+ | - +------------------------------------------------------------------------+ + * +-----------------------------------------------------------------------+ */ static GstElement * gen_vis_element (GstPlayBin * play_bin) @@ -1407,12 +1407,7 @@ g_return_val_if_fail (sink != NULL, FALSE); - /* For live pipelines we need to add the bin in the same state as the - * parent so that it starts as soon as it is prerolled. */ - if (play_bin->is_live) - state = GST_STATE_PLAYING; - else - state = GST_STATE_PAUSED; + state = GST_STATE_PAUSED; /* this is only for debugging */ parent = gst_pad_get_parent_element (srcpad); @@ -1425,10 +1420,12 @@ /* for live pipelines, disable the sync in the sinks until core handles this * correctly. */ + if (play_bin->is_live) { + gst_pipeline_use_clock (GST_PIPELINE (play_bin), NULL); gst_element_set_clock (sink, NULL); + } - /* bring it to the PAUSED state so we can link to the peer without + /* bring it to the required state so we can link to the peer without * breaking the flow */ stateret = gst_element_set_state (sink, state); if (stateret == GST_STATE_CHANGE_FAILURE) @@ -1677,48 +1674,6 @@ return res; -static gboolean -do_playbin_seek (GstElement * element, GstEvent * event) -{ - gdouble rate; - GstSeekFlags flags; - gboolean flush; - gboolean was_playing = FALSE; - gboolean res; - gst_event_parse_seek (event, &rate, NULL, &flags, NULL, NULL, NULL, NULL); - flush = flags & GST_SEEK_FLAG_FLUSH; - if (flush) { - GstState state; - /* need to call _get_state() since a bin state is only updated - * with this call. */ - gst_element_get_state (element, &state, NULL, 0); - was_playing = state == GST_STATE_PLAYING; - if (was_playing) { - gst_element_set_state (element, GST_STATE_PAUSED); - gst_element_get_state (element, NULL, NULL, 50 * GST_MSECOND); - } - } - GST_DEBUG_OBJECT (element, "Sending seek event to a sink"); - res = gst_play_bin_send_event_to_sink (GST_PLAY_BIN (element), event); - /* need to reset the stream time to 0 after a flushing seek */ - if (res) - gst_pipeline_set_new_stream_time (GST_PIPELINE (element), 0); - if (was_playing) - /* and continue playing */ - gst_element_set_state (element, GST_STATE_PLAYING); - return res; -} /* We only want to send the event to a single sink (overriding GstBin's * behaviour), but we want to keep GstPipeline's behaviour - wrapping seek * events appropriately. So, this is a messy duplication of code. */ @@ -1728,13 +1683,13 @@ gboolean res = FALSE; GstEventType event_type = GST_EVENT_TYPE (event); switch (event_type) { case GST_EVENT_SEEK: - res = do_playbin_seek (element, event); + GST_DEBUG_OBJECT (element, "Sending seek event to a sink"); + res = gst_play_bin_send_event_to_sink (GST_PLAY_BIN (element), event); break; default: - res = gst_play_bin_send_event_to_sink (GST_PLAY_BIN (element), event); + res = parent_class->send_event (element, event); @@ -1886,6 +1841,7 @@ switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: + gst_pipeline_auto_clock (GST_PIPELINE (play_bin)); /* this really is the easiest way to make the state change return * ASYNC until we added the sinks */ if (!play_bin->fakesink) { |
From: <wt...@ke...> - 2007-04-03 11:11:13
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Tue Apr 03 2007 11:11:04 UTC Log message: Patch by: Tommi Myöhänen <ext-tommi dot myohanen at nokia dot com> * gst/playback/gstdecodebin2.c: (connect_pad), (expose_pad), (deactivate_free_recursive): Decodebin2 doesn't unref pads it obtains in some occasions: - multiqueue src pads, when either connecting further or exposing - sink pads of new autoplugged elements - peer pads when recursively freeing elements Fixes #425455. Modified files: . : ChangeLog gst/playback : gstdecodebin2.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3249&r2=1.3250 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstdecodebin2.c.diff?r1=1.14&r2=1.15 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3249 retrieving revision 1.3250 diff -u -d -r1.3249 -r1.3250 --- ChangeLog 30 Mar 2007 17:05:23 -0000 1.3249 +++ ChangeLog 3 Apr 2007 11:10:52 -0000 1.3250 @@ -1,3 +1,15 @@ +2007-04-03 Wim Taymans <wi...@fl...> + + Patch by: Tommi Myöhänen <ext-tommi dot myohanen at nokia dot com> + * gst/playback/gstdecodebin2.c: (connect_pad), (expose_pad), + (deactivate_free_recursive): + Decodebin2 doesn't unref pads it obtains in some occasions: + - multiqueue src pads, when either connecting further or exposing + - sink pads of new autoplugged elements + - peer pads when recursively freeing elements + Fixes #425455. 2007-03-30 Sebastian Dröge <sl...@ci...> * gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps): Index: gstdecodebin2.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin2.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- gstdecodebin2.c 4 Mar 2007 23:39:50 -0000 1.14 +++ gstdecodebin2.c 3 Apr 2007 11:10:52 -0000 1.15 @@ -835,6 +835,7 @@ { gboolean res = FALSE; GList *tmp; + GstPad *mqpad = NULL; g_return_val_if_fail (factories != NULL, FALSE); GST_DEBUG_OBJECT (dbin, "pad %s:%s , group:%p", @@ -842,8 +843,6 @@ /* 1. is element demuxer or parser */ if (is_demuxer_element (src)) { - GstPad *mqpad; - GST_LOG_OBJECT (src, "is a demuxer, connecting the pad through multiqueue"); if (!group) @@ -908,7 +907,7 @@ gst_bin_remove (GST_BIN (dbin), element); continue; } + gst_object_unref (sinkpad); GST_LOG_OBJECT (dbin, "linked on pad %s:%s", GST_DEBUG_PAD_NAME (pad)); /* link this element further */ @@ -920,7 +919,6 @@ GST_WARNING_OBJECT (dbin, "Couldn't set %s to PAUSED", GST_ELEMENT_NAME (element)); gst_element_set_state (element, GST_STATE_NULL); - gst_object_unref (sinkpad); @@ -929,6 +927,9 @@ break; } + if (mqpad) + gst_object_unref (mqpad); beach: return res; } @@ -1058,6 +1059,7 @@ gboolean newgroup = FALSE; gboolean isdemux; GST_DEBUG_OBJECT (dbin, "pad %s:%s, group:%p", GST_DEBUG_PAD_NAME (pad), group); @@ -1074,8 +1076,6 @@ isdemux = is_demuxer_element (src); if (isdemux || newgroup) { if (!(mqpad = gst_decode_group_control_demuxer_pad (group, pad))) @@ -1091,6 +1091,9 @@ * group as being complete. */ gst_decode_group_set_complete (group); return; @@ -1823,7 +1826,10 @@ GstPad *peerpad = NULL; if ((peerpad = gst_pad_get_peer (pad))) { - GstObject *parent = gst_pad_get_parent (peerpad); + GstObject *parent; + parent = gst_pad_get_parent (peerpad); + gst_object_unref (peerpad); if (parent && GST_IS_ELEMENT (parent)) deactivate_free_recursive (group, GST_ELEMENT (parent)); |
From: <wt...@ke...> - 2007-04-05 10:27:24
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Thu Apr 05 2007 10:27:18 UTC Log message: Patch by: Tommi Myöhänen <ext-tommi dot myohanen at nokia dot com> * gst/playback/gstplaybasebin.c: (add_stream): Fix leak in add_stream(), when g_value_set_object() increases the refcount of streaminfo object. Fixes #426250. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3251&r2=1.3252 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.141&r2=1.142 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3251 retrieving revision 1.3252 diff -u -d -r1.3251 -r1.3252 --- ChangeLog 4 Apr 2007 02:45:02 -0000 1.3251 +++ ChangeLog 5 Apr 2007 10:27:06 -0000 1.3252 @@ -1,3 +1,11 @@ +2007-04-05 Wim Taymans <wi...@fl...> + + Patch by: Tommi Myöhänen <ext-tommi dot myohanen at nokia dot com> + * gst/playback/gstplaybasebin.c: (add_stream): + Fix leak in add_stream(), when g_value_set_object() increases the + refcount of streaminfo object. Fixes #426250. 2007-04-03 David Schleef <ds...@sc...> * gst/videotestsrc/gstvideotestsrc.c: Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.141 retrieving revision 1.142 diff -u -d -r1.141 -r1.142 --- gstplaybasebin.c 4 Mar 2007 23:39:51 -0000 1.141 +++ gstplaybasebin.c 5 Apr 2007 10:27:06 -0000 1.142 @@ -912,6 +912,7 @@ g_value_init (&v, G_TYPE_OBJECT); g_value_set_object (&v, info); g_value_array_append (group->streaminfo_value_array, &v); + g_value_unset (&v); group->streaminfo = g_list_append (group->streaminfo, info); if (info->type > 0 && info->type <= NUM_TYPES) { group->type[info->type - 1].npads++; |
From: <wt...@ke...> - 2007-04-06 12:58:24
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Fri Apr 06 2007 12:58:18 UTC Log message: * gst/playback/gstplaybin.c: (add_sink), (gst_play_bin_change_state): Activate sync in playbin, we are ready to handle it for live streams. Modified files: . : ChangeLog gst/playback : gstplaybin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3254&r2=1.3255 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c.diff?r1=1.110&r2=1.111 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3254 retrieving revision 1.3255 diff -u -d -r1.3254 -r1.3255 --- ChangeLog 6 Apr 2007 09:56:18 -0000 1.3254 +++ ChangeLog 6 Apr 2007 12:58:06 -0000 1.3255 @@ -1,3 +1,9 @@ +2007-04-06 Wim Taymans <wi...@fl...> + + * gst/playback/gstplaybin.c: (add_sink), + (gst_play_bin_change_state): + Activate sync in playbin, we are ready to handle it for live streams. 2007-04-06 Tim-Philipp Müller <tim at centricular dot net> * tests/check/elements/playbin.c: Index: gstplaybin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybin.c,v retrieving revision 1.110 retrieving revision 1.111 diff -u -d -r1.110 -r1.111 --- gstplaybin.c 22 Mar 2007 17:43:52 -0000 1.110 +++ gstplaybin.c 6 Apr 2007 12:58:06 -0000 1.111 @@ -1415,13 +1415,6 @@ } gst_bin_add (GST_BIN_CAST (play_bin), sink); - /* for live pipelines, disable the sync in the sinks until core handles this - * correctly. */ - if (play_bin->is_live) { - gst_pipeline_use_clock (GST_PIPELINE (play_bin), NULL); - gst_element_set_clock (sink, NULL); - } - /* bring it to the required state so we can link to the peer without * breaking the flow */ stateret = gst_element_set_state (sink, state); @@ -1798,7 +1791,6 @@ switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: - gst_pipeline_auto_clock (GST_PIPELINE (play_bin)); /* this really is the easiest way to make the state change return * ASYNC until we added the sinks */ if (!play_bin->fakesink) { |
From: <wt...@ke...> - 2007-05-10 15:28:33
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Thu May 10 2007 15:28:26 UTC Log message: * gst/playback/gstplaybasebin.c: (fill_buffer), (check_queue), (queue_out_of_data): Connect to the new queue "pushing" signal instead of the broken "running" one. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3303&r2=1.3304 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.142&r2=1.143 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3303 retrieving revision 1.3304 diff -u -d -r1.3303 -r1.3304 --- ChangeLog 9 May 2007 21:17:40 -0000 1.3303 +++ ChangeLog 10 May 2007 15:28:13 -0000 1.3304 @@ -1,3 +1,10 @@ +2007-05-10 Wim Taymans <wi...@fl...> + + * gst/playback/gstplaybasebin.c: (fill_buffer), (check_queue), + (queue_out_of_data): + Connect to the new queue "pushing" signal instead of the broken + "running" one. 2007-05-09 Sebastien Moutte <seb...@mo...> * gst-libs/gst/rtp/gstbasertpaudiopayload.c: Index: gstplaybasebin.c RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.142 retrieving revision 1.143 diff -u -d -r1.142 -r1.143 --- gstplaybasebin.c 5 Apr 2007 10:27:06 -0000 1.142 +++ gstplaybasebin.c 10 May 2007 15:28:13 -0000 1.143 @@ -496,6 +496,7 @@ static inline void fill_buffer (GstPlayBaseBin * play_base_bin, gint percent) { + GST_DEBUG_OBJECT (play_base_bin, "buffering %d", percent); gst_element_post_message (GST_ELEMENT_CAST (play_base_bin), gst_message_new_buffering (GST_OBJECT_CAST (play_base_bin), percent)); } @@ -528,10 +529,12 @@ GstPlayBaseBin *play_base_bin = g_object_get_data (G_OBJECT (queue), "pbb"); guint64 level = 0; - GST_DEBUG ("check queue triggered"); + GST_DEBUG_OBJECT (queue, "check queue triggered"); g_object_get (G_OBJECT (queue), "current-level-time", &level, NULL); - GST_DEBUG ("Queue size: %" GST_TIME_FORMAT, GST_TIME_ARGS (level)); + GST_DEBUG_OBJECT (play_base_bin, "Queue size: %" GST_TIME_FORMAT, + GST_TIME_ARGS (level)); if (play_base_bin->queue_threshold > 0) { level = level * 99 / play_base_bin->queue_threshold; if (level > 99) @@ -678,7 +681,7 @@ * This signal could never be called because the queue max-size limits are set * too low. We take care of this possible deadlock in the the overrun signal * handler. */ - g_signal_connect (G_OBJECT (queue), "running", + g_signal_connect (G_OBJECT (queue), "pushing", G_CALLBACK (queue_threshold_reached), play_base_bin); GST_DEBUG_OBJECT (play_base_bin, "setting min threshold time to %" G_GUINT64_FORMAT, @@ -686,7 +689,7 @@ g_object_set (queue, "min-threshold-time", (guint64) play_base_bin->queue_threshold, NULL); - /* re-connect probe, this will five feedback about the percentage that we + /* re-connect probe, this will fire feedback about the percentage that we * buffered and is posted in the BUFFERING message. */ if (!g_object_get_data (G_OBJECT (queue), "probe")) { GstPad *sinkpad; |
From: <wt...@ke...> - 2007-05-17 11:58:03
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Thu May 17 2007 11:57:56 UTC Log message: * gst/playback/Makefile.am: * gst/playback/gstqueue2.c: (gst_queue_get_type), (gst_queue_class_init), (gst_queue_init), (gst_queue_finalize), (gst_queue_getcaps), (gst_queue_bufferalloc), (gst_queue_acceptcaps), (update_time_level), (apply_segment), (apply_buffer), (update_buffering), (reset_rate_timer), (update_rates), (gst_queue_locked_flush), (gst_queue_locked_enqueue), (gst_queue_locked_dequeue), (gst_queue_handle_sink_event), (gst_queue_is_empty), (gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one), (gst_queue_loop), (gst_queue_handle_src_event), (gst_queue_handle_src_query), (gst_queue_sink_activate_push), (gst_queue_src_activate_push), (gst_queue_change_state), (gst_queue_set_property), (gst_queue_get_property), (plugin_init): On our way to playbin2 this is the new network queue that does buffering all by itself using high and low watermarks. It can also measure up and downstream bandwidth to optimally size the queue. Modified files: . : ChangeLog gst/playback : Makefile.am Added files: gst/playback : gstqueue2.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3316&r2=1.3317 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/Makefile.am.diff?r1=1.15&r2=1.16 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstqueue2.c?rev=1.1&content-type=text/vnd.viewcvs-markup ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3316 retrieving revision 1.3317 diff -u -d -r1.3316 -r1.3317 --- ChangeLog 17 May 2007 11:16:13 -0000 1.3316 +++ ChangeLog 17 May 2007 11:57:43 -0000 1.3317 @@ -1,3 +1,23 @@ +2007-05-17 Wim Taymans <wi...@fl...> + + * gst/playback/Makefile.am: + * gst/playback/gstqueue2.c: (gst_queue_get_type), + (gst_queue_class_init), (gst_queue_init), (gst_queue_finalize), + (gst_queue_getcaps), (gst_queue_bufferalloc), + (gst_queue_acceptcaps), (update_time_level), (apply_segment), + (apply_buffer), (update_buffering), (reset_rate_timer), + (update_rates), (gst_queue_locked_flush), + (gst_queue_locked_enqueue), (gst_queue_locked_dequeue), + (gst_queue_handle_sink_event), (gst_queue_is_empty), + (gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one), + (gst_queue_loop), (gst_queue_handle_src_event), + (gst_queue_handle_src_query), (gst_queue_sink_activate_push), + (gst_queue_src_activate_push), (gst_queue_change_state), + (gst_queue_set_property), (gst_queue_get_property), (plugin_init): + On our way to playbin2 this is the new network queue that does buffering + all by itself using high and low watermarks. It can also measure up and + downstream bandwidth to optimally size the queue. 2007-05-17 Michael Smith <ms...@fl...> * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_do_seek): Index: Makefile.am RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/Makefile.am,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Makefile.am 4 Mar 2007 23:39:50 -0000 1.15 +++ Makefile.am 17 May 2007 11:57:44 -0000 1.16 @@ -7,7 +7,7 @@ plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ -plugin_LTLIBRARIES = libgstplaybin.la libgstdecodebin.la libgstdecodebin2.la +plugin_LTLIBRARIES = libgstplaybin.la libgstdecodebin.la libgstdecodebin2.la libgstqueue2.la libgstplaybin_la_SOURCES = \ gstplaybin.c \ @@ -38,6 +38,12 @@ $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \ $(GST_LIBS) +libgstqueue2_la_SOURCES = gstqueue2.c +nodist_libgstqueue2_la_SOURCES = $(built_sources) +libgstqueue2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) +libgstqueue2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstqueue2_la_LIBADD = $(GST_LIBS) noinst_HEADERS = \ gstplaybasebin.h \ gststreaminfo.h \ --- NEW FILE: gstqueue2.c --- /* GStreamer * Copyright (C) 1999,2000 Erik Walthinsen <om...@cs...> * 2000 Wim Taymans <wt...@ch...> * 2003 Colin Walters <cwa...@gn...> * 2005 Wim Taymans <wi...@fl...> * 2007 Wim Taymans <wi...@fl...> * * gstqueue2.c: * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. [...1339 lines suppressed...] plugin_init (GstPlugin * plugin) { GST_DEBUG_CATEGORY_INIT (queue_debug, "queue", 0, "queue element"); GST_DEBUG_CATEGORY_INIT (queue_dataflow, "queue_dataflow", 0, "dataflow inside the queue element"); #ifdef ENABLE_NLS GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, LOCALEDIR); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); #endif /* ENABLE_NLS */ return gst_element_register (plugin, "queue2", GST_RANK_NONE, GST_TYPE_QUEUE); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, "queue2", "Queue newer version", plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) |