[FFmpeg-soc] [soc]: r5848 - in libavfilter: diffs/03_doc_filters.diff vf_drawtext.c

stefano subversion at mplayerhq.hu
Sun Jul 4 21:08:10 CEST 2010


Author: stefano
Date: Sun Jul  4 21:08:10 2010
New Revision: 5848

Log:
Allow the drawtext filter to set opacity through an alpha specifier in
the color string.

Modified:
   libavfilter/diffs/03_doc_filters.diff
   libavfilter/vf_drawtext.c

Modified: libavfilter/diffs/03_doc_filters.diff
==============================================================================
--- libavfilter/diffs/03_doc_filters.diff	Sun Jul  4 20:39:41 2010	(r5847)
+++ libavfilter/diffs/03_doc_filters.diff	Sun Jul  4 21:08:10 2010	(r5848)
@@ -2,7 +2,7 @@ Index: doc/filters.texi
 ===================================================================
 --- doc/filters.texi	(revision 24040)
 +++ doc/filters.texi	(working copy)
-@@ -39,6 +39,111 @@
+@@ -39,6 +39,114 @@
  
  The default value of @var{width} and @var{height} is 0.
  
@@ -66,7 +66,8 @@ Index: doc/filters.texi
 + at item fgcolor
 +
 +The foreground color to be used for drawing text.
-+Either a string (e.g. ``red'') or in 0xRRGGBB[AA] format (e.g. ``0xff000033'').
++Either a string (e.g. ``red'') or in 0xRRGGBB[AA] format
++(e.g. ``0xff000033''), possibly followed by an alpha specifier.
 +
 +The default value of @var{fgcolor} is black.
 +
@@ -74,7 +75,8 @@ Index: doc/filters.texi
 +
 +The background color to be used for drawing box around text or drawing
 +text outline based on option selected.
-+Either a string (e.g. ``yellow'') or in 0xRRGGBB[AA] format (e.g. ``0xff00ff'').
++Either a string (e.g. ``yellow'') or in 0xRRGGBB[AA] format
++(e.g. ``0xff00ff''), possibly followed by an alpha specifier.
 +
 +The default value of @var{bgcolor} is white.
 +
@@ -96,11 +98,12 @@ Index: doc/filters.texi
 +
 + at example
 +drawtext="fontfile=FreeSerif.ttf: text='Test Text': x=100: y=50: fontsize=24:
-+          fgcolor=0xff00ff33: bgcolor=red: box=1"
++          fgcolor=yellow@@0.2: bgcolor=red@@0.2: box=1"
 + at end example
 +
 +Draw 'Test Text' with font FreeSerif of size 24 at (100,50), text color is yellow,
-+background color is red, draw a box around text.
++background color is red, draw a box around text. Both the text and the
++box have an opacity of 20%.
 +
 +Note that the double quotes are not necessary if spaces are not used within
 +the parameter list.
@@ -114,7 +117,7 @@ Index: doc/filters.texi
  @section format
  
  Convert the input video to one of the specified pixel formats.
-@@ -56,6 +161,30 @@
+@@ -56,6 +164,30 @@
  
  will convert the input video to the format ``yuv420p''.
  
@@ -145,7 +148,7 @@ Index: doc/filters.texi
  @section noformat
  
  Force libavfilter not to use any of the specified pixel formats for the
-@@ -77,6 +206,56 @@
+@@ -77,6 +209,56 @@
  
  Pass the source unchanged to the output.
  
@@ -202,7 +205,7 @@ Index: doc/filters.texi
  @section pad
  
  Add paddings to the input image, and places the original input at the
-@@ -112,6 +291,14 @@
+@@ -112,6 +294,14 @@
  
  @end table
  
@@ -217,7 +220,7 @@ Index: doc/filters.texi
  @section scale
  
  Scale the input video to @var{width}:@var{height} and/or convert the image format.
-@@ -137,6 +324,24 @@
+@@ -137,6 +327,24 @@
  
  The default value of @var{width} and @var{height} is 0.
  
@@ -242,7 +245,7 @@ Index: doc/filters.texi
  @section slicify
  
  Pass the images of input video on to next video filter as multiple
-@@ -152,6 +357,19 @@
+@@ -152,6 +360,19 @@
  Adding this in the beginning of filter chains should make filtering
  faster due to better use of the memory cache.
  
@@ -262,7 +265,7 @@ Index: doc/filters.texi
  @section unsharp
  
  Sharpen or blur the input video.
-@@ -217,6 +435,32 @@
+@@ -217,6 +438,32 @@
  
  Below is a description of the currently available video sources.
  

Modified: libavfilter/vf_drawtext.c
==============================================================================
--- libavfilter/vf_drawtext.c	Sun Jul  4 20:39:41 2010	(r5847)
+++ libavfilter/vf_drawtext.c	Sun Jul  4 21:08:10 2010	(r5848)
@@ -133,14 +133,8 @@ static inline int extract_color(AVFilter
     color[0] = RGB_TO_Y(rgba[0], rgba[1], rgba[2]);
     color[1] = RGB_TO_U(rgba[0], rgba[1], rgba[2], 0);
     color[2] = RGB_TO_V(rgba[0], rgba[1], rgba[2], 0);
+    color[3] = rgba[3];
 
-    /* FIXME: av_parse_color currently sets alpha to 0 if no alpha is specified.
-     * So we force alpha = 0xFF (opaque), here in such a case.
-     */
-    if (rgba[3] != 0)
-        color[3] = rgba[3];
-    else
-        color[3] = 0xFF;
     return 0;
 }
 


More information about the FFmpeg-soc mailing list