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

cosmetics: Remove tabs and trailing whitespace.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27981 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2008-11-23 11:58:11 +00:00
parent b2fb201a6b
commit 9e2505a3f5

View File

@ -41,11 +41,11 @@ struct vf_priv_s {
//===========================================================================// //===========================================================================//
static int config(struct vf_instance_s* vf, static int config(struct vf_instance_s* vf,
int width, int height, int d_width, int d_height, int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt) unsigned int flags, unsigned int outfmt)
{ {
vf->priv->ctx=sws_getContextFromCmdLine(width, height, outfmt, vf->priv->ctx=sws_getContextFromCmdLine(width, height, outfmt,
d_width, d_height, IMGFMT_RGB24); d_width, d_height, IMGFMT_RGB24);
vf->priv->outbuffer_size = d_width * d_height * 3 * 2; vf->priv->outbuffer_size = d_width * d_height * 3 * 2;
vf->priv->outbuffer = realloc(vf->priv->outbuffer, vf->priv->outbuffer_size); vf->priv->outbuffer = realloc(vf->priv->outbuffer, vf->priv->outbuffer_size);
@ -72,10 +72,10 @@ static void write_png(struct vf_priv_s *priv)
fp = fopen (fname, "wb"); fp = fopen (fname, "wb");
if (fp == NULL) { if (fp == NULL) {
mp_msg(MSGT_VFILTER,MSGL_ERR,"\nPNG Error opening %s for writing!\n", fname); mp_msg(MSGT_VFILTER,MSGL_ERR,"\nPNG Error opening %s for writing!\n", fname);
return; return;
} }
pic.data[0] = priv->buffer; pic.data[0] = priv->buffer;
pic.linesize[0] = priv->stride; pic.linesize[0] = priv->stride;
size = avcodec_encode_video(priv->avctx, priv->outbuffer, priv->outbuffer_size, &pic); size = avcodec_encode_video(priv->avctx, priv->outbuffer, priv->outbuffer_size, &pic);
@ -95,11 +95,11 @@ static int fexists(char *fname)
static void gen_fname(struct vf_priv_s* priv) static void gen_fname(struct vf_priv_s* priv)
{ {
do { do {
snprintf (priv->fname, 100, "shot%04d.png", ++priv->frameno); snprintf (priv->fname, 100, "shot%04d.png", ++priv->frameno);
} while (fexists(priv->fname) && priv->frameno < 100000); } while (fexists(priv->fname) && priv->frameno < 100000);
if (fexists(priv->fname)) { if (fexists(priv->fname)) {
priv->fname[0] = '\0'; priv->fname[0] = '\0';
return; return;
} }
mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n",priv->fname); mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n",priv->fname);
@ -110,11 +110,11 @@ static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi)
{ {
uint8_t *dst[3]; uint8_t *dst[3];
int dst_stride[3]; int dst_stride[3];
dst_stride[0] = priv->stride; dst_stride[0] = priv->stride;
dst_stride[1] = dst_stride[2] = 0; dst_stride[1] = dst_stride[2] = 0;
if (!priv->buffer) if (!priv->buffer)
priv->buffer = memalign(16, dst_stride[0]*priv->dh); priv->buffer = memalign(16, dst_stride[0]*priv->dh);
dst[0] = priv->buffer; dst[0] = priv->buffer;
dst[1] = dst[2] = 0; dst[1] = dst[2] = 0;
@ -123,25 +123,25 @@ static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi)
static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){ static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
mpi->type, mpi->flags, mpi->width, mpi->height); mpi->type, mpi->flags, mpi->width, mpi->height);
if (vf->priv->shot) { if (vf->priv->shot) {
vf->priv->store_slices = 1; vf->priv->store_slices = 1;
if (!vf->priv->buffer) if (!vf->priv->buffer)
vf->priv->buffer = memalign(16, vf->priv->stride*vf->priv->dh); vf->priv->buffer = memalign(16, vf->priv->stride*vf->priv->dh);
} }
} }
static void draw_slice(struct vf_instance_s* vf, static void draw_slice(struct vf_instance_s* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){ unsigned char** src, int* stride, int w,int h, int x, int y){
if (vf->priv->store_slices) { if (vf->priv->store_slices) {
uint8_t *dst[3]; uint8_t *dst[3];
int dst_stride[3]; int dst_stride[3];
dst_stride[0] = vf->priv->stride; dst_stride[0] = vf->priv->stride;
dst_stride[1] = dst_stride[2] = 0; dst_stride[1] = dst_stride[2] = 0;
dst[0] = vf->priv->buffer; dst[0] = vf->priv->buffer;
dst[1] = dst[2] = 0; dst[1] = dst[2] = 0;
sws_scale_ordered(vf->priv->ctx, src, stride, y, h, dst, dst_stride); sws_scale_ordered(vf->priv->ctx, src, stride, y, h, dst, dst_stride);
} }
vf_next_draw_slice(vf,src,stride,w,h,x,y); vf_next_draw_slice(vf,src,stride,w,h,x,y);
} }
@ -150,56 +150,56 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
// FIXME: should vf.c really call get_image when using slices?? // FIXME: should vf.c really call get_image when using slices??
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
return; return;
vf->dmpi= vf_get_image(vf->next, mpi->imgfmt, vf->dmpi= vf_get_image(vf->next, mpi->imgfmt,
mpi->type, mpi->flags/* | MP_IMGFLAG_READABLE*/, mpi->width, mpi->height); mpi->type, mpi->flags/* | MP_IMGFLAG_READABLE*/, mpi->width, mpi->height);
mpi->planes[0]=vf->dmpi->planes[0]; mpi->planes[0]=vf->dmpi->planes[0];
mpi->stride[0]=vf->dmpi->stride[0]; mpi->stride[0]=vf->dmpi->stride[0];
if(mpi->flags&MP_IMGFLAG_PLANAR){ if(mpi->flags&MP_IMGFLAG_PLANAR){
mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[1]=vf->dmpi->planes[1];
mpi->planes[2]=vf->dmpi->planes[2]; mpi->planes[2]=vf->dmpi->planes[2];
mpi->stride[1]=vf->dmpi->stride[1]; mpi->stride[1]=vf->dmpi->stride[1];
mpi->stride[2]=vf->dmpi->stride[2]; mpi->stride[2]=vf->dmpi->stride[2];
} }
mpi->width=vf->dmpi->width; mpi->width=vf->dmpi->width;
mpi->flags|=MP_IMGFLAG_DIRECT; mpi->flags|=MP_IMGFLAG_DIRECT;
mpi->priv=(void*)vf->dmpi; mpi->priv=(void*)vf->dmpi;
} }
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
{ {
mp_image_t *dmpi = (mp_image_t *)mpi->priv; mp_image_t *dmpi = (mp_image_t *)mpi->priv;
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
dmpi = vf->dmpi; dmpi = vf->dmpi;
else else
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
dmpi=vf_get_image(vf->next,mpi->imgfmt, dmpi=vf_get_image(vf->next,mpi->imgfmt,
MP_IMGTYPE_EXPORT, 0, MP_IMGTYPE_EXPORT, 0,
mpi->width, mpi->height); mpi->width, mpi->height);
vf_clone_mpi_attributes(dmpi, mpi); vf_clone_mpi_attributes(dmpi, mpi);
dmpi->planes[0]=mpi->planes[0]; dmpi->planes[0]=mpi->planes[0];
dmpi->planes[1]=mpi->planes[1]; dmpi->planes[1]=mpi->planes[1];
dmpi->planes[2]=mpi->planes[2]; dmpi->planes[2]=mpi->planes[2];
dmpi->stride[0]=mpi->stride[0]; dmpi->stride[0]=mpi->stride[0];
dmpi->stride[1]=mpi->stride[1]; dmpi->stride[1]=mpi->stride[1];
dmpi->stride[2]=mpi->stride[2]; dmpi->stride[2]=mpi->stride[2];
dmpi->width=mpi->width; dmpi->width=mpi->width;
dmpi->height=mpi->height; dmpi->height=mpi->height;
} }
if(vf->priv->shot) { if(vf->priv->shot) {
if (vf->priv->shot==1) if (vf->priv->shot==1)
vf->priv->shot=0; vf->priv->shot=0;
gen_fname(vf->priv); gen_fname(vf->priv);
if (vf->priv->fname[0]) { if (vf->priv->fname[0]) {
if (!vf->priv->store_slices) if (!vf->priv->store_slices)
scale_image(vf->priv, dmpi); scale_image(vf->priv, dmpi);
write_png(vf->priv); write_png(vf->priv);
} }
vf->priv->store_slices = 0; vf->priv->store_slices = 0;
} }
return vf_next_put_image(vf, dmpi, pts); return vf_next_put_image(vf, dmpi, pts);
@ -212,15 +212,15 @@ int control (vf_instance_t *vf, int request, void *data)
* 1: take screenshots with each frame until the same command is given once again * 1: take screenshots with each frame until the same command is given once again
**/ **/
if(request==VFCTRL_SCREENSHOT) { if(request==VFCTRL_SCREENSHOT) {
if (data && *(int*)data) { // repeated screenshot mode if (data && *(int*)data) { // repeated screenshot mode
if (vf->priv->shot==2) if (vf->priv->shot==2)
vf->priv->shot=0; vf->priv->shot=0;
else else
vf->priv->shot=2; vf->priv->shot=2;
} else { // single screenshot } else { // single screenshot
if (!vf->priv->shot) if (!vf->priv->shot)
vf->priv->shot=1; vf->priv->shot=1;
} }
return CONTROL_TRUE; return CONTROL_TRUE;
} }
return vf_next_control (vf, request, data); return vf_next_control (vf, request, data);
@ -243,14 +243,14 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
case IMGFMT_BGR15: case IMGFMT_BGR15:
case IMGFMT_RGB32: case IMGFMT_RGB32:
case IMGFMT_RGB24: case IMGFMT_RGB24:
case IMGFMT_Y800: case IMGFMT_Y800:
case IMGFMT_Y8: case IMGFMT_Y8:
case IMGFMT_YVU9: case IMGFMT_YVU9:
case IMGFMT_IF09: case IMGFMT_IF09:
case IMGFMT_444P: case IMGFMT_444P:
case IMGFMT_422P: case IMGFMT_422P:
case IMGFMT_411P: case IMGFMT_411P:
return vf_next_query_format(vf, fmt); return vf_next_query_format(vf, fmt);
} }
return 0; return 0;
} }