diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/filter/vf.c | 24 | ||||
-rw-r--r-- | video/filter/vf_crop.c | 133 | ||||
-rw-r--r-- | video/filter/vf_dsize.c | 118 | ||||
-rw-r--r-- | video/filter/vf_expand.c | 178 | ||||
-rw-r--r-- | video/filter/vf_flip.c | 60 | ||||
-rw-r--r-- | video/filter/vf_gradfun.c | 108 | ||||
-rw-r--r-- | video/filter/vf_mirror.c | 38 | ||||
-rw-r--r-- | video/filter/vf_noformat.c | 72 | ||||
-rw-r--r-- | video/filter/vf_pullup.c | 83 | ||||
-rw-r--r-- | video/filter/vf_rotate.c | 106 | ||||
-rw-r--r-- | video/filter/vf_scale.c | 258 | ||||
-rw-r--r-- | video/filter/vf_stereo3d.c | 225 | ||||
-rw-r--r-- | video/filter/vf_yadif.c | 97 |
13 files changed, 0 insertions, 1500 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c index 6e2cb251e0..0edd2a7dcf 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -39,20 +39,8 @@ #include "video/mp_image_pool.h" #include "vf.h" -extern const vf_info_t vf_info_crop; -extern const vf_info_t vf_info_expand; -extern const vf_info_t vf_info_scale; extern const vf_info_t vf_info_format; -extern const vf_info_t vf_info_noformat; -extern const vf_info_t vf_info_flip; -extern const vf_info_t vf_info_rotate; -extern const vf_info_t vf_info_mirror; -extern const vf_info_t vf_info_gradfun; -extern const vf_info_t vf_info_dsize; -extern const vf_info_t vf_info_pullup; extern const vf_info_t vf_info_sub; -extern const vf_info_t vf_info_yadif; -extern const vf_info_t vf_info_stereo3d; extern const vf_info_t vf_info_convert; extern const vf_info_t vf_info_lavfi; extern const vf_info_t vf_info_lavfi_bridge; @@ -66,19 +54,7 @@ extern const vf_info_t vf_info_d3d11vpp; // list of available filters: static const vf_info_t *const filter_list[] = { #if HAVE_GPL - &vf_info_crop, - &vf_info_expand, - &vf_info_scale, &vf_info_format, - &vf_info_noformat, - &vf_info_flip, - &vf_info_mirror, - &vf_info_rotate, - &vf_info_gradfun, - &vf_info_pullup, - &vf_info_yadif, - &vf_info_stereo3d, - &vf_info_dsize, &vf_info_sub, #endif diff --git a/video/filter/vf_crop.c b/video/filter/vf_crop.c deleted file mode 100644 index 495abf65c7..0000000000 --- a/video/filter/vf_crop.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "config.h" -#include "common/msg.h" -#include "options/options.h" - -#include "video/img_format.h" -#include "video/mp_image.h" -#include "vf.h" - -#include "options/m_option.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -static const struct vf_priv_s { - int crop_w,crop_h; - int crop_x,crop_y; -} vf_priv_dflt = { - -1,-1, - -1,-1 -}; - -//===========================================================================// - -static int reconfig(struct vf_instance *vf, struct mp_image_params *in, - struct mp_image_params *out) -{ - int width = in->w, height = in->h; - - // calculate the missing parameters: - if(vf->priv->crop_w<=0 || vf->priv->crop_w>width) vf->priv->crop_w=width; - if(vf->priv->crop_h<=0 || vf->priv->crop_h>height) vf->priv->crop_h=height; - if(vf->priv->crop_x<0) vf->priv->crop_x=(width-vf->priv->crop_w)/2; - if(vf->priv->crop_y<0) vf->priv->crop_y=(height-vf->priv->crop_h)/2; - // rounding: - - int orig_x = vf->priv->crop_x; - int orig_y = vf->priv->crop_y; - - struct mp_imgfmt_desc fmt = mp_imgfmt_get_desc(in->imgfmt); - - if (fmt.flags & MP_IMGFLAG_HWACCEL) { - vf->priv->crop_x = 0; - vf->priv->crop_y = 0; - } else { - vf->priv->crop_x = MP_ALIGN_DOWN(vf->priv->crop_x, fmt.align_x); - vf->priv->crop_y = MP_ALIGN_DOWN(vf->priv->crop_y, fmt.align_y); - } - - if (vf->priv->crop_x != orig_x || vf->priv->crop_y != orig_y) { - MP_WARN(vf, "Adjusting crop origin to %d/%d for pixel format alignment.\n", - vf->priv->crop_x, vf->priv->crop_y); - } - - // check: - if(vf->priv->crop_w+vf->priv->crop_x>width || - vf->priv->crop_h+vf->priv->crop_y>height){ - MP_WARN(vf, "Bad position/width/height - cropped area outside of the original!\n"); - return -1; - } - - *out = *in; - out->w = vf->priv->crop_w; - out->h = vf->priv->crop_h; - return 0; -} - -static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) -{ - if (mpi->fmt.flags & MP_IMGFLAG_HWACCEL) { - mp_image_set_size(mpi, vf->fmt_out.w, vf->fmt_out.h); - } else { - mp_image_crop(mpi, vf->priv->crop_x, vf->priv->crop_y, - vf->priv->crop_x + vf->priv->crop_w, - vf->priv->crop_y + vf->priv->crop_h); - } - return mpi; -} - -static int query_format(struct vf_instance *vf, unsigned int fmt) -{ - return vf_next_query_format(vf, fmt); -} - -static int vf_open(vf_instance_t *vf){ - MP_WARN(vf, "This filter is deprecated. Use lavfi crop instead.\n"); - vf->reconfig=reconfig; - vf->filter=filter; - vf->query_format=query_format; - return 1; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -static const m_option_t vf_opts_fields[] = { - OPT_INT("w", crop_w, M_OPT_MIN, .min = 0), - OPT_INT("h", crop_h, M_OPT_MIN, .min = 0), - OPT_INT("x", crop_x, M_OPT_MIN, .min = -1), - OPT_INT("y", crop_y, M_OPT_MIN, .min = -1), - {0} -}; - -const vf_info_t vf_info_crop = { - .description = "cropping", - .name = "crop", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .priv_defaults = &vf_priv_dflt, - .options = vf_opts_fields, -}; - -//===========================================================================// diff --git a/video/filter/vf_dsize.c b/video/filter/vf_dsize.c deleted file mode 100644 index 12fa7242f3..0000000000 --- a/video/filter/vf_dsize.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <inttypes.h> -#include <limits.h> - -#include "config.h" -#include "common/msg.h" -#include "options/m_option.h" - -#include "video/img_format.h" -#include "video/mp_image.h" -#include "vf.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -struct vf_priv_s { - int w, h; - int method; // aspect method, 0 -> downscale, 1-> upscale. +2 -> original aspect. - int round; - float aspect; -}; - -static int reconfig(struct vf_instance *vf, struct mp_image_params *in, - struct mp_image_params *out) -{ - int width = in->w, height = in->h; - int d_width, d_height; - mp_image_params_get_dsize(in, &d_width, &d_height); - int w = vf->priv->w; - int h = vf->priv->h; - if (vf->priv->aspect < 0.001) { // did the user input aspect or w,h params - if (w == 0) w = d_width; - if (h == 0) h = d_height; - if (w == -1) w = width; - if (h == -1) h = height; - if (w == -2) w = h * (double)d_width / d_height; - if (w == -3) w = h * (double)width / height; - if (h == -2) h = w * (double)d_height / d_width; - if (h == -3) h = w * (double)height / width; - if (vf->priv->method > -1) { - double aspect = (vf->priv->method & 2) ? ((double)height / width) : ((double)d_height / d_width); - if ((h > w * aspect) ^ (vf->priv->method & 1)) { - h = w * aspect; - } else { - w = h / aspect; - } - } - if (vf->priv->round > 1) { // round up - w += (vf->priv->round - 1 - (w - 1) % vf->priv->round); - h += (vf->priv->round - 1 - (h - 1) % vf->priv->round); - } - d_width = w; - d_height = h; - } else { - if (vf->priv->aspect * height > width) { - d_width = height * vf->priv->aspect + .5; - d_height = height; - } else { - d_height = width / vf->priv->aspect + .5; - d_width = width; - } - } - *out = *in; - mp_image_params_set_dsize(out, d_width, d_height); - return 0; -} - -static int vf_open(vf_instance_t *vf) -{ - MP_WARN(vf, "This filter is deprecated. No replacement.\n"); - - vf->reconfig = reconfig; - return 1; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -const vf_info_t vf_info_dsize = { - .description = "reset displaysize/aspect", - .name = "dsize", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .priv_defaults = &(const struct vf_priv_s){ - .aspect = 0.0, - .w = -1, - .h = -1, - .method = -1, - .round = 1, - }, - .options = (const struct m_option[]){ - OPT_INTRANGE("w", w, 0, -3, INT_MAX), - OPT_INTRANGE("h", h, 0, -3, INT_MAX), - OPT_INTRANGE("method", method, 0, -1, 3), - OPT_INTRANGE("round", round, 0, 0, 9999), - OPT_FLOAT("aspect", aspect, CONF_RANGE, .min = 0, .max = 10), - {0} - }, -}; diff --git a/video/filter/vf_expand.c b/video/filter/vf_expand.c deleted file mode 100644 index 398d90ecba..0000000000 --- a/video/filter/vf_expand.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdbool.h> - -#include <libavutil/common.h> - -#include "config.h" -#include "common/msg.h" -#include "options/options.h" - -#include "video/img_format.h" -#include "video/mp_image.h" -#include "vf.h" - -#include "options/m_option.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -static struct vf_priv_s { - // These four values are a backup of the values parsed from the command line. - // This is necessary so that we do not get a mess upon filter reinit due to - // e.g. aspect changes and with only aspect specified on the command line, - // where we would otherwise use the values calculated for a different aspect - // instead of recalculating them again. - int cfg_exp_w, cfg_exp_h; - int cfg_exp_x, cfg_exp_y; - int exp_w,exp_h; - int exp_x,exp_y; - double aspect; - int round; -} const vf_priv_dflt = { - -1,-1, - -1,-1, - -1,-1, - -1,-1, - 0., - 1, -}; - -//===========================================================================// - -static int reconfig(struct vf_instance *vf, struct mp_image_params *in, - struct mp_image_params *out) -{ - int width = in->w, height = in->h; - - vf->priv->exp_x = vf->priv->cfg_exp_x; - vf->priv->exp_y = vf->priv->cfg_exp_y; - vf->priv->exp_w = vf->priv->cfg_exp_w; - vf->priv->exp_h = vf->priv->cfg_exp_h; - if ( vf->priv->exp_w == -1 ) vf->priv->exp_w=width; - else if (vf->priv->exp_w < -1 ) vf->priv->exp_w=width - vf->priv->exp_w; - else if ( vf->priv->exp_w<width ) vf->priv->exp_w=width; - if ( vf->priv->exp_h == -1 ) vf->priv->exp_h=height; - else if ( vf->priv->exp_h < -1 ) vf->priv->exp_h=height - vf->priv->exp_h; - else if( vf->priv->exp_h<height ) vf->priv->exp_h=height; - if (vf->priv->aspect) { - float adjusted_aspect = vf->priv->aspect; - adjusted_aspect *= (double)in->p_w/in->p_h; - if (vf->priv->exp_h < vf->priv->exp_w / adjusted_aspect) { - vf->priv->exp_h = vf->priv->exp_w / adjusted_aspect + 0.5; - } else { - vf->priv->exp_w = vf->priv->exp_h * adjusted_aspect + 0.5; - } - } - if (vf->priv->round > 1) { // round up. - vf->priv->exp_w = (1 + (vf->priv->exp_w - 1) / vf->priv->round) * vf->priv->round; - vf->priv->exp_h = (1 + (vf->priv->exp_h - 1) / vf->priv->round) * vf->priv->round; - } - - if(vf->priv->exp_x<0 || vf->priv->exp_x+width>vf->priv->exp_w) vf->priv->exp_x=(vf->priv->exp_w-width)/2; - if(vf->priv->exp_y<0 || vf->priv->exp_y+height>vf->priv->exp_h) vf->priv->exp_y=(vf->priv->exp_h-height)/2; - - struct mp_imgfmt_desc fmt = mp_imgfmt_get_desc(in->imgfmt); - - vf->priv->exp_x = MP_ALIGN_DOWN(vf->priv->exp_x, fmt.align_x); - vf->priv->exp_y = MP_ALIGN_DOWN(vf->priv->exp_y, fmt.align_y); - - *out = *in; - out->w = vf->priv->exp_w; - out->h = vf->priv->exp_h; - - return 0; -} - -static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) -{ - int e_x = vf->priv->exp_x, e_y = vf->priv->exp_y; - int e_w = vf->priv->exp_w, e_h = vf->priv->exp_h; - - if (e_x == 0 && e_y == 0 && e_w == mpi->w && e_h == mpi->h) - return mpi; - - struct mp_image *dmpi = vf_alloc_out_image(vf); - if (!dmpi) { - talloc_free(mpi); - return NULL; - } - mp_image_copy_attributes(dmpi, mpi); - - struct mp_image cropped = *dmpi; - mp_image_crop(&cropped, e_x, e_y, e_x + mpi->w, e_y + mpi->h); - mp_image_copy(&cropped, mpi); - - int e_x2 = e_x + MP_ALIGN_DOWN(mpi->w, mpi->fmt.align_x); - int e_y2 = e_y + MP_ALIGN_DOWN(mpi->h, mpi->fmt.align_y); - - // top border (over the full width) - mp_image_clear(dmpi, 0, 0, e_w, e_y); - // bottom border (over the full width) - mp_image_clear(dmpi, 0, e_y2, e_w, e_h); - // left - mp_image_clear(dmpi, 0, e_y, e_x, e_y2); - // right - mp_image_clear(dmpi, e_x2, e_y, e_w, e_y2); - - talloc_free(mpi); - return dmpi; -} - -static int query_format(struct vf_instance *vf, unsigned int fmt) -{ - if (!IMGFMT_IS_HWACCEL(fmt)) - return vf_next_query_format(vf, fmt); - return 0; -} - -static int vf_open(vf_instance_t *vf){ - MP_WARN(vf, "This filter is deprecated. Use lavfi pad instead.\n"); - - vf->reconfig=reconfig; - vf->query_format=query_format; - vf->filter=filter; - return 1; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -static const m_option_t vf_opts_fields[] = { - OPT_INT("w", cfg_exp_w, 0), - OPT_INT("h", cfg_exp_h, 0), - OPT_INT("x", cfg_exp_x, M_OPT_MIN, .min = -1), - OPT_INT("y", cfg_exp_y, M_OPT_MIN, .min = -1), - OPT_DOUBLE("aspect", aspect, M_OPT_MIN, .min = 0), - OPT_INT("round", round, M_OPT_MIN, .min = 1), - {0} -}; - -const vf_info_t vf_info_expand = { - .description = "expanding", - .name = "expand", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .priv_defaults = &vf_priv_dflt, - .options = vf_opts_fields, -}; - -//===========================================================================// diff --git a/video/filter/vf_flip.c b/video/filter/vf_flip.c deleted file mode 100644 index 776f127fa1..0000000000 --- a/video/filter/vf_flip.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "config.h" -#include "common/msg.h" - -#include "video/mp_image.h" -#include "vf.h" - -#include "video/out/vo.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) -{ - mp_image_vflip(mpi); - return mpi; -} - -static int query_format(struct vf_instance *vf, unsigned int fmt) -{ - if (!IMGFMT_IS_HWACCEL(fmt)) - return vf_next_query_format(vf, fmt); - return 0; -} - -static int vf_open(vf_instance_t *vf){ - MP_WARN(vf, "This filter is deprecated. Use lavfi vflip instead.\n"); - - vf->filter=filter; - vf->query_format = query_format; - return 1; -} - -const vf_info_t vf_info_flip = { - .description = "flip image upside-down", - .name = "flip", - .open = vf_open, -}; diff --git a/video/filter/vf_gradfun.c b/video/filter/vf_gradfun.c deleted file mode 100644 index 33bc883c61..0000000000 --- a/video/filter/vf_gradfun.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2009 Loren Merritt <lorenm@u.washignton.edu> - * - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <inttypes.h> -#include <math.h> - -#include "vf.h" - -#include "common/common.h" -#include "options/m_option.h" - -#include "vf_lavfi.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -struct vf_priv_s { - float cfg_thresh; - int cfg_radius; - float cfg_size; - int radius; - - struct vf_lw_opts *lw_opts; -} const vf_priv_dflt = { - .cfg_thresh = 1.5, - .cfg_radius = -1, - .cfg_size = -1, -}; - -static int lavfi_reconfig(struct vf_instance *vf, - struct mp_image_params *in, - struct mp_image_params *out) -{ - struct vf_priv_s *p = vf_lw_old_priv(vf); - int w = in->w; - int h = in->h; - p->radius = p->cfg_radius; - if (p->cfg_size > -1) - p->radius = (p->cfg_size / 100.0f) * sqrtf(w * w + h * h); - p->radius = MPCLAMP((p->radius+1)&~1, 4, 32); - vf_lw_update_graph(vf, "gradfun", "%f:%d", p->cfg_thresh, p->radius); - return 0; -} - -static int vf_open(vf_instance_t *vf) -{ - MP_WARN(vf, "%s", VF_LW_REPLACE); - - bool have_radius = vf->priv->cfg_radius > -1; - bool have_size = vf->priv->cfg_size > -1; - - if (have_radius && have_size) { - MP_ERR(vf, "scale: gradfun: only one of " - "radius/size parameters allowed at the same time!\n"); - return 0; - } - - if (!have_radius && !have_size) - vf->priv->cfg_size = 1.0; - - if (vf_lw_set_graph(vf, vf->priv->lw_opts, "gradfun", "%f:4", - vf->priv->cfg_thresh) >= 0) - { - vf_lw_set_reconfig_cb(vf, lavfi_reconfig); - return 1; - } - - MP_FATAL(vf, "This version of libavfilter has no 'gradfun' filter.\n"); - return 0; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -static const m_option_t vf_opts_fields[] = { - OPT_FLOATRANGE("strength", cfg_thresh, 0, 0.51, 255), - OPT_INTRANGE("radius", cfg_radius, 0, 4, 32), - OPT_FLOATRANGE("size", cfg_size, 0, 0.1, 5.0), - OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0), - {0} -}; - -const vf_info_t vf_info_gradfun = { - .description = "gradient deband", - .name = "gradfun", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .priv_defaults = &vf_priv_dflt, - .options = vf_opts_fields, -}; diff --git a/video/filter/vf_mirror.c b/video/filter/vf_mirror.c deleted file mode 100644 index 91cc9a5503..0000000000 --- a/video/filter/vf_mirror.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stddef.h> - -#include "vf.h" -#include "vf_lavfi.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -static int vf_open(vf_instance_t *vf) -{ - MP_WARN(vf, "This filter is deprecated. Use lavfi hflip instead.\n"); - return vf_lw_set_graph(vf, NULL, NULL, "hflip") >= 0; -} - -const vf_info_t vf_info_mirror = { - .description = "horizontal mirror", - .name = "mirror", - .open = vf_open, -}; diff --git a/video/filter/vf_noformat.c b/video/filter/vf_noformat.c deleted file mode 100644 index b6a71d9417..0000000000 --- a/video/filter/vf_noformat.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <inttypes.h> - -#include "config.h" -#include "common/msg.h" - -#include "video/img_format.h" -#include "video/mp_image.h" -#include "vf.h" - -#include "options/m_option.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -static struct vf_priv_s { - int fmt; -} const vf_priv_dflt = { - IMGFMT_420P -}; - -//===========================================================================// - -static int query_format(struct vf_instance *vf, unsigned int fmt){ - if(fmt!=vf->priv->fmt) - return vf_next_query_format(vf,fmt); - return 0; -} - -static int vf_open(vf_instance_t *vf){ - MP_WARN(vf, "This filter is deprecated and will be removed (no replacement)\n"); - vf->query_format=query_format; - return 1; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -static const m_option_t vf_opts_fields[] = { - OPT_IMAGEFORMAT("fmt", fmt, 0), - {0} -}; - -const vf_info_t vf_info_noformat = { - .description = "disallow one output format", - .name = "noformat", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .priv_defaults = &vf_priv_dflt, - .options = vf_opts_fields, -}; - -//===========================================================================// diff --git a/video/filter/vf_pullup.c b/video/filter/vf_pullup.c deleted file mode 100644 index 83d5f177b3..0000000000 --- a/video/filter/vf_pullup.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "common/msg.h" -#include "options/m_option.h" - -#include "vf.h" - -#include "vf_lavfi.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -struct vf_priv_s { - struct pullup_context *ctx; - int init; - int fakecount; - double lastpts; - int junk_left, junk_right, junk_top, junk_bottom; - int strict_breaks, metric_plane; - struct vf_lw_opts *lw_opts; -}; - -static int vf_open(vf_instance_t *vf) -{ - MP_WARN(vf, "%s", VF_LW_REPLACE); - - struct vf_priv_s *p = vf->priv; - const char *pname[3] = {"y", "u", "v"}; - if (vf_lw_set_graph(vf, p->lw_opts, "pullup", "%d:%d:%d:%d:%d:%s", - p->junk_left, p->junk_right, p->junk_top, p->junk_bottom, - p->strict_breaks, pname[p->metric_plane]) >= 0) - { - return 1; - } - - MP_FATAL(vf, "This version of libavfilter has no 'pullup' filter.\n"); - return 0; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -const vf_info_t vf_info_pullup = { - .description = "pullup (from field sequence to frames)", - .name = "pullup", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .priv_defaults = &(const struct vf_priv_s){ - .junk_left = 1, - .junk_right = 1, - .junk_top = 4, - .junk_bottom = 4, - }, - .options = (const struct m_option[]){ - OPT_INT("jl", junk_left, 0), - OPT_INT("jr", junk_right, 0), - OPT_INT("jt", junk_top, 0), - OPT_INT("jb", junk_bottom, 0), - OPT_INT("sb", strict_breaks, 0), - OPT_CHOICE("mp", metric_plane, 0, ({"y", 0}, {"u", 1}, {"v", 2})), - OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0), - {0} - }, -}; diff --git a/video/filter/vf_rotate.c b/video/filter/vf_rotate.c deleted file mode 100644 index 443a0dac42..0000000000 --- a/video/filter/vf_rotate.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <inttypes.h> - -#include "common/msg.h" -#include "options/m_option.h" - -#include "vf.h" -#include "vf_lavfi.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -struct vf_priv_s { - int angle; - int warn; - struct vf_lw_opts *lw_opts; -}; - -static const char *const rot[] = { - "null", - "transpose=clock", - "vflip,hflip", - "transpose=cclock", - "null", // actually set in lavfi_recreate() -}; - -static int lavfi_reconfig(struct vf_instance *vf, - struct mp_image_params *in, - struct mp_image_params *out) -{ - struct vf_priv_s *p = vf_lw_old_priv(vf); - if (p->angle == 4) { // "auto" - int r = in->rotate; - if (r < 0 || r >= 360) { - MP_ERR(vf, "Can't apply rotation of %d degrees.\n", r); - return -1; - } - if (r % 90) { - double a = r / 180.0 * M_PI; - vf_lw_update_graph(vf, NULL, "rotate=%f:ow=rotw(%f):oh=roth(%f)", - a, a, a); - } else { - vf_lw_update_graph(vf, NULL, "%s", rot[(r / 90) % 360]); - } - out->rotate = 0; - } - return 0; -} - -static int vf_open(vf_instance_t *vf) -{ - struct vf_priv_s *p = vf->priv; - - if (p->warn) - MP_WARN(vf, "%s", VF_LW_REPLACE); - - if (vf_lw_set_graph(vf, p->lw_opts, NULL, "%s", rot[p->angle]) >= 0) { - vf_lw_set_reconfig_cb(vf, lavfi_reconfig); - return 1; - } - - return 0; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -const vf_info_t vf_info_rotate = { - .description = "rotate", - .name = "rotate", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .options = (const struct m_option[]){ - OPT_CHOICE("angle", angle, 0, - ({"0", 0}, - {"90", 1}, - {"180", 2}, - {"270", 3}, - {"auto", 4})), - OPT_FLAG("warn", warn, 0, OPTDEF_INT(1)), - OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0), - {0} - }, -}; - -//===========================================================================// diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c deleted file mode 100644 index 28508e4466..0000000000 --- a/video/filter/vf_scale.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <inttypes.h> -#include <sys/types.h> - -#include <libswscale/swscale.h> - -#include "config.h" -#include "common/msg.h" -#include "options/options.h" - -#include "video/img_format.h" -#include "video/mp_image.h" -#include "vf.h" -#include "video/fmt-conversion.h" - -#include "video/sws_utils.h" - -#include "video/csputils.h" -#include "video/out/vo.h" - -#include "options/m_option.h" - -#include "vf_lavfi.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -static struct vf_priv_s { - int w, h; - int cfg_w, cfg_h; - int v_chr_drop; - double param[2]; - struct mp_sws_context *sws; - int noup; - int accurate_rnd; - int warn; -} const vf_priv_dflt = { - 0, 0, - -1, -1, - 0, - {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT}, - .warn = 1, -}; - -static int find_best_out(vf_instance_t *vf, int in_format) -{ - int best = 0; - for (int out_format = IMGFMT_START; out_format < IMGFMT_END; out_format++) { - if (!vf_next_query_format(vf, out_format)) - continue; - if (sws_isSupportedOutput(imgfmt2pixfmt(out_format)) < 1) - continue; - if (best) { - int candidate = mp_imgfmt_select_best(best, out_format, in_format); - if (candidate) - best = candidate; - } else { - best = out_format; - } - } - return best; -} - -static int reconfig(struct vf_instance *vf, struct mp_image_params *in, - struct mp_image_params *out) -{ - int width = in->w, height = in->h; - int d_width, d_height; - mp_image_params_get_dsize(in, &d_width, &d_height); - - unsigned int best = find_best_out(vf, in->imgfmt); - int round_w = 0, round_h = 0; - - if (!best) { - MP_WARN(vf, "no supported output format found\n"); - return -1; - } - - vf->next->query_format(vf->next, best); - - vf->priv->w = vf->priv->cfg_w; - vf->priv->h = vf->priv->cfg_h; - - if (vf->priv->w <= -8) { - vf->priv->w += 8; - round_w = 1; - } - if (vf->priv->h <= -8) { - vf->priv->h += 8; - round_h = 1; - } - - if (vf->priv->w < -3 || vf->priv->h < -3 || - (vf->priv->w < -1 && vf->priv->h < -1)) - { - MP_ERR(vf, "invalid parameters\n"); - return -1; - } - - if (vf->priv->w == -1) - vf->priv->w = width; - if (vf->priv->w == 0) - vf->priv->w = d_width; - - if (vf->priv->h == -1) - vf->priv->h = height; - if (vf->priv->h == 0) - vf->priv->h = d_height; - - if (vf->priv->w == -3) - vf->priv->w = vf->priv->h * width / height; - if (vf->priv->w == -2) - vf->priv->w = vf->priv->h * d_width / d_height; - - if (vf->priv->h == -3) - vf->priv->h = vf->priv->w * height / width; - if (vf->priv->h == -2) - vf->priv->h = vf->priv->w * d_height / d_width; - - if (round_w) - vf->priv->w = ((vf->priv->w + 8) / 16) * 16; - if (round_h) - vf->priv->h = ((vf->priv->h + 8) / 16) * 16; - - // check for upscaling, now that all parameters had been applied - if (vf->priv->noup) { - if ((vf->priv->w > width) + (vf->priv->h > height) >= vf->priv->noup) { - vf->priv->w = width; - vf->priv->h = height; - } - } - - MP_DBG(vf, "scaling %dx%d to %dx%d\n", width, height, vf->priv->w, vf->priv->h); - - // Compute new d_width and d_height, preserving aspect - // while ensuring that both are >= output size in pixels. - if (vf->priv->h * d_width > vf->priv->w * d_height) { - d_width = vf->priv->h * d_width / d_height; - d_height = vf->priv->h; - } else { - d_height = vf->priv->w * d_height / d_width; - d_width = vf->priv->w; - } - - *out = *in; - out->w = vf->priv->w; - out->h = vf->priv->h; - mp_image_params_set_dsize(out, d_width, d_height); - out->imgfmt = best; - - // Second-guess what libswscale is going to output and what not. - // It depends what libswscale supports for in/output, and what makes sense. - struct mp_imgfmt_desc s_fmt = mp_imgfmt_get_desc(in->imgfmt); - struct mp_imgfmt_desc d_fmt = mp_imgfmt_get_desc(out->imgfmt); - // keep colorspace settings if the data stays in yuv - if (!(s_fmt.flags & MP_IMGFLAG_YUV) || !(d_fmt.flags & MP_IMGFLAG_YUV)) { - out->color.space = MP_CSP_AUTO; - out->color.levels = MP_CSP_LEVELS_AUTO; - } - mp_image_params_guess_csp(out); - - mp_sws_set_from_cmdline(vf->priv->sws, vf->chain->opts->vo->sws_opts); - vf->priv->sws->flags |= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT; - vf->priv->sws->flags |= vf->priv->accurate_rnd * SWS_ACCURATE_RND; - vf->priv->sws->src = *in; - vf->priv->sws->dst = *out; - - if (mp_sws_reinit(vf->priv->sws) < 0) { - // error... - MP_WARN(vf, "Couldn't init libswscale for this setup\n"); - return -1; - } - return 0; -} - -static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) -{ - struct mp_image *dmpi = vf_alloc_out_image(vf); - if (!dmpi) - return NULL; - mp_image_copy_attributes(dmpi, mpi); - - mp_sws_scale(vf->priv->sws, dmpi, mpi); - - talloc_free(mpi); - return dmpi; -} - -static int query_format(struct vf_instance *vf, unsigned int fmt) -{ - if (IMGFMT_IS_HWACCEL(fmt) || sws_isSupportedInput(imgfmt2pixfmt(fmt)) < 1) - return 0; - return !!find_best_out(vf, fmt); -} - -static void uninit(struct vf_instance *vf) -{ -} - -static int vf_open(vf_instance_t *vf) -{ - vf->reconfig = reconfig; - vf->filter = filter; - vf->query_format = query_format; - vf->uninit = uninit; - vf->priv->sws = mp_sws_alloc(vf); - vf->priv->sws->log = vf->log; - vf->priv->sws->params[0] = vf->priv->param[0]; - vf->priv->sws->params[1] = vf->priv->param[1]; - if (vf->priv->warn) - MP_WARN(vf, "%s", VF_LW_REPLACE); - return 1; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -static const m_option_t vf_opts_fields[] = { - OPT_INT("w", cfg_w, M_OPT_MIN, .min = -11), - OPT_INT("h", cfg_h, M_OPT_MIN, .min = -11), - OPT_DOUBLE("param", param[0], M_OPT_RANGE, .min = 0.0, .max = 100.0), - OPT_DOUBLE("param2", param[1], M_OPT_RANGE, .min = 0.0, .max = 100.0), - OPT_INTRANGE("chr-drop", v_chr_drop, 0, 0, 3), - OPT_INTRANGE("noup", noup, 0, 0, 2), - OPT_FLAG("arnd", accurate_rnd, 0), - OPT_FLAG("warn", warn, 0), - {0} -}; - -const vf_info_t vf_info_scale = { - .description = "software scaling", - .name = "scale", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .priv_defaults = &vf_priv_dflt, - .options = vf_opts_fields, -}; - -//===========================================================================// diff --git a/video/filter/vf_stereo3d.c b/video/filter/vf_stereo3d.c deleted file mode 100644 index 3d29dcd8e8..0000000000 --- a/video/filter/vf_stereo3d.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (C) 2010 Gordon Schmidt <gordon.schmidt <at> s2000.tu-chemnitz.de> - * - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -//==includes==// -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdbool.h> - -#include <libavutil/common.h> - -#include "config.h" -#include "common/msg.h" -#include "options/options.h" - -#include "video/img_format.h" -#include "video/mp_image.h" -#include "vf.h" -#include "options/m_option.h" - -#include "vf_lavfi.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -//==types==// -typedef enum stereo_code { - ANAGLYPH_RC_GRAY, //anaglyph red/cyan gray - ANAGLYPH_RC_HALF, //anaglyph red/cyan half colored - ANAGLYPH_RC_COLOR, //anaglyph red/cyan colored - ANAGLYPH_RC_DUBOIS, //anaglyph red/cyan dubois - ANAGLYPH_GM_GRAY, //anaglyph green/magenta gray - ANAGLYPH_GM_HALF, //anaglyph green/magenta half colored - ANAGLYPH_GM_COLOR, //anaglyph green/magenta colored - ANAGLYPH_GM_DUBOIS, //anaglyph green/magenta dubois - ANAGLYPH_YB_GRAY, //anaglyph yellow/blue gray - ANAGLYPH_YB_HALF, //anaglyph yellow/blue half colored - ANAGLYPH_YB_COLOR, //anaglyph yellow/blue colored - ANAGLYPH_YB_DUBOIS, //anaglyph yellow/blue dubois - MONO_L, //mono output for debugging (left eye only) - MONO_R, //mono output for debugging (right eye only) - SIDE_BY_SIDE_LR, //side by side parallel (left eye left, right eye right) - SIDE_BY_SIDE_RL, //side by side crosseye (right eye left, left eye right) - SIDE_BY_SIDE_2_LR, //side by side parallel with half width resolution - SIDE_BY_SIDE_2_RL, //side by side crosseye with half width resolution - ABOVE_BELOW_LR, //above-below (left eye above, right eye below) - ABOVE_BELOW_RL, //above-below (right eye above, left eye below) - ABOVE_BELOW_2_LR, //above-below with half height resolution - ABOVE_BELOW_2_RL, //above-below with half height resolution - INTERLEAVE_ROWS_LR, //row-interleave (left eye has top row) - INTERLEAVE_ROWS_RL, //row-interleave (right eye has top row) - STEREO_AUTO, //use video metadata info (for input) - ALTERNATING_LR, //alternating frames (left first) - ALTERNATING_RL, //alternating frames (right first) - STEREO_CODE_COUNT //no value set - TODO: needs autodetection -} stereo_code; - -struct vf_priv_s { - int in_fmt; - int out_fmt; - bool auto_in; - int warn; - struct vf_lw_opts *lw_opts; -} const vf_priv_default = { - SIDE_BY_SIDE_LR, - ANAGLYPH_RC_DUBOIS, - .warn = 1, -}; - -const struct m_opt_choice_alternatives stereo_code_names[] = { - {"arcg", ANAGLYPH_RC_GRAY}, - {"anaglyph_red_cyan_gray", ANAGLYPH_RC_GRAY}, - {"arch", ANAGLYPH_RC_HALF}, - {"anaglyph_red_cyan_half_color", ANAGLYPH_RC_HALF}, - {"arcc", ANAGLYPH_RC_COLOR}, - {"anaglyph_red_cyan_color", ANAGLYPH_RC_COLOR}, - {"arcd", ANAGLYPH_RC_DUBOIS}, - {"anaglyph_red_cyan_dubios", ANAGLYPH_RC_DUBOIS}, - {"agmg", ANAGLYPH_GM_GRAY}, - {"anaglyph_green_magenta_gray", ANAGLYPH_GM_GRAY}, - {"agmh", ANAGLYPH_GM_HALF}, - {"anaglyph_green_magenta_half_color",ANAGLYPH_GM_HALF}, - {"agmc", ANAGLYPH_GM_COLOR}, - {"anaglyph_green_magenta_color", ANAGLYPH_GM_COLOR}, - {"agmd", ANAGLYPH_GM_DUBOIS}, - {"anaglyph_green_magenta_dubois", ANAGLYPH_GM_DUBOIS}, - {"aybg", ANAGLYPH_YB_GRAY}, - {"anaglyph_yellow_blue_gray", ANAGLYPH_YB_GRAY}, - {"aybh", ANAGLYPH_YB_HALF}, - {"anaglyph_yellow_blue_half_color", ANAGLYPH_YB_HALF}, - {"aybc", ANAGLYPH_YB_COLOR}, - {"anaglyph_yellow_blue_color", ANAGLYPH_YB_COLOR}, - {"aybd", ANAGLYPH_YB_DUBOIS}, - {"anaglyph_yellow_blue_dubois", ANAGLYPH_YB_DUBOIS}, - {"ml", MONO_L}, - {"mono_left", MONO_L}, - {"mr", MONO_R}, - {"mono_right", MONO_R}, - {"sbsl", SIDE_BY_SIDE_LR}, - {"side_by_side_left_first", SIDE_BY_SIDE_LR}, - {"sbsr", SIDE_BY_SIDE_RL}, - {"side_by_side_right_first", SIDE_BY_SIDE_RL}, - {"sbs2l", SIDE_BY_SIDE_2_LR}, - {"side_by_side_half_width_left_first", SIDE_BY_SIDE_2_LR}, - {"sbs2r", SIDE_BY_SIDE_2_RL}, - {"side_by_side_half_width_right_first",SIDE_BY_SIDE_2_RL}, - {"abl", ABOVE_BELOW_LR}, - {"above_below_left_first", ABOVE_BELOW_LR}, - {"abr", ABOVE_BELOW_RL}, - {"above_below_right_first", ABOVE_BELOW_RL}, - {"ab2l", ABOVE_BELOW_2_LR}, - {"above_below_half_height_left_first", ABOVE_BELOW_2_LR}, - {"ab2r", ABOVE_BELOW_2_RL}, - {"above_below_half_height_right_first",ABOVE_BELOW_2_RL}, - {"irl", INTERLEAVE_ROWS_LR}, - {"interleave_rows_left_first", INTERLEAVE_ROWS_LR}, - {"irr", INTERLEAVE_ROWS_RL}, - {"interleave_rows_right_first", INTERLEAVE_ROWS_RL}, - {"al", ALTERNATING_LR}, - {"ar", ALTERNATING_RL}, - // convenience alias for MP_STEREO3D_MONO - {"mono", MONO_L}, - // for filter auto-insertion - {"auto", STEREO_AUTO}, - { NULL, 0} -}; - -// Extremely stupid; can be dropped when the internal filter is dropped, -// and OPT_CHOICE_C() can be used instead. -static int opt_to_stereo3dmode(int val) -{ - // Find x for name == MP_STEREO3D_NAME(x) - const char *name = m_opt_choice_str(stereo_code_names, val); - for (int n = 0; n < MP_STEREO3D_COUNT; n++) { - const char *o = MP_STEREO3D_NAME(val); - if (name && o && strcmp(o, name) == 0) - return n; - } - return MP_STEREO3D_INVALID; -} - -static int lavfi_reconfig(struct vf_instance *vf, - struct mp_image_params *in, - struct mp_image_params *out) -{ - struct vf_priv_s *p = vf_lw_old_priv(vf); - if (p->auto_in) { - const char *inf = MP_STEREO3D_NAME(in->stereo_in); - if (!inf) { - MP_ERR(vf, "Unknown/unsupported 3D mode.\n"); - return -1; - } - vf_lw_update_graph(vf, "stereo3d", "%s:%s", - inf, m_opt_choice_str(stereo_code_names, p->out_fmt)); - out->stereo_in = out->stereo_out = opt_to_stereo3dmode(p->out_fmt); - } - return 0; -} - -static void lavfi_init(vf_instance_t *vf) -{ - if (vf->priv->in_fmt == STEREO_AUTO && - vf_lw_set_graph(vf, vf->priv->lw_opts, "stereo3d", "null") >= 0) - { - vf_lw_set_reconfig_cb(vf, lavfi_reconfig); - return; - } - - if (vf_lw_set_graph(vf, vf->priv->lw_opts, "stereo3d", "%s:%s", - m_opt_choice_str(stereo_code_names, vf->priv->in_fmt), - m_opt_choice_str(stereo_code_names, vf->priv->out_fmt)) >= 0) - return; -} - -static int vf_open(vf_instance_t *vf) -{ - if (vf->priv->warn) - MP_WARN(vf, "%s", VF_LW_REPLACE); - - if (vf->priv->out_fmt == STEREO_AUTO) { - MP_FATAL(vf, "No autodetection for stereo output.\n"); - return 0; - } - if (vf->priv->in_fmt == STEREO_AUTO) - vf->priv->auto_in = 1; - - lavfi_init(vf); - return 1; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -static const m_option_t vf_opts_fields[] = { - OPT_CHOICE_C("in", in_fmt, 0, stereo_code_names), - OPT_CHOICE_C("out", out_fmt, 0, stereo_code_names), - OPT_FLAG("warn", warn, 0), - OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0), - {0} -}; - -const vf_info_t vf_info_stereo3d = { - .description = "stereoscopic 3d view", - .name = "stereo3d", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .priv_defaults = &vf_priv_default, - .options = vf_opts_fields, -}; diff --git a/video/filter/vf_yadif.c b/video/filter/vf_yadif.c deleted file mode 100644 index 3eee572a5f..0000000000 --- a/video/filter/vf_yadif.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdlib.h> - -#include <libavfilter/version.h> - -#include "options/options.h" - -#include "common/msg.h" -#include "vf.h" - -#include "vf_lavfi.h" - -#include "config.h" -#if !HAVE_GPL -#error GPL only -#endif - -struct vf_priv_s { - int mode; - int interlaced_only; - struct vf_lw_opts *lw_opts; - int warn; -}; - -static int vf_open(vf_instance_t *vf) -{ - struct vf_priv_s *p = vf->priv; - - if (p->warn) - MP_WARN(vf, "%s", VF_LW_REPLACE); - -#if LIBAVFILTER_VERSION_MICRO >= 100 - const char *mode[] = {"send_frame", "send_field", "send_frame_nospatial", - "send_field_nospatial"}; - - if (vf_lw_set_graph(vf, p->lw_opts, "yadif", "mode=%s:deint=%s", mode[p->mode], - p->interlaced_only ? "interlaced" : "all") >= 0) - { - return 1; - } -#else - // Libav numeric modes happen to match ours, but keep it explicit. - const char *mode[] = {"0", "1", "2", "3"}; - if (vf_lw_set_graph(vf, p->lw_opts, "yadif", "mode=%s:auto=%d", mode[p->mode], - p->interlaced_only) >= 0) - { - return 1; - } -#endif - - MP_FATAL(vf, "This version of libavfilter has no 'yadif' filter.\n"); - return 0; -} - -#define OPT_BASE_STRUCT struct vf_priv_s -static const m_option_t vf_opts_fields[] = { - OPT_CHOICE("mode", mode, 0, - ({"frame", 0}, - {"field", 1}, - {"frame-nospatial", 2}, - {"field-nospatial", 3})), - OPT_FLAG("interlaced-only", interlaced_only, 0), - OPT_FLAG("warn", warn, 0), - OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0), - {0} -}; - -const vf_info_t vf_info_yadif = { - .description = "Yet Another DeInterlacing Filter", - .name = "yadif", - .open = vf_open, - .priv_size = sizeof(struct vf_priv_s), - .priv_defaults = &(const struct vf_priv_s){ - .mode = 1, - .interlaced_only = 1, - .warn = 1, - }, - .options = vf_opts_fields, -}; |