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.
28 #include "img_format.h"
33 //===========================================================================//
35 static void get_image(struct vf_instance_s
* 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_s
* vf
, mp_image_t
*mpi
, double pts
){
54 if(mpi
->flags
&MP_IMGFLAG_DIRECT
){
55 dmpi
=(mp_image_t
*)mpi
->priv
;
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_s
* vf
, unsigned int fmt
){
85 return vf_next_query_format(vf
, fmt
);
90 static int 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
;
97 const vf_info_t vf_info_swapuv
= {
100 "Michael Niedermayer",
106 //===========================================================================//