GNOME Bugzilla – Bug 621428
playbin: ghostpad with arbitrary getcaps func leads to not working srt subtitles
Last modified: 2013-08-16 12:34:19 UTC
on my hard way to trying to enable my app to be able to switch between vobsobs and text subs during playback i've tried overwriting my ghostpad's caps so that there won't be a stalling data flow due to incompatible buffers still floating in the pipeline after i've switched the ghostpad target element. however, this construction entirely disables srt subtitles from working. attached, there'll be modified playbin-text icle testcases and a logfile.
Created attachment 163496 [details] testcase run with movie container uri as first and srt subtitle uri as second parameter playback will fail due to an Internal data flow error
Created attachment 163497 [details] testcase run with movie container uri as first and srt subtitle uri as second parameter when not using ghostpad and overwritten getcaps, then it links and displays correctly: root@dm500hd:/media/hdd/movie/mkv# /testProgs/playbin-text file:///media/hdd/movie/mkv/BrokenPlayback2.mkv file:///media/hdd/movie/mkv/BrokenPlayback2.srt ** Message: using external subtitles file:///media/hdd/movie/mkv/BrokenPlayback2.srt ** Message: received a subtitle at position 0:00:00.010000000, running_time 0:00:00.010896000 00000000 (0x4ba068): 42 69 73 68 65 72 20 62 65 69 20 26 61 6d 70 3b Bisher bei & 00000010 (0x4ba078): 71 75 6f 74 3b 42 6f 73 74 6f 6e 20 4c 65 67 61 quot;Boston Lega 00000020 (0x4ba088): 6c 26 61 6d 70 3b 71 75 6f 74 3b 2e 2e 2e l&quot;... ** Message: received a subtitle at position 0:00:01.240826000, running_time 0:00:01.240899000 00000000 (0x4c9f38): 3c 62 3e 49 63 68 20 62 69 6e 20 26 71 75 6f 74 <b>Ich bin " 00000010 (0x4c9f48): 3b 6b 65 69 6e 65 26 71 75 6f 74 3b 20 50 73 79 ;keine" Psy 00000020 (0x4c9f58): 63 68 6f 6c 6f 67 69 6e 2c 3c 2f 62 3e chologin,</b> ** Message: received a subtitle at position 0:00:02.450833000, running_time 0:00:02.450905000 00000000 (0x4fbf88): 61 62 65 72 20 69 63 68 20 64 65 6e 6b 65 2c 20 aber ich denke, 00000010 (0x4fbf98): 64 69 65 20 62 65 73 74 65 20 4d c3 b6 67 6c 69 die beste M..gli 00000020 (0x4fbfa8): 63 68 6b 65 69 74 20 73 65 69 6e 65 20 41 6e 67 chkeit seine Ang 00000030 (0x4fbfb8): 73 74 0a 7a 75 20 c3 bc 62 65 72 77 69 6e 64 65 st.zu ..berwinde 00000040 (0x4fbfc8): 6e 2c 20 69 73 74 20 64 61 72 c3 bc 62 65 72 20 n, ist dar..ber 00000050 (0x4fbfd8): 7a 75 20 72 65 64 65 6e 2e zu reden.
Created attachment 163498 [details] debug log this is a debug log of testcase_621428_ghostpadcaps.c GST_DEBUG=5 /testProgs/playbin-text file:///media/hdd/movie/mkv/BrokenPlayback2.mkv file:///media/hdd/movie/mkv/BrokenPlayback2.srt >testcase-ghostpad-nosrtsubs.log 2>&1
Test video: http://www.homeys-bunker.de/dm800/samples/BrokenPlayback2.mkv
This is a regression and should be fixed before 0.10.30. Shouldn't be too hard to fix.
I'm working on this now, there are some problems in your sample code but even after fixing them things don't work as they should.
Not a playbin2 bug... see the attached sample, which works and the FIXMEs I've added (you need to do that to make everything really work).
Created attachment 163699 [details] testcase_621428_ghostpadcaps.c
okay this actually enables srt subtitles and vob subtitles to all be correctly shown in the testcase. however, when i switch subtitle streams using g_object_set (G_OBJECT (m_gst_playbin), "current-text", pid, NULL); nothing really happens. so the gstGhostpadHasCAPS is not invoked by that and therefore it doesn't relink the elements in the subtitle bin
Created attachment 163910 [details] testcase supposed to switch between subtitle streams run with /testProgs/playbin-text file:///hdd/movie/mkv/BrokenPlayback3.mkv file:///hdd/movie/mkv/BrokenPlayback2.srt supposed to switch in between text stream 0 and 1 every 20 seconds but in the second callback, after it had switched to the vob stream successfully once, it seems to get stuck at line 221: g_object_set (G_OBJECT (app->playbin), "current-text", new_pid, NULL);
Is this still an issue with 1.0?
the stream selection works now attached, you'll find the test case with ported api. however, there is still one little problem with my code i guess. it starts with the first 10s worth of text lines from the srt subtitle file, then it switches over to dvd vobsub and displays a couple buffers until second 20. when it switches back to the srt subtitle stream at that moment, it will go through the first couple text lines once again gstGhostpadHasCAPS... text/x-raw, format=(string)pango-markup Linking ghostpad: appsink ** Message: received a subtitle at position 0:00:01.001118360, running_time 0:00:01.001126491 00000000 (0x7f819008ea60): 49 74 20 77 61 73 20 61 20 74 65 73 74 2e 0a 4a It was a test..J 00000010 (0x7f819008ea70): 75 64 67 6d 65 6e 74 2e 20 43 6f 6e 63 65 6e 74 udgment. Concent 00000020 (0x7f819008ea80): 72 61 74 69 6f 6e 2e 20 54 65 63 68 6e 69 71 75 ration. Techniqu 00000030 (0x7f819008ea90): 65 2e e. [....] switching from stream 0 to stream 1... switched to stream stream 1... GST_QUERY_ACCEPT_CAPS template=text/x-raw, format=(string){ utf8, pango-markup }; subpicture/x-dvd; subpicture/x-pgs accept=subpicture/x-dvd, codec_data=(buffer)2320566f6253756220696e6465782066696c652c2076372028646f206e6f74206d6f646966792074686973206c696e6521290a23200a23205468697320696e64657820626c6f636b207761732067656e657261746564206279204d616b654d4b562076312e352e3520626574612077696e287838362d72656c65617365290a2320776869636820686173206e6f2072656c6174696f6e20746f20566f6253756220736f6674776172652e205468652066697273740a23206c696e652061626f76652069732070726573656e7420666f7220636f6d7061746962696c69747920726561736f6e732e0a23200a73697a653a20373230783537360a6f72673a20302c20300a616c7068613a20313030250a736d6f6f74683a204f46460a66616465696e2f6f75743a2035302c2035300a616c69676e3a204f4646206174204c45465420544f500a74696d65206f66667365743a20300a666f7263656420737562733a204f46460a70616c657474653a203030303065312c206538336630372c203030303030302c206664666466642c203131656231302c206561313265622c206661666631612c203039356437362c203763376337632c206530653065302c203730316630332c203037373330372c203030303036632c206363306165392c206432616230662c203733303937320a23200a2320656e640a00 ?1 ** Message: received a subtitle at position 0:00:14.508000000, running_time 0:00:11.877558331 00000000 (0x7f818c3ada90): 0a c4 0a a5 00 00 00 00 00 00 00 00 00 00 00 00 ................ [...] switching from stream 1 to stream 0... switched to stream stream 0... ** Message: received a subtitle at position 0:00:06.351000000, running_time 0:00:20.500053573 00000000 (0x7f819008eb30): 49 74 20 77 61 73 20 61 20 74 65 73 74 2e 0a 4a It was a test..J 00000010 (0x7f819008eb40): 75 64 67 6d 65 6e 74 2e 20 43 6f 6e 63 65 6e 74 udgment. Concent 00000020 (0x7f819008eb50): 72 61 74 69 6f 6e 2e 20 54 65 63 68 6e 69 71 75 ration. Techniqu 00000030 (0x7f819008eb60): 65 2e e. ** Message: received a subtitle at position 0:00:06.671000000, running_time 0:00:20.500207752 00000000 (0x7f8190022190): 48 69 67 68 20 73 63 6f 72 65 73 20 6f 6e 20 65 High scores on e 00000010 (0x7f81900221a0): 76 65 72 79 74 68 69 6e 67 2e verything. ** Message: received a subtitle at position 0:00:19.232000000, running_time 0:00:20.500321898 00000000 (0x7f8190076a20): 4e 6f 77 2c 20 67 65 74 20 73 6f 6d 65 20 72 65 Now, get some re 00000010 (0x7f8190076a30): 73 74 2e st. ** Message: received a subtitle at position 0:00:21.913000000, running_time 0:00:20.500427514 00000000 (0x7f8190076ad0): 59 6f 75 20 6f 6b 61 79 3f You okay? ERROR: from element /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:tbin/GstBin:subtitle_bin/GstAppSink:subtitle_sink: Internal data flow problem. Additional debug info: gstbasesink.c(3226): gst_base_sink_chain_unlocked (): /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:tbin/GstBin:subtitle_bin/GstAppSink:subtitle_sink: Received buffer without a new-segment. Assuming timestamps start from 0. ** Message: received a subtitle at position 0:00:24.638000000, running_time 0:00:21.914161901 00000000 (0x7f8190076b80): 49 20 66 65 65 6c 20 61 20 6c 6f 74 20 62 65 74 I feel a lot bet 00000010 (0x7f8190076b90): 74 65 72 20 6e 6f 77 2e ter now.
Created attachment 230044 [details] new testcase with 1.0 api
Created attachment 230045 [details] sample srt file
So not a bug anymore, stream switching works and when switching to the external subtitle file you get everything again. This happens because it will seek to the beginning again to make stream switches happen immediately. Your sink should clip all buffers outside the segment and before the current time.
aye aye and thanks for the hint!