# HG changeset patch # User henry # Date 1126453268 0 # Node ID 5ab14fa7a019106287f4b7a68bef5c288cd783d9 # Parent 34eb986b7e4ad3d9822ad5b4f1618e4493f2aeb3 do nothing if no free filenames are available diff -r 34eb986b7e4a -r 5ab14fa7a019 libmpcodecs/vf_screenshot.c --- 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);