mp_msg: print messages to stdout, statusline to stderr
[mplayer.git] / libmpcodecs / vf_swapuv.c
blob6edb2567594e2e2ecf367f1de04ba2a575645c12
1 /*
2 * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
4 * This file is part of MPlayer.
6 * MPlayer is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * MPlayer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <inttypes.h>
25 #include <assert.h>
27 #include "mp_msg.h"
28 #include "img_format.h"
29 #include "mp_image.h"
30 #include "vf.h"
33 //===========================================================================//
35 static void get_image(struct vf_instance *vf, mp_image_t *mpi){
36 mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt,
37 mpi->type, mpi->flags, mpi->w, mpi->h);
39 mpi->planes[0]=dmpi->planes[0];
40 mpi->planes[1]=dmpi->planes[2];
41 mpi->planes[2]=dmpi->planes[1];
42 mpi->stride[0]=dmpi->stride[0];
43 mpi->stride[1]=dmpi->stride[2];
44 mpi->stride[2]=dmpi->stride[1];
45 mpi->width=dmpi->width;
47 mpi->flags|=MP_IMGFLAG_DIRECT;
48 mpi->priv=(void*)dmpi;
51 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
52 mp_image_t *dmpi;
54 if(mpi->flags&MP_IMGFLAG_DIRECT){
55 dmpi=(mp_image_t*)mpi->priv;
56 } else {
57 dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h);
58 assert(mpi->flags&MP_IMGFLAG_PLANAR);
59 dmpi->planes[0]=mpi->planes[0];
60 dmpi->planes[1]=mpi->planes[2];
61 dmpi->planes[2]=mpi->planes[1];
62 dmpi->stride[0]=mpi->stride[0];
63 dmpi->stride[1]=mpi->stride[2];
64 dmpi->stride[2]=mpi->stride[1];
65 dmpi->width=mpi->width;
68 vf_clone_mpi_attributes(dmpi, mpi);
70 return vf_next_put_image(vf,dmpi, pts);
73 //===========================================================================//
75 static int query_format(struct vf_instance *vf, unsigned int fmt){
76 switch(fmt)
78 case IMGFMT_YV12:
79 case IMGFMT_I420:
80 case IMGFMT_IYUV:
81 case IMGFMT_YVU9:
82 case IMGFMT_444P:
83 case IMGFMT_422P:
84 case IMGFMT_411P:
85 return vf_next_query_format(vf, fmt);
87 return 0;
90 static int vf_open(vf_instance_t *vf, char *args){
91 vf->put_image=put_image;
92 vf->get_image=get_image;
93 vf->query_format=query_format;
94 return 1;
97 const vf_info_t vf_info_swapuv = {
98 "UV swapper",
99 "swapuv",
100 "Michael Niedermayer",
102 vf_open,
103 NULL
106 //===========================================================================//