changeset 16457:5ab14fa7a019

do nothing if no free filenames are available
author henry
date Sun, 11 Sep 2005 15:41:08 +0000
parents 34eb986b7e4a
children c35ed5cdf07e
files libmpcodecs/vf_screenshot.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_screenshot.c	Sun Sep 11 15:08:48 2005 +0000
+++ b/libmpcodecs/vf_screenshot.c	Sun Sep 11 15:41:08 2005 +0000
@@ -120,7 +120,10 @@
     do {
 	snprintf (priv->fname, 100, "shot%04d.png", ++priv->frameno);
     } while (fexists(priv->fname) && priv->frameno < 100000);
-    if (fexists(priv->fname)) return;
+    if (fexists(priv->fname)) {
+	priv->fname[0] = '\0';
+	return;
+    }
 
     mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n",priv->fname);
 
@@ -209,7 +212,8 @@
 	if(vf->priv->store_slices) {
 	    vf->priv->store_slices = 0;
 	    gen_fname(vf->priv);
-	    write_png(vf->priv->fname, vf->priv->buffer, vf->priv->dw, vf->priv->dh, vf->priv->stride);
+	    if (vf->priv->fname[0])
+		write_png(vf->priv->fname, vf->priv->buffer, vf->priv->dw, vf->priv->dh, vf->priv->stride);
 	}
 	return vf_next_put_image(vf,vf->dmpi);
     }
@@ -235,8 +239,10 @@
     if(vf->priv->shot) {
 	vf->priv->shot=0;
 	gen_fname(vf->priv);
-	scale_image(vf->priv);
-	write_png(vf->priv->fname, vf->priv->buffer, vf->priv->dw, vf->priv->dh, vf->priv->stride);
+	if (vf->priv->fname[0]) {
+	    scale_image(vf->priv);
+	    write_png(vf->priv->fname, vf->priv->buffer, vf->priv->dw, vf->priv->dh, vf->priv->stride);
+	}
     }
 
     return vf_next_put_image(vf, vf->priv->dmpi);