GNOME Bugzilla – Bug 614942
playbin2: "text-sink" is supposed to handle raw subtitle data?
Last modified: 2010-04-29 17:07:22 UTC
playbin2's "text-sink" property does not work as it seems. $ gst-inspect playbin2|grep text-sink text-sink : the text output element to use (NULL = default textoverlay) $ I expected "text-sink" just rendered text. But actually the text-sink needs to parse raw subtitle data, rather than parsed text. Like this: $ gst-launch playbin2 .... text-sink="subparse ! fakesink dump=1" I'm not sure whether it is intended. But I think most application authors don't want to change subtitle parsing, but just want to redirect the subtitle output.
What would you define as raw parsed text? Just UTF8 plaintext? Pango markup? srt subtitles? The text-sink also gets subpicture text streams btw... so in any case, you have to handle different formats there.
It is OK to handle different formats including subpictures. But in case of raw unparsed subtitles (srt/smi/etc.), it has no timestamps and all of them need subparse element.
Ok, so you would be fine with subpictures, pango markup, srt/smi/etc, ... as long as the buffers are timestamped?
srt/smi/etc formats need to be parsed first to be timestamped correctly.
It could come from a container format with timestamps I guess... Well, we should probably add a parsed=true field to the subtitle caps and only accept those before the subtitle sink. I agree that the current behaviour is a bit suboptimal.
Ok, one solution here would be, to set the raw caps on decodebin2 not to all supported subtitle formats but only to those supported by the subtitle sink (if a subtitle sink is used). I'll work on that later...
Created attachment 159429 [details] [review] playbin2: Set subtitle encoding on the decodebins again
Created attachment 159430 [details] [review] playbin2: If a text sink is provided, let subtitle parsing be done by decodebin2 if required This way subtitle sinks only get buffers in the format that they understand, i.e. raw parsed text in most cases. Fixes bug #614942.
*** Bug 616377 has been marked as a duplicate of this bug. ***
These patches should fix your problem as long as the text-sink sinkpad provides correct caps, i.e. "text/x-plain; text/x-pango-markup" Please test them, I'll push this after 0.10.29 release.
not confirmed :( still spits out root@dm8000:/testProgs# ./playbin-text file:///hdd/movie/mkv/boston.legal.s04e01.mkv file:///hdd/movie/mkv/boston.legal.s04e01.srt ** Message: using external subtitles file:///hdd/movie/mkv/boston.legal.s04e01.srt ** Message: received a subtitle at position 855443:32:57.935404848, running_time 0:00:00.012033000 00000000 (0x48c000): 31 0d 0a 30 30 3a 30 30 3a 30 30 2c 30 31 30 20 1..00:00:00,010 00000010 (0x48c010): 2d 2d 3e 20 30 30 3a 30 30 3a 30 31 2c 32 33 30 --> 00:00:01,230 00000020 (0x48c020): 0d 0a 42 69 73 68 65 72 20 62 65 69 20 26 71 75 ..Bisher bei &qu 00000030 (0x48c030): 6f 74 3b 42 6f 73 74 6f 6e 20 4c 65 67 61 6c 26 ot;Boston Legal& 00000040 (0x48c040): 71 75 6f 74 3b 2e 2e 2e 0d 0a 0d 0a 32 0d 0a 30 quot;.......2..0 00000050 (0x48c050): 30 3a 30 30 3a 30 31 2c 32 34 30 20 2d 2d 3e 20 0:00:01,240 --> 00000060 (0x48c060): 30 30 3a 30 30 3a 30 32 2c 34 34 30 0d 0a 3c 62 00:00:02,440..<b 00000070 (0x48c070): 3e 49 63 68 20 62 69 6e 20 22 6b 65 69 6e 65 22 >Ich bin "keine" 00000080 (0x48c080): 20 50 73 79 63 68 6f 6c 6f 67 69 6e 2c 3c 2f 62 Psychologin,</b 00000090 (0x48c090): 3e 0d 0a 0d 0a 33 0d 0a 30 30 3a 30 30 3a 30 32 >....3..00:00:02 000000a0 (0x48c0a0): 2c 34 35 30 20 2d 2d 3e 20 30 30 3a 30 30 3a 30 ,450 --> 00:00:0 000000b0 (0x48c0b0): 35 2c 36 33 30 0d 0a 61 62 65 72 20 69 63 68 20 5,630..aber ich 000000c0 (0x48c0c0): 64 65 6e 6b 65 2c 20 64 69 65 20 62 65 73 74 65 denke, die beste 000000d0 (0x48c0d0): 20 4d f6 67 6c 69 63 68 6b 65 69 74 20 73 65 69 M.glichkeit sei 000000e0 (0x48c0e0): 6e 65 20 41 6e 67 73 74 0d 0a 7a 75 20 fc 62 65 ne Angst..zu .be 000000f0 (0x48c0f0): 72 77 69 6e 64 65 6e 2c 20 69 73 74 20 64 61 72 rwinden, ist dar 00000100 (0x48c100): fc 62 65 72 20 7a 75 20 72 65 64 65 6e 2e 0d 0a .ber zu reden... 00000110 (0x48c110): 0d 0a 34 0d 0a 30 30 3a 30 30 3a 30 35 2c 36 34 ..4..00:00:05,64 00000120 (0x48c120): 30 20 2d 2d 3e 20 30 30 3a 30 30 3a 30 36 2c 34 0 --> 00:00:06,4 00000130 (0x48c130): 30 30 0d 0a 3c 69 3e 48 75 6d 70 65 72 64 69 6e 00..<i>Humperdin.............. all at the beginning even though i've added the line g_object_set (G_OBJECT (app->textsink), "caps", gst_caps_from_string(" text/x-plain "), NULL); to my playbin-text testcase ( https://bugzilla.gnome.org/show_bug.cgi?id=616377 )
Could you check what caps the buffers have, that you get in your sink? I used your test and set the caps of appsink to "text/plain" and got timestamped and parsed buffers.
sebastian sorry i tested with the wrong binary! so now text/x-plain gives a data flow error but with pango-markup, it works as expected. thanks a lot!
Great, thanks for confirming :) You might want to add support for correct negotiation in subparse to make sure that text/x-plain is used when downstream doesn't support text/x-pango-markup.
commit cc8a5bdcd322efcdc7814483e71d0349e81f24a0 Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Fri Apr 23 16:08:14 2010 +0200 playbin2: If a text sink is provided, let subtitle parsing be done by decode This way subtitle sinks only get buffers in the format that they understand, i.e. raw parsed text in most cases. Fixes bug #614942.