Thread: [Mplayerxp-cvslog] SF.net SVN: mplayerxp:[297] mplayerxp (Page 13)
Brought to you by:
olov
From: <nic...@us...> - 2012-11-04 09:56:43
|
Revision: 297 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=297&view=rev Author: nickols_k Date: 2012-11-04 09:56:36 +0000 (Sun, 04 Nov 2012) Log Message: ----------- minor fixups Modified Paths: -------------- mplayerxp/libvo/vo_x11.c mplayerxp/mplayer.c mplayerxp/osdep/mp_malloc.c mplayerxp/postproc/af.c mplayerxp/postproc/af.h mplayerxp/postproc/af_resample.c mplayerxp/postproc/af_resample.h Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-11-04 08:50:52 UTC (rev 296) +++ mplayerxp/libvo/vo_x11.c 2012-11-04 09:56:36 UTC (rev 297) @@ -303,6 +303,8 @@ else return 0x1|0x4; } +// just for tests: +//if(format->fourcc==IMGFMT_YUY2) return 0x1|0x2|0x4; return 0; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-04 08:50:52 UTC (rev 296) +++ mplayerxp/mplayer.c 2012-11-04 09:56:36 UTC (rev 297) @@ -499,7 +499,7 @@ gCpuCaps.has3DNowExt= gCpuCaps.hasSSE= gCpuCaps.hasSSE2= - gCpuCaps.hasSSE2= + gCpuCaps.hasSSE3= gCpuCaps.hasSSSE3= gCpuCaps.hasSSE41= gCpuCaps.hasSSE42= Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-11-04 08:50:52 UTC (rev 296) +++ mplayerxp/osdep/mp_malloc.c 2012-11-04 09:56:36 UTC (rev 297) @@ -41,7 +41,7 @@ static priv_t* priv; static any_t* prot_page_align(any_t *ptr) { return (any_t*)(((unsigned long)ptr)&(~(__VM_PAGE_SIZE__-1))); } -static size_t prot_fullsize(size_t size) { +static size_t app_fullsize(size_t size) { unsigned npages = size/__VM_PAGE_SIZE__; unsigned fullsize; if(size%__VM_PAGE_SIZE__) npages++; @@ -95,9 +95,11 @@ } else printf("[prot_free_slot] Internal error! Can't find slot for address: %p\n",ptr); } -static any_t* __prot_malloc(size_t size) { +/* ----------- append ------------ */ + +static any_t* __prot_malloc_append(size_t size) { any_t* rp; - size_t fullsize=prot_fullsize(size); + size_t fullsize=app_fullsize(size); rp=memalign(__VM_PAGE_SIZE__,fullsize); if(rp) { prot_append_slot(&priv->mallocs,rp,size); @@ -108,58 +110,109 @@ return rp; } -static any_t* __prot_memalign(size_t boundary,size_t size) { UNUSED(boundary); return __prot_malloc(size); } +static any_t* __prot_memalign_append(size_t boundary,size_t size) { UNUSED(boundary); return __prot_malloc_append(size); } -static void __prot_free(any_t*ptr) { +static void __prot_free_append(any_t*ptr) { any_t *page_ptr=prot_page_align(ptr); - free(page_ptr); mp_slot_t* slot=prot_find_slot(&priv->mallocs,page_ptr); if(!slot) { - printf("[__prot_free] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,page_ptr); + printf("[__prot_free_append] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,page_ptr); __prot_print_slots(&priv->mallocs); kill(getpid(), SIGILL); } - size_t fullsize=prot_fullsize(slot->size); + size_t fullsize=app_fullsize(slot->size); mprotect(prot_last_page(page_ptr,fullsize),__VM_PAGE_SIZE__,MP_PROT_READ|MP_PROT_WRITE); + free(page_ptr); prot_free_slot(&priv->mallocs,page_ptr); } #define min(a,b) ((a)<(b)?(a):(b)) -static any_t* __prot_realloc(any_t*ptr,size_t size) { +static any_t* __prot_realloc_append(any_t*ptr,size_t size) { any_t* rp; - if((rp=__prot_malloc(size))!=NULL && ptr) { + if((rp=__prot_malloc_append(size))!=NULL && ptr) { mp_slot_t* slot=prot_find_slot(&priv->mallocs,prot_page_align(ptr)); if(!slot) { - printf("[__prot_realloc] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,prot_page_align(ptr)); + printf("[__prot_realloc_append] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,prot_page_align(ptr)); __prot_print_slots(&priv->mallocs); kill(getpid(), SIGILL); } memcpy(rp,ptr,min(slot->size,size)); - __prot_free(ptr); + __prot_free_append(ptr); } return rp; } +/* ----------- prepend ------------ */ +static any_t* pre_page_align(any_t *ptr) { return (any_t*)((unsigned long)ptr-__VM_PAGE_SIZE__); } +static size_t pre_fullsize(size_t size) { return size+__VM_PAGE_SIZE__; } + +static any_t* __prot_malloc_prepend(size_t size) { + any_t* rp; + size_t fullsize=pre_fullsize(size); + rp=memalign(__VM_PAGE_SIZE__,fullsize); + if(rp) { + prot_append_slot(&priv->mallocs,rp,size); + // protect last page here + mprotect(rp,__VM_PAGE_SIZE__,MP_DENY_ALL); + rp+=__VM_PAGE_SIZE__; + } + return rp; +} + +static any_t* __prot_memalign_prepend(size_t boundary,size_t size) { UNUSED(boundary); return __prot_malloc_prepend(size); } + +static void __prot_free_prepend(any_t*ptr) { + any_t *page_ptr=pre_page_align(ptr); + mp_slot_t* slot=prot_find_slot(&priv->mallocs,page_ptr); + if(!slot) { + printf("[__prot_free_prepend] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,page_ptr); + __prot_print_slots(&priv->mallocs); + kill(getpid(), SIGILL); + } + mprotect(page_ptr,__VM_PAGE_SIZE__,MP_PROT_READ|MP_PROT_WRITE); + free(page_ptr); + prot_free_slot(&priv->mallocs,page_ptr); +} + +static any_t* __prot_realloc_prepend(any_t*ptr,size_t size) { + any_t* rp; + if((rp=__prot_malloc_prepend(size))!=NULL && ptr) { + mp_slot_t* slot=prot_find_slot(&priv->mallocs,pre_page_align(ptr)); + if(!slot) { + printf("[__prot_realloc_prepend] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,pre_page_align(ptr)); + __prot_print_slots(&priv->mallocs); + kill(getpid(), SIGILL); + } + memcpy(rp,ptr,min(slot->size,size)); + __prot_free_prepend(ptr); + } + return rp; +} + static any_t* prot_malloc(size_t size) { any_t* rp; - rp=__prot_malloc(size); + if(priv->flags&MPA_FLG_BOUNDS_CHECK) rp=__prot_malloc_append(size); + else rp=__prot_malloc_prepend(size); return rp; } static any_t* prot_memalign(size_t boundary,size_t size) { any_t* rp; - rp=__prot_memalign(boundary,size); + if(priv->flags&MPA_FLG_BOUNDS_CHECK) rp=__prot_memalign_append(boundary,size); + else rp=__prot_memalign_prepend(boundary,size); return rp; } static any_t* prot_realloc(any_t*ptr,size_t size) { any_t* rp; - rp=__prot_realloc(ptr,size); + if(priv->flags&MPA_FLG_BOUNDS_CHECK) rp=__prot_realloc_append(ptr,size); + else rp=__prot_realloc_prepend(ptr,size); return rp; } static void prot_free(any_t*ptr) { - __prot_free(ptr); + if(priv->flags&MPA_FLG_BOUNDS_CHECK) __prot_free_append(ptr); + else __prot_free_prepend(ptr); } static __always_inline any_t* bt_malloc(size_t size) { Modified: mplayerxp/postproc/af.c =================================================================== --- mplayerxp/postproc/af.c 2012-11-04 08:50:52 UTC (rev 296) +++ mplayerxp/postproc/af.c 2012-11-04 09:56:36 UTC (rev 297) @@ -383,14 +383,14 @@ // Figure out how fast the machine is if(AF_INIT_AUTO == (AF_INIT_TYPE_MASK & s->cfg.force)) - s->cfg.force = (s->cfg.force & ~AF_INIT_TYPE_MASK) | AF_INIT_TYPE; + s->cfg.force = (s->cfg.force & ~AF_INIT_TYPE_MASK) | AF_INIT_TYPE(); // Check if this is the first call if(!s->first){ // Add all filters in the list (if there are any) if(!s->cfg.list){ // To make automatic format conversion work - if(!af_append(s,s->first,"ao2")) - return -1; + if(!af_append(s,s->first,"ao2")) + return -1; } else{ af_name=s->cfg.list; @@ -405,7 +405,7 @@ } if(strcmp(s->last->info->name,"ao2")!=0) if(!af_append(s,s->last,"ao2")) return -1; - // Init filters + // Init filters if(CONTROL_OK != af_reinit(s,s->first)) return -1; @@ -426,7 +426,7 @@ af = af_append(s,s->first,"resample"); else af = af_prepend(s,s->first,"resample"); - } + } else{ if(!strcmp(s->last->info->name,"format")) af = af_prepend(s,s->last,"resample"); @@ -445,9 +445,9 @@ af->control(af, AF_CONTROL_COMMAND_LINE, args); } if(CONTROL_OK != af_reinit(s,af)) - return -1; - } - + return -1; + } + // Check number of output channels fix if not OK // If needed always inserted last -> easy to screw up other filters if(s->last->data->nch!=s->output.nch){ @@ -461,7 +461,7 @@ if(CONTROL_OK != af_reinit(s,af)) return -1; } - + // Check output format fix if not OK if((s->last->data->format != s->output.format) || (s->last->data->bps != s->output.bps)){ @@ -611,7 +611,7 @@ if( (t * (((in/t)*mul.n))/mul.d) >= len) return in; in+=t; } - + // Could no meet constraint nr 3. while(out > max_outsize || in > max_insize){ in-=t; @@ -640,11 +640,11 @@ { // Calculate new length register int len = af_lencalc(af->mul,data); - MSG_V("[libaf] Reallocating memory in module %s, " + MSG_V("[libaf] Reallocating memory in module %s, " "old len = %i, new len = %i\n",af->info->name,af->data->len,len); // If there is a buffer mp_free it - if(af->data->audio) - mp_free(af->data->audio); +printf("len=%i\n",len); + if(af->data->audio) mp_free(af->data->audio); // Create new buffer and check that it is OK af->data->audio = mp_malloc(len); if(!af->data->audio){ @@ -728,10 +728,10 @@ void af_showconf(af_instance_t *first) { - af_instance_t* af=first; + af_instance_t* af=first; // ok! MSG_INFO("[libaf] Using audio filters chain:\n"); - // Iterate through all filters + // Iterate through all filters do{ MSG_INFO(" "); if(af->control(af,AF_CONTROL_SHOWCONF,NULL)!=CONTROL_OK) Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-11-04 08:50:52 UTC (rev 296) +++ mplayerxp/postproc/af.h 2012-11-04 09:56:36 UTC (rev 297) @@ -79,9 +79,9 @@ // Default init type #ifndef AF_INIT_TYPE #if defined(HAVE_SSE) || defined(HAVE_3DNOW) -#define AF_INIT_TYPE (af_cpu_speed?*af_cpu_speed:AF_INIT_FAST) +static inline int AF_INIT_TYPE(void) { return (af_cpu_speed?*af_cpu_speed:AF_INIT_FAST); } #else -#define AF_INIT_TYPE (af_cpu_speed?*af_cpu_speed:AF_INIT_SLOW) +static inline int AF_INIT_TYPE(void) { return (af_cpu_speed?*af_cpu_speed:AF_INIT_SLOW); } #endif #endif @@ -171,8 +171,8 @@ block length 2. OUT <= max_outsize, where max_outsize is the maximum possible output block length - 3. If possible OUT >= len. - Return -1 in case of error */ + 3. If possible OUT >= len. + Return -1 in case of error */ int __FASTCALL__ af_calc_insize_constrained(af_stream_t* s, int len, int max_outsize,int max_insize); @@ -219,8 +219,9 @@ /* Memory reallocation macro: if a local buffer is used (i.e. if the filter doesn't operate on the incoming buffer this macro must be called to ensure the buffer is big enough. */ -#define RESIZE_LOCAL_BUFFER(a,d)\ -((a->data->len < af_lencalc(a->mul,d))?af_resize_local_buffer(a,d):CONTROL_OK) +static inline int RESIZE_LOCAL_BUFFER(af_instance_t* a, af_data_t* d) { + return (a->data->len < af_lencalc(a->mul,d))?af_resize_local_buffer(a,d):CONTROL_OK; +} /* Some other useful macro definitions*/ #ifndef min Modified: mplayerxp/postproc/af_resample.c =================================================================== --- mplayerxp/postproc/af_resample.c 2012-11-04 08:50:52 UTC (rev 296) +++ mplayerxp/postproc/af_resample.c 2012-11-04 09:56:36 UTC (rev 297) @@ -52,12 +52,12 @@ // local data typedef struct af_resample_s { - any_t* w; // Current filter weights - any_t** xq; // Circular buffers - uint32_t xi; // Index for circular buffers + any_t* w; // Current filter weights + any_t** xq; // Circular buffers + uint32_t xi; // Index for circular buffers uint32_t wi; // Index for w - uint32_t i; // Number of new samples to put in x queue - uint32_t dn; // Down sampling factor + uint32_t i; // Number of new samples to put in x queue + uint32_t dn; // Down sampling factor uint32_t up; // Up sampling factor uint64_t step; // Step size for linear interpolation uint64_t pt; // Pointer remainder for linear interpolation @@ -100,9 +100,9 @@ // Fast linear interpolation resample with modest audio quality static int __FASTCALL__ linint(af_data_t* c,af_data_t* l, af_resample_t* s) { - uint32_t len = 0; // Number of input samples - uint32_t nch = l->nch; // Words pre transfer - uint64_t step = s->step; + uint32_t len = 0; // Number of input samples + uint32_t nch = l->nch; // Words pre transfer + uint64_t step = s->step; int16_t* in16 = ((int16_t*)c->audio); int16_t* out16 = ((int16_t*)l->audio); int32_t* in32 = ((int32_t*)c->audio); @@ -110,35 +110,35 @@ uint64_t end = ((((uint64_t)c->len)/2LL)<<STEPACCURACY); uint64_t pt = s->pt; uint16_t tmp; - + switch (nch){ case 1: while(pt < end){ - out16[len++]=in16[pt>>STEPACCURACY]; + out16[len++]=in16[pt>>STEPACCURACY]; pt+=step; } s->pt=pt & ((1LL<<STEPACCURACY)-1); - break; + break; case 2: end/=2; while(pt < end){ - out32[len++]=in32[pt>>STEPACCURACY]; + out32[len++]=in32[pt>>STEPACCURACY]; pt+=step; } len=(len<<1); s->pt=pt & ((1LL<<STEPACCURACY)-1); break; - default: + default: end /=nch; while(pt < end){ tmp=nch; - do { - tmp--; - out16[len+tmp]=in16[tmp+(pt>>STEPACCURACY)*nch]; + do { + tmp--; + out16[len+tmp]=in16[tmp+(pt>>STEPACCURACY)*nch]; } while (tmp); len+=nch; pt+=step; - } + } s->pt=pt & ((1LL<<STEPACCURACY)-1); } return len; @@ -345,7 +345,7 @@ return CONTROL_UNKNOWN; } -// Deallocate memory +// Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { if(af->data) @@ -378,7 +378,7 @@ if(s->up>s->dn){ # define UP # include "af_resample.h" -# undef UP +# undef UP } else{ # define DN @@ -392,7 +392,7 @@ if(s->up>s->dn){ # define UP # include "af_resample.h" -# undef UP +# undef UP } else{ # define DN Modified: mplayerxp/postproc/af_resample.h =================================================================== --- mplayerxp/postproc/af_resample.h 2012-11-04 08:50:52 UTC (rev 296) +++ mplayerxp/postproc/af_resample.h 2012-11-04 09:56:36 UTC (rev 297) @@ -1,5 +1,5 @@ /*============================================================================= -// +// // This software has been released under the terms of the GNU General Public // license. See http://www.gnu.org/copyleft/gpl.html for details. // @@ -11,8 +11,8 @@ /* This file contains the resampling engine, the sample format is controlled by the FORMAT parameter, the filter length by the L parameter and the resampling type by UP and DN. This file should - only be included by af_resample.c -*/ + only be included by af_resample.c +*/ #undef L #undef SHIFT @@ -48,10 +48,10 @@ #endif // Short filter -#if defined(L8) +#if defined(L8) -#define L 8 // Filter length -// Unrolled loop to speed up execution +#define L 8 // Filter length +// Unrolled loop to speed up execution #if !(defined( ARCH_X86 ) || defined(ARCH_X86_64)) #define FIR(x,w,y) \ (y[0]) = ( w[0]*x[0]+w[1]*x[1]+w[2]*x[2]+w[3]*x[3] \ @@ -61,7 +61,7 @@ #else /* L8/L16 */ -#define L 16 +#define L 16 // Unrolled loop to speed up execution #if !(defined( ARCH_X86 ) || defined(ARCH_X86_64)) #define FIR(x,w,y) \ @@ -79,8 +79,8 @@ #if defined(UP) - uint32_t inc = s->up/s->dn; - uint32_t level = s->up%s->dn; + uint32_t inc = s->up/s->dn; + uint32_t level = s->up%s->dn; register FORMAT* w = s->w; // Index current channel @@ -111,8 +111,8 @@ #endif /* UP */ #if defined(DN) /* DN */ - uint32_t inc = s->dn/s->up; - uint32_t level = s->dn%s->up; + uint32_t inc = s->dn/s->up; + uint32_t level = s->dn%s->up; FORMAT* w = s->w; // Index current channel @@ -132,10 +132,8 @@ // Run the FIR filter FIR((&x[xi]),(&w[wi*L]),out); len++; out+=nch; - // Update wi to point at the correct polyphase component wi=(wi+dn)%up; - // Insert i number of new samples in queue i = inc; if(wi<level) i++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-09 07:18:55
|
Revision: 306 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=306&view=rev Author: nickols_k Date: 2012-11-09 07:18:45 +0000 (Fri, 09 Nov 2012) Log Message: ----------- rename main files Modified Paths: -------------- mplayerxp/Makefile mplayerxp/dump.c mplayerxp/fifo.c mplayerxp/libao2/ao_alsa9.c mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_dmo.c mplayerxp/libmpcodecs/ad_faad.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/ad_qtaudio.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpconf/cfgparser.c mplayerxp/libmpdemux/asf_mmst_streaming.c mplayerxp/libmpdemux/asf_streaming.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/cddb.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/librtsp/rtsp.c mplayerxp/libmpdemux/librtsp/rtsp_rtp.c mplayerxp/libmpdemux/librtsp/rtsp_session.c mplayerxp/libmpdemux/network.c mplayerxp/libmpdemux/realrtsp/asmrp.c mplayerxp/libmpdemux/realrtsp/real.c mplayerxp/libmpdemux/realrtsp/rmff.c mplayerxp/libmpdemux/realrtsp/sdpplin.c mplayerxp/libmpdemux/realrtsp/xbuffer.c mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/s_dvdread.c mplayerxp/libmpdemux/s_ffmpeg.c mplayerxp/libmpdemux/s_file.c mplayerxp/libmpdemux/s_oss.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/stream.c mplayerxp/libmpdemux/sub_cc.c mplayerxp/libmpdemux/sub_ty.c mplayerxp/libmpdemux/url.c mplayerxp/libmpdemux/video.c mplayerxp/libmpsub/vobsub.c mplayerxp/libplaytree/asxparser.c mplayerxp/libvo/osd.c mplayerxp/libvo/screenshot.c mplayerxp/libvo/sub.c mplayerxp/libvo/video_out.c mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/vosub_vidix.c mplayerxp/libvo/x11_common.c mplayerxp/mp_msg.h mplayerxp/osdep/aclib.c mplayerxp/osdep/cpudetect.h mplayerxp/osdep/vbelib.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf_menu.c mplayerxp/xmpcore/mp_image.c mplayerxp/xmpcore/sig_hand.c mplayerxp/xmpcore/xmp_adecoder.c mplayerxp/xmpcore/xmp_aplayer.c mplayerxp/xmpcore/xmp_core.c mplayerxp/xmpcore/xmp_vdecoder.c mplayerxp/xmpcore/xmp_vplayer.c Added Paths: ----------- mplayerxp/cfg-mplayerxp.h mplayerxp/mplayerxp.c mplayerxp/mplayerxp.h Removed Paths: ------------- mplayerxp/cfg-mplayer.h mplayerxp/mplayer.c mplayerxp/mplayer.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/Makefile 2012-11-09 07:18:45 UTC (rev 306) @@ -24,7 +24,7 @@ LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs SRCS_COMMON = mp_msg.c -SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c dump.c +SRCS_MPLAYER = mplayerxp.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c dump.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) Deleted: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/cfg-mplayer.h 2012-11-09 07:18:45 UTC (rev 306) @@ -1,294 +0,0 @@ -/* - * config for cfgparser - */ - -extern const char *oss_mixer_device; -#ifdef HAVE_SDL -//extern char *sdl_driver; -extern int sdl_noxv; -extern int sdl_forcexv; -extern int sdl_forcegl; -//extern char *sdl_adriver; -#endif - -extern int network_prefer_ipv4; -extern char *network_username; -extern char *network_password; -extern int network_bandwidth; -extern char *network_useragent; -extern int network_ipv4_only_proxy; -extern int network_cookies_enabled; -extern char *cookies_file; - -extern af_cfg_t af_cfg; // Configuration for audio filters -extern vf_cfg_t vf_cfg; // Configuration for audio filters - -/* - * CONF_TYPE_FUNC_FULL : - * allows own implemtations for passing the params - * - * the function receives parameter name and argument (if it does not start with - ) - * useful with a conf.name like 'aa*' to parse several parameters to a function - * return 0 =ok, but we didn't need the param (could be the filename) - * return 1 =ok, we accepted the param - * negative values: see cfgparser.h, ERR_XXX - * - * by Folke - */ - -static const config_t xpcore_config[]={ - {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, UINT_MAX, "specifies number cpus to use for playback"}, - {"dump", &mp_conf.stream_dump, CONF_TYPE_STRING, 0, 0, 0, "specifies dump type and name for the dump of stream"}, - {"gomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 0, 1, "enables usage of OpenMP extensions"}, - {"nogomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 1, 0, "disables usage of OpenMP extensions"}, - {"xp_buffs", &vo_conf.xp_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, "specifies number of buffers for decoding-ahead in XP mode"}, - {"cache", &mp_conf.s_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, "specifies amount of memory for precaching a file/URL"}, - {"nocache", &mp_conf.s_cache_size, CONF_TYPE_FLAG, 0, 1, 0, "disables precaching a file/URL"}, - {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, "dynamically changes the level of postprocessing depending on spare CPU time available"}, - {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, "sets playback speed factor"}, - {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, "performs benchmarking to estimate performance of MPlayerXP"}, - {"test-av", &mp_conf.test_av, CONF_TYPE_FLAG, 0, 0, 1, "test antiviral protection of MPlayerXP"}, - {"malloc-debug", &mp_conf.malloc_debug, CONF_TYPE_FLAG, 0, 1, 0, "debugs malloc() calls in MPlayerXP"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -#ifdef HAVE_STREAMING -static const config_t net_config[]={ - {"ipv4", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, "forces mplayerxp to use IPv4 protocol over network"}, -#ifdef HAVE_AF_INET6 - {"ipv6", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, "forces mplayerxp to use IPv6 protocol over network"}, -#else - {"ipv6", "MPlayerXP was compiled without IPv6 support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, -#endif /* HAVE_AF_INET6 */ - {"ipv4-only-proxy", &network_ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, "skip the proxy for IPv6 addresses"}, - {"user", &network_username, CONF_TYPE_STRING, 0, 0, 0, "specifies username for HTTP authentication"}, - {"passwd", &network_password, CONF_TYPE_STRING, 0, 0, 0, "specifies password for HTTP authentication"}, - {"bandwidth", &network_bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, "specifies the maximum bandwidth for network streaming"}, - {"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, "specifies string as user agent for HTTP streaming"}, - {"cookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, "send cookies when making HTTP requests"}, - {"cookies-file", &cookies_file, CONF_TYPE_STRING, 0, 0, 0, "Read HTTP cookies from file"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; -#endif - -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -static const config_t cpu_config[]={ - {"simd", &x86.simd, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SIMD extensions of CPU"}, - {"nosimd", &x86.simd, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SIMD extensions of CPU"}, - {"mmx", &x86.mmx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX extensions of CPU"}, - {"nommx", &x86.mmx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX extensions of CPU"}, - {"mmx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX2 extensions of CPU"}, - {"nommx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX2 extensions of CPU"}, - {"3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow! extensions of CPU"}, - {"no3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow! extensions of CPU"}, - {"3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow-2! extensions of CPU"}, - {"no3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow-2! extensions of CPU"}, - {"sse", &x86.sse, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE extensions of CPU"}, - {"nosse", &x86.sse, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE extensions of CPU"}, - {"sse2", &x86.sse2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE2 extensions of CPU"}, - {"nosse2", &x86.sse2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE2 extensions of CPU"}, - {"sse3", &x86.sse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE3 extensions of CPU"}, - {"nosse3", &x86.sse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE3 extensions of CPU"}, - {"ssse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSSE3 extensions of CPU"}, - {"nossse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSSE3 extensions of CPU"}, - {"sse41", &x86.sse41, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE41 extensions of CPU"}, - {"nosse41", &x86.sse41, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE41 extensions of CPU"}, - {"sse42", &x86.sse42, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE42 extensions of CPU"}, - {"nosse42", &x86.sse42, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE42 extensions of CPU"}, - {"aes", &x86.aes, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AES extensions of CPU"}, - {"noaes", &x86.aes, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AES extensions of CPU"}, - {"avx", &x86.avx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AVX extensions of CPU"}, - {"noavx", &x86.avx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AVX extensions of CPU"}, - {"fma", &x86.fma, CONF_TYPE_FLAG, 0, 0, 1, "enables using of FMA extensions of CPU"}, - {"nofma", &x86.fma, CONF_TYPE_FLAG, 0, 1, 0, "disables using of FMA extensions of CPU"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; -#endif - -static const config_t osd_config[]={ - {"level", &mp_conf.osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , "specifies initial mode of the OSD"}, -#ifdef USE_OSD - {"font", &mp_conf.font_name, CONF_TYPE_STRING, 0, 0, 0, "specifies an alternative directory of font.desc location"}, - {"ffactor", &mp_conf.font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, "specifies resampling of alphamap of the font"}, - {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, "specifies align position of SPU (DVD-VOBsub) subtitles"}, - {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies antialiasing/scaling mode for SPU"}, - {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, "specifies variance parameter of gaussian for -spuaa"}, -#endif - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -static const config_t veq_config[]={ - {"brightness",&vo_conf.gamma.brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies brightness-level for output image"}, - {"saturation",&vo_conf.gamma.saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies saturation-level for output image"}, - {"contrast",&vo_conf.gamma.contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies contrast-level for output image"}, - {"hue",&vo_conf.gamma.hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies hue of gamma-correction for output image"}, - {"red",&vo_conf.gamma.red_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of red component for output image"}, - {"green",&vo_conf.gamma.green_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of green component for output image"}, - {"blue",&vo_conf.gamma.blue_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of blue component for output image"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - - -static const config_t avsync_config[]={ - {"framedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, "enables frame-dropping on slow systems: decodes all video frames, but skips displaying some ones"}, -/*UD*/ {"hardframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, "enables hard frame-dropping on slow systems: skips displaying and decoding of some frames"}, - {"noframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, "disables frame dropping"}, - {"pts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 0, 1, "use PTS-based method of A/V synchronization"}, - {"nopts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 1, 0, "use BPS-based method of A/V synchronization"}, - {"force_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files"}, - {"noforce_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files"}, - {"force_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files without PTS changing"}, - {"noforce_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files without PTS changing"}, - {"frame_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 0, 1, "recalc PTS of frames as they were added to the buffer"}, - {"noframe_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 1, 0, "keep original PTS of each frame"}, - {"softsleep", &mp_conf.softsleep, CONF_TYPE_FLAG, 0, 0, 1, "enables high quality software timers for A/V synchronization"}, -#ifdef HAVE_RTC - {"rtc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 1, 0, "enables using of /dev/rtc (real-time clock chip) to compute PTS"}, - {"nortc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 0, 1, "disables using of /dev/rtc (real-time clock chip) to compute PTS"}, -#endif - {"fps", &mp_conf.force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, "forces frame rate (if value is wrong in the header)"}, - {"vsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 0, 1, "forces video hardware to wait VSYNC signal before frame switching"}, - {"novsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 1, 0, "disables video hardware to wait VSYNC signal before frame switching"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - - -static const config_t subtitle_config[]={ - {"on", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, "enables subtitle-steam playback"}, - {"off", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, "disables subtitle-stream playback"}, - {"vob", &mp_conf.vobsub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the VobSub files that are to be used for subtitle"}, - {"vobid", &mp_conf.vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies the VobSub subtitle id"}, -#ifdef USE_SUB - {"file", &mp_conf.sub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the subtitle file"}, -#ifdef USE_ICONV - {"cp", &sub_data.cp, CONF_TYPE_STRING, 0, 0, 0, "specifies codepage of subtitles"}, -#endif - {"fps", &mp_conf.sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, "specifies frame/sec rate of subtitle file"}, - {"noauto", &mp_conf.sub_auto, CONF_TYPE_FLAG, 0, 1, 0, "disable autodetection of vobsub for textsubs if vobsub found"}, - {"unicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UNICODE"}, - {"nounicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, - {"utf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UTF8"}, - {"noutf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UTF8"}, - {"pos",&sub_data.pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, "specifies vertical shift of subtitles"}, -#endif - {"cc", &mp_conf.subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, "enable DVD Closed Caption (CC) subtitles"}, - {"nocc", &mp_conf.subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, "disable DVD Closed Caption (CC) subtitles"}, - {"id", &mp_conf.dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "selects subtitle channel"}, - {"lang", &mp_conf.dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-subtitle stream as two-letter country code(s)"}, - {"ifo", &mp_conf.spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, "specifies .ifo file for DVD subtitles"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -#ifdef HAVE_X11 -static const config_t x11_config[]={ - {"display", &vo_conf.mDisplayName, CONF_TYPE_STRING, 0, 0, 0, "specifies the hostname and display number of the X server"}, - {"wid", &vo_conf.WinID, CONF_TYPE_INT, 0, 0, 0, "tells MPlayerXP to use existing X11 window (for using MPlayerXP as plugin)"}, - {"rootwin", &vo_conf.WinID, CONF_TYPE_FLAG, 0, -1, 0, "render movie in the root window (desktop background)"}, -#ifdef HAVE_XINERAMA - {"xinerama", &mp_conf.xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, "tells MPlayerXP the display for movie playback"}, -#endif - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; -#endif - -static const config_t audio_config[]={ - {"on", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 0, 1, "enables audio-steam playback"}, - {"off", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 1, 0, "disables audio-stream playback"}, - {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, "select audio-mixer device"}, - {"channels", &mp_conf.ao_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, "select number of audio output channels to be used"}, - {"rate", &mp_conf.force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, "specifies Hz for audio playback"}, - {"lang", &mp_conf.audio_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-audio stream as two-letter country code(s)"}, - {"id", &mp_conf.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects audio channel"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -static const config_t video_config[]={ - {"on", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 0, 1, "enables video-steam playback"}, - {"off", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 1, 0, "disables video-stream playback"}, - {"width", &vo_conf.opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to width (if driver supports)"}, - {"height", &vo_conf.opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to height (if driver supports)"}, - {"zoom", &vo_conf.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, "scale output image by given factor"}, - {"screenw", &vo_conf.screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "specifies the horizontal resolution of the screen (if supported)"}, - {"screenh", &vo_conf.screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "specifies the vertical resolution of the screen (if supported)"}, - {"aspect", &vo_conf.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, "sets aspect-ratio of movies (autodetect)"}, - {"noaspect", &vo_conf.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, "unsets aspect-ratio of movies"}, - {"aspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 0, 1, "keeps aspect-ratio of the movie during window resize"}, - {"noaspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 1, 0, "render movie to the user-defined window's geometry"}, - {"monitorpixelaspect", &mp_conf.monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, "sets the aspect-ratio of a single pixel of TV screen"}, - {"vm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 0, 1, "enables video-mode changing during playback"}, - {"novm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 1, 0, "disables video-mode changing during playback"}, - {"fs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 0, 1, "fullscreen playback"}, - {"nofs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 1, 0, "windowed playback"}, - {"fsmode", &vo_conf.fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, "enables workaround for some fullscreen related problems"}, - {"flip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 1, "flip output image upside-down"}, - {"noflip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 0, "render output image as is"}, - {"bpp", &vo_conf.dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, "use different color depth than autodetect"}, - {"bm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 1, "enables using of bus-mastering (if it available for given OS/videocard)"}, - {"bm2", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 2, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, - {"nobm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 1, 0, "disables using of bus-mastering"}, - {"id", &mp_conf.video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects video channel"}, - {"pp", &mp_conf.npp_options, CONF_TYPE_STRING, 0, 0, 0, "specifies options of post-processing"}, -#ifdef HAVE_PNG - {"z", &mp_conf.z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 9, "specifies compression level for PNG output"}, -#endif -#ifdef HAVE_SDL - {"noxv", &sdl_noxv, CONF_TYPE_FLAG, 0, 0, 1, "disable XVideo hardware acceleration for SDL"}, - {"forcexv", &sdl_forcexv, CONF_TYPE_FLAG, 0, 0, 1, "force XVideo hardware acceleration for SDL"}, - {"forcegl", &sdl_forcegl, CONF_TYPE_FLAG, 0, 0, 1, "force OpenGL hardware acceleration for SDL"}, -#endif - {"eq",&veq_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video-equalizer specific options"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -static const config_t playback_config[]={ - {"sb", &mp_conf.seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, "seek to given byte position before playback"}, - {"ss", &mp_conf.seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, "seek to given time position before playback"}, - {"loop", &mp_conf.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, "loops movie playback given number of times. 0 means forever"}, - {"noloop", &mp_conf.loop_times, CONF_TYPE_FLAG, 0, 0, -1, "disable loop of playback"}, - {"shuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, "play files in random order"}, - {"noshuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, "play files in regular order"}, - {"list", NULL, CONF_TYPE_STRING, 0, 0, 0, "specifies playlist (1 file/row or Winamp or ASX format)"}, - {"frames", &mp_conf.play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, "play given number of frames and exit"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - - -static const config_t mplayer_opts[]={ - /* name, pointer, type, flags, min, max, help */ - {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, ""}, /* this don't need anymore to be the first!!! */ - -//---------------------- libao/libvo/mplayer options ------------------------ - {"vo", &mp_conf.video_driver, CONF_TYPE_STRING, 0, 0, 0, "select video output driver and optinaly device"}, - {"ao", &mp_conf.audio_driver, CONF_TYPE_STRING, 0, 0, 0, "select audio output driver and optinaly device"}, - {"af", &af_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects audio filter"}, - {"vf", &vf_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects video filter"}, - {"afm", &mp_conf.audio_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoders family"}, - {"vfm", &mp_conf.video_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoders family"}, - {"ac", &mp_conf.audio_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoder"}, - {"vc", &mp_conf.video_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoder"}, -/*UD*/ {"verbose", &mp_conf.verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, "verbose output"}, - {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, "verbose output (more -v means more verbosity)"}, - {"slave", &mp_conf.slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, "turns MPlayerXP into slave mode as a backend for other programs"}, - {"use-stdin", &mp_conf.use_stdin, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "forces reading of keyboard codes from STDIN instead of terminal's console"}, - {"msgfilter", &mp_conf.msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, "specifies filter for verbosed messages"}, - - {"core", &xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "XP-core related options" }, - {"play", &playback_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Playback specific options" }, - {"audio", &audio_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Audio related options" }, - {"video", &video_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video related options" }, - {"sub", &subtitle_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Subtitle related options" }, -#ifdef HAVE_X11 - {"x", &x11_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "X11-specific options" }, -#endif - {"osd", &osd_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "OSD-related options"}, - {"sync", &avsync_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "AV-synchronization related options" }, -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) - {"cpu", &cpu_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "CPU specific options" }, -#endif -// ------------------------- stream options -------------------- -#ifdef HAVE_STREAMING - { "net", &net_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Network specific options" }, -#endif -// ------------------------- codec/pp options -------------------- - {NULL, NULL, 0, 0, 0, 0, NULL} -}; Copied: mplayerxp/cfg-mplayerxp.h (from rev 304, mplayerxp/cfg-mplayer.h) =================================================================== --- mplayerxp/cfg-mplayerxp.h (rev 0) +++ mplayerxp/cfg-mplayerxp.h 2012-11-09 07:18:45 UTC (rev 306) @@ -0,0 +1,294 @@ +/* + * config for cfgparser + */ + +extern const char *oss_mixer_device; +#ifdef HAVE_SDL +//extern char *sdl_driver; +extern int sdl_noxv; +extern int sdl_forcexv; +extern int sdl_forcegl; +//extern char *sdl_adriver; +#endif + +extern int network_prefer_ipv4; +extern char *network_username; +extern char *network_password; +extern int network_bandwidth; +extern char *network_useragent; +extern int network_ipv4_only_proxy; +extern int network_cookies_enabled; +extern char *cookies_file; + +extern af_cfg_t af_cfg; // Configuration for audio filters +extern vf_cfg_t vf_cfg; // Configuration for audio filters + +/* + * CONF_TYPE_FUNC_FULL : + * allows own implemtations for passing the params + * + * the function receives parameter name and argument (if it does not start with - ) + * useful with a conf.name like 'aa*' to parse several parameters to a function + * return 0 =ok, but we didn't need the param (could be the filename) + * return 1 =ok, we accepted the param + * negative values: see cfgparser.h, ERR_XXX + * + * by Folke + */ + +static const config_t xpcore_config[]={ + {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, UINT_MAX, "specifies number cpus to use for playback"}, + {"dump", &mp_conf.stream_dump, CONF_TYPE_STRING, 0, 0, 0, "specifies dump type and name for the dump of stream"}, + {"gomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 0, 1, "enables usage of OpenMP extensions"}, + {"nogomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 1, 0, "disables usage of OpenMP extensions"}, + {"xp_buffs", &vo_conf.xp_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, "specifies number of buffers for decoding-ahead in XP mode"}, + {"cache", &mp_conf.s_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, "specifies amount of memory for precaching a file/URL"}, + {"nocache", &mp_conf.s_cache_size, CONF_TYPE_FLAG, 0, 1, 0, "disables precaching a file/URL"}, + {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, "dynamically changes the level of postprocessing depending on spare CPU time available"}, + {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, "sets playback speed factor"}, + {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, "performs benchmarking to estimate performance of MPlayerXP"}, + {"test-av", &mp_conf.test_av, CONF_TYPE_FLAG, 0, 0, 1, "test antiviral protection of MPlayerXP"}, + {"malloc-debug", &mp_conf.malloc_debug, CONF_TYPE_FLAG, 0, 1, 0, "debugs malloc() calls in MPlayerXP"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +#ifdef HAVE_STREAMING +static const config_t net_config[]={ + {"ipv4", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, "forces mplayerxp to use IPv4 protocol over network"}, +#ifdef HAVE_AF_INET6 + {"ipv6", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, "forces mplayerxp to use IPv6 protocol over network"}, +#else + {"ipv6", "MPlayerXP was compiled without IPv6 support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, +#endif /* HAVE_AF_INET6 */ + {"ipv4-only-proxy", &network_ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, "skip the proxy for IPv6 addresses"}, + {"user", &network_username, CONF_TYPE_STRING, 0, 0, 0, "specifies username for HTTP authentication"}, + {"passwd", &network_password, CONF_TYPE_STRING, 0, 0, 0, "specifies password for HTTP authentication"}, + {"bandwidth", &network_bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, "specifies the maximum bandwidth for network streaming"}, + {"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, "specifies string as user agent for HTTP streaming"}, + {"cookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, "send cookies when making HTTP requests"}, + {"cookies-file", &cookies_file, CONF_TYPE_STRING, 0, 0, 0, "Read HTTP cookies from file"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; +#endif + +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) +static const config_t cpu_config[]={ + {"simd", &x86.simd, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SIMD extensions of CPU"}, + {"nosimd", &x86.simd, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SIMD extensions of CPU"}, + {"mmx", &x86.mmx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX extensions of CPU"}, + {"nommx", &x86.mmx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX extensions of CPU"}, + {"mmx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX2 extensions of CPU"}, + {"nommx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX2 extensions of CPU"}, + {"3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow! extensions of CPU"}, + {"no3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow! extensions of CPU"}, + {"3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow-2! extensions of CPU"}, + {"no3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow-2! extensions of CPU"}, + {"sse", &x86.sse, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE extensions of CPU"}, + {"nosse", &x86.sse, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE extensions of CPU"}, + {"sse2", &x86.sse2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE2 extensions of CPU"}, + {"nosse2", &x86.sse2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE2 extensions of CPU"}, + {"sse3", &x86.sse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE3 extensions of CPU"}, + {"nosse3", &x86.sse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE3 extensions of CPU"}, + {"ssse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSSE3 extensions of CPU"}, + {"nossse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSSE3 extensions of CPU"}, + {"sse41", &x86.sse41, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE41 extensions of CPU"}, + {"nosse41", &x86.sse41, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE41 extensions of CPU"}, + {"sse42", &x86.sse42, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE42 extensions of CPU"}, + {"nosse42", &x86.sse42, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE42 extensions of CPU"}, + {"aes", &x86.aes, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AES extensions of CPU"}, + {"noaes", &x86.aes, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AES extensions of CPU"}, + {"avx", &x86.avx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AVX extensions of CPU"}, + {"noavx", &x86.avx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AVX extensions of CPU"}, + {"fma", &x86.fma, CONF_TYPE_FLAG, 0, 0, 1, "enables using of FMA extensions of CPU"}, + {"nofma", &x86.fma, CONF_TYPE_FLAG, 0, 1, 0, "disables using of FMA extensions of CPU"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; +#endif + +static const config_t osd_config[]={ + {"level", &mp_conf.osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , "specifies initial mode of the OSD"}, +#ifdef USE_OSD + {"font", &mp_conf.font_name, CONF_TYPE_STRING, 0, 0, 0, "specifies an alternative directory of font.desc location"}, + {"ffactor", &mp_conf.font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, "specifies resampling of alphamap of the font"}, + {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, "specifies align position of SPU (DVD-VOBsub) subtitles"}, + {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies antialiasing/scaling mode for SPU"}, + {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, "specifies variance parameter of gaussian for -spuaa"}, +#endif + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +static const config_t veq_config[]={ + {"brightness",&vo_conf.gamma.brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies brightness-level for output image"}, + {"saturation",&vo_conf.gamma.saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies saturation-level for output image"}, + {"contrast",&vo_conf.gamma.contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies contrast-level for output image"}, + {"hue",&vo_conf.gamma.hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies hue of gamma-correction for output image"}, + {"red",&vo_conf.gamma.red_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of red component for output image"}, + {"green",&vo_conf.gamma.green_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of green component for output image"}, + {"blue",&vo_conf.gamma.blue_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of blue component for output image"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + + +static const config_t avsync_config[]={ + {"framedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, "enables frame-dropping on slow systems: decodes all video frames, but skips displaying some ones"}, +/*UD*/ {"hardframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, "enables hard frame-dropping on slow systems: skips displaying and decoding of some frames"}, + {"noframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, "disables frame dropping"}, + {"pts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 0, 1, "use PTS-based method of A/V synchronization"}, + {"nopts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 1, 0, "use BPS-based method of A/V synchronization"}, + {"force_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files"}, + {"noforce_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files"}, + {"force_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files without PTS changing"}, + {"noforce_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files without PTS changing"}, + {"frame_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 0, 1, "recalc PTS of frames as they were added to the buffer"}, + {"noframe_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 1, 0, "keep original PTS of each frame"}, + {"softsleep", &mp_conf.softsleep, CONF_TYPE_FLAG, 0, 0, 1, "enables high quality software timers for A/V synchronization"}, +#ifdef HAVE_RTC + {"rtc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 1, 0, "enables using of /dev/rtc (real-time clock chip) to compute PTS"}, + {"nortc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 0, 1, "disables using of /dev/rtc (real-time clock chip) to compute PTS"}, +#endif + {"fps", &mp_conf.force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, "forces frame rate (if value is wrong in the header)"}, + {"vsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 0, 1, "forces video hardware to wait VSYNC signal before frame switching"}, + {"novsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 1, 0, "disables video hardware to wait VSYNC signal before frame switching"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + + +static const config_t subtitle_config[]={ + {"on", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, "enables subtitle-steam playback"}, + {"off", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, "disables subtitle-stream playback"}, + {"vob", &mp_conf.vobsub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the VobSub files that are to be used for subtitle"}, + {"vobid", &mp_conf.vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies the VobSub subtitle id"}, +#ifdef USE_SUB + {"file", &mp_conf.sub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the subtitle file"}, +#ifdef USE_ICONV + {"cp", &sub_data.cp, CONF_TYPE_STRING, 0, 0, 0, "specifies codepage of subtitles"}, +#endif + {"fps", &mp_conf.sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, "specifies frame/sec rate of subtitle file"}, + {"noauto", &mp_conf.sub_auto, CONF_TYPE_FLAG, 0, 1, 0, "disable autodetection of vobsub for textsubs if vobsub found"}, + {"unicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UNICODE"}, + {"nounicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, + {"utf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UTF8"}, + {"noutf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UTF8"}, + {"pos",&sub_data.pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, "specifies vertical shift of subtitles"}, +#endif + {"cc", &mp_conf.subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, "enable DVD Closed Caption (CC) subtitles"}, + {"nocc", &mp_conf.subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, "disable DVD Closed Caption (CC) subtitles"}, + {"id", &mp_conf.dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "selects subtitle channel"}, + {"lang", &mp_conf.dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-subtitle stream as two-letter country code(s)"}, + {"ifo", &mp_conf.spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, "specifies .ifo file for DVD subtitles"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +#ifdef HAVE_X11 +static const config_t x11_config[]={ + {"display", &vo_conf.mDisplayName, CONF_TYPE_STRING, 0, 0, 0, "specifies the hostname and display number of the X server"}, + {"wid", &vo_conf.WinID, CONF_TYPE_INT, 0, 0, 0, "tells MPlayerXP to use existing X11 window (for using MPlayerXP as plugin)"}, + {"rootwin", &vo_conf.WinID, CONF_TYPE_FLAG, 0, -1, 0, "render movie in the root window (desktop background)"}, +#ifdef HAVE_XINERAMA + {"xinerama", &mp_conf.xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, "tells MPlayerXP the display for movie playback"}, +#endif + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; +#endif + +static const config_t audio_config[]={ + {"on", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 0, 1, "enables audio-steam playback"}, + {"off", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 1, 0, "disables audio-stream playback"}, + {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, "select audio-mixer device"}, + {"channels", &mp_conf.ao_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, "select number of audio output channels to be used"}, + {"rate", &mp_conf.force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, "specifies Hz for audio playback"}, + {"lang", &mp_conf.audio_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-audio stream as two-letter country code(s)"}, + {"id", &mp_conf.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects audio channel"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +static const config_t video_config[]={ + {"on", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 0, 1, "enables video-steam playback"}, + {"off", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 1, 0, "disables video-stream playback"}, + {"width", &vo_conf.opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to width (if driver supports)"}, + {"height", &vo_conf.opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to height (if driver supports)"}, + {"zoom", &vo_conf.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, "scale output image by given factor"}, + {"screenw", &vo_conf.screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "specifies the horizontal resolution of the screen (if supported)"}, + {"screenh", &vo_conf.screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "specifies the vertical resolution of the screen (if supported)"}, + {"aspect", &vo_conf.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, "sets aspect-ratio of movies (autodetect)"}, + {"noaspect", &vo_conf.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, "unsets aspect-ratio of movies"}, + {"aspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 0, 1, "keeps aspect-ratio of the movie during window resize"}, + {"noaspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 1, 0, "render movie to the user-defined window's geometry"}, + {"monitorpixelaspect", &mp_conf.monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, "sets the aspect-ratio of a single pixel of TV screen"}, + {"vm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 0, 1, "enables video-mode changing during playback"}, + {"novm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 1, 0, "disables video-mode changing during playback"}, + {"fs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 0, 1, "fullscreen playback"}, + {"nofs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 1, 0, "windowed playback"}, + {"fsmode", &vo_conf.fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, "enables workaround for some fullscreen related problems"}, + {"flip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 1, "flip output image upside-down"}, + {"noflip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 0, "render output image as is"}, + {"bpp", &vo_conf.dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, "use different color depth than autodetect"}, + {"bm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 1, "enables using of bus-mastering (if it available for given OS/videocard)"}, + {"bm2", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 2, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, + {"nobm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 1, 0, "disables using of bus-mastering"}, + {"id", &mp_conf.video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects video channel"}, + {"pp", &mp_conf.npp_options, CONF_TYPE_STRING, 0, 0, 0, "specifies options of post-processing"}, +#ifdef HAVE_PNG + {"z", &mp_conf.z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 9, "specifies compression level for PNG output"}, +#endif +#ifdef HAVE_SDL + {"noxv", &sdl_noxv, CONF_TYPE_FLAG, 0, 0, 1, "disable XVideo hardware acceleration for SDL"}, + {"forcexv", &sdl_forcexv, CONF_TYPE_FLAG, 0, 0, 1, "force XVideo hardware acceleration for SDL"}, + {"forcegl", &sdl_forcegl, CONF_TYPE_FLAG, 0, 0, 1, "force OpenGL hardware acceleration for SDL"}, +#endif + {"eq",&veq_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video-equalizer specific options"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +static const config_t playback_config[]={ + {"sb", &mp_conf.seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, "seek to given byte position before playback"}, + {"ss", &mp_conf.seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, "seek to given time position before playback"}, + {"loop", &mp_conf.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, "loops movie playback given number of times. 0 means forever"}, + {"noloop", &mp_conf.loop_times, CONF_TYPE_FLAG, 0, 0, -1, "disable loop of playback"}, + {"shuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, "play files in random order"}, + {"noshuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, "play files in regular order"}, + {"list", NULL, CONF_TYPE_STRING, 0, 0, 0, "specifies playlist (1 file/row or Winamp or ASX format)"}, + {"frames", &mp_conf.play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, "play given number of frames and exit"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + + +static const config_t mplayer_opts[]={ + /* name, pointer, type, flags, min, max, help */ + {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, ""}, /* this don't need anymore to be the first!!! */ + +//---------------------- libao/libvo/mplayer options ------------------------ + {"vo", &mp_conf.video_driver, CONF_TYPE_STRING, 0, 0, 0, "select video output driver and optinaly device"}, + {"ao", &mp_conf.audio_driver, CONF_TYPE_STRING, 0, 0, 0, "select audio output driver and optinaly device"}, + {"af", &af_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects audio filter"}, + {"vf", &vf_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects video filter"}, + {"afm", &mp_conf.audio_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoders family"}, + {"vfm", &mp_conf.video_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoders family"}, + {"ac", &mp_conf.audio_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoder"}, + {"vc", &mp_conf.video_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoder"}, +/*UD*/ {"verbose", &mp_conf.verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, "verbose output"}, + {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, "verbose output (more -v means more verbosity)"}, + {"slave", &mp_conf.slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, "turns MPlayerXP into slave mode as a backend for other programs"}, + {"use-stdin", &mp_conf.use_stdin, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "forces reading of keyboard codes from STDIN instead of terminal's console"}, + {"msgfilter", &mp_conf.msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, "specifies filter for verbosed messages"}, + + {"core", &xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "XP-core related options" }, + {"play", &playback_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Playback specific options" }, + {"audio", &audio_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Audio related options" }, + {"video", &video_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video related options" }, + {"sub", &subtitle_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Subtitle related options" }, +#ifdef HAVE_X11 + {"x", &x11_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "X11-specific options" }, +#endif + {"osd", &osd_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "OSD-related options"}, + {"sync", &avsync_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "AV-synchronization related options" }, +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) + {"cpu", &cpu_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "CPU specific options" }, +#endif +// ------------------------- stream options -------------------- +#ifdef HAVE_STREAMING + { "net", &net_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Network specific options" }, +#endif +// ------------------------- codec/pp options -------------------- + {NULL, NULL, 0, 0, 0, 0, NULL} +}; Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/dump.c 2012-11-09 07:18:45 UTC (rev 306) @@ -13,7 +13,7 @@ #include "xmpcore/sig_hand.h" #include "help_mp.h" #include "input/input.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "libmpdemux/muxer.h" #include "libmpdemux/mrl.h" #include "osdep/mplib.h" Modified: mplayerxp/fifo.c =================================================================== --- mplayerxp/fifo.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/fifo.c 2012-11-09 07:18:45 UTC (rev 306) @@ -1,4 +1,4 @@ -#include "mplayer.h" +#include "mplayerxp.h" #include "fifo.h" #include "osdep/mplib.h" Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libao2/ao_alsa9.c 2012-11-09 07:18:45 UTC (rev 306) @@ -18,7 +18,7 @@ #include <sys/poll.h> #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #define ALSA_PCM_NEW_HW_PARAMS_API #define ALSA_PCM_NEW_SW_PARAMS_API #include <alsa/asoundlib.h> Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-11-09 07:18:45 UTC (rev 306) @@ -8,12 +8,12 @@ #include "codecs_ld.h" #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "help_mp.h" #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "liba52/a52.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-11-09 07:18:45 UTC (rev 306) @@ -8,13 +8,13 @@ #include "codecs_ld.h" #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "help_mp.h" #include "osdep/cpudetect.h" #include "libdca/dca.h" #include "osdep/mm_accel.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "osdep/bswap.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" Modified: mplayerxp/libmpcodecs/ad_dmo.c =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/ad_dmo.c 2012-11-09 07:18:45 UTC (rev 306) @@ -6,7 +6,7 @@ #include "codecs_ld.h" #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "help_mp.h" #include "osdep/mplib.h" #include "ad_internal.h" Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/ad_faad.c 2012-11-09 07:18:45 UTC (rev 306) @@ -15,7 +15,7 @@ #include "codecs_ld.h" #include "mp_config.h" #include "ad_internal.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" #include "osdep/mplib.h" Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-11-09 07:18:45 UTC (rev 306) @@ -4,7 +4,7 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/libmpcodecs/ad_qtaudio.c =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2012-11-09 07:18:45 UTC (rev 306) @@ -8,7 +8,7 @@ #include "ad_internal.h" #include "osdep/bswap.h" #include "codecs_ld.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "libao2/afmt.h" #ifdef WIN32_LOADER #include "loader/ldt_keeper.h" Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-11-09 07:18:45 UTC (rev 306) @@ -5,7 +5,7 @@ #include "mp_config.h" #include "help_mp.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "xmpcore/xmp_core.h" #include "libmpdemux/stream.h" @@ -16,7 +16,7 @@ #include "dec_audio.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "libmpdemux/demuxer_r.h" #include "postproc/af.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-09 07:18:45 UTC (rev 306) @@ -7,7 +7,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include "mplayer.h" +#include "mplayerxp.h" #include "help_mp.h" #include "osdep/timer.h" Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-09 07:18:45 UTC (rev 306) @@ -5,7 +5,7 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "xmpcore/xmp_core.h" #ifdef HAVE_GOMP #include <omp.h> Modified: mplayerxp/libmpcodecs/vd_libmpeg2.c =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-11-09 07:18:45 UTC (rev 306) @@ -11,7 +11,7 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "vd_internal.h" #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" Modified: mplayerxp/libmpcodecs/vd_qtvideo.c =================================================================== --- mplayerxp/libmpcodecs/vd_qtvideo.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpcodecs/vd_qtvideo.c 2012-11-09 07:18:45 UTC (rev 306) @@ -2,7 +2,7 @@ #include <stdlib.h> #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ Modified: mplayerxp/libmpconf/cfgparser.c =================================================================== --- mplayerxp/libmpconf/cfgparser.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpconf/cfgparser.c 2012-11-09 07:18:45 UTC (rev 306) @@ -598,7 +598,7 @@ MSG_INFO("%s", (char *) conf[i].p); exit(1); default: - MSG_ERR( "Unknown config type specified in conf-mplayer.h!\n"); + MSG_ERR( "Unknown config type specified in conf-mplayerxp.h!\n"); break; } out: Modified: mplayerxp/libmpdemux/asf_mmst_streaming.c =================================================================== --- mplayerxp/libmpdemux/asf_mmst_streaming.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/asf_mmst_streaming.c 2012-11-09 07:18:45 UTC (rev 306) @@ -15,7 +15,7 @@ #include <inttypes.h> #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "tcp.h" #include "url.h" Modified: mplayerxp/libmpdemux/asf_streaming.c =================================================================== --- mplayerxp/libmpdemux/asf_streaming.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/asf_streaming.c 2012-11-09 07:18:45 UTC (rev 306) @@ -6,7 +6,7 @@ #include <errno.h> #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #ifndef HAVE_WINSOCK2 #define closesocket close #else Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/cache2.c 2012-11-09 07:18:45 UTC (rev 306) @@ -22,7 +22,7 @@ #include "osdep/mplib.h" #include "help_mp.h" #include "mpdemux.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "demux_msg.h" #ifndef min Modified: mplayerxp/libmpdemux/cdda.c =================================================================== --- mplayerxp/libmpdemux/cdda.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/cdda.c 2012-11-09 07:18:45 UTC (rev 306) @@ -1,5 +1,5 @@ #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #ifdef HAVE_LIBCDIO Modified: mplayerxp/libmpdemux/cddb.c =================================================================== --- mplayerxp/libmpdemux/cddb.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/cddb.c 2012-11-09 07:18:45 UTC (rev 306) @@ -13,7 +13,7 @@ */ #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #if defined(HAVE_LIBCDIO) && defined(HAVE_STREAMING) Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-11-09 07:18:45 UTC (rev 306) @@ -7,7 +7,7 @@ */ #define USE_QTX_CODECS 1 #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include <stdlib.h> #include <stdio.h> Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-11-09 07:18:45 UTC (rev 306) @@ -12,7 +12,7 @@ #include <theora/theora.h> #endif -#include "mplayer.h" +#include "mplayerxp.h" #include "osdep/bswap.h" #include "help_mp.h" #include "stream.h" Modified: mplayerxp/libmpdemux/demux_ts.c =================================================================== --- mplayerxp/libmpdemux/demux_ts.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/demux_ts.c 2012-11-09 07:18:45 UTC (rev 306) @@ -28,7 +28,7 @@ #include <string.h> #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/demux_ty.c 2012-11-09 07:18:45 UTC (rev 306) @@ -36,7 +36,7 @@ #include <stdarg.h> #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "osdep/bswap.h" #include "help_mp.h" Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/demuxer.c 2012-11-09 07:18:45 UTC (rev 306) @@ -12,7 +12,7 @@ #include "stream.h" #include "mp_config.h" #include "help_mp.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "libmpsub/subreader.h" #include "libmpconf/cfgparser.h" #include "nls/nls.h" Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-11-09 07:18:45 UTC (rev 306) @@ -10,7 +10,7 @@ #include "libmpsub/vobsub.h" #include "osdep/timer.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "xmpcore/xmp_core.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/librtsp/rtsp.c =================================================================== --- mplayerxp/libmpdemux/librtsp/rtsp.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/librtsp/rtsp.c 2012-11-09 07:18:45 UTC (rev 306) @@ -33,7 +33,7 @@ #include <stdio.h> #include <assert.h> #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #ifndef HAVE_WINSOCK2 #define closesocket close #include <sys/socket.h> Modified: mplayerxp/libmpdemux/librtsp/rtsp_rtp.c =================================================================== --- mplayerxp/libmpdemux/librtsp/rtsp_rtp.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/librtsp/rtsp_rtp.c 2012-11-09 07:18:45 UTC (rev 306) @@ -27,7 +27,7 @@ #include <inttypes.h> #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "osdep/mplib.h" #ifndef HAVE_WINSOCK2 Modified: mplayerxp/libmpdemux/librtsp/rtsp_session.c =================================================================== --- mplayerxp/libmpdemux/librtsp/rtsp_session.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/librtsp/rtsp_session.c 2012-11-09 07:18:45 UTC (rev 306) @@ -30,7 +30,7 @@ #include <sys/types.h> #include "mp_config.h" -#include "mplayer.h" +#include "mplayerxp.h" #ifndef HAVE_WINSOCK2 #include <sys/socket.h> #include <netinet/in.h> Modified: mplayerxp/libmpdemux/network.c =================================================================== --- mplayerxp/libmpdemux/network.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/network.c 2012-11-09 07:18:45 UTC (rev 306) @@ -16,7 +16,7 @@ #include <ctype.h> #include "../mp_config.h" -#include "../mplayer.h" +#include "../mplayerxp.h" #ifndef HAVE_WINSOCK2 #define closesocket close #else Modified: mplayerxp/libmpdemux/realrtsp/asmrp.c =================================================================== --- mplayerxp/libmpdemux/realrtsp/asmrp.c 2012-11-09 06:59:22 UTC (rev 305) +++ mplayerxp/libmpdemux/realrtsp/asmrp.c 2012-11-09 07:18:45 UTC (rev 306) @@ -42,7 +42,7 @@ #include <string.h> #include "asmrp.h" #include "demux_msg.h" -#include "mplayer.h" +#include "mplayerxp.h" #include "osdep/mplib.h" /* Modified: mplayerxp/libmpdemux/realrtsp/real.c ==========================================================... [truncated message content] |
From: <nic...@us...> - 2012-11-09 15:57:34
|
Revision: 314 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=314&view=rev Author: nickols_k Date: 2012-11-09 15:57:27 +0000 (Fri, 09 Nov 2012) Log Message: ----------- use more MPXP_Rc Modified Paths: -------------- mplayerxp/input/input.c mplayerxp/input/input.h mplayerxp/libmpconf/cfgparser.c mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpconf/codec-cfg.h mplayerxp/libmpdemux/tcp.c mplayerxp/mplayerxp.c Modified: mplayerxp/input/input.c =================================================================== --- mplayerxp/input/input.c 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/input/input.c 2012-11-09 15:57:27 UTC (rev 314) @@ -437,10 +437,10 @@ static int mp_input_default_cmd_func(int fd,char* buf, int l); static char* mp_input_get_key_name(int key); -int mp_input_add_cmd_fd(int fd, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { +MPXP_Rc mp_input_add_cmd_fd(int fd, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { if(num_cmd_fd == MP_MAX_CMD_FD) { MSG_ERR("Too much command fd, unable to register fd %d\n",fd); - return 0; + return MPXP_False; } memset(&cmd_fds[num_cmd_fd],0,sizeof(mp_input_fd_t)); @@ -450,7 +450,7 @@ if(!sel) cmd_fds[num_cmd_fd].flags = MP_FD_NO_SELECT; num_cmd_fd++; - return 1; + return MPXP_Ok; } void mp_input_rm_cmd_fd(int fd) { @@ -478,10 +478,10 @@ num_key_fd--; } -int mp_input_add_key_fd(int fd, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { +MPXP_Rc mp_input_add_key_fd(int fd, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { if(num_key_fd == MP_MAX_KEY_FD) { MSG_ERR("Too much key fd, unable to register fd %d\n",fd); - return 0; + return MPXP_False; } memset(&key_fds[num_key_fd],0,sizeof(mp_input_fd_t)); @@ -491,11 +491,9 @@ if(!sel) key_fds[num_key_fd].flags |= MP_FD_NO_SELECT; num_key_fd++; - return 1; + return MPXP_Ok; } - - mp_cmd_t* mp_input_parse_cmd(char* str) { int i,l; char *ptr,*e; @@ -994,12 +992,12 @@ return NULL; } -int mp_input_queue_cmd(mp_cmd_t* cmd) { - if(cmd_queue_length >= CMD_QUEUE_SIZE) return 0; +MPXP_Rc mp_input_queue_cmd(mp_cmd_t* cmd) { + if(cmd_queue_length >= CMD_QUEUE_SIZE) return MPXP_False; cmd_queue[cmd_queue_end] = cmd; cmd_queue_end = (cmd_queue_end + 1) % CMD_QUEUE_SIZE; cmd_queue_length++; - return 1; + return MPXP_Ok; } static mp_cmd_t* mp_input_get_queued_cmd(int peek_only) { @@ -1436,7 +1434,7 @@ exit(0); } -int mp_input_check_interrupt(int tim) { +MPXP_Rc mp_input_check_interrupt(int tim) { mp_cmd_t* cmd; if((cmd = mp_input_get_cmd(tim,0,1)) == NULL) return 0; switch(cmd->id) { @@ -1446,10 +1444,10 @@ case MP_CMD_PLAY_TREE_UP_STEP: case MP_CMD_PLAY_ALT_SRC_STEP: // The cmd will be executed when we are back in the main loop - return 1; //<-- memory leaks here + return MPXP_Ok; //<-- memory leaks here } // remove the cmd from the queue cmd = mp_input_get_cmd(tim,0,0); mp_cmd_free(cmd); - return 0; + return MPXP_False; } Modified: mplayerxp/input/input.h =================================================================== --- mplayerxp/input/input.h 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/input/input.h 2012-11-09 15:57:27 UTC (rev 314) @@ -1,6 +1,8 @@ #ifndef INPUT_H_INCLUDED #define INPUT_H_INCLUDED 1 +#include "xmpcore/xmp_enums.h" + // All commands id enum { MP_CMD_SEEK =0, @@ -150,14 +152,14 @@ // fd will be used. // The last arg can be NULL if nothing is needed to close the driver. The close // function can be used -extern int mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func); +extern MPXP_Rc mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func); // This remove a cmd driver, you usally don't need to use it extern void mp_input_rm_cmd_fd(int fd); // The args are the sames as for the keys drivers. If you don't use any valid fd you MUST // give a read_func. -extern int mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); +extern MPXP_Rc mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); // As for the cmd one you usally don't need this function extern void mp_input_rm_key_fd(int fd); @@ -165,7 +167,7 @@ // This function can be used to reput a command in the system. It's used by libmpdemux // when it perform a blocking operation to resend the command it received to the main // loop. -extern int mp_input_queue_cmd(mp_cmd_t* cmd); +extern MPXP_Rc mp_input_queue_cmd(mp_cmd_t* cmd); // This function retrive the next avaible command waiting no more than time msec. // If pause is true, the next input will always return a pause command. @@ -190,7 +192,7 @@ extern void mp_input_uninit(void); // Interruptible usleep: (used by libmpdemux) -extern int mp_input_check_interrupt(int time); +extern MPXP_Rc mp_input_check_interrupt(int time); extern void mp_input_print_keys(void); extern void mp_input_print_cmds(void); Modified: mplayerxp/libmpconf/cfgparser.c =================================================================== --- mplayerxp/libmpconf/cfgparser.c 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/libmpconf/cfgparser.c 2012-11-09 15:57:27 UTC (rev 314) @@ -695,354 +695,330 @@ return config_read_option(config,config->opt_list,opt,param); } -int m_config_parse_config_file(m_config_t *config, char *conffile) +MPXP_Rc m_config_parse_config_file(m_config_t *config, char *conffile) { #define PRINT_LINENUM MSG_ERR("%s(%d): ", conffile, line_num) #define MAX_LINE_LEN 1000 #define MAX_OPT_LEN 100 #define MAX_PARAM_LEN 100 - FILE *fp; - char *line; - char opt[MAX_OPT_LEN + 1]; - char param[MAX_PARAM_LEN + 1]; - char c; /* for the "" and '' check */ - int tmp; - int line_num = 0; - int line_pos; /* line pos */ - int opt_pos; /* opt pos */ - int param_pos; /* param pos */ - int ret = 1; - int errors = 0; + FILE *fp; + char *line; + char opt[MAX_OPT_LEN + 1]; + char param[MAX_PARAM_LEN + 1]; + char c; /* for the "" and '' check */ + int tmp; + int line_num = 0; + int line_pos; /* line pos */ + int opt_pos; /* opt pos */ + int param_pos; /* param pos */ + MPXP_Rc ret = MPXP_Ok; + int errors = 0; #ifdef MP_DEBUG - assert(config != NULL); - // assert(conf_list != NULL); + assert(config != NULL); + // assert(conf_list != NULL); #endif - if (++config->recursion_depth > 1) - MSG_INFO("Reading config file: %s", conffile); + if (++config->recursion_depth > 1) MSG_INFO("Reading config file: %s", conffile); - if (config->recursion_depth > MAX_RECURSION_DEPTH) { - MSG_FATAL(": too deep 'include'. check your configfiles\n"); - ret = -1; - goto out; - } + if (config->recursion_depth > MAX_RECURSION_DEPTH) { + MSG_FATAL(": too deep 'include'. check your configfiles\n"); + ret = MPXP_False; + goto out; + } - if (init_conf(config, CONFIG_FILE) == -1) { - ret = -1; - goto out; - } + if (init_conf(config, CONFIG_FILE) == -1) { + ret = MPXP_False; + goto out; + } - if ((line = (char *) mp_malloc(MAX_LINE_LEN + 1)) == NULL) { - MSG_FATAL("\ncan't get memory for 'line': %s", strerror(errno)); - ret = -1; - goto out; - } + if ((line = (char *) mp_malloc(MAX_LINE_LEN + 1)) == NULL) { + MSG_FATAL("\ncan't get memory for 'line': %s", strerror(errno)); + ret = MPXP_False; + goto out; + } - if ((fp = fopen(conffile, "r")) == NULL) { - if (config->recursion_depth > 1) - MSG_ERR(": %s\n", strerror(errno)); - mp_free(line); - ret = 0; - goto out; + if ((fp = fopen(conffile, "r")) == NULL) { + if (config->recursion_depth > 1) MSG_ERR(": %s\n", strerror(errno)); + mp_free(line); + ret = MPXP_Ok; + goto out; + } + if (config->recursion_depth > 1) MSG_FATAL("\n"); + + while (fgets(line, MAX_LINE_LEN, fp)) { + if (errors >= 16) { + MSG_FATAL("too many errors\n"); + goto out; } - if (config->recursion_depth > 1) - MSG_FATAL("\n"); - while (fgets(line, MAX_LINE_LEN, fp)) { - if (errors >= 16) { - MSG_FATAL("too many errors\n"); - goto out; - } + line_num++; + line_pos = 0; - line_num++; - line_pos = 0; + /* skip whitespaces */ + while (isspace(line[line_pos])) ++line_pos; - /* skip whitespaces */ - while (isspace(line[line_pos])) - ++line_pos; + /* EOL / comment */ + if (line[line_pos] == '\0' || line[line_pos] == '#') continue; - /* EOL / comment */ - if (line[line_pos] == '\0' || line[line_pos] == '#') - continue; + /* read option. */ + for (opt_pos = 0; isprint(line[line_pos]) && + line[line_pos] != ' ' && + line[line_pos] != '#' && + line[line_pos] != '='; /* NOTHING */) { + opt[opt_pos++] = line[line_pos++]; + if (opt_pos >= MAX_OPT_LEN) { + PRINT_LINENUM; + MSG_ERR("too long option\n"); + errors++; + ret = MPXP_False; + goto nextline; + } + } + if (opt_pos == 0) { + PRINT_LINENUM; + MSG_ERR("parse error\n"); + ret = MPXP_False; + errors++; + continue; + } + opt[opt_pos] = '\0'; - /* read option. */ - for (opt_pos = 0; isprint(line[line_pos]) && - line[line_pos] != ' ' && - line[line_pos] != '#' && - line[line_pos] != '='; /* NOTHING */) { - opt[opt_pos++] = line[line_pos++]; - if (opt_pos >= MAX_OPT_LEN) { - PRINT_LINENUM; - MSG_ERR("too long option\n"); - errors++; - ret = -1; - goto nextline; - } - } - if (opt_pos == 0) { - PRINT_LINENUM; - MSG_ERR("parse error\n"); - ret = -1; - errors++; - continue; - } - opt[opt_pos] = '\0'; - #ifdef MP_DEBUG - PRINT_LINENUM; - MSG_DBG2("option: %s\n", opt); + PRINT_LINENUM; + MSG_DBG2("option: %s\n", opt); #endif - /* skip whitespaces */ - while (isspace(line[line_pos])) - ++line_pos; + /* skip whitespaces */ + while (isspace(line[line_pos])) ++line_pos; - /* check '=' */ - if (line[line_pos++] != '=') { - PRINT_LINENUM; - MSG_ERR("option without parameter\n"); - ret = -1; - errors++; - continue; - } + /* check '=' */ + if (line[line_pos++] != '=') { + PRINT_LINENUM; + MSG_ERR("option without parameter\n"); + ret = MPXP_False; + errors++; + continue; + } - /* whitespaces... */ - while (isspace(line[line_pos])) - ++line_pos; + /* whitespaces... */ + while (isspace(line[line_pos])) ++line_pos; - /* read the parameter */ - if (line[line_pos] == '"' || line[line_pos] == '\'') { - c = line[line_pos]; - ++line_pos; - for (param_pos = 0; line[line_pos] != c; /* NOTHING */) { - param[param_pos++] = line[line_pos++]; - if (param_pos >= MAX_PARAM_LEN) { - PRINT_LINENUM; - MSG_ERR("too long parameter\n"); - ret = -1; - errors++; - goto nextline; - } - } - line_pos++; /* skip the closing " or ' */ - } else { - for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos]) - && line[line_pos] != '#'; /* NOTHING */) { - param[param_pos++] = line[line_pos++]; - if (param_pos >= MAX_PARAM_LEN) { - PRINT_LINENUM; - MSG_ERR("too long parameter\n"); - ret = -1; - errors++; - goto nextline; - } - } + /* read the parameter */ + if (line[line_pos] == '"' || line[line_pos] == '\'') { + c = line[line_pos]; + ++line_pos; + for (param_pos = 0; line[line_pos] != c; /* NOTHING */) { + param[param_pos++] = line[line_pos++]; + if (param_pos >= MAX_PARAM_LEN) { + PRINT_LINENUM; + MSG_ERR("too long parameter\n"); + ret = MPXP_False; + errors++; + goto nextline; } - param[param_pos] = '\0'; - - /* did we read a parameter? */ - if (param_pos == 0) { - PRINT_LINENUM; - MSG_ERR("option without parameter\n"); - ret = -1; - errors++; - continue; + } + line_pos++; /* skip the closing " or ' */ + } else { + for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos]) + && line[line_pos] != '#'; /* NOTHING */) { + param[param_pos++] = line[line_pos++]; + if (param_pos >= MAX_PARAM_LEN) { + PRINT_LINENUM; + MSG_ERR("too long parameter\n"); + ret = MPXP_False; + errors++; + goto nextline; } + } + } + param[param_pos] = '\0'; + /* did we read a parameter? */ + if (param_pos == 0) { + PRINT_LINENUM; + MSG_ERR("option without parameter\n"); + ret = MPXP_False; + errors++; + continue; + } + #ifdef MP_DEBUG - PRINT_LINENUM; - MSG_DBG2("parameter: %s\n", param); + PRINT_LINENUM; + MSG_DBG2("parameter: %s\n", param); #endif - /* now, check if we have some more chars on the line */ - /* whitespace... */ - while (isspace(line[line_pos])) - ++line_pos; + /* now, check if we have some more chars on the line */ + /* whitespace... */ + while (isspace(line[line_pos])) ++line_pos; - /* EOL / comment */ - if (line[line_pos] != '\0' && line[line_pos] != '#') { - PRINT_LINENUM; - MSG_ERR("extra characters on line: %s\n", line+line_pos); - ret = -1; - } + /* EOL / comment */ + if (line[line_pos] != '\0' && line[line_pos] != '#') { + PRINT_LINENUM; + MSG_ERR("extra characters on line: %s\n", line+line_pos); + ret = MPXP_False; + } - tmp = m_config_set_option(config, opt, param); - switch (tmp) { - case ERR_NOT_AN_OPTION: - case ERR_MISSING_PARAM: - case ERR_OUT_OF_RANGE: - case ERR_NO_SUBCONF: - case ERR_FUNC_ERR: - PRINT_LINENUM; - MSG_ERR("%s\n", opt); - ret = -1; - errors++; - continue; - /* break */ - } -nextline: - ; + tmp = m_config_set_option(config, opt, param); + switch (tmp) { + case ERR_NOT_AN_OPTION: + case ERR_MISSING_PARAM: + case ERR_OUT_OF_RANGE: + case ERR_NO_SUBCONF: + case ERR_FUNC_ERR: + PRINT_LINENUM; + MSG_ERR("%s\n", opt); + ret = MPXP_False; + errors++; + continue; + /* break */ } +nextline: + ; + } - mp_free(line); - fclose(fp); + mp_free(line); + fclose(fp); out: - --config->recursion_depth; - return ret; + --config->recursion_depth; + return ret; } extern void show_help(void); extern void show_long_help(void); -int m_config_parse_command_line(m_config_t *config, int argc, char **argv, char **envp) +MPXP_Rc m_config_parse_command_line(m_config_t *config, int argc, char **argv, char **envp) { - int i; - int tmp; - char *opt; - int no_more_opts = 0; - UNUSED(envp); + int i; + int tmp; + char *opt; + int no_more_opts = 0; + UNUSED(envp); #ifdef MP_DEBUG - assert(config != NULL); - assert(config->pt != NULL); - assert(argv != NULL); - assert(envp != NULL); - assert(argc >= 1); + assert(config != NULL); + assert(config->pt != NULL); + assert(argv != NULL); + assert(envp != NULL); + assert(argc >= 1); #endif - - if (init_conf(config, COMMAND_LINE) == -1) - return -1; - if(config->last_parent == NULL) - config->last_parent = config->pt; - /* in order to work recursion detection properly in parse_config_file */ - ++config->recursion_depth; - for (i = 1; i < argc; i++) { - //next: - opt = argv[i]; - if(strcmp(opt,"--help")==0) { - show_help(); - exit(0); - } - if(strcmp(opt,"--long-help")==0) { - show_long_help(); - exit(0); - } - /* check for -- (no more options id.) except --help! */ - if ((*opt == '-') && (*(opt+1) == '-')) - { - no_more_opts = 1; - if (i+1 >= argc) - { - MSG_ERR( "You added '--' but no filenames presented!\n"); - goto err_out; - } - continue; - } - if((opt[0] == '{') && (opt[1] == '\0')) - { - play_tree_t* entry = play_tree_new(); - UNSET_GLOBAL(config); - if(config->last_entry == NULL) { - play_tree_set_child(config->last_parent,entry); - } else { - play_tree_append_entry(config->last_entry,entry); - config->last_entry = NULL; - } - config->last_parent = entry; - continue; - } + if (init_conf(config, COMMAND_LINE) == -1) return MPXP_False; + if(config->last_parent == NULL) config->last_parent = config->pt; + /* in order to work recursion detection properly in parse_config_file */ + ++config->recursion_depth; - if((opt[0] == '}') && (opt[1] == '\0')) - { - if( ! config->last_parent || ! config->last_parent->parent) { - MSG_ERR( "too much }-\n"); - goto err_out; - } - config->last_entry = config->last_parent; - config->last_parent = config->last_entry->parent; - continue; - } + for (i = 1; i < argc; i++) { + //next: + opt = argv[i]; + if(strcmp(opt,"--help")==0) { + show_help(); + exit(0); + } + if(strcmp(opt,"--long-help")==0) { + show_long_help(); + exit(0); + } + /* check for -- (no more options id.) except --help! */ + if ((*opt == '-') && (*(opt+1) == '-')) { + no_more_opts = 1; + if (i+1 >= argc) { + MSG_ERR( "You added '--' but no filenames presented!\n"); + goto err_out; + } + continue; + } + if((opt[0] == '{') && (opt[1] == '\0')) { + play_tree_t* entry = play_tree_new(); + UNSET_GLOBAL(config); + if(config->last_entry == NULL) { + play_tree_set_child(config->last_parent,entry); + } else { + play_tree_append_entry(config->last_entry,entry); + config->last_entry = NULL; + } + config->last_parent = entry; + continue; + } - if ((no_more_opts == 0) && (*opt == '-') && (*(opt+1) != 0)) /* option */ - { - /* remove leading '-' */ - char *assign,*item,*parm; - opt++; + if((opt[0] == '}') && (opt[1] == '\0')) { + if( ! config->last_parent || ! config->last_parent->parent) { + MSG_ERR( "too much }-\n"); + goto err_out; + } + config->last_entry = config->last_parent; + config->last_parent = config->last_entry->parent; + continue; + } - MSG_DBG2( "this_option: %s\n", opt); - parm = argv[i+1]; - item=opt; - assign = strchr(opt,'='); - if(assign) { - item = mp_malloc(assign-opt); - memcpy(item,opt,assign-opt); - item[assign-opt]='\0'; - parm = mp_strdup(assign+1); - } - tmp = m_config_set_option(config, item, parm); - if(!tmp && assign) - MSG_ERR("Option '%s' doesn't require arguments\n",item); - if(assign) { - mp_free(item); - mp_free(parm); - } - if(!tmp && assign) goto err_out; + if ((no_more_opts == 0) && (*opt == '-') && (*(opt+1) != 0)) /* option */ { + /* remove leading '-' */ + char *assign,*item,*parm; + opt++; - switch (tmp) { - case ERR_NOT_AN_OPTION: - case ERR_MISSING_PARAM: - case ERR_OUT_OF_RANGE: - case ERR_NO_SUBCONF: - case ERR_FUNC_ERR: - MSG_ERR( "Error '%s' while parsing option: '%s'!\n" + MSG_DBG2( "this_option: %s\n", opt); + parm = argv[i+1]; + item=opt; + assign = strchr(opt,'='); + if(assign) { + item = mp_malloc(assign-opt); + memcpy(item,opt,assign-opt); + item[assign-opt]='\0'; + parm = mp_strdup(assign+1); + } + tmp = m_config_set_option(config, item, parm); + if(!tmp && assign) MSG_ERR("Option '%s' doesn't require arguments\n",item); + if(assign) { + mp_free(item); + mp_free(parm); + } + if(!tmp && assign) goto err_out; + + switch (tmp) { + case ERR_NOT_AN_OPTION: + case ERR_MISSING_PARAM: + case ERR_OUT_OF_RANGE: + case ERR_NO_SUBCONF: + case ERR_FUNC_ERR: + MSG_ERR( "Error '%s' while parsing option: '%s'!\n" ,tmp==ERR_NOT_AN_OPTION?"no-option": tmp==ERR_MISSING_PARAM?"missing-param": tmp==ERR_OUT_OF_RANGE?"out-of-range": tmp==ERR_NO_SUBCONF?"no-subconfig": "func-error" ,opt); - goto err_out; - default: - i += tmp; - if(assign) i--; - break; - } - } - else /* filename */ - { - play_tree_t* entry = play_tree_new(); - MSG_DBG2("Adding file %s\n",argv[i]); - play_tree_add_file(entry,argv[i]); - if(strcasecmp(argv[i],"-") == 0) - m_config_set_option(config,"use-stdin",NULL); - /* opt is not an option -> treat it as a filename */ - UNSET_GLOBAL(config); // We start entry specific options - if(config->last_entry == NULL) - play_tree_set_child(config->last_parent,entry); - else - play_tree_append_entry(config->last_entry,entry); - config->last_entry = entry; - } + goto err_out; + default: + i += tmp; + if(assign) i--; + break; + } + } else /* filename */ { + play_tree_t* entry = play_tree_new(); + MSG_DBG2("Adding file %s\n",argv[i]); + play_tree_add_file(entry,argv[i]); + if(strcasecmp(argv[i],"-") == 0) m_config_set_option(config,"use-stdin",NULL); + /* opt is not an option -> treat it as a filename */ + UNSET_GLOBAL(config); // We start entry specific options + if(config->last_entry == NULL) play_tree_set_child(config->last_parent,entry); + else play_tree_append_entry(config->last_entry,entry); + config->last_entry = entry; } + } - --config->recursion_depth; - if(config->last_parent != config->pt) - MSG_ERR("Missing }- ?\n"); - UNSET_GLOBAL(config); - SET_RUNNING(config); - return 1; + --config->recursion_depth; + if(config->last_parent != config->pt) MSG_ERR("Missing }- ?\n"); + UNSET_GLOBAL(config); + SET_RUNNING(config); + return MPXP_Ok; #if 0 err_out_mem: - MSG_ERR( "can't allocate memory for filenames (%s)\n", strerror(errno)); + MSG_ERR( "can't allocate memory for filenames (%s)\n", strerror(errno)); #endif err_out: - --config->recursion_depth; - MSG_ERR( "command line: %s\n", argv[i]); - return -1; + --config->recursion_depth; + MSG_ERR( "command line: %s\n", argv[i]); + return MPXP_False; } - - int m_config_register_options(m_config_t *config,const config_t *args) { int list_len = 0; const config_t** conf_list = config->opt_list; @@ -1212,8 +1188,7 @@ } -int -m_config_switch_flag(m_config_t *config,const char* opt) { +int m_config_switch_flag(m_config_t *config,const char* opt) { const config_t *conf; #ifdef MP_DEBUG Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/libmpconf/cfgparser.h 2012-11-09 15:57:27 UTC (rev 314) @@ -1,9 +1,9 @@ /* * command line and config file parser */ - #ifndef __CONFIG_H -#define __CONFIG_H +#define __CONFIG_H 1 +#include "xmpcore/xmp_enums.h" /* config types */ enum { @@ -81,13 +81,13 @@ * 0 if can't open configfile * 1 on success */ -int m_config_parse_config_file(m_config_t *config, char *conffile); +MPXP_Rc m_config_parse_config_file(m_config_t *config, char *conffile); /* parse_command_line returns: * -1 on error (invalid option...) * 1 otherwise */ -int m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); +MPXP_Rc m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); m_config_t* m_config_new(play_tree_t* pt); Modified: mplayerxp/libmpconf/codec-cfg.h =================================================================== --- mplayerxp/libmpconf/codec-cfg.h 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/libmpconf/codec-cfg.h 2012-11-09 15:57:27 UTC (rev 314) @@ -28,31 +28,31 @@ #ifndef GUID_TYPE #define GUID_TYPE typedef struct { - uint32_t f1; - uint16_t f2; - uint16_t f3; - uint8_t f4[8]; + uint32_t f1; + uint16_t f2; + uint16_t f3; + uint8_t f4[8]; } GUID; #endif typedef struct codecs_st { - uint32_t fourcc[CODECS_MAX_FOURCC]; - uint32_t fourccmap[CODECS_MAX_FOURCC]; - uint32_t outfmt[CODECS_MAX_OUTFMT]; - unsigned char outflags[CODECS_MAX_OUTFMT]; - uint32_t infmt[CODECS_MAX_INFMT]; - unsigned char inflags[CODECS_MAX_INFMT]; - char codec_name[256]; - char s_info[256]; - char s_comment[256]; - char dll_name[256]; - GUID guid; - char driver_name[256]; - short flags; - short status; - short cpuflags; - short priority; + uint32_t fourcc[CODECS_MAX_FOURCC]; + uint32_t fourccmap[CODECS_MAX_FOURCC]; + uint32_t outfmt[CODECS_MAX_OUTFMT]; + unsigned char outflags[CODECS_MAX_OUTFMT]; + uint32_t infmt[CODECS_MAX_INFMT]; + unsigned char inflags[CODECS_MAX_INFMT]; + char codec_name[256]; + char s_info[256]; + char s_comment[256]; + char dll_name[256]; + GUID guid; + char driver_name[256]; + short flags; + short status; + short cpuflags; + short priority; } codecs_t; extern int parse_codec_cfg(const char *cfgfile); Modified: mplayerxp/libmpdemux/tcp.c =================================================================== --- mplayerxp/libmpdemux/tcp.c 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/libmpdemux/tcp.c 2012-11-09 15:57:27 UTC (rev 314) @@ -198,7 +198,7 @@ FD_SET( socket_server_fd, &set ); // When the connection will be made, we will have a writeable fd while((ret = select(FD_SETSIZE, NULL, &set, NULL, &tv)) == 0) { - if(count > 30 || mp_input_check_interrupt(500)) { + if(count > 30 || mp_input_check_interrupt(500)==MPXP_Ok) { if(count > 30) MSG_ERR("[tcp%s] Connecting timeout\n",IP_NAME); else Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/mplayerxp.c 2012-11-09 15:57:27 UTC (rev 314) @@ -156,9 +156,9 @@ **************************************************************************/ static int cfg_inc_verbose(struct config *conf){ UNUSED(conf); ++mp_conf.verbose; return 0;} -static int cfg_include(struct config *conf, char *filename){ - UNUSED(conf); - return m_config_parse_config_file(mp_data->mconfig, filename); +static MPXP_Rc cfg_include(struct config *conf, char *filename){ + UNUSED(conf); + return m_config_parse_config_file(mp_data->mconfig, filename); } #include "cfg-mplayerxp.h" @@ -441,8 +441,7 @@ write(conffile_fd, default_config, strlen(default_config)); close(conffile_fd); } - if (m_config_parse_config_file(conf, conffile) < 0) - exit(1); + if (m_config_parse_config_file(conf, conffile) != MPXP_Ok) exit(1); mp_free(conffile); } } @@ -1677,7 +1676,7 @@ mp_register_options(mp_data->mconfig); parse_cfgfiles(mp_data->mconfig); - if(m_config_parse_command_line(mp_data->mconfig, argc, argv, envp) < 0) + if(m_config_parse_command_line(mp_data->mconfig, argc, argv, envp)!=MPXP_Ok) exit_player("Error parse command line"); // error parsing cmdline if(!mp_conf.xp) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-10 10:58:35
|
Revision: 315 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=315&view=rev Author: nickols_k Date: 2012-11-10 10:58:25 +0000 (Sat, 10 Nov 2012) Log Message: ----------- new version of input: input2 Modified Paths: -------------- mplayerxp/dump.c mplayerxp/dump.h mplayerxp/input/input.c mplayerxp/input/input.h mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_divx4.c mplayerxp/libmpcodecs/vd_dmo.c mplayerxp/libmpcodecs/vd_dshow.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_huffyuv.c mplayerxp/libmpcodecs/vd_internal.h mplayerxp/libmpcodecs/vd_libdv.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_mpegpes.c mplayerxp/libmpcodecs/vd_null.c mplayerxp/libmpcodecs/vd_nuv.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpcodecs/vd_raw.c mplayerxp/libmpcodecs/vd_real.c mplayerxp/libmpcodecs/vd_theora.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpcodecs/vd_xvid.c mplayerxp/libmpconf/cfgparser.c mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpdemux/asf_mmst_streaming.c mplayerxp/libmpdemux/asf_streaming.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/cdd.h mplayerxp/libmpdemux/cddb.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/mpdemux.c mplayerxp/libmpdemux/mpdemux.h mplayerxp/libmpdemux/network.c mplayerxp/libmpdemux/network.h mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/s_dvdread.c mplayerxp/libmpdemux/s_ffmpeg.c mplayerxp/libmpdemux/s_file.c mplayerxp/libmpdemux/s_ftp.c mplayerxp/libmpdemux/s_network.c mplayerxp/libmpdemux/s_oss.c mplayerxp/libmpdemux/s_rtsp.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/s_udp.c mplayerxp/libmpdemux/s_vcdnav.c mplayerxp/libmpdemux/stream.c mplayerxp/libmpdemux/stream.h mplayerxp/libmpdemux/tcp.c mplayerxp/libmpdemux/tcp.h mplayerxp/libmpdemux/test.c mplayerxp/libplaytree/asxparser.c mplayerxp/libplaytree/asxparser.h mplayerxp/libplaytree/playtree.h mplayerxp/libplaytree/playtreeparser.c mplayerxp/libplaytree/playtreeparser.h mplayerxp/mplayerxp.c mplayerxp/mplayerxp.h mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu.h mplayerxp/postproc/libmenu/menu_cmdlist.c mplayerxp/postproc/libmenu/menu_console.c mplayerxp/postproc/libmenu/menu_filesel.c mplayerxp/postproc/libmenu/menu_param.c mplayerxp/postproc/libmenu/menu_pt.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_menu.c Added Paths: ----------- mplayerxp/libmpdemux/asf_streaming.h Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/dump.c 2012-11-10 10:58:25 UTC (rev 315) @@ -73,16 +73,17 @@ #define MUX_HAVE_VIDEO 0x02 #define MUX_HAVE_SUBS 0x04 typedef struct priv_s { - int my_use_pts; - FILE *mux_file; - muxer_t *muxer; + int my_use_pts; + FILE* mux_file; + muxer_t* muxer; muxer_stream_t *m_audio,*m_video,*m_subs; - unsigned decoded_frameno; - unsigned a_frameno; - int mux_type; - uint64_t vsize,asize,ssize; - float timer_corr; /* use common time-base */ - float vtimer; + unsigned decoded_frameno; + unsigned a_frameno; + int mux_type; + uint64_t vsize,asize,ssize; + float timer_corr; /* use common time-base */ + float vtimer; + any_t* libinput; }priv_t; void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp) @@ -93,12 +94,12 @@ returns: 0 - nothing interested -1 - quit */ -static int check_cmd(void) +static int check_cmd(priv_t* priv) { mp_cmd_t* cmd; int retval; retval = 0; - while((cmd = mp_input_get_cmd(0,0,0)) != NULL) + while((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) { switch(cmd->id) { @@ -112,124 +113,108 @@ return retval; } -void dump_mux_init(demuxer_t *demuxer) +void dump_mux_init(demuxer_t *demuxer,any_t* libinput) { sh_audio_t* sha=demuxer->audio->sh; sh_video_t* shv=demuxer->video->sh; - char stream_dump_name[1024]; - /* TODO copy it from demuxer */ - if(demuxer->priv) return; - demuxer->priv=mp_mallocz(sizeof(priv_t)); - priv_t*priv=demuxer->priv; - /* describe other useless dumps */ - priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; - if(port) - { - if(strcmp(port,"audio") ==0 ) { strcpy(stream_dump_name,"a_"); priv->mux_type&=~(MUX_HAVE_VIDEO|MUX_HAVE_SUBS); } - else - if(strcmp(port,"video") ==0 ) { strcpy(stream_dump_name,"v_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_SUBS); } - else - if(strcmp(port,"sub") ==0 ) { strcpy(stream_dump_name,"s_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_VIDEO); } - else strcpy(stream_dump_name,port); - } - else strcpy(stream_dump_name,"avs_"); - if(strcmp(media,"lavf") == 0) { strcpy(stream_dump_name,"avs_dump."); strcat(stream_dump_name,port); } - else - if(strcmp(media,"mpxp") == 0) strcat(stream_dump_name,"dump.mpxp"); - else - if(strcmp(media,"raw") == 0) strcat(stream_dump_name,"dump.raw"); - else - { - MSG_FATAL("Unsupported muxer format %s found\n",media); - exit_player(MSGTR_Exit_error); - } - priv->mux_file=fopen(stream_dump_name,"wb"); - MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); - if(!priv->mux_file){ - MSG_FATAL(MSGTR_CantOpenDumpfile); - exit_player(MSGTR_Exit_error); - } - if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) - { - MSG_FATAL("Can't initialize muxer\n"); - exit_player(MSGTR_Exit_error); - } - if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) - { - priv->m_audio=muxer_new_stream(priv->muxer,MUXER_TYPE_AUDIO); - priv->m_audio->buffer_size=0x100000; //16384; - priv->m_audio->source=sha; - priv->m_audio->codec=0; - if(!sha->wf) - { - sha->wf=mp_malloc(sizeof(WAVEFORMATEX)); - sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; - sha->wf->wFormatTag = sha->wtag; - sha->wf->nChannels = sha->nch; - sha->wf->nSamplesPerSec = sha->rate; - sha->wf->nAvgBytesPerSec=sha->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; - sha->wf->wBitsPerSample = 16; // FIXME - sha->wf->cbSize=0; // FIXME for l3codeca.acm + char stream_dump_name[1024]; + /* TODO copy it from demuxer */ + if(demuxer->priv) return; + demuxer->priv=mp_mallocz(sizeof(priv_t)); + priv_t*priv=demuxer->priv; + priv->libinput=libinput; + /* describe other useless dumps */ + priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; + if(port) { + if(strcmp(port,"audio") ==0 ) { strcpy(stream_dump_name,"a_"); priv->mux_type&=~(MUX_HAVE_VIDEO|MUX_HAVE_SUBS); } + else if(strcmp(port,"video") ==0 ) { strcpy(stream_dump_name,"v_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_SUBS); } + else if(strcmp(port,"sub") ==0 ) { strcpy(stream_dump_name,"s_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_VIDEO); } + else strcpy(stream_dump_name,port); + } else strcpy(stream_dump_name,"avs_"); + if(strcmp(media,"lavf") == 0) { strcpy(stream_dump_name,"avs_dump."); strcat(stream_dump_name,port); } + else if(strcmp(media,"mpxp") == 0) strcat(stream_dump_name,"dump.mpxp"); + else if(strcmp(media,"raw") == 0) strcat(stream_dump_name,"dump.raw"); + else { + MSG_FATAL("Unsupported muxer format %s found\n",media); + exit_player(MSGTR_Exit_error); } - priv->m_audio->wf=mp_malloc(sha->wf->cbSize+sizeof(WAVEFORMATEX)); - memcpy(priv->m_audio->wf,sha->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); - if(!sha->wf->cbSize && sha->codecdata_len) - { - priv->m_audio->wf->cbSize=sha->wf->cbSize=sha->codecdata_len; - priv->m_audio->wf=mp_realloc(priv->m_audio->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); - memcpy((char *)(priv->m_audio->wf+1),sha->codecdata,sha->codecdata_len); + priv->mux_file=fopen(stream_dump_name,"wb"); + MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); + if(!priv->mux_file){ + MSG_FATAL(MSGTR_CantOpenDumpfile); + exit_player(MSGTR_Exit_error); } - if(!sha->i_bps) sha->i_bps=priv->m_audio->wf->nAvgBytesPerSec; - if(sha->audio.dwScale){ - priv->m_audio->h.dwSampleSize=sha->audio.dwSampleSize; - priv->m_audio->h.dwScale=sha->audio.dwScale; - priv->m_audio->h.dwRate=sha->audio.dwRate; - } else { - priv->m_audio->h.dwSampleSize=priv->m_audio->wf->nBlockAlign; - priv->m_audio->h.dwScale=priv->m_audio->h.dwSampleSize; - priv->m_audio->h.dwRate=priv->m_audio->wf->nAvgBytesPerSec; + if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) { + MSG_FATAL("Can't initialize muxer\n"); + exit_player(MSGTR_Exit_error); } - } - else priv->m_audio=NULL; - if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) - { - priv->m_video=muxer_new_stream(priv->muxer,MUXER_TYPE_VIDEO); - priv->m_video->buffer_size=0x200000; // 2MB - priv->m_video->source=shv; - priv->m_video->h.dwSampleSize=0; // VBR - priv->m_video->h.dwScale=10000; - priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; - priv->m_video->h.dwSuggestedBufferSize=shv->video.dwSuggestedBufferSize; - if(!shv->bih) - { - shv->bih=mp_malloc(sizeof(BITMAPINFOHEADER)); - shv->bih->biSize=sizeof(BITMAPINFOHEADER); - shv->bih->biWidth=shv->src_w; - shv->bih->biHeight=shv->src_h; - shv->bih->biCompression=shv->fourcc; - shv->bih->biPlanes=1; - shv->bih->biBitCount=24; // FIXME!!! - shv->bih->biSizeImage=shv->bih->biWidth*shv->bih->biHeight*(shv->bih->biBitCount/8); - } - priv->m_video->bih=mp_malloc(shv->bih->biSize); - memcpy(priv->m_video->bih,shv->bih,shv->bih->biSize); - priv->m_video->ImageDesc=shv->ImageDesc; - priv->m_video->aspect=shv->aspect; - priv->m_video->codec=0; - } - else priv->m_video=NULL; - if(demuxer->sub->sh && (priv->mux_type&MUX_HAVE_SUBS)) - { - priv->m_subs=muxer_new_stream(priv->muxer,MUXER_TYPE_SUBS); - priv->m_subs->buffer_size=0x100000; //16384; - priv->m_subs->source=NULL; - priv->m_subs->codec=0; - } - else priv->m_subs=NULL; - MSG_DBG2("Opening dump: %X\n",demuxer); - MSG_INFO("Dumping stream to %s\n",stream_dump_name); - muxer_fix_parameters(priv->muxer); - muxer_write_header(priv->muxer,demuxer); + if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) { + priv->m_audio=muxer_new_stream(priv->muxer,MUXER_TYPE_AUDIO); + priv->m_audio->buffer_size=0x100000; //16384; + priv->m_audio->source=sha; + priv->m_audio->codec=0; + if(!sha->wf) { + sha->wf=mp_malloc(sizeof(WAVEFORMATEX)); + sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; + sha->wf->wFormatTag = sha->wtag; + sha->wf->nChannels = sha->nch; + sha->wf->nSamplesPerSec = sha->rate; + sha->wf->nAvgBytesPerSec=sha->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; + sha->wf->wBitsPerSample = 16; // FIXME + sha->wf->cbSize=0; // FIXME for l3codeca.acm + } + priv->m_audio->wf=mp_malloc(sha->wf->cbSize+sizeof(WAVEFORMATEX)); + memcpy(priv->m_audio->wf,sha->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); + if(!sha->wf->cbSize && sha->codecdata_len) { + priv->m_audio->wf->cbSize=sha->wf->cbSize=sha->codecdata_len; + priv->m_audio->wf=mp_realloc(priv->m_audio->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); + memcpy((char *)(priv->m_audio->wf+1),sha->codecdata,sha->codecdata_len); + } + if(!sha->i_bps) sha->i_bps=priv->m_audio->wf->nAvgBytesPerSec; + if(sha->audio.dwScale){ + priv->m_audio->h.dwSampleSize=sha->audio.dwSampleSize; + priv->m_audio->h.dwScale=sha->audio.dwScale; + priv->m_audio->h.dwRate=sha->audio.dwRate; + } else { + priv->m_audio->h.dwSampleSize=priv->m_audio->wf->nBlockAlign; + priv->m_audio->h.dwScale=priv->m_audio->h.dwSampleSize; + priv->m_audio->h.dwRate=priv->m_audio->wf->nAvgBytesPerSec; + } + } else priv->m_audio=NULL; + if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) { + priv->m_video=muxer_new_stream(priv->muxer,MUXER_TYPE_VIDEO); + priv->m_video->buffer_size=0x200000; // 2MB + priv->m_video->source=shv; + priv->m_video->h.dwSampleSize=0; // VBR + priv->m_video->h.dwScale=10000; + priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; + priv->m_video->h.dwSuggestedBufferSize=shv->video.dwSuggestedBufferSize; + if(!shv->bih) { + shv->bih=mp_malloc(sizeof(BITMAPINFOHEADER)); + shv->bih->biSize=sizeof(BITMAPINFOHEADER); + shv->bih->biWidth=shv->src_w; + shv->bih->biHeight=shv->src_h; + shv->bih->biCompression=shv->fourcc; + shv->bih->biPlanes=1; + shv->bih->biBitCount=24; // FIXME!!! + shv->bih->biSizeImage=shv->bih->biWidth*shv->bih->biHeight*(shv->bih->biBitCount/8); + } + priv->m_video->bih=mp_malloc(shv->bih->biSize); + memcpy(priv->m_video->bih,shv->bih,shv->bih->biSize); + priv->m_video->ImageDesc=shv->ImageDesc; + priv->m_video->aspect=shv->aspect; + priv->m_video->codec=0; + } else priv->m_video=NULL; + if(demuxer->sub->sh && (priv->mux_type&MUX_HAVE_SUBS)) { + priv->m_subs=muxer_new_stream(priv->muxer,MUXER_TYPE_SUBS); + priv->m_subs->buffer_size=0x100000; //16384; + priv->m_subs->source=NULL; + priv->m_subs->codec=0; + } else priv->m_subs=NULL; + MSG_DBG2("Opening dump: %X\n",demuxer); + MSG_INFO("Dumping stream to %s\n",stream_dump_name); + muxer_fix_parameters(priv->muxer); + muxer_write_header(priv->muxer,demuxer); } void dump_mux_close(demuxer_t *demuxer) @@ -371,7 +356,7 @@ The ideal case is: type=read_packet(ANY_TYPE); put_packet(type); */ in_size=ds_get_packet_r(sha->ds,&start,&a_pts); - cmd = check_cmd(); + cmd = check_cmd(priv); if(cmd == -1) goto done; else a_duration=(float)in_size/(float)(sha->i_bps); @@ -406,7 +391,7 @@ { float v_pts; in_size=video_read_frame(shv,&frame_time,&v_pts,&start,0); - cmd = check_cmd(); + cmd = check_cmd(priv); if(cmd == -1) goto done; else if(mpeg_vtimer==HUGE) mpeg_vtimer=v_pts; @@ -438,7 +423,7 @@ in_size=ds_get_packet_r(demuxer->sub,&start,&s_pts); seof=demuxer->sub->eof; if(seof) break; - cmd = check_cmd(); + cmd = check_cmd(priv); if(cmd == -1) goto done; else MSG_V("Got sub frame: %f\n",s_pts); Modified: mplayerxp/dump.h =================================================================== --- mplayerxp/dump.h 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/dump.h 2012-11-10 10:58:25 UTC (rev 315) @@ -8,7 +8,7 @@ extern int dump_parse(const char *param); extern void dump_stream(stream_t *stream); -extern void dump_mux_init(demuxer_t *demuxer); +extern void dump_mux_init(demuxer_t *demuxer,any_t*libinput); extern void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames); extern void dump_mux_close(demuxer_t *demuxer); extern void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp); Modified: mplayerxp/input/input.c =================================================================== --- mplayerxp/input/input.c 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/input/input.c 2012-11-10 10:58:25 UTC (rev 315) @@ -37,6 +37,72 @@ #include "in_msg.h" +#ifndef MP_MAX_KEY_FD +#define MP_MAX_KEY_FD 10 +#endif + +#ifndef MP_MAX_CMD_FD +#define MP_MAX_CMD_FD 10 +#endif + +#define MP_FD_EOF (1<<0) +#define MP_FD_DROP (1<<1) +#define MP_FD_DEAD (1<<2) +#define MP_FD_GOT_CMD (1<<3) +#define MP_FD_NO_SELECT (1<<4) + +#define CMD_QUEUE_SIZE 100 + +typedef struct mp_input_fd { + int fd; + any_t* read_func; + mp_close_func_t close_func; + int flags; + // This fields are for the cmd fds + char* buffer; + int pos,size; +} mp_input_fd_t; + +typedef struct mp_cmd_filter_st mp_cmd_filter_t; + +struct mp_cmd_filter_st { + mp_input_cmd_filter filter; + any_t* ctx; + mp_cmd_filter_t* next; +}; + +typedef struct priv_s { + // These are the user defined binds + mp_cmd_bind_t* cmd_binds; + mp_cmd_filter_t* cmd_filters; + + mp_input_fd_t key_fds[MP_MAX_KEY_FD]; + unsigned int num_key_fd; + mp_input_fd_t cmd_fds[MP_MAX_CMD_FD]; + unsigned int num_cmd_fd; + mp_cmd_t* cmd_queue[CMD_QUEUE_SIZE]; + unsigned int cmd_queue_length,cmd_queue_start,cmd_queue_end; + // this is the key currently down + int key_down[MP_MAX_KEY_DOWN]; + unsigned int num_key_down,last_key_down; + // Autorepeat stuff + short ar_state; + mp_cmd_t* ar_cmd; + unsigned int last_ar; + + int in_file_fd; + char key_str[12]; + int joystick_fd; +}priv_t; + +typedef struct input_conf_s { + int use_joystick,use_lirc,use_lircc; + unsigned ar_delay,ar_rate; + const char* js_dev; + const char* in_file; +}input_conf_t; +static input_conf_t libinput_conf = { 1, 1, 1, 100, 8, "/dev/input/js0", NULL }; + /// This array defines all know commands. /// The first field is an id used to recognize the command without too many strcmp /// The second is abviously the command name @@ -332,79 +398,18 @@ { { 0 }, NULL } }; +static char* config_file = "input.conf"; -#ifndef MP_MAX_KEY_FD -#define MP_MAX_KEY_FD 10 -#endif - -#ifndef MP_MAX_CMD_FD -#define MP_MAX_CMD_FD 10 -#endif - -#define MP_FD_EOF (1<<0) -#define MP_FD_DROP (1<<1) -#define MP_FD_DEAD (1<<2) -#define MP_FD_GOT_CMD (1<<3) -#define MP_FD_NO_SELECT (1<<4) - -#define CMD_QUEUE_SIZE 100 - -typedef struct mp_input_fd { - int fd; - any_t* read_func; - mp_close_func_t close_func; - int flags; - // This fields are for the cmd fds - char* buffer; - int pos,size; -} mp_input_fd_t; - -typedef struct mp_cmd_filter_st mp_cmd_filter_t; - -struct mp_cmd_filter_st { - mp_input_cmd_filter filter; - any_t* ctx; - mp_cmd_filter_t* next; -}; - -// These are the user defined binds -static mp_cmd_bind_t* cmd_binds = NULL; -static mp_cmd_filter_t* cmd_filters = NULL; - // Callback to allow the menu filter to grab the incoming keys void (*mp_input_key_cb)(int code) = NULL; -static mp_input_fd_t key_fds[MP_MAX_KEY_FD]; -static unsigned int num_key_fd = 0; -static mp_input_fd_t cmd_fds[MP_MAX_CMD_FD]; -static unsigned int num_cmd_fd = 0; -static mp_cmd_t* cmd_queue[CMD_QUEUE_SIZE]; -static unsigned int cmd_queue_length = 0,cmd_queue_start = 0, cmd_queue_end = 0; +static int mp_input_print_key_list(any_t*,const config_t* cfg); +static int mp_input_print_cmd_list(any_t*,const config_t* cfg); -// this is the key currently down -static int key_down[MP_MAX_KEY_DOWN]; -static unsigned int num_key_down = 0, last_key_down = 0; - -// Autorepeat stuff -static short ar_state = -1; -static mp_cmd_t* ar_cmd = NULL; -static unsigned int ar_delay = 100, ar_rate = 8, last_ar = 0; - -static int use_joystick = 1, use_lirc = 1, use_lircc = 1; -static char* config_file = "input.conf"; - -static const char* js_dev = "/dev/input/js0"; - -static const char* in_file = NULL; -static int in_file_fd = -1; - -static int mp_input_print_key_list(const config_t* cfg); -static int mp_input_print_cmd_list(const config_t* cfg); - static const config_t joystick_conf[] = { - { "on", &use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of joystick" }, - { "off", &use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of joystick" }, - { "dev", &js_dev, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies the joystick device" }, + { "on", &libinput_conf.use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of joystick" }, + { "off", &libinput_conf.use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of joystick" }, + { "dev", &libinput_conf.js_dev, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies the joystick device" }, { NULL, NULL, 0, 0, 0, 0, NULL} }; @@ -412,18 +417,18 @@ // Our command line options static const config_t input_conf[] = { { "conf", &config_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies alternative input.conf" }, - { "ar-delay", &ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "autorepeate a key delay in milliseconds (0 to disable)" }, - { "ar-rate", &ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "number of key-presses per second generating on autorepeat" }, + { "ar-delay", &libinput_conf.ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "autorepeate a key delay in milliseconds (0 to disable)" }, + { "ar-rate", &libinput_conf.ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "number of key-presses per second generating on autorepeat" }, { "keylist", mp_input_print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, "prints all keys that can be bound to commands" }, { "cmdlist", mp_input_print_cmd_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, "prints all commands that can be bound to keys" }, - { "file", &in_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifes file with commands (useful for FIFO)" }, + { "file", &libinput_conf.in_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifes file with commands (useful for FIFO)" }, #ifdef HAVE_LIRC { "lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies a config.file for LIRC"}, #endif - { "lirc", &use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of lirc" }, - { "nolirc", &use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of lirc" }, - { "lircc", &use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of lirc daemon" }, - { "nolircc", &use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of lirc daemon" }, + { "lirc", &libinput_conf.use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of lirc" }, + { "nolirc", &libinput_conf.use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of lirc" }, + { "lircc", &libinput_conf.use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of lirc daemon" }, + { "nolircc", &libinput_conf.use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of lirc daemon" }, { "joystick", &joystick_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Joystick related options" }, { NULL, NULL, 0, 0, 0, 0, NULL} }; @@ -435,61 +440,65 @@ static int mp_input_default_key_func(int fd); static int mp_input_default_cmd_func(int fd,char* buf, int l); -static char* mp_input_get_key_name(int key); +static char* mp_input_get_key_name(any_t*,int key); -MPXP_Rc mp_input_add_cmd_fd(int fd, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { - if(num_cmd_fd == MP_MAX_CMD_FD) { +MPXP_Rc mp_input_add_cmd_fd(any_t* handle,int fd, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { + priv_t* priv = (priv_t*)handle; + if(priv->num_cmd_fd == MP_MAX_CMD_FD) { MSG_ERR("Too much command fd, unable to register fd %d\n",fd); return MPXP_False; } - memset(&cmd_fds[num_cmd_fd],0,sizeof(mp_input_fd_t)); - cmd_fds[num_cmd_fd].fd = fd; - cmd_fds[num_cmd_fd].read_func = read_func ? read_func : mp_input_default_cmd_func; - cmd_fds[num_cmd_fd].close_func = close_func; - if(!sel) cmd_fds[num_cmd_fd].flags = MP_FD_NO_SELECT; - num_cmd_fd++; + memset(&priv->cmd_fds[priv->num_cmd_fd],0,sizeof(mp_input_fd_t)); + priv->cmd_fds[priv->num_cmd_fd].fd = fd; + priv->cmd_fds[priv->num_cmd_fd].read_func = read_func ? read_func : mp_input_default_cmd_func; + priv->cmd_fds[priv->num_cmd_fd].close_func = close_func; + if(!sel) priv->cmd_fds[priv->num_cmd_fd].flags = MP_FD_NO_SELECT; + priv->num_cmd_fd++; return MPXP_Ok; } -void mp_input_rm_cmd_fd(int fd) { +void mp_input_rm_cmd_fd(any_t* handle,int fd) { + priv_t* priv = (priv_t*)handle; unsigned int i; - for(i = 0; i < num_cmd_fd; i++) { - if(cmd_fds[i].fd == fd) break; + for(i = 0; i < priv->num_cmd_fd; i++) { + if(priv->cmd_fds[i].fd == fd) break; } - if(i == num_cmd_fd) return; - if(cmd_fds[i].close_func) cmd_fds[i].close_func(cmd_fds[i].fd); - if(cmd_fds[i].buffer) mp_free(cmd_fds[i].buffer); - if(i + 1 < num_cmd_fd) memmove(&cmd_fds[i],&cmd_fds[i+1],(num_cmd_fd - i - 1)*sizeof(mp_input_fd_t)); - num_cmd_fd--; + if(i == priv->num_cmd_fd) return; + if(priv->cmd_fds[i].close_func) priv->cmd_fds[i].close_func(priv->cmd_fds[i].fd); + if(priv->cmd_fds[i].buffer) mp_free(priv->cmd_fds[i].buffer); + if(i + 1 < priv->num_cmd_fd) memmove(&priv->cmd_fds[i],&priv->cmd_fds[i+1],(priv->num_cmd_fd - i - 1)*sizeof(mp_input_fd_t)); + priv->num_cmd_fd--; } -void mp_input_rm_key_fd(int fd) { +void mp_input_rm_key_fd(any_t* handle,int fd) { + priv_t* priv = (priv_t*)handle; unsigned int i; - for(i = 0; i < num_key_fd; i++) { - if(key_fds[i].fd == fd) break; + for(i = 0; i < priv->num_key_fd; i++) { + if(priv->key_fds[i].fd == fd) break; } - if(i == num_key_fd) return; - if(key_fds[i].close_func) key_fds[i].close_func(key_fds[i].fd); - if(i + 1 < num_key_fd) memmove(&key_fds[i],&key_fds[i+1],(num_key_fd - i - 1)*sizeof(mp_input_fd_t)); - num_key_fd--; + if(i == priv->num_key_fd) return; + if(priv->key_fds[i].close_func) priv->key_fds[i].close_func(priv->key_fds[i].fd); + if(i + 1 < priv->num_key_fd) memmove(&priv->key_fds[i],&priv->key_fds[i+1],(priv->num_key_fd - i - 1)*sizeof(mp_input_fd_t)); + priv->num_key_fd--; } -MPXP_Rc mp_input_add_key_fd(int fd, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { - if(num_key_fd == MP_MAX_KEY_FD) { +MPXP_Rc mp_input_add_key_fd(any_t* handle,int fd, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { + priv_t* priv = (priv_t*)handle; + if(priv->num_key_fd == MP_MAX_KEY_FD) { MSG_ERR("Too much key fd, unable to register fd %d\n",fd); return MPXP_False; } - memset(&key_fds[num_key_fd],0,sizeof(mp_input_fd_t)); - key_fds[num_key_fd].fd = fd; - key_fds[num_key_fd].read_func = read_func ? read_func : mp_input_default_key_func; - key_fds[num_key_fd].close_func = close_func; - if(!sel) key_fds[num_key_fd].flags |= MP_FD_NO_SELECT; - num_key_fd++; + memset(&priv->key_fds[priv->num_key_fd],0,sizeof(mp_input_fd_t)); + priv->key_fds[priv->num_key_fd].fd = fd; + priv->key_fds[priv->num_key_fd].read_func = read_func ? read_func : mp_input_default_key_func; + priv->key_fds[priv->num_key_fd].close_func = close_func; + if(!sel) priv->key_fds[priv->num_key_fd].flags |= MP_FD_NO_SELECT; + priv->num_key_fd++; return MPXP_Ok; } @@ -700,16 +709,16 @@ } } -void mp_input_add_cmd_filter(mp_input_cmd_filter func, any_t* ctx) { +void mp_input_add_cmd_filter(any_t* handle,mp_input_cmd_filter func, any_t* ctx) { + priv_t* priv = (priv_t*)handle; mp_cmd_filter_t* filter = mp_malloc(sizeof(mp_cmd_filter_t))/*, *prev*/; filter->filter = func; filter->ctx = ctx; - filter->next = cmd_filters; - cmd_filters = filter; + filter->next = priv->cmd_filters; + priv->cmd_filters = filter; } - static char* mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) { int j; @@ -731,34 +740,37 @@ return binds[j].cmd; } -static mp_cmd_t* mp_input_get_cmd_from_keys(int n,int* keys, int paused) { +static mp_cmd_t* mp_input_get_cmd_from_keys(any_t* handle,int n,int* keys, int paused) { + priv_t* priv = (priv_t*)handle; char* cmd = NULL; mp_cmd_t* ret; - if(cmd_binds) cmd = mp_input_find_bind_for_key(cmd_binds,n,keys); - if(cmd == NULL) cmd = mp_input_find_bind_for_key(def_cmd_binds,n,keys); + UNUSED(paused); + if(priv->cmd_binds) cmd = mp_input_find_bind_for_key(priv->cmd_binds,n,keys); + if(cmd == NULL) cmd = mp_input_find_bind_for_key(def_cmd_binds,n,keys); if(cmd == NULL) { - MSG_WARN("No bind found for key %s",mp_input_get_key_name(keys[0])); + MSG_WARN("No bind found for key %s",mp_input_get_key_name(priv,keys[0])); if(n > 1) { int s; - for(s=1; s < n; s++) MSG_WARN("-%s",mp_input_get_key_name(keys[s])); + for(s=1; s < n; s++) MSG_WARN("-%s",mp_input_get_key_name(priv,keys[s])); } MSG_WARN(" \n"); return NULL; } ret = mp_input_parse_cmd(cmd); if(!ret) { - MSG_ERR("Invalid command for binded key %s",mp_input_get_key_name(key_down[0])); - if( num_key_down > 1) { + MSG_ERR("Invalid command for binded key %s",mp_input_get_key_name(priv,priv->key_down[0])); + if(priv->num_key_down > 1) { unsigned int s; - for(s=1; s < num_key_down; s++) MSG_ERR("-%s",mp_input_get_key_name(key_down[s])); + for(s=1; s < priv->num_key_down; s++) MSG_ERR("-%s",mp_input_get_key_name(priv,priv->key_down[s])); } MSG_ERR(" : %s \n",cmd); } return ret; } -int mp_input_read_key_code(int tim) { +static int mp_input_read_key_code(any_t* handle,int tim) { + priv_t* priv = (priv_t*)handle; #ifndef HAVE_NO_POSIX_SELECT fd_set fds; struct timeval tv,*time_val; @@ -766,27 +778,27 @@ int i,n=0,max_fd = 0; static int last_loop = 0; - if(num_key_fd == 0) return MP_INPUT_NOTHING; + if(priv->num_key_fd == 0) return MP_INPUT_NOTHING; #ifndef HAVE_NO_POSIX_SELECT FD_ZERO(&fds); #endif // Remove fd marked as dead and build the fd_set // n == number of fd's to be select() checked - for(i = 0; (unsigned int)i < num_key_fd; i++) { - if( (key_fds[i].flags & MP_FD_DEAD) ) { - mp_input_rm_key_fd(key_fds[i].fd); + for(i = 0; (unsigned int)i < priv->num_key_fd; i++) { + if( (priv->key_fds[i].flags & MP_FD_DEAD) ) { + mp_input_rm_key_fd(priv,priv->key_fds[i].fd); i--; continue; - } else if(key_fds[i].flags & MP_FD_NO_SELECT) continue; - if(key_fds[i].fd > max_fd) max_fd = key_fds[i].fd; + } else if(priv->key_fds[i].flags & MP_FD_NO_SELECT) continue; + if(priv->key_fds[i].fd > max_fd) max_fd = priv->key_fds[i].fd; #ifndef HAVE_NO_POSIX_SELECT - FD_SET(key_fds[i].fd,&fds); + FD_SET(priv->key_fds[i].fd,&fds); #endif n++; } - if(num_key_fd == 0) return MP_INPUT_NOTHING; + if(priv->num_key_fd == 0) return MP_INPUT_NOTHING; #ifndef HAVE_NO_POSIX_SELECT // if we have fd's without MP_FD_NO_SELECT flag, call select(): if(n>0){ @@ -807,39 +819,40 @@ for(i = last_loop + 1 ; i != last_loop ; i++) { int code = -1; // This is to check all fd in turn - if((unsigned int)i >= num_key_fd) { + if((unsigned int)i >= priv->num_key_fd) { i = -1; last_loop++; - last_loop %= (num_key_fd+1); + last_loop %= (priv->num_key_fd+1); continue; } #ifndef HAVE_NO_POSIX_SELECT // No input from this fd - if(! (key_fds[i].flags & MP_FD_NO_SELECT) && ! FD_ISSET(key_fds[i].fd,&fds)) + if(! (priv->key_fds[i].flags & MP_FD_NO_SELECT) && ! FD_ISSET(priv->key_fds[i].fd,&fds)) continue; #endif - if(key_fds[i].fd == 0) { // stdin is handled by getch2 + if(priv->key_fds[i].fd == 0) { // stdin is handled by getch2 code = getch2(tim); if(code < 0) code = MP_INPUT_NOTHING; - } else code = ((mp_key_func_t)key_fds[i].read_func)(key_fds[i].fd); + } else code = ((mp_key_func_t)priv->key_fds[i].read_func)(priv->key_fds[i].fd); if(code >= 0) return code; - if(code == MP_INPUT_ERROR) MSG_ERR("Error on key input fd %d\n",key_fds[i].fd); + if(code == MP_INPUT_ERROR) MSG_ERR("Error on key input fd %d\n",priv->key_fds[i].fd); else if(code == MP_INPUT_DEAD) { - MSG_ERR("Dead key input on fd %d\n",key_fds[i].fd); - key_fds[i].flags |= MP_FD_DEAD; + MSG_ERR("Dead key input on fd %d\n",priv->key_fds[i].fd); + priv->key_fds[i].flags |= MP_FD_DEAD; } } return MP_INPUT_NOTHING; } -static mp_cmd_t* mp_input_read_keys(int tim,int paused) { - int code = mp_input_read_key_code(tim); +static mp_cmd_t* mp_input_read_keys(any_t*handle,int tim,int paused) { + priv_t* priv = (priv_t*)handle; + int code = mp_input_read_key_code(priv,tim); unsigned int j; mp_cmd_t* ret; if(mp_input_key_cb) { - for( ; code >= 0 ; code = mp_input_read_key_code(0) ) { + for( ; code >= 0 ; code = mp_input_read_key_code(priv,0) ) { if(code & MP_KEY_DOWN) continue; code &= ~(MP_KEY_DOWN|MP_NO_REPEAT_KEY); mp_input_key_cb(code); @@ -847,78 +860,79 @@ return NULL; } - for( ; code >= 0 ; code = mp_input_read_key_code(0) ) { + for( ; code >= 0 ; code = mp_input_read_key_code(priv,0) ) { // key pushed if(code & MP_KEY_DOWN) { - if(num_key_down > MP_MAX_KEY_DOWN) { + if(priv->num_key_down > MP_MAX_KEY_DOWN) { MSG_ERR("Too much key down at the same time\n"); continue; } code &= ~MP_KEY_DOWN; // Check if we don't already have this key as pushed - for(j = 0; j < num_key_down; j++) { - if(key_down[j] == code) + for(j = 0; j < priv->num_key_down; j++) { + if(priv->key_down[j] == code) break; } - if(j != num_key_down) continue; - key_down[num_key_down] = code; - num_key_down++; - last_key_down = GetTimer(); - ar_state = 0; + if(j != priv->num_key_down) continue; + priv->key_down[priv->num_key_down] = code; + priv->num_key_down++; + priv->last_key_down = GetTimer(); + priv->ar_state = 0; continue; } // key released // Check if the key is in the down key, driver which can't send push event // send only release event - for(j = 0; j < num_key_down; j++) { - if(key_down[j] == code) break; + for(j = 0; j < priv->num_key_down; j++) { + if(priv->key_down[j] == code) break; } - if(j == num_key_down) { // key was not in the down keys : add it - if(num_key_down > MP_MAX_KEY_DOWN) { + if(j == priv->num_key_down) { // key was not in the down keys : add it + if(priv->num_key_down > MP_MAX_KEY_DOWN) { MSG_ERR("Too much key down at the same time\n"); continue; } - key_down[num_key_down] = code; - num_key_down++; - last_key_down = 1; + priv->key_down[priv->num_key_down] = code; + priv->num_key_down++; + priv->last_key_down = 1; } // We ignore key from last combination - ret = last_key_down ? mp_input_get_cmd_from_keys(num_key_down,key_down,paused) : NULL; + ret = priv->last_key_down ? mp_input_get_cmd_from_keys(priv,priv->num_key_down,priv->key_down,paused) : NULL; // Remove the key - if(j+1 < num_key_down) memmove(&key_down[j],&key_down[j+1],(num_key_down-(j+1))*sizeof(int)); - num_key_down--; - last_key_down = 0; - ar_state = -1; - if(ar_cmd) { - mp_cmd_free(ar_cmd); - ar_cmd = NULL; + if(j+1 < priv->num_key_down) memmove(&priv->key_down[j],&priv->key_down[j+1],(priv->num_key_down-(j+1))*sizeof(int)); + priv->num_key_down--; + priv->last_key_down = 0; + priv->ar_state = -1; + if(priv->ar_cmd) { + mp_cmd_free(priv->ar_cmd); + priv->ar_cmd = NULL; } if(ret) return ret; } // No input : autorepeat ? - if(ar_rate > 0 && ar_state >=0 && num_key_down > 0 && ! (key_down[num_key_down-1] & MP_NO_REPEAT_KEY)) { + if(libinput_conf.ar_rate > 0 && priv->ar_state >=0 && priv->num_key_down > 0 && !(priv->key_down[priv->num_key_down-1]&MP_NO_REPEAT_KEY)) { unsigned int t = GetTimer(); // First time : wait delay - if(ar_state == 0 && (t - last_key_down) >= ar_delay*1000) { - ar_cmd = mp_input_get_cmd_from_keys(num_key_down,key_down,paused); - if(!ar_cmd) { - ar_state = -1; + if(priv->ar_state == 0 && (t - priv->last_key_down) >= libinput_conf.ar_delay*1000) { + priv->ar_cmd = mp_input_get_cmd_from_keys(priv,priv->num_key_down,priv->key_down,paused); + if(!priv->ar_cmd) { + priv->ar_state = -1; return NULL; } - ar_state = 1; - last_ar = t; - return mp_cmd_clone(ar_cmd); + priv->ar_state = 1; + priv->last_ar = t; + return mp_cmd_clone(priv->ar_cmd); // Then send rate / sec event - } else if(ar_state == 1 && (t -last_ar) >= 1000000/ar_rate) { - last_ar = t; - return mp_cmd_clone(ar_cmd); + } else if(priv->ar_state == 1 && (t -priv->last_ar) >= 1000000/libinput_conf.ar_rate) { + priv->last_ar = t; + return mp_cmd_clone(priv->ar_cmd); } } return NULL; } -static mp_cmd_t* mp_input_read_cmds(int tim) { +static mp_cmd_t* mp_input_read_cmds(any_t* handle,int tim) { + priv_t* priv = (priv_t*)handle; #ifndef HAVE_NO_POSIX_SELECT fd_set fds; struct timeval tv,*time_val; @@ -927,25 +941,25 @@ mp_cmd_t* ret; static int last_loop = 0; - if(num_cmd_fd == 0) return NULL; + if(priv->num_cmd_fd == 0) return NULL; #ifndef HAVE_NO_POSIX_SELECT FD_ZERO(&fds); #endif - for(i = 0; (unsigned int)i < num_cmd_fd ; i++) { - if( (cmd_fds[i].flags & MP_FD_DEAD) || (cmd_fds[i].flags & MP_FD_EOF) ) { - mp_input_rm_cmd_fd(cmd_fds[i].fd); + for(i = 0; (unsigned int)i < priv->num_cmd_fd ; i++) { + if( (priv->cmd_fds[i].flags & MP_FD_DEAD) || (priv->cmd_fds[i].flags & MP_FD_EOF) ) { + mp_input_rm_cmd_fd(priv,priv->cmd_fds[i].fd); i--; continue; - } else if(cmd_fds[i].flags & MP_FD_NO_SELECT) continue; - if(cmd_fds[i].flags & MP_FD_GOT_CMD) got_cmd = 1; - if(cmd_fds[i].fd > max_fd) max_fd = cmd_fds[i].fd; + } else if(priv->cmd_fds[i].flags & MP_FD_NO_SELECT) continue; + if(priv->cmd_fds[i].flags & MP_FD_GOT_CMD) got_cmd = 1; + if(priv->cmd_fds[i].fd > max_fd) max_fd = priv->cmd_fds[i].fd; #ifndef HAVE_NO_POSIX_SELECT - FD_SET(cmd_fds[i].fd,&fds); + FD_SET(priv->cmd_fds[i].fd,&fds); #endif n++; } - if(num_cmd_fd == 0) return NULL; + if(priv->num_cmd_fd == 0) return NULL; #ifndef HAVE_NO_POSIX_SELECT if(tim >= 0) { tv.tv_sec=tim/1000; @@ -966,20 +980,20 @@ for(i = last_loop + 1; i != last_loop ; i++) { int r = 0; char* cmd; - if((unsigned int)i >= num_cmd_fd) { + if((unsigned int)i >= priv->num_cmd_fd) { i = -1; last_loop++; - last_loop %= (num_cmd_fd+1); + last_loop %= (priv->num_cmd_fd+1); continue; } #ifndef HAVE_NO_POSIX_SELECT - if( ! (cmd_fds[i].flags & MP_FD_NO_SELECT) && ! FD_ISSET(cmd_fds[i].fd,&fds) && ! (cmd_fds[i].flags & MP_FD_GOT_CMD) ) + if(!(priv->cmd_fds[i].flags&MP_FD_NO_SELECT) && !FD_ISSET(priv->cmd_fds[i].fd,&fds) && !(priv->cmd_fds[i].flags & MP_FD_GOT_CMD)) continue; #endif - r = mp_input_read_cmd(&cmd_fds[i],&cmd); + r = mp_input_read_cmd(&priv->cmd_fds[i],&cmd); if(r < 0) { - if(r == MP_INPUT_ERROR) MSG_ERR("Error on cmd fd %d\n",cmd_fds[i].fd); - else if(r == MP_INPUT_DEAD) cmd_fds[i].flags |= MP_FD_DEAD; + if(r == MP_INPUT_ERROR) MSG_ERR("Error on cmd fd %d\n",priv->cmd_fds[i].fd); + else if(r == MP_INPUT_DEAD) priv->cmd_fds[i].flags |= MP_FD_DEAD; continue; } ret = mp_input_parse_cmd(cmd); @@ -992,24 +1006,26 @@ return NULL; } -MPXP_Rc mp_input_queue_cmd(mp_cmd_t* cmd) { - if(cmd_queue_length >= CMD_QUEUE_SIZE) return MPXP_False; - cmd_queue[cmd_queue_end] = cmd; - cmd_queue_end = (cmd_queue_end + 1) % CMD_QUEUE_SIZE; - cmd_queue_length++; +MPXP_Rc mp_input_queue_cmd(any_t* handle,mp_cmd_t* cmd) { + priv_t* priv = (priv_t*)handle; + if(priv->cmd_queue_length >= CMD_QUEUE_SIZE) return MPXP_False; + priv->cmd_queue[priv->cmd_queue_end] = cmd; + priv->cmd_queue_end = (priv->cmd_queue_end + 1) % CMD_QUEUE_SIZE; + priv->cmd_queue_length++; return MPXP_Ok; } -static mp_cmd_t* mp_input_get_queued_cmd(int peek_only) { +static mp_cmd_t* mp_input_get_queued_cmd(any_t* handle,int peek_only) { + priv_t* priv = (priv_t*)handle; mp_cmd_t* ret; - if(cmd_queue_length == 0) return NULL; + if(priv->cmd_queue_length == 0) return NULL; - ret = cmd_queue[cmd_queue_start]; + ret = priv->cmd_queue[priv->cmd_queue_start]; if (!peek_only) { - cmd_queue_length--; - cmd_queue_start = (cmd_queue_start + 1) % CMD_QUEUE_SIZE; + priv->cmd_queue_length--; + priv->cmd_queue_start = (priv->cmd_queue_start + 1) % CMD_QUEUE_SIZE; } return ret; } @@ -1018,29 +1034,30 @@ * \param peek_only when set, the returned command stays in the queue. * Do not mp_free the returned cmd whe you set this! */ -mp_cmd_t* mp_input_get_cmd(int tim, int paused, int peek_only) { +mp_cmd_t* mp_input_get_cmd(any_t*handle,int tim, int paused, int peek_only) { + priv_t* priv = (priv_t*)handle; mp_cmd_t* ret = NULL; mp_cmd_filter_t* cf; int from_queue; while(1) { from_queue = 1; - ret = mp_input_get_queued_cmd(peek_only); + ret = mp_input_get_queued_cmd(priv,peek_only); if(ret) break; from_queue = 0; - ret = mp_input_read_keys(tim,paused); + ret = mp_input_read_keys(priv,tim,paused); if(ret) break; - ret = mp_input_read_cmds(tim); + ret = mp_input_read_cmds(priv,tim); break; } if(!ret) return NULL; - for(cf = cmd_filters ; cf ; cf = cf->next) { + for(cf = priv->cmd_filters ; cf ; cf = cf->next) { if(cf->filter(ret,paused,cf->ctx)) return NULL; } - if (!from_queue && peek_only) mp_input_queue_cmd(ret); + if (!from_queue && peek_only) mp_input_queue_cmd(priv,ret); return ret; } @@ -1078,23 +1095,22 @@ return ret; } -static char key_str[12]; +static char* mp_input_get_key_name(any_t* handle,int key) { + priv_t* priv = (priv_t*)handle; + unsigned i; -static char* mp_input_get_key_name(int key) { - int i; - for(i = 0; key_names[i].name != NULL; i++) { if(key_names[i].key == key) return key_names[i].name; } if(isascii(key)) { - snprintf(key_str,12,"%c",(char)key); - return key_str; + snprintf(priv->key_str,12,"%c",(char)key); + return priv->key_str; } // Print the hex key code - snprintf(key_str,12,"%#-8x",key); - return key_str; + snprintf(priv->key_str,12,"%#-8x",key); + return priv->key_str; } static int mp_input_get_key_from_name(char* name) { @@ -1132,7 +1148,8 @@ return 1; } -void mp_input_bind_keys(int keys[MP_MAX_KEY_DOWN+1], char* cmd) { +static void mp_input_bind_keys(any_t* handle,int keys[MP_MAX_KEY_DOWN+1], char* cmd) { + priv_t* priv = (priv_t*)handle; int i = 0,j; mp_cmd_bind_t* _bind = NULL; @@ -1141,20 +1158,20 @@ assert(cmd != NULL); #endif - if(cmd_binds) { - for(i = 0; cmd_binds[i].cmd != NULL ; i++) { - for(j = 0 ; cmd_binds[i].input[j] == keys[j] && keys[j] != 0 ; j++) /* NOTHING */; - if(keys[j] == 0 && cmd_binds[i].input[j] == 0 ) { - _bind = &cmd_binds[i]; + if(priv->cmd_binds) { + for(i = 0; priv->cmd_binds[i].cmd != NULL ; i++) { + for(j = 0 ; priv->cmd_binds[i].input[j] == keys[j] && keys[j] != 0 ; j++) /* NOTHING */; + if(keys[j] == 0 && priv->cmd_binds[i].input[j] == 0 ) { + _bind = &priv->cmd_binds[i]; break; } } } if(!_bind) { - cmd_binds = (mp_cmd_bind_t*)mp_realloc(cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); - memset(&cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); - _bind = &cmd_binds[i]; + priv->cmd_binds = (mp_cmd_bind_t*)mp_realloc(priv->cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); + memset(&priv->cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); + _bind = &priv->cmd_binds[i]; } if(_bind->cmd) mp_free(_bind->cmd); _bind->cmd = mp_strdup(cmd); @@ -1171,7 +1188,8 @@ #define BS_MAX 256 #define SPACE_CHAR " \n\r\t" -static int mp_input_parse_config(char *file) { +static int mp_input_parse_config(any_t* handle,char *file) { + priv_t* priv = (priv_t*)handle; int fd; int bs = 0,r,eof = 0,comments = 0; char *iter,*end; @@ -1208,7 +1226,7 @@ // Empty buffer : return if(bs <= 1) { MSG_INFO("Input config file %s parsed : %d binds\n",file,n_binds); - if(binds) cmd_binds = binds; + if(binds) priv->cmd_binds = binds; close(fd); return 1; } @@ -1268,8 +1286,8 @@ // Found new line if(iter[0] == '\n' || iter[0] == '\r') { int i; - MSG_ERR("No command found for key %s" ,mp_input_get_key_name(keys[0])); - for(i = 1; keys[i] != 0 ; i++) MSG_ERR("-%s",mp_input_get_key_name(keys[i])); + MSG_ERR("No command found for key %s" ,mp_input_get_key_name(priv,keys[0])); + for(i = 1; keys[i] != 0 ; i++) MSG_ERR("-%s",mp_input_get_key_name(priv,keys[i])); MSG_ERR("\n"); keys[0] = 0; if(iter > buffer) { @@ -1294,7 +1312,7 @@ strncpy(cmd,iter,end-iter); cmd[end-iter] = '\0'; //printf("Set bind %d => %s\n",keys[0],cmd); - mp_input_bind_keys(keys,cmd); + mp_input_bind_keys(priv,keys,cmd); n_binds++; keys[0] = 0; end++; @@ -1309,102 +1327,120 @@ return 0; } -void mp_input_init(void) { +static void mp_input_init(any_t* handle) { + priv_t* priv = (priv_t*)handle; char* file; file = config_file[0] != '/' ? get_path(config_file) : config_file; if(!file) return; - if(! mp_input_parse_config(file)) { + if(! mp_input_parse_config(handle,file)) { // Try global conf dir file = CONFDIR "/input.conf"; - if(! mp_input_parse_config(file)) MSG_WARN("Falling back on default (hardcoded) input config\n"); + if(! mp_input_parse_config(handle,file)) MSG_WARN("Falling back on default (hardcoded) input config\n"); } #ifdef HAVE_JOYSTICK - if(use_joystick) { - int fd = mp_input_joystick_init(js_dev); - if(fd < 0) MSG_ERR("Can't init input joystick with using: %s\n",js_dev); - else mp_input_add_key_fd(fd,1,mp_input_joystick_read,(mp_close_func_t)close); + if(libinput_conf.use_joystick) { + priv->joystick_fd = mp_input_joystick_init(libinput_conf.js_dev); + if(priv->joystick_fd<=0) MSG_ERR("Can't init input joystick with using: %s\n",libinput_conf.js_dev); + else mp_input_add_key_fd(priv,priv->joystick_fd,1,mp_input_joystick_read,(mp_close_func_t)close); } #endif #ifdef HAVE_LIRC - if(use_lirc) { + if(libinput_conf.use_lirc) { int fd = mp_input_lirc_init(); if(fd > 0) mp_input_add_cmd_fd(fd,0,mp_input_lirc_read,mp_input_lirc_close); } #endif #ifdef HAVE_LIRCC - if(use_lircc) { + if(libinput_conf.use_lircc) { int fd = lircc_init("mplayer", NULL); if(fd >= 0) mp_input_add_cmd_fd(fd,1,NULL,(mp_close_func_t)lircc_cleanup); } #endif - if(in_file) { + if(libinput_conf.in_file) { struct stat st; - if(stat(in_file,&st)) MSG_ERR("Can't stat %s: %s\n",in_file,strerror(errno)); + if(stat(libinput_conf.in_file,&st)) MSG_ERR("Can't stat %s: %s\n",libinput_conf.in_file,strerror(errno)); else { - in_file_fd = open(in_file,S_ISFIFO(st.st_mode) ? O_RDWR : O_RDONLY); - if(in_file_fd >= 0) mp_input_add_cmd_fd(in_file_fd,1,NULL,(mp_close_func_t)close); - else MSG_ERR("Can't open %s: %s\n",in_file,strerror(errno)); + priv->in_file_fd = open(libinput_conf.in_file,S_ISFIFO(st.st_mode) ? O_RDWR : O_RDONLY); + if(priv->in_file_fd >= 0) mp_input_add_cmd_fd(priv,priv->in_file_fd,1,NULL,(mp_close_func_t)close); + else MSG_ERR("Can't open %s: %s\n",libinput_conf.in_file,strerror(errno)); } } } -void mp_input_uninit(void) { +static void mp_input_uninit(any_t* handle) { + priv_t* priv = (priv_t*)handle; unsigned int i; - for(i=0; i < num_key_fd; i++) { - if(key_fds[i].close_func) key_fds[i].close_func(key_fds[i].fd); + for(i=0; i < priv->num_key_fd; i++) { + if(priv->key_fds[i].close_func) priv->key_fds[i].close_func(priv->key_fds[i].fd); } - for(i=0; i < num_cmd_fd; i++) { - if(cmd_fds[i].close_func) cmd_fds[i].close_func(cmd_fds[i].fd); + for(i=0; i < priv->num_cmd_fd; i++) { + if(priv->cmd_fds[i].close_func) priv->cmd_fds[i].close_func(priv->cmd_fds[i].fd); } - if(cmd_binds) { - unsigned i=0; + if(priv->cmd_binds) { for(i=0;;i++) { - if(cmd_binds[i].cmd != NULL) mp_free(cmd_binds[i].cmd); + if(priv->cmd_binds[i].cmd != NULL) mp_free(priv->cmd_binds[i].cmd); else break; } - mp_free(cmd_binds); - cmd_binds=NULL; + mp_free(priv->cmd_binds); + priv->cmd_binds=NULL; } } +any_t* mp_input_open(void) { + priv_t* priv; + priv=mp_mallocz(sizeof(priv_t)); + priv->ar_state=-1; + priv->in_file_fd=-1; + mp_input_init(priv); + return priv; +} + +void mp_input_close(any_t* handle) { + mp_input_uninit(handle); + mp_free(handle); +} + void mp_input_register_options(m_config_t* cfg) { m_config_register_options(cfg,mp_input_opts); } -void mp_input_print_keys(void) { +void mp_input_print_keys(any_t*handle) { unsigned i; + UNUSED(handle); MSG_INFO("List of available KEYS:\n"); for(i= 0; key_names[i].name != NULL ; i++) MSG_INFO("%s\n",key_names[i].name); } -static int mp_input_print_key_list(const config_t* cfg) { - mp_input_print_keys(); +static int mp_input_print_key_list(any_t*handle,const config_t* cfg) { + UNUSED(cfg); + mp_input_print_keys(handle); exit(0); } -void mp_input_print_binds(void) { +void mp_input_print_binds(any_t*handle) { unsigned i,j; MSG_INFO("List of available key bindings:\n"); for(i=0; def_cmd_binds[i].cmd != NULL ; i++) { for(j=0;def_cmd_binds[i].input[j] != 0;j++) { - MSG_INFO(" %-20s",mp_input_get_key_name(def_cmd_binds[i].input[j])); + MSG_INFO(" %-20s",mp_input_get_key_name(handle,def_cmd_binds[i].input[j])); } MSG_INFO(" %s\n",def_cmd_binds[i].cmd); } } -void mp_input_print_cmds(void) { +void mp_input_print_cmds(any_t*handle) { const mp_cmd_t *cmd; int i,j; char* type; + UNUSED(handle); MSG_INFO("List of available input commands:\n"); for(i = 0; (cmd = &mp_cmds[i])->name != NULL ; i++) { MSG_INFO(" %-20.20s",cmd->name); @@ -1429,14 +1465,16 @@ } } -static int mp_input_print_cmd_list(const config_t* cfg) { - mp_input_print_cmds(); +static int mp_input_print_cmd_list(any_t*handle,const config_t* cfg) { + UNUSED(cfg); + mp_input_print_cmds(handle); exit(0); } -MPXP_Rc mp_input_check_interrupt(int tim) { +MPXP_Rc mp_input_check_interrupt(any_t* handle,int tim) { + priv_t* priv = (priv_t*)handle; mp_cmd_t* cmd; - if((cmd = mp_input_get_cmd(tim,0,1)) == NULL) return 0; + if((cmd = mp_input_get_cmd(handle,tim,0,1)) == NULL) return 0; switch(cmd->id) { case MP_CMD_QUIT: case MP_CMD_SOFT_QUIT: @@ -1447,7 +1485,7 @@ return MPXP_Ok; //<-- memory leaks here } // remove the cmd from the queue - cmd = mp_input_get_cmd(tim,0,0); + cmd = mp_input_get_cmd(priv,tim,0,0); mp_cmd_free(cmd); return MPXP_False; } Modified: mplayerxp/input/input.h =================================================================== --- mplayerxp/input/input.h 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/input/input.h 2012-11-10 10:58:25 UTC (rev 315) @@ -85,9 +85,7 @@ MP_CMD_ARG_STRING =2, MP_CMD_ARG_VOID =3, -#ifndef MP_CMD_MAX_ARGS MP_CMD_MAX_ARGS =10 -#endif }; // Error codes for the drivers @@ -106,33 +104,33 @@ }; typedef union mp_cmd_arg_value { - int i; - float f; - char* s; - any_t* v; + int i; + float f; + char* s; + any_t* v; } mp_cmd_arg_value_t; typedef struct mp_cmd_arg { - int type; - mp_cmd_arg_value_t v; + int type; + mp_cmd_arg_value_t v; } mp_cmd_arg_t; typedef struct mp_cmd { - int id; - char* name; - int nargs; - mp_cmd_arg_t args[MP_CMD_MAX_ARGS]; + int id; + char* name; + int nargs; + mp_cmd_arg_t args[MP_CMD_MAX_ARGS]; } mp_cmd_t; typedef struct mp_cmd_bind { - int input[MP_MAX_KEY_DOWN+1]; - char* cmd; + int input[MP_MAX_KEY_DOWN+1]; + char* cmd; } mp_cmd_bind_t; typedef struct mp_key_name { - int key; - char* name; + int key; + char* name; } mp_key_name_t; // These typedefs are for the drivers. They are the functions used to retrive @@ -152,32 +150,32 @@ // fd will be used. // The last arg can be NULL if nothing is needed to close the driver. The close // function can be used -extern MPXP_Rc mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func); +extern MPXP_Rc mp_input_add_cmd_fd(any_t* handle,int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func); // This remove a cmd driver, you usally don't need to use it -extern void mp_input_rm_cmd_fd(int fd); +extern void mp_input_rm_cmd_fd(any_t* handle,int fd); // The args are the sames as for the keys drivers. If you don't use any valid fd you MUST // give a read_func. -extern MPXP_Rc mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); +extern MPXP_Rc mp_input_add_key_fd(any_t*handle,int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); // As for the cmd one you usally don't need this function -extern void mp_input_rm_key_fd(int fd); +extern void mp_input_rm_key_fd(any_t* handle,int fd); // This function can be used to reput a command in the system. It's used by libmpdemux // when it perform a blocking operation to resend the command it received to the main // loop. -extern MPXP_Rc mp_input_queue_cmd(mp_cmd_t* cmd); +extern MPXP_Rc mp_input_queue_cmd(any_t* handle,mp_cmd_t* cmd); // This function retrive the next avaible command waiting no more than time msec. // If pause is true, the next input will always return a pause command. -extern mp_cmd_t* mp_input_get_cmd(int time, int paused, int peek_only); +extern mp_cmd_t* mp_input_get_cmd(any_t*handle,int time, int paused, int peek_only); extern mp_cmd_t* mp_input_parse_cmd(char* str); /// These filter allow you to process the command before mplayer /// If a filter return a true value mp_input_get_cmd will return NULL -extern void mp_input_add_cmd_filter(mp_input_cmd_filter, any_t* ctx); +extern void mp_input_add_cmd_filter(any_t* handle,mp_input_cmd_filter, any_t* ctx); // After getting a command from mp_input_get_cmd you need to mp_free it using this // function @@ -187,14 +185,13 @@ extern mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd); // When you create a new driver you should add it in this 2 functions. -extern void mp_input_init(void); +extern any_t* mp_input_open(void); +extern void mp_input_close(any_t* handle); -extern void mp_input_uninit(void); - // Interruptible usleep: (used by libmpdemux) -extern MPXP_Rc mp_input_check_interrupt(int time); +extern MPXP_Rc mp_input_check_interrupt(any_t* handle,int time); -extern void mp_input_print_keys(void); -extern void mp_input_print_cmds(void); -extern void mp_input_print_binds(void); +extern void mp_input_print_keys(any_t*handle); +extern void mp_input_print_cmds(any_t*handle); +extern void mp_input_print_binds(any_t*handle); #endif Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-10 10:58:25 UTC (rev 315) @@ -120,10 +120,10 @@ #endif } -MPXP_Rc mpcv_ffmpeg_init(sh_video_t*sh_video) { +MPXP_Rc mpcv_ffmpeg_init(sh_video_t*sh_video,any_t* libinput) { /* Use ffmpeg's drivers as last hope */ mpvdec=mpcv_find_driver_by_name("ffmpeg"); - if(mpvdec->init(sh_video)!=MPXP_Ok){ + if(mpvdec->init(sh_video,libinput)!=MPXP_Ok){ MSG_ERR(MSGTR_CODEC_CANT_INITV); return MPXP_False; } @@ -131,7 +131,7 @@ return MPXP_Ok; } -MPXP_Rc mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status){ +MPXP_Rc mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,any_t*libinput){ sh_video->codec=NULL; MSG_DBG3("mpcv_init(%p, %s, %s, %i)\n",sh_video,codecname,vfm,status); while((sh_video->codec=find_codec(sh_video->fourcc, @@ -159,7 +159,7 @@ if(!(mpvdec=mpcv_find_driver_by_name(sh_video->codec->driver_name))) continue; else MSG_DBG3("mpcv_init: mpcodecs_vd_drivers[%s]->mpvdec==0\n",mpcodecs_vd_drivers[i]->info->driver_name); // it's available, let's try to init! - if(mpvdec->init(sh_video)!=MPXP_Ok){ + if(mpvdec->init(sh_video,libinput)!=MPXP_Ok){ MSG_ERR(MSGTR_CODEC_CANT_INITV); continue; // try next... } Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/libmpcodecs/dec_video.h 2012-11-10 10:58:25 UTC (rev 315) @@ -3,9 +3,9 @@ #include "xmpcore/xmp_enums.h" // dec_video.c: -extern MPXP_Rc __FASTCALL__ mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status); +extern MPXP_Rc __FASTCALL__ mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status,any_t*libinput); extern void __FASTCALL__ mpcv_uninit(sh_video_t *sh_video); -extern MPXP_Rc __FASTCALL__ mpcv_ffmpeg_init(sh_video_t*); +extern MPXP_Rc __FASTCALL__ mpcv_ffmpeg_init(sh_video_t*,any_t* libinput); extern int __FASTCALL__ mpcv_decode(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame,float pts); Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/libmpcodecs/vd.c 2012-11-10 10:58:25 UTC (rev 315) @@ -96,7 +96,7 @@ extern vo_data_t* vo_data; extern const vd_functions_t* mpvdec; // FIXME! -MPXP_Rc mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune){ +MPXP_Rc mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune, any_t* libinput){ int i,j; unsigned int out_fmt=0; int screen_size_x=0;//SCREEN_SIZE_X; @@ -154,13 +154,13 @@ 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); + sc=vf=vf_open_filter(vf,sh,"fmtcvt",NULL,libinput); goto csp_again; } else if(palette==1){ MSG_V("vd: Trying -vf palette...\n"); palette=-1; - vf=vf_open_filter(vf,sh,"palette",NULL); + vf=vf_open_filter(vf,sh,"palette",NULL,libinput); goto csp_again; } else { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc @@ -194,7 +194,7 @@ if(vo_data->flags&VFCAP_FLIPPED) vo_FLIP_REVERT(vo_data); if(vo_FLIP(vo_data) && !(vo_data->flags&VFCAP_FLIP)){ // we need to flip, but no flipping filter avail. - sh->vfilter=vf=vf_open_filter(vf,sh,"mirror","x"); + sh->vfilter=vf=vf_open_filter(vf,sh,"mirror","x",libinput); } // time to do aspect ratio corrections... Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/libmpcodecs/vd.h 2012-11-10 10:58:25 UTC (rev 315) @@ -17,7 +17,7 @@ { const vd_info_t* info; const config_t* options;/**< Optional: MPlayerXP's option related */ - MPXP_Rc (*__FASTCALL__ init)(sh_video_t *sh); + MPXP_Rc (*__FASTCALL__ init)(sh_video_t *sh,any_t* libinput); void (*__FASTCALL__ uninit)(sh_video_t *sh); MPXP_Rc (* control)(sh_video_t *sh,int cmd,any_t* arg, ...); mp_image_t* (*__FASTCALL__ decode)(sh_video_t *sh,any_t* data,int len,int flags); @@ -34,7 +34,7 @@ VDCTRL_RESYNC_STREAM =7 /* resync video stream if needed */ }; // callbacks: -MPXP_Rc __FASTCALL__ mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune); +MPXP_Rc __FASTCALL__ mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune, any_t* libinput); mp_image_t* __FASTCALL__ mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,int w, int h); void __FASTCALL__ mpcodecs_draw_slice(sh_video_t* sh, mp_image_t*); void __FASTCALL__ mpcodecs_draw_image(sh_video_t* sh, mp_image_t *mpi); Modified: mplayerxp/libmpcodecs/vd_divx4.c =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.c 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/libmpcodecs/vd_divx4.c 2012-11-10 10:58:25 UTC (rev 315) @@ -187,12 +187,12 @@ } // init driver -static MPXP_Rc init(sh_video_t *sh){ +static MPXP_Rc init(sh_video_t *sh,any_t* libinput){ DecInit dinit; priv_t*p; int bits=12; if(!load_lib("libdivx"SLIBSUFFIX)) return MPXP_False; - if(!(mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL))) return MPXP_False; + if(!(mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput))) return MPXP_False; switch(sh->codec->outfmt[sh->outfmtidx]){ case IMGFMT_YV12: case IMGFMT_I420: Modified: mplayerxp/libmpcodecs/vd_dmo.c =================================================================== --- mplayerxp/libmpcodecs/vd_dmo.c 2012-11-09 15:57:27 UTC (rev 314) +++ mplayerxp/libmpcodecs/vd_dmo.c 2012-11-10 10:58:25 UTC (rev 315) @@ -45,7 +45,7 @@ } // init driver -static MPXP_Rc init(sh_video_t *sh){ +static MPXP_Rc init(sh_video_t *sh,any_t* libinput){ unsigned int out_fmt; if(!(sh->context=DMO_VideoDecoder_Open(sh->codec->dll_name,&sh->codec->guid, sh->bih, 0, 0))){ MSG_ERR(MSGTR_MissingDLLcodec,sh->codec->dll_name); @@ -53,7 +53,7 @@ "package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.tar.bz... [truncated message content] |
From: <nic...@us...> - 2012-11-10 12:07:14
|
Revision: 318 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=318&view=rev Author: nickols_k Date: 2012-11-10 12:07:07 +0000 (Sat, 10 Nov 2012) Log Message: ----------- segfaults-- Modified Paths: -------------- ffmpeg/doc/examples/pc-uninstalled/libswresample.pc mplayerxp/libmpcodecs/dec_audio.c mplayerxp/mplayerxp.c mplayerxp/postproc/af_volnorm.c mplayerxp/postproc/af_volume.c Modified: ffmpeg/doc/examples/pc-uninstalled/libswresample.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libswresample.pc 2012-11-10 11:22:10 UTC (rev 317) +++ ffmpeg/doc/examples/pc-uninstalled/libswresample.pc 2012-11-10 12:07:07 UTC (rev 318) @@ -8,5 +8,5 @@ Version: 0.15.100 Requires: libavutil = 51.73.101 Conflicts: -Libs: -L${libdir} -lswresample -lm +Libs: -L${libdir} -lswresample64 -lm Cflags: -I${includedir} Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-11-10 11:22:10 UTC (rev 317) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-11-10 12:07:07 UTC (rev 318) @@ -133,6 +133,7 @@ void mpca_uninit(sh_audio_t *sh_audio) { + if(!sh_audio) return; if(sh_audio->afilter){ MSG_V("Uninit audio filters...\n"); af_uninit(sh_audio->afilter); Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-10 11:22:10 UTC (rev 317) +++ mplayerxp/mplayerxp.c 2012-11-10 12:07:07 UTC (rev 318) @@ -2030,7 +2030,7 @@ } usleep(250000); //read_input: - vo_check_events(vo_data); + if(sh_video) vo_check_events(vo_data); repaint: #ifdef USE_OSD if((mpxp_paint_osd(&osd.visible,&in_pause))!=0) goto repaint; Modified: mplayerxp/postproc/af_volnorm.c =================================================================== --- mplayerxp/postproc/af_volnorm.c 2012-11-10 11:22:10 UTC (rev 317) +++ mplayerxp/postproc/af_volnorm.c 2012-11-10 12:07:07 UTC (rev 318) @@ -71,7 +71,7 @@ // Initialization and runtime control static MPXP_Rc __FASTCALL__ control(struct af_instance_s* af, int cmd, any_t* arg) { - af_volnorm_t* s = (af_volnorm_t*)af->setup; + af_volnorm_t* s = (af_volnorm_t*)af->setup; switch(cmd){ case AF_CONTROL_REINIT: @@ -81,8 +81,8 @@ af->data->rate = ((mp_aframe_t*)arg)->rate; af->data->nch = ((mp_aframe_t*)arg)->nch; - if(((mp_aframe_t*)arg)->format != (MPAF_F | MPAF_NE) && - ((mp_aframe_t*)arg)->format != (MPAF_SI | MPAF_NE)) + if(!(((mp_aframe_t*)arg)->format == (MPAF_F | MPAF_NE) || + ((mp_aframe_t*)arg)->format == (MPAF_SI | MPAF_NE))) return MPXP_Error; if(((mp_aframe_t*)arg)->format == (MPAF_SI | MPAF_NE)){ Modified: mplayerxp/postproc/af_volume.c =================================================================== --- mplayerxp/postproc/af_volume.c 2012-11-10 11:22:10 UTC (rev 317) +++ mplayerxp/postproc/af_volume.c 2012-11-10 12:07:07 UTC (rev 318) @@ -52,7 +52,7 @@ // Initialization and runtime control static MPXP_Rc __FASTCALL__ control(struct af_instance_s* af, int cmd, any_t* arg) { - af_volume_t* s = (af_volume_t*)af->setup; + af_volume_t* s = (af_volume_t*)af->setup; switch(cmd){ case AF_CONTROL_REINIT: @@ -85,22 +85,22 @@ for(i=0;i<AF_NCH;i++) vol[i]=v; return control(af,AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET, vol); } - case AF_CONTROL_POST_CREATE: - s->fast = ((((af_cfg_t*)arg)->force & AF_INIT_FORMAT_MASK) == + case AF_CONTROL_POST_CREATE: + s->fast = ((((af_cfg_t*)arg)->force & AF_INIT_FORMAT_MASK) == AF_INIT_FLOAT) ? 0 : 1; return MPXP_Ok; case AF_CONTROL_VOLUME_ON_OFF | AF_CONTROL_SET: memcpy(s->enable,(int*)arg,AF_NCH*sizeof(int)); - return MPXP_Ok; + return MPXP_Ok; case AF_CONTROL_VOLUME_ON_OFF | AF_CONTROL_GET: memcpy((int*)arg,s->enable,AF_NCH*sizeof(int)); - return MPXP_Ok; + return MPXP_Ok; case AF_CONTROL_VOLUME_SOFTCLIP | AF_CONTROL_SET: s->soft = *(int*)arg; - return MPXP_Ok; + return MPXP_Ok; case AF_CONTROL_VOLUME_SOFTCLIP | AF_CONTROL_GET: *(int*)arg = s->soft; - return MPXP_Ok; + return MPXP_Ok; case AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET: return af_from_dB(AF_NCH,(float*)arg,s->level,20.0,-200.0,60.0); case AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_GET: @@ -125,7 +125,7 @@ return MPXP_Unknown; } -// Deallocate memory +// Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { if(af->data) @@ -140,7 +140,7 @@ mp_aframe_t* c = data; // Current working data af_volume_t* s = (af_volume_t*)af->setup; // Setup for this instance int ch = 0; // Channel counter - register int nch = c->nch; // Number of channels + register int nch = c->nch; // Number of channels register int i = 0; // Basic operation volume control only (used on slow machines) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-11 10:15:02
|
Revision: 325 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=325&view=rev Author: nickols_k Date: 2012-11-11 10:14:52 +0000 (Sun, 11 Nov 2012) Log Message: ----------- remove redundant argument Modified Paths: -------------- mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_divx4.c mplayerxp/libmpcodecs/vd_dmo.c mplayerxp/libmpcodecs/vd_dshow.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_huffyuv.c mplayerxp/libmpcodecs/vd_libdv.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_mpegpes.c mplayerxp/libmpcodecs/vd_nuv.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpcodecs/vd_raw.c mplayerxp/libmpcodecs/vd_real.c mplayerxp/libmpcodecs/vd_theora.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpcodecs/vd_xvid.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/vosub_vidix.c mplayerxp/libvo/vosub_vidix.h mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.c mplayerxp/postproc/vf_2xsai.c mplayerxp/postproc/vf_aspect.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_denoise3d.c mplayerxp/postproc/vf_dint.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_eq.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_flip.c mplayerxp/postproc/vf_format.c mplayerxp/postproc/vf_menu.c mplayerxp/postproc/vf_mirror.c mplayerxp/postproc/vf_noise.c mplayerxp/postproc/vf_ow.c mplayerxp/postproc/vf_palette.c mplayerxp/postproc/vf_panscan.c mplayerxp/postproc/vf_perspective.c mplayerxp/postproc/vf_pp.c mplayerxp/postproc/vf_raw.c mplayerxp/postproc/vf_rectangle.c mplayerxp/postproc/vf_rgb2bgr.c mplayerxp/postproc/vf_rotate.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_smartblur.c mplayerxp/postproc/vf_softpulldown.c mplayerxp/postproc/vf_test.c mplayerxp/postproc/vf_unsharp.c mplayerxp/postproc/vf_vo.c mplayerxp/postproc/vf_yuvcsp.c mplayerxp/postproc/vf_yuy2.c mplayerxp/postproc/vf_yvu9.c Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd.c 2012-11-11 10:14:52 UTC (rev 325) @@ -96,7 +96,7 @@ extern vo_data_t* vo_data; extern const vd_functions_t* mpvdec; // FIXME! -MPXP_Rc mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune, any_t* libinput){ +MPXP_Rc mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t* libinput){ int i,j; unsigned int out_fmt=0; int screen_size_x=0;//SCREEN_SIZE_X; @@ -250,16 +250,16 @@ if(vf->config(vf,sh->src_w,sh->src_h, screen_size_x,screen_size_y, vo_data->flags, - out_fmt,tune)==0){ + out_fmt)==0){ MSG_WARN(MSGTR_CannotInitVO); sh->vfilter_inited=-1; return MPXP_False; } - MSG_DBG2("vf->config(%dx%d->%dx%d,flags=%d,'%s',%p)\n", + MSG_DBG2("vf->config(%dx%d->%dx%d,flags=%d,'%s')\n", sh->src_w,sh->src_h, screen_size_x,screen_size_y, vo_data->flags, - vo_format_name(out_fmt),tune); + vo_format_name(out_fmt)); return MPXP_True; } Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd.h 2012-11-11 10:14:52 UTC (rev 325) @@ -34,7 +34,7 @@ VDCTRL_RESYNC_STREAM =7 /* resync video stream if needed */ }; // callbacks: -MPXP_Rc __FASTCALL__ mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune, any_t* libinput); +MPXP_Rc __FASTCALL__ mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t* libinput); mp_image_t* __FASTCALL__ mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,int w, int h); void __FASTCALL__ mpcodecs_draw_slice(sh_video_t* sh, mp_image_t*); void __FASTCALL__ mpcodecs_draw_image(sh_video_t* sh, mp_image_t *mpi); Modified: mplayerxp/libmpcodecs/vd_divx4.c =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_divx4.c 2012-11-11 10:14:52 UTC (rev 325) @@ -192,7 +192,7 @@ priv_t*p; int bits=12; if(!load_lib("libdivx"SLIBSUFFIX)) return MPXP_False; - if(!(mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput))) return MPXP_False; + if(!(mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput))) return MPXP_False; switch(sh->codec->outfmt[sh->outfmtidx]){ case IMGFMT_YV12: case IMGFMT_I420: Modified: mplayerxp/libmpcodecs/vd_dmo.c =================================================================== --- mplayerxp/libmpcodecs/vd_dmo.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_dmo.c 2012-11-11 10:14:52 UTC (rev 325) @@ -53,7 +53,7 @@ "package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.tar.bz2!\n"); return MPXP_False; } - if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput)) return MPXP_False; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput)) return MPXP_False; out_fmt=sh->codec->outfmt[sh->outfmtidx]; switch(out_fmt){ case IMGFMT_YUY2: Modified: mplayerxp/libmpcodecs/vd_dshow.c =================================================================== --- mplayerxp/libmpcodecs/vd_dshow.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_dshow.c 2012-11-11 10:14:52 UTC (rev 325) @@ -69,7 +69,7 @@ MSG_HINT("package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n"); return MPXP_False; } - if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput)) return MPXP_False; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput)) return MPXP_False; out_fmt=sh->codec->outfmt[sh->outfmtidx]; switch(out_fmt){ case IMGFMT_YUY2: Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-11 10:14:52 UTC (rev 325) @@ -186,30 +186,6 @@ return MPXP_Unknown; } -static MPXP_Rc ff_config_vo(sh_video_t *sh,uint32_t w,uint32_t h,any_t* libinput) -{ - priv_t *priv=sh->context; - vo_tune_info_t vfi; - if(!priv->vo_inited) { - unsigned halign=15,valign=15; - vfi.pitch[0]=32; - vfi.pitch[1]= - vfi.pitch[2]=16; - if(priv->ctx->pix_fmt == PIX_FMT_YUV410P && priv->cap_dr1) { - //yes seriously, its really needed (16x16 chroma blocks in SVQ1 -> 64x64) - valign=63; - vfi.pitch[0]=64; - vfi.pitch[1]= - vfi.pitch[2]=16; - } - sh->src_w=w;//(w+valign)&(~valign); - sh->src_h=(h+halign)&(~halign); - priv->vo_inited=1; - return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,&vfi,libinput); - } - return MPXP_Ok; -} - static MPXP_Rc find_vdecoder(sh_video_t* sh) { unsigned i; unsigned char flag = CODECS_FLAG_NOFLIP; @@ -420,7 +396,7 @@ } if(pp_flags) ppContext=pp2_get_context(sh->src_w,sh->src_h,pp_flags); } - return ff_config_vo(sh,sh->src_w,sh->src_h,libinput); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); } // uninit driver Modified: mplayerxp/libmpcodecs/vd_huffyuv.c =================================================================== --- mplayerxp/libmpcodecs/vd_huffyuv.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_huffyuv.c 2012-11-11 10:14:52 UTC (rev 325) @@ -314,7 +314,7 @@ switch (priv->bitmaptype) { case BMPTYPE_RGB: case BMPTYPE_YUV: - vo_ret = mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput); + vo_ret = mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); break; case BMPTYPE_RGBA: MSG_ERR( "[HuffYUV] RGBA not supported yet.\n"); Modified: mplayerxp/libmpcodecs/vd_libdv.c =================================================================== --- mplayerxp/libmpcodecs/vd_libdv.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_libdv.c 2012-11-11 10:14:52 UTC (rev 325) @@ -52,7 +52,7 @@ static MPXP_Rc init(sh_video_t *sh,any_t* libinput) { sh->context = (any_t*)init_global_rawdv_decoder(); - return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); } // uninit driver Modified: mplayerxp/libmpcodecs/vd_libmpeg2.c =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-11-11 10:14:52 UTC (rev 325) @@ -185,7 +185,7 @@ if(!load_lib("libmpeg2"SLIBSUFFIX)) return MPXP_False; priv=sh->context=mp_malloc(sizeof(priv_t)); if(!(priv->mpeg2dec=mpeg2_init(mp_data->mplayer_accel))) return MPXP_False; - return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); } // uninit driver Modified: mplayerxp/libmpcodecs/vd_mpegpes.c =================================================================== --- mplayerxp/libmpcodecs/vd_mpegpes.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_mpegpes.c 2012-11-11 10:14:52 UTC (rev 325) @@ -25,7 +25,7 @@ // init driver static MPXP_Rc init(sh_video_t *sh,any_t* libinput){ - return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); } // uninit driver Modified: mplayerxp/libmpcodecs/vd_nuv.c =================================================================== --- mplayerxp/libmpcodecs/vd_nuv.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_nuv.c 2012-11-11 10:14:52 UTC (rev 325) @@ -33,7 +33,7 @@ // init driver static MPXP_Rc init(sh_video_t *sh,any_t* libinput){ - return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); } // uninit driver Modified: mplayerxp/libmpcodecs/vd_qtvideo.c =================================================================== --- mplayerxp/libmpcodecs/vd_qtvideo.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_qtvideo.c 2012-11-11 10:14:52 UTC (rev 325) @@ -288,9 +288,9 @@ } MSG_V("imgfmt: %s qt_imgfmt: %.4s\n", vo_format_name(imgfmt), &qt_imgfmt); sh->context = qt_imgfmt; - if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput)) return MPXP_False; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput)) return MPXP_False; #else - if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput)) return MPXP_False; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput)) return MPXP_False; #endif return MPXP_Ok; } Modified: mplayerxp/libmpcodecs/vd_raw.c =================================================================== --- mplayerxp/libmpcodecs/vd_raw.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_raw.c 2012-11-11 10:14:52 UTC (rev 325) @@ -42,7 +42,7 @@ MSG_WARN("RAW: depth %d not supported\n",sh->bih->biBitCount); } } - return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); } // uninit driver Modified: mplayerxp/libmpcodecs/vd_real.c =================================================================== --- mplayerxp/libmpcodecs/vd_real.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_real.c 2012-11-11 10:14:52 UTC (rev 325) @@ -163,7 +163,7 @@ if(!load_syms(sh->codec->dll_name)) return MPXP_False; // only I420 supported - if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput)) return MPXP_False; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput)) return MPXP_False; // init codec: sh->context=NULL; result=(*rvyuv_init)(&init_data, &sh->context); Modified: mplayerxp/libmpcodecs/vd_theora.c =================================================================== --- mplayerxp/libmpcodecs/vd_theora.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_theora.c 2012-11-11 10:14:52 UTC (rev 325) @@ -111,7 +111,7 @@ MSG_V("INFO: Theora video init ok!\n"); - return mpcodecs_config_vo (sh,sh->src_w,sh->src_h,NULL,libinput); + return mpcodecs_config_vo (sh,sh->src_w,sh->src_h,libinput); } /* Modified: mplayerxp/libmpcodecs/vd_vfw.c =================================================================== --- mplayerxp/libmpcodecs/vd_vfw.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_vfw.c 2012-11-11 10:14:52 UTC (rev 325) @@ -256,7 +256,7 @@ priv->ex = vfw_ex; if(init_vfw_video_codec(sh)!=MPXP_Ok) return MPXP_False; MSG_V("INFO: Win32/VFW init OK!\n"); - return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); } // uninit driver Modified: mplayerxp/libmpcodecs/vd_xanim.c =================================================================== --- mplayerxp/libmpcodecs/vd_xanim.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_xanim.c 2012-11-11 10:14:52 UTC (rev 325) @@ -874,7 +874,7 @@ // init driver static MPXP_Rc init(sh_video_t *sh,any_t* libinput){ if(xacodec_init_video(sh,sh->codec->outfmt[sh->outfmtidx])) - return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL,libinput); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); return MPXP_False; } Modified: mplayerxp/libmpcodecs/vd_xvid.c =================================================================== --- mplayerxp/libmpcodecs/vd_xvid.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libmpcodecs/vd_xvid.c 2012-11-11 10:14:52 UTC (rev 325) @@ -380,7 +380,7 @@ priv->img_type = MP_IMGTYPE_TEMP; break; } - return mpcodecs_config_vo(sh, sh->src_w, sh->src_h, NULL,libinput); + return mpcodecs_config_vo(sh, sh->src_w, sh->src_h,libinput); } // uninit driver Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/video_out.c 2012-11-11 10:14:52 UTC (rev 325) @@ -400,7 +400,7 @@ static int vo_inited=0; MPXP_Rc __FASTCALL__ vo_config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, - uint32_t format,const vo_tune_info_t *vti) + uint32_t format) { vo_priv_t* priv=(vo_priv_t*)vo->vo_priv; MPXP_Rc retval; @@ -424,7 +424,7 @@ priv->dri.d_height = d_h; MSG_V("video_out->config(%u,%u,%u,%u,0x%x,'%s',%s)\n" ,w,h,d_w,d_h,fullscreen,title,vo_format_name(dest_fourcc)); - retval = video_out->config(vo,w,h,d_w,d_h,fullscreen,title,dest_fourcc,vti); + retval = video_out->config(vo,w,h,d_w,d_h,fullscreen,title,dest_fourcc); priv->srcFourcc=format; if(retval == MPXP_Ok) { int dri_retv; Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/video_out.h 2012-11-11 10:14:52 UTC (rev 325) @@ -64,12 +64,6 @@ const char *comment; /**< any additional comments */ } vo_info_t; -/** Misc info to tuneup VO-driver */ -typedef struct vo_tune_info_s -{ - int pitch[3]; /**< Picthes for image lines. Should be 0 if unknown else power of 2 */ -}vo_tune_info_t; - /** Request for supported FOURCC by VO-driver */ typedef struct vo_query_fourcc_s { @@ -217,7 +211,7 @@ **/ MPXP_Rc (* __FASTCALL__ config)(vo_data_t* vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, - uint32_t format,const vo_tune_info_t *); + uint32_t format); /** Control interface * @param request command. See VOCTRL_** for detail @@ -253,7 +247,7 @@ extern MPXP_Rc __FASTCALL__ vo_init(vo_data_t* vo,const char *subdevice_name); extern MPXP_Rc __FASTCALL__ vo_config(vo_data_t* vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, - uint32_t format,const vo_tune_info_t *); + uint32_t format); extern uint32_t __FASTCALL__ vo_query_format(vo_data_t* vo,uint32_t* fourcc,unsigned src_w,unsigned src_h); extern MPXP_Rc vo_reset(vo_data_t* vo); extern MPXP_Rc vo_fullscreen(vo_data_t* vo); Modified: mplayerxp/libvo/video_out_internal.h =================================================================== --- mplayerxp/libvo/video_out_internal.h 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/video_out_internal.h 2012-11-11 10:14:52 UTC (rev 325) @@ -25,7 +25,7 @@ static MPXP_Rc __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data); static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, - uint32_t format,const vo_tune_info_t *); + uint32_t format); static const vo_info_t* __FASTCALL__ get_info(vo_data_t*vo); static void __FASTCALL__ select_frame(vo_data_t*vo,unsigned idx); static void __FASTCALL__ uninit(vo_data_t*vo); Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vo_dga.c 2012-11-11 10:14:52 UTC (rev 325) @@ -187,23 +187,23 @@ return 0; } -static char * __FASTCALL__ vd_GetModeString(int index){ +static char * __FASTCALL__ vd_GetModeString(int _index){ #define VO_DGA_MAX_STRING_LEN 100 static char stringbuf[VO_DGA_MAX_STRING_LEN]; stringbuf[VO_DGA_MAX_STRING_LEN-1]=0; snprintf(stringbuf, VO_DGA_MAX_STRING_LEN-2, "depth=%d, bpp=%d, r=%06x, g=%06x, b=%06x, %s (-bpp %d)", - vo_dga_modes[index].vdm_depth, - vo_dga_modes[index].vdm_bitspp, - vo_dga_modes[index].vdm_rmask, - vo_dga_modes[index].vdm_gmask, - vo_dga_modes[index].vdm_bmask, - vo_dga_modes[index].vdm_supported ? - (vo_dga_modes[index].vdm_conversion_func == VDM_CONV_NATIVE ? + vo_dga_modes[_index].vdm_depth, + vo_dga_modes[_index].vdm_bitspp, + vo_dga_modes[_index].vdm_rmask, + vo_dga_modes[_index].vdm_gmask, + vo_dga_modes[_index].vdm_bmask, + vo_dga_modes[_index].vdm_supported ? + (vo_dga_modes[_index].vdm_conversion_func == VDM_CONV_NATIVE ? "native (fast), " : "conversion (slow),") : "not supported :-( ", - vo_dga_modes[index].vdm_mplayer_depth); + vo_dga_modes[_index].vdm_mplayer_depth); return stringbuf; } @@ -565,9 +565,9 @@ #endif #endif -static MPXP_Rc __FASTCALL__ config(vo_data_t*vo, uint32_t width, uint32_t height, +static MPXP_Rc __FASTCALL__ config(vo_data_t*vo, uint32_t width,uint32_t height, uint32_t d_width,uint32_t d_height, - uint32_t flags,char *title,uint32_t format,const vo_tune_info_t *info ) + uint32_t flags,char *title,uint32_t format) { priv_t*priv=(priv_t*)vo->priv; unsigned wanted_width, wanted_height; @@ -577,7 +577,6 @@ unsigned mX,mY; UNUSED(title); - UNUSED(info); if( priv->is_running ) return MPXP_False; priv->src_format = format; Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vo_fbdev.c 2012-11-11 10:14:52 UTC (rev 325) @@ -827,7 +827,7 @@ static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, - uint32_t format,const vo_tune_info_t *info) + uint32_t format) { priv_t*priv=(priv_t*)vo->priv; struct fb_cmap *cmap; @@ -997,7 +997,7 @@ if(vidix_name) { if(vidix_init(vo,width,height,x_offset,y_offset,priv->out_width, priv->out_height,format,priv->bpp, - priv->xres,priv->yres,info) != MPXP_Ok) { + priv->xres,priv->yres) != MPXP_Ok) { MSG_ERR(FBDEV "Can't initialize VIDIX driver\n"); vidix_name = NULL; vidix_term(vo); Modified: mplayerxp/libvo/vo_null.c =================================================================== --- mplayerxp/libvo/vo_null.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vo_null.c 2012-11-11 10:14:52 UTC (rev 325) @@ -62,7 +62,7 @@ UNUSED(idx); } -static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info) +static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) { priv_t*priv=(priv_t*)vo->priv; unsigned awidth; @@ -76,44 +76,6 @@ UNUSED(fullscreen); UNUSED(title); priv->pitch_y=priv->pitch_u=priv->pitch_v=1; - if(info) { - switch(((const vo_tune_info_t *)info)->pitch[0]) { - case 2: - case 4: - case 8: - case 16: - case 32: - case 64: - case 128: - case 256: priv->pitch_y = ((const vo_tune_info_t *)info)->pitch[0]; - break; - default: break; - } - switch(((const vo_tune_info_t *)info)->pitch[1]) { - case 2: - case 4: - case 8: - case 16: - case 32: - case 64: - case 128: - case 256: priv->pitch_u = ((const vo_tune_info_t *)info)->pitch[1]; - break; - default: break; - } - switch(((const vo_tune_info_t *)info)->pitch[2]) { - case 2: - case 4: - case 8: - case 16: - case 32: - case 64: - case 128: - case 256: priv->pitch_v = ((const vo_tune_info_t *)info)->pitch[2]; - break; - default: break; - } - } priv->offset_y=priv->offset_u=priv->offset_v=0; switch(format) { case IMGFMT_Y800: Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vo_opengl.c 2012-11-11 10:14:52 UTC (rev 325) @@ -153,7 +153,7 @@ /* connect to server, create and map window, * allocate colors and (shared) memory */ -static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t *info) +static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { priv_t*priv=(priv_t*)vo->priv; int is_bgr; @@ -164,7 +164,6 @@ XSetWindowAttributes xswa; unsigned long xswamask,i; - UNUSED(info); aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vo_sdl.c 2012-11-11 10:14:52 UTC (rev 325) @@ -202,84 +202,40 @@ #define SDL_SRF_UNLOCK(srf) #endif -/** Private SDL Data structure **/ +typedef enum { + YUV=0, + RGB, + BGR, + GL +}sdl_mode_e; +/** Private SDL Data structure **/ typedef struct priv_s { - - /* output driver used by sdl */ - char driver[8]; - - /* SDL display surface */ - SDL_Surface *surface; - - /* SDL RGB surface */ - SDL_Surface *rgbsurface[MAX_DRI_BUFFERS]; - - /* SDL YUV overlay */ - SDL_Overlay *overlay[MAX_DRI_BUFFERS]; - - /* XP related indexes */ - unsigned num_buffs; - - /* available fullscreen modes */ - SDL_Rect **fullmodes; - - /* surface attributes for fullscreen and windowed mode */ - Uint32 sdlflags, sdlfullflags; - - /* save the windowed output extents */ - SDL_Rect windowsize; - - /* Bits per Pixel */ - Uint8 bpp; - - /* RGB or YUV? */ -#define YUV 0 -#define RGB 1 -#define BGR 2 -#define GL 3 - Uint8 mode; - - /* current fullscreen mode, 0 = highest available fullscreen mode */ - int fullmode; - - /* Flip image */ - int flip; - - /* fullscreen behaviour; see init */ - int fulltype; - - /* is X running (0/1) */ - int X; - - /* X11 Resolution */ - int XWidth, XHeight; - - /* original image dimensions */ - int width, height; - - /* destination dimensions */ - int dstwidth, dstheight; - - /* Draw image at coordinate y on the SDL surfaces */ - int y; - - /* The image is displayed between those y coordinates in priv->surface */ - int y_screen_top, y_screen_bottom; - - /* 1 if the OSD has changed otherwise 0 */ - int osd_has_changed; - - /* source image format (YUV/RGB/...) */ - uint32_t format; - + char driver[8]; /* output driver used by sdl */ + SDL_Surface*surface; /* SDL display surface */ + SDL_Surface*rgbsurface[MAX_DRI_BUFFERS]; /* SDL RGB surface */ + SDL_Overlay*overlay[MAX_DRI_BUFFERS]; /* SDL YUV overlay */ + unsigned num_buffs; /* XP related indexes */ + SDL_Rect** fullmodes; /* available fullscreen modes */ + Uint32 sdlflags, sdlfullflags; /* surface attributes for fullscreen and windowed mode */ + SDL_Rect windowsize; /* save the windowed output extents */ + Uint8 bpp; /* Bits per Pixel */ + sdl_mode_e mode; /* RGB or YUV? */ + int fullmode; /* current fullscreen mode, 0 = highest available fullscreen mode */ + int flip; /* Flip image */ + int fulltype; /* fullscreen behaviour; see init */ + int X; /* is X running (0/1) */ + int XWidth, XHeight; /* X11 Resolution */ + int width, height; /* original image dimensions */ + int dstwidth, dstheight; /* destination dimensions */ + int y; /* Draw image at coordinate y on the SDL surfaces */ + int y_screen_top, y_screen_bottom; /* The image is displayed between those y coordinates in priv->surface */ + int osd_has_changed; /* 1 if the OSD has changed otherwise 0 */ + uint32_t format; /* source image format (YUV/RGB/...) */ /* dirty_off_frame[0] contains a bounding box around the osd contents drawn above the image dirty_off_frame[1] is the corresponding thing for OSD contents drawn below the image */ - SDL_Rect dirty_off_frame[2]; - - /* stride info from video decoder */ - const vo_tune_info_t *info; + SDL_Rect dirty_off_frame[2]; }priv_t; static void __FASTCALL__ erase_area_4(int x_start, int width, int height, int pitch, uint32_t color, uint8_t* pixels); @@ -565,14 +521,12 @@ * returns : non-zero on success, zero on error. **/ -static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t *info) +static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) //static int sdl_setup (int width, int height) { priv_t *priv = vo->priv; MPXP_Rc retval; - UNUSED(info); - priv->info=info; if(sdl_forcegl) priv->mode = GL; else switch(format){ @@ -749,7 +703,7 @@ else { if(vidix_init(vo,priv->width,priv->height,0,priv->y, priv->dstwidth,priv->dstheight,priv->format,priv->bpp, - priv->XWidth,priv->XHeight,priv->info) != MPXP_Ok) { + priv->XWidth,priv->XHeight) != MPXP_Ok) { MSG_ERR("vo_sdl: Can't initialize VIDIX driver\n"); vidix_name = NULL; return MPXP_False; Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vo_vesa.c 2012-11-11 10:14:52 UTC (rev 325) @@ -397,7 +397,7 @@ * bit 2 (0x04) enables software scaling (-zoom) * bit 3 (0x08) enables flipping (-flip) (NK: and for what?) */ -static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t *info) +static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { priv_t*priv=(priv_t*)vo->priv; struct VbeInfoBlock vib; @@ -664,7 +664,7 @@ if(priv->vidix_name) { if(vidix_init(vo,width,height,priv->x_offset,priv->y_offset,priv->dstW, priv->dstH,format,priv->dstBpp, - priv->vmode_info.XResolution,priv->vmode_info.YResolution,info) != MPXP_Ok) { + priv->vmode_info.XResolution,priv->vmode_info.YResolution) != MPXP_Ok) { MSG_ERR("vo_vesa: Can't initialize VIDIX driver\n"); priv->vidix_name = NULL; vesa_term(vo); Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vo_x11.c 2012-11-11 10:14:52 UTC (rev 325) @@ -111,7 +111,7 @@ return ret; } -static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width,uint32_t height,uint32_t d_width,uint32_t d_height,uint32_t flags,char *title,uint32_t format,const vo_tune_info_t *info) +static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width,uint32_t height,uint32_t d_width,uint32_t d_height,uint32_t flags,char *title,uint32_t format) { priv_t* priv=(priv_t*)vo->priv; // int interval, prefer_blank, allow_exp, nothing; @@ -124,8 +124,6 @@ unsigned long xswamask; unsigned i; - UNUSED(info); - priv->num_buffers=vo_conf.xp_buffs; if (!title) Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vo_xv.c 2012-11-11 10:14:52 UTC (rev 325) @@ -261,7 +261,7 @@ * connect to server, create and map window, * allocate colors and (shared) memory */ -static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t *info) +static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { priv_t*priv=(priv_t*)vo->priv; // int screen; @@ -275,7 +275,6 @@ XSetWindowAttributes xswa; unsigned long xswamask,i; - UNUSED(info); aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vo_xvidix.c 2012-11-11 10:14:52 UTC (rev 325) @@ -47,8 +47,6 @@ "" }; -#define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */ - typedef struct priv_s { /* Image parameters */ uint32_t image_width; @@ -67,10 +65,9 @@ uint32_t fgColor; /* VIDIX related */ char * name; - vo_tune_info_t vtune; }priv_t; -static uint32_t __FASTCALL__ set_window(vo_data_t*vo,int force_update,const vo_tune_info_t *info) +static uint32_t __FASTCALL__ set_window(vo_data_t*vo,int force_update) { priv_t*priv=(priv_t*)vo->priv; uint32_t retval=0; @@ -132,7 +129,7 @@ vidix_stop(vo); if (vidix_init(vo,priv->image_width, priv->image_height, priv->win_x, priv->win_y, priv->win_w, priv->win_h, priv->image_format, vo->depthonscreen, - vo_conf.screenwidth, vo_conf.screenheight,info) != MPXP_Ok) + vo_conf.screenwidth, vo_conf.screenheight) != MPXP_Ok) { MSG_FATAL( "Can't initialize VIDIX driver: %s: %s\n", priv->name, strerror(errno)); @@ -164,7 +161,7 @@ * allocate colors and (shared) memory */ static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t *info) + uint32_t d_height, uint32_t flags, char *title, uint32_t format) { priv_t*priv=(priv_t*)vo->priv; XVisualInfo vinfo; @@ -341,9 +338,7 @@ #endif } - set_window(vo,1,info); - if(info) memcpy(&priv->vtune,info,sizeof(vo_tune_info_t)); - else memset(&priv->vtune,0,sizeof(vo_tune_info_t)); + set_window(vo,1); XFlush(vo->mDisplay); XSync(vo->mDisplay, False); @@ -362,8 +357,7 @@ { priv_t*priv=(priv_t*)vo->priv; uint32_t event = vo_x11_check_events(vo,vo->mDisplay,adjust_size); - if((event & VO_EVENT_RESIZE)) - event = set_window(vo,0,&priv->vtune); + if((event & VO_EVENT_RESIZE)) event = set_window(vo,0); return event; } Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vosub_vidix.c 2012-11-11 10:14:52 UTC (rev 325) @@ -321,22 +321,23 @@ int munlock(const any_t*addr,size_t len) { return ENOSYS; } #endif -#define ALLOC_VIDIX_STRUCTS()\ -{\ - if(!priv->cap) priv->cap = vdlAllocCapabilityS();\ - if(!priv->play) priv->play = vdlAllocPlaybackS();\ - if(!priv->fourcc) priv->fourcc = vdlAllocFourccS();\ - if(!priv->dstrides) priv->dstrides = vdlAllocYUVS();\ - if(!(priv->cap && priv->play && priv->fourcc && priv->dstrides)) {\ - MSG_FATAL("Can not alloc certain structures\n");\ - return -1;\ - }\ +static MPXP_Rc alloc_vidix_structs(any_t* ctx) { + priv_t* priv=(priv_t*)ctx; + if(!priv->cap) priv->cap = vdlAllocCapabilityS(); + if(!priv->play) priv->play = vdlAllocPlaybackS(); + if(!priv->fourcc) priv->fourcc = vdlAllocFourccS(); + if(!priv->dstrides) priv->dstrides = vdlAllocYUVS(); + if(!(priv->cap && priv->play && priv->fourcc && priv->dstrides)) { + MSG_FATAL("Can not alloc certain structures\n"); + return MPXP_False; + } + return MPXP_Ok; } MPXP_Rc __FASTCALL__ vidix_init(vo_data_t* vo,unsigned src_width,unsigned src_height, unsigned x_org,unsigned y_org,unsigned dst_width, unsigned dst_height,unsigned format,unsigned dest_bpp, - unsigned vid_w,unsigned vid_h,const any_t*info) + unsigned vid_w,unsigned vid_h) { priv_t*priv=(priv_t*)vo->priv3; size_t i; @@ -407,44 +408,6 @@ priv->play->num_frames=(vo_conf.use_bm!=1)?NUM_FRAMES-1:1; if(priv->play->num_frames > vo_conf.xp_buffs) priv->play->num_frames = vo_conf.xp_buffs; priv->play->src.pitch.y = priv->play->src.pitch.u = priv->play->src.pitch.v = 0; - if(info) { - switch(((const vo_tune_info_t *)info)->pitch[0]) { - case 2: - case 4: - case 8: - case 16: - case 32: - case 64: - case 128: - case 256: priv->play->src.pitch.y = ((const vo_tune_info_t *)info)->pitch[0]; - break; - default: break; - } - switch(((const vo_tune_info_t *)info)->pitch[1]) { - case 2: - case 4: - case 8: - case 16: - case 32: - case 64: - case 128: - case 256: priv->play->src.pitch.u = ((const vo_tune_info_t *)info)->pitch[1]; - break; - default: break; - } - switch(((const vo_tune_info_t *)info)->pitch[2]) { - case 2: - case 4: - case 8: - case 16: - case 32: - case 64: - case 128: - case 256: priv->play->src.pitch.v = ((const vo_tune_info_t *)info)->pitch[2]; - break; - default: break; - } - } if((err=vdlConfigPlayback(priv->handler,priv->play))!=0) { MSG_FATAL("Can't configure playback: %s\n",strerror(err)); return MPXP_False; @@ -620,7 +583,7 @@ MSG_DBG2("vidix_preinit(%s) was called\n",drvname); priv_t* priv=mp_mallocz(sizeof(priv_t)); vo->priv3=priv; - ALLOC_VIDIX_STRUCTS() + if(alloc_vidix_structs(priv)!=MPXP_Ok) return MPXP_False; if(vdlGetVersion() != VIDIX_VERSION) { MSG_FATAL("You have wrong version of VIDIX library\n"); mp_free(priv); Modified: mplayerxp/libvo/vosub_vidix.h =================================================================== --- mplayerxp/libvo/vosub_vidix.h 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/libvo/vosub_vidix.h 2012-11-11 10:14:52 UTC (rev 325) @@ -18,7 +18,7 @@ MPXP_Rc __FASTCALL__ vidix_init(vo_data_t*,unsigned src_width,unsigned src_height, unsigned dest_x,unsigned dest_y,unsigned dst_width, unsigned dst_height,unsigned format,unsigned dest_bpp, - unsigned vid_w,unsigned vid_h,const any_t*info); + unsigned vid_w,unsigned vid_h); int vidix_start(vo_data_t*); int vidix_stop(vo_data_t*); void vidix_term(vo_data_t*); Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf.c 2012-11-11 10:14:52 UTC (rev 325) @@ -364,7 +364,7 @@ int __FASTCALL__ vf_next_config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int voflags, unsigned int outfmt, any_t*tune){ + unsigned int voflags, unsigned int outfmt){ int miss; int flags=vf_next_query_format(vf,outfmt,d_width,d_height); vf->dw=width; @@ -394,7 +394,7 @@ vf->next=vf2; } vf_showlist(vf); - return vf->next->config(vf->next,width,height,d_width,d_height,voflags,outfmt,tune); + return vf->next->config(vf->next,width,height,d_width,d_height,voflags,outfmt); } int __FASTCALL__ vf_next_control(struct vf_instance_s* vf, int request, any_t* data){ @@ -617,7 +617,7 @@ if(vf_scaler->config(vf_scaler,sw,sh, w,h, VOFLAG_SWSCALE, - sfourcc,NULL)==0){ + sfourcc)==0){ MSG_WARN(MSGTR_CannotInitVO); vf_scaler=NULL; } Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf.h 2012-11-11 10:14:52 UTC (rev 325) @@ -35,7 +35,7 @@ // funcs: int (* __FASTCALL__ config)(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune); + unsigned int flags, unsigned int outfmt); MPXP_Rc (* __FASTCALL__ control)(struct vf_instance_s* vf, int request, any_t* data); int (* __FASTCALL__ query_format)(struct vf_instance_s* vf, @@ -114,7 +114,7 @@ // default wrappers: int __FASTCALL__ vf_next_config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune); + unsigned int flags, unsigned int outfmt); MPXP_Rc __FASTCALL__ vf_next_control(struct vf_instance_s* vf, int request, any_t* data); int __FASTCALL__ vf_next_query_format(struct vf_instance_s* vf, unsigned int fmt,unsigned w,unsigned h); int __FASTCALL__ vf_next_put_slice(struct vf_instance_s* vf,mp_image_t *mpi); Modified: mplayerxp/postproc/vf_1bpp.c =================================================================== --- mplayerxp/postproc/vf_1bpp.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_1bpp.c 2012-11-11 10:14:52 UTC (rev 325) @@ -28,7 +28,7 @@ IMGFMT_IYUV, IMGFMT_422P, IMGFMT_444P, - + IMGFMT_YUY2, IMGFMT_BGR15, IMGFMT_RGB15, @@ -65,7 +65,7 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ if (!vf->priv->fmt) vf->priv->fmt=find_best(vf,d_width,d_height); if(!vf->priv->fmt){ @@ -74,7 +74,7 @@ else if(outfmt==IMGFMT_BGR8) vf->priv->fmt=IMGFMT_BGR32; else return 0; } - return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt); } static int bittab[8]={128,64,32,16,8,4,2,1}; Modified: mplayerxp/postproc/vf_2xsai.c =================================================================== --- mplayerxp/postproc/vf_2xsai.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_2xsai.c 2012-11-11 10:14:52 UTC (rev 325) @@ -271,11 +271,11 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt, any_t*tune){ + unsigned int flags, unsigned int outfmt){ Init_2xSaI(outfmt&255); - return vf_next_config(vf,2*width,2*height,2*d_width,2*d_height,flags,outfmt,tune); + return vf_next_config(vf,2*width,2*height,2*d_width,2*d_height,flags,outfmt); } static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ Modified: mplayerxp/postproc/vf_aspect.c =================================================================== --- mplayerxp/postproc/vf_aspect.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_aspect.c 2012-11-11 10:14:52 UTC (rev 325) @@ -18,7 +18,7 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune) + unsigned int flags, unsigned int outfmt) { if(vf->priv->aspect==768.) { @@ -37,7 +37,7 @@ d_width = width; } } - return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt, tune); + return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); } static MPXP_Rc __FASTCALL__ vf_open(vf_instance_t *vf,const char* args) Modified: mplayerxp/postproc/vf_delogo.c =================================================================== --- mplayerxp/postproc/vf_delogo.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_delogo.c 2012-11-11 10:14:52 UTC (rev 325) @@ -125,9 +125,9 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } Modified: mplayerxp/postproc/vf_denoise3d.c =================================================================== --- mplayerxp/postproc/vf_denoise3d.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_denoise3d.c 2012-11-11 10:14:52 UTC (rev 325) @@ -57,14 +57,14 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ uninit(vf); vf->priv->Line = mp_malloc(width*sizeof(int)); vf->priv->pmpi=NULL; // vf->default_caps &= !VFCAP_ACCEPT_STRIDE; - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } #define LowPass(Prev, Curr, Coef) (Curr + Coef[Prev - Curr]) Modified: mplayerxp/postproc/vf_dint.c =================================================================== --- mplayerxp/postproc/vf_dint.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_dint.c 2012-11-11 10:14:52 UTC (rev 325) @@ -34,9 +34,9 @@ static int __FASTCALL__ kd_config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } @@ -297,7 +297,7 @@ static int __FASTCALL__ config (struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune) + unsigned int flags, unsigned int outfmt) { int rowsize; @@ -326,7 +326,7 @@ vf->priv->diff = 31; // vf->priv->rdfr = vf->priv->dfr = 0; vf->priv->was_dint = 0; - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static int __FASTCALL__ put_slice (struct vf_instance_s* vf, mp_image_t *mpi) Modified: mplayerxp/postproc/vf_down3dright.c =================================================================== --- mplayerxp/postproc/vf_down3dright.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_down3dright.c 2012-11-11 10:14:52 UTC (rev 325) @@ -105,11 +105,11 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune) + unsigned int flags, unsigned int outfmt) { /* FIXME - also support UYVY output? */ return vf_next_config(vf, width * vf->priv->scalew, - height / vf->priv->scaleh - vf->priv->skipline, d_width, d_height, flags, IMGFMT_YV12, tune); + height / vf->priv->scaleh - vf->priv->skipline, d_width, d_height, flags, IMGFMT_YV12); } Modified: mplayerxp/postproc/vf_eq.c =================================================================== --- mplayerxp/postproc/vf_eq.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_eq.c 2012-11-11 10:14:52 UTC (rev 325) @@ -121,7 +121,7 @@ int pel; short brvec[4]; short contvec[4]; - + // printf("\nmmx: src=%p dst=%p w=%d h=%d ds=%d ss=%d\n",src,dst,w,h,dstride,sstride); contrast = (int) (par->c * 256 * 16); Modified: mplayerxp/postproc/vf_expand.c =================================================================== --- mplayerxp/postproc/vf_expand.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_expand.c 2012-11-11 10:14:52 UTC (rev 325) @@ -34,7 +34,7 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ unsigned h,dh; vf->priv->w=width; vf->priv->h=height; @@ -42,7 +42,7 @@ vf->priv->dn_h=vf->priv->up_h=(get_osd_height(vo_data,OSD_PB_START,0)*4)/3; h=height+vf->priv->up_h+vf->priv->dn_h; dh=d_height+vf->priv->up_h+vf->priv->dn_h; - return vf_next_config(vf,width,h,d_width,dh,flags,outfmt,tune); + return vf_next_config(vf,width,h,d_width,dh,flags,outfmt); } static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ Modified: mplayerxp/postproc/vf_flip.c =================================================================== --- mplayerxp/postproc/vf_flip.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_flip.c 2012-11-11 10:14:52 UTC (rev 325) @@ -20,7 +20,7 @@ #include <stdlib.h> #include <string.h> -#include "config.h" +#include "mp_config.h" #include "pp_msg.h" #include "xmpcore/mp_image.h" @@ -32,9 +32,9 @@ static int __FASTCALL__ config(struct vf_instance_s *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ flags&=~VOFLAG_FLIPPING; // remove the FLIP flag - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static int __FASTCALL__ put_slice(struct vf_instance_s *vf, mp_image_t *mpi){ Modified: mplayerxp/postproc/vf_format.c =================================================================== --- mplayerxp/postproc/vf_format.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_format.c 2012-11-11 10:14:52 UTC (rev 325) @@ -32,8 +32,8 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + unsigned int flags, unsigned int outfmt){ + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static uint32_t get_format(const char *args) Modified: mplayerxp/postproc/vf_menu.c =================================================================== --- mplayerxp/postproc/vf_menu.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_menu.c 2012-11-11 10:14:52 UTC (rev 325) @@ -224,7 +224,7 @@ } static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune) { + unsigned int flags, unsigned int outfmt) { #ifdef HAVE_FREETYPE // here is the right place to get screen dimensions if (force_load_font) { @@ -233,7 +233,7 @@ } #endif if(outfmt == IMGFMT_MPEGPES) vf->priv->passthrough = 1; - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static int __FASTCALL__ query_format(struct vf_instance_s* vf, unsigned int fmt,unsigned w,unsigned h){ Modified: mplayerxp/postproc/vf_mirror.c =================================================================== --- mplayerxp/postproc/vf_mirror.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_mirror.c 2012-11-11 10:14:52 UTC (rev 325) @@ -89,10 +89,10 @@ //===========================================================================// static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ vf->priv->dw=width; vf->priv->dh=height; - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ Modified: mplayerxp/postproc/vf_noise.c =================================================================== --- mplayerxp/postproc/vf_noise.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_noise.c 2012-11-11 10:14:52 UTC (rev 325) @@ -318,9 +318,9 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void __FASTCALL__ get_image(struct vf_instance_s* vf, mp_image_t *mpi){ Modified: mplayerxp/postproc/vf_ow.c =================================================================== --- mplayerxp/postproc/vf_ow.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_ow.c 2012-11-11 10:14:52 UTC (rev 325) @@ -204,7 +204,7 @@ // printf("%f\n", sum/height/width); } -static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt, any_t*tune){ +static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){ int h= (height+15)&(~15); int i,j; @@ -213,8 +213,7 @@ for(i=0; i<=vf->priv->depth; i++) vf->priv->plane[i][j]= mp_malloc(vf->priv->stride*h*sizeof(vf->priv->plane[0][0][0])); } - - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void __FASTCALL__ get_image(struct vf_instance_s* vf, mp_image_t *mpi){ Modified: mplayerxp/postproc/vf_palette.c =================================================================== --- mplayerxp/postproc/vf_palette.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_palette.c 2012-11-11 10:14:52 UTC (rev 325) @@ -62,7 +62,7 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ if (!vf->priv->fmt) vf->priv->fmt=find_best(vf,outfmt,d_width,d_height); if(!vf->priv->fmt){ @@ -71,7 +71,7 @@ else if(outfmt==IMGFMT_BGR8) vf->priv->fmt=IMGFMT_BGR32; else return 0; } - return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt); } static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ Modified: mplayerxp/postproc/vf_panscan.c =================================================================== --- mplayerxp/postproc/vf_panscan.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_panscan.c 2012-11-11 10:14:52 UTC (rev 325) @@ -34,7 +34,7 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ unsigned w,h,d_w,d_h; vf->priv->org_w=width; vf->priv->org_h=height; @@ -82,7 +82,7 @@ } vf->priv->fmt=outfmt; MSG_DBG2("w,h=%i %i org_w,h=%i %i\n",w,h,vf->priv->org_w,vf->priv->org_h); - return vf_next_config(vf,w,h,d_w,d_h,flags,outfmt,tune); + return vf_next_config(vf,w,h,d_w,d_h,flags,outfmt); } @@ -219,7 +219,7 @@ //===========================================================================// static int __FASTCALL__ crop_config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ unsigned w,h,d_w,d_h; vf->priv->org_w=width; vf->priv->org_h=height; @@ -248,7 +248,7 @@ } d_w=(float)d_width*vf->priv->ps_w/width; d_h=(float)d_height*vf->priv->ps_h/height; - return vf_next_config(vf,w,h,d_w,d_h,flags,outfmt,tune); + return vf_next_config(vf,w,h,d_w,d_h,flags,outfmt); } static MPXP_Rc __FASTCALL__ vf_crop_open(vf_instance_t *vf,const char* args){ Modified: mplayerxp/postproc/vf_perspective.c =================================================================== --- mplayerxp/postproc/vf_perspective.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_perspective.c 2012-11-11 10:14:52 UTC (rev 325) @@ -100,7 +100,7 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ int i, j; vf->priv->pvStride= width; @@ -122,7 +122,7 @@ vf->priv->coeff[i][j]= (int)floor((1<<COEFF_BITS)*temp[j]/sum + 0.5); } - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void __FASTCALL__ uninit(struct vf_instance_s* vf){ Modified: mplayerxp/postproc/vf_pp.c =================================================================== --- mplayerxp/postproc/vf_pp.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_pp.c 2012-11-11 10:14:52 UTC (rev 325) @@ -26,7 +26,7 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int voflags, unsigned int outfmt,any_t*tune){ + unsigned int voflags, unsigned int outfmt){ int flags= (gCpuCaps.hasMMX ? PP_CPU_CAPS_MMX : 0) | (gCpuCaps.hasMMX2 ? PP_CPU_CAPS_MMX2 : 0) @@ -42,7 +42,7 @@ if(vf->priv->context) pp_free_context(vf->priv->context); vf->priv->context= pp2_get_context(width, height, flags); - return vf_next_config(vf,width,height,d_width,d_height,voflags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,voflags,outfmt); } static void __FASTCALL__ uninit(struct vf_instance_s* vf){ Modified: mplayerxp/postproc/vf_raw.c =================================================================== --- mplayerxp/postproc/vf_raw.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_raw.c 2012-11-11 10:14:52 UTC (rev 325) @@ -25,8 +25,8 @@ //===========================================================================// static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + unsigned int flags, unsigned int outfmt){ + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ Modified: mplayerxp/postproc/vf_rectangle.c =================================================================== --- mplayerxp/postproc/vf_rectangle.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_rectangle.c 2012-11-11 10:14:52 UTC (rev 325) @@ -14,7 +14,7 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune) + unsigned int flags, unsigned int outfmt) { if (vf->priv->w < 0 || width < vf->priv->w) vf->priv->w = width; @@ -29,7 +29,7 @@ MSG_WARN("rectangle: bad position/width/height - rectangle area is out of the original!\n"); return 0; } - return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt,tune); + return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); } static MPXP_Rc __FASTCALL__ control(struct vf_instance_s* vf, int request, any_t*data) Modified: mplayerxp/postproc/vf_rgb2bgr.c =================================================================== --- mplayerxp/postproc/vf_rgb2bgr.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_rgb2bgr.c 2012-11-11 10:14:52 UTC (rev 325) @@ -40,9 +40,9 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ vf->priv->fmt=getfmt(outfmt,vf->priv->forced); - return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt); } #define rgb32tobgr32(a,b,c) shuffle_bytes_3210(a,b,c) Modified: mplayerxp/postproc/vf_rotate.c =================================================================== --- mplayerxp/postproc/vf_rotate.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_rotate.c 2012-11-11 10:14:52 UTC (rev 325) @@ -115,13 +115,13 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ vf->priv->dw=width; vf->priv->dh=height; if(vf->priv->direction==180) - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt,tune); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); else - return vf_next_config(vf,height,width,d_height,d_width,flags,outfmt,tune); + return vf_next_config(vf,height,width,d_height,d_width,flags,outfmt); } static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ Modified: mplayerxp/postproc/vf_scale.c =================================================================== --- mplayerxp/postproc/vf_scale.c 2012-11-10 17:01:29 UTC (rev 324) +++ mplayerxp/postproc/vf_scale.c 2012-11-11 10:14:52 UTC (rev 325) @@ -130,7 +130,7 @@ static int __FASTCALL__ config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt,any_t*tune){ + unsigned int flags, unsigned int outfmt){ unsigned int best=find_best_out(vf,d_width,d_height); int vo_flags; int int_sws_flags=0; @@ -303,7 +303,7 @@ //d_width=d_width*vf->priv->w/width; //d_height=d_height*vf->priv->h/height; } - return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best,tune); + return vf_next_config(vf,vf... [truncated message content] |
From: <nic...@us...> - 2012-11-11 11:47:17
|
Revision: 326 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=326&view=rev Author: nickols_k Date: 2012-11-11 11:47:09 +0000 (Sun, 11 Nov 2012) Log Message: ----------- still one step in antiviral protection Modified Paths: -------------- mplayerxp/libao2/audio_out.c mplayerxp/libmpcodecs/ad.c mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd.h mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/demuxer.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/mplayerxp.c mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h mplayerxp/postproc/Makefile mplayerxp/postproc/af.c mplayerxp/postproc/af.h mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h Added Paths: ----------- mplayerxp/libmpdemux/demux_null.c mplayerxp/postproc/af_null.c mplayerxp/postproc/vf_null.c Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libao2/audio_out.c 2012-11-11 11:47:09 UTC (rev 326) @@ -35,7 +35,7 @@ extern const ao_functions_t audio_out_jack; #endif -const ao_functions_t* audio_out_drivers[] = +static const ao_functions_t* audio_out_drivers[] = { #ifdef USE_OSS_AUDIO &audio_out_oss, @@ -184,18 +184,17 @@ const ao_functions_t* __FASTCALL__ ao_register(const char *driver_name) { - unsigned i; - if(!driver_name) - audio_out=audio_out_drivers[0]; - else - for (i=0; audio_out_drivers[i] != NULL; i++) - { - const ao_info_t *info = audio_out_drivers[i]->info; - if(strcmp(info->short_name,driver_name) == 0){ - audio_out = audio_out_drivers[i];break; + unsigned i; + if(!driver_name) + audio_out=audio_out_drivers[0]; + else + for (i=0; audio_out_drivers[i] != &audio_out_null; i++) { + const ao_info_t *info = audio_out_drivers[i]->info; + if(strcmp(info->short_name,driver_name) == 0){ + audio_out = audio_out_drivers[i];break; + } } - } - return audio_out; + return audio_out; } const ao_info_t* ao_get_info( void ) Modified: mplayerxp/libmpcodecs/ad.c =================================================================== --- mplayerxp/libmpcodecs/ad.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libmpcodecs/ad.c 2012-11-11 11:47:09 UTC (rev 326) @@ -34,8 +34,7 @@ extern const ad_functions_t mpcodecs_ad_dmo; extern const ad_functions_t mpcodecs_ad_qtaudio; -const ad_functions_t* mpcodecs_ad_drivers[] = { - &mpcodecs_ad_null, +static const ad_functions_t* mpcodecs_ad_drivers[] = { &mpcodecs_ad_mp3, &mpcodecs_ad_a52, &mpcodecs_ad_dca, @@ -58,22 +57,33 @@ &mpcodecs_ad_dmo, &mpcodecs_ad_qtaudio, #endif - NULL + &mpcodecs_ad_null, + }; static unsigned int nddrivers=sizeof(mpcodecs_ad_drivers)/sizeof(ad_functions_t*); void libmpcodecs_ad_register_options(m_config_t* cfg) { - unsigned i; - for(i=0;i<nddrivers;i++) - { - if(mpcodecs_ad_drivers[i]) - if(mpcodecs_ad_drivers[i]->options) - m_config_register_options(cfg,mpcodecs_ad_drivers[i]->options); - } + unsigned i; + for(i=0;i<nddrivers;i++) { + if(mpcodecs_ad_drivers[i]) + if(mpcodecs_ad_drivers[i]->options) + m_config_register_options(cfg,mpcodecs_ad_drivers[i]->options); + if(mpcodecs_ad_drivers[i]==&mpcodecs_ad_null) break; + } } +const ad_functions_t* afm_find_driver(const char *name) { + unsigned i; + for (i=0; mpcodecs_ad_drivers[i] != &mpcodecs_ad_null; i++) { + if(strcmp(mpcodecs_ad_drivers[i]->info->driver_name,name)==0){ + return mpcodecs_ad_drivers[i]; + } + } + return NULL; +} + void afm_help(void) { unsigned i; MSG_INFO("Available audio codec families/drivers:\n"); Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libmpcodecs/ad.h 2012-11-11 11:47:09 UTC (rev 326) @@ -32,7 +32,7 @@ unsigned (* __FASTCALL__ decode)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); } ad_functions_t; -extern const ad_functions_t* mpcodecs_ad_drivers[]; +extern const ad_functions_t* afm_find_driver(const char *name); #define FIX_APTS(sh_audio,pts,in_size) (sh_audio->i_bps?((float)(pts)+(float)(in_size)/(float)sh_audio->i_bps):((float)(pts))) #endif Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-11-11 11:47:09 UTC (rev 326) @@ -28,23 +28,9 @@ static const ad_functions_t* mpadec; -const ad_functions_t* mpca_find_driver(const char *name) { - unsigned i; - for (i=0; mpcodecs_ad_drivers[i] != NULL; i++) { - if(strcmp(mpcodecs_ad_drivers[i]->info->driver_name,name)==0){ - return mpcodecs_ad_drivers[i]; - } - } - return NULL; -} - MPXP_Rc mpca_init(sh_audio_t *sh_audio) { - unsigned i; - for (i=0; mpcodecs_ad_drivers[i] != NULL; i++) - if(strcmp(mpcodecs_ad_drivers[i]->info->driver_name,sh_audio->codec->driver_name)==0){ - mpadec=mpcodecs_ad_drivers[i]; break; - } + mpadec=afm_find_driver(sh_audio->codec->driver_name); if(!mpadec){ MSG_ERR(MSGTR_CODEC_BAD_AFAMILY,sh_audio->codec->codec_name, sh_audio->codec->driver_name); return MPXP_False; // no such driver Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-11 11:47:09 UTC (rev 326) @@ -86,13 +86,6 @@ static unsigned smp_num_cpus=1; static unsigned use_vf_threads=0; -static const vd_functions_t* mpcv_find_driver_by_name(const char *name) { - unsigned i; - for (i=0; mpcodecs_vd_drivers[i] != NULL; i++) - if(strcmp(mpcodecs_vd_drivers[i]->info->driver_name,name)==0) break; - return mpcodecs_vd_drivers[i]; -} - static void mpcv_print_codec_info(sh_video_t* sh_video) { MSG_OK("[VC] %s decoder: [%s] drv:%s.%s (%dx%d (aspect %g) %4.2ffps\n" ,mp_conf.video_codec?"Forcing":"Selected" @@ -121,9 +114,14 @@ MPXP_Rc mpcv_ffmpeg_init(sh_video_t*sh_video,any_t* libinput) { /* Use ffmpeg's drivers as last hope */ - mpvdec=mpcv_find_driver_by_name("ffmpeg"); - if(mpvdec->init(sh_video,libinput)!=MPXP_Ok){ - MSG_ERR(MSGTR_CODEC_CANT_INITV); + mpvdec=vfm_find_driver("ffmpeg"); + if(mpvdec) { + if(mpvdec->init(sh_video,libinput)!=MPXP_Ok){ + MSG_ERR(MSGTR_CODEC_CANT_INITV); + return MPXP_False; + } + } else { + MSG_ERR("Cannot find ffmpeg video decoder\n"); return MPXP_False; } mpcv_print_codec_info(sh_video); @@ -155,7 +153,7 @@ } sh_video->codec->flags|=CODECS_FLAG_SELECTED; // tagging it // ok, it matches all rules, let's find the driver! - if(!(mpvdec=mpcv_find_driver_by_name(sh_video->codec->driver_name))) continue; + if(!(mpvdec=vfm_find_driver(sh_video->codec->driver_name))) continue; else MSG_DBG3("mpcv_init: mpcodecs_vd_drivers[%s]->mpvdec==0\n",mpcodecs_vd_drivers[i]->info->driver_name); // it's available, let's try to init! if(mpvdec->init(sh_video,libinput)!=MPXP_Ok){ Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libmpcodecs/vd.c 2012-11-11 11:47:09 UTC (rev 326) @@ -41,8 +41,7 @@ extern const vd_functions_t mpcodecs_vd_qtvideo; extern const vd_functions_t mpcodecs_vd_theora; -const vd_functions_t* mpcodecs_vd_drivers[] = { - &mpcodecs_vd_null, +static const vd_functions_t* mpcodecs_vd_drivers[] = { &mpcodecs_vd_ffmpeg, #ifdef HAVE_WIN32LOADER &mpcodecs_vd_dshow, @@ -66,6 +65,7 @@ #ifdef HAVE_LIBDV &mpcodecs_vd_libdv, #endif + &mpcodecs_vd_null, NULL }; static unsigned int nddrivers=sizeof(mpcodecs_vd_drivers)/sizeof(vd_functions_t*); @@ -77,9 +77,18 @@ if(mpcodecs_vd_drivers[i]) if(mpcodecs_vd_drivers[i]->options) m_config_register_options(cfg,mpcodecs_vd_drivers[i]->options); + if(mpcodecs_vd_drivers[i]==&mpcodecs_vd_null) break; } } +const vd_functions_t* vfm_find_driver(const char *name) { + unsigned i; + for (i=0; mpcodecs_vd_drivers[i] != &mpcodecs_vd_null; i++) + if(strcmp(mpcodecs_vd_drivers[i]->info->driver_name,name)==0) + return mpcodecs_vd_drivers[i]; + return NULL; +} + void vfm_help(void) { unsigned i; MSG_INFO("Available video codec families/drivers:\n"); Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libmpcodecs/vd.h 2012-11-11 11:47:09 UTC (rev 326) @@ -23,8 +23,7 @@ mp_image_t* (*__FASTCALL__ decode)(sh_video_t *sh,const enc_frame_t* frame); } vd_functions_t; -// NULL terminated array of all drivers -extern const vd_functions_t* mpcodecs_vd_drivers[]; +const vd_functions_t* vfm_find_driver(const char *name); enum { VDCTRL_QUERY_FORMAT =3, /* test for availabilty of a format */ Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libmpdemux/Makefile 2012-11-11 11:47:09 UTC (rev 326) @@ -39,7 +39,7 @@ SRCS += mpdemux.c demux_bmp.c demux_rawaudio.c demux_aiff.c demux_vqf.c SRCS += demux_pva.c demux_rawvideo.c demux_smjpeg.c demux_ts.c demux_ty.c demux_nsv.c SRCS += demux_mkv.c demux_mpxp64.c sub_cc.c sub_ty.c -SRCS += demux_lavf.c +SRCS += demux_lavf.c demux_null.c ifeq ($(HAVE_LIBVORBIS),yes) SRCS += demux_ogg.c endif Added: mplayerxp/libmpdemux/demux_null.c =================================================================== --- mplayerxp/libmpdemux/demux_null.c (rev 0) +++ mplayerxp/libmpdemux/demux_null.c 2012-11-11 11:47:09 UTC (rev 326) @@ -0,0 +1,54 @@ +#include "mp_config.h" + +#include <stdlib.h> +#include <stdio.h> + +#include "stream.h" +#include "demuxer.h" +#include "stheader.h" +#include "libmpconf/cfgparser.h" + +static const config_t demux_null_opts[] = { + {NULL, NULL, 0, 0, 0, 0, NULL} +}; + +static const config_t null_conf[] = { + { "null", &demux_null_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Null specific commands"}, + { NULL,NULL, 0, 0, 0, 0, NULL} +}; + +static int null_probe(demuxer_t* demuxer) +{ + return 0; +} + +static demuxer_t* null_open(demuxer_t* demuxer) { + return NULL; +} + +static int null_demux(demuxer_t* demuxer, demux_stream_t *ds) { + return 0; +} + +static void null_seek(demuxer_t *demuxer,const seek_args_t* seeka){ +} + +static void null_close(demuxer_t* demuxer) {} + +static int null_control(demuxer_t *demuxer,int cmd,any_t*args) +{ + return DEMUX_UNKNOWN; +} + +demuxer_driver_t demux_null = +{ + "NULL parser", + "...", + null_conf, + null_probe, + null_open, + null_demux, + null_seek, + null_close, + null_control +}; Property changes on: mplayerxp/libmpdemux/demux_null.c ___________________________________________________________________ Added: svn:eol-style + native Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libmpdemux/demuxer.c 2012-11-11 11:47:09 UTC (rev 326) @@ -53,8 +53,9 @@ extern demuxer_driver_t demux_ty; extern demuxer_driver_t demux_audio; extern demuxer_driver_t demux_lavf; +extern demuxer_driver_t demux_null; -static demuxer_driver_t *ddrivers[] = +static const demuxer_driver_t *ddrivers[] = { &demux_rawaudio, &demux_rawvideo, @@ -84,27 +85,27 @@ &demux_audio, &demux_mpgts, &demux_ty, - &demux_lavf + &demux_lavf, + &demux_null, + NULL }; -static unsigned int nddrivers=sizeof(ddrivers)/sizeof(demuxer_driver_t*); typedef struct demuxer_info_st { - char *id[INFOT_MAX]; + char *id[INFOT_MAX]; } demuxer_info_t; void libmpdemux_register_options(m_config_t* cfg) { - unsigned i; - for(i=0;i<nddrivers;i++) - { - if(ddrivers[i]->options) - m_config_register_options(cfg,ddrivers[i]->options); - } + unsigned i; + for(i=0;ddrivers[i];i++) { + if(ddrivers[i]->options) + m_config_register_options(cfg,ddrivers[i]->options); + if(ddrivers[i]==&demux_null) break; + } } void free_demuxer_stream(demux_stream_t *ds){ - if(ds) - { + if(ds) { ds_free_packs(ds); mp_free(ds); } @@ -159,8 +160,7 @@ sh_audio_t *get_sh_audio(demuxer_t *demuxer, int id) { - if(id > MAX_A_STREAMS-1 || id < 0) - { + if(id > MAX_A_STREAMS-1 || id < 0) { MSG_WARN("Requested audio stream id overflow (%d > %d)\n", id, MAX_A_STREAMS); return NULL; @@ -169,13 +169,12 @@ } sh_audio_t* new_sh_audio_aid(demuxer_t *demuxer,int id,int aid){ - if(id > MAX_A_STREAMS-1 || id < 0) - { + if(id > MAX_A_STREAMS-1 || id < 0) { MSG_WARN("Requested audio stream id overflow (%d > %d)\n", id, MAX_A_STREAMS); return NULL; } - if(demuxer->a_streams[id]){ + if(demuxer->a_streams[id]) { MSG_WARN(MSGTR_AudioStreamRedefined,id); } else { sh_audio_t *sh; @@ -199,8 +198,7 @@ sh_video_t *get_sh_video(demuxer_t *demuxer, int id) { - if(id > MAX_V_STREAMS-1 || id < 0) - { + if(id > MAX_V_STREAMS-1 || id < 0) { MSG_WARN("Requested video stream id overflow (%d > %d)\n", id, MAX_V_STREAMS); return NULL; @@ -209,13 +207,12 @@ } sh_video_t* new_sh_video_vid(demuxer_t *demuxer,int id,int vid){ - if(id > MAX_V_STREAMS-1 || id < 0) - { + if(id > MAX_V_STREAMS-1 || id < 0) { MSG_WARN("Requested video stream id overflow (%d > %d)\n", id, MAX_V_STREAMS); return NULL; } - if(demuxer->v_streams[id]){ + if(demuxer->v_streams[id]) { MSG_WARN(MSGTR_VideoStreamRedefined,id); } else { MSG_V("==> Found video stream: %d\n",id); @@ -263,11 +260,10 @@ // dp->pts=pts; //(float)pts/90000.0f; // dp->pos=pos; // append packet to DS stream: - if(dp->len>0) - { + if(dp->len>0) { ++ds->packs; ds->bytes+=dp->len; - if(ds->last){ + if(ds->last) { // next packet in stream ds->last->next=dp; ds->last=dp; @@ -309,7 +305,7 @@ demuxer_t *demux=ds->demuxer; if(ds->buffer) mp_free(ds->buffer); /* ds_free_packs(ds); */ - if(mp_conf.verbose>2){ + if(mp_conf.verbose>2) { if(ds==demux->audio) MSG_DBG3("ds_fill_buffer(d_audio) called\n"); else @@ -543,16 +539,14 @@ pts_from_bps=0; demux_aid_vid_mismatch = 0; i=0; - again: - for(;i<nddrivers;i++) - { +again: + for(;ddrivers[i]!=&demux_null;i++) { /* don't remove it from loop!!! (for initializing) */ demuxer = new_demuxer(stream,DEMUXER_TYPE_UNKNOWN,audio_id,video_id,dvdsub_id); MSG_V("Probing %s ... ",ddrivers[i]->name); stream_reset(demuxer->stream); stream_seek(demuxer->stream,demuxer->stream->start_pos); - if(ddrivers[i]->probe(demuxer)) - { + if(ddrivers[i]->probe(demuxer)) { MSG_V("OK\n"); demuxer->driver = ddrivers[i]; break; @@ -560,15 +554,13 @@ MSG_V("False\n"); FREE_DEMUXER(demuxer); } - if(!demuxer || !demuxer->driver) - { + if(!demuxer || !demuxer->driver) { MSG_ERR(MSGTR_FormatNotRecognized); FREE_DEMUXER(demuxer); return NULL; } - if(!(new_demux=demuxer->driver->open(demuxer))) - { + if(!(new_demux=demuxer->driver->open(demuxer))) { MSG_ERR("Can't open stream with '%s'\n", demuxer->driver->name); demuxer->driver=NULL; i++; @@ -577,13 +569,10 @@ demuxer=new_demux; MSG_OK("Using: %s\n",demuxer->driver->name); for(i=0;i<sizeof(stream_txt_ids)/sizeof(struct s_stream_txt_ids);i++) - if(!demux_info_get(demuxer,stream_txt_ids[i].demuxer_id)) - { + if(!demux_info_get(demuxer,stream_txt_ids[i].demuxer_id)) { char stream_name[256]; - if(demuxer->stream->driver->control) - { - if(demuxer->stream->driver->control(demuxer->stream,stream_txt_ids[i].stream_id,stream_name) == SCTRL_OK) - { + if(demuxer->stream->driver->control) { + if(demuxer->stream->driver->control(demuxer->stream,stream_txt_ids[i].stream_id,stream_name) == SCTRL_OK) { demux_info_add(demuxer,stream_txt_ids[i].demuxer_id,stream_name); } } Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libvo/video_out.c 2012-11-11 11:47:09 UTC (rev 326) @@ -66,7 +66,7 @@ extern vo_functions_t video_out_xvidix; #endif -const vo_functions_t* video_out_drivers[] = +static const vo_functions_t* video_out_drivers[] = { #ifdef HAVE_XV &video_out_xv, @@ -152,17 +152,16 @@ const vo_functions_t *vo_register(vo_data_t*vo,const char *driver_name) { - unsigned i; - if(!driver_name) - video_out=video_out_drivers[0]; - else - for (i=0; video_out_drivers[i] != NULL; i++){ - const vo_info_t *info = video_out_drivers[i]->get_info (vo); - if(strcmp(info->short_name,driver_name) == 0){ - video_out = video_out_drivers[i];break; + unsigned i; + if(!driver_name) video_out=video_out_drivers[0]; + else + for (i=0; video_out_drivers[i] != &video_out_null; i++){ + const vo_info_t *info = video_out_drivers[i]->get_info (vo); + if(strcmp(info->short_name,driver_name) == 0){ + video_out = video_out_drivers[i];break; + } } - } - return video_out; + return video_out; } const vo_info_t* vo_get_info(vo_data_t*vo) Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/libvo/video_out.h 2012-11-11 11:47:09 UTC (rev 326) @@ -279,8 +279,4 @@ unsigned y_mul[4],y_div[4]; }vo_format_desc; extern int __FASTCALL__ vo_describe_fourcc(uint32_t fourcc,vo_format_desc *vd); - -// NULL terminated array of all drivers -extern const vo_functions_t* video_out_drivers[]; - #endif Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/mplayerxp.c 2012-11-11 11:47:09 UTC (rev 326) @@ -1132,7 +1132,7 @@ } if(mp_conf.audio_codec && strcmp(sh_audio->codec->codec_name,mp_conf.audio_codec)) continue; else if(mp_conf.audio_family && strcmp(sh_audio->codec->driver_name,mp_conf.audio_family)) continue; - if(mpca_find_driver(sh_audio->codec->driver_name)) { + if(afm_find_driver(sh_audio->codec->driver_name)) { MSG_V("%s audio codec: [%s] drv:%s (%s)\n",mp_conf.audio_codec?"Forcing":"Detected",sh_audio->codec->codec_name,sh_audio->codec->driver_name,sh_audio->codec->s_info); found=1; break; Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/osdep/mp_malloc.c 2012-11-11 11:47:09 UTC (rev 326) @@ -173,11 +173,12 @@ } return NULL; } -static __always_inline void print_backtrace(void) { + +static __always_inline void __print_backtrace(unsigned num) { bt_cache_t* cache=init_bt_cache(); - any_t* calls[10]; + any_t* calls[num]; unsigned i,ncalls; - ncalls=backtrace(calls,10); + ncalls=backtrace(calls,num); MSG_INFO("*** Backtrace for suspect call ***\n"); for(i=0;i<ncalls;i++) { MSG_INFO(" %p -> %s\n",calls[i],addr2line(cache,calls[i])); @@ -185,13 +186,15 @@ uninit_bt_cache(cache); } +void print_backtrace(unsigned num) { __print_backtrace(num); } + static void __prot_free_append(any_t*ptr) { any_t *page_ptr=prot_page_align(ptr); mp_slot_t* slot=prot_find_slot(&priv->mallocs,page_ptr); if(!slot) { printf("[__prot_free_append] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,page_ptr); __prot_print_slots(&priv->mallocs); - print_backtrace(); + __print_backtrace(10); kill(getpid(), SIGILL); } size_t fullsize=app_fullsize(slot->size); @@ -208,7 +211,7 @@ if(!slot) { printf("[__prot_realloc_append] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,prot_page_align(ptr)); __prot_print_slots(&priv->mallocs); - print_backtrace(); + __print_backtrace(10); kill(getpid(), SIGILL); } memcpy(rp,ptr,min(slot->size,size)); @@ -242,7 +245,7 @@ if(!slot) { printf("[__prot_free_prepend] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,page_ptr); __prot_print_slots(&priv->mallocs); - print_backtrace(); + __print_backtrace(10); kill(getpid(), SIGILL); } mprotect(page_ptr,__VM_PAGE_SIZE__,MP_PROT_READ|MP_PROT_WRITE); @@ -257,7 +260,7 @@ if(!slot) { printf("[__prot_realloc_prepend] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,pre_page_align(ptr)); __prot_print_slots(&priv->mallocs); - print_backtrace(); + __print_backtrace(10); kill(getpid(), SIGILL); } memcpy(rp,ptr,min(slot->size,size)); @@ -489,5 +492,5 @@ int __FASTCALL__ mp_mprotect(const any_t* addr,size_t len,enum mp_prot_e flags) { - return mprotect(addr,len,flags); + return mprotect((any_t*)addr,len,flags); } Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/osdep/mplib.h 2012-11-11 11:47:09 UTC (rev 326) @@ -61,4 +61,6 @@ MP_DENY_ALL =0x0, /* Page can not be accessed. */ }; extern int __FASTCALL__ mp_mprotect(const any_t* addr,size_t len,enum mp_prot_e flags); + +extern void print_backtrace(unsigned num); #endif Modified: mplayerxp/postproc/Makefile =================================================================== --- mplayerxp/postproc/Makefile 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/postproc/Makefile 2012-11-11 11:47:09 UTC (rev 326) @@ -7,9 +7,20 @@ DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done SRCS=postprocess.c swscale.c -SRCS+=af.c af_ao2.c af_crystality.c af_dummy.c af_delay.c af_channels.c af_format.c af_resample.c af_volume.c af_equalizer.c af_tools.c af_comp.c af_gate.c af_pan.c af_surround.c af_sub.c af_export.c af_volnorm.c af_extrastereo.c af_lp.c af_dyn.c af_echo3d.c af_hrtf.c af_ffenc.c af_raw.c af_karaoke.c af_center.c af_sinesuppress.c af_scaletempo.c +SRCS+=af.c af_ao2.c af_crystality.c af_dummy.c af_delay.c af_channels.c +SRCS+=af_format.c af_resample.c af_volume.c af_equalizer.c af_tools.c af_comp.c +SRCS+=af_gate.c af_pan.c af_surround.c af_sub.c af_export.c af_volnorm.c +SRCS+=af_extrastereo.c af_lp.c af_dyn.c af_echo3d.c af_hrtf.c af_ffenc.c +SRCS+=af_raw.c af_karaoke.c af_center.c af_sinesuppress.c af_scaletempo.c +SRCS+=af_null.c SRCS+=aflib.c -SRCS+=vf.c vf_vo.c vf_expand.c vf_flip.c vf_format.c vf_yuy2.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_eq.c vf_dint.c vf_1bpp.c vf_unsharp.c vf_swapuv.c vf_il.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_denoise3d.c vf_aspect.c vf_softpulldown.c vf_delogo.c vf_yuvcsp.c vf_pp.c vf_scale.c vf_panscan.c vf_raw.c vf_ow.c vf_2xsai.c vf_framestep.c vf_menu.c +SRCS+=vf.c vf_vo.c vf_expand.c vf_flip.c vf_format.c vf_yuy2.c vf_rgb2bgr.c +SRCS+=vf_rotate.c vf_mirror.c vf_palette.c vf_test.c vf_noise.c vf_yvu9.c +SRCS+=vf_rectangle.c vf_eq.c vf_dint.c vf_1bpp.c vf_unsharp.c vf_swapuv.c +SRCS+=vf_il.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_denoise3d.c +SRCS+=vf_aspect.c vf_softpulldown.c vf_delogo.c vf_yuvcsp.c vf_pp.c vf_scale.c +SRCS+=vf_panscan.c vf_raw.c vf_ow.c vf_2xsai.c vf_framestep.c vf_menu.c +SRCS+=vf_null.c OBJS=$(SRCS:.c=.o) CFLAGS = $(OPTFLAGS) -I. -I.. -Wall Modified: mplayerxp/postproc/af.c =================================================================== --- mplayerxp/postproc/af.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/postproc/af.c 2012-11-11 11:47:09 UTC (rev 326) @@ -40,8 +40,9 @@ extern const af_info_t af_info_karaoke; extern const af_info_t af_info_sinesuppress; extern const af_info_t af_info_scaletempo; +extern const af_info_t af_info_null; -static const af_info_t* filter_list[]={ +static const af_info_t* filter_list[]={ &af_info_ao, &af_info_center, &af_info_channels, @@ -72,6 +73,7 @@ &af_info_ffenc, &af_info_scaletempo, &af_info_raw, + &af_info_null, NULL }; @@ -80,10 +82,10 @@ /* Find a filter in the static list of filters using it's name. This function is used internally */ -static const af_info_t* __FASTCALL__ af_find(char*name) +static const af_info_t* __FASTCALL__ af_find(const char* name) { int i=0; - while(filter_list[i]){ + while(filter_list[i]!=&af_info_null){ if(!strcmp(filter_list[i]->name,name)) return filter_list[i]; i++; @@ -94,7 +96,7 @@ /* Find filter in the dynamic filter list using it's name This function is used for finding already initialized filters */ -af_instance_t* __FASTCALL__ af_get(af_stream_t* s, char* name) +af_instance_t* __FASTCALL__ af_get(af_stream_t* s,const char* name) { af_instance_t* af=s->first; // Find the filter @@ -108,7 +110,7 @@ /*/ Function for creating a new filter of type name. The name may contain the commandline parameters for the filter */ -static af_instance_t* __FASTCALL__ af_create(af_stream_t* s, char* name) +static af_instance_t* __FASTCALL__ af_create(af_stream_t* s,const char* name) { char* cmdline = name; @@ -159,7 +161,7 @@ /* Create and insert a new filter of type name before the filter in the argument. This function can be called during runtime, the return value is the new filter */ -static af_instance_t* __FASTCALL__ af_prepend(af_stream_t* s, af_instance_t* af, char* name) +static af_instance_t* __FASTCALL__ af_prepend(af_stream_t* s, af_instance_t* af,const char* name) { // Create the new filter and make sure it is OK af_instance_t* new=af_create(s,name); @@ -184,7 +186,7 @@ /* Create and insert a new filter of type name after the filter in the argument. This function can be called during runtime, the return value is the new filter */ -af_instance_t* af_append(af_stream_t* s, af_instance_t* af, char* name) +static af_instance_t* af_append(af_stream_t* s, af_instance_t* af,const char* name) { // Create the new filter and make sure it is OK af_instance_t* new=af_create(s,name); @@ -325,8 +327,8 @@ } // Check if there are any filters left in the list if(NULL == af){ - if(!(af=af_append(s,s->first,"dummy"))) - return -1; + if(!(af=af_append(s,s->first,"dummy"))) + return -1; } else af=af->next; @@ -476,7 +478,7 @@ to the stream s. The filter will be inserted somewhere nice in the list of filters. The return value is a pointer to the new filter, If the filter couldn't be added the return value is NULL. */ -af_instance_t* af_add(af_stream_t* s, char* name){ +af_instance_t* af_add(af_stream_t* s,const char* name){ af_instance_t* new; // Sanity check if(!s || !s->first || !name) Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/postproc/af.h 2012-11-11 11:47:09 UTC (rev 326) @@ -125,14 +125,14 @@ to the stream s. The filter will be inserted somewhere nice in the list of filters. The return value is a pointer to the new filter, If the filter couldn't be added the return value is NULL. */ -af_instance_t* af_add(af_stream_t* s, char* name); +af_instance_t* af_add(af_stream_t* s,const char* name); // Uninit and remove the filter "af" void af_remove(af_stream_t* s, af_instance_t* af); /* Find filter in the dynamic filter list using it's name This function is used for finding already initialized filters */ -af_instance_t* __FASTCALL__ af_get(af_stream_t* s, char* name); +af_instance_t* __FASTCALL__ af_get(af_stream_t* s,const char* name); // Filter data chunk through the filters in the list mp_aframe_t* __FASTCALL__ af_play(af_stream_t* s, mp_aframe_t* data); Added: mplayerxp/postproc/af_null.c =================================================================== --- mplayerxp/postproc/af_null.c (rev 0) +++ mplayerxp/postproc/af_null.c 2012-11-11 11:47:09 UTC (rev 326) @@ -0,0 +1,16 @@ +#include "af.h" + +// Allocate memory and set function pointers +static MPXP_Rc open(af_instance_t* af){ + return MPXP_Error; +} + +// Description of this filter +const af_info_t af_info_null = { + "Null audio filter", + "null", + "Nickols_K", + "", + AF_FLAGS_REENTRANT, + open +}; Property changes on: mplayerxp/postproc/af_null.c ___________________________________________________________________ Added: svn:eol-style + native Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/postproc/vf.c 2012-11-11 11:47:09 UTC (rev 326) @@ -57,6 +57,7 @@ extern const vf_info_t vf_info_yuvcsp; extern const vf_info_t vf_info_yuy2; extern const vf_info_t vf_info_yvu9; +extern const vf_info_t vf_info_null; // list of available filters: static const vf_info_t* filter_list[]={ @@ -98,6 +99,7 @@ &vf_info_yuvcsp, &vf_info_yuy2, &vf_info_yvu9, + &vf_info_null, NULL }; @@ -278,18 +280,18 @@ return 1;//vf_next_query_format(vf,fmt,w,h); } -vf_instance_t* __FASTCALL__ vf_open_plugin(const vf_info_t** _filter_list,vf_instance_t* next,sh_video_t *sh,char *name, char *args,any_t* libinput){ +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){ vf_instance_t* vf; int i; for(i=0;;i++){ - if(!_filter_list[i]){ + if(filter_list[i]==&vf_info_null){ MSG_ERR("Can't find video filter: %s\n",name); return NULL; // no such filter! } - if(!strcmp(_filter_list[i]->name,name)) break; + if(!strcmp(filter_list[i]->name,name)) break; } vf=mp_mallocz(sizeof(vf_instance_t)); - vf->info=_filter_list[i]; + vf->info=filter_list[i]; vf->next=next; vf->prev=NULL; vf->config=vf_next_config; @@ -310,11 +312,11 @@ return NULL; } -vf_instance_t* __FASTCALL__ vf_open_filter(vf_instance_t* next,sh_video_t *sh,char *name, char *args,any_t*libinput){ +vf_instance_t* __FASTCALL__ vf_open_filter(vf_instance_t* next,sh_video_t *sh,const char *name,const char *args,any_t*libinput){ if(strcmp(name,"vo")) { MSG_V("Open video filter: [%s]\n", name); } - return vf_open_plugin(filter_list,next,sh,name,args,libinput); + return vf_open_plugin(next,sh,name,args,libinput); } //============================================================================ @@ -422,9 +424,6 @@ //============================================================================ vf_instance_t* __FASTCALL__ append_filters(vf_instance_t* last){ - vf_instance_t* vf; - int i; - return last; } @@ -475,7 +474,7 @@ arg=strchr(vf_last,'='); if(arg) { *arg=0; arg++; } MSG_V("Attach filter %s\n",vf_last); - vfi=vf_open_plugin(filter_list,vfi,sh,vf_last,arg,libinput); + vfi=vf_open_plugin(vfi,sh,vf_last,arg,libinput); if(!vfi) vfi=vfi_prev; vfi_prev=vfi; } Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-11-11 10:14:52 UTC (rev 325) +++ mplayerxp/postproc/vf.h 2012-11-11 11:47:09 UTC (rev 326) @@ -104,9 +104,8 @@ mp_image_t* __FASTCALL__ vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h,unsigned idx); int __FASTCALL__ vf_query_format(vf_instance_t* vf, unsigned int fmt,unsigned width,unsigned height); -vf_instance_t* __FASTCALL__ vf_open_plugin(const vf_info_t** filter_list, vf_instance_t* next,sh_video_t *sh, char *name, char *args,any_t*libinput); -vf_instance_t* __FASTCALL__ vf_open_filter(vf_instance_t* next,sh_video_t *sh,char *name, char *args,any_t*libinput); -vf_instance_t* __FASTCALL__ vf_open_encoder(vf_instance_t* next, char *name, char *args); +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); Added: mplayerxp/postproc/vf_null.c =================================================================== --- mplayerxp/postproc/vf_null.c (rev 0) +++ mplayerxp/postproc/vf_null.c 2012-11-11 11:47:09 UTC (rev 326) @@ -0,0 +1,17 @@ +#include "mp_config.h" +#include "vf.h" + +static MPXP_Rc __FASTCALL__ vf_open(vf_instance_t *vf,const char* args){ + return MPXP_False; +} + +const vf_info_t vf_info_null = { + "null filter", + "null", + "Nickols_K", + "", + VF_FLAGS_THREADS, + vf_open +}; + +//===========================================================================// Property changes on: mplayerxp/postproc/vf_null.c ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-12 09:23:15
|
Revision: 335 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=335&view=rev Author: nickols_k Date: 2012-11-12 09:23:05 +0000 (Mon, 12 Nov 2012) Log Message: ----------- move mixer into libao2 Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libao2/Makefile mplayerxp/mplayerxp.c Added Paths: ----------- mplayerxp/libao2/mixer.c mplayerxp/libao2/mixer.h Removed Paths: ------------- mplayerxp/mixer.c mplayerxp/mixer.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-12 09:03:29 UTC (rev 334) +++ mplayerxp/Makefile 2012-11-12 09:23:05 UTC (rev 335) @@ -24,7 +24,7 @@ LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs SRCS_COMMON = mp_msg.c -SRCS_MPLAYER = mplayerxp.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c dump.c +SRCS_MPLAYER = mplayerxp.c fifo.c $(SRCS_COMMON) mp-opt-reg.c dump.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) Modified: mplayerxp/libao2/Makefile =================================================================== --- mplayerxp/libao2/Makefile 2012-11-12 09:03:29 UTC (rev 334) +++ mplayerxp/libao2/Makefile 2012-11-12 09:23:05 UTC (rev 335) @@ -4,7 +4,7 @@ LIBNAME = libao2.a # TODO: moveout ao_sdl.c so it's only used when SDL is detected -SRCS= audio_out.c afmt.c ao_null.c ao_wav.c +SRCS= audio_out.c afmt.c ao_null.c ao_wav.c mixer.c ifeq ($(HAVE_SDL),yes) SRCS+=ao_sdl.c endif Copied: mplayerxp/libao2/mixer.c (from rev 333, mplayerxp/mixer.c) =================================================================== --- mplayerxp/libao2/mixer.c (rev 0) +++ mplayerxp/libao2/mixer.c 2012-11-12 09:23:05 UTC (rev 335) @@ -0,0 +1,69 @@ +#include <string.h> +#include <sys/ioctl.h> +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> + +#include "mp_config.h" +#include "mixer.h" +#include "libao2/audio_out.h" + +void mixer_getvolume(ao_data_t* ao, float *l,float *r ) +{ + ao_control_vol_t vol; + *l=0; *r=0; + if(MPXP_Ok != ao_control(ao,AOCONTROL_GET_VOLUME,(long)&vol)) return; + *r=vol.right; + *l=vol.left; +} + +void mixer_setvolume(ao_data_t* ao,float l,float r ) +{ + ao_control_vol_t vol; + vol.right=r; vol.left=l; + ao_control(ao,AOCONTROL_SET_VOLUME,(long)&vol); +} + +#define MIXER_CHANGE 3 + +void mixer_incvolume(ao_data_t* ao) +{ + float mixer_l, mixer_r; + mixer_getvolume(ao, &mixer_l,&mixer_r ); + mixer_l += MIXER_CHANGE; + if ( mixer_l > 100 ) mixer_l = 100; + mixer_r += MIXER_CHANGE; + if ( mixer_r > 100 ) mixer_r = 100; + mixer_setvolume(ao, mixer_l,mixer_r ); +} + +void mixer_decvolume(ao_data_t* ao) +{ + float mixer_l, mixer_r; + mixer_getvolume(ao, &mixer_l,&mixer_r ); + mixer_l -= MIXER_CHANGE; + if ( mixer_l < 0 ) mixer_l = 0; + mixer_r -= MIXER_CHANGE; + if ( mixer_r < 0 ) mixer_r = 0; + mixer_setvolume(ao, mixer_l,mixer_r ); +} + +float mixer_getbothvolume(ao_data_t* ao) +{ + float mixer_l, mixer_r; + mixer_getvolume(ao, &mixer_l,&mixer_r ); + return ( mixer_l + mixer_r ) / 2; +} + +static int muted=0; +static float mute_l,mute_r; +void mixer_mute(ao_data_t* ao) +{ + if ( muted ) { mixer_setvolume(ao, mute_l,mute_r ); muted=0; } + else + { + mixer_getvolume(ao, &mute_l,&mute_r ); + mixer_setvolume(ao, 0,0 ); + muted=1; + } +} Copied: mplayerxp/libao2/mixer.h (from rev 333, mplayerxp/mixer.h) =================================================================== --- mplayerxp/libao2/mixer.h (rev 0) +++ mplayerxp/libao2/mixer.h 2012-11-12 09:23:05 UTC (rev 335) @@ -0,0 +1,15 @@ +#ifndef __MPLAYER_MIXER +#define __MPLAYER_MIXER +#include "libao2/audio_out.h" + +extern void mixer_getvolume(ao_data_t* ao,float *l,float *r ); +extern void mixer_setvolume(ao_data_t* ao,float l,float r ); +extern void mixer_incvolume(ao_data_t* ao); +extern void mixer_decvolume(ao_data_t* ao); +extern float mixer_getbothvolume(ao_data_t* ao); +void mixer_mute(ao_data_t* ao); + +//extern void mixer_setbothvolume( int v ); +static inline void mixer_setbothvolume(ao_data_t* ao, float v ) { mixer_setvolume(ao,v,v); } + +#endif Deleted: mplayerxp/mixer.c =================================================================== --- mplayerxp/mixer.c 2012-11-12 09:03:29 UTC (rev 334) +++ mplayerxp/mixer.c 2012-11-12 09:23:05 UTC (rev 335) @@ -1,69 +0,0 @@ -#include <string.h> -#include <sys/ioctl.h> -#include <fcntl.h> -#include <stdio.h> -#include <unistd.h> - -#include "mp_config.h" -#include "mixer.h" -#include "libao2/audio_out.h" - -void mixer_getvolume(ao_data_t* ao, float *l,float *r ) -{ - ao_control_vol_t vol; - *l=0; *r=0; - if(MPXP_Ok != ao_control(ao,AOCONTROL_GET_VOLUME,(long)&vol)) return; - *r=vol.right; - *l=vol.left; -} - -void mixer_setvolume(ao_data_t* ao,float l,float r ) -{ - ao_control_vol_t vol; - vol.right=r; vol.left=l; - ao_control(ao,AOCONTROL_SET_VOLUME,(long)&vol); -} - -#define MIXER_CHANGE 3 - -void mixer_incvolume(ao_data_t* ao) -{ - float mixer_l, mixer_r; - mixer_getvolume(ao, &mixer_l,&mixer_r ); - mixer_l += MIXER_CHANGE; - if ( mixer_l > 100 ) mixer_l = 100; - mixer_r += MIXER_CHANGE; - if ( mixer_r > 100 ) mixer_r = 100; - mixer_setvolume(ao, mixer_l,mixer_r ); -} - -void mixer_decvolume(ao_data_t* ao) -{ - float mixer_l, mixer_r; - mixer_getvolume(ao, &mixer_l,&mixer_r ); - mixer_l -= MIXER_CHANGE; - if ( mixer_l < 0 ) mixer_l = 0; - mixer_r -= MIXER_CHANGE; - if ( mixer_r < 0 ) mixer_r = 0; - mixer_setvolume(ao, mixer_l,mixer_r ); -} - -float mixer_getbothvolume(ao_data_t* ao) -{ - float mixer_l, mixer_r; - mixer_getvolume(ao, &mixer_l,&mixer_r ); - return ( mixer_l + mixer_r ) / 2; -} - -static int muted=0; -static float mute_l,mute_r; -void mixer_mute(ao_data_t* ao) -{ - if ( muted ) { mixer_setvolume(ao, mute_l,mute_r ); muted=0; } - else - { - mixer_getvolume(ao, &mute_l,&mute_r ); - mixer_setvolume(ao, 0,0 ); - muted=1; - } -} Deleted: mplayerxp/mixer.h =================================================================== --- mplayerxp/mixer.h 2012-11-12 09:03:29 UTC (rev 334) +++ mplayerxp/mixer.h 2012-11-12 09:23:05 UTC (rev 335) @@ -1,15 +0,0 @@ -#ifndef __MPLAYER_MIXER -#define __MPLAYER_MIXER -#include "libao2/audio_out.h" - -extern void mixer_getvolume(ao_data_t* ao,float *l,float *r ); -extern void mixer_setvolume(ao_data_t* ao,float l,float r ); -extern void mixer_incvolume(ao_data_t* ao); -extern void mixer_decvolume(ao_data_t* ao); -extern float mixer_getbothvolume(ao_data_t* ao); -void mixer_mute(ao_data_t* ao); - -//extern void mixer_setbothvolume( int v ); -static inline void mixer_setbothvolume(ao_data_t* ao, float v ) { mixer_setvolume(ao,v,v); } - -#endif Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-12 09:03:29 UTC (rev 334) +++ mplayerxp/mplayerxp.c 2012-11-12 09:23:05 UTC (rev 335) @@ -44,9 +44,6 @@ #include "libmpcodecs/dec_video.h" #include "libmpcodecs/dec_audio.h" -/* Common FIFO functions, and keyboard/event FIFO code */ -#include "fifo.h" - #ifdef USE_SUB #include "libmpsub/subreader.h" #endif @@ -71,7 +68,7 @@ #include "dump.h" #include "nls/nls.h" #include "postproc/libmenu/menu.h" -#include "mixer.h" +#include "libao2/mixer.h" #include "xmpcore/xmp_core.h" #include "xmpcore/xmp_vplayer.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-12 09:54:41
|
Revision: 339 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=339&view=rev Author: nickols_k Date: 2012-11-12 09:54:33 +0000 (Mon, 12 Nov 2012) Log Message: ----------- use enums and inline functions instead of #define Modified Paths: -------------- mplayerxp/libvo/osd_template.c mplayerxp/mplayerxp.c mplayerxp/osdep/aclib_template.c mplayerxp/postproc/aflib_accel.h mplayerxp/pvector/pvector.h mplayerxp/pvector/pvector_f32_x86.h mplayerxp/pvector/pvector_int_x86.h Modified: mplayerxp/libvo/osd_template.c =================================================================== --- mplayerxp/libvo/osd_template.c 2012-11-12 09:35:42 UTC (rev 338) +++ mplayerxp/libvo/osd_template.c 2012-11-12 09:54:33 UTC (rev 339) @@ -70,12 +70,12 @@ if(srca[x]) *dst=((dstbase[x]*srca[x])>>8)+src[x]; if(_ivec_aligned(dst)) break; /* align on sizeof(MMREG) boundary */ } - if((w-x)>=__IVEC_SIZE) - for(;x<w;x+=__IVEC_SIZE){ + if((w-x)>=_ivec_size()) + for(;x<w;x+=_ivec_size()){ __ivec vmsk,vdest,vsrc,vsrca,vt[4]; - _ivec_prefetchw(&dstbase[x+__IVEC_SIZE*4]); - _ivec_prefetch(&src[x+__IVEC_SIZE*4]); - _ivec_prefetch(&srca[x+__IVEC_SIZE*4]); + _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); + _ivec_prefetch(&src[x+_ivec_size()*4]); + _ivec_prefetch(&srca[x+_ivec_size()*4]); vdest = _ivec_loada(&dstbase[x]); if(_ivec_aligned(&src[x])) vsrc = _ivec_loada(&src[x]); @@ -133,9 +133,9 @@ mm[5]=_m_psllwi(mm[5],8); mm[4]=_m_psrlwi(mm[4],8); for(;x<w;x+=4){ - _ivec_prefetchw(&dstbase[x+__IVEC_SIZE*4]); - _ivec_prefetch(&src[x+__IVEC_SIZE*4]); - _ivec_prefetch(&srca[x+__IVEC_SIZE*4]); + _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); + _ivec_prefetch(&src[x+_ivec_size()*4]); + _ivec_prefetch(&srca[x+_ivec_size()*4]); mm[0]=_m_load(&(((char *)dstbase)[x*2])); mm[1]=mm[0]; mm[0]=_m_pand(mm[0],mm[4]); @@ -192,9 +192,9 @@ mm[6]=_mm_set1_pi8(0xFF); for(;x<w;x+=2){ if(srca[x] || srca[x+1]) { - _ivec_prefetchw(&dstbase[x+__IVEC_SIZE*4]); - _ivec_prefetch(&src[x+__IVEC_SIZE*4]); - _ivec_prefetch(&srca[x+__IVEC_SIZE*4]); + _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); + _ivec_prefetch(&src[x+_ivec_size()*4]); + _ivec_prefetch(&srca[x+_ivec_size()*4]); mm[0]=_m_load(&dstbase[0]); mm[1]=mm[0]; mm[5]=mm[0]; @@ -264,9 +264,9 @@ mm[6]=_mm_set1_pi8(0xFF); for(;x<w;x+=2){ if(srca[x] || srca[x+1]) { - _ivec_prefetchw(&dstbase[x+__IVEC_SIZE*4]); - _ivec_prefetch(&src[x+__IVEC_SIZE*4]); - _ivec_prefetch(&srca[x+__IVEC_SIZE*4]); + _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); + _ivec_prefetch(&src[x+_ivec_size()*4]); + _ivec_prefetch(&srca[x+_ivec_size()*4]); mm[0]=_m_load(&dstbase[4*x]); mm[1]=mm[0]; mm[0]=_m_punpcklbw(mm[0],mm[7]); Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-12 09:35:42 UTC (rev 338) +++ mplayerxp/mplayerxp.c 2012-11-12 09:54:33 UTC (rev 339) @@ -101,30 +101,32 @@ static x86_features_t x86; #endif -#define ABS(x) (((x)>=0)?(x):(-(x))) +enum { + INITED_VO =0x00000001, + INITED_AO =0x00000002, + INITED_RESERVED =0x00000004, + INITED_LIRC =0x00000008, + INITED_SPUDEC =0x00000010, + INITED_STREAM =0x00000020, + INITED_INPUT =0x00000040, + INITED_DEMUXER =0x00000080, + INITED_ACODEC =0x00000100, + INITED_VCODEC =0x00000200, + INITED_VOBSUB =0x00000400, + INITED_SUBTITLE =0x10000000, + INITED_XMP =0x80000000, + INITED_ALL =0xFFFFFFFF +}; -#define INITED_VO 0x00000001 -#define INITED_AO 0x00000002 -#define INITED_RESERVED 0x00000004 -#define INITED_LIRC 0x00000008 -#define INITED_SPUDEC 0x00000010 -#define INITED_STREAM 0x00000020 -#define INITED_INPUT 0x00000040 -#define INITED_DEMUXER 0x00000080 -#define INITED_ACODEC 0x00000100 -#define INITED_VCODEC 0x00000200 -#define INITED_VOBSUB 0x00000400 -#define INITED_SUBTITLE 0x10000000 -#define INITED_XMP 0x80000000 -#define INITED_ALL 0xFFFFFFFF +enum { + PT_NEXT_ENTRY =1, + PT_PREV_ENTRY =-1, + PT_NEXT_SRC =2, + PT_PREV_SRC =-2, + PT_UP_NEXT =3, + PT_UP_PREV =-3 +}; -#define PT_NEXT_ENTRY 1 -#define PT_PREV_ENTRY -1 -#define PT_NEXT_SRC 2 -#define PT_PREV_SRC -2 -#define PT_UP_NEXT 3 -#define PT_UP_PREV -3 - typedef struct priv_s { unsigned inited_flags; int vo_inited; @@ -524,54 +526,52 @@ static void init_player( void ) { - if(mp_conf.video_driver && strcmp(mp_conf.video_driver,"help")==0) - { + if(mp_conf.video_driver && strcmp(mp_conf.video_driver,"help")==0) { vo_print_help(vo_data); mpxp_uninit_structs(); exit(0); } - if(mp_conf.audio_driver && strcmp(mp_conf.audio_driver,"help")==0) - { + if(mp_conf.audio_driver && strcmp(mp_conf.audio_driver,"help")==0) { ao_print_help(); mpxp_uninit_structs(); exit(0); } - if(mp_conf.video_family && strcmp(mp_conf.video_family,"help")==0){ + if(mp_conf.video_family && strcmp(mp_conf.video_family,"help")==0) { vfm_help(); mpxp_uninit_structs(); exit(0); } - if(mp_conf.audio_family && strcmp(mp_conf.audio_family,"help")==0){ + if(mp_conf.audio_family && strcmp(mp_conf.audio_family,"help")==0) { afm_help(); mpxp_uninit_structs(); exit(0); } - if(vf_cfg.list && strcmp(vf_cfg.list,"help")==0){ + if(vf_cfg.list && strcmp(vf_cfg.list,"help")==0) { vf_help(); mpxp_uninit_structs(); exit(0); } - if(af_cfg.list && strcmp(af_cfg.list,"help")==0){ + if(af_cfg.list && strcmp(af_cfg.list,"help")==0) { af_help(); mpxp_uninit_structs(); exit(0); } /* check codec.conf*/ - if(!parse_codec_cfg(get_path("codecs.conf"))){ - if(!parse_codec_cfg(CONFDIR"/codecs.conf")){ + if(!parse_codec_cfg(get_path("codecs.conf"))) { + if(!parse_codec_cfg(CONFDIR"/codecs.conf")) { MSG_HINT(MSGTR_CopyCodecsConf); mpxp_uninit_structs(); exit(0); } } - if(mp_conf.audio_codec && strcmp(mp_conf.audio_codec,"help")==0){ + if(mp_conf.audio_codec && strcmp(mp_conf.audio_codec,"help")==0) { list_codecs(1); mpxp_uninit_structs(); exit(0); } - if(mp_conf.video_codec && strcmp(mp_conf.video_codec,"help")==0){ + if(mp_conf.video_codec && strcmp(mp_conf.video_codec,"help")==0) { list_codecs(0); mpxp_uninit_structs(); exit(0); Modified: mplayerxp/osdep/aclib_template.c =================================================================== --- mplayerxp/osdep/aclib_template.c 2012-11-12 09:35:42 UTC (rev 338) +++ mplayerxp/osdep/aclib_template.c 2012-11-12 09:54:33 UTC (rev 339) @@ -51,7 +51,7 @@ #if defined( OPTIMIZE_MMX ) && !defined( OPTIMIZE_MMX2 ) #define MIN_LEN 0x800 /* 2K blocks. Was found experimentally */ #else -#define MIN_LEN __IVEC_SIZE*8 +#define MIN_LEN _ivec_size()*8 #endif #undef FAST_MEMORY_COPY @@ -60,7 +60,7 @@ any_t*retval;\ const unsigned char *cfrom=from;\ unsigned char *tto=to;\ - const unsigned block_size = __IVEC_SIZE*8;\ + const unsigned block_size = _ivec_size()*8;\ __ivec iarr[8];\ size_t i;\ retval = to;\ @@ -101,24 +101,24 @@ /* if SRC is misaligned */\ for(; i>0; i--)\ {\ - _ivec_prefetch(&cfrom[__IVEC_SIZE*8]);\ - _ivec_prefetch(&cfrom[__IVEC_SIZE*8+32]);\ - iarr[0] = _ivec_loadu(&cfrom[__IVEC_SIZE*0]);\ - iarr[1] = _ivec_loadu(&cfrom[__IVEC_SIZE*1]);\ - iarr[2] = _ivec_loadu(&cfrom[__IVEC_SIZE*2]);\ - iarr[3] = _ivec_loadu(&cfrom[__IVEC_SIZE*3]);\ - iarr[4] = _ivec_loadu(&cfrom[__IVEC_SIZE*4]);\ - iarr[5] = _ivec_loadu(&cfrom[__IVEC_SIZE*5]);\ - iarr[6] = _ivec_loadu(&cfrom[__IVEC_SIZE*6]);\ - iarr[7] = _ivec_loadu(&cfrom[__IVEC_SIZE*7]);\ - MEM_STORE(&tto[__IVEC_SIZE*0],iarr[0]);\ - MEM_STORE(&tto[__IVEC_SIZE*1],iarr[1]);\ - MEM_STORE(&tto[__IVEC_SIZE*2],iarr[2]);\ - MEM_STORE(&tto[__IVEC_SIZE*3],iarr[3]);\ - MEM_STORE(&tto[__IVEC_SIZE*4],iarr[4]);\ - MEM_STORE(&tto[__IVEC_SIZE*5],iarr[5]);\ - MEM_STORE(&tto[__IVEC_SIZE*6],iarr[6]);\ - MEM_STORE(&tto[__IVEC_SIZE*7],iarr[7]);\ + _ivec_prefetch(&cfrom[_ivec_size()*8]);\ + _ivec_prefetch(&cfrom[_ivec_size()*8+32]);\ + iarr[0] = _ivec_loadu(&cfrom[_ivec_size()*0]);\ + iarr[1] = _ivec_loadu(&cfrom[_ivec_size()*1]);\ + iarr[2] = _ivec_loadu(&cfrom[_ivec_size()*2]);\ + iarr[3] = _ivec_loadu(&cfrom[_ivec_size()*3]);\ + iarr[4] = _ivec_loadu(&cfrom[_ivec_size()*4]);\ + iarr[5] = _ivec_loadu(&cfrom[_ivec_size()*5]);\ + iarr[6] = _ivec_loadu(&cfrom[_ivec_size()*6]);\ + iarr[7] = _ivec_loadu(&cfrom[_ivec_size()*7]);\ + MEM_STORE(&tto[_ivec_size()*0],iarr[0]);\ + MEM_STORE(&tto[_ivec_size()*1],iarr[1]);\ + MEM_STORE(&tto[_ivec_size()*2],iarr[2]);\ + MEM_STORE(&tto[_ivec_size()*3],iarr[3]);\ + MEM_STORE(&tto[_ivec_size()*4],iarr[4]);\ + MEM_STORE(&tto[_ivec_size()*5],iarr[5]);\ + MEM_STORE(&tto[_ivec_size()*6],iarr[6]);\ + MEM_STORE(&tto[_ivec_size()*7],iarr[7]);\ cfrom+=block_size;\ tto+=block_size;\ }\ @@ -126,24 +126,24 @@ /* if SRC is aligned */\ for(; i>0; i--)\ {\ - _ivec_prefetch(&cfrom[__IVEC_SIZE*8]);\ - _ivec_prefetch(&cfrom[__IVEC_SIZE*8+32]);\ - iarr[0] = _ivec_loada(&cfrom[__IVEC_SIZE*0]);\ - iarr[1] = _ivec_loada(&cfrom[__IVEC_SIZE*1]);\ - iarr[2] = _ivec_loada(&cfrom[__IVEC_SIZE*2]);\ - iarr[3] = _ivec_loada(&cfrom[__IVEC_SIZE*3]);\ - iarr[4] = _ivec_loada(&cfrom[__IVEC_SIZE*4]);\ - iarr[5] = _ivec_loada(&cfrom[__IVEC_SIZE*5]);\ - iarr[6] = _ivec_loada(&cfrom[__IVEC_SIZE*6]);\ - iarr[7] = _ivec_loada(&cfrom[__IVEC_SIZE*7]);\ - MEM_STORE(&tto[__IVEC_SIZE*0],iarr[0]);\ - MEM_STORE(&tto[__IVEC_SIZE*1],iarr[1]);\ - MEM_STORE(&tto[__IVEC_SIZE*2],iarr[2]);\ - MEM_STORE(&tto[__IVEC_SIZE*3],iarr[3]);\ - MEM_STORE(&tto[__IVEC_SIZE*4],iarr[4]);\ - MEM_STORE(&tto[__IVEC_SIZE*5],iarr[5]);\ - MEM_STORE(&tto[__IVEC_SIZE*6],iarr[6]);\ - MEM_STORE(&tto[__IVEC_SIZE*7],iarr[7]);\ + _ivec_prefetch(&cfrom[_ivec_size()*8]);\ + _ivec_prefetch(&cfrom[_ivec_size()*8+32]);\ + iarr[0] = _ivec_loada(&cfrom[_ivec_size()*0]);\ + iarr[1] = _ivec_loada(&cfrom[_ivec_size()*1]);\ + iarr[2] = _ivec_loada(&cfrom[_ivec_size()*2]);\ + iarr[3] = _ivec_loada(&cfrom[_ivec_size()*3]);\ + iarr[4] = _ivec_loada(&cfrom[_ivec_size()*4]);\ + iarr[5] = _ivec_loada(&cfrom[_ivec_size()*5]);\ + iarr[6] = _ivec_loada(&cfrom[_ivec_size()*6]);\ + iarr[7] = _ivec_loada(&cfrom[_ivec_size()*7]);\ + MEM_STORE(&tto[_ivec_size()*0],iarr[0]);\ + MEM_STORE(&tto[_ivec_size()*1],iarr[1]);\ + MEM_STORE(&tto[_ivec_size()*2],iarr[2]);\ + MEM_STORE(&tto[_ivec_size()*3],iarr[3]);\ + MEM_STORE(&tto[_ivec_size()*4],iarr[4]);\ + MEM_STORE(&tto[_ivec_size()*5],iarr[5]);\ + MEM_STORE(&tto[_ivec_size()*6],iarr[6]);\ + MEM_STORE(&tto[_ivec_size()*7],iarr[7]);\ cfrom+=block_size;\ tto+=block_size;\ }\ Modified: mplayerxp/postproc/aflib_accel.h =================================================================== --- mplayerxp/postproc/aflib_accel.h 2012-11-12 09:35:42 UTC (rev 338) +++ mplayerxp/postproc/aflib_accel.h 2012-11-12 09:54:33 UTC (rev 339) @@ -9,14 +9,14 @@ unsigned i; i = 0; #ifdef HAVE_INT_PVECTOR - len_mm=len&(~(__IVEC_SIZE-1)); + len_mm=len&(~(_ivec_size()-1)); if(!_ivec_aligned(out_data)) for(;i<len;i++) { ((uint16_t*)out_data)[i]=((uint16_t)((const uint8_t*)in_data)[i])<<8; if(_ivec_aligned(out_data)) break; } - if((len_mm-i)>=__IVEC_SIZE) - for(;i<len_mm;i+=__IVEC_SIZE){ + if((len_mm-i)>=_ivec_size()) + for(;i<len_mm;i+=_ivec_size()){ __ivec ind,itmp[2]; if(_ivec_aligned(in_data)) ind = _ivec_loada(&((const uint8_t *)in_data)[i]); @@ -25,10 +25,10 @@ itmp[0] = _ivec_scale_u16_from_u8(ind,&itmp[1]); if(final) { _ivec_stream(&((uint16_t*)out_data)[i],itmp[0]); - _ivec_stream(&((uint16_t*)out_data)[i+__IVEC_SIZE/2],itmp[1]); + _ivec_stream(&((uint16_t*)out_data)[i+_ivec_size()/2],itmp[1]); } else { _ivec_storea(&((uint16_t*)out_data)[i],itmp[0]); - _ivec_storea(&((uint16_t*)out_data)[i+__IVEC_SIZE/2],itmp[1]); + _ivec_storea(&((uint16_t*)out_data)[i+_ivec_size()/2],itmp[1]); } } _ivec_empty(); @@ -46,22 +46,22 @@ unsigned i; i = 0; #ifdef HAVE_INT_PVECTOR - len_mm=len&(~(__IVEC_SIZE-1)); + len_mm=len&(~(_ivec_size()-1)); if(!_ivec_aligned(out_data)) for(;i<len;i++) { ((uint8_t*)out_data)[i]=(uint8_t)((((const uint16_t*)in_data)[i])>>8); if(_ivec_aligned(out_data)) break; } - if((len_mm-i)>=__IVEC_SIZE) - for(;i<len_mm;i+=__IVEC_SIZE){ + if((len_mm-i)>=_ivec_size()) + for(;i<len_mm;i+=_ivec_size()){ __ivec outd,itmp[2]; if(_ivec_aligned(in_data)) { itmp[0] = _ivec_loada(&((const uint16_t*)in_data)[i]); - itmp[1] = _ivec_loada(&((const uint16_t*)in_data)[i+__IVEC_SIZE/2]); + itmp[1] = _ivec_loada(&((const uint16_t*)in_data)[i+_ivec_size()/2]); } else { itmp[0] = _ivec_loadu(&((const uint16_t*)in_data)[i]); - itmp[1] = _ivec_loadu(&((const uint16_t*)in_data)[i+__IVEC_SIZE/2]); + itmp[1] = _ivec_loadu(&((const uint16_t*)in_data)[i+_ivec_size()/2]); } outd = _ivec_scale_s8_from_s16(itmp[0],itmp[1]); if(final) @@ -84,14 +84,14 @@ unsigned i; i=0; #ifdef HAVE_INT_PVECTOR - len_mm=len&(~(__IVEC_SIZE-1)); + len_mm=len&(~(_ivec_size()-1)); if(!_ivec_aligned(out_data)) for(;i<len;i++){ ((uint32_t*)out_data)[i]=((uint32_t)((const uint16_t*)in_data)[i])<<16; if(_ivec_aligned(out_data)) break; } - if((len_mm-i)>=__IVEC_SIZE) - for(;i<len_mm;i+=__IVEC_SIZE) + if((len_mm-i)>=_ivec_size()) + for(;i<len_mm;i+=_ivec_size()) { __ivec ind,tmp[2]; if(_ivec_aligned(in_data)) @@ -101,10 +101,10 @@ tmp[0]= _ivec_scale_u32_from_u16(ind,&tmp[1]); if(final) { _ivec_stream(&((uint8_t *)out_data)[i*2],tmp[0]); - _ivec_stream(&((uint8_t *)out_data)[i*2+__IVEC_SIZE],tmp[1]); + _ivec_stream(&((uint8_t *)out_data)[i*2+_ivec_size()],tmp[1]); } else { _ivec_storea(&((uint8_t *)out_data)[i*2],tmp[0]); - _ivec_storea(&((uint8_t *)out_data)[i*2+__IVEC_SIZE],tmp[1]); + _ivec_storea(&((uint8_t *)out_data)[i*2+_ivec_size()],tmp[1]); } } if(final) _ivec_sfence(); @@ -122,22 +122,22 @@ unsigned i; i=0; #ifdef HAVE_INT_PVECTOR - len_mm=len&(~(__IVEC_SIZE-1)); + len_mm=len&(~(_ivec_size()-1)); if(!_ivec_aligned(out_data)) for(;i<len;i++){ ((uint16_t*)out_data)[i]=(uint16_t)((((const uint32_t*)in_data)[i])>>16); if(_ivec_aligned(out_data)) break; } - if((len_mm-i)>=__IVEC_SIZE) - for(;i<len_mm;i+=__IVEC_SIZE) + if((len_mm-i)>=_ivec_size()) + for(;i<len_mm;i+=_ivec_size()) { __ivec ind[2],tmp; if(_ivec_aligned(in_data)) { ind[0]=_ivec_loada(&((const uint8_t *)in_data)[i*2]); - ind[1]=_ivec_loada(&((const uint8_t *)in_data)[i*2+__IVEC_SIZE]); + ind[1]=_ivec_loada(&((const uint8_t *)in_data)[i*2+_ivec_size()]); } else { ind[0]=_ivec_loadu(&((const uint8_t *)in_data)[i*2]); - ind[1]=_ivec_loadu(&((const uint8_t *)in_data)[i*2+__IVEC_SIZE]); + ind[1]=_ivec_loadu(&((const uint8_t *)in_data)[i*2+_ivec_size()]); } tmp = _ivec_scale_s16_from_s32(ind[0],ind[1]); if(final) @@ -334,9 +334,9 @@ if(_f32vec_aligned(out)) break; } _ivec_empty(); - len_mm=len&(~(__F32VEC_SIZE-1)); - if((len_mm-i)>=__F32VEC_SIZE/sizeof(float)) - for(;i<len_mm;i+=__F32VEC_SIZE/sizeof(float)) { + len_mm=len&(~(_f32vec_size()-1)); + if((len_mm-i)>=_f32vec_size()/sizeof(float)) + for(;i<len_mm;i+=_f32vec_size()/sizeof(float)) { __f32vec tmp; if(_f32vec_aligned(in)) tmp = _f32vec_loada(&((const float*)in)[i]); @@ -372,8 +372,8 @@ if(_f32vec_aligned(out)) break; } _ivec_empty(); - if((len-i)>=__F32VEC_SIZE) - for(;i<len;i+=__F32VEC_SIZE/sizeof(float)) { + if((len-i)>=_f32vec_size()) + for(;i<len;i+=_f32vec_size()/sizeof(float)) { __f32vec tmp; if(_f32vec_aligned(in)) tmp = _f32vec_from_s32a(&((const int32_t*)in)[i]); Modified: mplayerxp/pvector/pvector.h =================================================================== --- mplayerxp/pvector/pvector.h 2012-11-12 09:35:42 UTC (rev 338) +++ mplayerxp/pvector/pvector.h 2012-11-12 09:54:33 UTC (rev 339) @@ -57,7 +57,7 @@ u32 - unsigned uint32_t This interface defines: - __IVEC_SIZE size of vector in bytes + _ivec_size size of vector in bytes __ivec type of vector functions: @@ -174,7 +174,7 @@ f32 - float32_t This interface defines: - __F32VEC_SIZE size of vector in bytes + _f32vec_size() size of vector in bytes __f32vec type of vector functions: Modified: mplayerxp/pvector/pvector_f32_x86.h =================================================================== --- mplayerxp/pvector/pvector_f32_x86.h 2012-11-12 09:35:42 UTC (rev 338) +++ mplayerxp/pvector/pvector_f32_x86.h 2012-11-12 09:54:33 UTC (rev 339) @@ -21,21 +21,31 @@ #include <mm3dnow.h> #endif -#undef __F32VEC_SIZE #undef __f32vec #ifdef OPTIMIZE_AVX -#define __F32VEC_SIZE 32 #define __f32vec __m256 #elif defined( OPTIMIZE_SSE ) -#define __F32VEC_SIZE 16 #define __f32vec __m128 #else -#define __F32VEC_SIZE 8 #define __f32vec __m64 #endif +extern __inline unsigned __attribute__((__gnu_inline__, __always_inline__)) +PVECTOR_RENAME(f32vec_size)() +{ +#ifdef OPTIMIZE_AVX + return 32; +#elif defined( OPTIMIZE_SSE ) + return 16; +#else + retturn 8; +#endif +} +#undef _f32vec_size +#define _f32vec_size PVECTOR_RENAME(f32vec_size) + extern __inline int __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(f32vec_aligned)(const any_t* p) { return (((long)p)&(__F32VEC_SIZE-1))==0; } +PVECTOR_RENAME(f32vec_aligned)(const any_t* p) { return (((long)p)&(_f32vec_size()-1))==0; } #undef _f32vec_aligned #define _f32vec_aligned PVECTOR_RENAME(f32vec_aligned) Modified: mplayerxp/pvector/pvector_int_x86.h =================================================================== --- mplayerxp/pvector/pvector_int_x86.h 2012-11-12 09:35:42 UTC (rev 338) +++ mplayerxp/pvector/pvector_int_x86.h 2012-11-12 09:54:33 UTC (rev 339) @@ -24,18 +24,29 @@ #include <mmintrin.h> #endif -#undef __IVEC_SIZE #undef __ivec #ifdef OPTIMIZE_SSE2 -#define __IVEC_SIZE 16 #define __ivec __m128i #else -#define __IVEC_SIZE 8 #define __ivec __m64 #endif +static __inline unsigned __attribute__((__gnu_inline__, __always_inline__)) +PVECTOR_RENAME(ivec_size)() +{ +#ifdef OPTIMIZE_AVX + return 32; +#elif defined(OPTIMIZE_SSE2) + return 16; +#else + return 8; +#endif +} +#undef _ivec_size +#define _ivec_size PVECTOR_RENAME(ivec_size) + static __inline int __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(ivec_aligned)(const any_t* p) { return (((long)p)&(__IVEC_SIZE-1))==0; } +PVECTOR_RENAME(ivec_aligned)(const any_t* p) { return (((long)p)&(_ivec_size()-1))==0; } #undef _ivec_aligned #define _ivec_aligned PVECTOR_RENAME(ivec_aligned) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-12 11:16:04
|
Revision: 341 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=341&view=rev Author: nickols_k Date: 2012-11-12 11:15:50 +0000 (Mon, 12 Nov 2012) Log Message: ----------- use configurable value for max-trace Modified Paths: -------------- mplayerxp/cfg-mplayerxp.h mplayerxp/mplayerxp.c mplayerxp/mplayerxp.h mplayerxp/xmpcore/xmp_vdecoder.c Modified: mplayerxp/cfg-mplayerxp.h =================================================================== --- mplayerxp/cfg-mplayerxp.h 2012-11-12 10:34:29 UTC (rev 340) +++ mplayerxp/cfg-mplayerxp.h 2012-11-12 11:15:50 UTC (rev 341) @@ -48,7 +48,8 @@ {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, "sets playback speed factor"}, {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, "performs benchmarking to estimate performance of MPlayerXP"}, {"test-av", &mp_conf.test_av, CONF_TYPE_FLAG, 0, 0, 1, "test antiviral protection of MPlayerXP"}, - {"malloc-debug", &mp_conf.malloc_debug, CONF_TYPE_FLAG, 0, 1, 0, "debugs malloc() calls in MPlayerXP"}, + {"malloc-debug", &mp_conf.malloc_debug, CONF_TYPE_FLAG, 0, 0, 1, "debugs malloc() calls in MPlayerXP"}, + {"max-trace", &mp_conf.max_trace, CONF_TYPE_INT, CONF_RANGE, 1, 1024, "maximal number of backtrace stack"}, {NULL, NULL, 0, 0, 0, 0, NULL}, }; Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-12 10:34:29 UTC (rev 340) +++ mplayerxp/mplayerxp.c 2012-11-12 11:15:50 UTC (rev 341) @@ -233,6 +233,7 @@ mp_conf.ao_channels=2; mp_conf.monitor_pixel_aspect=1; mp_conf.msg_filter=0xFFFFFFFF; + mp_conf.max_trace=10; } static void mpxp_uninit_structs(void) { Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-11-12 10:34:29 UTC (rev 340) +++ mplayerxp/mplayerxp.h 2012-11-12 11:15:50 UTC (rev 341) @@ -13,6 +13,7 @@ uint32_t msg_filter; int test_av; int malloc_debug; + unsigned max_trace; // XP-core int xp; /* XP-mode */ int gomp; /* currently it's experimental feature */ Modified: mplayerxp/xmpcore/xmp_vdecoder.c =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-12 10:34:29 UTC (rev 340) +++ mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-12 11:15:50 UTC (rev 341) @@ -188,7 +188,7 @@ if(cur_time - mp_data->seek_time > (xp_core->num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(sh_video,frame->pts,drop_barrier); } /* if( mp_conf.frame_dropping ) */ if(!finite(frame->pts)) MSG_WARN("Bug of demuxer! Value of video pts=%f\n",frame->pts); - if(frame->type!=VideoFrame) escape_player("VideoDecoder doesn't parse non video frames",10); + if(frame->type!=VideoFrame) escape_player("VideoDecoder doesn't parse non video frames",mp_conf.max_trace); #if 0 /* We can't seriously examine question of too slow machines This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-12 13:14:41
|
Revision: 342 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=342&view=rev Author: nickols_k Date: 2012-11-12 13:14:33 +0000 (Mon, 12 Nov 2012) Log Message: ----------- function vf_get_image() had a viral nature. Use vf_get_new_image() instead Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/osdep/mp_malloc.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.c mplayerxp/postproc/vf_2xsai.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_denoise3d.c mplayerxp/postproc/vf_dint.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_eq.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_flip.c mplayerxp/postproc/vf_framestep.c mplayerxp/postproc/vf_il.c mplayerxp/postproc/vf_menu.c mplayerxp/postproc/vf_mirror.c mplayerxp/postproc/vf_noise.c mplayerxp/postproc/vf_ow.c mplayerxp/postproc/vf_palette.c mplayerxp/postproc/vf_panscan.c mplayerxp/postproc/vf_perspective.c mplayerxp/postproc/vf_pp.c mplayerxp/postproc/vf_raw.c mplayerxp/postproc/vf_rectangle.c mplayerxp/postproc/vf_rgb2bgr.c mplayerxp/postproc/vf_rotate.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_smartblur.c mplayerxp/postproc/vf_softpulldown.c mplayerxp/postproc/vf_swapuv.c mplayerxp/postproc/vf_test.c mplayerxp/postproc/vf_unsharp.c mplayerxp/postproc/vf_vo.c mplayerxp/postproc/vf_yuvcsp.c mplayerxp/postproc/vf_yuy2.c mplayerxp/postproc/vf_yvu9.c mplayerxp/xmpcore/mp_image.c mplayerxp/xmpcore/sig_hand.c Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-12 13:14:33 UTC (rev 342) @@ -178,7 +178,7 @@ if(sh->vf_flags&VF_FLAGS_SLICES) { unsigned j,i,y; - mp_image_t ampi[num_slices]; + mp_image_t *ampi[num_slices]; static int hello_printed=0; if(!hello_printed) { MSG_OK("[VC] using %u threads for video filters\n",smp_num_cpus); @@ -186,21 +186,25 @@ } y=0; for(i=0;i<num_slices;i++) { - mpi_fake_slice(&i[i],mpi,y,h_step); + ampi[i]=new_mp_image(mpi->w,y,h_step); + mpi_fake_slice(ampi[i],mpi,y,h_step); y+=h_step; } + free_mp_image(mpi); #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) 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,&i[i]); + vf->put_slice(vf,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,&i[j]); + vf->put_slice(vf,ampi[j]); + free_mp_image(ampi[j]); } } else @@ -209,12 +213,14 @@ /* 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,&i[i]); + vf->put_slice(vf,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); + free_mp_image(mpi); } } } Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/libmpcodecs/vd.c 2012-11-12 13:14:33 UTC (rev 342) @@ -278,7 +278,7 @@ // Note: buffer allocation may be moved to mpcodecs_config_vo() 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_image(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h,dae_curr_vdecoded(xp_core)); + 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)); 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"); Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-12 13:14:33 UTC (rev 342) @@ -684,6 +684,7 @@ } if(!(frame->flags&3) && priv->use_slices) { + if(mpi) free_mp_image(mpi); mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_DIRECT,sh->src_w, sh->src_h); priv->mpi = mpi; priv->frame_number++; @@ -708,6 +709,7 @@ if(!got_picture) return NULL; // skipped image if(!priv->ctx->draw_horiz_band) { + if(mpi) free_mp_image(mpi); mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,sh->src_w,sh->src_h); if(!mpi){ // temporary! MSG_ERR("couldn't allocate image for ffmpeg codec\n"); Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/osdep/mp_malloc.c 2012-11-12 13:14:33 UTC (rev 342) @@ -23,6 +23,7 @@ typedef struct mp_slot_container_s { mp_slot_t* slots; size_t nslots; + size_t size; }mp_slot_container_t; typedef struct priv_s { @@ -75,8 +76,17 @@ static mp_slot_t* prot_append_slot(mp_slot_container_t* c,any_t*ptr,size_t size) { mp_slot_t* s; - if(!c->slots) s=malloc(sizeof(mp_slot_t)); - else s=realloc(c->slots,sizeof(mp_slot_t)*(c->nslots+1)); + s=c->slots; + if(!c->slots) { + c->size=16; + s=malloc(sizeof(mp_slot_t)*16); + } + else { + if(c->nslots+1>c->size) { + c->size+=16; + s=realloc(c->slots,sizeof(mp_slot_t)*c->size); + } + } c->slots=s; memset(&c->slots[c->nslots],0,sizeof(mp_slot_t)); c->slots[c->nslots].page_ptr=ptr; @@ -90,7 +100,10 @@ if(idx!=UINT_MAX) { memmove(&c->slots[idx],&c->slots[idx+1],sizeof(mp_slot_t)*(c->nslots-(idx+1))); c->nslots--; - c->slots=realloc(c->slots,sizeof(mp_slot_t)*c->nslots); + if(c->nslots<c->size-16) { + c->size-=16; + c->slots=realloc(c->slots,sizeof(mp_slot_t)*c->size); + } } else printf("[prot_free_slot] Internal error! Can't find slot for address: %p\n",ptr); } Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf.c 2012-11-12 13:14:33 UTC (rev 342) @@ -153,123 +153,116 @@ } } -mp_image_t* __FASTCALL__ vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h,unsigned idx){ - mp_image_t* mpi=NULL; - int w2=(mp_imgflag&MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE)?((w+15)&(~15)):w; - unsigned xp_idx=idx; - MSG_DBG2("vf_get_image(%s,0x%X,0x%X,0x%X,0x%X,0x%X) was called\n",vf->info->name,outfmt,mp_imgtype,mp_imgflag,w,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){ + int is_static=0; + mp_image_t* mpi=NULL; + int w2=(mp_imgflag&MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE)?((w+15)&(~15)):w; + unsigned xp_idx=idx; + MSG_DBG2("vf_get_new_image(%s,0x%X,0x%X,0x%X,0x%X,0x%X) was called\n",vf->info->name,outfmt,mp_imgtype,mp_imgflag,w,h); - if(vf->put_slice==vf_next_put_slice){ - MSG_DBG2("passthru mode to %s\n",vf->next->info->name); - return vf_get_image(vf->next,outfmt,mp_imgtype,mp_imgflag,w,h,xp_idx); - } - // Note: we should call libvo first to check if it supports direct rendering - // and if not, then fallback to software buffers: - switch(mp_imgtype){ - case MP_IMGTYPE_EXPORT: - if(!vf->imgctx.export_images[0]) vf->imgctx.export_images[0]=new_mp_image(w2,h,xp_idx); - mpi=vf->imgctx.export_images[0]; - break; - case MP_IMGTYPE_STATIC: - if(!vf->imgctx.static_images[0]) vf->imgctx.static_images[0]=new_mp_image(w2,h,xp_idx); - mpi=vf->imgctx.static_images[0]; - break; - case MP_IMGTYPE_TEMP: - if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h,xp_idx); - mpi=vf->imgctx.temp_images[0]; - break; - case MP_IMGTYPE_IPB: - if(!(mp_imgflag&MP_IMGFLAG_READABLE)){ // B frame: - if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h,xp_idx); - mpi=vf->imgctx.temp_images[0]; - break; + if(vf->put_slice==vf_next_put_slice){ + MSG_DBG2("passthru mode to %s\n",vf->next->info->name); + return vf_get_new_image(vf->next,outfmt,mp_imgtype,mp_imgflag,w,h,xp_idx); } - case MP_IMGTYPE_IP: - if(!vf->imgctx.static_images[vf->imgctx.static_idx]) vf->imgctx.static_images[vf->imgctx.static_idx]=new_mp_image(w2,h,xp_idx); - mpi=vf->imgctx.static_images[vf->imgctx.static_idx]; - vf->imgctx.static_idx^=1; - break; - } - if(mpi){ - mpi->type=mp_imgtype; - mpi->w=w; mpi->h=h; - // keep buffer allocation status & color flags only: - mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; - // accept restrictions & draw_slice flags only: - mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK); - MSG_DBG2("vf_get_image fills mpi structure. flags=0x%X\n",mpi->flags); - if(mpi->width!=w2 || mpi->height!=h){ - if(mpi->flags&MP_IMGFLAG_ALLOCATED){ - if(mpi->width<w2 || mpi->height<h){ - // need to re-allocate buffer memory: - mp_free(mpi->planes[0]); - mpi->flags&=~MP_IMGFLAG_ALLOCATED; - MSG_DBG2("vf.c: have to REALLOCATE buffer memory :(\n"); + // Note: we should call libvo first to check if it supports direct rendering + // and if not, then fallback to software buffers: + switch(mp_imgtype){ + case MP_IMGTYPE_IP: + case MP_IMGTYPE_STATIC: + is_static=1; + break; + case MP_IMGTYPE_IPB: + if(mp_imgflag&MP_IMGFLAG_READABLE) is_static=1; + default: + break; + } + mpi=new_mp_image(w2,h,xp_idx); + if(mpi){ + mpi->type=mp_imgtype; + mpi->w=w; mpi->h=h; + // keep buffer allocation status & color flags only: + mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; + // accept restrictions & draw_slice flags only: + mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK); + MSG_DBG2("vf_get_new_image fills mpi structure. flags=0x%X\n",mpi->flags); + if(mpi->width!=w2 || mpi->height!=h){ + if(mpi->flags&MP_IMGFLAG_ALLOCATED){ + if(mpi->width<w2 || mpi->height<h){ + // need to re-allocate buffer memory: + mp_free(mpi->planes[0]); + mpi->flags&=~MP_IMGFLAG_ALLOCATED; + MSG_DBG2("vf.c: have to REALLOCATE buffer memory :(\n"); + } } + mpi->width=w2; mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; + mpi->height=h; mpi->chroma_height=(h + (1<<mpi->chroma_y_shift) - 1)>>mpi->chroma_y_shift; } - mpi->width=w2; mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; - mpi->height=h; mpi->chroma_height=(h + (1<<mpi->chroma_y_shift) - 1)>>mpi->chroma_y_shift; - } - if(!mpi->bpp) mp_image_setfmt(mpi,outfmt); - MSG_DBG2("vf_get_image setfmt. flags=0x%X\n",mpi->flags); - if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT){ - - // check libvo first! - if(vf->get_image) vf->get_image(vf,mpi); - MSG_DBG2("[vf->get_image] returns xp_idx=%u\n",mpi->xp_idx); + if(!mpi->bpp) mp_image_setfmt(mpi,outfmt); + MSG_DBG2("vf_get_new_image setfmt. flags=0x%X\n",mpi->flags); + if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT) { + // check libvo first! + if(vf->get_image) vf->get_image(vf,mpi); + MSG_DBG2("[vf->get_image] returns xp_idx=%u\n",mpi->xp_idx); - if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - // non-direct and not yet allocated image. allocate it! - - // check if codec prefer aligned stride: - if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){ - int align=(mpi->flags&MP_IMGFLAG_PLANAR && - mpi->flags&MP_IMGFLAG_YUV) ? - (8<<mpi->chroma_x_shift)-1 : 15; // -- maybe FIXME - w2=((w+align)&(~align)); - if(mpi->width!=w2){ - // we have to change width... check if we CAN co it: - int flags=vf->query_format(vf,outfmt,w,h); // should not fail - if(!(flags&3)) MSG_WARN("??? vf_get_image{vf->query_format(outfmt)} failed!\n"); -// printf("query -> 0x%X \n",flags); - if(flags&VFCAP_ACCEPT_STRIDE){ - mpi->width=w2; - mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; - } - } - } - - mpi_alloc_planes(mpi); -// printf("clearing img!\n"); -// vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); - } - } - else { - MSG_DBG2("vf_get_image forces xp_idx retrieving\n"); - mpi->xp_idx=dae_curr_vdecoded(xp_core); - } - if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) - if(vf->start_slice) vf->start_slice(vf,mpi); - if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){ + if(!(mpi->flags&MP_IMGFLAG_DIRECT)) { + // non-direct and not yet allocated image. allocate it! + // check if codec prefer aligned stride: + if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE) { + int align=( mpi->flags&MP_IMGFLAG_PLANAR && + mpi->flags&MP_IMGFLAG_YUV) ? + (8<<mpi->chroma_x_shift)-1 : 15; // -- maybe FIXME + w2=((w+align)&(~align)); + if(mpi->width!=w2) { + // we have to change width... check if we CAN co it: + int flags=vf->query_format(vf,outfmt,w,h); // should not fail + if(!(flags&3)) MSG_WARN("??? vf_get_new_image{vf->query_format(outfmt)} failed!\n"); + if(flags&VFCAP_ACCEPT_STRIDE){ + mpi->width=w2; + mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; + } + } + } + if(is_static) { + unsigned idx=0; + if(mpi->flags&(MP_IMGTYPE_IP|MP_IMGTYPE_IPB)) { + idx=vf->imgctx.static_idx; + vf->imgctx.static_idx^=1; + } + if(!vf->imgctx.static_planes[idx]) { + mpi_alloc_planes(mpi); + vf->imgctx.static_planes[idx]=mpi->planes[0]; + } + mpi->planes[0]=vf->imgctx.static_planes[idx]; + mpi->flags&=~MP_IMGFLAG_ALLOCATED; + } else + mpi_alloc_planes(mpi); + } // if !DIRECT + } else { + MSG_DBG2("vf_get_new_image forces xp_idx retrieving\n"); + mpi->xp_idx=dae_curr_vdecoded(xp_core); + mpi->flags&=~MP_IMGFLAG_ALLOCATED; + } + if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && vf->start_slice) + vf->start_slice(vf,mpi); + if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){ MSG_V("*** [%s] %s%s mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n", - vf->info->name, - (mpi->type==MP_IMGTYPE_EXPORT)?"Exporting": - ((mpi->flags&MP_IMGFLAG_DIRECT)?"Direct Rendering":"Allocating"), - (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)?" (slices)":"", - mpi->width,mpi->height,mpi->bpp, - (mpi->flags&MP_IMGFLAG_YUV)?"YUV":((mpi->flags&MP_IMGFLAG_SWAPPED)?"BGR":"RGB"), - (mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed", - mpi->bpp*mpi->width*mpi->height/8); + vf->info->name, + (mpi->type==MP_IMGTYPE_EXPORT)?"Exporting": + ((mpi->flags&MP_IMGFLAG_DIRECT)?"Direct Rendering":"Allocating"), + (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)?" (slices)":"", + mpi->width,mpi->height,mpi->bpp, + (mpi->flags&MP_IMGFLAG_YUV)?"YUV":((mpi->flags&MP_IMGFLAG_SWAPPED)?"BGR":"RGB"), + (mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed", + mpi->bpp*mpi->width*mpi->height/8); MSG_DBG2("(imgfmt: %x, planes: %x,%x,%x strides: %d,%d,%d, chroma: %dx%d, shift: h:%d,v:%d)\n", mpi->imgfmt, mpi->planes[0], mpi->planes[1], mpi->planes[2], mpi->stride[0], mpi->stride[1], mpi->stride[2], mpi->chroma_width, mpi->chroma_height, mpi->chroma_x_shift, mpi->chroma_y_shift); mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED; + } } - - } - MSG_DBG2("vf_get_image returns xp_idx=%i\n",mpi->xp_idx); - return mpi; + MSG_DBG2("vf_get_new_image returns xp_idx=%i\n",mpi->xp_idx); + return mpi; } //============================================================================ @@ -418,7 +411,10 @@ } int __FASTCALL__ vf_next_put_slice(struct vf_instance_s* vf,mp_image_t *mpi){ - return vf->next->put_slice(vf->next,mpi); + int rc; + rc = vf->next->put_slice(vf->next,mpi); + free_mp_image(mpi); + return rc; } //============================================================================ @@ -431,10 +427,8 @@ void __FASTCALL__ vf_uninit_filter(vf_instance_t* vf){ if(vf->uninit) vf->uninit(vf); - free_mp_image(vf->imgctx.static_images[0]); - free_mp_image(vf->imgctx.static_images[1]); - free_mp_image(vf->imgctx.temp_images[0]); - free_mp_image(vf->imgctx.export_images[0]); + if(vf->imgctx.static_planes[0]) free(vf->imgctx.static_planes[0]); + if(vf->imgctx.static_planes[1]) free(vf->imgctx.static_planes[1]); mp_free(vf); } Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf.h 2012-11-12 13:14:33 UTC (rev 342) @@ -24,9 +24,7 @@ } vf_info_t; typedef struct vf_image_context_s { - mp_image_t* static_images[2]; - mp_image_t* temp_images[1]; - mp_image_t* export_images[1]; + mp_image_t* static_planes[2]; int static_idx; } vf_image_context_t; @@ -101,7 +99,7 @@ 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_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_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h,unsigned idx); 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); Modified: mplayerxp/postproc/vf_1bpp.c =================================================================== --- mplayerxp/postproc/vf_1bpp.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_1bpp.c 2012-11-12 13:14:33 UTC (rev 342) @@ -110,7 +110,7 @@ mp_image_t *dmpi; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,vf->priv->fmt, + dmpi=vf_get_new_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_2xsai.c =================================================================== --- mplayerxp/postproc/vf_2xsai.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_2xsai.c 2012-11-12 13:14:33 UTC (rev 342) @@ -282,7 +282,7 @@ mp_image_t *dmpi; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, 2*mpi->w, 2*mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_delogo.c =================================================================== --- mplayerxp/postproc/vf_delogo.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_delogo.c 2012-11-12 13:14:33 UTC (rev 342) @@ -135,7 +135,7 @@ if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ // ok, we can do pp in-place (or pp disabled): - vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, + vf->dmpi=vf_get_new_image(vf->next,mpi->imgfmt, mpi->type, mpi->flags,mpi->w, mpi->h,mpi->xp_idx); mpi->planes[0]=vf->dmpi->planes[0]; mpi->stride[0]=vf->dmpi->stride[0]; @@ -155,7 +155,7 @@ if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, + vf->dmpi=vf_get_new_image(vf->next,vf->priv->outfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); } Modified: mplayerxp/postproc/vf_denoise3d.c =================================================================== --- mplayerxp/postproc/vf_denoise3d.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_denoise3d.c 2012-11-12 13:14:33 UTC (rev 342) @@ -183,7 +183,7 @@ int ch= mpi->h >> mpi->chroma_y_shift; int W = mpi->w, H = mpi->h; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + mp_image_t *dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); @@ -228,7 +228,7 @@ int ch= mpi->h >> mpi->chroma_y_shift; int W = mpi->w, H = mpi->h; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + mp_image_t *dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_dint.c =================================================================== --- mplayerxp/postproc/vf_dint.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_dint.c 2012-11-12 13:14:33 UTC (rev 342) @@ -83,7 +83,7 @@ int finalize; mp_image_t *pmpi; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + mp_image_t *dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); if(!dmpi) return 0; @@ -301,7 +301,7 @@ { int rowsize; - vf->priv->pmpi = vf_get_image (vf->next, outfmt, MP_IMGTYPE_TEMP, + vf->priv->pmpi = vf_get_new_image (vf->next, outfmt, MP_IMGTYPE_TEMP, 0,width, height, XP_IDX_INVALID); if (!(vf->priv->pmpi->flags & MP_IMGFLAG_PLANAR) && outfmt != IMGFMT_RGB32 && outfmt != IMGFMT_BGR32 && Modified: mplayerxp/postproc/vf_down3dright.c =================================================================== --- mplayerxp/postproc/vf_down3dright.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_down3dright.c 2012-11-12 13:14:33 UTC (rev 342) @@ -91,7 +91,7 @@ mp_image_t *dmpi; int finalize; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next, IMGFMT_YV12, + dmpi=vf_get_new_image(vf->next, IMGFMT_YV12, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w * vf->priv->scalew, mpi->h / vf->priv->scaleh - vf->priv->skipline,mpi->xp_idx); Modified: mplayerxp/postproc/vf_eq.c =================================================================== --- mplayerxp/postproc/vf_eq.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_eq.c 2012-11-12 13:14:33 UTC (rev 342) @@ -263,7 +263,7 @@ eq2->buf[0] = (unsigned char *) mp_realloc (eq2->buf[0], img_n); } - dst = vf_get_image (vf->next, src->imgfmt, MP_IMGTYPE_EXPORT, 0,src->w, src->h,src->xp_idx); + dst = vf_get_new_image (vf->next, src->imgfmt, MP_IMGTYPE_EXPORT, 0,src->w, src->h,src->xp_idx); #ifdef _OPENMP #pragma omp parallel for Modified: mplayerxp/postproc/vf_expand.c =================================================================== --- mplayerxp/postproc/vf_expand.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_expand.c 2012-11-12 13:14:33 UTC (rev 342) @@ -51,16 +51,16 @@ if(vf->priv->new_frame) { vf->priv->new_frame = 0; - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, vf->priv->w,vf->priv->up_h,mpi->xp_idx); vf_mpi_clear(dmpi,0,0,vf->priv->w,vf->priv->up_h); - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, vf->priv->w,vf->priv->up_h+vf->priv->h+vf->priv->dn_h,mpi->xp_idx); vf_mpi_clear(dmpi,0,0,vf->priv->w,vf->priv->dn_h); } - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h+vf->priv->up_h,mpi->xp_idx); finalize = dmpi->flags&MP_IMGFLAG_FINALIZED; Modified: mplayerxp/postproc/vf_flip.c =================================================================== --- mplayerxp/postproc/vf_flip.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_flip.c 2012-11-12 13:14:33 UTC (rev 342) @@ -45,7 +45,7 @@ return vf_next_put_slice(vf,(mp_image_t*)mpi->priv); } - vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, + vf->dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, mpi->width, mpi->height,mpi->xp_idx); Modified: mplayerxp/postproc/vf_framestep.c =================================================================== --- mplayerxp/postproc/vf_framestep.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_framestep.c 2012-11-12 13:14:33 UTC (rev 342) @@ -109,7 +109,7 @@ if (skip == 0) { /* Get image, export type (we don't modify tghe image) */ - dmpi=vf_get_image(vf->next, mpi->imgfmt, + dmpi=vf_get_new_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h,mpi->xp_idx); /* Copy only the pointer ( MP_IMGTYPE_EXPORT ! ) */ Modified: mplayerxp/postproc/vf_il.c =================================================================== --- mplayerxp/postproc/vf_il.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_il.c 2012-11-12 13:14:33 UTC (rev 342) @@ -95,7 +95,7 @@ FilterParam *luma = &vf->priv->lumaParam; FilterParam *chroma= &vf->priv->chromaParam; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + mp_image_t *dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_menu.c =================================================================== --- mplayerxp/postproc/vf_menu.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_menu.c 2012-11-12 13:14:33 UTC (rev 342) @@ -125,7 +125,7 @@ mp_image_t *dmpi; if(mpi->type == MP_IMGTYPE_TEMP && (!(mpi->flags&MP_IMGFLAG_PRESERVE)) ) { - dmpi = vf_get_image(vf->next,mpi->imgfmt,mpi->type, mpi->flags,mpi->w, mpi->h,mpi->xp_idx); + dmpi = vf_get_new_image(vf->next,mpi->imgfmt,mpi->type, mpi->flags,mpi->w, mpi->h,mpi->xp_idx); memcpy(mpi->planes,dmpi->planes,MP_MAX_PLANES*sizeof(unsigned char*)); memcpy(mpi->stride,dmpi->stride,MP_MAX_PLANES*sizeof(unsigned int)); mpi->flags|=MP_IMGFLAG_DIRECT; @@ -142,7 +142,7 @@ mp_image_t *dmpi = NULL; if (vf->priv->passthrough) { - dmpi=vf_get_image(vf->next, IMGFMT_MPEGPES, MP_IMGTYPE_EXPORT, + dmpi=vf_get_new_image(vf->next, IMGFMT_MPEGPES, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h,mpi->xp_idx); dmpi->planes[0]=mpi->planes[0]; return vf_next_put_slice(vf,dmpi); @@ -185,7 +185,7 @@ if(mpi->flags&MP_IMGFLAG_DIRECT) dmpi = mpi->priv; else { - dmpi = vf_get_image(vf->next,mpi->imgfmt, + dmpi = vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); copy_mpi(dmpi,mpi); @@ -199,7 +199,7 @@ if(mpi->flags&MP_IMGFLAG_DIRECT) dmpi = mpi->priv; else { - dmpi = vf_get_image(vf->next,mpi->imgfmt, + dmpi = vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_mirror.c =================================================================== --- mplayerxp/postproc/vf_mirror.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_mirror.c 2012-11-12 13:14:33 UTC (rev 342) @@ -99,7 +99,7 @@ mp_image_t *dmpi; int finalize; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h, mpi->xp_idx); finalize = dmpi->flags&MP_IMGFLAG_FINALIZED; Modified: mplayerxp/postproc/vf_noise.c =================================================================== --- mplayerxp/postproc/vf_noise.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_noise.c 2012-11-12 13:14:33 UTC (rev 342) @@ -327,7 +327,7 @@ if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ // ok, we can do pp in-place (or pp disabled): - vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, + vf->dmpi=vf_get_new_image(vf->next,mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h,mpi->xp_idx); mpi->planes[0]=vf->dmpi->planes[0]; mpi->stride[0]=vf->dmpi->stride[0]; @@ -347,7 +347,7 @@ if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, + vf->dmpi=vf_get_new_image(vf->next,vf->priv->outfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); //printf("nodr\n"); Modified: mplayerxp/postproc/vf_ow.c =================================================================== --- mplayerxp/postproc/vf_ow.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_ow.c 2012-11-12 13:14:33 UTC (rev 342) @@ -219,7 +219,7 @@ static void __FASTCALL__ get_image(struct vf_instance_s* vf, mp_image_t *mpi){ if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change // ok, we can do pp in-place (or pp disabled): - vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, + vf->dmpi=vf_get_new_image(vf->next,mpi->imgfmt, mpi->type, mpi->flags | MP_IMGFLAG_READABLE, mpi->width, mpi->height,mpi->xp_idx); mpi->planes[0]=vf->dmpi->planes[0]; mpi->stride[0]=vf->dmpi->stride[0]; @@ -238,7 +238,7 @@ if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // no DR, so get a new image! hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, mpi->width,mpi->height,mpi->xp_idx); Modified: mplayerxp/postproc/vf_palette.c =================================================================== --- mplayerxp/postproc/vf_palette.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_palette.c 2012-11-12 13:14:33 UTC (rev 342) @@ -78,7 +78,7 @@ mp_image_t *dmpi; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,vf->priv->fmt, + dmpi=vf_get_new_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h, mpi->xp_idx); Modified: mplayerxp/postproc/vf_panscan.c =================================================================== --- mplayerxp/postproc/vf_panscan.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_panscan.c 2012-11-12 13:14:33 UTC (rev 342) @@ -101,7 +101,7 @@ /* In hope that mpi->x === 0 */ cw=MIN(sw,dw); ch=MIN(sh,dh); - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, cw,ch,mpi->xp_idx); finalize = dmpi->flags&MP_IMGFLAG_FINALIZED; Modified: mplayerxp/postproc/vf_perspective.c =================================================================== --- mplayerxp/postproc/vf_perspective.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_perspective.c 2012-11-12 13:14:33 UTC (rev 342) @@ -258,7 +258,7 @@ int cw= mpi->w >> mpi->chroma_x_shift; int ch= mpi->h >> mpi->chroma_y_shift; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + mp_image_t *dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_pp.c =================================================================== --- mplayerxp/postproc/vf_pp.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_pp.c 2012-11-12 13:14:33 UTC (rev 342) @@ -85,7 +85,7 @@ if(!(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ // ok, we can do pp in-place (or pp disabled): - vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, + vf->dmpi=vf_get_new_image(vf->next,mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h,mpi->xp_idx); mpi->planes[0]=vf->dmpi->planes[0]; mpi->stride[0]=vf->dmpi->stride[0]; @@ -102,7 +102,7 @@ static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, + vf->dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, (mpi->w+7)&(~7),(mpi->h+7)&(~7),mpi->xp_idx); } Modified: mplayerxp/postproc/vf_raw.c =================================================================== --- mplayerxp/postproc/vf_raw.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_raw.c 2012-11-12 13:14:33 UTC (rev 342) @@ -33,7 +33,7 @@ mp_image_t *dmpi; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); if(mpi->flags&MP_IMGFLAG_PLANAR){ Modified: mplayerxp/postproc/vf_rectangle.c =================================================================== --- mplayerxp/postproc/vf_rectangle.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_rectangle.c 2012-11-12 13:14:33 UTC (rev 342) @@ -67,7 +67,7 @@ int finalize; unsigned int bpp = mpi->bpp / 8; unsigned int x, y, w, h; - dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP, + dmpi = vf_get_new_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, mpi->w, mpi->h,mpi->xp_idx); finalize = dmpi->flags&MP_IMGFLAG_FINALIZED; Modified: mplayerxp/postproc/vf_rgb2bgr.c =================================================================== --- mplayerxp/postproc/vf_rgb2bgr.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_rgb2bgr.c 2012-11-12 13:14:33 UTC (rev 342) @@ -51,7 +51,7 @@ mp_image_t *dmpi; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,vf->priv->fmt, + dmpi=vf_get_new_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h, mpi->xp_idx); Modified: mplayerxp/postproc/vf_rotate.c =================================================================== --- mplayerxp/postproc/vf_rotate.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_rotate.c 2012-11-12 13:14:33 UTC (rev 342) @@ -130,18 +130,18 @@ // hope we'll get DR buffer: if(vf->priv->direction==180) { - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h, mpi->xp_idx); } else { if(vf->priv->direction==90) - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->h, mpi->w, mpi->xp_idx); else - dmpi=vf_get_image(vf->next,mpi->imgfmt, + dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->h, mpi->w, mpi->xp_idx); } Modified: mplayerxp/postproc/vf_scale.c =================================================================== --- mplayerxp/postproc/vf_scale.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_scale.c 2012-11-12 13:14:33 UTC (rev 342) @@ -341,7 +341,7 @@ stride[3]=mpi->stride[3]; } MSG_DBG2("vf_scale.put_frame was called\n"); - dmpi=vf_get_image(vf->next,vf->priv->fmt, + dmpi=vf_get_new_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, vf->priv->w, vf->priv->h,mpi->xp_idx); scale(vf->priv->ctx, vf->priv->ctx2, planes, stride, mpi->y, mpi->h, dmpi->planes, dmpi->stride, vf->priv->interlaced); @@ -364,7 +364,7 @@ stride[3]=mpi->stride[3]; } MSG_DBG2("vf_scale.put_slice was called[%i %i]\n",mpi->y, mpi->h); - dmpi=vf_get_image(vf->next,vf->priv->fmt, + dmpi=vf_get_new_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, vf->priv->w, vf->priv->h,mpi->xp_idx); /* Try to fake first slice*/ Modified: mplayerxp/postproc/vf_smartblur.c =================================================================== --- mplayerxp/postproc/vf_smartblur.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_smartblur.c 2012-11-12 13:14:33 UTC (rev 342) @@ -169,7 +169,7 @@ int cw= mpi->w >> mpi->chroma_x_shift; int ch= mpi->h >> mpi->chroma_y_shift; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + mp_image_t *dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); @@ -320,7 +320,7 @@ int cw= mpi->w >> mpi->chroma_x_shift; int ch= mpi->h >> mpi->chroma_y_shift; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + mp_image_t *dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); @@ -446,7 +446,7 @@ int cw= mpi->w >> mpi->chroma_x_shift; int ch= mpi->h >> mpi->chroma_y_shift; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + mp_image_t *dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_softpulldown.c =================================================================== --- mplayerxp/postproc/vf_softpulldown.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_softpulldown.c 2012-11-12 13:14:33 UTC (rev 342) @@ -44,9 +44,9 @@ int flags = mpi->fields; int state = vf->priv->state; - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE, mpi->w, mpi->h,mpi->xp_idx); + dmpi = vf_get_new_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE, mpi->w, mpi->h,mpi->xp_idx); finalize = dmpi->flags&MP_IMGFLAG_FINALIZED; vf->priv->in++; Modified: mplayerxp/postproc/vf_swapuv.c =================================================================== --- mplayerxp/postproc/vf_swapuv.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_swapuv.c 2012-11-12 13:14:33 UTC (rev 342) @@ -35,7 +35,7 @@ //===========================================================================// static void __FASTCALL__ get_image(struct vf_instance_s* vf, mp_image_t *mpi){ - mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt, + mp_image_t *dmpi= vf_get_new_image(vf->next, mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h,mpi->xp_idx); mpi->planes[0]=dmpi->planes[0]; @@ -57,7 +57,7 @@ if(mpi->flags&MP_IMGFLAG_DIRECT){ dmpi=(mp_image_t*)mpi->priv; } else { - dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h,mpi->xp_idx); + dmpi=vf_get_new_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h,mpi->xp_idx); assert(mpi->flags&MP_IMGFLAG_PLANAR); dmpi->planes[0]=mpi->planes[0]; dmpi->planes[1]=mpi->planes[2]; Modified: mplayerxp/postproc/vf_test.c =================================================================== --- mplayerxp/postproc/vf_test.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_test.c 2012-11-12 13:14:33 UTC (rev 342) @@ -121,7 +121,7 @@ int x, y; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,vf->priv->fmt, + dmpi=vf_get_new_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h, mpi->xp_idx); @@ -376,7 +376,7 @@ int frame= vf->priv->frame_num; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,IMGFMT_YV12, + dmpi=vf_get_new_image(vf->next,IMGFMT_YV12, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_unsharp.c =================================================================== --- mplayerxp/postproc/vf_unsharp.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_unsharp.c 2012-11-12 13:14:33 UTC (rev 342) @@ -187,7 +187,7 @@ if( mpi->imgfmt!=vf->priv->outfmt ) return; // colorspace differ - vf->dmpi = vf_get_image( vf->next, mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h,mpi->xp_idx ); + vf->dmpi = vf_get_new_image( vf->next, mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h,mpi->xp_idx ); mpi->planes[0] = vf->dmpi->planes[0]; mpi->stride[0] = vf->dmpi->stride[0]; mpi->width = vf->dmpi->width; @@ -206,7 +206,7 @@ if( !(mpi->flags & MP_IMGFLAG_DIRECT) ) // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi = vf_get_image( vf->next,vf->priv->outfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h,mpi->xp_idx); + vf->dmpi = vf_get_new_image( vf->next,vf->priv->outfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h,mpi->xp_idx); dmpi= vf->dmpi; finalize = dmpi->flags&MP_IMGFLAG_FINALIZED; Modified: mplayerxp/postproc/vf_vo.c =================================================================== --- mplayerxp/postproc/vf_vo.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_vo.c 2012-11-12 13:14:33 UTC (rev 342) @@ -133,12 +133,11 @@ MSG_DBG2("vf_vo_get_image was called failed\n"); } -static int __FASTCALL__ put_slice(struct vf_instance_s* vf, - mp_image_t *mpi){ +static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ if(!vo_config_count) return 0; // vo not configured? if(!(mpi->flags & MP_IMGFLAG_FINAL) || (vf->sh->vfilter==vf && !(mpi->flags & MP_IMGFLAG_RENDERED))) { - MSG_DBG2("vf_vo_put_slice was called(%u): %u %u %u %u\n",mpi->xp_idx,mpi->x,mpi->y,mpi->w,mpi->h); - vo_draw_slice(vo_data,mpi); + MSG_DBG2("vf_vo_put_slice was called(%u): %u %u %u %u\n",mpi->xp_idx,mpi->x,mpi->y,mpi->w,mpi->h); + vo_draw_slice(vo_data,mpi); } return 1; } Modified: mplayerxp/postproc/vf_yuvcsp.c =================================================================== --- mplayerxp/postproc/vf_yuvcsp.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_yuvcsp.c 2012-11-12 13:14:33 UTC (rev 342) @@ -36,7 +36,7 @@ uint8_t *y_in, *cb_in, *cr_in; uint8_t *y_out, *cb_out, *cr_out; - vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, + vf->dmpi=vf_get_new_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_yuy2.c =================================================================== --- mplayerxp/postproc/vf_yuy2.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_yuy2.c 2012-11-12 13:14:33 UTC (rev 342) @@ -34,7 +34,7 @@ mp_image_t *dmpi; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,IMGFMT_YUY2, + dmpi=vf_get_new_image(vf->next,IMGFMT_YUY2, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h,mpi->xp_idx); Modified: mplayerxp/postproc/vf_yvu9.c =================================================================== --- mplayerxp/postproc/vf_yvu9.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/postproc/vf_yvu9.c 2012-11-12 13:14:33 UTC (rev 342) @@ -32,7 +32,7 @@ int y,w,h,finalize; // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,IMGFMT_YV12, + dmpi=vf_get_new_image(vf->next,IMGFMT_YV12, MP_IMGTYPE_TEMP, 0/*MP_IMGFLAG_ACCEPT_STRIDE*/, mpi->w, mpi->h,mpi->xp_idx); finalize = dmpi->flags&MP_IMGFLAG_FINALIZED; Modified: mplayerxp/xmpcore/mp_image.c =================================================================== --- mplayerxp/xmpcore/mp_image.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/xmpcore/mp_image.c 2012-11-12 13:14:33 UTC (rev 342) @@ -159,41 +159,39 @@ } mp_image_t* alloc_mpi(unsigned w, unsigned h, unsigned int fmt,unsigned xp_idx) { - mp_image_t* mpi = new_mp_image(w,h,xp_idx); + mp_image_t* mpi = new_mp_image(w,h,xp_idx); - mp_image_setfmt(mpi,fmt); - mpi_alloc_planes(mpi); - return mpi; + mp_image_setfmt(mpi,fmt); + mpi_alloc_planes(mpi); + return mpi; } void mpi_alloc_planes(mp_image_t *mpi) { - // IF09 - allocate space for 4. plane delta info - unused - if (mpi->imgfmt == IMGFMT_IF09) - { - mpi->planes[0]=mp_memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8+ - mpi->chroma_width*mpi->chroma_height); - /* delta table, just for fun ;) */ - mpi->planes[3]=mpi->planes[0]+2*(mpi->chroma_width*mpi->chroma_height); - } - else - mpi->planes[0]=mp_memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8); - if(mpi->flags&MP_IMGFLAG_PLANAR){ - // YV12/I420/YVU9/IF09. feel mp_free to add other planar formats here... - if(!mpi->stride[0]) mpi->stride[0]=mpi->width; - if(!mpi->stride[1]) mpi->stride[1]=mpi->stride[2]=mpi->chroma_width; - if(mpi->flags&MP_IMGFLAG_SWAPPED){ - // I420/IYUV (Y,U,V) - mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height; - mpi->planes[2]=mpi->planes[1]+mpi->chroma_width*mpi->chroma_height; + unsigned size,delta; + size=mpi->bpp*mpi->width*(mpi->height+2)/8; + delta=0; + // IF09 - allocate space for 4. plane delta info - unused + if (mpi->imgfmt == IMGFMT_IF09) delta=mpi->chroma_width*mpi->chroma_height; + mpi->planes[0]=mp_memalign(64,size+delta); + if(delta) /* delta table, just for fun ;) */ + mpi->planes[3]=mpi->planes[0]+2*(mpi->chroma_width*mpi->chroma_height); + if(mpi->flags&MP_IMGFLAG_PLANAR){ + // YV12/I420/YVU9/IF09. feel mp_free to add other planar formats here... + if(!mpi->stride[0]) mpi->stride[0]=mpi->width; + if(!mpi->stride[1]) mpi->stride[1]=mpi->stride[2]=mpi->chroma_width; + if(mpi->flags&MP_IMGFLAG_SWAPPED){ + // I420/IYUV (Y,U,V) + mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height; + mpi->planes[2]=mpi->planes[1]+mpi->chroma_width*mpi->chroma_height; + } else { + // YV12,YVU9,IF09 (Y,V,U) + mpi->planes[2]=mpi->planes[0]+mpi->width*mpi->height; + mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height; + } } else { - // YV12,YVU9,IF09 (Y,V,U) - mpi->planes[2]=mpi->planes[0]+mpi->width*mpi->height; - mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height; + if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; } - } else { - if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; - } - mpi->flags|=MP_IMGFLAG_ALLOCATED; + mpi->flags|=MP_IMGFLAG_ALLOCATED; } void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi) { @@ -218,4 +216,5 @@ dmpi->h = h; dmpi->chroma_height = h >> mpi->chroma_y_shift; dmpi->xp_idx = mpi->xp_idx; + dmpi->flags&=~MP_IMGFLAG_ALLOCATED; } Modified: mplayerxp/xmpcore/sig_hand.c =================================================================== --- mplayerxp/xmpcore/sig_hand.c 2012-11-12 11:15:50 UTC (rev 341) +++ mplayerxp/xmpcore/sig_hand.c 2012-11-12 13:14:33 UTC (rev 342) @@ -23,29 +23,9 @@ #ifdef HAVE_BACKTRACE #include <execinfo.h> -/* Obtain a backtrace and print it to stdout. */ -static void print_trace (void) -{ - any_t*array[10]; - size_t size; - char **strings; - size_t i; - - size = backtrace (array, 10); - strings = backtrace_symbols (array, size); - - MSG_ERR ("Obtained %zd stack frames.\n", size); - - for (i = 0; i < size; i++) - MSG_ERR ("%s\n", strings[i]); - - mp_free (strings); -} - /* A dummy function to make the backtrace more interesting. */ -static void dump_trace (void) -{ - print_trace (); +static void dump_trace (void) { + show_backtrace("Obtained %zd stack frames.\n",mp_conf.max_trace); } #endif static void my_callback(int signo) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-13 07:52:07
|
Revision: 352 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=352&view=rev Author: nickols_k Date: 2012-11-13 07:51:55 +0000 (Tue, 13 Nov 2012) Log Message: ----------- initial QoS protection for modules Modified Paths: -------------- README mplayerxp/configure mplayerxp/input2/input.c mplayerxp/libao2/audio_out.c mplayerxp/libao2/audio_out.h mplayerxp/libao2/mixer.c mplayerxp/libmpcodecs/ad_vorbis.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/vd.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/stream.c mplayerxp/libmpdemux/stream.h mplayerxp/libplaytree/asxparser.c mplayerxp/libplaytree/playtreeparser.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/mplayerxp.c mplayerxp/osdep/mplib.c mplayerxp/osdep/mplib.h mplayerxp/postproc/af.c mplayerxp/postproc/af.h mplayerxp/postproc/af_ao2.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_vo.c mplayerxp/xmpcore/xmp_adecoder.c mplayerxp/xmpcore/xmp_aplayer.c mplayerxp/xmpcore/xmp_vdecoder.c mplayerxp/xmpcore/xmp_vplayer.c Modified: README =================================================================== --- README 2012-11-13 06:22:26 UTC (rev 351) +++ README 2012-11-13 07:51:55 UTC (rev 352) @@ -150,6 +150,12 @@ pointer on XP-CORE between antiviral-holes which reject memory scan. Also it attempts to prevent registration of unknown drivers using some antiviral traps. +Furthermore, GCC itself has a virual nature because it supports so-called +__attribute__ ((alias (#name))); __attribute__ ((weak)) +which allow overload any function of program. To avoid that MPlayerXP uses +RND_RENAME() macroses which generate pseudo-random names for some functions +during configure time. + But last word in this way was not speaked. ;) Best regards! Nickols_K Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/configure 2012-11-13 07:51:55 UTC (rev 352) @@ -768,7 +768,15 @@ EOF cc_check || die "Canot generate pseudo-random numbers" +echocheck "generating pseudo-random numbers" rnd_arr=`$TMPO` +sleep 1 +rnd_carr=`$TMPO` +sleep 1 +rnd_sarr=`$TMPO` +sleep 1 +rnd_farr=`$TMPO` +echores "done" rnd0=`echo $rnd_arr | cut -d ' ' -f 1` rnd1=`echo $rnd_arr | cut -d ' ' -f 2` @@ -781,17 +789,50 @@ rnd8=`echo $rnd_arr | cut -d ' ' -f 9` rnd9=`echo $rnd_arr | cut -d ' ' -f 10` -crnd0=$(($rnd0 % 255)) -crnd1=$(($rnd1 % 255)) -crnd2=$(($rnd2 % 255)) -crnd3=$(($rnd3 % 255)) -crnd4=$(($rnd4 % 255)) -crnd5=$(($rnd5 % 255)) -crnd6=$(($rnd6 % 255)) -crnd7=$(($rnd7 % 255)) -crnd8=$(($rnd8 % 255)) -crnd9=$(($rnd9 % 255)) +srnd0=`echo $rnd_sarr | cut -d ' ' -f 1` +srnd1=`echo $rnd_sarr | cut -d ' ' -f 2` +srnd2=`echo $rnd_sarr | cut -d ' ' -f 3` +srnd3=`echo $rnd_sarr | cut -d ' ' -f 4` +srnd4=`echo $rnd_sarr | cut -d ' ' -f 5` +srnd5=`echo $rnd_sarr | cut -d ' ' -f 6` +srnd6=`echo $rnd_sarr | cut -d ' ' -f 7` +srnd7=`echo $rnd_sarr | cut -d ' ' -f 8` +srnd8=`echo $rnd_sarr | cut -d ' ' -f 9` +srnd9=`echo $rnd_sarr | cut -d ' ' -f 10` +frnd0=`echo $rnd_farr | cut -d ' ' -f 1` +frnd1=`echo $rnd_farr | cut -d ' ' -f 2` +frnd2=`echo $rnd_farr | cut -d ' ' -f 3` +frnd3=`echo $rnd_farr | cut -d ' ' -f 4` +frnd4=`echo $rnd_farr | cut -d ' ' -f 5` +frnd5=`echo $rnd_farr | cut -d ' ' -f 6` +frnd6=`echo $rnd_farr | cut -d ' ' -f 7` +frnd7=`echo $rnd_farr | cut -d ' ' -f 8` +frnd8=`echo $rnd_farr | cut -d ' ' -f 9` +frnd9=`echo $rnd_farr | cut -d ' ' -f 10` + +crnd0=`echo $rnd_carr | cut -d ' ' -f 1` +crnd1=`echo $rnd_carr | cut -d ' ' -f 2` +crnd2=`echo $rnd_carr | cut -d ' ' -f 3` +crnd3=`echo $rnd_carr | cut -d ' ' -f 4` +crnd4=`echo $rnd_carr | cut -d ' ' -f 5` +crnd5=`echo $rnd_carr | cut -d ' ' -f 6` +crnd6=`echo $rnd_carr | cut -d ' ' -f 7` +crnd7=`echo $rnd_carr | cut -d ' ' -f 8` +crnd8=`echo $rnd_carr | cut -d ' ' -f 9` +crnd9=`echo $rnd_carr | cut -d ' ' -f 10` + +crnd0=$(($crnd0 % 255)) +crnd1=$(($crnd1 % 255)) +crnd2=$(($crnd2 % 255)) +crnd3=$(($crnd3 % 255)) +crnd4=$(($crnd4 % 255)) +crnd5=$(($crnd5 % 255)) +crnd6=$(($crnd6 % 255)) +crnd7=$(($crnd7 % 255)) +crnd8=$(($crnd8 % 255)) +crnd9=$(($crnd9 % 255)) + ############################################################################# echo "Creating mp_config.mak" cat >> mp_config.mak << EOF @@ -1004,28 +1045,28 @@ #define RND_NUMBER8 $rnd8 #define RND_NUMBER9 $rnd9 -#define RND_STR0 "$rnd0" -#define RND_STR1 "$rnd1" -#define RND_STR2 "$rnd2" -#define RND_STR3 "$rnd3" -#define RND_STR4 "$rnd4" -#define RND_STR5 "$rnd5" -#define RND_STR6 "$rnd6" -#define RND_STR7 "$rnd7" -#define RND_STR8 "$rnd8" -#define RND_STR9 "$rnd9" +#define RND_STR0 "$srnd0" +#define RND_STR1 "$srnd1" +#define RND_STR2 "$srnd2" +#define RND_STR3 "$srnd3" +#define RND_STR4 "$srnd4" +#define RND_STR5 "$srnd5" +#define RND_STR6 "$srnd6" +#define RND_STR7 "$srnd7" +#define RND_STR8 "$srnd8" +#define RND_STR9 "$srnd9" -#define RND_RENAME0(a) a ## $rnd0 -#define RND_RENAME1(a) a ## $rnd1 -#define RND_RENAME2(a) a ## $rnd2 -#define RND_RENAME3(a) a ## $rnd3 -#define RND_RENAME4(a) a ## $rnd4 -#define RND_RENAME5(a) a ## $rnd5 -#define RND_RENAME6(a) a ## $rnd6 -#define RND_RENAME7(a) a ## $rnd7 -#define RND_RENAME8(a) a ## $rnd8 -#define RND_RENAME9(a) a ## $rnd9 +#define RND_RENAME0(a) a ## $frnd0 +#define RND_RENAME1(a) a ## $frnd1 +#define RND_RENAME2(a) a ## $frnd2 +#define RND_RENAME3(a) a ## $frnd3 +#define RND_RENAME4(a) a ## $frnd4 +#define RND_RENAME5(a) a ## $frnd5 +#define RND_RENAME6(a) a ## $frnd6 +#define RND_RENAME7(a) a ## $frnd7 +#define RND_RENAME8(a) a ## $frnd8 +#define RND_RENAME9(a) a ## $frnd9 #endif /* MPXP_CONFIG_H */ EOF Modified: mplayerxp/input2/input.c =================================================================== --- mplayerxp/input2/input.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/input2/input.c 2012-11-13 07:51:55 UTC (rev 352) @@ -742,6 +742,7 @@ filter->ctx = ctx; filter->next = priv->cmd_filters; priv->cmd_filters = filter; + RND_RENAME0(rnd_fill)(priv->antiviral_hole,sizeof(priv->antiviral_hole)); } static char* mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) { Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libao2/audio_out.c 2012-11-13 07:51:55 UTC (rev 352) @@ -66,7 +66,7 @@ NULL }; -static const ao_functions_t *audio_out=NULL; +static const ao_functions_t *RND_RENAME8(audio_out)=NULL; char * __FASTCALL__ ao_format_name(int format) { @@ -182,46 +182,47 @@ MSG_INFO("\n"); } -const ao_functions_t* __FASTCALL__ ao_register(const char *driver_name) +const ao_functions_t* __FASTCALL__ RND_RENAME4(ao_register)(const char *driver_name) { unsigned i; if(!driver_name) - audio_out=audio_out_drivers[0]; + RND_RENAME8(audio_out)=audio_out_drivers[0]; else for (i=0; audio_out_drivers[i] != &audio_out_null; i++) { const ao_info_t *info = audio_out_drivers[i]->info; if(strcmp(info->short_name,driver_name) == 0){ - audio_out = audio_out_drivers[i];break; + RND_RENAME8(audio_out) = audio_out_drivers[i];break; } } - return audio_out; + return RND_RENAME8(audio_out); } const ao_info_t* ao_get_info( void ) { - return audio_out->info; + return RND_RENAME8(audio_out)->info; } -ao_data_t* __FASTCALL__ ao_init(unsigned flags,const char *subdevice) +ao_data_t* __FASTCALL__ RND_RENAME5(ao_init)(unsigned flags,const char *subdevice) { ao_data_t* ao; ao=mp_mallocz(sizeof(ao_data_t)); if(subdevice) ao->subdevice=mp_strdup(subdevice); ao->outburst=OUTBURST; ao->buffersize=-1; - if(audio_out->init(ao,flags)==MPXP_Ok) return ao; + RND_RENAME0(rnd_fill)(ao->antiviral_hole,sizeof(ao->antiviral_hole)); + if(RND_RENAME8(audio_out)->init(ao,flags)==MPXP_Ok) return ao; mp_free(ao); return NULL; } MPXP_Rc __FASTCALL__ ao_configure(ao_data_t*ao,unsigned rate,unsigned channels,unsigned format) { - return audio_out->configure(ao,rate,channels,format); + return RND_RENAME8(audio_out)->configure(ao,rate,channels,format); } void ao_uninit(ao_data_t*ao) { - audio_out->uninit(ao); + RND_RENAME8(audio_out)->uninit(ao); if(ao->subdevice) mp_free(ao->subdevice); mp_free(ao); ao=NULL; @@ -229,35 +230,35 @@ void ao_reset(ao_data_t*ao) { - if(ao) audio_out->reset(ao); + if(ao) RND_RENAME8(audio_out)->reset(ao); } unsigned ao_get_space(ao_data_t*ao) { - return ao?audio_out->get_space(ao):0; + return ao?RND_RENAME8(audio_out)->get_space(ao):0; } float ao_get_delay(ao_data_t*ao) { - return ao?audio_out->get_delay(ao):0; + return ao?RND_RENAME8(audio_out)->get_delay(ao):0; } -unsigned __FASTCALL__ ao_play(ao_data_t*ao,any_t* data,unsigned len,unsigned flags) +unsigned __FASTCALL__ RND_RENAME6(ao_play)(ao_data_t*ao,any_t* data,unsigned len,unsigned flags) { - return ao?audio_out->play(ao,data,len,flags):0; + return ao?RND_RENAME8(audio_out)->play(ao,data,len,flags):0; } void ao_pause(ao_data_t*ao) { - if(ao) audio_out->pause(ao); + if(ao) RND_RENAME8(audio_out)->pause(ao); } void ao_resume(ao_data_t*ao) { - if(ao) audio_out->resume(ao); + if(ao) RND_RENAME8(audio_out)->resume(ao); } -MPXP_Rc __FASTCALL__ ao_control(ao_data_t*ao,int cmd,long arg) +MPXP_Rc __FASTCALL__ RND_RENAME7(ao_control)(ao_data_t*ao,int cmd,long arg) { - return ao?audio_out->control(ao,cmd,arg):MPXP_Error; + return ao?RND_RENAME8(audio_out)->control(ao,cmd,arg):MPXP_Error; } Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libao2/audio_out.h 2012-11-13 07:51:55 UTC (rev 352) @@ -15,6 +15,7 @@ typedef struct ao_data_s { char* subdevice; + char antiviral_hole[RND_CHAR2]; unsigned samplerate; /**< rate of samples in Hz */ unsigned channels; /**< number of audio channels */ unsigned format; /**< format of audio samples */ @@ -98,16 +99,16 @@ extern int __FASTCALL__ ao_format_bits(int format); extern void ao_print_help( void ); -extern const ao_functions_t* __FASTCALL__ ao_register(const char *driver_name); +extern const ao_functions_t* __FASTCALL__ RND_RENAME4(ao_register)(const char *driver_name); extern const ao_info_t* ao_get_info( void ); -extern ao_data_t* __FASTCALL__ ao_init(unsigned flags,const char *subdevice); +extern ao_data_t* __FASTCALL__ RND_RENAME5(ao_init)(unsigned flags,const char *subdevice); extern MPXP_Rc __FASTCALL__ ao_configure(ao_data_t* priv,unsigned rate,unsigned channels,unsigned format); extern void __FASTCALL__ ao_uninit(ao_data_t* priv); extern void __FASTCALL__ ao_reset(ao_data_t* priv); extern unsigned __FASTCALL__ ao_get_space(ao_data_t* priv); -extern unsigned __FASTCALL__ ao_play(ao_data_t* priv,any_t* data,unsigned len,unsigned flags); +extern unsigned __FASTCALL__ RND_RENAME6(ao_play)(ao_data_t* priv,any_t* data,unsigned len,unsigned flags); extern float __FASTCALL__ ao_get_delay(ao_data_t* priv); extern void __FASTCALL__ ao_pause(ao_data_t* priv); extern void __FASTCALL__ ao_resume(ao_data_t* priv); -extern MPXP_Rc __FASTCALL__ ao_control(ao_data_t* priv,int cmd,long arg); +extern MPXP_Rc __FASTCALL__ RND_RENAME7(ao_control)(ao_data_t* priv,int cmd,long arg); #endif Modified: mplayerxp/libao2/mixer.c =================================================================== --- mplayerxp/libao2/mixer.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libao2/mixer.c 2012-11-13 07:51:55 UTC (rev 352) @@ -12,7 +12,7 @@ { ao_control_vol_t vol; *l=0; *r=0; - if(MPXP_Ok != ao_control(ao,AOCONTROL_GET_VOLUME,(long)&vol)) return; + if(MPXP_Ok != RND_RENAME7(ao_control)(ao,AOCONTROL_GET_VOLUME,(long)&vol)) return; *r=vol.right; *l=vol.left; } @@ -21,7 +21,7 @@ { ao_control_vol_t vol; vol.right=r; vol.left=l; - ao_control(ao,AOCONTROL_SET_VOLUME,(long)&vol); + RND_RENAME7(ao_control)(ao,AOCONTROL_SET_VOLUME,(long)&vol); } #define MIXER_CHANGE 3 Modified: mplayerxp/libmpcodecs/ad_vorbis.c =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpcodecs/ad_vorbis.c 2012-11-13 07:51:55 UTC (rev 352) @@ -99,7 +99,7 @@ #define OGG_FMT16 AFMT_S16_LE #endif sh->afmt=OGG_FMT16; - if(ao_control(ao_data,AOCONTROL_QUERY_FORMAT,OGG_FMT32) == MPXP_Ok) { + if(RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_FORMAT,OGG_FMT32) == MPXP_Ok) { sh->afmt=OGG_FMT32; } // assume 128kbit if bitrate not specified in the header Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-11-13 07:51:55 UTC (rev 352) @@ -28,7 +28,7 @@ static const ad_functions_t* mpadec; -MPXP_Rc mpca_init(sh_audio_t *sh_audio) +MPXP_Rc RND_RENAME2(mpca_init)(sh_audio_t *sh_audio) { mpadec=afm_find_driver(sh_audio->codec->driver_name); if(!mpadec){ @@ -143,7 +143,7 @@ unsigned in_samplerate, unsigned in_channels, unsigned in_format, unsigned* out_samplerate, unsigned* out_channels, unsigned* out_format){ char strbuf[200]; - af_stream_t* afs=af_new(sh_audio); + af_stream_t* afs=RND_RENAME6(af_new)(sh_audio); // input format: same as codec's output format: afs->input.rate = in_samplerate; @@ -163,7 +163,7 @@ afs->input.rate,afs->input.nch,(afs->input.format&MPAF_BPS_MASK)*8); // let's autoprobe it! - if(MPXP_Ok != af_init(afs,0)){ + if(MPXP_Ok != RND_RENAME7(af_init)(afs,0)){ mp_free(afs); return MPXP_False; // failed :( } @@ -190,7 +190,7 @@ unsigned out_minsize, unsigned out_maxsize){ char strbuf[200]; af_stream_t* afs=sh_audio->afilter; - if(!afs) afs = af_new(sh_audio); + if(!afs) afs = RND_RENAME6(af_new)(sh_audio); // input format: same as codec's output format: afs->input.rate = in_samplerate; @@ -210,7 +210,7 @@ afs->output.rate,afs->output.nch,(afs->output.format&MPAF_BPS_MASK)*8,ao_format_name(mpaf_format_encode(afs->output.format))); // let's autoprobe it! - if(MPXP_Ok != af_init(afs,1)){ + if(MPXP_Ok != RND_RENAME7(af_init)(afs,1)){ sh_audio->afilter=NULL; mp_free(afs); return MPXP_False; // failed :( @@ -255,7 +255,7 @@ out_minsize,out_maxsize); } -unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts) +unsigned RND_RENAME3(mpca_decode)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts) { unsigned len; unsigned cp_size,cp_tile; @@ -293,7 +293,7 @@ afd.rate=sh_audio->rate; afd.nch=sh_audio->nch; afd.format=mpaf_format_decode(sh_audio->afmt); - pafd=af_play(sh_audio->afilter,&afd); + pafd=RND_RENAME8(af_play)(sh_audio->afilter,&afd); if(!pafd) { MSG_V("decaudio: filter error\n"); Modified: mplayerxp/libmpcodecs/dec_audio.h =================================================================== --- mplayerxp/libmpcodecs/dec_audio.h 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpcodecs/dec_audio.h 2012-11-13 07:51:55 UTC (rev 352) @@ -6,9 +6,9 @@ // dec_audio.c: extern const ad_functions_t* __FASTCALL__ mpca_find_driver(const char *name); -extern MPXP_Rc __FASTCALL__ mpca_init(sh_audio_t *sh_audio); +extern MPXP_Rc __FASTCALL__ RND_RENAME2(mpca_init)(sh_audio_t *sh_audio); extern void __FASTCALL__ mpca_uninit(sh_audio_t *sh_audio); -extern unsigned __FASTCALL__ mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts); +extern unsigned __FASTCALL__ RND_RENAME3(mpca_decode)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts); extern void __FASTCALL__ mpca_resync_stream(sh_audio_t *sh_audio); extern void __FASTCALL__ mpca_skip_frame(sh_audio_t *sh_audio); struct codecs_st; Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-13 07:51:55 UTC (rev 352) @@ -128,7 +128,7 @@ return MPXP_Ok; } -MPXP_Rc mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,any_t*libinput){ +MPXP_Rc RND_RENAME3(mpcv_init)(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,any_t*libinput){ sh_video->codec=NULL; MSG_DBG3("mpcv_init(%p, %s, %s, %i)\n",sh_video,codecname,vfm,status); while((sh_video->codec=find_codec(sh_video->fourcc, @@ -226,7 +226,7 @@ extern vo_data_t* vo_data; static void update_subtitle(sh_video_t *sh_video,float v_pts,unsigned idx); -int mpcv_decode(sh_video_t *sh_video,const enc_frame_t* frame){ +int RND_RENAME4(mpcv_decode)(sh_video_t *sh_video,const enc_frame_t* frame){ vf_instance_t* vf; mp_image_t *mpi=NULL; unsigned int t; Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpcodecs/dec_video.h 2012-11-13 07:51:55 UTC (rev 352) @@ -3,11 +3,11 @@ #include "xmpcore/xmp_enums.h" // dec_video.c: -extern MPXP_Rc __FASTCALL__ mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status,any_t*libinput); +extern MPXP_Rc __FASTCALL__ RND_RENAME3(mpcv_init)(sh_video_t *sh_video, const char *codec_name,const char *family,int status,any_t*libinput); extern void __FASTCALL__ mpcv_uninit(sh_video_t *sh_video); extern MPXP_Rc __FASTCALL__ mpcv_ffmpeg_init(sh_video_t*,any_t* libinput); -extern int __FASTCALL__ mpcv_decode(sh_video_t *sh_video,const enc_frame_t* frame); +extern int __FASTCALL__ RND_RENAME4(mpcv_decode)(sh_video_t *sh_video,const enc_frame_t* frame); extern MPXP_Rc __FASTCALL__ mpcv_get_quality_max(sh_video_t *sh_video,unsigned *qual); extern MPXP_Rc __FASTCALL__ mpcv_set_quality(sh_video_t *sh_video,int quality); Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpcodecs/vd.c 2012-11-13 07:51:55 UTC (rev 352) @@ -163,13 +163,13 @@ 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,libinput); + sc=vf=RND_RENAME9(vf_open_filter)(vf,sh,"fmtcvt",NULL,libinput); goto csp_again; } else if(palette==1){ MSG_V("vd: Trying -vf palette...\n"); palette=-1; - vf=vf_open_filter(vf,sh,"palette",NULL,libinput); + vf=RND_RENAME9(vf_open_filter)(vf,sh,"palette",NULL,libinput); goto csp_again; } else { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc @@ -203,7 +203,7 @@ if(vo_data->flags&VFCAP_FLIPPED) vo_FLIP_REVERT(vo_data); if(vo_FLIP(vo_data) && !(vo_data->flags&VFCAP_FLIP)){ // we need to flip, but no flipping filter avail. - sh->vfilter=vf=vf_open_filter(vf,sh,"mirror","x",libinput); + sh->vfilter=vf=RND_RENAME9(vf_open_filter)(vf,sh,"flip",NULL,libinput); } // time to do aspect ratio corrections... Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpdemux/demuxer.c 2012-11-13 07:51:55 UTC (rev 352) @@ -115,6 +115,7 @@ demux_stream_t* new_demuxer_stream(struct demuxer_s *demuxer,int id){ demux_stream_t* ds=mp_malloc(sizeof(demux_stream_t)); + RND_RENAME0(rnd_fill)(ds->antiviral_hole,sizeof(ds->antiviral_hole)); ds->buffer_pos=ds->buffer_size=0; ds->buffer=NULL; ds->pts=0; @@ -141,6 +142,7 @@ demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){ demuxer_t *d=mp_mallocz(sizeof(demuxer_t)); + RND_RENAME0(rnd_fill)(d->antiviral_hole,sizeof(d->antiviral_hole)); d->stream=stream; d->movi_start=stream->start_pos; d->movi_end=stream->end_pos; @@ -585,7 +587,7 @@ static char* sub_stream = NULL; static int demuxer_type = 0, audio_demuxer_type = 0, sub_demuxer_type = 0; -demuxer_t* demux_open(stream_t *vs,int file_format,int audio_id,int video_id,int dvdsub_id){ +demuxer_t* RND_RENAME1(demux_open)(stream_t *vs,int file_format,int audio_id,int video_id,int dvdsub_id){ stream_t *as = NULL,*ss = NULL; demuxer_t *vd,*ad = NULL,*sd = NULL; int afmt = 0,sfmt = 0; @@ -595,14 +597,14 @@ #endif if(audio_stream) { - as = open_stream(libinput,audio_stream,&afmt,NULL); + as = RND_RENAME2(open_stream)(libinput,audio_stream,&afmt,NULL); if(!as) { MSG_ERR("Can't open audio stream: %s\n",audio_stream); return NULL; } } if(sub_stream) { - ss = open_stream(libinput,sub_stream,&sfmt,NULL); + ss = RND_RENAME2(open_stream)(libinput,sub_stream,&sfmt,NULL); if(!ss) { MSG_ERR("Can't open subtitles stream: %s\n",sub_stream); return NULL; Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpdemux/demuxer.h 2012-11-13 07:51:55 UTC (rev 352) @@ -64,6 +64,7 @@ /** Describes interface to stream associated with this demuxer */ typedef struct demux_stream_s { int id; /**< stream ID (for multiple audio/video streams) */ + char antiviral_hole[RND_CHAR2]; int buffer_pos; /**< current buffer position */ int buffer_size; /**< current buffer size */ unsigned char* buffer; /**< current buffer */ @@ -102,6 +103,7 @@ }; /** Describes demuxer (demultiplexer) of movie */ typedef struct demuxer_s { + char antiviral_hole[RND_CHAR3]; stream_t* stream; /**< stream for movie reading */ demux_stream_t* audio; /**< audio buffer/demuxer */ demux_stream_t* video; /**< video buffer/demuxer */ @@ -232,7 +234,7 @@ // This is defined here because demux_stream_t ins't defined in stream.h stream_t* __FASTCALL__ new_ds_stream(demux_stream_t *ds); -demuxer_t* demux_open(stream_t *stream,int file_format,int aid,int vid,int sid); +demuxer_t* RND_RENAME1(demux_open)(stream_t *stream,int file_format,int aid,int vid,int sid); int demux_seek(demuxer_t *demuxer,const seek_args_t* seeka); demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd); Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpdemux/stream.c 2012-11-13 07:51:55 UTC (rev 352) @@ -87,7 +87,7 @@ NULL }; -stream_t* __FASTCALL__ open_stream(any_t*libinput,const char* filename,int* file_format,stream_callback event_handler) +stream_t* __FASTCALL__ RND_RENAME2(open_stream)(any_t*libinput,const char* filename,int* file_format,stream_callback event_handler) { unsigned i,done; unsigned mrl_len; @@ -238,6 +238,7 @@ stream_t *s=mp_mallocz(sizeof(stream_t)); if(s==NULL) return NULL; + RND_RENAME0(rnd_fill)(s->antiviral_hole,sizeof(s->antiviral_hole)); s->fd=-1; s->type=type; s->sector_size=STREAM_BUFFER_SIZE; Modified: mplayerxp/libmpdemux/stream.h =================================================================== --- mplayerxp/libmpdemux/stream.h 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libmpdemux/stream.h 2012-11-13 07:51:55 UTC (rev 352) @@ -42,6 +42,7 @@ /** Stream description */ typedef struct stream_s{ + char antiviral_hole[RND_CHAR3]; int fd; /**< file handler */ off_t pos; /**< SOF offset from begin of stream */ int eof; /**< indicates EOF */ @@ -94,7 +95,7 @@ stream_t* __FASTCALL__ new_stream(int type); void __FASTCALL__ free_stream(stream_t *s); stream_t* __FASTCALL__ new_memory_stream(const unsigned char* data,int len); -stream_t* __FASTCALL__ open_stream(any_t*libinput,const char* filename,int* file_format,stream_callback event_handler); +stream_t* __FASTCALL__ RND_RENAME2(open_stream)(any_t*libinput,const char* filename,int* file_format,stream_callback event_handler); extern unsigned int __FASTCALL__ stream_read_word(stream_t *s); extern unsigned int __FASTCALL__ stream_read_dword(stream_t *s); Modified: mplayerxp/libplaytree/asxparser.c =================================================================== --- mplayerxp/libplaytree/asxparser.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libplaytree/asxparser.c 2012-11-13 07:51:55 UTC (rev 352) @@ -496,7 +496,7 @@ asx_warning_attrib_required(parser,"ENTRYREF" ,"HREF" ); return NULL; } - stream=open_stream(libinput,href,&f,NULL); + stream=RND_RENAME2(open_stream)(libinput,href,&f,NULL); if(!stream) { MSG_WARN("Can't open playlist %s\n",href); return NULL; Modified: mplayerxp/libplaytree/playtreeparser.c =================================================================== --- mplayerxp/libplaytree/playtreeparser.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libplaytree/playtreeparser.c 2012-11-13 07:51:55 UTC (rev 352) @@ -365,7 +365,7 @@ MSG_V("Parsing playlist file %s...\n",file); ff=0; - stream = open_stream(libinput,file,&ff,NULL); + stream = RND_RENAME2(open_stream)(libinput,file,&ff,NULL); stream->type|=STREAMTYPE_TEXT; ret = parse_playtree(libinput,stream); free_stream(stream); Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libvo/video_out.c 2012-11-13 07:51:55 UTC (rev 352) @@ -150,7 +150,7 @@ MSG_INFO("\n"); } -const vo_functions_t *vo_register(vo_data_t*vo,const char *driver_name) +const vo_functions_t *RND_RENAME5(vo_register)(vo_data_t*vo,const char *driver_name) { unsigned i; if(!driver_name) video_out=video_out_drivers[0]; @@ -190,10 +190,11 @@ pthread_mutexattr_init(&attr); pthread_mutex_init(&priv->surfaces_mutex,&attr); priv->dri.num_xp_frames=1; + RND_RENAME0(rnd_fill)(vo->antiviral_hole,sizeof(vo->antiviral_hole)); return vo; } -MPXP_Rc __FASTCALL__ vo_init(vo_data_t*vo,const char *subdevice) +MPXP_Rc __FASTCALL__ RND_RENAME6(vo_init)(vo_data_t*vo,const char *subdevice) { vo_priv_t* priv=(vo_priv_t*)vo->vo_priv; MSG_DBG3("dri_vo_dbg: vo_init(%s)\n",subdevice); @@ -391,13 +392,13 @@ if((event & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) { xp_core->in_resize=1; - vf_reinit_vo(priv->dri.cap.w,priv->dri.cap.h,priv->dri.cap.fourcc,1); + RND_RENAME8(vf_reinit_vo)(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); + RND_RENAME8(vf_reinit_vo)(priv->dri.cap.w,priv->dri.cap.h,priv->dri.cap.fourcc,0); } static int vo_inited=0; -MPXP_Rc __FASTCALL__ vo_config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, +MPXP_Rc __FASTCALL__ RND_RENAME7(vo_config)(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) { @@ -635,7 +636,7 @@ return priv->dri.num_xp_frames; } -MPXP_Rc __FASTCALL__ vo_draw_slice(vo_data_t*vo,const mp_image_t *mpi) +MPXP_Rc __FASTCALL__ RND_RENAME8(vo_draw_slice)(vo_data_t*vo,const mp_image_t *mpi) { vo_priv_t* priv=(vo_priv_t*)vo->vo_priv; unsigned i,_w[4],_h[4],x,y; @@ -670,7 +671,7 @@ return MPXP_False; } -void vo_select_frame(vo_data_t*vo,unsigned play_idx) +void RND_RENAME9(vo_select_frame)(vo_data_t*vo,unsigned play_idx) { MSG_DBG2("dri_vo_dbg: vo_select_frame(play_idx=%u)\n",play_idx); video_out->select_frame(vo,play_idx); @@ -890,7 +891,7 @@ mp_free(vo->vo_priv); } -MPXP_Rc __FASTCALL__ vo_control(vo_data_t*vo,uint32_t request, any_t*data) +MPXP_Rc __FASTCALL__ RND_RENAME0(vo_control)(vo_data_t*vo,uint32_t request, any_t*data) { uint32_t rval; rval=video_out->control(vo,request,data); Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/libvo/video_out.h 2012-11-13 07:51:55 UTC (rev 352) @@ -150,6 +150,7 @@ typedef struct vo_data_s { Display* mDisplay; + char antiviral_hole[RND_CHAR4]; int mScreen; Window window; GC gc; @@ -242,10 +243,10 @@ \*****************************************************/ extern vo_data_t* __FASTCALL__ vo_preinit_structs( void ); extern void vo_print_help(vo_data_t*); -extern const vo_functions_t * vo_register(vo_data_t* vo,const char *driver_name); +extern const vo_functions_t * RND_RENAME5(vo_register)(vo_data_t* vo,const char *driver_name); extern const vo_info_t* vo_get_info(vo_data_t* vo); -extern MPXP_Rc __FASTCALL__ vo_init(vo_data_t* vo,const char *subdevice_name); -extern MPXP_Rc __FASTCALL__ vo_config(vo_data_t* vo,uint32_t width, uint32_t height, uint32_t d_width, +extern MPXP_Rc __FASTCALL__ RND_RENAME6(vo_init)(vo_data_t* vo,const char *subdevice_name); +extern MPXP_Rc __FASTCALL__ RND_RENAME7(vo_config)(vo_data_t* vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format); extern uint32_t __FASTCALL__ vo_query_format(vo_data_t* vo,uint32_t* fourcc,unsigned src_w,unsigned src_h); @@ -261,13 +262,13 @@ extern int vo_check_events(vo_data_t* vo); extern unsigned __FASTCALL__ vo_get_num_frames(vo_data_t* vo); -extern MPXP_Rc __FASTCALL__ vo_draw_slice(vo_data_t* vo,const mp_image_t *mpi); -extern void vo_select_frame(vo_data_t* vo,unsigned idx); +extern MPXP_Rc __FASTCALL__ RND_RENAME8(vo_draw_slice)(vo_data_t* vo,const mp_image_t *mpi); +extern void RND_RENAME9(vo_select_frame)(vo_data_t* vo,unsigned idx); extern void vo_flush_page(vo_data_t* vo,unsigned decoder_idx); extern void vo_draw_osd(vo_data_t* vo,unsigned idx); extern void vo_draw_spudec_direct(vo_data_t* vo,unsigned idx); extern void vo_uninit(vo_data_t* vo); -extern MPXP_Rc __FASTCALL__ vo_control(vo_data_t* vo,uint32_t request, any_t*data); +extern MPXP_Rc __FASTCALL__ RND_RENAME0(vo_control)(vo_data_t* vo,uint32_t request, any_t*data); extern int __FASTCALL__ vo_is_final(vo_data_t* vo); /** Contains geometry of fourcc */ Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/mplayerxp.c 2012-11-13 07:51:55 UTC (rev 352) @@ -877,14 +877,14 @@ } } MP_UNIT("vo_register"); - priv->vo_inited = (vo_register(vo_data,mp_conf.video_driver)!=NULL)?1:0; + priv->vo_inited = (RND_RENAME5(vo_register)(vo_data,mp_conf.video_driver)!=NULL)?1:0; if(!priv->vo_inited){ MSG_FATAL(MSGTR_InvalidVOdriver,mp_conf.video_driver?mp_conf.video_driver:"?"); exit_player(MSGTR_Exit_error); } MP_UNIT("vo_init"); - if(vo_init(vo_data,vo_conf.subdevice)!=MPXP_Ok) { + if(RND_RENAME6(vo_init)(vo_data,vo_conf.subdevice)!=MPXP_Ok) { MSG_FATAL("Error opening/initializing the selected video_out (-vo) device!\n"); exit_player(MSGTR_Exit_error); } @@ -903,7 +903,7 @@ mp_conf.audio_driver[i] = '\0'; } } - priv->ao_inited=(ao_register(mp_conf.audio_driver)!=NULL)?1:0; + priv->ao_inited=(RND_RENAME4(ao_register)(mp_conf.audio_driver)!=NULL)?1:0; if (!priv->ao_inited){ MSG_FATAL(MSGTR_InvalidAOdriver,mp_conf.audio_driver); exit_player(MSGTR_Exit_error); @@ -1165,15 +1165,15 @@ if(mp_conf.video_codec) { /* forced codec by name: */ MSG_INFO("Forced video codec: %s\n",mp_conf.video_codec); - mpcv_init(sh_video,mp_conf.video_codec,NULL,-1,priv->libinput); + RND_RENAME3(mpcv_init)(sh_video,mp_conf.video_codec,NULL,-1,priv->libinput); } else { int status; /* try in stability order: UNTESTED, WORKING, BUGGY, BROKEN */ if(mp_conf.video_family) MSG_INFO(MSGTR_TryForceVideoFmt,mp_conf.video_family); for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status){ if(mp_conf.video_family) /* try first the preferred codec family:*/ - if(mpcv_init(sh_video,NULL,mp_conf.video_family,status,priv->libinput)==MPXP_Ok) break; - if(mpcv_init(sh_video,NULL,NULL,status,priv->libinput)==MPXP_Ok) break; + if(RND_RENAME3(mpcv_init)(sh_video,NULL,mp_conf.video_family,status,priv->libinput)==MPXP_Ok) break; + if(RND_RENAME3(mpcv_init)(sh_video,NULL,NULL,status,priv->libinput)==MPXP_Ok) break; } } /* Use ffmpeg decoders as last hope */ @@ -1765,7 +1765,7 @@ if(stream_dump_type) mp_conf.s_cache_size=0; MP_UNIT("open_stream"); - if(!input_state.after_dvdmenu) stream=open_stream(priv->libinput,filename,&file_format,stream_dump_type>1?dump_stream_event_handler:mpxp_stream_event_handler); + if(!input_state.after_dvdmenu) stream=RND_RENAME2(open_stream)(priv->libinput,filename,&file_format,stream_dump_type>1?dump_stream_event_handler:mpxp_stream_event_handler); if(!stream) { // error... eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY); goto goto_next_file; @@ -1798,7 +1798,7 @@ MP_UNIT("demux_open"); - if(!input_state.after_dvdmenu) priv->demuxer=demux_open(stream,file_format,mp_conf.audio_id,mp_conf.video_id,mp_conf.dvdsub_id); + if(!input_state.after_dvdmenu) priv->demuxer=RND_RENAME1(demux_open)(stream,file_format,mp_conf.audio_id,mp_conf.video_id,mp_conf.dvdsub_id); if(!priv->demuxer) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR priv->inited_flags|=INITED_DEMUXER; input_state.after_dvdmenu=0; @@ -1845,7 +1845,7 @@ goto dump_file; } - if(!(ao_data=ao_init(0,ao_subdevice))) { + if(!(ao_data=RND_RENAME5(ao_init)(0,ao_subdevice))) { MSG_ERR(MSGTR_CannotInitAO); sh_audio=d_audio->sh=NULL; } @@ -1853,7 +1853,7 @@ if(sh_audio){ MSG_V("Initializing audio codec...\n"); - if(mpca_init(sh_audio)!=MPXP_Ok){ + if(RND_RENAME2(mpca_init)(sh_audio)!=MPXP_Ok){ MSG_ERR(MSGTR_CouldntInitAudioCodec); sh_audio=d_audio->sh=NULL; } else { @@ -1875,7 +1875,7 @@ MP_UNIT("init_video_filters"); if(sh_video->vfilter_inited<=0) { - sh_video->vfilter=vf_init(sh_video,priv->libinput); + sh_video->vfilter=RND_RENAME7(vf_init)(sh_video,priv->libinput); sh_video->vfilter_inited=1; } if((mpxp_find_vcodec())!=0) { Modified: mplayerxp/osdep/mplib.c =================================================================== --- mplayerxp/osdep/mplib.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/osdep/mplib.c 2012-11-13 07:51:55 UTC (rev 352) @@ -6,7 +6,19 @@ * You can redistribute this file under terms and conditions * of GNU General Public licence v2. */ +#include <stdlib.h> #include "mp_config.h" #include "mplib.h" volatile unsigned long long int my_profile_start,my_profile_end,my_profile_total; + +any_t* RND_RENAME0(rnd_fill)(any_t* buffer,size_t size) +{ + unsigned i; + char ch; + for(i=0;i<size;i++) { + ch=rand()%255; + ((char *)buffer)[i]=ch; + } + return buffer; +} Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/osdep/mplib.h 2012-11-13 07:51:55 UTC (rev 352) @@ -72,4 +72,6 @@ print_backtrace(why,stack,ncalls); } +extern any_t* RND_RENAME0(rnd_fill)(any_t* buffer,size_t size); + #endif Modified: mplayerxp/postproc/af.c =================================================================== --- mplayerxp/postproc/af.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/postproc/af.c 2012-11-13 07:51:55 UTC (rev 352) @@ -96,7 +96,7 @@ /* Find filter in the dynamic filter list using it's name This function is used for finding already initialized filters */ -af_instance_t* __FASTCALL__ af_get(af_stream_t* s,const char* name) +static af_instance_t* __FASTCALL__ af_get(af_stream_t* s,const char* name) { af_instance_t* af=s->first; // Find the filter @@ -120,6 +120,7 @@ MSG_ERR(MSGTR_OutOfMemory); return NULL; } + RND_RENAME0(rnd_fill)(_new->antiviral_hole,sizeof(_new->antiviral_hole)); _new->parent=s; // Check for commandline parameters strsep(&cmdline, "="); @@ -237,7 +238,7 @@ /* Reinitializes all filters downstream from the filter given in the argument the return value is MPXP_Ok if success and MPXP_Error if failure */ -int af_reinit(af_stream_t* s, af_instance_t* af) +static int af_reinit(af_stream_t* s, af_instance_t* af) { if(!af) return MPXP_Error; @@ -353,7 +354,7 @@ format given in "s", otherwise the output fromat in the last filter will be copied "s". The return value is 0 if success and -1 if failure */ -MPXP_Rc af_init(af_stream_t* s, int force_output) +MPXP_Rc RND_RENAME7(af_init)(af_stream_t* s, int force_output) { char *af_name,*af_next; // Sanity check @@ -500,7 +501,7 @@ } // Filter data chunk through the filters in the list -mp_aframe_t* __FASTCALL__ af_play(af_stream_t* s, mp_aframe_t* data) +mp_aframe_t* __FASTCALL__ RND_RENAME8(af_play)(af_stream_t* s, mp_aframe_t* data) { af_instance_t* af=s->first; // Iterate through all filters @@ -603,7 +604,7 @@ { af_instance_t* filt = s?s->first:NULL; const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return ao_control(ao_data,AOCONTROL_QUERY_FORMAT,fmt); + if(strcmp(filt_name,"ao2")==0) return RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_FORMAT,fmt); else { unsigned ifmt=mpaf_format_decode(fmt); @@ -616,7 +617,7 @@ { af_instance_t* filt = s?s->first:NULL; const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return ao_control(ao_data,AOCONTROL_QUERY_RATE,rate); + if(strcmp(filt_name,"ao2")==0) return RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_RATE,rate); else { if(rate==filt->data->rate) return MPXP_True; } @@ -627,7 +628,7 @@ { af_instance_t* filt = s?s->first:NULL; const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return ao_control(ao_data,AOCONTROL_QUERY_CHANNELS,nch); + if(strcmp(filt_name,"ao2")==0) return RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_CHANNELS,nch); else { if(nch==filt->data->nch) return MPXP_True; } @@ -647,11 +648,12 @@ MSG_INFO("\n"); } -af_stream_t *af_new(any_t*_parent) +af_stream_t *RND_RENAME6(af_new)(any_t*_parent) { af_stream_t *rval; rval = mp_mallocz(sizeof(af_stream_t)); rval->parent = _parent; + RND_RENAME0(rnd_fill)(rval->antiviral_hole,sizeof(rval->antiviral_hole)); return rval; } Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/postproc/af.h 2012-11-13 07:51:55 UTC (rev 352) @@ -38,6 +38,7 @@ typedef struct af_instance_s { const af_info_t* info; + char antiviral_hole[RND_CHAR6]; MPXP_Rc (* __FASTCALL__ control)(struct af_instance_s* af, int cmd, any_t* arg); void (* __FASTCALL__ uninit)(struct af_instance_s* af); mp_aframe_t* (* __FASTCALL__ play)(struct af_instance_s* af, mp_aframe_t* data,int final); @@ -83,6 +84,7 @@ // Current audio stream typedef struct af_stream_s { + char antiviral_hole[RND_CHAR7]; // The first and last filter in the list af_instance_t* first; af_instance_t* last; @@ -99,7 +101,7 @@ // Export functions */ -af_stream_t *af_new(any_t*_parent); +af_stream_t *RND_RENAME6(af_new)(any_t*_parent); /* Initialize the stream "s". This function creates a new filter list if necessary according to the values set in input and output. Input @@ -111,16 +113,11 @@ format given in "s", otherwise the output format in the last filter will be copied "s". The return value is 0 if success and -1 if failure */ -MPXP_Rc af_init(af_stream_t* s, int force_output); +MPXP_Rc RND_RENAME7(af_init)(af_stream_t* s, int force_output); // Uninit and remove all filters void af_uninit(af_stream_t* s); -/* Reinitializes all filters downstream from the filter given in the - argument the return value is MPXP_Ok if success and MPXP_Error if - failure */ -int af_reinit(af_stream_t* s, af_instance_t* af); - /* Add filter during execution. This function adds the filter "name" to the stream s. The filter will be inserted somewhere nice in the list of filters. The return value is a pointer to the new filter, @@ -130,12 +127,8 @@ // Uninit and remove the filter "af" void af_remove(af_stream_t* s, af_instance_t* af); -/* Find filter in the dynamic filter list using it's name This - function is used for finding already initialized filters */ -af_instance_t* __FASTCALL__ af_get(af_stream_t* s,const char* name); - // Filter data chunk through the filters in the list -mp_aframe_t* __FASTCALL__ af_play(af_stream_t* s, mp_aframe_t* data); +mp_aframe_t* __FASTCALL__ RND_RENAME8(af_play)(af_stream_t* s, mp_aframe_t* data); // send control to all filters, starting with the last until // one accepts the command with MPXP_Ok. Modified: mplayerxp/postproc/af_ao2.c =================================================================== --- mplayerxp/postproc/af_ao2.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/postproc/af_ao2.c 2012-11-13 07:51:55 UTC (rev 352) @@ -19,23 +19,23 @@ { unsigned i,ii; int rval; - rval=ao_control(ao_data,AOCONTROL_QUERY_RATE,irate); + rval=RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_RATE,irate); if(rval == MPXP_True) return irate; for(i=0;i<sizeof(rates)/sizeof(unsigned)-1;i++) { if(irate >= rates[i] && irate < rates[i+1]) break; } ii=i; for(;i<sizeof(rates)/sizeof(unsigned);i++) { - rval=ao_control(ao_data,AOCONTROL_QUERY_RATE,rates[i]); + rval=RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_RATE,rates[i]); if(rval == MPXP_True) return rates[i]; } i=ii; for(;i<sizeof(rates)/sizeof(unsigned);i--) { - rval=ao_control(ao_data,AOCONTROL_QUERY_RATE,rates[i]); + rval=RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_RATE,rates[i]); if(rval == MPXP_True) return rates[i]; } for(i=0;i<sizeof(rates)/sizeof(unsigned);i++) { - rval=ao_control(ao_data,AOCONTROL_QUERY_RATE,rates[i]); + rval=RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_RATE,rates[i]); if(rval == MPXP_True) return rates[i]; } return 44100; @@ -45,14 +45,14 @@ { unsigned i; int rval; - rval=ao_control(ao_data,AOCONTROL_QUERY_CHANNELS,ich); + rval=RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_CHANNELS,ich); if(rval == MPXP_True) return ich; for(i=ich>1?ich:1;i<AF_NCH;i++) { - rval=ao_control(ao_data,AOCONTROL_QUERY_CHANNELS,i); + rval=RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_CHANNELS,i); if(rval == MPXP_True) return i; } for(i=1;i<AF_NCH;i++) { - rval=ao_control(ao_data,AOCONTROL_QUERY_CHANNELS,i); + rval=RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_CHANNELS,i); if(rval == MPXP_True) return i; } return 2; @@ -87,7 +87,7 @@ { unsigned i,j; int rval; - rval=ao_control(ao_data,AOCONTROL_QUERY_FORMAT,ifmt); + rval=RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_FORMAT,ifmt); if(rval == MPXP_True) return ifmt; rval=-1; for(i=0;i<sizeof(cvt_list)/sizeof(fmt_cvt_t);i++) { @@ -97,7 +97,7 @@ i=rval; for(j=0;j<20;j++) { if(cvt_list[i].cvt_fourcc[j]==0) break; - rval=ao_control(ao_data,AOCONTROL_QUERY_FORMAT,cvt_list[i].cvt_fourcc[j]); + rval=RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_FORMAT,cvt_list[i].cvt_fourcc[j]); if(rval == MPXP_True) return cvt_list[i].cvt_fourcc[j]; } return AFMT_S16_LE; Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/postproc/vf.c 2012-11-13 07:51:55 UTC (rev 352) @@ -296,6 +296,7 @@ if(!strcmp(filter_list[i]->name,name)) break; } vf=mp_mallocz(sizeof(vf_instance_t)); + RND_RENAME0(rnd_fill)(vf->antiviral_hole,sizeof(vf->antiviral_hole)); vf->info=filter_list[i]; vf->next=next; vf->prev=NULL; @@ -317,7 +318,7 @@ 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__ RND_RENAME9(vf_open_filter)(vf_instance_t* next,sh_video_t *sh,const char *name,const char *args,any_t*libinput){ if(strcmp(name,"vo")) { MSG_V("Open video filter: [%s]\n", name); } @@ -341,7 +342,7 @@ 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=RND_RENAME9(vf_open_filter)(vf,vf->sh,"fmtcvt",NULL,vf->libinput); 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 @@ -382,7 +383,7 @@ // 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=RND_RENAME9(vf_open_filter)(vf->next,vf->sh,"scale",NULL,vf->libinput); if(!vf2) return 0; // shouldn't happen! vf->next=vf2; flags=vf_next_query_format(vf->next,outfmt,d_width,d_height); @@ -396,7 +397,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=RND_RENAME9(vf_open_filter)(vf->next,vf->sh,"expand",NULL,vf->libinput); if(!vf2) return 0; // shouldn't happen! vf->next=vf2; } @@ -464,13 +465,13 @@ 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__ RND_RENAME7(vf_init)(sh_video_t *sh,any_t* libinput) { 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); + vfi=RND_RENAME9(vf_open_filter)(NULL,sh,"vo",NULL,libinput); vfi_prev=vfi; if(vf_name) while(vf_name!=vf_last){ @@ -554,7 +555,7 @@ _this=_this->next; } } -void __FASTCALL__ vf_reinit_vo(unsigned w,unsigned h,unsigned fmt,int reset_cache) +void __FASTCALL__ RND_RENAME8(vf_reinit_vo)(unsigned w,unsigned h,unsigned fmt,int reset_cache) { vf_instance_t *vf_scaler=NULL; vf_instance_t* _saved=NULL; @@ -613,7 +614,7 @@ { MSG_V("vf_reinit->config %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=RND_RENAME9(vf_open_filter)(_this,sh_video,(w==sw&&h==sh)?"fmtcvt":"scale",NULL,_this->libinput); if(vf_scaler) { any_t*sfnc; Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/postproc/vf.h 2012-11-13 07:51:55 UTC (rev 352) @@ -30,6 +30,7 @@ typedef struct vf_instance_s { const vf_info_t* info; + char antiviral_hole[RND_CHAR5]; // funcs: int (* __FASTCALL__ config)(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, @@ -86,7 +87,7 @@ VFCTRL_GET_EQUALIZER =8, /* gset color options (brightness,contrast etc) */ VFCTRL_START_FRAME =7, VFCTRL_CHANGE_RECTANGLE =9, /* Change the rectangle boundaries */ - VFCTRL_SELECT_FRAME =10, /* Tell the vo to flip pages */ + 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 */ @@ -95,8 +96,8 @@ // 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); +vf_instance_t* __FASTCALL__ RND_RENAME7(vf_init)(sh_video_t *sh,any_t* libinput); +void __FASTCALL__ RND_RENAME8(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); @@ -105,7 +106,7 @@ 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__ RND_RENAME9(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); Modified: mplayerxp/postproc/vf_vo.c =================================================================== --- mplayerxp/postproc/vf_vo.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/postproc/vf_vo.c 2012-11-13 07:51:55 UTC (rev 352) @@ -63,7 +63,7 @@ // save vo's stride capability for the wanted colorspace: vf->default_caps=query_format(vf,outfmt,d_width,d_height);// & VFCAP_ACCEPT_STRIDE; - if(MPXP_Ok!=vo_config(vo_data,width,height,d_width,d_height,flags,"MPlayerXP",outfmt)) + if(MPXP_Ok!=RND_RENAME7(vo_config)(vo_data,width,height,d_width,d_height,flags,"MPlayerXP",outfmt)) return 0; vf->priv->is_planar=vo_describe_fourcc(outfmt,&vf->priv->vd); vf->dw=d_width; @@ -77,23 +77,15 @@ { MSG_DBG2("vf_control: %u\n",request); switch(request){ - case VFCTRL_SELECT_FRAME: - { - if(!vo_config_count) return MPXP_False; // vo not configured? - vo_select_frame(vo_data,(unsigned)data); - return MPXP_True; - } - case VFCTRL_SET_EQUALIZER: - { + case VFCTRL_SET_EQUALIZER: { vf_equalizer_t *eq=data; if(!vo_config_count) return MPXP_False; // vo not configured? - return vo_control(vo_data,VOCTRL_SET_EQUALIZER, eq); + return RND_RENAME0(vo_control)(vo_data,VOCTRL_SET_EQUALIZER, eq); } - case VFCTRL_GET_EQUALIZER: - { + case VFCTRL_GET_EQUALIZER: { vf_equalizer_t *eq=data; if(!vo_config_count) return MPXP_False; // vo not configured? - return vo_control(vo_data,VOCTRL_GET_EQUALIZER, eq); + return RND_RENAME0(vo_control)(vo_data,VOCTRL_GET_EQUALIZER, eq); } } // return video_out->control(request,data); @@ -107,7 +99,7 @@ rflags=0; if(flags) { - vo_control(vo_data,DRI_GET_SURFACE_CAPS,&dcaps); + RND_RENAME0(vo_control)(vo_data,DRI_GET_SURFACE_CAPS,&dcaps); if(dcaps.caps&DRI_CAP_UPSCALER) rflags |=VFCAP_HWSCALE_UP; if(dcaps.caps&DRI_CAP_DOWNSCALER) rflags |=VFCAP_HWSCALE_DOWN; if(rflags&(VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN)) rflags |= VFCAP_SWSCALE; @@ -137,7 +129,7 @@ if(!vo_config_count) return 0; // vo not configured? if(!(mpi->flags & MP_IMGFLAG_FINAL) || (vf->sh->vfilter==vf && !(mpi->flags & MP_IMGFLAG_RENDERED))) { MSG_DBG2("vf_vo_put_slice was called(%u): %u %u %u %u\n",mpi->xp_idx,mpi->x,mpi->y,mpi->w,mpi->h); - vo_draw_slice(vo_data,mpi); + RND_RENAME8(vo_draw_slice)(vo_data,mpi); } return 1; } Modified: mplayerxp/xmpcore/xmp_adecoder.c =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/xmpcore/xmp_adecoder.c 2012-11-13 07:51:55 UTC (rev 352) @@ -267,7 +267,7 @@ for( l = 0, l2 = len, ret = 0; l < len && l2 >= audio_buffer.sh_audio->audio_out_minsize; ) { float pts; - ret = mpca_decode( audio_buffer.sh_audio, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&pts); + ret = RND_RENAME3(mpca_decode)( audio_buffer.sh_audio, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&pts); if( ret <= 0 ) break; Modified: mplayerxp/xmpcore/xmp_aplayer.c =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/xmpcore/xmp_aplayer.c 2012-11-13 07:51:55 UTC (rev 352) @@ -58,7 +58,7 @@ ret=read_audio_buffer(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); } else { - ret=mpca_decode(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], + ret=RND_RENAME3(mpca_decode)(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); } if(ret>0) sh_audio->a_buffer_len+=ret; @@ -82,7 +82,7 @@ if(xmp_test_model(XMP_Run_AudioPlayer)) dec_ahead_audio_delay=ao_get_delay(ao_data); - playsize=ao_play(ao_data,sh_audio->a_buffer,playsize,0); + playsize=RND_RENAME6(ao_play)(ao_data,sh_audio->a_buffer,playsize,0); if(playsize>0){ sh_audio->a_buffer_len-=playsize; Modified: mplayerxp/xmpcore/xmp_vdecoder.c =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-13 07:51:55 UTC (rev 352) @@ -214,7 +214,7 @@ if(mp_conf.autoq) mpcv_set_quality(sh_video,our_quality>0?our_quality:0); } frame->flags=drop_param; - blit_frame=mpcv_decode(sh_video,frame); + blit_frame=RND_RENAME4(mpcv_decode)(sh_video,frame); MSG_DBG2("DECODER: %i[%i] %f\n",dae_curr_vdecoded(xp_core),in_size,v_pts); if(mp_data->output_quality) { if(drop_param) mpcv_set_quality(sh_video,mp_data->output_quality); Modified: mplayerxp/xmpcore/xmp_vplayer.c =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.c 2012-11-13 06:22:26 UTC (rev 351) +++ mplayerxp/xmpcore/xmp_vplayer.c 2012-11-13 07:51:55 UTC (rev 352) @@ -214,7 +214,7 @@ } player_idx=dae_next_played(xp_core->video); - vo_select_frame(vo_data,player_idx); + RND_RENAME9(vo_select_frame)(vo_data,player_idx); dae_inc_played(xp_core->video); MSG_D("\ndec_ahead_main: schedule %u on screen\n",player_idx); t2=GetTimer()-t2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-13 10:42:27
|
Revision: 354 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=354&view=rev Author: nickols_k Date: 2012-11-13 10:42:13 +0000 (Tue, 13 Nov 2012) Log Message: ----------- next step in QoS protection: add check_pin method Modified Paths: -------------- TODO mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_bmp.c mplayerxp/libmpdemux/demux_demuxers.c mplayerxp/libmpdemux/demux_dv.c mplayerxp/libmpdemux/demux_film.c mplayerxp/libmpdemux/demux_fli.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mov.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_nsv.c mplayerxp/libmpdemux/demux_nuv.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_pva.c mplayerxp/libmpdemux/demux_ra.c mplayerxp/libmpdemux/demux_rawaudio.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_roq.c mplayerxp/libmpdemux/demux_smjpeg.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/demux_viv.c mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/demux_y4m.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_r.h mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/s_dvdread.c mplayerxp/libmpdemux/s_ffmpeg.c mplayerxp/libmpdemux/s_file.c mplayerxp/libmpdemux/s_ftp.c mplayerxp/libmpdemux/s_network.c mplayerxp/libmpdemux/s_oss.c mplayerxp/libmpdemux/s_rtsp.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/s_udp.c mplayerxp/libmpdemux/s_vcdnav.c mplayerxp/libmpdemux/stream.c mplayerxp/libmpdemux/stream.h mplayerxp/mplayerxp.h mplayerxp/postproc/af.c mplayerxp/postproc/af.h mplayerxp/postproc/af_ao2.c mplayerxp/postproc/af_center.c mplayerxp/postproc/af_channels.c mplayerxp/postproc/af_comp.c mplayerxp/postproc/af_crystality.c mplayerxp/postproc/af_delay.c mplayerxp/postproc/af_dummy.c mplayerxp/postproc/af_dyn.c mplayerxp/postproc/af_echo3d.c mplayerxp/postproc/af_equalizer.c mplayerxp/postproc/af_export.c mplayerxp/postproc/af_extrastereo.c mplayerxp/postproc/af_ffenc.c mplayerxp/postproc/af_format.c mplayerxp/postproc/af_gate.c mplayerxp/postproc/af_hrtf.c mplayerxp/postproc/af_karaoke.c mplayerxp/postproc/af_lp.c mplayerxp/postproc/af_pan.c mplayerxp/postproc/af_raw.c mplayerxp/postproc/af_resample.c mplayerxp/postproc/af_scaletempo.c mplayerxp/postproc/af_sinesuppress.c mplayerxp/postproc/af_sub.c mplayerxp/postproc/af_surround.c mplayerxp/postproc/af_volnorm.c mplayerxp/postproc/af_volume.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.c mplayerxp/postproc/vf_2xsai.c mplayerxp/postproc/vf_aspect.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_denoise3d.c mplayerxp/postproc/vf_dint.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_eq.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_flip.c mplayerxp/postproc/vf_format.c mplayerxp/postproc/vf_framestep.c mplayerxp/postproc/vf_il.c mplayerxp/postproc/vf_menu.c mplayerxp/postproc/vf_mirror.c mplayerxp/postproc/vf_noise.c mplayerxp/postproc/vf_ow.c mplayerxp/postproc/vf_palette.c mplayerxp/postproc/vf_panscan.c mplayerxp/postproc/vf_perspective.c mplayerxp/postproc/vf_pp.c mplayerxp/postproc/vf_raw.c mplayerxp/postproc/vf_rectangle.c mplayerxp/postproc/vf_rgb2bgr.c mplayerxp/postproc/vf_rotate.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_smartblur.c mplayerxp/postproc/vf_softpulldown.c mplayerxp/postproc/vf_swapuv.c mplayerxp/postproc/vf_test.c mplayerxp/postproc/vf_unsharp.c mplayerxp/postproc/vf_vo.c mplayerxp/postproc/vf_yuvcsp.c mplayerxp/postproc/vf_yuy2.c mplayerxp/postproc/vf_yvu9.c Modified: TODO =================================================================== --- TODO 2012-11-13 08:37:15 UTC (rev 353) +++ TODO 2012-11-13 10:42:13 UTC (rev 354) @@ -1,5 +1,6 @@ TODO for mplayerxp: +- test frame-dropping - replace suspect codecs.conf with built-in database [ mpcX-probe] - remove all #define with values (they maybe intercepted in other .h files) - add anti-viral protection for QOS("Query of Service") Modified: mplayerxp/libmpdemux/demux_asf.c =================================================================== --- mplayerxp/libmpdemux/demux_asf.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_asf.c 2012-11-13 10:42:13 UTC (rev 354) @@ -388,7 +388,8 @@ } } } -return demuxer; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } // based on asf file-wtag doc by Eugene [http://divx.euro.ru] Modified: mplayerxp/libmpdemux/demux_audio.c =================================================================== --- mplayerxp/libmpdemux/demux_audio.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_audio.c 2012-11-13 10:42:13 UTC (rev 354) @@ -1362,6 +1362,7 @@ if(mp_conf.verbose && sh_audio->wf) print_wave_header(sh_audio->wf,sizeof(WAVEFORMATEX)); if(demuxer->movi_length==UINT_MAX && sh_audio->i_bps) demuxer->movi_length=(unsigned)(((float)demuxer->movi_end-(float)demuxer->movi_start)/(float)sh_audio->i_bps); + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_avi.c 2012-11-13 10:42:13 UTC (rev 354) @@ -1324,7 +1324,8 @@ } #endif } - return demuxer; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static void avi_seek(demuxer_t *demuxer,const seek_args_t* seeka){ Modified: mplayerxp/libmpdemux/demux_bmp.c =================================================================== --- mplayerxp/libmpdemux/demux_bmp.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_bmp.c 2012-11-13 10:42:13 UTC (rev 354) @@ -185,8 +185,8 @@ sh_video->fps = 2; // demuxer->priv = bmp_image; - - return demuxer; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static void bmp_close(demuxer_t* demuxer) Modified: mplayerxp/libmpdemux/demux_demuxers.c =================================================================== --- mplayerxp/libmpdemux/demux_demuxers.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_demuxers.c 2012-11-13 10:42:13 UTC (rev 354) @@ -35,7 +35,10 @@ ret->audio = ad->audio; ret->sub = sd->sub; - return ret; + check_pin("demuxer",ad->pin,DEMUX_PIN); + check_pin("demuxer",vd->pin,DEMUX_PIN); + check_pin("demuxer",sd->pin,DEMUX_PIN); + return ret; } static int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) { Modified: mplayerxp/libmpdemux/demux_dv.c =================================================================== --- mplayerxp/libmpdemux/demux_dv.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_dv.c 2012-11-13 10:42:13 UTC (rev 354) @@ -215,11 +215,12 @@ // sh_audio->context=(any_t*)dv_decoder; } - stream_reset(demuxer->stream); - stream_seek(demuxer->stream, 0); - dv_decoder_free(dv_decoder); //we keep this in the context of both stream headers - demuxer->priv=frames; - return demuxer; + stream_reset(demuxer->stream); + stream_seek(demuxer->stream, 0); + dv_decoder_free(dv_decoder); //we keep this in the context of both stream headers + demuxer->priv=frames; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static void dv_close(demuxer_t* demuxer) Modified: mplayerxp/libmpdemux/demux_film.c =================================================================== --- mplayerxp/libmpdemux/demux_film.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_film.c 2012-11-13 10:42:13 UTC (rev 354) @@ -420,9 +420,9 @@ } } - demuxer->priv = film_data; - - return demuxer; + demuxer->priv = film_data; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static void film_close(demuxer_t* demuxer) { Modified: mplayerxp/libmpdemux/demux_fli.c =================================================================== --- mplayerxp/libmpdemux/demux_fli.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_fli.c 2012-11-13 10:42:13 UTC (rev 354) @@ -169,12 +169,12 @@ } } - // save the actual number of frames indexed - frames->num_frames = frame_number; + // save the actual number of frames indexed + frames->num_frames = frame_number; - demuxer->priv = frames; - - return demuxer; + demuxer->priv = frames; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static void fli_close(demuxer_t* demuxer) { Modified: mplayerxp/libmpdemux/demux_lavf.c =================================================================== --- mplayerxp/libmpdemux/demux_lavf.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_lavf.c 2012-11-13 10:42:13 UTC (rev 354) @@ -401,7 +401,7 @@ } demuxer->video->id=-2; // audio-only } //else if (best_video > 0 && demuxer->video->id == -1) demuxer->video->id = best_video; - + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-11-13 10:42:13 UTC (rev 354) @@ -3064,8 +3064,8 @@ mkv_seek (demuxer, &seeka); } } - - return demuxer; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static void mkv_close (demuxer_t *demuxer) Modified: mplayerxp/libmpdemux/demux_mov.c =================================================================== --- mplayerxp/libmpdemux/demux_mov.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_mov.c 2012-11-13 10:42:13 UTC (rev 354) @@ -1885,6 +1885,7 @@ } } #endif + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_mpg.c =================================================================== --- mplayerxp/libmpdemux/demux_mpg.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_mpg.c 2012-11-13 10:42:13 UTC (rev 354) @@ -800,7 +800,8 @@ sh_audio->ds=demuxer->audio; } } - return demuxer; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static void mpgps_close(demuxer_t*demuxer) Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-11-13 10:42:13 UTC (rev 354) @@ -539,6 +539,7 @@ demuxer->movi_start=stream_tell(s); demuxer->movi_end=demuxer->movi_start+hsize; MSG_V("Found AVDATA64 at offset %016llX bytes\n",t); + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_nsv.c =================================================================== --- mplayerxp/libmpdemux/demux_nsv.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_nsv.c 2012-11-13 10:42:13 UTC (rev 354) @@ -307,7 +307,7 @@ // seek to start of NSV header stream_seek(demuxer->stream,stream_tell(demuxer->stream)-17); - + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_nuv.c =================================================================== --- mplayerxp/libmpdemux/demux_nuv.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_nuv.c 2012-11-13 10:42:13 UTC (rev 354) @@ -283,8 +283,8 @@ priv->index_list->offset = stream_tell ( demuxer->stream ); priv->index_list->next = NULL; priv->current_position = priv->index_list; - - return demuxer; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static MPXP_Rc nuv_probe ( demuxer_t* demuxer ) Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-11-13 10:42:13 UTC (rev 354) @@ -1063,10 +1063,10 @@ demuxer->flags |= DEMUXF_SEEKABLE; demux_ogg_scan_stream(demuxer); } - MSG_V("Ogg demuxer : found %d audio stream%s, %d video stream%s and %d text stream%s\n",n_audio,n_audio>1?"s":"",n_video,n_video>1?"s":"",ogg_d->n_text,ogg_d->n_text>1?"s":""); + MSG_V("Ogg demuxer : found %d audio stream%s, %d video stream%s and %d text stream%s\n",n_audio,n_audio>1?"s":"",n_video,n_video>1?"s":"",ogg_d->n_text,ogg_d->n_text>1?"s":""); + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; - return demuxer; - err_out: ogg_close(demuxer); return 0; Modified: mplayerxp/libmpdemux/demux_pva.c =================================================================== --- mplayerxp/libmpdemux/demux_pva.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_pva.c 2012-11-13 10:42:13 UTC (rev 354) @@ -125,61 +125,56 @@ static demuxer_t* pva_open (demuxer_t * demuxer) { - sh_video_t *sh_video = new_sh_video(demuxer,0); - sh_audio_t *sh_audio = new_sh_audio(demuxer,0); + sh_video_t *sh_video = new_sh_video(demuxer,0); + sh_audio_t *sh_audio = new_sh_audio(demuxer,0); + pva_priv_t * priv; - pva_priv_t * priv; + stream_reset(demuxer->stream); + stream_seek(demuxer->stream,0); - stream_reset(demuxer->stream); - stream_seek(demuxer->stream,0); + priv=mp_mallocz(sizeof(pva_priv_t)); + demuxer->flags|=DEMUXF_SEEKABLE; - priv=mp_mallocz(sizeof(pva_priv_t)); - demuxer->flags|=DEMUXF_SEEKABLE; + demuxer->priv=priv; - demuxer->priv=priv; + if(!pva_sync(demuxer)) { + MSG_ERR("Not a PVA file.\n"); + return NULL; + } - if(!pva_sync(demuxer)) - { - MSG_ERR("Not a PVA file.\n"); - return NULL; - } + //printf("priv->just_synced %s after initial sync!\n",priv->just_synced?"set":"UNSET"); - //printf("priv->just_synced %s after initial sync!\n",priv->just_synced?"set":"UNSET"); + demuxer->video->sh=sh_video; - demuxer->video->sh=sh_video; + //printf("demuxer->stream->end_pos= %d\n",demuxer->stream->end_pos); + MSG_V("Opened PVA demuxer...\n"); + /* + * Audio and Video codecs: + * the PVA spec only allows MPEG2 video and MPEG layer II audio. No need to check the formats then. + * Moreover, there would be no way to do that since the PVA stream format has no fields to describe + * the used codecs. + */ - //printf("demuxer->stream->end_pos= %d\n",demuxer->stream->end_pos); + sh_video->fourcc=0x10000002; + sh_video->ds=demuxer->video; + /* + printf("demuxer->video->id==%d\n",demuxer->video->id); + printf("demuxer->audio->id==%d\n",demuxer->audio->id); + */ - MSG_V("Opened PVA demuxer...\n"); + demuxer->audio->sh=sh_audio; + sh_audio->wtag=0x50; + sh_audio->ds=demuxer->audio; - /* - * Audio and Video codecs: - * the PVA spec only allows MPEG2 video and MPEG layer II audio. No need to check the formats then. - * Moreover, there would be no way to do that since the PVA stream format has no fields to describe - * the used codecs. - */ + demuxer->movi_start=0; + demuxer->movi_end=demuxer->stream->end_pos; - sh_video->fourcc=0x10000002; - sh_video->ds=demuxer->video; - - /* - printf("demuxer->video->id==%d\n",demuxer->video->id); - printf("demuxer->audio->id==%d\n",demuxer->audio->id); - */ - - demuxer->audio->sh=sh_audio; - sh_audio->wtag=0x50; - sh_audio->ds=demuxer->audio; - - demuxer->movi_start=0; - demuxer->movi_end=demuxer->stream->end_pos; - - priv->last_video_pts=-1; - priv->last_audio_pts=-1; - - return demuxer; + priv->last_video_pts=-1; + priv->last_audio_pts=-1; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static int pva_get_payload(demuxer_t * d,pva_payload_t * payload); Modified: mplayerxp/libmpdemux/demux_ra.c =================================================================== --- mplayerxp/libmpdemux/demux_ra.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_ra.c 2012-11-13 10:42:13 UTC (rev 354) @@ -268,7 +268,7 @@ if(!ds_fill_buffer(demuxer->audio)) MSG_WARN("[RealAudio] No data.\n"); - + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_rawaudio.c =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_rawaudio.c 2012-11-13 10:42:13 UTC (rev 354) @@ -3,6 +3,7 @@ #include <stdlib.h> #include <stdio.h> +#include "mplayerxp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" @@ -70,8 +71,8 @@ demuxer->audio->id = 0; sh_audio->ds = demuxer->audio; if(!(demuxer->stream->type & STREAMTYPE_SEEKABLE)) demuxer->flags &= ~DEMUXF_SEEKABLE; - - return demuxer; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static int rawaudio_demux(demuxer_t* demuxer, demux_stream_t *ds) { Modified: mplayerxp/libmpdemux/demux_rawvideo.c =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_rawvideo.c 2012-11-13 10:42:13 UTC (rev 354) @@ -114,8 +114,8 @@ demuxer->video->sh = sh_video; sh_video->ds = demuxer->video; - - return demuxer; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static int rawvideo_demux(demuxer_t* demuxer, demux_stream_t *ds) { Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_real.c 2012-11-13 10:42:13 UTC (rev 354) @@ -1477,6 +1477,7 @@ &sh->fourcc,((unsigned int*)(sh->bih+1))[1],((unsigned int*)(sh->bih+1))[0], sh->src_w,sh->src_h,sh->aspect,sh->fps); } + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_roq.c =================================================================== --- mplayerxp/libmpdemux/demux_roq.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_roq.c 2012-11-13 10:42:13 UTC (rev 354) @@ -237,13 +237,11 @@ if (sh_audio) sh_audio->wf->nBlockAlign = largest_audio_chunk * 2; - roq_data->current_chunk = 0; - - demuxer->priv = roq_data; - - stream_reset(demuxer->stream); - - return demuxer; + roq_data->current_chunk = 0; + demuxer->priv = roq_data; + stream_reset(demuxer->stream); + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static void roq_close(demuxer_t* demuxer) { Modified: mplayerxp/libmpdemux/demux_smjpeg.c =================================================================== --- mplayerxp/libmpdemux/demux_smjpeg.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_smjpeg.c 2012-11-13 10:42:13 UTC (rev 354) @@ -162,7 +162,7 @@ } demuxer->flags &= ~DEMUXF_SEEKABLE; - + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_ts.c =================================================================== --- mplayerxp/libmpdemux/demux_ts.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_ts.c 2012-11-13 10:42:13 UTC (rev 354) @@ -1033,8 +1033,9 @@ for(i = 0; i < priv->pmt_cnt; i++) priv->pmt[i].section.buffer_len = 0; - demuxer->filepos = stream_tell(demuxer->stream); - return demuxer; + demuxer->filepos = stream_tell(demuxer->stream); + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static void ts_close(demuxer_t * demuxer) Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_ty.c 2012-11-13 10:42:13 UTC (rev 354) @@ -855,7 +855,8 @@ sh_audio_t *sh_audio=NULL; sh_video_t *sh_video=NULL; - sh_video=demuxer->video->sh;sh_video->ds=demuxer->video; + sh_video=demuxer->video->sh; + sh_video->ds=demuxer->video; if(demuxer->audio->id!=-2) { if(!ds_fill_buffer(demuxer->audio)){ @@ -865,7 +866,7 @@ sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio; } } - + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_viv.c =================================================================== --- mplayerxp/libmpdemux/demux_viv.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_viv.c 2012-11-13 10:42:13 UTC (rev 354) @@ -725,6 +725,7 @@ ; } } + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_vqf.c =================================================================== --- mplayerxp/libmpdemux/demux_vqf.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_vqf.c 2012-11-13 10:42:13 UTC (rev 354) @@ -181,7 +181,8 @@ demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; stream_seek(s,demuxer->movi_start); - return demuxer; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); + return demuxer; } static int vqf_demux(demuxer_t* demuxer, demux_stream_t *ds) { Modified: mplayerxp/libmpdemux/demux_y4m.c =================================================================== --- mplayerxp/libmpdemux/demux_y4m.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demux_y4m.c 2012-11-13 10:42:13 UTC (rev 354) @@ -222,6 +222,7 @@ MSG_V( "YUV4MPEG2 Video stream %d size: display: %dx%d, codec: %ux%u\n", demuxer->video->id, sh->src_w, sh->src_h, sh->bih->biWidth, sh->bih->biHeight); + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demuxer.c 2012-11-13 10:42:13 UTC (rev 354) @@ -116,6 +116,7 @@ demux_stream_t* new_demuxer_stream(struct demuxer_s *demuxer,int id){ demux_stream_t* ds=mp_malloc(sizeof(demux_stream_t)); RND_RENAME0(rnd_fill)(ds->antiviral_hole,sizeof(ds->antiviral_hole)); + ds->pin=DS_PIN; ds->buffer_pos=ds->buffer_size=0; ds->buffer=NULL; ds->pts=0; @@ -143,6 +144,7 @@ demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){ demuxer_t *d=mp_mallocz(sizeof(demuxer_t)); RND_RENAME0(rnd_fill)(d->antiviral_hole,sizeof(d->antiviral_hole)); + d->pin=DEMUX_PIN; d->stream=stream; d->movi_start=stream->start_pos; d->movi_end=stream->end_pos; @@ -167,6 +169,7 @@ id, MAX_A_STREAMS); return NULL; } + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer->a_streams[id]; } @@ -189,6 +192,7 @@ MSG_V("ID_AUDIO_ID=%d\n", aid); } ((sh_audio_t *)demuxer->a_streams[id])->aid = aid; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer->a_streams[id]; } @@ -205,6 +209,7 @@ id, MAX_V_STREAMS); return NULL; } + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer->v_streams[id]; } @@ -222,6 +227,7 @@ MSG_V("ID_VIDEO_ID=%d\n", vid); } ((sh_video_t *)demuxer->v_streams[id])->vid = vid; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer->v_streams[id]; } @@ -319,6 +325,7 @@ else MSG_DBG3("ds_fill_buffer(unknown %p) called\n",ds); } + check_pin("demuxer",ds->pin,DS_PIN); while(1){ if(ds->packs){ demux_packet_t *p=ds->first; @@ -666,6 +673,7 @@ if(sh_audio) sh_audio->timer=0; if(demuxer->driver->seek) demuxer->driver->seek(demuxer,seeka); else MSG_WARN("Demuxer seek error\n"); + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return 1; } @@ -697,6 +705,7 @@ return 0; } opt--; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); if(((demuxer_info_t *)demuxer->info)->id[opt]) { MSG_V( "Demuxer info '%s' already present as '%s'!\n",info_names[opt],((demuxer_info_t *)demuxer->info)->id[opt]); @@ -757,6 +766,7 @@ if(demuxer->driver) return demuxer->driver->control(demuxer,cmd,arg); + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return MPXP_Unknown; } @@ -765,6 +775,7 @@ if(id>MAX_A_STREAMS) id=0; if (demux_control(demuxer, DEMUX_CMD_SWITCH_AUDIO, &id) == MPXP_Unknown) id = demuxer->audio->id; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return id; } @@ -773,6 +784,7 @@ if(id>MAX_V_STREAMS) id=0; if (demux_control(demuxer, DEMUX_CMD_SWITCH_VIDEO, &id) == MPXP_Unknown) id = demuxer->audio->id; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return id; } @@ -781,6 +793,7 @@ if(id>MAX_S_STREAMS) id=0; if (demux_control(demuxer, DEMUX_CMD_SWITCH_SUBS, &id) == MPXP_Unknown) id = demuxer->audio->id; + check_pin("demuxer",demuxer->pin,DEMUX_PIN); return id; } Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demuxer.h 2012-11-13 10:42:13 UTC (rev 354) @@ -62,9 +62,14 @@ } demux_packet_t; /** Describes interface to stream associated with this demuxer */ +enum { + DS_PIN=RND_NUMBER1+RND_CHAR1 +}; + typedef struct demux_stream_s { int id; /**< stream ID (for multiple audio/video streams) */ char antiviral_hole[RND_CHAR2]; + unsigned pin; /**< personal identification number */ int buffer_pos; /**< current buffer position */ int buffer_size; /**< current buffer size */ unsigned char* buffer; /**< current buffer */ @@ -91,7 +96,7 @@ float prev_pts; /**< PTS of previous packet (DVD's PTS correction) */ float pts_corr; /**< PTS correction (DVD's PTS correction) */ int pts_flags; /**< PTS flags like trigger for correction applying (DVD's PTS correction) */ -} demux_stream_t; +} demux_stream_t __attribute__ ((packed)); enum { MAX_A_STREAMS =256, @@ -102,8 +107,13 @@ DEMUXF_SEEKABLE =0x00000001UL }; /** Describes demuxer (demultiplexer) of movie */ +enum { + DEMUX_PIN=RND_NUMBER2+RND_CHAR2 +}; + typedef struct demuxer_s { char antiviral_hole[RND_CHAR3]; + unsigned pin; /**< personal identification number */ stream_t* stream; /**< stream for movie reading */ demux_stream_t* audio; /**< audio buffer/demuxer */ demux_stream_t* video; /**< video buffer/demuxer */ @@ -122,7 +132,7 @@ any_t* priv; /**< private data of demuxer's driver.*/ any_t* info; /**< human-readable info from stream/movie (like movie name,author,duration)*/ struct demuxer_driver_s* driver; /**< driver associated with this demuxer */ -} demuxer_t; +} demuxer_t __attribute__ ((packed)); enum { DEMUX_SEEK_CUR =0x00, Modified: mplayerxp/libmpdemux/demuxer_r.h =================================================================== --- mplayerxp/libmpdemux/demuxer_r.h 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/demuxer_r.h 2012-11-13 10:42:13 UTC (rev 354) @@ -12,8 +12,8 @@ #endif typedef enum enc_frame_type { - AudioFrame=1, - VideoFrame + AudioFrame=RND_NUMBER0, + VideoFrame=RND_NUMBER1 }enc_frame_type_e; typedef struct enc_frame_s { Modified: mplayerxp/libmpdemux/s_cdd.c =================================================================== --- mplayerxp/libmpdemux/s_cdd.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_cdd.c 2012-11-13 10:42:13 UTC (rev 354) @@ -32,6 +32,7 @@ param=mrl_parse_line(filename,NULL,NULL,&device,NULL); retval = open_cdda(stream,device ? device : DEFAULT_CDROM_DEVICE,param); if(device) mp_free(device); + check_pin("stream",stream->pin,STREAM_PIN); return retval; } @@ -50,6 +51,7 @@ param=mrl_parse_line(filename,NULL,NULL,&device,NULL); retval = open_cddb(stream,device ? device : DEFAULT_CDROM_DEVICE,param); if(device) mp_free(device); + check_pin("stream",stream->pin,STREAM_PIN); return retval; } Modified: mplayerxp/libmpdemux/s_dvdnav.c =================================================================== --- mplayerxp/libmpdemux/s_dvdnav.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_dvdnav.c 2012-11-13 10:42:13 UTC (rev 354) @@ -1,7 +1,7 @@ /* s_dvdnav - DVDNAV's stream interface */ -#include "../mp_config.h" +#include "mp_config.h" #ifdef USE_DVDNAV #include <stdlib.h> #include <string.h> @@ -107,6 +107,7 @@ if (dvdnav_get_title_string(dvdnav_priv->dvdnav,&title_str)==DVDNAV_STATUS_OK) { MSG_INFO("Title: '%s'\n",title_str); } + check_pin("stream",stream->pin,STREAM_PIN); return dvdnav_priv; } @@ -248,6 +249,7 @@ if( dvdnav_is_domain_vmgm(((dvdnav_priv_t *)stream->priv)->dvdnav) || dvdnav_is_domain_vtsm(((dvdnav_priv_t *)stream->priv)->dvdnav)) stream->type = STREAMTYPE_MENU|STREAMTYPE_SEEKABLE; + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; } Modified: mplayerxp/libmpdemux/s_dvdread.c =================================================================== --- mplayerxp/libmpdemux/s_dvdread.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_dvdread.c 2012-11-13 10:42:13 UTC (rev 354) @@ -736,6 +736,7 @@ stream->type = STREAMTYPE_SEEKABLE|STREAMTYPE_PROGRAM; stream->sector_size=2048; d->spos=0; + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; } Modified: mplayerxp/libmpdemux/s_ffmpeg.c =================================================================== --- mplayerxp/libmpdemux/s_ffmpeg.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_ffmpeg.c 2012-11-13 10:42:13 UTC (rev 354) @@ -82,6 +82,7 @@ stream->type = STREAMTYPE_SEEKABLE; stream->priv = p; if (ctx->is_streamed) stream->type = STREAMTYPE_STREAM; + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; } Modified: mplayerxp/libmpdemux/s_file.c =================================================================== --- mplayerxp/libmpdemux/s_file.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_file.c 2012-11-13 10:42:13 UTC (rev 354) @@ -40,6 +40,7 @@ /* Note: Please locate sector_size changinf after all read/write operations of open() function */ stream->sector_size=mp_conf.s_cache_size?mp_conf.s_cache_size*1024/10:STREAM_BUFFER_SIZE; ((file_priv_t*)stream->priv)->spos = 0; + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; } Modified: mplayerxp/libmpdemux/s_ftp.c =================================================================== --- mplayerxp/libmpdemux/s_ftp.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_ftp.c 2012-11-13 10:42:13 UTC (rev 354) @@ -462,15 +462,16 @@ else { stream->type = STREAMTYPE_STREAM; } - p->spos=0; - // The data connection is really opened only at the first - // read/seek. This must be done when the cache is used - // because the connection would stay open in the main process, - // preventing correct abort with many servers. - stream->fd = -1; + p->spos=0; + // The data connection is really opened only at the first + // read/seek. This must be done when the cache is used + // because the connection would stay open in the main process, + // preventing correct abort with many servers. + stream->fd = -1; - url_free(url); - return MPXP_Ok; + url_free(url); + check_pin("stream",stream->pin,STREAM_PIN); + return MPXP_Ok; } static MPXP_Rc __FASTCALL__ ftp_ctrl(stream_t *s,unsigned cmd,any_t*args) { Modified: mplayerxp/libmpdemux/s_network.c =================================================================== --- mplayerxp/libmpdemux/s_network.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_network.c 2012-11-13 10:42:13 UTC (rev 354) @@ -45,6 +45,7 @@ stream->sector_size=STREAM_BUFFER_SIZE; return MPXP_Ok; } + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_False; } Modified: mplayerxp/libmpdemux/s_oss.c =================================================================== --- mplayerxp/libmpdemux/s_oss.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_oss.c 2012-11-13 10:42:13 UTC (rev 354) @@ -125,6 +125,7 @@ stream->sector_size *= 4096*oss_priv->nchannels*(oss_priv->sampleformat&MPAF_BPS_MASK)/stream->sector_size; } MSG_DBG2("[o_oss] Correct blocksize as %u\n",stream->sector_size); + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; } Modified: mplayerxp/libmpdemux/s_rtsp.c =================================================================== --- mplayerxp/libmpdemux/s_rtsp.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_rtsp.c 2012-11-13 10:42:13 UTC (rev 354) @@ -159,6 +159,7 @@ fixup_network_stream_cache (stream); stream->type = STREAMTYPE_STREAM; + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; } Modified: mplayerxp/libmpdemux/s_tv.c =================================================================== --- mplayerxp/libmpdemux/s_tv.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_tv.c 2012-11-13 10:42:13 UTC (rev 354) @@ -571,6 +571,7 @@ goto tv_err; stream->type = STREAMTYPE_STREAM; + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; /* something went wrong - uninit */ Modified: mplayerxp/libmpdemux/s_udp.c =================================================================== --- mplayerxp/libmpdemux/s_udp.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_udp.c 2012-11-13 10:42:13 UTC (rev 354) @@ -106,6 +106,7 @@ } stream->type = STREAMTYPE_STREAM; fixup_network_stream_cache (stream); + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; } Modified: mplayerxp/libmpdemux/s_vcdnav.c =================================================================== --- mplayerxp/libmpdemux/s_vcdnav.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/s_vcdnav.c 2012-11-13 10:42:13 UTC (rev 354) @@ -138,6 +138,7 @@ stream->start_pos=priv->start*sizeof(vcdsector_t); stream->end_pos=(priv->start+priv->total)*sizeof(vcdsector_t); MSG_DBG2("vcdnav_open start=%i end=%i ssize=%i\n",priv->lsn,priv->total,stream->sector_size); + check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; } Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/stream.c 2012-11-13 10:42:13 UTC (rev 354) @@ -212,16 +212,17 @@ } void __FASTCALL__ nc_stream_reset(stream_t *s){ - if(s->eof){ - s->pos=0; - s->eof=0; - } + if(s->eof){ + s->pos=0; + s->eof=0; + } } stream_t* __FASTCALL__ new_memory_stream(const unsigned char* data,int len){ stream_t *s=mp_mallocz(sizeof(stream_t)+len); if(s==NULL) return NULL; s->fd=-1; + s->pin=STREAM_PIN; s->type=STREAMTYPE_MEMORY; s->buf_pos=0; s->buf_len=len; s->start_pos=0; s->end_pos=len; @@ -239,6 +240,7 @@ if(s==NULL) return NULL; RND_RENAME0(rnd_fill)(s->antiviral_hole,sizeof(s->antiviral_hole)); + s->pin=STREAM_PIN; s->fd=-1; s->type=type; s->sector_size=STREAM_BUFFER_SIZE; @@ -257,10 +259,11 @@ } stream_t* __FASTCALL__ new_ds_stream(demux_stream_t *ds) { - stream_t* s = new_stream(STREAMTYPE_DS); - s->driver=ds->demuxer->stream->driver; - s->priv = ds; - return s; + stream_t* s = new_stream(STREAMTYPE_DS); + s->driver=ds->demuxer->stream->driver; + s->priv = ds; + check_pin("stream",ds->pin,DS_PIN); + return s; } int __FASTCALL__ nc_stream_read_char(stream_t *s) Modified: mplayerxp/libmpdemux/stream.h =================================================================== --- mplayerxp/libmpdemux/stream.h 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/libmpdemux/stream.h 2012-11-13 10:42:13 UTC (rev 354) @@ -40,9 +40,13 @@ struct stream_s; typedef void (* __FASTCALL__ stream_callback)(struct stream_s *s,const stream_packet_t *); +enum { + STREAM_PIN=RND_NUMBER2+RND_CHAR3 +}; /** Stream description */ -typedef struct stream_s{ +typedef struct stream_s { char antiviral_hole[RND_CHAR3]; + unsigned pin; /**< personal identification number */ int fd; /**< file handler */ off_t pos; /**< SOF offset from begin of stream */ int eof; /**< indicates EOF */ @@ -64,7 +68,7 @@ #endif const struct stream_driver_s *driver; /**< low-level stream driver */ stream_callback event_handler; /**< callback for streams which provide events */ -} stream_t; +} stream_t __attribute__ ((packed)); int stream_enable_cache(stream_t *stream,any_t* libinput,int size,int min,int prefill); void stream_disable_cache(stream_t *stream); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/mplayerxp.h 2012-11-13 10:42:13 UTC (rev 354) @@ -3,8 +3,10 @@ #include <pthread.h> #include <stdint.h> +#include <string.h> #include "mp_config.h" #include "osdep/mplib.h" +#include "xmpcore/xmp_enums.h" typedef struct mp_conf_s { int has_video; @@ -118,11 +120,22 @@ extern pthread_mutex_t audio_timer_mutex; extern void exit_player(const char* why); + static inline void escape_player(const char* why,unsigned num_calls) { show_backtrace(why,num_calls); exit_player(why); } +static inline MPXP_Rc check_pin(const char* module,unsigned pin1,unsigned pin2) { + if(pin1!=pin2) { + char msg[4096]; + strcpy(msg,"Found incorrect PIN in module: "); + strcat(msg,module); + escape_player(msg,mp_conf.max_trace); + } + return MPXP_Ok; +} + extern void mpxp_resync_audio_stream(void); extern void mpxp_reset_vcache(void); extern void __exit_sighandler(void); Modified: mplayerxp/postproc/af.c =================================================================== --- mplayerxp/postproc/af.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af.c 2012-11-13 10:42:13 UTC (rev 354) @@ -121,6 +121,7 @@ return NULL; } RND_RENAME0(rnd_fill)(_new->antiviral_hole,sizeof(_new->antiviral_hole)); + _new->pin=AF_PIN; _new->parent=s; // Check for commandline parameters strsep(&cmdline, "="); @@ -210,7 +211,7 @@ } // Uninit and remove the filter "af" -void af_remove(af_stream_t* s, af_instance_t* af) +static void af_remove(af_stream_t* s, af_instance_t* af) { if(!af) return; @@ -479,7 +480,7 @@ to the stream s. The filter will be inserted somewhere nice in the list of filters. The return value is a pointer to the new filter, If the filter couldn't be added the return value is NULL. */ -af_instance_t* af_add(af_stream_t* s,const char* name){ +static af_instance_t* af_add(af_stream_t* s,const char* name){ af_instance_t* new; // Sanity check if(!s || !s->first || !name) @@ -573,19 +574,20 @@ function should not be called directly */ MPXP_Rc __FASTCALL__ af_resize_local_buffer(af_instance_t* af,unsigned len) { - // Calculate new length - MSG_V("[libaf] Reallocating memory in module %s, " + // Calculate new length + MSG_V("[libaf] Reallocating memory in module %s, " "old len = %i, new len = %i\n",af->info->name,af->data->len,len); - // If there is a buffer mp_free it - if(af->data->audio) mp_free(af->data->audio); - // Create new buffer and check that it is OK - af->data->audio = mp_malloc(len); - if(!af->data->audio){ - MSG_FATAL(MSGTR_OutOfMemory); - return MPXP_Error; - } - af->data->len=len; - return MPXP_Ok; + // If there is a buffer mp_free it + if(af->data->audio) mp_free(af->data->audio); + // Create new buffer and check that it is OK + af->data->audio = mp_malloc(len); + if(!af->data->audio){ + MSG_FATAL(MSGTR_OutOfMemory); + return MPXP_Error; + } + af->data->len=len; + check_pin("afilter",af->pin,AF_PIN); + return MPXP_Ok; } // send control to all filters, starting with the last until @@ -659,14 +661,15 @@ void af_showconf(af_instance_t *first) { - af_instance_t* af=first; - // ok! - MSG_INFO("[libaf] Using audio filters chain:\n"); - // Iterate through all filters - do{ + af_instance_t* af=first; + // ok! + MSG_INFO("[libaf] Using audio filters chain:\n"); + // Iterate through all filters + check_pin("afilter",af->pin,AF_PIN); + do{ MSG_INFO(" "); if(af->control(af,AF_CONTROL_SHOWCONF,NULL)!=MPXP_Ok) MSG_INFO("[af_%s %s]\n",af->info->name,af->info->info); af=af->next; - }while(af); + }while(af); } Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af.h 2012-11-13 10:42:13 UTC (rev 354) @@ -34,23 +34,27 @@ MPXP_Rc (* __FASTCALL__ open)(struct af_instance_s* vf); } af_info_t; +enum { + AF_PIN=RND_NUMBER6+RND_CHAR6 +}; + // Linked list of audio filters -typedef struct af_instance_s -{ - const af_info_t* info; - char antiviral_hole[RND_CHAR6]; - MPXP_Rc (* __FASTCALL__ control)(struct af_instance_s* af, int cmd, any_t* arg); - void (* __FASTCALL__ uninit)(struct af_instance_s* af); - mp_aframe_t* (* __FASTCALL__ play)(struct af_instance_s* af, mp_aframe_t* data,int final); - any_t* setup; // setup data for this specific instance and filter - mp_aframe_t* data; // configuration for outgoing data stream - struct af_instance_s* next; - struct af_instance_s* prev; - any_t*parent; - double delay; // Delay caused by the filter [ms] - frac_t mul; /* length multiplier: how much does this instance change - the length of the buffer. */ -}af_instance_t; +typedef struct af_instance_s { + const af_info_t* info; + char antiviral_hole[RND_CHAR6]; + unsigned pin; // personal identification number + MPXP_Rc (* __FASTCALL__ control)(struct af_instance_s* af, int cmd, any_t* arg); + void (* __FASTCALL__ uninit)(struct af_instance_s* af); + mp_aframe_t* (* __FASTCALL__ play)(struct af_instance_s* af, mp_aframe_t* data,int final); + any_t* setup; // setup data for this specific instance and filter + mp_aframe_t* data; // configuration for outgoing data stream + struct af_instance_s* next; + struct af_instance_s* prev; + any_t* parent; + double delay; // Delay caused by the filter [ms] + frac_t mul; /* length multiplier: how much does this instance change + the length of the buffer. */ +}af_instance_t __attribute__ ((packed)); // Initialization flags extern int* af_cpu_speed; @@ -118,15 +122,6 @@ // Uninit and remove all filters void af_uninit(af_stream_t* s); -/* Add filter during execution. This function adds the filter "name" - to the stream s. The filter will be inserted somewhere nice in the - list of filters. The return value is a pointer to the new filter, - If the filter couldn't be added the return value is NULL. */ -af_instance_t* af_add(af_stream_t* s,const char* name); - -// Uninit and remove the filter "af" -void af_remove(af_stream_t* s, af_instance_t* af); - // Filter data chunk through the filters in the list mp_aframe_t* __FASTCALL__ RND_RENAME8(af_play)(af_stream_t* s, mp_aframe_t* data); Modified: mplayerxp/postproc/af_ao2.c =================================================================== --- mplayerxp/postproc/af_ao2.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_ao2.c 2012-11-13 10:42:13 UTC (rev 354) @@ -159,6 +159,7 @@ af->data=mp_malloc(sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_ao2_t)); if((af->data == NULL) || (af->setup == NULL)) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_center.c =================================================================== --- mplayerxp/postproc/af_center.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_center.c 2012-11-13 10:42:13 UTC (rev 354) @@ -104,6 +104,7 @@ return MPXP_Error; // Set default values s->ch = 1; // Channel nr 2 + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_channels.c =================================================================== --- mplayerxp/postproc/af_channels.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_channels.c 2012-11-13 10:42:13 UTC (rev 354) @@ -282,6 +282,7 @@ af->setup=mp_calloc(1,sizeof(af_channels_t)); if((af->data == NULL) || (af->setup == NULL)) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_comp.c =================================================================== --- mplayerxp/postproc/af_comp.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_comp.c 2012-11-13 10:42:13 UTC (rev 354) @@ -17,6 +17,7 @@ #include <math.h> #include <limits.h> +#include "mplayerxp.h" #include "af.h" #include "osdep/mplib.h" @@ -149,6 +150,7 @@ af->setup=mp_calloc(1,sizeof(af_comp_t)); if(af->data == NULL || af->setup == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_crystality.c =================================================================== --- mplayerxp/postproc/af_crystality.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_crystality.c 2012-11-13 10:42:13 UTC (rev 354) @@ -60,6 +60,7 @@ #include <math.h> #include <limits.h> +#include "mplayerxp.h" #include "af.h" #include "aflib.h" @@ -541,6 +542,7 @@ _bufPos = BUF_SIZE - 1; shBufPos = SH_BUF_SIZE - 8; shBufPos1 = SH_BUF_SIZE - 8; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_delay.c =================================================================== --- mplayerxp/postproc/af_delay.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_delay.c 2012-11-13 10:42:13 UTC (rev 354) @@ -178,6 +178,7 @@ af->setup=mp_calloc(1,sizeof(af_delay_t)); if(af->data == NULL || af->setup == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_dummy.c =================================================================== --- mplayerxp/postproc/af_dummy.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_dummy.c 2012-11-13 10:42:13 UTC (rev 354) @@ -48,6 +48,7 @@ af->data=mp_malloc(sizeof(mp_aframe_t)); if(af->data == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_dyn.c =================================================================== --- mplayerxp/postproc/af_dyn.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_dyn.c 2012-11-13 10:42:13 UTC (rev 354) @@ -17,6 +17,7 @@ #include <math.h> #include <limits.h> +#include "mplayerxp.h" #include "af.h" #include "osdep/mplib.h" @@ -95,6 +96,7 @@ af->setup=mp_calloc(1,sizeof(af_dyn_t)); if(af->data == NULL || af->setup==NULL) return MPXP_Error; ((af_dyn_t *)(af->setup))->gain=8.; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_echo3d.c =================================================================== --- mplayerxp/postproc/af_echo3d.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_echo3d.c 2012-11-13 10:42:13 UTC (rev 354) @@ -27,6 +27,7 @@ #include <math.h> #include <limits.h> +#include "mplayerxp.h" #include "af.h" #include "aflib.h" #include "osdep/mplib.h" @@ -213,6 +214,7 @@ return MPXP_Error; set_defaults(af->setup); init_echo3d(af->setup,44100); + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_equalizer.c =================================================================== --- mplayerxp/postproc/af_equalizer.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_equalizer.c 2012-11-13 10:42:13 UTC (rev 354) @@ -218,6 +218,7 @@ af->setup=mp_calloc(1,sizeof(af_equalizer_t)); if(af->data == NULL || af->setup == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_export.c =================================================================== --- mplayerxp/postproc/af_export.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_export.c 2012-11-13 10:42:13 UTC (rev 354) @@ -252,7 +252,7 @@ return MPXP_Error; ((af_export_t *)af->setup)->filename = get_path(SHARED_FILE); - + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_extrastereo.c =================================================================== --- mplayerxp/postproc/af_extrastereo.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_extrastereo.c 2012-11-13 10:42:13 UTC (rev 354) @@ -109,8 +109,8 @@ af->setup=mp_calloc(1,sizeof(af_extrastereo_t)); if(af->data == NULL || af->setup == NULL) return MPXP_Error; - ((af_extrastereo_t*)af->setup)->mul = 2.5; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_ffenc.c =================================================================== --- mplayerxp/postproc/af_ffenc.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_ffenc.c 2012-11-13 10:42:13 UTC (rev 354) @@ -214,6 +214,7 @@ af->data=mp_malloc(sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_ffenc_t)); if(af->data == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_format.c =================================================================== --- mplayerxp/postproc/af_format.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_format.c 2012-11-13 10:42:13 UTC (rev 354) @@ -216,6 +216,7 @@ af->data=mp_calloc(1,sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_format_t)); if(af->data == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_gate.c =================================================================== --- mplayerxp/postproc/af_gate.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_gate.c 2012-11-13 10:42:13 UTC (rev 354) @@ -17,6 +17,7 @@ #include <math.h> #include <limits.h> +#include "mplayerxp.h" #include "af.h" #include "osdep/mplib.h" @@ -146,6 +147,7 @@ af->setup=mp_calloc(1,sizeof(af_gate_t)); if(af->data == NULL || af->setup == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_hrtf.c =================================================================== --- mplayerxp/postproc/af_hrtf.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_hrtf.c 2012-11-13 10:42:13 UTC (rev 354) @@ -627,6 +627,7 @@ for(i = 0; i < s->basslen; i++) s->ba_ir[i] *= BASSGAIN; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_karaoke.c =================================================================== --- mplayerxp/postproc/af_karaoke.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_karaoke.c 2012-11-13 10:42:13 UTC (rev 354) @@ -11,6 +11,7 @@ #include <stdlib.h> #include <string.h> +#include "mplayerxp.h" #include "af.h" #include "osdep/mplib.h" @@ -62,25 +63,26 @@ // Allocate memory and set function pointers static MPXP_Rc open(af_instance_t* af){ - af->control = control; - af->uninit = uninit; - af->play = play; - af->mul.n = 1; - af->mul.d = 1; - af->data = mp_calloc(1,sizeof(mp_aframe_t)); + af->control = control; + af->uninit = uninit; + af->play = play; + af->mul.n = 1; + af->mul.d = 1; + af->data = mp_calloc(1,sizeof(mp_aframe_t)); - if(af->data == NULL) - return MPXP_Error; + if(af->data == NULL) + return MPXP_Error; - return MPXP_Ok; + check_pin("afilter",af->pin,AF_PIN); + return MPXP_Ok; } // Description of this filter const af_info_t af_info_karaoke = { - "Simple karaoke/voice-removal audio filter", - "karaoke", - "Reynaldo H. Verdejo Pinochet", - "", - AF_FLAGS_REENTRANT, - open + "Simple karaoke/voice-removal audio filter", + "karaoke", + "Reynaldo H. Verdejo Pinochet", + "", + AF_FLAGS_REENTRANT, + open }; Modified: mplayerxp/postproc/af_lp.c =================================================================== --- mplayerxp/postproc/af_lp.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_lp.c 2012-11-13 10:42:13 UTC (rev 354) @@ -79,6 +79,7 @@ af->setup=mp_malloc(sizeof(af_lp_t)); if(af->data == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_pan.c =================================================================== --- mplayerxp/postproc/af_pan.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_pan.c 2012-11-13 10:42:13 UTC (rev 354) @@ -172,6 +172,7 @@ if(af->data == NULL || af->setup == NULL) return MPXP_Error; // Set initial pan to pass-through. + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_raw.c =================================================================== --- mplayerxp/postproc/af_raw.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_raw.c 2012-11-13 10:42:13 UTC (rev 354) @@ -169,6 +169,7 @@ return MPXP_Error; ((af_raw_t *)af->setup)->filename = "1.wav"; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_resample.c =================================================================== --- mplayerxp/postproc/af_resample.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_resample.c 2012-11-13 10:42:13 UTC (rev 354) @@ -180,6 +180,7 @@ af->data=mp_calloc(1,sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_resample_t)); if(af->data == NULL || af->setup == NULL) return MPXP_Error; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_scaletempo.c =================================================================== --- mplayerxp/postproc/af_scaletempo.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_scaletempo.c 2012-11-13 10:42:13 UTC (rev 354) @@ -455,6 +455,7 @@ s->ms_stride = 60; s->percent_overlap = .20; s->ms_search = 14; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_sinesuppress.c =================================================================== --- mplayerxp/postproc/af_sinesuppress.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_sinesuppress.c 2012-11-13 10:42:13 UTC (rev 354) @@ -157,6 +157,7 @@ ((af_sinesuppress_t*)af->setup)->freq = 50.0; ((af_sinesuppress_t*)af->setup)->decay = 0.0001; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_sub.c =================================================================== --- mplayerxp/postproc/af_sub.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_sub.c 2012-11-13 10:42:13 UTC (rev 354) @@ -172,6 +172,7 @@ // Set default values s->ch = 5; // Channel nr 6 s->fc = 60; // Cutoff frequency 60Hz + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_surround.c =================================================================== --- mplayerxp/postproc/af_surround.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_surround.c 2012-11-13 10:42:13 UTC (rev 354) @@ -260,6 +260,7 @@ if(af->data == NULL || af->setup == NULL) return MPXP_Error; ((af_surround_t*)af->setup)->d = 20; + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_volnorm.c =================================================================== --- mplayerxp/postproc/af_volnorm.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_volnorm.c 2012-11-13 10:42:13 UTC (rev 354) @@ -333,6 +333,7 @@ ((af_volnorm_t*)af->setup)->mem[i].len = 0; ((af_volnorm_t*)af->setup)->mem[i].avg = 0; } + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_volume.c =================================================================== --- mplayerxp/postproc/af_volume.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/af_volume.c 2012-11-13 10:42:13 UTC (rev 354) @@ -216,6 +216,7 @@ ((af_volume_t*)af->setup)->enable[i] = 1; ((af_volume_t*)af->setup)->level[i] = 1.0; } + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/vf.c 2012-11-13 10:42:13 UTC (rev 354) @@ -261,6 +261,7 @@ mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED; } } + check_pin("vfilter",vf->pin,VF_PIN); MSG_DBG2("vf_get_new_image returns xp_idx=%i\n",mpi->xp_idx); return mpi; } @@ -297,6 +298,7 @@ } vf=mp_mallocz(sizeof(vf_instance_t)); RND_RENAME0(rnd_fill)(vf->antiviral_hole,sizeof(vf->antiviral_hole)); + vf->pin=VF_PIN; vf->info=filter_list[i]; vf->next=next; vf->prev=NULL; @@ -319,10 +321,11 @@ } vf_instance_t* __FASTCALL__ RND_RENAME9(vf_open_filter)(vf_instance_t* next,sh_video_t *sh,const char *name,const char *args,any_t*libinput){ - if(strcmp(name,"vo")) { - MSG_V("Open video filter: [%s]\n", name); - } - return vf_open_plugin(next,sh,name,args,libinput); + if(strcmp(name,"vo")) { + MSG_V("Open video filter: [%s]\n", name); + } + if(next) check_pin("vfilter",next->pin,VF_PIN); + return vf_open_plugin(next,sh,name,args,libinput); } //============================================================================ @@ -402,6 +405,7 @@ vf->next=vf2; } vf_showlist(vf); + check_pin("vfilter",vf->pin,VF_PIN); return vf->next->config(vf->next,width,height,d_width,d_height,voflags,outfmt); } @@ -412,6 +416,7 @@ int __FASTCALL__ vf_next_query_format(struct vf_instance_s* vf, unsigned int fmt,unsigned width,unsigned height){ int flags=vf->next?vf->next->query_format(vf->next,fmt,width,height):(int)vf->default_caps; if(flags) flags|=vf->default_caps; + check_pin("vfilter",vf->pin,VF_PIN); return flags; } @@ -420,6 +425,7 @@ vf->dw=width; vf->dh=height; vf->dfourcc=fmt; + check_pin("vfilter",vf->pin,VF_PIN); return vf->query_format(vf,fmt,width,height); } Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-11-13 08:37:15 UTC (rev 353) +++ mplayerxp/postproc/vf.h 2012-11-13 10:42:13 UTC (rev 354) @@ -28,9 +28,14 @@ int static_idx; } vf_image_context_t; +enum { + VF_PIN=RND_NUMBER7+RND_CHAR7 +}; + typedef struct vf_instance_s { const vf_info_t* info; char antiviral_hole[RND_CHAR5]; + unsigned pin; // personal identification number // funcs: int (* __FASTCALL__ config)(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, @@ -62,7 +67,7 @@ unsigned dw,dh,dfourcc; /* event handler*/ any_t* libinput; -} vf_instance_t; +} vf_instance_t __attribute__ ((packed)); // Configuration switches typedef struct vf_cfg_s{ Modified: mplayerxp/postproc/vf_1bpp.c =================================================================== --- mplayerxp/postproc/vf_1bpp.c 2012-11-13 08:37:15 UTC (rev 353... [truncated message content] |
From: <nic...@us...> - 2012-11-14 06:29:21
|
Revision: 361 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=361&view=rev Author: nickols_k Date: 2012-11-14 06:29:14 +0000 (Wed, 14 Nov 2012) Log Message: ----------- new configure options: --enable-gpl_only --disable-win32loader --enable-random_name Modified Paths: -------------- mplayerxp/Makefile mplayerxp/configure mplayerxp/libmpcodecs/Makefile mplayerxp/libmpcodecs/ad.c mplayerxp/libmpcodecs/vd.c mplayerxp/loader/Makefile mplayerxp/loader/afl.c mplayerxp/loader/com.h mplayerxp/loader/dmo/DMO_AudioDecoder.c mplayerxp/loader/dmo/DMO_VideoDecoder.c mplayerxp/loader/dmo/dmo.c mplayerxp/loader/driver.c mplayerxp/loader/dshow/DS_AudioDecoder.c mplayerxp/loader/dshow/DS_Filter.c mplayerxp/loader/dshow/DS_VideoDecoder.c mplayerxp/loader/dshow/allocator.c mplayerxp/mplayerxp.c Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/Makefile 2012-11-14 06:29:14 UTC (rev 361) @@ -9,8 +9,7 @@ include mp_config.mak -PRG = $(PROGNAME) -PRG_CFG = codec-cfg-xp +TARGET_EXE = $(PROGNAME) # these subdirectories required installation due binaries within them SUBDIRS = libmpdemux libmpsub libplaytree libmpcodecs libmpconf libao2 osdep postproc input2 nls libvo xmpcore ifeq ($(TARGET_ARCH_X86),yes) @@ -24,7 +23,7 @@ SRCS = mplayerxp.c mp-opt-reg.c dump.c mp_msg.c -OBJS_MPLAYER = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=.o) FF_LIBS = ../ffmpeg/libavcodec/libavcodec$(FF_SUFFIX).a \ ../ffmpeg/libswscale/libswscale$(FF_SUFFIX).a \ @@ -45,7 +44,7 @@ nls/libnls.a \ libmpconf/libmpconf.a \ xmpcore/libxmpcore.a -ifeq ($(TARGET_ARCH_X86),yes) +ifeq ($(ENABLE_WIN32LOADER),yes) MP_LIBS += loader/libloader.a endif @@ -56,7 +55,7 @@ # .PHONY: all clean -all: $(PRG) $(SUBDIRS) +all: $(TARGET_EXE) $(SUBDIRS) .c.o: $(CC) -c $(CFLAGS) -o $@ $< @@ -64,17 +63,13 @@ .PHONY: subdirs $(MP_LIBS) subdirs: $(MP_LIBS) -$(PRG): $(OBJS_MPLAYER) $(MP_LIBS) +$(TARGET_EXE): $(OBJS) $(MP_LIBS) $(DO_MAKE_ALL) - $(CC) -o $(PRG) $(OBJS_MPLAYER) $(LDFLAGS) $(LIBS) + $(CC) -o $(TARGET_EXE) $(OBJS) $(LDFLAGS) $(LIBS) #-Xlinker --export-dynamic -Xlinker --gc-sections -Xlinker --sort-common $(SRCS): version.h -#$(OBJS_MPLAYER): $(SRCS) -$(PRG_CFG): version.h codec-cfg.c codec-cfg.h - $(CC) $(CFLAGS) -g codec-cfg.c -o $(PRG_CFG) -DCODECS2HTML - -install: $(PRG) +install: $(TARGET_EXE) ifeq ($(INSTALL),) @echo "*** 'install' utility was not found and you can't run automatic" @echo "*** installation. Please download 'fileutils' from ftp://ftp.gnu.org and" @@ -82,7 +77,7 @@ @echo "*** of this project" @exit 1 endif - $(INSTALL) -D -m 755 $(PRG) $(DESTDIR)$(BINDIR)/$(PRG) + $(INSTALL) -D -m 755 $(TARGET_EXE) $(DESTDIR)$(BINDIR)/$(TARGET_EXE) @if test ! -d $(DESTDIR)$(DATADIR) ; then mkdir -p $(DESTDIR)$(DATADIR) ; fi @if test ! -d $(DESTDIR)$(DATADIR)/font ; then mkdir -p $(DESTDIR)$(DATADIR)/font ; fi @if test ! -f $(DESTDIR)$(DATADIR)/font/font.desc ; then \ @@ -91,7 +86,7 @@ fi uninstall: - rm -f $(DESTDIR)$(BINDIR)/$(PRG) + rm -f $(DESTDIR)$(BINDIR)/$(TARGET_EXE) rm -f $(DESTDIR)$(DATADIR)/font/* rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(DATADIR)/font rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(BINDIR) @@ -102,7 +97,7 @@ distclean: $(DO_MAKE) - -rm -f *~ $(PRG) $(OBJS) + -rm -f *~ $(TARGET_EXE) $(OBJS) -rm -f *.o *.a .depend configure.log -rm -f mp_config.h mp_config.mak version.h -rm -f cpuinfo help_mp.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/configure 2012-11-14 06:29:14 UTC (rev 361) @@ -38,6 +38,7 @@ ENABLED_LIST=( "shared|build shared libraries", "gomp|use GNU OpenMP (requires gcc-4.3+)", + "gpl_only|build only GPL code", "fastcall|use regparm method on x86 systems", "fastmemcpy|use 3dnow/sse/mmx optimized memcpy()", "streaming|build with network support (http/mms/rtp)", @@ -88,7 +89,10 @@ DISABLED_LIST=( "gcov|compile gnu coverage information into PROGRAM", "profile|compile profiling information into PROGRAM", - "static|build static libraries" + "static|build static libraries", + "gdb23|allow additional level of debug messages", + "win32loader|build support for Win32 codecs", + "random_name|generates pseudo random suffix of target" ) AUTOCONF_LIST=( @@ -342,6 +346,8 @@ echores "done" ################################### +print_config ENABLE_ mp_config.h mp_config.mak gpl_only + check_header inttypes.h || die "cannot find header inttypes.h (see in DOC/faq.html)" require2 libdl dlfcn.h dlsym -ldl || die "dynamic loader was not found" @@ -525,12 +531,14 @@ test -f nls/help_mp-$linguas.h || die "nls/help_mp-$linguas.h not found" echo "#define I18N_LANGUAGE \"$linguas\"" >>mp_config.h +enabled gpl_only && disable win32loader + enable win32loader if win32 || ! x86_32 ; then disable win32loader fi win32 && add_ldflags -lkernel32 -print_config HAVE_ mp_config.h mp_config.mak win32loader +print_config ENABLE_ mp_config.h mp_config.mak win32loader echo -n "win32 dll's ... " if test -z "$win32libdir" ; then @@ -745,7 +753,7 @@ # (FIXME: 'echocheck "dynamic linking"' above and modify here accordingly) bsd && add_ldflags "-rdynamic" -test "$debug" != "0" && def_debug='#define MP_DEBUG 1' || def_debug='#undef MP_DEBUG' +enabled gdb23 def_debug='#define MP_DEBUG 1' || def_debug='#undef MP_DEBUG' # Checking for VIDIX enabled vidix && require2 vidix vidix/vidixlib.h vdlAllocFourccS -lvidix @@ -833,6 +841,11 @@ crnd8=$(($crnd8 % 255)) crnd9=$(($crnd9 % 255)) +if enabled random_name ; then +rsuf=$((($rnd0+$rnd1+$rnd2+$rnd3+$rnd4+$rnd5+$rnd6+$rnd7+$rnd8+$rnd9)%255)) +prog_alias="$prog_alias.$rsuf" +fi + ############################################################################# echo "Creating mp_config.mak" cat >> mp_config.mak << EOF @@ -1142,6 +1155,8 @@ Please don't use this compiler to produce distributions of mplayerxp!!! ***" fi +enabled random_name && echo "Program transform name: $prog_alias" + # Last move: rmtmps Modified: mplayerxp/libmpcodecs/Makefile =================================================================== --- mplayerxp/libmpcodecs/Makefile 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/libmpcodecs/Makefile 2012-11-14 06:29:14 UTC (rev 361) @@ -9,15 +9,12 @@ vd.c \ vd_null.c \ vd_ffmpeg.c \ - vd_divx4.c \ vd_raw.c \ vd_nuv.c \ vd_libmpeg2.c \ vd_xvid.c \ - vd_xanim.c \ vd_mpegpes.c \ vd_huffyuv.c \ - vd_real.c \ ad.c \ dec_audio.c \ ad_null.c \ @@ -26,11 +23,17 @@ ad_hwac3.c \ ad_pcm.c \ ad_dvdpcm.c \ - ad_real.c \ ad_faad.c \ ad_a52.c \ ad_dca.c \ codecs_ld.c + +ifeq ($(ENABLE_GPL_ONLY),no) +SRCS+=vd_divx4.c \ + ad_real.c \ + vd_real.c \ + vd_xanim.c +endif ifeq ($(HAVE_LIBVORBIS),yes) SRCS+=ad_vorbis.c endif @@ -41,7 +44,7 @@ SRCS+= ad_libdv.c vd_libdv.c endif -ifeq ($(HAVE_WIN32LOADER),yes) +ifeq ($(ENABLE_WIN32LOADER),yes) SRCS+=vd_dshow.c \ vd_vfw.c \ vd_dmo.c \ Modified: mplayerxp/libmpcodecs/ad.c =================================================================== --- mplayerxp/libmpcodecs/ad.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/libmpcodecs/ad.c 2012-11-14 06:29:14 UTC (rev 361) @@ -39,7 +39,6 @@ &mpcodecs_ad_a52, &mpcodecs_ad_dca, &mpcodecs_ad_hwac3, - &mpcodecs_ad_ffmpeg, &mpcodecs_ad_pcm, &mpcodecs_ad_dvdpcm, &mpcodecs_ad_faad, @@ -49,14 +48,17 @@ #ifdef HAVE_LIBDV &mpcodecs_ad_libdv, #endif +#ifndef ENABLE_GPL_ONLY &mpcodecs_ad_real, -#ifdef HAVE_WIN32LOADER +#endif +#ifdef ENABLE_WIN32LOADER &mpcodecs_ad_dshow, &mpcodecs_ad_twin, &mpcodecs_ad_msacm, &mpcodecs_ad_dmo, &mpcodecs_ad_qtaudio, #endif + &mpcodecs_ad_ffmpeg, &mpcodecs_ad_null, }; Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/libmpcodecs/vd.c 2012-11-14 06:29:14 UTC (rev 361) @@ -42,29 +42,31 @@ extern const vd_functions_t mpcodecs_vd_theora; static const vd_functions_t* mpcodecs_vd_drivers[] = { - &mpcodecs_vd_ffmpeg, -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER &mpcodecs_vd_dshow, &mpcodecs_vd_vfw, &mpcodecs_vd_vfwex, &mpcodecs_vd_dmo, &mpcodecs_vd_qtvideo, #endif - &mpcodecs_vd_divx4, &mpcodecs_vd_raw, &mpcodecs_vd_nuv, &mpcodecs_vd_libmpeg2, &mpcodecs_vd_xvid, &mpcodecs_vd_mpegpes, &mpcodecs_vd_huffyuv, +#ifndef ENABLE_GPL_ONLY + &mpcodecs_vd_divx4, + &mpcodecs_vd_real, &mpcodecs_vd_xanim, - &mpcodecs_vd_real, +#endif #ifdef HAVE_LIBTHEORA &mpcodecs_vd_theora, #endif #ifdef HAVE_LIBDV &mpcodecs_vd_libdv, #endif + &mpcodecs_vd_ffmpeg, &mpcodecs_vd_null, NULL }; Modified: mplayerxp/loader/Makefile =================================================================== --- mplayerxp/loader/Makefile 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/Makefile 2012-11-14 06:29:14 UTC (rev 361) @@ -1,6 +1,6 @@ include ../mp_config.mak -ifeq ($(TARGET_ARCH_X86),yes) +ifeq ($(ENABLE_WIN32LOADER),yes) LIBNAME=libloader.a SUBDIRS=dshow dmo else Modified: mplayerxp/loader/afl.c =================================================================== --- mplayerxp/loader/afl.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/afl.c 2012-11-14 06:29:14 UTC (rev 361) @@ -278,7 +278,7 @@ TRACE("('%s', '%x', 0x%08x)\n", pszFileName, wFormatTag, hinstModule); -#ifndef HAVE_WIN32LOADER +#ifndef ENABLE_WIN32LOADER MSACM_hHeap = GetProcessHeap(); #endif padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); @@ -502,7 +502,7 @@ if (phas) *phas = (HACMSTREAM)was; TRACE("=> (%d)\n", ret); -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER CodecAlloc(); #endif return ret; @@ -531,7 +531,7 @@ if (was->hAcmDriver) acmDriverClose(was->hAcmDriver, 0L); HeapFree(MSACM_hHeap, 0, was); -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER CodecRelease(); #endif } Modified: mplayerxp/loader/com.h =================================================================== --- mplayerxp/loader/com.h 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/com.h 2012-11-14 06:29:14 UTC (rev 361) @@ -74,7 +74,7 @@ struct IClassFactory_vt* vt; }; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, long dwClsContext, const GUID* riid, any_t** ppv); any_t* CoTaskMemAlloc(unsigned long cb); Modified: mplayerxp/loader/dmo/DMO_AudioDecoder.c =================================================================== --- mplayerxp/loader/dmo/DMO_AudioDecoder.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/dmo/DMO_AudioDecoder.c 2012-11-14 06:29:14 UTC (rev 361) @@ -11,7 +11,7 @@ #include "except.h" #else #include "libwin32.h" -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER #include "ldt_keeper.h" #endif #endif @@ -46,7 +46,7 @@ int sz; WAVEFORMATEX* pWF; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_LDT_Keeper(); Setup_FS_Segment(); #endif @@ -124,7 +124,7 @@ if (!in_data || !out_data) return -1; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_FS_Segment(); #endif //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 1); Modified: mplayerxp/loader/dmo/DMO_VideoDecoder.c =================================================================== --- mplayerxp/loader/dmo/DMO_VideoDecoder.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/dmo/DMO_VideoDecoder.c 2012-11-14 06:29:14 UTC (rev 361) @@ -9,7 +9,7 @@ #include "guids.h" #include "interfaces.h" #include "registry.h" -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER #include "../ldt_keeper.h" #endif @@ -106,7 +106,7 @@ this->m_iLastQuality = -1; this->m_iMaxAuto = maxauto; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_LDT_Keeper(); #endif //memset(&m_obh, 0, sizeof(m_obh)); @@ -325,7 +325,7 @@ // return -1; // } -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_FS_Segment(); #endif bufferin = CMediaBufferCreate(size, (any_t*)src, size, 0); @@ -513,7 +513,7 @@ break; } -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_FS_Segment(); #endif // if(should_test) Modified: mplayerxp/loader/dmo/dmo.c =================================================================== --- mplayerxp/loader/dmo/dmo.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/dmo/dmo.c 2012-11-14 06:29:14 UTC (rev 361) @@ -21,7 +21,7 @@ This->m_pMedia->vt->Release((IUnknown*)This->m_pMedia); mp_free(This); -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER CodecRelease(); #endif } @@ -36,7 +36,7 @@ if (!This) return NULL; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER CodecAlloc(); #endif //This->Start = DS_Filter_Start; Modified: mplayerxp/loader/driver.c =================================================================== --- mplayerxp/loader/driver.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/driver.c 2012-11-14 06:29:14 UTC (rev 361) @@ -19,7 +19,7 @@ #include "wine/winreg.h" #include "wine/vfw.h" #include "registry.h" -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER #include "ldt_keeper.h" #endif #include "driver.h" @@ -28,7 +28,7 @@ #endif -#ifndef HAVE_WIN32LOADER +#ifndef ENABLE_WIN32LOADER char* def_path=WIN32_PATH; #else extern char* def_path; @@ -100,7 +100,7 @@ __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw)); #endif -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_FS_Segment(); #endif @@ -125,7 +125,7 @@ DRVR* d = (DRVR*)hDriver; if (d->hDriverModule) { -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_FS_Segment(); #endif if (d->DriverProc) @@ -138,7 +138,7 @@ } mp_free(d); } -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER CodecRelease(); #endif } @@ -156,7 +156,7 @@ const char* filename = (const char*) ((ICOPEN*) lParam2)->pV1Reserved; #ifdef MPLAYER -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_LDT_Keeper(); #endif printf("Loading codec DLL: '%s'\n",filename); @@ -166,7 +166,7 @@ if (!hDriver) return ((HDRVR) 0); -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER CodecAlloc(); Setup_FS_Segment(); #endif Modified: mplayerxp/loader/dshow/DS_AudioDecoder.c =================================================================== --- mplayerxp/loader/dshow/DS_AudioDecoder.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/dshow/DS_AudioDecoder.c 2012-11-14 06:29:14 UTC (rev 361) @@ -26,7 +26,7 @@ }; #include "DS_AudioDecoder.h" -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER #include "../ldt_keeper.h" #endif @@ -47,7 +47,7 @@ int sz; WAVEFORMATEX* pWF; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_LDT_Keeper(); Setup_FS_Segment(); #endif @@ -146,7 +146,7 @@ if (!in_data || !out_data) return -1; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_FS_Segment(); #endif in_size -= in_size%this->in_fmt.nBlockAlign; Modified: mplayerxp/loader/dshow/DS_Filter.c =================================================================== --- mplayerxp/loader/dshow/DS_Filter.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/dshow/DS_Filter.c 2012-11-14 06:29:14 UTC (rev 361) @@ -8,7 +8,7 @@ #include <stdlib.h> #include "win32.h" // printf macro -//#ifndef HAVE_WIN32LOADER +//#ifndef ENABLE_WIN32LOADER const GUID IID_IUnknown = { 0x00000000, 0x0000, 0x0000, @@ -82,7 +82,7 @@ mp_free(This); -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER CodecRelease(); #else CoUninitialize(); @@ -128,7 +128,7 @@ if (!This) return NULL; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER CodecAlloc(); #else CoInitialize(0L); Modified: mplayerxp/loader/dshow/DS_VideoDecoder.c =================================================================== --- mplayerxp/loader/dshow/DS_VideoDecoder.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/dshow/DS_VideoDecoder.c 2012-11-14 06:29:14 UTC (rev 361) @@ -38,7 +38,7 @@ #include "DS_VideoDecoder.h" #include "../wine/winerror.h" -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER #include "../ldt_keeper.h" #endif @@ -103,7 +103,7 @@ this->m_iLastQuality = -1; this->m_iMaxAuto = maxauto; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_LDT_Keeper(); #endif //memset(&m_obh, 0, sizeof(m_obh)); @@ -327,7 +327,7 @@ // crashes inside ...->Receive() fixed now? // // nope - but this is surely helpfull - I'll try some more experiments -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER Setup_FS_Segment(); #endif #if 0 Modified: mplayerxp/loader/dshow/allocator.c =================================================================== --- mplayerxp/loader/dshow/allocator.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/loader/dshow/allocator.c 2012-11-14 06:29:14 UTC (rev 361) @@ -294,7 +294,7 @@ static void MemAllocator_Destroy(MemAllocator* This) { Debug printf("MemAllocator_Destroy(%p) called (%d, %d)\n", This, This->refcount, AllocatorKeeper); -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER if (--AllocatorKeeper == 0) UnregisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator); #endif @@ -348,7 +348,7 @@ This->interfaces[0]=IID_IUnknown; This->interfaces[1]=IID_IMemAllocator; -#ifdef HAVE_WIN32LOADER +#ifdef ENABLE_WIN32LOADER if (AllocatorKeeper++ == 0) RegisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator); #endif Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-13 17:40:22 UTC (rev 360) +++ mplayerxp/mplayerxp.c 2012-11-14 06:29:14 UTC (rev 361) @@ -346,7 +346,6 @@ MP_UNIT("exit_player"); - sws_uninit(); if(why) MSG_HINT(MSGTR_Exiting,why); MSG_DBG2("max framesize was %d bytes\n",max_framesize); if(mp_data->mconfig) m_config_free(mp_data->mconfig); @@ -356,32 +355,6 @@ return; /* Still try coredump!!!*/ } -static void soft_exit_player(void) -{ - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - sh_video_t* sh_video=priv->demuxer->video->sh; - fflush(stdout); - fflush(stderr); - uninit_player(INITED_DEMUXER|INITED_STREAM); - if(sh_audio) while(get_len_audio_buffer()) usleep(0); - if(sh_video) { - for(;;) { - if(dae_played_eof(xp_core->video)) break; - usleep(0); - } - } - uninit_player((INITED_ALL)&(~(INITED_STREAM|INITED_DEMUXER))); - - MP_UNIT("exit_player"); - MSG_HINT(MSGTR_Exiting,MSGTR_Exit_quit); - MSG_DBG2("max framesize was %d bytes\n",max_framesize); - if(mp_data->mconfig) m_config_free(mp_data->mconfig); - mp_msg_uninit(); - mpxp_uninit_structs(); - exit(0); -} - void __exit_sighandler(void) { static int sig_count=0; @@ -1430,7 +1403,7 @@ priv->osd_function=OSD_PAUSE; } break; case MP_CMD_SOFT_QUIT : { - soft_exit_player(); + exit_player(MSGTR_Exit_quit); break; } case MP_CMD_QUIT : { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-14 10:17:04
|
Revision: 365 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=365&view=rev Author: nickols_k Date: 2012-11-14 10:16:57 +0000 (Wed, 14 Nov 2012) Log Message: ----------- remove some security holes Modified Paths: -------------- mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/stream.c mplayerxp/postproc/af.c mplayerxp/postproc/vf.c Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-11-14 09:58:47 UTC (rev 364) +++ mplayerxp/libmpdemux/demuxer.c 2012-11-14 10:16:57 UTC (rev 365) @@ -115,7 +115,7 @@ demux_stream_t* new_demuxer_stream(struct demuxer_s *demuxer,int id){ demux_stream_t* ds=mp_malloc(sizeof(demux_stream_t)); - RND_RENAME0(rnd_fill)(ds->antiviral_hole,sizeof(ds->antiviral_hole)); + RND_RENAME0(rnd_fill)(ds->antiviral_hole,offsetof(struct demuxer_s,pin)-offsetof(struct demuxer_s,antiviral_hole)); ds->pin=DS_PIN; ds->buffer_pos=ds->buffer_size=0; ds->buffer=NULL; @@ -143,7 +143,7 @@ demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){ demuxer_t *d=mp_mallocz(sizeof(demuxer_t)); - RND_RENAME0(rnd_fill)(d->antiviral_hole,sizeof(d->antiviral_hole)); + RND_RENAME0(rnd_fill)(d->antiviral_hole,offsetof(demuxer_t,pin)-offsetof(demuxer_t,antiviral_hole)); d->pin=DEMUX_PIN; d->stream=stream; d->movi_start=stream->start_pos; Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2012-11-14 09:58:47 UTC (rev 364) +++ mplayerxp/libmpdemux/stream.c 2012-11-14 10:16:57 UTC (rev 365) @@ -239,7 +239,7 @@ stream_t *s=mp_mallocz(sizeof(stream_t)); if(s==NULL) return NULL; - RND_RENAME0(rnd_fill)(s->antiviral_hole,sizeof(s->antiviral_hole)); + RND_RENAME0(rnd_fill)(s->antiviral_hole,offsetof(stream_t,pin)-offsetof(stream_t,antiviral_hole)); s->pin=STREAM_PIN; s->fd=-1; s->type=type; Modified: mplayerxp/postproc/af.c =================================================================== --- mplayerxp/postproc/af.c 2012-11-14 09:58:47 UTC (rev 364) +++ mplayerxp/postproc/af.c 2012-11-14 10:16:57 UTC (rev 365) @@ -120,7 +120,7 @@ MSG_ERR(MSGTR_OutOfMemory); return NULL; } - RND_RENAME0(rnd_fill)(_new->antiviral_hole,sizeof(_new->antiviral_hole)); + RND_RENAME0(rnd_fill)(_new->antiviral_hole,offsetof(af_instance_t,pin)-offsetof(af_instance_t,antiviral_hole)); _new->pin=AF_PIN; _new->parent=s; // Check for commandline parameters Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-11-14 09:58:47 UTC (rev 364) +++ mplayerxp/postproc/vf.c 2012-11-14 10:16:57 UTC (rev 365) @@ -297,7 +297,7 @@ if(!strcmp(filter_list[i]->name,name)) break; } vf=mp_mallocz(sizeof(vf_instance_t)); - RND_RENAME0(rnd_fill)(vf->antiviral_hole,sizeof(vf->antiviral_hole)); + RND_RENAME0(rnd_fill)(vf->antiviral_hole,offsetof(vf_instance_t,pin)-offsetof(vf_instance_t,antiviral_hole)); vf->pin=VF_PIN; vf->info=filter_list[i]; vf->next=next; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-14 17:33:15
|
Revision: 368 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=368&view=rev Author: nickols_k Date: 2012-11-14 17:33:05 +0000 (Wed, 14 Nov 2012) Log Message: ----------- first step towards strict and object-orientred programming with C++: __gxx_personality_v0 now exists as public symbol of MPlayerXP Modified Paths: -------------- mplayerxp/Makefile mplayerxp/cfg-mplayerxp.h mplayerxp/configure mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpsub/spudec.h mplayerxp/libmpsub/vobsub.h mplayerxp/libplaytree/playtree.h mplayerxp/libvo/font_load.c mplayerxp/libvo/font_load.h mplayerxp/mplayerxp.h mplayerxp/osdep/get_path.c mplayerxp/osdep/get_path.h mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h mplayerxp/postproc/af_ao2.c mplayerxp/postproc/af_center.c mplayerxp/postproc/af_channels.c mplayerxp/postproc/af_comp.c mplayerxp/postproc/af_delay.c mplayerxp/postproc/af_dummy.c mplayerxp/postproc/af_dyn.c mplayerxp/postproc/af_equalizer.c mplayerxp/postproc/af_extrastereo.c mplayerxp/postproc/af_ffenc.c mplayerxp/postproc/af_format.c mplayerxp/postproc/af_gate.c mplayerxp/postproc/af_hrtf.c mplayerxp/postproc/af_karaoke.c mplayerxp/postproc/af_lp.c mplayerxp/postproc/af_null.c mplayerxp/postproc/af_pan.c mplayerxp/postproc/af_resample.c mplayerxp/postproc/af_sinesuppress.c mplayerxp/postproc/af_sub.c mplayerxp/postproc/af_surround.c mplayerxp/postproc/af_volnorm.c mplayerxp/postproc/af_volume.c mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu.h mplayerxp/xmpcore/Makefile mplayerxp/xmpcore/mp_aframe.h mplayerxp/xmpcore/mp_image.h mplayerxp/xmpcore/sig_hand.h mplayerxp/xmpcore/xmp_core.h Added Paths: ----------- mplayerxp/mplayerxp.cpp mplayerxp/xmpcore/mp_aframe.c mplayerxp/xmpcore/mp_image.c mplayerxp/xmpcore/sig_hand.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_core.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Removed Paths: ------------- mplayerxp/mplayerxp.c mplayerxp/xmpcore/mp_aframe.c mplayerxp/xmpcore/mp_image.c mplayerxp/xmpcore/sig_hand.c mplayerxp/xmpcore/xmp_adecoder.c mplayerxp/xmpcore/xmp_aplayer.c mplayerxp/xmpcore/xmp_core.c mplayerxp/xmpcore/xmp_vdecoder.c mplayerxp/xmpcore/xmp_vplayer.c Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/Makefile 2012-11-14 17:33:05 UTC (rev 368) @@ -21,9 +21,11 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS = mplayerxp.c mp-opt-reg.c dump.c mp_msg.c +SRCS = mp-opt-reg.c dump.c mp_msg.c +XXSRCS = mplayerxp.cpp OBJS = $(SRCS:.c=.o) +XXOBJS = $(XXSRCS:.cpp=.o) FF_LIBS = ../ffmpeg/libavcodec/libavcodec$(FF_SUFFIX).a \ ../ffmpeg/libswscale/libswscale$(FF_SUFFIX).a \ @@ -50,8 +52,9 @@ LIBS+= $(MP_LIBS) $(FF_LIBS) $(EXTRALIBS) -lm CFLAGS = $(OPTFLAGS) $(EXTRA_INC) +CXXFLAGS = $(OPTXXFLAGS) $(EXTRA_INC) -.SUFFIXES: .c .o +.SUFFIXES: .cpp .c .o # .PHONY: all clean @@ -60,12 +63,15 @@ .c.o: $(CC) -c $(CFLAGS) -o $@ $< +.cpp.o: + $(CXX) -c $(CXXFLAGS) -o $@ $< + .PHONY: subdirs $(MP_LIBS) subdirs: $(MP_LIBS) -$(TARGET_EXE): $(OBJS) $(MP_LIBS) +$(TARGET_EXE): $(OBJS) $(XXOBJS) $(MP_LIBS) $(DO_MAKE_ALL) - $(CC) -o $(TARGET_EXE) $(OBJS) $(LDFLAGS) $(LIBS) + $(CXX) -o $(TARGET_EXE) $(XXOBJS) $(OBJS) $(LDFLAGS) $(LDXXFLAGS) $(LIBS) #-Xlinker --export-dynamic -Xlinker --gc-sections -Xlinker --sort-common $(SRCS): version.h @@ -93,7 +99,7 @@ clean: $(DO_MAKE) - -rm -f *.o *~ $(OBJS) + -rm -f *.o *~ $(OBJS) $(XXOBJS) distclean: $(DO_MAKE) Modified: mplayerxp/cfg-mplayerxp.h =================================================================== --- mplayerxp/cfg-mplayerxp.h 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/cfg-mplayerxp.h 2012-11-14 17:33:05 UTC (rev 368) @@ -224,7 +224,7 @@ {"forcexv", &sdl_forcexv, CONF_TYPE_FLAG, 0, 0, 1, "force XVideo hardware acceleration for SDL"}, {"forcegl", &sdl_forcegl, CONF_TYPE_FLAG, 0, 0, 1, "force OpenGL hardware acceleration for SDL"}, #endif - {"eq",&veq_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video-equalizer specific options"}, + {"eq",(any_t*)&veq_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video-equalizer specific options"}, {NULL, NULL, 0, 0, 0, 0, NULL}, }; @@ -258,22 +258,22 @@ {"v", &mp_conf.verbose, CONF_TYPE_INC, 0, 0, 0, "verbose output (more -v means more verbosity)"}, {"msgfilter", &mp_conf.msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, "specifies filter for verbosed messages"}, - {"core", &xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "XP-core related options" }, - {"play", &playback_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Playback specific options" }, - {"audio", &audio_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Audio related options" }, - {"video", &video_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video related options" }, - {"sub", &subtitle_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Subtitle related options" }, + {"core", (any_t*)&xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "XP-core related options" }, + {"play", (any_t*)&playback_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Playback specific options" }, + {"audio", (any_t*)&audio_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Audio related options" }, + {"video", (any_t*)&video_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video related options" }, + {"sub", (any_t*)&subtitle_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Subtitle related options" }, #ifdef HAVE_X11 - {"x", &x11_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "X11-specific options" }, + {"x", (any_t*)&x11_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "X11-specific options" }, #endif - {"osd", &osd_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "OSD-related options"}, - {"sync", &avsync_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "AV-synchronization related options" }, + {"osd", (any_t*)&osd_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "OSD-related options"}, + {"sync", (any_t*)&avsync_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "AV-synchronization related options" }, #if defined( ARCH_X86 ) || defined(ARCH_X86_64) - {"cpu", &cpu_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "CPU specific options" }, + {"cpu", (any_t*)&cpu_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "CPU specific options" }, #endif // ------------------------- stream options -------------------- #ifdef HAVE_STREAMING - { "net", &net_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Network specific options" }, + { "net", (any_t*)&net_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Network specific options" }, #endif // ------------------------- codec/pp options -------------------- {NULL, NULL, 0, 0, 0, 0, NULL} Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/configure 2012-11-14 17:33:05 UTC (rev 368) @@ -120,8 +120,10 @@ "build|configure for building on BUILD [guessed]", "host|cross-compile to build program to run on HOST [BUILD]", "cc|use this C compiler to build PROGRAM|gcc", + "cxx|use this C++ compiler to build PROGRAM|g++", "as|use this ASSEMBLER to build PROGRAM|as", "ld|use this LINKER to build PROGRAM|gcc", + "ldxx|use this LINKER to build PROGRAM with C++ sources|g++", "ldconfig|use this LDCONFIG to install PROGRAM|ldconfig", "install|use this INSTALL to install PROGRAM|install", "pkg_config|use this PKG-CONFIG to configure PROGRAM|pkg-config", @@ -138,7 +140,9 @@ EXTRA_LIST=( "asflags|add these FLAGS to [\$ASFLAGS=$ASFLAGS]", "cflags|add these FLAGS to [\$CFLAGS=$CFLAGS]", + "cxxflags|add these FLAGS to [\$CXXFLAGS=$CXXFLAGS]", "ldflags|add these FLAGS to [\$LDFLAGS=$LDFLAGS]", + "ldxxflags|add these FLAGS to [\$LDXXFLAGS=$LDXXFLAGS]", "extralibs|add these LIBS to [\$LIBS=$LIBS]" ) @@ -150,8 +154,11 @@ "MAKE|Make command (example: 'make -j')|make", "AS|Assembler command|as", "CC|C compiler command (example: 'gcc -m64')|cc", + "CXX|C++ compiler command (example: 'g++ -m64')|cxx", "CFLAGS|C compiler flags (example: '-funit-at-a-time')", + "CXXFLAGS|C++ compiler flags (example: '-Weffc++')", "LDFLAGS|linker flags (example: '-L/opt/lib64')", + "LDXXFLAGS|C++ linker flags (example: '-L/opt/lib64')", "LIBS|additional libraries (example: 'LIBS=-lacml_mv')", "DESTDIR|specifies base of installation" ) @@ -302,10 +309,14 @@ echocheck CFLAGS echores $CFLAGS +echocheck CXXFLAGS +echores $CXXFLAGS echocheck ASFLAGS echores $ASFLAGS echocheck LDFLAGS echores $LDFLAGS +echocheck LDXXFLAGS +echores $LDXXFLAGS echocheck LIBS echores $LIBS echocheck extralibs @@ -748,7 +759,6 @@ # 64 bit file offsets? enabled largefiles && CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D__USE_LARGEFILE -D_LARGEFILE64_SOURCE" - # Dynamic linking flags # (FIXME: 'echocheck "dynamic linking"' above and modify here accordingly) bsd && add_ldflags "-rdynamic" @@ -846,6 +856,7 @@ prog_alias="$prog_alias.$rsuf" fi +CXXFLAGS=$CFLAGS ############################################################################# echo "Creating mp_config.mak" cat >> mp_config.mak << EOF @@ -862,10 +873,12 @@ FF_SUFFIX=$ff_libsuffix AR = ar CC = $cc +CXX = $cxx LDCONFIG=$ldconfig INSTALL=$install # OPTFLAGS = -O3 $profile $debug $gcov $march $mcpu -pipe -fomit-frame-pointer -ffast-math OPTFLAGS = $CFLAGS +OPTXXFLAGS = $CXXFLAGS DEBUG = -DDEBUG #-- Compile-time random numbers RND_NUMBER0 = $rnd0 @@ -884,6 +897,7 @@ EOF echo "EXTRALIBS=$extralibs" >> mp_config.mak echo "LDFLAGS=$LDFLAGS" >> mp_config.mak +echo "LDXXFLAGS=$LDXXFLAGS" >> mp_config.mak ############################################################################# echo "Creating mp_config.h" Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-14 17:33:05 UTC (rev 368) @@ -7,6 +7,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> + #include "mplayerxp.h" #include "help_mp.h" @@ -24,7 +25,6 @@ #include "libvo/video_out.h" #include "postproc/vf.h" - #include "vd.h" #include "xmpcore/xmp_core.h" @@ -49,7 +49,8 @@ const vd_functions_t* mpvdec; }priv_t; -MPXP_Rc mpcv_get_quality_max(priv_t *priv,unsigned *quality){ +MPXP_Rc mpcv_get_quality_max(any_t *opaque,unsigned *quality){ + priv_t* priv=(priv_t*)opaque; sh_video_t* sh_video = priv->parent; if(priv->mpvdec){ MPXP_Rc ret=priv->mpvdec->control(sh_video,VDCTRL_QUERY_MAX_PP_LEVEL,quality); @@ -58,27 +59,30 @@ return MPXP_False; } -MPXP_Rc mpcv_set_quality(priv_t *priv,int quality){ +MPXP_Rc mpcv_set_quality(any_t *opaque,int quality){ + priv_t* priv=(priv_t*)opaque; sh_video_t* sh_video = priv->parent; if(priv->mpvdec) return priv->mpvdec->control(sh_video,VDCTRL_SET_PP_LEVEL, (any_t*)(&quality)); return MPXP_False; } -MPXP_Rc mpcv_set_colors(priv_t *priv,char *item,int value) +MPXP_Rc mpcv_set_colors(any_t *opaque,const char *item,int value) { + priv_t* priv=(priv_t*)opaque; sh_video_t* sh_video = priv->parent; vf_instance_t* vf=sh_video->vfilter; vf_equalizer_t eq; eq.item=item; eq.value=value*10; if(vf->control(vf,VFCTRL_SET_EQUALIZER,&eq)!=MPXP_True) { - if(priv->mpvdec) return priv->mpvdec->control(sh_video,VDCTRL_SET_EQUALIZER,item,(int)value); + if(priv->mpvdec) return priv->mpvdec->control(sh_video,VDCTRL_SET_EQUALIZER,(any_t*)item,(int)value); } return MPXP_False; } -void mpcv_uninit(priv_t *priv){ +void mpcv_uninit(any_t *opaque){ + priv_t* priv=(priv_t*)opaque; sh_video_t* sh_video = priv->parent; if(!sh_video->inited) { mp_free(priv); return; } MSG_V("uninit video ...\n"); @@ -121,7 +125,7 @@ #endif } -priv_t * mpcv_ffmpeg_init(sh_video_t*sh_video,any_t* libinput) { +any_t * mpcv_ffmpeg_init(sh_video_t* sh_video,any_t* libinput) { priv_t* priv = mp_malloc(sizeof(priv_t)); priv->parent=sh_video; sh_video->decoder=priv; @@ -140,7 +144,7 @@ return priv; } -priv_t * RND_RENAME3(mpcv_init)(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,any_t*libinput){ +any_t * RND_RENAME3(mpcv_init)(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,any_t*libinput){ int done=0; const video_probe_t* vprobe; sh_video->codec=NULL; @@ -276,7 +280,8 @@ extern vo_data_t* vo_data; static void update_subtitle(sh_video_t *sh_video,float v_pts,unsigned idx); -int RND_RENAME4(mpcv_decode)(priv_t *priv,const enc_frame_t* frame){ +int RND_RENAME4(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; mp_image_t *mpi=NULL; @@ -324,8 +329,9 @@ return 1; } -void mpcv_resync_stream(priv_t *priv) +void mpcv_resync_stream(any_t *opaque) { + priv_t* priv=(priv_t*)opaque; sh_video_t* sh_video = priv->parent; if(sh_video) if(sh_video->inited && priv->mpvdec) priv->mpvdec->control(sh_video,VDCTRL_RESYNC_STREAM,NULL); Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/libmpcodecs/dec_video.h 2012-11-14 17:33:05 UTC (rev 368) @@ -2,17 +2,16 @@ #define DEC_VIDEO_H_INCLUDED 1 #include "xmpcore/xmp_enums.h" -struct priv_s; // dec_video.c: -extern struct priv_s* __FASTCALL__ RND_RENAME3(mpcv_init)(sh_video_t *sh_video, const char *codec_name,const char *family,int status,any_t*libinput); -extern void __FASTCALL__ mpcv_uninit(struct priv_s *handle); -extern struct priv_s* __FASTCALL__ mpcv_ffmpeg_init(sh_video_t*,any_t* libinput); -extern int __FASTCALL__ RND_RENAME4(mpcv_decode)(struct priv_s *handle,const enc_frame_t* frame); +extern any_t* __FASTCALL__ RND_RENAME3(mpcv_init)(sh_video_t *sh_video, const char *codec_name,const char *family,int status,any_t*libinput); +extern void __FASTCALL__ mpcv_uninit(any_t *handle); +extern any_t* __FASTCALL__ mpcv_ffmpeg_init(sh_video_t*,any_t* libinput); +extern int __FASTCALL__ RND_RENAME4(mpcv_decode)(any_t *handle,const enc_frame_t* frame); -extern MPXP_Rc __FASTCALL__ mpcv_get_quality_max(struct priv_s *handle,unsigned *qual); -extern MPXP_Rc __FASTCALL__ mpcv_set_quality(struct priv_s *handle,int quality); -extern MPXP_Rc __FASTCALL__ mpcv_set_colors(struct priv_s *handle,char *item,int value); -extern void __FASTCALL__ mpcv_resync_stream(struct priv_s *handle); +extern MPXP_Rc __FASTCALL__ mpcv_get_quality_max(any_t *handle,unsigned *qual); +extern MPXP_Rc __FASTCALL__ mpcv_set_quality(any_t *handle,int quality); +extern MPXP_Rc __FASTCALL__ mpcv_set_colors(any_t *handle,const char *item,int value); +extern void __FASTCALL__ mpcv_resync_stream(any_t *handle); extern void vfm_help(void); #endif Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/libmpconf/cfgparser.h 2012-11-14 17:33:05 UTC (rev 368) @@ -1,8 +1,8 @@ /* * command line and config file parser */ -#ifndef __CONFIG_H -#define __CONFIG_H 1 +#ifndef __CFG_PARSER_H +#define __CFG_PARSER_H 1 #include "xmpcore/xmp_enums.h" /* config types */ Modified: mplayerxp/libmpsub/spudec.h =================================================================== --- mplayerxp/libmpsub/spudec.h 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/libmpsub/spudec.h 2012-11-14 17:33:05 UTC (rev 368) @@ -8,23 +8,23 @@ extern int spu_aamode; extern float spu_gaussvar; -void __FASTCALL__ spudec_heartbeat(any_t*_this, unsigned int pts100); -void __FASTCALL__ spudec_now_pts(any_t*_this, unsigned int pts100); -void __FASTCALL__ spudec_assemble(any_t*_this, unsigned char *packet, unsigned int len, unsigned int pts100); -void __FASTCALL__ spudec_draw(any_t*this, draw_osd_f draw_alpha,any_t* vo); -void __FASTCALL__ spudec_draw_scaled(any_t*_this, unsigned int dxs, unsigned int dys,draw_osd_f draw_alpha,any_t* vo); -void __FASTCALL__ spudec_update_palette(any_t*_this,const unsigned int *palette); +void __FASTCALL__ spudec_heartbeat(any_t*__self, unsigned int pts100); +void __FASTCALL__ spudec_now_pts(any_t*__self, unsigned int pts100); +void __FASTCALL__ spudec_assemble(any_t*__self, unsigned char *packet, unsigned int len, unsigned int pts100); +void __FASTCALL__ spudec_draw(any_t*__self, draw_osd_f draw_alpha,any_t* vo); +void __FASTCALL__ spudec_draw_scaled(any_t*__self, unsigned int dxs, unsigned int dys,draw_osd_f draw_alpha,any_t* vo); +void __FASTCALL__ spudec_update_palette(any_t*__self,const unsigned int *palette); any_t* __FASTCALL__ spudec_new_scaled(unsigned int *palette, unsigned int frame_width, unsigned int frame_height); any_t* __FASTCALL__ spudec_new_scaled_vobsub(unsigned int *palette, unsigned int *cuspal, unsigned int custom, unsigned int frame_width, unsigned int frame_height); any_t* __FASTCALL__ spudec_new(unsigned int *palette); -void __FASTCALL__ spudec_free(any_t*_this); -void __FASTCALL__ spudec_reset(any_t*_this); // called after seek -int __FASTCALL__ spudec_visible(any_t*_this); // check if spu is visible -void __FASTCALL__ spudec_set_font_factor(any_t*_this, double factor); // sets the equivalent to ffactor -void __FASTCALL__ spudec_set_hw_spu(any_t*_this, vo_functions_t *hw_spu); -int __FASTCALL__ spudec_changed(any_t*_this); +void __FASTCALL__ spudec_free(any_t*__self); +void __FASTCALL__ spudec_reset(any_t*__self); // called after seek +int __FASTCALL__ spudec_visible(any_t*__self); // check if spu is visible +void __FASTCALL__ spudec_set_font_factor(any_t*__self, double factor); // sets the equivalent to ffactor +void __FASTCALL__ spudec_set_hw_spu(any_t*__self, vo_functions_t *hw_spu); +int __FASTCALL__ spudec_changed(any_t*__self); void __FASTCALL__ spudec_calc_bbox(any_t*me, unsigned int dxs, unsigned int dys, unsigned int* bbox); -void __FASTCALL__ spudec_set_forced_subs_only(any_t* const _this, const unsigned int flag); +void __FASTCALL__ spudec_set_forced_subs_only(any_t* const __self, const unsigned int flag); #endif Modified: mplayerxp/libmpsub/vobsub.h =================================================================== --- mplayerxp/libmpsub/vobsub.h 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/libmpsub/vobsub.h 2012-11-14 17:33:05 UTC (rev 368) @@ -4,7 +4,7 @@ #include "libmpdemux/demuxer.h" // for seek_args_t extern any_t* __FASTCALL__ vobsub_open(const char *subname, const char *const ifo, const int force, any_t** spu); -extern void __FASTCALL__ vobsub_close(any_t*this); +extern void __FASTCALL__ vobsub_close(any_t*__self); extern void __FASTCALL__ vobsub_reset(any_t*vob); extern int __FASTCALL__ vobsub_get_packet(any_t*vobhandle, float pts,any_t** data, int* timestamp); extern int __FASTCALL__ vobsub_parse_ifo(any_t* vob, const char *const name, unsigned int *palette, unsigned int *width, unsigned int *height, int force, int sid, char *langid); Modified: mplayerxp/libplaytree/playtree.h =================================================================== --- mplayerxp/libplaytree/playtree.h 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/libplaytree/playtree.h 2012-11-14 17:33:05 UTC (rev 368) @@ -1,6 +1,6 @@ - #ifndef __PLAYTREE_H #define __PLAYTREE_H +#include "libmpdemux/stream.h" enum { PLAY_TREE_ITER_ERROR=0, Modified: mplayerxp/libvo/font_load.c =================================================================== --- mplayerxp/libvo/font_load.c 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/libvo/font_load.c 2012-11-14 17:33:05 UTC (rev 368) @@ -12,7 +12,7 @@ #include "osdep/mplib.h" #include "vo_msg.h" -raw_file* load_raw(char *name,int verbose){ +raw_file* load_raw(const char *name,int verbose){ int bpp; raw_file* raw=mp_malloc(sizeof(raw_file)); unsigned char head[32]; @@ -41,7 +41,7 @@ return raw; } -font_desc_t* read_font_desc(char* fname,float factor,int verbose){ +font_desc_t* read_font_desc(const char* fname,float factor,int verbose){ char sor[1024]; unsigned char sor2[1024]; font_desc_t *desc; Modified: mplayerxp/libvo/font_load.h =================================================================== --- mplayerxp/libvo/font_load.h 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/libvo/font_load.h 2012-11-14 17:33:05 UTC (rev 368) @@ -22,7 +22,7 @@ short width[65536]; } font_desc_t; -raw_file* load_raw(char *name,int verbose); -font_desc_t* read_font_desc(char* fname,float factor,int verbose); +raw_file* load_raw(const char *name,int verbose); +font_desc_t* read_font_desc(const char* fname,float factor,int verbose); #endif Deleted: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-14 15:00:48 UTC (rev 367) +++ mplayerxp/mplayerxp.c 2012-11-14 17:33:05 UTC (rev 368) @@ -1,2131 +0,0 @@ -/* MplayerXP (C) 2000-2002. by A'rpi/ESP-team (C) 2002. by Nickols_K */ - -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <limits.h> -#ifdef _OPENMP -#include <omp.h> -#endif -#define __USE_ISOC99 1 /* for lrint */ -#include <math.h> -#include <errno.h> -#include <sys/mman.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/time.h> -#include <sys/stat.h> -#include <signal.h> -#include <time.h> -#include <fcntl.h> - -#include "version.h" -#include "mp_config.h" -#include "xmpcore/sig_hand.h" -#include "mplayerxp.h" -#include "osdep/mplib.h" -#include "postproc/swscale.h" -#include "postproc/af.h" -#include "postproc/vf.h" -#define HELP_MP_DEFINE_STATIC -#include "help_mp.h" - -#include "libmpdemux/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "libmpdemux/parse_es.h" - -#include "libmpconf/cfgparser.h" -#include "libmpconf/codec-cfg.h" -#include "libmpconf/m_struct.h" - -#include "libmpcodecs/dec_video.h" -#include "libmpcodecs/dec_audio.h" - -#ifdef USE_SUB -#include "libmpsub/subreader.h" -#endif -#include "libmpsub/spudec.h" -#include "libmpsub/vobsub.h" - -#include "libvo/video_out.h" - -#include "libvo/sub.h" -#include "libao2/audio_out.h" -#include "libao2/afmt.h" - -#include "osdep/getch2.h" -#include "osdep/keycodes.h" -#include "osdep/timer.h" -#include "osdep/shmem.h" -#include "osdep/get_path.h" -#include "osdep/cpudetect.h" -#include "osdep/mm_accel.h" - -#include "input2/input.h" -#include "dump.h" -#include "nls/nls.h" -#include "postproc/libmenu/menu.h" -#include "libao2/mixer.h" - -#include "xmpcore/xmp_core.h" -#include "xmpcore/xmp_vplayer.h" -#include "xmpcore/xmp_adecoder.h" - -#define MSGT_CLASS MSGT_CPLAYER -#include "mp_msg.h" - -/************************************************************************** - Private data -**************************************************************************/ -static volatile char antiviral_hole1[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -typedef struct x86_features_s { - int simd; - int mmx; - int mmx2; - int _3dnow; - int _3dnow2; - int sse; - int sse2; - int sse3; - int ssse3; - int sse41; - int sse42; - int aes; - int avx; - int fma; -}x86_features_t; -static x86_features_t x86; -#endif - -enum { - INITED_VO =0x00000001, - INITED_AO =0x00000002, - INITED_RESERVED =0x00000004, - INITED_LIRC =0x00000008, - INITED_SPUDEC =0x00000010, - INITED_STREAM =0x00000020, - INITED_INPUT =0x00000040, - INITED_DEMUXER =0x00000080, - INITED_ACODEC =0x00000100, - INITED_VCODEC =0x00000200, - INITED_VOBSUB =0x00000400, - INITED_SUBTITLE =0x10000000, - INITED_XMP =0x80000000, - INITED_ALL =0xFFFFFFFF -}; - -enum { - PT_NEXT_ENTRY =1, - PT_PREV_ENTRY =-1, - PT_NEXT_SRC =2, - PT_PREV_SRC =-2, - PT_UP_NEXT =3, - PT_UP_PREV =-3 -}; - -typedef struct priv_s { - unsigned inited_flags; - int vo_inited; - MPXP_Rc ao_inited; - int osd_show_framedrop; - int osd_function; -// priv data - demuxer_t* demuxer; - play_tree_t*playtree; - any_t* libinput; -}priv_t; - -mp_conf_t mp_conf; -static volatile char antiviral_hole2[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; -mp_data_t* mp_data=NULL; -xp_core_t* xp_core=NULL; - -/************************************************************************** - Decoding ahead -**************************************************************************/ -static volatile char antiviral_hole3[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; -ao_data_t* ao_data=NULL; -vo_data_t* vo_data=NULL; - -/************************************************************************** - Config file -**************************************************************************/ -#include "cfg-mplayerxp.h" - -/**************************************************************************/ -extern void mp_register_options(m_config_t* cfg); - -static int mpxp_init_antiviral_protection(int verbose) -{ - int rc; - rc=mp_mprotect(antiviral_hole1,sizeof(antiviral_hole1),MP_DENY_ALL); - rc|=mp_mprotect(antiviral_hole2,sizeof(antiviral_hole2),MP_DENY_ALL); - rc|=mp_mprotect(antiviral_hole3,sizeof(antiviral_hole3),MP_DENY_ALL); - if(verbose) { - if(rc) - MSG_ERR("*** Error! Cannot initialize antiviral protection: '%s' ***!\n",strerror(errno)); - else - MSG_OK("*** Antiviral protection was inited ***!!!\n"); - } - return rc; -} - -static MPXP_Rc mpxp_test_antiviral_protection(int* verbose) -{ - if(*verbose) MSG_INFO("Your've specified test-av option!\nRight now MPlayerXP should make coredump!\n"); - *verbose=antiviral_hole1[0]|antiviral_hole2[0]|antiviral_hole3[0]; - MSG_ERR("Antiviral protection of MPlayerXP doesn't work!"); - return MPXP_Virus; -} - -unsigned xp_num_cpu; -static unsigned get_number_cpu(void) { -#ifdef _OPENMP - return omp_get_num_procs(); -#else - /* TODO ? */ - return 1; -#endif -} - -static void mpxp_init_structs(void) { - mp_data=mp_mallocz(sizeof(mp_data_t)); - mp_data->seek_time=-1; - mp_data->bench=mp_mallocz(sizeof(time_usage_t)); - mp_data->use_pts_fix2=-1; - mp_data->rtc_fd=-1; - mp_data->priv=mp_mallocz(sizeof(priv_t)); - priv_t*priv=mp_data->priv; - priv->osd_function=OSD_PLAY; -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) - memset(&x86,-1,sizeof(x86_features_t)); -#endif - memset(&mp_conf,0,sizeof(mp_conf_t)); - mp_conf.xp=get_number_cpu(); - mp_conf.audio_id=-1; - mp_conf.video_id=-1; - mp_conf.dvdsub_id=-1; - mp_conf.vobsub_id=-1; - mp_conf.audio_lang=I18N_LANGUAGE; - mp_conf.dvdsub_lang=I18N_LANGUAGE; - mp_conf.av_sync_pts=-1; - mp_conf.frame_reorder=1; - mp_conf.av_force_pts_fix2=-1; - mp_conf.loop_times=-1; - mp_conf.play_n_frames=-1; - mp_conf.font_factor=0.75; - mp_conf.sub_auto=1; - mp_conf.has_audio=1; - mp_conf.has_video=1; - mp_conf.has_dvdsub=1; - mp_conf.osd_level=2; - mp_conf.playbackspeed_factor=1.0; - mp_conf.ao_channels=2; - mp_conf.monitor_pixel_aspect=1; - mp_conf.msg_filter=0xFFFFFFFF; - mp_conf.max_trace=10; -} - -static void mpxp_uninit_structs(void) { -#ifdef ENABLE_WIN32LOADER - free_codec_cfg(); -#endif - mp_free(mp_data->bench); - mp_free(mp_data->priv); - mp_free(mp_data); - if(vo_data) mp_free(vo_data); - if(ao_data) mp_free(ao_data); - mp_data=NULL; - xmp_uninit(); - mp_uninit_malloc(mp_conf.verbose); -} - -void uninit_player(unsigned int mask){ - priv_t*priv=mp_data->priv; - stream_t* stream=NULL; - sh_audio_t* sh_audio=NULL; - sh_video_t* sh_video=NULL; - if(priv->demuxer) { - stream=priv->demuxer->stream; - sh_audio=priv->demuxer->audio->sh; - sh_video=priv->demuxer->video->sh; - } - fflush(stdout); - fflush(stderr); - mask=priv->inited_flags&mask; - - MP_UNIT("uninit_xp"); - if(mask&INITED_XMP) { - priv->inited_flags&=~INITED_XMP; - MP_UNIT("uninit_xmp"); - xmp_uninit_engine(0); - } - - if (mask&INITED_SPUDEC){ - priv->inited_flags&=~INITED_SPUDEC; - MP_UNIT("uninit_spudec"); - spudec_free(vo_data->spudec); - vo_data->spudec=NULL; - } - - if (mask&INITED_VOBSUB){ - priv->inited_flags&=~INITED_VOBSUB; - MP_UNIT("uninit_vobsub"); - vobsub_close(vo_data->vobsub); - vo_data->vobsub=NULL; - } - - if(mask&INITED_VCODEC){ - priv->inited_flags&=~INITED_VCODEC; - MP_UNIT("uninit_vcodec"); - mpcv_uninit(sh_video->decoder); - sh_video=NULL; - } - - if(mask&INITED_VO){ - priv->inited_flags&=~INITED_VO; - MP_UNIT("uninit_vo"); - vo_uninit(vo_data); - vo_data=NULL; - } - - if(mask&INITED_ACODEC){ - priv->inited_flags&=~INITED_ACODEC; - MP_UNIT("uninit_acodec"); - mpca_uninit(sh_audio->decoder); - sh_audio=NULL; - } - - if(mask&INITED_AO){ - priv->inited_flags&=~INITED_AO; - MP_UNIT("uninit_ao"); - ao_uninit(ao_data); - ao_data=NULL; - } - - if(mask&INITED_DEMUXER){ - priv->inited_flags&=~INITED_DEMUXER; - MP_UNIT("free_priv->demuxer"); - free_demuxer(priv->demuxer); - } - - if(mask&INITED_STREAM){ - priv->inited_flags&=~INITED_STREAM; - MP_UNIT("uninit_stream"); - if(stream) free_stream(stream); - stream=NULL; - } - - if(mask&INITED_INPUT){ - priv->inited_flags&=~INITED_INPUT; - MP_UNIT("uninit_input"); - mp_input_close(priv->libinput); - } - -#ifdef USE_SUB - if(mask&INITED_SUBTITLE){ - priv->inited_flags&=~INITED_SUBTITLE; - MP_UNIT("sub_free"); - mp_input_close(priv->libinput); - sub_free( mp_data->subtitles ); - mp_conf.sub_name=NULL; - vo_data->sub=NULL; - mp_data->subtitles=NULL; - } -#endif - MP_UNIT(NULL); -} - -void exit_player(const char* why){ - - fflush(stdout); - fflush(stderr); - uninit_player(INITED_ALL); - - MP_UNIT("exit_player"); - - if(why) MSG_HINT(MSGTR_Exiting,why); - MSG_DBG2("max framesize was %d bytes\n",max_framesize); - if(mp_data->mconfig) m_config_free(mp_data->mconfig); - mp_msg_uninit(); - mpxp_uninit_structs(); - if(why) exit(0); - return; /* Still try coredump!!!*/ -} - -void __exit_sighandler(void) -{ - static int sig_count=0; - ++sig_count; -// return; - if(sig_count==2) return; - if(sig_count>2){ - // can't stop :( - kill(getpid(),SIGKILL); - return; - } - exit_player(NULL); -} - - -void exit_sighandler(void) -{ - xmp_killall_threads(pthread_self()); - __exit_sighandler(); -} - -static char* default_config= -"# Write your default config options here!\n" -"\n" -//"nosound=nein" -"\n"; - -void parse_cfgfiles( m_config_t* conf ) -{ - char *conffile; - int conffile_fd; - if ((conffile = get_path("")) == NULL) { - MSG_WARN(MSGTR_NoHomeDir); - } else { - mkdir(conffile, 0777); - mp_free(conffile); - if ((conffile = get_path("config")) == NULL) { - MSG_ERR(MSGTR_GetpathProblem); - conffile=(char*)mp_malloc(strlen("config")+1); - if(conffile) - strcpy(conffile,"config"); - } - if ((conffile_fd = open(conffile, O_CREAT | O_EXCL | O_WRONLY, 0666)) != -1) { - MSG_INFO(MSGTR_CreatingCfgFile, conffile); - write(conffile_fd, default_config, strlen(default_config)); - close(conffile_fd); - } - if (m_config_parse_config_file(conf, conffile) != MPXP_Ok) exit(1); - mp_free(conffile); - } -} - -// When libmpdemux perform a blocking operation (network connection or cache filling) -// if the operation fail we use this function to check if it was interrupted by the user. -// The function return a new value for eof. -static int libmpdemux_was_interrupted(int eof) -{ - priv_t*priv=mp_data->priv; - mp_cmd_t* cmd; - if((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) { - switch(cmd->id) { - case MP_CMD_QUIT: - case MP_CMD_SOFT_QUIT: // should never happen - exit_player(MSGTR_Exit_quit); - case MP_CMD_PLAY_TREE_STEP: { - eof = (cmd->args[0].v.i > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY; - } break; - case MP_CMD_PLAY_TREE_UP_STEP: { - eof = (cmd->args[0].v.i > 0) ? PT_UP_NEXT : PT_UP_PREV; - } break; - case MP_CMD_PLAY_ALT_SRC_STEP: { - eof = (cmd->args[0].v.i > 0) ? PT_NEXT_SRC : PT_PREV_SRC; - } break; - } - mp_cmd_free(cmd); - } - return eof; -} - -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -static void get_mmx_optimizations( void ) -{ - GetCpuCaps(&gCpuCaps); - - if(x86.simd) { - if(x86.mmx != -1) gCpuCaps.hasMMX=x86.mmx; - if(x86.mmx2 != -1) gCpuCaps.hasMMX2=x86.mmx2; - if(x86._3dnow != -1) gCpuCaps.has3DNow=x86._3dnow; - if(x86._3dnow2 != -1) gCpuCaps.has3DNowExt=x86._3dnow2; - if(x86.sse != -1) gCpuCaps.hasSSE=x86.sse; - if(x86.sse2 != -1) gCpuCaps.hasSSE2=x86.sse2; - if(x86.sse3 != -1) gCpuCaps.hasSSE2=x86.sse3; - if(x86.ssse3 != -1) gCpuCaps.hasSSSE3=x86.ssse3; - if(x86.sse41 != -1) gCpuCaps.hasSSE41=x86.sse41; - if(x86.sse42 != -1) gCpuCaps.hasSSE42=x86.sse42; - if(x86.aes != -1) gCpuCaps.hasAES=x86.aes; - if(x86.avx != -1) gCpuCaps.hasAVX=x86.avx; - if(x86.fma != -1) gCpuCaps.hasFMA=x86.fma; - } else { - gCpuCaps.hasMMX= - gCpuCaps.hasMMX2= - gCpuCaps.has3DNow= - gCpuCaps.has3DNowExt= - gCpuCaps.hasSSE= - gCpuCaps.hasSSE2= - gCpuCaps.hasSSE3= - gCpuCaps.hasSSSE3= - gCpuCaps.hasSSE41= - gCpuCaps.hasSSE42= - gCpuCaps.hasAES= - gCpuCaps.hasAVX= - gCpuCaps.hasFMA=0; - } - MSG_V("User corrected CPU flags: MMX=%d MMX2=%d 3DNow=%d 3DNow2=%d SSE=%d SSE2=%d SSE3=%d SSSE3=%d SSE41=%d SSE42=%d AES=%d AVX=%d FMA=%d\n", - gCpuCaps.hasMMX, - gCpuCaps.hasMMX2, - gCpuCaps.has3DNow, - gCpuCaps.has3DNowExt, - gCpuCaps.hasSSE, - gCpuCaps.hasSSE2, - gCpuCaps.hasSSE3, - gCpuCaps.hasSSSE3, - gCpuCaps.hasSSE41, - gCpuCaps.hasSSE42, - gCpuCaps.hasAES, - gCpuCaps.hasAVX, - gCpuCaps.hasFMA); - if(gCpuCaps.hasMMX) mp_data->mplayer_accel |= MM_ACCEL_X86_MMX; - if(gCpuCaps.hasMMX2) mp_data->mplayer_accel |= MM_ACCEL_X86_MMXEXT; - if(gCpuCaps.hasSSE) mp_data->mplayer_accel |= MM_ACCEL_X86_SSE; - if(gCpuCaps.has3DNow) mp_data->mplayer_accel |= MM_ACCEL_X86_3DNOW; - if(gCpuCaps.has3DNowExt) mp_data->mplayer_accel |= MM_ACCEL_X86_3DNOWEXT; - MSG_V("mp_data->mplayer_accel=%i\n",mp_data->mplayer_accel); -} -#endif - - -static void init_player( void ) -{ - if(mp_conf.video_driver && strcmp(mp_conf.video_driver,"help")==0) { - vo_print_help(vo_data); - mpxp_uninit_structs(); - exit(0); - } - if(mp_conf.audio_driver && strcmp(mp_conf.audio_driver,"help")==0) { - ao_print_help(); - mpxp_uninit_structs(); - exit(0); - } - if(mp_conf.video_family && strcmp(mp_conf.video_family,"help")==0) { - vfm_help(); - mpxp_uninit_structs(); - exit(0); - } - if(mp_conf.audio_family && strcmp(mp_conf.audio_family,"help")==0) { - afm_help(); - mpxp_uninit_structs(); - exit(0); - } - if(vf_cfg.list && strcmp(vf_cfg.list,"help")==0) { - vf_help(); - mpxp_uninit_structs(); - exit(0); - } - if(af_cfg.list && strcmp(af_cfg.list,"help")==0) { - af_help(); - mpxp_uninit_structs(); - exit(0); - } - -#ifdef ENABLE_WIN32LOADER - /* check codec.conf*/ - if(!parse_codec_cfg(get_path("win32codecs.conf"))) { - if(!parse_codec_cfg(CONFDIR"/win32codecs.conf")) { - MSG_HINT(MSGTR_CopyCodecsConf); - mpxp_uninit_structs(); - exit(0); - } - } -#endif - if(mp_conf.audio_codec && strcmp(mp_conf.audio_codec,"help")==0) { -#ifdef ENABLE_WIN32LOADER - list_codecs(1); -#endif - mpxp_uninit_structs(); - exit(0); - } - if(mp_conf.video_codec && strcmp(mp_conf.video_codec,"help")==0) { -#ifdef ENABLE_WIN32LOADER - list_codecs(0); -#endif - mpxp_uninit_structs(); - exit(0); - } -} - -void show_help(void) { - // no file/vcd/dvd -> show HELP: - MSG_INFO("%s",help_text); - print_stream_drivers(); - MSG_INFO("\nExample: mplayerxp -ao alsa:hw:0 -vo x11 your.avi\n" - "Use --long-help option for full help\n"); -} - -void show_long_help(void) { - priv_t*priv=mp_data->priv; - m_config_show_options(mp_data->mconfig); - mp_input_print_binds(priv->libinput); - print_stream_drivers(); - vo_print_help(vo_data); - ao_print_help(); - vf_help(); - af_help(); - vfm_help(); - afm_help(); -#ifdef ENABLE_WIN32LOADER - /* check codec.conf*/ - if(!parse_codec_cfg(get_path("win32codecs.conf"))){ - if(!parse_codec_cfg(CONFDIR"/win32codecs.conf")){ - MSG_HINT(MSGTR_CopyCodecsConf); - mpxp_uninit_structs(); - exit(0); - } - } - list_codecs(0); - list_codecs(1); -#endif -} - -#ifdef USE_OSD - -//================= Update OSD ==================== -void update_osd( float v_pts ) -{ - priv_t*priv=mp_data->priv; - static char osd_text_buffer[64]; - static int osd_last_pts=-303; -//================= Update OSD ==================== - if(mp_conf.osd_level>=2){ - int pts=(mp_conf.osd_level==3&&priv->demuxer->movi_length!=UINT_MAX)?priv->demuxer->movi_length-v_pts:v_pts; - int addon=(mp_conf.osd_level==3&&priv->demuxer->movi_length!=UINT_MAX)?-1:1; - char osd_text_tmp[64]; - if(pts==osd_last_pts-addon) - { - if(mp_conf.osd_level==3&&priv->demuxer->movi_length!=UINT_MAX) ++pts; - else --pts; - } - else osd_last_pts=pts; - vo_data->osd_text=osd_text_buffer; - if (priv->osd_show_framedrop) { - sprintf(osd_text_tmp, "Framedrop: %s",mp_conf.frame_dropping>1?"hard":mp_conf.frame_dropping?"vo":"none"); - priv->osd_show_framedrop--; - } else -#ifdef ENABLE_DEC_AHEAD_DEBUG - if(mp_conf.verbose) sprintf(osd_text_tmp,"%c %02d:%02d:%02d",priv->osd_function,pts/3600,(pts/60)%60,pts%60); - else sprintf(osd_text_tmp,"%c %02d:%02d:%02d",priv->osd_function,pts/3600,(pts/60)%60,pts%60); -#else - sprintf(osd_text_tmp,"%c %02d:%02d:%02d",priv->osd_function,pts/3600,(pts/60)%60,pts%60); -#endif - if(strcmp(vo_data->osd_text, osd_text_tmp)) { - strcpy(vo_data->osd_text, osd_text_tmp); - vo_osd_changed(OSDTYPE_OSD); - } - } else { - if(vo_data->osd_text) { - vo_data->osd_text=NULL; - vo_osd_changed(OSDTYPE_OSD); - } - } -} -#endif -typedef struct osd_args_s { - int visible; - int info_factor; -}osd_args_t; - -void mpxp_seek( osd_args_t *osd,const seek_args_t* seek) -{ - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - sh_video_t* sh_video=priv->demuxer->video->sh; - demux_stream_t *d_dvdsub=priv->demuxer->sub; - int seek_rval=1; - xp_core->audio->eof=0; - if(seek->secs || seek->flags&DEMUX_SEEK_SET) { - seek_rval=demux_seek_r(priv->demuxer,seek); - mp_data->mpxp_after_seek=25; /* 1 sec delay */ - } - if(seek_rval){ - mp_data->seek_time = GetTimerMS(); - - // success: - /* FIXME there should be real seeking for vobsub */ - if (vo_data->vobsub) vobsub_reset(vo_data->vobsub); - if (vo_data->spudec) spudec_reset(vo_data->spudec); - - if(sh_audio){ - sh_audio->chapter_change=0; - sh_audio->a_pts=HUGE; - } - fflush(stdout); - - if(sh_video){ - MP_UNIT("seek_video_reset"); - mpcv_resync_stream(sh_video->decoder); - vo_reset(vo_data); - sh_video->chapter_change=-1; - } - - if(sh_audio){ - MP_UNIT("seek_audio_reset"); - mpca_resync_stream(sh_audio->decoder); - ao_reset(ao_data); // stop audio, throwing away buffered data - } - - if (vo_data->vobsub) { - MP_UNIT("seek_vobsub_reset"); - vobsub_seek_r(vo_data->vobsub, seek); - } - -#ifdef USE_OSD - // Set OSD: - if(mp_conf.osd_level){ - int len=((priv->demuxer->movi_end-priv->demuxer->movi_start)>>8); - if (len>0){ - if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; - vo_data->osd_progbar_type=0; - vo_data->osd_progbar_value=(priv->demuxer->filepos-priv->demuxer->movi_start)/len; - vo_osd_changed(OSDTYPE_PROGBAR); - } - } -#endif - if(sh_video) { - max_pts_correction=0.1; - if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; // to rewert to PLAY pointer after 1 sec - mp_data->bench->audio=0; mp_data->bench->audio_decode=0; mp_data->bench->video=0; mp_data->bench->vout=0; - if(vo_data->spudec) { - unsigned char* packet=NULL; - while(ds_get_packet_sub_r(d_dvdsub,&packet)>0) ; // Empty stream - spudec_reset(vo_data->spudec); - } - } - } - - if(sh_video) dae_wait_decoder_outrun(xp_core->video); -} - -void mpxp_reset_vcache(void) -{ - priv_t*priv=mp_data->priv; - sh_video_t* sh_video=priv->demuxer->video->sh; - seek_args_t seek = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; - if(sh_video) mpxp_seek(NULL,&seek); - return; -} - -void mpxp_resync_audio_stream(void) -{ - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - mpca_resync_stream(sh_audio->decoder); -} - -static void __FASTCALL__ mpxp_stream_event_handler(const struct stream_s *s,const stream_packet_t *sp) -{ - s->driver->control(s,SCRTL_EVT_HANDLE,(any_t*)sp); -} - -static void init_benchmark(void) -{ - mp_data->bench->max_audio=0; mp_data->bench->max_video=0; mp_data->bench->max_vout=0; - mp_data->bench->min_audio=HUGE; mp_data->bench->min_video=HUGE; mp_data->bench->min_vout=HUGE; - - mp_data->bench->min_audio_decode=HUGE; - mp_data->bench->max_audio_decode=0; - - mp_data->bench->max_demux=0; - mp_data->bench->demux=0; - mp_data->bench->min_demux=HUGE; - - mp_data->bench->cur_video=0; - mp_data->bench->cur_vout=0; - mp_data->bench->cur_audio=0; -} - -static void show_benchmark(void) -{ - double tot=(mp_data->bench->video+mp_data->bench->vout+mp_data->bench->audio+mp_data->bench->audio_decode+mp_data->bench->demux+mp_data->bench->c2); - double total_time_usage; - - mp_data->bench->total_start=GetTimer()-mp_data->bench->total_start; - total_time_usage = (float)mp_data->bench->total_start*0.000001; - - MSG_INFO("\nAVE BENCHMARKs: VC:%8.3fs VO:%8.3fs A:%8.3fs D:%8.3fs = %8.4fs C:%8.3fs\n", - mp_data->bench->video,mp_data->bench->vout,mp_data->bench->audio+mp_data->bench->audio_decode, - mp_data->bench->demux,mp_data->bench->c2,tot); - if(total_time_usage>0.0) - MSG_INFO("AVE BENCHMARK%%: VC:%8.4f%% VO:%8.4f%% A:%8.4f%% D:%8.4f%% C:%8.4f%% = %8.4f%%\n", - 100.0*mp_data->bench->video/total_time_usage, - 100.0*mp_data->bench->vout/total_time_usage, - 100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/total_time_usage, - 100.0*mp_data->bench->demux/total_time_usage, - 100.0*mp_data->bench->c2/total_time_usage, - 100.0*tot/total_time_usage); - unsigned nframes=xp_core->video->num_played_frames; - MSG_INFO("\nREAL RESULTS: from %u was dropped=%u\n" - ,nframes,xp_core->video->num_dropped_frames); -} - -static void show_benchmark_status(void) -{ - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - if(xmp_test_model(XMP_Run_AudioPlayback)) - MSG_STATUS("A:%6.1f %4.1f%%\r" - ,sh_audio->timer-ao_get_delay(ao_data) - ,(sh_audio->timer>0.5)?100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)sh_audio->timer:0 - ); - else - MSG_STATUS("A:%6.1f %4.1f%% B:%4.1f\r" - ,sh_audio->timer-ao_get_delay(ao_data) - ,(sh_audio->timer>0.5)?100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)sh_audio->timer:0 - ,get_delay_audio_buffer() - ); -} - -// for multifile support: -play_tree_iter_t* playtree_iter = NULL; - -static void mpxp_init_keyboard_fifo(void) -{ - priv_t*priv=mp_data->priv; -#ifdef HAVE_TERMCAP - load_termcap(NULL); // load key-codes -#endif - /* Init input system */ - MP_UNIT("init_input"); - priv->libinput=RND_RENAME0(mp_input_open)(); - priv->inited_flags|=INITED_INPUT; -} - -void mplayer_put_key(int code){ - priv_t*priv=mp_data->priv; - mp_cmd_t* cmd; - cmd=mp_input_get_cmd_from_keys(priv->libinput,1,&code); - mp_input_queue_cmd(priv->libinput,cmd); -} - - -static void mpxp_init_osd(void) { -// check font -#ifdef USE_OSD - if(mp_conf.font_name){ - vo_data->font=read_font_desc(mp_conf.font_name,mp_conf.font_factor,mp_conf.verbose>1); - if(!vo_data->font) MSG_ERR(MSGTR_CantLoadFont,mp_conf.font_name); - } else { - // try default: - vo_data->font=read_font_desc(get_path("font/font.desc"),mp_conf.font_factor,mp_conf.verbose>1); - if(!vo_data->font) - vo_data->font=read_font_desc(DATADIR"/font/font.desc",mp_conf.font_factor,mp_conf.verbose>1); - } -#endif - /* Configure menu here */ - { - char *menu_cfg; - menu_cfg = get_path("menu.conf"); - if(menu_init(NULL, menu_cfg)) - MSG_INFO("Menu initialized: %s\n", menu_cfg); - else { - menu_cfg="/etc/menu.conf"; - if(menu_init(NULL, menu_cfg)) - MSG_INFO("Menu initialized: %s\n", menu_cfg); - else - MSG_WARN("Menu init failed\n"); - } - } - MP_UNIT("init_osd"); - vo_init_osd(); -} - -static char * mpxp_init_output_subsystems(void) { - priv_t*priv=mp_data->priv; - char* rs=NULL; - unsigned i; - // check video_out driver name: - if (mp_conf.video_driver) - if ((i=strcspn(mp_conf.video_driver, ":")) > 0) { - size_t i2 = strlen(mp_conf.video_driver); - if (mp_conf.video_driver[i] == ':') { - vo_conf.subdevice = mp_malloc(i2-i); - if (vo_conf.subdevice != NULL) - strncpy(vo_conf.subdevice, (char *)(mp_conf.video_driver+i+1), i2-i); - mp_conf.video_driver[i] = '\0'; - } - } - MP_UNIT("vo_register"); - priv->vo_inited = (RND_RENAME5(vo_register)(vo_data,mp_conf.video_driver)!=NULL)?1:0; - - if(!priv->vo_inited){ - MSG_FATAL(MSGTR_InvalidVOdriver,mp_conf.video_driver?mp_conf.video_driver:"?"); - exit_player(MSGTR_Exit_error); - } - MP_UNIT("vo_init"); - if(RND_RENAME6(vo_init)(vo_data,vo_conf.subdevice)!=MPXP_Ok) { - MSG_FATAL("Error opening/initializing the selected video_out (-vo) device!\n"); - exit_player(MSGTR_Exit_error); - } - -// check audio_out driver name: - MP_UNIT("ao_init"); - if (mp_conf.audio_driver) - if ((i=strcspn(mp_conf.audio_driver, ":")) > 0) - { - size_t i2 = strlen(mp_conf.audio_driver); - - if (mp_conf.audio_driver[i] == ':') - { - rs = mp_malloc(i2-i); - if (rs != NULL) strncpy(rs, (char *)(mp_conf.audio_driver+i+1), i2-i); - mp_conf.audio_driver[i] = '\0'; - } - } - return rs; -} - -static int mpxp_init_vobsub(const char *filename) { - priv_t*priv=mp_data->priv; - int forced_subs_only=0; - MP_UNIT("vobsub"); - if (mp_conf.vobsub_name){ - vo_data->vobsub=vobsub_open(mp_conf.vobsub_name,mp_conf.spudec_ifo,1,&vo_data->spudec); - if(vo_data->vobsub==NULL) - MSG_ERR(MSGTR_CantLoadSub,mp_conf.vobsub_name); - else { - priv->inited_flags|=INITED_VOBSUB; - vobsub_set_from_lang(vo_data->vobsub, mp_conf.dvdsub_lang); - // check if vobsub requested only to display forced subtitles - forced_subs_only=vobsub_get_forced_subs_flag(vo_data->vobsub); - } - }else if(mp_conf.sub_auto && filename && (strlen(filename)>=5)){ - /* try to autodetect vobsub from movie filename ::atmos */ - char *buf = mp_mallocz((strlen(filename)-3) * sizeof(char)); - strncpy(buf, filename, strlen(filename)-4); - vo_data->vobsub=vobsub_open(buf,mp_conf.spudec_ifo,0,&vo_data->spudec); - mp_free(buf); - } - if(vo_data->vobsub) - { - mp_conf.sub_auto=0; // don't do autosub for textsubs if vobsub found - priv->inited_flags|=INITED_VOBSUB; - } - return forced_subs_only; -} - -static int mpxp_handle_playlist(const char *filename) { - priv_t*priv=mp_data->priv; - stream_t* stream=priv->demuxer->stream; - int eof=0; - play_tree_t* entry; - // Handle playlist - MP_UNIT("handle_playlist"); - MSG_V("Parsing playlist %s...\n",filename); - entry = parse_playtree(priv->libinput,stream); - if(!entry) { - entry = playtree_iter->tree; - if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) { - eof = PT_NEXT_ENTRY; - return eof; - } - if(playtree_iter->tree == entry ) { // Loop with a single file - if(play_tree_iter_up_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) { - eof = PT_NEXT_ENTRY; - return eof; - } - } - play_tree_remove(entry,1,1); - eof = PT_NEXT_SRC; - return eof; - } - play_tree_insert_entry(playtree_iter->tree,entry); - entry = playtree_iter->tree; - if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) { - eof = PT_NEXT_ENTRY; - return eof; - } - play_tree_remove(entry,1,1); - eof = PT_NEXT_SRC; - return eof; -} - -static void mpxp_init_dvd_nls(void) { -/* Add NLS support here */ - priv_t*priv=mp_data->priv; - stream_t* stream=priv->demuxer->stream; - char *lang; - if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(); - MP_UNIT("dvd lang->id"); - if(mp_conf.audio_lang) { - lang=mp_malloc(max(strlen(mp_conf.audio_lang)+1,4)); - strcpy(lang,mp_conf.audio_lang); - if(mp_conf.audio_id==-1 && stream->driver->control(stream,SCTRL_LNG_GET_AID,lang)==MPXP_Ok) { - mp_conf.audio_id=*(int *)lang; - } - mp_free(lang); - } - if(mp_conf.dvdsub_lang) { - lang=mp_malloc(max(strlen(mp_conf.dvdsub_lang)+1,4)); - strcpy(lang,mp_conf.dvdsub_lang); - if(mp_conf.dvdsub_id==-1 && stream->driver->control(stream,SCTRL_LNG_GET_SID,lang)==MPXP_Ok) { - mp_conf.dvdsub_id=*(int *)lang; - } - mp_free(lang); - } -} - -static void mpxp_print_stream_formats(void) { - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - sh_video_t* sh_video=priv->demuxer->video->sh; - int fmt; - char *c; - MSG_INFO("[Stream]:"); - if(sh_video) { - MSG_INFO("Video="); - if(sh_video->bih)fmt=sh_video->bih->biCompression; - else fmt=sh_video->fourcc; - c=(char *)&fmt; - if(isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) - MSG_INFO("%.4s",c); - else - MSG_INFO("%08X",fmt); - } - if(sh_audio) { - MSG_INFO(" Audio="); - fmt=sh_audio->wtag; - c=(char *)&fmt; - if(isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) - MSG_INFO("%.4s",c); - else - MSG_INFO("%08X",fmt); - } - MSG_INFO("\n"); -} - -static void mpxp_read_video_properties(void) { - priv_t*priv=mp_data->priv; - sh_video_t* sh_video=priv->demuxer->video->sh; - demux_stream_t *d_video=priv->demuxer->video; - MP_UNIT("video_read_properties"); - if(!video_read_properties(sh_video)) { - MSG_ERR("Video: can't read properties\n"); - sh_video=d_video->sh=NULL; - } else { - MSG_V("[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", - priv->demuxer->file_format,sh_video->fourcc, sh_video->src_w,sh_video->src_h, - sh_video->fps,1/sh_video->fps - ); - /* need to set fps here for output encoders to pick it up in their init */ - if(mp_conf.force_fps){ - sh_video->fps=mp_conf.force_fps; - } - - if(!sh_video->fps && !mp_conf.force_fps){ - MSG_ERR(MSGTR_FPSnotspecified); - sh_video=d_video->sh=NULL; - } - } -} - -static void mpxp_read_subtitles(const char *filename,int forced_subs_only,int stream_dump_type) { - priv_t*priv=mp_data->priv; - sh_video_t* sh_video=priv->demuxer->video->sh; - stream_t* stream=priv->demuxer->stream; - if (mp_conf.spudec_ifo) { - unsigned int palette[16], width, height; - MP_UNIT("spudec_init_vobsub"); - if (vobsub_parse_ifo(NULL,mp_conf.spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0) - vo_data->spudec=spudec_new_scaled(palette, sh_video->src_w, sh_video->src_h); - } - - if (vo_data->spudec==NULL) { - unsigned *pal; - MP_UNIT("spudec_init"); - if(stream->driver->control(stream,SCTRL_VID_GET_PALETTE,&pal)==MPXP_Ok) - vo_data->spudec=spudec_new_scaled(pal,sh_video->src_w, sh_video->src_h); - } - - if (vo_data->spudec==NULL) { - MP_UNIT("spudec_init_normal"); - vo_data->spudec=spudec_new_scaled(NULL, sh_video->src_w, sh_video->src_h); - spudec_set_font_factor(vo_data->spudec,mp_conf.font_factor); - } - - if (vo_data->spudec!=NULL) { - priv->inited_flags|=INITED_SPUDEC; - // Apply current settings for forced subs - spudec_set_forced_subs_only(vo_data->spudec,forced_subs_only); - } - -#ifdef USE_SUB -// after reading video params we should load subtitles because -// we know fps so now we can adjust subtitles time to ~6 seconds AST -// check .sub - MP_UNIT("read_subtitles_file"); - if(mp_conf.sub_name){ - mp_data->subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); - if(!mp_data->subtitles) MSG_ERR(MSGTR_CantLoadSub,mp_conf.sub_name); - } else if(mp_conf.sub_auto) { // auto load sub file ... - mp_data->subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) - : "default.sub", sh_video->fps ); - } - if(mp_data->subtitles) { - priv->inited_flags|=INITED_SUBTITLE; - if(stream_dump_type>1) list_sub_file(mp_data->subtitles); - } -#endif -} - -static void mpxp_find_acodec(void) { - int found=0; - any_t* mpca=0; - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - demux_stream_t *d_audio=priv->demuxer->audio; - sh_audio->codec=NULL; - mpca=RND_RENAME2(mpca_init)(sh_audio); // try auto-probe first - if(mpca) { sh_audio->decoder=mpca; found=1; } -#ifdef ENABLE_WIN32LOADER - if(!found) { -// Go through the codec.conf and find the best codec... - if(mp_conf.audio_family) MSG_INFO(MSGTR_TryForceAudioFmt,mp_conf.audio_family); - while(1) { - sh_audio->codec=find_codec(sh_audio->wtag,NULL,sh_audio->codec,1); - if(!sh_audio->codec) { - if(mp_conf.audio_family) { - sh_audio->codec=NULL; /* re-search */ - MSG_ERR(MSGTR_CantFindAfmtFallback); - mp_conf.audio_family=NULL; - continue; - } - break; - } - if(mp_conf.audio_codec && strcmp(sh_audio->codec->codec_name,mp_conf.audio_codec)) continue; - else if(mp_conf.audio_family && strcmp(sh_audio->codec->driver_name,mp_conf.audio_family)) continue; - if(afm_find_driver(sh_audio->codec->driver_name)) { - MSG_V("%s audio codec: [%s] drv:%s (%s)\n",mp_conf.audio_codec?"Forcing":"Detected",sh_audio->codec->codec_name,sh_audio->codec->driver_name,sh_audio->codec->s_info); - found=1; - break; - } - } - if(!found) { - sh_audio->codec=find_ffmpeg_audio(sh_audio); - if(sh_audio->codec) found=1; - } - } -#endif - if(!found) { - const char *fmt; - MSG_ERR(MSGTR_CantFindAudioCodec); - fmt = (const char *)&sh_audio->wtag; - if(isprint(fmt[0]) && isprint(fmt[1]) && isprint(fmt[2]) && isprint(fmt[3])) - MSG_ERR(" '%c%c%c%c'!\n",fmt[0],fmt[1],fmt[2],fmt[3]); - else - MSG_ERR(" 0x%08X!\n",sh_audio->wtag); - MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); - sh_audio=d_audio->sh=NULL; - } -} - -static MPXP_Rc mpxp_find_vcodec(void) { - priv_t*priv=mp_data->priv; - demux_stream_t *d_video=priv->demuxer->video; - sh_video_t* sh_video=priv->demuxer->video->sh; - MPXP_Rc rc=MPXP_Ok; - MP_UNIT("init_video_codec"); - sh_video->inited=0; - if((sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,mp_conf.video_codec,mp_conf.video_family,-1,priv->libinput))) sh_video->inited=1; -#ifdef ENABLE_WIN32LOADER - if(!sh_video->inited) { -/* Go through the codec.conf and find the best codec...*/ - vo_data->flags=0; - if(vo_conf.fullscreen) vo_FS_SET(vo_data); - if(vo_conf.softzoom) vo_ZOOM_SET(vo_data); - if(vo_conf.flip>0) vo_FLIP_SET(vo_data); - if(vo_conf.vidmode) vo_VM_SET(vo_data); - codecs_reset_selection(0); - if(mp_conf.video_codec) { - /* forced codec by name: */ - MSG_INFO("Forced video codec: %s\n",mp_conf.video_codec); - sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,mp_conf.video_codec,NULL,-1,priv->libinput); - } else { - int status; - /* try in stability order: UNTESTED, WORKING, BUGGY, BROKEN */ - if(mp_conf.video_family) MSG_INFO(MSGTR_TryForceVideoFmt,mp_conf.video_family); - for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status){ - if(mp_conf.video_family) /* try first the preferred codec family:*/ - if((sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,NULL,mp_conf.video_family,status,priv->libinput))) break; - if((sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,NULL,NULL,status,priv->libinput))) break; - } - } - } - /* Use ffmpeg decoders as last hope */ - if(!sh_video->inited) sh_video->decoder=mpcv_ffmpeg_init(sh_video,priv->libinput); -#endif - - if(!sh_video->inited) { - const char *fmt; - MSG_ERR(MSGTR_CantFindVideoCodec); - fmt = (const char *)&sh_video->fourcc; - if(isprint(fmt[0]) && isprint(fmt[1]) && isprint(fmt[2]) && isprint(fmt[3])) - MSG_ERR(" '%c%c%c%c'!\n",fmt[0],fmt[1],fmt[2],fmt[3]); - else - MSG_ERR(" 0x%08X!\n",sh_video->fourcc); - MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); - sh_video = d_video->sh = NULL; - rc=MPXP_False; - } else priv->inited_flags|=INITED_VCODEC; - - if(sh_video) - MSG_V("%s video codec: [%s] vfm:%s (%s)\n", - mp_conf.video_codec?"Forcing":"Detected",sh_video->codec->codec_name,sh_video->codec->driver_name,sh_video->codec->s_info); - return rc; -} - -static int mpxp_configure_audio(void) { - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - sh_video_t* sh_video=priv->demuxer->video->sh; - demux_stream_t *d_audio=priv->demuxer->audio; - int rc=0; - const ao_info_t *info=ao_get_info(ao_data); - MP_UNIT("setup_audio"); - MSG_V("AO: [%s] %iHz %s %s\n", - info->short_name, - mp_conf.force_srate?mp_conf.force_srate:sh_audio->rate, - sh_audio->nch>7?"surround71": - sh_audio->nch>6?"surround61": - sh_audio->nch>5?"surround51": - sh_audio->nch>4?"surround41": - sh_audio->nch>3?"surround40": - sh_audio->nch>2?"stereo2.1": - sh_audio->nch>1?"Stereo":"Mono", - ao_format_name(sh_audio->afmt) - ); - MSG_V("AO: Description: %s\nAO: Author: %s\n", - info->name, info->author); - if(strlen(info->comment) > 0) - MSG_V("AO: Comment: %s\n", info->comment); - - MP_UNIT("af_preinit"); - ao_data->samplerate=mp_conf.force_srate?mp_conf.force_srate:sh_audio->rate; - ao_data->channels=mp_conf.ao_channels?mp_conf.ao_channels:sh_audio->nch; - ao_data->format=sh_audio->afmt; -#if 1 - if(mpca_preinit_filters(sh_audio, - // input: - (int)(sh_audio->rate), - sh_audio->nch, sh_audio->afmt, - // output: - &ao_data->samplerate, &ao_data->channels, &ao_data->format)!=MPXP_Ok){ - MSG_ERR("Audio filter chain preinit failed\n"); - } else { - MSG_V("AF_pre: %dHz %dch (%s) afmt=%08X sh_audio_min=%i\n", - ao_data->samplerate, ao_data->channels, - ao_format_name(ao_data->format),ao_data->format - ,sh_audio->audio_out_minsize); - } -#endif - if(MPXP_Ok!=ao_configure(ao_data,mp_conf.force_srate?mp_conf.force_srate:ao_data->samplerate, - ao_data->channels,ao_data->format)) { - MSG_ERR("Can't configure audio device\n"); - sh_audio=d_audio->sh=NULL; - if(sh_video == NULL) rc=-1; - } else { - priv->inited_flags|=INITED_AO; - MP_UNIT("af_init"); - if(mpca_init_filters(sh_audio, - sh_audio->rate, - sh_audio->nch, sh_audio->afmt, - ao_data->samplerate, ao_data->channels, ao_data->format, - ao_data->outburst*4, ao_data->buffersize)!=MPXP_Ok) { - MSG_ERR("No matching audio filter found!\n"); - } - } - return rc; -} - -static void mpxp_run_ahead_engine(void) { - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - sh_video_t* sh_video=priv->demuxer->video->sh; - MP_UNIT("init_xp"); - if(sh_video && xp_core->num_v_buffs < 3) {/* we need at least 3 buffers to suppress screen judering */ - MSG_FATAL("Not enough buffers for DECODING AHEAD!\nNeed %u buffers but exist only %u\n",3,xp_core->num_v_buffs); - exit_player("Try other '-vo' driver.\n"); - } - if(xmp_init_engine(sh_video,sh_audio)!=0) - exit_player("Can't initialize decoding ahead!\n"); - if(xmp_run_decoders()!=0) - exit_player("Can't run decoding ahead!\n"); - if(sh_video) MSG_OK("Using DECODING AHEAD mplayer's core with %u video buffers\n",xp_core->num_v_buffs); - else MSG_OK("Using DECODING AHEAD mplayer's core with %u audio buffers\n",xp_core->num_a_buffs); -/* reset counters */ - if(sh_video) xp_core->video->num_dropped_frames=0; - priv->inited_flags|=INITED_XMP; -} - -static void mpxp_print_audio_status(void) { - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->... [truncated message content] |
From: <nic...@us...> - 2012-11-15 06:58:33
|
Revision: 370 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=370&view=rev Author: nickols_k Date: 2012-11-15 06:58:22 +0000 (Thu, 15 Nov 2012) Log Message: ----------- make whole folder as sources of c++ Modified Paths: -------------- mplayerxp/Makefile mplayerxp/dump.h mplayerxp/mp_msg.h mplayerxp/mplayerxp.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Added Paths: ----------- mplayerxp/dump.cpp mplayerxp/mp-opt-reg.cpp mplayerxp/mp_msg.cpp Removed Paths: ------------- mplayerxp/dump.c mplayerxp/mp-opt-reg.c mplayerxp/mp_msg.c Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/Makefile 2012-11-15 06:58:22 UTC (rev 370) @@ -21,11 +21,9 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS = mp-opt-reg.c dump.c mp_msg.c -XXSRCS = mplayerxp.cpp +SRCS = mplayerxp.cpp mp-opt-reg.cpp dump.cpp mp_msg.cpp -OBJS = $(SRCS:.c=.o) -XXOBJS = $(XXSRCS:.cpp=.o) +OBJS = $(SRCS:.cpp=.o) FF_LIBS = ../ffmpeg/libavcodec/libavcodec$(FF_SUFFIX).a \ ../ffmpeg/libswscale/libswscale$(FF_SUFFIX).a \ @@ -51,7 +49,6 @@ endif LIBS+= $(MP_LIBS) $(FF_LIBS) $(EXTRALIBS) -lm -CFLAGS = $(OPTFLAGS) $(EXTRA_INC) CXXFLAGS = $(OPTXXFLAGS) $(EXTRA_INC) .SUFFIXES: .cpp .c .o @@ -60,18 +57,15 @@ all: $(TARGET_EXE) $(SUBDIRS) -.c.o: - $(CC) -c $(CFLAGS) -o $@ $< - .cpp.o: $(CXX) -c $(CXXFLAGS) -o $@ $< .PHONY: subdirs $(MP_LIBS) subdirs: $(MP_LIBS) -$(TARGET_EXE): $(OBJS) $(XXOBJS) $(MP_LIBS) +$(TARGET_EXE): $(OBJS) $(MP_LIBS) $(DO_MAKE_ALL) - $(CXX) -o $(TARGET_EXE) $(XXOBJS) $(OBJS) $(LDFLAGS) $(LDXXFLAGS) $(LIBS) + $(CXX) -o $(TARGET_EXE) $(OBJS) $(LDFLAGS) $(LDXXFLAGS) $(LIBS) #-Xlinker --export-dynamic -Xlinker --gc-sections -Xlinker --sort-common $(SRCS): version.h @@ -113,7 +107,7 @@ $(MAKE) dep dep: - $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend $(DO_MAKE) # Deleted: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/dump.c 2012-11-15 06:58:22 UTC (rev 370) @@ -1,463 +0,0 @@ -/* - dump.c - stream dumper -*/ - -#include <stdio.h> -#include <stdlib.h> -#define __USE_ISOC99 1 /* for lrint */ -#include <math.h> - -#include "mp_config.h" - -#include "dump.h" -#include "xmpcore/sig_hand.h" -#include "help_mp.h" -#include "input2/input.h" -#include "mplayerxp.h" -#include "libmpdemux/muxer.h" -#include "libmpdemux/mrl.h" -#include "osdep/mplib.h" -#define MSGT_CLASS MSGT_GLOBAL -#include "mp_msg.h" - -static char *media=NULL,*port=NULL; - -/* example: -dump @avi:my_file.avi#rate=50 */ -int dump_parse(const char *param) -{ - int type=0; - const char *tile; - tile=mrl_parse_line(param,NULL,NULL,&media,&port); - if(!media) return 0; - if(strcmp(media,"stream")==0) type=1; - else type=2; - return type; -} - -void dump_stream(stream_t *stream) -{ - char buf[4096]; - int len; - FILE *f; - const char *ext,*name; - MP_UNIT("dumpstream"); - stream_reset(stream); - stream_seek(stream,stream->start_pos); - ext=".ext"; - if(!port) - { - strcpy(buf,"stream_dump"); - strcat(buf,ext); - } - else - { - strcpy(buf,port); - } - name=buf; - f=fopen(name,"wb"); - if(!f){ - MSG_FATAL(MSGTR_CantOpenDumpfile); - exit_player(MSGTR_Exit_error); - } - MSG_INFO("Dumping stream to %s\n",name); - while(!stream_eof(stream)){ - len=stream_read(stream,buf,4096); - if(len>0) fwrite(buf,len,1,f); - } - fclose(f); - MSG_INFO(MSGTR_CoreDumped); /* nice joke ;) */ - exit_player(MSGTR_Exit_eof); -} - -#define MUX_HAVE_AUDIO 0x01 -#define MUX_HAVE_VIDEO 0x02 -#define MUX_HAVE_SUBS 0x04 -typedef struct priv_s { - int my_use_pts; - FILE* mux_file; - muxer_t* muxer; - muxer_stream_t *m_audio,*m_video,*m_subs; - unsigned decoded_frameno; - unsigned a_frameno; - int mux_type; - uint64_t vsize,asize,ssize; - float timer_corr; /* use common time-base */ - float vtimer; - any_t* libinput; -}priv_t; - -void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp) -{ -} - -/* - returns: 0 - nothing interested - -1 - quit -*/ -static int check_cmd(priv_t* priv) -{ - mp_cmd_t* cmd; - int retval; - retval = 0; - while((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) - { - switch(cmd->id) - { - case MP_CMD_QUIT: - case MP_CMD_SOFT_QUIT: - retval = -1; - break; - default: break; - } - } - return retval; -} - -void dump_mux_init(demuxer_t *demuxer,any_t* libinput) -{ - sh_audio_t* sha=demuxer->audio->sh; - sh_video_t* shv=demuxer->video->sh; - char stream_dump_name[1024]; - /* TODO copy it from demuxer */ - if(demuxer->priv) return; - demuxer->priv=mp_mallocz(sizeof(priv_t)); - priv_t*priv=demuxer->priv; - priv->libinput=libinput; - /* describe other useless dumps */ - priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; - if(port) { - if(strcmp(port,"audio") ==0 ) { strcpy(stream_dump_name,"a_"); priv->mux_type&=~(MUX_HAVE_VIDEO|MUX_HAVE_SUBS); } - else if(strcmp(port,"video") ==0 ) { strcpy(stream_dump_name,"v_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_SUBS); } - else if(strcmp(port,"sub") ==0 ) { strcpy(stream_dump_name,"s_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_VIDEO); } - else strcpy(stream_dump_name,port); - } else strcpy(stream_dump_name,"avs_"); - if(strcmp(media,"lavf") == 0) { strcpy(stream_dump_name,"avs_dump."); strcat(stream_dump_name,port); } - else if(strcmp(media,"mpxp") == 0) strcat(stream_dump_name,"dump.mpxp"); - else if(strcmp(media,"raw") == 0) strcat(stream_dump_name,"dump.raw"); - else { - MSG_FATAL("Unsupported muxer format %s found\n",media); - exit_player(MSGTR_Exit_error); - } - priv->mux_file=fopen(stream_dump_name,"wb"); - MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); - if(!priv->mux_file){ - MSG_FATAL(MSGTR_CantOpenDumpfile); - exit_player(MSGTR_Exit_error); - } - if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) { - MSG_FATAL("Can't initialize muxer\n"); - exit_player(MSGTR_Exit_error); - } - if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) { - priv->m_audio=muxer_new_stream(priv->muxer,MUXER_TYPE_AUDIO); - priv->m_audio->buffer_size=0x100000; //16384; - priv->m_audio->source=sha; - priv->m_audio->codec=0; - if(!sha->wf) { - sha->wf=mp_malloc(sizeof(WAVEFORMATEX)); - sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; - sha->wf->wFormatTag = sha->wtag; - sha->wf->nChannels = sha->nch; - sha->wf->nSamplesPerSec = sha->rate; - sha->wf->nAvgBytesPerSec=sha->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; - sha->wf->wBitsPerSample = 16; // FIXME - sha->wf->cbSize=0; // FIXME for l3codeca.acm - } - priv->m_audio->wf=mp_malloc(sha->wf->cbSize+sizeof(WAVEFORMATEX)); - memcpy(priv->m_audio->wf,sha->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); - if(!sha->wf->cbSize && sha->codecdata_len) { - priv->m_audio->wf->cbSize=sha->wf->cbSize=sha->codecdata_len; - priv->m_audio->wf=mp_realloc(priv->m_audio->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); - memcpy((char *)(priv->m_audio->wf+1),sha->codecdata,sha->codecdata_len); - } - if(!sha->i_bps) sha->i_bps=priv->m_audio->wf->nAvgBytesPerSec; - if(sha->audio.dwScale){ - priv->m_audio->h.dwSampleSize=sha->audio.dwSampleSize; - priv->m_audio->h.dwScale=sha->audio.dwScale; - priv->m_audio->h.dwRate=sha->audio.dwRate; - } else { - priv->m_audio->h.dwSampleSize=priv->m_audio->wf->nBlockAlign; - priv->m_audio->h.dwScale=priv->m_audio->h.dwSampleSize; - priv->m_audio->h.dwRate=priv->m_audio->wf->nAvgBytesPerSec; - } - } else priv->m_audio=NULL; - if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) { - priv->m_video=muxer_new_stream(priv->muxer,MUXER_TYPE_VIDEO); - priv->m_video->buffer_size=0x200000; // 2MB - priv->m_video->source=shv; - priv->m_video->h.dwSampleSize=0; // VBR - priv->m_video->h.dwScale=10000; - priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; - priv->m_video->h.dwSuggestedBufferSize=shv->video.dwSuggestedBufferSize; - if(!shv->bih) { - shv->bih=mp_malloc(sizeof(BITMAPINFOHEADER)); - shv->bih->biSize=sizeof(BITMAPINFOHEADER); - shv->bih->biWidth=shv->src_w; - shv->bih->biHeight=shv->src_h; - shv->bih->biCompression=shv->fourcc; - shv->bih->biPlanes=1; - shv->bih->biBitCount=24; // FIXME!!! - shv->bih->biSizeImage=shv->bih->biWidth*shv->bih->biHeight*(shv->bih->biBitCount/8); - } - priv->m_video->bih=mp_malloc(shv->bih->biSize); - memcpy(priv->m_video->bih,shv->bih,shv->bih->biSize); - priv->m_video->ImageDesc=shv->ImageDesc; - priv->m_video->aspect=shv->aspect; - priv->m_video->codec=0; - } else priv->m_video=NULL; - if(demuxer->sub->sh && (priv->mux_type&MUX_HAVE_SUBS)) { - priv->m_subs=muxer_new_stream(priv->muxer,MUXER_TYPE_SUBS); - priv->m_subs->buffer_size=0x100000; //16384; - priv->m_subs->source=NULL; - priv->m_subs->codec=0; - } else priv->m_subs=NULL; - MSG_DBG2("Opening dump: %X\n",demuxer); - MSG_INFO("Dumping stream to %s\n",stream_dump_name); - muxer_fix_parameters(priv->muxer); - muxer_write_header(priv->muxer,demuxer); -} - -void dump_mux_close(demuxer_t *demuxer) -{ - priv_t* priv=demuxer->priv; - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; - sh_audio_t* sha=d_audio->sh; - sh_video_t* shv=d_video->sh; - if(priv) { - MSG_DBG2("Closing dump: %X %f secs\n" - "As video %X-%ix%i audio %X-%ix%ix%i\n" - ,demuxer,shv?priv->vtimer:sha->timer - ,priv->m_video?priv->m_video->bih->biCompression:-1 - ,priv->m_video?priv->m_video->bih->biWidth:-1 - ,priv->m_video?priv->m_video->bih->biHeight:-1 - ,priv->m_audio?priv->m_audio->wf->wFormatTag:-1 - ,priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1 - ,priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1 - ,priv->m_audio?priv->m_audio->wf->nChannels:-1); - if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) priv->m_video->source=shv; - if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) priv->m_audio->source=sha; - muxer_write_index(priv->muxer); - /* fixup avi header */ - if(shv) { - if(priv->vtimer) shv->fps=(float)priv->decoded_frameno/(priv->vtimer+priv->timer_corr); - if(priv->m_video) { - priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; - priv->m_video->h.dwSuggestedBufferSize=priv->vsize/priv->decoded_frameno; - MSG_V("Finishing vstream as: scale %u rate %u fps %f (frames=%u timer=%f)\n" - ,priv->m_video->h.dwScale - ,priv->m_video->h.dwRate - ,shv->fps - ,priv->decoded_frameno - ,priv->vtimer+priv->timer_corr); - } - } - if(sha) { - if(priv->m_audio) { - priv->m_audio->h.dwSuggestedBufferSize=priv->asize/priv->a_frameno; - MSG_V("Finishing astream as: scale %u rate %u (frames=%u timer=%f) avg=%i size=%u\n" - ,priv->m_audio->h.dwScale - ,priv->m_audio->h.dwRate - ,priv->a_frameno - ,sha->timer+priv->timer_corr - ,priv->m_audio->wf->nAvgBytesPerSec - ,priv->asize); - } - } - if(demuxer->sub->sh) { - if(priv->m_subs) MSG_V("Finishing sstream as\n"); - } - fseeko(priv->mux_file,0,SEEK_SET); - muxer_write_header(priv->muxer,demuxer); - fclose(priv->mux_file); - mp_free(demuxer->priv); - demuxer->priv=NULL; - } - MSG_INFO(MSGTR_CoreDumped); -} - - -void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames) -{ - priv_t* priv=demuxer->priv; - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; - demux_stream_t *d_sub=demuxer->sub; - sh_audio_t* sha=d_audio->sh; - sh_video_t* shv=d_video->sh; - float frame_time,a_duration; - float mpeg_vtimer=HUGE,mpeg_atimer=HUGE; - unsigned char* start=NULL; - int in_size,aeof,veof,seof,cmd; - - if(!priv) return; - MP_UNIT("dump"); - priv->my_use_pts=use_pts; - /* test stream property */ - MSG_INFO("%s using PTS method\n",use_pts?"":"not"); - if(priv->m_video) - { - if(!shv) { MSG_ERR("Video not found!!!Skip this stream\n"); return; } - if(!shv->bih) { MSG_ERR("Video property not found!!!Skip this stream\n"); return; } - if(memcmp(shv->bih,priv->m_video->bih,sizeof(BITMAPINFOHEADER))!=0) - { - MSG_ERR("Found different video properties(%X-%ix%i)!=(%X-%ix%i)!!!\nSkip this stream\n", - shv->bih->biCompression,shv->bih->biWidth,shv->bih->biHeight, - priv->m_video->bih->biCompression,priv->m_video->bih->biWidth, - priv->m_video->bih->biHeight); - return; - } - priv->m_video->source=shv; - } - if(priv->m_audio) - { - if(!sha) { MSG_ERR("Audio not found!!!Skip this stream\n"); return; } - if(!sha->wf) { MSG_ERR("Audio property not found!!!Skip this stream\n"); return; } - if(memcmp(sha->wf,priv->m_audio->wf,sizeof(WAVEFORMATEX))!=0) - { - MSG_ERR("Found different audio properties(%X-%ix%ix%i)!=(%X-%ix%ix%i)X!!!\nSkip this stream\n", - sha->wf->wFormatTag,sha->wf->nSamplesPerSec,sha->wf->wBitsPerSample,sha->wf->nChannels, - priv->m_audio->wf->wFormatTag,priv->m_audio->wf->nSamplesPerSec, - priv->m_audio->wf->wBitsPerSample,priv->m_audio->wf->nChannels); - return; - } - priv->m_audio->source=sha; - } - if (seek_to_sec) { - float d; - float rel_seek_secs=0; - seek_args_t seek_p = { 0, 1}; - int a,b; - if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3) - rel_seek_secs += 3600*a +60*b +d ; - else if (sscanf(seek_to_sec, "%d:%f", &a, &d)==2) - rel_seek_secs += 60*a +d; - else if (sscanf(seek_to_sec, "%f", &d)==1) - rel_seek_secs += d; - - seek_to_sec = NULL; - MSG_INFO("seeking to %u seconds\n"); - seek_p.secs=rel_seek_secs; - demux_seek_r(demuxer,&seek_p); - } - aeof=sha?0:1; - veof=shv?0:1; - if(shv) priv->vtimer=0; - if(sha) sha->timer=0; - while(!(aeof && veof)){ - in_size=0; - if(sha && !aeof) - { - float a_pts; - while(sha->timer < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of audio reading */ - { - /* we should try to keep structure of audio packets here - and don't generate badly interlaved stream. - The ideal case is: type=read_packet(ANY_TYPE); put_packet(type); - */ - in_size=ds_get_packet_r(sha->ds,&start,&a_pts); - cmd = check_cmd(priv); - if(cmd == -1) goto done; - else - a_duration=(float)in_size/(float)(sha->i_bps); - if(mpeg_atimer==HUGE) mpeg_atimer=a_pts; - else - { - if( mpeg_atimer-a_duration<a_pts) mpeg_atimer=a_pts; - else mpeg_atimer+=a_duration; - } - if(use_pts) sha->timer=a_pts; - else sha->timer=mpeg_atimer; - MSG_V("Got audio frame: %f %u\n",a_pts,(!aeof)?priv->a_frameno:-1); - aeof=sha->ds->eof; - priv->a_frameno++; - if(aeof) break; - if(priv->m_audio) - { - priv->m_audio->buffer=start; - if(in_size>0) - { - MSG_V("put audio: %f %f %u\n",a_pts,sha->timer+priv->timer_corr,in_size); - if(priv->m_audio) - muxer_write_chunk(priv->m_audio,in_size,priv->m_video?0:AVIIF_KEYFRAME,sha->timer+priv->timer_corr); - } - if(!priv->m_audio->h.dwSampleSize && priv->m_audio->timer>0) - priv->m_audio->wf->nAvgBytesPerSec=0.5f+(double)priv->m_audio->size/priv->m_audio->timer; - } - priv->asize += in_size; - } - } - if(shv && !veof) - { - float v_pts; - in_size=video_read_frame(shv,&frame_time,&v_pts,&start,0); - cmd = check_cmd(priv); - if(cmd == -1) goto done; - else - if(mpeg_vtimer==HUGE) mpeg_vtimer=v_pts; - else - { - if( mpeg_vtimer-frame_time<v_pts ) mpeg_vtimer=v_pts; - else mpeg_vtimer+=frame_time; - } - if(use_pts) priv->vtimer=v_pts; - else priv->vtimer=mpeg_vtimer; - ++priv->decoded_frameno; - veof=shv->ds->eof; - MSG_V("Got video frame %f %i\n",v_pts,(!veof)?priv->decoded_frameno:-1); - if(priv->m_video) priv->m_video->buffer=start; - if(in_size>0) - { - MSG_V("put video: %f %f %u flg=%u\n",v_pts,priv->vtimer+priv->timer_corr,in_size,shv->ds->flags); - if(priv->m_video) muxer_write_chunk(priv->m_video,in_size,(shv->ds->flags&1)?AVIIF_KEYFRAME:0,priv->vtimer+priv->timer_corr); - priv->vsize += in_size; - } - if(!(priv->decoded_frameno%100)) - MSG_STATUS("Done %u frames\r",priv->decoded_frameno); - } - if(demuxer->sub->sh) - { - float s_pts=0; - while(s_pts < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of sub reading */ - { - in_size=ds_get_packet_r(demuxer->sub,&start,&s_pts); - seof=demuxer->sub->eof; - if(seof) break; - cmd = check_cmd(priv); - if(cmd == -1) goto done; - else - MSG_V("Got sub frame: %f\n",s_pts); - if(priv->m_subs) - { - priv->m_subs->buffer=start; - if(in_size>0) - { - MSG_V("put subs: %f %u\n",s_pts,in_size); - if(priv->m_subs) - muxer_write_chunk(priv->m_subs,in_size,priv->m_video?0:AVIIF_KEYFRAME,s_pts); - } - } - } - } - if(priv->decoded_frameno>play_n_frames) break; - } - done: - if(shv) priv->timer_corr+=priv->vtimer+frame_time; - else - { - if(sha) priv->timer_corr+=d_audio->pts; - if(priv->m_audio->wf->nAvgBytesPerSec) - priv->timer_corr+=((float)ds_tell_pts(d_audio))/((float)priv->m_audio->wf->nAvgBytesPerSec); - } - MSG_STATUS("Done %u frames (video(%X-%ix%i): %llu bytes audio(%X-%ix%ix%i): %llu bytes)\n" - ,priv->decoded_frameno - ,priv->m_video?priv->m_video->bih->biCompression:-1 - ,priv->m_video?priv->m_video->bih->biWidth:-1 - ,priv->m_video?priv->m_video->bih->biHeight:-1 - ,priv->vsize - ,priv->m_audio?priv->m_audio->wf->wFormatTag:-1 - ,priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1 - ,priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1 - ,priv->m_audio?priv->m_audio->wf->nChannels:-1 - ,priv->asize); -} Copied: mplayerxp/dump.cpp (from rev 369, mplayerxp/dump.c) =================================================================== --- mplayerxp/dump.cpp (rev 0) +++ mplayerxp/dump.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -0,0 +1,463 @@ +/* + dump.c - stream dumper +*/ + +#include <stdio.h> +#include <stdlib.h> +#define __USE_ISOC99 1 /* for lrint */ +#include <math.h> +extern "C"{ +#include "mp_config.h" + +#include "xmpcore/sig_hand.h" +#include "help_mp.h" +#include "input2/input.h" +#include "mplayerxp.h" +#include "libmpdemux/muxer.h" +#include "libmpdemux/mrl.h" +#include "osdep/mplib.h" +#define MSGT_CLASS MSGT_GLOBAL +#include "mp_msg.h" +} +#include "dump.h" + +static char *media=NULL,*port=NULL; + +/* example: -dump @avi:my_file.avi#rate=50 */ +int dump_parse(const char *param) +{ + int type=0; + const char *tile; + tile=mrl_parse_line(param,NULL,NULL,&media,&port); + if(!media) return 0; + if(strcmp(media,"stream")==0) type=1; + else type=2; + return type; +} + +void dump_stream(stream_t *stream) +{ + char buf[4096]; + int len; + FILE *f; + const char *ext,*name; + MP_UNIT("dumpstream"); + stream_reset(stream); + stream_seek(stream,stream->start_pos); + ext=".ext"; + if(!port) + { + strcpy(buf,"stream_dump"); + strcat(buf,ext); + } + else + { + strcpy(buf,port); + } + name=buf; + f=fopen(name,"wb"); + if(!f){ + MSG_FATAL(MSGTR_CantOpenDumpfile); + exit_player(MSGTR_Exit_error); + } + MSG_INFO("Dumping stream to %s\n",name); + while(!stream_eof(stream)){ + len=stream_read(stream,buf,4096); + if(len>0) fwrite(buf,len,1,f); + } + fclose(f); + MSG_INFO(MSGTR_CoreDumped); /* nice joke ;) */ + exit_player(MSGTR_Exit_eof); +} + +#define MUX_HAVE_AUDIO 0x01 +#define MUX_HAVE_VIDEO 0x02 +#define MUX_HAVE_SUBS 0x04 +typedef struct priv_s { + int my_use_pts; + FILE* mux_file; + muxer_t* muxer; + muxer_stream_t *m_audio,*m_video,*m_subs; + unsigned decoded_frameno; + unsigned a_frameno; + int mux_type; + uint64_t vsize,asize,ssize; + float timer_corr; /* use common time-base */ + float vtimer; + any_t* libinput; +}priv_t; + +void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp) +{ +} + +/* + returns: 0 - nothing interested + -1 - quit +*/ +static int check_cmd(priv_t* priv) +{ + mp_cmd_t* cmd; + int retval; + retval = 0; + while((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) + { + switch(cmd->id) + { + case MP_CMD_QUIT: + case MP_CMD_SOFT_QUIT: + retval = -1; + break; + default: break; + } + } + return retval; +} + +void dump_mux_init(demuxer_t *demuxer,any_t* libinput) +{ + sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); + sh_video_t* shv=reinterpret_cast<sh_video_t*>(demuxer->video->sh); + char stream_dump_name[1024]; + /* TODO copy it from demuxer */ + if(demuxer->priv) return; + demuxer->priv=mp_mallocz(sizeof(priv_t)); + priv_t*priv=reinterpret_cast<priv_t*>(demuxer->priv); + priv->libinput=libinput; + /* describe other useless dumps */ + priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; + if(port) { + if(strcmp(port,"audio") ==0 ) { strcpy(stream_dump_name,"a_"); priv->mux_type&=~(MUX_HAVE_VIDEO|MUX_HAVE_SUBS); } + else if(strcmp(port,"video") ==0 ) { strcpy(stream_dump_name,"v_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_SUBS); } + else if(strcmp(port,"sub") ==0 ) { strcpy(stream_dump_name,"s_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_VIDEO); } + else strcpy(stream_dump_name,port); + } else strcpy(stream_dump_name,"avs_"); + if(strcmp(media,"lavf") == 0) { strcpy(stream_dump_name,"avs_dump."); strcat(stream_dump_name,port); } + else if(strcmp(media,"mpxp") == 0) strcat(stream_dump_name,"dump.mpxp"); + else if(strcmp(media,"raw") == 0) strcat(stream_dump_name,"dump.raw"); + else { + MSG_FATAL("Unsupported muxer format %s found\n",media); + exit_player(MSGTR_Exit_error); + } + priv->mux_file=fopen(stream_dump_name,"wb"); + MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); + if(!priv->mux_file){ + MSG_FATAL(MSGTR_CantOpenDumpfile); + exit_player(MSGTR_Exit_error); + } + if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) { + MSG_FATAL("Can't initialize muxer\n"); + exit_player(MSGTR_Exit_error); + } + if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) { + priv->m_audio=muxer_new_stream(priv->muxer,MUXER_TYPE_AUDIO); + priv->m_audio->buffer_size=0x100000; //16384; + priv->m_audio->source=sha; + priv->m_audio->codec=0; + if(!sha->wf) { + sha->wf=(WAVEFORMATEX*)mp_malloc(sizeof(WAVEFORMATEX)); + sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; + sha->wf->wFormatTag = sha->wtag; + sha->wf->nChannels = sha->nch; + sha->wf->nSamplesPerSec = sha->rate; + sha->wf->nAvgBytesPerSec=sha->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; + sha->wf->wBitsPerSample = 16; // FIXME + sha->wf->cbSize=0; // FIXME for l3codeca.acm + } + priv->m_audio->wf=(WAVEFORMATEX*)mp_malloc(sha->wf->cbSize+sizeof(WAVEFORMATEX)); + memcpy(priv->m_audio->wf,sha->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); + if(!sha->wf->cbSize && sha->codecdata_len) { + priv->m_audio->wf->cbSize=sha->wf->cbSize=sha->codecdata_len; + priv->m_audio->wf=(WAVEFORMATEX*)mp_realloc(priv->m_audio->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); + memcpy((char *)(priv->m_audio->wf+1),sha->codecdata,sha->codecdata_len); + } + if(!sha->i_bps) sha->i_bps=priv->m_audio->wf->nAvgBytesPerSec; + if(sha->audio.dwScale){ + priv->m_audio->h.dwSampleSize=sha->audio.dwSampleSize; + priv->m_audio->h.dwScale=sha->audio.dwScale; + priv->m_audio->h.dwRate=sha->audio.dwRate; + } else { + priv->m_audio->h.dwSampleSize=priv->m_audio->wf->nBlockAlign; + priv->m_audio->h.dwScale=priv->m_audio->h.dwSampleSize; + priv->m_audio->h.dwRate=priv->m_audio->wf->nAvgBytesPerSec; + } + } else priv->m_audio=NULL; + if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) { + priv->m_video=muxer_new_stream(priv->muxer,MUXER_TYPE_VIDEO); + priv->m_video->buffer_size=0x200000; // 2MB + priv->m_video->source=shv; + priv->m_video->h.dwSampleSize=0; // VBR + priv->m_video->h.dwScale=10000; + priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; + priv->m_video->h.dwSuggestedBufferSize=shv->video.dwSuggestedBufferSize; + if(!shv->bih) { + shv->bih=(BITMAPINFOHEADER*)mp_malloc(sizeof(BITMAPINFOHEADER)); + shv->bih->biSize=sizeof(BITMAPINFOHEADER); + shv->bih->biWidth=shv->src_w; + shv->bih->biHeight=shv->src_h; + shv->bih->biCompression=shv->fourcc; + shv->bih->biPlanes=1; + shv->bih->biBitCount=24; // FIXME!!! + shv->bih->biSizeImage=shv->bih->biWidth*shv->bih->biHeight*(shv->bih->biBitCount/8); + } + priv->m_video->bih=(BITMAPINFOHEADER*)mp_malloc(shv->bih->biSize); + memcpy(priv->m_video->bih,shv->bih,shv->bih->biSize); + priv->m_video->ImageDesc=shv->ImageDesc; + priv->m_video->aspect=shv->aspect; + priv->m_video->codec=0; + } else priv->m_video=NULL; + if(demuxer->sub->sh && (priv->mux_type&MUX_HAVE_SUBS)) { + priv->m_subs=muxer_new_stream(priv->muxer,MUXER_TYPE_SUBS); + priv->m_subs->buffer_size=0x100000; //16384; + priv->m_subs->source=NULL; + priv->m_subs->codec=0; + } else priv->m_subs=NULL; + MSG_DBG2("Opening dump: %X\n",demuxer); + MSG_INFO("Dumping stream to %s\n",stream_dump_name); + muxer_fix_parameters(priv->muxer); + muxer_write_header(priv->muxer,demuxer); +} + +void dump_mux_close(demuxer_t *demuxer) +{ + priv_t* priv=reinterpret_cast<priv_t*>(demuxer->priv); + demux_stream_t *d_audio=demuxer->audio; + demux_stream_t *d_video=demuxer->video; + sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(d_audio->sh); + sh_video_t* shv=reinterpret_cast<sh_video_t*>(d_video->sh); + if(priv) { + MSG_DBG2("Closing dump: %X %f secs\n" + "As video %X-%ix%i audio %X-%ix%ix%i\n" + ,demuxer,shv?priv->vtimer:sha->timer + ,priv->m_video?priv->m_video->bih->biCompression:-1 + ,priv->m_video?priv->m_video->bih->biWidth:-1 + ,priv->m_video?priv->m_video->bih->biHeight:-1 + ,priv->m_audio?priv->m_audio->wf->wFormatTag:-1 + ,priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1 + ,priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1 + ,priv->m_audio?priv->m_audio->wf->nChannels:-1); + if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) priv->m_video->source=shv; + if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) priv->m_audio->source=sha; + muxer_write_index(priv->muxer); + /* fixup avi header */ + if(shv) { + if(priv->vtimer) shv->fps=(float)priv->decoded_frameno/(priv->vtimer+priv->timer_corr); + if(priv->m_video) { + priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; + priv->m_video->h.dwSuggestedBufferSize=priv->vsize/priv->decoded_frameno; + MSG_V("Finishing vstream as: scale %u rate %u fps %f (frames=%u timer=%f)\n" + ,priv->m_video->h.dwScale + ,priv->m_video->h.dwRate + ,shv->fps + ,priv->decoded_frameno + ,priv->vtimer+priv->timer_corr); + } + } + if(sha) { + if(priv->m_audio) { + priv->m_audio->h.dwSuggestedBufferSize=priv->asize/priv->a_frameno; + MSG_V("Finishing astream as: scale %u rate %u (frames=%u timer=%f) avg=%i size=%u\n" + ,priv->m_audio->h.dwScale + ,priv->m_audio->h.dwRate + ,priv->a_frameno + ,sha->timer+priv->timer_corr + ,priv->m_audio->wf->nAvgBytesPerSec + ,priv->asize); + } + } + if(demuxer->sub->sh) { + if(priv->m_subs) MSG_V("Finishing sstream as\n"); + } + fseeko(priv->mux_file,0,SEEK_SET); + muxer_write_header(priv->muxer,demuxer); + fclose(priv->mux_file); + mp_free(demuxer->priv); + demuxer->priv=NULL; + } + MSG_INFO(MSGTR_CoreDumped); +} + + +void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames) +{ + priv_t* priv=reinterpret_cast<priv_t*>(demuxer->priv); + demux_stream_t *d_audio=demuxer->audio; + demux_stream_t *d_video=demuxer->video; + sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(d_audio->sh); + sh_video_t* shv=reinterpret_cast<sh_video_t*>(d_video->sh); + float frame_time,a_duration; + float mpeg_vtimer=HUGE,mpeg_atimer=HUGE; + unsigned char* start=NULL; + int in_size,aeof,veof,seof,cmd; + + if(!priv) return; + MP_UNIT("dump"); + priv->my_use_pts=use_pts; + /* test stream property */ + MSG_INFO("%s using PTS method\n",use_pts?"":"not"); + if(priv->m_video) + { + if(!shv) { MSG_ERR("Video not found!!!Skip this stream\n"); return; } + if(!shv->bih) { MSG_ERR("Video property not found!!!Skip this stream\n"); return; } + if(memcmp(shv->bih,priv->m_video->bih,sizeof(BITMAPINFOHEADER))!=0) + { + MSG_ERR("Found different video properties(%X-%ix%i)!=(%X-%ix%i)!!!\nSkip this stream\n", + shv->bih->biCompression,shv->bih->biWidth,shv->bih->biHeight, + priv->m_video->bih->biCompression,priv->m_video->bih->biWidth, + priv->m_video->bih->biHeight); + return; + } + priv->m_video->source=shv; + } + if(priv->m_audio) + { + if(!sha) { MSG_ERR("Audio not found!!!Skip this stream\n"); return; } + if(!sha->wf) { MSG_ERR("Audio property not found!!!Skip this stream\n"); return; } + if(memcmp(sha->wf,priv->m_audio->wf,sizeof(WAVEFORMATEX))!=0) + { + MSG_ERR("Found different audio properties(%X-%ix%ix%i)!=(%X-%ix%ix%i)X!!!\nSkip this stream\n", + sha->wf->wFormatTag,sha->wf->nSamplesPerSec,sha->wf->wBitsPerSample,sha->wf->nChannels, + priv->m_audio->wf->wFormatTag,priv->m_audio->wf->nSamplesPerSec, + priv->m_audio->wf->wBitsPerSample,priv->m_audio->wf->nChannels); + return; + } + priv->m_audio->source=sha; + } + if (seek_to_sec) { + float d; + float rel_seek_secs=0; + seek_args_t seek_p = { 0, 1}; + int a,b; + if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3) + rel_seek_secs += 3600*a +60*b +d ; + else if (sscanf(seek_to_sec, "%d:%f", &a, &d)==2) + rel_seek_secs += 60*a +d; + else if (sscanf(seek_to_sec, "%f", &d)==1) + rel_seek_secs += d; + + seek_to_sec = NULL; + MSG_INFO("seeking to %u seconds\n"); + seek_p.secs=rel_seek_secs; + demux_seek_r(demuxer,&seek_p); + } + aeof=sha?0:1; + veof=shv?0:1; + if(shv) priv->vtimer=0; + if(sha) sha->timer=0; + while(!(aeof && veof)){ + in_size=0; + if(sha && !aeof) + { + float a_pts; + while(sha->timer < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of audio reading */ + { + /* we should try to keep structure of audio packets here + and don't generate badly interlaved stream. + The ideal case is: type=read_packet(ANY_TYPE); put_packet(type); + */ + in_size=ds_get_packet_r(sha->ds,&start,&a_pts); + cmd = check_cmd(priv); + if(cmd == -1) goto done; + else + a_duration=(float)in_size/(float)(sha->i_bps); + if(mpeg_atimer==HUGE) mpeg_atimer=a_pts; + else + { + if( mpeg_atimer-a_duration<a_pts) mpeg_atimer=a_pts; + else mpeg_atimer+=a_duration; + } + if(use_pts) sha->timer=a_pts; + else sha->timer=mpeg_atimer; + MSG_V("Got audio frame: %f %u\n",a_pts,(!aeof)?priv->a_frameno:-1); + aeof=sha->ds->eof; + priv->a_frameno++; + if(aeof) break; + if(priv->m_audio) + { + priv->m_audio->buffer=start; + if(in_size>0) + { + MSG_V("put audio: %f %f %u\n",a_pts,sha->timer+priv->timer_corr,in_size); + if(priv->m_audio) + muxer_write_chunk(priv->m_audio,in_size,priv->m_video?0:AVIIF_KEYFRAME,sha->timer+priv->timer_corr); + } + if(!priv->m_audio->h.dwSampleSize && priv->m_audio->timer>0) + priv->m_audio->wf->nAvgBytesPerSec=0.5f+(double)priv->m_audio->size/priv->m_audio->timer; + } + priv->asize += in_size; + } + } + if(shv && !veof) + { + float v_pts; + in_size=video_read_frame(shv,&frame_time,&v_pts,&start,0); + cmd = check_cmd(priv); + if(cmd == -1) goto done; + else + if(mpeg_vtimer==HUGE) mpeg_vtimer=v_pts; + else + { + if( mpeg_vtimer-frame_time<v_pts ) mpeg_vtimer=v_pts; + else mpeg_vtimer+=frame_time; + } + if(use_pts) priv->vtimer=v_pts; + else priv->vtimer=mpeg_vtimer; + ++priv->decoded_frameno; + veof=shv->ds->eof; + MSG_V("Got video frame %f %i\n",v_pts,(!veof)?priv->decoded_frameno:-1); + if(priv->m_video) priv->m_video->buffer=start; + if(in_size>0) + { + MSG_V("put video: %f %f %u flg=%u\n",v_pts,priv->vtimer+priv->timer_corr,in_size,shv->ds->flags); + if(priv->m_video) muxer_write_chunk(priv->m_video,in_size,(shv->ds->flags&1)?AVIIF_KEYFRAME:0,priv->vtimer+priv->timer_corr); + priv->vsize += in_size; + } + if(!(priv->decoded_frameno%100)) + MSG_STATUS("Done %u frames\r",priv->decoded_frameno); + } + if(demuxer->sub->sh) + { + float s_pts=0; + while(s_pts < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of sub reading */ + { + in_size=ds_get_packet_r(demuxer->sub,&start,&s_pts); + seof=demuxer->sub->eof; + if(seof) break; + cmd = check_cmd(priv); + if(cmd == -1) goto done; + else + MSG_V("Got sub frame: %f\n",s_pts); + if(priv->m_subs) + { + priv->m_subs->buffer=start; + if(in_size>0) + { + MSG_V("put subs: %f %u\n",s_pts,in_size); + if(priv->m_subs) + muxer_write_chunk(priv->m_subs,in_size,priv->m_video?0:AVIIF_KEYFRAME,s_pts); + } + } + } + } + if(priv->decoded_frameno>play_n_frames) break; + } + done: + if(shv) priv->timer_corr+=priv->vtimer+frame_time; + else + { + if(sha) priv->timer_corr+=d_audio->pts; + if(priv->m_audio->wf->nAvgBytesPerSec) + priv->timer_corr+=((float)ds_tell_pts(d_audio))/((float)priv->m_audio->wf->nAvgBytesPerSec); + } + MSG_STATUS("Done %u frames (video(%X-%ix%i): %llu bytes audio(%X-%ix%ix%i): %llu bytes)\n" + ,priv->decoded_frameno + ,priv->m_video?priv->m_video->bih->biCompression:-1 + ,priv->m_video?priv->m_video->bih->biWidth:-1 + ,priv->m_video?priv->m_video->bih->biHeight:-1 + ,priv->vsize + ,priv->m_audio?priv->m_audio->wf->wFormatTag:-1 + ,priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1 + ,priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1 + ,priv->m_audio?priv->m_audio->wf->nChannels:-1 + ,priv->asize); +} Modified: mplayerxp/dump.h =================================================================== --- mplayerxp/dump.h 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/dump.h 2012-11-15 06:58:22 UTC (rev 370) @@ -1,7 +1,6 @@ /* dump.h - stream dumper interface */ - #ifndef DUMP_H_INCLUDED #define DUMP_H_INCLUDED 1 #include "libmpdemux/demuxer_r.h" Deleted: mplayerxp/mp-opt-reg.c =================================================================== --- mplayerxp/mp-opt-reg.c 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/mp-opt-reg.c 2012-11-15 06:58:22 UTC (rev 370) @@ -1,27 +0,0 @@ - -#include "mp_config.h" -#include <stdlib.h> -#include <stdio.h> -#include "libmpdemux/stream.h" -#include "libmpconf/cfgparser.h" - -extern void mp_input_register_options(m_config_t* cfg); -extern void libmpdemux_register_options(m_config_t* cfg); -extern void demuxer_register_options(m_config_t* cfg); -#ifdef HAVE_LIBCDIO -extern void cdda_register_options(m_config_t* cfg); -#endif -extern void libmpcodecs_ad_register_options(m_config_t* cfg); -extern void libmpcodecs_vd_register_options(m_config_t* cfg); - -void mp_register_options(m_config_t* cfg) -{ - mp_input_register_options(cfg); - libmpdemux_register_options(cfg); - demuxer_register_options(cfg); -#ifdef HAVE_LIBCDIO - cdda_register_options(cfg); -#endif - libmpcodecs_ad_register_options(cfg); - libmpcodecs_vd_register_options(cfg); -} Copied: mplayerxp/mp-opt-reg.cpp (from rev 369, mplayerxp/mp-opt-reg.c) =================================================================== --- mplayerxp/mp-opt-reg.cpp (rev 0) +++ mplayerxp/mp-opt-reg.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -0,0 +1,29 @@ +#include "mp_config.h" + +#include <stdlib.h> +#include <stdio.h> +#include "libmpdemux/stream.h" +#include "libmpconf/cfgparser.h" + +extern "C" { +extern void mp_input_register_options(m_config_t* cfg); +extern void libmpdemux_register_options(m_config_t* cfg); +extern void demuxer_register_options(m_config_t* cfg); +#ifdef HAVE_LIBCDIO +extern void cdda_register_options(m_config_t* cfg); +#endif +extern void libmpcodecs_ad_register_options(m_config_t* cfg); +extern void libmpcodecs_vd_register_options(m_config_t* cfg); +} + +extern "C" void mp_register_options(m_config_t* cfg) +{ + mp_input_register_options(cfg); + libmpdemux_register_options(cfg); + demuxer_register_options(cfg); +#ifdef HAVE_LIBCDIO + cdda_register_options(cfg); +#endif + libmpcodecs_ad_register_options(cfg); + libmpcodecs_vd_register_options(cfg); +} Deleted: mplayerxp/mp_msg.c =================================================================== --- mplayerxp/mp_msg.c 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/mp_msg.c 2012-11-15 06:58:22 UTC (rev 370) @@ -1,132 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <unistd.h> -#include <string.h> -#include <inttypes.h> -#include <pthread.h> -#include "mp_config.h" -#include "nls/nls.h" -#include "mp_msg.h" -#include "osdep/mplib.h" - -#define _bg(x) ((x) >> 4) -#define _fg(x) ((x) & 0x0f) -typedef struct priv_s { - int _color[8]; - char vtmp[100]; - char scol[9][20]; - pthread_mutex_t mp_msg_mutex; -}priv_t; -const char hl[9] = { 0xC, 0x4, 0xE, 0xA, 0xB, 0x7, 0x9, 0x3, 0x7 }; - -static char *_2ansi(unsigned char attr) -{ - priv_t*priv=mp_data->msg_priv; - int bg = _bg(attr); - int bc = priv->_color[bg & 7]; - - sprintf(priv->vtmp, - "\033[%d;3%d;4%d%sm", - _fg(attr) > 7, - priv->_color[_fg(attr) & 7], - bc, - bg > 7 ? ";5" : "" - ); - return priv->vtmp; -} - -void mp_msg_init(int verbose) -{ - pthread_mutexattr_t attr; - unsigned i; - int _color[8]={0,4,2,6,1,5,3,7}; - mp_data->msg_priv=mp_mallocz(sizeof(priv_t)); - priv_t*priv=mp_data->msg_priv; - memcpy(priv->_color,_color,sizeof(_color)); - pthread_mutexattr_init(&attr); - pthread_mutex_init(&priv->mp_msg_mutex,&attr); - pthread_mutexattr_destroy(&attr); - for(i=0;i<sizeof(hl)/sizeof(char);i++) - memcpy(priv->scol[i],_2ansi(hl[i]),sizeof(priv->scol[0])); -} - -void mp_msg_uninit(void) -{ - priv_t*priv=mp_data->msg_priv; - if(isatty(fileno(stderr))) fprintf(stderr,priv->scol[8]); - mp_msg_flush(); - pthread_mutex_destroy(&priv->mp_msg_mutex); - mp_free(priv); -} - -const char * msg_prefix[] = -{ - "GLOBAL", - "PLAYER", - "LIBVO", - "LIBAO", - "DEMUX", - "CFGPRS", - "DECAUD", - "DECVID", - "VOBSUB", - "OSDEP", - "SPUDEC", - "PLAYTR", - "INPUT", - "OSD", - "CPUDTC", - "CODCFG", - "SWS", - "FINDSB", - "SUBRDR", - "POSTPR" -}; - -int mp_msg_c( unsigned x, const char *format, ... ){ -/* TODO: more useful usage of module_id */ - int rc=0; - priv_t*priv=NULL; - va_list va; - char sbuf[0xFFFFF]; - unsigned ssize; - unsigned level=(x>>28)&0xF; - unsigned mod=x&0x0FFFFFFF; - static int was_eol=1; - if(mp_data) priv=mp_data->msg_priv; - if(level>mp_conf.verbose+MSGL_V-1) return 0; /* do not display */ - if((mod&mp_conf.msg_filter)==0) return 0; /* do not display */ - if(priv) { - pthread_mutex_lock(&priv->mp_msg_mutex); - if(isatty(fileno(stderr))) - fprintf(stderr,priv->scol[level<9?level:8]); - } - if(mp_conf.verbose>1 && was_eol) - { - unsigned mod_name; - const char *smod=NULL; - mod_name = 0; - while((mod&0x1)==0) { mod_name++; mod>>=1; } - if(mod_name < sizeof(msg_prefix)/sizeof(msg_prefix[0])) - smod = msg_prefix[mod_name]; - fprintf(stderr,"%s: ",smod?smod:"UNKNOWN"); - } - va_start(va, format); - ssize=vsprintf(sbuf,format, va); - va_end(va); - if(strcmp(nls_get_screen_cp(),"UTF-8")!=0) { - char *obuf; - obuf=nls_recode2screen_cp("UTF-8",sbuf,ssize); - rc=fputs(obuf,stderr); - mp_free(obuf); - } - else rc=fputs(sbuf,stderr); - if(format[strlen(format)-1]=='\n') was_eol=1; - else was_eol=0; - fflush(stderr); - if(priv) pthread_mutex_unlock(&priv->mp_msg_mutex); - return rc; -} - -void mp_msg_flush(void) { fflush(stderr); } Copied: mplayerxp/mp_msg.cpp (from rev 369, mplayerxp/mp_msg.c) =================================================================== --- mplayerxp/mp_msg.cpp (rev 0) +++ mplayerxp/mp_msg.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -0,0 +1,133 @@ +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <unistd.h> +#include <string.h> +#include <inttypes.h> +#include <pthread.h> +extern "C" { +#include "mp_config.h" +#include "nls/nls.h" +#include "mp_msg.h" +#include "osdep/mplib.h" +} +#define _bg(x) ((x) >> 4) +#define _fg(x) ((x) & 0x0f) +typedef struct priv_s { + int _color[8]; + char vtmp[100]; + char scol[9][20]; + pthread_mutex_t mp_msg_mutex; +}priv_t; +const char hl[9] = { 0xC, 0x4, 0xE, 0xA, 0xB, 0x7, 0x9, 0x3, 0x7 }; + +static char *_2ansi(unsigned char attr) +{ + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + int bg = _bg(attr); + int bc = priv->_color[bg & 7]; + + sprintf(priv->vtmp, + "\033[%d;3%d;4%d%sm", + _fg(attr) > 7, + priv->_color[_fg(attr) & 7], + bc, + bg > 7 ? ";5" : "" + ); + return priv->vtmp; +} + +void mp_msg_init(int verbose) +{ + pthread_mutexattr_t attr; + unsigned i; + int _color[8]={0,4,2,6,1,5,3,7}; + mp_data->msg_priv=mp_mallocz(sizeof(priv_t)); + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + memcpy(priv->_color,_color,sizeof(_color)); + pthread_mutexattr_init(&attr); + pthread_mutex_init(&priv->mp_msg_mutex,&attr); + pthread_mutexattr_destroy(&attr); + for(i=0;i<sizeof(hl)/sizeof(char);i++) + memcpy(priv->scol[i],_2ansi(hl[i]),sizeof(priv->scol[0])); +} + +void mp_msg_uninit(void) +{ + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + if(isatty(fileno(stderr))) fprintf(stderr,priv->scol[8]); + mp_msg_flush(); + pthread_mutex_destroy(&priv->mp_msg_mutex); + mp_free(priv); +} + +const char * msg_prefix[] = +{ + "GLOBAL", + "PLAYER", + "LIBVO", + "LIBAO", + "DEMUX", + "CFGPRS", + "DECAUD", + "DECVID", + "VOBSUB", + "OSDEP", + "SPUDEC", + "PLAYTR", + "INPUT", + "OSD", + "CPUDTC", + "CODCFG", + "SWS", + "FINDSB", + "SUBRDR", + "POSTPR" +}; + +int mp_msg_c( unsigned x, const char *format, ... ){ +/* TODO: more useful usage of module_id */ + int rc=0; + priv_t*priv=NULL; + va_list va; + char sbuf[0xFFFFF]; + unsigned ssize; + unsigned level=(x>>28)&0xF; + unsigned mod=x&0x0FFFFFFF; + static int was_eol=1; + if(mp_data) priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + if(level>mp_conf.verbose+MSGL_V-1) return 0; /* do not display */ + if((mod&mp_conf.msg_filter)==0) return 0; /* do not display */ + if(priv) { + pthread_mutex_lock(&priv->mp_msg_mutex); + if(isatty(fileno(stderr))) + fprintf(stderr,priv->scol[level<9?level:8]); + } + if(mp_conf.verbose>1 && was_eol) + { + unsigned mod_name; + const char *smod=NULL; + mod_name = 0; + while((mod&0x1)==0) { mod_name++; mod>>=1; } + if(mod_name < sizeof(msg_prefix)/sizeof(msg_prefix[0])) + smod = msg_prefix[mod_name]; + fprintf(stderr,"%s: ",smod?smod:"UNKNOWN"); + } + va_start(va, format); + ssize=vsprintf(sbuf,format, va); + va_end(va); + if(strcmp(nls_get_screen_cp(),"UTF-8")!=0) { + char *obuf; + obuf=nls_recode2screen_cp("UTF-8",sbuf,ssize); + rc=fputs(obuf,stderr); + mp_free(obuf); + } + else rc=fputs(sbuf,stderr); + if(format[strlen(format)-1]=='\n') was_eol=1; + else was_eol=0; + fflush(stderr); + if(priv) pthread_mutex_unlock(&priv->mp_msg_mutex); + return rc; +} + +void mp_msg_flush(void) { fflush(stderr); } Modified: mplayerxp/mp_msg.h =================================================================== --- mplayerxp/mp_msg.h 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/mp_msg.h 2012-11-15 06:58:22 UTC (rev 370) @@ -3,6 +3,9 @@ #include "mplayerxp.h" +#ifdef __cplusplus +extern "C" { +#endif // verbosity elevel: // stuff from level MSGL_FATAL-MSGL_HINT should be translated. @@ -111,7 +114,9 @@ #define MSG_DBG2(args...) #define MSG_DBG3(args...) #endif - #endif // __va_arg_pack +#ifdef __cplusplus +} +#endif #endif // __MP_MSG_H Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/mplayerxp.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -66,7 +66,6 @@ #include "osdep/mm_accel.h" #include "input2/input.h" -#include "dump.h" #include "nls/nls.h" #include "postproc/libmenu/menu.h" #include "libao2/mixer.h" @@ -78,6 +77,7 @@ #define MSGT_CLASS MSGT_CPLAYER #include "mp_msg.h" } // extern "C" +#include "dump.h" /************************************************************************** Private data **************************************************************************/ @@ -199,7 +199,7 @@ mp_data->use_pts_fix2=-1; mp_data->rtc_fd=-1; mp_data->priv=mp_mallocz(sizeof(priv_t)); - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); priv->osd_function=OSD_PLAY; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) memset(&x86,-1,sizeof(x86_features_t)); @@ -245,14 +245,14 @@ } void uninit_player(unsigned int mask){ - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); stream_t* stream=NULL; sh_audio_t* sh_audio=NULL; sh_video_t* sh_video=NULL; if(priv->demuxer) { stream=priv->demuxer->stream; - sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); } fflush(stdout); fflush(stderr); @@ -414,7 +414,7 @@ // The function return a new value for eof. static int libmpdemux_was_interrupted(int eof) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); mp_cmd_t* cmd; if((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) { switch(cmd->id) { @@ -562,7 +562,7 @@ } extern "C" void show_long_help(void) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); m_config_show_options(mp_data->mconfig); mp_input_print_binds(priv->libinput); print_stream_drivers(); @@ -591,7 +591,7 @@ //================= Update OSD ==================== void update_osd( float v_pts ) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); static char osd_text_buffer[64]; static int osd_last_pts=-303; //================= Update OSD ==================== @@ -635,9 +635,9 @@ void mpxp_seek( osd_args_t *osd,const seek_args_t* seek) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); demux_stream_t *d_dvdsub=priv->demuxer->sub; int seek_rval=1; xp_core->audio->eof=0; @@ -706,8 +706,8 @@ void mpxp_reset_vcache(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); seek_args_t seek = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; if(sh_video) mpxp_seek(NULL,&seek); return; @@ -715,8 +715,8 @@ void mpxp_resync_audio_stream(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); mpca_resync_stream(sh_audio->decoder); } @@ -768,8 +768,8 @@ static void show_benchmark_status(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); if(xmp_test_model(XMP_Run_AudioPlayback)) MSG_STATUS("A:%6.1f %4.1f%%\r" ,sh_audio->timer-ao_get_delay(ao_data) @@ -788,7 +788,7 @@ static void mpxp_init_keyboard_fifo(void) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); #ifdef HAVE_TERMCAP load_termcap(NULL); // load key-codes #endif @@ -799,7 +799,7 @@ } void mplayer_put_key(int code){ - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); mp_cmd_t* cmd; cmd=mp_input_get_cmd_from_keys(priv->libinput,1,&code); mp_input_queue_cmd(priv->libinput,cmd); @@ -838,7 +838,7 @@ } static char * mpxp_init_output_subsystems(void) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); char* rs=NULL; unsigned i; // check video_out driver name: @@ -883,7 +883,7 @@ } static int mpxp_init_vobsub(const char *filename) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); int forced_subs_only=0; MP_UNIT("vobsub"); if (mp_conf.vobsub_name){ @@ -912,7 +912,7 @@ } static int mpxp_handle_playlist(const char *filename) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); stream_t* stream=priv->demuxer->stream; int eof=0; play_tree_t* entry; @@ -949,7 +949,7 @@ static void mpxp_init_dvd_nls(void) { /* Add NLS support here */ - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); stream_t* stream=priv->demuxer->stream; char *lang; if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(); @@ -973,9 +973,9 @@ } static void mpxp_print_stream_formats(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); int fmt; char *c; MSG_INFO("[Stream]:"); @@ -1002,14 +1002,14 @@ } static void mpxp_read_video_properties(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); demux_stream_t *d_video=priv->demuxer->video; MP_UNIT("video_read_properties"); if(!video_read_properties(sh_video)) { MSG_ERR("Video: can't read properties\n"); d_video->sh=NULL; - sh_video=(sh_video_t*)d_video->sh; + sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); } else { MSG_V("[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", priv->demuxer->file_format,sh_video->fourcc, sh_video->src_w,sh_video->src_h, @@ -1023,14 +1023,14 @@ if(!sh_video->fps && !mp_conf.force_fps){ MSG_ERR(MSGTR_FPSnotspecified); d_video->sh=NULL; - sh_video=(sh_video_t*)d_video->sh; + sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); } } } static void mpxp_read_subtitles(const char *filename,int forced_subs_only,int stream_dump_type) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); stream_t* stream=priv->demuxer->stream; if (mp_conf.spudec_ifo) { unsigned int palette[16], width, height; @@ -1080,8 +1080,8 @@ static void mpxp_find_acodec(void) { int found=0; any_t* mpca=0; - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); demux_stream_t *d_audio=priv->demuxer->audio; sh_audio->codec=NULL; mpca=RND_RENAME2(mpca_init)(sh_audio); // try auto-probe first @@ -1125,14 +1125,14 @@ MSG_ERR(" 0x%08X!\n",sh_audio->wtag); MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); d_audio->sh=NULL; - sh_audio=(sh_audio_t*)d_audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } } static MPXP_Rc mpxp_find_vcodec(void) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); demux_stream_t *d_video=priv->demuxer->video; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); MPXP_Rc rc=MPXP_Ok; MP_UNIT("init_video_codec"); sh_video->inited=0; @@ -1175,7 +1175,7 @@ MSG_ERR(" 0x%08X!\n",sh_video->fourcc); MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); d_video->sh = NULL; - sh_video = (sh_video_t*)d_video->sh; + sh_video = reinterpret_cast<sh_video_t*>(d_video->sh); rc=MPXP_False; } else priv->inited_flags|=INITED_VCODEC; @@ -1186,9 +1186,9 @@ } static int mpxp_configure_audio(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); demux_stream_t *d_audio=priv->demuxer->audio; int rc=0; const ao_info_t *info=ao_get_info(ao_data); @@ -1233,7 +1233,7 @@ ao_data->channels,ao_data->format)) { MSG_ERR("Can't configure audio device\n"); d_audio->sh=NULL; - sh_audio=(sh_audio_t*)d_audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); if(sh_video == NULL) rc=-1; } else { priv->inited_flags|=INITED_AO; @@ -1250,9 +1250,9 @@ } static void mpxp_run_ahead_engine(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); MP_UNIT("init_xp"); if(sh_video && xp_core->num_v_buffs < 3) {/* we need at least 3 buffers to suppress screen judering */ MSG_FATAL("Not enough buffers for DECODING AHEAD!\nNeed %u buffers but exist only %u\n",3,xp_core->num_v_buffs); @@ -1270,8 +1270,8 @@ } static void mpxp_print_audio_status(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); /* PAINT audio OSD */ unsigned ipts,rpts; unsigned char h,m,s,rh,rm,rs; @@ -1296,10 +1296,10 @@ #ifdef USE_OSD static int mpxp_paint_osd(int* osd_visible,int* in_pause) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); const stream_t* stream=priv->demuxer->stream; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); int rc=0; if(*osd_visible) { if (!--(*osd_visible)) { @@ -1373,7 +1373,7 @@ }input_state_t; static int mpxp_handle_input(seek_args_t* seek,osd_args_t* osd,input_state_t* state) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); stream_t* stream=priv->demuxer->stream; sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); int v_bright=0; @@ -1806,8 +1806,8 @@ sh_audio_t* sh_audio; sh_video_t* sh_video; - sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); mpxp_print_stream_formats(); @@ -1827,7 +1827,7 @@ MP_UNIT("init_audio_codec"); if(sh_audio) mpxp_find_acodec(); - sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); if(stream_dump_type>1) { dump_mux_init(priv->demuxer,priv->libinput); @@ -1837,7 +1837,7 @@ if(!(ao_data=RND_RENAME5(ao_init)(ao_subdevice))) { MSG_ERR(MSGTR_CannotInitAO); d_audio->sh=NULL; - sh_audio=(sh_audio_t*)d_audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } if(ao_subdevice) mp_free(ao_subdevice); priv->ao_inited=RND_RENAME4(ao_register)(ao_data,mp_conf.audio_driver,0); @@ -1852,7 +1852,7 @@ if(RND_RENAME2(mpca_init)(sh_audio)==NULL){ MSG_ERR(MSGTR_CouldntInitAudioCodec); d_audio->sh=NULL; - sh_audio=(sh_audio_t*)d_audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } } if(sh_audio) { @@ -1878,7 +1878,7 @@ sh_video->vfilter_inited=1; } if((mpxp_find_vcodec())!=MPXP_Ok) { - sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); if(!sh_audio) goto goto_next_file; goto main; } Modified: mplayerxp/xmpcore/xmp_adecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -378,9 +378,9 @@ volatile float dec_ahead_audio_delay; int xp_thread_decode_audio(demux_stream_t *d_audio) { - sh_audio_t* sh_audio=(sh_audio_t*)xp_core->audio->sh; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(xp_core->audio->sh); sh_video_t* sh_video=NULL; - if(xp_core->video) sh_video=(sh_video_t*)xp_core->video->sh; + if(xp_core->video) sh_video=reinterpret_cast<sh_video_t*>(xp_core->video->sh); int free_buf, vbuf_size, pref_buf; unsigned len=0; @@ -419,8 +419,8 @@ /* this routine decodes audio only */ any_t* a_dec_ahead_routine( any_t* arg ) { - mpxp_thread_t* priv=(mpxp_thread_t*)arg; - sh_audio_t* sh_audio=(sh_audio_t*)priv->dae->sh; + mpxp_thread_t* priv=reinterpret_cast<mpxp_thread_t*>(arg); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->dae->sh); demux_stream_t *d_audio=sh_audio->ds; int ret; Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -128,11 +128,11 @@ extern ao_data_t* ao_data; any_t* audio_play_routine( any_t* arg ) { - mpxp_thread_t* priv=(mpxp_thread_t*)arg; - sh_audio_t* sh_audio=(sh_audio_t*)priv->dae->sh; + mpxp_thread_t* priv=reinterpret_cast<mpxp_thread_t*>(arg); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->dae->sh); demux_stream_t *d_audio=sh_audio->ds; demuxer_t *demuxer=d_audio->demuxer; - sh_video_t* sh_video=(sh_video_t*)demuxer->video->sh; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(demuxer->video->sh); int eof = 0; struct timeval now; Modified: mplayerxp/xmpcore/xmp_vdecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -111,8 +111,8 @@ any_t* xmp_video_decoder( any_t* arg ) { - mpxp_thread_t* priv=(mpxp_th... [truncated message content] |
From: <nic...@us...> - 2012-11-15 14:34:55
|
Revision: 374 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=374&view=rev Author: nickols_k Date: 2012-11-15 14:34:45 +0000 (Thu, 15 Nov 2012) Log Message: ----------- rename mp_data ->MPXPCtx Modified Paths: -------------- mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_faad.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd_dshow.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libplaytree/asxparser.c mplayerxp/mp_msg.cpp mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-11-15 14:34:45 UTC (rev 374) @@ -155,7 +155,7 @@ float pts; int flags=0; /* Dolby AC3 audio:*/ - mpxp_a52_accel = mp_data->mplayer_accel; + mpxp_a52_accel = MPXPCtx->mplayer_accel; mpxp_a52_state=a52_init (mpxp_a52_accel); if (mpxp_a52_state == NULL) { MSG_ERR("A52 init failed\n"); Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-11-15 14:34:45 UTC (rev 374) @@ -155,7 +155,7 @@ float pts; int flags=0; /* Dolby AC3 audio:*/ - mpxp_dca_accel = mp_data->mplayer_accel; + mpxp_dca_accel = MPXPCtx->mplayer_accel; mpxp_dca_state = dca_init(mpxp_dca_accel); if (mpxp_dca_state == NULL) { MSG_ERR("dca init failed\n"); Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpcodecs/ad_faad.c 2012-11-15 14:34:45 UTC (rev 374) @@ -193,7 +193,7 @@ float pts; int NeAAC_init; NeAACDecConfigurationPtr NeAAC_conf; - if(!(NeAAC_hdec = NeAACDecOpen(mp_data->mplayer_accel))) { + if(!(NeAAC_hdec = NeAACDecOpen(MPXPCtx->mplayer_accel))) { MSG_WARN("FAAD: Failed to open the decoder!\n"); // XXX: deal with cleanup! return MPXP_False; } Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-15 14:34:45 UTC (rev 374) @@ -305,11 +305,11 @@ t2=GetTimer();t=t2-t; tt = t*0.000001f; - mp_data->bench->video+=tt; + MPXPCtx->bench->video+=tt; if(mp_conf.benchmark || mp_conf.frame_dropping) { - if(tt > mp_data->bench->max_video) mp_data->bench->max_video=tt; - if(tt < mp_data->bench->min_video) mp_data->bench->min_video=tt; - mp_data->bench->cur_video=tt; + if(tt > MPXPCtx->bench->max_video) MPXPCtx->bench->max_video=tt; + if(tt < MPXPCtx->bench->min_video) MPXPCtx->bench->min_video=tt; + MPXPCtx->bench->cur_video=tt; } if(frame->flags) return 0; @@ -318,12 +318,12 @@ t2=GetTimer()-t2; tt=t2*0.000001f; - mp_data->bench->vout+=tt; + MPXPCtx->bench->vout+=tt; if(mp_conf.benchmark || mp_conf.frame_dropping) { - if(tt > mp_data->bench->max_vout) mp_data->bench->max_vout = tt; - if(tt < mp_data->bench->min_vout) mp_data->bench->min_vout = tt; - mp_data->bench->cur_vout=tt; + if(tt > MPXPCtx->bench->max_vout) MPXPCtx->bench->max_vout = tt; + if(tt < MPXPCtx->bench->min_vout) MPXPCtx->bench->min_vout = tt; + MPXPCtx->bench->cur_vout=tt; } return 1; @@ -345,12 +345,12 @@ demux_stream_t *d_dvdsub=sh_video->ds->demuxer->sub; #ifdef USE_SUB // find sub - if(mp_data->subtitles && v_pts>0){ + if(MPXPCtx->subtitles && v_pts>0){ float pts=v_pts; if(mp_conf.sub_fps==0) mp_conf.sub_fps=sh_video->fps; MP_UNIT("find_sub"); if (pts > sub_last_pts || pts < sub_last_pts-1.0 ) { - find_sub(mp_data->subtitles,sub_uses_time?(100*pts):(pts*mp_conf.sub_fps),vo_data); // FIXME! frame counter... + find_sub(MPXPCtx->subtitles,sub_uses_time?(100*pts):(pts*mp_conf.sub_fps),vo_data); // FIXME! frame counter... sub_last_pts = pts; } MP_UNIT(NULL); Modified: mplayerxp/libmpcodecs/vd_dshow.c =================================================================== --- mplayerxp/libmpcodecs/vd_dshow.c 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpcodecs/vd_dshow.c 2012-11-15 14:34:45 UTC (rev 374) @@ -87,7 +87,7 @@ default: DS_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR } - DS_SetAttr_DivX("Quality",mp_data->output_quality); + DS_SetAttr_DivX("Quality",MPXPCtx->output_quality); DS_VideoDecoder_StartInternal(sh->context); MSG_V("INFO: Win32/DShow init OK!\n"); return MPXP_Ok; Modified: mplayerxp/libmpcodecs/vd_libmpeg2.c =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-11-15 14:34:45 UTC (rev 374) @@ -261,7 +261,7 @@ priv_t *priv; if(!load_lib("libmpeg2"SLIBSUFFIX)) return MPXP_False; priv=sh->context=mp_malloc(sizeof(priv_t)); - if(!(priv->mpeg2dec=mpeg2_init(mp_data->mplayer_accel))) return MPXP_False; + if(!(priv->mpeg2dec=mpeg2_init(MPXPCtx->mplayer_accel))) return MPXP_False; return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,libinput); } Modified: mplayerxp/libmpcodecs/vd_vfw.c =================================================================== --- mplayerxp/libmpcodecs/vd_vfw.c 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpcodecs/vd_vfw.c 2012-11-15 14:34:45 UTC (rev 374) @@ -172,7 +172,7 @@ // avi_header.our_in_buffer=mp_malloc(avi_header.video.dwSuggestedBufferSize); // FIXME!!!! - ICSendMessage(priv->hic, ICM_USER+80, (long)(&mp_data->output_quality), 0); + ICSendMessage(priv->hic, ICM_USER+80, (long)(&MPXPCtx->output_quality), 0); // don't do this palette mess always, it makes div3 dll crashing... if(sh_video->codec->outfmt[sh_video->outfmtidx]==IMGFMT_BGR8){ Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpdemux/cache2.c 2012-11-15 14:34:45 UTC (rev 374) @@ -258,9 +258,9 @@ if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; tt = t*0.000001f; - mp_data->bench->c2+=tt; - if(tt > mp_data->bench->max_c2) mp_data->bench->max_c2=tt; - if(tt < mp_data->bench->min_c2) mp_data->bench->min_c2=tt; + MPXPCtx->bench->c2+=tt; + if(tt > MPXPCtx->bench->max_c2) MPXPCtx->bench->max_c2=tt; + if(tt < MPXPCtx->bench->min_c2) MPXPCtx->bench->min_c2=tt; } if(!cfill) usleep(FILL_USLEEP_TIME); // idle if(priv->state==Pth_Canceling) break; Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-11-15 14:34:45 UTC (rev 374) @@ -624,7 +624,7 @@ if(!ad) MSG_WARN("Failed to open audio demuxer: %s\n",audio_stream); else if(ad->audio->sh && ((sh_audio_t*)ad->audio->sh)->wtag == 0x55) // MP3 - m_config_set_flag(mp_data->mconfig,"mp3.hr-seek",1); // Enable high res seeking + m_config_set_flag(MPXPCtx->mconfig,"mp3.hr-seek",1); // Enable high res seeking } if(ss) { sd = demux_open_stream(ss,sub_demuxer_type ? sub_demuxer_type : sfmt,-2,-2,dvdsub_id); Modified: mplayerxp/libmpdemux/demuxer_r.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_r.cpp 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libmpdemux/demuxer_r.cpp 2012-11-15 14:34:45 UTC (rev 374) @@ -86,10 +86,10 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - mp_data->bench->demux+=tt; - mp_data->bench->audio_decode_correction=tt; - if(tt > mp_data->bench->max_demux) mp_data->bench->max_demux=tt; - if(tt < mp_data->bench->min_demux) mp_data->bench->min_demux=tt; + MPXPCtx->bench->demux+=tt; + MPXPCtx->bench->audio_decode_correction=tt; + if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; + if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -114,9 +114,9 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - mp_data->bench->demux+=tt; - if(tt > mp_data->bench->max_demux) mp_data->bench->max_demux=tt; - if(tt < mp_data->bench->min_demux) mp_data->bench->min_demux=tt; + MPXPCtx->bench->demux+=tt; + if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; + if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; } UNLOCK_DEMUXER(); return frame; @@ -137,10 +137,10 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - mp_data->bench->demux+=tt; - mp_data->bench->audio_decode_correction=tt; - if(tt > mp_data->bench->max_demux) mp_data->bench->max_demux=tt; - if(tt < mp_data->bench->min_demux) mp_data->bench->min_demux=tt; + MPXPCtx->bench->demux+=tt; + MPXPCtx->bench->audio_decode_correction=tt; + if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; + if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -161,10 +161,10 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - mp_data->bench->demux+=tt; - mp_data->bench->audio_decode_correction=tt; - if(tt > mp_data->bench->max_demux) mp_data->bench->max_demux=tt; - if(tt < mp_data->bench->min_demux) mp_data->bench->min_demux=tt; + MPXPCtx->bench->demux+=tt; + MPXPCtx->bench->audio_decode_correction=tt; + if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; + if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -192,9 +192,9 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - mp_data->bench->demux+=tt; - if(tt > mp_data->bench->max_demux) mp_data->bench->max_demux=tt; - if(tt < mp_data->bench->min_demux) mp_data->bench->min_demux=tt; + MPXPCtx->bench->demux+=tt; + if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; + if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; } UNLOCK_DEMUXER(); return retval; Modified: mplayerxp/libplaytree/asxparser.c =================================================================== --- mplayerxp/libplaytree/asxparser.c 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/libplaytree/asxparser.c 2012-11-15 14:34:45 UTC (rev 374) @@ -445,7 +445,7 @@ return; } val = asx_get_attrib("VALUE",attribs); - if(m_config_get_option(mp_data->mconfig,name) == NULL) { + if(m_config_get_option(MPXPCtx->mconfig,name) == NULL) { MSG_WARN("Found unknow param in asx: %s",name); if(val) MSG_WARN("=%s\n",val); Modified: mplayerxp/mp_msg.cpp =================================================================== --- mplayerxp/mp_msg.cpp 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/mp_msg.cpp 2012-11-15 14:34:45 UTC (rev 374) @@ -23,7 +23,7 @@ static char *_2ansi(unsigned char attr) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->msg_priv); int bg = _bg(attr); int bc = priv->_color[bg & 7]; @@ -42,7 +42,7 @@ unsigned i; int _color[8]={0,4,2,6,1,5,3,7}; priv_t*priv=new priv_t; - mp_data->msg_priv=priv; + MPXPCtx->msg_priv=priv; memcpy(priv->_color,_color,sizeof(_color)); pthread_mutex_init(&priv->mp_msg_mutex,NULL); for(i=0;i<sizeof(hl)/sizeof(char);i++) memcpy(priv->scol[i],_2ansi(hl[i]),sizeof(priv->scol[0])); @@ -50,7 +50,7 @@ void mpxp_print_uninit(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->msg_priv); if(isatty(fileno(stderr))) fprintf(stderr,priv->scol[8]); mpxp_print_flush(); pthread_mutex_destroy(&priv->mp_msg_mutex); @@ -90,7 +90,7 @@ unsigned mod=x&0x0FFFFFFF; static int was_eol=1; priv_t*priv=NULL; - if(mp_data) priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + if(MPXPCtx) priv=reinterpret_cast<priv_t*>(MPXPCtx->msg_priv); if(level>mp_conf.verbose+MSGL_V-1) return 0; /* do not display */ if((mod&mp_conf.msg_filter)==0) return 0; /* do not display */ if(priv) { Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/mplayerxp.cpp 2012-11-15 14:34:45 UTC (rev 374) @@ -157,7 +157,7 @@ mp_conf_t mp_conf; static volatile char antiviral_hole2[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; -mp_data_t* mp_data=NULL; +MPXPContext_t* MPXPCtx=NULL; xp_core_t* xp_core=NULL; static volatile char antiviral_hole3[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; volatile MPXPSecureKeys* secure_keys; @@ -206,13 +206,13 @@ } static void mpxp_init_structs(void) { - mp_data=new(zeromem) mp_data_t; - mp_data->seek_time=-1; - mp_data->bench=new(zeromem) time_usage_t; - mp_data->use_pts_fix2=-1; - mp_data->rtc_fd=-1; - mp_data->priv=new(zeromem)priv_t; - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + MPXPCtx=new(zeromem) MPXPContext_t; + MPXPCtx->seek_time=-1; + MPXPCtx->bench=new(zeromem) time_usage_t; + MPXPCtx->use_pts_fix2=-1; + MPXPCtx->rtc_fd=-1; + MPXPCtx->priv=new(zeromem)priv_t; + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); priv->osd_function=OSD_PLAY; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) memset(&x86,-1,sizeof(x86_features_t)); @@ -247,18 +247,18 @@ #ifdef ENABLE_WIN32LOADER free_codec_cfg(); #endif - delete mp_data->bench; - delete reinterpret_cast<priv_t*>(mp_data->priv); - delete mp_data; + delete MPXPCtx->bench; + delete reinterpret_cast<priv_t*>(MPXPCtx->priv); + delete MPXPCtx; if(vo_data) mp_free(vo_data); if(ao_data) mp_free(ao_data); - mp_data=NULL; + MPXPCtx=NULL; xmp_uninit(); mp_uninit_malloc(mp_conf.verbose); } void uninit_player(unsigned int mask){ - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); stream_t* stream=NULL; sh_audio_t* sh_audio=NULL; sh_video_t* sh_video=NULL; @@ -344,10 +344,10 @@ priv->inited_flags&=~INITED_SUBTITLE; MP_UNIT("sub_free"); mp_input_close(priv->libinput); - sub_free( mp_data->subtitles ); + sub_free( MPXPCtx->subtitles ); mp_conf.sub_name=NULL; vo_data->sub=NULL; - mp_data->subtitles=NULL; + MPXPCtx->subtitles=NULL; } #endif MP_UNIT(NULL); @@ -362,7 +362,7 @@ MP_UNIT("exit_player"); if(why) MSG_HINT(MSGTR_Exiting,why); - if(mp_data->mconfig) m_config_free(mp_data->mconfig); + if(MPXPCtx->mconfig) m_config_free(MPXPCtx->mconfig); mpxp_print_uninit(); mpxp_uninit_structs(); if(why) exit(0); @@ -426,7 +426,7 @@ // The function return a new value for eof. static int libmpdemux_was_interrupted(int eof) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); mp_cmd_t* cmd; if((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) { switch(cmd->id) { @@ -496,12 +496,12 @@ gCpuCaps.hasAES, gCpuCaps.hasAVX, gCpuCaps.hasFMA); - if(gCpuCaps.hasMMX) mp_data->mplayer_accel |= MM_ACCEL_X86_MMX; - if(gCpuCaps.hasMMX2) mp_data->mplayer_accel |= MM_ACCEL_X86_MMXEXT; - if(gCpuCaps.hasSSE) mp_data->mplayer_accel |= MM_ACCEL_X86_SSE; - if(gCpuCaps.has3DNow) mp_data->mplayer_accel |= MM_ACCEL_X86_3DNOW; - if(gCpuCaps.has3DNowExt) mp_data->mplayer_accel |= MM_ACCEL_X86_3DNOWEXT; - MSG_V("mp_data->mplayer_accel=%i\n",mp_data->mplayer_accel); + if(gCpuCaps.hasMMX) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_MMX; + if(gCpuCaps.hasMMX2) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_MMXEXT; + if(gCpuCaps.hasSSE) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_SSE; + if(gCpuCaps.has3DNow) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_3DNOW; + if(gCpuCaps.has3DNowExt) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_3DNOWEXT; + MSG_V("MPXPCtx->mplayer_accel=%i\n",MPXPCtx->mplayer_accel); } #endif @@ -574,8 +574,8 @@ } extern "C" void show_long_help(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); - m_config_show_options(mp_data->mconfig); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + m_config_show_options(MPXPCtx->mconfig); mp_input_print_binds(priv->libinput); print_stream_drivers(); vo_print_help(vo_data); @@ -603,7 +603,7 @@ //================= Update OSD ==================== void update_osd( float v_pts ) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); static char osd_text_buffer[64]; static int osd_last_pts=-303; //================= Update OSD ==================== @@ -647,7 +647,7 @@ void mpxp_seek( osd_args_t *osd,const seek_args_t* seek) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); demux_stream_t *d_dvdsub=priv->demuxer->sub; @@ -655,10 +655,10 @@ xp_core->audio->eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { seek_rval=demux_seek_r(priv->demuxer,seek); - mp_data->mpxp_after_seek=25; /* 1 sec delay */ + MPXPCtx->mpxp_after_seek=25; /* 1 sec delay */ } if(seek_rval){ - mp_data->seek_time = GetTimerMS(); + MPXPCtx->seek_time = GetTimerMS(); // success: /* FIXME there should be real seeking for vobsub */ @@ -704,7 +704,7 @@ if(sh_video) { max_pts_correction=0.1; if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; // to rewert to PLAY pointer after 1 sec - mp_data->bench->audio=0; mp_data->bench->audio_decode=0; mp_data->bench->video=0; mp_data->bench->vout=0; + MPXPCtx->bench->audio=0; MPXPCtx->bench->audio_decode=0; MPXPCtx->bench->video=0; MPXPCtx->bench->vout=0; if(vo_data->spudec) { unsigned char* packet=NULL; while(ds_get_packet_sub_r(d_dvdsub,&packet)>0) ; // Empty stream @@ -718,7 +718,7 @@ void mpxp_reset_vcache(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); seek_args_t seek = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; if(sh_video) mpxp_seek(NULL,&seek); @@ -727,7 +727,7 @@ void mpxp_resync_audio_stream(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); mpca_resync_stream(sh_audio->decoder); } @@ -739,39 +739,39 @@ static void init_benchmark(void) { - mp_data->bench->max_audio=0; mp_data->bench->max_video=0; mp_data->bench->max_vout=0; - mp_data->bench->min_audio=HUGE; mp_data->bench->min_video=HUGE; mp_data->bench->min_vout=HUGE; + MPXPCtx->bench->max_audio=0; MPXPCtx->bench->max_video=0; MPXPCtx->bench->max_vout=0; + MPXPCtx->bench->min_audio=HUGE; MPXPCtx->bench->min_video=HUGE; MPXPCtx->bench->min_vout=HUGE; - mp_data->bench->min_audio_decode=HUGE; - mp_data->bench->max_audio_decode=0; + MPXPCtx->bench->min_audio_decode=HUGE; + MPXPCtx->bench->max_audio_decode=0; - mp_data->bench->max_demux=0; - mp_data->bench->demux=0; - mp_data->bench->min_demux=HUGE; + MPXPCtx->bench->max_demux=0; + MPXPCtx->bench->demux=0; + MPXPCtx->bench->min_demux=HUGE; - mp_data->bench->cur_video=0; - mp_data->bench->cur_vout=0; - mp_data->bench->cur_audio=0; + MPXPCtx->bench->cur_video=0; + MPXPCtx->bench->cur_vout=0; + MPXPCtx->bench->cur_audio=0; } static void show_benchmark(void) { - double tot=(mp_data->bench->video+mp_data->bench->vout+mp_data->bench->audio+mp_data->bench->audio_decode+mp_data->bench->demux+mp_data->bench->c2); + double tot=(MPXPCtx->bench->video+MPXPCtx->bench->vout+MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode+MPXPCtx->bench->demux+MPXPCtx->bench->c2); double total_time_usage; - mp_data->bench->total_start=GetTimer()-mp_data->bench->total_start; - total_time_usage = (float)mp_data->bench->total_start*0.000001; + MPXPCtx->bench->total_start=GetTimer()-MPXPCtx->bench->total_start; + total_time_usage = (float)MPXPCtx->bench->total_start*0.000001; MSG_INFO("\nAVE BENCHMARKs: VC:%8.3fs VO:%8.3fs A:%8.3fs D:%8.3fs = %8.4fs C:%8.3fs\n", - mp_data->bench->video,mp_data->bench->vout,mp_data->bench->audio+mp_data->bench->audio_decode, - mp_data->bench->demux,mp_data->bench->c2,tot); + MPXPCtx->bench->video,MPXPCtx->bench->vout,MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode, + MPXPCtx->bench->demux,MPXPCtx->bench->c2,tot); if(total_time_usage>0.0) MSG_INFO("AVE BENCHMARK%%: VC:%8.4f%% VO:%8.4f%% A:%8.4f%% D:%8.4f%% C:%8.4f%% = %8.4f%%\n", - 100.0*mp_data->bench->video/total_time_usage, - 100.0*mp_data->bench->vout/total_time_usage, - 100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/total_time_usage, - 100.0*mp_data->bench->demux/total_time_usage, - 100.0*mp_data->bench->c2/total_time_usage, + 100.0*MPXPCtx->bench->video/total_time_usage, + 100.0*MPXPCtx->bench->vout/total_time_usage, + 100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/total_time_usage, + 100.0*MPXPCtx->bench->demux/total_time_usage, + 100.0*MPXPCtx->bench->c2/total_time_usage, 100.0*tot/total_time_usage); unsigned nframes=xp_core->video->num_played_frames; MSG_INFO("\nREAL RESULTS: from %u was dropped=%u\n" @@ -780,17 +780,17 @@ static void show_benchmark_status(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); if(xmp_test_model(XMP_Run_AudioPlayback)) MSG_STATUS("A:%6.1f %4.1f%%\r" ,sh_audio->timer-ao_get_delay(ao_data) - ,(sh_audio->timer>0.5)?100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)sh_audio->timer:0 + ,(sh_audio->timer>0.5)?100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)sh_audio->timer:0 ); else MSG_STATUS("A:%6.1f %4.1f%% B:%4.1f\r" ,sh_audio->timer-ao_get_delay(ao_data) - ,(sh_audio->timer>0.5)?100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)sh_audio->timer:0 + ,(sh_audio->timer>0.5)?100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)sh_audio->timer:0 ,get_delay_audio_buffer() ); } @@ -800,7 +800,7 @@ static void mpxp_init_keyboard_fifo(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); #ifdef HAVE_TERMCAP load_termcap(NULL); // load key-codes #endif @@ -811,7 +811,7 @@ } void mplayer_put_key(int code){ - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); mp_cmd_t* cmd; cmd=mp_input_get_cmd_from_keys(priv->libinput,1,&code); mp_input_queue_cmd(priv->libinput,cmd); @@ -850,7 +850,7 @@ } static char * mpxp_init_output_subsystems(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); char* rs=NULL; unsigned i; // check video_out driver name: @@ -895,7 +895,7 @@ } static int mpxp_init_vobsub(const char *filename) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); int forced_subs_only=0; MP_UNIT("vobsub"); if (mp_conf.vobsub_name){ @@ -924,7 +924,7 @@ } static int mpxp_handle_playlist(const char *filename) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); stream_t* stream=priv->demuxer->stream; int eof=0; play_tree_t* entry; @@ -961,7 +961,7 @@ static void mpxp_init_dvd_nls(void) { /* Add NLS support here */ - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); stream_t* stream=priv->demuxer->stream; char *lang; if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(); @@ -985,7 +985,7 @@ } static void mpxp_print_stream_formats(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); int fmt; @@ -1014,7 +1014,7 @@ } static void mpxp_read_video_properties(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); demux_stream_t *d_video=priv->demuxer->video; MP_UNIT("video_read_properties"); @@ -1041,7 +1041,7 @@ } static void mpxp_read_subtitles(const char *filename,int forced_subs_only,int stream_dump_type) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); stream_t* stream=priv->demuxer->stream; if (mp_conf.spudec_ifo) { @@ -1076,15 +1076,15 @@ // check .sub MP_UNIT("read_subtitles_file"); if(mp_conf.sub_name){ - mp_data->subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); - if(!mp_data->subtitles) MSG_ERR(MSGTR_CantLoadSub,mp_conf.sub_name); + MPXPCtx->subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); + if(!MPXPCtx->subtitles) MSG_ERR(MSGTR_CantLoadSub,mp_conf.sub_name); } else if(mp_conf.sub_auto) { // auto load sub file ... - mp_data->subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) + MPXPCtx->subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) : "default.sub", sh_video->fps ); } - if(mp_data->subtitles) { + if(MPXPCtx->subtitles) { priv->inited_flags|=INITED_SUBTITLE; - if(stream_dump_type>1) list_sub_file(mp_data->subtitles); + if(stream_dump_type>1) list_sub_file(MPXPCtx->subtitles); } #endif } @@ -1092,7 +1092,7 @@ static void mpxp_find_acodec(void) { int found=0; any_t* mpca=0; - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); demux_stream_t *d_audio=priv->demuxer->audio; sh_audio->codec=NULL; @@ -1142,7 +1142,7 @@ } static MPXP_Rc mpxp_find_vcodec(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); demux_stream_t *d_video=priv->demuxer->video; sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); MPXP_Rc rc=MPXP_Ok; @@ -1198,7 +1198,7 @@ } static int mpxp_configure_audio(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); demux_stream_t *d_audio=priv->demuxer->audio; @@ -1262,7 +1262,7 @@ } static void mpxp_run_ahead_engine(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); MP_UNIT("init_xp"); @@ -1282,7 +1282,7 @@ } static void mpxp_print_audio_status(void) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); /* PAINT audio OSD */ unsigned ipts,rpts; @@ -1308,7 +1308,7 @@ #ifdef USE_OSD static int mpxp_paint_osd(int* osd_visible,int* in_pause) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); const stream_t* stream=priv->demuxer->stream; sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); @@ -1385,7 +1385,7 @@ }input_state_t; static int mpxp_handle_input(seek_args_t* seek,osd_args_t* osd,input_state_t* state) { - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); stream_t* stream=priv->demuxer->stream; sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); int v_bright=0; @@ -1652,7 +1652,7 @@ secure_keys=ptr_protector.protect(new MPXPSecureKeys(10)); mpxp_init_structs(); - priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); vo_data=vo_preinit_structs(); init_signal_handling(); @@ -1667,13 +1667,13 @@ priv->playtree = play_tree_new(); - mp_data->mconfig = m_config_new(priv->playtree,priv->libinput); - m_config_register_options(mp_data->mconfig,mplayer_opts); + MPXPCtx->mconfig = m_config_new(priv->playtree,priv->libinput); + m_config_register_options(MPXPCtx->mconfig,mplayer_opts); // TODO : add something to let modules register their options - mp_register_options(mp_data->mconfig); - parse_cfgfiles(mp_data->mconfig); + mp_register_options(MPXPCtx->mconfig); + parse_cfgfiles(MPXPCtx->mconfig); - if(m_config_parse_command_line(mp_data->mconfig, argc, argv, envp)!=MPXP_Ok) + if(m_config_parse_command_line(MPXPCtx->mconfig, argc, argv, envp)!=MPXP_Ok) exit_player("Error parse command line"); // error parsing cmdline if(!mp_conf.xp) { @@ -1700,7 +1700,7 @@ priv->playtree = play_tree_cleanup(priv->playtree); if(priv->playtree) { - playtree_iter = play_tree_iter_new(priv->playtree,mp_data->mconfig); + playtree_iter = play_tree_iter_new(priv->playtree,MPXPCtx->mconfig); if(playtree_iter) { if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { play_tree_iter_free(playtree_iter); @@ -1905,11 +1905,11 @@ MPXP_Rc rc; unsigned quality; rc=mpcv_get_quality_max(sh_video->decoder,&quality); - if(rc==MPXP_Ok) mp_data->output_quality=quality; - if(mp_conf.autoq>mp_data->output_quality) mp_conf.autoq=mp_data->output_quality; - else mp_data->output_quality=mp_conf.autoq; - MSG_V("AutoQ: setting quality to %d\n",mp_data->output_quality); - mpcv_set_quality(sh_video->decoder,mp_data->output_quality); + if(rc==MPXP_Ok) MPXPCtx->output_quality=quality; + if(mp_conf.autoq>MPXPCtx->output_quality) mp_conf.autoq=MPXPCtx->output_quality; + else MPXPCtx->output_quality=mp_conf.autoq; + MSG_V("AutoQ: setting quality to %d\n",MPXPCtx->output_quality); + mpcv_set_quality(sh_video->decoder,MPXPCtx->output_quality); } vf_showlist(reinterpret_cast<vf_instance_t*>(sh_video->vfilter)); @@ -1938,9 +1938,9 @@ d_video->demuxer->file_format == DEMUXER_TYPE_H264_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_PS || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS))) - mp_data->use_pts_fix2=1; + MPXPCtx->use_pts_fix2=1; else - mp_data->use_pts_fix2=0; + MPXPCtx->use_pts_fix2=0; if(sh_video) sh_video->chapter_change=0; @@ -1973,13 +1973,13 @@ } /* Init timers and benchmarking */ - mp_data->rtc_fd=InitTimer(); - if(!mp_conf.nortc && mp_data->rtc_fd>0) { close(mp_data->rtc_fd); mp_data->rtc_fd=-1; } - MSG_V("Using %s timing\n",mp_data->rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()"); + MPXPCtx->rtc_fd=InitTimer(); + if(!mp_conf.nortc && MPXPCtx->rtc_fd>0) { close(MPXPCtx->rtc_fd); MPXPCtx->rtc_fd=-1; } + MSG_V("Using %s timing\n",MPXPCtx->rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()"); - mp_data->bench->total_start=GetTimer(); - mp_data->bench->audio=0; mp_data->bench->audio_decode=0; mp_data->bench->video=0; - mp_data->bench->audio_decode_correction=0; + MPXPCtx->bench->total_start=GetTimer(); + MPXPCtx->bench->audio=0; MPXPCtx->bench->audio_decode=0; MPXPCtx->bench->video=0; + MPXPCtx->bench->audio_decode_correction=0; if(mp_conf.benchmark) init_benchmark(); @@ -1994,7 +1994,7 @@ let thread will decode ahead! We may print something in block window ;) */ - mp_data->seek_time = GetTimerMS(); + MPXPCtx->seek_time = GetTimerMS(); if(sh_video) dae_wait_decoder_outrun(xp_core->video); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/mplayerxp.h 2012-11-15 14:34:45 UTC (rev 374) @@ -106,7 +106,7 @@ }time_usage_t; /* non-configurable through command line stuff */ -typedef struct mp_data_s { +typedef struct MPXPContext_s { int rtc_fd; int seek_time; int output_quality; @@ -118,8 +118,8 @@ time_usage_t*bench; any_t* priv; any_t* msg_priv; -}mp_data_t; -extern mp_data_t* mp_data; +}MPXPContext_t; +extern MPXPContext_t* MPXPCtx; extern void update_osd( float v_pts ); Modified: mplayerxp/xmpcore/xmp_adecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-15 14:34:45 UTC (rev 374) @@ -304,12 +304,12 @@ pthread_cond_signal( &audio_buffer.wait_buffer_cond ); t=GetTimer()-t; - mp_data->bench->audio_decode+=t*0.000001f; - mp_data->bench->audio_decode-=mp_data->bench->audio_decode_correction; + MPXPCtx->bench->audio_decode+=t*0.000001f; + MPXPCtx->bench->audio_decode-=MPXPCtx->bench->audio_decode_correction; if(mp_conf.benchmark) { - if(t > mp_data->bench->max_audio_decode) mp_data->bench->max_audio_decode = t; - if(t < mp_data->bench->min_audio_decode) mp_data->bench->min_audio_decode = t; + if(t > MPXPCtx->bench->max_audio_decode) MPXPCtx->bench->max_audio_decode = t; + if(t < MPXPCtx->bench->min_audio_decode) MPXPCtx->bench->min_audio_decode = t; } pthread_mutex_unlock( &audio_buffer.head_mutex ); Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-15 14:34:45 UTC (rev 374) @@ -71,12 +71,12 @@ MP_UNIT("play_audio"); // Leave AUDIO decoder module t=GetTimer()-t; tt = t*0.000001f; - mp_data->bench->audio+=tt; + MPXPCtx->bench->audio+=tt; if(mp_conf.benchmark) { - if(tt > mp_data->bench->max_audio) mp_data->bench->max_audio = tt; - if(tt < mp_data->bench->min_audio) mp_data->bench->min_audio = tt; - mp_data->bench->cur_audio=tt; + if(tt > MPXPCtx->bench->max_audio) MPXPCtx->bench->max_audio = tt; + if(tt < MPXPCtx->bench->min_audio) MPXPCtx->bench->min_audio = tt; + MPXPCtx->bench->cur_audio=tt; } if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; @@ -89,7 +89,7 @@ memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); if(!mp_conf.av_sync_pts && xmp_test_model(XMP_Run_AudioPlayer)) pthread_mutex_lock(&audio_timer_mutex); - if(mp_data->use_pts_fix2) { + if(MPXPCtx->use_pts_fix2) { if(sh_audio->a_pts != HUGE) { sh_audio->a_pts_pos-=playsize; if(sh_audio->a_pts_pos > -ao_get_delay(ao_data)*sh_audio->af_bps) { Modified: mplayerxp/xmpcore/xmp_vdecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-11-15 14:34:45 UTC (rev 374) @@ -40,7 +40,7 @@ float screen_pts=dae_played_frame(xp_core->video).v_pts-(mp_conf.av_sync_pts?0:xp_core->initial_apts); static float prev_delta=64; float delta,max_frame_delay;/* delay for decoding of top slow frame */ - max_frame_delay = mp_data->bench->max_video+mp_data->bench->max_vout; + max_frame_delay = MPXPCtx->bench->max_video+MPXPCtx->bench->max_vout; /* TODO: @@ -134,7 +134,7 @@ if(!xmp_test_model(XMP_Run_VA_Decoder) && xp_core->audio) priv->name = "video decoder"; drop_barrier=(float)(xp_core->num_v_buffs/2)*(1/sh_video->fps); - if(mp_conf.av_sync_pts == -1 && !mp_data->use_pts_fix2) + if(mp_conf.av_sync_pts == -1 && !MPXPCtx->use_pts_fix2) xp_core->bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG4_ES || d_video->demuxer->file_format == DEMUXER_TYPE_H264_ES || @@ -186,7 +186,7 @@ int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ - if(cur_time - mp_data->seek_time > (xp_core->num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(sh_video,frame->pts,drop_barrier); + if(cur_time - MPXPCtx->seek_time > (xp_core->num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(sh_video,frame->pts,drop_barrier); } /* if( mp_conf.frame_dropping ) */ if(!finite(frame->pts)) MSG_WARN("Bug of demuxer! Value of video pts=%f\n",frame->pts); if(frame->type!=VideoFrame) escape_player("VideoDecoder doesn't parse non video frames",mp_conf.max_trace); @@ -205,11 +205,11 @@ if(xp_n_frame_to_drop) drop_param=mp_conf.frame_dropping; else drop_param=0; /* decode: */ - if(mp_data->output_quality) { + if(MPXPCtx->output_quality) { unsigned total = xp_core->num_v_buffs/2; unsigned distance = dae_get_decoder_outrun(xp_core->video); int our_quality; - our_quality = mp_data->output_quality*distance/total; + our_quality = MPXPCtx->output_quality*distance/total; if(drop_param) mpcv_set_quality(sh_video->decoder,0); else if(mp_conf.autoq) mpcv_set_quality(sh_video->decoder,our_quality>0?our_quality:0); @@ -217,8 +217,8 @@ frame->flags=drop_param; blit_frame=RND_RENAME4(mpcv_decode)(sh_video->decoder,frame); MSG_DBG2("DECODER: %i[%i] %f\n",dae_curr_vdecoded(xp_core),frame->len,frame->pts); - if(mp_data->output_quality) { - if(drop_param) mpcv_set_quality(sh_video->decoder,mp_data->output_quality); + if(MPXPCtx->output_quality) { + if(drop_param) mpcv_set_quality(sh_video->decoder,MPXPCtx->output_quality); } if(!blit_frame && drop_param) priv->dae->num_dropped_frames++; if(blit_frame) { Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-11-15 14:18:24 UTC (rev 373) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-11-15 14:34:45 UTC (rev 374) @@ -29,10 +29,10 @@ MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d [frms: [%i]]\n", a_pts-delay,v_pts,AV_delay ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 - ,mp_data->output_quality + ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)v_pts):0 + ,MPXPCtx->output_quality ,dae_curr_vplayed(xp_core) ); fflush(stdout); @@ -47,26 +47,26 @@ ,a_pts-v_pts ,0.0 ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 - ,mp_data->output_quality + ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)v_pts):0 + ,MPXPCtx->output_quality ); } else MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d\r" ,v_pts ,xp_core->video->num_played_frames - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 - ,mp_data->output_quality + ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)v_pts):0 + ,MPXPCtx->output_quality ); fflush(stdout); } static void vplayer_check_chapter_change(sh_audio_t* sh_audio,sh_video_t* sh_video,xmp_frame_t* shva_prev,float v_pts) { - if(mp_data->use_pts_fix2 && sh_audio) { + if(MPXPCtx->use_pts_fix2 && sh_audio) { if(sh_video->chapter_change == -1) { /* First frame after seek */ while(v_pts < 1.0 && sh_audio->timer==0.0 && ao_get_delay(ao_data)==0.0) usleep(0); /* Wait for audio to start play */ @@ -96,10 +96,10 @@ often ao_get_delay() never returns 0 :( */ if(xp_core->audio->eof && !get_delay_audio_buffer()) goto nosound_model; if((!xp_core->audio->eof || ao_get_delay(ao_data)) && - (!mp_data->use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) + (!MPXPCtx->use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) sleep_time=screen_pts-((sh_audio->timer-ao_get_delay(ao_data)) +(mp_conf.av_sync_pts?0:xp_core->initial_apts)); - else if(mp_data->use_pts_fix2 && sh_audio->chapter_change) + else if(MPXPCtx->use_pts_fix2 && sh_audio->chapter_change) sleep_time=0; else goto nosound_model; @@ -192,7 +192,7 @@ static int drop_message=0; if(!drop_message && xp_core->video->num_slow_frames > 50) { drop_message=1; - if(mp_data->mpxp_after_seek) mp_data->mpxp_after_seek--; + if(MPXPCtx->mpxp_after_seek) MPXPCtx->mpxp_after_seek--; else MSG_WARN(MSGTR_SystemTooSlow); } MSG_D("\ndec_ahead_main: stalling: %i %i\n",dae_cuurr_vplayed(),dae_curr_decoded()); @@ -211,7 +211,7 @@ sleep_time=vplayer_compute_sleep_time(sh_audio,sh_video,&shva_prev,v_pts); if(!(vo_data->flags&256)){ /* flag 256 means: libvo driver does its timing (dvb card) */ - if(!vplayer_do_sleep(sh_audio,mp_data->rtc_fd,sleep_time)) return 0; + if(!vplayer_do_sleep(sh_audio,MPXPCtx->rtc_fd,sleep_time)) return 0; } player_idx=dae_next_played(xp_core->video); @@ -220,10 +220,10 @@ MSG_D("\ndec_ahead_main: schedule %u on screen\n",player_idx); t2=GetTimer()-t2; tt = t2*0.000001f; - mp_data->bench->vout+=tt; + MPXPCtx->bench->vout+=tt; if(mp_conf.benchmark) { /* we need compute draw_slice+change_frame here */ - mp_data->bench->cur_vout+=tt; + MPXPCtx->bench->cur_vout+=tt; } } MP_UNIT(NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-15 14:48:49
|
Revision: 375 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=375&view=rev Author: nickols_k Date: 2012-11-15 14:48:42 +0000 (Thu, 15 Nov 2012) Log Message: ----------- decrease number reinterpret_cast and warnings Modified Paths: -------------- mplayerxp/mp_msg.h mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h Modified: mplayerxp/mp_msg.h =================================================================== --- mplayerxp/mp_msg.h 2012-11-15 14:34:45 UTC (rev 374) +++ mplayerxp/mp_msg.h 2012-11-15 14:48:42 UTC (rev 375) @@ -60,8 +60,8 @@ int mpxp_printf( unsigned x, const char *format, ... ); #ifdef __GNUC__ -static inline int mpxp_print_dummy(void) {return 0;} -#define mpxp_print(mod,lev, args... ) ((lev<(mp_conf.verbose+MSGL_V))?(mpxp_printf(((lev&0xF)<<28)|(mod&0x0FFFFFFF),## args)):(mpxp_print_dummy())) +static inline int mpxp_print_dummy(const char* args,...) { UNUSED(args); return 0;} +#define mpxp_print(mod,lev, args... ) ((lev<(mp_conf.verbose+MSGL_V))?(mpxp_printf(((lev&0xF)<<28)|(mod&0x0FFFFFFF),## args)):(mpxp_print_dummy(args))) #else #define mpxp_print(mod,lev, ... ) mpxp_printf(((lev&0xF)<<28)|(mod&0x0FFFFFFF),__VA_ARGS__) #endif @@ -84,8 +84,8 @@ static __always_inline int MSG_DBG2(const char* args,...) { return mpxp_print(MSGT_CLASS,MSGL_DBG3,args,__va_arg_pack ()); } static __always_inline int MSG_DBG3(const char* args,...) { return mpxp_print(MSGT_CLASS,MSGL_DBG4,args,__va_arg_pack ()); } #else -static __always_inline int MSG_DBG2(const char* args,...) { return 0; } -static __always_inline int MSG_DBG3(const char* args,...) { return 0; } +static __always_inline int MSG_DBG2(const char* args,...) { return mpxp_print_dummy(args); } +static __always_inline int MSG_DBG3(const char* args,...) { return mpxp_print_dummy(args); } #endif #else // __va_arg_pack Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-11-15 14:34:45 UTC (rev 374) +++ mplayerxp/mplayerxp.cpp 2012-11-15 14:48:42 UTC (rev 375) @@ -134,7 +134,7 @@ PT_UP_PREV =-3 }; -typedef struct priv_s { +struct MPXPSystem { unsigned inited_flags; int vo_inited; MPXP_Rc ao_inited; @@ -144,7 +144,7 @@ demuxer_t* demuxer; play_tree_t*playtree; any_t* libinput; -}priv_t; +}; struct MPXPSecureKeys { public: @@ -211,9 +211,9 @@ MPXPCtx->bench=new(zeromem) time_usage_t; MPXPCtx->use_pts_fix2=-1; MPXPCtx->rtc_fd=-1; - MPXPCtx->priv=new(zeromem)priv_t; - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - priv->osd_function=OSD_PLAY; + MPXPCtx->MPXPSys=new(zeromem)MPXPSystem; + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + MPXPSys->osd_function=OSD_PLAY; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) memset(&x86,-1,sizeof(x86_features_t)); #endif @@ -248,7 +248,7 @@ free_codec_cfg(); #endif delete MPXPCtx->bench; - delete reinterpret_cast<priv_t*>(MPXPCtx->priv); + delete MPXPCtx->MPXPSys; delete MPXPCtx; if(vo_data) mp_free(vo_data); if(ao_data) mp_free(ao_data); @@ -258,92 +258,92 @@ } void uninit_player(unsigned int mask){ - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; stream_t* stream=NULL; sh_audio_t* sh_audio=NULL; sh_video_t* sh_video=NULL; - if(priv->demuxer) { - stream=priv->demuxer->stream; - sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); - sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); + if(MPXPSys->demuxer) { + stream=MPXPSys->demuxer->stream; + sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); + sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); } fflush(stdout); fflush(stderr); - mask=priv->inited_flags&mask; + mask=MPXPSys->inited_flags&mask; MP_UNIT("uninit_xp"); if(mask&INITED_XMP) { - priv->inited_flags&=~INITED_XMP; + MPXPSys->inited_flags&=~INITED_XMP; MP_UNIT("uninit_xmp"); xmp_uninit_engine(0); } if (mask&INITED_SPUDEC){ - priv->inited_flags&=~INITED_SPUDEC; + MPXPSys->inited_flags&=~INITED_SPUDEC; MP_UNIT("uninit_spudec"); spudec_free(vo_data->spudec); vo_data->spudec=NULL; } if (mask&INITED_VOBSUB){ - priv->inited_flags&=~INITED_VOBSUB; + MPXPSys->inited_flags&=~INITED_VOBSUB; MP_UNIT("uninit_vobsub"); vobsub_close(vo_data->vobsub); vo_data->vobsub=NULL; } if(mask&INITED_VCODEC){ - priv->inited_flags&=~INITED_VCODEC; + MPXPSys->inited_flags&=~INITED_VCODEC; MP_UNIT("uninit_vcodec"); mpcv_uninit(sh_video->decoder); sh_video=NULL; } if(mask&INITED_VO){ - priv->inited_flags&=~INITED_VO; + MPXPSys->inited_flags&=~INITED_VO; MP_UNIT("uninit_vo"); vo_uninit(vo_data); vo_data=NULL; } if(mask&INITED_ACODEC){ - priv->inited_flags&=~INITED_ACODEC; + MPXPSys->inited_flags&=~INITED_ACODEC; MP_UNIT("uninit_acodec"); mpca_uninit(sh_audio->decoder); sh_audio=NULL; } if(mask&INITED_AO){ - priv->inited_flags&=~INITED_AO; + MPXPSys->inited_flags&=~INITED_AO; MP_UNIT("uninit_ao"); ao_uninit(ao_data); ao_data=NULL; } if(mask&INITED_DEMUXER){ - priv->inited_flags&=~INITED_DEMUXER; + MPXPSys->inited_flags&=~INITED_DEMUXER; MP_UNIT("free_priv->demuxer"); - free_demuxer(priv->demuxer); + free_demuxer(MPXPSys->demuxer); } if(mask&INITED_STREAM){ - priv->inited_flags&=~INITED_STREAM; + MPXPSys->inited_flags&=~INITED_STREAM; MP_UNIT("uninit_stream"); if(stream) free_stream(stream); stream=NULL; } if(mask&INITED_INPUT){ - priv->inited_flags&=~INITED_INPUT; + MPXPSys->inited_flags&=~INITED_INPUT; MP_UNIT("uninit_input"); - mp_input_close(priv->libinput); + mp_input_close(MPXPSys->libinput); } #ifdef USE_SUB if(mask&INITED_SUBTITLE){ - priv->inited_flags&=~INITED_SUBTITLE; + MPXPSys->inited_flags&=~INITED_SUBTITLE; MP_UNIT("sub_free"); - mp_input_close(priv->libinput); + mp_input_close(MPXPSys->libinput); sub_free( MPXPCtx->subtitles ); mp_conf.sub_name=NULL; vo_data->sub=NULL; @@ -426,9 +426,9 @@ // The function return a new value for eof. static int libmpdemux_was_interrupted(int eof) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; mp_cmd_t* cmd; - if((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) { + if((cmd = mp_input_get_cmd(MPXPSys->libinput,0,0,0)) != NULL) { switch(cmd->id) { case MP_CMD_QUIT: case MP_CMD_SOFT_QUIT: // should never happen @@ -574,9 +574,9 @@ } extern "C" void show_long_help(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; m_config_show_options(MPXPCtx->mconfig); - mp_input_print_binds(priv->libinput); + mp_input_print_binds(MPXPSys->libinput); print_stream_drivers(); vo_print_help(vo_data); ao_print_help(); @@ -603,30 +603,30 @@ //================= Update OSD ==================== void update_osd( float v_pts ) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; static char osd_text_buffer[64]; static int osd_last_pts=-303; //================= Update OSD ==================== if(mp_conf.osd_level>=2){ - int pts=(mp_conf.osd_level==3&&priv->demuxer->movi_length!=UINT_MAX)?priv->demuxer->movi_length-v_pts:v_pts; - int addon=(mp_conf.osd_level==3&&priv->demuxer->movi_length!=UINT_MAX)?-1:1; + int pts=(mp_conf.osd_level==3&&MPXPSys->demuxer->movi_length!=UINT_MAX)?MPXPSys->demuxer->movi_length-v_pts:v_pts; + int addon=(mp_conf.osd_level==3&&MPXPSys->demuxer->movi_length!=UINT_MAX)?-1:1; char osd_text_tmp[64]; if(pts==osd_last_pts-addon) { - if(mp_conf.osd_level==3&&priv->demuxer->movi_length!=UINT_MAX) ++pts; + if(mp_conf.osd_level==3&&MPXPSys->demuxer->movi_length!=UINT_MAX) ++pts; else --pts; } else osd_last_pts=pts; vo_data->osd_text=osd_text_buffer; - if (priv->osd_show_framedrop) { + if (MPXPSys->osd_show_framedrop) { sprintf(osd_text_tmp, "Framedrop: %s",mp_conf.frame_dropping>1?"hard":mp_conf.frame_dropping?"vo":"none"); - priv->osd_show_framedrop--; + MPXPSys->osd_show_framedrop--; } else #ifdef ENABLE_DEC_AHEAD_DEBUG - if(mp_conf.verbose) sprintf(osd_text_tmp,"%c %02d:%02d:%02d",priv->osd_function,pts/3600,(pts/60)%60,pts%60); - else sprintf(osd_text_tmp,"%c %02d:%02d:%02d",priv->osd_function,pts/3600,(pts/60)%60,pts%60); + if(mp_conf.verbose) sprintf(osd_text_tmp,"%c %02d:%02d:%02d",MPXPSys->osd_function,pts/3600,(pts/60)%60,pts%60); + else sprintf(osd_text_tmp,"%c %02d:%02d:%02d",MPXPSys->osd_function,pts/3600,(pts/60)%60,pts%60); #else - sprintf(osd_text_tmp,"%c %02d:%02d:%02d",priv->osd_function,pts/3600,(pts/60)%60,pts%60); + sprintf(osd_text_tmp,"%c %02d:%02d:%02d",MPXPSys->osd_function,pts/3600,(pts/60)%60,pts%60); #endif if(strcmp(vo_data->osd_text, osd_text_tmp)) { strcpy(vo_data->osd_text, osd_text_tmp); @@ -647,14 +647,14 @@ void mpxp_seek( osd_args_t *osd,const seek_args_t* seek) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); - demux_stream_t *d_dvdsub=priv->demuxer->sub; + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); + demux_stream_t *d_dvdsub=MPXPSys->demuxer->sub; int seek_rval=1; xp_core->audio->eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { - seek_rval=demux_seek_r(priv->demuxer,seek); + seek_rval=demux_seek_r(MPXPSys->demuxer,seek); MPXPCtx->mpxp_after_seek=25; /* 1 sec delay */ } if(seek_rval){ @@ -692,11 +692,11 @@ #ifdef USE_OSD // Set OSD: if(mp_conf.osd_level){ - int len=((priv->demuxer->movi_end-priv->demuxer->movi_start)>>8); + int len=((MPXPSys->demuxer->movi_end-MPXPSys->demuxer->movi_start)>>8); if (len>0){ if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; vo_data->osd_progbar_type=0; - vo_data->osd_progbar_value=(priv->demuxer->filepos-priv->demuxer->movi_start)/len; + vo_data->osd_progbar_value=(MPXPSys->demuxer->filepos-MPXPSys->demuxer->movi_start)/len; vo_osd_changed(OSDTYPE_PROGBAR); } } @@ -718,8 +718,8 @@ void mpxp_reset_vcache(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); seek_args_t seek = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; if(sh_video) mpxp_seek(NULL,&seek); return; @@ -727,8 +727,8 @@ void mpxp_resync_audio_stream(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); mpca_resync_stream(sh_audio->decoder); } @@ -780,8 +780,8 @@ static void show_benchmark_status(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); if(xmp_test_model(XMP_Run_AudioPlayback)) MSG_STATUS("A:%6.1f %4.1f%%\r" ,sh_audio->timer-ao_get_delay(ao_data) @@ -800,21 +800,21 @@ static void mpxp_init_keyboard_fifo(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; #ifdef HAVE_TERMCAP load_termcap(NULL); // load key-codes #endif /* Init input system */ MP_UNIT("init_input"); - priv->libinput=RND_RENAME0(mp_input_open)(); - priv->inited_flags|=INITED_INPUT; + MPXPSys->libinput=RND_RENAME0(mp_input_open)(); + MPXPSys->inited_flags|=INITED_INPUT; } void mplayer_put_key(int code){ - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; mp_cmd_t* cmd; - cmd=mp_input_get_cmd_from_keys(priv->libinput,1,&code); - mp_input_queue_cmd(priv->libinput,cmd); + cmd=mp_input_get_cmd_from_keys(MPXPSys->libinput,1,&code); + mp_input_queue_cmd(MPXPSys->libinput,cmd); } @@ -850,7 +850,7 @@ } static char * mpxp_init_output_subsystems(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; char* rs=NULL; unsigned i; // check video_out driver name: @@ -865,9 +865,9 @@ } } MP_UNIT("vo_register"); - priv->vo_inited = (RND_RENAME5(vo_register)(vo_data,mp_conf.video_driver)!=NULL)?1:0; + MPXPSys->vo_inited = (RND_RENAME5(vo_register)(vo_data,mp_conf.video_driver)!=NULL)?1:0; - if(!priv->vo_inited){ + if(!MPXPSys->vo_inited){ MSG_FATAL(MSGTR_InvalidVOdriver,mp_conf.video_driver?mp_conf.video_driver:"?"); exit_player(MSGTR_Exit_error); } @@ -895,7 +895,7 @@ } static int mpxp_init_vobsub(const char *filename) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; int forced_subs_only=0; MP_UNIT("vobsub"); if (mp_conf.vobsub_name){ @@ -903,7 +903,7 @@ if(vo_data->vobsub==NULL) MSG_ERR(MSGTR_CantLoadSub,mp_conf.vobsub_name); else { - priv->inited_flags|=INITED_VOBSUB; + MPXPSys->inited_flags|=INITED_VOBSUB; vobsub_set_from_lang(vo_data->vobsub, mp_conf.dvdsub_lang); // check if vobsub requested only to display forced subtitles forced_subs_only=vobsub_get_forced_subs_flag(vo_data->vobsub); @@ -918,20 +918,20 @@ if(vo_data->vobsub) { mp_conf.sub_auto=0; // don't do autosub for textsubs if vobsub found - priv->inited_flags|=INITED_VOBSUB; + MPXPSys->inited_flags|=INITED_VOBSUB; } return forced_subs_only; } static int mpxp_handle_playlist(const char *filename) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - stream_t* stream=priv->demuxer->stream; + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + stream_t* stream=MPXPSys->demuxer->stream; int eof=0; play_tree_t* entry; // Handle playlist MP_UNIT("handle_playlist"); MSG_V("Parsing playlist %s...\n",filename); - entry = parse_playtree(priv->libinput,stream); + entry = parse_playtree(MPXPSys->libinput,stream); if(!entry) { entry = playtree_iter->tree; if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) { @@ -961,8 +961,8 @@ static void mpxp_init_dvd_nls(void) { /* Add NLS support here */ - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - stream_t* stream=priv->demuxer->stream; + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + stream_t* stream=MPXPSys->demuxer->stream; char *lang; if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(); MP_UNIT("dvd lang->id"); @@ -985,9 +985,9 @@ } static void mpxp_print_stream_formats(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); int fmt; char *c; MSG_INFO("[Stream]:"); @@ -1014,9 +1014,9 @@ } static void mpxp_read_video_properties(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); - demux_stream_t *d_video=priv->demuxer->video; + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); + demux_stream_t *d_video=MPXPSys->demuxer->video; MP_UNIT("video_read_properties"); if(!video_read_properties(sh_video)) { MSG_ERR("Video: can't read properties\n"); @@ -1024,7 +1024,7 @@ sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); } else { MSG_V("[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", - priv->demuxer->file_format,sh_video->fourcc, sh_video->src_w,sh_video->src_h, + MPXPSys->demuxer->file_format,sh_video->fourcc, sh_video->src_w,sh_video->src_h, sh_video->fps,1/sh_video->fps ); /* need to set fps here for output encoders to pick it up in their init */ @@ -1041,9 +1041,9 @@ } static void mpxp_read_subtitles(const char *filename,int forced_subs_only,int stream_dump_type) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); - stream_t* stream=priv->demuxer->stream; + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); + stream_t* stream=MPXPSys->demuxer->stream; if (mp_conf.spudec_ifo) { unsigned int palette[16], width, height; MP_UNIT("spudec_init_vobsub"); @@ -1065,7 +1065,7 @@ } if (vo_data->spudec!=NULL) { - priv->inited_flags|=INITED_SPUDEC; + MPXPSys->inited_flags|=INITED_SPUDEC; // Apply current settings for forced subs spudec_set_forced_subs_only(vo_data->spudec,forced_subs_only); } @@ -1083,7 +1083,7 @@ : "default.sub", sh_video->fps ); } if(MPXPCtx->subtitles) { - priv->inited_flags|=INITED_SUBTITLE; + MPXPSys->inited_flags|=INITED_SUBTITLE; if(stream_dump_type>1) list_sub_file(MPXPCtx->subtitles); } #endif @@ -1092,9 +1092,9 @@ static void mpxp_find_acodec(void) { int found=0; any_t* mpca=0; - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); - demux_stream_t *d_audio=priv->demuxer->audio; + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); + demux_stream_t *d_audio=MPXPSys->demuxer->audio; sh_audio->codec=NULL; mpca=RND_RENAME2(mpca_init)(sh_audio); // try auto-probe first if(mpca) { sh_audio->decoder=mpca; found=1; } @@ -1142,13 +1142,13 @@ } static MPXP_Rc mpxp_find_vcodec(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - demux_stream_t *d_video=priv->demuxer->video; - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + demux_stream_t *d_video=MPXPSys->demuxer->video; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); MPXP_Rc rc=MPXP_Ok; MP_UNIT("init_video_codec"); sh_video->inited=0; - if((sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,mp_conf.video_codec,mp_conf.video_family,-1,priv->libinput))) sh_video->inited=1; + if((sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,mp_conf.video_codec,mp_conf.video_family,-1,MPXPSys->libinput))) sh_video->inited=1; #ifdef ENABLE_WIN32LOADER if(!sh_video->inited) { /* Go through the codec.conf and find the best codec...*/ @@ -1161,20 +1161,20 @@ if(mp_conf.video_codec) { /* forced codec by name: */ MSG_INFO("Forced video codec: %s\n",mp_conf.video_codec); - sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,mp_conf.video_codec,NULL,-1,priv->libinput); + sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,mp_conf.video_codec,NULL,-1,MPXPSys->libinput); } else { int status; /* try in stability order: UNTESTED, WORKING, BUGGY, BROKEN */ if(mp_conf.video_family) MSG_INFO(MSGTR_TryForceVideoFmt,mp_conf.video_family); for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status){ if(mp_conf.video_family) /* try first the preferred codec family:*/ - if((sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,NULL,mp_conf.video_family,status,priv->libinput))) break; - if((sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,NULL,NULL,status,priv->libinput))) break; + if((sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,NULL,mp_conf.video_family,status,MPXPSys->libinput))) break; + if((sh_video->decoder=RND_RENAME3(mpcv_init)(sh_video,NULL,NULL,status,MPXPSys->libinput))) break; } } } /* Use ffmpeg decoders as last hope */ - if(!sh_video->inited) sh_video->decoder=mpcv_ffmpeg_init(sh_video,priv->libinput); + if(!sh_video->inited) sh_video->decoder=mpcv_ffmpeg_init(sh_video,MPXPSys->libinput); #endif if(!sh_video->inited) { @@ -1189,7 +1189,7 @@ d_video->sh = NULL; sh_video = reinterpret_cast<sh_video_t*>(d_video->sh); rc=MPXP_False; - } else priv->inited_flags|=INITED_VCODEC; + } else MPXPSys->inited_flags|=INITED_VCODEC; if(sh_video) MSG_V("%s video codec: [%s] vfm:%s (%s)\n", @@ -1198,10 +1198,10 @@ } static int mpxp_configure_audio(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); - demux_stream_t *d_audio=priv->demuxer->audio; + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); + demux_stream_t *d_audio=MPXPSys->demuxer->audio; int rc=0; const ao_info_t *info=ao_get_info(ao_data); MP_UNIT("setup_audio"); @@ -1248,7 +1248,7 @@ sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); if(sh_video == NULL) rc=-1; } else { - priv->inited_flags|=INITED_AO; + MPXPSys->inited_flags|=INITED_AO; MP_UNIT("af_init"); if(mpca_init_filters(sh_audio, sh_audio->rate, @@ -1262,9 +1262,9 @@ } static void mpxp_run_ahead_engine(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); MP_UNIT("init_xp"); if(sh_video && xp_core->num_v_buffs < 3) {/* we need at least 3 buffers to suppress screen judering */ MSG_FATAL("Not enough buffers for DECODING AHEAD!\nNeed %u buffers but exist only %u\n",3,xp_core->num_v_buffs); @@ -1278,22 +1278,22 @@ else MSG_OK("Using DECODING AHEAD mplayer's core with %u audio buffers\n",xp_core->num_a_buffs); /* reset counters */ if(sh_video) xp_core->video->num_dropped_frames=0; - priv->inited_flags|=INITED_XMP; + MPXPSys->inited_flags|=INITED_XMP; } static void mpxp_print_audio_status(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); /* PAINT audio OSD */ unsigned ipts,rpts; unsigned char h,m,s,rh,rm,rs; static char ph=0,pm=0,ps=0; ipts=(unsigned)(sh_audio->timer-ao_get_delay(ao_data)); - rpts=priv->demuxer->movi_length-ipts; + rpts=MPXPSys->demuxer->movi_length-ipts; h = ipts/3600; m = (ipts/60)%60; s = ipts%60; - if(priv->demuxer->movi_length!=UINT_MAX) { + if(MPXPSys->demuxer->movi_length!=UINT_MAX) { rh = rpts/3600; rm = (rpts/60)%60; rs = rpts%60; @@ -1308,20 +1308,20 @@ #ifdef USE_OSD static int mpxp_paint_osd(int* osd_visible,int* in_pause) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - const stream_t* stream=priv->demuxer->stream; - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + const stream_t* stream=MPXPSys->demuxer->stream; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); int rc=0; if(*osd_visible) { if (!--(*osd_visible)) { vo_data->osd_progbar_type=-1; // disable vo_osd_changed(OSDTYPE_PROGBAR); - if (!((priv->osd_function == OSD_PAUSE)||(priv->osd_function==OSD_DVDMENU))) - priv->osd_function = OSD_PLAY; + if (!((MPXPSys->osd_function == OSD_PAUSE)||(MPXPSys->osd_function==OSD_DVDMENU))) + MPXPSys->osd_function = OSD_PLAY; } } - if(priv->osd_function==OSD_DVDMENU) { + if(MPXPSys->osd_function==OSD_DVDMENU) { rect_highlight_t hl; if(stream->driver->control(stream,SCTRL_VID_GET_HILIGHT,&hl)==MPXP_Ok) { osd_set_nav_box (hl.sx, hl.sy, hl.ex, hl.ey); @@ -1329,9 +1329,9 @@ vo_osd_changed (OSDTYPE_DVDNAV); } } - if(priv->osd_function==OSD_PAUSE||priv->osd_function==OSD_DVDMENU) { + if(MPXPSys->osd_function==OSD_PAUSE||MPXPSys->osd_function==OSD_DVDMENU) { mp_cmd_t* cmd; - if (priv->vo_inited && sh_video) { + if (MPXPSys->vo_inited && sh_video) { if(mp_conf.osd_level>1 && !*in_pause) { *in_pause = 1; return -1; @@ -1343,7 +1343,7 @@ fflush(stdout); } - if (priv->ao_inited==MPXP_Ok && sh_audio) { + if (MPXPSys->ao_inited==MPXP_Ok && sh_audio) { if(xmp_test_model(XMP_Run_AudioPlayer)) { xp_core->in_pause=1; while( !dec_ahead_can_aseek ) usleep(0); @@ -1351,25 +1351,25 @@ ao_pause(ao_data); // pause audio, keep data if possible } - while( (cmd = mp_input_get_cmd(priv->libinput,20,1,1)) == NULL) { - if(sh_video && priv->vo_inited) vo_check_events(vo_data); + while( (cmd = mp_input_get_cmd(MPXPSys->libinput,20,1,1)) == NULL) { + if(sh_video && MPXPSys->vo_inited) vo_check_events(vo_data); usleep(20000); } if (cmd && cmd->id == MP_CMD_PAUSE) { - cmd = mp_input_get_cmd(priv->libinput,0,1,0); + cmd = mp_input_get_cmd(MPXPSys->libinput,0,1,0); mp_cmd_free(cmd); } - if(priv->osd_function==OSD_PAUSE) priv->osd_function=OSD_PLAY; - if (priv->ao_inited==MPXP_Ok && sh_audio) { + if(MPXPSys->osd_function==OSD_PAUSE) MPXPSys->osd_function=OSD_PLAY; + if (MPXPSys->ao_inited==MPXP_Ok && sh_audio) { ao_resume(ao_data); // resume audio if(xmp_test_model(XMP_Run_AudioPlayer)) { xp_core->in_pause=0; __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); } } - if (priv->vo_inited && sh_video) + if (MPXPSys->vo_inited && sh_video) vo_resume(vo_data); // resume video *in_pause=0; (void)GetRelativeTime(); // keep TF around FT in next cycle @@ -1385,9 +1385,9 @@ }input_state_t; static int mpxp_handle_input(seek_args_t* seek,osd_args_t* osd,input_state_t* state) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); - stream_t* stream=priv->demuxer->stream; - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); + MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; + stream_t* stream=MPXPSys->demuxer->stream; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); int v_bright=0; int v_cont=0; int v_hue=0; @@ -1400,7 +1400,7 @@ */ int eof=0; mp_cmd_t* cmd; - while( (cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) { + while( (cmd = mp_input_get_cmd(MPXPSys->libinput,0,0,0)) != NULL) { switch(cmd->id) { case MP_CMD_SEEK : { int v,i_abs; @@ -1408,12 +1408,12 @@ i_abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; if(i_abs) { seek->flags = DEMUX_SEEK_SET|DEMUX_SEEK_PERCENTS; - if(sh_video) priv->osd_function= (v > dae_played_frame(xp_core->video).v_pts) ? OSD_FFW : OSD_REW; + if(sh_video) MPXPSys->osd_function= (v > dae_played_frame(xp_core->video).v_pts) ? OSD_FFW : OSD_REW; seek->secs = v/100.; } else { seek->flags = DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS; - if(sh_video) priv->osd_function= (v > 0) ? OSD_FFW : OSD_REW; + if(sh_video) MPXPSys->osd_function= (v > 0) ? OSD_FFW : OSD_REW; seek->secs+= v; } } break; @@ -1423,17 +1423,17 @@ MSG_WARN("Speed adjusting is not implemented yet!\n"); break; case MP_CMD_SWITCH_AUDIO : - MSG_INFO("ID_AUDIO_TRACK=%i\n",demuxer_switch_audio_r(priv->demuxer, priv->demuxer->audio->id+1)); + MSG_INFO("ID_AUDIO_TRACK=%i\n",demuxer_switch_audio_r(MPXPSys->demuxer, MPXPSys->demuxer->audio->id+1)); break; case MP_CMD_SWITCH_VIDEO : - MSG_INFO("ID_VIDEO_TRACK=%i\n",demuxer_switch_video_r(priv->demuxer, priv->demuxer->video->id+1)); + MSG_INFO("ID_VIDEO_TRACK=%i\n",demuxer_switch_video_r(MPXPSys->demuxer, MPXPSys->demuxer->video->id+1)); break; case MP_CMD_SWITCH_SUB : - MSG_INFO("ID_SUB_TRACK=%i\n",demuxer_switch_subtitle_r(priv->demuxer, priv->demuxer->sub->id+1)); + MSG_INFO("ID_SUB_TRACK=%i\n",demuxer_switch_subtitle_r(MPXPSys->demuxer, MPXPSys->demuxer->sub->id+1)); break; case MP_CMD_FRAME_STEP : case MP_CMD_PAUSE : { - priv->osd_function=OSD_PAUSE; + MPXPSys->osd_function=OSD_PAUSE; } break; case MP_CMD_SOFT_QUIT : { exit_player(MSGTR_Exit_quit); @@ -1570,7 +1570,7 @@ mp_conf.frame_dropping = (mp_conf.frame_dropping+1)%3; else mp_conf.frame_dropping = v > 2 ? 2 : v; - priv->osd_show_framedrop = osd->info_factor; + MPXPSys->osd_show_framedrop = osd->info_factor; } break; case MP_CMD_TV_STEP_CHANNEL: if(cmd->args[0].v.i > 0) cmd->id=MP_CMD_TV_STEP_CHANNEL_UP; @@ -1587,9 +1587,9 @@ stream->type|=STREAMTYPE_MENU; state->need_repaint=1; } - priv->osd_function=OSD_DVDMENU; + MPXPSys->osd_function=OSD_DVDMENU; if(cmd->args[0].v.i==MP_CMD_DVDNAV_SELECT) { - priv->osd_function=0; + MPXPSys->osd_function=0; state->need_repaint=1; state->after_dvdmenu=1; state->next_file=1; @@ -1652,7 +1652,7 @@ secure_keys=ptr_protector.protect(new MPXPSecureKeys(10)); mpxp_init_structs(); - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->priv); + MPXPSystem* MPXPSys=MPXPCtx->MPXPSys; vo_data=vo_preinit_structs(); init_signal_handling(); @@ -1665,9 +1665,9 @@ MSG_INFO("%s",banner_text); /* Test for cpu capabilities (and corresponding OS support) for optimizing */ - priv->playtree = play_tree_new(); + MPXPSys->playtree = play_tree_new(); - MPXPCtx->mconfig = m_config_new(priv->playtree,priv->libinput); + MPXPCtx->mconfig = m_config_new(MPXPSys->playtree,MPXPSys->libinput); m_config_register_options(MPXPCtx->mconfig,mplayer_opts); // TODO : add something to let modules register their options mp_register_options(MPXPCtx->mconfig); @@ -1695,12 +1695,12 @@ MSG_ERR("MPlayerXP requires working copy of libswscaler\n"); exit_player(MSGTR_Exit_quit); } - if(mp_conf.shuffle_playback) priv->playtree->flags|=PLAY_TREE_RND; - else priv->playtree->flags&=~PLAY_TREE_RND; + if(mp_conf.shuffle_playback) MPXPSys->playtree->flags|=PLAY_TREE_RND; + else MPXPSys->playtree->flags&=~PLAY_TREE_RND; - priv->playtree = play_tree_cleanup(priv->playtree); - if(priv->playtree) { - playtree_iter = play_tree_iter_new(priv->playtree,MPXPCtx->mconfig); + MPXPSys->playtree = play_tree_cleanup(MPXPSys->playtree); + if(MPXPSys->playtree) { + playtree_iter = play_tree_iter_new(MPXPSys->playtree,MPXPCtx->mconfig); if(playtree_iter) { if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { play_tree_iter_free(playtree_iter); @@ -1742,20 +1742,20 @@ forced_subs_only=mpxp_init_vobsub(filename); MP_UNIT("mplayer"); - if(!input_state.after_dvdmenu && priv->demuxer) { - free_stream(priv->demuxer->stream); - priv->demuxer->stream=NULL; - priv->inited_flags&=~INITED_STREAM; - free_demuxer(priv->demuxer); - priv->demuxer=NULL; - priv->inited_flags&=~INITED_DEMUXER; + if(!input_state.after_dvdmenu && MPXPSys->demuxer) { + free_stream(MPXPSys->demuxer->stream); + MPXPSys->demuxer->stream=NULL; + MPXPSys->inited_flags&=~INITED_STREAM; + free_demuxer(MPXPSys->demuxer); + MPXPSys->demuxer=NULL; + MPXPSys->inited_flags&=~INITED_DEMUXER; } - if(priv->demuxer) { - priv->demuxer->audio=NULL; - priv->demuxer->video=NULL; - priv->demuxer->sub=NULL; - priv->demuxer->audio->sh=NULL; - priv->demuxer->video->sh=NULL; + if(MPXPSys->demuxer) { + MPXPSys->demuxer->audio=NULL; + MPXPSys->demuxer->video=NULL; + MPXPSys->demuxer->sub=NULL; + MPXPSys->demuxer->audio->sh=NULL; + MPXPSys->demuxer->video->sh=NULL; } //============ Open & Sync STREAM --- fork cache2 ==================== stream_dump_type=0; @@ -1767,13 +1767,13 @@ if(stream_dump_type) mp_conf.s_cache_size=0; MP_UNIT("open_stream"); - if(!input_state.after_dvdmenu) stream=RND_RENAME2(open_stream)(priv->libinput,filename,&file_format,stream_dump_type>1?dump_stream_event_handler:mpxp_stream_event_handler); + if(!input_state.after_dvdmenu) stream=RND_RENAME2(open_stream)(MPXPSys->libinput,filename,&file_format,stream_dump_type>1?dump_stream_event_handler:mpxp_stream_event_handler); if(!stream) { // error... MSG_ERR("Can't open: %s\n",filename); eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY); goto goto_next_file; } - priv->inited_flags|=INITED_STREAM; + MPXPSys->inited_flags|=INITED_STREAM; if(stream->type & STREAMTYPE_TEXT) { eof=mpxp_handle_playlist(filename); @@ -1785,14 +1785,14 @@ // CACHE2: initial prefill: 20% later: 5% (should be set by -cacheopts) if(mp_conf.s_cache_size && !stream_dump_type){ MP_UNIT("enable_cache"); - if(!stream_enable_cache(stream,priv->libinput,mp_conf.s_cache_size*1024,mp_conf.s_cache_size*1024/5,mp_conf.s_cache_size*1024/20)) + if(!stream_enable_cache(stream,MPXPSys->libinput,mp_conf.s_cache_size*1024,mp_conf.s_cache_size*1024/5,mp_conf.s_cache_size*1024/20)) if((eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY))) goto goto_next_file; } // DUMP STREAMS: if(stream_dump_type==1) dump_stream(stream); -//============ Open priv->demuxerS --- DETECT file type ======================= +//============ Open MPXPSys->demuxerS --- DETECT file type ======================= if(mp_conf.playbackspeed_factor!=1.0) mp_conf.has_audio=0; xp_core->initial_apts=HUGE; if(!mp_conf.has_audio) mp_conf.audio_id=-2; // do NOT read audio packets... @@ -1801,17 +1801,17 @@ MP_UNIT("demux_open"); - if(!input_state.after_dvdmenu) priv->demuxer=demux_open(stream,file_format,mp_conf.audio_id,mp_conf.video_id,mp_conf.dvdsub_id); - if(!priv->demuxer) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR - priv->inited_flags|=INITED_DEMUXER; + if(!input_state.after_dvdmenu) MPXPSys->demuxer=demux_open(stream,file_format,mp_conf.audio_id,mp_conf.video_id,mp_conf.dvdsub_id); + if(!MPXPSys->demuxer) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR + MPXPSys->inited_flags|=INITED_DEMUXER; input_state.after_dvdmenu=0; demux_stream_t *d_video; demux_stream_t *d_audio; demux_stream_t *d_dvdsub; - d_audio=priv->demuxer->audio; - d_video=priv->demuxer->video; - d_dvdsub=priv->demuxer->sub; + d_audio=MPXPSys->demuxer->audio; + d_video=MPXPSys->demuxer->video; + d_dvdsub=MPXPSys->demuxer->sub; /* Add NLS support here */ mpxp_init_dvd_nls(); @@ -1821,8 +1821,8 @@ sh_audio_t* sh_audio; sh_video_t* sh_video; - sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); - sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); + sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); + sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); mpxp_print_stream_formats(); @@ -1842,10 +1842,10 @@ MP_UNIT("init_audio_codec"); if(sh_audio) mpxp_find_acodec(); - sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer->audio->sh); if(stream_dump_type>1) { - dump_mux_init(priv->demuxer,priv->libinput); + dump_mux_init(MPXPSys->demuxer,MPXPSys->libinput); goto dump_file; } @@ -1855,8 +1855,8 @@ sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } if(ao_subdevice) mp_free(ao_subdevice); - priv->ao_inited=RND_RENAME4(ao_register)(ao_data,mp_conf.audio_driver,0); - if (priv->ao_inited!=MPXP_Ok){ + MPXPSys->ao_inited=RND_RENAME4(ao_register)(ao_data,mp_conf.audio_driver,0); + if (MPXPSys->ao_inited!=MPXP_Ok){ MSG_FATAL(MSGTR_InvalidAOdriver,mp_conf.audio_driver); exit_player(MSGTR_Exit_error); } @@ -1877,11 +1877,11 @@ } } - if(sh_audio) priv->inited_flags|=INITED_ACODEC; + if(sh_audio) MPXPSys->inited_flags|=INITED_ACODEC; if(stream_dump_type>1) { dump_file: - dump_mux(priv->demuxer,mp_conf.av_sync_pts,mp_conf.seek_to_sec,mp_conf.play_n_frames); + dump_mux(MPXPSys->demuxer,mp_conf.av_sync_pts,mp_conf.seek_to_sec,mp_conf.play_n_frames); goto goto_next_file; } /*================== Init VIDEO (codec & libvo) ==========================*/ @@ -1889,11 +1889,11 @@ MP_UNIT("init_video_filters"); if(sh_video->vfilter_inited<=0) { - sh_video->vfilter=RND_RENAME7(vf_init)(sh_video,priv->libinput); + sh_video->vfilter=RND_RENAME7(vf_init)(sh_video,MPXPSys->libinput); sh_video->vfilter_inited=1; } if((mpxp_find_vcodec())!=MPXP_Ok) { - sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); + sh_video=reinterpret_cast<sh_video_t*>(MPXPSys->demuxer->video->sh); if(!sh_audio) goto goto_next_file; goto main; } @@ -1915,7 +1915,7 @@ vf_showlist(reinterpret_cast<vf_instance_t*>(sh_video->vfilter)); // ========== Init display (sh_video->src_w*sh_video->src_h/out_fmt) ============ - priv->inited_flags|=INITED_VO; + MPXPSys->inited_flags|=INITED_VO; MSG_V("INFO: Video OUT driver init OK!\n"); MP_UNIT("init_libvo"); fflush(stdout); @@ -1952,7 +1952,7 @@ if(mp_conf.verbose) MSG_V("Freeing %d unused audio chunks\n",d_audio->packs); ds_free_packs(d_audio); // mp_free buffered chunks d_audio->id=-2; // do not read audio chunks - if(priv->ao_inited==MPXP_Ok) uninit_player(INITED_AO); // close device + if(MPXPSys->ao_inited==MPXP_Ok) uninit_player(INITED_AO); // close device } if(!sh_video){ @@ -1960,12 +1960,12 @@ if(mp_conf.verbose) MSG_V("Freeing %d unused video chunks\n",d_video->packs); ds_free_packs(d_video); d_video->id=-2; - if(priv->vo_inited) uninit_player(INITED_VO); + if(MPXPSys->vo_inited) uninit_player(INITED_VO); } if(!sh_audio && !sh_video) exit_player("Nothing to do"); - if(priv->demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf! + if(MPXPSys->demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf! if(mp_conf.force_fps && sh_video) { sh_video->fps=mp_conf.force_fps; @@ -1984,7 +1984,7 @@ if(mp_conf.benchmark) init_benchmark(); /* display clip info */ - demux_info_print(priv->demuxer,filename); + demux_info_print(MPXPSys->demuxer,filename); mpxp_run_ahead_engine(); @@ -2138,14 +2138,14 @@ flg=INITED_ALL; if(input_state.after_dvdmenu) flg &=~(INITED_STREAM|INITED_DEMUXER); uninit_player(flg&(~INITED_INPUT)); /* TODO: |(~INITED_AO)|(~INITED_VO) */ - priv->vo_inited=0; - priv->ao_inited=MPXP_False; + MPXPSys->vo_inited=0; + MPXPSys->ao_inited=MPXP_False; eof = 0; xp_core->audio->eof=0; goto play_next_file; } - if(stream_dump_type>1) dump_mux_close(priv->demuxer); + if(stream_dump_type>1) dump_mux_close(MPXPSys->demuxer); exit_player(MSGTR_Exit_eof); mpxp_uninit_structs(); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-11-15 14:34:45 UTC (rev 374) +++ mplayerxp/mplayerxp.h 2012-11-15 14:48:42 UTC (rev 375) @@ -105,19 +105,20 @@ double total_start; }time_usage_t; +struct MPXPSystem; /* non-configurable through command line stuff */ typedef struct MPXPContext_s { - int rtc_fd; - int seek_time; - int output_quality; - unsigned mpxp_after_seek; - int use_pts_fix2; - unsigned mplayer_accel; - subtitle* subtitles; - m_config_t* mconfig; - time_usage_t*bench; - any_t* priv; - any_t* msg_priv; + int rtc_fd; + int seek_time; + int output_quality; + unsigned mpxp_after_seek; + int use_pts_fix2; + unsigned mplayer_accel; + subtitle* subtitles; + m_config_t* mconfig; + time_usage_t* bench; + struct MPXPSystem* MPXPSys; + any_t* msg_priv; }MPXPContext_t; extern MPXPContext_t* MPXPCtx; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-15 17:23:58
|
Revision: 377 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=377&view=rev Author: nickols_k Date: 2012-11-15 17:23:49 +0000 (Thu, 15 Nov 2012) Log Message: ----------- more .cpp sources + fix getch2() handling Modified Paths: -------------- mplayerxp/input2/Makefile mplayerxp/input2/input.h mplayerxp/input2/lirc.c mplayerxp/mp-opt-reg.cpp mplayerxp/mplayerxp.h mplayerxp/osdep/Makefile mplayerxp/osdep/getch2.h Added Paths: ----------- mplayerxp/input2/input.cpp mplayerxp/input2/joystick.cpp mplayerxp/osdep/getch2.cpp Removed Paths: ------------- mplayerxp/input2/input.c mplayerxp/input2/joystick.c mplayerxp/osdep/getch2.c Modified: mplayerxp/input2/Makefile =================================================================== --- mplayerxp/input2/Makefile 2012-11-15 15:59:41 UTC (rev 376) +++ mplayerxp/input2/Makefile 2012-11-15 17:23:49 UTC (rev 377) @@ -3,19 +3,23 @@ LIBNAME = libinput2.a -SRCS=input.c joystick.c lirc.c +SRCS=lirc.c +CXXSRCS=input.cpp joystick.cpp OBJS=$(SRCS:.c=.o) +CXXOBJS=$(CXXSRCS:.cpp=.o) CFLAGS = $(OPTFLAGS) -I. -I.. -Wall +CXXFLAGS = $(OPTXXFLAGS) -I. -I.. -Wall .SUFFIXES: .c .o - .c.o: $(CC) -c $(CFLAGS) -o $@ $< +.cpp.o: + $(CXX) -c $(CXXFLAGS) -o $@ $< -$(LIBNAME): $(OBJS) - $(AR) r $(LIBNAME) $(OBJS) +$(LIBNAME): $(OBJS) $(CXXOBJS) + $(AR) r $(LIBNAME) $(OBJS) $(CXXOBJS) all: $(LIBNAME) @@ -28,7 +32,7 @@ dep: depend depend: - $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # # include dependency files if they exist Deleted: mplayerxp/input2/input.c =================================================================== --- mplayerxp/input2/input.c 2012-11-15 15:59:41 UTC (rev 376) +++ mplayerxp/input2/input.c 2012-11-15 17:23:49 UTC (rev 377) @@ -1,1438 +0,0 @@ -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <unistd.h> -#include <errno.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <fcntl.h> -#include <ctype.h> - -#include "input.h" -#include "mouse.h" -#ifdef MP_DEBUG -#include <assert.h> -#endif -#include "libmpdemux/stream.h" -#include "osdep/getch2.h" -#include "osdep/keycodes.h" -#include "osdep/get_path.h" -#include "osdep/timer.h" -#include "osdep/mplib.h" -#include "libmpconf/cfgparser.h" - -#include "joystick.h" - -#ifdef HAVE_LIRC -#include "lirc.h" -#endif - -#ifdef HAVE_LIRCC -#include <lirc/lircc.h> -#endif - -#include "in_msg.h" - -#ifndef MP_MAX_KEY_FD -#define MP_MAX_KEY_FD 10 -#endif - -#ifndef MP_MAX_CMD_FD -#define MP_MAX_CMD_FD 10 -#endif - -#define MP_FD_EOF (1<<0) -#define MP_FD_DROP (1<<1) -#define MP_FD_DEAD (1<<2) -#define MP_FD_GOT_CMD (1<<3) -#define MP_FD_NO_SELECT (1<<4) - -#define CMD_QUEUE_SIZE 100 - -typedef int (*mp_key_func_t)(any_t* ctx); // These functions should return the key code or one of the error code -typedef int (*mp_cmd_func_t)(any_t* ctx,char* dest,int size); // These functions should act like read but they must use our error code (if needed ;-) -typedef void (*mp_close_func_t)(any_t* ctx); // These are used to close the driver - - -typedef struct mp_cmd_bind { - int input[MP_MAX_KEY_DOWN+1]; - char* cmd; -} mp_cmd_bind_t; - -typedef struct mp_key_name { - int key; - char* name; -} mp_key_name_t; - - -typedef struct mp_input_fd { - any_t* opaque; - any_t* read_func; - mp_close_func_t close_func; - int flags; - // This fields are for the cmd fds - char* buffer; - int pos,size; -} mp_input_fd_t; - -typedef struct mp_cmd_filter_st mp_cmd_filter_t; - -struct mp_cmd_filter_st { - mp_input_cmd_filter filter; - any_t* ctx; - mp_cmd_filter_t* next; -}; - -typedef struct priv_s { - char antiviral_hole[RND_CHAR1]; - // These are the user defined binds - mp_cmd_bind_t* cmd_binds; - mp_cmd_filter_t* cmd_filters; - - mp_input_fd_t key_fds[MP_MAX_KEY_FD]; - unsigned int num_key_fd; - mp_input_fd_t cmd_fds[MP_MAX_CMD_FD]; - unsigned int num_cmd_fd; - mp_cmd_t* cmd_queue[CMD_QUEUE_SIZE]; - unsigned int cmd_queue_length,cmd_queue_start,cmd_queue_end; - // this is the key currently down - int key_down[MP_MAX_KEY_DOWN]; - unsigned int num_key_down,last_key_down; - // Autorepeat stuff - short ar_state; - mp_cmd_t* ar_cmd; - unsigned int last_ar; - - int in_file_fd; - int tim; //for getch2 - char key_str[12]; -}priv_t; - -typedef struct input_conf_s { - int use_joystick,use_lirc,use_lircc; - unsigned ar_delay,ar_rate; - const char* js_dev; - const char* in_file; - int print_key_list,print_cmd_list; -}input_conf_t; -static input_conf_t libinput_conf = { 1, 1, 1, 100, 8, "/dev/input/js0", NULL, 0, 0 }; - -/// This array defines all know commands. -/// The first field is an id used to recognize the command without too many strcmp -/// The second is abviously the command name -/// The third is the minimum number of argument this command need -/// Then come the definition of each argument, terminated with and arg of type -1 -/// A command can take maximum MP_CMD_MAX_ARGS-1 arguments (-1 because of -/// the terminal one) wich is actually 9 - -/// For the args, the first field is the type (actually int, float or string), the second -/// is the default value wich is used for optional arguments - -static const mp_cmd_t mp_cmds[] = { - { MP_CMD_SEEK, "seek", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, - { MP_CMD_SPEED_INCR, "speed_incr", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, - { MP_CMD_SPEED_MULT, "speed_mult", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, - { MP_CMD_SPEED_SET, "speed_set", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, - { MP_CMD_SWITCH_AUDIO, "cycle_audio", 0, { {-1,{0}} } }, - { MP_CMD_SWITCH_VIDEO, "cycle_video", 0, { {-1,{0}} } }, - { MP_CMD_SWITCH_SUB, "cycle_subtitles", 0, { {-1,{0}} } }, - { MP_CMD_QUIT, "quit", 0, { {-1,{0}} } }, - { MP_CMD_SOFT_QUIT, "soft_quit", 0, { {-1,{0}} } }, - { MP_CMD_PAUSE, "pause", 0, { {-1,{0}} } }, - { MP_CMD_FRAME_STEP, "frame_step", 0, { {-1,{0}} } }, - { MP_CMD_PLAY_TREE_STEP, "pt_step",1, { { MP_CMD_ARG_INT ,{0}}, { MP_CMD_ARG_INT ,{0}}, {-1,{0}} } }, - { MP_CMD_PLAY_TREE_UP_STEP, "pt_up_step",1, { { MP_CMD_ARG_INT,{0} }, { MP_CMD_ARG_INT ,{0}}, {-1,{0}} } }, - { MP_CMD_PLAY_ALT_SRC_STEP, "alt_src_step",1, { { MP_CMD_ARG_INT,{0} }, {-1,{0}} } }, - { MP_CMD_OSD, "osd",0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } }, - { MP_CMD_VOLUME, "volume", 1, { { MP_CMD_ARG_INT,{0} }, {-1,{0}} } }, - { MP_CMD_MUTE, "mute", 0, { {-1,{0}} } }, - { MP_CMD_CONTRAST, "contrast",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, - { MP_CMD_BRIGHTNESS, "brightness",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, - { MP_CMD_HUE, "hue",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, - { MP_CMD_SATURATION, "saturation",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, - { MP_CMD_FRAMEDROPPING, "frame_drop",0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } }, - { MP_CMD_SUB_POS, "sub_pos", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, -#ifdef USE_TV - { MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", 1, { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }}, - { MP_CMD_TV_STEP_NORM, "tv_step_norm",0, { {-1,{0}} } }, - { MP_CMD_TV_STEP_CHANNEL_LIST, "tv_step_chanlist", 0, { {-1,{0}} } }, -#endif - { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } }, - { MP_CMD_VO_SCREENSHOT, "vo_screenshot", 0, { {-1,{0}} } }, - { MP_CMD_PANSCAN, "panscan",1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, - -#ifdef USE_DVDNAV - { MP_CMD_DVDNAV, "dvdnav", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, - { MP_CMD_DVDNAV_EVENT, "dvdnav_event", 1, { { MP_CMD_ARG_VOID, {0}}, {-1, {0}} } }, -#endif - { MP_CMD_MENU, "menu",1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, - { MP_CMD_SET_MENU, "set_menu",1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, - { MP_CMD_CHELP, "help", 0, { {-1,{0}} } }, - { MP_CMD_CEXIT, "exit", 0, { {-1,{0}} } }, - { MP_CMD_CHIDE, "hide", 0, { {MP_CMD_ARG_INT,{3000}}, {-1,{0}} } }, - - { 0, NULL, 0, {} } -}; - -/// The names of the key for input.conf -/// If you add some new keys, you also need to add them here - -static const mp_key_name_t key_names[] = { - { ' ', "SPACE" }, - { KEY_ENTER, "ENTER" }, - { KEY_TAB, "TAB" }, - { KEY_CTRL, "CTRL" }, - { KEY_BACKSPACE, "BS" }, - { KEY_DELETE, "DEL" }, - { KEY_INSERT, "INS" }, - { KEY_HOME, "HOME" }, - { KEY_END, "END" }, - { KEY_PAGE_UP, "PGUP" }, - { KEY_PAGE_DOWN, "PGDWN" }, - { KEY_ESC, "ESC" }, - { KEY_RIGHT, "RIGHT" }, - { KEY_LEFT, "LEFT" }, - { KEY_DOWN, "DOWN" }, - { KEY_UP, "UP" }, - { KEY_F+1, "F1" }, - { KEY_F+2, "F2" }, - { KEY_F+3, "F3" }, - { KEY_F+4, "F4" }, - { KEY_F+5, "F5" }, - { KEY_F+6, "F6" }, - { KEY_F+7, "F7" }, - { KEY_F+8, "F8" }, - { KEY_F+9, "F9" }, - { KEY_F+10, "F10" }, - { KEY_KP0, "KP0" }, - { KEY_KP1, "KP1" }, - { KEY_KP2, "KP2" }, - { KEY_KP3, "KP3" }, - { KEY_KP4, "KP4" }, - { KEY_KP5, "KP5" }, - { KEY_KP6, "KP6" }, - { KEY_KP7, "KP7" }, - { KEY_KP8, "KP8" }, - { KEY_KP9, "KP9" }, - { KEY_KPDEL, "KP_DEL" }, - { KEY_KPDEC, "KP_DEL" }, - { KEY_KPINS, "KP0" }, - { KEY_KPENTER, "KP_ENTER" }, - { MOUSE_BTN0, "MOUSE_BTN0" }, - { MOUSE_BTN1, "MOUSE_BTN1" }, - { MOUSE_BTN2, "MOUSE_BTN2" }, - { MOUSE_BTN3, "MOUSE_BTN3" }, - { MOUSE_BTN4, "MOUSE_BTN4" }, - { MOUSE_BTN5, "MOUSE_BTN5" }, - { MOUSE_BTN6, "MOUSE_BTN6" }, - { MOUSE_BTN7, "MOUSE_BTN7" }, - { MOUSE_BTN8, "MOUSE_BTN8" }, - { MOUSE_BTN9, "MOUSE_BTN9" }, - { MOUSE_BTN0_DBL, "MOUSE_BTN0_DBL" }, - { MOUSE_BTN1_DBL, "MOUSE_BTN1_DBL" }, - { MOUSE_BTN2_DBL, "MOUSE_BTN2_DBL" }, - { MOUSE_BTN3_DBL, "MOUSE_BTN3_DBL" }, - { MOUSE_BTN4_DBL, "MOUSE_BTN4_DBL" }, - { MOUSE_BTN5_DBL, "MOUSE_BTN5_DBL" }, - { MOUSE_BTN6_DBL, "MOUSE_BTN6_DBL" }, - { MOUSE_BTN7_DBL, "MOUSE_BTN7_DBL" }, - { MOUSE_BTN8_DBL, "MOUSE_BTN8_DBL" }, - { MOUSE_BTN9_DBL, "MOUSE_BTN9_DBL" }, - { JOY_AXIS1_MINUS, "JOY_UP" }, - { JOY_AXIS1_PLUS, "JOY_DOWN" }, - { JOY_AXIS0_MINUS, "JOY_LEFT" }, - { JOY_AXIS0_PLUS, "JOY_RIGHT" }, - - { JOY_AXIS0_PLUS, "JOY_AXIS0_PLUS" }, - { JOY_AXIS0_MINUS, "JOY_AXIS0_MINUS" }, - { JOY_AXIS1_PLUS, "JOY_AXIS1_PLUS" }, - { JOY_AXIS1_MINUS, "JOY_AXIS1_MINUS" }, - { JOY_AXIS2_PLUS, "JOY_AXIS2_PLUS" }, - { JOY_AXIS2_MINUS, "JOY_AXIS2_MINUS" }, - { JOY_AXIS3_PLUS, "JOY_AXIS3_PLUS" }, - { JOY_AXIS3_MINUS, "JOY_AXIS3_MINUS" }, - { JOY_AXIS4_PLUS, "JOY_AXIS4_PLUS" }, - { JOY_AXIS4_MINUS, "JOY_AXIS4_MINUS" }, - { JOY_AXIS5_PLUS, "JOY_AXIS5_PLUS" }, - { JOY_AXIS5_MINUS, "JOY_AXIS5_MINUS" }, - { JOY_AXIS6_PLUS, "JOY_AXIS6_PLUS" }, - { JOY_AXIS6_MINUS, "JOY_AXIS6_MINUS" }, - { JOY_AXIS7_PLUS, "JOY_AXIS7_PLUS" }, - { JOY_AXIS7_MINUS, "JOY_AXIS7_MINUS" }, - { JOY_AXIS8_PLUS, "JOY_AXIS8_PLUS" }, - { JOY_AXIS8_MINUS, "JOY_AXIS8_MINUS" }, - { JOY_AXIS9_PLUS, "JOY_AXIS9_PLUS" }, - { JOY_AXIS9_MINUS, "JOY_AXIS9_MINUS" }, - - { JOY_BTN0, "JOY_BTN0" }, - { JOY_BTN1, "JOY_BTN1" }, - { JOY_BTN2, "JOY_BTN2" }, - { JOY_BTN3, "JOY_BTN3" }, - { JOY_BTN4, "JOY_BTN4" }, - { JOY_BTN5, "JOY_BTN5" }, - { JOY_BTN6, "JOY_BTN6" }, - { JOY_BTN7, "JOY_BTN7" }, - { JOY_BTN8, "JOY_BTN8" }, - { JOY_BTN9, "JOY_BTN9" }, - - { KEY_XF86_STANDBY, "XF86_STANDBY" }, - { KEY_XF86_POWER, "XF86_POWER" }, - { KEY_XF86_PAUSE, "XF86_PAUSE" }, - { KEY_XF86_STOP, "XF86_STOP" }, - { KEY_XF86_PREV, "XF86_PREV" }, - { KEY_XF86_NEXT, "XF86_NEXT" }, - { KEY_XF86_VOLUME_UP, "XF86_VOLUME_UP" }, - { KEY_XF86_VOLUME_DN, "XF86_VOLUME_DN" }, - { KEY_XF86_MUTE, "XF86_MUTE" }, - { KEY_XF86_EJECT, "XF86_EJECT" }, - { KEY_XF86_MENU, "XF86_MENU" }, - { KEY_XF86_PLAY, "XF86_PLAY" }, - { KEY_XF86_FORWARD, "XF86_FORWARD" }, - { KEY_XF86_REWIND, "XF86_REWIND" }, - { KEY_XF86_BRIGHTNESS, "XF86_BRIGHTNESS" }, - { KEY_XF86_CONTRAST, "XF86_CONTRAST" }, - { KEY_XF86_SATURATION, "XF86_SATURATION" }, - { KEY_XF86_SCREENSAVE, "XF86_SCREENSAVE" }, - { KEY_XF86_REFRESH, "XF86_REFRESH" }, - - { 0, NULL } -}; - -// This is the default binding. The content of input.conf override these ones. -// The first args is a null terminated array of key codes. -// The second is the command - -static const mp_cmd_bind_t def_cmd_binds[] = { - - { { MOUSE_BTN3, 0 }, "seek 10" }, - { { MOUSE_BTN4, 0 }, "seek -10" }, - { { MOUSE_BTN5, 0 }, "volume 1" }, - { { MOUSE_BTN6, 0 }, "volume -1" }, - -#ifdef USE_DVDNAV - { { KEY_KP8, 0 }, "dvdnav 1" }, // up - { { KEY_KP2, 0 }, "dvdnav 2" }, // down - { { KEY_KP4, 0 }, "dvdnav 3" }, // left - { { KEY_KP6, 0 }, "dvdnav 4" }, // right - { { KEY_KP5, 0 }, "dvdnav 5" }, // menu - { { KEY_KP0, 0 }, "dvdnav 6" }, // select - { { KEY_KPINS, 0 }, "dvdnav 6" }, // select -#endif - { { KEY_F+3, 0 }, "menu menu" }, - { { KEY_XF86_MENU, 0 }, "menu menu" }, - { { KEY_F+2, 0 }, "set_menu" }, - { { KEY_F+1, 0 }, "menu help" }, - { { KEY_F+10, 0 }, "menu exit" }, - { { KEY_F+8, 0 }, "menu hide" }, - - { { KEY_RIGHT, 0 }, "seek 10" }, - { { KEY_LEFT, 0 }, "seek -10" }, - { { KEY_UP, 0 }, "seek 60" }, - { { KEY_DOWN, 0 }, "seek -60" }, - { { KEY_PAGE_UP, 0 }, "seek 600" }, - { { KEY_PAGE_DOWN, 0 }, "seek -600" }, - { { '[', 0 }, "speed_mult 0.9091" }, - { { ']', 0 }, "speed_mult 1.1" }, - { { '{', 0 }, "speed_mult 0.5" }, - { { '}', 0 }, "speed_mult 2.0" }, - { { KEY_BACKSPACE, 0 }, "speed_set 1.0" }, - { { 'q', 0 }, "soft_quit" }, - { { KEY_ESC, 0 }, "quit" }, - { { 'p', 0 }, "pause" }, - { { ' ', 0 }, "pause" }, - { { '.', 0 }, "frame_step" }, - { { KEY_HOME, 0 }, "pt_up_step 1" }, - { { KEY_END, 0 }, "pt_up_step -1" }, - { { '>', 0 }, "pt_step 1" }, - { { KEY_ENTER, 0 }, "pt_step 1 1" }, - { { '<', 0 }, "pt_step -1" }, - { { KEY_INS, 0 }, "alt_src_step 1" }, - { { KEY_DEL, 0 }, "alt_src_step -1" }, - { { 'o', 0 }, "osd" }, - { { '9', 0 }, "volume -1" }, - { { '/', 0 }, "volume -1" }, - { { '0', 0 }, "volume 1" }, - { { '*', 0 }, "volume 1" }, - { { 'm', 0 }, "mute" }, - { { '1', 0 }, "contrast -1" }, - { { '2', 0 }, "contrast 1" }, - { { '3', 0 }, "brightness -1" }, - { { '4', 0 }, "brightness 1" }, - { { '5', 0 }, "hue -1" }, - { { '6', 0 }, "hue 1" }, - { { '7', 0 }, "saturation -1" }, - { { '8', 0 }, "saturation 1" }, - { { 'd', 0 }, "frame_drop" }, - { { 'r', 0 }, "sub_pos -1" }, - { { 't', 0 }, "sub_pos +1" }, -#ifdef USE_TV - { { 'h', 0 }, "tv_step_channel 1" }, - { { 'k', 0 }, "tv_step_channel -1" }, - { { 'n', 0 }, "tv_step_norm" }, - { { 'u', 0 }, "tv_step_chanlist" }, -#endif -#ifdef HAVE_JOYSTICK - { { JOY_AXIS0_PLUS, 0 }, "seek 10" }, - { { JOY_AXIS0_MINUS, 0 }, "seek -10" }, - { { JOY_AXIS1_MINUS, 0 }, "seek 60" }, - { { JOY_AXIS1_PLUS, 0 }, "seek -60" }, - { { JOY_BTN0, 0 }, "pause" }, - { { JOY_BTN1, 0 }, "osd" }, - { { JOY_BTN2, 0 }, "volume 1"}, - { { JOY_BTN3, 0 }, "volume -1"}, -#endif - { { 'f', 0 }, "vo_fullscreen" }, - { { 's', 0 }, "vo_screenshot" }, - { { 'w', 0 }, "panscan -0.1" }, - { { 'e', 0 }, "panscan +0.1" }, - - { { 'a', 0 }, "cycle_audio" }, - { { 'v', 0 }, "cycle_video" }, - { { 'c', 0 }, "cycle_subtitles" }, - - { { KEY_XF86_PLAY, 0 }, "pause" }, - { { KEY_XF86_PAUSE, 0 }, "pause" }, - { { KEY_XF86_STANDBY, 0 }, "pause" }, - { { KEY_XF86_STOP, 0 }, "soft_quit" }, - { { KEY_XF86_POWER, 0 }, "quit" }, - { { KEY_XF86_EJECT, 0 }, "quit" }, - { { KEY_XF86_PREV, 0 }, "pt_step -1" }, - { { KEY_XF86_NEXT, 0 }, "pt_step 1" }, - { { KEY_XF86_REWIND, 0 }, "seek -60" }, - { { KEY_XF86_FORWARD, 0 }, "seek 60" }, - { { KEY_XF86_VOLUME_UP, 0 }, "volume 1"}, - { { KEY_XF86_VOLUME_DN, 0 }, "volume -1"}, - { { KEY_XF86_MUTE, 0 }, "mute" }, - { { KEY_XF86_SCREENSAVE, 0 }, "vo_screenshot" }, - { { KEY_XF86_BRIGHTNESS, 0 }, "brightness 1" }, - { { KEY_XF86_CONTRAST, 0 }, "contrast 1" }, - { { KEY_XF86_SATURATION, 0 }, "saturation 1" }, - { { KEY_XF86_REFRESH, 0 }, "pause" }, - - { { 0 }, NULL } -}; - -static char* config_file = "input.conf"; - -// Callback to allow the menu filter to grab the incoming keys -void (*mp_input_key_cb)(int code) = NULL; - -static mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd); // This create a copy of a command (used by the auto repeat stuff) -static int mp_input_print_key_list(any_t*); -static int mp_input_print_cmd_list(any_t*); - -static const config_t joystick_conf[] = { - { "on", &libinput_conf.use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of joystick" }, - { "off", &libinput_conf.use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of joystick" }, - { "dev", &libinput_conf.js_dev, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies the joystick device" }, - { NULL, NULL, 0, 0, 0, 0, NULL} -}; - -extern char *lirc_configfile; -// Our command line options -static const config_t input_conf[] = { - { "conf", &config_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies alternative input.conf" }, - { "ar-delay", &libinput_conf.ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "autorepeate a key delay in milliseconds (0 to disable)" }, - { "ar-rate", &libinput_conf.ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "number of key-presses per second generating on autorepeat" }, - { "keylist", &libinput_conf.print_key_list, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "prints all keys that can be bound to commands" }, - { "cmdlist", &libinput_conf.print_cmd_list, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "prints all commands that can be bound to keys" }, - { "file", &libinput_conf.in_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifes file with commands (useful for FIFO)" }, -#ifdef HAVE_LIRC - { "lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies a config.file for LIRC"}, -#endif - { "lirc", &libinput_conf.use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of lirc" }, - { "nolirc", &libinput_conf.use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of lirc" }, - { "lircc", &libinput_conf.use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of lirc daemon" }, - { "nolircc", &libinput_conf.use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of lirc daemon" }, - { "joystick", &joystick_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Joystick related options" }, - { NULL, NULL, 0, 0, 0, 0, NULL} -}; - -static const config_t mp_input_opts[] = { - { "input", &input_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Input specific options"}, - { NULL, NULL, 0, 0, 0, 0, NULL} -}; - -static int mp_input_default_key_func(any_t* fd); -static int mp_input_default_cmd_func(any_t* fd,char* buf, int l); -static char* mp_input_get_key_name(any_t*,int key); - -static MPXP_Rc mp_input_add_cmd_fd(any_t* handle,any_t* opaque, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { - priv_t* priv = (priv_t*)handle; - if(priv->num_cmd_fd == MP_MAX_CMD_FD) { - MSG_ERR("Too much command fd, unable to register fd\n"); - return MPXP_False; - } - - memset(&priv->cmd_fds[priv->num_cmd_fd],0,sizeof(mp_input_fd_t)); - priv->cmd_fds[priv->num_cmd_fd].opaque = opaque; - priv->cmd_fds[priv->num_cmd_fd].read_func = read_func ? read_func : mp_input_default_cmd_func; - priv->cmd_fds[priv->num_cmd_fd].close_func = close_func; - if(!sel) priv->cmd_fds[priv->num_cmd_fd].flags = MP_FD_NO_SELECT; - priv->num_cmd_fd++; - - return MPXP_Ok; -} - -static void mp_input_rm_cmd_fd(any_t* handle,any_t* fd) { - priv_t* priv = (priv_t*)handle; - unsigned int i; - - for(i = 0; i < priv->num_cmd_fd; i++) { - if(priv->cmd_fds[i].opaque == fd) break; - } - if(i == priv->num_cmd_fd) return; - if(priv->cmd_fds[i].close_func) priv->cmd_fds[i].close_func(priv->cmd_fds[i].opaque); - if(priv->cmd_fds[i].buffer) mp_free(priv->cmd_fds[i].buffer); - if(i + 1 < priv->num_cmd_fd) memmove(&priv->cmd_fds[i],&priv->cmd_fds[i+1],(priv->num_cmd_fd-i-1)*sizeof(mp_input_fd_t)); - priv->num_cmd_fd--; -} - -static void mp_input_rm_key_fd(any_t* handle,any_t* fd) { - priv_t* priv = (priv_t*)handle; - unsigned int i; - - for(i = 0; i < priv->num_key_fd; i++) { - if(priv->key_fds[i].opaque == fd) break; - } - if(i == priv->num_key_fd) return; - if(priv->key_fds[i].close_func) priv->key_fds[i].close_func(priv->key_fds[i].opaque); - if(i + 1 < priv->num_key_fd) memmove(&priv->key_fds[i],&priv->key_fds[i+1],(priv->num_key_fd-i-1)*sizeof(mp_input_fd_t)); - priv->num_key_fd--; -} - -static MPXP_Rc mp_input_add_key_fd(any_t* handle,any_t* opaque, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { - priv_t* priv = (priv_t*)handle; - if(priv->num_key_fd == MP_MAX_KEY_FD) { - MSG_ERR("Too much key fd, unable to register fd\n"); - return MPXP_False; - } - - memset(&priv->key_fds[priv->num_key_fd],0,sizeof(mp_input_fd_t)); - priv->key_fds[priv->num_key_fd].opaque = opaque; - priv->key_fds[priv->num_key_fd].read_func = read_func ? read_func : mp_input_default_key_func; - priv->key_fds[priv->num_key_fd].close_func = close_func; - if(!sel) priv->key_fds[priv->num_key_fd].flags |= MP_FD_NO_SELECT; - priv->num_key_fd++; - - return MPXP_Ok; -} - -mp_cmd_t* mp_input_parse_cmd(char* str) { - int i,l; - char *ptr,*e; - mp_cmd_t *cmd; - const mp_cmd_t *cmd_def; - -#ifdef MP_DEBUG - assert(str != NULL); -#endif - - for(ptr = str ; ptr[0] != '\0' && ptr[0] != '\t' && ptr[0] != ' ' ; ptr++) - /* NOTHING */; - if(ptr[0] != '\0') l = ptr-str; - else l = strlen(str); - - if(l == 0) return NULL; - - for(i=0; mp_cmds[i].name != NULL; i++) { - if(strncasecmp(mp_cmds[i].name,str,l) == 0) break; - } - - if(mp_cmds[i].name == NULL) return NULL; - - cmd_def = &mp_cmds[i]; - - cmd = (mp_cmd_t*)mp_malloc(sizeof(mp_cmd_t)); - cmd->id = cmd_def->id; - cmd->name = mp_strdup(cmd_def->name); - - ptr = str; - - for(i=0; ptr && i < MP_CMD_MAX_ARGS; i++) { - ptr = strchr(ptr,' '); - if(!ptr) break; - while(ptr[0] == ' ' || ptr[0] == '\t') ptr++; - if(ptr[0] == '\0') break; - cmd->args[i].type = cmd_def->args[i].type; - switch(cmd_def->args[i].type) { - case MP_CMD_ARG_INT: - errno = 0; - cmd->args[i].v.i = atoi(ptr); - if(errno != 0) { - MSG_ERR("Command %s : argument %d isn't an integer\n",cmd_def->name,i+1); - ptr = NULL; - } - break; - case MP_CMD_ARG_FLOAT: - errno = 0; - /* <ol...@al...> Use portable C locale for parsing floats: */ -#ifdef USE_SETLOCALE - setlocale(LC_NUMERIC, "C"); -#endif - cmd->args[i].v.f = atof(ptr); -#ifdef USE_SETLOCALE - setlocale(LC_NUMERIC, ""); -#endif - if(errno != 0) { - MSG_ERR("Command %s : argument %d isn't a float\n",cmd_def->name,i+1); - ptr = NULL; - } - break; - case MP_CMD_ARG_STRING: { - char term; - char* ptr2 = ptr, *start; - if(ptr[0] == '\'' || ptr[0] == '"') { - term = ptr[0]; - ptr2++; - } else - term = ' '; - start = ptr2; - while(1) { - e = strchr(ptr2,term); - if(!e) break; - if(e <= ptr2 || *(e - 1) != '\\') break; - ptr2 = e + 1; - } - if(term != ' ' && (!e || e[0] == '\0')) { - MSG_ERR("Command %s : argument %d is unterminated\n",cmd_def->name,i+1); - ptr = NULL; - break; - } else if(!e) e = ptr+strlen(ptr); - l = e-start; - cmd->args[i].v.s = (char*)mp_malloc((l+1)*sizeof(char)); - strncpy(cmd->args[i].v.s,start,l); - cmd->args[i].v.s[l] = '\0'; - ptr2 = start; - for(e = strchr(ptr2,'\\') ; e ; e = strchr(ptr2,'\\')) { - memmove(e,e+1,strlen(e)); - ptr2 = e + 1; - } - } break; - case -1: ptr = NULL; - default: MSG_ERR("Unknown argument %d\n",i); - } - } - cmd->nargs = i; - if(cmd_def->nargs > cmd->nargs) { - MSG_ERR("Got command '%s' but\n",str); - MSG_ERR("command %s require at least %d arguments, we found only %d so far\n",cmd_def->name,cmd_def->nargs,cmd->nargs); - mp_cmd_free(cmd); - return NULL; - } - for( ; i < MP_CMD_MAX_ARGS && cmd_def->args[i].type != -1 ; i++) { - memcpy(&cmd->args[i],&cmd_def->args[i],sizeof(mp_cmd_arg_t)); - if(cmd_def->args[i].type == MP_CMD_ARG_STRING && cmd_def->args[i].v.s != NULL) - cmd->args[i].v.s = mp_strdup(cmd_def->args[i].v.s); - } - if(i < MP_CMD_MAX_ARGS) cmd->args[i].type = -1; - return cmd; -} - -static int mp_input_default_key_func(any_t* fd) { - priv_t* priv = (priv_t*)fd; - int r,code=0; - unsigned int l; - l = 0; - if(priv->in_file_fd == 0) { // stdin is handled by getch2 - code = getch2(priv->tim); - if(code < 0) code = MP_INPUT_NOTHING; - } else - fcntl(priv->in_file_fd,F_SETFL,fcntl(priv->in_file_fd,F_GETFL)|O_NONBLOCK); - while(l < sizeof(int)) { - r = read(priv->in_file_fd,(&code)+l,sizeof(int)-l); - if(r <= 0) break; - l +=r; - } - return code; -} - -#define MP_CMD_MAX_SIZE 256 -static int mp_input_read_cmd(mp_input_fd_t* mp_fd, char** ret) { - char* end; - (*ret) = NULL; - - // Allocate the buffer if it dont exist - if(!mp_fd->buffer) { - mp_fd->buffer = (char*)mp_malloc(MP_CMD_MAX_SIZE*sizeof(char)); - mp_fd->pos = 0; - mp_fd->size = MP_CMD_MAX_SIZE; - } - - // Get some data if needed/possible - while( !(mp_fd->flags & MP_FD_GOT_CMD) && !(mp_fd->flags & MP_FD_EOF) && (mp_fd->size-mp_fd->pos>1)) { - int r = ((mp_cmd_func_t)mp_fd->read_func)(mp_fd->opaque,mp_fd->buffer+mp_fd->pos,mp_fd->size-1-mp_fd->pos); - // Error ? - if(r < 0) { - switch(r) { - case MP_INPUT_ERROR: - case MP_INPUT_DEAD: - MSG_ERR("Error while reading cmd fd: %s\n",strerror(errno)); - case MP_INPUT_NOTHING: return r; - } - // EOF ? - } else if(r == 0) { - mp_fd->flags |= MP_FD_EOF; - break; - } - mp_fd->pos += r; - break; - } - // Reset the got_cmd flag - mp_fd->flags &= ~MP_FD_GOT_CMD; - while(1) { - int l = 0; - // Find the cmd end - mp_fd->buffer[mp_fd->pos] = '\0'; - end = strchr(mp_fd->buffer,'\n'); - // No cmd end ? - if(!end) { - // If buffer is full we must drop all until the next \n - if(mp_fd->size - mp_fd->pos <= 1) { - MSG_ERR("Cmd buffer is full: dropping content\n"); - mp_fd->pos = 0; - mp_fd->flags |= MP_FD_DROP; - } - break; - } - // We alredy have a cmd : set the got_cmd flag - else if((*ret)) { - mp_fd->flags |= MP_FD_GOT_CMD; - break; - } - l = end - mp_fd->buffer; - // Not dropping : put the cmd in ret - if( ! (mp_fd->flags & MP_FD_DROP)) { - (*ret) = (char*)mp_malloc((l+1)*sizeof(char)); - strncpy((*ret),mp_fd->buffer,l); - (*ret)[l] = '\0'; - } else { // Remove the dropping flag - mp_fd->flags &= ~MP_FD_DROP; - } - if( mp_fd->pos - (l+1) > 0) memmove(mp_fd->buffer,end+1,mp_fd->pos-(l+1)); - mp_fd->pos -= l+1; - } - if(*ret) return 1; - else return MP_INPUT_NOTHING; -} - -static int mp_input_default_cmd_func(any_t* fd,char* buf, int l) { - priv_t* priv=(priv_t*)fd; - fcntl(priv->in_file_fd,F_SETFL,fcntl(priv->in_file_fd,F_GETFL)|O_NONBLOCK); - while(1) { - int r = read(priv->in_file_fd,buf,l); - // Error ? - if(r < 0) { - if(errno == EINTR) continue; - else if(errno == EAGAIN) return MP_INPUT_NOTHING; - return MP_INPUT_ERROR; - // EOF ? - } - return r; - } -} - -void mp_input_add_cmd_filter(any_t* handle,mp_input_cmd_filter func, any_t* ctx) { - priv_t* priv = (priv_t*)handle; - mp_cmd_filter_t* filter = mp_malloc(sizeof(mp_cmd_filter_t))/*, *prev*/; - - filter->filter = func; - filter->ctx = ctx; - filter->next = priv->cmd_filters; - priv->cmd_filters = filter; - SECURE_NAME9(rnd_fill)(priv->antiviral_hole,offsetof(priv_t,cmd_binds)-offsetof(priv_t,antiviral_hole)); -} - -static char* mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) { - int j; - - for(j = 0; binds[j].cmd != NULL; j++) { - if(n > 0) { - int found = 1,s; - for(s = 0; s < n && binds[j].input[s] != 0; s++) { - if(binds[j].input[s] != keys[s]) { - found = 0; - break; - } - } - if(found && binds[j].input[s] == 0 && s == n) break; - else continue; - } else if(n == 1){ - if(binds[j].input[0] == keys[0] && binds[j].input[1] == 0) break; - } - } - return binds[j].cmd; -} - -mp_cmd_t* mp_input_get_cmd_from_keys(any_t* handle,int n,int* keys) { - priv_t* priv = (priv_t*)handle; - char* cmd = NULL; - mp_cmd_t* ret; - - if(priv->cmd_binds) cmd = mp_input_find_bind_for_key(priv->cmd_binds,n,keys); - if(cmd == NULL) cmd = mp_input_find_bind_for_key(def_cmd_binds,n,keys); - if(cmd == NULL) { - MSG_WARN("No bind found for key %s",mp_input_get_key_name(priv,keys[0])); - if(n > 1) { - int s; - for(s=1; s < n; s++) MSG_WARN("-%s",mp_input_get_key_name(priv,keys[s])); - } - MSG_WARN(" \n"); - return NULL; - } - ret = mp_input_parse_cmd(cmd); - if(!ret) { - MSG_ERR("Invalid command for binded key %s",mp_input_get_key_name(priv,priv->key_down[0])); - if(priv->num_key_down > 1) { - unsigned int s; - for(s=1; s < priv->num_key_down; s++) MSG_ERR("-%s",mp_input_get_key_name(priv,priv->key_down[s])); - } - MSG_ERR(" : %s \n",cmd); - } - return ret; -} - -static int mp_input_read_key_code(any_t* handle,int tim) { - priv_t* priv = (priv_t*)handle; - int n=0; - unsigned i; - - if(priv->num_key_fd == 0) return MP_INPUT_NOTHING; - - // Remove fd marked as dead and build the fd_set - // n == number of fd's to be select() checked - for(i = 0; (unsigned int)i < priv->num_key_fd; i++) { - if( (priv->key_fds[i].flags & MP_FD_DEAD) ) { - mp_input_rm_key_fd(priv,priv->key_fds[i].opaque); - i--; - continue; - } else if(priv->key_fds[i].flags & MP_FD_NO_SELECT) continue; - n++; - } - - if(priv->num_key_fd == 0) return MP_INPUT_NOTHING; - for(i = 0; i < priv->num_key_fd; i++) { - int code = -1; - priv->tim = tim; - code = ((mp_key_func_t)priv->key_fds[i].read_func)(priv->key_fds[i].opaque); - if(code >= 0) return code; - - if(code == MP_INPUT_ERROR) MSG_ERR("Error on key input fd\n"); - else if(code == MP_INPUT_DEAD) { - MSG_ERR("Dead key input on fd\n"); - mp_input_rm_key_fd(priv,priv->key_fds[i].opaque); - } - } - return MP_INPUT_NOTHING; -} - -static mp_cmd_t* mp_input_read_keys(any_t*handle,int tim) { - priv_t* priv = (priv_t*)handle; - int code = mp_input_read_key_code(priv,tim); - unsigned int j; - mp_cmd_t* ret; - - if(mp_input_key_cb) { - for( ; code >= 0 ; code = mp_input_read_key_code(priv,0) ) { - if(code & MP_KEY_DOWN) continue; - code &= ~(MP_KEY_DOWN|MP_NO_REPEAT_KEY); - mp_input_key_cb(code); - } - return NULL; - } - - for( ; code >= 0 ; code = mp_input_read_key_code(priv,0) ) { - // key pushed - if(code & MP_KEY_DOWN) { - if(priv->num_key_down > MP_MAX_KEY_DOWN) { - MSG_ERR("Too much key down at the same time\n"); - continue; - } - code &= ~MP_KEY_DOWN; - // Check if we don't already have this key as pushed - for(j = 0; j < priv->num_key_down; j++) { - if(priv->key_down[j] == code) - break; - } - if(j != priv->num_key_down) continue; - priv->key_down[priv->num_key_down] = code; - priv->num_key_down++; - priv->last_key_down = GetTimer(); - priv->ar_state = 0; - continue; - } - // key released - // Check if the key is in the down key, driver which can't send push event - // send only release event - for(j = 0; j < priv->num_key_down; j++) { - if(priv->key_down[j] == code) break; - } - if(j == priv->num_key_down) { // key was not in the down keys : add it - if(priv->num_key_down > MP_MAX_KEY_DOWN) { - MSG_ERR("Too much key down at the same time\n"); - continue; - } - priv->key_down[priv->num_key_down] = code; - priv->num_key_down++; - priv->last_key_down = 1; - } - // We ignore key from last combination - ret = priv->last_key_down ? mp_input_get_cmd_from_keys(priv,priv->num_key_down,priv->key_down):NULL; - // Remove the key - if(j+1 < priv->num_key_down) memmove(&priv->key_down[j],&priv->key_down[j+1],(priv->num_key_down-(j+1))*sizeof(int)); - priv->num_key_down--; - priv->last_key_down = 0; - priv->ar_state = -1; - if(priv->ar_cmd) { - mp_cmd_free(priv->ar_cmd); - priv->ar_cmd = NULL; - } - if(ret) return ret; - } - - // No input : autorepeat ? - if(libinput_conf.ar_rate > 0 && priv->ar_state >=0 && priv->num_key_down > 0 && !(priv->key_down[priv->num_key_down-1]&MP_NO_REPEAT_KEY)) { - unsigned int t = GetTimer(); - // First time : wait delay - if(priv->ar_state == 0 && (t - priv->last_key_down) >= libinput_conf.ar_delay*1000) { - priv->ar_cmd = mp_input_get_cmd_from_keys(priv,priv->num_key_down,priv->key_down); - if(!priv->ar_cmd) { - priv->ar_state = -1; - return NULL; - } - priv->ar_state = 1; - priv->last_ar = t; - return mp_cmd_clone(priv->ar_cmd); - // Then send rate / sec event - } else if(priv->ar_state == 1 && (t -priv->last_ar) >= 1000000/libinput_conf.ar_rate) { - priv->last_ar = t; - return mp_cmd_clone(priv->ar_cmd); - } - } - return NULL; -} - -static mp_cmd_t* mp_input_read_cmds(any_t* handle) { - priv_t* priv = (priv_t*)handle; - int i,n = 0,got_cmd = 0; - mp_cmd_t* ret; - static int last_loop = 0; - - if(priv->num_cmd_fd == 0) return NULL; - - for(i = 0; (unsigned int)i < priv->num_cmd_fd ; i++) { - if(priv->cmd_fds[i].flags&MP_FD_EOF) { - mp_input_rm_cmd_fd(priv,priv->cmd_fds[i].opaque); - i--; - continue; - } else if(priv->cmd_fds[i].flags & MP_FD_NO_SELECT) continue; - if(priv->cmd_fds[i].flags & MP_FD_GOT_CMD) got_cmd = 1; - n++; - } - if(priv->num_cmd_fd == 0) return NULL; - for(i = 0; i < priv->num_cmd_fd; i++) { - int r = 0; - char* cmd; - r = mp_input_read_cmd(&priv->cmd_fds[i],&cmd); - if(r < 0) { - if(r == MP_INPUT_ERROR) MSG_ERR("Error on cmd fd\n"); - else if(r == MP_INPUT_DEAD) priv->cmd_fds[i].flags |= MP_FD_DEAD; - continue; - } - ret = mp_input_parse_cmd(cmd); - mp_free(cmd); - if(!ret) continue; - last_loop = i; - return ret; - } - last_loop = 0; - return NULL; -} - -MPXP_Rc mp_input_queue_cmd(any_t* handle,mp_cmd_t* cmd) { - priv_t* priv = (priv_t*)handle; - if(priv->cmd_queue_length >= CMD_QUEUE_SIZE) return MPXP_False; - priv->cmd_queue[priv->cmd_queue_end] = cmd; - priv->cmd_queue_end = (priv->cmd_queue_end + 1) % CMD_QUEUE_SIZE; - priv->cmd_queue_length++; - return MPXP_Ok; -} - -static mp_cmd_t* mp_input_get_queued_cmd(any_t* handle,int peek_only) { - priv_t* priv = (priv_t*)handle; - mp_cmd_t* ret; - - if(priv->cmd_queue_length == 0) return NULL; - - ret = priv->cmd_queue[priv->cmd_queue_start]; - - if (!peek_only) { - priv->cmd_queue_length--; - priv->cmd_queue_start = (priv->cmd_queue_start + 1) % CMD_QUEUE_SIZE; - } - return ret; -} - -/** - * \param peek_only when set, the returned command stays in the queue. - * Do not mp_free the returned cmd whe you set this! - */ -mp_cmd_t* mp_input_get_cmd(any_t*handle,int tim, int paused, int peek_only) { - priv_t* priv = (priv_t*)handle; - mp_cmd_t* ret = NULL; - mp_cmd_filter_t* cf; - int from_queue; - - from_queue = 1; - ret = mp_input_get_queued_cmd(priv,peek_only); - if(!ret) { - from_queue = 0; - ret = mp_input_read_keys(priv,tim); - if(!ret) ret = mp_input_read_cmds(priv); - } - if(!ret) return NULL; - - for(cf = priv->cmd_filters ; cf ; cf = cf->next) { - if(cf->filter(ret,paused,cf->ctx)) return NULL; - } - - if (!from_queue && peek_only) mp_input_queue_cmd(priv,ret); - - return ret; -} - -void mp_cmd_free(mp_cmd_t* cmd) { - int i; -//#ifdef MP_DEBUG -// assert(cmd != NULL); -//#endif - if ( !cmd ) return; - - if(cmd->name) mp_free(cmd->name); - - for(i=0; i < MP_CMD_MAX_ARGS && cmd->args[i].type != -1; i++) { - if(cmd->args[i].type == MP_CMD_ARG_STRING && cmd->args[i].v.s != NULL) - mp_free(cmd->args[i].v.s); - } - mp_free(cmd); -} - -static mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd) { - mp_cmd_t* ret; - int i; -#ifdef MP_DEBUG - assert(cmd != NULL); -#endif - - ret = (mp_cmd_t*)mp_malloc(sizeof(mp_cmd_t)); - memcpy(ret,cmd,sizeof(mp_cmd_t)); - if(cmd->name) ret->name = mp_strdup(cmd->name); - for(i = 0; i < MP_CMD_MAX_ARGS && cmd->args[i].type != -1; i++) { - if(cmd->args[i].type == MP_CMD_ARG_STRING && cmd->args[i].v.s != NULL) - ret->args[i].v.s = mp_strdup(cmd->args[i].v.s); - } - return ret; -} - -static char* mp_input_get_key_name(any_t* handle,int key) { - priv_t* priv = (priv_t*)handle; - unsigned i; - - for(i = 0; key_names[i].name != NULL; i++) { - if(key_names[i].key == key) return key_names[i].name; - } - - if(isascii(key)) { - snprintf(priv->key_str,12,"%c",(char)key); - return priv->key_str; - } - - // Print the hex key code - snprintf(priv->key_str,12,"%#-8x",key); - return priv->key_str; -} - -static int mp_input_get_key_from_name(char* name) { - int i,ret = 0,len = strlen(name); - if(len == 1) { // Direct key code - ret = (unsigned char)name[0]; - return ret; - } else if(len > 2 && strncasecmp("0x",name,2) == 0) return strtol(name,NULL,16); - - for(i = 0; key_names[i].name != NULL; i++) { - if(strcasecmp(key_names[i].name,name) == 0) - return key_names[i].key; - } - return -1; -} - -static int mp_input_get_input_from_name(char* name,int* keys) { - char *end,*ptr; - int n=0; - - ptr = name; - n = 0; - for(end = strchr(ptr,'-') ; ptr != NULL ; end = strchr(ptr,'-')) { - if(end && end[1] != '\0') { - if(end[1] == '-') end = &end[1]; - end[0] = '\0'; - } - keys[n] = mp_input_get_key_from_name(ptr); - if(keys[n] < 0) return 0; - n++; - if(end && end[1] != '\0' && n < MP_MAX_KEY_DOWN) ptr = &end[1]; - else break; - } - keys[n] = 0; - return 1; -} - -static void mp_input_bind_keys(any_t* handle,int keys[MP_MAX_KEY_DOWN+1], char* cmd) { - priv_t* priv = (priv_t*)handle; - int i = 0,j; - mp_cmd_bind_t* _bind = NULL; - -#ifdef MP_DEBUG - assert(keys != NULL); - assert(cmd != NULL); -#endif - - if(priv->cmd_binds) { - for(i = 0; priv->cmd_binds[i].cmd != NULL ; i++) { - for(j = 0 ; priv->cmd_binds[i].input[j] == keys[j] && keys[j] != 0 ; j++) /* NOTHING */; - if(keys[j] == 0 && priv->cmd_binds[i].input[j] == 0 ) { - _bind = &priv->cmd_binds[i]; - break; - } - } - } - - if(!_bind) { - priv->cmd_binds = (mp_cmd_bind_t*)mp_realloc(priv->cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); - memset(&priv->cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); - _bind = &priv->cmd_binds[i]; - } - if(_bind->cmd) mp_free(_bind->cmd); - _bind->cmd = mp_strdup(cmd); - memcpy(_bind->input,keys,(MP_MAX_KEY_DOWN+1)*sizeof(int)); -} - -static void mp_input_free_binds(mp_cmd_bind_t* binds) { - int i; - if(!binds) return; - for(i = 0; binds[i].cmd != NULL; i++) mp_free(binds[i].cmd); - mp_free(binds); -} - -#define BS_MAX 256 -#define SPACE_CHAR " \n\r\t" - -static int mp_input_parse_config(any_t* handle,char *file) { - priv_t* priv = (priv_t*)handle; - int fd; - int bs = 0,r,eof = 0,comments = 0; - char *iter,*end; - char buffer[BS_MAX]; - int n_binds = 0, keys[MP_MAX_KEY_DOWN+1] = { 0 }; - mp_cmd_bind_t* binds = NULL; - - fd = open(file,O_RDONLY); - - if(fd < 0) { - MSG_ERR("Can't open input config file %s : %s\n",file,strerror(errno)); - return 0; - } - - MSG_V("Parsing input config file %s\n",file); - - while(1) { - if(! eof && bs < BS_MAX-1) { - if(bs > 0) bs--; - r = read(fd,buffer+bs,BS_MAX-1-bs); - if(r < 0) { - if(errno == EINTR) continue; - MSG_ERR("Error while reading input config file %s : %s\n",file,strerror(errno)); - mp_input_free_binds(binds); - close(fd); - return 0; - } else if(r == 0) { - eof = 1; - } else { - bs += r+1; - buffer[bs-1] = '\0'; - } - } - // Empty buffer : return - if(bs <= 1) { - MSG_INFO("Input config file %s parsed : %d binds\n",file,n_binds); - if(binds) priv->cmd_binds = binds; - close(fd); - return 1; - } - iter = buffer; - if(comments) { - for( ; iter[0] != '\0' && iter[0] != '\n' ; iter++)/* NOTHING */; - if(iter[0] == '\0') { // Buffer was full of comment - bs = 0; - continue; - } - iter++; - r = strlen(iter); - if(r) memmove(buffer,iter,r+1); - bs = r+1; - if(iter[0] != '#') comments = 0; - continue; - } - // Find the wanted key - if(keys[0] == 0) { - // Jump beginning space - for( ; iter[0] != '\0' && strchr(SPACE_CHAR,iter[0]) != NULL ; iter++)/* NOTHING */; - if(iter[0] == '\0') { // Buffer was full of space char - bs = 0; - continue; - } - if(iter[0] == '#') { // Comments - comments = 1; - continue; - } - // Find the end of the key code name - for(end = iter; end[0] != '\0' && strchr(SPACE_CHAR,end[0]) == NULL ; end++)/*NOTHING */; - if(end[0] == '\0') { // Key name don't fit in the buffer - if(buffer == iter) { - if(eof && (buffer-iter) == bs) MSG_ERR("Unfinished binding %s\n",iter); - else MSG_ERR("Buffer is too small for this key name : %s\n",iter); - mp_input_free_binds(binds); - return 0; - } - memmove(buffer,iter,end-iter); - bs = end-iter; - continue; - } - char name[end-iter+1]; - strncpy(name,iter,end-iter); - name[end-iter] = '\0'; - if(! mp_input_get_input_from_name(name,keys)) { - MSG_ERR("Unknown key '%s'\n",name); - mp_input_free_binds(binds); - close(fd); - return 0; - } - if( bs > (end-buffer)) memmove(buffer,end,bs - (end-buffer)); - bs -= end-buffer; - continue; - } else { // Get the command - while(iter[0] == ' ' || iter[0] == '\t') iter++; - // Found new line - if(iter[0] == '\n' || iter[0] == '\r') { - int i; - MSG_ERR("No command found for key %s" ,mp_input_get_key_name(priv,keys[0])); - for(i = 1; keys[i] != 0 ; i++) MSG_ERR("-%s",mp_input_get_key_name(priv,keys[i])); - MSG_ERR("\n"); - keys[0] = 0; - if(iter > buffer) { - memmove(buffer,iter,bs- (iter-buffer)); - bs -= (iter-buffer); - } - continue; - } - for(end = iter ; end[0] != '\n' && end[0] != '\r' && end[0] != '\0' ; end++)/* NOTHING */; - if(end[0] == '\0' && ! (eof && ((end+1) - buffer) == bs)) { - if(iter == buffer) { - MSG_ERR("Buffer is too small for command %s\n",buffer); - mp_input_free_binds(binds); - close(fd); - return 0; - } - memmove(buffer,iter,end - iter); - bs = end - iter; - continue; - } - char cmd[end-iter+1]; - strncpy(cmd,iter,end-iter); - cmd[end-iter] = '\0'; - //printf("Set bind %d => %s\n",keys[0],cmd); - mp_input_bind_keys(priv,keys,cmd); - n_binds++; - keys[0] = 0; - end++; - if(bs > (end-buffer)) memmove(buffer,end,bs-(end-buffer)); - bs -= (end-buffer); - buffer[bs-1] = '\0'; - continue; - } - } - MSG_ERR("What are we doing here ?\n"); - close(fd); - return 0; -} - -static void mp_input_init(any_t* handle) { - priv_t* priv = (priv_t*)handle; - char* file; - - file = config_file[0] != '/' ? get_path(config_file) : config_file; - if(!file) return; - - if(! mp_input_parse_config(handle,file)) { - // Try global conf dir - file = CONFDIR "/input.conf"; - if(! mp_input_parse_config(handle,file)) MSG_WARN("Falling back on default (hardcoded) input config\n"); - } -#ifdef HAVE_JOYSTICK - if(libinput_conf.use_joystick) { - any_t* joystick_fd; - joystick_fd = mp_input_joystick_open(libinput_conf.js_dev); - if(!joystick_fd) MSG_ERR("Can't init input joystick with using: %s\n",libinput_conf.js_dev); - else mp_input_add_key_fd(priv,joystick_fd,1,mp_input_joystick_read,(mp_close_func_t)mp_input_joystick_close); - } -#endif - -#ifdef HAVE_LIRC - if(libinput_conf.use_lirc) { - any_t* lirc_fd = mp_input_lirc_init(); - if(fd > 0) mp_input_add_cmd_fd(priv,lirc_fd,0,mp_input_lirc_read_cmd,mp_input_lirc_close); - } -#endif - -#ifdef HAVE_LIRCC - if(libinput_conf.use_lircc) { - int fd = lircc_init("mplayer", NULL); - if(fd >= 0) mp_input_add_cmd_fd(fd,1,NULL,(mp_close_func_t)lircc_cleanup); - } -#endif - if(libinput_conf.in_file) { - struct stat st; - if(stat(libinput_conf.in_file,&st)) MSG_ERR("Can't stat %s: %s\n",libinput_conf.in_file,strerror(errno)); - else { - priv->in_file_fd = open(libinput_conf.in_file,(S_ISFIFO(st.st_mode)?O_RDWR:O_RDONLY)|O_NONBLOCK); - if(priv->in_file_fd >= 0) mp_input_add_cmd_fd(priv,priv,1,NULL,(mp_close_func_t)close); - else MSG_ERR("Can't open %s: %s\n",libinput_conf.in_file,strerror(errno)); - } - } else { - priv->in_file_fd = 0; - getch2_enable(); // prepare stdin for hotkeys... - mp_input_add_cmd_fd(priv,priv,1,NULL,(mp_close_func_t)close); - } -} - -static void mp_input_uninit(any_t* handle) { - priv_t* priv = (priv_t*)handle; - unsigned int i; - - for(i=0; i < priv->num_key_fd; i++) { - if(priv->key_fds[i].close_func) priv->key_fds[i].close_func(priv->key_fds[i].opaque); - } - - for(i=0; i < priv->num_cmd_fd; i++) { - if(priv->cmd_fds[i].close_func) priv->cmd_fds[i].close_func(priv->cmd_fds[i].opaque); - } - - if(priv->cmd_binds) { - for(i=0;;i++) { - if(priv->cmd_binds[i].cmd != NULL) mp_free(priv->cmd_binds[i].cmd); - else break; - } - mp_free(priv->cmd_binds); - priv->cmd_binds=NULL; - } - if(priv->in_file_fd==0) getch2_disable(); -} - -any_t* RND_RENAME0(mp_input_open)(void) { - priv_t* priv; - priv=mp_mallocz(sizeof(priv_t)); - priv->ar_state=-1; - priv->in_file_fd=-1; - mp_input_init(priv); - if(libinput_conf.print_key_list) mp_input_print_key_list(priv); - if(libinput_conf.print_cmd_list) mp_input_print_cmd_list(priv); - return priv; -} - -void mp_input_close(any_t* handle) { - mp_input_uninit(handle); - mp_free(handle); -} - -void mp_input_register_options(m_config_t* cfg) { - m_config_register_options(cfg,mp_input_opts); -} - -void mp_input_print_keys(any_t*handle) { - unsigned i; - UNUSED(handle); - MSG_INFO("List of available KEYS:\n"); - for(i= 0; key_names[i].name != NULL ; i++) MSG_INFO("%s\n",key_names[i].name); -} - -static int mp_input_print_key_list(any_t*handle) { - mp_input_print_keys(handle); - exit(0); -} - -void mp_input_print_binds(any_t*handle) { - unsigned i,j; - MSG_INFO("List of available key bindings:\n"); - for(i=0; def_cmd_binds[i].cmd != NULL ; i++) { - for(j=0;def_cmd_binds[i].input[j] != 0;j++) { - MSG_INFO(" %-20s",mp_input_get_key_name(handle,def_cmd_binds[i].input[j])); - } - MSG_INFO(" %s\n",def_cmd_binds[i].cmd); - } -} - -void mp_input_print_cmds(any_t*handle) { - const mp_cmd_t *cmd; - int i,j; - char* type; - - UNUSED(handle); - MSG_INFO("List of available input commands:\n"); - for(i = 0; (cmd = &mp_cmds[i])->name != NULL ; i++) { - MSG_INFO(" %-20.20s",cmd->name); - for(j= 0 ; j < MP_CMD_MAX_ARGS && cmd->args[j].type != -1 ; j++) { - switch(cmd->args[j].type) { - case MP_CMD_ARG_INT: - type = "Integer"; - break; - case MP_CMD_ARG_FLOAT: - type = "Float"; - break; - case MP_CMD_ARG_STRING: - type = "String"; - break; - default: - type = "??"; - } - if(j+1 > cmd->nargs) MSG_INFO(" [%s]",type); - else MSG_INFO(" %s",type); - } - MSG_INFO("\n"); - } -} - -static int mp_input_print_cmd_list(any_t*handle) { - mp_input_print_cmds(handle); - exit(0); -} - -MPXP_Rc mp_input_check_interrupt(any_t* handle,int tim) { - priv_t* priv = (priv_t*)handle; - mp_cmd_t* cmd; - if((cmd = mp_input_get_cmd(handle,tim,0,1)) == NULL) return 0; - switch(cmd->id) { - case MP_CMD_QUIT: - case MP_CMD_SOFT_QUIT: - case MP_CMD_PLAY_TREE_STEP: - case MP_CMD_PLAY_TREE_UP_STEP: - case MP_CMD_PLAY_ALT_SRC_STEP: - // The cmd will be executed when we are back in the main loop - return MPXP_Ok; //<-- memory leaks here - } - // remove the cmd from the queue - cmd = mp_input_get_cmd(priv,tim,0,0); - mp_cmd_free(cmd); - return MPXP_False; -} Copied: mplayerxp/input2/input.cpp (from rev 372, mplayerxp/input2/input.c) =================================================================== --- mplayerxp/input2/input.cpp (rev 0) +++ mplayerxp/input2/input.cpp 2012-11-15 17:23:49 UTC (rev 377) @@ -0,0 +1,1444 @@ +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <unistd.h> +#include <errno.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <fcntl.h> +#include <ctype.h> +extern "C" { +#include "input.h" +#include "mouse.h" +#ifdef MP_DEBUG +#include <assert.h> +#endif +#include "libmpdemux/stream.h" +#include "osdep/keycodes.h" +#include "osdep/get_path.h" +#include "osdep/timer.h" +#include "osdep/mplib.h" +#include "libmpconf/cfgparser.h" + +#ifdef HAVE_LIRC +#include "lirc.h" +#endif + +#ifdef HAVE_LIRCC +#include <lirc/lircc.h> +#endif + +#include "in_msg.h" +} +#include "joystick.h" +#include "osdep/getch2.h" + +#ifndef MP_MAX_KEY_FD +#define MP_MAX_KEY_FD 10 +#endif + +#ifndef MP_MAX_CMD_FD +#define MP_MAX_CMD_FD 10 +#endif + +#define MP_FD_EOF (1<<0) +#define MP_FD_DROP (1<<1) +#define MP_FD_DEAD (1<<2) +#define MP_FD_GOT_CMD (1<<3) +#define MP_FD_NO_SELECT (1<<4) + +#define CMD_QUEUE_SIZE 100 + +typedef int (*mp_key_func_t)(any_t* ctx); // These functions should return the key code or one of the error code +typedef int (*mp_cmd_func_t)(any_t* ctx,char* dest,int size); // These functions should act like read but they must use our error code (if needed ;-) +typedef void (*mp_close_func_t)(any_t* ctx); // These are used to close the driver + + +typedef struct mp_cmd_bind { + int input[MP_MAX_KEY_DOWN+1]; + const char* cmd; +} mp_cmd_bind_t; + +typedef struct mp_key_name { + int key; + const char* name; +} mp_key_name_t; + + +typedef struct mp_input_fd { + any_t* opaque; + union { + mp_key_func_t key_func; + mp_cmd_func_t cmd_func; + }read; + mp_close_func_t close_func; + int flags; + // This fields are for the cmd fds + char* buffer; + int pos,size; +} mp_input_fd_t; + +typedef struct mp_cmd_filter_st mp_cmd_filter_t; + +struct mp_cmd_filter_st { + mp_input_cmd_filter filter; + any_t* ctx; + mp_cmd_filter_t* next; +}; + +typedef struct priv_s { + char antiviral_hole[RND_CHAR1]; + // These are the user defined binds + mp_cmd_bind_t* cmd_binds; + mp_cmd_filter_t* cmd_filters; + + mp_input_fd_t key_fds[MP_MAX_KEY_FD]; + unsigned int num_key_fd; + mp_input_fd_t cmd_fds[MP_MAX_CMD_FD]; + unsigned int num_cmd_fd; + mp_cmd_t* cmd_queue[CMD_QUEUE_SIZE]; + unsigned int cmd_queue_length,cmd_queue_start,cmd_queue_end; + // this is the key currently down + int key_down[MP_MAX_KEY_DOWN]; + unsigned int num_key_down,last_key_down; + // Autorepeat stuff + short ar_state; + mp_cmd_t* ar_cmd; + unsigned int last_ar; + + int in_file_fd; + int tim; //for getch2 + char key_str[12]; +}priv_t; + +typedef struct input_conf_s { + int use_joystick,use_lirc,use_lircc; + unsigned ar_delay,ar_rate; + const char* js_dev; + const char* in_file; + int print_key_list,print_cmd_list; +}input_conf_t; +static input_conf_t libinput_conf = { 1, 1, 1, 100, 8, "/dev/input/js0", NULL, 0, 0 }; + +/// This array defines all know commands. +/// The first field is an id used to recognize the command without too many strcmp +/// The second is abviously the command name +/// The third is the minimum number of argument this command need +/// Then come the definition of each argument, terminated with and arg of type -1 +/// A command can take maximum MP_CMD_MAX_ARGS-1 arguments (-1 because of +/// the terminal one) wich is actually 9 + +/// For the args, the first field is the type (actually int, float or string), the second +/// is the default value wich is used for optional arguments + +static const mp_cmd_t mp_cmds[] = { + { MP_CMD_SEEK, "seek", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, + { MP_CMD_SPEED_INCR, "speed_incr", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, + { MP_CMD_SPEED_MULT, "speed_mult", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, + { MP_CMD_SPEED_SET, "speed_set", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, + { MP_CMD_SWITCH_AUDIO, "cycle_audio", 0, { {-1,{0}} } }, + { MP_CMD_SWITCH_VIDEO, "cycle_video", 0, { {-1,{0}} } }, + { MP_CMD_SWITCH_SUB, "cycle_subtitles", 0, { {-1,{0}} } }, + { MP_CMD_QUIT, "quit", 0, { {-1,{0}} } }, + { MP_CMD_SOFT_QUIT, "soft_quit", 0, { {-1,{0}} } }, + { MP_CMD_PAUSE, "pause", 0, { {-1,{0}} } }, + { MP_CMD_FRAME_STEP, "frame_step", 0, { {-1,{0}} } }, + { MP_CMD_PLAY_TREE_STEP, "pt_step",1, { { MP_CMD_ARG_INT ,{0}}, { MP_CMD_ARG_INT ,{0}}, {-1,{0}} } }, + { MP_CMD_PLAY_TREE_UP_STEP, "pt_up_step",1, { { MP_CMD_ARG_INT,{0} }, { MP_CMD_ARG_INT ,{0}}, {-1,{0}} } }, + { MP_CMD_PLAY_ALT_SRC_STEP, "alt_src_step",1, { { MP_CMD_ARG_INT,{0} }, {-1,{0}} } }, + { MP_CMD_OSD, "osd",0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } }, + { MP_CMD_VOLUME, "volume", 1, { { MP_CMD_ARG_INT,{0} }, {-1,{0}} } }, + { MP_CMD_MUTE, "mute", 0, { {-1,{0}} } }, + { MP_CMD_CONTRAST, "contrast",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, + { MP_CMD_BRIGHTNESS, "brightness",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, + { MP_CMD_HUE, "hue",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, + { MP_CMD_SATURATION, "saturation",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, + { MP_CMD_FRAMEDROPPING, "frame_drop",0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } }, + { MP_CMD_SUB_POS, "sub_pos", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, +#ifdef USE_TV + { MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", 1, { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }}, + { MP_CMD_TV_STEP_NORM, "tv_step_norm",0, { {-1,{0}} } }, + { MP_CMD_TV_STEP_CHANNEL_LIST, "tv_step_chanlist", 0, { {-1,{0}} } }, +#endif + { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } }, + { MP_CMD_VO_SCREENSHOT, "vo_screenshot", 0, { {-1,{0}} } }, + { MP_CMD_PANSCAN, "panscan",1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, + +#ifdef USE_DVDNAV + { MP_CMD_DVDNAV, "dvdnav", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, + { MP_CMD_DVDNAV_EVENT, "dvdnav_event", 1, { { MP_CMD_ARG_VOID, {0}}, {-1, {0}} } }, +#endif + { MP_CMD_MENU, "menu",1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, + { MP_CMD_SET_MENU, "set_menu",1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, + { MP_CMD_CHELP, "help", 0, { {-1,{0}} } }, + { MP_CMD_CEXIT, "exit", 0, { {-1,{0}} } }, + { MP_CMD_CHIDE, "hide", 0, { {MP_CMD_ARG_INT,{3000}}, {-1,{0}} } }, + + { 0, NULL, 0, {} } +}; + +/// The names of the key for input.conf +/// If you add some new keys, you also need to add them here + +static const mp_key_name_t key_names[] = { + { ' ', "SPACE" }, + { KEY_ENTER, "ENTER" }, + { KEY_TAB, "TAB" }, + { KEY_CTRL, "CTRL" }, + { KEY_BACKSPACE, "BS" }, + { KEY_DELETE, "DEL" }, + { KEY_INSERT, "INS" }, + { KEY_HOME, "HOME" }, + { KEY_END, "END" }, + { KEY_PAGE_UP, "PGUP" }, + { KEY_PAGE_DOWN, "PGDWN" }, + { KEY_ESC, "ESC" }, + { KEY_RIGHT, "RIGHT" }, + { KEY_LEFT, "LEFT" }, + { KEY_DOWN, "DOWN" }, + { KEY_UP, "UP" }, + { KEY_F+1, "F1" }, + { KEY_F+2, "F2" }, + { KEY_F+3, "F3" }, + { KEY_F+4, "F4" }, + { KEY_F+5, "F5" }, + { KEY_F+6, "F6" }, + { KEY_F+7, "F7" }, + { KEY_F+8, "F8" }, + { KEY_F+9, "F9" }, + { KEY_F+10, "F10" }, + { KEY_KP0, "KP0" }, + { KEY_KP1, "KP1" }, + { KEY_KP2, "KP2" }, + { KEY_KP3, "KP3" }, + { KEY_KP4, "KP4" }, + { KEY_KP5, "KP5" }, + { KEY_KP6, "KP6" }, + { KEY_KP7, "KP7" }, + { KEY_KP8, "KP8" }, + { KEY_KP9, "KP9" }, + { KEY_KPDEL, "KP_DEL" }, + { KEY_KPDEC, "KP_DEL" }, + { KEY_KPINS, "KP0" }, + { KEY_KPENTER, "KP_ENTER" }, + { MOUSE_BTN0, "MOUSE_BTN0" }, + { MOUSE_BTN1, "MOUSE_BTN1" }, + { MOUSE_BTN2, "MOUSE_BTN2" }, + { MOUSE_BTN3, "MOUSE_BTN3" }, + { MOUSE_BTN4, "MOUSE_BTN4" }, + { MOUSE_BTN5, "MOUSE_BTN5" }, + { MOUSE_BTN6, "MOUSE_BTN6" }, + { MOUSE_BTN7, "MOUSE_BTN7" }, + { MOUSE_BTN8, "MOUSE_BTN8" }, + { MOUSE_BTN9, "MOUSE_BTN9" }, + { MOUSE_BTN0_DBL, "MOUSE_BTN0_DBL" }, + { MOUSE_BTN1_DBL, "MOUSE_BTN1_DBL" }, + { MOUSE_BTN2_DBL, "MOUSE_BTN2_DBL" }, + { MOUSE_BTN3_DBL, "MOUSE_BTN3_DBL" }, + { MOUSE_BTN4_DBL, "MOUSE_BTN4_DBL" }, + { MOUSE_BTN5_DBL, "MOUSE_BTN5_DBL" }, + { MOUSE_BTN6_DBL, "MOUSE_BTN6_DBL" }, + { MOUSE_BTN7_DBL, "MOUSE_BTN7_DBL" }, + { MOUSE_BTN8_DBL, "MOUSE_BTN8_DBL" }, + { MOUSE_BTN9_DBL, "MOUSE_BTN9_DBL" }, + { JOY_AXIS1_MINUS, "JOY_UP" }, + { JOY_AXIS1_PLUS, "JOY_DOWN" }, + { JOY_AXIS0_MINUS, "JOY_LEFT" }, + { JOY_AXIS0_PLUS, "JOY_RIGHT" }, + + { JOY_AXIS0_PLUS, "JOY_AXIS0_PLUS" }, + { JOY_AXIS0_MINUS, "JOY_AXIS0_MINUS" }, + { JOY_AXIS1_PLUS, "JOY_AXIS1_PLUS" }, + { JOY_AXIS1_MINUS, "JOY_AXIS1_MINUS" }, + { JOY_AXIS2_PLUS, "JOY_AXIS2_PLUS" }, + { JOY_AXIS2_MINUS, "JOY_AXIS2_MINUS" }, + { JOY_AXIS3_PLUS, "JOY_AXIS3_PLUS" }, + { JOY_AXIS3_MINUS, "JOY_AXIS3_MINUS" }, + { JOY_AXIS4_PLUS, "JOY_AXIS4_PLUS" }, + { JOY_AXIS4_MINUS, "JOY_AXIS4_MINUS" }, + { JOY_AXIS5_PLUS, "JOY_AXIS5_PLUS" }, + { JOY_AXIS5_MINUS, "JOY_AXIS5_MINUS" }, + { JOY_AXIS6_PLUS, "JOY_AXIS6_PLUS" }, + { JOY_AXIS6_MINUS, "JOY_AXIS6_MINUS" }, + { JOY_AXIS7_PLUS, "JOY_AXIS7_PLUS" }, + { JOY_AXIS7_MINUS, "JOY_AXIS7_MINUS" }, + { JOY_AXIS8_PLUS, "JOY_AXIS8_PLUS" }, + { JOY_AXIS8_MINUS, "JOY_AXIS8_MINUS" }, + { JOY_AXIS9_PLUS, "JOY_AXIS9_PLUS" }, + { JOY_AXIS9_MINUS, "JOY_AXIS9_MINUS" }, + + { JOY_BTN0, "JOY_BTN0" }, + { JOY_BTN1, "JOY_BTN1" }, + { JOY_BTN2, "JOY_BTN2" }, + { JOY_BTN3, "JOY_BTN3" }, + { JOY_BTN4, "JOY_BTN4" }, + { JOY_BTN5, "JOY_BTN5" }, + { JOY_BTN6, "JOY_BTN6" }, + { JOY_BTN7, "JOY_BTN7" }, + { JOY_BTN8, "JOY_BTN8" }, + { JOY_BTN9, "JOY_BTN9" }, + + { KEY_XF86_STANDBY, "XF86_STANDBY" }, + { KEY_XF86_POWER, "XF86_POWER" }, + { KEY_XF86_PAUSE, "XF86_PAUSE" }, + { KEY_XF86_STOP, "XF86_STOP" }, + { KEY_XF86_PREV, "XF86_PREV" }, + { KEY_XF86_NEXT, "XF86_NEXT" }, + { KEY_XF86_VOLUME_UP, "XF86_VOLUME_UP" }, + { KEY_XF86_VOLUME_DN, "XF86_VOLUME_DN" }, + { KEY_XF86_MUTE, "XF86_MUTE" }, + { KEY_XF86_EJECT, "XF86_EJECT" }, + { KEY_XF86_MENU, "XF86_MENU" }, + { KEY_XF86_PLAY, "XF86_PLAY" }, + { KEY_XF86_FORWARD, "XF86_FORWARD" }, + { KEY_XF86_REWIND, "XF86_REWIND" }, + { KEY_XF86_BRIGHTNESS, "XF86_BRIGHTNESS" }, + { KEY_XF86_CONTRAST, "XF86_CONTRAST" }, + { KEY_XF86_SATURATION, "XF86_SATURATION" }, + { KEY_XF86_SCREENSAVE, "XF86_SCREENSAVE" }, + { KEY_XF86_REFRESH, "XF86_REFRESH" }, + + { 0, NULL } +}; + +// This is the default binding. The content of input.conf override these ones. +// The first args is a null terminated array of key codes. +// The second is the command + +static const mp_cmd_bind_t def_cmd_binds[] = { + + { { MOUSE_BTN3, 0 }, "seek 10" }, + { { MOUSE_BTN4, 0 }, "seek -10" }, + { { MOUSE_BTN5, 0 }, "volume 1" }, + { { MOUSE_BTN6, 0 }, "volume -1" }, + +#ifdef USE_DVDNAV + { { KEY_KP8, 0 }, "dvdnav 1" }, // up + { { KEY_KP2, 0 }, "dvdnav 2" }, // down + { { KEY_KP4, 0 }, "dvdnav 3" }, // left + { { KEY_KP6, 0 }, "dvdnav 4" }, // right + { { KEY_KP5, 0 }, "dvdnav 5" }, // menu + { { KEY_KP0, 0 }, "dvdnav 6" }, // select + { { KEY_KPINS, 0 }, "dvdnav 6" }, // select +#endif + { { KEY_F+3, 0 }, "menu menu" }, + { { KEY_XF86_MENU, 0 }, "menu menu" }, + { { KEY_F+2, 0 }, "set_menu" }, + { { KEY_F+1, 0 }, "menu help" }, + { { KEY_F+10, 0 }, "menu exit" }, + { { KEY_F+8, 0 }, "menu hide" }, + + { { KEY_RIGHT, 0 }, "seek 10" }, + { { KEY_LEFT, 0 }, "seek -10" }, + { { KEY_UP, 0 }, "seek 60" }, + { { KEY_DOWN, 0 }, "seek -60" }, + { { KEY_PAGE_UP, 0 }, "seek 600" }, + { { KEY_PAGE_DOWN, 0 }, "seek -600" }, + { { '[', 0 }, "speed_mult 0.9091" }, + { { ']', 0 }, "speed_mult 1.1" }, + { { '{', 0 }, "speed_mult 0.5" }, + { { '}', 0 }, "speed_mult 2.0" }, + { { KEY_BACKSPACE, 0 }, "speed_set 1.0" }, + { { 'q', 0 }, "soft_quit" }, + { { KEY_ESC, 0 }, "quit" }, + { { 'p', 0 }, "pause" }, + { { ' ', 0 }, "pause" }, + { { '.', 0 }, "frame_step" }, + { { KEY_HOME, 0 }, "pt_up_step 1" }, + { { KEY_END, 0 }, "pt_up_step -1" }, + { { '>', 0 }, "pt_step 1" }, + { { KEY_ENTER, 0 }, "pt_step 1 1" }, + { { '<', 0 }, "pt_step -1" }, + { { KEY_INS, 0 }, "alt_src_step 1" }, + { { KEY_DEL, 0 }, "alt_src_step -1" }, + { { 'o', 0 }, "osd" }, + { { '9', 0 }, "volume -1" }, + { { '/', 0 }, "volume -1" }, + { { '0', 0 }, "volume 1" }, + { { '*', 0 }, "volume 1" }, + { { 'm', 0 }, "mute" }, + { { '1', 0 }, "contrast -1... [truncated message content] |
From: <nic...@us...> - 2012-11-15 17:34:00
|
Revision: 379 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=379&view=rev Author: nickols_k Date: 2012-11-15 17:33:49 +0000 (Thu, 15 Nov 2012) Log Message: ----------- more c++ names in .o files Modified Paths: -------------- mplayerxp/mplayerxp.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_core.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-11-15 17:27:15 UTC (rev 378) +++ mplayerxp/mplayerxp.cpp 2012-11-15 17:33:49 UTC (rev 379) @@ -71,12 +71,12 @@ #include "libao2/mixer.h" #include "xmpcore/xmp_core.h" -#include "xmpcore/xmp_vplayer.h" -#include "xmpcore/xmp_adecoder.h" #define MSGT_CLASS MSGT_CPLAYER #include "mp_msg.h" } // extern "C" +#include "xmpcore/xmp_vplayer.h" +#include "xmpcore/xmp_adecoder.h" #include "osdep/getch2.h" #include "xmpcore/PointerProtector.h" #include "dump.h" Modified: mplayerxp/xmpcore/xmp_adecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-15 17:27:15 UTC (rev 378) +++ mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-15 17:33:49 UTC (rev 379) @@ -7,11 +7,11 @@ #include "mp_msg.h" #include "sig_hand.h" #include "xmp_core.h" -#include "xmp_adecoder.h" #include "osdep/mplib.h" #include "osdep/timer.h" #include "libmpcodecs/dec_audio.h" } +#include "xmp_adecoder.h" #ifdef ENABLE_DEC_AHEAD_DEBUG #define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) #else Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-15 17:27:15 UTC (rev 378) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-15 17:33:49 UTC (rev 379) @@ -7,13 +7,13 @@ #include "mp_msg.h" #include "sig_hand.h" #include "xmp_core.h" -#include "xmp_aplayer.h" -#include "xmp_adecoder.h" #include "osdep/timer.h" #include "libmpcodecs/dec_audio.h" #include "libao2/audio_out.h" } +#include "xmp_aplayer.h" +#include "xmp_adecoder.h" #ifdef ENABLE_DEC_AHEAD_DEBUG #define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) #else Modified: mplayerxp/xmpcore/xmp_core.cpp =================================================================== --- mplayerxp/xmpcore/xmp_core.cpp 2012-11-15 17:27:15 UTC (rev 378) +++ mplayerxp/xmpcore/xmp_core.cpp 2012-11-15 17:33:49 UTC (rev 379) @@ -21,10 +21,6 @@ #include "osdep/mplib.h" #include "xmp_core.h" -#include "xmp_aplayer.h" -#include "xmp_vplayer.h" -#include "xmp_adecoder.h" -#include "xmp_vdecoder.h" #include "mplayerxp.h" #include "libao2/audio_out.h" @@ -35,6 +31,11 @@ #include "sig_hand.h" #include "osdep/timer.h" } +#include "xmp_aplayer.h" +#include "xmp_vplayer.h" +#include "xmp_adecoder.h" +#include "xmp_vdecoder.h" + #ifdef ENABLE_DEC_AHEAD_DEBUG #define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) #else Modified: mplayerxp/xmpcore/xmp_vdecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-11-15 17:27:15 UTC (rev 378) +++ mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-11-15 17:33:49 UTC (rev 379) @@ -3,11 +3,12 @@ #include "mp_msg.h" #include "sig_hand.h" #include "xmp_core.h" -#include "xmp_adecoder.h" -#include "xmp_vdecoder.h" #include "osdep/timer.h" #include "libmpcodecs/dec_video.h" } +#include "xmp_adecoder.h" +#include "xmp_vdecoder.h" + #include <stdio.h> #include <unistd.h> // for usleep() #include <math.h> Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-11-15 17:27:15 UTC (rev 378) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-11-15 17:33:49 UTC (rev 379) @@ -1,6 +1,5 @@ extern "C" { #include "mplayerxp.h" -#include "xmp_vplayer.h" #include "xmp_core.h" #include "help_mp.h" #include "mp_msg.h" @@ -10,8 +9,10 @@ #include "libvo/video_out.h" #include "osdep/timer.h" #include "libmpdemux/demuxer.h" +} #include "xmp_adecoder.h" -} +#include "xmp_vplayer.h" + #include <stdio.h> #include <unistd.h> // for usleep() #include <math.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-16 11:32:59
|
Revision: 384 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=384&view=rev Author: nickols_k Date: 2012-11-16 11:32:49 +0000 (Fri, 16 Nov 2012) Log Message: ----------- new C++ sources & memory leaks-- Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/input2/input.cpp mplayerxp/libao2/Makefile mplayerxp/libao2/afmt.h mplayerxp/libao2/audio_out.h mplayerxp/libmpcodecs/Makefile mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/vd.h mplayerxp/libmpconf/Makefile mplayerxp/libmpconf/codec-cfg.h mplayerxp/libmpconf/m_property.h mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libmpdemux/mrl.h mplayerxp/libmpdemux/muxer.h mplayerxp/libmpdemux/stheader.h mplayerxp/libmpsub/Makefile mplayerxp/libmpsub/spudec.h mplayerxp/libmpsub/vobsub.h mplayerxp/libplaytree/Makefile mplayerxp/libplaytree/asxparser.h mplayerxp/libplaytree/playtree.h mplayerxp/libplaytree/playtreeparser.h mplayerxp/libvo/Makefile mplayerxp/libvo/font_load.h mplayerxp/libvo/img_format.h mplayerxp/libvo/screenshot.h mplayerxp/libvo/vosub_vidix.c mplayerxp/mp-opt-reg.cpp mplayerxp/mp_msg.cpp mplayerxp/mplayerxp.cpp mplayerxp/nls/Makefile mplayerxp/nls/nls.h mplayerxp/osdep/Makefile mplayerxp/osdep/get_path.h mplayerxp/postproc/Makefile mplayerxp/postproc/af.h mplayerxp/postproc/libmenu/menu.h mplayerxp/postproc/swscale.h mplayerxp/postproc/vf.h mplayerxp/postproc/vf_scale.h mplayerxp/xmpcore/mp_aframe.cpp mplayerxp/xmpcore/mp_image.cpp mplayerxp/xmpcore/sig_hand.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_core.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Added Paths: ----------- mplayerxp/libao2/afmt.cpp mplayerxp/libao2/audio_out.cpp mplayerxp/libao2/mixer.cpp mplayerxp/libmpcodecs/ad.cpp mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/vd.cpp mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpdemux/muxer.cpp mplayerxp/libmpsub/spudec.cpp mplayerxp/libplaytree/asxparser.cpp mplayerxp/libvo/font_load.cpp mplayerxp/libvo/img_format.cpp mplayerxp/libvo/screenshot.cpp mplayerxp/libvo/video_out.cpp mplayerxp/nls/recode.cpp mplayerxp/osdep/cpudetect.cpp mplayerxp/postproc/af.cpp mplayerxp/postproc/vf.cpp Removed Paths: ------------- mplayerxp/libao2/afmt.c mplayerxp/libao2/audio_out.c mplayerxp/libao2/mixer.c mplayerxp/libmpcodecs/ad.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpconf/cfgparser.c mplayerxp/libmpdemux/muxer.c mplayerxp/libmpsub/spudec.c mplayerxp/libplaytree/asxparser.c mplayerxp/libvo/font_load.c mplayerxp/libvo/img_format.c mplayerxp/libvo/screenshot.c mplayerxp/libvo/video_out.c mplayerxp/nls/recode.c mplayerxp/osdep/cpudetect.c mplayerxp/postproc/af.c mplayerxp/postproc/vf.c Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/dump.cpp 2012-11-16 11:32:49 UTC (rev 384) @@ -6,7 +6,7 @@ #include <stdlib.h> #define __USE_ISOC99 1 /* for lrint */ #include <math.h> -extern "C"{ + #include "mp_config.h" #include "xmpcore/sig_hand.h" @@ -18,7 +18,7 @@ #include "osdep/mplib.h" #define MSGT_CLASS MSGT_GLOBAL #include "mp_msg.h" -} + #include "dump.h" static char *media=NULL,*port=NULL; Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/input2/input.cpp 2012-11-16 11:32:49 UTC (rev 384) @@ -9,7 +9,7 @@ #include <sys/time.h> #include <fcntl.h> #include <ctype.h> -extern "C" { + #include "input.h" #include "mouse.h" #ifdef MP_DEBUG @@ -23,7 +23,7 @@ #include "libmpconf/cfgparser.h" #include "in_msg.h" -} + #ifdef HAVE_LIRC #include "lirc.h" #endif Modified: mplayerxp/libao2/Makefile =================================================================== --- mplayerxp/libao2/Makefile 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libao2/Makefile 2012-11-16 11:32:49 UTC (rev 384) @@ -4,7 +4,8 @@ LIBNAME = libao2.a # TODO: moveout ao_sdl.c so it's only used when SDL is detected -SRCS= audio_out.c afmt.c ao_null.c ao_wav.c mixer.c +CXXSRCS=audio_out.cpp mixer.cpp afmt.cpp +SRCS=ao_null.c ao_wav.c ifeq ($(HAVE_SDL),yes) SRCS+=ao_sdl.c endif @@ -30,10 +31,11 @@ SRCS+=ao_jack.c endif - OBJS=$(SRCS:.c=.o) +CXXOBJS=$(CXXSRCS:.cpp=.o) CFLAGS = $(OPTFLAGS) -I. -I.. -Wall +CXXFLAGS = $(OPTXXFLAGS) -I. -I.. -Wall .SUFFIXES: .c .o @@ -41,9 +43,11 @@ .c.o: $(CC) -c $(CFLAGS) -o $@ $< +.cpp.o: + $(CXX) -c $(CXXFLAGS) -o $@ $< -$(LIBNAME): $(OBJS) - $(AR) r $(LIBNAME) $(OBJS) +$(LIBNAME): $(OBJS) $(CXXOBJS) + $(AR) r $(LIBNAME) $(OBJS) $(CXXOBJS) all: $(LIBNAME) @@ -56,7 +60,7 @@ dep: depend depend: - $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # # include dependency files if they exist Deleted: mplayerxp/libao2/afmt.c =================================================================== --- mplayerxp/libao2/afmt.c 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libao2/afmt.c 2012-11-16 11:32:49 UTC (rev 384) @@ -1,37 +0,0 @@ -#include "afmt.h" - -unsigned afmt2bps(unsigned fmt) { - unsigned rc; - switch (fmt) { - default: - case AFMT_U8: - case AFMT_S8: rc = 1; break; - case AFMT_S16_LE: - case AFMT_S16_BE: - case AFMT_U16_LE: - case AFMT_U16_BE: return 2; - case AFMT_S24_LE: - case AFMT_S24_BE: - case AFMT_U24_LE: - case AFMT_U24_BE: return 3; - case AFMT_FLOAT32: - case AFMT_S32_LE: - case AFMT_S32_BE: - case AFMT_U32_LE: - case AFMT_U32_BE: return 4; - } - return rc; -} - -/* very approximate prediction */ -unsigned bps2afmt(unsigned bps) { - unsigned rc; - switch (bps) { - default: - case 1: rc = AFMT_S8; break; - case 2: return AFMT_S16_LE; break; - case 3: return AFMT_S24_LE; break; - case 4: return AFMT_S32_LE; break; - } - return rc; -} \ No newline at end of file Copied: mplayerxp/libao2/afmt.cpp (from rev 369, mplayerxp/libao2/afmt.c) =================================================================== --- mplayerxp/libao2/afmt.cpp (rev 0) +++ mplayerxp/libao2/afmt.cpp 2012-11-16 11:32:49 UTC (rev 384) @@ -0,0 +1,37 @@ +#include "afmt.h" + +unsigned afmt2bps(unsigned fmt) { + unsigned rc; + switch (fmt) { + default: + case AFMT_U8: + case AFMT_S8: rc = 1; break; + case AFMT_S16_LE: + case AFMT_S16_BE: + case AFMT_U16_LE: + case AFMT_U16_BE: return 2; + case AFMT_S24_LE: + case AFMT_S24_BE: + case AFMT_U24_LE: + case AFMT_U24_BE: return 3; + case AFMT_FLOAT32: + case AFMT_S32_LE: + case AFMT_S32_BE: + case AFMT_U32_LE: + case AFMT_U32_BE: return 4; + } + return rc; +} + +/* very approximate prediction */ +unsigned bps2afmt(unsigned bps) { + unsigned rc; + switch (bps) { + default: + case 1: rc = AFMT_S8; break; + case 2: return AFMT_S16_LE; break; + case 3: return AFMT_S24_LE; break; + case 4: return AFMT_S32_LE; break; + } + return rc; +} \ No newline at end of file Modified: mplayerxp/libao2/afmt.h =================================================================== --- mplayerxp/libao2/afmt.h 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libao2/afmt.h 2012-11-16 11:32:49 UTC (rev 384) @@ -46,7 +46,13 @@ # define AFMT_FLOAT32 0x00100000 +#ifdef __cplusplus +extern "C" { +#endif extern unsigned __FASTCALL__ afmt2bps(unsigned fmt); extern unsigned __FASTCALL__ bps2afmt(unsigned bps); /**< very approximate prediction */ +#ifdef __cplusplus +} +#endif #endif Deleted: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libao2/audio_out.c 2012-11-16 11:32:49 UTC (rev 384) @@ -1,299 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include "mp_config.h" -#include "osdep/mplib.h" -#include "audio_out.h" -#include "afmt.h" -#include "ao_msg.h" - -extern const ao_functions_t audio_out_wav; -extern const ao_functions_t audio_out_null; -#ifdef USE_OSS_AUDIO -extern const ao_functions_t audio_out_oss; -#endif -#ifdef HAVE_ALSA -extern const ao_functions_t audio_out_alsa; -#endif -#ifdef HAVE_SDL -extern const ao_functions_t audio_out_sdl; -#endif -#ifdef HAVE_ARTS -extern const ao_functions_t audio_out_arts; -#endif -#ifdef HAVE_ESD -extern const ao_functions_t audio_out_esd; -#endif -#ifdef HAVE_OPENAL -extern const ao_functions_t audio_out_openal; -#endif -#ifdef HAVE_NAS -extern const ao_functions_t audio_out_nas; -#endif -#ifdef HAVE_JACK -extern const ao_functions_t audio_out_jack; -#endif - -static const ao_functions_t* audio_out_drivers[] = -{ -#ifdef USE_OSS_AUDIO - &audio_out_oss, -#endif -#ifdef HAVE_SDL - &audio_out_sdl, -#endif -#ifdef HAVE_ALSA - &audio_out_alsa, -#endif -#ifdef HAVE_ARTS - &audio_out_arts, -#endif -#ifdef HAVE_ESD - &audio_out_esd, -#endif -#ifdef HAVE_OPENAL - &audio_out_openal, -#endif -#ifdef HAVE_NAS - &audio_out_nas, -#endif -#ifdef HAVE_JACK - &audio_out_jack, -#endif - &audio_out_wav, - &audio_out_null, - NULL -}; - -typedef struct priv_s { - char antiviral_hole[RND_CHAR5]; - const ao_functions_t* audio_out; -}priv_t; - -char * __FASTCALL__ ao_format_name(int format) -{ - switch (format) - { - case AFMT_MU_LAW: - return("Mu-Law"); - case AFMT_A_LAW: - return("A-Law"); - case AFMT_IMA_ADPCM: - return("Ima-ADPCM"); - case AFMT_S8: - return("Signed 8-bit"); - case AFMT_U8: - return("Unsigned 8-bit"); - case AFMT_U16_LE: - return("Unsigned 16-bit (Little-Endian)"); - case AFMT_U16_BE: - return("Unsigned 16-bit (Big-Endian)"); - case AFMT_S16_LE: - return("Signed 16-bit (Little-Endian)"); - case AFMT_S16_BE: - return("Signed 16-bit (Big-Endian)"); - case AFMT_U24_LE: - return("Unsigned 24-bit (Little-Endian)"); - case AFMT_U24_BE: - return("Unsigned 24-bit (Big-Endian)"); - case AFMT_S24_LE: - return("Signed 24-bit (Little-Endian)"); - case AFMT_S24_BE: - return("Signed 24-bit (Big-Endian)"); - case AFMT_U32_LE: - return("Unsigned 32-bit (Little-Endian)"); - case AFMT_U32_BE: - return("Unsigned 32-bit (Big-Endian)"); - case AFMT_S32_LE: - return("Signed 32-bit (Little-Endian)"); - case AFMT_S32_BE: - return("Signed 32-bit (Big-Endian)"); - case AFMT_MPEG: - return("MPEG (2) audio"); - case AFMT_AC3: - return("AC3"); - case AFMT_FLOAT32: - return("Float32"); -/* - the following two formats are not available with old linux kernel - headers (e.g. in 2.2.16) -*/ - } - return("Unknown"); -} - -// return number of bits for 1 sample in one channel, or 8 bits for compressed -int __FASTCALL__ ao_format_bits(int format){ - switch (format) - { -/* - the following two formats are not available with old linux kernel - headers (e.g. in 2.2.16) -*/ -#ifdef AFMT_S32_LE - case AFMT_S32_LE: - case AFMT_U32_LE: - return 32; -#endif -#ifdef AFMT_S32_BE - case AFMT_S32_BE: - case AFMT_U32_BE: - return 32; -#endif -#ifdef AFMT_S24_LE - case AFMT_S24_LE: - case AFMT_U24_LE: - return 24; -#endif -#ifdef AFMT_S24_BE - case AFMT_S24_BE: - case AFMT_U24_BE: - return 24; -#endif - - case AFMT_U16_LE: - case AFMT_U16_BE: - case AFMT_S16_LE: - case AFMT_S16_BE: - return 16;//16 bits - - case AFMT_MU_LAW: - case AFMT_A_LAW: - case AFMT_IMA_ADPCM: - case AFMT_S8: - case AFMT_U8: - case AFMT_MPEG: - case AFMT_AC3: - default: - return 8;//default 1 byte - - } - return 8; -} - - -void ao_print_help( void ) -{ - unsigned i; - MSG_INFO("Available audio output drivers:\n"); - i=0; - while (audio_out_drivers[i]) { - const ao_info_t *info = audio_out_drivers[i++]->info; - MSG_INFO("\t%s\t%s\n", info->short_name, info->name); - } - MSG_INFO("\n"); -} - -MPXP_Rc __FASTCALL__ RND_RENAME4(ao_register)(ao_data_t* ao,const char *driver_name,unsigned flags) -{ - priv_t* priv=ao->opaque; - unsigned i; - if(!driver_name) - priv->audio_out=audio_out_drivers[0]; - else - for (i=0; audio_out_drivers[i] != &audio_out_null; i++) { - const ao_info_t *info = audio_out_drivers[i]->info; - if(strcmp(info->short_name,driver_name) == 0){ - priv->audio_out = audio_out_drivers[i];break; - } - } - if(priv->audio_out->init(ao,flags)==MPXP_Ok) return MPXP_Ok; - return MPXP_False; -} - -const ao_info_t* ao_get_info( const ao_data_t* ao ) -{ - priv_t* priv=ao->opaque; - return priv->audio_out->info; -} - -ao_data_t* __FASTCALL__ RND_RENAME5(ao_init)(const char *subdevice) -{ - ao_data_t* ao; - ao=mp_mallocz(sizeof(ao_data_t)); - if(subdevice) ao->subdevice=mp_strdup(subdevice); - ao->outburst=OUTBURST; - ao->buffersize=-1; - ao->opaque=mp_malloc(sizeof(priv_t)); - priv_t* priv=ao->opaque; - SECURE_NAME9(rnd_fill)(priv->antiviral_hole,sizeof(priv_t)); - SECURE_NAME9(rnd_fill)(ao->antiviral_hole,offsetof(ao_data_t,samplerate)-offsetof(ao_data_t,antiviral_hole)); - priv->audio_out=NULL; - return ao; -} - -MPXP_Rc __FASTCALL__ ao_configure(ao_data_t*ao,unsigned rate,unsigned channels,unsigned format) -{ - priv_t* priv=ao->opaque; - return priv->audio_out->configure(ao,rate,channels,format); -} - -void ao_uninit(ao_data_t*ao) -{ - priv_t* priv=ao->opaque; - priv->audio_out->uninit(ao); - if(ao->subdevice) mp_free(ao->subdevice); - mp_free(priv); - mp_free(ao); - ao=NULL; -} - -void ao_reset(ao_data_t*ao) -{ - if(ao) { - priv_t* priv=ao->opaque; - priv->audio_out->reset(ao); - } -} - -unsigned ao_get_space(const ao_data_t*ao) -{ - if(ao) { - priv_t* priv=ao->opaque; - return priv->audio_out->get_space(ao); - } - return 0; -} - -float ao_get_delay(const ao_data_t*ao) -{ - if(ao) { - priv_t* priv=ao->opaque; - return priv->audio_out->get_delay(ao); - } - return 0; -} - -unsigned __FASTCALL__ RND_RENAME6(ao_play)(ao_data_t*ao,const any_t* data,unsigned len,unsigned flags) -{ - if(ao) { - priv_t* priv=ao->opaque; - return priv->audio_out->play(ao,data,len,flags); - } return 0; -} - -void ao_pause(ao_data_t*ao) -{ - if(ao) { - priv_t* priv=ao->opaque; - priv->audio_out->pause(ao); - } -} - -void ao_resume(ao_data_t*ao) -{ - if(ao) { - priv_t* priv=ao->opaque; - priv->audio_out->resume(ao); - } -} - -MPXP_Rc __FASTCALL__ RND_RENAME7(ao_control)(const ao_data_t*ao,int cmd,long arg) -{ - if(ao) { - priv_t* priv=ao->opaque; - return priv->audio_out->control(ao,cmd,arg); - } - return MPXP_Error; -} Copied: mplayerxp/libao2/audio_out.cpp (from rev 372, mplayerxp/libao2/audio_out.c) =================================================================== --- mplayerxp/libao2/audio_out.cpp (rev 0) +++ mplayerxp/libao2/audio_out.cpp 2012-11-16 11:32:49 UTC (rev 384) @@ -0,0 +1,299 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#include "mp_config.h" +#include "osdep/mplib.h" +#include "audio_out.h" +#include "afmt.h" +#include "ao_msg.h" + +extern const ao_functions_t audio_out_wav; +extern const ao_functions_t audio_out_null; +#ifdef USE_OSS_AUDIO +extern const ao_functions_t audio_out_oss; +#endif +#ifdef HAVE_ALSA +extern const ao_functions_t audio_out_alsa; +#endif +#ifdef HAVE_SDL +extern const ao_functions_t audio_out_sdl; +#endif +#ifdef HAVE_ARTS +extern const ao_functions_t audio_out_arts; +#endif +#ifdef HAVE_ESD +extern const ao_functions_t audio_out_esd; +#endif +#ifdef HAVE_OPENAL +extern const ao_functions_t audio_out_openal; +#endif +#ifdef HAVE_NAS +extern const ao_functions_t audio_out_nas; +#endif +#ifdef HAVE_JACK +extern const ao_functions_t audio_out_jack; +#endif + +static const ao_functions_t* audio_out_drivers[] = +{ +#ifdef USE_OSS_AUDIO + &audio_out_oss, +#endif +#ifdef HAVE_SDL + &audio_out_sdl, +#endif +#ifdef HAVE_ALSA + &audio_out_alsa, +#endif +#ifdef HAVE_ARTS + &audio_out_arts, +#endif +#ifdef HAVE_ESD + &audio_out_esd, +#endif +#ifdef HAVE_OPENAL + &audio_out_openal, +#endif +#ifdef HAVE_NAS + &audio_out_nas, +#endif +#ifdef HAVE_JACK + &audio_out_jack, +#endif + &audio_out_wav, + &audio_out_null, + NULL +}; + +typedef struct priv_s { + char antiviral_hole[RND_CHAR5]; + const ao_functions_t* audio_out; +}priv_t; + +const char * __FASTCALL__ ao_format_name(int format) +{ + switch (format) + { + case AFMT_MU_LAW: + return("Mu-Law"); + case AFMT_A_LAW: + return("A-Law"); + case AFMT_IMA_ADPCM: + return("Ima-ADPCM"); + case AFMT_S8: + return("Signed 8-bit"); + case AFMT_U8: + return("Unsigned 8-bit"); + case AFMT_U16_LE: + return("Unsigned 16-bit (Little-Endian)"); + case AFMT_U16_BE: + return("Unsigned 16-bit (Big-Endian)"); + case AFMT_S16_LE: + return("Signed 16-bit (Little-Endian)"); + case AFMT_S16_BE: + return("Signed 16-bit (Big-Endian)"); + case AFMT_U24_LE: + return("Unsigned 24-bit (Little-Endian)"); + case AFMT_U24_BE: + return("Unsigned 24-bit (Big-Endian)"); + case AFMT_S24_LE: + return("Signed 24-bit (Little-Endian)"); + case AFMT_S24_BE: + return("Signed 24-bit (Big-Endian)"); + case AFMT_U32_LE: + return("Unsigned 32-bit (Little-Endian)"); + case AFMT_U32_BE: + return("Unsigned 32-bit (Big-Endian)"); + case AFMT_S32_LE: + return("Signed 32-bit (Little-Endian)"); + case AFMT_S32_BE: + return("Signed 32-bit (Big-Endian)"); + case AFMT_MPEG: + return("MPEG (2) audio"); + case AFMT_AC3: + return("AC3"); + case AFMT_FLOAT32: + return("Float32"); +/* + the following two formats are not available with old linux kernel + headers (e.g. in 2.2.16) +*/ + } + return("Unknown"); +} + +// return number of bits for 1 sample in one channel, or 8 bits for compressed +int __FASTCALL__ ao_format_bits(int format){ + switch (format) + { +/* + the following two formats are not available with old linux kernel + headers (e.g. in 2.2.16) +*/ +#ifdef AFMT_S32_LE + case AFMT_S32_LE: + case AFMT_U32_LE: + return 32; +#endif +#ifdef AFMT_S32_BE + case AFMT_S32_BE: + case AFMT_U32_BE: + return 32; +#endif +#ifdef AFMT_S24_LE + case AFMT_S24_LE: + case AFMT_U24_LE: + return 24; +#endif +#ifdef AFMT_S24_BE + case AFMT_S24_BE: + case AFMT_U24_BE: + return 24; +#endif + + case AFMT_U16_LE: + case AFMT_U16_BE: + case AFMT_S16_LE: + case AFMT_S16_BE: + return 16;//16 bits + + case AFMT_MU_LAW: + case AFMT_A_LAW: + case AFMT_IMA_ADPCM: + case AFMT_S8: + case AFMT_U8: + case AFMT_MPEG: + case AFMT_AC3: + default: + return 8;//default 1 byte + + } + return 8; +} + + +void ao_print_help( void ) +{ + unsigned i; + MSG_INFO("Available audio output drivers:\n"); + i=0; + while (audio_out_drivers[i]) { + const ao_info_t *info = audio_out_drivers[i++]->info; + MSG_INFO("\t%s\t%s\n", info->short_name, info->name); + } + MSG_INFO("\n"); +} + +MPXP_Rc __FASTCALL__ RND_RENAME4(ao_register)(ao_data_t* ao,const char *driver_name,unsigned flags) +{ + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + unsigned i; + if(!driver_name) + priv->audio_out=audio_out_drivers[0]; + else + for (i=0; audio_out_drivers[i] != &audio_out_null; i++) { + const ao_info_t *info = audio_out_drivers[i]->info; + if(strcmp(info->short_name,driver_name) == 0){ + priv->audio_out = audio_out_drivers[i];break; + } + } + if(priv->audio_out->init(ao,flags)==MPXP_Ok) return MPXP_Ok; + return MPXP_False; +} + +const ao_info_t* ao_get_info( const ao_data_t* ao ) +{ + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + return priv->audio_out->info; +} + +ao_data_t* __FASTCALL__ RND_RENAME5(ao_init)(const char *subdevice) +{ + ao_data_t* ao; + ao=new(zeromem) ao_data_t; + if(subdevice) ao->subdevice=mp_strdup(subdevice); + ao->outburst=OUTBURST; + ao->buffersize=-1; + ao->opaque=mp_malloc(sizeof(priv_t)); + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + SECURE_NAME9(rnd_fill)(priv->antiviral_hole,sizeof(priv_t)); + SECURE_NAME9(rnd_fill)(ao->antiviral_hole,offsetof(ao_data_t,samplerate)-offsetof(ao_data_t,antiviral_hole)); + priv->audio_out=NULL; + return ao; +} + +MPXP_Rc __FASTCALL__ ao_configure(ao_data_t*ao,unsigned rate,unsigned channels,unsigned format) +{ + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + return priv->audio_out->configure(ao,rate,channels,format); +} + +void ao_uninit(ao_data_t*ao) +{ + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + priv->audio_out->uninit(ao); + if(ao->subdevice) delete ao->subdevice; + delete priv; + delete ao; + ao=NULL; +} + +void ao_reset(ao_data_t*ao) +{ + if(ao) { + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + priv->audio_out->reset(ao); + } +} + +unsigned ao_get_space(const ao_data_t*ao) +{ + if(ao) { + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + return priv->audio_out->get_space(ao); + } + return 0; +} + +float ao_get_delay(const ao_data_t*ao) +{ + if(ao) { + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + return priv->audio_out->get_delay(ao); + } + return 0; +} + +unsigned __FASTCALL__ RND_RENAME6(ao_play)(ao_data_t*ao,const any_t* data,unsigned len,unsigned flags) +{ + if(ao) { + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + return priv->audio_out->play(ao,data,len,flags); + } return 0; +} + +void ao_pause(ao_data_t*ao) +{ + if(ao) { + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + priv->audio_out->pause(ao); + } +} + +void ao_resume(ao_data_t*ao) +{ + if(ao) { + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + priv->audio_out->resume(ao); + } +} + +MPXP_Rc __FASTCALL__ RND_RENAME7(ao_control)(const ao_data_t*ao,int cmd,long arg) +{ + if(ao) { + priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); + return priv->audio_out->control(ao,cmd,arg); + } + return MPXP_Error; +} Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libao2/audio_out.h 2012-11-16 11:32:49 UTC (rev 384) @@ -100,7 +100,7 @@ } ao_control_vol_t; /* prototypes */ -extern char * __FASTCALL__ ao_format_name(int format); +extern const char * __FASTCALL__ ao_format_name(int format); extern int __FASTCALL__ ao_format_bits(int format); extern void ao_print_help( void ); Deleted: mplayerxp/libao2/mixer.c =================================================================== --- mplayerxp/libao2/mixer.c 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libao2/mixer.c 2012-11-16 11:32:49 UTC (rev 384) @@ -1,69 +0,0 @@ -#include <string.h> -#include <sys/ioctl.h> -#include <fcntl.h> -#include <stdio.h> -#include <unistd.h> - -#include "mp_config.h" -#include "mixer.h" -#include "libao2/audio_out.h" - -void mixer_getvolume(const ao_data_t* ao, float *l,float *r ) -{ - ao_control_vol_t vol; - *l=0; *r=0; - if(MPXP_Ok != RND_RENAME7(ao_control)(ao,AOCONTROL_GET_VOLUME,(long)&vol)) return; - *r=vol.right; - *l=vol.left; -} - -void mixer_setvolume(const ao_data_t* ao,float l,float r ) -{ - ao_control_vol_t vol; - vol.right=r; vol.left=l; - RND_RENAME7(ao_control)(ao,AOCONTROL_SET_VOLUME,(long)&vol); -} - -#define MIXER_CHANGE 3 - -void mixer_incvolume(const ao_data_t* ao) -{ - float mixer_l, mixer_r; - mixer_getvolume(ao, &mixer_l,&mixer_r ); - mixer_l += MIXER_CHANGE; - if ( mixer_l > 100 ) mixer_l = 100; - mixer_r += MIXER_CHANGE; - if ( mixer_r > 100 ) mixer_r = 100; - mixer_setvolume(ao, mixer_l,mixer_r ); -} - -void mixer_decvolume(const ao_data_t* ao) -{ - float mixer_l, mixer_r; - mixer_getvolume(ao, &mixer_l,&mixer_r ); - mixer_l -= MIXER_CHANGE; - if ( mixer_l < 0 ) mixer_l = 0; - mixer_r -= MIXER_CHANGE; - if ( mixer_r < 0 ) mixer_r = 0; - mixer_setvolume(ao, mixer_l,mixer_r ); -} - -float mixer_getbothvolume(const ao_data_t* ao) -{ - float mixer_l, mixer_r; - mixer_getvolume(ao, &mixer_l,&mixer_r ); - return ( mixer_l + mixer_r ) / 2; -} - -static int muted=0; -static float mute_l,mute_r; -void mixer_mute(const ao_data_t* ao) -{ - if ( muted ) { mixer_setvolume(ao, mute_l,mute_r ); muted=0; } - else - { - mixer_getvolume(ao, &mute_l,&mute_r ); - mixer_setvolume(ao, 0,0 ); - muted=1; - } -} Copied: mplayerxp/libao2/mixer.cpp (from rev 369, mplayerxp/libao2/mixer.c) =================================================================== --- mplayerxp/libao2/mixer.cpp (rev 0) +++ mplayerxp/libao2/mixer.cpp 2012-11-16 11:32:49 UTC (rev 384) @@ -0,0 +1,69 @@ +#include <string.h> +#include <sys/ioctl.h> +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> + +#include "mp_config.h" +#include "mixer.h" +#include "libao2/audio_out.h" + +void mixer_getvolume(const ao_data_t* ao, float *l,float *r ) +{ + ao_control_vol_t vol; + *l=0; *r=0; + if(MPXP_Ok != RND_RENAME7(ao_control)(ao,AOCONTROL_GET_VOLUME,(long)&vol)) return; + *r=vol.right; + *l=vol.left; +} + +void mixer_setvolume(const ao_data_t* ao,float l,float r ) +{ + ao_control_vol_t vol; + vol.right=r; vol.left=l; + RND_RENAME7(ao_control)(ao,AOCONTROL_SET_VOLUME,(long)&vol); +} + +#define MIXER_CHANGE 3 + +void mixer_incvolume(const ao_data_t* ao) +{ + float mixer_l, mixer_r; + mixer_getvolume(ao, &mixer_l,&mixer_r ); + mixer_l += MIXER_CHANGE; + if ( mixer_l > 100 ) mixer_l = 100; + mixer_r += MIXER_CHANGE; + if ( mixer_r > 100 ) mixer_r = 100; + mixer_setvolume(ao, mixer_l,mixer_r ); +} + +void mixer_decvolume(const ao_data_t* ao) +{ + float mixer_l, mixer_r; + mixer_getvolume(ao, &mixer_l,&mixer_r ); + mixer_l -= MIXER_CHANGE; + if ( mixer_l < 0 ) mixer_l = 0; + mixer_r -= MIXER_CHANGE; + if ( mixer_r < 0 ) mixer_r = 0; + mixer_setvolume(ao, mixer_l,mixer_r ); +} + +float mixer_getbothvolume(const ao_data_t* ao) +{ + float mixer_l, mixer_r; + mixer_getvolume(ao, &mixer_l,&mixer_r ); + return ( mixer_l + mixer_r ) / 2; +} + +static int muted=0; +static float mute_l,mute_r; +void mixer_mute(const ao_data_t* ao) +{ + if ( muted ) { mixer_setvolume(ao, mute_l,mute_r ); muted=0; } + else + { + mixer_getvolume(ao, &mute_l,&mute_r ); + mixer_setvolume(ao, 0,0 ); + muted=1; + } +} Modified: mplayerxp/libmpcodecs/Makefile =================================================================== --- mplayerxp/libmpcodecs/Makefile 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libmpcodecs/Makefile 2012-11-16 11:32:49 UTC (rev 384) @@ -5,9 +5,9 @@ DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done -SRCS=dec_video.c \ - vd.c \ - vd_null.c \ +CXXSRCS=dec_video.cpp vd.cpp ad.cpp dec_audio.cpp + +SRCS=vd_null.c \ vd_ffmpeg.c \ vd_raw.c \ vd_nuv.c \ @@ -15,8 +15,6 @@ vd_xvid.c \ vd_mpegpes.c \ vd_huffyuv.c \ - ad.c \ - dec_audio.c \ ad_null.c \ ad_ffmpeg.c \ ad_mp3.c \ @@ -57,8 +55,10 @@ endif OBJS=$(SRCS:.c=.o) +CXXOBJS=$(CXXSRCS:.cpp=.o) CFLAGS = $(OPTFLAGS) -I. -I.. -Wall +CXXFLAGS = $(OPTXXFLAGS) -I. -I.. -Wall .SUFFIXES: .c .o @@ -71,9 +71,11 @@ .c.o: $(CC) -c $(CFLAGS) -o $@ $< +.cpp.o: + $(CXX) -c $(CXXFLAGS) -o $@ $< -$(LIBNAME): $(SUBDIRS) $(OBJS) - $(AR) r $(LIBNAME) $(OBJS) \ +$(LIBNAME): $(SUBDIRS) $(OBJS) $(CXXOBJS) + $(AR) r $(LIBNAME) $(OBJS) $(CXXOBJS) \ $(wildcard libnuppelvideo/*.o) \ $(wildcard liba52/*.o) \ $(wildcard libdca/*.o) @@ -91,7 +93,7 @@ depend: $(DO_MAKE) - $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # # include dependency files if they exist Deleted: mplayerxp/libmpcodecs/ad.c =================================================================== --- mplayerxp/libmpcodecs/ad.c 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libmpcodecs/ad.c 2012-11-16 11:32:49 UTC (rev 384) @@ -1,107 +0,0 @@ -/* - ad.c - audio decoder interface -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "mp_config.h" - -#include "libmpdemux/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "ad.h" -#include "ad_msg.h" - -/* Missed vorbis, mad, dshow */ - -extern const ad_functions_t mpcodecs_ad_null; -extern const ad_functions_t mpcodecs_ad_mp3; -extern const ad_functions_t mpcodecs_ad_ffmpeg; -extern const ad_functions_t mpcodecs_ad_a52; -extern const ad_functions_t mpcodecs_ad_dca; -extern const ad_functions_t mpcodecs_ad_hwac3; -extern const ad_functions_t mpcodecs_ad_pcm; -extern const ad_functions_t mpcodecs_ad_libdv; -extern const ad_functions_t mpcodecs_ad_dvdpcm; -extern const ad_functions_t mpcodecs_ad_dshow; -extern const ad_functions_t mpcodecs_ad_msacm; -extern const ad_functions_t mpcodecs_ad_faad; -extern const ad_functions_t mpcodecs_ad_vorbis; -extern const ad_functions_t mpcodecs_ad_real; -extern const ad_functions_t mpcodecs_ad_twin; -extern const ad_functions_t mpcodecs_ad_dmo; -extern const ad_functions_t mpcodecs_ad_qtaudio; - -static const ad_functions_t* mpcodecs_ad_drivers[] = { - &mpcodecs_ad_mp3, - &mpcodecs_ad_a52, - &mpcodecs_ad_dca, - &mpcodecs_ad_hwac3, - &mpcodecs_ad_pcm, - &mpcodecs_ad_dvdpcm, - &mpcodecs_ad_faad, -#ifdef HAVE_LIBVORBIS - &mpcodecs_ad_vorbis, -#endif -#ifdef HAVE_LIBDV - &mpcodecs_ad_libdv, -#endif -#ifndef ENABLE_GPL_ONLY - &mpcodecs_ad_real, -#endif -#ifdef ENABLE_WIN32LOADER - &mpcodecs_ad_dshow, - &mpcodecs_ad_twin, - &mpcodecs_ad_msacm, - &mpcodecs_ad_dmo, - &mpcodecs_ad_qtaudio, -#endif - &mpcodecs_ad_ffmpeg, - &mpcodecs_ad_null, - -}; - -static unsigned int nddrivers=sizeof(mpcodecs_ad_drivers)/sizeof(ad_functions_t*); - -void libmpcodecs_ad_register_options(m_config_t* cfg) -{ - unsigned i; - for(i=0;i<nddrivers;i++) { - if(mpcodecs_ad_drivers[i]) - if(mpcodecs_ad_drivers[i]->options) - m_config_register_options(cfg,mpcodecs_ad_drivers[i]->options); - if(mpcodecs_ad_drivers[i]==&mpcodecs_ad_null) break; - } -} - -const ad_functions_t* afm_find_driver(const char *name) { - unsigned i; - for (i=0; mpcodecs_ad_drivers[i] != &mpcodecs_ad_null; i++) { - if(strcmp(mpcodecs_ad_drivers[i]->info->driver_name,name)==0){ - return mpcodecs_ad_drivers[i]; - } - } - return NULL; -} - -const audio_probe_t* afm_probe_driver(sh_audio_t *sh) { - unsigned i; - const audio_probe_t* rv; - for (i=0; mpcodecs_ad_drivers[i] != &mpcodecs_ad_null; i++) { - if((rv=mpcodecs_ad_drivers[i]->probe(sh,sh->wtag))!=NULL) return rv; - } - return NULL; -} - -void afm_help(void) { - unsigned i; - MSG_INFO("Available audio codec families/drivers:\n"); - for(i=0;i<nddrivers;i++) { - if(mpcodecs_ad_drivers[i]) - if(mpcodecs_ad_drivers[i]->options) - MSG_INFO("\t%-10s %s\n",mpcodecs_ad_drivers[i]->info->driver_name,mpcodecs_ad_drivers[i]->info->descr); - } - MSG_INFO("\n"); -} Copied: mplayerxp/libmpcodecs/ad.cpp (from rev 369, mplayerxp/libmpcodecs/ad.c) =================================================================== --- mplayerxp/libmpcodecs/ad.cpp (rev 0) +++ mplayerxp/libmpcodecs/ad.cpp 2012-11-16 11:32:49 UTC (rev 384) @@ -0,0 +1,107 @@ +/* + ad.c - audio decoder interface +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "mp_config.h" + +#include "libmpdemux/stream.h" +#include "libmpdemux/demuxer.h" +#include "libmpdemux/stheader.h" +#include "ad.h" +#include "ad_msg.h" + +/* Missed vorbis, mad, dshow */ + +extern const ad_functions_t mpcodecs_ad_null; +extern const ad_functions_t mpcodecs_ad_mp3; +extern const ad_functions_t mpcodecs_ad_ffmpeg; +extern const ad_functions_t mpcodecs_ad_a52; +extern const ad_functions_t mpcodecs_ad_dca; +extern const ad_functions_t mpcodecs_ad_hwac3; +extern const ad_functions_t mpcodecs_ad_pcm; +extern const ad_functions_t mpcodecs_ad_libdv; +extern const ad_functions_t mpcodecs_ad_dvdpcm; +extern const ad_functions_t mpcodecs_ad_dshow; +extern const ad_functions_t mpcodecs_ad_msacm; +extern const ad_functions_t mpcodecs_ad_faad; +extern const ad_functions_t mpcodecs_ad_vorbis; +extern const ad_functions_t mpcodecs_ad_real; +extern const ad_functions_t mpcodecs_ad_twin; +extern const ad_functions_t mpcodecs_ad_dmo; +extern const ad_functions_t mpcodecs_ad_qtaudio; + +static const ad_functions_t* mpcodecs_ad_drivers[] = { + &mpcodecs_ad_mp3, + &mpcodecs_ad_a52, + &mpcodecs_ad_dca, + &mpcodecs_ad_hwac3, + &mpcodecs_ad_pcm, + &mpcodecs_ad_dvdpcm, + &mpcodecs_ad_faad, +#ifdef HAVE_LIBVORBIS + &mpcodecs_ad_vorbis, +#endif +#ifdef HAVE_LIBDV + &mpcodecs_ad_libdv, +#endif +#ifndef ENABLE_GPL_ONLY + &mpcodecs_ad_real, +#endif +#ifdef ENABLE_WIN32LOADER + &mpcodecs_ad_dshow, + &mpcodecs_ad_twin, + &mpcodecs_ad_msacm, + &mpcodecs_ad_dmo, + &mpcodecs_ad_qtaudio, +#endif + &mpcodecs_ad_ffmpeg, + &mpcodecs_ad_null, + +}; + +static unsigned int nddrivers=sizeof(mpcodecs_ad_drivers)/sizeof(ad_functions_t*); + +void libmpcodecs_ad_register_options(m_config_t* cfg) +{ + unsigned i; + for(i=0;i<nddrivers;i++) { + if(mpcodecs_ad_drivers[i]) + if(mpcodecs_ad_drivers[i]->options) + m_config_register_options(cfg,mpcodecs_ad_drivers[i]->options); + if(mpcodecs_ad_drivers[i]==&mpcodecs_ad_null) break; + } +} + +const ad_functions_t* afm_find_driver(const char *name) { + unsigned i; + for (i=0; mpcodecs_ad_drivers[i] != &mpcodecs_ad_null; i++) { + if(strcmp(mpcodecs_ad_drivers[i]->info->driver_name,name)==0){ + return mpcodecs_ad_drivers[i]; + } + } + return NULL; +} + +const audio_probe_t* afm_probe_driver(sh_audio_t *sh) { + unsigned i; + const audio_probe_t* rv; + for (i=0; mpcodecs_ad_drivers[i] != &mpcodecs_ad_null; i++) { + if((rv=mpcodecs_ad_drivers[i]->probe(sh,sh->wtag))!=NULL) return rv; + } + return NULL; +} + +void afm_help(void) { + unsigned i; + MSG_INFO("Available audio codec families/drivers:\n"); + for(i=0;i<nddrivers;i++) { + if(mpcodecs_ad_drivers[i]) + if(mpcodecs_ad_drivers[i]->options) + MSG_INFO("\t%-10s %s\n",mpcodecs_ad_drivers[i]->info->driver_name,mpcodecs_ad_drivers[i]->info->descr); + } + MSG_INFO("\n"); +} Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libmpcodecs/ad.h 2012-11-16 11:32:49 UTC (rev 384) @@ -7,6 +7,9 @@ #include "libmpconf/cfgparser.h" #include "xmpcore/xmp_enums.h" #include "libao2/afmt.h" +#ifdef __cplusplus +extern "C" { +#endif typedef struct ad_info_s { @@ -56,5 +59,8 @@ extern const ad_functions_t* afm_find_driver(const char *name); extern const audio_probe_t* afm_probe_driver(sh_audio_t* sh); #define FIX_APTS(sh_audio,pts,in_size) (sh_audio->i_bps?((float)(pts)+(float)(in_size)/(float)sh_audio->i_bps):((float)(pts))) +#ifdef __cplusplus +} +#endif #endif Deleted: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-11-16 07:53:58 UTC (rev 383) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-11-16 11:32:49 UTC (rev 384) @@ -1,382 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include "mp_config.h" -#include "help_mp.h" - -#include "mplayerxp.h" -#include "xmpcore/xmp_core.h" - -#include "libmpdemux/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "libmpconf/codec-cfg.h" - -#include "dec_audio.h" -#include "libao2/afmt.h" -#include "libao2/audio_out.h" -#include "mplayerxp.h" -#include "libmpdemux/demuxer_r.h" -#include "postproc/af.h" -#include "osdep/fastmemcpy.h" -#include "osdep/mplib.h" -#include "ad_msg.h" - -/* used for ac3surround decoder - set using -channels option */ -af_cfg_t af_cfg; // Configuration for audio filters - -typedef struct priv_s { - sh_audio_t* parent; - const ad_functions_t* mpadec; -}priv_t; - -any_t* RND_RENAME2(mpca_init)(sh_audio_t *sh_audio) -{ - const char *afm,*ac; - const audio_probe_t* aprobe=NULL; - priv_t* priv = mp_mallocz(sizeof(priv_t)); - priv->parent=sh_audio; - if(!sh_audio->codec) { - if(mp_conf.audio_family) { - afm=mp_conf.audio_family; - ac=afm; - priv->mpadec=afm_find_driver(afm); - if(priv->mpadec) aprobe=priv->mpadec->probe(sh_audio,sh_audio->wtag); - } - else aprobe = afm_probe_driver(sh_audio); - } - if(aprobe) { - afm=aprobe->driver; - ac=aprobe->codec_dll; - /* fake struct codecs_st*/ - sh_audio->codec=mp_malloc(sizeof(struct codecs_st)); - strcpy(sh_audio->codec->dll_name,aprobe->codec_dll); - strcpy(sh_audio->codec->driver_name,aprobe->driver); - strcpy(sh_audio->codec->codec_name,sh_audio->codec->dll_name); - memcpy(sh_audio->codec->outfmt,aprobe->sample_fmt,sizeof(aprobe->sample_fmt)); - priv->mpadec=afm_find_driver(afm); - } - else if(sh_audio->codec) { - afm=sh_audio->codec->driver_name; - ac=sh_audio->codec->codec_name; - priv->mpadec=afm_find_driver(afm); - } - if(!priv->mpadec){ - MSG_ERR(MSGTR_CODEC_BAD_AFAMILY,ac, afm); - mp_free(priv); - return NULL; // no such driver - } - - /* reset in/out buffer size/pointer: */ - sh_audio->a_buffer_size=0; - sh_audio->a_buffer=NULL; - sh_audio->a_in_buffer_size=0; - sh_audio->a_in_buffer=NULL; - - /* Set up some common usefull defaults. ad->preinit() can override these: */ -#ifdef WORDS_BIGENDIAN - sh_audio->afmt=AFMT_S16_BE; -#else - sh_audio->afmt=AFMT_S16_LE; -#endif - sh_audio->rate=0; - sh_audio->o_bps=0; - if(sh_audio->wf) /* NK: We need to know i_bps before its detection by codecs param */ - sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; - - sh_audio->audio_out_minsize=8192;/* default size, maybe not enough for Win32/ACM*/ - sh_audio->audio_in_minsize=0; - - if(priv->mpadec->preinit(sh_audio)!=MPXP_Ok) { - MSG_ERR(MSGTR_CODEC_CANT_PREINITA); - mp_free(priv); - return NULL; - } - - /* allocate audio in buffer: */ - if(sh_audio->audio_in_minsize>0){ - sh_audio->a_in_buffer_size=sh_audio->audio_in_minsize; - MSG_V("dec_audio: Allocating %d bytes for input buffer\n", - sh_audio->a_in_buffer_size); - sh_audio->a_in_buffer=mp_mallocz(sh_audio->a_in_buffer_size); - sh_audio->a_in_buffer_len=0; - } - - /* allocate audio out buffer: */ - sh_audio->a_buffer_size=sh_audio->audio_out_minsize+MAX_OUTBURST; /* worst case calc.*/ - - MSG_V("dec_audio: Allocating %d + %d = %d bytes for output buffer\n", - sh_audio->audio_out_minsize,MAX_OUTBURST,sh_audio->a_buffer_size); - - sh_audio->a_buffer=mp_mallocz(sh_audio->a_buffer_size); - if(!sh_audio->a_buffer) { - MSG_ERR(MSGTR_CantAllocAudioBuf); - mp_free(priv); - return NULL; - } - sh_audio->a_buffer_len=0; - - if(priv->mpadec->init(sh_audio)!=MPXP_Ok){ - MSG_WARN(MSGTR_CODEC_CANT_INITA); - mpca_uninit(priv); /* mp_free buffers */ - return NULL; - } - - sh_audio->inited=1; - - if(!sh_audio->nch || !sh_audio->rate) { - MSG_WARN(MSGTR_UnknownAudio); - mpca_uninit(priv); /* mp_free buffers */ - return NULL; - } - - if(!sh_audio->o_bps) - sh_audio->o_bps=sh_audio->nch*sh_audio->rate*afmt2bps(sh_audio->afmt); - if(!sh_audio->i_bps) { - static int warned=0; - if(!warned) { - warned=1; - MSG_WARN(MSGTR_CODEC_INITAL_AV_RESYNC); - } - } else if(xp_core->initial_apts_corr.need_correction==1) { - xp_core->initial_apts += ((float)(xp_core->initial_apts_corr.pts_bytes-xp_core->initial_apts_corr.nbytes))/(float)sh_audio->i_bps; - xp_core->initial_apts_corr.need_correction=0; - } - MSG_OK("[AC] %s decoder: [%s] drv:%s.%s ratio %i->%i\n",mp_conf.audio_codec?"Forcing":"Selecting" - ,ac - ,priv->mpadec->info->driver_name - ,ac - ,sh_audio->i_bps,sh_audio->o_bps); - if(sh_audio->codec) { mp_free(sh_audio->codec); sh_audio->codec=NULL; } - return priv; -} - -void mpca_uninit(any_t *opaque) -{ - priv_t* priv = (priv_t*)opaque; - sh_audio_t* parent = priv->parent; - if(!parent) { mp_free(priv); return; } - if(priv->parent->afilter){ - MSG_V("Uninit audio filters...\n"); - af_uninit(parent->afilter); - mp_free(parent->afilter); - parent->afilter=NULL; - } - if(parent->a_buffer) mp_free(parent->a_buffer); - parent->a_buffer=NULL; - if(parent->a_in_buffer) mp_free(parent->a_in_buffer); - parent->a_in_buffer=NULL; - if(!parent->inited) { mp_free(priv); return; } - MSG_V("uninit audio: ...\n"); - priv->mpadec->uninit(parent); - if(parent->a_buffer) mp_free(parent->a_buffer); - parent->a_buffer=NULL; - parent->inited=0; - mp_free(priv); -} - - /* Init audio filters */ -MPXP_Rc mpca_preinit_filters(sh_audio_t *sh_audio, - unsigned in_samplerate, unsigned in_channels, unsigned in_format, - unsigned* out_samplerate, unsigned* out_channels, unsigned* out_format){ - char strbuf[200]; - af_stream_t* afs=RND_RENAME6(af_new)(sh_audio); - - // input format: same as codec's output format: - afs->input.rate = in_samplerate; - afs->input.nch = in_channels; - afs->input.format = mpaf_format_decode(in_format); - - // output format: same as ao driver's input format (if missing, fallback to input) - afs->output.rate = *out_samplerate ? *out_samplerate : afs->input.rate; - afs->output.nch = *out_channels ? *out_channels : afs->input.nch; - if(*out_format) afs->output.format = mpaf_format_decode(*out_format); - else afs->output.format = afs->input.format; - - // filter config: - memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t)); - - MSG_V("Checking audio filter chain for %dHz/%dch/%dbit...\n", - afs->input.rate,afs->input.nch,(afs->input.format&MPAF_BPS_MASK)*8); - - // let's autoprobe it! - if(MPXP_Ok != RND_RENAME7(af_init)(afs,0)){ - mp_free(afs); - return MPXP_False; // failed :( - } - - *out_samplerate=afs->output.rate; - *out_channels=afs->output.nch; - *out_format=mpaf_format_encode(afs->output.format); - - sh_audio->af_bps = afs->output.rate*afs->output.nch*(afs->output.format&MPAF_BPS_MASK); - - MSG_V("AF_pre: af format: %d ch, %d hz, %s af_bps=%i\n", - afs->output.nch, afs->output.rate, - mpaf_fmt2str(afs->output.format,strbuf,200), - sh_audio->af_bps); - - sh_audio->afilter=(any_t*)afs; - return MPXP_Ok; -} - - /* Init audio filters */ -MPXP_Rc mpca_init_filters(sh_audio_t *sh_audio, - unsigned in_samplerate, unsigned in_channels, mpaf_format_e in_format, - unsigned out_samplerate, unsigned out_channels, mpaf_format_e out_format, - unsigned out_minsize, unsigned out_maxsize){ - char strbuf[200]; - af_stream_t* afs=sh_audio->afilter; - if(!afs) afs = RND_RENAME6(af_new)(sh_audio); - - // input format: same as codec's output format: - afs->input.rate = in_samplerate; - afs->input.nch = in_channels; - afs->input.format = mpaf_format_decode(in_format); - - // output format: same as ao driver's input format (if missing, fallback to input) - afs->output.rate = out_samplerate ? out_samplerate : afs->input.rate; - afs->output.nch = out_channels ? out_channels : afs->input.nch; - afs->output.format = mpaf_format_decode(out_format ? out_format : afs->input.format); - - // filter config: - memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t)); - - MSG_V("Building audio filter chain for %dHz/%dch/%dbit (%s) -> %dHz/%dch/%dbit (%s)...\n", - afs->input.rate,afs->input.nch,(afs->input.format&MPAF_BPS_MASK)*8,ao_format_name(mpaf_format_encode(afs->input.format)), - afs->output.rate,afs->output.nch,(afs->output.format&MPAF_BPS_MASK)*8,ao_format_name(mpaf_format_encode(afs->output.format))); - - // let's autoprobe it! - if(MPXP_Ok != RND_RENAME7(af_init)(afs,1)){ - sh_audio->afilter=NULL; - mp_free(afs); - return MPXP_False; // failed :( - } - - // allocate the a_out_* buffers: - if(out_maxsize<out_minsize) out_maxsize=out_minsize; - if(out_maxsize<8192) out_maxsize=MAX_OUTBURST; // not sure this is ok - - sh_audio->af_bps = afs->output.rate*afs->output.nch*(afs->output.format&MPAF_BPS_MASK); - - MSG_V("AF_init: af format: %d ch, %d hz, %s af_bps=%i\n", - afs->output.nch, afs->output.rate, - mpaf_fmt2str(afs->output.format,strbuf,200), - sh_audio->af_bps); - - sh_audio->a_buffer_size=out_maxsize; - sh_audio->a_buffer=mp_mallocz(sh_audio->a_buffer_size); - sh_audio->a_buffer_len=0; - - af_showconf(afs->first); - sh_audio->afilter=(any_t*)afs; - sh_audio->afilter_inited=1; - return MPXP_Ok; -} - - /* Init audio filters */ -MPXP_Rc mpca_reinit_filters(sh_audio_t *sh_audio, - unsigned in_samplerate, unsigned in_channels, mpaf_format_e in_format, - unsigned out_samplerate, unsigned out_channels, mpaf_format_e out_format, - unsigned out_minsize, unsigned out_maxsize) -{ - if(sh_audio->afilter){ - MSG_V("Uninit audio filters...\n"); - af_uninit(sh_audio->afilter); - mp_free(sh_audio->afilter); - sh_audio->afilter=NULL; - } - return mpca_init_filters(sh_audio,in_samplerate,in_channels, - in_format,out_samplerate, - out_channels,out_format, - out_minsize,out_maxsize); -} - -unsigned RND_RENAME3(mpca_decode)(any_t *opaque,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts) -{ - priv_t* priv = (priv_t*)opaque; - sh_audio_t* sh_audio = priv->parent; - unsigned len; - unsigned cp_size,cp_tile; - mp_aframe_t afd; // filter input - mp_aframe_t* pafd; // filter output - - if(!sh_audio->inited) return 0; // no codec - MSG_DBG3("mpca_decode(%p,%p,%i,%i,%i,%p)\n",sh_audio,buf,minlen,maxlen,buflen,pts); - - if(minlen>maxlen) MSG_WARN(MSGTR_CODEC_XP_INT_ERR,minlen,maxlen); - if(sh_audio->af_buffer_len) { - cp_size=min(buflen,sh_audio->af_buffer_len); - memcpy(buf,sh_audio->af_buffer,cp_size); - *pts = sh_audio->af_pts; - cp_tile=sh_audio->af_buffer_len-cp_size; - MSG_DBG2("cache->buf %i bytes %f pts <PREDICTED PTS %f>\n",cp_size,*pts,*pts+(float)cp_tile/(float)sh_audio->af_bps); - if(cp_tile) { - sh_audio->af_buffer=&sh_audio->af_buffer[cp_size]; - sh_audio->af_buffer_len=cp_tile; - sh_audio->af_pts += (float)cp_size/(float)sh_audio->af_bps; - } - else sh_audio->af_buffer_len=0; - return cp_size; - } - if(sh_audio->af_bps>sh_audio->o_bps) - maxlen=min(maxlen,(long long int)buflen*sh_audio->o_bps/sh_audio->af_bps); - len=priv->mpadec->decode(sh_audio,buf, minlen, maxlen,pts); - if(len>buflen) MSG_WARN(MSGTR_CODEC_BUF_OVERFLOW,sh_audio->codec->driver_name,len,buflen); - MSG_DBG2("decaudio: %i bytes %f pts min %i max %i buflen %i o_bps=%i f_bps=%i\n",len,*pts,minlen,maxlen,buflen,sh_audio->o_bps,sh_audio->af_bps); - if(len==0 || !sh_audio->afilter) return 0; // EOF? - // run the filters: - memset(&afd,0,sizeof(mp_aframe_t)); - afd.audio=buf; - afd.len=len; - afd.rate=sh_audio->rate; - afd.nch=sh_audio->nch; - afd.format=mpaf_format_decode(sh_audio->afmt); - pafd=RND_RENAME8(af_play)(sh_audio->afilter,&afd); - - if(!pafd) { - MSG_V("decaudio: filter error\n"); - return 0; // error - } - - MSG_DBG2("decaudio: %X in=%d out=%d (min %d max %d buf %d)\n", - pafd->format,len, pafd->len, minlen, maxlen, buflen); - - cp_size=pafd->len; - if(buf != pafd->audio) { - cp_size=min(buflen,pafd->len); - memcpy(buf,pafd->audio,cp_size); - cp_tile=pafd->len-cp_size; - if(cp_tile) { - sh_audio->af_buffer=&((char *)pafd->audio)[cp_size]; - sh_audio->af_buffer_len=cp_tile; - sh_audio->af_pts = *pts+(float)cp_size/(float)sh_audio->af_bps; - MSG_DBG2("decaudio: afilter->cache %i bytes %f pts\n",cp_tile,*pts); - } else sh_audio->af_buffer_len=0; - } - return cp_size; -} - -/* Note: it is called once after seeking, to resync. */ -void mpca_resync_stream(any_t *opaque) -{ - priv_t* priv = (priv_t*)opaque; - sh_audio_t* sh_audio = priv->parent; - if(sh_audio) { - sh_audio->a_in_buffer_len=0; /* workaround */ - if(sh_audio->inited && priv->mpadec) priv->mpadec->control(sh_audio,ADCTRL_RESYNC_STREAM,NULL); - } -} - -/* Note: it is called to skip (jump over) small amount (1/10 sec or 1 frame) - of audio data - used to sync audio to video after seeking */ -void mpca_skip_frame(any_t *opaque) -{ - priv_t* priv = (priv_t*)opaque; - sh_audio_t* sh_audio = priv->parent; - MPXP_Rc rc=MPXP_True; - if(sh_audio) - if(sh_audio->inited && priv->mpadec) rc=priv->mpadec->control(sh_audio,ADCTRL_SKIP_FRAME,NULL); - if(rc!=MPXP_True) ds_fill_buffer(sh_audio->ds); -} Copied: mplayerxp/libmpcodecs/dec_audio.cpp (from rev 369, mplayerxp/libmpcodecs/dec_audio.c) =================================================================== --- mplayerxp/libmpcodecs/dec_audio.cpp (rev 0) +++ mplayerxp/libmpcodecs/dec_audio.cpp 2012-11-16 11:32:49 UTC (rev 384) @@ -0,0 +1,384 @@ +#include <algorithm> + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include "mp_config.h" +#include "help_mp.h" + +#include "mplayerxp.h" +#include "xmpcore/xmp_core.h" + +#include "libmpdemux/stream.h" +#include "libmpdemux/demuxer.h" +#include "libmpdemux/stheader.h" +#include "libmpconf/codec-cfg.h" + +#include "dec_audio.h" +#include "libao2/afmt.h" +#include "libao2/audio_out.h" +#include "mplayerxp.h" +#include "libmpdemux/demuxer_r.h" +#include "postproc/af.h" +#include "osdep/fastmemcpy.h" +#include "osdep/mplib.h" +#include "ad_msg.h" + +/* used for ac3surround decoder - set using -channels option */ +af_cfg_t af_cfg; // Configuration for audio filters + +typedef struct priv_s { + sh_audio_t* parent; + const ad_functions_t* mpadec; +}priv_t; + +any_t* RND_RENAME2(mpca_init)(sh_audio_t *sh_audio) +{ + const char *afm=NULL,*ac=NULL; + const audio_probe_t* aprobe=NULL; + priv_t* priv = new(zeromem) priv_t; + priv->parent=sh_audio; + if(!sh_audio->codec) { + if(mp_conf.audio_family) { + afm=mp_conf.audio_family; + ac=afm; + priv->mpadec=afm_find_driver(afm); + if(priv->mpadec) aprobe=priv->mpadec->probe(sh_audio,sh_audio->wtag); + } + else aprobe = afm_probe_driver(sh_audio); + } + if(aprobe) { + afm=aprobe->driver; + ac=aprobe->codec_dll; + /* fake struct codecs_st*/ + sh_audio->codec=new(zeromem) struct codecs_st; + strcpy(sh_audio->codec->dll_name,aprobe->codec_dll); + strcpy(sh_audio->codec->driver_name,aprobe->driver); + strcpy(sh_audio->codec->codec_name,sh_audio->codec->dll_name); + memcpy(sh_audio->codec->outfmt,aprobe->sample_fmt,sizeof(aprobe->sample_fmt)); + priv->mpadec=afm_find_driver(afm); + } + else if(sh_audio->codec) { + afm=sh_audio->codec->driver_name; + ac=sh_audio->codec->codec_name; + priv->mpadec=afm_find_driver(afm); + } + if(!priv->mpadec){ + MSG_ERR(MSGTR_CODEC_BAD_AFAMILY,ac, afm); + delete priv; + return NULL; // no such driver + } + + /* reset in/out buffer size/pointer: */ + sh_audio->a_buffer_size=0; + sh_audio->a_buffer=NULL; + sh_audio->a_in_buffer_size=0; + sh_audio->a_in_buffer=NULL; + + /* Set up some common usefull defaults. ad->preinit() can override these: */ +#ifdef WORDS_BIGENDIAN + sh_audio->afmt=AFMT_S16_BE; +#else + sh_audio->afmt=AFMT_S16_LE; +#endif + sh_audio->rate=0; + sh_audio->o_bps=0; + if(sh_audio->wf) /* NK: We need to know i_bps before its detection by codecs param */ + sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; + + sh_audio->audio_out_minsize=8192;/* default size, maybe not enough for Win32/ACM*/ + sh_audio->audio_in_minsize=0; + + if(priv->mpadec->preinit(sh_audio)!=MPXP_Ok) { + MSG_ERR(MSGTR_CODEC_CANT_PREINITA); + delete priv; + return NULL; + } + + /* allocate audio in buffer: */ + if(sh_audio->audio_in_minsize>0){ + sh_audio->a_in_buffer_size=sh_audio->audio_in_minsize; + MSG_V("dec_audio: Allocating %d bytes for input buffer\n", + sh_audio->a_in_buffer_size); + sh_audio->a_in_buffer=new char [sh_audio->a_in_buffer_size]; + sh_audio->a_in_buffer_len=0; + } + + /* allocate audio out buffer: */ + sh_audio->a_buffer_size=sh_audio->audio_out_minsize+MAX_OUTBURST; /* worst case calc.*/ + + MSG_V("dec_audio: Allocating %d + %d = %d bytes for output buffer\n", + sh_audio->audio_out_minsize,MAX_OUTBURST,sh_audio->a_buffer_size); + + sh_audio->a_buffer=new char [sh_audio->a_buffer_size]; + if(!sh_audio->a_buffer) { + MSG_ERR(MSGTR_CantAllocAudioBuf); + delete priv; + return NULL; + } + sh_audio->a_buffer_len=0; + + if(priv->mpadec->init(sh_audio)!=MPXP_Ok){ + MSG_WARN(MSGTR_CODEC_CANT_INITA); + mpca_uninit(priv); /* mp_free buffers */ + return NULL; + } + + sh_audio->inited=1; + + if(!sh_audio->nch || !sh_audio->rate) { + MSG_WARN(MSGTR_UnknownAudio); + mpca_uninit(priv); /* mp_free buffers */ + return NULL; + } + + if(!sh_audio->o_bps) + sh_audio->o_bps=sh_audio->nch*sh_audio->rate*afmt2bps(sh_audio->afmt); + if(!sh_audio->i_bps) { + static int warned=0; + if(!warned) { + warned=1; + MSG_WARN(MSGTR_CODEC_INITAL_AV_RESYNC); + } + } else if(xp_core->initial_apts_corr.need_correction==1) { + xp_core->initial_apts += ((float)(xp_core->initial_apts_corr.pts_bytes-xp_core->initial_apts_corr.nbytes))/(float)sh_audio->i_bps; + xp_core->initial_apts_corr.need_correction=0; + } + MSG_OK("[AC] %s decoder: [%s] drv:%s.%s ratio %i->%i\n",mp_conf.audio_codec?"Forcing":"Selecting" + ,ac + ,priv->mpadec->info->driver_name + ,ac + ,sh_audio->i_bps,sh_audio->o_bps); + if(sh_audio->codec) { delete sh_audio->codec; sh_audio->codec=NULL; } + return priv; +} + +void mpca_uninit(any_t *opaque) +{ + priv_t* priv = (priv_t*)opaque; + sh_audio_t* parent = priv->parent; + if(!parent) { delete priv; return; } + if(priv->parent->afilter){ + MSG_V("Uninit audio filters...\n"); + af_uninit(parent->afilter); + delete parent->afilter; + parent->afilter=NULL; + } + if(parent->a_buffer) delete parent->a_buffer; + parent->a_buffer=NULL; + if(parent->a_in_buffer) delete parent->a_in_buffer; + parent->a_in_buffer=NULL; + if(!parent->inited) { delete priv; return; } + MSG_V("uninit audio: ...\n"); + priv->mpadec->uninit(parent); + if(parent->a_buffer) delete parent->a_buffer; + parent->a_buffer=NULL; + parent->inited=0; + delete priv; +} + + /* Init audio filters */ +MPXP_Rc mpca_preinit_filters(sh_audio_t *sh_audio, + unsigned in_samplerate, unsigned in_channels, unsigned in_format, + unsigned* out_samplerate, unsigned* out_channels, unsigned* out_format){ + char strbuf[200]; + af_stream_t* afs=RND_RENAME6(af_new)(sh_audio); + + // input format: same as codec's output format: + afs->input.rate = in_samplerate; + afs->input.nch = in_channels; + afs->input.format = mpaf_format_decode(in_format); + + // output format: same as ao driver's input format (if missing, fallback to input) + afs->output.rate = *out_samplerate ? *out_samplerate : afs->input.rate; + afs->output.nch = *out_channels ? *out_channels : afs->input.nch; + if(*out_format) afs->output.format = mpaf_format_decode(*out_format); + else afs->output.format = afs->input.format; + + // filter config: + memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t)); + + MSG_V("Checking audio filter chain for %dHz/%dch/%dbit...\n", + afs->input.rate,afs->input.nch,(afs->input.format&MPAF_BPS_MASK)*8); + + // let's autoprobe it! + if(MPXP_Ok != RND_RENAME7(af_init)(afs,0)){ + delete afs; + return MPXP_False; // failed :( + } + + *out_samplerate=afs->output.rate; + *out_channels=afs->output.nch; + *out_format=mpaf_format_encode(afs->output.format); + + sh_audio->af_bps = afs->output.rate*afs->output.nch*(afs->output.format&MPAF_BPS_MASK); + + MSG_V("AF_pre: af format: %d ch, %d hz, %s af_bps=%i\n", + afs->output.nch, afs->output.rate, + mpaf_fmt2str(afs->output.format,strbuf,200), + sh_audio->af_bps); + + sh_audio->afilter=afs; + return MPXP_Ok; +} + + /* Init audio filters */ +MPXP_Rc mpca_init_filters(sh_audio_t *sh_audio, + unsigned in_samplerate, unsigned in_channels, mpaf_format_e in_format, + unsigned out_samplerate, unsigned out_channels, mpaf_format_e out_format, + unsigned out_minsize, unsigned out_maxsize){ + char strbuf[200]; + af_stream_t* afs=sh_audio->afilter; + if(!afs) afs = RND_RENAME6(af_new)(sh_audio); + + // input format: same as codec's output format: + afs->input.rate = in_samplerate; + afs->input.nch = in_channels; + afs->input.format = mpaf_format_decode(in_format); + + // output format: same as ao driver's input format (if missing, fallback to input) + afs->output.rate = out_samplerate ? out_samplerate : afs->input.rate; + afs->output.nch = out_channels ? out_channels : afs->input.nch; + afs->output.format = mpaf_format_decode(out_format ? out_format : afs->input.format); + + // filter config: + memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t)); + + MSG_V("Building audio filter chain for %dHz/%dch/%dbit (%s) -> %dHz/%dch/%dbit (%s)...\n", + afs->input.rate,afs->input.nch,(afs->input.format&MPAF_BPS_MASK)*8,ao_format_name(mpaf_format_encode(afs->input.format)), + afs->output.rate,afs->output.nch,(afs->output.format&MPAF_BPS_MASK)*8,ao_format_name(mpaf_format_encode(afs->output.format))); + + // let's autoprobe it! + if(MPXP_Ok != RND_RENAME7(af_init)(afs,1)){ + sh_audio->afilter=NULL; + delete afs; + return MPXP_False; // failed :( + } + + // allocate the a_out_* buffers: + if(out_maxsize<out_minsize) out_maxsize=out_minsize; + if(out_maxsize<8192) out_maxsize=MAX_OUTBURST; // not sure this is ok + + sh_audio->af_bps = afs->output.rate*afs->output.nch*(afs->output.format&MPAF_BPS_MASK); + + MSG_V("AF_init: af format: %d ch, %d hz, %s af_bps=%i\n", + afs->output.nch, afs->output.rate, + mpaf_fmt2str(afs->output.format,strbuf,200), + sh_audio->af_bps); + + sh_audio->a_buffer_size=out_maxsize; + sh_audio->a_buffer=new char [sh_audio->a_buffer_size]; + sh_audio->a_buffer_len=0; + + af_showconf(afs->first); + sh_audio->afilter=afs; + sh_audio->afilter_inited=1; + return MPXP_Ok; +} + + /* Init audio filters */ +MPXP_Rc mpca_reinit_filters(sh_audio_t *sh_audio, + unsigned in_samplerate, unsigned in_channels, mpaf_format_e in_format, + unsigned out_samplerate, unsigned out_channels, mpaf_format_e out_format, + unsigned out_minsize, unsigned out_maxsize) +{ + if(sh_audio->afilter){ + MSG_V("Uninit audio filters...\n"); + af_uninit(sh_audio->afilter); + delete sh_audio->afilter; + sh_audio->afilter=NULL; + } + return mpca_init_filters(sh_audio,in_samplerate,in_channels, + in_format,out_samplerate, + out_channels,out_format, + out_minsize,out_maxsize); +} + +unsigned RND_RENAME3(mpca_decode)(any_t *opaque,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts) +{ + priv_t* priv = (priv_t*)opaque; + sh_audio_t* sh_audio = priv->parent; + unsigned len; + unsigned cp_size,cp_tile; + mp_aframe_t afd; // filter input + mp_aframe_t* pafd; // filter output + + if(!sh_audio->inited) return 0; // no codec + MSG_DBG3("mpca_decode(%p,%p,%i,%i,%i,%p)\n",sh_audio,buf,minlen,maxlen,buflen,pts); + + if(minlen>maxlen) MSG_WARN(MSGTR_CODEC_XP_INT_ERR,minlen,maxlen); + if(sh_audio->af_buffer_len) { + cp_size=std::min(buflen,sh_audio->af_buffer_len); + memcpy(buf,sh_audio->af_buffer,cp_size); + *pts = sh_audio->af_pts; + cp_tile=sh_audio->af_buffer_len-cp_size; + MSG_DBG2("cache->buf %i bytes %f pts <PREDICTED PTS %f>\n",cp_size,*pts,*pts+(float)cp_tile/(float)sh_audio->af_bps); + if(cp_tile) { + sh_audio->af_buffer=&sh_audio->af_buffer[cp_size]; + sh_audio->af_buffer_len=cp_tile; + sh_audio->af_pts += (float)cp_size/(float)sh_audio->af_bps; + } + else sh_audio->af_buffer_len=0; + return cp_size; + } + if(sh_audio->af_bps>sh_audio->o_bps) + maxlen=std::min(maxlen,buflen*sh_audio->o_bps/sh_audio->af_bps); + len=priv->mpadec->decode(sh_audio,buf, minlen, maxlen,pts); + if(len>buflen) MSG_WARN(MSGTR_CODEC_BUF_OVERFLOW,sh_audio->codec->driver_name,len,buflen); + MSG_DBG2("decaudio: %i bytes %f pts min %i max %i buflen %i o_bps=%i f_bps=%i\n",len,*pts,minlen,maxlen,buflen,sh_audio->o_bps,sh_audio->af_bps); + if(len==0 || !sh_audio->afilter) return 0; // EOF? + // run the filt... [truncated message content] |
From: <nic...@us...> - 2012-11-17 10:43:00
|
Revision: 389 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=389&view=rev Author: nickols_k Date: 2012-11-17 10:42:51 +0000 (Sat, 17 Nov 2012) Log Message: ----------- method af_play had a viral nature -> fully redesign it. Remove Mu-LAW & A_Law from filters because lavc supports them in decoders Modified Paths: -------------- TODO mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/postproc/Makefile mplayerxp/postproc/af.cpp mplayerxp/postproc/af.h mplayerxp/postproc/af_ao2.c mplayerxp/postproc/af_center.c mplayerxp/postproc/af_channels.c mplayerxp/postproc/af_comp.c mplayerxp/postproc/af_crystality.c mplayerxp/postproc/af_delay.c mplayerxp/postproc/af_dummy.c mplayerxp/postproc/af_dyn.c mplayerxp/postproc/af_echo3d.c mplayerxp/postproc/af_equalizer.c mplayerxp/postproc/af_export.cpp mplayerxp/postproc/af_extrastereo.c mplayerxp/postproc/af_ffenc.c mplayerxp/postproc/af_format.c mplayerxp/postproc/af_gate.c mplayerxp/postproc/af_hrtf.c mplayerxp/postproc/af_karaoke.c mplayerxp/postproc/af_lp.c mplayerxp/postproc/af_pan.c mplayerxp/postproc/af_raw.c mplayerxp/postproc/af_resample.c mplayerxp/postproc/af_scaletempo.c mplayerxp/postproc/af_sinesuppress.c mplayerxp/postproc/af_sub.c mplayerxp/postproc/af_surround.c mplayerxp/postproc/af_tools.c mplayerxp/postproc/af_volnorm.c mplayerxp/postproc/af_volume.c mplayerxp/postproc/aflib.h mplayerxp/postproc/aflib_accel.h mplayerxp/pvector/pvector_f32_x86.h mplayerxp/pvector/pvector_int_x86.h mplayerxp/xmpcore/mp_aframe.cpp mplayerxp/xmpcore/mp_aframe.h Added Paths: ----------- mplayerxp/postproc/aflib.cpp Removed Paths: ------------- mplayerxp/postproc/af_format_alaw.c mplayerxp/postproc/af_format_ulaw.c mplayerxp/postproc/aflib.c Modified: TODO =================================================================== --- TODO 2012-11-17 05:26:00 UTC (rev 388) +++ TODO 2012-11-17 10:42:51 UTC (rev 389) @@ -11,6 +11,7 @@ license=check_pin(Module_VideoDecoder,pin); ... vd_ffmpeg: init(sh_video_t *sh,any_t* libinput,uint32_t license) { + check_license(Module_VideoDecoder,license); ... PointerProtector lavc_guard(license); priv->lavc_ctx = lavc_guard.protect(avcodec_alloc_context3(priv->codec)); Modified: mplayerxp/libmpcodecs/dec_audio.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_audio.cpp 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/libmpcodecs/dec_audio.cpp 2012-11-17 10:42:51 UTC (rev 389) @@ -301,8 +301,6 @@ sh_audio_t* sh_audio = priv->parent; unsigned len; unsigned cp_size,cp_tile; - mp_aframe_t afd; // filter input - mp_aframe_t* pafd; // filter output if(!sh_audio->inited) return 0; // no codec MSG_DBG3("mpca_decode(%p,%p,%i,%i,%i,%p)\n",sh_audio,buf,minlen,maxlen,buflen,pts); @@ -329,6 +327,8 @@ MSG_DBG2("decaudio: %i bytes %f pts min %i max %i buflen %i o_bps=%i f_bps=%i\n",len,*pts,minlen,maxlen,buflen,sh_audio->o_bps,sh_audio->af_bps); if(len==0 || !sh_audio->afilter) return 0; // EOF? // run the filters: + mp_aframe_t afd; // filter input + mp_aframe_t* pafd; // filter output memset(&afd,0,sizeof(mp_aframe_t)); afd.audio=buf; afd.len=len; Modified: mplayerxp/postproc/Makefile =================================================================== --- mplayerxp/postproc/Makefile 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/Makefile 2012-11-17 10:42:51 UTC (rev 389) @@ -6,16 +6,38 @@ DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done -CXXSRCS=af.cpp af_export.cpp vf.cpp +CXXSRCS=af.cpp aflib.cpp af_export.cpp vf.cpp SRCS=postprocess.c swscale.c -SRCS+=af_ao2.c af_crystality.c af_dummy.c af_delay.c af_channels.c -SRCS+=af_format.c af_resample.c af_volume.c af_equalizer.c af_tools.c af_comp.c -SRCS+=af_gate.c af_pan.c af_surround.c af_sub.c af_volnorm.c -SRCS+=af_extrastereo.c af_lp.c af_dyn.c af_echo3d.c af_hrtf.c af_ffenc.c -SRCS+=af_raw.c af_karaoke.c af_center.c af_sinesuppress.c af_scaletempo.c -SRCS+=af_null.c -SRCS+=aflib.c +SRCS+=af_ao2.c \ + af_center.c \ + af_channels.c \ + af_comp.c \ + af_crystality.c \ + af_delay.c \ + af_dummy.c \ + af_dyn.c \ + af_echo3d.c \ + af_equalizer.c \ + af_extrastereo.c \ + af_ffenc.c \ + af_format.c \ + af_gate.c \ + af_hrtf.c \ + af_karaoke.c \ + af_lp.c \ + af_null.c \ + af_pan.c \ + af_raw.c \ + af_resample.c \ + af_scaletempo.c \ + af_sinesuppress.c \ + af_sub.c \ + af_surround.c \ + af_tools.c \ + af_volnorm.c \ + af_volume.c + SRCS+=vf_vo.c vf_expand.c vf_flip.c vf_format.c vf_yuy2.c vf_rgb2bgr.c SRCS+=vf_rotate.c vf_mirror.c vf_palette.c vf_test.c vf_noise.c vf_yvu9.c SRCS+=vf_rectangle.c vf_eq.c vf_dint.c vf_1bpp.c vf_unsharp.c vf_swapuv.c Modified: mplayerxp/postproc/af.cpp =================================================================== --- mplayerxp/postproc/af.cpp 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af.cpp 2012-11-17 10:42:51 UTC (rev 389) @@ -248,101 +248,92 @@ failure */ static int af_reinit(af_stream_t* s, af_instance_t* af) { - if(!af) - return MPXP_Error; + if(!af) return MPXP_Error; - MSG_DBG2("af_reinit()\n"); - do{ - mp_aframe_t in; // Format of the input to current filter - int rv=0; // Return value + MSG_DBG2("af_reinit()\n"); + do { + af_conf_t in; // Format of the input to current filter + int rv=0; // Return value - // Check if this is the first filter - if(!af->prev) memcpy(&in,&(s->input),sizeof(mp_aframe_t)); - else memcpy(&in,af->prev->data,sizeof(mp_aframe_t)); + // Check if this is the first filter + if(!af->prev) memcpy(&in,&(s->input),sizeof(af_conf_t)); + else memcpy(&in,&af->prev->conf,sizeof(af_conf_t)); - // Reset just in case... - in.audio=NULL; - in.len=0; - - rv = af->config(af,&in); - switch(rv){ - case MPXP_Ok: - break; - case MPXP_False:{ // Configuration filter is needed - // Do auto insertion only if force is not specified - if((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE){ - af_instance_t* _new = NULL; - // Insert channels filter - if((af->prev?af->prev->data->nch:s->input.nch) != in.nch){ - if(NULL == (_new = af_prepend(s,af,"channels"))) return MPXP_Error; - if(MPXP_Ok != (rv = _new->control(_new,AF_CONTROL_CHANNELS,&in.nch))) return rv; - // Initialize channels filter - if(!_new->prev) memcpy(&in,&(s->input),sizeof(mp_aframe_t)); - else memcpy(&in,_new->prev->data,sizeof(mp_aframe_t)); - if(MPXP_Ok != (rv = _new->config(_new,&in))) return rv; - } - // Insert rate filter - if((af->prev?af->prev->data->rate:s->input.rate) != in.rate){ - if(NULL == (_new = af_prepend(s,af,"resample"))) return MPXP_Error; - if(MPXP_Ok != (rv = _new->control(_new,AF_CONTROL_RESAMPLE_RATE,&in.rate))) return rv; - // Initialize channels filter - if(!_new->prev) memcpy(&in,&(s->input),sizeof(mp_aframe_t)); - else memcpy(&in,_new->prev->data,sizeof(mp_aframe_t)); - if(MPXP_Ok != (rv = _new->config(_new,&in))) { - af_instance_t* af2 = af_prepend(s,af,"format"); - // Init the _new filter - if(af2) { - if((MPXP_Ok != af2->control(af2,AF_CONTROL_FORMAT,&in.format))) return -1; - if(MPXP_Ok != af_reinit(s,af2)) return MPXP_Error; - rv = _new->config(_new,&in); + rv = af->config(af,&in); + memcpy(&in,&af->conf,sizeof(af_conf_t)); + switch(rv){ + case MPXP_Ok: break; + case MPXP_False:{ // Configuration filter is needed + // Do auto insertion only if force is not specified + if((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE){ + af_instance_t* _new = NULL; + // Insert channels filter + if((af->prev?af->prev->conf.nch:s->input.nch) != in.nch){ + if(NULL == (_new = af_prepend(s,af,"channels"))) return MPXP_Error; + if(MPXP_Ok != (rv = _new->control(_new,AF_CONTROL_CHANNELS,&in.nch))) return rv; + // Initialize channels filter + if(!_new->prev) memcpy(&in,&(s->input),sizeof(af_conf_t)); + else memcpy(&in,&_new->prev->conf,sizeof(af_conf_t)); + if(MPXP_Ok != (rv = _new->config(_new,&in))) return rv; + } + // Insert rate filter + if((af->prev?af->prev->conf.rate:s->input.rate) != in.rate){ + if(NULL == (_new = af_prepend(s,af,"resample"))) return MPXP_Error; + if(MPXP_Ok != (rv = _new->control(_new,AF_CONTROL_RESAMPLE_RATE,&in.rate))) return rv; + // Initialize channels filter + if(!_new->prev) memcpy(&in,&(s->input),sizeof(af_conf_t)); + else memcpy(&in,&_new->prev->conf,sizeof(af_conf_t)); + if(MPXP_Ok != (rv = _new->config(_new,&in))) { + af_instance_t* af2 = af_prepend(s,af,"format"); + // Init the _new filter + if(af2) { + if((MPXP_Ok != af2->control(af2,AF_CONTROL_FORMAT,&in.format))) return -1; + if(MPXP_Ok != af_reinit(s,af2)) return MPXP_Error; + rv = _new->config(_new,&in); + } + return rv; + } + } + // Insert format filter + if(((af->prev?af->prev->conf.format:s->input.format) != in.format)) { + if(NULL == (_new = af_prepend(s,af,"format"))) return MPXP_Error; + if(MPXP_Ok != (rv = _new->control(_new,AF_CONTROL_FORMAT,&in.format))) return rv; + // Initialize format filter + if(!_new->prev) memcpy(&in,&(s->input),sizeof(af_conf_t)); + else memcpy(&in,&_new->prev->conf,sizeof(af_conf_t)); + if(MPXP_Ok != (rv = _new->config(_new,&in))) return rv; + } + if(!_new){ // Should _never_ happen + MSG_ERR("[libaf] Unable to correct audio format. " + "This error should never occur, please send bugreport.\n"); + return MPXP_Error; + } + af=_new; + } + break; } - return rv; - } + case MPXP_Detach:{ // Filter is redundant and wants to be unloaded + // Do auto remove only if force is not specified + if((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE){ + af_instance_t* aft=af->prev; + af_remove(s,af); + if(aft) af=aft; + else af=s->first; // Restart configuration + } + break; + } + default: + MSG_ERR("[libaf] Reinitialization did not work, audio" + " filter '%s' returned error code %i for r=%i c=%i fmt=%x\n",af->info->name,rv,in.rate,in.nch,in.format); + return MPXP_Error; } - // Insert format filter - if(((af->prev?af->prev->data->format:s->input.format) != in.format)) { - if(NULL == (_new = af_prepend(s,af,"format"))) return MPXP_Error; - if(MPXP_Ok != (rv = _new->control(_new,AF_CONTROL_FORMAT,&in.format))) return rv; - // Initialize format filter - if(!_new->prev) memcpy(&in,&(s->input),sizeof(mp_aframe_t)); - else memcpy(&in,_new->prev->data,sizeof(mp_aframe_t)); - if(MPXP_Ok != (rv = _new->config(_new,&in))) return rv; - } - if(!_new){ // Should _never_ happen - MSG_ERR("[libaf] Unable to correct audio format. " - "This error should never occur, please send bugreport.\n"); - return MPXP_Error; - } - af=_new; - } - break; - } - case MPXP_Detach:{ // Filter is redundant and wants to be unloaded - // Do auto remove only if force is not specified - if((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE){ - af_instance_t* aft=af->prev; - af_remove(s,af); - if(aft) - af=aft; - else - af=s->first; // Restart configuration - } - break; - } - default: - MSG_ERR("[libaf] Reinitialization did not work, audio" - " filter '%s' returned error code %i for r=%i c=%i fmt=%x\n",af->info->name,rv,in.rate,in.nch,in.format); - return MPXP_Error; - } - // Check if there are any filters left in the list - if(NULL == af){ - if(!(af=af_append(s,s->first,"dummy"))) - return -1; - } - else - af=af->next; - }while(af); - return MPXP_Ok; + // Check if there are any filters left in the list + if(NULL == af){ + if(!(af=af_append(s,s->first,"dummy"))) + return -1; + } else af=af->next; + }while(af); + return MPXP_Ok; } // Uninit and remove all filters @@ -368,10 +359,6 @@ // Sanity check if(!s) return MPXP_False; - // Precaution in case caller is misbehaving - s->input.audio = s->output.audio = NULL; - s->input.len = s->output.len = 0; - // Figure out how fast the machine is if(AF_INIT_AUTO == (AF_INIT_TYPE_MASK & s->cfg.force)) s->cfg.force = (s->cfg.force & ~AF_INIT_TYPE_MASK) | AF_INIT_TYPE(); @@ -402,7 +389,7 @@ // If force_output isn't set do not compensate for output format if(!force_output){ - memcpy(&s->output, s->last->data, sizeof(mp_aframe_t)); + memcpy(&s->output, &s->last->conf, sizeof(af_conf_t)); return MPXP_Ok; } @@ -410,7 +397,7 @@ if((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE){ af_instance_t* af = NULL; // New filter // Check output frequency if not OK fix with resample - if(s->last->data->rate!=s->output.rate){ + if(s->last->conf.rate!=s->output.rate){ if(NULL==(af=af_get(s,"resample"))){ if((AF_INIT_TYPE_MASK & s->cfg.force) == AF_INIT_SLOW){ if(!strcmp(s->first->info->name,"format")) @@ -441,7 +428,7 @@ // Check number of output channels fix if not OK // If needed always inserted last -> easy to screw up other filters - if(s->last->data->nch!=s->output.nch){ + if(s->last->conf.nch!=s->output.nch){ if(!strcmp(s->last->info->name,"format")) af = af_prepend(s,s->last,"channels"); else @@ -454,7 +441,7 @@ } // Check output format fix if not OK - if((s->last->data->format != s->output.format)){ + if((s->last->conf.format != s->output.format)){ if(strcmp(s->last->info->name,"format")) af = af_append(s,s->last,"format"); else @@ -470,9 +457,9 @@ if(MPXP_Ok != af_reinit(s,s->first)) return MPXP_False; - if((s->last->data->format != s->output.format) || - (s->last->data->nch != s->output.nch) || - (s->last->data->rate != s->output.rate)) { + if((s->last->conf.format != s->output.format) || + (s->last->conf.nch != s->output.nch) || + (s->last->conf.rate != s->output.rate)) { // Something is stuffed audio out will not work MSG_ERR("[libaf] Unable to setup filter system can not" " meet sound-card demands, please send bugreport. \n"); @@ -509,16 +496,20 @@ } // Filter data chunk through the filters in the list -mp_aframe_t* __FASTCALL__ RND_RENAME8(af_play)(af_stream_t* s, mp_aframe_t* data) +mp_aframe_t* __FASTCALL__ RND_RENAME8(af_play)(af_stream_t* s,const mp_aframe_t* data) { - af_instance_t* af=s->first; - // Iterate through all filters - do{ - MSG_DBG2("filtering %s\n",af->info->name); - data=af->play(af,data,af->next?0:1); - af=af->next; - }while(af && data); - return data; + mp_aframe_t* in = const_cast<mp_aframe_t*>(data); + mp_aframe_t* out; + af_instance_t* af=s->first; + // Iterate through all filters + do{ + MSG_DBG2("filtering %s\n",af->info->name); + out=af->play(af,in); + if(out!=in && in!=data) free_mp_aframe(in); + in=out; + af=af->next; + }while(af && out); + return out; } /* Helper function used to calculate the exact buffer length needed @@ -577,26 +568,6 @@ return delay; } -/* Helper function called by the macro with the same name this - function should not be called directly */ -MPXP_Rc __FASTCALL__ af_resize_local_buffer(af_instance_t* af,unsigned len) -{ - // Calculate _new length - MSG_V("[libaf] Reallocating memory in module %s, " - "old len = %i, _new len = %i\n",af->info->name,af->data->len,len); - // If there is a buffer mp_free it - if(af->data->audio) delete af->data->audio; - // Create _new buffer and check that it is OK - af->data->audio = new char [len]; - if(!af->data->audio){ - MSG_FATAL(MSGTR_OutOfMemory); - return MPXP_Error; - } - af->data->len=len; - check_pin("afilter",af->pin,AF_PIN); - return MPXP_Ok; -} - // send control to all filters, starting with the last until // one responds with MPXP_Ok MPXP_Rc __FASTCALL__ af_control_any_rev (af_stream_t* s, int cmd, any_t* arg) { @@ -611,50 +582,42 @@ MPXP_Rc __FASTCALL__ af_query_fmt (const af_stream_t* s,mpaf_format_e fmt) { - af_instance_t* filt = s?s->first:NULL; - const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_FORMAT,fmt); - else - { - unsigned ifmt=mpaf_format_decode(fmt); - if(ifmt==filt->data->format) return MPXP_True; - } - return MPXP_False; + af_instance_t* filt = s?s->first:NULL; + const char *filt_name=filt?filt->info->name:"ao2"; + if(strcmp(filt_name,"ao2")==0) return RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_FORMAT,fmt); + else if(mpaf_format_decode(fmt)==filt->conf.format) return MPXP_True; + return MPXP_False; } MPXP_Rc __FASTCALL__ af_query_rate (const af_stream_t* s,unsigned rate) { - af_instance_t* filt = s?s->first:NULL; - const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_RATE,rate); - else { - if(rate==filt->data->rate) return MPXP_True; - } - return MPXP_False; + af_instance_t* filt = s?s->first:NULL; + const char *filt_name=filt?filt->info->name:"ao2"; + if(strcmp(filt_name,"ao2")==0) return RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_RATE,rate); + else if(rate==filt->conf.rate) return MPXP_True; + return MPXP_False; } MPXP_Rc __FASTCALL__ af_query_channels (const af_stream_t* s,unsigned nch) { - af_instance_t* filt = s?s->first:NULL; - const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_CHANNELS,nch); - else { - if(nch==filt->data->nch) return MPXP_True; - } - return MPXP_False; + af_instance_t* filt = s?s->first:NULL; + const char *filt_name=filt?filt->info->name:"ao2"; + if(strcmp(filt_name,"ao2")==0) return RND_RENAME7(ao_control)(ao_data,AOCONTROL_QUERY_CHANNELS,nch); + else if(nch==filt->conf.nch) return MPXP_True; + return MPXP_False; } void af_help (void) { - int i = 0; - MSG_INFO( "Available audio filters:\n"); - while (filter_list[i]) { - if (filter_list[i]->comment && filter_list[i]->comment[0]) - MSG_INFO( "\t%-10s: %s (%s)\n", filter_list[i]->name, filter_list[i]->info, filter_list[i]->comment); - else - MSG_INFO( "\t%-10s: %s\n", filter_list[i]->name, filter_list[i]->info); - i++; - } - MSG_INFO("\n"); + unsigned i = 0; + MSG_INFO( "Available audio filters:\n"); + while (filter_list[i]) { + if (filter_list[i]->comment && filter_list[i]->comment[0]) + MSG_INFO( "\t%-10s: %s (%s)\n", filter_list[i]->name, filter_list[i]->info, filter_list[i]->comment); + else + MSG_INFO( "\t%-10s: %s\n", filter_list[i]->name, filter_list[i]->info); + i++; + } + MSG_INFO("\n"); } af_stream_t *RND_RENAME6(af_new)(any_t*_parent) Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af.h 2012-11-17 10:42:51 UTC (rev 389) @@ -42,17 +42,24 @@ AF_PIN=RND_NUMBER6+RND_CHAR6 }; +typedef struct af_conf_s { + /*------ stream description ----------*/ + unsigned rate; /* rate of audio */ + unsigned nch; /* number of channels */ + mpaf_format_e format;/* PCM format of audio */ +}af_conf_t; + // Linked list of audio filters typedef struct af_instance_s { const af_info_t* info; char antiviral_hole[RND_CHAR6]; unsigned pin; // personal identification number - MPXP_Rc (* __FASTCALL__ config)(struct af_instance_s* af, const mp_aframe_t* arg); + MPXP_Rc (* __FASTCALL__ config)(struct af_instance_s* af, const af_conf_t* arg); MPXP_Rc (* __FASTCALL__ control)(struct af_instance_s* af, int cmd, any_t* arg); void (* __FASTCALL__ uninit)(struct af_instance_s* af); - mp_aframe_t* (* __FASTCALL__ play)(struct af_instance_s* af, mp_aframe_t* data,int final); + mp_aframe_t* (* __FASTCALL__ play)(struct af_instance_s* af,const mp_aframe_t* data); any_t* setup; // setup data for this specific instance and filter - mp_aframe_t* data; // configuration for outgoing data stream + af_conf_t conf; // configuration for outgoing data stream struct af_instance_s* next; struct af_instance_s* prev; any_t* parent; @@ -93,16 +100,16 @@ // Current audio stream typedef struct af_stream_s { - char antiviral_hole[RND_CHAR7]; - // The first and last filter in the list - af_instance_t* first; - af_instance_t* last; - // Storage for input and output data formats - mp_aframe_t input; - mp_aframe_t output; - // Configuration for this stream - af_cfg_t cfg; - any_t*parent; + char antiviral_hole[RND_CHAR7]; + // The first and last filter in the list + af_instance_t* first; + af_instance_t* last; + // Storage for input and output data formats + af_conf_t input; + af_conf_t output; + // Configuration for this stream + af_cfg_t cfg; + any_t* parent; }af_stream_t; @@ -128,7 +135,7 @@ void af_uninit(af_stream_t* s); // Filter data chunk through the filters in the list -mp_aframe_t* __FASTCALL__ RND_RENAME8(af_play)(af_stream_t* s, mp_aframe_t* data); +mp_aframe_t* __FASTCALL__ RND_RENAME8(af_play)(af_stream_t* s,const mp_aframe_t* data); // send control to all filters, starting with the last until // one accepts the command with MPXP_Ok. @@ -151,10 +158,6 @@ // Helper functions and macros used inside the audio filters -/* Helper function called by the macro with the same name only to be - called from inside filters */ -MPXP_Rc __FASTCALL__ af_resize_local_buffer(af_instance_t* af,unsigned len); - /* Helper function used to calculate the exact buffer length needed when buffers are resized. The returned length is >= than what is needed */ @@ -171,7 +174,7 @@ /* Helper function used to convert from sample time to ms */ int __FASTCALL__ af_to_ms(int n, int* in, float* out, int rate); /* Helper function for testing the output format */ -MPXP_Rc __FASTCALL__ af_test_output(struct af_instance_s* af,const mp_aframe_t* out); +MPXP_Rc __FASTCALL__ af_test_output(struct af_instance_s* af,const af_conf_t* out); /** Print a list of all available audio filters */ void af_help(void); @@ -186,13 +189,6 @@ /* print out configuration of filter's chain */ extern void af_showconf(af_instance_t *first); -/* Memory reallocation macro: if a local buffer is used (i.e. if the - filter doesn't operate on the incoming buffer this macro must be - called to ensure the buffer is big enough. */ -static inline int RESIZE_LOCAL_BUFFER(af_instance_t* a, mp_aframe_t* d) { - unsigned len=af_lencalc(a->mul,d); - return ((unsigned)a->data->len < len)?af_resize_local_buffer(a,len):MPXP_Ok; -} #ifdef __cplusplus } #endif Modified: mplayerxp/postproc/af_ao2.c =================================================================== --- mplayerxp/postproc/af_ao2.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_ao2.c 2012-11-17 10:42:51 UTC (rev 389) @@ -110,14 +110,14 @@ }af_ao2_t; // Initialization and runtime control -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af, const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af, const af_conf_t* arg) { af_ao2_t* s = af->setup; /* Sanity check */ if(!arg) return MPXP_Error; - s->rate = af->data->rate = find_best_rate(arg->rate); - s->nch = af->data->nch = find_best_ch(arg->nch); - s->format = af->data->format = mpaf_format_decode(find_best_fmt(mpaf_format_encode(arg->format))); + s->rate = af->conf.rate = find_best_rate(arg->rate); + s->nch = af->conf.nch = find_best_ch(arg->nch); + s->format = af->conf.format = mpaf_format_decode(find_best_fmt(mpaf_format_encode(arg->format))); return af_test_output(af,arg); } @@ -141,12 +141,11 @@ // Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { - if(af->data) mp_free(af->data); if(af->setup) mp_free(af->setup); } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* data) { // Do something necessary to get rid of annoying warning during compile if(!af) MSG_ERR("EEEK: Argument af == NULL in af_dummy.c play()."); @@ -161,9 +160,8 @@ af->play=play; af->mul.d=1; af->mul.n=1; - af->data=mp_malloc(sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_ao2_t)); - if((af->data == NULL) || (af->setup == NULL)) return MPXP_Error; + if(af->setup == NULL) return MPXP_Error; check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_center.c =================================================================== --- mplayerxp/postproc/af_center.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_center.c 2012-11-17 10:42:51 UTC (rev 389) @@ -25,15 +25,15 @@ }af_center_t; // Initialization and runtime control -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const af_conf_t* arg) { af_center_t* s = af->setup; // Sanity check if(!arg) return MPXP_Error; - af->data->rate = arg->rate; - af->data->nch = max(s->ch+1,arg->nch); - af->data->format = MPAF_NE|MPAF_F|4; + af->conf.rate = arg->rate; + af->conf.nch = max(s->ch+1,arg->nch); + af->conf.format = MPAF_NE|MPAF_F|4; return af_test_output(af,arg); } @@ -66,30 +66,29 @@ // Deallocate memory static void uninit(struct af_instance_s* af) { - if(af->data) - mp_free(af->data); - if(af->setup) - mp_free(af->setup); + if(af->setup) mp_free(af->setup); } // Filter data through filter -static mp_aframe_t* play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* play(struct af_instance_s* af,const mp_aframe_t* ind) { - mp_aframe_t* c = data; // Current working data - af_center_t* s = af->setup; // Setup for this instance - float* a = c->audio; // Audio data - int len = c->len/4; // Number of samples in current audio block - int nch = c->nch; // Number of channels - int ch = s->ch; // Channel in which to insert the center audio - register int i; + mp_aframe_t*c = ind; // Current working data + af_center_t*s = af->setup;// Setup for this instance + float* a = c->audio; // Audio data + unsigned len = c->len/4; // Number of samples in current audio block + unsigned nch = c->nch; // Number of channels + unsigned ch = s->ch; // Channel in which to insert the center audio + unsigned i; + mp_aframe_t*outd= new_mp_aframe_genome(ind); + mp_alloc_aframe(outd); - // Run filter - for(i=0;i<len;i+=nch){ - // Average left and right - a[i+ch] = (a[i]/2) + (a[i+1]/2); - } + // Run filter + for(i=0;i<len;i+=nch){ + // Average left and right + ((float*)outd->audio)[i+ch] = (a[i]/2) + (a[i+1]/2); + } - return c; + return outd; } // Allocate memory and set function pointers @@ -101,10 +100,8 @@ af->play=play; af->mul.n=1; af->mul.d=1; - af->data=mp_calloc(1,sizeof(mp_aframe_t)); af->setup=s=mp_calloc(1,sizeof(af_center_t)); - if(af->data == NULL || af->setup == NULL) - return MPXP_Error; + if(af->setup == NULL) return MPXP_Error; // Set default values s->ch = 1; // Channel nr 2 check_pin("afilter",af->pin,AF_PIN); Modified: mplayerxp/postproc/af_channels.c =================================================================== --- mplayerxp/postproc/af_channels.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_channels.c 2012-11-17 10:42:51 UTC (rev 389) @@ -23,11 +23,11 @@ }af_channels_t; // Local function for copying data -static void __FASTCALL__ copy(any_t* in, any_t* out, int ins, int inos,int outs, int outos, int len, int bps) +static void __FASTCALL__ af_copy(const any_t* in, any_t* out, int ins, int inos,int outs, int outos, int len, int bps) { switch(bps){ case 1:{ - int8_t* tin = (int8_t*)in; + const int8_t* tin = (const int8_t*)in; int8_t* tout = (int8_t*)out; tin += inos; tout += outos; @@ -40,7 +40,7 @@ break; } case 2:{ - int16_t* tin = (int16_t*)in; + const int16_t* tin = (const int16_t*)in; int16_t* tout = (int16_t*)out; tin += inos; tout += outos; @@ -53,7 +53,7 @@ break; } case 3:{ - int8_t* tin = (int8_t*)in; + const int8_t* tin = (const int8_t*)in; int8_t* tout = (int8_t*)out; tin += 3 * inos; tout += 3 * outos; @@ -68,7 +68,7 @@ break; } case 4:{ - int32_t* tin = (int32_t*)in; + const int32_t* tin = (const int32_t*)in; int32_t* tout = (int32_t*)out; tin += inos; tout += outos; @@ -81,7 +81,7 @@ break; } case 8:{ - int64_t* tin = (int64_t*)in; + const int64_t* tin = (const int64_t*)in; int64_t* tout = (int64_t*)out; tin += inos; tout += outos; @@ -118,38 +118,38 @@ return MPXP_Ok; } -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const af_conf_t* arg) { af_channels_t* s = af->setup; // Set default channel assignment if(!s->router){ int i; // Make sure this filter isn't redundant - if(af->data->nch == ((mp_aframe_t*)arg)->nch) + if(af->conf.nch == arg->nch) return MPXP_Detach; // If mono: fake stereo - if(((mp_aframe_t*)arg)->nch == 1){ - s->nr = min(af->data->nch,2); + if(arg->nch == 1){ + s->nr = min(af->conf.nch,2); for(i=0;i<s->nr;i++){ s->route[i][FR] = 0; s->route[i][TO] = i; } } else{ - s->nr = min(af->data->nch, ((mp_aframe_t*)arg)->nch); + s->nr = min(af->conf.nch, arg->nch); for(i=0;i<s->nr;i++){ s->route[i][FR] = i; s->route[i][TO] = i; } } } - s->ich=((mp_aframe_t*)arg)->nch; - af->data->rate = ((mp_aframe_t*)arg)->rate; - af->data->format = ((mp_aframe_t*)arg)->format; - af->mul.n = af->data->nch; - af->mul.d = ((mp_aframe_t*)arg)->nch; - return check_routes(s,((mp_aframe_t*)arg)->nch,af->data->nch); + s->ich=arg->nch; + af->conf.rate = arg->rate; + af->conf.format = arg->format; + af->mul.n = af->conf.nch; + af->mul.d = arg->nch; + return check_routes(s,arg->nch,af->conf.nch); } // Initialization and runtime control static MPXP_Rc __FASTCALL__ control(struct af_instance_s* af, int cmd, any_t* arg) @@ -157,7 +157,7 @@ af_channels_t* s = af->setup; switch(cmd){ case AF_CONTROL_SHOWCONF: - MSG_INFO("[af_channels] Changing channels %d -> %d\n",s->ich,af->data->nch); + MSG_INFO("[af_channels] Changing channels %d -> %d\n",s->ich,af->conf.nch); return MPXP_Ok; case AF_CONTROL_COMMAND_LINE:{ int nch = 0; @@ -199,13 +199,13 @@ return MPXP_Error; } - af->data->nch=((int*)arg)[0]; + af->conf.nch=((int*)arg)[0]; if(!s->router) MSG_V("[channels] Changing number of channels" - " to %i\n",af->data->nch); + " to %i\n",af->conf.nch); return MPXP_Ok; case AF_CONTROL_CHANNELS | AF_CONTROL_GET: - *(int*)arg = af->data->nch; + *(int*)arg = af->conf.nch; return MPXP_Ok; case AF_CONTROL_CHANNELS_ROUTING | AF_CONTROL_SET:{ int ch = ((af_control_ext_t*)arg)->ch; @@ -240,37 +240,33 @@ // Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { - if(af->setup) - mp_free(af->setup); - if(af->data) - mp_free(af->data); + if(af->setup) mp_free(af->setup); } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) { - mp_aframe_t* c = data; // Current working data - af_channels_t* s = af->setup; - int i; + af_channels_t*s = af->setup; + int i; - if(MPXP_Ok != RESIZE_LOCAL_BUFFER(af,data)) - return NULL; - mp_aframe_t* l = af->data; // Local data + mp_aframe_t*out; + out=new_mp_aframe_genome(in); + out->len=af_lencalc(af->mul,in); + mp_alloc_aframe(out); - // Reset unused channels - memset(l->audio,0,(c->len*af->mul.n)/af->mul.d); + // Reset unused channels + memset(out->audio,0,(in->len*af->mul.n)/af->mul.d); - if(MPXP_Ok == check_routes(s,c->nch,l->nch)) - for(i=0;i<s->nr;i++) - copy(c->audio,l->audio,c->nch,s->route[i][FR], - l->nch,s->route[i][TO],c->len,c->format&MPAF_BPS_MASK); + if(MPXP_Ok == check_routes(s,in->nch,out->nch)) + for(i=0;i<s->nr;i++) + af_copy(in->audio,out->audio,in->nch,s->route[i][FR], + out->nch,s->route[i][TO],in->len,in->format&MPAF_BPS_MASK); - // Set output data - c->audio = l->audio; - c->len = (c->len*af->mul.n)/af->mul.d; - c->nch = l->nch; + // Set output data + out->len = (in->len*af->mul.n)/af->mul.d; + out->nch = in->nch; - return c; + return out; } // Allocate memory and set function pointers @@ -281,10 +277,8 @@ af->play=play; af->mul.n=1; af->mul.d=1; - af->data=mp_calloc(1,sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_channels_t)); - if((af->data == NULL) || (af->setup == NULL)) - return MPXP_Error; + if(af->setup == NULL) return MPXP_Error; check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_comp.c =================================================================== --- mplayerxp/postproc/af_comp.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_comp.c 2012-11-17 10:42:51 UTC (rev 389) @@ -33,15 +33,14 @@ float ratio[AF_NCH]; // Compression ratio }af_comp_t; -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const af_conf_t* arg) { - af_comp_t* s = (af_comp_t*)af->setup; // Sanity check if(!arg) return MPXP_Error; - af->data->rate = arg->rate; - af->data->nch = arg->nch; - af->data->format = MPAF_F|MPAF_NE|4; + af->conf.rate = arg->rate; + af->conf.nch = arg->nch; + af->conf.format = MPAF_F|MPAF_NE|4; // Time constant set to 0.1s // s->alpha = (1.0/0.2)/(2.0*M_PI*(float)((mp_aframe_t*)arg)->rate); @@ -80,13 +79,13 @@ case AF_CONTROL_COMP_THRESH | AF_CONTROL_GET: return af_to_dB(AF_NCH,s->tresh,(float*)arg,10.0); case AF_CONTROL_COMP_ATTACK | AF_CONTROL_SET: - return af_from_ms(AF_NCH,(float*)arg,s->attack,af->data->rate,500.0,0.1); + return af_from_ms(AF_NCH,(float*)arg,s->attack,af->conf.rate,500.0,0.1); case AF_CONTROL_COMP_ATTACK | AF_CONTROL_GET: - return af_to_ms(AF_NCH,s->attack,(float*)arg,af->data->rate); + return af_to_ms(AF_NCH,s->attack,(float*)arg,af->conf.rate); case AF_CONTROL_COMP_RELEASE | AF_CONTROL_SET: - return af_from_ms(AF_NCH,(float*)arg,s->release,af->data->rate,3000.0,10.0); + return af_from_ms(AF_NCH,(float*)arg,s->release,af->conf.rate,3000.0,10.0); case AF_CONTROL_COMP_RELEASE | AF_CONTROL_GET: - return af_to_ms(AF_NCH,s->release,(float*)arg,af->data->rate); + return af_to_ms(AF_NCH,s->release,(float*)arg,af->conf.rate); case AF_CONTROL_COMP_RATIO | AF_CONTROL_SET: for(i=0;i<AF_NCH;i++) s->ratio[i] = clamp(((float*)arg)[i],1.0,10.0); @@ -103,43 +102,42 @@ // Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { - if(af->data) - mp_free(af->data); - if(af->setup) - mp_free(af->setup); + if(af->setup) mp_free(af->setup); } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) { - mp_aframe_t* c = data; // Current working data - af_comp_t* s = (af_comp_t*)af->setup; // Setup for this instance - float* a = (float*)c->audio; // Audio data - int len = c->len/4; // Number of samples - int ch = 0; // Channel counter - register int nch = c->nch; // Number of channels - register int i = 0; + const mp_aframe_t*c = in; // Current working data + af_comp_t* s = (af_comp_t*)af->setup; // Setup for this instance + unsigned len = c->len/4; // Number of samples + unsigned ch = 0; // Channel counter + unsigned nch = c->nch; // Number of channels + unsigned i = 0; - // Compress/expand - for(ch = 0; ch < nch ; ch++){ - if(s->enable[ch]){ - float t = 1.0 - s->time[ch]; - for(i=ch;i<len;i+=nch){ - register float x = a[i]; - register float pow = x*x; - s->pow[ch] = t*s->pow[ch] + - pow*s->time[ch]; // LP filter - if(pow < s->pow[ch]){ - ; + mp_aframe_t* out = new_mp_aframe_genome(in); + mp_alloc_aframe(out); + + float* _in = (float*)c->audio; // Audio data + float* _out = (float*)out->audio; // Audio data + // Compress/expand + for(ch = 0; ch < nch ; ch++){ + if(s->enable[ch]){ + float t = 1.0 - s->time[ch]; + for(i=ch;i<len;i+=nch){ + register float x = _in[i]; + register float _pow = x*x; + s->pow[ch] = t*s->pow[ch] + _pow*s->time[ch]; // LP filter + if(_pow < s->pow[ch]){ + ; + } else{ + ; + } + _out[i] = x; + } } - else{ - ; - } - a[i] = x; - } } - } - return c; + return out; } // Allocate memory and set function pointers @@ -150,10 +148,8 @@ af->play=play; af->mul.n=1; af->mul.d=1; - af->data=mp_calloc(1,sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_comp_t)); - if(af->data == NULL || af->setup == NULL) - return MPXP_Error; + if(af->setup == NULL) return MPXP_Error; check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_crystality.c =================================================================== --- mplayerxp/postproc/af_crystality.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_crystality.c 2012-11-17 10:42:51 UTC (rev 389) @@ -196,14 +196,16 @@ static float buf[BUF_SIZE]; static unsigned _bufPos = BUF_SIZE - 1; static unsigned bufPos[3]; -static void __FASTCALL__ echo3d(af_crystality_t *setup,float *data, unsigned datasize) +static mp_aframe_t* __FASTCALL__ echo3d(af_crystality_t *setup,const mp_aframe_t* in) { - unsigned x,i; + unsigned x,i,datasize; float _left, _right, dif, difh, leftc, rightc, left[4], right[4]; float *dataptr; float lt, rt; + mp_aframe_t* out = new_mp_aframe_genome(in); + mp_alloc_aframe(out); + memcpy(out->audio,in->audio,out->len); - #if 0 float lsine,rsine; static float lharmb = 0, rharmb = 0, lhfb = 0, rhfb = 0; @@ -213,7 +215,8 @@ bufPos[0] = 1 + BUF_SIZE - DELAY1; bufPos[1] = 1 + BUF_SIZE - DELAY1 - DELAY2; bufPos[2] = 1 + BUF_SIZE - DELAY1 - DELAY2 - DELAY3; - dataptr = data; + dataptr = out->audio; + datasize= out->len; for (x = 0; x < datasize; x += 8) { @@ -293,6 +296,7 @@ dataptr[1] = _right;//clamp(_right,-1.0,1.0); dataptr += 2; } + return out; } /* @@ -393,19 +397,24 @@ /* * exact bandwidth extender ("exciter") routine */ -static void __FASTCALL__ bandext(af_crystality_t *setup,float *data, const unsigned datasize) +static mp_aframe_t* __FASTCALL__ bandext(af_crystality_t *setup,const mp_aframe_t*in) { - - unsigned x,i; + unsigned x,i,datasize; float _left, _right; - float *dataptr = data; + float *dataptr=NULL; static float lprev[4], rprev[4]; float left[5], right[5]; static float lamplUp, lamplDown; static float ramplUp, ramplDown; float lampl, rampl; float tmp; + mp_aframe_t* out=new_mp_aframe_genome(in); + mp_alloc_aframe(out); + memcpy(out->audio,in->audio,out->len); + dataptr = out->audio; + datasize= out->len; + for (x = 0; x < datasize; x += 8) { // ************ load sample ********** @@ -462,9 +471,10 @@ dataptr[1] = _right;//clamp(_right,-1.0,+1.0); dataptr += 2; } + return out; } -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const af_conf_t* arg) { af_crystality_t* s = af->setup; unsigned i_bps,fmt; @@ -472,10 +482,10 @@ if(!arg) return MPXP_Error; if(arg->nch!=2) return MPXP_Error; - af->data->rate = arg->rate; - af->data->nch = arg->nch; - af->data->format = MPAF_NE|MPAF_F|4; - init_crystality(s,af->data->rate); + af->conf.rate = arg->rate; + af->conf.nch = arg->nch; + af->conf.format = MPAF_NE|MPAF_F|4; + init_crystality(s,af->conf.rate); i_bps=((sh_audio_t *)((af_stream_t *)af->parent)->parent)->i_bps*8; fmt=((sh_audio_t *)((af_stream_t *)af->parent)->parent)->wtag; if(fmt==0x55 || fmt==0x50) {/* MP3 */ @@ -511,19 +521,17 @@ // Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { - if(af->data) - mp_free(af->data); - if(af->setup) - mp_free(af->setup); + if(af->setup) mp_free(af->setup); } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) { - mp_aframe_t* c = data; /* Current working data */ - echo3d(af->setup,(float*)c->audio, c->len); - bandext(af->setup,(float*)c->audio, c->len); - return c; + mp_aframe_t* out,*tmp; + tmp=echo3d(af->setup,in); + out=bandext(af->setup,tmp); + free_mp_aframe(tmp); + return out; } // Allocate memory and set function pointers @@ -534,10 +542,8 @@ af->play=play; af->mul.n=1; af->mul.d=1; - af->data=mp_calloc(1,sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_crystality_t)); - if(af->data == NULL || af->setup == NULL) - return MPXP_Error; + if(af->setup == NULL) return MPXP_Error; set_defaults(af->setup); init_crystality(af->setup,44100); left0p = right0p = 0; Modified: mplayerxp/postproc/af_delay.c =================================================================== --- mplayerxp/postproc/af_delay.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_delay.c 2012-11-17 10:42:51 UTC (rev 389) @@ -47,7 +47,7 @@ } case AF_CONTROL_DELAY_LEN | AF_CONTROL_SET:{ int i; - if(MPXP_Ok != af_from_ms(AF_NCH, arg, s->wi, af->data->rate, 0.0, 1000.0)) + if(MPXP_Ok != af_from_ms(AF_NCH, arg, s->wi, af->conf.rate, 0.0, 1000.0)) return MPXP_Error; s->ri = 0; for(i=0;i<AF_NCH;i++){ @@ -66,35 +66,30 @@ else s->wi[i] = s->wi[i] - s->ri; } - return af_to_ms(AF_NCH, s->wi, arg, af->data->rate); + return af_to_ms(AF_NCH, s->wi, arg, af->conf.rate); } default: break; } return MPXP_Unknown; } -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const af_conf_t* arg) { af_delay_t* s = af->setup; unsigned i; // Free prevous delay queues - for(i=0;i<af->data->nch;i++){ - if(s->q[i]) - mp_free(s->q[i]); - } + for(i=0;i<af->conf.nch;i++) if(s->q[i]) mp_free(s->q[i]); - af->data->rate = arg->rate; - af->data->nch = arg->nch; - af->data->format = arg->format; + af->conf.rate = arg->rate; + af->conf.nch = arg->nch; + af->conf.format = arg->format; // Allocate new delay queues - for(i=0;i<af->data->nch;i++){ - s->q[i] = mp_calloc(L,af->data->format&MPAF_BPS_MASK); - if(NULL == s->q[i]) - MSG_FATAL(MSGTR_OutOfMemory); + for(i=0;i<af->conf.nch;i++){ + s->q[i] = mp_calloc(L,af->conf.format&MPAF_BPS_MASK); + if(NULL == s->q[i]) MSG_FATAL(MSGTR_OutOfMemory); } - return control(af,AF_CONTROL_DELAY_LEN | AF_CONTROL_SET,s->d); } @@ -102,8 +97,6 @@ static void __FASTCALL__ uninit(struct af_instance_s* af) { int i; - if(af->data) - mp_free(af->data); for(i=0;i<AF_NCH;i++) if(((af_delay_t*)(af->setup))->q[i]) mp_free(((af_delay_t*)(af->setup))->q[i]); @@ -112,78 +105,80 @@ } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) { - mp_aframe_t* c = data; // Current working data - af_delay_t* s = af->setup; // Setup for this instance - int nch = c->nch; // Number of channels - int len = c->len/(c->format&MPAF_BPS_MASK); // Number of sample in data chunk - int ri = 0; - int ch,i; - for(ch=0;ch<nch;ch++){ - switch(c->format&MPAF_BPS_MASK){ - case 1:{ - int8_t* a = c->audio; - int8_t* q = s->q[ch]; - int wi = s->wi[ch]; - ri = s->ri; - for(i=ch;i<len;i+=nch){ - q[wi] = a[i]; - a[i] = q[ri]; - UPDATEQI(wi); - UPDATEQI(ri); - } - s->wi[ch] = wi; - break; + mp_aframe_t* c=new_mp_aframe_genome(in); + mp_alloc_aframe(c); + memcpy(c->audio,in->audio,c->len); + + af_delay_t* s = af->setup; // Setup for this instance + int nch = c->nch; // Number of channels + int len = c->len/(c->format&MPAF_BPS_MASK); // Number of sample in data chunk + int ri = 0; + int ch,i; + + for(ch=0;ch<nch;ch++){ + switch(c->format&MPAF_BPS_MASK){ + case 1:{ + int8_t* a = c->audio; + int8_t* q = s->q[ch]; + int wi = s->wi[ch]; + ri = s->ri; + for(i=ch;i<len;i+=nch){ + q[wi] = a[i]; + a[i] = q[ri]; + UPDATEQI(wi); + UPDATEQI(ri); + } + s->wi[ch] = wi; + break; + } + case 2:{ + int16_t* a = c->audio; + int16_t* q = s->q[ch]; + int wi = s->wi[ch]; + ri = s->ri; + for(i=ch;i<len;i+=nch){ + q[wi] = a[i]; + a[i] = q[ri]; + UPDATEQI(wi); + UPDATEQI(ri); + } + s->wi[ch] = wi; + break; + } + case 4:{ + int32_t* a = c->audio; + int32_t* q = s->q[ch]; + int wi = s->wi[ch]; + ri = s->ri; + for(i=ch;i<len;i+=nch){ + q[wi] = a[i]; + a[i] = q[ri]; + UPDATEQI(wi); + UPDATEQI(ri); + } + s->wi[ch] = wi; + break; + } } - case 2:{ - int16_t* a = c->audio; - int16_t* q = s->q[ch]; - int wi = s->wi[ch]; - ri = s->ri; - for(i=ch;i<len;i+=nch){ - q[wi] = a[i]; - a[i] = q[ri]; - UPDATEQI(wi); - UPDATEQI(ri); - } - s->wi[ch] = wi; - break; } - case 4:{ - int32_t* a = c->audio; - int32_t* q = s->q[ch]; - int wi = s->wi[ch]; - ri = s->ri; - for(i=ch;i<len;i+=nch){ - q[wi] = a[i]; - a[i] = q[ri]; - UPDATEQI(wi); - UPDATEQI(ri); - } - s->wi[ch] = wi; - break; - } - } - } - s->ri = ri; - return c; + s->ri = ri; + return c; } // Allocate memory and set function pointers static MPXP_Rc __FASTCALL__ af_open(af_instance_t* af){ - af->config=config; - af->control=control; - af->uninit=uninit; - af->play=play; - af->mul.n=1; - af->mul.d=1; - af->data=mp_calloc(1,sizeof(mp_aframe_t)); - af->setup=mp_calloc(1,sizeof(af_delay_t)); - if(af->data == NULL || af->setup == NULL) - return MPXP_Error; + af->config=config; + af->control=control; + af->uninit=uninit; + af->play=play; + af->mul.n=1; + af->mul.d=1; + af->setup=mp_calloc(1,sizeof(af_delay_t)); + if(af->setup == NULL) return MPXP_Error; check_pin("afilter",af->pin,AF_PIN); - return MPXP_Ok; + return MPXP_Ok; } // Description of this filter Modified: mplayerxp/postproc/af_dummy.c =================================================================== --- mplayerxp/postproc/af_dummy.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_dummy.c 2012-11-17 10:42:51 UTC (rev 389) @@ -9,10 +9,11 @@ #include "osdep/mplib.h" #include "pp_msg.h" -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const af_conf_t* arg) { - memcpy(af->data,arg,sizeof(mp_aframe_t)); - MSG_V("[dummy] Was reinitialized, rate=%iHz, nch = %i, format = 0x%08X\n",af->data->rate,af->data->nch,af->data->format); + memcpy(&af->conf,arg,sizeof(af_conf_t)); + MSG_V("[dummy] Was reinitialized, rate=%iHz, nch = %i, format = 0x%08X\n" + ,af->conf.rate,af->conf.nch,af->conf.format); return MPXP_Ok; } // Initialization and runtime control @@ -24,17 +25,15 @@ // Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { - if(af->data) - mp_free(af->data); } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* data) { - // Do something necessary to get rid of annoying warning during compile - if(!af) - MSG_ERR("EEEK: Argument af == NULL in af_dummy.c play()."); - return data; + // Do something necessary to get rid of annoying warning during compile + if(!af) + MSG_ERR("EEEK: Argument af == NULL in af_dummy.c play()."); + return data; } // Allocate memory and set function pointers @@ -45,10 +44,7 @@ af->play=play; af->mul.d=1; af->mul.n=1; - af->data=mp_malloc(sizeof(mp_aframe_t)); - if(af->data == NULL) - return MPXP_Error; - check_pin("afilter",af->pin,AF_PIN); + check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; } Modified: mplayerxp/postproc/af_dyn.c =================================================================== --- mplayerxp/postproc/af_dyn.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_dyn.c 2012-11-17 10:42:51 UTC (rev 389) @@ -26,15 +26,14 @@ float gain; }af_dyn_t; -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const af_conf_t* arg) { - af_dyn_t* s = (af_dyn_t*)af->setup; // Sanity check if(!arg) return MPXP_Error; - af->data->rate = arg->rate; - af->data->nch = arg->nch; - af->data->format = MPAF_F|MPAF_NE|4; + af->conf.rate = arg->rate; + af->conf.nch = arg->nch; + af->conf.format = MPAF_F|MPAF_NE|4; return af_test_output(af,arg); } @@ -59,35 +58,36 @@ // Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { - if(af->data) - mp_free(af->data); - if(af->setup) - mp_free(af->setup); + if(af->setup) mp_free(af->setup); } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* ind) { - register unsigned i = 0; - float *in = (float*)data->audio; // Audio data - af_dyn_t *s=af->setup; - unsigned nsamples = data->len/4; // Number of samples - float d,l; - int sign; - for(i = 0; i < nsamples; i++) { + unsigned i = 0; + float* in = (float*)ind->audio;// Audio data + af_dyn_t* s=af->setup; + unsigned nsamples = ind->len/4; // Number of samples + float d,l; + int sign; + mp_aframe_t*outd= new_mp_aframe_genome(ind); + mp_alloc_aframe(outd); + float* out = (float*)outd->audio;// Audio data + + for(i = 0; i < nsamples; i++) { d = *in; if (d == 0.0) l = 0; else { - if (d < 0.0) { - d *= -1.0; - sign = -1; - } else sign = 1; - l = pow(s->gain, log10(d))*sign; + if (d < 0.0) { + d *= -1.0; + sign = -1; + } else sign = 1; + l = pow(s->gain, log10(d))*sign; } - *in++ = l; - } + *out++ = l; + } - return data; + return outd; } // Allocate memory and set function pointers @@ -98,9 +98,8 @@ af->play=play; af->mul.n=1; af->mul.d=1; - af->data=mp_calloc(1,sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_dyn_t)); - if(af->data == NULL || af->setup==NULL) return MPXP_Error; + if(af->setup==NULL) return MPXP_Error; ((af_dyn_t *)(af->setup))->gain=8.; check_pin("afilter",af->pin,AF_PIN); return MPXP_Ok; Modified: mplayerxp/postproc/af_echo3d.c =================================================================== --- mplayerxp/postproc/af_echo3d.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_echo3d.c 2012-11-17 10:42:51 UTC (rev 389) @@ -88,80 +88,77 @@ * quite nice echo */ -static void __FASTCALL__ echo3d(af_crystality_t *s,float *data, unsigned datasize) +static mp_aframe_t* __FASTCALL__ echo3d(af_crystality_t *s,const mp_aframe_t* in) { - unsigned x,i; - float _left, _right, dif, leftc, rightc, left[4], right[4]; - float *dataptr; - float lt, rt; - unsigned weight[2][3] = { { 9, 8, 8 }, { 11, 9, 10 }}; + unsigned x,i; + float _left, _right, dif, leftc, rightc, left[4], right[4]; + float *inptr,*outptr; + float lt, rt; + unsigned weight[2][3] = { { 9, 8, 8 }, { 11, 9, 10 }}; + mp_aframe_t* out = new_mp_aframe_genome(in); + mp_alloc_aframe(out); - s->_bufPos = s->buf_size - 1; - s->bufPos[0] = 1 + s->buf_size - DELAY1; - s->bufPos[1] = 1 + s->buf_size - DELAY1 - DELAY2; - s->bufPos[2] = 1 + s->buf_size - DELAY1 - DELAY2 - DELAY3; - dataptr = data; + s->_bufPos = s->buf_size - 1; + s->bufPos[0] = 1 + s->buf_size - DELAY1; + s->bufPos[1] = 1 + s->buf_size - DELAY1 - DELAY2; + s->bufPos[2] = 1 + s->buf_size - DELAY1 - DELAY2 - DELAY3; + inptr = in->audio; + outptr = in->audio; - for (x = 0; x < datasize; x += 8) { + for (x = 0; x < in->len; x += 8) { + // ************ load sample ********** + left[0] = inptr[0]; + right[0] = inptr[1]; - // ************ load sample ********** - left[0] = dataptr[0]; - right[0] = dataptr[1]; - - leftc = rightc = 0; - // ************ calc echos ********** - for(i=0;i<(unsigned)s->echos;i++) - { - dif = (left[i] - right[i]); - // ************ slightly expand stereo for direct input ********** - left[i] += dif; - right[i] -= dif; - left[i] *= 0.5; - right[i] *= 0.5; - // ************ compute echo ********** - left[i+1] = s->buf[s->bufPos[i]++]; - if (s->bufPos[i] == s->buf_size) s->bufPos[i] = 0; - right[i+1] = s->buf[s->bufPos[i]++]; - if (s->bufPos[i] == s->buf_size) s->bufPos[i] = 0; - leftc += left[i]/weight[0][i]; - rightc += right[i]/weight[1][i]; + leftc = rightc = 0; + // ************ calc echos ********** + for(i=0;i<(unsigned)s->echos;i++) { + dif = (left[i] - right[i]); + // ************ slightly expand stereo for direct input ********** + left[i] += dif; + right[i] -= dif; + left[i] *= 0.5; + right[i] *= 0.5; + // ************ compute echo ********** + left[i+1] = s->buf[s->bufPos[i]++]; + if (s->bufPos[i] == s->buf_size) s->bufPos[i] = 0; + right[i+1] = s->buf[s->bufPos[i]++]; + if (s->bufPos[i] == s->buf_size) s->bufPos[i] = 0; + leftc += left[i]/weight[0][i]; + rightc += right[i]/weight[1][i]; + } + // ************ mix reverb with (near to) direct input ********** + _left = s->left0p + leftc * s->echo_sfactor / 16; + _right = s->right0p + rightc * s->echo_sfactor / 16; + /* do not reverb high frequencies (filter) */ + lt=(lowpass(&s->lp_reverb[0],leftc+left[0]/2)*s->feedback_sfactor)/256; + rt=(lowpass(&s->lp_reverb[1],rightc+right[0]/2)*s->feedback_sfactor)/256;; + s->buf[s->_bufPos++] = lt; + if (s->_bufPos == s->buf_size) s->_bufPos = 0; + s->buf[s->_bufPos++] = rt; + if (s->_bufPos == s->buf_size) s->_bufPos = 0; + s->left0p = left[0]; + s->right0p = right[0]; + // ************ store sample ********** + outptr[0] = clamp(_left,INT_MIN,INT_MAX); + outptr[1] = clamp(_right,INT_MIN,INT_MAX); + inptr += 2; + outptr += 2; } - - // ************ mix reverb with (near to) direct input ********** - _left = s->left0p + leftc * s->echo_sfactor / 16; - _right = s->right0p + rightc * s->echo_sfactor / 16; - - /* do not reverb high frequencies (filter) */ - lt=(lowpass(&s->lp_reverb[0],leftc+left[0]/2)*s->feedback_sfactor)/256; - rt=(lowpass(&s->lp_reverb[1],rightc+right[0]/2)*s->feedback_sfactor)/256;; - - s->buf[s->_bufPos++] = lt; - if (s->_bufPos == s->buf_size) s->_bufPos = 0; - s->buf[s->_bufPos++] = rt; - if (s->_bufPos == s->buf_size) s->_bufPos = 0; - - s->left0p = left[0]; - s->right0p = right[0]; - - // ************ store sample ********** - dataptr[0] = clamp(_left,INT_MIN,INT_MAX); - dataptr[1] = clamp(_right,INT_MIN,INT_MAX); - dataptr += 2; - - } + return out; } -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const af_conf_t* arg) { af_crystality_t* s = (af_crystality_t*)af->setup; // Sanity check if(!arg) return MPXP_Error; if(arg->nch!=2) return MPXP_Error; - af->data->rate = arg->rate; - af->data->nch = arg->nch; - af->data->format = MPAF_NE|MPAF_F|4; - init_echo3d(s,af->data->rate); + af->conf.rate = arg->rate; + af->conf.nch = arg->nch; + af->conf.format = MPAF_NE|MPAF_F|4; + init_echo3d(s,af->conf.rate); return af_test_output(af,arg); } @@ -187,20 +184,14 @@ // Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { - if(af->data) - mp_free(af->data); - if(((af_crystality_t *)af->setup)->buf) mp_free(((af_crystality_t *)af->setup)->buf); - if(af->setup) - mp_free(af->setup); + if(((af_crystality_t *)af->setup)->buf) mp_free(((af_crystality_t *)af->setup)->buf); + if(af->setup) mp_free(af->setup); } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) { - mp_aframe_t* c = data; /* Current working data */ - - echo3d(af->setup,(float*)c->audio, c->len); - return c; + return echo3d(af->setup,in); } // Allocate memory and set function pointers @@ -211,10 +202,8 @@ af->play=play; af->mul.n=1; af->mul.d=1; - af->data=mp_calloc(1,sizeof(mp_aframe_t)); af->setup=mp_calloc(1,sizeof(af_crystality_t)); - if(af->data == NULL || af->setup == NULL) - return MPXP_Error; + if(af->setup == NULL) return MPXP_Error; set_defaults(af->setup); init_echo3d(af->setup,44100); check_pin("afilter",af->pin,AF_PIN); Modified: mplayerxp/postproc/af_equalizer.c =================================================================== --- mplayerxp/postproc/af_equalizer.c 2012-11-17 05:26:00 UTC (rev 388) +++ mplayerxp/postproc/af_equalizer.c 2012-11-17 10:42:51 UTC (rev 389) @@ -74,7 +74,7 @@ b[1] = -1.0050; } -static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const mp_aframe_t* arg) +static MPXP_Rc __FASTCALL__ config(struct af_instance_s* af,const af_conf_t* arg) { af_equalizer_t* s = (af_equalizer_t*)af->setup; unsigned k =0; @@ -83,14 +83,13 @@ // Sanity check if(!arg) return MPXP_Error; - af->data->rate = arg->rate; - af->data->nch = arg->nch; - af->data->format = MPAF_NE|MPAF_F|4; + af->conf.rate = arg->rate; + af->conf.nch = arg->nch; + af->conf.format = MPAF_NE|MPAF_F|4; // Calculate number of active filters s->K=KM; - while(F[s->K-1] > (float)af->data->rate/2.2) - s->K--; + while(F[s->K-1] > (float)af->conf.rate/2.2) s->K--; if(s->K != KM) MSG_INFO("[equalizer] Limiting the number of filters to" @@ -98,10 +97,10 @@ // Generate filter taps for(k=0;k<s->K;k++) - bp2(s->a[k],s->b[k],F[k]/((float)af->data->rate),Q); + bp2(s->a[k],s->b[k],F[k]/((float)af->conf.rate),Q); // Calculate how much this plugin adds to the overall time delay - af->delay += 2000.0/((float)af->data->rate); + af->delay += 2000.0/((float)af->conf.rate); return af_test_output(af,arg); } @@ -164,49 +163,47 @@ // Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { - if(af->data) - mp_free(af->data); - if(af->setup) - mp_free(af->setup); + if(af->setup) mp_free(af->setup); } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, mp_aframe_t* data,int final) +static mp_aframe_t* __FASTCA... [truncated message content] |
From: <nic...@us...> - 2012-11-17 14:32:33
|
Revision: 396 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=396&view=rev Author: nickols_k Date: 2012-11-17 14:32:26 +0000 (Sat, 17 Nov 2012) Log Message: ----------- memory leaks-- Modified Paths: -------------- mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/postproc/af_format.c Modified: mplayerxp/libmpcodecs/dec_audio.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_audio.cpp 2012-11-17 14:31:53 UTC (rev 395) +++ mplayerxp/libmpcodecs/dec_audio.cpp 2012-11-17 14:32:26 UTC (rev 396) @@ -346,17 +346,16 @@ pafd->format,len, pafd->len, minlen, maxlen, buflen); cp_size=pafd->len; - if(buf != pafd->audio) { - cp_size=std::min(buflen,pafd->len); - memcpy(buf,pafd->audio,cp_size); - cp_tile=pafd->len-cp_size; - if(cp_tile) { - sh_audio->af_buffer=&((char *)pafd->audio)[cp_size]; - sh_audio->af_buffer_len=cp_tile; - sh_audio->af_pts = *pts+(float)cp_size/(float)sh_audio->af_bps; - MSG_DBG2("decaudio: afilter->cache %i bytes %f pts\n",cp_tile,*pts); - } else sh_audio->af_buffer_len=0; - } + cp_size=std::min(buflen,pafd->len); + memcpy(buf,pafd->audio,cp_size); + cp_tile=pafd->len-cp_size; + if(cp_tile) { + sh_audio->af_buffer=&((char *)pafd->audio)[cp_size]; + sh_audio->af_buffer_len=cp_tile; + sh_audio->af_pts = *pts+(float)cp_size/(float)sh_audio->af_bps; + MSG_DBG2("decaudio: afilter->cache %i bytes %f pts\n",cp_tile,*pts); + } else sh_audio->af_buffer_len=0; + free_mp_aframe(pafd); return cp_size; } Modified: mplayerxp/postproc/af_format.c =================================================================== --- mplayerxp/postproc/af_format.c 2012-11-17 14:31:53 UTC (rev 395) +++ mplayerxp/postproc/af_format.c 2012-11-17 14:32:26 UTC (rev 396) @@ -113,70 +113,99 @@ if(af->setup) mp_free(af->setup); } +static void print_fmts(const char *pfx,const mp_aframe_t* in,const mp_aframe_t*out) { + char buff[4096],buff2[4096]; + MSG_INFO("%s in_fmt=%s[len=%i] -> out_fmt=%s[len=%i]\n" + ,pfx + ,mpaf_fmt2str(in->format,buff,sizeof(buff)) + ,in->len + ,mpaf_fmt2str(out->format,buff2,sizeof(buff2)) + ,out->len); +} + static mp_aframe_t* change_endian(const mp_aframe_t* in) { mp_aframe_t* out; out=new_mp_aframe_genome(in); mp_alloc_aframe(out); endian(in,out); + out->format^=MPAF_LE; return out; } -static mp_aframe_t* convert_audio(const struct af_instance_s* af,const mp_aframe_t*in) { - mp_aframe_t* out,*tmp; +static mp_aframe_t* convert_audio_f(const struct af_instance_s* af,const mp_aframe_t*in) { + mp_aframe_t* out; out=new_mp_aframe_genome(in); out->len=af_lencalc(af->mul,in); mp_alloc_aframe(out); +print_fmts("convert_audio_f",in,out); if(in->format&MPAF_F) { + out->format=af->conf.format; +print_fmts("convert_audio_f1.5",in,out); float2int(in, out); - if((out->format&MPAF_SIGN_MASK) == MPAF_US) si2us(out, out); - } else { - // Input is INT - if((out->format&(MPAF_SPECIAL_MASK|MPAF_POINT_MASK))==MPAF_F){ - if((in->format&(MPAF_SIGN_MASK))==MPAF_US) us2si(in, out); - int2float(out, out); - } - else { - if((in->format&MPAF_BPS_MASK) != (out->format&MPAF_BPS_MASK)) { - // Change BPS - tmp=new_mp_aframe_genome(in); - mp_alloc_aframe(tmp); - if((in->format&(MPAF_SIGN_MASK))==MPAF_SI) si2us(in, tmp); - else tmp = (mp_aframe_t*)in; - change_bps(tmp, out); // works with US only for now - if(tmp!=in) free_mp_aframe(tmp); - if((out->format&(MPAF_SIGN_MASK))==MPAF_SI) us2si(in, out); - } else if((in->format&MPAF_SIGN_MASK)!=(out->format&MPAF_SIGN_MASK)) { - // Change signed/unsigned - if((in->format&MPAF_SIGN_MASK) == MPAF_US) - us2si(in, out); - else - si2us(in, out); - } else { - // should never happens: bypass - memcpy(out->audio,in->audio,in->len); - } - } } + if((out->format&(MPAF_SPECIAL_MASK|MPAF_POINT_MASK))==MPAF_F) { + int2float(in, out); + out->format=MPAF_PCM|MPAF_NE|MPAF_F|4; + } +print_fmts("convert_audio_f2",in,out); return out; } +static mp_aframe_t* convert_audio_i(const struct af_instance_s* af,const mp_aframe_t*in) { + mp_aframe_t* out; + out=new_mp_aframe_genome(in); + out->len=af_lencalc(af->mul,in); + mp_alloc_aframe(out); + out->format=af->conf.format; +print_fmts("convert_audio_pre",in,out); + change_bps(in, out); // works with US only for now +print_fmts("convert_audio_i",in,out); + return out; +} + +static mp_aframe_t* convert_si2us(const mp_aframe_t*in) { + mp_aframe_t* out; + out=new_mp_aframe_genome(in); + mp_alloc_aframe(out); + out->format|=MPAF_US; +print_fmts("convert_si2us_pre",in,out); + si2us(in, out); +print_fmts("convert_si2us",in,out); + return out; +} + +static mp_aframe_t* convert_us2si(const mp_aframe_t*in) { + mp_aframe_t* out; + out=new_mp_aframe_genome(in); + mp_alloc_aframe(out); + out->format&=~MPAF_US; +print_fmts("convert_us2si_pre",in,out); + us2si(in, out); +print_fmts("convert_us2si",in,out); + return out; +} + // Filter data through filter static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, const mp_aframe_t* in) { mp_aframe_t*out,*tmp; - out=new_mp_aframe_genome(in); - out->len=af_lencalc(af->mul,in); - mp_alloc_aframe(out); tmp=NULL; // Change to cpu native endian format - if((in->format&MPAF_END_MASK)!=MPAF_NE) - tmp=change_endian(in); - else - tmp=(mp_aframe_t*)in; + if((in->format&MPAF_END_MASK)!=MPAF_NE) tmp=change_endian(in); + else tmp=(mp_aframe_t*)in; // Conversion table - out=convert_audio(af,tmp); + if(in->format&MPAF_F||af->conf.format&MPAF_F) out=convert_audio_f(af,tmp); + else { + if(!(in->format&MPAF_US)) out=convert_si2us(tmp); + else out = tmp; + out=convert_audio_i(af,tmp); + if(tmp!=in) free_mp_aframe(tmp); + tmp=out; + if(!(af->conf.format&MPAF_SI)) out=convert_us2si(tmp); + if(tmp!=out) free_mp_aframe(tmp); + } if(tmp!=in) free_mp_aframe(tmp); tmp=out; @@ -185,7 +214,7 @@ out=change_endian(tmp); free_mp_aframe(tmp); } - + out->format=af->conf.format; return out; } @@ -240,14 +269,14 @@ // Function implementations used by play static void endian(const mp_aframe_t* in, mp_aframe_t* out) { - unsigned i; + unsigned i,nsamples=in->len/in->format&MPAF_BPS_MASK; switch(in->format&MPAF_BPS_MASK){ case 2: - for(i=0;i<in->len;i++) ((uint16_t*)out->audio)[i]=bswap_16(((uint16_t*)in->audio)[i]); + for(i=0;i<nsamples;i++) ((uint16_t*)out->audio)[i]=bswap_16(((uint16_t*)in->audio)[i]); break; case 3:{ register uint8_t s; - for(i=0;i<in->len;i++){ + for(i=0;i<nsamples;i++){ s=((uint8_t*)in->audio)[3*i]; ((uint8_t*)out->audio)[3*i]=((uint8_t*)in->audio)[3*i+2]; if (in->audio != out->audio) ((uint8_t*)out->audio)[3*i+1]=((uint8_t*)in->audio)[3*i+1]; @@ -256,45 +285,45 @@ break; } case 4: - for(i=0;i<in->len;i++) ((uint32_t*)out->audio)[i]=bswap_32(((uint32_t*)in->audio)[i]); + for(i=0;i<nsamples;i++) ((uint32_t*)out->audio)[i]=bswap_32(((uint32_t*)in->audio)[i]); break; } } static void si2us(const mp_aframe_t* in, mp_aframe_t* out) { - unsigned i; + unsigned i,nsamples=in->len/in->format&MPAF_BPS_MASK; switch(in->format&MPAF_BPS_MASK) { case 1: - for(i=0;i<in->len;i++) ((uint8_t*)out->audio)[i]=(uint8_t)(SCHAR_MAX+((int)((int8_t*)in->audio)[i])); + for(i=0;i<nsamples;i++) ((uint8_t*)out->audio)[i]=(uint8_t)(SCHAR_MAX+((int)((int8_t*)in->audio)[i])); break; case 2: - for(i=0;i<in->len;i++) ((uint16_t*)out->audio)[i]=(uint16_t)(SHRT_MAX+((int)((int16_t*)in->audio)[i])); + for(i=0;i<nsamples;i++) ((uint16_t*)out->audio)[i]=(uint16_t)(SHRT_MAX+((int)((int16_t*)in->audio)[i])); break; case 3: - for(i=0;i<in->len;i++) store24bit(out->audio, i, (uint32_t)(INT_MAX+(int32_t)load24bit(in->audio, i))); + for(i=0;i<nsamples;i++) store24bit(out->audio, i, (uint32_t)(INT_MAX+(int32_t)load24bit(in->audio, i))); break; case 4: - for(i=0;i<in->len;i++) ((uint32_t*)out->audio)[i]=(uint32_t)(INT_MAX+((int32_t*)in->audio)[i]); + for(i=0;i<nsamples;i++) ((uint32_t*)out->audio)[i]=(uint32_t)(INT_MAX+((int32_t*)in->audio)[i]); break; } } static void us2si(const mp_aframe_t* in, mp_aframe_t* out) { - unsigned i; + unsigned i,nsamples=in->len/in->format&MPAF_BPS_MASK; switch(in->format&MPAF_BPS_MASK){ case 1: - for(i=0;i<in->len;i++) ((int8_t*)out->audio)[i]=(int8_t)(SCHAR_MIN+((int)((uint8_t*)in->audio)[i])); + for(i=0;i<nsamples;i++) ((int8_t*)out->audio)[i]=(int8_t)(SCHAR_MIN+((int)((uint8_t*)in->audio)[i])); break; case 2: - for(i=0;i<in->len;i++) ((int16_t*)out->audio)[i]=(int16_t)(SHRT_MIN+((int)((uint16_t*)in->audio)[i])); + for(i=0;i<nsamples;i++) ((int16_t*)out->audio)[i]=(int16_t)(SHRT_MIN+((int)((uint16_t*)in->audio)[i])); break; case 3: - for(i=0;i<in->len;i++) store24bit(out->audio, i, (int32_t)(INT_MIN+(uint32_t)load24bit(in->audio, i))); + for(i=0;i<nsamples;i++) store24bit(out->audio, i, (int32_t)(INT_MIN+(uint32_t)load24bit(in->audio, i))); break; case 4: - for(i=0;i<in->len;i++) ((int32_t*)out->audio)[i]=(int32_t)(INT_MIN+((uint32_t*)in->audio)[i]); + for(i=0;i<nsamples;i++) ((int32_t*)out->audio)[i]=(int32_t)(INT_MIN+((uint32_t*)in->audio)[i]); break; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-19 15:53:08
|
Revision: 414 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=414&view=rev Author: nickols_k Date: 2012-11-19 15:52:58 +0000 (Mon, 19 Nov 2012) Log Message: ----------- cleanups Modified Paths: -------------- mplayerxp/configure mplayerxp/libvo/jpeg_enc.c mplayerxp/postproc/af_scaletempo.cpp mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/swscale.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-11-19 13:39:12 UTC (rev 413) +++ mplayerxp/configure 2012-11-19 15:52:58 UTC (rev 414) @@ -1145,6 +1145,8 @@ #ifdef __cplusplus } +#undef FFMAX +#undef FFMIN #endif #endif EOF Modified: mplayerxp/libvo/jpeg_enc.c =================================================================== --- mplayerxp/libvo/jpeg_enc.c 2012-11-19 13:39:12 UTC (rev 413) +++ mplayerxp/libvo/jpeg_enc.c 2012-11-19 15:52:58 UTC (rev 414) @@ -33,10 +33,7 @@ #endif /* We need this #define because we need ../libavcodec/common.h to #define * be2me_32, otherwise the linker will complain that it doesn't exist */ -#define HAVE_AV_CONFIG_H -#include "../libmpcodecs/interface/ffmpeg/avcodec.h" -//#include "../libavcodec/dsputil.h" -//#include "../libavcodec/mpegvideo.h" +#include "mp_conf_lavc.h" #include "jpeg_enc.h" #include "vo_msg.h" Modified: mplayerxp/postproc/af_scaletempo.cpp =================================================================== --- mplayerxp/postproc/af_scaletempo.cpp 2012-11-19 13:39:12 UTC (rev 413) +++ mplayerxp/postproc/af_scaletempo.cpp 2012-11-19 15:52:58 UTC (rev 414) @@ -30,6 +30,7 @@ * samples from last stride with correlated samples of current input * */ +#include <algorithm> #include <stdlib.h> #include <string.h> @@ -40,9 +41,6 @@ #include "osdep/mplib.h" #include "pp_msg.h" -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) - // Data for specific instances of this filter typedef struct af_scaletempo_s { @@ -99,7 +97,7 @@ } else { int bytes_skip; s->bytes_to_slide -= s->bytes_queued; - bytes_skip = FFMIN(s->bytes_to_slide, bytes_in); + bytes_skip = std::min(s->bytes_to_slide, bytes_in); s->bytes_queued = 0; s->bytes_to_slide -= bytes_skip; offset += bytes_skip; @@ -108,7 +106,7 @@ } if (bytes_in > 0) { - int bytes_copy = FFMIN(s->bytes_queue - s->bytes_queued, bytes_in); + int bytes_copy = std::min(s->bytes_queue - s->bytes_queued, bytes_in); memcpy(s->buf_queue + s->bytes_queued, (int8_t*)data->audio + offset, bytes_copy); Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-11-19 13:39:12 UTC (rev 413) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-11-19 15:52:58 UTC (rev 414) @@ -1,3 +1,5 @@ +#include <algorithm> + #include "mp_config.h" #include "help_mp.h" @@ -337,7 +339,7 @@ fribidi_set_mirroring (1); fribidi_set_reorder_nsm (0); char_set_num = fribidi_parse_charset("UTF-8"); - buffer_size = FFMAX(1024,len+1); + buffer_size = std::max(1024,len+1); logical = mp_malloc(buffer_size); visual = mp_malloc(buffer_size); outputstr = new char [buffer_size]; Modified: mplayerxp/postproc/swscale.h =================================================================== --- mplayerxp/postproc/swscale.h 2012-11-19 13:39:12 UTC (rev 413) +++ mplayerxp/postproc/swscale.h 2012-11-19 15:52:58 UTC (rev 414) @@ -22,7 +22,7 @@ #ifndef SWSCALE_H #define SWSCALE_H -#include "mp_conf_lavc.h" // unfortunatelly +#include "mp_conf_lavc.h" extern int sws_init(void); extern void sws_uninit(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |