banshee r3627 - in trunk/banshee: . libbanshee src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Core/Banshee.Services/Banshee.MediaEngine
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3627 - in trunk/banshee: . libbanshee src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Core/Banshee.Services/Banshee.MediaEngine
- Date: Mon, 31 Mar 2008 22:33:43 +0100 (BST)
Author: abock
Date: Mon Mar 31 22:33:42 2008
New Revision: 3627
URL: http://svn.gnome.org/viewvc/banshee?rev=3627&view=rev
Log:
2008-03-31 Aaron Bockover <abock gnome org>
* libbanshee/banshee-player.c:
* libbanshee/banshee-player.h:
* libbanshee/banshee-player-video.c:
* libbanshee/banshee-player-video.h: Split out video related code into a
separate module
* src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs:
Updated to reflect changes in libbanshee
* src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs:
Make the engine service IDisposable and dispose of its child engines
Added:
trunk/banshee/libbanshee/banshee-player-video.c
trunk/banshee/libbanshee/banshee-player-video.h
Modified:
trunk/banshee/ChangeLog
trunk/banshee/libbanshee/Makefile.am
trunk/banshee/libbanshee/banshee-player.c
trunk/banshee/libbanshee/banshee-player.h
trunk/banshee/libbanshee/libbanshee.mdp
trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
Modified: trunk/banshee/libbanshee/Makefile.am
==============================================================================
--- trunk/banshee/libbanshee/Makefile.am (original)
+++ trunk/banshee/libbanshee/Makefile.am Mon Mar 31 22:33:42 2008
@@ -15,6 +15,7 @@
banshee-player.c \
banshee-player-cdda.c \
banshee-player-missing-elements.c \
+ banshee-player-video.c \
gst-cd-rip-0.10.c \
gst-misc-0.10.c \
gst-transcode-0.10.c
@@ -23,6 +24,7 @@
banshee-player.h \
banshee-player-cdda.h \
banshee-player-missing-elements.h \
+ banshee-player-video.h \
gst-cd-rip.h \
gst-misc.h \
gst-transcode.h
Added: trunk/banshee/libbanshee/banshee-player-video.c
==============================================================================
--- (empty file)
+++ trunk/banshee/libbanshee/banshee-player-video.c Mon Mar 31 22:33:42 2008
@@ -0,0 +1,219 @@
+//
+// banshee-player-video.c
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2005-2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#include "banshee-player-video.h"
+
+// ---------------------------------------------------------------------------
+// Private Functions
+// ---------------------------------------------------------------------------
+
+#ifdef GDK_WINDOWING_X11
+
+static gboolean
+bp_video_find_xoverlay (BansheePlayer *player)
+{
+ GstElement *video_sink = NULL;
+ GstElement *xoverlay;
+ GstXOverlay *previous_xoverlay;
+
+ previous_xoverlay = player->xoverlay;
+
+ g_object_get (player->playbin, "video-sink", &video_sink, NULL);
+
+ if (video_sink == NULL) {
+ player->xoverlay = NULL;
+ if (previous_xoverlay != NULL) {
+ gst_object_unref (previous_xoverlay);
+ }
+
+ return FALSE;
+ }
+
+ xoverlay = GST_IS_BIN (video_sink)
+ ? gst_bin_get_by_interface (GST_BIN (video_sink), GST_TYPE_X_OVERLAY)
+ : video_sink;
+
+ player->xoverlay = GST_IS_X_OVERLAY (xoverlay) ? GST_X_OVERLAY (xoverlay) : NULL;
+
+ if (previous_xoverlay != NULL) {
+ gst_object_unref (previous_xoverlay);
+ }
+
+ if (player->xoverlay != NULL && g_object_class_find_property (
+ G_OBJECT_GET_CLASS (player->xoverlay), "force-aspect-ratio")) {
+ g_object_set (G_OBJECT (player->xoverlay), "force-aspect-ratio", TRUE, NULL);
+ }
+
+ gst_object_unref (video_sink);
+
+ return player->xoverlay != NULL;
+}
+
+#endif /* GDK_WINDOWING_X11 */
+
+static void
+bp_video_sink_element_added (GstBin *videosink, GstElement *element, BansheePlayer *player)
+{
+ g_return_if_fail (IS_BANSHEE_PLAYER (player));
+
+ #ifdef GDK_WINDOWING_X11
+ g_mutex_lock (player->mutex);
+ bp_video_find_xoverlay (player);
+ g_mutex_unlock (player->mutex);
+ #endif
+}
+
+static void
+bp_video_bus_element_sync_message (GstBus *bus, GstMessage *message, BansheePlayer *player)
+{
+ gboolean found_xoverlay;
+
+ g_return_if_fail (IS_BANSHEE_PLAYER (player));
+
+ #ifdef GDK_WINDOWING_X11
+
+ if (message->structure == NULL || !gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
+ return;
+ }
+
+ g_mutex_lock (player->mutex);
+ found_xoverlay = bp_video_find_xoverlay (player);
+ g_mutex_unlock (player->mutex);
+
+ if (found_xoverlay) {
+ gst_x_overlay_set_xwindow_id (player->xoverlay, GDK_WINDOW_XWINDOW (player->video_window));
+ }
+
+ #endif
+}
+
+// ---------------------------------------------------------------------------
+// Internal Functions
+// ---------------------------------------------------------------------------
+
+void
+_bp_video_pipeline_setup (BansheePlayer *player, GstBus *bus)
+{
+ GstElement *videosink;
+
+ #ifdef GDK_WINDOWING_X11
+
+ g_return_if_fail (IS_BANSHEE_PLAYER (player));
+
+ videosink = gst_element_factory_make ("gconfvideosink", "videosink");
+ if (videosink == NULL) {
+ videosink = gst_element_factory_make ("ximagesink", "videosink");
+ if (videosink == NULL) {
+ videosink = gst_element_factory_make ("fakesink", "videosink");
+ if (videosink != NULL) {
+ g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
+ }
+ }
+ }
+
+ g_object_set (G_OBJECT (player->playbin), "video-sink", videosink, NULL);
+
+ gst_bus_set_sync_handler (bus, gst_bus_sync_signal_handler, player);
+ g_signal_connect (bus, "sync-message::element", G_CALLBACK (bp_video_bus_element_sync_message), player);
+
+ if (GST_IS_BIN (videosink)) {
+ g_signal_connect (videosink, "element-added", G_CALLBACK (bp_video_sink_element_added), player);
+ }
+
+ #endif
+}
+
+// ---------------------------------------------------------------------------
+// Public Functions
+// ---------------------------------------------------------------------------
+
+#ifdef GDK_WINDOWING_X11
+
+P_INVOKE gboolean
+bp_video_is_supported (BansheePlayer *player)
+{
+ return TRUE; // bp_video_find_xoverlay (player);
+}
+
+P_INVOKE void
+bp_video_set_window (BansheePlayer *player, GdkWindow *window)
+{
+ g_return_if_fail (IS_BANSHEE_PLAYER (player));
+
+ player->video_window = window;
+}
+
+P_INVOKE void
+bp_video_window_expose (BansheePlayer *player, GdkWindow *window, gboolean direct)
+{
+ XID window_id;
+
+ g_return_if_fail (IS_BANSHEE_PLAYER (player));
+
+ if (direct && player->xoverlay != NULL && GST_IS_X_OVERLAY (player->xoverlay)) {
+ gst_x_overlay_expose (player->xoverlay);
+ return;
+ }
+
+ g_mutex_lock (player->mutex);
+
+ if (player->xoverlay == NULL && !bp_video_find_xoverlay (player)) {
+ g_mutex_unlock (player->mutex);
+ return;
+ }
+
+ gst_object_ref (player->xoverlay);
+ g_mutex_unlock (player->mutex);
+
+ window_id = GDK_WINDOW_XWINDOW (window);
+
+ gst_x_overlay_set_xwindow_id (player->xoverlay, window_id);
+ gst_x_overlay_expose (player->xoverlay);
+
+ gst_object_unref (player->xoverlay);
+}
+
+#else /* GDK_WINDOWING_X11 */
+
+P_INVOKE gboolean
+bp_video_is_supported (BansheePlayer *player)
+{
+ return FALSE;
+}
+
+P_INVOKE void
+bp_video_set_window (BansheePlayer *player, GdkWindow *window)
+{
+}
+
+P_INVOKE void
+bp_video_window_expose (BansheePlayer *player, GdkWindow *window, gboolean direct)
+{
+}
+
+#endif /* GDK_WINDOWING_X11 */
Added: trunk/banshee/libbanshee/banshee-player-video.h
==============================================================================
--- (empty file)
+++ trunk/banshee/libbanshee/banshee-player-video.h Mon Mar 31 22:33:42 2008
@@ -0,0 +1,36 @@
+//
+// banshee-player-video.h
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2005-2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#ifndef _BANSHEE_PLAYER_VIDEO_H
+#define _BANSHEE_PLAYER_VIDEO_H
+
+#include "banshee-player.h"
+
+void _bp_video_pipeline_setup (BansheePlayer *player, GstBus *bus);
+
+#endif /* _BANSHEE_PLAYER_VIDEO_H */
Modified: trunk/banshee/libbanshee/banshee-player.c
==============================================================================
--- trunk/banshee/libbanshee/banshee-player.c (original)
+++ trunk/banshee/libbanshee/banshee-player.c Mon Mar 31 22:33:42 2008
@@ -29,12 +29,9 @@
#include "banshee-player.h"
#include "banshee-player-cdda.h"
+#include "banshee-player-video.h"
#include "banshee-player-missing-elements.h"
-#ifdef GDK_WINDOWING_X11
-static gboolean bp_find_xoverlay (BansheePlayer *player);
-#endif
-
static void
bp_process_tag(const GstTagList *tag_list, const gchar *tag_name, BansheePlayer *player)
{
@@ -176,47 +173,10 @@
return TRUE;
}
-static void
-bp_video_sink_element_added (GstBin *videosink, GstElement *element, BansheePlayer *player)
-{
- g_return_if_fail (IS_BANSHEE_PLAYER (player));
-
- #ifdef GDK_WINDOWING_X11
- g_mutex_lock (player->mutex);
- bp_find_xoverlay (player);
- g_mutex_unlock (player->mutex);
- #endif
-}
-
-static void
-bp_bus_element_sync_message (GstBus *bus, GstMessage *message, BansheePlayer *player)
-{
- gboolean found_xoverlay;
-
- g_return_if_fail (IS_BANSHEE_PLAYER (player));
-
- #ifdef GDK_WINDOWING_X11
-
- if (message->structure == NULL || !gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
- return;
- }
-
- g_mutex_lock (player->mutex);
- found_xoverlay = bp_find_xoverlay (player);
- g_mutex_unlock (player->mutex);
-
- if (found_xoverlay) {
- gst_x_overlay_set_xwindow_id (player->xoverlay, GDK_WINDOW_XWINDOW (player->video_window));
- }
-
- #endif
-}
-
static gboolean
bp_construct(BansheePlayer *player)
{
GstBus *bus;
- GstElement *videosink;
GstElement *audiosink;
GstElement *audiosinkqueue;
//GstElement *audioconvert;
@@ -282,33 +242,12 @@
g_object_set (G_OBJECT (player->playbin), "audio-sink", player->audiobin, NULL);
- videosink = gst_element_factory_make ("gconfvideosink", "videosink");
- if (videosink == NULL) {
- videosink = gst_element_factory_make ("ximagesink", "videosink");
- if (videosink == NULL) {
- videosink = gst_element_factory_make ("fakesink", "videosink");
- if (videosink != NULL) {
- g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
- }
- }
- }
-
- g_object_set (G_OBJECT (player->playbin), "video-sink", videosink, NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (player->playbin));
-
+ bus = gst_pipeline_get_bus (GST_PIPELINE (player->playbin));
gst_bus_add_watch (bus, bp_bus_callback, player);
- gst_bus_set_sync_handler (bus, gst_bus_sync_signal_handler, player);
-
- g_signal_connect (bus, "sync-message::element",
- G_CALLBACK (bp_bus_element_sync_message), player);
-
- g_signal_connect (player->playbin, "notify::source", G_CALLBACK (_bp_cdda_on_notify_source), player);
- if (GST_IS_BIN (videosink)) {
- g_signal_connect (videosink, "element-added",
- G_CALLBACK (bp_video_sink_element_added), player);
- }
+ g_signal_connect (player->playbin, "notify::source", G_CALLBACK (_bp_cdda_on_notify_source), player);
+
+ _bp_video_pipeline_setup (player, bus);
return TRUE;
}
@@ -604,110 +543,6 @@
*stream = GST_STREAM_ERROR;
}
-/* Region XOverlay */
-
-#ifdef GDK_WINDOWING_X11
-
-gboolean
-bp_video_is_supported (BansheePlayer *player)
-{
- return TRUE; // bp_find_xoverlay (player);
-}
-
-static gboolean
-bp_find_xoverlay (BansheePlayer *player)
-{
- GstElement *video_sink = NULL;
- GstElement *xoverlay;
- GstXOverlay *previous_xoverlay;
-
- previous_xoverlay = player->xoverlay;
-
- g_object_get (player->playbin, "video-sink", &video_sink, NULL);
-
- if (video_sink == NULL) {
- player->xoverlay = NULL;
- if (previous_xoverlay != NULL) {
- gst_object_unref (previous_xoverlay);
- }
-
- return FALSE;
- }
-
- xoverlay = GST_IS_BIN (video_sink)
- ? gst_bin_get_by_interface (GST_BIN (video_sink), GST_TYPE_X_OVERLAY)
- : video_sink;
-
- player->xoverlay = GST_IS_X_OVERLAY (xoverlay) ? GST_X_OVERLAY (xoverlay) : NULL;
-
- if (previous_xoverlay != NULL) {
- gst_object_unref (previous_xoverlay);
- }
-
- if (player->xoverlay != NULL && g_object_class_find_property (
- G_OBJECT_GET_CLASS (player->xoverlay), "force-aspect-ratio")) {
- g_object_set (G_OBJECT (player->xoverlay), "force-aspect-ratio", TRUE, NULL);
- }
-
- gst_object_unref (video_sink);
-
- return player->xoverlay != NULL;
-}
-
-void
-bp_set_video_window (BansheePlayer *player, GdkWindow *window)
-{
- player->video_window = window;
-}
-
-void
-bp_expose_video_window (BansheePlayer *player, GdkWindow *window, gboolean direct)
-{
- XID window_id;
-
- if (direct && player->xoverlay != NULL && GST_IS_X_OVERLAY (player->xoverlay)) {
- gst_x_overlay_expose (player->xoverlay);
- return;
- }
-
- g_mutex_lock (player->mutex);
-
- if (player->xoverlay == NULL && !bp_find_xoverlay (player)) {
- g_mutex_unlock (player->mutex);
- return;
- }
-
- gst_object_ref (player->xoverlay);
- g_mutex_unlock (player->mutex);
-
- window_id = GDK_WINDOW_XWINDOW (window);
-
- gst_x_overlay_set_xwindow_id (player->xoverlay, window_id);
- gst_x_overlay_expose (player->xoverlay);
-
- gst_object_unref (player->xoverlay);
-}
-
-#else
-
-gboolean
-bp_video_is_supported (BansheePlayer *player)
-{
- return FALSE;
-}
-
-void
-bp_set_video_window (BansheePlayer *player, GdkWindow *window)
-{
-}
-
-void
-bp_expose_video_window (BansheePlayer *player, GdkWindow *window, gboolean direct)
-{
-}
-
-#endif
-
/* Region Equalizer */
gboolean
Modified: trunk/banshee/libbanshee/banshee-player.h
==============================================================================
--- trunk/banshee/libbanshee/banshee-player.h (original)
+++ trunk/banshee/libbanshee/banshee-player.h Mon Mar 31 22:33:42 2008
@@ -18,6 +18,7 @@
# include <gst/interfaces/xoverlay.h>
#endif
+#define P_INVOKE
#define IS_BANSHEE_PLAYER(e) (e != NULL)
#define SET_CALLBACK(cb_name) { if(player != NULL) { player->cb_name = cb; } }
Modified: trunk/banshee/libbanshee/libbanshee.mdp
==============================================================================
--- trunk/banshee/libbanshee/libbanshee.mdp (original)
+++ trunk/banshee/libbanshee/libbanshee.mdp Mon Mar 31 22:33:42 2008
@@ -20,6 +20,8 @@
<File name="banshee-player-cdda.c" subtype="Code" buildaction="Compile" />
<File name="banshee-player-missing-elements.c" subtype="Code" buildaction="Compile" />
<File name="banshee-player-missing-elements.h" subtype="Code" buildaction="Nothing" />
+ <File name="banshee-player-video.c" subtype="Code" buildaction="Compile" />
+ <File name="banshee-player-video.h" subtype="Code" buildaction="Nothing" />
</Contents>
<compiler ctype="GccCompiler" />
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am">
Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs (original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs Mon Mar 31 22:33:42 2008
@@ -159,7 +159,7 @@
public override void VideoExpose (IntPtr window, bool direct)
{
- bp_expose_video_window (handle, window, direct);
+ bp_video_window_expose (handle, window, direct);
}
public override IntPtr [] GetBaseElements ()
@@ -340,7 +340,7 @@
}
public override IntPtr VideoWindow {
- set { bp_set_video_window (handle, value); }
+ set { bp_video_set_window (handle, value); }
}
public double AmplifierLevel {
@@ -459,10 +459,10 @@
private static extern bool bp_video_is_supported (HandleRef player);
[DllImport ("libbanshee")]
- private static extern void bp_set_video_window (HandleRef player, IntPtr window);
+ private static extern void bp_video_set_window (HandleRef player, IntPtr window);
[DllImport ("libbanshee")]
- private static extern void bp_expose_video_window (HandleRef player, IntPtr window, bool direct);
+ private static extern void bp_video_window_expose (HandleRef player, IntPtr window, bool direct);
[DllImport ("libbanshee")]
private static extern void bp_get_error_quarks (out uint core, out uint library,
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs Mon Mar 31 22:33:42 2008
@@ -45,7 +45,7 @@
namespace Banshee.MediaEngine
{
- public class PlayerEngineService : IRequiredService, IPlayerEngineService
+ public class PlayerEngineService : IInitializeService, IRequiredService, IPlayerEngineService, IDisposable
{
private List<PlayerEngine> engines = new List<PlayerEngine> ();
private PlayerEngine active_engine;
@@ -72,6 +72,10 @@
public PlayerEngineService ()
{
+ }
+
+ public void Initialize ()
+ {
preferred_engine_id = EngineSchema.Get();
if (default_engine == null && engines.Count > 0) {
@@ -124,6 +128,19 @@
public void Dispose ()
{
+ MetadataService.Instance.HaveResult -= OnMetadataServiceHaveResult;
+
+ foreach (PlayerEngine engine in engines) {
+ engine.Dispose ();
+ }
+
+ active_engine = null;
+ default_engine = null;
+ pending_engine = null;
+
+ preferred_engine_id = null;
+
+ engines.Clear ();
}
private void OnMetadataServiceHaveResult (object o, MetadataLookupResultArgs args)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]