summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-30 22:14:57 +0200
committerwm4 <wm4@nowhere>2015-03-31 00:09:03 +0200
commit1164dc572c7bc69e97eb92c63a89df6767d61505 (patch)
tree441d29dc0a8f124b40b64c0c7c44a27d32d8b125
parent205a2ef16919a6baa6ac37e17098038b0d68df1b (diff)
downloadmpv-1164dc572c7bc69e97eb92c63a89df6767d61505.tar.bz2
mpv-1164dc572c7bc69e97eb92c63a89df6767d61505.tar.xz
vf_format: by default, pass through video without change
Instead of forcing a useless format (packed YUV??) by default. Also cleanup.
-rw-r--r--DOCS/man/vf.rst2
-rw-r--r--video/filter/vf_format.c39
2 files changed, 18 insertions, 23 deletions
diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst
index f6a583a49d..d79774c721 100644
--- a/DOCS/man/vf.rst
+++ b/DOCS/man/vf.rst
@@ -207,7 +207,7 @@ Available filters are:
For a list of available formats, see ``format=fmt=help``.
``<fmt>``
- Format name, e.g. rgb15, bgr24, 420p, etc. (default: yuyv).
+ Format name, e.g. rgb15, bgr24, 420p, etc. (default: don't change).
``<outfmt>``
Format name that should be substituted for the output. If this is not
100% compatible with the ``<fmt>`` value, it will crash.
diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c
index 4342aa5bf0..df629e3276 100644
--- a/video/filter/vf_format.c
+++ b/video/filter/vf_format.c
@@ -30,29 +30,28 @@
#include "options/m_option.h"
-static struct vf_priv_s {
+struct vf_priv_s {
int fmt;
int outfmt;
-} const vf_priv_dflt = {
- IMGFMT_YUYV,
- 0
};
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- if(fmt==vf->priv->fmt) {
+static int query_format(struct vf_instance *vf, unsigned int fmt)
+{
+ if (fmt == vf->priv->fmt || !vf->priv->fmt) {
if (vf->priv->outfmt)
fmt = vf->priv->outfmt;
- return vf_next_query_format(vf,fmt);
+ 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 reconfig(struct vf_instance *vf, struct mp_image_params *in,
+ struct mp_image_params *out)
+{
+ *out = *in;
+ if (vf->priv->outfmt)
+ out->imgfmt = vf->priv->outfmt;
+ return 0;
}
static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi)
@@ -63,12 +62,11 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi)
return mpi;
}
-static int vf_open(vf_instance_t *vf){
- vf->query_format=query_format;
- if (vf->priv->outfmt) {
- vf->config=config;
- vf->filter=filter;
- }
+static int vf_open(vf_instance_t *vf)
+{
+ vf->query_format = query_format;
+ vf->reconfig = reconfig;
+ vf->filter = filter;
return 1;
}
@@ -84,8 +82,5 @@ const vf_info_t vf_info_format = {
.name = "format",
.open = vf_open,
.priv_size = sizeof(struct vf_priv_s),
- .priv_defaults = &vf_priv_dflt,
.options = vf_opts_fields,
};
-
-//===========================================================================//