After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 514050 - Adding subtitles causes video playback to restart
Adding subtitles causes video playback to restart
Status: RESOLVED FIXED
Product: totem
Classification: Core
Component: Movie player
2.21.x
Other Linux
: Normal trivial
: ---
Assigned To: General Totem maintainer(s)
General Totem maintainer(s)
: 536087 (view as bug list)
Depends on: 589515
Blocks: 606019
 
 
Reported: 2008-02-03 10:46 UTC by gbz
Modified: 2012-04-23 17:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
instant-sub.patch (496 bytes, patch)
2009-07-23 17:25 UTC, Bastien Nocera
none Details | Review
Split out the subtitle loading (6.84 KB, patch)
2012-04-20 14:08 UTC, Bastien Nocera
reviewed Details | Review
Split out the subtitle loading and instant apply (7.18 KB, patch)
2012-04-21 12:50 UTC, Bastien Nocera
reviewed Details | Review
Split out the subtitle loading and instant apply (7.52 KB, patch)
2012-04-22 20:18 UTC, Bastien Nocera
none Details | Review
backend: Split out the subtitle loading (9.44 KB, patch)
2012-04-23 12:45 UTC, Bastien Nocera
committed Details | Review

Description gbz 2008-02-03 10:46:03 UTC
It's a nice feature that you can now add subtitles from a file, using the gui.
But when you have selected a subtitles file, the playback of the video restarts from the beginning. Is this really necessary? It works that way in mplayer, but isn't Gstreamer capable of switching without such a break?
Comment 1 Bastien Nocera 2008-02-04 17:27:15 UTC
This is because the xine-lib backend doesn't support it (lowest common denominator).

And we won't be able to do it another way until we get rid of xine-lib, or it grows the ability:
http://bugs.xine-project.org/show_bug.cgi?id=37
Comment 2 gbz 2008-07-31 12:09:35 UTC
I think gstreamer is more powerful in every aspect. Anyway, here's an idea:
If all of subtitles handling were moved to a plugin, there could be two versions of it:
subtitles-gstreamer and subtitles-xine. Each with an optimal set of features, including the necessary gui.
There are other features of gstreamer that would be nice to deploy also, like being able to position the subtitles anywhere on the canvas.
And you can set padding, alignment, wrapping, background box etc. Plus, the main codebase of totem would become somewhat smaller.
Comment 3 gbz 2009-07-22 14:20:47 UTC
Will this be changed in trunk, now that Totem uses Gstreamer exclusively?
Comment 4 Bastien Nocera 2009-07-23 17:19:18 UTC
It's broken in GStreamer.
Comment 5 Bastien Nocera 2009-07-23 17:25:03 UTC
Created attachment 139087 [details] [review]
instant-sub.patch

Patch to use alongside:
http://git.gnome.org/cgit/totem/commit/?id=9eab91849905a403ac9309351edba39a3fcb0995

This should allow loading subtitle file on the fly.
Comment 6 Praveen Thirukonda 2009-10-09 14:00:28 UTC
+1 for this request.
Comment 7 Sebastian Dröge (slomo) 2009-11-15 10:03:25 UTC
Supporting this in GStreamer won't be trivial, see bug #589515. For now totem could simply do the following:

GstFormat fmt = GST_FORMAT_TIME;
GstClockTime position;

gst_element_query_position (bvw->priv->play, &fmt, &position);
g_object_set (bvw->priv->play, "uri", video_file_uri, "suburi", new_subtitle_uri, NULL);
gst_element_set_state (bvw->priv->play, GST_STATE_READY);
gst_element_set_state (bvw->priv->play, GST_STATE_PLAYING);
(wait until PAUSED)
gst_element_seek (bvw->priv->play, ... position ...);

Most of the "save position and restore" feature could be reused here. This won't give perfect results but it wouldn't be much work and improve the situation ;)

Bastien, what do you think?
Comment 8 Bastien Nocera 2009-11-15 12:12:20 UTC
Any chance to be able to do this in PAUSED, so as to avoid glitches? Otherwise I'll implement it that way, yes.
Comment 9 Sebastian Dröge (slomo) 2009-11-15 15:38:47 UTC
(In reply to comment #8)
> Any chance to be able to do this in PAUSED, so as to avoid glitches? Otherwise
> I'll implement it that way, yes.

Well, no :( It can only safely be done in READY. Would it be fine for you if it was possible to be able to set the suburi a single time during playback for a single track? I.e. multiple times would be possible before going to PAUSED and if no suburi was set until then it's possible to set it a single time without doing state changes again.

Trying to change an existing suburi during playback would then either be a no-op until the next URI is set or would set the suburi for the next track. I guess I prefer the former.

Implementing changing the suburi during playback will result in many problems, see bug #589515.
Comment 10 Robin Stocker 2009-11-24 20:14:12 UTC
*** Bug 536087 has been marked as a duplicate of this bug. ***
Comment 11 Luis Medinas 2011-03-29 12:58:03 UTC
This is possible on Banshee 1.9.x since they got subtitle supported added.
We can select subtitles on fly. Î've been using it without any problems maybe after all this time this should be done in totem.
Comment 12 Sebastian Dröge (slomo) 2011-03-29 13:01:33 UTC
Ideally this should be done in playbin2 but it's not exactly easy ;)

Do you know how this was implemented in banshee?
Comment 13 Luis Medinas 2011-03-29 13:18:41 UTC
Banshee did with playbin !? http://git.gnome.org/browse/banshee/commit/?id=9e86951d4234d3abdd25d301837f86475795687e see the initial commit. Afaik banshee moved to playbin2 a long time ago but maybe only for audio files.
Comment 14 Bastien Nocera 2012-04-20 14:08:16 UTC
Created attachment 212423 [details] [review]
Split out the subtitle loading

Split out the subtitle loading from _open() so it could
eventually be handled on-the-fly (without reloading the movie
itself).
Comment 15 Philip Withnall 2012-04-20 17:22:05 UTC
Review of attachment 212423 [details] [review]:

::: src/backend/bacon-video-widget-gst-0.10.c
@@ +3448,3 @@
  * @error: a #GError, or %NULL
  *
  * Opens the given @mrl in @bvw for playing. If @subtitle_uri is not %NULL, the given

subtitle_uri no longer exists.

Should probably still mention that passing in subtitles after #subtitle: in the MRL works (assuming it still does).

@@ +3899,3 @@
 }
 
+/** bacon_video_widget_set_text_subtitle:

Need a new line after the ‘/**’.

@@ +3901,3 @@
+/** bacon_video_widget_set_text_subtitle:
+ * @bvw: a #BaconVideoWidget
+ * @subtitle_uri: the URI of a subtitle file, or %NULL

Needs (allow-none).

@@ +3904,3 @@
+ *
+ * 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

“Use %NULL if you*” needs fixing.

@@ +3911,3 @@
+				      const gchar * subtitle_uri)
+{
+  g_return_if_fail (bvw != NULL);

BACON_IS_VIDEO_WIDGET() already does the !=NULL check, so this first assertion is unnecessary.
Comment 16 Bastien Nocera 2012-04-21 12:50:42 UTC
Created attachment 212499 [details] [review]
Split out the subtitle loading and instant apply

Split out the subtitle loading from _open() so it can
be handled on-the-fly (without reloading the movie itself).
Comment 17 Bastien Nocera 2012-04-21 12:51:17 UTC
Comment on attachment 139087 [details] [review]
instant-sub.patch

Merged into the other patch
Comment 18 Bastien Nocera 2012-04-21 12:51:42 UTC
Comment on attachment 212423 [details] [review]
Split out the subtitle loading

Fixed the review comments in the new patch.
Comment 19 Philip Withnall 2012-04-21 13:38:55 UTC
Review of attachment 212499 [details] [review]:

Looks good to me apart from this:

::: src/backend/bacon-video-widget-gst-0.10.c
@@ +3908,3 @@
+ */
+void
+bacon_video_widget_set_text_subtitle (BaconVideoWidget * bvw,

I forgot in the other review (sorry), but this should probably be added to totem-sections.txt in the documentation.
Comment 20 Bastien Nocera 2012-04-21 23:39:24 UTC
See also https://bugzilla.gnome.org/show_bug.cgi?id=661666 for another example of on-the-fly subtitle loading.
Comment 21 Bastien Nocera 2012-04-22 20:18:21 UTC
Created attachment 212568 [details] [review]
Split out the subtitle loading and instant apply

Split out the subtitle loading from _open() so it can
be handled on-the-fly (without reloading the movie itself).
Comment 22 Bastien Nocera 2012-04-23 00:01:13 UTC
A couple of different problems:
- We don't seem to be getting an updated list of channels, so we don't see the subtitles being listed
- I'm not certain the TEXT flag is getting set either

We also probably need to check the index-ing of subtitles when both internal and external subtitles are available.
Comment 23 Bastien Nocera 2012-04-23 12:45:58 UTC
Created attachment 212598 [details] [review]
backend: Split out the subtitle loading

Split out the subtitle loading from _open() so it can
be handled on-the-fly (without reloading the movie itself).
Comment 24 Bastien Nocera 2012-04-23 12:51:34 UTC
Hacked around the playbin2 limitations, similarly to how Banshee did it. Causes
a slight glitch in display, but it's better than restarting all the way from the beginning.

Attachment 212598 [details] pushed as 65c83b0 - backend: Split out the subtitle loading
Comment 25 Luis Medinas 2012-04-23 17:29:59 UTC
Thanks Bastien, i owe you a beer!