mirror of https://github.com/mpv-player/mpv
swscale filter
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5523 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
712a621e7a
commit
abd870166d
|
@ -5,7 +5,7 @@ LIBNAME = libmpcodecs.a
|
||||||
|
|
||||||
AUDIO_SRCS=dec_audio.c ad.c ad_a52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dk4adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c ad_msgsm.c ad_faad.c ad_vorbis.c ad_libmad.c
|
AUDIO_SRCS=dec_audio.c ad.c ad_a52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dk4adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c ad_msgsm.c ad_faad.c ad_vorbis.c ad_libmad.c
|
||||||
VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c vd_mpegpes.c
|
VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c vd_mpegpes.c
|
||||||
VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c
|
VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c
|
||||||
|
|
||||||
ifeq ($(PNG),yes)
|
ifeq ($(PNG),yes)
|
||||||
VIDEO_SRCS += vd_mpng.c
|
VIDEO_SRCS += vd_mpng.c
|
||||||
|
|
|
@ -13,6 +13,7 @@ extern vf_info_t vf_info_vo;
|
||||||
extern vf_info_t vf_info_crop;
|
extern vf_info_t vf_info_crop;
|
||||||
extern vf_info_t vf_info_expand;
|
extern vf_info_t vf_info_expand;
|
||||||
extern vf_info_t vf_info_pp;
|
extern vf_info_t vf_info_pp;
|
||||||
|
extern vf_info_t vf_info_scale;
|
||||||
|
|
||||||
char** vo_plugin_args=(char**) NULL;
|
char** vo_plugin_args=(char**) NULL;
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ static vf_info_t* filter_list[]={
|
||||||
&vf_info_crop,
|
&vf_info_crop,
|
||||||
&vf_info_expand,
|
&vf_info_expand,
|
||||||
&vf_info_pp,
|
&vf_info_pp,
|
||||||
// &vf_info_zoom,
|
&vf_info_scale,
|
||||||
// &vf_info_osd,
|
// &vf_info_osd,
|
||||||
&vf_info_vo,
|
&vf_info_vo,
|
||||||
NULL
|
NULL
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
|
#include "../mp_msg.h"
|
||||||
|
|
||||||
|
#include "../mp_image.h"
|
||||||
|
#include "vf.h"
|
||||||
|
|
||||||
|
#include "../libvo/fastmemcpy.h"
|
||||||
|
#include "../postproc/swscale.h"
|
||||||
|
|
||||||
|
struct vf_priv_s {
|
||||||
|
int w,h;
|
||||||
|
SwsContext *ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
//===========================================================================//
|
||||||
|
|
||||||
|
static int config(struct vf_instance_s* vf,
|
||||||
|
int width, int height, int d_width, int d_height,
|
||||||
|
unsigned int flags, unsigned int outfmt){
|
||||||
|
// calculate the missing parameters:
|
||||||
|
if(vf->priv->w<=0) vf->priv->w=width;
|
||||||
|
if(vf->priv->h<=0) vf->priv->h=height;
|
||||||
|
// new swscaler:
|
||||||
|
vf->priv->ctx=getSwsContextFromCmdLine(width,height,outfmt,
|
||||||
|
vf->priv->w,vf->priv->h,outfmt);
|
||||||
|
if(!vf->priv->ctx){
|
||||||
|
// error...
|
||||||
|
printf("Couldn't init SwScaler for this setup\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,outfmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
||||||
|
mp_image_t *dmpi;
|
||||||
|
|
||||||
|
// hope we'll get DR buffer:
|
||||||
|
dmpi=vf_get_image(vf->next,mpi->imgfmt,
|
||||||
|
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
|
||||||
|
vf->priv->w, vf->priv->h);
|
||||||
|
|
||||||
|
vf->priv->ctx->swScale(vf->priv->ctx,mpi->planes,mpi->stride,0,mpi->h,dmpi->planes,dmpi->stride);
|
||||||
|
|
||||||
|
vf_next_put_image(vf,dmpi);
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================//
|
||||||
|
|
||||||
|
static int open(vf_instance_t *vf, char* args){
|
||||||
|
vf->config=config;
|
||||||
|
vf->put_image=put_image;
|
||||||
|
vf->priv=malloc(sizeof(struct vf_priv_s));
|
||||||
|
// TODO: parse args ->
|
||||||
|
vf->priv->ctx=NULL;
|
||||||
|
vf->priv->w=
|
||||||
|
vf->priv->h=-1;
|
||||||
|
if(args) sscanf(args, "%d:%d",
|
||||||
|
&vf->priv->w,
|
||||||
|
&vf->priv->h);
|
||||||
|
printf("SwScale: %d x %d\n",
|
||||||
|
vf->priv->w,
|
||||||
|
vf->priv->h);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
vf_info_t vf_info_scale = {
|
||||||
|
"software scaling",
|
||||||
|
"scale",
|
||||||
|
"A'rpi",
|
||||||
|
"",
|
||||||
|
open
|
||||||
|
};
|
||||||
|
|
||||||
|
//===========================================================================//
|
Loading…
Reference in New Issue