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 721925 - video-sink: add overlay composition support
video-sink: add overlay composition support
Status: RESOLVED FIXED
Product: clutter-gst
Classification: Other
Component: general
2.0.x
Other Linux
: Normal normal
: ---
Assigned To: clutter-gst-maint
clutter-gst-maint
: 674547 (view as bug list)
Depends on:
Blocks: 497130 515240 720835
 
 
Reported: 2014-01-10 11:36 UTC by Matthieu Bouron
Modified: 2014-09-04 09:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH 1/3] video-sink: correctly reference the upload texture in the GLTextureUploadRenderer (3.58 KB, patch)
2014-01-10 11:38 UTC, Matthieu Bouron
none Details | Review
[PATCH 2/3] video-sink: fix gl_target type in the GLTextureUploadRenderer (1.28 KB, patch)
2014-01-10 11:38 UTC, Matthieu Bouron
none Details | Review
[PATCH 3/3] video-sink: add overlay composition rendering support to the GLTextureUploadRenderer (8.35 KB, patch)
2014-01-10 11:39 UTC, Matthieu Bouron
none Details | Review
[PATCH 3/3] video-sink: add overlay composition rendering support to the GLTextureUploadRenderer (8.39 KB, patch)
2014-01-16 17:05 UTC, Matthieu Bouron
none Details | Review
video-sink: add overlay composition support (15.26 KB, patch)
2014-03-04 18:30 UTC, Matthieu Bouron
none Details | Review
video-sink: add overlay composition support (15.31 KB, patch)
2014-03-05 19:58 UTC, Matthieu Bouron
none Details | Review
video-sink: add overlay composition support (15.34 KB, patch)
2014-03-05 20:05 UTC, Matthieu Bouron
none Details | Review
video-sink: add overlay composition support (15.33 KB, patch)
2014-03-05 20:27 UTC, Matthieu Bouron
none Details | Review

Description Matthieu Bouron 2014-01-10 11:36:32 UTC
This patch add overlay composition rendering support to the GLTextureUploadRenderer. It is used for example for subtitles rendering with an hardware decoder capable of using the GLTextureUploadMeta API.

In order to do such, the GLTextureUploadRenderer uses an offscreen framebuffer.
For each rectangle that should be composited a new overlay transparent texture is created, then the rectangle region is applied on it, then the overlay texture is composited onto the input texture using a shader.
This procedure is repeated for each rectangle using the last result of the framebuffer as input. There might be room for improvement here since, a copy of the frambuffer texture is done, I didn't find a way to swap the texture of the framebuffer using the cogl api.

Development branch (including the deinterlace feature) can be found here: http://cgit.collabora.com/git/user/mateo/clutter-gst.git/log/?h=clutter-gst-2.0/deinterlace-overlay-gltextureuploadrenderer
Comment 1 Matthieu Bouron 2014-01-10 11:38:04 UTC
Created attachment 265906 [details] [review]
[PATCH 1/3] video-sink: correctly reference the upload texture in the GLTextureUploadRenderer
Comment 2 Matthieu Bouron 2014-01-10 11:38:30 UTC
Created attachment 265907 [details] [review]
[PATCH 2/3] video-sink: fix gl_target type in the GLTextureUploadRenderer
Comment 3 Matthieu Bouron 2014-01-10 11:39:38 UTC
Created attachment 265908 [details] [review]
[PATCH 3/3] video-sink: add overlay composition rendering support to the GLTextureUploadRenderer
Comment 4 Nicolas Dufresne (ndufresne) 2014-01-16 17:00:51 UTC
I'm not a big fad of doing shader composition. Unless I'm mistaken, it means that subtitle buffers are still negotiated base on the video size rather then the display size. Might be ok as a first step, but it's not really the right direction in order to achieve high quality subtitle and close captioning.
Comment 5 Matthieu Bouron 2014-01-16 17:05:24 UTC
Created attachment 266487 [details] [review]
[PATCH 3/3] video-sink: add overlay composition rendering support to the GLTextureUploadRenderer

Fixes a material leak.
Comment 6 Bastien Nocera 2014-02-26 16:02:06 UTC
*** Bug 674547 has been marked as a duplicate of this bug. ***
Comment 7 Matthieu Bouron 2014-03-04 18:30:51 UTC
Created attachment 270929 [details] [review]
video-sink: add overlay composition support

Patch updated. Overlay composition is now implemented using a proper clutter offscreen effect and is available for all formats supported by cluttersink.

The patch applies on-top of the colorbalance patch: https://bugzilla.gnome.org/show_bug.cgi?id=663204

Repo: http://cgit.collabora.com/git/user/mateo/clutter-gst.git/log/?h=colorbalance/overlay
Comment 8 Matthieu Bouron 2014-03-05 19:58:17 UTC
Created attachment 271025 [details] [review]
video-sink: add overlay composition support

Patch updated, the overlay texture was not unref after being used by the material in ClutterGstOverlayEffect.paint_target.
Comment 9 Matthieu Bouron 2014-03-05 20:05:00 UTC
Created attachment 271026 [details] [review]
video-sink: add overlay composition support

Patch updated, adding missing cogl object unref on the overlay texture in the video-sink. Sorry the noise.
Comment 10 Matthieu Bouron 2014-03-05 20:27:34 UTC
Created attachment 271030 [details] [review]
video-sink: add overlay composition support

Correct version of the patch attached, unref the cogl material related to the overlay in ClutterGstOverlayEffect.paint_target instead of unref the overlay cogl texture.
Comment 11 Lionel Landwerlin 2014-06-07 10:15:07 UTC
I just push 2 commits to master to implement overlay composition support in a slightly different way :

https://git.gnome.org/browse/clutter-gst/commit/?id=541e1078cbbe61c1a5da61ef53c848b2dc3f5fe3

https://git.gnome.org/browse/clutter-gst/commit/?id=3fe0658a4555abd324cff1bd0ea805a5f75bda63

The idea is to create separate nodes in the render graph to avoid writing onto each video frame. That way the video frames are never accessed by the CPU if you have decoding done in hardware.

Thanks a lot for submitting the patch though.
Comment 12 Bastien Nocera 2014-09-04 01:39:02 UTC
This is only clutter-gst 3.0 material, right? Could you add some examples of using it?
Comment 13 Lionel Landwerlin 2014-09-04 09:15:46 UTC
There is nothing special about using this feature.
It just works by default.