1 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian.droege@collabora.co.uk>
2 Date: Wed, 19 Sep 2012 11:34:06 +0200
3 Subject: Initial port to GStreamer 1.0
6 build/m4/banshee/gstreamer.m4 | 19 +++---
7 data/audio-profiles/wav.xml.in | 5 +-
8 libbanshee/banshee-bpmdetector.c | 11 ++--
9 libbanshee/banshee-gst.h | 4 +-
10 libbanshee/banshee-player-cdda.c | 5 +-
11 libbanshee/banshee-player-dvd.c | 4 +-
12 libbanshee/banshee-player-equalizer.c | 4 +-
13 libbanshee/banshee-player-missing-elements.c | 2 +-
14 libbanshee/banshee-player-pipeline.c | 37 ++++++-----
15 libbanshee/banshee-player-private.h | 13 ++--
16 libbanshee/banshee-player-replaygain.c | 29 ++++-----
17 libbanshee/banshee-player-video.c | 89 +++++++++++++-------------
18 libbanshee/banshee-player-vis.c | 88 ++++++++-----------------
19 libbanshee/banshee-player.c | 11 ++--
20 libbanshee/banshee-ripper.c | 16 ++---
21 libbanshee/banshee-tagger.c | 2 +-
22 libbanshee/banshee-transcoder.c | 19 +++---
23 17 files changed, 156 insertions(+), 202 deletions(-)
25 diff --git a/build/m4/banshee/gstreamer.m4 b/build/m4/banshee/gstreamer.m4
26 index 6267cce..917cf58 100644
27 --- a/build/m4/banshee/gstreamer.m4
28 +++ b/build/m4/banshee/gstreamer.m4
30 AC_DEFUN([BANSHEE_CHECK_GSTREAMER],
32 - GSTREAMER_REQUIRED_VERSION=0.10.26
33 + GSTREAMER_REQUIRED_VERSION=0.11.99
34 AC_SUBST(GSTREAMER_REQUIRED_VERSION)
36 PKG_CHECK_MODULES(GST,
37 - gstreamer-0.10 >= $GSTREAMER_REQUIRED_VERSION
38 - gstreamer-base-0.10 >= $GSTREAMER_REQUIRED_VERSION
39 - gstreamer-plugins-base-0.10 >= $GSTREAMER_REQUIRED_VERSION
40 - gstreamer-controller-0.10 >= $GSTREAMER_REQUIRED_VERSION
41 - gstreamer-dataprotocol-0.10 >= $GSTREAMER_REQUIRED_VERSION
42 - gstreamer-fft-0.10 >= $GSTREAMER_REQUIRED_VERSION)
44 - GST_LIBS="$GST_LIBS -lgstvideo-0.10 -lgstinterfaces-0.10 -lgstcdda-0.10 -lgstpbutils-0.10 -lgsttag-0.10"
45 + gstreamer-1.0 >= $GSTREAMER_REQUIRED_VERSION
46 + gstreamer-base-1.0 >= $GSTREAMER_REQUIRED_VERSION
47 + gstreamer-controller-1.0 >= $GSTREAMER_REQUIRED_VERSION
48 + gstreamer-plugins-base-1.0 >= $GSTREAMER_REQUIRED_VERSION
49 + gstreamer-audio-1.0 >= $GSTREAMER_REQUIRED_VERSION
50 + gstreamer-fft-1.0 >= $GSTREAMER_REQUIRED_VERSION
51 + gstreamer-pbutils-1.0 >= $GSTREAMER_REQUIRED_VERSION
52 + gstreamer-tag-1.0 >= $GSTREAMER_REQUIRED_VERSION
53 + gstreamer-video-1.0 >= $GSTREAMER_REQUIRED_VERSION)
57 diff --git a/data/audio-profiles/wav.xml.in b/data/audio-profiles/wav.xml.in
58 index 35cd1d2..6dc1bab 100644
59 --- a/data/audio-profiles/wav.xml.in
60 +++ b/data/audio-profiles/wav.xml.in
64 (+ "audio/x-raw-int, "
65 - "endianness=(int)1234, "
68 - "signed=(boolean)true, "
69 + "format=(string)S16LE, "
73 diff --git a/libbanshee/banshee-bpmdetector.c b/libbanshee/banshee-bpmdetector.c
74 index c06ffcb..68b0419 100644
75 --- a/libbanshee/banshee-bpmdetector.c
76 +++ b/libbanshee/banshee-bpmdetector.c
83 #include <glib/gi18n.h>
85 @@ -50,7 +51,7 @@ struct BansheeBpmDetector {
88 * You can run this pipeline on the cmd line with:
89 - * gst-launch -m filesrc location=/path/to/my.mp3 ! decodebin2 ! \
90 + * gst-launch -m filesrc location=/path/to/my.mp3 ! decodebin ! \
91 * audioconvert ! bpmdetect ! fakesink
94 @@ -168,14 +169,14 @@ bbd_new_decoded_pad(GstElement *decodebin, GstPad *pad,
96 g_return_if_fail(detector != NULL);
98 - audiopad = gst_element_get_pad(detector->audioconvert, "sink");
99 + audiopad = gst_element_get_static_pad(detector->audioconvert, "sink");
101 if(GST_PAD_IS_LINKED(audiopad)) {
102 g_object_unref(audiopad);
106 - caps = gst_pad_get_caps(pad);
107 + caps = gst_pad_query_caps(pad, NULL);
108 str = gst_caps_get_structure(caps, 0);
110 if(!g_strrstr(gst_structure_get_name(str), "audio")) {
111 @@ -209,9 +210,9 @@ bbd_pipeline_construct (BansheeBpmDetector *detector)
115 - detector->decodebin = gst_element_factory_make ("decodebin2", "decodebin2");
116 + detector->decodebin = gst_element_factory_make ("decodebin", "decodebin");
117 if (detector->decodebin == NULL) {
118 - bbd_raise_error (detector, _("Could not create decodebin2 plugin"), NULL);
119 + bbd_raise_error (detector, _("Could not create decodebin plugin"), NULL);
123 diff --git a/libbanshee/banshee-gst.h b/libbanshee/banshee-gst.h
124 index 85662cf..332f356 100644
125 --- a/libbanshee/banshee-gst.h
126 +++ b/libbanshee/banshee-gst.h
128 #define BANSHEE_GST_ITERATOR_ITERATE(iter,child_type,child_name,free,block) { \
129 gboolean iter##_done = FALSE; \
130 while (!iter##_done) { \
131 + GValue child_value = {0, }; \
132 child_type child_name; \
133 - switch (gst_iterator_next (iter, (gpointer)&child_name)) { \
134 + switch (gst_iterator_next (iter, &child_value)) { \
135 case GST_ITERATOR_OK: { \
136 + child_name = (child_type) g_value_get_object(&child_value); \
140 diff --git a/libbanshee/banshee-player-cdda.c b/libbanshee/banshee-player-cdda.c
141 index 8be2bdd..401edf0 100644
142 --- a/libbanshee/banshee-player-cdda.c
143 +++ b/libbanshee/banshee-player-cdda.c
145 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
148 -#include <gst/cdda/gstcddabasesrc.h>
150 +#include <gst/audio/gstaudiocdsrc.h>
151 #include "banshee-player-cdda.h"
153 // ---------------------------------------------------------------------------
154 @@ -46,7 +47,7 @@ bp_cdda_get_cdda_source (GstElement *playbin)
156 g_object_get (playbin, "source", &source, NULL);
158 - if (source == NULL || !GST_IS_CDDA_BASE_SRC (source)) {
159 + if (source == NULL || !GST_IS_AUDIO_CD_SRC (source)) {
160 if (source != NULL) {
161 g_object_unref (source);
163 diff --git a/libbanshee/banshee-player-dvd.c b/libbanshee/banshee-player-dvd.c
164 index 55d499c..991b506 100644
165 --- a/libbanshee/banshee-player-dvd.c
166 +++ b/libbanshee/banshee-player-dvd.c
167 @@ -296,7 +296,7 @@ bp_dvd_go_to_next_chapter (BansheePlayer *player)
170 GstFormat format = gst_format_get_by_nick ("chapter");
171 - gst_element_query_position (player->playbin, &format, &index);
172 + gst_element_query_position (player->playbin, format, &index);
173 gst_element_seek (player->playbin, 1.0, format, GST_SEEK_FLAG_FLUSH,
174 GST_SEEK_TYPE_SET, index + 1, GST_SEEK_TYPE_NONE, 0);
176 @@ -306,7 +306,7 @@ bp_dvd_go_to_previous_chapter (BansheePlayer *player)
179 GstFormat format = gst_format_get_by_nick ("chapter");
180 - gst_element_query_position (player->playbin, &format, &index);
181 + gst_element_query_position (player->playbin, format, &index);
182 gst_element_seek (player->playbin, 1.0, format, GST_SEEK_FLAG_FLUSH,
183 GST_SEEK_TYPE_SET, index - 1, GST_SEEK_TYPE_NONE, 0);
185 diff --git a/libbanshee/banshee-player-equalizer.c b/libbanshee/banshee-player-equalizer.c
186 index a496ada..0cbb3b7 100644
187 --- a/libbanshee/banshee-player-equalizer.c
188 +++ b/libbanshee/banshee-player-equalizer.c
189 @@ -122,7 +122,7 @@ bp_equalizer_set_gain (BansheePlayer *player, guint bandnum, gdouble gain)
190 g_return_if_fail (IS_BANSHEE_PLAYER (player));
192 if (player->equalizer != NULL) {
196 g_return_if_fail (bandnum < gst_child_proxy_get_children_count (GST_CHILD_PROXY (player->equalizer)));
198 @@ -188,7 +188,7 @@ bp_equalizer_get_frequencies (BansheePlayer *player, gdouble **freq)
199 count = gst_child_proxy_get_children_count (GST_CHILD_PROXY (player->equalizer));
201 for (i = 0; i < count; i++) {
205 band = gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (player->equalizer), i);
206 g_object_get (G_OBJECT (band), "freq", &(*freq)[i], NULL);
207 diff --git a/libbanshee/banshee-player-missing-elements.c b/libbanshee/banshee-player-missing-elements.c
208 index 20804c4..30118c5 100644
209 --- a/libbanshee/banshee-player-missing-elements.c
210 +++ b/libbanshee/banshee-player-missing-elements.c
211 @@ -170,7 +170,7 @@ _bp_missing_elements_handle_state_changed (BansheePlayer *player, GstState old,
215 - install_return = gst_install_plugins_async (details, player->install_plugins_context,
216 + install_return = gst_install_plugins_async ((const gchar * const*) details, player->install_plugins_context,
217 bp_missing_elements_handle_install_result, player);
219 if (install_return != GST_INSTALL_PLUGINS_STARTED_OK) {
220 diff --git a/libbanshee/banshee-player-pipeline.c b/libbanshee/banshee-player-pipeline.c
221 index ed845f3..6c2af35 100644
222 --- a/libbanshee/banshee-player-pipeline.c
223 +++ b/libbanshee/banshee-player-pipeline.c
224 @@ -76,7 +76,7 @@ playbin_stream_changed_cb (GstElement * element, BansheePlayer *player)
227 // We're being called from the streaming thread, so don't do anything here
228 - msg = gst_message_new_application (GST_OBJECT (player->playbin), gst_structure_new ("stream-changed", NULL));
229 + msg = gst_message_new_application (GST_OBJECT (player->playbin), gst_structure_new_empty ("stream-changed"));
230 gst_element_post_message (player->playbin, msg);
233 @@ -218,6 +218,11 @@ bp_pipeline_bus_callback (GstBus *bus, GstMessage *message, gpointer userdata)
237 + case GST_MESSAGE_STREAM_START: {
238 + bp_next_track_starting (player);
242 case GST_MESSAGE_APPLICATION: {
244 const GstStructure * s = gst_message_get_structure (message);
245 @@ -289,11 +294,11 @@ _bp_pipeline_construct (BansheePlayer *player)
247 // Playbin is the core element that handles autoplugging (finding the right
248 // source and decoder elements) based on source URI and stream content
249 - player->playbin = gst_element_factory_make ("playbin2", "playbin");
250 + player->playbin = gst_element_factory_make ("playbin", "playbin");
252 #ifdef ENABLE_GAPLESS
253 // FIXME: Connect a proxy about-to-finish callback that will generate a next-track-starting callback.
254 - // This can be removed once playbin2 generates its own next-track signal.
255 + // This can be removed once playbin generates its own next-track signal.
256 // bgo#584987 - this is included in >= 0.10.26
257 g_signal_connect (player->playbin, "about-to-finish", G_CALLBACK (bp_about_to_finish_callback), player);
258 #endif //ENABLE_GAPLESS
259 @@ -305,18 +310,13 @@ _bp_pipeline_construct (BansheePlayer *player)
260 g_signal_connect (player->playbin, "audio-changed", G_CALLBACK (playbin_stream_changed_cb), player);
261 g_signal_connect (player->playbin, "text-changed", G_CALLBACK (playbin_stream_changed_cb), player);
263 - // Try to find an audio sink, prefer gconf, which typically is set to auto these days,
264 - // fall back on auto, which should work on windows, and as a last ditch, try alsa
265 - audiosink = gst_element_factory_make ("gconfaudiosink", "audiosink");
266 - if (audiosink == NULL) {
267 - audiosink = gst_element_factory_make ("directsoundsink", "audiosink");
268 - if (audiosink != NULL) {
269 - g_object_set (G_OBJECT (audiosink), "volume", 1.0, NULL);
271 - audiosink = gst_element_factory_make ("autoaudiosink", "audiosink");
272 - if (audiosink == NULL) {
273 - audiosink = gst_element_factory_make ("alsasink", "audiosink");
275 + audiosink = gst_element_factory_make ("directsoundsink", "audiosink");
276 + if (audiosink != NULL) {
277 + g_object_set (G_OBJECT (audiosink), "volume", 1.0, NULL);
279 + audiosink = gst_element_factory_make ("autoaudiosink", "audiosink");
280 + if (audiosink == NULL) {
281 + audiosink = gst_element_factory_make ("alsasink", "audiosink");
285 @@ -341,7 +341,6 @@ _bp_pipeline_construct (BansheePlayer *player)
286 GstIterator *elem_iter = gst_bin_iterate_recurse (GST_BIN (audiosink));
287 BANSHEE_GST_ITERATOR_ITERATE (elem_iter, GstElement *, element, TRUE, {
288 player->audiosink_has_volume |= g_object_class_find_property (G_OBJECT_GET_CLASS (element), "volume") != NULL;
289 - gst_object_unref (element);
292 bp_debug ("Audiosink has volume: %s",
293 @@ -383,7 +382,7 @@ _bp_pipeline_construct (BansheePlayer *player)
296 // Ghost pad the audio bin so audio is passed from the bin into the tee
297 - teepad = gst_element_get_pad (player->audiotee, "sink");
298 + teepad = gst_element_get_static_pad (player->audiotee, "sink");
299 gst_element_add_pad (player->audiobin, gst_ghost_pad_new ("sink", teepad));
300 gst_object_unref (teepad);
302 @@ -411,8 +410,8 @@ _bp_pipeline_construct (BansheePlayer *player)
303 gst_bus_add_watch (bus, bp_pipeline_bus_callback, player);
305 // Link the first tee pad to the primary audio sink queue
306 - GstPad *sinkpad = gst_element_get_pad (audiosinkqueue, "sink");
307 - pad = gst_element_get_request_pad (player->audiotee, "src%d");
308 + GstPad *sinkpad = gst_element_get_static_pad (audiosinkqueue, "sink");
309 + pad = gst_element_get_request_pad (player->audiotee, "src_%u");
310 g_object_set(player->audiotee, "alloc-pad", pad, NULL);
311 gst_pad_link (pad, sinkpad);
312 gst_object_unref (GST_OBJECT (pad));
313 diff --git a/libbanshee/banshee-player-private.h b/libbanshee/banshee-player-private.h
314 index 9fed356..9346911 100644
315 --- a/libbanshee/banshee-player-private.h
316 +++ b/libbanshee/banshee-player-private.h
318 #include <gst/fft/gstfftf32.h>
319 #include <gst/pbutils/pbutils.h>
320 #include <gst/tag/tag.h>
321 -#include <gst/interfaces/navigation.h>
322 +#include <gst/video/navigation.h>
324 #if defined(GDK_WINDOWING_X11)
325 # include <gdk/gdkx.h>
326 -# include <gst/interfaces/xoverlay.h>
327 +# include <gst/video/videooverlay.h>
328 #elif defined(GDK_WINDOWING_WIN32)
329 # include <gdk/gdkwin32.h>
330 -# include <gst/interfaces/xoverlay.h>
331 +# include <gst/video/videooverlay.h>
334 #include "banshee-gst.h"
335 @@ -155,11 +155,11 @@ struct BansheePlayer {
337 BpVideoDisplayContextType video_display_context_type;
338 #if defined(GDK_WINDOWING_X11)
339 - GstXOverlay *xoverlay;
340 + GstVideoOverlay *video_overlay;
341 GdkWindow *video_window;
342 XID video_window_xid;
343 #elif defined(GDK_WINDOWING_WIN32)
344 - GstXOverlay *xoverlay;
345 + GstVideoOverlay *video_overlay;
346 GdkWindow *video_window;
347 HWND video_window_xid;
349 @@ -179,6 +179,8 @@ struct BansheePlayer {
351 GstFFTF32Complex *vis_fft_buffer;
352 gfloat *vis_fft_sample_buffer;
353 + GstPad *vis_event_probe_pad;
354 + gulong vis_event_probe_id;
356 // Plugin Installer State
358 @@ -197,6 +199,7 @@ struct BansheePlayer {
359 // http://replaygain.hydrogenaudio.org/player_scale.html
360 gdouble rg_gain_history[10];
362 + gulong rg_pad_block_id;
365 GstNavigation *navigation;
366 diff --git a/libbanshee/banshee-player-replaygain.c b/libbanshee/banshee-player-replaygain.c
367 index a479d4a..e42b197 100644
368 --- a/libbanshee/banshee-player-replaygain.c
369 +++ b/libbanshee/banshee-player-replaygain.c
370 @@ -79,17 +79,13 @@ static void on_target_gain_changed (GstElement *rgvolume, GParamSpec *pspec, Ban
371 _bp_rgvolume_print_volume (player);
375 -pad_block_cb (GstPad *srcPad, gboolean blocked, gpointer user_data)
376 +static GstPadProbeReturn
377 +pad_block_cb (GstPad *srcPad, GstPadProbeInfo *info, gpointer user_data)
379 BansheePlayer* player;
385 player = (BansheePlayer*) user_data;
386 - g_return_if_fail (IS_BANSHEE_PLAYER (player));
387 + g_return_val_if_fail (IS_BANSHEE_PLAYER (player), GST_PAD_PROBE_OK);
389 // The pad_block_cb can get triggered multiple times, on different threads.
390 // Lock around the link/unlink code, so we don't end up going through here
391 @@ -99,11 +95,9 @@ pad_block_cb (GstPad *srcPad, gboolean blocked, gpointer user_data)
392 if ((player->replaygain_enabled && player->rgvolume_in_pipeline) ||
393 (!player->replaygain_enabled && !player->rgvolume_in_pipeline)) {
394 // The pipeline is already in the correct state. Unblock the pad, and return.
395 + player->rg_pad_block_id = 0;
396 g_mutex_unlock (player->replaygain_mutex);
397 - if (gst_pad_is_blocked (srcPad)) {
398 - gst_pad_set_blocked_async (srcPad, FALSE, &pad_block_cb, player);
401 + return GST_PAD_PROBE_REMOVE;
404 if (player->rgvolume_in_pipeline) {
405 @@ -139,13 +133,12 @@ pad_block_cb (GstPad *srcPad, gboolean blocked, gpointer user_data)
408 // Our state is now consistent
409 + player->rg_pad_block_id = 0;
410 g_mutex_unlock (player->replaygain_mutex);
412 - if (gst_pad_is_blocked (srcPad)) {
413 - gst_pad_set_blocked_async (srcPad, FALSE, &pad_block_cb, player);
416 _bp_rgvolume_print_volume (player);
418 + return GST_PAD_PROBE_REMOVE;
421 // ---------------------------------------------------------------------------
422 @@ -187,9 +180,9 @@ void _bp_replaygain_pipeline_rebuild (BansheePlayer* player)
423 srcPad = gst_element_get_static_pad (player->before_rgvolume, "src");
425 if (gst_pad_is_active (srcPad) && !gst_pad_is_blocked (srcPad)) {
426 - gst_pad_set_blocked_async (srcPad, TRUE, &pad_block_cb, player);
427 - } else if (srcPad->block_callback == NULL) {
428 - pad_block_cb (srcPad, TRUE, player);
429 + player->rg_pad_block_id = gst_pad_add_probe (srcPad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, &pad_block_cb, player, NULL);
430 + } else if (!player->rg_pad_block_id) {
431 + pad_block_cb (srcPad, NULL, player);
435 diff --git a/libbanshee/banshee-player-video.c b/libbanshee/banshee-player-video.c
436 index b901354..eb95c3f 100644
437 --- a/libbanshee/banshee-player-video.c
438 +++ b/libbanshee/banshee-player-video.c
440 #if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WIN32)
443 -bp_video_find_xoverlay (BansheePlayer *player)
444 +bp_video_find_video_overlay (BansheePlayer *player)
446 GstElement *video_sink = NULL;
447 - GstElement *xoverlay;
448 - GstXOverlay *previous_xoverlay;
449 - gboolean found_xoverlay;
450 + GstElement *video_overlay;
451 + GstVideoOverlay *previous_video_overlay;
452 + gboolean found_video_overlay;
454 g_object_get (player->playbin, "video-sink", &video_sink, NULL);
456 g_mutex_lock (player->video_mutex);
457 - previous_xoverlay = player->xoverlay;
458 + previous_video_overlay = player->video_overlay;
460 if (video_sink == NULL) {
461 - player->xoverlay = NULL;
462 - if (previous_xoverlay != NULL) {
463 - gst_object_unref (previous_xoverlay);
464 + player->video_overlay = NULL;
465 + if (previous_video_overlay != NULL) {
466 + gst_object_unref (previous_video_overlay);
468 g_mutex_unlock (player->video_mutex);
472 - xoverlay = GST_IS_BIN (video_sink)
473 - ? gst_bin_get_by_interface (GST_BIN (video_sink), GST_TYPE_X_OVERLAY)
474 + video_overlay = GST_IS_BIN (video_sink)
475 + ? gst_bin_get_by_interface (GST_BIN (video_sink), GST_TYPE_VIDEO_OVERLAY)
478 - player->xoverlay = GST_IS_X_OVERLAY (xoverlay) ? GST_X_OVERLAY (xoverlay) : NULL;
479 + player->video_overlay = GST_IS_VIDEO_OVERLAY (video_overlay) ? GST_VIDEO_OVERLAY (video_overlay) : NULL;
481 - if (previous_xoverlay != NULL) {
482 - gst_object_unref (previous_xoverlay);
483 + if (previous_video_overlay != NULL) {
484 + gst_object_unref (previous_video_overlay);
487 #if !defined(GDK_WINDOWING_WIN32) // We can't rely on aspect ratio from dshowvideosink
488 - if (player->xoverlay != NULL && g_object_class_find_property (
489 - G_OBJECT_GET_CLASS (player->xoverlay), "force-aspect-ratio")) {
490 - g_object_set (G_OBJECT (player->xoverlay), "force-aspect-ratio", TRUE, NULL);
491 + if (player->video_overlay != NULL && g_object_class_find_property (
492 + G_OBJECT_GET_CLASS (player->video_overlay), "force-aspect-ratio")) {
493 + g_object_set (G_OBJECT (player->video_overlay), "force-aspect-ratio", TRUE, NULL);
497 - if (player->xoverlay != NULL && g_object_class_find_property (
498 - G_OBJECT_GET_CLASS (player->xoverlay), "handle-events")) {
499 - g_object_set (G_OBJECT (player->xoverlay), "handle-events", FALSE, NULL);
500 + if (player->video_overlay != NULL && g_object_class_find_property (
501 + G_OBJECT_GET_CLASS (player->video_overlay), "handle-events")) {
502 + g_object_set (G_OBJECT (player->video_overlay), "handle-events", FALSE, NULL);
505 gst_object_unref (video_sink);
506 - found_xoverlay = (player->xoverlay != NULL) ? TRUE : FALSE;
507 + found_video_overlay = (player->video_overlay != NULL) ? TRUE : FALSE;
509 g_mutex_unlock (player->video_mutex);
510 - return found_xoverlay;
511 + return found_video_overlay;
514 #endif /* GDK_WINDOWING_X11 || GDK_WINDOWING_WIN32 */
515 @@ -130,27 +130,27 @@ bp_video_sink_element_added (GstBin *videosink, GstElement *element, BansheePlay
516 g_return_if_fail (IS_BANSHEE_PLAYER (player));
518 #if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WIN32)
519 - bp_video_find_xoverlay (player);
520 + bp_video_find_video_overlay (player);
525 bp_video_bus_element_sync_message (GstBus *bus, GstMessage *message, BansheePlayer *player)
527 - gboolean found_xoverlay;
528 + gboolean found_video_overlay;
530 g_return_if_fail (IS_BANSHEE_PLAYER (player));
532 #if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WIN32)
534 - if (message->structure == NULL || !gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
535 + if (!gst_is_video_overlay_prepare_window_handle_message (message)) {
539 - found_xoverlay = bp_video_find_xoverlay (player);
540 + found_video_overlay = bp_video_find_video_overlay (player);
542 - if (found_xoverlay) {
543 - gst_x_overlay_set_xwindow_id (player->xoverlay, player->video_window_xid);
544 + if (found_video_overlay) {
545 + gst_video_overlay_set_window_handle (player->video_overlay, player->video_window_xid);
549 @@ -164,7 +164,7 @@ static void
550 cb_caps_set (GObject *obj, GParamSpec *pspec, BansheePlayer *p)
552 GstStructure * s = NULL;
553 - GstCaps * caps = gst_pad_get_negotiated_caps (GST_PAD (obj));
554 + GstCaps * caps = gst_pad_get_current_caps (GST_PAD (obj));
556 if (G_UNLIKELY (!caps)) {
558 @@ -219,7 +219,7 @@ _bp_parse_stream_info (BansheePlayer *player)
561 if (G_LIKELY (vpad)) {
562 - GstCaps *caps = gst_pad_get_negotiated_caps (vpad);
563 + GstCaps *caps = gst_pad_get_current_caps (vpad);
564 if (G_LIKELY (caps)) {
565 cb_caps_set (G_OBJECT (vpad), NULL, player);
566 gst_caps_unref (caps);
567 @@ -249,21 +249,18 @@ _bp_video_pipeline_setup (BansheePlayer *player, GstBus *bus)
569 player->video_display_context_type = BP_VIDEO_DISPLAY_CONTEXT_GDK_WINDOW;
571 - videosink = gst_element_factory_make ("gconfvideosink", "videosink");
572 + videosink = gst_element_factory_make ("autovideosink", "videosink");
573 if (videosink == NULL) {
574 - videosink = gst_element_factory_make ("autovideosink", "videosink");
575 - if (videosink == NULL) {
576 - player->video_display_context_type = BP_VIDEO_DISPLAY_CONTEXT_UNSUPPORTED;
577 - videosink = gst_element_factory_make ("fakesink", "videosink");
578 - if (videosink != NULL) {
579 - g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
581 + player->video_display_context_type = BP_VIDEO_DISPLAY_CONTEXT_UNSUPPORTED;
582 + videosink = gst_element_factory_make ("fakesink", "videosink");
583 + if (videosink != NULL) {
584 + g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
588 g_object_set (G_OBJECT (player->playbin), "video-sink", videosink, NULL);
590 - gst_bus_set_sync_handler (bus, gst_bus_sync_signal_handler, player);
591 + gst_bus_set_sync_handler (bus, gst_bus_sync_signal_handler, player, NULL);
592 g_signal_connect (bus, "sync-message::element", G_CALLBACK (bp_video_bus_element_sync_message), player);
594 if (GST_IS_BIN (videosink)) {
595 @@ -349,21 +346,21 @@ bp_video_window_expose (BansheePlayer *player, GdkWindow *window, gboolean direc
597 g_return_if_fail (IS_BANSHEE_PLAYER (player));
599 - if (direct && player->xoverlay != NULL && GST_IS_X_OVERLAY (player->xoverlay)) {
600 - gst_x_overlay_expose (player->xoverlay);
601 + if (direct && player->video_overlay != NULL && GST_IS_VIDEO_OVERLAY (player->video_overlay)) {
602 + gst_video_overlay_expose (player->video_overlay);
606 - if (player->xoverlay == NULL && !bp_video_find_xoverlay (player)) {
607 + if (player->video_overlay == NULL && !bp_video_find_video_overlay (player)) {
611 - gst_object_ref (player->xoverlay);
612 + gst_object_ref (player->video_overlay);
614 - gst_x_overlay_set_xwindow_id (player->xoverlay, player->video_window_xid);
615 - gst_x_overlay_expose (player->xoverlay);
616 + gst_video_overlay_set_window_handle (player->video_overlay, player->video_window_xid);
617 + gst_video_overlay_expose (player->video_overlay);
619 - gst_object_unref (player->xoverlay);
620 + gst_object_unref (player->video_overlay);
623 // MUST be called from the GTK main thread; calling it in OnRealized will do the right thing.
624 @@ -379,7 +376,7 @@ bp_video_window_realize (BansheePlayer *player, GdkWindow *window)
625 // //Explicitly create the native window. GDK_WINDOW_XWINDOW will call this
626 // //function anyway, but this way we can raise a more useful message should it fail.
627 // if (!gdk_window_ensure_native (window)) {
628 -// banshee_log (BANSHEE_LOG_TYPE_ERROR, "player-video", "Couldn't create native window needed for GstXOverlay!");
629 +// banshee_log (BANSHEE_LOG_TYPE_ERROR, "player-video", "Couldn't create native window needed for GstVideoOverlay!");
633 diff --git a/libbanshee/banshee-player-vis.c b/libbanshee/banshee-player-vis.c
634 index 5787c87..7e7dc78 100644
635 --- a/libbanshee/banshee-player-vis.c
636 +++ b/libbanshee/banshee-player-vis.c
641 +#include <gst/audio/audio.h>
643 #include "banshee-player-vis.h"
645 #define SLICE_SIZE 735
647 static GstStaticCaps vis_data_sink_caps = GST_STATIC_CAPS (
648 - "audio/x-raw-float, "
650 + "format = (string) " GST_AUDIO_NE(F32) ", "
651 "rate = (int) 44100, "
652 - "channels = (int) 2, "
653 - "endianness = (int) BYTE_ORDER, "
655 + "channels = (int) 2"
658 // ---------------------------------------------------------------------------
659 @@ -48,6 +48,7 @@ static void
660 bp_vis_pcm_handoff (GstElement *sink, GstBuffer *buffer, GstPad *pad, gpointer userdata)
662 BansheePlayer *player = (BansheePlayer*)userdata;
664 GstStructure *structure;
665 gint channels, wanted_size;
667 @@ -69,14 +70,16 @@ bp_vis_pcm_handoff (GstElement *sink, GstBuffer *buffer, GstPad *pad, gpointer u
668 player->vis_thawing = FALSE;
671 - structure = gst_caps_get_structure (gst_buffer_get_caps (buffer), 0);
672 + caps = gst_pad_get_current_caps (pad);
673 + structure = gst_caps_get_structure (caps, 0);
674 gst_structure_get_int (structure, "channels", &channels);
675 + gst_caps_unref (caps);
677 wanted_size = channels * SLICE_SIZE * sizeof (gfloat);
679 - gst_adapter_push (player->vis_buffer, gst_buffer_copy (buffer));
680 + gst_adapter_push (player->vis_buffer, gst_buffer_ref (buffer));
682 - while ((data = (gfloat *)gst_adapter_peek (player->vis_buffer, wanted_size)) != NULL) {
683 + while ((data = (gfloat *)gst_adapter_map (player->vis_buffer, wanted_size)) != NULL) {
684 gfloat *deinterlaced = g_malloc (wanted_size);
685 gfloat *specbuf = g_new (gfloat, SLICE_SIZE * 2);
687 @@ -124,6 +127,7 @@ bp_vis_pcm_handoff (GstElement *sink, GstBuffer *buffer, GstPad *pad, gpointer u
688 g_free (deinterlaced);
691 + gst_adapter_unmap (player->vis_buffer);
692 gst_adapter_flush (player->vis_buffer, wanted_size);
695 @@ -132,65 +136,28 @@ bp_vis_pcm_handoff (GstElement *sink, GstBuffer *buffer, GstPad *pad, gpointer u
696 // Internal Functions
697 // ---------------------------------------------------------------------------
700 -_bp_vis_pipeline_block_callback (GstPad *pad, gboolean blocked, gpointer data)
701 +static GstPadProbeReturn
702 +_bp_vis_pipeline_event_probe (GstPad *pad, GstPadProbeInfo *info, gpointer data)
704 BansheePlayer *player = (BansheePlayer *) data;
708 - // Set thawing mode (discards buffers that are too old from the queue).
709 - player->vis_thawing = TRUE;
714 -_bp_vis_pipeline_set_blocked (BansheePlayer *player, gboolean blocked)
716 - GstPad *queue_sink;
718 - if (player->vis_resampler == NULL)
721 - queue_sink = gst_element_get_static_pad (player->vis_resampler, "src");
723 - gst_pad_set_blocked_async (queue_sink, blocked, _bp_vis_pipeline_block_callback, (gpointer) player);
725 - gst_object_unref (GST_OBJECT (queue_sink));
729 -_bp_vis_pipeline_event_probe (GstPad *pad, GstEvent *event, gpointer data)
731 - BansheePlayer *player = (BansheePlayer *) data;
732 + if ((info->type & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) == 0)
733 + return GST_PAD_PROBE_PASS;
735 + event = GST_EVENT (info->data);
736 switch (GST_EVENT_TYPE (event)) {
737 case GST_EVENT_FLUSH_START:
738 case GST_EVENT_FLUSH_STOP:
740 - case GST_EVENT_NEWSEGMENT:
741 + case GST_EVENT_SEGMENT:
742 case GST_EVENT_CUSTOM_DOWNSTREAM:
743 player->vis_thawing = TRUE;
748 - if (player->vis_enabled)
751 - switch (GST_EVENT_TYPE (event)) {
752 - case GST_EVENT_EOS:
753 - case GST_EVENT_CUSTOM_DOWNSTREAM_OOB:
754 - _bp_vis_pipeline_set_blocked (player, FALSE);
756 - case GST_EVENT_CUSTOM_DOWNSTREAM:
757 - case GST_EVENT_NEWSEGMENT:
758 - _bp_vis_pipeline_set_blocked (player, TRUE);
765 + return GST_PAD_PROBE_PASS;
769 @@ -212,9 +179,8 @@ _bp_vis_pipeline_setup (BansheePlayer *player)
770 // Core elements, if something fails here, it's the end of the world
771 audiosinkqueue = gst_element_factory_make ("queue", "vis-queue");
773 - pad = gst_element_get_static_pad (audiosinkqueue, "sink");
774 - gst_pad_add_event_probe (pad, G_CALLBACK (_bp_vis_pipeline_event_probe), player);
775 - gst_object_unref (GST_OBJECT (pad));
776 + player->vis_event_probe_pad = gst_element_get_static_pad (audiosinkqueue, "sink");
777 + player->vis_event_probe_id = gst_pad_add_probe (player->vis_event_probe_pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, _bp_vis_pipeline_event_probe, player, NULL);
779 resampler = gst_element_factory_make ("audioresample", "vis-resample");
780 converter = gst_element_factory_make ("audioconvert", "vis-convert");
781 @@ -255,7 +221,7 @@ _bp_vis_pipeline_setup (BansheePlayer *player)
782 converter, fakesink, NULL);
784 pad = gst_element_get_static_pad (audiosinkqueue, "sink");
785 - teepad = gst_element_get_request_pad (player->audiotee, "src%d");
786 + teepad = gst_element_get_request_pad (player->audiotee, "src_%u");
787 gst_pad_link (teepad, pad);
788 gst_object_unref (GST_OBJECT (teepad));
789 gst_object_unref (GST_OBJECT (pad));
790 @@ -270,14 +236,17 @@ _bp_vis_pipeline_setup (BansheePlayer *player)
791 player->vis_resampler = resampler;
792 player->vis_thawing = FALSE;
793 player->vis_enabled = FALSE;
795 - // Disable the pipeline till we hear otherwise from managed land.
796 - _bp_vis_pipeline_set_blocked (player, TRUE);
800 _bp_vis_pipeline_destroy (BansheePlayer *player)
802 + if (player->vis_event_probe_pad) {
803 + gst_pad_remove_probe (player->vis_event_probe_pad, player->vis_event_probe_id);
804 + gst_object_unref (GST_OBJECT (player->vis_event_probe_pad));
805 + player->vis_event_probe_pad = NULL;
808 if (player->vis_buffer != NULL) {
809 gst_object_unref (player->vis_buffer);
810 player->vis_buffer = NULL;
811 @@ -315,6 +284,5 @@ bp_set_vis_data_callback (BansheePlayer *player, BansheePlayerVisDataCallback cb
813 player->vis_data_cb = cb;
815 - _bp_vis_pipeline_set_blocked (player, cb == NULL);
816 player->vis_enabled = cb != NULL;
818 diff --git a/libbanshee/banshee-player.c b/libbanshee/banshee-player.c
819 index c655a72..b8f98b8 100644
820 --- a/libbanshee/banshee-player.c
821 +++ b/libbanshee/banshee-player.c
822 @@ -250,12 +250,11 @@ bp_set_position (BansheePlayer *player, guint64 time_ms)
824 bp_get_position (BansheePlayer *player)
826 - static GstFormat format = GST_FORMAT_TIME;
829 g_return_val_if_fail (IS_BANSHEE_PLAYER (player), 0);
831 - if (player->playbin != NULL && gst_element_query_position (player->playbin, &format, &position)) {
832 + if (player->playbin != NULL && gst_element_query_position (player->playbin, GST_FORMAT_TIME, &position)) {
833 return position / GST_MSECOND;
836 @@ -265,12 +264,11 @@ bp_get_position (BansheePlayer *player)
838 bp_get_duration (BansheePlayer *player)
840 - static GstFormat format = GST_FORMAT_TIME;
843 g_return_val_if_fail (IS_BANSHEE_PLAYER (player), 0);
845 - if (player->playbin != NULL && gst_element_query_duration (player->playbin, &format, &duration)) {
846 + if (player->playbin != NULL && gst_element_query_duration (player->playbin, GST_FORMAT_TIME, &duration)) {
847 return duration / GST_MSECOND;
850 @@ -446,7 +444,6 @@ bp_set_subtitle_uri (BansheePlayer *player, const gchar *uri)
851 g_return_if_fail (IS_BANSHEE_PLAYER (player));
854 - GstFormat format = GST_FORMAT_BYTES;
855 gboolean paused = FALSE;
857 // Gstreamer playbin do not support to set suburi during playback
858 @@ -454,7 +451,7 @@ bp_set_subtitle_uri (BansheePlayer *player, const gchar *uri)
859 gst_element_get_state (player->playbin, &state, NULL, 0);
860 paused = (state == GST_STATE_PAUSED);
861 if (state >= GST_STATE_PAUSED) {
862 - gst_element_query_position (player->playbin, &format, &pos);
863 + gst_element_query_position (player->playbin, GST_FORMAT_BYTES, &pos);
864 gst_element_set_state (player->playbin, GST_STATE_READY);
865 // Force to wait asynch operation
866 gst_element_get_state (player->playbin, &state, NULL, -1);
867 @@ -467,7 +464,7 @@ bp_set_subtitle_uri (BansheePlayer *player, const gchar *uri)
868 gst_element_get_state (player->playbin, &state, NULL, -1);
871 - gst_element_seek_simple (player->playbin, format, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, pos);
872 + gst_element_seek_simple (player->playbin, GST_FORMAT_BYTES, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, pos);
876 diff --git a/libbanshee/banshee-ripper.c b/libbanshee/banshee-ripper.c
877 index e0e8c85..b3f8fed 100644
878 --- a/libbanshee/banshee-ripper.c
879 +++ b/libbanshee/banshee-ripper.c
880 @@ -85,7 +85,6 @@ br_raise_error (BansheeRipper *ripper, const gchar *error, const gchar *debug)
882 br_iterate_timeout (BansheeRipper *ripper)
884 - GstFormat format = GST_FORMAT_TIME;
888 @@ -96,7 +95,7 @@ br_iterate_timeout (BansheeRipper *ripper)
892 - if (!gst_element_query_position (ripper->cddasrc, &format, &position)) {
893 + if (!gst_element_query_position (ripper->cddasrc, GST_FORMAT_TIME, &position)) {
897 @@ -142,8 +141,9 @@ br_encoder_probe_mime_type (GstBin *bin)
898 GstIterator *pad_iter = gst_element_iterate_src_pads (element);
900 BANSHEE_GST_ITERATOR_ITERATE (pad_iter, GstPad *, pad, TRUE, {
901 - GstStructure *str = GST_PAD_CAPS (pad) != NULL
902 - ? gst_caps_get_structure (GST_PAD_CAPS (pad), 0)
903 + GstCaps *caps = gst_pad_get_current_caps (pad);
904 + GstStructure *str = caps != NULL
905 + ? gst_caps_get_structure (caps, 0)
909 @@ -171,11 +171,8 @@ br_encoder_probe_mime_type (GstBin *bin)
910 preferred_mimetype = mimetype;
914 - gst_object_unref (pad);
915 + gst_caps_unref (caps);
918 - gst_object_unref (element);
921 return preferred_mimetype;
922 @@ -271,7 +268,7 @@ br_pipeline_construct (BansheeRipper *ripper)
926 - ripper->cddasrc = gst_element_make_from_uri (GST_URI_SRC, "cdda://1", "cddasrc");
927 + ripper->cddasrc = gst_element_make_from_uri (GST_URI_SRC, "cdda://1", "cddasrc", NULL);
928 if (ripper->cddasrc == NULL) {
929 br_raise_error (ripper, _("Could not initialize element from cdda URI"), NULL);
931 @@ -405,7 +402,6 @@ br_rip_track (BansheeRipper *ripper, gint track_number, gchar *output_path,
933 // We'll warn the user in the UI if we can't tag the encoded audio files
934 *tagging_supported = TRUE;
935 - gst_object_unref (element);
939 diff --git a/libbanshee/banshee-tagger.c b/libbanshee/banshee-tagger.c
940 index ca15e8f..762dfa9 100644
941 --- a/libbanshee/banshee-tagger.c
942 +++ b/libbanshee/banshee-tagger.c
943 @@ -69,7 +69,7 @@ bt_tag_list_foreach (const GstTagList *list, const gchar *tag, gpointer userdata
947 - return gst_tag_list_new ();
948 + return gst_tag_list_new_empty ();
952 diff --git a/libbanshee/banshee-transcoder.c b/libbanshee/banshee-transcoder.c
953 index 10fc35c..0e241f0 100644
954 --- a/libbanshee/banshee-transcoder.c
955 +++ b/libbanshee/banshee-transcoder.c
956 @@ -64,14 +64,13 @@ gst_transcoder_raise_error(GstTranscoder *transcoder, const gchar *error, const
958 gst_transcoder_iterate_timeout(GstTranscoder *transcoder)
960 - GstFormat format = GST_FORMAT_TIME;
964 g_return_val_if_fail(transcoder != NULL, FALSE);
966 - if(!gst_element_query_duration(transcoder->pipeline, &format, &duration) ||
967 - !gst_element_query_position(transcoder->sink_bin, &format, &position)) {
968 + if(!gst_element_query_duration(transcoder->pipeline, GST_FORMAT_TIME, &duration) ||
969 + !gst_element_query_position(transcoder->sink_bin, GST_FORMAT_TIME, &position)) {
973 @@ -196,14 +195,14 @@ gst_transcoder_new_decoded_pad(GstElement *decodebin, GstPad *pad,
975 g_return_if_fail(transcoder != NULL);
977 - audiopad = gst_element_get_pad(transcoder->sink_bin, "sink");
978 + audiopad = gst_element_get_static_pad(transcoder->sink_bin, "sink");
980 if(GST_PAD_IS_LINKED(audiopad)) {
981 g_object_unref(audiopad);
985 - caps = gst_pad_get_caps(pad);
986 + caps = gst_pad_query_caps(pad, NULL);
987 str = gst_caps_get_structure(caps, 0);
989 if(!g_strrstr(gst_structure_get_name(str), "audio")) {
990 @@ -235,19 +234,19 @@ gst_transcoder_create_pipeline(GstTranscoder *transcoder,
992 transcoder->pipeline = gst_pipeline_new("pipeline");
994 - source_elem = gst_element_make_from_uri(GST_URI_SRC, input_uri, "source");
995 + source_elem = gst_element_make_from_uri(GST_URI_SRC, input_uri, "source", NULL);
996 if(source_elem == NULL) {
997 gst_transcoder_raise_error(transcoder, _("Could not create source element"), NULL);
1001 - decoder_elem = gst_element_factory_make("decodebin2", "decodebin2");
1002 + decoder_elem = gst_element_factory_make("decodebin", "decodebin");
1003 if(decoder_elem == NULL) {
1004 - gst_transcoder_raise_error(transcoder, _("Could not create decodebin2 plugin"), NULL);
1005 + gst_transcoder_raise_error(transcoder, _("Could not create decodebin plugin"), NULL);
1009 - sink_elem = gst_element_make_from_uri(GST_URI_SINK, output_uri, "sink");
1010 + sink_elem = gst_element_make_from_uri(GST_URI_SINK, output_uri, "sink", NULL);
1011 if(sink_elem == NULL) {
1012 gst_transcoder_raise_error(transcoder, _("Could not create sink element"), NULL);
1014 @@ -277,7 +276,7 @@ gst_transcoder_create_pipeline(GstTranscoder *transcoder,
1018 - encoder_pad = gst_element_get_pad(conv_elem, "sink");
1019 + encoder_pad = gst_element_get_static_pad(conv_elem, "sink");
1020 if(encoder_pad == NULL) {
1021 gst_transcoder_raise_error(transcoder, _("Could not get sink pad from encoder"), NULL);