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 340887 - add pangocairo textoverlay plugin.
add pangocairo textoverlay plugin.
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.x
Other All
: Normal enhancement
: 0.10.25
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 320395 557784 (view as bug list)
Depends on: 320395
Blocks: 358213
 
 
Reported: 2006-05-07 06:48 UTC by Young-Ho Cha
Modified: 2009-08-04 10:48 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
pangocairo textoverlay patch (15.89 KB, patch)
2006-05-10 15:00 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (25.92 KB, patch)
2006-05-10 17:15 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (26.37 KB, patch)
2006-05-11 16:07 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (26.60 KB, patch)
2006-05-11 16:38 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (26.69 KB, patch)
2006-05-11 17:08 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (27.04 KB, patch)
2006-05-12 15:52 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (27.03 KB, patch)
2006-05-13 13:11 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (29.42 KB, patch)
2006-05-13 19:47 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (32.33 KB, patch)
2006-05-15 15:39 UTC, Young-Ho Cha
none Details | Review
check pangocairo in configure (612 bytes, patch)
2006-05-16 01:46 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (31.29 KB, patch)
2006-05-16 05:24 UTC, Young-Ho Cha
none Details | Review
check pangocairo in configure (569 bytes, patch)
2006-06-24 00:37 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (33.19 KB, patch)
2006-06-24 00:45 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (33.63 KB, patch)
2006-06-24 02:41 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (33.64 KB, patch)
2006-11-22 13:24 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (37.10 KB, patch)
2007-03-01 04:48 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (37.10 KB, patch)
2007-03-01 04:50 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (37.29 KB, patch)
2007-03-01 05:55 UTC, Young-Ho Cha
none Details | Review
check pangocairo in configure (1.39 KB, patch)
2007-03-04 04:25 UTC, Young-Ho Cha
rejected Details | Review
pangocairo textoverlay patch (37.78 KB, patch)
2007-03-04 04:42 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (37.30 KB, patch)
2007-03-08 05:27 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (37.63 KB, patch)
2007-08-18 09:54 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (37.63 KB, patch)
2008-03-11 08:41 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (37.39 KB, patch)
2008-05-07 05:58 UTC, Young-Ho Cha
none Details | Review
pangocairo textoverlay patch (37.74 KB, patch)
2008-06-20 08:57 UTC, Young-Ho Cha
needs-work Details | Review
pangocairo textoverlay patch (43.49 KB, patch)
2009-07-31 06:43 UTC, Young-Ho Cha
committed Details | Review

Description Young-Ho Cha 2006-05-07 06:48:54 UTC
Hi.

I hacked subparse plugin to support sami subtitle. see bug 169936.

In sami subtitle, it can assign font color, but pango and cairo textoverlay
plugins are not support that feature.

so, I'm hacking pango plugin, and now it works.

you can see some screenshot that works.

http://ftp.mizi.com/~ganadist/gst-color-subtitle.png
http://ftp.mizi.com/~ganadist/gstsubtitle-pangocairo.png

and you can download plugin below url.

http://ftp.mizi.com/~ganadist/gst-pangocairo.tgz

There are some need to work yet.
 1. wrap-mode property didn't work.
 2. need draw outline text.

could you review this? any comment welcome. :)
Comment 1 Young-Ho Cha 2006-05-08 16:12:25 UTC
I updated pangocairo plugin.

Now, plugin draw text shadow. so you can read easily subtitle image.

before: http://ftp.mizi.com/~ganadist/gst-color-subtitle.png
after: http://ftp.mizi.com/~ganadist/gst-color-shadow.png

and wrapmode property work.

you can download plugin below url.

http://ftp.mizi.com/~ganadist/gst-pangocairo-060509.tgz
Comment 2 Tim-Philipp Müller 2006-05-10 08:45:55 UTC
Nice, this might resolve bug #320395 as well.

The only problem with this is that this means we need to require a newer Pango version and we need to check whether the Pango version required isn't "too new" for what we want to require. That needs looking into.

It would be great if you could post a patch (created with 'diff -u' or 'cvs diff -u') against the current version of pango textoverlay in CVS. That makes it easier to review for us.


Comment 3 Young-Ho Cha 2006-05-10 15:00:37 UTC
Created attachment 65166 [details] [review]
pangocairo textoverlay patch
Comment 4 Young-Ho Cha 2006-05-10 15:08:15 UTC
currently, I changed only textoverlay plugin.

If anyone teach ARGB to AYUV conversion formula, I'll work to change textrender plugin too.
Comment 5 Young-Ho Cha 2006-05-10 17:15:34 UTC
Created attachment 65180 [details] [review]
pangocairo textoverlay patch

I modified textrender plugin, too.

but I can't test that.

I try like this, but it was not working.

How I can test textrender plugin?

$ GST_DEBUG=pango:5 gst-launch -v filesrc location=Fate/Stay\ Night\ 01.smi ! subparse ! textrender ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/pipeline0/subparse0.src: caps = text/x-pango-markup
/pipeline0/textrender0.sink: caps = text/x-pango-markup
DEBUG (0x820df98 - 0:00:00.413317000)                pango(28660) gsttextrender.c(299):gst_text_render_chain: rendering ' '
DEBUG (0x820df98 - 0:00:00.588833000)                pango(28660) gsttextrender.c(208):gst_text_render_setcaps: Got caps video/x-raw-yuv, format=(fourcc)AYUV, width=(int)0, height=(int)13, framerate=(fraction)1/1
/pipeline0/textrender0.src: caps = video/x-raw-yuv, format=(fourcc)AYUV, width=(int)0, height=(int)13, framerate=(fraction)1/1
DEBUG (0x820df98 - 0:00:00.589231000)                pango(28660) gsttextrender.c(316):gst_text_render_chain: Allocating AYUV buffer WxH = 0x13
ERROR: from element /pipeline0/filesrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(1479): gst_base_src_loop (): /pipeline0/filesrc0:
streaming task paused, reason unexpected
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
/pipeline0/textrender0.sink: caps = NULL
/pipeline0/textrender0.src: caps = NULL
/pipeline0/subparse0.src: caps = NULL
FREEING pipeline ...
Comment 6 Young-Ho Cha 2006-05-11 16:07:22 UTC
Created attachment 65255 [details] [review]
pangocairo textoverlay patch

avoid render NULL string in textrender plugin.
add width because keep image buffer when render whitespace only in textrender plugin.
little optimize in argb to yuv conversion in textoverlay plugin.
shadow offset is now in the ratio of font size.
Comment 7 Young-Ho Cha 2006-05-11 16:10:17 UTC
now textrender plugin is working, too.

I test with this command and textrender plugin also can render colored subtitle.

$ gst-launch -v filesrc location=test.smi ! subparse ! textrender font-desc=Gulim\ 30 ! ffmpegcolorspace !  ximagesink

Comment 8 Young-Ho Cha 2006-05-11 16:38:03 UTC
Created attachment 65256 [details] [review]
pangocairo textoverlay patch

fix segfault when subtitle image height is larger then overlay height.
Comment 9 Young-Ho Cha 2006-05-11 17:08:47 UTC
Created attachment 65261 [details] [review]
pangocairo textoverlay patch

sorry for change very often. but I think this is last change in today. :)

add some margin for render shadow completely in textoverlay plugin.
Comment 10 Young-Ho Cha 2006-05-12 15:52:46 UTC
Created attachment 65327 [details] [review]
pangocairo textoverlay patch

improved gst_text_overlay_blit_sub2x2cbcr()
 argb sampling more correctly.
 more optimization.
Comment 11 Young-Ho Cha 2006-05-13 13:11:12 UTC
Created attachment 65379 [details] [review]
pangocairo textoverlay patch

more optimization in gst_text_overlay_blit_1()
remove useless cairo operation in gst_text_overlay_render_pangocairo()
Comment 12 Young-Ho Cha 2006-05-13 19:47:31 UTC
Created attachment 65396 [details] [review]
pangocairo textoverlay patch

I found when other mediaplayers render subtitle, draw with outline.
so implement it.

and fix some bugs that related with subtitle layout. 

I wish this will be last update. :)
Comment 13 Young-Ho Cha 2006-05-15 15:39:13 UTC
Created attachment 65507 [details] [review]
pangocairo textoverlay patch

change to draw shaded background with cairo.
calculrate shadow and outline offset when inited and font changed only.
Comment 14 Young-Ho Cha 2006-05-16 01:46:33 UTC
Created attachment 65565 [details] [review]
check pangocairo in configure
Comment 15 Young-Ho Cha 2006-05-16 05:24:43 UTC
Created attachment 65570 [details] [review]
pangocairo textoverlay patch

improved drawing outline text.
clamp image_height.
Comment 16 Young-Ho Cha 2006-06-24 00:37:46 UTC
Created attachment 67917 [details] [review]
check pangocairo in configure

update patch against cvs HEAD
Comment 17 Young-Ho Cha 2006-06-24 00:45:15 UTC
Created attachment 67918 [details] [review]
pangocairo textoverlay patch

update patch against cvs HEAD
add 'auto-resize' property for fit overlay text size in proportion to output resolution.
It can help to resolve bug 305051.
Comment 18 Young-Ho Cha 2006-06-24 02:41:16 UTC
Created attachment 67922 [details] [review]
pangocairo textoverlay patch

use logical_rect instead of ink_rect when calculate width.
set pango layout width with DEFAULT_SCALE_BASIS(640 pixel)
Comment 19 Young-Ho Cha 2006-11-22 13:24:33 UTC
Created attachment 77024 [details] [review]
pangocairo textoverlay patch

regenerate patch against HEAD
Comment 20 Young-Ho Cha 2007-03-01 04:48:01 UTC
Created attachment 83614 [details] [review]
pangocairo textoverlay patch

add vertical render property.

In Pango 1.16.0, add feature that render text to vertical direction.

so, I applied that in pango text overlay element.

Here is a screenshot.

Thanks to Behdad.

TODO:
 check pango version 1.16.0 and enable vertical text rendering feature.
Comment 21 Young-Ho Cha 2007-03-01 04:50:12 UTC
Created attachment 83615 [details] [review]
pangocairo textoverlay patch

There some some testlet code in previous patch.

Upload patch again.
Comment 22 Young-Ho Cha 2007-03-01 04:51:53 UTC
Here is a screenshot that work vertical subtitle rendering

http://ftp.mizi.com/~ganadist/sub-vertical.png
Comment 23 Young-Ho Cha 2007-03-01 05:55:55 UTC
Created attachment 83619 [details] [review]
pangocairo textoverlay patch

adjust layout width when render vertically.
Comment 24 Tim-Philipp Müller 2007-03-01 09:33:08 UTC
This is cool stuff! I'll look into adding this after the upcoming -base release.
Comment 25 Young-Ho Cha 2007-03-04 04:25:15 UTC
Created attachment 83862 [details] [review]
check pangocairo in configure

check pangocairo version to enable vertical rendering.
Comment 26 Young-Ho Cha 2007-03-04 04:42:23 UTC
Created attachment 83863 [details] [review]
pangocairo textoverlay patch

- rename USE_VERTICAL_RENDER to HAVE_PANGO_VERTICAL_WRITING
- don't use cairo_scale and use cairo_matrix to scale
Comment 27 Young-Ho Cha 2007-03-08 05:27:23 UTC
Created attachment 84215 [details] [review]
pangocairo textoverlay patch

 fix compile with pango 1.14
 remove duplicated Makefile.am with attachment:83862
Comment 28 Young-Ho Cha 2007-08-18 09:54:38 UTC
Created attachment 93892 [details] [review]
pangocairo textoverlay patch

update against CVS HEAD.
when blend with video and subtitle image, if subtitle's alpha pixel value is 0, then skip. It would make blending speedup, cause subtitle surface have many 0 alpha -value pixel.
Comment 29 Young-Ho Cha 2008-03-11 08:41:45 UTC
Created attachment 107039 [details] [review]
pangocairo textoverlay patch 

update against CVS HEAD.
Comment 30 Young-Ho Cha 2008-05-07 05:58:54 UTC
Created attachment 110509 [details] [review]
pangocairo textoverlay patch

update against CVS HEAD.
Comment 31 Young-Ho Cha 2008-06-20 08:57:54 UTC
Created attachment 113099 [details] [review]
pangocairo textoverlay patch 

update against CVS HEAD.
Comment 32 Edward Hervey 2009-03-11 08:35:34 UTC
Young-Ho, I'm confused. How is this different from the cairotextoverlay provided by the cairo plugin in -good ?
Comment 33 David Schleef 2009-03-11 19:34:54 UTC
cairotextoverlay uses the cairo "toy" text API.  A full-featured text overlay element should use pangocairo.  Both pango and cairo provide useful non-overlapping features, and pangocairo is an unstoppable force.

Once a pangocairo text overlay is part of base/good, the only reason for cairotextoverlay is for applications that only require minimal features and few required packages.
Comment 34 Sebastian Dröge (slomo) 2009-07-30 12:38:40 UTC
I'm closing this bug as a duplicate of #557784 now. The patch there is the better solution (always use pango's cairo backend in textoverlay).

This patch here seems to provide some additional changes that would be nice to have "ported" to the other patch though.

*** This bug has been marked as a duplicate of 557784 ***
Comment 35 Sebastian Dröge (slomo) 2009-07-30 12:40:26 UTC
Doh, I should read more carefully. This patch does the same as the one in bug #557784 , so bug #557784 should probably be a duplicate of this one and both patches should be merged.
Comment 36 Sebastian Dröge (slomo) 2009-07-30 12:41:00 UTC
*** Bug 557784 has been marked as a duplicate of this bug. ***
Comment 37 Sebastian Dröge (slomo) 2009-07-30 12:43:08 UTC
*** Bug 320395 has been marked as a duplicate of this bug. ***
Comment 38 Sebastian Dröge (slomo) 2009-07-30 12:45:39 UTC
The patch doesn't apply anymore unfortunately, needs some work and needs to be merged with the one from bug #557784 (if useful) and then committed.
Comment 39 Young-Ho Cha 2009-07-31 06:43:28 UTC
Created attachment 139605 [details] [review]
pangocairo textoverlay patch

update pangocairo patch against git master.
 * add support uyvy colorspace.
Comment 40 Sebastian Dröge (slomo) 2009-08-04 09:59:09 UTC
Thanks, I've committed this and will push it after 0.10.24 release.

commit 196763f450e3bdbb0e7d41c6f74446520d5d52be
Author: Young-Ho Cha <ganadist@chollian.net>
Date:   Tue Aug 4 11:35:10 2009 +0200

    pango: Use pango-cairo instead of pango-ft2
    
    pango-cairo will always use the native font rendering backend
    of the platform and provides better results.
    
    Fixes bug #340887.
Comment 41 Sebastian Dröge (slomo) 2009-08-04 10:48:10 UTC
FYI I've also fixed and cleaned some things and added support for xRGB/BGRx :)