GNOME Bugzilla – Bug 697071
kate: port Kate subtitle plugin to 1.0
Last modified: 2018-11-03 13:15:13 UTC
Created attachment 240329 [details] [review] Patch to port Kate subtitles to 1.0 I need Kate plugins to work for a project I'm working on, but it hasn't been ported yet, so I went through and did some work on it myself. The plugin seems to work with this patch, but the overlay subtitles aren't showing up, so I assume I missed something. If I run it through a test program which attaches buffer probes to every pad, I see all of the subtitles, but they don't show up on the video. Could someone take a look at this? I can work on it more, but I'm not sure what I'm missing.
Created attachment 240332 [details] Example program which attaches probes to all text pads and prints subtitles Run this with: libtool --mode=link g++ -o text_example text_example.cpp -g `pkg-config --cflags --libs gstreamer-1.0` ./text_example [some .ogv file with subtitles] The files I've been using are: http://dl.dropbox.com/u/61100892/counting-subtitled.ogv Interestingly, it only logs the first subtitle when I play it remotely, but if I play it locally it shows all of them. This video should work too, but I don't get any output, even logging: http://ftp.nluug.nl/ftp/graphics/blender/apricot/trailer/sintel_trailer-480p.ogv (But it does complain if it can't find the kate plugin)
You can also see the subtitles going by with: GST_DEBUG=katedec:6 gst-launch-1.0 playbin uri=file://path/to/something.ogv Interestingly, it seems to be pushing subtitles into the src pad, but they never show up on the video.
Created attachment 240341 [details] [review] Updated patch with correct caps This patch correctly sets the caps for marked up subtitles to text/x-raw, format=pango-markup. It still doesn't display anything..
Created attachment 240342 [details] [review] Updated patch where caps negotation works again That last patch fixed some code that was supposed to send caps events before sending buffers, but apparently doing that broke caps negotation, so I turned it back off.
Created attachment 240413 [details] [review] Update patch to add buffer unreffing back and add 'utf8' to caps
I've gone over the porting list several times, and the only thing I can think of is that maybe I'm not sending the stream headers correctly? http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/random/porting-to-1.0.txt The list says that that's "not implemented yet" though, and I can't find any documentation about stream headers. It seems to match the symptoms though (since elements aren't supposed to play things until they get a stream header?).
Thanks, pushed your patch and fixed up some things I noticed. Text at least seems to work for me now. commit 1dd53d64e8324b2e4537d5ebc6b9fec00b84dfaf Author: Tim-Philipp Müller <tim@centricular.net> Date: Mon Apr 15 00:48:36 2013 +0100 kate: only send decoder output caps once or when the format changes and not for every single buffer. And also send a caps event for spu output. https://bugzilla.gnome.org/show_bug.cgi?id=697071 commit a3ad6eaf2d8285e9af588a7a9d99d0e1de9daf94 Author: Tim-Philipp Müller <tim@centricular.net> Date: Sun Apr 14 23:22:40 2013 +0100 kate: fix decoder output caps It's either pango-markup or utf8, never both at the same time. https://bugzilla.gnome.org/show_bug.cgi?id=697071 commit 46f979a83957b76c64b5caabfa7d5cd424eedf7d Author: Tim-Philipp Müller <tim@centricular.net> Date: Sun Apr 14 23:19:44 2013 +0100 kate: mark header buffers as such commit 8da7230c881e75a94a171a1d2b152af4d88a7c2f Author: Tim-Philipp Müller <tim@centricular.net> Date: Sun Apr 14 23:08:40 2013 +0100 kateenc: save current input format in setcaps commit b8d4b6f3bdc3089fa4707d2b4f713f6b1ac25151 Author: Tim-Philipp Müller <tim@centricular.net> Date: Sun Apr 14 21:28:51 2013 +0100 kate: fix printf format strings and disable tiger element commit b261bd516f65a713d6753b65177378185ebaba80 Author: Brendan Long <b.long@cablelabs.com> Date: Mon Apr 1 12:47:13 2013 -0600 kate: port Kate subtitles to 1.0 https://bugzilla.gnome.org/show_bug.cgi?id=697071 Keeping bug open for 1) port of tiger element 2) port of unit tests
I've been looking at the unit tests, and I'm wondering if there's a better way of creating buffers than this: inbuffer = gst_buffer_new_allocate (NULL, sizeof(kate_header_0x80), NULL); fail_if (inbuffer == NULL); fail_if (gst_buffer_map(inbuffer, &info, GST_MAP_WRITE) != TRUE); memcpy (info.data, kate_header_0x80, sizeof (kate_header_0x80)); gst_buffer_unmap (inbuffer, &info); I'd like to use gst_buffer_new_wrapped, but that takes ownership of the memory, which I assume wouldn't work with static variables.
Created attachment 241583 [details] [review] Work in progress to fix Kate tests I made the Kate tests compile, but most of them fail. I think the problem is missing caps events. I'll try to work on this more tomorrow, but I figured I'd most it in case someone else is working on this and it's helpful.
> I've been looking at the unit tests, and I'm wondering if there's a better way > of creating buffers than this: > > inbuffer = gst_buffer_new_allocate (NULL, sizeof(kate_header_0x80), NULL); > fail_if (inbuffer == NULL); > fail_if (gst_buffer_map(inbuffer, &info, GST_MAP_WRITE) != TRUE); > memcpy (info.data, kate_header_0x80, sizeof (kate_header_0x80)); > gst_buffer_unmap (inbuffer, &info); > > I'd like to use gst_buffer_new_wrapped, but that takes ownership of the memory, > which I assume wouldn't work with static variables. You can use gst_buffer_fill(),or just pass g_memdup (data, size), size, it's not like efficiency matters here. But you can also use new_wrapped_full and pass something as free function that does nothing to make sure it doesn't get freed.
Ok thanks. I'll probably go with: gst_buffer_new_wrapped (g_memdup (kate_header_0x80, sizeof (kate_header_0x80)), sizeof (kate_header_0x80)); I didn't realize that function existed. I wasn't really concerned with efficiency, I just don't want to make the code confusing.
I've started porting the tiger element btw.
Created attachment 241603 [details] [review] Port Kate tests to 1.0 -- 3 failures still I updated this to use g_memdup() and now correctly send caps events. There are still 3 failures though: 72%: Checks: 11, Failures: 3, Errors: 0 elements/kate.c:352:F:general:test_kate_identification_header:0: Failure '(message = gst_bus_pop (bus)) == NULL' occured elements/kate.c:422:F:general:test_kate_encode_empty:0: Assertion 'gst_pad_push (myencsrcpad, inbuffer) == GST_FLOW_ERROR' failed elements/kate.c:472:F:general:test_kate_encode_simple:0: Assertion 'gst_pad_push (myencsrcpad, inbuffer) == GST_FLOW_OK' failed
I've found the problems with the last three unit tests. Will push your patch and a fix later.
Thanks, I meant to go back and look at them again and just haven't had time.
What's missing here now? The port of the tiger element?
Yes, I'm working on the tiger port. Also kept it open to make unit test valgrind clean (or at least fix the leaks).
Tim, do you have a wip tiger patch?
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/91.