[banshee] Don't try to find subtitle files for music (bgo#638541)
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Don't try to find subtitle files for music (bgo#638541)
- Date: Thu, 17 Feb 2011 19:01:48 +0000 (UTC)
commit 71d9735c9c104107763f82135d4b77cd512d7cdd
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Feb 17 11:22:12 2011 -0600
Don't try to find subtitle files for music (bgo#638541)
libbanshee/banshee-player.c | 14 +++++++++-----
.../Banshee.GStreamer/PlayerEngine.cs | 16 +++++++++-------
.../Banshee.GStreamerSharp/PlayerEngine.cs | 2 +-
.../Banshee.MediaEngine/NullPlayerEngine.cs | 2 +-
.../Banshee.MediaEngine/PlayerEngine.cs | 11 ++++++-----
5 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/libbanshee/banshee-player.c b/libbanshee/banshee-player.c
index 56f8319..6ac8c7e 100644
--- a/libbanshee/banshee-player.c
+++ b/libbanshee/banshee-player.c
@@ -140,7 +140,7 @@ bp_initialize_pipeline (BansheePlayer *player)
}
P_INVOKE gboolean
-bp_open (BansheePlayer *player, const gchar *uri)
+bp_open (BansheePlayer *player, const gchar *uri, gboolean maybe_video)
{
GstState state;
@@ -169,8 +169,10 @@ bp_open (BansheePlayer *player, const gchar *uri)
// Pass the request off to playbin
g_object_set (G_OBJECT (player->playbin), "uri", uri, NULL);
- // Lookup for subtitle files with same name/folder
- bp_lookup_for_subtitle (player, uri);
+ if (maybe_video) {
+ // Lookup for subtitle files with same name/folder
+ bp_lookup_for_subtitle (player, uri);
+ }
player->in_gapless_transition = FALSE;
@@ -211,12 +213,14 @@ bp_play (BansheePlayer *player)
}
P_INVOKE gboolean
-bp_set_next_track (BansheePlayer *player, const gchar *uri)
+bp_set_next_track (BansheePlayer *player, const gchar *uri, gboolean maybe_video)
{
g_return_val_if_fail (IS_BANSHEE_PLAYER (player), FALSE);
g_return_val_if_fail (player->playbin != NULL, FALSE);
g_object_set (G_OBJECT (player->playbin), "uri", uri, NULL);
- bp_lookup_for_subtitle (player, uri);
+ if (maybe_video) {
+ bp_lookup_for_subtitle (player, uri);
+ }
return TRUE;
}
diff --git a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
index 8de5029..86604cf 100644
--- a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
+++ b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
@@ -104,6 +104,7 @@ namespace Banshee.GStreamer
private bool next_track_pending;
private SafeUri pending_uri;
+ private bool pending_maybe_video;
private bool buffering_finished;
private bool xid_is_set = false;
@@ -221,7 +222,7 @@ namespace Banshee.GStreamer
base.Close (fullShutdown);
}
- protected override void OpenUri (SafeUri uri)
+ protected override void OpenUri (SafeUri uri, bool maybeVideo)
{
// The GStreamer engine can use the XID of the main window if it ever
// needs to bring up the plugin installer so it can be transient to
@@ -236,7 +237,7 @@ namespace Banshee.GStreamer
IntPtr uri_ptr = GLib.Marshaller.StringToPtrGStrdup (uri.AbsoluteUri);
try {
- if (!bp_open (handle, uri_ptr)) {
+ if (!bp_open (handle, uri_ptr, maybeVideo)) {
throw new ApplicationException ("Could not open resource");
}
} finally {
@@ -254,7 +255,7 @@ namespace Banshee.GStreamer
bp_pause (handle);
}
- public override void SetNextTrackUri (SafeUri uri)
+ public override void SetNextTrackUri (SafeUri uri, bool maybeVideo)
{
next_track_pending = false;
if (next_track_set.WaitOne (0, false)) {
@@ -262,6 +263,7 @@ namespace Banshee.GStreamer
// This means that we've missed the window for gapless.
// Save this URI to be played when we receive EOS.
pending_uri = uri;
+ pending_maybe_video = maybeVideo;
return;
}
// If there isn't a next track for us, release the block on the about-to-finish callback.
@@ -271,7 +273,7 @@ namespace Banshee.GStreamer
}
IntPtr uri_ptr = GLib.Marshaller.StringToPtrGStrdup (uri.AbsoluteUri);
try {
- bp_set_next_track (handle, uri_ptr);
+ bp_set_next_track (handle, uri_ptr, maybeVideo);
} finally {
GLib.Marshaller.Free (uri_ptr);
next_track_set.Set ();
@@ -310,7 +312,7 @@ namespace Banshee.GStreamer
"was too slow at calculating what track to play next. " +
"If this happens frequently, please file a bug");
OnStateChanged (PlayerState.Loading);
- OpenUri (pending_uri);
+ OpenUri (pending_uri, pending_maybe_video);
Play ();
pending_uri = null;
} else {
@@ -899,7 +901,7 @@ namespace Banshee.GStreamer
private static extern bool bp_supports_gapless (HandleRef player);
[DllImport ("libbanshee.dll")]
- private static extern bool bp_open (HandleRef player, IntPtr uri);
+ private static extern bool bp_open (HandleRef player, IntPtr uri, bool maybeVideo);
[DllImport ("libbanshee.dll")]
private static extern void bp_stop (HandleRef player, bool nullstate);
@@ -911,7 +913,7 @@ namespace Banshee.GStreamer
private static extern void bp_play (HandleRef player);
[DllImport ("libbanshee.dll")]
- private static extern bool bp_set_next_track (HandleRef player, IntPtr uri);
+ private static extern bool bp_set_next_track (HandleRef player, IntPtr uri, bool maybeVideo);
[DllImport ("libbanshee.dll")]
private static extern void bp_set_volume (HandleRef player, double volume);
diff --git a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
index 08dcdd6..4114017 100644
--- a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
+++ b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
@@ -171,7 +171,7 @@ namespace Banshee.GStreamerSharp
}
}
- protected override void OpenUri (SafeUri uri)
+ protected override void OpenUri (SafeUri uri, bool maybeVideo)
{
Console.WriteLine ("Gst# PlayerEngine OpenUri: {0}", uri);
if (pipeline.CurrentState == State.Playing) {
diff --git a/src/Core/Banshee.Services/Banshee.MediaEngine/NullPlayerEngine.cs b/src/Core/Banshee.Services/Banshee.MediaEngine/NullPlayerEngine.cs
index 5dd3a6a..abecf9e 100644
--- a/src/Core/Banshee.Services/Banshee.MediaEngine/NullPlayerEngine.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaEngine/NullPlayerEngine.cs
@@ -35,7 +35,7 @@ namespace Banshee.MediaEngine
{
public class NullPlayerEngine : MediaEngine.PlayerEngine
{
- protected override void OpenUri (SafeUri uri)
+ protected override void OpenUri (SafeUri uri, bool maybeVideo)
{
}
diff --git a/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs b/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
index 26579bf..91162bb 100644
--- a/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
@@ -53,7 +53,7 @@ namespace Banshee.MediaEngine
// will be changed to PlayerState.Idle after going to PlayerState.Ready
private PlayerState idle_state = PlayerState.NotReady;
- protected abstract void OpenUri (SafeUri uri);
+ protected abstract void OpenUri (SafeUri uri, bool maybeVideo);
internal protected virtual bool DelayedInitialize {
get { return false; }
@@ -120,7 +120,8 @@ namespace Banshee.MediaEngine
try {
// Setting the next track doesn't change the player state.
- SetNextTrackUri (track == null ? null : track.Uri);
+ SetNextTrackUri (track == null ? null : track.Uri,
+ track == null || track.HasAttribute (TrackMediaAttributes.VideoStream) || track is UnknownTrackInfo);
} catch (Exception e) {
Log.Exception ("Failed to pre-buffer next track", e);
}
@@ -136,7 +137,7 @@ namespace Banshee.MediaEngine
try {
current_track = track;
OnStateChanged (PlayerState.Loading);
- OpenUri (uri);
+ OpenUri (uri, track.HasAttribute (TrackMediaAttributes.VideoStream) || track is UnknownTrackInfo);
} catch (Exception e) {
Close (true);
OnEventChanged (new PlayerEventErrorArgs (e.Message));
@@ -147,11 +148,11 @@ namespace Banshee.MediaEngine
public abstract void Pause ();
- public virtual void SetNextTrackUri (SafeUri uri)
+ public virtual void SetNextTrackUri (SafeUri uri, bool maybeVideo)
{
// Opening files on SetNextTrack is a sane default behaviour.
// This only wants to be overridden if the PlayerEngine sends out RequestNextTrack signals before EoS
- OpenUri (uri);
+ OpenUri (uri, maybeVideo);
}
public virtual void VideoExpose (IntPtr displayContext, bool direct)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]