mp_msg: print messages to stdout, statusline to stderr
[mplayer.git] / libmpcodecs / vf_format.c
blob422956539b91a5ef1dcc3ce2afeae8dd78d53d4f
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>
22 #include <inttypes.h>
24 #include "config.h"
25 #include "mp_msg.h"
27 #include "img_format.h"
28 #include "mp_image.h"
29 #include "vf.h"
31 #include "m_option.h"
32 #include "m_struct.h"
34 static struct vf_priv_s {
35 unsigned int fmt;
36 unsigned int outfmt;
37 } const vf_priv_dflt = {
38 IMGFMT_YUY2,
42 //===========================================================================//
44 static int query_format(struct vf_instance *vf, unsigned int fmt){
45 if(fmt==vf->priv->fmt) {
46 if (vf->priv->outfmt)
47 fmt = vf->priv->outfmt;
48 return vf_next_query_format(vf,fmt);
50 return 0;
53 static int config(struct vf_instance *vf, int width, int height,
54 int d_width, int d_height,
55 unsigned flags, unsigned outfmt){
56 return vf_next_config(vf, width, height, d_width, d_height, flags, vf->priv->outfmt);
59 static int vf_open(vf_instance_t *vf, char *args){
60 vf->query_format=query_format;
61 vf->draw_slice=vf_next_draw_slice;
62 vf->default_caps=0;
63 if (vf->priv->outfmt)
64 vf->config=config;
65 return 1;
68 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
69 static const m_option_t vf_opts_fields[] = {
70 {"fmt", ST_OFF(fmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL},
71 {"outfmt", ST_OFF(outfmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL},
72 { NULL, NULL, 0, 0, 0, 0, NULL }
75 static const m_struct_t vf_opts = {
76 "format",
77 sizeof(struct vf_priv_s),
78 &vf_priv_dflt,
79 vf_opts_fields
82 const vf_info_t vf_info_format = {
83 "force output format",
84 "format",
85 "A'rpi",
86 "FIXME! get_image()/put_image()",
87 vf_open,
88 &vf_opts
91 //===========================================================================//