r9326 - in trunk: doc/hooks.texi vhook/imlib2.c
Author: ramiro Date: Fri Jun 15 22:40:14 2007 New Revision: 9326 Log: Allow user to specify rgb.txt for imlib2 vhook Modified: trunk/doc/hooks.texi trunk/vhook/imlib2.c Modified: trunk/doc/hooks.texi ============================================================================== --- trunk/doc/hooks.texi (original) +++ trunk/doc/hooks.texi Fri Jun 15 22:40:14 2007 @@ -67,8 +67,13 @@ with the full path to the font file, as @end example where 20 is the point size. +You can specify the filename to read RGB color names from. If none are +specified, these defaults are used: @file{/usr/share/X11/rgb.txt} and + at file{/usr/lib/X11/rgb.txt} + Options: @multitable @columnfractions .2 .8 + at item @option{-C <rgb.txt>} @tab The filename to read RGB color names from @item @option{-c <color>} @tab The color of the text @item @option{-F <fontname>} @tab The font face and size @item @option{-t <text>} @tab The text @@ -137,6 +142,14 @@ Usage examples: a newline are treated as end-of-file. To create blank lines, use lines that consist of space characters only. + # Scrolling credits with custom color from a text file + ffmpeg -i input.avi -vhook \ + 'vhook/imlib2.so -C rgb.txt -c CustomColor1 -F VeraBd.ttf/16 -x 100 -y -1.0*N -f credits.txt' \ + -sameq output.avi + + This example does the same as the one above, but specifies an rgb.txt file + to be used, which has a custom made color in it. + # scrolling credits from a graphics file ffmpeg -sameq -i input.avi \ -vhook 'vhook/imlib2.so -x 0 -y -1.0*N -i credits.png' output.avi Modified: trunk/vhook/imlib2.c ============================================================================== --- trunk/vhook/imlib2.c (original) +++ trunk/vhook/imlib2.c Fri Jun 15 22:40:14 2007 @@ -15,6 +15,10 @@ * * Options: * + * -C <rgb.txt> The filename to read RGB color names from + * Defaults if none specified: + * /usr/share/X11/rgb.txt + * /usr/lib/X11/rgb.txt * -c <color> The color of the text * -F <fontname> The font face and size * -t <text> The text @@ -176,6 +180,7 @@ int Configure(void **ctxp, int argc, cha { int c; ContextInfo *ci; + char *rgbtxt = 0; char *font = "LucidaSansDemiBold/16"; char *fp = getenv("FONTPATH"); char *color = 0; @@ -203,8 +208,11 @@ int Configure(void **ctxp, int argc, cha imlib_add_path_to_font_path(fp); - while ((c = getopt(argc, argv, "c:f:F:t:x:y:i:")) > 0) { + while ((c = getopt(argc, argv, "C:c:f:F:t:x:y:i:")) > 0) { switch (c) { + case 'C': + rgbtxt = optarg; + break; case 'c': color = optarg; break; @@ -246,11 +254,16 @@ int Configure(void **ctxp, int argc, cha char buff[256]; int done = 0; + if (rgbtxt) + f = fopen(rgbtxt, "r"); + else + { f = fopen("/usr/share/X11/rgb.txt", "r"); if (!f) f = fopen("/usr/lib/X11/rgb.txt", "r"); + } if (!f) { - fprintf(stderr, "Failed to find rgb.txt\n"); + fprintf(stderr, "Failed to find RGB color names file\n"); return -1; } while (fgets(buff, sizeof(buff), f)) {
On Fri, Jun 15, 2007 at 10:40:14PM +0200, ramiro wrote:
Log: Allow user to specify rgb.txt for imlib2 vhook
--- trunk/doc/hooks.texi (original) +++ trunk/doc/hooks.texi Fri Jun 15 22:40:14 2007 @@ -67,8 +67,13 @@ with the full path to the font file, as
+You can specify the filename to read RGB color names from. If none are +specified, these defaults are used: @file{/usr/share/X11/rgb.txt} and
none is specified
@@ -137,6 +142,14 @@ Usage examples:
+ This example does the same as the one above, but specifies an rgb.txt file + to be used, which has a custom made color in it.
custom-made Diego
Diego Biurrun wrote:
On Fri, Jun 15, 2007 at 10:40:14PM +0200, ramiro wrote:
Log: Allow user to specify rgb.txt for imlib2 vhook
--- trunk/doc/hooks.texi (original) +++ trunk/doc/hooks.texi Fri Jun 15 22:40:14 2007 @@ -67,8 +67,13 @@ with the full path to the font file, as
+You can specify the filename to read RGB color names from. If none are +specified, these defaults are used: @file{/usr/share/X11/rgb.txt} and
none is specified
Actually, given the context, I would say "filenames" (or "filename or filenames", or even "filename(s)") instead of this change. Given that there are multiple files used in the default, is it possible to specify multiple files via the explicit option? If so, precisely how (by repeating the option? by listing multiple files with some delimiter? something else?)? If not, might it be a good idea to allow that? -- The Wanderer Warning: Simply because I argue an issue does not mean I agree with any side of it. Secrecy is the beginning of tyranny.
The Wanderer wrote:
Diego Biurrun wrote:
On Fri, Jun 15, 2007 at 10:40:14PM +0200, ramiro wrote:
Log: Allow user to specify rgb.txt for imlib2 vhook
--- trunk/doc/hooks.texi (original) +++ trunk/doc/hooks.texi Fri Jun 15 22:40:14 2007 @@ -67,8 +67,13 @@ with the full path to the font file, as
+You can specify the filename to read RGB color names from. If none are +specified, these defaults are used: @file{/usr/share/X11/rgb.txt} and
none is specified
Actually, given the context, I would say "filenames" (or "filename or filenames", or even "filename(s)") instead of this change.
Given that there are multiple files used in the default, is it possible to specify multiple files via the explicit option? If so, precisely how (by repeating the option? by listing multiple files with some delimiter? something else?)?
If not, might it be a good idea to allow that?
Seems like a good idea. The comments are misleading, so I'll work on it. I was going to ask for help on this, but Diego probably read my mind... Can you also take a look at r9342 so that I change the docs in one commit? Another thing, is it ok to remove the documentation on top of the vhook .c files? They are on hooks.texi anyways, with a better explanation. Seems like duplication for me. Ramiro Polla
On Sat, Jun 16, 2007 at 07:40:56PM -0300, Ramiro Ribeiro Polla wrote:
The Wanderer wrote:
Diego Biurrun wrote:
On Fri, Jun 15, 2007 at 10:40:14PM +0200, ramiro wrote:
Log: Allow user to specify rgb.txt for imlib2 vhook
--- trunk/doc/hooks.texi (original) +++ trunk/doc/hooks.texi Fri Jun 15 22:40:14 2007 @@ -67,8 +67,13 @@ with the full path to the font file, as
+You can specify the filename to read RGB color names from. If none are +specified, these defaults are used: @file{/usr/share/X11/rgb.txt} and
none is specified
Actually, given the context, I would say "filenames" (or "filename or filenames", or even "filename(s)") instead of this change.
Given that there are multiple files used in the default, is it possible to specify multiple files via the explicit option? If so, precisely how (by repeating the option? by listing multiple files with some delimiter? something else?)?
If not, might it be a good idea to allow that?
Seems like a good idea. The comments are misleading, so I'll work on it.
I was going to ask for help on this, but Diego probably read my mind... Can you also take a look at r9342 so that I change the docs in one commit?
Looked OK to me.
Another thing, is it ok to remove the documentation on top of the vhook .c files? They are on hooks.texi anyways, with a better explanation. Seems like duplication for me.
I'm fine with removing it. If you feel like it you can add a pointer to that file, though I don't think it's a must. Diego
Diego Biurrun wrote:
On Sat, Jun 16, 2007 at 07:40:56PM -0300, Ramiro Ribeiro Polla wrote:
The Wanderer wrote:
Diego Biurrun wrote:
On Fri, Jun 15, 2007 at 10:40:14PM +0200, ramiro wrote:
Log: Allow user to specify rgb.txt for imlib2 vhook
--- trunk/doc/hooks.texi (original) +++ trunk/doc/hooks.texi Fri Jun 15 22:40:14 2007 @@ -67,8 +67,13 @@ with the full path to the font file, as
+You can specify the filename to read RGB color names from. If none are +specified, these defaults are used: @file{/usr/share/X11/rgb.txt} and
none is specified
Actually, given the context, I would say "filenames" (or "filename or filenames", or even "filename(s)") instead of this change.
Given that there are multiple files used in the default, is it possible to specify multiple files via the explicit option? If so, precisely how (by repeating the option? by listing multiple files with some delimiter? something else?)?
If not, might it be a good idea to allow that?
It was simpler to just change documentation. Also fixed the "custom-made" part.
Another thing, is it ok to remove the documentation on top of the vhook .c files? They are on hooks.texi anyways, with a better explanation. Seems like duplication for me.
I'm fine with removing it. If you feel like it you can add a pointer to that file, though I don't think it's a must.
Removed from imlib2.c, since doc/hooks.texi has a more complete documentation. I left the part that wasn't copied to the documentation. Ramiro Polla
participants (4)
-
diego@biurrun.de -
inverseparadox@comcast.net -
ramiro@lisha.ufsc.br -
subversion@mplayerhq.hu