GNOME Bugzilla – Bug 340887
add pangocairo textoverlay plugin.
Last modified: 2009-08-04 10:48:10 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. :)
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
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.
Created attachment 65166 [details] [review] pangocairo textoverlay patch
currently, I changed only textoverlay plugin. If anyone teach ARGB to AYUV conversion formula, I'll work to change textrender plugin too.
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 ...
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.
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
Created attachment 65256 [details] [review] pangocairo textoverlay patch fix segfault when subtitle image height is larger then overlay height.
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.
Created attachment 65327 [details] [review] pangocairo textoverlay patch improved gst_text_overlay_blit_sub2x2cbcr() argb sampling more correctly. more optimization.
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()
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. :)
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.
Created attachment 65565 [details] [review] check pangocairo in configure
Created attachment 65570 [details] [review] pangocairo textoverlay patch improved drawing outline text. clamp image_height.
Created attachment 67917 [details] [review] check pangocairo in configure update patch against cvs HEAD
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.
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)
Created attachment 77024 [details] [review] pangocairo textoverlay patch regenerate patch against HEAD
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.
Created attachment 83615 [details] [review] pangocairo textoverlay patch There some some testlet code in previous patch. Upload patch again.
Here is a screenshot that work vertical subtitle rendering http://ftp.mizi.com/~ganadist/sub-vertical.png
Created attachment 83619 [details] [review] pangocairo textoverlay patch adjust layout width when render vertically.
This is cool stuff! I'll look into adding this after the upcoming -base release.
Created attachment 83862 [details] [review] check pangocairo in configure check pangocairo version to enable vertical rendering.
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
Created attachment 84215 [details] [review] pangocairo textoverlay patch fix compile with pango 1.14 remove duplicated Makefile.am with attachment:83862
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.
Created attachment 107039 [details] [review] pangocairo textoverlay patch update against CVS HEAD.
Created attachment 110509 [details] [review] pangocairo textoverlay patch update against CVS HEAD.
Created attachment 113099 [details] [review] pangocairo textoverlay patch update against CVS HEAD.
Young-Ho, I'm confused. How is this different from the cairotextoverlay provided by the cairo plugin in -good ?
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.
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 ***
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.
*** Bug 557784 has been marked as a duplicate of this bug. ***
*** Bug 320395 has been marked as a duplicate of this bug. ***
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.
Created attachment 139605 [details] [review] pangocairo textoverlay patch update pangocairo patch against git master. * add support uyvy colorspace.
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.
FYI I've also fixed and cleaned some things and added support for xRGB/BGRx :)