0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

do nothing if no free filenames are available

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16458 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
henry 2005-09-11 15:41:08 +00:00
parent 9227bb4a99
commit 1887baa1ea

View File

@ -120,7 +120,10 @@ static void gen_fname(struct vf_priv_s* priv)
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 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
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 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
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);