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 697071 - kate: port Kate subtitle plugin to 1.0
kate: port Kate subtitle plugin to 1.0
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-04-01 21:06 UTC by Brendan Long
Modified: 2018-11-03 13:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to port Kate subtitles to 1.0 (37.32 KB, patch)
2013-04-01 21:06 UTC, Brendan Long
none Details | Review
Example program which attaches probes to all text pads and prints subtitles (2.59 KB, text/x-c++src)
2013-04-01 21:15 UTC, Brendan Long
  Details
Updated patch with correct caps (36.81 KB, patch)
2013-04-02 02:07 UTC, Brendan Long
none Details | Review
Updated patch where caps negotation works again (36.89 KB, patch)
2013-04-02 03:59 UTC, Brendan Long
none Details | Review
Update patch to add buffer unreffing back and add 'utf8' to caps (36.58 KB, patch)
2013-04-02 16:59 UTC, Brendan Long
committed Details | Review
Work in progress to fix Kate tests (17.29 KB, patch)
2013-04-15 17:59 UTC, Brendan Long
none Details | Review
Port Kate tests to 1.0 -- 3 failures still (14.66 KB, patch)
2013-04-15 23:31 UTC, Brendan Long
none Details | Review

Description Brendan Long 2013-04-01 21:06:35 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.
Comment 1 Brendan Long 2013-04-01 21:15:47 UTC
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)
Comment 2 Brendan Long 2013-04-02 02:04:10 UTC
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.
Comment 3 Brendan Long 2013-04-02 02:07:39 UTC
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..
Comment 4 Brendan Long 2013-04-02 03:59:01 UTC
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.
Comment 5 Brendan Long 2013-04-02 16:59:49 UTC
Created attachment 240413 [details] [review]
Update patch to add buffer unreffing back and add 'utf8' to caps
Comment 6 Brendan Long 2013-04-02 21:00:28 UTC
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?).
Comment 7 Tim-Philipp Müller 2013-04-15 00:07:13 UTC
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
Comment 8 Brendan Long 2013-04-15 17:45:29 UTC
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.
Comment 9 Brendan Long 2013-04-15 17:59:28 UTC
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.
Comment 10 Tim-Philipp Müller 2013-04-15 22:15:31 UTC
> 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.
Comment 11 Brendan Long 2013-04-15 22:19:54 UTC
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.
Comment 12 Tim-Philipp Müller 2013-04-15 23:25:46 UTC
I've started porting the tiger element btw.
Comment 13 Brendan Long 2013-04-15 23:31:18 UTC
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
Comment 14 Tim-Philipp Müller 2013-04-22 12:47:54 UTC
I've found the problems with the last three unit tests. Will push your patch and a fix later.
Comment 15 Brendan Long 2013-04-22 14:58:01 UTC
Thanks, I meant to go back and look at them again and just haven't had time.
Comment 16 Sebastian Dröge (slomo) 2013-04-23 07:34:17 UTC
What's missing here now? The port of the tiger element?
Comment 17 Tim-Philipp Müller 2013-04-23 08:16:58 UTC
Yes, I'm working on the tiger port.

Also kept it open to make unit test valgrind clean (or at least fix the leaks).
Comment 18 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-21 19:18:27 UTC
Tim, do you have a wip tiger patch?
Comment 19 GStreamer system administrator 2018-11-03 13:15:13 UTC
-- 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.