[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[368] mplayerxp
Brought to you by:
olov
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] |