[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[498] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-02 11:56:40
|
Revision: 498 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=498&view=rev Author: nickols_k Date: 2012-12-02 11:56:31 +0000 (Sun, 02 Dec 2012) Log Message: ----------- Redesign video filter system and make sh_video not available for it. Note: it seems that executable compiled with -g3 lost >500KB of size after applying this patch. Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpdemux/stheader.h mplayerxp/libvo/img_format.cpp mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/mp_msg.cpp mplayerxp/mplayerxp.cpp mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf_1bpp.cpp mplayerxp/postproc/vf_2xsai.cpp mplayerxp/postproc/vf_aspect.cpp mplayerxp/postproc/vf_delogo.cpp mplayerxp/postproc/vf_denoise3d.cpp mplayerxp/postproc/vf_dint.cpp mplayerxp/postproc/vf_down3dright.cpp mplayerxp/postproc/vf_eq.cpp mplayerxp/postproc/vf_expand.cpp mplayerxp/postproc/vf_flip.cpp mplayerxp/postproc/vf_format.cpp mplayerxp/postproc/vf_framestep.cpp mplayerxp/postproc/vf_il.cpp mplayerxp/postproc/vf_menu.cpp mplayerxp/postproc/vf_mirror.cpp mplayerxp/postproc/vf_noise.cpp mplayerxp/postproc/vf_null.cpp mplayerxp/postproc/vf_ow.cpp mplayerxp/postproc/vf_palette.cpp mplayerxp/postproc/vf_panscan.cpp mplayerxp/postproc/vf_perspective.cpp mplayerxp/postproc/vf_pp.cpp mplayerxp/postproc/vf_raw.cpp mplayerxp/postproc/vf_rectangle.cpp mplayerxp/postproc/vf_rgb2bgr.cpp mplayerxp/postproc/vf_rotate.cpp mplayerxp/postproc/vf_scale.cpp mplayerxp/postproc/vf_smartblur.cpp mplayerxp/postproc/vf_softpulldown.cpp mplayerxp/postproc/vf_swapuv.cpp mplayerxp/postproc/vf_test.cpp mplayerxp/postproc/vf_unsharp.cpp mplayerxp/postproc/vf_vo.cpp mplayerxp/postproc/vf_yuvcsp.cpp mplayerxp/postproc/vf_yuy2.cpp mplayerxp/postproc/vf_yvu9.cpp Added Paths: ----------- mplayerxp/postproc/vf.h mplayerxp/postproc/vf_internal.h Removed Paths: ------------- mplayerxp/postproc/vf.h Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -73,11 +73,11 @@ { priv_t* priv=(priv_t*)opaque; sh_video_t* sh_video = priv->parent; - vf_instance_t* vf=sh_video->vfilter; + vf_stream_t* vs=sh_video->vfilter; vf_equalizer_t eq; eq.item=item; eq.value=value*10; - if(vf->control_vf(vf,VFCTRL_SET_EQUALIZER,&eq)!=MPXP_True) { + if(vf_control(vs,VFCTRL_SET_EQUALIZER,&eq)!=MPXP_True) { if(priv->mpvdec) return priv->mpvdec->control_vd(sh_video,VDCTRL_SET_EQUALIZER,(any_t*)item,(int)value); } return MPXP_False; @@ -88,7 +88,7 @@ sh_video_t* sh_video = priv->parent; if(!sh_video->inited) { delete priv; return; } MSG_V("uninit video ...\n"); - if(sh_video->vfilter && sh_video->vfilter_inited==1) vf_uninit_filter_chain(sh_video->vfilter); + if(sh_video->vfilter && sh_video->vfilter_inited==1) vf_uninit(sh_video->vfilter); priv->mpvdec->uninit(sh_video); sh_video->inited=0; delete priv; @@ -146,12 +146,25 @@ } any_t * mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,any_t*libinput){ + UNUSED(codecname); + UNUSED(status); int done=0; const video_probe_t* vprobe=NULL; sh_video->codec=NULL; priv_t* priv = new(zeromem) priv_t; priv->parent=sh_video; priv->libinput=libinput; + + MP_UNIT("init_video_filters"); + if(sh_video->vfilter_inited<=0) { + vf_conf_t conf; + conf.w=sh_video->src_w; + conf.h=sh_video->src_h; + conf.fourcc=sh_video->fourcc; // may be NULL ??? + sh_video->vfilter=vf_init(libinput,&conf); + sh_video->vfilter_inited=1; + } + if(vfm) { priv->mpvdec=vfm_find_driver(vfm); if(priv->mpvdec) vprobe=priv->mpvdec->probe(sh_video,sh_video->fourcc); @@ -174,6 +187,8 @@ sh_video->codec=NULL; } else done=1; } + if(done) vf_showlist(sh_video->vfilter); + #ifdef ENABLE_WIN32LOADER if(sh_video->codec) { done=0; @@ -223,10 +238,10 @@ void mpcodecs_draw_image(sh_video_t* sh,mp_image_t *mpi) { - vf_instance_t* vf; + vf_stream_t* s; const unsigned h_step=16; unsigned num_slices = mpi->h/h_step; - vf=sh->vfilter; + s=sh->vfilter; if(!(mpi->flags&(MP_IMGFLAG_DRAW_CALLBACK))){ if(mpi->h%h_step) num_slices++; @@ -248,16 +263,16 @@ #ifdef _OPENMP if(use_vf_threads && (num_slices>smp_num_cpus)) { for(j=0;j<num_slices;j+=smp_num_cpus) { -#pragma omp parallel for shared(vf) private(i) +#pragma omp parallel for shared(s) private(i) for(i=j;i<smp_num_cpus;i++) { MSG_DBG2("parallel: dec_video.put_slice[%ux%u] %i %i %i %i\n",ampi[i]->width,ampi[i]->height,ampi[i]->x,ampi[i]->y,ampi[i]->w,ampi[i]->h); - vf->put_slice(vf,ampi[i]); + vf_put_slice(s,ampi[i]); free_mp_image(ampi[i]); } } for(;j<num_slices;j++) { MSG_DBG2("par_tail: dec_video.put_slice[%ux%u] %i %i %i %i\n",ampi[i]->width,ampi[i]->height,ampi[i]->x,ampi[i]->y,ampi[i]->w,ampi[i]->h); - vf->put_slice(vf,ampi[j]); + vf_put_slice(s,ampi[j]); free_mp_image(ampi[j]); } } @@ -267,13 +282,13 @@ /* execute slices instead of whole frame make faster multiple filters */ for(i=0;i<num_slices;i++) { MSG_DBG2("dec_video.put_slice[%ux%u] %i %i %i %i -> [%i]\n",ampi[i]->width,ampi[i]->height,ampi[i]->x,ampi[i]->y,ampi[i]->w,ampi[i]->h,ampi[i]->xp_idx); - vf->put_slice(vf,ampi[i]); + vf_put_slice(s,ampi[i]); free_mp_image(ampi[i]); } } } else { MSG_DBG2("Put whole frame[%ux%u]\n",mpi->width,mpi->height); - vf->put_slice(vf,mpi); + vf_put_slice(s,mpi); } free_mp_image(mpi); } @@ -283,16 +298,16 @@ int mpcv_decode(any_t *opaque,const enc_frame_t* frame){ priv_t* priv=(priv_t*)opaque; sh_video_t* sh_video = priv->parent; - vf_instance_t* vf; + vf_stream_t* s; mp_image_t *mpi=NULL; unsigned int t; unsigned int t2; double tt; - vf=sh_video->vfilter; + s=sh_video->vfilter; t=GetTimer(); - vf->control_vf(vf,VFCTRL_START_FRAME,NULL); + vf_control(s,VFCTRL_START_FRAME,NULL); sh_video->active_slices=0; mpi=priv->mpvdec->decode(sh_video, frame); @@ -409,7 +424,8 @@ int screen_size_x=0;//SCREEN_SIZE_X; int screen_size_y=0;//SCREEN_SIZE_Y; sh_video_t* sh = priv->parent; - vf_instance_t* vf=sh->vfilter,*sc=NULL; + vf_stream_t* s=sh->vfilter; + vf_conf_t conf; int palette=0; if(!(sh->src_w && sh->src_h)) @@ -432,9 +448,9 @@ int flags; out_fmt=sh->codec->outfmt[i]; if(out_fmt==0xFFFFFFFF||out_fmt==0x0) continue; - flags=vf_query_format(vf,out_fmt,w,h); + flags=vf_query_format(s,out_fmt,w,h); MSG_DBG2("vo_debug[step i=%d]: query(%s %ix%i) returned 0x%X for:\n",i,vo_format_name(out_fmt),w,h,flags); - if(mp_conf.verbose>1) if(mp_conf.verbose) vf_showlist(vf); + if(mp_conf.verbose>1) vf_showlist(s); if((flags&VFCAP_CSP_SUPPORTED_BY_HW) || ((flags&VFCAP_CSP_SUPPORTED) && j<0)){ // check (query) if codec really support this outfmt... sh->outfmtidx=j; // pass index to the control() function this way @@ -454,7 +470,7 @@ } if(j<0){ // TODO: no match - we should use conversion... - if(strcmp(vf->info->name,"fmtcvt") && palette!=1){ + if(strcmp(vf_get_first_name(s),"fmtcvt") && palette!=1){ int ind; MSG_WARN("Can't find colorspace for: "); for(ind=0;ind<CODECS_MAX_OUTFMT;ind++) { @@ -463,26 +479,24 @@ MSG_WARN("'%s' ",vo_format_name(sh->codec->outfmt[ind])); } MSG_WARN("Trying -vf fmtcvt\n"); - sc=vf=vf_open_filter(vf,sh,"fmtcvt",NULL,priv->libinput); + conf.w=sh->src_w; + conf.h=sh->src_h; + conf.fourcc=sh->codec->outfmt[sh->outfmtidx]; + vf_prepend_filter(s,"fmtcvt",&conf); goto csp_again; } else if(palette==1){ MSG_V("vd: Trying -vf palette...\n"); palette=-1; - vf=vf_open_filter(vf,sh,"palette",NULL,priv->libinput); + conf.w=sh->src_w; + conf.h=sh->src_h; + conf.fourcc=sh->codec->outfmt[sh->outfmtidx]; + vf_prepend_filter(s,"palette",&conf); goto csp_again; } else { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc - vf_instance_t* voi, *vp = NULL, *ve; - // Remove the scale filter if we added it ourself - if(vf == sc) { - ve = vf; - vf = vf->next; - vf_uninit_filter(ve); - } - // Find the last filter (vf_vo) - for(voi = vf ; voi->next ; voi = voi->next) - vp = voi; + // Remove the scale filter if we added it ourself + if(strcmp(vf_get_first_name(s),"fmtcvt")==0) vf_remove_first(s); } MSG_WARN(MSGTR_VOincompCodec); sh->vfilter_inited=-1; @@ -491,7 +505,6 @@ out_fmt=sh->codec->outfmt[j]; sh->outfmtidx=j; - sh->vfilter=vf; // autodetect flipping if(vo_conf.flip==0){ @@ -503,7 +516,10 @@ if(vo_data->flags&VFCAP_FLIPPED) vo_data->FLIP_REVERT(); if(vo_data->FLIP() && !(vo_data->flags&VFCAP_FLIP)){ // we need to flip, but no flipping filter avail. - sh->vfilter=vf=vf_open_filter(vf,sh,"flip",NULL,priv->libinput); + conf.w=sh->src_w; + conf.h=sh->src_h; + conf.fourcc=out_fmt; + vf_prepend_filter(s,"flip",&conf); } // time to do aspect ratio corrections... @@ -555,8 +571,8 @@ vo_data->flags, "MPlayerXP",vo_format_name(out_fmt)); - MSG_DBG2("vf configuring: %s\n",vf->info->name); - if(vf->config_vf(vf,sh->src_w,sh->src_h, +// MSG_DBG2("vf configuring: %s\n",vf->info->name); + if(vf_config(s,sh->src_w,sh->src_h, screen_size_x,screen_size_y, vo_data->flags, out_fmt)==0){ @@ -577,8 +593,9 @@ // returns NULL or allocated mp_image_t* // Note: buffer allocation may be moved to mpcodecs_config_vf() later... mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,int w, int h){ - MSG_DBG2("mpcodecs_get_image(vf_%s,%i,%i,%i,%i) was called\n",((vf_instance_t *)(sh->vfilter))->info->name,mp_imgtype,mp_imgflag,w,h); - mp_image_t* mpi=vf_get_new_image(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h,dae_curr_vdecoded(xp_core)); + vf_stream_t* s = sh->vfilter; +// MSG_DBG2("mpcodecs_get_image(vf_%s,%i,%i,%i,%i) was called\n",((vf_instance_t *)(sh->vfilter))->info->name,mp_imgtype,mp_imgflag,w,h); + mp_image_t* mpi=vf_get_new_image(s,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h,dae_curr_vdecoded(xp_core)); mpi->x=mpi->y=0; if(mpi->xp_idx==XP_IDX_INVALID) MSG_V("[mpcodecs_get_image] Incorrect mpi->xp_idx. Be ready for segfault!\n"); @@ -586,6 +603,6 @@ } void mpcodecs_draw_slice(sh_video_t *sh, mp_image_t*mpi) { - vf_instance_t* vf = sh->vfilter; - vf->put_slice(vf,mpi); + vf_stream_t* vf = sh->vfilter; + vf_put_slice(vf,mpi); } Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/libmpdemux/stheader.h 2012-12-02 11:56:31 UTC (rev 498) @@ -74,7 +74,10 @@ unsigned codecdata_len; }; -struct vf_instance_t; +namespace mpxp { + struct vf_stream_t; +} + struct sh_video_t : public standard_header { public: sh_video_t() {} @@ -92,7 +95,7 @@ float aspect; unsigned int outfmtidx; // TODO: replace with out_fourcc /* vfilter chan */ - vf_instance_t* vfilter; + vf_stream_t* vfilter; int vfilter_inited; int vf_flags; unsigned active_slices; // used in dec_video+vd_ffmpeg only!!! Modified: mplayerxp/libvo/img_format.cpp =================================================================== --- mplayerxp/libvo/img_format.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/libvo/img_format.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -1,6 +1,7 @@ #include "mp_config.h" #include "osdep/mplib.h" using namespace mpxp; +#include <ctype.h> #include <stdio.h> #include <limits.h> #include "img_format.h" @@ -80,7 +81,11 @@ case IMGFMT_XVMC_MOCO_MPEG2: return("MPEG1/2 Motion Compensation"); case IMGFMT_XVMC_IDCT_MPEG2: return("MPEG1/2 Motion Compensation and IDCT"); } - snprintf(unknow_format,20,"Unknown 0x%04x",format); + char *p=reinterpret_cast<char *>(&format); + if(isprint(p[0])&&isprint(p[1])&&isprint(p[2])&&isprint(p[4])) + snprintf(unknow_format,20,"Unknown %c%c%c%c",p[0],p[1],p[2],p[3]); + else + snprintf(unknow_format,20,"Unknown 0x%04x",format); return unknow_format; } Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/libvo/video_out.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -36,7 +36,6 @@ #include "osdep/shmem.h" #include "mp_conf_lavc.h" -#include "postproc/vf.h" #include "xmpcore/xmp_core.h" #include "mplayerxp.h" #include "osdep/fastmemcpy.h" @@ -46,6 +45,7 @@ #include "dri_vo.h" #include "osd_render.h" #include "sub.h" +#include "postproc/vf.h" #include "vo_msg.h" namespace mpxp{ @@ -121,6 +121,7 @@ const vo_info_t* video_out; class VO_Interface* vo_iface; const OSD_Render* draw_alpha; + vf_stream_t* parent; }; vo_priv_t::vo_priv_t() { @@ -305,16 +306,17 @@ /* TODO: smart analizer of scaling possibilities of vo_driver */ if(is_resize) { xp_core->in_resize=1; - vf_reinit_vo(priv.dri.cap.w,priv.dri.cap.h,priv.dri.cap.fourcc,1); + vf_reinit_vo(priv.parent,priv.dri.cap.w,priv.dri.cap.h,priv.dri.cap.fourcc,1); } - vf_reinit_vo(priv.dri.cap.w,priv.dri.cap.h,priv.dri.cap.fourcc,0); + vf_reinit_vo(priv.parent,priv.dri.cap.w,priv.dri.cap.h,priv.dri.cap.fourcc,0); } -MPXP_Rc Video_Output::configure(uint32_t width, uint32_t height, uint32_t d_width, +MPXP_Rc Video_Output::configure(vf_stream_t* s,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, vo_flags_e _fullscreen, const char *title, uint32_t format) { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + priv.parent=s; MPXP_Rc retval; unsigned dest_fourcc,w,d_w,h,d_h; MSG_DBG3("dri_vo_dbg: vo_config\n"); Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/libvo/video_out.h 2012-12-02 11:56:31 UTC (rev 498) @@ -146,6 +146,7 @@ virtual ~video_private() {} }; + struct vf_stream_t; class Video_Output { public: Video_Output(); @@ -168,7 +169,7 @@ virtual MPXP_Rc init(const char *driver_name) const; virtual void print_help() const; virtual const vo_info_t* get_info() const; - virtual MPXP_Rc configure(uint32_t width, uint32_t height, uint32_t d_width, + virtual MPXP_Rc configure(vf_stream_t* parent,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, vo_flags_e fullscreen,const char *title, uint32_t format); virtual uint32_t query_format(uint32_t* fourcc,unsigned src_w,unsigned src_h) const; Modified: mplayerxp/mp_msg.cpp =================================================================== --- mplayerxp/mp_msg.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/mp_msg.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -86,7 +86,7 @@ int mpxp_printf( unsigned x, const char *format, ... ){ /* TODO: more useful usage of module_id */ int rc=0; - char sbuf[0xFFFF]; + char* sbuf=new char[0xFFFFF]; unsigned ssize; unsigned level=(x>>28)&0xF; unsigned mod=x&0x0FFFFFFF; @@ -125,6 +125,7 @@ else was_eol=0; fflush(stderr); // if(priv) pthread_mutex_unlock(&priv->mp_msg_mutex); + delete sbuf; return rc; } Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/mplayerxp.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -1917,11 +1917,6 @@ /*================== Init VIDEO (codec & libvo) ==========================*/ if(!sh_video) goto main; - MP_UNIT("init_video_filters"); - if(sh_video->vfilter_inited<=0) { - sh_video->vfilter=vf_init(sh_video,MPXPSys.libinput()); - sh_video->vfilter_inited=1; - } if((MPXPSys.find_vcodec())!=MPXP_Ok) { sh_video=reinterpret_cast<sh_video_t*>(MPXPSys.demuxer()->video->sh); if(!sh_audio) goto goto_next_file; @@ -1942,7 +1937,6 @@ mpcv_set_quality(mpxp_context().video().decoder,mpxp_context().output_quality); } - vf_showlist(reinterpret_cast<vf_instance_t*>(sh_video->vfilter)); // ========== Init display (sh_video->src_w*sh_video->src_h/out_fmt) ============ MPXPSys.inited_flags|=INITED_VO; Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -13,6 +13,7 @@ #include "libvo/video_out.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "libmpconf/codec-cfg.h" @@ -282,11 +283,14 @@ // By default vf doesn't accept MPEGPES static int __FASTCALL__ vf_default_query_format(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h){ - if(fmt == IMGFMT_MPEGPES) return 0; - return 1;//vf_next_query_format(vf,fmt,w,h); + UNUSED(vf); + UNUSED(w); + UNUSED(h); + if(fmt == IMGFMT_MPEGPES) return 0; + return 1;//vf_next_query_format(vf,fmt,w,h); } -static vf_instance_t* __FASTCALL__ vf_open_plugin(vf_instance_t* next,sh_video_t *sh,const char *name,const char *args,any_t* libinput){ +static vf_instance_t* __FASTCALL__ vf_open_plugin(vf_instance_t* next,const char *name,const char *args,any_t* libinput,const vf_conf_t* conf){ vf_instance_t* vf; int i; for(i=0;;i++){ @@ -308,10 +312,9 @@ vf->put_slice=vf_next_put_slice; vf->default_caps=VFCAP_ACCEPT_STRIDE; vf->default_reqs=0; - vf->sh=sh; - vf->dw=sh->src_w; - vf->dh=sh->src_h; - vf->dfourcc=sh->fourcc; + vf->conf.w=conf->w; + vf->conf.h=conf->h; + vf->conf.fourcc=conf->fourcc; vf->libinput=libinput; if(next) next->prev=vf; if(vf->info->open(vf,(char*)args)==MPXP_Ok) return vf; // Success! @@ -320,23 +323,22 @@ return NULL; } -vf_instance_t* __FASTCALL__ vf_open_filter(vf_instance_t* next,sh_video_t *sh,const char *name,const char *args,any_t*libinput){ +vf_instance_t* __FASTCALL__ vf_open_filter(vf_instance_t* next,const char *name,const char *args,any_t*libinput,const vf_conf_t* conf){ if(strcmp(name,"vo")) { - MSG_V("Open video filter: [%s]\n", name); + MSG_V("Open video filter: [%s] <%ux%u %s>\n", name,conf->w,conf->h,vo_format_name(conf->fourcc)); } if(next) check_pin("vfilter",next->pin,VF_PIN); - return vf_open_plugin(next,sh,name,args,libinput); + return vf_open_plugin(next,name,args,libinput,conf); } //============================================================================ - -unsigned int __FASTCALL__ vf_match_csp(vf_instance_t** vfp,unsigned int* list,unsigned int preferred,unsigned w,unsigned h){ +unsigned int __FASTCALL__ vf_match_csp(vf_instance_t** vfp,unsigned int* list,const vf_conf_t* conf){ vf_instance_t* vf=*vfp; unsigned int* p; unsigned int best=0; int ret; if((p=list)) while(*p){ - ret=vf->query_format(vf,*p,w,h); + ret=vf->query_format(vf,*p,conf->w,conf->h); MSG_V("[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3); if(ret&2){ best=*p; break;} // no conversion -> bingo! if(ret&1 && !best) best=*p; // best with conversion @@ -345,13 +347,14 @@ if(best) return best; // bingo, they have common csp! // ok, then try with scale: if(vf->info == &vf_info_scale) return 0; // avoid infinite recursion! - vf=vf_open_filter(vf,vf->sh,"fmtcvt",NULL,vf->libinput); + vf=vf_open_filter(vf,"fmtcvt",NULL,vf->libinput,conf); if(!vf) return 0; // failed to init "scale" // try the preferred csp first: - if(preferred && vf->query_format(vf,preferred,w,h)) best=preferred; else + if(conf->fourcc && vf->query_format(vf,conf->fourcc,conf->w,conf->h)) best=conf->fourcc; + else // try the list again, now with "scaler" : if((p=list)) while(*p){ - ret=vf->query_format(vf,*p,w,h); + ret=vf->query_format(vf,*p,conf->w,conf->h); MSG_V("[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3); if(ret&2){ best=*p; break;} // no conversion -> bingo! if(ret&1 && !best) best=*p; // best with conversion @@ -378,15 +381,12 @@ vo_flags_e voflags, unsigned int outfmt){ int miss; int flags=vf_next_query_format(vf,outfmt,d_width,d_height); - vf->dw=width; - vf->dh=height; - vf->dfourcc=outfmt; if(!flags){ // hmm. colorspace mismatch!!! // let's insert the 'scale' filter, it does the job for us: vf_instance_t* vf2; if(vf->next->info==&vf_info_scale) return 0; // scale->scale - vf2=vf_open_filter(vf->next,vf->sh,"scale",NULL,vf->libinput); + vf2=vf_open_filter(vf->next,"scale",NULL,vf->libinput,&vf->conf); if(!vf2) return 0; // shouldn't happen! vf->next=vf2; flags=vf_next_query_format(vf->next,outfmt,d_width,d_height); @@ -400,7 +400,7 @@ if(miss&VFCAP_ACCEPT_STRIDE){ // vf requires stride support but vf->next doesn't support it! // let's insert the 'expand' filter, it does the job for us: - vf_instance_t* vf2=vf_open_filter(vf->next,vf->sh,"expand",NULL,vf->libinput); + vf_instance_t* vf2=vf_open_filter(vf->next,"expand",NULL,vf->libinput,&vf->conf); if(!vf2) return 0; // shouldn't happen! vf->next=vf2; } @@ -422,9 +422,6 @@ int __FASTCALL__ vf_query_format(vf_instance_t* vf, unsigned int fmt,unsigned width,unsigned height) { - vf->dw=width; - vf->dh=height; - vf->dfourcc=fmt; check_pin("vfilter",vf->pin,VF_PIN); return vf->query_format(vf,fmt,width,height); } @@ -459,25 +456,14 @@ } } -void vf_help(){ - int i=0; - MSG_INFO( "Available video filters:\n"); - while(filter_list[i]){ - MSG_INFO("\t%-10s: %s\n",filter_list[i]->name,filter_list[i]->info); - i++; - } - MSG_INFO("\n"); -} - extern vf_cfg_t vf_cfg; -static sh_video_t *sh_video; -vf_instance_t* __FASTCALL__ vf_init(sh_video_t *sh,any_t* libinput) +vf_instance_t* __FASTCALL__ vf_init_filter(any_t* libinput,const vf_conf_t* conf) { char *vf_last=NULL,*vf_name=vf_cfg.list; char *arg; vf_instance_t* vfi=NULL,*vfi_prev=NULL,*vfi_first; - sh_video=sh; - vfi=vf_open_filter(NULL,sh,"vo",NULL,libinput); +// sh_video=sh; + vfi=vf_open_filter(NULL,"vo",NULL,libinput,conf); vfi_prev=vfi; if(vf_name) while(vf_name!=vf_last){ @@ -487,7 +473,7 @@ arg=strchr(vf_last,'='); if(arg) { *arg=0; arg++; } MSG_V("Attach filter %s\n",vf_last); - vfi=vf_open_plugin(vfi,sh,vf_last,arg,libinput); + vfi=vf_open_plugin(vfi,vf_last,arg,libinput,conf); if(!vfi) vfi=vfi_prev; vfi_prev=vfi; } @@ -524,7 +510,7 @@ if(next->print_conf) next->print_conf(next); else MSG_INFO("[vf_%s] %s [%dx%d,%s] \n",next->info->name,next->info->info, - next->dw,next->dh,vo_format_name(next->dfourcc)); + next->conf.w,next->conf.h,vo_format_name(next->conf.fourcc)); next=next->next; }while(next); } @@ -544,31 +530,45 @@ static int __FASTCALL__ dummy_config(vf_instance_t* vf, int width, int height, int d_width, int d_height, vo_flags_e voflags, unsigned int outfmt){ + UNUSED(vf); + UNUSED(width); + UNUSED(height); + UNUSED(d_width); + UNUSED(d_height); + UNUSED(voflags); + UNUSED(outfmt); return 1; } -static void vf_report_chain(void) +static void vf_report_chain(vf_instance_t* first) { - vf_instance_t *_this=sh_video->vfilter; - MSG_V("sh_video: %ix%i@%s\n",sh_video->src_w,sh_video->src_h,vo_format_name(sh_video->codec->outfmt[sh_video->outfmtidx])); + vf_instance_t *_this=first; + MSG_V("vf->first: %ix%i@%s\n",first->conf.w,first->conf.h,vo_format_name(first->conf.fourcc)); while(1) { if(!_this) break; - MSG_V("%s[%ux%i@%s](%s, %s)\n" - ,_this->info->name - ,_this->dw,_this->dh,vo_format_name(_this->dfourcc) - ,_this->prev?_this->prev->info->name:"NULL",_this->next?_this->next->info->name:"NULL"); + MSG_V("[%ux%i@%s](%s<-%s->%s)\n" + ,_this->conf.w + ,_this->conf.h + ,vo_format_name(_this->conf.fourcc) + ,_this->prev?_this->prev->info->name:"NULL" + ,_this->info->name + ,_this->next?_this->next->info->name:"NULL"); _this=_this->next; } } -void __FASTCALL__ vf_reinit_vo(unsigned w,unsigned h,unsigned fmt,int reset_cache) +vf_instance_t* __FASTCALL__ vf_reinit_vo(vf_instance_t* first,unsigned w,unsigned h,unsigned fmt,int reset_cache) { vf_instance_t *vf_scaler=NULL; vf_instance_t* _saved=NULL; - vf_instance_t* _this=sh_video->vfilter; + vf_instance_t* _this=first; + vf_instance_t* _first=first; unsigned sw,sh,sfourcc; - MSG_V("Call vf_reinit_vo %ix%i@%s\n",w,h,vo_format_name(fmt)); - _this=sh_video->vfilter; + MSG_V("Call vf_reinit_vo <%s: %ix%i@%s> -> <vo: %ix%i@%s>\n" + ,_first->info->name + ,_first->conf.w,_first->conf.h,vo_format_name(_first->conf.fourcc) + ,w,h,vo_format_name(fmt)); + _this=first; _saved=NULL; while(1) { @@ -577,7 +577,7 @@ _saved=_this; _this=_this->next; } - vf_report_chain(); + vf_report_chain(_first); _this=_saved->prev; if(_this) if(strcmp(_this->info->name,"fmtcvt")==0 || strcmp(_this->info->name,"scale")==0) @@ -586,13 +586,13 @@ MSG_V("Unlinking 'fmtcvt'\n"); i=_this->prev; if(i) i->next=_this->next; - else sh_video->vfilter=_this->next; + else first=_this->next; _this->next->prev=i; vf_uninit_filter(_this); - vf_report_chain(); + vf_report_chain(_this); } /* _this == vo */ - _this=sh_video->vfilter; + _this=first; _saved=NULL; while(1) { @@ -603,24 +603,24 @@ _this=_saved; if(_this->prev) { - sw=_this->prev->dw; - sh=_this->prev->dh; - sfourcc=_this->prev->dfourcc; + sw=_this->prev->conf.w; + sh=_this->prev->conf.h; + sfourcc=_this->prev->conf.fourcc; MSG_V("Using(%s) %ix%i@%s\n",_this->prev->info->name,sw,sh,vo_format_name(sfourcc)); } else { - sw=sh_video->src_w; - sh=sh_video->src_h; - sfourcc=sh_video->codec->outfmt[sh_video->outfmtidx]; - MSG_V("Using(sh_video) %ix%i@%s\n",sw,sh,vo_format_name(sfourcc)); + sw=_first->conf.w; + sh=_first->conf.h; + sfourcc=_first->conf.fourcc; + MSG_V("Using(first:%s) %ix%i@%s\n",first->info->name,sw,sh,vo_format_name(sfourcc)); } if(w==sw && h==sh && fmt==sfourcc); /* nothing todo */ else { MSG_V("vf_reinit->config_vf %i %i %s=> %i %i %s\n",sw,sh,vo_format_name(sfourcc),w,h,vo_format_name(fmt)); _saved=_this->prev; - vf_scaler=vf_open_filter(_this,sh_video,(w==sw&&h==sh)?"fmtcvt":"scale",NULL,_this->libinput); + vf_scaler=vf_open_filter(_this,(w==sw&&h==sh)?"fmtcvt":"scale",NULL,_this->libinput,&_first->conf); if(vf_scaler) { vf_config_fun_t sfnc; @@ -640,14 +640,115 @@ MSG_V("Insert scaler before '%s' after '%s'\n",_this->info->name,_saved?_saved->info->name:"NULL"); vf_scaler->prev=_saved; if(_saved) _saved->next=vf_scaler; - else sh_video->vfilter=vf_scaler; - _this->dw=w; - _this->dh=h; - _this->dfourcc=fmt; + else first=vf_scaler; + _this->conf.w=w; + _this->conf.h=h; + _this->conf.fourcc=fmt; if(reset_cache) mpxp_reset_vcache(); vo_data->reset(); } } - _this=sh_video->vfilter; - vf_report_chain(); + _this=first; + vf_report_chain(_this); + return _this; } + +vf_instance_t* __FASTCALL__ vf_first(const vf_instance_t* it) { + vf_instance_t* curr = const_cast<vf_instance_t*>(it); + while(curr->prev) curr=curr->prev; + return curr; +} + +vf_instance_t* __FASTCALL__ vf_last(const vf_instance_t* it) { + vf_instance_t* curr = const_cast<vf_instance_t*>(it); + while(curr->next) curr=curr->next; + return curr; +} +/*----------------------------------------*/ +namespace mpxp { + +void vf_help(){ + int i=0; + MSG_INFO( "Available video filters:\n"); + while(filter_list[i]){ + MSG_INFO("\t%-10s: %s\n",filter_list[i]->name,filter_list[i]->info); + i++; + } + MSG_INFO("\n"); +} + +vf_stream_t* vf_init(any_t* libinput,const vf_conf_t* conf) { + vf_stream_t* s = new(zeromem) vf_stream_t; + s->libinput=libinput; + s->first=vf_init_filter(libinput,conf); + s->first->parent=s; + return s; +} + +void vf_uninit(vf_stream_t* s) { vf_uninit_filter_chain(s->first); delete s; } + +void __FASTCALL__ vf_reinit_vo(vf_stream_t* s,unsigned w,unsigned h,unsigned fmt,int reset_cache) { + vf_instance_t* first=s->first; + MSG_V("[stream: vf_reinit_vo]: %p\n",first); + if(first) s->first=vf_reinit_vo(first,w,h,fmt,reset_cache); +} + +void __FASTCALL__ vf_showlist(vf_stream_t* s) { vf_showlist(s->first); } + +int __FASTCALL__ vf_query_flags(vf_stream_t* s) { + vf_instance_t* first=s->first; + return vf_query_flags(first); +} + +int __FASTCALL__ vf_config(vf_stream_t* s, + int width, int height, int d_width, int d_height, + vo_flags_e flags, unsigned int outfmt) { + vf_instance_t* first=s->first; + return first->config_vf(first,width,height,d_width,d_height,flags,outfmt); +} +int __FASTCALL__ vf_query_format(vf_stream_t* s,unsigned int fmt,unsigned w,unsigned h) { + vf_instance_t* first=s->first; + return first->query_format(first,fmt,w,h); +} +void __FASTCALL__ vf_get_image(vf_stream_t* s,mp_image_t *mpi) { + vf_instance_t* first=s->first; + return first->get_image(first,mpi); +} +int __FASTCALL__ vf_put_slice(vf_stream_t* s,mp_image_t *mpi) { + vf_instance_t* first=s->first; + return first->put_slice(first,mpi); +} +void __FASTCALL__ vf_start_slice(vf_stream_t* s,mp_image_t *mpi) { + vf_instance_t* first=s->first; + return first->start_slice(first,mpi); +} + +MPXP_Rc __FASTCALL__ vf_control(vf_stream_t* s,int request, any_t* data) { + vf_instance_t* first=s->first; + return first->control_vf(first,request,data); +} + +mp_image_t* __FASTCALL__ vf_get_new_image(vf_stream_t* s, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h,unsigned idx) { + vf_instance_t* first=s->first; + return vf_get_new_image(first,outfmt,mp_imgtype,mp_imgflag,w,h,idx); +} + +void __FASTCALL__ vf_prepend_filter(vf_stream_t* s,const char *name,const vf_conf_t* conf,const char *args) { + vf_instance_t* first=s->first; + s->first=vf_open_filter(first,name,args,s->libinput,conf); + s->first->parent=s; +} + +void __FASTCALL__ vf_remove_first(vf_stream_t* s) { + vf_instance_t* first=s->first; + if(first->next) { + s->first=first->next; + vf_uninit_filter(first); + } +} + +const char * __FASTCALL__ vf_get_first_name(vf_stream_t* s) { + vf_instance_t* first=s->first; + return first->info->name; +} +} // namespace mpxp Deleted: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf.h 2012-12-02 11:56:31 UTC (rev 498) @@ -1,143 +0,0 @@ -#ifndef __VF_H -#define __VF_H 1 -#include "xmpcore/xmp_enums.h" -#include "libmpstream/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "libvo/video_out.h" // for vo_flags_e - -struct vf_instance_t; -struct vf_priv_t; - -enum { - VF_FLAGS_THREADS =0x00000001UL, /**< Thread safe plugin (requires to be applied within of threads) */ - VF_FLAGS_OSD =0x00000002UL, /**< requires to be applied during page flipping */ - VF_FLAGS_SLICES =0x00000004UL /**< really can draw slices (requires to be applied on SMP etc) */ -}; - -struct vf_info_t { - const char *info; - const char *name; - const char *author; - const char *comment; - const unsigned flags; - MPXP_Rc (* __FASTCALL__ open)(vf_instance_t* vf,const char* args); -}; - -struct vf_image_context_t { - unsigned char* static_planes[2]; - int static_idx; -}; - -enum { - VF_PIN=RND_NUMBER7+RND_CHAR7 -}; - -typedef int (* __FASTCALL__ vf_config_fun_t)(vf_instance_t* vf, - int width, int height, int d_width, int d_height, - vo_flags_e flags, unsigned int outfmt); -struct vf_instance_t { - const vf_info_t* info; - char antiviral_hole[RND_CHAR5]; - unsigned pin; // personal identification number - // funcs: - int (* __FASTCALL__ config_vf)(vf_instance_t* vf, - int width, int height, int d_width, int d_height, - vo_flags_e flags, unsigned int outfmt); - MPXP_Rc (* __FASTCALL__ control_vf)(vf_instance_t* vf, - int request, any_t* data); - int (* __FASTCALL__ query_format)(vf_instance_t* vf, - unsigned int fmt,unsigned w,unsigned h); - void (* __FASTCALL__ get_image)(vf_instance_t* vf, - mp_image_t *mpi); - int (* __FASTCALL__ put_slice)(vf_instance_t* vf, - mp_image_t *mpi); - void (* __FASTCALL__ start_slice)(vf_instance_t* vf, - mp_image_t *mpi); - void (* __FASTCALL__ uninit)(vf_instance_t* vf); - // optional: maybe NULL - void (* __FASTCALL__ print_conf)(vf_instance_t* vf); - // caps: - unsigned int default_caps; // used by default query_format() - unsigned int default_reqs; // used by default config() - // data: - vf_image_context_t imgctx; - vf_instance_t* next; - vf_instance_t* prev; - mp_image_t *dmpi; - vf_priv_t* priv; - sh_video_t *sh; - /* configuration for outgoing stream */ - unsigned dw,dh,dfourcc; - /* event handler*/ - any_t* libinput; -}__attribute__ ((packed)); - -// Configuration switches -struct vf_cfg_t{ - int force; // Initialization type - char* list; /* list of names of filters that are added to filter - list during first initialization of stream */ -}; - -// control codes: -#include "mpc_info.h" - -struct vf_equalizer_t -{ - const char *item; - int value; -}; - -enum { - VFCTRL_QUERY_MAX_PP_LEVEL =4, /* test for postprocessing support (max level) */ - VFCTRL_SET_PP_LEVEL =5, /* set postprocessing level */ - VFCTRL_SET_EQUALIZER =6, /* set color options (brightness,contrast etc) */ - VFCTRL_GET_EQUALIZER =8, /* gset color options (brightness,contrast etc) */ - VFCTRL_START_FRAME =7, - VFCTRL_CHANGE_RECTANGLE =9, /* Change the rectangle boundaries */ - VFCTRL_RESERVED =10, /* Tell the vo to flip pages */ - VFCTRL_DUPLICATE_FRAME =11, /* For encoding - encode zero-change frame */ - VFCTRL_SKIP_NEXT_FRAME =12, /* For encoding - drop the next frame that passes thru */ - VFCTRL_FLUSH_PAGES =13 /* For encoding - flush delayed frames */ -}; -#include "vfcap.h" - -// functions: - -vf_instance_t* __FASTCALL__ vf_init(sh_video_t *sh,any_t* libinput); -void __FASTCALL__ vf_reinit_vo(unsigned w,unsigned h,unsigned fmt,int reset_cache); - -void __FASTCALL__ vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h); -mp_image_t* __FASTCALL__ vf_get_new_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h,unsigned idx); -mp_image_t* __FASTCALL__ vf_get_new_genome(vf_instance_t* vf, const mp_image_t* mpi); -mp_image_t* __FASTCALL__ vf_get_new_exportable_genome(vf_instance_t* vf, int mp_imgtype, int mp_imgflag, const mp_image_t* mpi); -mp_image_t* __FASTCALL__ vf_get_new_temp_genome(vf_instance_t* vf, const mp_image_t* mpi); -int __FASTCALL__ vf_query_format(vf_instance_t* vf, unsigned int fmt,unsigned width,unsigned height); - -vf_instance_t* __FASTCALL__ vf_open_filter(vf_instance_t* next,sh_video_t *sh,const char *name,const char *args,any_t*libinput); -vf_instance_t* __FASTCALL__ vf_open_encoder(vf_instance_t* next,const char *name,const char *args); - -unsigned int __FASTCALL__ vf_match_csp(vf_instance_t** vfp,unsigned int* list,unsigned int preferred,unsigned w,unsigned h); -void __FASTCALL__ vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src); - -// default wrappers: -int __FASTCALL__ vf_next_config(vf_instance_t* vf, - int width, int height, int d_width, int d_height, - vo_flags_e flags, unsigned int outfmt); -MPXP_Rc __FASTCALL__ vf_next_control(vf_instance_t* vf, int request, any_t* data); -int __FASTCALL__ vf_next_query_format(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h); -int __FASTCALL__ vf_next_put_slice(vf_instance_t* vf,mp_image_t *mpi); - -vf_instance_t* __FASTCALL__ append_filters(vf_instance_t* last); - -/* returns ANDed flags of whole chain */ -unsigned __FASTCALL__ vf_query_flags(vf_instance_t*vfi); - -void vf_help(); - -void __FASTCALL__ vf_uninit_filter(vf_instance_t* vf); -void __FASTCALL__ vf_uninit_filter_chain(vf_instance_t* vf); -void __FASTCALL__ vf_showlist(vf_instance_t* vf); - -#endif Added: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h (rev 0) +++ mplayerxp/postproc/vf.h 2012-12-02 11:56:31 UTC (rev 498) @@ -0,0 +1,75 @@ +#ifndef __VF_H_INCLUDED +#define __VF_H_INCLUDED 1 +#include <stdint.h> +#include "xmpcore/xmp_enums.h" +#include "xmpcore/mp_image.h" +#include "libvo/video_out.h" // for vo_flags_e +#include "vfcap.h" + +struct vf_instance_t; +namespace mpxp { + enum { + VF_FLAGS_THREADS =0x00000001UL, /**< Thread safe plugin (requires to be applied within of threads) */ + VF_FLAGS_OSD =0x00000002UL, /**< requires to be applied during page flipping */ + VF_FLAGS_SLICES =0x00000004UL /**< really can draw slices (requires to be applied on SMP etc) */ + }; + + enum { + VFCTRL_QUERY_MAX_PP_LEVEL=4, /* test for postprocessing support (max level) */ + VFCTRL_SET_PP_LEVEL =5, /* set postprocessing level */ + VFCTRL_SET_EQUALIZER =6, /* set color options (brightness,contrast etc) */ + VFCTRL_GET_EQUALIZER =8, /* gset color options (brightness,contrast etc) */ + VFCTRL_START_FRAME =7, + VFCTRL_CHANGE_RECTANGLE =9, /* Change the rectangle boundaries */ + VFCTRL_RESERVED =10, /* Tell the vo to flip pages */ + VFCTRL_DUPLICATE_FRAME =11, /* For encoding - encode zero-change frame */ + VFCTRL_SKIP_NEXT_FRAME =12, /* For encoding - drop the next frame that passes thru */ + VFCTRL_FLUSH_PAGES =13 /* For encoding - flush delayed frames */ + }; + + struct vf_equalizer_t { + const char *item; + int value; + }; + + // Configuration switches + struct vf_cfg_t{ + int force; // Initialization type + char* list; /* list of names of filters that are added to filter + list during first initialization of stream */ + }; + + struct vf_conf_t { + unsigned w; + unsigned h; + uint32_t fourcc; + }; + + struct vf_stream_t { + vf_instance_t* first; + any_t* libinput; + }; + + vf_stream_t* __FASTCALL__ vf_init(any_t* libinput,const vf_conf_t* conf); + void __FASTCALL__ vf_uninit(vf_stream_t* s); + void __FASTCALL__ vf_reinit_vo(vf_stream_t* s,unsigned w,unsigned h,unsigned fmt,int reset_cache); + + void __FASTCALL__ vf_showlist(vf_stream_t* s); + void vf_help(); + + int __FASTCALL__ vf_query_flags(vf_stream_t* s); + int __FASTCALL__ vf_config(vf_stream_t* s, + int width, int height, int d_width, int d_height, + vo_flags_e flags, unsigned int outfmt); + int __FASTCALL__ vf_query_format(vf_stream_t* s,unsigned int fmt,unsigned w,unsigned h); + void __FASTCALL__ vf_get_image(vf_stream_t* s,mp_image_t *mpi); + int __FASTCALL__ vf_put_slice(vf_stream_t* s,mp_image_t *mpi); + void __FASTCALL__ vf_start_slice(vf_stream_t* s,mp_image_t *mpi); + MPXP_Rc __FASTCALL__ vf_control(vf_stream_t* s,int request, any_t* data); + mp_image_t* __FASTCALL__ vf_get_new_image(vf_stream_t* s, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h,unsigned idx); + void __FASTCALL__ vf_prepend_filter(vf_stream_t* s,const char *name,const vf_conf_t* conf,const char *args=NULL); + void __FASTCALL__ vf_remove_first(vf_stream_t* s); + const char * __FASTCALL__ vf_get_first_name(vf_stream_t* s); +} // namespace +#endif + Property changes on: mplayerxp/postproc/vf.h ___________________________________________________________________ Added: svn:eol-style + native Modified: mplayerxp/postproc/vf_1bpp.cpp =================================================================== --- mplayerxp/postproc/vf_1bpp.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_1bpp.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -9,6 +9,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "postproc/swscale.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_2xsai.cpp =================================================================== --- mplayerxp/postproc/vf_2xsai.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_2xsai.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -9,6 +9,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "pp_msg.h" //===========================================================================// Modified: mplayerxp/postproc/vf_aspect.cpp =================================================================== --- mplayerxp/postproc/vf_aspect.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_aspect.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -9,6 +9,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "pp_msg.h" struct vf_priv_t { Modified: mplayerxp/postproc/vf_delogo.cpp =================================================================== --- mplayerxp/postproc/vf_delogo.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_delogo.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -32,6 +32,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "pp_msg.h" @@ -241,7 +242,8 @@ vf->priv->yoff -= vf->priv->band; // check csp: - vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12,1,1); + vf_conf_t conf = { 1, 1, IMGFMT_YV12 }; + vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,&conf); if(!vf->priv->outfmt) { uninit(vf); return MPXP_False; // no csp match :( Modified: mplayerxp/postproc/vf_denoise3d.cpp =================================================================== --- mplayerxp/postproc/vf_denoise3d.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_denoise3d.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -28,6 +28,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_dint.cpp =================================================================== --- mplayerxp/postproc/vf_dint.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_dint.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -11,6 +11,7 @@ #include "xmpcore/mp_image.h" #include "libvo/img_format.h" #include "vf.h" +#include "vf_internal.h" #include "pp_msg.h" struct vf_priv_t { Modified: mplayerxp/postproc/vf_down3dright.cpp =================================================================== --- mplayerxp/postproc/vf_down3dright.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_down3dright.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -11,6 +11,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "postproc/swscale.h" Modified: mplayerxp/postproc/vf_eq.cpp =================================================================== --- mplayerxp/postproc/vf_eq.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_eq.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -24,6 +24,7 @@ #include "libvo/video_out.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #ifdef USE_SETLOCALE #include <locale.h> Modified: mplayerxp/postproc/vf_expand.cpp =================================================================== --- mplayerxp/postproc/vf_expand.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_expand.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -10,6 +10,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_flip.cpp =================================================================== --- mplayerxp/postproc/vf_flip.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_flip.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -27,6 +27,7 @@ #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "libvo/video_out.h" Modified: mplayerxp/postproc/vf_format.cpp =================================================================== --- mplayerxp/postproc/vf_format.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_format.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -9,6 +9,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "pp_msg.h" struct vf_priv_t { Modified: mplayerxp/postproc/vf_framestep.cpp =================================================================== --- mplayerxp/postproc/vf_framestep.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_framestep.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -60,6 +60,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "pp_msg.h" /* Uncomment if you want to print some info on the format */ Modified: mplayerxp/postproc/vf_il.cpp =================================================================== --- mplayerxp/postproc/vf_il.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_il.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -28,6 +28,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "pp_msg.h" Copied: mplayerxp/postproc/vf_internal.h (from rev 496, mplayerxp/postproc/vf.h) =================================================================== --- mplayerxp/postproc/vf_internal.h (rev 0) +++ mplayerxp/postproc/vf_internal.h 2012-12-02 11:56:31 UTC (rev 498) @@ -0,0 +1,107 @@ +#ifndef __VF_H +#define __VF_H 1 +#include "vf.h" + +struct vf_instance_t; +struct vf_priv_t; + +struct vf_info_t { + const char *info; + const char *name; + const char *author; + const char *comment; + const unsigned flags; + MPXP_Rc (* __FASTCALL__ open)(vf_instance_t* vf,const char* args); +}; + +struct vf_image_context_t { + unsigned char* static_planes[2]; + int static_idx; +}; + +enum { + VF_PIN=RND_NUMBER7+RND_CHAR7 +}; + +typedef int (* __FASTCALL__ vf_config_fun_t)(vf_instance_t* vf, + int width, int height, int d_width, int d_height, + vo_flags_e flags, unsigned int outfmt); +struct vf_instance_t { + const vf_info_t* info; + char antiviral_hole[RND_CHAR5]; + unsigned pin; // personal identification number + // funcs: + int (* __FASTCALL__ config_vf)(vf_instance_t* vf, + int width, int height, int d_width, int d_height, + vo_flags_e flags, unsigned int outfmt); + MPXP_Rc (* __FASTCALL__ control_vf)(vf_instance_t* vf, + int request, any_t* data); + int (* __FASTCALL__ query_format)(vf_instance_t* vf, + unsigned int fmt,unsigned w,unsigned h); + void (* __FASTCALL__ get_image)(vf_instance_t* vf, + mp_image_t *mpi); + int (* __FASTCALL__ put_slice)(vf_instance_t* vf, + mp_image_t *mpi); + void (* __FASTCALL__ start_slice)(vf_instance_t* vf, + mp_image_t *mpi); + void (* __FASTCALL__ uninit)(vf_instance_t* vf); + // optional: maybe NULL + void (* __FASTCALL__ print_conf)(vf_instance_t* vf); + // caps: + unsigned int default_caps; // used by default query_format() + unsigned int default_reqs; // used by default config() + // data: + vf_image_context_t imgctx; + vf_stream_t* parent; + vf_instance_t* next; + vf_instance_t* prev; + mp_image_t *dmpi; + vf_priv_t* priv; + /* configuration for outgoing stream */ + vf_conf_t conf; + /* event handler*/ + any_t* libinput; +}__attribute__ ((packed)); + +// control codes: +#include "mpc_info.h" + +// functions: + +vf_instance_t* __FASTCALL__ vf_init_filter(any_t* libinput,const vf_conf_t* conf); +vf_instance_t* __FASTCALL__ vf_reinit_vo(vf_instance_t* first,unsigned w,unsigned h,unsigned fmt,int reset_cache); + +void __FASTCALL__ vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h); +mp_image_t* __FASTCALL__ vf_get_new_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h,unsigned idx); +mp_image_t* __FASTCALL__ vf_get_new_genome(vf_instance_t* vf, const mp_image_t* mpi); +mp_image_t* __FASTCALL__ vf_get_new_exportable_genome(vf_instance_t* vf, int mp_imgtype, int mp_imgflag, const mp_image_t* mpi); +mp_image_t* __FASTCALL__ vf_get_new_temp_genome(vf_instance_t* vf, const mp_image_t* mpi); +int __FASTCALL__ vf_query_format(vf_instance_t* vf, unsigned int fmt,unsigned width,unsigned height); + +vf_instance_t* __FASTCALL__ vf_open_filter(vf_instance_t* next,const char *name,const char *args,any_t*libinput,const vf_conf_t* conf); +vf_instance_t* __FASTCALL__ vf_open_encoder(vf_instance_t* next,const char *name,const char *args); + +unsigned int __FASTCALL__ vf_match_csp(vf_instance_t** vfp,unsigned int* list,const vf_conf_t* conf); +void __FASTCALL__ vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src); + +// default wrappers: +int __FASTCALL__ vf_next_config(vf_instance_t* vf, + int width, int height, int d_width, int d_height, + vo_flags_e flags, unsigned int outfmt); +MPXP_Rc __FASTCALL__ vf_next_control(vf_instance_t* vf, int request, any_t* data); +int __FASTCALL__ vf_next_query_format(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h); +int __FASTCALL__ vf_next_put_slice(vf_instance_t* vf,mp_image_t *mpi); + +vf_instance_t* __FASTCALL__ append_filters(vf_instance_t* last); + +/* returns ANDed flags of whole chain */ +unsigned __FASTCALL__ vf_query_flags(vf_instance_t*vfi); + +void __FASTCALL__ vf_uninit_filter(vf_instance_t* vf); +void __FASTCALL__ vf_uninit_filter_chain(vf_instance_t* vf); +void __FASTCALL__ vf_showlist(vf_instance_t* vf); + +vf_instance_t* __FASTCALL__ vf_first(const vf_instance_t*); +vf_instance_t* __FASTCALL__ vf_last(const vf_instance_t*); + +#endif Modified: mplayerxp/postproc/vf_menu.cpp =================================================================== --- mplayerxp/postproc/vf_menu.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_menu.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -13,6 +13,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "libvo/video_out.h" Modified: mplayerxp/postproc/vf_mirror.cpp =================================================================== --- mplayerxp/postproc/vf_mirror.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_mirror.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -9,6 +9,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "postproc/swscale.h" Modified: mplayerxp/postproc/vf_noise.cpp =================================================================== --- mplayerxp/postproc/vf_noise.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_noise.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -30,6 +30,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "pp_msg.h" @@ -463,7 +464,8 @@ } // check csp: - vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12,1,1); + vf_conf_t conf = { 1, 1, IMGFMT_YV12 }; + vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,&conf); if(!vf->priv->outfmt) { uninit(vf); return MPXP_False; // no csp match :( Modified: mplayerxp/postproc/vf_null.cpp =================================================================== --- mplayerxp/postproc/vf_null.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_null.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -2,6 +2,7 @@ #include "osdep/mplib.h" using namespace mpxp; #include "vf.h" +#include "vf_internal.h" static MPXP_Rc __FASTCALL__ vf_open(vf_instance_t *vf,const char* args){ return MPXP_False; Modified: mplayerxp/postproc/vf_ow.cpp =================================================================== --- mplayerxp/postproc/vf_ow.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_ow.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -36,6 +36,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "pp_msg.h" //===========================================================================// Modified: mplayerxp/postproc/vf_palette.cpp =================================================================== --- mplayerxp/postproc/vf_palette.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_palette.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -9,6 +9,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "postproc/swscale.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_panscan.cpp =================================================================== --- mplayerxp/postproc/vf_panscan.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_panscan.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -12,6 +12,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_perspective.cpp =================================================================== --- mplayerxp/postproc/vf_perspective.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_perspective.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -29,6 +29,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_pp.cpp =================================================================== --- mplayerxp/postproc/vf_pp.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_pp.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -12,6 +12,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "postprocess.h" #include "pp_msg.h" @@ -152,7 +153,8 @@ vf->priv->context=NULL; // check csp: - vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12,1,1); + vf_conf_t conf = { 1, 1, IMGFMT_YV12 }; + vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,&conf); if(!vf->priv->outfmt) return MPXP_False; // no csp match :( if(args){ Modified: mplayerxp/postproc/vf_raw.cpp =================================================================== --- mplayerxp/postproc/vf_raw.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_raw.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -13,6 +13,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "postproc/swscale.h" Modified: mplayerxp/postproc/vf_rectangle.cpp =================================================================== --- mplayerxp/postproc/vf_rectangle.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_rectangle.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -6,6 +6,7 @@ #include <string.h> #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_rgb2bgr.cpp =================================================================== --- mplayerxp/postproc/vf_rgb2bgr.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_rgb2bgr.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -9,6 +9,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "mp_conf_lavc.h" Modified: mplayerxp/postproc/vf_rotate.cpp =================================================================== --- mplayerxp/postproc/vf_rotate.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_rotate.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -9,6 +9,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "postproc/swscale.h" Modified: mplayerxp/postproc/vf_scale.cpp =================================================================== --- mplayerxp/postproc/vf_scale.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_scale.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -11,6 +11,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "libvo/video_out.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_smartblur.cpp =================================================================== --- mplayerxp/postproc/vf_smartblur.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_smartblur.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -32,6 +32,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "postproc/swscale.h" #include "vf_scale.h" Modified: mplayerxp/postproc/vf_softpulldown.cpp =================================================================== --- mplayerxp/postproc/vf_softpulldown.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_softpulldown.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -8,6 +8,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "libvo/sub.h" Modified: mplayerxp/postproc/vf_swapuv.cpp =================================================================== --- mplayerxp/postproc/vf_swapuv.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_swapuv.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -28,6 +28,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "pp_msg.h" //===========================================================================// Modified: mplayerxp/postproc/vf_test.cpp =================================================================== --- mplayerxp/postproc/vf_test.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_test.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -28,6 +28,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "swscale.h" #include "osdep/fastmemcpy.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_unsharp.cpp =================================================================== --- mplayerxp/postproc/vf_unsharp.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_unsharp.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -36,6 +36,7 @@ #include "libvo/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "osdep/fastmemcpy.h" #include "pp_msg.h" @@ -348,7 +349,8 @@ } // check csp: - vf->priv->outfmt = vf_match_csp( &vf->next, fmt_list, IMGFMT_YV12,1,1 ); + vf_conf_t conf = { 1, 1, IMGFMT_YV12 }; + vf->priv->outfmt = vf_match_csp( &vf->next, fmt_list,&conf); if( !vf->priv->outfmt ) { uninit( vf ); return MPXP_False; // no csp match :( Modified: mplayerxp/postproc/vf_vo.cpp =================================================================== --- mplayerxp/postproc/vf_vo.cpp 2012-12-02 07:38:22 UTC (rev 497) +++ mplayerxp/postproc/vf_vo.cpp 2012-12-02 11:56:31 UTC (rev 498) @@ -7,6 +7,7 @@ #include "xmpcore/mp_image.h" #include "vf.h" +#include "vf_internal.h" #include "vfcap.h" #include "libvo/video_out.h" #include "libvo/dri_vo.h" @@ -50,9 +51,9 @@ return 0; } - vf->dw=width; - vf->dh=height; - vf->dfourcc=outfmt; + vf->conf.w=widt... [truncated message content] |