Merge branch 'master' into 0.11
[platform/upstream/gst-plugins-base.git] / gst / playback / gstplaybin2.c
index 0ed8b3a..c0f1da7 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
@@ -47,7 +44,7 @@
  * meta info (tag) extraction
  * </listitem>
  * <listitem>
- * easy access to the last video frame
+ * easy access to the last video sample
  * </listitem>
  * <listitem>
  * buffering when playing streams over a network
@@ -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,
  * <title>Embedding the video window in your application</title>
  * By default, playbin (or rather the video sinks used) will create their own
  * window. Applications will usually want to force output to a window of their
- * own, however. This can be done using the #GstXOverlay interface, which most
+ * own, however. This can be done using the #GstVideoOverlay interface, which most
  * video sinks implement. See the documentation there for more details.
  * </refsect2>
  * <refsect2>
  * </refsect2>
  */
 
+/* FIXME 0.11: suppress warnings for deprecated API such as GValueArray
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include <string.h>
 #include <gst/gst.h>
 
 #include <gst/gst-i18n-plugin.h>
 #include <gst/pbutils/pbutils.h>
-#include <gst/interfaces/streamvolume.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/audio/streamvolume.h>
+#include <gst/video/videooverlay.h>
 #include <gst/interfaces/navigation.h>
-#include <gst/interfaces/colorbalance.h>
-
+#include <gst/video/colorbalance.h>
 #include "gstplay-enum.h"
 #include "gstplay-marshal.h"
 #include "gstplayback.h"
 #include "gstplaysink.h"
 #include "gstsubtitleoverlay.h"
-
 #include "gst/glib-compat-private.h"
-
 GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
 #define GST_CAT_DEFAULT gst_play_bin_debug
 
@@ -277,9 +271,10 @@ struct _GstSourceSelect
                                  */
   GstEvent *sinkpad_delayed_event;
   gulong sinkpad_data_probe;
+  gulong block_id;
 };
 
-#define GST_SOURCE_GROUP_GET_LOCK(group) (((GstSourceGroup*)(group))->lock)
+#define GST_SOURCE_GROUP_GET_LOCK(group) (&((GstSourceGroup*)(group))->lock)
 #define GST_SOURCE_GROUP_LOCK(group) (g_mutex_lock (GST_SOURCE_GROUP_GET_LOCK(group)))
 #define GST_SOURCE_GROUP_UNLOCK(group) (g_mutex_unlock (GST_SOURCE_GROUP_GET_LOCK(group)))
 
@@ -297,7 +292,7 @@ struct _GstSourceGroup
 {
   GstPlayBin *playbin;
 
-  GMutex *lock;
+  GMutex lock;
 
   gboolean valid;               /* the group has valid info to start playback */
   gboolean active;              /* the group is active */
@@ -335,7 +330,9 @@ struct _GstSourceGroup
   gulong sub_no_more_pads_id;
   gulong sub_autoplug_continue_id;
 
-  GMutex *stream_changed_pending_lock;
+  gulong block_id;
+
+  GMutex stream_changed_pending_lock;
   GList *stream_changed_pending;
 
   /* selectors for different streams */
@@ -343,12 +340,12 @@ struct _GstSourceGroup
 };
 
 #define GST_PLAY_BIN_GET_LOCK(bin) (&((GstPlayBin*)(bin))->lock)
-#define GST_PLAY_BIN_LOCK(bin) (g_static_rec_mutex_lock (GST_PLAY_BIN_GET_LOCK(bin)))
-#define GST_PLAY_BIN_UNLOCK(bin) (g_static_rec_mutex_unlock (GST_PLAY_BIN_GET_LOCK(bin)))
+#define GST_PLAY_BIN_LOCK(bin) (g_rec_mutex_lock (GST_PLAY_BIN_GET_LOCK(bin)))
+#define GST_PLAY_BIN_UNLOCK(bin) (g_rec_mutex_unlock (GST_PLAY_BIN_GET_LOCK(bin)))
 
 /* lock to protect dynamic callbacks, like no-more-pads */
-#define GST_PLAY_BIN_DYN_LOCK(bin)    g_mutex_lock ((bin)->dyn_lock)
-#define GST_PLAY_BIN_DYN_UNLOCK(bin)  g_mutex_unlock ((bin)->dyn_lock)
+#define GST_PLAY_BIN_DYN_LOCK(bin)    g_mutex_lock (&(bin)->dyn_lock)
+#define GST_PLAY_BIN_DYN_UNLOCK(bin)  g_mutex_unlock (&(bin)->dyn_lock)
 
 /* lock for shutdown */
 #define GST_PLAY_BIN_SHUTDOWN_LOCK(bin,label)           \
@@ -367,7 +364,7 @@ G_STMT_START {                                          \
   GST_PLAY_BIN_DYN_UNLOCK (bin);                  \
 
 /**
- * GstPlayBin2:
+ * GstPlayBin:
  *
  * playbin element structure
  */
@@ -375,7 +372,7 @@ struct _GstPlayBin
 {
   GstPipeline parent;
 
-  GStaticRecMutex lock;         /* to protect group switching */
+  GRecMutex lock;               /* to protect group switching */
 
   /* the groups, we use a double buffer to switch between current and next */
   GstSourceGroup groups[2];     /* array with group info */
@@ -383,7 +380,7 @@ struct _GstPlayBin
   GstSourceGroup *next_group;   /* pointer to the next group */
 
   /* properties */
-  guint connection_speed;       /* connection speed in bits/sec (0 = unknown) */
+  guint64 connection_speed;     /* connection speed in bits/sec (0 = unknown) */
   gint current_video;           /* the currently selected stream */
   gint current_audio;           /* the currently selected stream */
   gint current_text;            /* the currently selected stream */
@@ -398,11 +395,11 @@ struct _GstPlayBin
   GstElement *source;
 
   /* lock protecting dynamic adding/removing */
-  GMutex *dyn_lock;
+  GMutex dyn_lock;
   /* if we are shutting down or not */
   gint shutdown;
 
-  GMutex *elements_lock;
+  GMutex elements_lock;
   guint32 elements_cookie;
   GList *elements;              /* factories we can use for selecting elements */
 
@@ -447,8 +444,8 @@ struct _GstPlayBinClass
   GstTagList *(*get_audio_tags) (GstPlayBin * playbin, gint stream);
   GstTagList *(*get_text_tags) (GstPlayBin * playbin, gint stream);
 
-  /* get the last video frame and convert it to the given caps */
-  GstBuffer *(*convert_frame) (GstPlayBin * playbin, GstCaps * caps);
+  /* get the last video sample and convert it to the given caps */
+  GstSample *(*convert_sample) (GstPlayBin * playbin, GstCaps * caps);
 
   /* get audio/video/text pad for a stream */
   GstPad *(*get_video_pad) (GstPlayBin * playbin, gint stream);
@@ -502,7 +499,7 @@ enum
   PROP_TEXT_SINK,
   PROP_VOLUME,
   PROP_MUTE,
-  PROP_FRAME,
+  PROP_SAMPLE,
   PROP_FONT_DESC,
   PROP_CONNECTION_SPEED,
   PROP_BUFFER_SIZE,
@@ -516,7 +513,7 @@ enum
 enum
 {
   SIGNAL_ABOUT_TO_FINISH,
-  SIGNAL_CONVERT_FRAME,
+  SIGNAL_CONVERT_SAMPLE,
   SIGNAL_VIDEO_CHANGED,
   SIGNAL_AUDIO_CHANGED,
   SIGNAL_TEXT_CHANGED,
@@ -555,7 +552,7 @@ static GstTagList *gst_play_bin_get_audio_tags (GstPlayBin * playbin,
 static GstTagList *gst_play_bin_get_text_tags (GstPlayBin * playbin,
     gint stream);
 
-static GstBuffer *gst_play_bin_convert_frame (GstPlayBin * playbin,
+static GstSample *gst_play_bin_convert_sample (GstPlayBin * playbin,
     GstCaps * caps);
 
 static GstPad *gst_play_bin_get_video_pad (GstPlayBin * playbin, gint stream);
@@ -568,8 +565,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);
 
@@ -583,10 +580,7 @@ if (id) {                                \
   id = 0;                                \
 }
 
-static void gst_play_bin_implements_interface_init (gpointer g_iface,
-    gpointer g_iface_data);
-static void gst_play_bin_xoverlay_init (gpointer g_iface,
-    gpointer g_iface_data);
+static void gst_play_bin_overlay_init (gpointer g_iface, gpointer g_iface_data);
 static void gst_play_bin_navigation_init (gpointer g_iface,
     gpointer g_iface_data);
 static void gst_play_bin_colorbalance_init (gpointer g_iface,
@@ -610,15 +604,11 @@ gst_play_bin_get_type (void)
       (GInstanceInitFunc) gst_play_bin_init,
       NULL
     };
-    static const GInterfaceInfo impl_info = {
-      gst_play_bin_implements_interface_init,
-      NULL, NULL
-    };
     static const GInterfaceInfo svol_info = {
       NULL, NULL, NULL
     };
-    static const GInterfaceInfo xov_info = {
-      gst_play_bin_xoverlay_init,
+    static const GInterfaceInfo ov_info = {
+      gst_play_bin_overlay_init,
       NULL, NULL
     };
     static const GInterfaceInfo nav_info = {
@@ -631,14 +621,12 @@ 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_IMPLEMENTS_INTERFACE, &impl_info);
     g_type_add_interface_static (gst_play_bin_type, GST_TYPE_STREAM_VOLUME,
         &svol_info);
-    g_type_add_interface_static (gst_play_bin_type, GST_TYPE_X_OVERLAY,
-        &xov_info);
+    g_type_add_interface_static (gst_play_bin_type, GST_TYPE_VIDEO_OVERLAY,
+        &ov_info);
     g_type_add_interface_static (gst_play_bin_type, GST_TYPE_NAVIGATION,
         &nav_info);
     g_type_add_interface_static (gst_play_bin_type, GST_TYPE_COLOR_BALANCE,
@@ -667,7 +655,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.
@@ -677,7 +665,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.
@@ -691,7 +679,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.
    */
@@ -701,7 +689,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.
    */
@@ -710,7 +698,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.
@@ -720,7 +708,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.
    */
@@ -729,7 +717,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.
@@ -739,7 +727,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.
    */
@@ -748,7 +736,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.
@@ -784,7 +772,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.
@@ -800,16 +788,17 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstPlayBin2:frame:
-   * @playbin: a #GstPlayBin2
+   * GstPlayBin:sample:
+   * @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.
+   * Get the currently rendered or prerolled sample in the video sink.
+   * The #GstCaps in the sample will describe the format of the buffer.
    */
-  g_object_class_install_property (gobject_klass, PROP_FRAME,
-      gst_param_spec_mini_object ("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_SAMPLE,
+      g_param_spec_boxed ("sample", "Sample",
+          "The last sample (NULL = no video available)",
+          GST_TYPE_SAMPLE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
   g_object_class_install_property (gobject_klass, PROP_FONT_DESC,
       g_param_spec_string ("subtitle-font-desc",
           "Subtitle font description",
@@ -818,9 +807,9 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
           G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_klass, PROP_CONNECTION_SPEED,
-      g_param_spec_uint ("connection-speed", "Connection Speed",
+      g_param_spec_uint64 ("connection-speed", "Connection Speed",
           "Network connection speed in kbps (0 = unknown)",
-          0, G_MAXUINT / 1000, DEFAULT_CONNECTION_SPEED,
+          0, G_MAXUINT64 / 1000, DEFAULT_CONNECTION_SPEED,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_klass, PROP_BUFFER_SIZE,
@@ -834,7 +823,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
@@ -864,8 +853,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.
@@ -879,8 +868,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
@@ -897,8 +886,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
@@ -915,8 +904,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
@@ -934,8 +923,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.
@@ -954,8 +943,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.
@@ -974,8 +963,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.
@@ -994,8 +983,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
@@ -1015,8 +1004,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.
@@ -1031,8 +1020,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.
@@ -1047,8 +1036,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.
@@ -1063,8 +1052,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-sample
+   * @playbin: a #GstPlayBin
    * @caps: the target format of the frame
    *
    * Action signal to retrieve the currently playing video frame in the format
@@ -1077,15 +1066,15 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
    * %NULL is returned when no current buffer can be retrieved or when the
    * conversion failed.
    */
-  gst_play_bin_signals[SIGNAL_CONVERT_FRAME] =
-      g_signal_new ("convert-frame", G_TYPE_FROM_CLASS (klass),
+  gst_play_bin_signals[SIGNAL_CONVERT_SAMPLE] =
+      g_signal_new ("convert-sample", G_TYPE_FROM_CLASS (klass),
       G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-      G_STRUCT_OFFSET (GstPlayBinClass, convert_frame), NULL, NULL,
-      gst_play_marshal_BUFFER__BOXED, GST_TYPE_BUFFER, 1, GST_TYPE_CAPS);
+      G_STRUCT_OFFSET (GstPlayBinClass, convert_sample), NULL, NULL,
+      gst_play_marshal_SAMPLE__BOXED, GST_TYPE_SAMPLE, 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
@@ -1101,8 +1090,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
@@ -1118,8 +1107,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
@@ -1139,7 +1128,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
   klass->get_audio_tags = gst_play_bin_get_audio_tags;
   klass->get_text_tags = gst_play_bin_get_text_tags;
 
-  klass->convert_frame = gst_play_bin_convert_frame;
+  klass->convert_sample = gst_play_bin_convert_sample;
 
   klass->get_video_pad = gst_play_bin_get_video_pad;
   klass->get_audio_pad = gst_play_bin_get_audio_pad;
@@ -1167,7 +1156,7 @@ init_group (GstPlayBin * playbin, GstSourceGroup * group)
   group->video_channels = g_ptr_array_new ();
   group->audio_channels = g_ptr_array_new ();
   group->text_channels = g_ptr_array_new ();
-  group->lock = g_mutex_new ();
+  g_mutex_init (&group->lock);
   /* init selectors. The selector is found by finding the first prefix that
    * matches the media. */
   group->playbin = playbin;
@@ -1207,7 +1196,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);
   }
@@ -1218,7 +1207,7 @@ free_group (GstPlayBin * playbin, GstSourceGroup * group)
   g_ptr_array_free (group->audio_channels, TRUE);
   g_ptr_array_free (group->text_channels, TRUE);
 
-  g_mutex_free (group->lock);
+  g_mutex_clear (&group->lock);
   if (group->audio_sink) {
     if (group->audio_sink != playbin->audio_sink)
       gst_element_set_state (group->audio_sink, GST_STATE_NULL);
@@ -1235,9 +1224,9 @@ free_group (GstPlayBin * playbin, GstSourceGroup * group)
   g_list_free (group->stream_changed_pending);
   group->stream_changed_pending = NULL;
 
-  if (group->stream_changed_pending_lock)
-    g_mutex_free (group->stream_changed_pending_lock);
-  group->stream_changed_pending_lock = NULL;
+  if (group->stream_changed_pending_lock.p)
+    g_mutex_clear (&group->stream_changed_pending_lock);
+  group->stream_changed_pending_lock.p = NULL;
 }
 
 static void
@@ -1264,10 +1253,10 @@ static void
 gst_play_bin_update_elements_list (GstPlayBin * playbin)
 {
   GList *res, *tmp;
+  guint cookie;
 
-  if (!playbin->elements ||
-      playbin->elements_cookie !=
-      gst_default_registry_get_feature_list_cookie ()) {
+  cookie = gst_registry_get_feature_list_cookie (gst_registry_get ());
+  if (!playbin->elements || playbin->elements_cookie != cookie) {
     if (playbin->elements)
       gst_plugin_feature_list_free (playbin->elements);
     res =
@@ -1279,15 +1268,15 @@ gst_play_bin_update_elements_list (GstPlayBin * playbin)
     playbin->elements = g_list_concat (res, tmp);
     playbin->elements =
         g_list_sort (playbin->elements, gst_plugin_feature_rank_compare_func);
-    playbin->elements_cookie = gst_default_registry_get_feature_list_cookie ();
+    playbin->elements_cookie = cookie;
   }
 }
 
 static void
 gst_play_bin_init (GstPlayBin * playbin)
 {
-  g_static_rec_mutex_init (&playbin->lock);
-  playbin->dyn_lock = g_mutex_new ();
+  g_rec_mutex_init (&playbin->lock);
+  g_mutex_init (&playbin->dyn_lock);
 
   /* assume we can create a selector */
   playbin->have_selector = TRUE;
@@ -1299,7 +1288,7 @@ gst_play_bin_init (GstPlayBin * playbin)
   init_group (playbin, &playbin->groups[1]);
 
   /* first filter out the interesting element factories */
-  playbin->elements_lock = g_mutex_new ();
+  g_mutex_init (&playbin->elements_lock);
 
   /* add sink */
   playbin->playsink =
@@ -1351,9 +1340,9 @@ gst_play_bin_finalize (GObject * object)
   if (playbin->elements)
     gst_plugin_feature_list_free (playbin->elements);
 
-  g_static_rec_mutex_free (&playbin->lock);
-  g_mutex_free (playbin->dyn_lock);
-  g_mutex_free (playbin->elements_lock);
+  g_rec_mutex_clear (&playbin->lock);
+  g_mutex_clear (&playbin->dyn_lock);
+  g_mutex_clear (&playbin->elements_lock);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -1578,10 +1567,10 @@ gst_play_bin_get_text_tags (GstPlayBin * playbin, gint stream)
   return result;
 }
 
-static GstBuffer *
-gst_play_bin_convert_frame (GstPlayBin * playbin, GstCaps * caps)
+static GstSample *
+gst_play_bin_convert_sample (GstPlayBin * playbin, GstCaps * caps)
 {
-  return gst_play_sink_convert_frame (playbin->playsink, caps);
+  return gst_play_sink_convert_sample (playbin->playsink, caps);
 }
 
 /* Returns current stream number, or -1 if none has been selected yet */
@@ -1709,19 +1698,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 =
@@ -1735,7 +1719,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)
@@ -1743,11 +1727,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);
 
@@ -1756,11 +1741,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_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
+              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;
@@ -1773,6 +1765,7 @@ gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
         break;
     }
   }
+  g_value_unset (&item);
   gst_iterator_free (it);
 }
 
@@ -1847,7 +1840,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);
@@ -1861,7 +1855,7 @@ gst_play_bin_set_current_text_stream (GstPlayBin * playbin, gint stream)
            * currently displayed subtitles. This event will
            * never travel outside subtitleoverlay!
            */
-          s = gst_structure_empty_new ("subtitleoverlay-flush-subtitle");
+          s = gst_structure_new_empty ("subtitleoverlay-flush-subtitle");
           event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, s);
           gst_pad_send_event (peer, event);
           gst_object_unref (peer);
@@ -1870,7 +1864,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)
@@ -1991,7 +1986,7 @@ gst_play_bin_set_property (GObject * object, guint prop_id,
       break;
     case PROP_CONNECTION_SPEED:
       GST_PLAY_BIN_LOCK (playbin);
-      playbin->connection_speed = g_value_get_uint (value) * 1000;
+      playbin->connection_speed = g_value_get_uint64 (value) * 1000;
       GST_PLAY_BIN_UNLOCK (playbin);
       break;
     case PROP_BUFFER_SIZE:
@@ -2152,9 +2147,9 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
     case PROP_MUTE:
       g_value_set_boolean (value, gst_play_sink_get_mute (playbin->playsink));
       break;
-    case PROP_FRAME:
-      gst_value_take_buffer (value,
-          gst_play_sink_get_last_frame (playbin->playsink));
+    case PROP_SAMPLE:
+      gst_value_take_sample (value,
+          gst_play_sink_get_last_sample (playbin->playsink));
       break;
     case PROP_FONT_DESC:
       g_value_take_string (value,
@@ -2162,7 +2157,7 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
       break;
     case PROP_CONNECTION_SPEED:
       GST_PLAY_BIN_LOCK (playbin);
-      g_value_set_uint (value, playbin->connection_speed / 1000);
+      g_value_set_uint64 (value, playbin->connection_speed / 1000);
       GST_PLAY_BIN_UNLOCK (playbin);
       break;
     case PROP_BUFFER_SIZE:
@@ -2251,10 +2246,10 @@ gst_play_bin_query (GstElement * element, GstQuery * query)
     gboolean pending;
 
     GST_SOURCE_GROUP_LOCK (group);
-    if (group->stream_changed_pending_lock) {
-      g_mutex_lock (group->stream_changed_pending_lock);
+    if (group->stream_changed_pending_lock.p) {
+      g_mutex_lock (&group->stream_changed_pending_lock);
       pending = group->pending || group->stream_changed_pending;
-      g_mutex_unlock (group->stream_changed_pending_lock);
+      g_mutex_unlock (&group->stream_changed_pending_lock);
     } else {
       pending = group->pending;
     }
@@ -2324,12 +2319,12 @@ 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;
 
       group = playbin->curr_group;
-      g_mutex_lock (group->stream_changed_pending_lock);
+      g_mutex_lock (&group->stream_changed_pending_lock);
       for (l = group->stream_changed_pending; l;) {
         guint32 l_seqnum = GPOINTER_TO_UINT (l->data);
 
@@ -2347,7 +2342,7 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
           l = l->next;
         }
       }
-      g_mutex_unlock (group->stream_changed_pending_lock);
+      g_mutex_unlock (&group->stream_changed_pending_lock);
     }
   } else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ASYNC_START ||
       GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ASYNC_DONE) {
@@ -2378,6 +2373,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);
@@ -2397,15 +2393,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:
@@ -2416,6 +2413,7 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
               break;
           }
         }
+        g_value_unset (&item);
         if (it)
           gst_iterator_free (it);
 
@@ -2486,22 +2484,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 GstPadProbeReturn
+stream_changed_data_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data)
 {
+  GstMiniObject *object = GST_PAD_PROBE_INFO_DATA (info);
   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;
@@ -2509,20 +2501,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_PAD_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_PAD_PROBE_DROP;
   } else {
     /* send delayed event, then allow the caller to go on */
     gst_pad_send_event (pad, e);
-    return TRUE;
+    return GST_PAD_PROBE_OK;
   }
 }
 
@@ -2598,7 +2590,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
 
   playbin = group->playbin;
 
-  caps = gst_pad_get_caps_reffed (pad);
+  caps = gst_pad_query_caps (pad, NULL);
   s = gst_caps_get_structure (caps, 0);
   name = gst_structure_get_name (s);
 
@@ -2671,12 +2663,14 @@ 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_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
+        NULL, NULL, NULL);
   }
 
   /* get sinkpad for the new stream */
   if (select->selector) {
-    if ((sinkpad = gst_element_get_request_pad (select->selector, "sink%d"))) {
+    if ((sinkpad = gst_element_get_request_pad (select->selector, "sink_%u"))) {
       gulong notify_tags_handler = 0;
       NotifyTagsData *ntdata;
 
@@ -2684,7 +2678,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
@@ -2698,7 +2692,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) (guintptr) notify_tags_handler);
 
       /* store the pad in the array */
@@ -2710,7 +2704,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",
@@ -2733,7 +2727,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);
@@ -2794,18 +2788,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 =
         (guintptr) 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);
@@ -2955,14 +2949,14 @@ 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);
         msg = gst_message_new_element (GST_OBJECT_CAST (playbin), s);
         seqnum = gst_message_get_seqnum (msg);
         event = gst_event_new_sink_message (msg);
-        g_mutex_lock (group->stream_changed_pending_lock);
+        g_mutex_lock (&group->stream_changed_pending_lock);
         group->stream_changed_pending =
             g_list_prepend (group->stream_changed_pending,
             GUINT_TO_POINTER (seqnum));
@@ -2972,27 +2966,29 @@ 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_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
+            stream_changed_data_probe, (gpointer) select, NULL);
 
-        g_mutex_unlock (group->stream_changed_pending_lock);
+        g_mutex_unlock (&group->stream_changed_pending_lock);
         gst_message_unref (msg);
       }
 
       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);
@@ -3024,8 +3020,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);
@@ -3097,12 +3095,12 @@ autoplug_factories_cb (GstElement * decodebin, GstPad * pad,
       group, GST_DEBUG_PAD_NAME (pad), caps);
 
   /* filter out the elements based on the caps. */
-  g_mutex_lock (playbin->elements_lock);
+  g_mutex_lock (&playbin->elements_lock);
   gst_play_bin_update_elements_list (playbin);
   mylist =
       gst_element_factory_list_filter (playbin->elements, caps, GST_PAD_SINK,
       FALSE);
-  g_mutex_unlock (playbin->elements_lock);
+  g_mutex_unlock (&playbin->elements_lock);
 
   GST_DEBUG_OBJECT (playbin, "found factories %p", mylist);
   GST_PLUGIN_FEATURE_LIST_DEBUG (mylist);
@@ -3192,9 +3190,9 @@ 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_query_caps (sinkpad, NULL);
     if (!gst_caps_is_any (sinkcaps))
-      ret = !gst_pad_accept_caps (sinkpad, caps);
+      ret = !gst_pad_query_accept_caps (sinkpad, caps);
     gst_caps_unref (sinkcaps);
     gst_object_unref (sinkpad);
   } else {
@@ -3224,9 +3222,9 @@ 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_query_caps (sinkpad, NULL);
       if (!gst_caps_is_any (sinkcaps))
-        ret = !gst_pad_accept_caps (sinkpad, caps);
+        ret = !gst_pad_query_accept_caps (sinkpad, caps);
       gst_caps_unref (sinkcaps);
       gst_object_unref (sinkpad);
     }
@@ -3245,9 +3243,9 @@ 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_query_caps (sinkpad, NULL);
       if (!gst_caps_is_any (sinkcaps))
-        ret = !gst_pad_accept_caps (sinkpad, caps);
+        ret = !gst_pad_query_accept_caps (sinkpad, caps);
       gst_caps_unref (sinkcaps);
       gst_object_unref (sinkpad);
     }
@@ -3281,7 +3279,7 @@ sink_accepts_caps (GstElement * sink, GstCaps * caps)
   if ((sinkpad = gst_element_get_static_pad (sink, "sink"))) {
     /* Got the sink pad, now let's see if the element actually does accept the
      * caps that we have */
-    if (!gst_pad_accept_caps (sinkpad, caps)) {
+    if (!gst_pad_query_accept_caps (sinkpad, caps)) {
       gst_object_unref (sinkpad);
       return FALSE;
     }
@@ -3291,10 +3289,8 @@ sink_accepts_caps (GstElement * sink, GstCaps * caps)
   return TRUE;
 }
 
-static GstStaticCaps raw_audio_caps = GST_STATIC_CAPS ("audio/x-raw-int; "
-    "audio/x-raw-float");
-static GstStaticCaps raw_video_caps = GST_STATIC_CAPS ("video/x-raw-rgb; "
-    "video/x-raw-yuv; " "video/x-raw-gray");
+static GstStaticCaps raw_audio_caps = GST_STATIC_CAPS ("audio/x-raw");
+static GstStaticCaps raw_video_caps = GST_STATIC_CAPS ("video/x-raw");
 
 /* We are asked to select an element. See if the next element to check
  * is a sink. If this is the case, we see if the sink works by setting it to
@@ -3315,8 +3311,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 make sure the element is compatible with
    * the fixed sink */
@@ -3349,7 +3344,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
             (isaudiodec) ? gst_static_caps_get (&raw_audio_caps) :
             gst_static_caps_get (&raw_video_caps);
 
-        caps = gst_pad_get_caps_reffed (sinkpad);
+        caps = gst_pad_query_caps (sinkpad, NULL);
 
         /* If the sink supports raw audio/video, we first check
          * if the decoder could output any raw audio/video format
@@ -3381,7 +3376,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
         return GST_AUTOPLUG_SELECT_TRY;
 
       GST_DEBUG_OBJECT (playbin, "%s not compatible with the fixed sink",
-          GST_PLUGIN_FEATURE_NAME (factory));
+          GST_OBJECT_NAME (factory));
 
       return GST_AUTOPLUG_SELECT_SKIP;
     } else
@@ -3534,8 +3529,8 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
 
   g_list_free (group->stream_changed_pending);
   group->stream_changed_pending = NULL;
-  if (!group->stream_changed_pending_lock)
-    group->stream_changed_pending_lock = g_mutex_new ();
+  if (!group->stream_changed_pending_lock.p)
+    g_mutex_init (&group->stream_changed_pending_lock);
 
   if (group->uridecodebin) {
     GST_DEBUG_OBJECT (playbin, "reusing existing uridecodebin");
@@ -3671,7 +3666,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);
@@ -4066,67 +4061,51 @@ failure:
 }
 
 static void
-gst_play_bin_xoverlay_expose (GstXOverlay * overlay)
+gst_play_bin_overlay_expose (GstVideoOverlay * overlay)
 {
   GstPlayBin *playbin = GST_PLAY_BIN (overlay);
 
-  gst_x_overlay_expose (GST_X_OVERLAY (playbin->playsink));
+  gst_video_overlay_expose (GST_VIDEO_OVERLAY (playbin->playsink));
 }
 
 static void
-gst_play_bin_xoverlay_handle_events (GstXOverlay * overlay,
+gst_play_bin_overlay_handle_events (GstVideoOverlay * overlay,
     gboolean handle_events)
 {
   GstPlayBin *playbin = GST_PLAY_BIN (overlay);
 
-  gst_x_overlay_handle_events (GST_X_OVERLAY (playbin->playsink),
+  gst_video_overlay_handle_events (GST_VIDEO_OVERLAY (playbin->playsink),
       handle_events);
 }
 
 static void
-gst_play_bin_xoverlay_set_render_rectangle (GstXOverlay * overlay, gint x,
+gst_play_bin_overlay_set_render_rectangle (GstVideoOverlay * overlay, gint x,
     gint y, gint width, gint height)
 {
   GstPlayBin *playbin = GST_PLAY_BIN (overlay);
 
-  gst_x_overlay_set_render_rectangle (GST_X_OVERLAY (playbin->playsink), x, y,
-      width, height);
+  gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (playbin->playsink),
+      x, y, width, height);
 }
 
 static void
-gst_play_bin_xoverlay_set_window_handle (GstXOverlay * overlay, guintptr handle)
+gst_play_bin_overlay_set_window_handle (GstVideoOverlay * overlay,
+    guintptr handle)
 {
   GstPlayBin *playbin = GST_PLAY_BIN (overlay);
 
-  gst_x_overlay_set_window_handle (GST_X_OVERLAY (playbin->playsink), handle);
-}
-
-static void
-gst_play_bin_xoverlay_init (gpointer g_iface, gpointer g_iface_data)
-{
-  GstXOverlayClass *iface = (GstXOverlayClass *) g_iface;
-  iface->expose = gst_play_bin_xoverlay_expose;
-  iface->handle_events = gst_play_bin_xoverlay_handle_events;
-  iface->set_render_rectangle = gst_play_bin_xoverlay_set_render_rectangle;
-  iface->set_window_handle = gst_play_bin_xoverlay_set_window_handle;
-}
-
-static gboolean
-gst_play_bin_implements_interface_supported (GstImplementsInterface * iface,
-    GType type)
-{
-  if (type == GST_TYPE_X_OVERLAY || type == GST_TYPE_STREAM_VOLUME ||
-      type == GST_TYPE_NAVIGATION || type == GST_TYPE_COLOR_BALANCE)
-    return TRUE;
-  else
-    return FALSE;
+  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (playbin->playsink),
+      handle);
 }
 
 static void
-gst_play_bin_implements_interface_init (gpointer g_iface, gpointer g_iface_data)
+gst_play_bin_overlay_init (gpointer g_iface, gpointer g_iface_data)
 {
-  GstImplementsInterfaceClass *iface = (GstImplementsInterfaceClass *) g_iface;
-  iface->supported = gst_play_bin_implements_interface_supported;
+  GstVideoOverlayInterface *iface = (GstVideoOverlayInterface *) g_iface;
+  iface->expose = gst_play_bin_overlay_expose;
+  iface->handle_events = gst_play_bin_overlay_handle_events;
+  iface->set_render_rectangle = gst_play_bin_overlay_set_render_rectangle;
+  iface->set_window_handle = gst_play_bin_overlay_set_window_handle;
 }
 
 static void
@@ -4188,7 +4167,7 @@ gst_play_bin_colorbalance_get_balance_type (GstColorBalance * balance)
 static void
 gst_play_bin_colorbalance_init (gpointer g_iface, gpointer g_iface_data)
 {
-  GstColorBalanceClass *iface = (GstColorBalanceClass *) g_iface;
+  GstColorBalanceInterface *iface = (GstColorBalanceInterface *) g_iface;
 
   iface->list_channels = gst_play_bin_colorbalance_list_channels;
   iface->set_value = gst_play_bin_colorbalance_set_value;
@@ -4199,8 +4178,8 @@ gst_play_bin_colorbalance_init (gpointer g_iface, gpointer g_iface_data)
 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);
 }