[totem] Revert "Split out the subtitle loading"



commit a7777d81fab0fff05e096917c6e0b3705d01b9e3
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jul 23 18:19:34 2009 +0100

    Revert "Split out the subtitle loading"
    
    This reverts commit 9eab91849905a403ac9309351edba39a3fcb0995.
    
    playbin2 is broken when loading the subtitle after we've opened
    the file.

 browser-plugin/totem-plugin-viewer.c      |    2 +-
 src/backend/bacon-video-widget-gst-0.10.c |   34 +++++++---------------------
 src/backend/bacon-video-widget.h          |    3 +-
 src/backend/bvw-test.c                    |    2 +-
 src/totem-audio-preview.c                 |    2 +-
 src/totem-object.c                        |    5 +--
 src/totem-properties-view.c               |    2 +-
 src/totem-video-indexer.c                 |    2 +-
 src/totem-video-thumbnailer.c             |    2 +-
 9 files changed, 18 insertions(+), 36 deletions(-)
---
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 1956473..f1809f5 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -478,7 +478,7 @@ totem_embedded_open_internal (TotemEmbedded *emb,
 
 	/* FIXME: remove |err| and rely on async on_error? */
 	g_message ("BEFORE _open");
-	retval = bacon_video_widget_open (emb->bvw, uri, &err);
+	retval = bacon_video_widget_open (emb->bvw, uri, NULL, &err);
 	g_message ("AFTER _open (ret: %d)", retval);
 	if (retval == FALSE)
 	{
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 4d58592..0a9d740 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -3129,10 +3129,13 @@ error:
  * bacon_video_widget_open:
  * @bvw: a #BaconVideoWidget
  * @mrl: an MRL
+ * @subtitle_uri: the URI of a subtitle file, or %NULL
  * @error: a #GError, or %NULL
  *
  * Opens the given @mrl in @bvw for playing. If @subtitle_uri is not %NULL, the given
- * subtitle file is also loaded.
+ * subtitle file is also loaded. Alternatively, the subtitle URI can be passed in @mrl
+ * by adding it after <literal>#subtitle:</literal>. For example:
+ * <literal>http://example.com/video.mpg#subtitle:/home/user/subtitle.ass</literal>.
  *
  * If there was a filesystem error, a %BVW_ERROR_GENERIC error will be returned. Otherwise,
  * more specific #BvwError errors will be returned.
@@ -3143,7 +3146,7 @@ error:
  **/
 gboolean
 bacon_video_widget_open (BaconVideoWidget * bvw,
-                         const gchar * mrl, GError ** error)
+                         const gchar * mrl, const gchar *subtitle_uri, GError ** error)
 {
   GstMessage *err_msg = NULL;
   GFile *file;
@@ -3161,7 +3164,8 @@ bacon_video_widget_open (BaconVideoWidget * bvw,
   }
   
   GST_DEBUG ("mrl = %s", GST_STR_NULL (mrl));
-
+  GST_DEBUG ("subtitle_uri = %s", GST_STR_NULL (subtitle_uri));
+  
   /* this allows non-URI type of files in the thumbnailer and so on */
   file = g_file_new_for_commandline_arg (mrl);
 
@@ -3218,7 +3222,8 @@ bacon_video_widget_open (BaconVideoWidget * bvw,
     setup_vis (bvw);
   }
 
-  g_object_set (bvw->priv->play, "uri", bvw->priv->mrl, NULL);
+  g_object_set (bvw->priv->play, "uri", bvw->priv->mrl,
+                "suburi", subtitle_uri, NULL);
 
   bvw->priv->seekable = -1;
   bvw->priv->target_state = GST_STATE_PAUSED;
@@ -3528,27 +3533,6 @@ bvw_do_navigation_command (BaconVideoWidget * bvw, GstNavigationCommand command)
   gst_object_unref (GST_OBJECT (nav));
 }
 
-/** bacon_video_widget_set_text_subtitle:
- * @bvw: a #BaconVideoWidget
- * @subtitle_uri: the URI of a subtitle file, or %NULL
- *
- * Sets the URI for the text subtitle file to be displayed alongside
- * the current video. Use %NULL is you * want to unload the current text subtitle
- * file  being used.
- */
-void
-bacon_video_widget_set_text_subtitle (BaconVideoWidget * bvw,
-				      const gchar * subtitle_uri)
-{
-  g_return_if_fail (bvw != NULL);
-  g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
-  g_return_if_fail (GST_IS_ELEMENT (bvw->priv->play));
-  
-  GST_LOG ("Setting subtitle as %s", GST_STR_NULL (subtitle_uri));
-  g_object_set (bvw->priv->play, "suburi", subtitle_uri, NULL);
-}
-
-
 /**
  * bacon_video_widget_dvd_event:
  * @bvw: a #BaconVideoWidget
diff --git a/src/backend/bacon-video-widget.h b/src/backend/bacon-video-widget.h
index caf1b52..d4ffd0c 100644
--- a/src/backend/bacon-video-widget.h
+++ b/src/backend/bacon-video-widget.h
@@ -168,6 +168,7 @@ char *bacon_video_widget_get_backend_name (BaconVideoWidget *bvw);
 /* Actions */
 gboolean bacon_video_widget_open		 (BaconVideoWidget *bvw,
 						  const char *mrl,
+						  const char *subtitle_uri,
 						  GError **error);
 gboolean bacon_video_widget_play                 (BaconVideoWidget *bvw,
 						  GError **error);
@@ -199,8 +200,6 @@ void bacon_video_widget_set_volume               (BaconVideoWidget *bvw,
 double bacon_video_widget_get_volume             (BaconVideoWidget *bvw);
 
 /* Properties */
-void bacon_video_widget_set_text_subtitle	(BaconVideoWidget * bvw,
-						 const gchar * subtitle_uri);
 void bacon_video_widget_set_logo		 (BaconVideoWidget *bvw,
 						  const char *filename);
 void bacon_video_widget_set_logo_pixbuf		 (BaconVideoWidget *bvw,
diff --git a/src/backend/bvw-test.c b/src/backend/bvw-test.c
index b9e09a4..4cde296 100644
--- a/src/backend/bvw-test.c
+++ b/src/backend/bvw-test.c
@@ -14,7 +14,7 @@ static void
 test_bvw_set_mrl (GtkWidget *bvw, const char *path)
 {
 	mrl = g_strdup (path);
-	bacon_video_widget_open (BACON_VIDEO_WIDGET (bvw), mrl, NULL);
+	bacon_video_widget_open (BACON_VIDEO_WIDGET (bvw), mrl, NULL, NULL);
 }
 
 static void
diff --git a/src/totem-audio-preview.c b/src/totem-audio-preview.c
index dc24b39..4b4dd86 100644
--- a/src/totem-audio-preview.c
+++ b/src/totem-audio-preview.c
@@ -126,7 +126,7 @@ int main (int argc, char **argv)
 	bvw = BACON_VIDEO_WIDGET (widget);
 
 	totem_resources_monitor_start (NULL, -1);
-	if (bacon_video_widget_open (bvw, path, &error) == FALSE) {
+	if (bacon_video_widget_open (bvw, path, NULL, &error) == FALSE) {
 		g_print ("Can't open %s: %s\n", path, error->message);
 		return 1;
 	}
diff --git a/src/totem-object.c b/src/totem-object.c
index 1485f35..dda6db7 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -1711,8 +1711,7 @@ totem_action_set_mrl_with_warning (Totem *totem,
 			autoload_sub = totem_uri_get_subtitle_uri (mrl);
 
 		totem_gdk_window_set_waiting_cursor (totem->win->window);
-		retval = bacon_video_widget_open (totem->bvw, mrl, &err);
-		bacon_video_widget_set_text_subtitle (totem->bvw, subtitle ? subtitle : autoload_sub);
+		retval = bacon_video_widget_open (totem->bvw, mrl, subtitle ? subtitle : autoload_sub, &err);
 		g_free (autoload_sub);
 		gdk_window_set_cursor (totem->win->window, NULL);
 		totem->mrl = g_strdup (mrl);
@@ -2364,7 +2363,7 @@ on_got_redirect (BaconVideoWidget *bvw, const char *mrl, Totem *totem)
 	bacon_video_widget_close (totem->bvw);
 	totem_file_closed (totem);
 	totem_gdk_window_set_waiting_cursor (totem->win->window);
-	bacon_video_widget_open (totem->bvw, new_mrl ? new_mrl : mrl, NULL);
+	bacon_video_widget_open (totem->bvw, new_mrl ? new_mrl : mrl, NULL, NULL);
 	totem_file_opened (totem, new_mrl ? new_mrl : mrl);
 	gdk_window_set_cursor (totem->win->window, NULL);
 	bacon_video_widget_play (bvw, NULL);
diff --git a/src/totem-properties-view.c b/src/totem-properties-view.c
index a89de13..07de850 100644
--- a/src/totem-properties-view.c
+++ b/src/totem-properties-view.c
@@ -176,7 +176,7 @@ totem_properties_view_set_location (TotemPropertiesView *props,
 		bacon_video_widget_close (props->priv->bvw);
 		bacon_video_widget_properties_reset (props->priv->props);
 
-		if (bacon_video_widget_open (props->priv->bvw, location, &error) == FALSE) {
+		if (bacon_video_widget_open (props->priv->bvw, location, NULL, &error) == FALSE) {
 			g_warning ("Couldn't open %s: %s", location, error->message);
 			g_error_free (error);
 			return;
diff --git a/src/totem-video-indexer.c b/src/totem-video-indexer.c
index 51b6ff5..d9b3d44 100644
--- a/src/totem-video-indexer.c
+++ b/src/totem-video-indexer.c
@@ -204,7 +204,7 @@ int main (int argc, char **argv)
 	path = filenames[0];
 	if (time_limit != FALSE)
 		totem_resources_monitor_start (path, 0);
-	if (bacon_video_widget_open (bvw, path, &error) == FALSE) {
+	if (bacon_video_widget_open (bvw, path, NULL, &error) == FALSE) {
 		g_print ("Can't open %s: %s\n", path, error->message);
 		return 1;
 	}
diff --git a/src/totem-video-thumbnailer.c b/src/totem-video-thumbnailer.c
index 904914e..3850c7a 100644
--- a/src/totem-video-thumbnailer.c
+++ b/src/totem-video-thumbnailer.c
@@ -843,7 +843,7 @@ int main (int argc, char *argv[])
 
 	PROGRESS_DEBUG("About to open video file");
 
-	if (bacon_video_widget_open (bvw, input, &err) == FALSE) {
+	if (bacon_video_widget_open (bvw, input, NULL, &err) == FALSE) {
 		g_print ("totem-video-thumbnailer couldn't open file '%s'\n"
 				"Reason: %s.\n",
 				input, err->message);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]