Mercurial > mplayer.hg
comparison libmpcodecs/vf_screenshot.c @ 16457:5ab14fa7a019
do nothing if no free filenames are available
author | henry |
---|---|
date | Sun, 11 Sep 2005 15:41:08 +0000 |
parents | 34eb986b7e4a |
children | 0a828abf1f0f |
comparison
equal
deleted
inserted
replaced
16456:34eb986b7e4a | 16457:5ab14fa7a019 |
---|---|
118 static void gen_fname(struct vf_priv_s* priv) | 118 static void gen_fname(struct vf_priv_s* priv) |
119 { | 119 { |
120 do { | 120 do { |
121 snprintf (priv->fname, 100, "shot%04d.png", ++priv->frameno); | 121 snprintf (priv->fname, 100, "shot%04d.png", ++priv->frameno); |
122 } while (fexists(priv->fname) && priv->frameno < 100000); | 122 } while (fexists(priv->fname) && priv->frameno < 100000); |
123 if (fexists(priv->fname)) return; | 123 if (fexists(priv->fname)) { |
124 priv->fname[0] = '\0'; | |
125 return; | |
126 } | |
124 | 127 |
125 mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n",priv->fname); | 128 mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n",priv->fname); |
126 | 129 |
127 } | 130 } |
128 | 131 |
207 { | 210 { |
208 if (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) { | 211 if (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) { |
209 if(vf->priv->store_slices) { | 212 if(vf->priv->store_slices) { |
210 vf->priv->store_slices = 0; | 213 vf->priv->store_slices = 0; |
211 gen_fname(vf->priv); | 214 gen_fname(vf->priv); |
212 write_png(vf->priv->fname, vf->priv->buffer, vf->priv->dw, vf->priv->dh, vf->priv->stride); | 215 if (vf->priv->fname[0]) |
216 write_png(vf->priv->fname, vf->priv->buffer, vf->priv->dw, vf->priv->dh, vf->priv->stride); | |
213 } | 217 } |
214 return vf_next_put_image(vf,vf->dmpi); | 218 return vf_next_put_image(vf,vf->dmpi); |
215 } | 219 } |
216 | 220 |
217 if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ | 221 if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ |
233 vf->priv->dmpi->height=mpi->height; | 237 vf->priv->dmpi->height=mpi->height; |
234 | 238 |
235 if(vf->priv->shot) { | 239 if(vf->priv->shot) { |
236 vf->priv->shot=0; | 240 vf->priv->shot=0; |
237 gen_fname(vf->priv); | 241 gen_fname(vf->priv); |
238 scale_image(vf->priv); | 242 if (vf->priv->fname[0]) { |
239 write_png(vf->priv->fname, vf->priv->buffer, vf->priv->dw, vf->priv->dh, vf->priv->stride); | 243 scale_image(vf->priv); |
244 write_png(vf->priv->fname, vf->priv->buffer, vf->priv->dw, vf->priv->dh, vf->priv->stride); | |
245 } | |
240 } | 246 } |
241 | 247 |
242 return vf_next_put_image(vf, vf->priv->dmpi); | 248 return vf_next_put_image(vf, vf->priv->dmpi); |
243 } | 249 } |
244 | 250 |