Merge branch 'master' into 0.11
[platform/upstream/gstreamer.git] / gst / playback / gstplaybin2.c
index 41b3cd4..5c599c6 100644 (file)
  */
 
 /**
- * SECTION:element-playbin2
+ * SECTION:element-playbin
  *
- * Playbin2 provides a stand-alone everything-in-one abstraction for an
+ * Playbin provides a stand-alone everything-in-one abstraction for an
  * audio and/or video player.
  *
- * playbin2 is considered stable now. It is the prefered playback API now,
- * and replaces the old #playbin element, which is no longer supported.
- *
- * It can handle both audio and video files and features
+ * Playbin can handle both audio and video files and features
  * <itemizedlist>
  * <listitem>
  * automatic file type recognition and based on that automatic
@@ -60,8 +57,8 @@
  * <refsect2>
  * <title>Usage</title>
  * <para>
- * A playbin2 element can be created just like any other element using
- * gst_element_factory_make(). The file/URI to play should be set via the #GstPlayBin2:uri
+ * A playbin element can be created just like any other element using
+ * gst_element_factory_make(). The file/URI to play should be set via the #GstPlayBin:uri
  * property. This must be an absolute URI, relative file paths are not allowed.
  * Example URIs are file:///home/joe/movie.avi or http://www.joedoe.com/foo.ogg
  *
@@ -80,7 +77,7 @@
  * When playback has finished (an EOS message has been received on the bus)
  * or an error has occured (an ERROR message has been received on the bus) or
  * the user wants to play a different track, playbin should be set back to
- * READY or NULL state, then the #GstPlayBin2:uri property should be set to the
+ * READY or NULL state, then the #GstPlayBin:uri property should be set to the
  * new location and then playbin be set to PLAYING state again.
  *
  * Seeking can be done using gst_element_seek_simple() or gst_element_seek()
  * <title>Advanced Usage: specifying the audio and video sink</title>
  * <para>
  * By default, if no audio sink or video sink has been specified via the
- * #GstPlayBin2:audio-sink or #GstPlayBin2:video-sink property, playbin will use the autoaudiosink
+ * #GstPlayBin:audio-sink or #GstPlayBin:video-sink property, playbin will use the autoaudiosink
  * and autovideosink elements to find the first-best available output method.
  * This should work in most cases, but is not always desirable. Often either
  * the user or application might want to specify more explicitly what to use
  * If the application wants more control over how audio or video should be
  * output, it may create the audio/video sink elements itself (for example
  * using gst_element_factory_make()) and provide them to playbin using the
- * #GstPlayBin2:audio-sink or #GstPlayBin2:video-sink property.
+ * #GstPlayBin:audio-sink or #GstPlayBin:video-sink property.
  *
  * GNOME-based applications, for example, will usually want to create
  * gconfaudiosink and gconfvideosink elements and make playbin use those,
@@ -266,6 +263,7 @@ struct _GstSourceSelect
                                  */
   GstEvent *sinkpad_delayed_event;
   gulong sinkpad_data_probe;
+  gulong block_id;
 };
 
 #define GST_SOURCE_GROUP_GET_LOCK(group) (((GstSourceGroup*)(group))->lock)
@@ -324,6 +322,8 @@ struct _GstSourceGroup
   gulong sub_no_more_pads_id;
   gulong sub_autoplug_continue_id;
 
+  gulong block_id;
+
   GMutex *stream_changed_pending_lock;
   GList *stream_changed_pending;
 
@@ -356,7 +356,7 @@ G_STMT_START {                                          \
   GST_PLAY_BIN_DYN_UNLOCK (bin);                  \
 
 /**
- * GstPlayBin2:
+ * GstPlayBin:
  *
  * playbin element structure
  */
@@ -557,8 +557,8 @@ static void no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group);
 static void pad_removed_cb (GstElement * decodebin, GstPad * pad,
     GstSourceGroup * group);
 
-static void gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
-    gboolean block);
+static void gst_play_bin_suburidecodebin_block (GstSourceGroup * group,
+    GstElement * suburidecodebin, gboolean block);
 static void gst_play_bin_suburidecodebin_seek_to_start (GstElement *
     suburidecodebin);
 
@@ -595,7 +595,7 @@ gst_play_bin_get_type (void)
     };
 
     gst_play_bin_type = g_type_register_static (GST_TYPE_PIPELINE,
-        "GstPlayBin2", &gst_play_bin_info, 0);
+        "GstPlayBin", &gst_play_bin_info, 0);
 
     g_type_add_interface_static (gst_play_bin_type, GST_TYPE_STREAM_VOLUME,
         &svol_info);
@@ -623,7 +623,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
   gobject_klass->finalize = gst_play_bin_finalize;
 
   /**
-   * GstPlayBin2:uri
+   * GstPlayBin:uri
    *
    * Set the next URI that playbin will play. This property can be set from the
    * about-to-finish signal to queue the next media file.
@@ -633,7 +633,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:suburi
+   * GstPlayBin:suburi
    *
    * Set the next subtitle URI that playbin will play. This property can be
    * set from the about-to-finish signal to queue the next subtitle media file.
@@ -647,7 +647,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           GST_TYPE_ELEMENT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:flags
+   * GstPlayBin:flags
    *
    * Control the behaviour of playbin.
    */
@@ -657,7 +657,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:n-video
+   * GstPlayBin:n-video
    *
    * Get the total number of available video streams.
    */
@@ -666,7 +666,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Total number of video streams", 0, G_MAXINT, 0,
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:current-video
+   * GstPlayBin:current-video
    *
    * Get or set the currently playing video stream. By default the first video
    * stream with data is played.
@@ -676,7 +676,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Currently playing video stream (-1 = auto)",
           -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:n-audio
+   * GstPlayBin:n-audio
    *
    * Get the total number of available audio streams.
    */
@@ -685,7 +685,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Total number of audio streams", 0, G_MAXINT, 0,
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:current-audio
+   * GstPlayBin:current-audio
    *
    * Get or set the currently playing audio stream. By default the first audio
    * stream with data is played.
@@ -695,7 +695,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Currently playing audio stream (-1 = auto)",
           -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:n-text
+   * GstPlayBin:n-text
    *
    * Get the total number of available subtitle streams.
    */
@@ -704,7 +704,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           "Total number of text streams", 0, G_MAXINT, 0,
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:current-text:
+   * GstPlayBin:current-text:
    *
    * Get or set the currently playing subtitle stream. By default the first
    * subtitle stream with data is played.
@@ -740,7 +740,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:volume:
+   * GstPlayBin:volume:
    *
    * Get or set the current audio stream volume. 1.0 means 100%,
    * 0.0 means mute. This uses a linear volume scale.
@@ -756,14 +756,14 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:frame:
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin:frame:
+   * @playbin: a #GstPlayBin
    *
    * Get the currently rendered or prerolled frame in the video sink.
    * The #GstCaps on the buffer will describe the format of the buffer.
    */
   g_object_class_install_property (gobject_klass, PROP_FRAME,
-      gst_param_spec_mini_object ("frame", "Frame",
+      g_param_spec_boxed ("frame", "Frame",
           "The last frame (NULL = no video available)",
           GST_TYPE_BUFFER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_klass, PROP_FONT_DESC,
@@ -790,7 +790,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           -1, G_MAXINT64, DEFAULT_BUFFER_DURATION,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
-   * GstPlayBin2:av-offset:
+   * GstPlayBin:av-offset:
    *
    * Control the synchronisation offset between the audio and video streams.
    * Positive values make the audio ahead of the video and negative values make
@@ -820,8 +820,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2::about-to-finish
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::about-to-finish
+   * @playbin: a #GstPlayBin
    *
    * This signal is emitted when the current uri is about to finish. You can
    * set the uri and suburi to make sure that playback continues.
@@ -833,8 +833,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
 
   /**
-   * GstPlayBin2::video-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::video-changed
+   * @playbin: a #GstPlayBin
    *
    * This signal is emitted whenever the number or order of the video
    * streams has changed. The application will most likely want to select
@@ -846,8 +846,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, video_changed), NULL, NULL,
       gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
   /**
-   * GstPlayBin2::audio-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::audio-changed
+   * @playbin: a #GstPlayBin
    *
    * This signal is emitted whenever the number or order of the audio
    * streams has changed. The application will most likely want to select
@@ -859,8 +859,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, audio_changed), NULL, NULL,
       gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
   /**
-   * GstPlayBin2::text-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::text-changed
+   * @playbin: a #GstPlayBin
    *
    * This signal is emitted whenever the number or order of the text
    * streams has changed. The application will most likely want to select
@@ -873,8 +873,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
 
   /**
-   * GstPlayBin2::video-tags-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::video-tags-changed
+   * @playbin: a #GstPlayBin
    * @stream: stream index with changed tags
    *
    * This signal is emitted whenever the tags of a video stream have changed.
@@ -889,8 +889,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
 
   /**
-   * GstPlayBin2::audio-tags-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::audio-tags-changed
+   * @playbin: a #GstPlayBin
    * @stream: stream index with changed tags
    *
    * This signal is emitted whenever the tags of an audio stream have changed.
@@ -905,8 +905,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
 
   /**
-   * GstPlayBin2::text-tags-changed
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::text-tags-changed
+   * @playbin: a #GstPlayBin
    * @stream: stream index with changed tags
    *
    * This signal is emitted whenever the tags of a text stream have changed.
@@ -921,8 +921,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
 
   /**
-   * GstPlayBin2::source-setup:
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::source-setup:
+   * @playbin: a #GstPlayBin
    * @source: source element
    *
    * This signal is emitted after the source element has been created, so
@@ -939,8 +939,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT);
 
   /**
-   * GstPlayBin2::get-video-tags
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-video-tags
+   * @playbin: a #GstPlayBin
    * @stream: a video stream number
    *
    * Action signal to retrieve the tags of a specific video stream number.
@@ -955,8 +955,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_video_tags), NULL, NULL,
       gst_play_marshal_BOXED__INT, GST_TYPE_TAG_LIST, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::get-audio-tags
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-audio-tags
+   * @playbin: a #GstPlayBin
    * @stream: an audio stream number
    *
    * Action signal to retrieve the tags of a specific audio stream number.
@@ -971,8 +971,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_audio_tags), NULL, NULL,
       gst_play_marshal_BOXED__INT, GST_TYPE_TAG_LIST, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::get-text-tags
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-text-tags
+   * @playbin: a #GstPlayBin
    * @stream: a text stream number
    *
    * Action signal to retrieve the tags of a specific text stream number.
@@ -987,8 +987,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_text_tags), NULL, NULL,
       gst_play_marshal_BOXED__INT, GST_TYPE_TAG_LIST, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::convert-frame
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::convert-frame
+   * @playbin: a #GstPlayBin
    * @caps: the target format of the frame
    *
    * Action signal to retrieve the currently playing video frame in the format
@@ -1008,8 +1008,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       gst_play_marshal_BUFFER__BOXED, GST_TYPE_BUFFER, 1, GST_TYPE_CAPS);
 
   /**
-   * GstPlayBin2::get-video-pad
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-video-pad
+   * @playbin: a #GstPlayBin
    * @stream: a video stream number
    *
    * Action signal to retrieve the stream-selector sinkpad for a specific
@@ -1025,8 +1025,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_video_pad), NULL, NULL,
       gst_play_marshal_OBJECT__INT, GST_TYPE_PAD, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::get-audio-pad
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-audio-pad
+   * @playbin: a #GstPlayBin
    * @stream: an audio stream number
    *
    * Action signal to retrieve the stream-selector sinkpad for a specific
@@ -1042,8 +1042,8 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
       G_STRUCT_OFFSET (GstPlayBinClass, get_audio_pad), NULL, NULL,
       gst_play_marshal_OBJECT__INT, GST_TYPE_PAD, 1, G_TYPE_INT);
   /**
-   * GstPlayBin2::get-text-pad
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin::get-text-pad
+   * @playbin: a #GstPlayBin
    * @stream: a text stream number
    *
    * Action signal to retrieve the stream-selector sinkpad for a specific
@@ -1131,7 +1131,7 @@ free_group (GstPlayBin * playbin, GstSourceGroup * group)
   for (n = 0; n < PLAYBIN_STREAM_LAST; n++) {
     GstSourceSelect *select = &group->selector[n];
     if (select->sinkpad && select->sinkpad_data_probe)
-      gst_pad_remove_data_probe (select->sinkpad, select->sinkpad_data_probe);
+      gst_pad_remove_probe (select->sinkpad, select->sinkpad_data_probe);
     if (select->sinkpad_delayed_event)
       gst_event_unref (select->sinkpad_delayed_event);
   }
@@ -1623,19 +1623,14 @@ no_channels:
 }
 
 static void
-_suburidecodebin_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
-{
-  GST_DEBUG_OBJECT (pad, "Pad blocked: %d", blocked);
-}
-
-static void
 gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
 {
   GstIterator *it = gst_element_iterate_src_pads (suburidecodebin);
   GstPad *sinkpad;
+  GValue item = { 0, };
 
-  if (it && gst_iterator_next (it, (gpointer) & sinkpad) == GST_ITERATOR_OK
-      && sinkpad) {
+  if (it && gst_iterator_next (it, &item) == GST_ITERATOR_OK
+      && ((sinkpad = g_value_get_object (&item)) != NULL)) {
     GstEvent *event;
 
     event =
@@ -1649,7 +1644,7 @@ gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
         GST_DEBUG_OBJECT (suburidecodebin, "Seeking to the beginning failed!");
     }
 
-    gst_object_unref (sinkpad);
+    g_value_unset (&item);
   }
 
   if (it)
@@ -1657,11 +1652,12 @@ gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
 }
 
 static void
-gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
-    gboolean block)
+gst_play_bin_suburidecodebin_block (GstSourceGroup * group,
+    GstElement * suburidecodebin, gboolean block)
 {
   GstIterator *it = gst_element_iterate_src_pads (suburidecodebin);
   gboolean done = FALSE;
+  GValue item = { 0, };
 
   GST_DEBUG_OBJECT (suburidecodebin, "Blocking suburidecodebin: %d", block);
 
@@ -1670,11 +1666,18 @@ gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
   while (!done) {
     GstPad *sinkpad;
 
-    switch (gst_iterator_next (it, (gpointer) & sinkpad)) {
+    switch (gst_iterator_next (it, &item)) {
       case GST_ITERATOR_OK:
-        gst_pad_set_blocked_async (sinkpad, block, _suburidecodebin_blocked_cb,
-            NULL);
-        gst_object_unref (sinkpad);
+        sinkpad = g_value_get_object (&item);
+        if (block) {
+          group->block_id =
+              gst_pad_add_probe (sinkpad, GST_PROBE_TYPE_BLOCK, NULL, NULL,
+              NULL);
+        } else if (group->block_id) {
+          gst_pad_remove_probe (sinkpad, group->block_id);
+          group->block_id = 0;
+        }
+        g_value_reset (&item);
         break;
       case GST_ITERATOR_DONE:
         done = TRUE;
@@ -1687,6 +1690,7 @@ gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
         break;
     }
   }
+  g_value_unset (&item);
   gst_iterator_free (it);
 }
 
@@ -1761,7 +1765,8 @@ gst_play_bin_set_current_text_stream (GstPlayBin * playbin, gint stream)
 
         /* Block all suburidecodebin sinkpads */
         if (need_block)
-          gst_play_bin_suburidecodebin_block (group->suburidecodebin, TRUE);
+          gst_play_bin_suburidecodebin_block (group, group->suburidecodebin,
+              TRUE);
 
         /* activate the selected pad */
         g_object_set (selector, "active-pad", sinkpad, NULL);
@@ -1784,7 +1789,8 @@ gst_play_bin_set_current_text_stream (GstPlayBin * playbin, gint stream)
 
         /* Unblock pads if necessary */
         if (need_unblock)
-          gst_play_bin_suburidecodebin_block (group->suburidecodebin, FALSE);
+          gst_play_bin_suburidecodebin_block (group, group->suburidecodebin,
+              FALSE);
 
         /* seek to the beginning */
         if (need_seek)
@@ -2238,7 +2244,7 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
     const GstStructure *s = gst_message_get_structure (msg);
 
     /* Drop all stream-changed messages except the last one */
-    if (strcmp ("playbin2-stream-changed", gst_structure_get_name (s)) == 0) {
+    if (strcmp ("playbin-stream-changed", gst_structure_get_name (s)) == 0) {
       guint32 seqnum = gst_message_get_seqnum (msg);
       GList *l, *l_prev;
 
@@ -2292,6 +2298,7 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
         GstMessage *new_msg;
         GstIterator *it;
         gboolean done = FALSE;
+        GValue item = { 0, };
 
         gst_message_parse_error (msg, &err, &debug);
         new_msg = gst_message_new_warning (msg->src, err, debug);
@@ -2311,15 +2318,16 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
           GstPad *p = NULL;
           GstIteratorResult res;
 
-          res = gst_iterator_next (it, (gpointer) & p);
+          res = gst_iterator_next (it, &item);
 
           switch (res) {
             case GST_ITERATOR_DONE:
               done = TRUE;
               break;
             case GST_ITERATOR_OK:
+              p = g_value_get_object (&item);
               pad_removed_cb (NULL, p, group);
-              gst_object_unref (p);
+              g_value_reset (&item);
               break;
 
             case GST_ITERATOR_RESYNC:
@@ -2330,6 +2338,7 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
               break;
           }
         }
+        g_value_unset (&item);
         if (it)
           gst_iterator_free (it);
 
@@ -2400,22 +2409,16 @@ selector_active_pad_changed (GObject * selector, GParamSpec * pspec,
     g_object_notify (G_OBJECT (playbin), property);
 }
 
-static void
-selector_blocked (GstPad * pad, gboolean blocked, gpointer user_data)
-{
-  /* no nothing */
-  GST_DEBUG_OBJECT (pad, "blocked callback, blocked: %d", blocked);
-}
-
 /* this callback sends a delayed event once the pad becomes unblocked */
-static gboolean
-stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
+static GstProbeReturn
+stream_changed_data_probe (GstPad * pad, GstProbeType type,
+    GstMiniObject * object, gpointer data)
 {
   GstSourceSelect *select = (GstSourceSelect *) data;
   GstEvent *e;
 
   /* we need do this just once, so cleanup first */
-  gst_pad_remove_data_probe (pad, select->sinkpad_data_probe);
+  gst_pad_remove_probe (pad, select->sinkpad_data_probe);
   select->sinkpad_data_probe = 0;
   e = select->sinkpad_delayed_event;
   select->sinkpad_delayed_event = NULL;
@@ -2423,20 +2426,20 @@ stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
   /* really, this should not happen */
   if (!e) {
     GST_WARNING ("Data probed called, but no delayed event");
-    return TRUE;
+    return GST_PROBE_OK;
   }
 
   if (GST_IS_EVENT (object)
-      && GST_EVENT_TYPE (GST_EVENT_CAST (object)) == GST_EVENT_NEWSEGMENT) {
+      && GST_EVENT_TYPE (GST_EVENT_CAST (object)) == GST_EVENT_SEGMENT) {
     /* push the event first, then send the delayed one */
     gst_event_ref (GST_EVENT_CAST (object));
     gst_pad_send_event (pad, GST_EVENT_CAST (object));
     gst_pad_send_event (pad, e);
-    return FALSE;
+    return GST_PROBE_DROP;
   } else {
     /* send delayed event, then allow the caller to go on */
     gst_pad_send_event (pad, e);
-    return TRUE;
+    return GST_PROBE_OK;
   }
 }
 
@@ -2510,7 +2513,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
 
   playbin = group->playbin;
 
-  caps = gst_pad_get_caps_reffed (pad);
+  caps = gst_pad_get_caps (pad, NULL);
   s = gst_caps_get_structure (caps, 0);
   name = gst_structure_get_name (s);
 
@@ -2579,7 +2582,9 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
      * streams and connect the sinks, resulting in not-linked errors. After we
      * configured the sinks we will unblock them all. */
     GST_DEBUG_OBJECT (playbin, "blocking %" GST_PTR_FORMAT, select->srcpad);
-    gst_pad_set_blocked_async (select->srcpad, TRUE, selector_blocked, NULL);
+    select->block_id =
+        gst_pad_add_probe (select->srcpad, GST_PROBE_TYPE_BLOCK, NULL, NULL,
+        NULL);
   }
 
   /* get sinkpad for the new stream */
@@ -2592,7 +2597,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
           GST_DEBUG_PAD_NAME (sinkpad));
 
       /* store the selector for the pad */
-      g_object_set_data (G_OBJECT (sinkpad), "playbin2.select", select);
+      g_object_set_data (G_OBJECT (sinkpad), "playbin.select", select);
 
       /* connect to the notify::tags signal for our
        * own *-tags-changed signals
@@ -2606,7 +2611,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
           g_signal_connect_data (G_OBJECT (sinkpad), "notify::tags",
           G_CALLBACK (notify_tags_cb), ntdata, (GClosureNotify) g_free,
           (GConnectFlags) 0);
-      g_object_set_data (G_OBJECT (sinkpad), "playbin2.notify_tags_handler",
+      g_object_set_data (G_OBJECT (sinkpad), "playbin.notify_tags_handler",
           (gpointer) notify_tags_handler);
 
       /* store the pad in the array */
@@ -2618,7 +2623,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
         goto link_failed;
 
       /* store selector pad so we can release it */
-      g_object_set_data (G_OBJECT (pad), "playbin2.sinkpad", sinkpad);
+      g_object_set_data (G_OBJECT (pad), "playbin.sinkpad", sinkpad);
 
       changed = TRUE;
       GST_DEBUG_OBJECT (playbin, "linked pad %s:%s to selector %p",
@@ -2641,7 +2646,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
       case GST_PLAY_SINK_TYPE_VIDEO_RAW:
         /* we want to return NOT_LINKED for unselected pads but only for pads
          * from the normal uridecodebin. This makes sure that subtitle streams
-         * are not raced past audio/video from decodebin2's multiqueue.
+         * are not raced past audio/video from decodebin's multiqueue.
          * For pads from suburidecodebin OK should always be returned, otherwise
          * it will most likely stop. */
         g_object_set (sinkpad, "always-ok", always_ok, NULL);
@@ -2702,18 +2707,18 @@ pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
 
   GST_SOURCE_GROUP_LOCK (group);
   /* get the selector sinkpad */
-  if (!(peer = g_object_get_data (G_OBJECT (pad), "playbin2.sinkpad")))
+  if (!(peer = g_object_get_data (G_OBJECT (pad), "playbin.sinkpad")))
     goto not_linked;
 
-  if ((select = g_object_get_data (G_OBJECT (peer), "playbin2.select"))) {
+  if ((select = g_object_get_data (G_OBJECT (peer), "playbin.select"))) {
     gulong notify_tags_handler;
 
     notify_tags_handler =
         (gulong) g_object_get_data (G_OBJECT (peer),
-        "playbin2.notify_tags_handler");
+        "playbin.notify_tags_handler");
     if (notify_tags_handler != 0)
       g_signal_handler_disconnect (G_OBJECT (peer), notify_tags_handler);
-    g_object_set_data (G_OBJECT (peer), "playbin2.notify_tags_handler", NULL);
+    g_object_set_data (G_OBJECT (peer), "playbin.notify_tags_handler", NULL);
 
     /* remove the pad from the array */
     g_ptr_array_remove (select->channels, peer);
@@ -2863,7 +2868,7 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
         GstEvent *event;
         guint32 seqnum;
 
-        s = gst_structure_new ("playbin2-stream-changed", "uri", G_TYPE_STRING,
+        s = gst_structure_new ("playbin-stream-changed", "uri", G_TYPE_STRING,
             group->uri, NULL);
         if (group->suburi)
           gst_structure_set (s, "suburi", G_TYPE_STRING, group->suburi, NULL);
@@ -2880,17 +2885,17 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
           gst_event_unref (select->sinkpad_delayed_event);
         select->sinkpad_delayed_event = event;
         if (select->sinkpad_data_probe)
-          gst_pad_remove_data_probe (select->sinkpad,
-              select->sinkpad_data_probe);
+          gst_pad_remove_probe (select->sinkpad, select->sinkpad_data_probe);
 
         /* we go to the trouble of setting a probe on the pad to send
-           the playbin2-stream-changed event as sending it here might
+           the playbin-stream-changed event as sending it here might
            find that the pad is blocked, so we'd block here, and the
            pad might not be linked yet. Additionally, sending it here
            apparently would be on the wrong thread */
         select->sinkpad_data_probe =
-            gst_pad_add_data_probe (select->sinkpad,
-            (GCallback) stream_changed_data_probe, (gpointer) select);
+            gst_pad_add_probe (select->sinkpad, GST_PROBE_TYPE_DATA,
+            (GstPadProbeCallback) stream_changed_data_probe, (gpointer) select,
+            NULL);
 
         g_mutex_unlock (group->stream_changed_pending_lock);
         gst_message_unref (msg);
@@ -2899,8 +2904,10 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
       if (select->srcpad) {
         GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
             select->srcpad);
-        gst_pad_set_blocked_async (select->srcpad, FALSE, selector_blocked,
-            NULL);
+        if (select->block_id) {
+          gst_pad_remove_probe (select->srcpad, select->block_id);
+          select->block_id = 0;
+        }
       }
     }
     GST_SOURCE_GROUP_UNLOCK (group);
@@ -2932,8 +2939,10 @@ shutdown:
         }
         GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
             select->srcpad);
-        gst_pad_set_blocked_async (select->srcpad, FALSE, selector_blocked,
-            NULL);
+        if (select->block_id) {
+          gst_pad_remove_probe (select->srcpad, select->block_id);
+          select->block_id = 0;
+        }
       }
     }
     GST_SOURCE_GROUP_UNLOCK (group);
@@ -3100,7 +3109,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
     if (GST_STATE (sink) < GST_STATE_READY)
       gst_element_set_state (sink, GST_STATE_READY);
 
-    sinkcaps = gst_pad_get_caps_reffed (sinkpad);
+    sinkcaps = gst_pad_get_caps (sinkpad, NULL);
     if (!gst_caps_is_any (sinkcaps))
       ret = !gst_pad_accept_caps (sinkpad, caps);
     gst_caps_unref (sinkcaps);
@@ -3132,7 +3141,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
       if (GST_STATE (sink) < GST_STATE_READY)
         gst_element_set_state (sink, GST_STATE_READY);
 
-      sinkcaps = gst_pad_get_caps_reffed (sinkpad);
+      sinkcaps = gst_pad_get_caps (sinkpad, NULL);
       if (!gst_caps_is_any (sinkcaps))
         ret = !gst_pad_accept_caps (sinkpad, caps);
       gst_caps_unref (sinkcaps);
@@ -3153,7 +3162,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
       if (GST_STATE (sink) < GST_STATE_READY)
         gst_element_set_state (sink, GST_STATE_READY);
 
-      sinkcaps = gst_pad_get_caps_reffed (sinkpad);
+      sinkcaps = gst_pad_get_caps (sinkpad, NULL);
       if (!gst_caps_is_any (sinkcaps))
         ret = !gst_pad_accept_caps (sinkpad, caps);
       gst_caps_unref (sinkcaps);
@@ -3218,8 +3227,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
   GST_DEBUG_OBJECT (playbin, "select group %p for %s:%s, %" GST_PTR_FORMAT,
       group, GST_DEBUG_PAD_NAME (pad), caps);
 
-  GST_DEBUG_OBJECT (playbin, "checking factory %s",
-      GST_PLUGIN_FEATURE_NAME (factory));
+  GST_DEBUG_OBJECT (playbin, "checking factory %s", GST_OBJECT_NAME (factory));
 
   /* if it's not a sink, we just make decodebin try it */
   if (!gst_element_factory_list_is_type (factory,
@@ -3509,7 +3517,7 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
     goto uridecodebin_failure;
 
   GST_SOURCE_GROUP_LOCK (group);
-  /* alow state changes of the playbin2 affect the group elements now */
+  /* alow state changes of the playbin affect the group elements now */
   group_set_locked_state_unlocked (playbin, group, FALSE);
   group->active = TRUE;
   GST_SOURCE_GROUP_UNLOCK (group);
@@ -3906,8 +3914,8 @@ failure:
 gboolean
 gst_play_bin2_plugin_init (GstPlugin * plugin)
 {
-  GST_DEBUG_CATEGORY_INIT (gst_play_bin_debug, "playbin2", 0, "play bin");
+  GST_DEBUG_CATEGORY_INIT (gst_play_bin_debug, "playbin", 0, "play bin");
 
-  return gst_element_register (plugin, "playbin2", GST_RANK_NONE,
+  return gst_element_register (plugin, "playbin", GST_RANK_NONE,
       GST_TYPE_PLAY_BIN);
 }