build: remove IRIX support
[mplayer.git] / libmpcodecs / vf_flip.c
blobe8660ceb51f52b5d62f12d94b14f07be57bc04b1
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
23 #include "config.h"
24 #include "mp_msg.h"
26 #include "mp_image.h"
27 #include "vf.h"
29 #include "libvo/video_out.h"
31 //===========================================================================//
33 static int config(struct vf_instance *vf,
34 int width, int height, int d_width, int d_height,
35 unsigned int flags, unsigned int outfmt){
36 flags&=~VOFLAG_FLIPPING; // remove the FLIP flag
37 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
40 static void get_image(struct vf_instance *vf, mp_image_t *mpi){
41 if(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE){
42 // try full DR !
43 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
44 mpi->type, mpi->flags, mpi->width, mpi->height);
45 // set up mpi as a upside-down image of dmpi:
46 mpi->planes[0]=vf->dmpi->planes[0]+
47 vf->dmpi->stride[0]*(vf->dmpi->height-1);
48 mpi->stride[0]=-vf->dmpi->stride[0];
49 if(mpi->flags&MP_IMGFLAG_PLANAR){
50 mpi->planes[1]=vf->dmpi->planes[1]+
51 vf->dmpi->stride[1]*((vf->dmpi->height>>mpi->chroma_y_shift)-1);
52 mpi->stride[1]=-vf->dmpi->stride[1];
53 mpi->planes[2]=vf->dmpi->planes[2]+
54 vf->dmpi->stride[2]*((vf->dmpi->height>>mpi->chroma_y_shift)-1);
55 mpi->stride[2]=-vf->dmpi->stride[2];
57 mpi->flags|=MP_IMGFLAG_DIRECT;
58 mpi->priv=(void*)vf->dmpi;
62 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
63 if(mpi->flags&MP_IMGFLAG_DIRECT){
64 // we've used DR, so we're ready...
65 if(!(mpi->flags&MP_IMGFLAG_PLANAR))
66 ((mp_image_t*)mpi->priv)->planes[1] = mpi->planes[1]; // passthrough rgb8 palette
67 return vf_next_put_image(vf,(mp_image_t*)mpi->priv, pts);
70 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
71 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
72 mpi->width, mpi->height);
74 // set up mpi as a upside-down image of dmpi:
75 vf->dmpi->planes[0]=mpi->planes[0]+
76 mpi->stride[0]*(mpi->height-1);
77 vf->dmpi->stride[0]=-mpi->stride[0];
78 if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
79 vf->dmpi->planes[1]=mpi->planes[1]+
80 mpi->stride[1]*((mpi->height>>mpi->chroma_y_shift)-1);
81 vf->dmpi->stride[1]=-mpi->stride[1];
82 vf->dmpi->planes[2]=mpi->planes[2]+
83 mpi->stride[2]*((mpi->height>>mpi->chroma_y_shift)-1);
84 vf->dmpi->stride[2]=-mpi->stride[2];
85 } else
86 vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
88 return vf_next_put_image(vf,vf->dmpi, pts);
91 //===========================================================================//
93 static int vf_open(vf_instance_t *vf, char *args){
94 vf->config=config;
95 vf->get_image=get_image;
96 vf->put_image=put_image;
97 vf->default_reqs=VFCAP_ACCEPT_STRIDE;
98 return 1;
101 const vf_info_t vf_info_flip = {
102 "flip image upside-down",
103 "flip",
104 "A'rpi",
106 vf_open,
107 NULL
110 //===========================================================================//