summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-06-05 17:55:20 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-06-05 17:55:20 +0000
commit7e9ff557a03e16f2a8c1ce4cf4a8786878835b88 (patch)
tree205f5615dfbfb885bc6d4453b72035918efc45b9 /libmpcodecs
parent1689c3422f1ce4557cfaa184827d9a1c0962b5ea (diff)
downloadmpv-7e9ff557a03e16f2a8c1ce4cf4a8786878835b88.tar.bz2
mpv-7e9ff557a03e16f2a8c1ce4cf4a8786878835b88.tar.xz
Extend -vf format to allow substituting the format for a compatible one
(e.g. chaning rgb24 to bgr24). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31331 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vf_format.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/libmpcodecs/vf_format.c b/libmpcodecs/vf_format.c
index a8be4cdfef..8969e6d759 100644
--- a/libmpcodecs/vf_format.c
+++ b/libmpcodecs/vf_format.c
@@ -34,28 +34,42 @@
static struct vf_priv_s {
unsigned int fmt;
+ unsigned int outfmt;
} const vf_priv_dflt = {
- IMGFMT_YUY2
+ IMGFMT_YUY2,
+ 0
};
//===========================================================================//
static int query_format(struct vf_instance *vf, unsigned int fmt){
- if(fmt==vf->priv->fmt)
+ if(fmt==vf->priv->fmt) {
+ if (vf->priv->outfmt)
+ fmt = vf->priv->outfmt;
return vf_next_query_format(vf,fmt);
+ }
return 0;
}
+static int config(struct vf_instance *vf, int width, int height,
+ int d_width, int d_height,
+ unsigned flags, unsigned outfmt){
+ return vf_next_config(vf, width, height, d_width, d_height, flags, vf->priv->outfmt);
+}
+
static int vf_open(vf_instance_t *vf, char *args){
vf->query_format=query_format;
vf->draw_slice=vf_next_draw_slice;
vf->default_caps=0;
+ if (vf->priv->outfmt)
+ vf->config=config;
return 1;
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
static const m_option_t vf_opts_fields[] = {
{"fmt", ST_OFF(fmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL},
+ {"outfmt", ST_OFF(outfmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};