1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-11 09:29:29 +00:00

display size/aspect adjusting filter

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10007 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
rfelker 2003-04-27 18:55:04 +00:00
parent 987378835f
commit 007449236f
3 changed files with 69 additions and 1 deletions

View File

@ -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

View File

@ -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
};

66
libmpcodecs/vf_dsize.c Normal file
View File

@ -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
};