# HG changeset patch # User cboesch # Date 1296690916 0 # Node ID f03a237a8d26c1ba17242a4dc6b6c266cc8adfbd # Parent 08deb5816d9c5d038b09e402d2cfbcc9fc5c5ed5 Add prefix filename option for PNG video output. Patch by Marco Aurlio Graciotto Silva, magsilva gmail. diff -r 08deb5816d9c -r f03a237a8d26 DOCS/man/en/mplayer.1 --- a/DOCS/man/en/mplayer.1 Wed Feb 02 18:30:20 2011 +0000 +++ b/DOCS/man/en/mplayer.1 Wed Feb 02 23:55:16 2011 +0000 @@ -4592,6 +4592,8 @@ 0 is no compression, 9 is maximum compression. .IPs outdir= Specify the directory to save the PNG files to (default: ./). +.IPs prefix= +Specify the prefix to be used for the PNG filenames (default: no prefix). .IPs alpha (default: noalpha) Create PNG files with an alpha channel. Note that MPlayer in general does not support alpha, so this will only diff -r 08deb5816d9c -r f03a237a8d26 libvo/vo_png.c --- a/libvo/vo_png.c Wed Feb 02 18:30:20 2011 +0000 +++ b/libvo/vo_png.c Wed Feb 02 23:55:16 2011 +0000 @@ -54,6 +54,7 @@ static int z_compression; static char *png_outdir; +static char *png_outfile_prefix; static int framenum; static int use_alpha; static AVCodecContext *avctx; @@ -135,7 +136,7 @@ // if -dr or -slices then do nothing: if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE; - snprintf (buf, 100, "%s/%08d.png", png_outdir, ++framenum); + snprintf (buf, 100, "%s/%s%08d.png", png_outdir, png_outfile_prefix, ++framenum); outfile = fopen(buf, "wb"); if (!outfile) { mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_PNG_ErrorOpeningForWriting, strerror(errno)); @@ -201,6 +202,8 @@ outbuffer_size = 0; free(png_outdir); png_outdir = NULL; + free(png_outfile_prefix); + png_outfile_prefix = NULL; } static void check_events(void){} @@ -215,6 +218,7 @@ {"alpha", OPT_ARG_BOOL, &use_alpha, NULL}, {"z", OPT_ARG_INT, &z_compression, int_zero_to_nine}, {"outdir", OPT_ARG_MSTRZ, &png_outdir, NULL}, + {"prefix", OPT_ARG_MSTRZ, &png_outfile_prefix, NULL }, {NULL} }; @@ -222,6 +226,7 @@ { z_compression = 0; png_outdir = strdup("."); + png_outfile_prefix = strdup(""); use_alpha = 0; if (subopt_parse(arg, subopts) != 0) { return -1;