summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-27 18:55:04 +0000
committerrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-27 18:55:04 +0000
commit007449236fb9f4c18d021445a930f8773a624959 (patch)
tree0a5cecce1214362835cbf2b10e69fb024d3a3cf1 /libmpcodecs
parent987378835fe2306b92851b61a3559c16ecdf3ce7 (diff)
downloadmpv-007449236fb9f4c18d021445a930f8773a624959.tar.bz2
mpv-007449236fb9f4c18d021445a930f8773a624959.tar.xz
display size/aspect adjusting filter
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10007 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/Makefile2
-rw-r--r--libmpcodecs/vf.c2
-rw-r--r--libmpcodecs/vf_dsize.c66
3 files changed, 69 insertions, 1 deletions
diff --git a/libmpcodecs/Makefile b/libmpcodecs/Makefile
index 1e0e89a69f..2eff8a6b5f 100644
--- a/libmpcodecs/Makefile
+++ b/libmpcodecs/Makefile
@@ -14,7 +14,7 @@ VIDEO_SRCS_NAT=vd_null.c vd_cinepak.c vd_qtrpza.c vd_raw.c vd_msvidc.c vd_fli.c
VIDEO_SRCS_OPT=vd_realvid.c vd_ffmpeg.c vd_dshow.c vd_dmo.c vd_vfw.c vd_vfwex.c vd_odivx.c vd_divx4.c vd_xanim.c vd_xvid.c vd_libdv.c vd_qtvideo.c
VIDEO_SRCS=dec_video.c vd.c $(VIDEO_SRCS_NAT) $(VIDEO_SRCS_LIB) $(VIDEO_SRCS_OPT)
-VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_lavcdeint.c vf_eq.c vf_eq2.c vf_halfpack.c vf_dint.c vf_1bpp.c vf_bmovl.c vf_2xsai.c vf_unsharp.c vf_swapuv.c vf_il.c vf_boxblur.c vf_sab.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_field.c vf_denoise3d.c vf_hqdn3d.c vf_detc.c vf_telecine.c vf_tfields.c vf_ivtc.c vf_ilpack.c
+VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_lavcdeint.c vf_eq.c vf_eq2.c vf_halfpack.c vf_dint.c vf_1bpp.c vf_bmovl.c vf_2xsai.c vf_unsharp.c vf_swapuv.c vf_il.c vf_boxblur.c vf_sab.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_field.c vf_denoise3d.c vf_hqdn3d.c vf_detc.c vf_telecine.c vf_tfields.c vf_ivtc.c vf_ilpack.c vf_dsize.c
ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c ve_xvid.c ve_qtvideo.c ve_nuv.c
NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c native/svq1.c
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index 3f237d7adb..854b0faf47 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -65,6 +65,7 @@ extern vf_info_t vf_info_telecine;
extern vf_info_t vf_info_tfields;
extern vf_info_t vf_info_ivtc;
extern vf_info_t vf_info_ilpack;
+extern vf_info_t vf_info_dsize;
// list of available filters:
static vf_info_t* filter_list[]={
@@ -121,6 +122,7 @@ static vf_info_t* filter_list[]={
&vf_info_tfields,
&vf_info_ivtc,
&vf_info_ilpack,
+ &vf_info_dsize,
NULL
};
diff --git a/libmpcodecs/vf_dsize.c b/libmpcodecs/vf_dsize.c
new file mode 100644
index 0000000000..7806dc81d3
--- /dev/null
+++ b/libmpcodecs/vf_dsize.c
@@ -0,0 +1,66 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "../config.h"
+#include "../mp_msg.h"
+
+#include "img_format.h"
+#include "mp_image.h"
+#include "vf.h"
+
+struct vf_priv_s {
+ int w, h;
+ float aspect;
+};
+
+static int config(struct vf_instance_s* vf,
+ int width, int height, int d_width, int d_height,
+ unsigned int flags, unsigned int outfmt)
+{
+ if (vf->priv->w && vf->priv->h) {
+ d_width = vf->priv->w;
+ d_height = vf->priv->h;
+ } else {
+ if (vf->priv->aspect * height > width) {
+ d_width = height * vf->priv->aspect;
+ d_height = height;
+ } else {
+ d_height = width / vf->priv->aspect;
+ d_width = width;
+ }
+ }
+ return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
+}
+
+static int open(vf_instance_t *vf, char* args)
+{
+ vf->config = config;
+ vf->draw_slice = vf_next_draw_slice;
+ //vf->default_caps = 0;
+ vf->priv = calloc(sizeof(struct vf_priv_s), 1);
+ vf->priv->aspect = 4.0/3.0;
+ if (args) {
+ if (strchr(args, '/')) {
+ int w, h;
+ sscanf(args, "%d/%d", &w, &h);
+ vf->priv->aspect = (float)w/h;
+ } else if (strchr(args, '.')) {
+ sscanf(args, "%f", &vf->priv->aspect);
+ } else {
+ sscanf(args, "%d:%d", &vf->priv->w, &vf->priv->h);
+ }
+ }
+ return 1;
+}
+
+vf_info_t vf_info_dsize = {
+ "reset displaysize/aspect",
+ "dsize",
+ "Rich Felker",
+ "",
+ open,
+ NULL
+};
+