Thread: [Mplayerxp-cvslog] SF.net SVN: mplayerxp:[226] mplayerxp (Page 4)
Brought to you by:
olov
From: <nic...@us...> - 2012-10-27 14:01:24
|
Revision: 226 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=226&view=rev Author: nickols_k Date: 2012-10-27 14:01:14 +0000 (Sat, 27 Oct 2012) Log Message: ----------- merge similar code into function Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-27 10:31:00 UTC (rev 225) +++ mplayerxp/mplayer.c 2012-10-27 14:01:14 UTC (rev 226) @@ -1435,11 +1435,7 @@ } } - if(sh_video) { - do { - usleep(0); - }while(dae_get_decoder_outrun(xp_core.video) < xp_core.num_v_buffs/2 && !xp_core.eof); - } + if(sh_video) dae_wait_decoder_outrun(xp_core.video); } void mpxp_reset_vcache(void) @@ -2631,11 +2627,9 @@ We may print something in block window ;) */ mpxp_seek_time = GetTimerMS(); - if(sh_video) { - do { - usleep(0); - }while(dae_get_decoder_outrun(xp_core.video) < xp_core.num_v_buffs/2 && !xp_core.eof); - } + + if(sh_video) dae_wait_decoder_outrun(xp_core.video); + if(xmp_run_players()!=0) exit_player("Can't run xp players!\n"); MSG_OK("Using the next %i threads:\n",xp_core.num_threads); unsigned idx; Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-27 10:31:00 UTC (rev 225) +++ mplayerxp/xmp_core.c 2012-10-27 14:01:14 UTC (rev 226) @@ -135,6 +135,14 @@ return decoder_idx-it->player_idx; } +void dae_wait_decoder_outrun(const dec_ahead_engine_t* it) { + if(it) { + do { + usleep(0); + }while(dae_get_decoder_outrun(it) < xp_core.num_v_buffs/2); + } +} + frame_attr_t dae_played_fra(const dec_ahead_engine_t* it) { unsigned idx=it->player_idx; return it->fra[idx]; Modified: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-10-27 10:31:00 UTC (rev 225) +++ mplayerxp/xmp_core.h 2012-10-27 14:01:14 UTC (rev 226) @@ -94,14 +94,14 @@ extern int xmp_run_players( void ); extern void xmp_reset_sh_video(sh_video_t* shv); -extern void dae_init(dec_ahead_engine_t* it,unsigned nframes); -extern void dae_uninit(dec_ahead_engine_t* it); -extern void dae_reset(dec_ahead_engine_t* it); /* after mpxp_seek */ +extern void dae_init(dec_ahead_engine_t* it,unsigned nframes); +extern void dae_uninit(dec_ahead_engine_t* it); +extern void dae_reset(dec_ahead_engine_t* it); /* after mpxp_seek */ /* returns 1 - on success 0 - if busy */ -extern int dae_try_inc_played(dec_ahead_engine_t* it); -extern int dae_inc_played(dec_ahead_engine_t* it); -extern int dae_inc_decoded(dec_ahead_engine_t* it); +extern int dae_try_inc_played(dec_ahead_engine_t* it); +extern int dae_inc_played(dec_ahead_engine_t* it); +extern int dae_inc_decoded(dec_ahead_engine_t* it); extern unsigned dae_prev_played(const dec_ahead_engine_t* it); extern unsigned dae_prev_decoded(const dec_ahead_engine_t* it); @@ -109,6 +109,7 @@ extern unsigned dae_next_decoded(const dec_ahead_engine_t* it); /* returns normalized decoder_idx-player_idx */ extern unsigned dae_get_decoder_outrun(const dec_ahead_engine_t* it); +extern void dae_wait_decoder_outrun(const dec_ahead_engine_t* it); static inline unsigned dae_curr_vplayed() { return xp_core.video->player_idx; } static inline unsigned dae_curr_vdecoded() { return xp_core.video->decoder_idx; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-27 14:53:33
|
Revision: 227 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=227&view=rev Author: nickols_k Date: 2012-10-27 14:53:25 +0000 (Sat, 27 Oct 2012) Log Message: ----------- combine some variables into structures Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpsub/subreader.c mplayerxp/libplaytree/asxparser.c mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/postproc/vf_menu.c mplayerxp/xmp_core.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/cfg-mplayer.h 2012-10-27 14:53:25 UTC (rev 227) @@ -2,7 +2,6 @@ * config for cfgparser */ -extern int use_stdin; extern uint32_t mp_msg_filter; #ifdef HAVE_PNG extern int z_compression; @@ -147,8 +146,8 @@ static const config_t osd_config[]={ {"level", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , NULL, "specifies initial mode of the OSD"}, #ifdef USE_OSD - {"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies an alternative directory of font.desc location"}, - {"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL, "specifies resampling of alphamap of the font"}, + {"font", &mp_conf.font_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies an alternative directory of font.desc location"}, + {"ffactor", &mp_conf.font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL, "specifies resampling of alphamap of the font"}, {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL, "specifies align position of SPU (DVD-VOBsub) subtitles"}, {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "specifies antialiasing/scaling mode for SPU"}, {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, NULL, "specifies variance parameter of gaussian for -spuaa"}, @@ -193,17 +192,17 @@ static const config_t subtitle_config[]={ - {"on", &has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables subtitle-steam playback"}, - {"off", &has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables subtitle-stream playback"}, - {"vob", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the VobSub files that are to be used for subtitle"}, + {"on", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables subtitle-steam playback"}, + {"off", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables subtitle-stream playback"}, + {"vob", &mp_conf.vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the VobSub files that are to be used for subtitle"}, {"vobid", &mp_conf.vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "specifies the VobSub subtitle id"}, #ifdef USE_SUB - {"file", &sub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the subtitle file"}, + {"file", &mp_conf.sub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the subtitle file"}, #ifdef USE_ICONV {"cp", &sub_data.cp, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies codepage of subtitles"}, #endif - {"fps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL, "specifies frame/sec rate of subtitle file"}, - {"noauto", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable autodetection of vobsub for textsubs if vobsub found"}, + {"fps", &mp_conf.sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL, "specifies frame/sec rate of subtitle file"}, + {"noauto", &mp_conf.sub_auto, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable autodetection of vobsub for textsubs if vobsub found"}, {"unicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "tells MPlayerXP to handle the subtitle file as UNICODE"}, {"nounicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, {"utf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL, "tells MPlayerXP to handle the subtitle file as UTF8"}, @@ -231,11 +230,11 @@ #endif static const config_t audio_config[]={ - {"on", &has_audio, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables audio-steam playback"}, - {"off", &has_audio, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables audio-stream playback"}, + {"on", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables audio-steam playback"}, + {"off", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables audio-stream playback"}, {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL, "select audio-mixer device"}, {"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, NULL, "select number of audio output channels to be used"}, - {"rate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL, "specifies Hz for audio playback"}, + {"rate", &mp_conf.force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL, "specifies Hz for audio playback"}, {"lang", &mp_conf.audio_lang, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies language of DVD-audio stream as two-letter country code(s)"}, {"id", &mp_conf.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL, "selects audio channel"}, #ifdef USE_FAKE_MONO @@ -245,8 +244,8 @@ }; static const config_t video_config[]={ - {"on", &has_video, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-steam playback"}, - {"off", &has_video, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-stream playback"}, + {"on", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-steam playback"}, + {"off", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-stream playback"}, {"width", &vo_conf.opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to width (if driver supports)"}, {"height", &vo_conf.opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to height (if driver supports)"}, {"zoom", &vo_conf.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, @@ -302,18 +301,18 @@ {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL, ""}, /* this don't need anymore to be the first!!! */ //---------------------- libao/libvo/mplayer options ------------------------ - {"vo", &video_driver, CONF_TYPE_STRING, 0, 0, 0, NULL, "select video output driver and optinaly device"}, - {"ao", &audio_driver, CONF_TYPE_STRING, 0, 0, 0, NULL, "select audio output driver and optinaly device"}, + {"vo", &mp_conf.video_driver, CONF_TYPE_STRING, 0, 0, 0, NULL, "select video output driver and optinaly device"}, + {"ao", &mp_conf.audio_driver, CONF_TYPE_STRING, 0, 0, 0, NULL, "select audio output driver and optinaly device"}, {"af", &af_cfg.list, CONF_TYPE_STRING, 0, 0, 0, NULL, "selects audio filter"}, {"vf", &vf_cfg.list, CONF_TYPE_STRING, 0, 0, 0, NULL, "selects video filter"}, - {"afm", &audio_family, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified audio-decoders family"}, - {"vfm", &video_family, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified video-decoders family"}, - {"ac", &audio_codec, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified audio-decoder"}, - {"vc", &video_codec, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified video-decoder"}, + {"afm", &mp_conf.audio_family, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified audio-decoders family"}, + {"vfm", &mp_conf.video_family, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified video-decoders family"}, + {"ac", &mp_conf.audio_codec, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified audio-decoder"}, + {"vc", &mp_conf.video_codec, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified video-decoder"}, /*UD*/ {"verbose", &mp_conf.verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, NULL, "verbose output"}, {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL, "verbose output (more -v means more verbosity)"}, - {"slave", &slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL, "turns MPlayerXP into slave mode as a backend for other programs"}, - {"use-stdin", &use_stdin, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL, "forces reading of keyboard codes from STDIN instead of terminal's console"}, + {"slave", &mp_conf.slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL, "turns MPlayerXP into slave mode as a backend for other programs"}, + {"use-stdin", &mp_conf.use_stdin, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL, "forces reading of keyboard codes from STDIN instead of terminal's console"}, {"msgfilter", &mp_msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, NULL, "specifies filter for verbosed messages"}, {"core", &xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "XP-core related options" }, Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-27 14:53:25 UTC (rev 227) @@ -259,7 +259,6 @@ float pts; }mp3_priv_t; -extern char *audio_codec_param; int init(sh_audio_t *sh) { // MPEG Audio: Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-10-27 14:53:25 UTC (rev 227) @@ -5,7 +5,7 @@ #include "mp_config.h" #include "help_mp.h" -#include "../mplayer.h" +#include "mplayer.h" #include "libmpdemux/stream.h" #include "libmpdemux/demuxer.h" @@ -31,8 +31,6 @@ static const ad_functions_t* mpadec; -extern unsigned force_srate; -extern char *audio_codec; int mpca_init(sh_audio_t *sh_audio) { unsigned i; @@ -127,7 +125,7 @@ initial_audio_pts += ((float)(initial_audio_pts_corr.pts_bytes-initial_audio_pts_corr.nbytes))/(float)sh_audio->i_bps; initial_audio_pts_corr.need_correction=0; } - MSG_OK("[AC] %s decoder: [%s] drv:%s.%s ratio %i->%i\n",audio_codec?"Forcing":"Selecting" + MSG_OK("[AC] %s decoder: [%s] drv:%s.%s ratio %i->%i\n",mp_conf.audio_codec?"Forcing":"Selecting" ,sh_audio->codec->codec_name ,mpadec->info->driver_name ,sh_audio->codec->dll_name Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-27 14:53:25 UTC (rev 227) @@ -90,7 +90,6 @@ static unsigned smp_num_cpus=1; static unsigned use_vf_threads=0; -extern char *video_codec; int mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status){ unsigned o_bps,bpp; sh_video->codec=NULL; @@ -153,7 +152,7 @@ } o_bps=sh_video->fps*sh_video->src_w*sh_video->src_h*bpp/8; MSG_OK("[VC] %s decoder: [%s] drv:%s.%s (%dx%d (aspect %g) %4.2ffps\n" - ,video_codec?"Forcing":"Selected" + ,mp_conf.video_codec?"Forcing":"Selected" ,sh_video->codec->codec_name ,mpvdec->info->driver_name ,sh_video->codec->dll_name @@ -288,7 +287,6 @@ if(sh_video->inited && mpvdec) mpvdec->control(sh_video,VDCTRL_RESYNC_STREAM,NULL); } -extern float sub_fps; #ifdef USE_SUB extern subtitle* mp_subtitles; static float sub_last_pts = -303; @@ -299,10 +297,10 @@ // find sub if(mp_subtitles && v_pts>0){ float pts=v_pts; - if(sub_fps==0) sub_fps=sh_video->fps; + 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_subtitles,sub_uses_time?(100*pts):(pts*sub_fps),vo_data); // FIXME! frame counter... + find_sub(mp_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/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/libmpconf/cfgparser.h 2012-10-27 14:53:25 UTC (rev 227) @@ -77,8 +77,6 @@ char* opt_name; }; -extern m_config_t* mconfig; - /* parse_config_file returns: * -1 on error (can't malloc, invalid option...) * 0 if can't open configfile Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-27 14:53:25 UTC (rev 227) @@ -623,7 +623,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(mconfig,"mp3.hr-seek",1); // Enable high res seeking + m_config_set_flag(mp_data->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/libmpsub/subreader.c =================================================================== --- mplayerxp/libmpsub/subreader.c 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/libmpsub/subreader.c 2012-10-27 14:53:25 UTC (rev 227) @@ -509,8 +509,6 @@ return SUB_INVALID; // too many bad lines } -extern float sub_fps; - #ifdef USE_ICONV static iconv_t icdsc; @@ -807,7 +805,7 @@ float a,b; mpsub_position=0; - if (sub_fps==0) sub_fps=fps; + if (mp_conf.sub_fps==0) mp_conf.sub_fps=fps; fd=fopen ("dump.mpsub", "w"); if (!fd) { @@ -834,8 +832,8 @@ else fprintf (fd, " %.2f\n",b); } else { - fprintf (fd, "%ld %ld\n", (long)((egysub->start*(fps/sub_fps))-((mpsub_position*(fps/sub_fps)))), - (long)(((egysub->end)-(egysub->start))*(fps/sub_fps))); + fprintf (fd, "%ld %ld\n", (long)((egysub->start*(fps/mp_conf.sub_fps))-((mpsub_position*(fps/mp_conf.sub_fps)))), + (long)(((egysub->end)-(egysub->start))*(fps/mp_conf.sub_fps))); } mpsub_position = egysub->end; Modified: mplayerxp/libplaytree/asxparser.c =================================================================== --- mplayerxp/libplaytree/asxparser.c 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/libplaytree/asxparser.c 2012-10-27 14:53:25 UTC (rev 227) @@ -442,14 +442,14 @@ static void __FASTCALL__ asx_parse_param(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) { char *name,*val; - + name = asx_get_attrib("NAME",attribs); if(!name) { asx_warning_attrib_required(parser,"PARAM" ,"NAME" ); return; } val = asx_get_attrib("VALUE",attribs); - if(m_config_get_option(mconfig,name) == NULL) { + if(m_config_get_option(mp_data->mconfig,name) == NULL) { MSG_WARN("Found unknow param in asx: %s",name); if(val) MSG_WARN("=%s\n",val); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/mplayer.c 2012-10-27 14:53:25 UTC (rev 227) @@ -25,6 +25,7 @@ #include "mp_config.h" #include "sig_hand.h" #include "mplayer.h" +#include "my_malloc.h" #include "postproc/swscale.h" #include "postproc/af.h" #include "postproc/vf.h" @@ -61,8 +62,6 @@ #include "nls/nls.h" #include "postproc/libmenu/menu.h" -int slave_mode=0; - #define ABS(x) (((x)>=0)?(x):(-(x))) #define MSGT_CLASS MSGT_CPLAYER @@ -73,7 +72,7 @@ Playtree **************************************************************************/ -play_tree_t* playtree; +static play_tree_t* playtree; #define PT_NEXT_ENTRY 1 #define PT_PREV_ENTRY -1 @@ -86,7 +85,7 @@ Config **************************************************************************/ -m_config_t* mconfig; +//m_config_t* mconfig; /************************************************************************** Decoding ahead @@ -96,13 +95,11 @@ volatile unsigned xp_drop_frame_cnt=0; float xp_screen_pts; float playbackspeed_factor=1.0; -int mpxp_seek_time=-1; static unsigned mpxp_after_seek=0; int audio_eof=0; demux_stream_t *d_video=NULL; static int osd_show_framedrop = 0; static int osd_function=OSD_PLAY; -int output_quality=0; #ifdef USE_SUB subtitle* mp_subtitles=NULL; #endif @@ -129,7 +126,7 @@ static int cfg_include(struct config *conf, char *filename){ UNUSED(conf); - return m_config_parse_config_file(mconfig, filename); + return m_config_parse_config_file(mp_data->mconfig, filename); } #include "osdep/get_path.h" @@ -148,7 +145,6 @@ /* Common FIFO functions, and keyboard/event FIFO code */ #include "fifo.h" -int use_stdin=0; /**************************************************************************/ static int vo_inited=0; @@ -162,37 +158,16 @@ int osd_level=2; -/* codecs: */ -int has_audio=1; -int has_video=1; -int has_dvdsub=1; -char *audio_codec=NULL; /* override audio codec */ -char *audio_codec_param=NULL; -char *video_codec=NULL; /* override video codec */ -char *audio_family=NULL; /* override audio codec family */ -char *video_family=NULL; /* override video codec family */ - // A-V sync: static float c_total=0; -unsigned force_srate=0; static uint32_t our_n_frames=0; -// screen info: -char* video_driver=NULL; //"mga"; // default -char* audio_driver=NULL; -// sub: -char *font_name=NULL; -float font_factor=0.75; -char *sub_name=NULL; -float sub_fps=0; -int sub_auto = 1; -char *vobsub_name=NULL; - static stream_t* stream=NULL; mp_conf_t mp_conf; +mp_data_t*mp_data=NULL; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) typedef struct x86_features_s { @@ -232,6 +207,14 @@ 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_data=random_malloc(sizeof(mp_data_t),1000); + memset(mp_data,0,sizeof(mp_data_t)); + mp_data->seek_time=-1; } static unsigned int inited_flags=0; @@ -688,7 +671,7 @@ MP_UNIT("sub_free"); mp_input_uninit(); sub_free( mp_subtitles ); - sub_name=NULL; + mp_conf.sub_name=NULL; vo_data->sub=NULL; mp_subtitles=NULL; } @@ -707,7 +690,7 @@ sws_uninit(); if(how) MSG_HINT(MSGTR_Exiting,how); MSG_DBG2("max framesize was %d bytes\n",max_framesize); - if(mconfig) m_config_free(mconfig); + if(mp_data->mconfig) m_config_free(mp_data->mconfig); mp_msg_uninit(); if(how) exit(0); return; /* Still try coredump!!!*/ @@ -731,7 +714,7 @@ MP_UNIT("exit_player"); MSG_HINT(MSGTR_Exiting,MSGTR_Exit_quit); MSG_DBG2("max framesize was %d bytes\n",max_framesize); - if(mconfig) m_config_free(mconfig); + if(mp_data->mconfig) m_config_free(mp_data->mconfig); mp_msg_uninit(); exit(0); } @@ -885,21 +868,21 @@ static void init_player( void ) { - if(video_driver && strcmp(video_driver,"help")==0) + if(mp_conf.video_driver && strcmp(mp_conf.video_driver,"help")==0) { vo_print_help(vo_data); exit(0); } - if(audio_driver && strcmp(audio_driver,"help")==0) + if(mp_conf.audio_driver && strcmp(mp_conf.audio_driver,"help")==0) { ao_print_help(); exit(0); } - if(video_family && strcmp(video_family,"help")==0){ + if(mp_conf.video_family && strcmp(mp_conf.video_family,"help")==0){ vfm_help(); exit(0); } - if(audio_family && strcmp(audio_family,"help")==0){ + if(mp_conf.audio_family && strcmp(mp_conf.audio_family,"help")==0){ afm_help(); exit(0); } @@ -922,11 +905,11 @@ } } - if(audio_codec && strcmp(audio_codec,"help")==0){ + if(mp_conf.audio_codec && strcmp(mp_conf.audio_codec,"help")==0){ list_codecs(1); exit(0); } - if(video_codec && strcmp(video_codec,"help")==0){ + if(mp_conf.video_codec && strcmp(mp_conf.video_codec,"help")==0){ list_codecs(0); exit(0); } @@ -940,7 +923,7 @@ } void show_long_help(void) { - m_config_show_options(mconfig); + m_config_show_options(mp_data->mconfig); mp_input_print_binds(); print_stream_drivers(); vo_print_help(vo_data); @@ -1118,7 +1101,7 @@ ,(v_pts>0.5)?(int)(100.0*time_usage.video/(double)v_pts):0 ,(v_pts>0.5)?(int)(100.0*time_usage.vout/(double)v_pts):0 ,(v_pts>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)v_pts):0 - ,output_quality + ,mp_data->output_quality ,dae_curr_vplayed() ); fflush(stdout); @@ -1136,7 +1119,7 @@ ,(v_pts>0.5)?(int)(100.0*time_usage.video/(double)v_pts):0 ,(v_pts>0.5)?(int)(100.0*time_usage.vout/(double)v_pts):0 ,(v_pts>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)v_pts):0 - ,output_quality + ,mp_data->output_quality ); } else MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d\r" @@ -1145,7 +1128,7 @@ ,(v_pts>0.5)?(int)(100.0*time_usage.video/(double)v_pts):0 ,(v_pts>0.5)?(int)(100.0*time_usage.vout/(double)v_pts):0 ,(v_pts>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)v_pts):0 - ,output_quality + ,mp_data->output_quality ); fflush(stdout); } @@ -1250,6 +1233,7 @@ can_blit=dae_try_inc_played(xp_core.video); /* <-- TRY SWITCH TO NEXT FRAME */ shva=dae_next_played_fra(xp_core.video); v_pts = shva.v_pts; + /*------------------------ frame decoded. --------------------*/ /* blit frame */ @@ -1379,7 +1363,7 @@ mpxp_after_seek=25; /* 1 sec delay */ } if(seek_rval){ - mpxp_seek_time = GetTimerMS(); + mp_data->seek_time = GetTimerMS(); // success: /* FIXME there should be real seeking for vobsub */ @@ -1529,9 +1513,9 @@ mp_input_init(); if(keyb_fifo_get > 0) mp_input_add_key_fd(keyb_fifo_get,1,NULL,NULL); - if(slave_mode) + if(mp_conf.slave_mode) mp_input_add_cmd_fd(0,1,NULL,NULL); - else if(!use_stdin) + else if(!mp_conf.use_stdin) mp_input_add_key_fd(0,1,NULL,NULL); inited_flags|=INITED_INPUT; } @@ -1539,14 +1523,14 @@ static void mpxp_init_osd(void) { // check font #ifdef USE_OSD - if(font_name){ - vo_data->font=read_font_desc(font_name,font_factor,mp_conf.verbose>1); - if(!vo_data->font) MSG_ERR(MSGTR_CantLoadFont,font_name); + 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"),font_factor,mp_conf.verbose>1); + 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",font_factor,mp_conf.verbose>1); + vo_data->font=read_font_desc(DATADIR"/font/font.desc",mp_conf.font_factor,mp_conf.verbose>1); } #endif /* Configure menu here */ @@ -1571,21 +1555,21 @@ char* rs=NULL; unsigned i; // check video_out driver name: - if (video_driver) - if ((i=strcspn(video_driver, ":")) > 0) { - size_t i2 = strlen(video_driver); - if (video_driver[i] == ':') { + 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 = malloc(i2-i); if (vo_conf.subdevice != NULL) - strncpy(vo_conf.subdevice, (char *)(video_driver+i+1), i2-i); - video_driver[i] = '\0'; + strncpy(vo_conf.subdevice, (char *)(mp_conf.video_driver+i+1), i2-i); + mp_conf.video_driver[i] = '\0'; } } MP_UNIT("vo_register"); - vo_inited = (vo_register(vo_data,video_driver)!=NULL)?1:0; + vo_inited = (vo_register(vo_data,mp_conf.video_driver)!=NULL)?1:0; if(!vo_inited){ - MSG_FATAL(MSGTR_InvalidVOdriver,video_driver?video_driver:"?"); + MSG_FATAL(MSGTR_InvalidVOdriver,mp_conf.video_driver?mp_conf.video_driver:"?"); exit_player(MSGTR_Exit_error); } MP_UNIT("vo_init"); @@ -1597,21 +1581,21 @@ // check audio_out driver name: MP_UNIT("ao_init"); - if (audio_driver) - if ((i=strcspn(audio_driver, ":")) > 0) + if (mp_conf.audio_driver) + if ((i=strcspn(mp_conf.audio_driver, ":")) > 0) { - size_t i2 = strlen(audio_driver); + size_t i2 = strlen(mp_conf.audio_driver); - if (audio_driver[i] == ':') + if (mp_conf.audio_driver[i] == ':') { rs = malloc(i2-i); - if (rs != NULL) strncpy(rs, (char *)(audio_driver+i+1), i2-i); - audio_driver[i] = '\0'; + if (rs != NULL) strncpy(rs, (char *)(mp_conf.audio_driver+i+1), i2-i); + mp_conf.audio_driver[i] = '\0'; } } - ao_inited=(ao_register(audio_driver)!=NULL)?1:0; + ao_inited=(ao_register(mp_conf.audio_driver)!=NULL)?1:0; if (!ao_inited){ - MSG_FATAL(MSGTR_InvalidAOdriver,audio_driver); + MSG_FATAL(MSGTR_InvalidAOdriver,mp_conf.audio_driver); exit_player(MSGTR_Exit_error); } return rs; @@ -1620,17 +1604,17 @@ static int mpxp_init_vobsub(const char *filename) { int forced_subs_only=0; MP_UNIT("vobsub"); - if (vobsub_name){ - vo_data->vobsub=vobsub_open(vobsub_name,mp_conf.spudec_ifo,1,&vo_data->spudec); + 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,vobsub_name); + MSG_ERR(MSGTR_CantLoadSub,mp_conf.vobsub_name); else { 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(sub_auto && filename && (strlen(filename)>=5)){ + }else if(mp_conf.sub_auto && filename && (strlen(filename)>=5)){ /* try to autodetect vobsub from movie filename ::atmos */ char *buf = malloc((strlen(filename)-3) * sizeof(char)); memset(buf,0,strlen(filename)-3); // make sure string is terminated @@ -1640,7 +1624,7 @@ } if(vo_data->vobsub) { - sub_auto=0; // don't do autosub for textsubs if vobsub found + mp_conf.sub_auto=0; // don't do autosub for textsubs if vobsub found inited_flags|=INITED_VOBSUB; } return forced_subs_only; @@ -1769,7 +1753,7 @@ 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,font_factor); + spudec_set_font_factor(vo_data->spudec,mp_conf.font_factor); } if (vo_data->spudec!=NULL) { @@ -1783,11 +1767,11 @@ // we know fps so now we can adjust subtitles time to ~6 seconds AST // check .sub MP_UNIT("read_subtitles_file"); - if(sub_name){ - mp_subtitles=sub_read_file(sub_name, sh_video->fps); - if(!mp_subtitles) MSG_ERR(MSGTR_CantLoadSub,sub_name); + if(mp_conf.sub_name){ + mp_subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); + if(!mp_subtitles) MSG_ERR(MSGTR_CantLoadSub,mp_conf.sub_name); } else - if(sub_auto) { // auto load sub file ... + if(mp_conf.sub_auto) { // auto load sub file ... mp_subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) : "default.sub", sh_video->fps ); } @@ -1800,27 +1784,17 @@ } static void mpxp_find_acodec(void) { -/* accept parameters*/ - if(audio_codec) { - char *prm; - prm = strchr(audio_codec,':'); - if(prm) { - audio_codec_param=prm+1; - *prm=0; - } - } - // Go through the codec.conf and find the best codec... sh_audio->codec=NULL; - if(audio_family) MSG_INFO(MSGTR_TryForceAudioFmt,audio_family); + if(mp_conf.audio_family) MSG_INFO(MSGTR_TryForceAudioFmt,mp_conf.audio_family); while(1) { const char *fmt; sh_audio->codec=find_codec(sh_audio->wtag,NULL,sh_audio->codec,1); if(!sh_audio->codec) { - if(audio_family) { + if(mp_conf.audio_family) { sh_audio->codec=NULL; /* re-search */ MSG_ERR(MSGTR_CantFindAfmtFallback); - audio_family=NULL; + mp_conf.audio_family=NULL; continue; } MSG_ERR(MSGTR_CantFindAudioCodec); @@ -1833,9 +1807,9 @@ sh_audio=d_audio->sh=NULL; break; } - if(audio_codec && strcmp(sh_audio->codec->codec_name,audio_codec)) continue; - else if(audio_family && strcmp(sh_audio->codec->driver_name,audio_family)) continue; - MSG_V("%s audio codec: [%s] drv:%s (%s)\n",audio_codec?"Forcing":"Detected",sh_audio->codec->codec_name,sh_audio->codec->driver_name,sh_audio->codec->s_info); + 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; + 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); break; } } @@ -1851,17 +1825,17 @@ if(vo_conf.flip>0) VO_FLIP_SET(vo_data); if(vo_conf.vidmode) VO_VM_SET(vo_data); codecs_reset_selection(0); - if(video_codec) { + if(mp_conf.video_codec) { /* forced codec by name: */ - MSG_INFO("Forced video codec: %s\n",video_codec); - mpcv_init(sh_video,video_codec,NULL,-1); + MSG_INFO("Forced video codec: %s\n",mp_conf.video_codec); + mpcv_init(sh_video,mp_conf.video_codec,NULL,-1); } else { int status; /* try in stability order: UNTESTED, WORKING, BUGGY, BROKEN */ - if(video_family) MSG_INFO(MSGTR_TryForceVideoFmt,video_family); + if(mp_conf.video_family) MSG_INFO(MSGTR_TryForceVideoFmt,mp_conf.video_family); for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status){ - if(video_family) /* try first the preferred codec family:*/ - if(mpcv_init(sh_video,NULL,video_family,status)) break; + if(mp_conf.video_family) /* try first the preferred codec family:*/ + if(mpcv_init(sh_video,NULL,mp_conf.video_family,status)) break; if(mpcv_init(sh_video,NULL,NULL,status)) break; } } @@ -1879,7 +1853,7 @@ } else inited_flags|=INITED_VCODEC; MSG_V("%s video codec: [%s] vfm:%s (%s)\n", - video_codec?"Forcing":"Detected",sh_video->codec->codec_name,sh_video->codec->driver_name,sh_video->codec->s_info); + mp_conf.video_codec?"Forcing":"Detected",sh_video->codec->codec_name,sh_video->codec->driver_name,sh_video->codec->s_info); return rc; } @@ -1889,7 +1863,7 @@ MP_UNIT("setup_audio"); MSG_V("AO: [%s] %iHz %s %s\n", info->short_name, - force_srate?force_srate:sh_audio->samplerate, + mp_conf.force_srate?mp_conf.force_srate:sh_audio->samplerate, sh_audio->channels>7?"surround71": sh_audio->channels>6?"surround61": sh_audio->channels>5?"surround51": @@ -1905,7 +1879,7 @@ MSG_V("AO: Comment: %s\n", info->comment); MP_UNIT("af_preinit"); - ao_data->samplerate=force_srate?force_srate:sh_audio->samplerate; + ao_data->samplerate=mp_conf.force_srate?mp_conf.force_srate:sh_audio->samplerate; ao_data->channels=audio_output_channels?audio_output_channels:sh_audio->channels; ao_data->format=sh_audio->sample_format; #if 1 @@ -1923,7 +1897,7 @@ ao_format_name(ao_data->format),ao_data->format); } #endif - if(!ao_configure(ao_data,force_srate?force_srate:ao_data->samplerate, + if(!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; @@ -2326,13 +2300,13 @@ playtree = play_tree_new(); - mconfig = m_config_new(playtree); - m_config_register_options(mconfig,mplayer_opts); + mp_data->mconfig = m_config_new(playtree); + m_config_register_options(mp_data->mconfig,mplayer_opts); // TODO : add something to let modules register their options - mp_register_options(mconfig); - parse_cfgfiles(mconfig); + mp_register_options(mp_data->mconfig); + parse_cfgfiles(mp_data->mconfig); - if(m_config_parse_command_line(mconfig, argc, argv, envp) < 0) exit(1); // error parsing cmdline + if(m_config_parse_command_line(mp_data->mconfig, argc, argv, envp) < 0) exit(1); // error parsing cmdline if(!mp_conf.xp) { MSG_ERR("Error: detected option: -core.xp=0\n" @@ -2352,7 +2326,7 @@ else playtree->flags&=~PLAY_TREE_RND; playtree = play_tree_cleanup(playtree); if(playtree) { - playtree_iter = play_tree_iter_new(playtree,mconfig); + playtree_iter = play_tree_iter_new(playtree,mp_data->mconfig); if(playtree_iter) { if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { play_tree_iter_free(playtree_iter); @@ -2393,7 +2367,7 @@ // We must enable getch2 here to be able to interrupt network connection // or cache filling - if(!use_stdin && !slave_mode){ + if(!mp_conf.use_stdin && !mp_conf.slave_mode){ getch2_enable(); // prepare stdin for hotkeys... inited_flags|=INITED_GETCH2; } @@ -2452,9 +2426,9 @@ //============ Open DEMUXERS --- DETECT file type ======================= initial_audio_pts=HUGE; - if(!has_audio) mp_conf.audio_id=-2; // do NOT read audio packets... - if(!has_video) mp_conf.video_id=-2; // do NOT read video packets... - if(!has_dvdsub) mp_conf.dvdsub_id=-2;// do NOT read subtitle packets... + if(!mp_conf.has_audio) mp_conf.audio_id=-2; // do NOT read audio packets... + if(!mp_conf.has_video) mp_conf.video_id=-2; // do NOT read video packets... + if(!mp_conf.has_dvdsub) mp_conf.dvdsub_id=-2;// do NOT read subtitle packets... MP_UNIT("demux_open"); @@ -2537,11 +2511,11 @@ if(mp_conf.autoq>0){ /* Auto quality option enabled*/ - output_quality=mpcv_get_quality_max(sh_video); - if(mp_conf.autoq>output_quality) mp_conf.autoq=output_quality; - else output_quality=mp_conf.autoq; - MSG_V("AutoQ: setting quality to %d\n",output_quality); - mpcv_set_quality(sh_video,output_quality); + mp_data->output_quality=mpcv_get_quality_max(sh_video); + 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,mp_data->output_quality); } vf_showlist(sh_video->vfilter); @@ -2626,7 +2600,7 @@ let thread will decode ahead! We may print something in block window ;) */ - mpxp_seek_time = GetTimerMS(); + mp_data->seek_time = GetTimerMS(); if(sh_video) dae_wait_decoder_outrun(xp_core.video); Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/mplayer.h 2012-10-27 14:53:25 UTC (rev 227) @@ -1,7 +1,8 @@ #ifndef __MPLAYERXP_MAIN #define __MPLAYERXP_MAIN 1 -#include "pthread.h" +#include <pthread.h> +#include "mp_config.h" typedef struct initial_audio_pts_correction_s { @@ -14,6 +15,12 @@ extern float initial_audio_pts; typedef struct mp_conf_s { + int has_video; + int has_audio; + int has_dvdsub; + int use_stdin; + int slave_mode; +// XP-core int xp; /* XP-mode */ int gomp; /* currently it's experimental feature */ char* stream_dump; // dump name @@ -31,22 +38,46 @@ int softsleep; int nortc; // streaming: - int audio_id; - int video_id; - int dvdsub_id; - int vobsub_id; - char* audio_lang; - char* dvdsub_lang; - char* spudec_ifo; + int audio_id; + int video_id; + int dvdsub_id; + int vobsub_id; + char* audio_lang; + char* dvdsub_lang; + char* spudec_ifo; + unsigned force_srate; // seek: char* seek_to_sec; long long int seek_to_byte; int loop_times; int shuffle_playback; int play_n_frames; +/* codecs: */ + char* audio_codec; /* override audio codec */ + char* video_codec; /* override video codec */ + char* audio_family; /* override audio codec family */ + char* video_family; /* override video codec family */ +// drivers: + char* video_driver; //"mga"; // default + char* audio_driver; +// sub: + char* font_name; + float font_factor; + char* sub_name; + float sub_fps; + int sub_auto; + char* vobsub_name; }mp_conf_t; extern mp_conf_t mp_conf; +/* non-configurable through command line stuff */ +typedef struct mp_data_s { + int seek_time; + int output_quality; + any_t* mconfig; +}mp_data_t; +extern mp_data_t* mp_data; + extern unsigned mplayer_accel; extern int use_pts_fix2; Modified: mplayerxp/postproc/vf_menu.c =================================================================== --- mplayerxp/postproc/vf_menu.c 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/postproc/vf_menu.c 2012-10-27 14:53:25 UTC (rev 227) @@ -228,11 +228,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) { -#ifdef HAVE_FREETYPE +#ifdef HAVE_FREETYPE // here is the right place to get screen dimensions if (force_load_font) { force_load_font = 0; - load_font_ft(width,height,&vo_font,font_name); + load_font_ft(width,height,&vo_font,mp_conf.font_name); } #endif if(outfmt == IMGFMT_MPEGPES) vf->priv->passthrough = 1; Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-27 14:01:14 UTC (rev 226) +++ mplayerxp/xmp_core.c 2012-10-27 14:53:25 UTC (rev 227) @@ -176,7 +176,6 @@ extern volatile int xp_drop_frame; extern volatile unsigned xp_drop_frame_cnt; -extern int output_quality; extern volatile float xp_screen_pts; volatile int dec_ahead_can_aseek=0; /* It is safe to seek audio */ @@ -193,7 +192,6 @@ extern int sof_seek_pos; /* the movie at end of file :( */ extern int decore_audio( int xp_id ); -extern int mpxp_seek_time; extern void update_osd( float v_pts ); @@ -381,7 +379,7 @@ int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ - if(cur_time - mpxp_seek_time > (xp_core.num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); + if(cur_time - mp_data->seek_time > (xp_core.num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); } /* if( mp_conf.frame_dropping ) */ if(!finite(v_pts)) MSG_WARN("Bug of demuxer! Value of video pts=%f\n",v_pts); #if 0 @@ -399,18 +397,18 @@ if(xp_n_frame_to_drop) drop_param=mp_conf.frame_dropping; else drop_param=0; /* decode: */ - if(output_quality) { + if(mp_data->output_quality) { unsigned total = xp_core.num_v_buffs/2; unsigned distance = dae_get_decoder_outrun(xp_core.video); int our_quality; - our_quality = output_quality*distance/total; + our_quality = mp_data->output_quality*distance/total; if(drop_param) mpcv_set_quality(sh_video,0); else if(mp_conf.autoq) mpcv_set_quality(sh_video,our_quality>0?our_quality:0); } blit_frame=mpcv_decode(sh_video,start,in_size,drop_param,v_pts); - if(output_quality) { - if(drop_param) mpcv_set_quality(sh_video,output_quality); + if(mp_data->output_quality) { + if(drop_param) mpcv_set_quality(sh_video,mp_data->output_quality); } if(!blit_frame && drop_param) xp_drop_frame_cnt++; if(blit_frame) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-27 15:04:50
|
Revision: 228 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=228&view=rev Author: nickols_k Date: 2012-10-27 15:04:43 +0000 (Sat, 27 Oct 2012) Log Message: ----------- combine some variables into structures Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/xmp_core.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-27 14:53:25 UTC (rev 227) +++ mplayerxp/cfg-mplayer.h 2012-10-27 15:04:43 UTC (rev 228) @@ -19,10 +19,6 @@ extern int subcc_enabled; -#ifdef USE_OSD -extern int osd_level; -#endif - #ifdef HAVE_AA extern int vo_aa_parseoption(struct config * conf, char *opt, char * param); extern void vo_aa_revertoption(config_t* opt,char* param); @@ -144,7 +140,7 @@ #endif static const config_t osd_config[]={ - {"level", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , NULL, "specifies initial mode of the OSD"}, + {"level", &mp_conf.osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , NULL, "specifies initial mode of the OSD"}, #ifdef USE_OSD {"font", &mp_conf.font_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies an alternative directory of font.desc location"}, {"ffactor", &mp_conf.font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL, "specifies resampling of alphamap of the font"}, Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-27 14:53:25 UTC (rev 227) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-27 15:04:43 UTC (rev 228) @@ -257,11 +257,11 @@ t2=GetTimer();t=t2-t; tt = t*0.000001f; - time_usage.video+=tt; + mp_data->bench->video+=tt; if(mp_conf.benchmark || mp_conf.frame_dropping) { - if(tt > time_usage.max_video) time_usage.max_video=tt; - if(tt < time_usage.min_video) time_usage.min_video=tt; - time_usage.cur_video=tt; + 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(drop_frame) return 0; @@ -270,12 +270,12 @@ t2=GetTimer()-t2; tt=t2*0.000001f; - time_usage.vout+=tt; + mp_data->bench->vout+=tt; if(mp_conf.benchmark || mp_conf.frame_dropping) { - if(tt > time_usage.max_vout) time_usage.max_vout = tt; - if(tt < time_usage.min_vout) time_usage.min_vout = tt; - time_usage.cur_vout=tt; + 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; } return 1; Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-10-27 14:53:25 UTC (rev 227) +++ mplayerxp/libmpdemux/cache2.c 2012-10-27 15:04:43 UTC (rev 228) @@ -266,9 +266,9 @@ if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; tt = t*0.000001f; - time_usage.c2+=tt; - if(tt > time_usage.max_c2) time_usage.max_c2=tt; - if(tt < time_usage.min_c2) time_usage.min_c2=tt; + 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; } if(!cfill) usleep(FILL_USLEEP_TIME); // idle if(priv->state==Pth_Canceling) break; Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-27 14:53:25 UTC (rev 227) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-27 15:04:43 UTC (rev 228) @@ -71,10 +71,10 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - time_usage.demux+=tt; - time_usage.audio_decode_correction=tt; - if(tt > time_usage.max_demux) time_usage.max_demux=tt; - if(tt < time_usage.min_demux) time_usage.min_demux=tt; + 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; } UNLOCK_DEMUXER(); return retval; @@ -93,9 +93,9 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - time_usage.demux+=tt; - if(tt > time_usage.max_demux) time_usage.max_demux=tt; - if(tt < time_usage.min_demux) time_usage.min_demux=tt; + 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; } UNLOCK_DEMUXER(); return retval; @@ -116,10 +116,10 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - time_usage.demux+=tt; - time_usage.audio_decode_correction=tt; - if(tt > time_usage.max_demux) time_usage.max_demux=tt; - if(tt < time_usage.min_demux) time_usage.min_demux=tt; + 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; } UNLOCK_DEMUXER(); return retval; @@ -140,10 +140,10 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - time_usage.demux+=tt; - time_usage.audio_decode_correction=tt; - if(tt > time_usage.max_demux) time_usage.max_demux=tt; - if(tt < time_usage.min_demux) time_usage.min_demux=tt; + 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; } UNLOCK_DEMUXER(); return retval; @@ -171,9 +171,9 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - time_usage.demux+=tt; - if(tt > time_usage.max_demux) time_usage.max_demux=tt; - if(tt < time_usage.min_demux) time_usage.min_demux=tt; + 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; } UNLOCK_DEMUXER(); return retval; Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-27 14:53:25 UTC (rev 227) +++ mplayerxp/mplayer.c 2012-10-27 15:04:43 UTC (rev 228) @@ -82,12 +82,6 @@ #define PT_UP_PREV -3 /************************************************************************** - Config -**************************************************************************/ - -//m_config_t* mconfig; - -/************************************************************************** Decoding ahead **************************************************************************/ #include "xmp_core.h" @@ -152,12 +146,9 @@ //ao_functions_t *audio_out=NULL; /* mp_conf.benchmark: */ -time_usage_t time_usage; static unsigned bench_dropped_frames=0; static float max_av_resync=0; -int osd_level=2; - // A-V sync: static float c_total=0; @@ -193,7 +184,6 @@ #if defined( ARCH_X86 ) || defined(ARCH_X86_64) memset(&x86,-1,sizeof(x86_features_t)); #endif - memset(&time_usage,0,sizeof(time_usage_t)); memset(&mp_conf,0,sizeof(mp_conf_t)); mp_conf.xp=XP_VAPlay; mp_conf.audio_id=-1; @@ -212,9 +202,12 @@ mp_conf.has_audio=1; mp_conf.has_video=1; mp_conf.has_dvdsub=1; + mp_conf.osd_level=2; mp_data=random_malloc(sizeof(mp_data_t),1000); memset(mp_data,0,sizeof(mp_data_t)); mp_data->seek_time=-1; + mp_data->bench=malloc(sizeof(time_usage_t)); + memset(mp_data->bench,0,sizeof(time_usage_t)); } static unsigned int inited_flags=0; @@ -521,12 +514,12 @@ pthread_cond_signal( &audio_buffer.wait_buffer_cond ); t=GetTimer()-t; - time_usage.audio_decode+=t*0.000001f; - time_usage.audio_decode-=time_usage.audio_decode_correction; + mp_data->bench->audio_decode+=t*0.000001f; + mp_data->bench->audio_decode-=mp_data->bench->audio_decode_correction; if(mp_conf.benchmark) { - if(t > time_usage.max_audio_decode) time_usage.max_audio_decode = t; - if(t < time_usage.min_audio_decode) time_usage.min_audio_decode = t; + 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; } pthread_mutex_unlock( &audio_buffer.head_mutex ); @@ -692,6 +685,8 @@ MSG_DBG2("max framesize was %d bytes\n",max_framesize); if(mp_data->mconfig) m_config_free(mp_data->mconfig); mp_msg_uninit(); + free(mp_data->bench); + free(mp_data); if(how) exit(0); return; /* Still try coredump!!!*/ } @@ -716,6 +711,8 @@ MSG_DBG2("max framesize was %d bytes\n",max_framesize); if(mp_data->mconfig) m_config_free(mp_data->mconfig); mp_msg_uninit(); + free(mp_data->bench); + free(mp_data); exit(0); } @@ -999,12 +996,12 @@ MP_UNIT("play_audio"); // Leave AUDIO decoder module t=GetTimer()-t; tt = t*0.000001f; - time_usage.audio+=tt; + mp_data->bench->audio+=tt; if(mp_conf.benchmark) { - if(tt > time_usage.max_audio) time_usage.max_audio = tt; - if(tt < time_usage.min_audio) time_usage.min_audio = tt; - time_usage.cur_audio=tt; + 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(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; @@ -1059,13 +1056,13 @@ static char osd_text_buffer[64]; static int osd_last_pts=-303; //================= Update OSD ==================== - if(osd_level>=2){ - int pts=(osd_level==3&&demuxer->movi_length!=UINT_MAX)?demuxer->movi_length-v_pts:v_pts; - int addon=(osd_level==3&&demuxer->movi_length!=UINT_MAX)?-1:1; + if(mp_conf.osd_level>=2){ + int pts=(mp_conf.osd_level==3&&demuxer->movi_length!=UINT_MAX)?demuxer->movi_length-v_pts:v_pts; + int addon=(mp_conf.osd_level==3&&demuxer->movi_length!=UINT_MAX)?-1:1; char osd_text_tmp[64]; if(pts==osd_last_pts-addon) { - if(osd_level==3&&demuxer->movi_length!=UINT_MAX) ++pts; + if(mp_conf.osd_level==3&&demuxer->movi_length!=UINT_MAX) ++pts; else --pts; } else osd_last_pts=pts; @@ -1098,9 +1095,9 @@ MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d [frms: [%i]]\n", a_pts-delay,v_pts,AV_delay,c_total ,xp_core.video->num_played_frames,xp_core.video->num_decoded_frames - ,(v_pts>0.5)?(int)(100.0*time_usage.video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*time_usage.vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)v_pts):0 + ,(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 ,dae_curr_vplayed() ); @@ -1116,18 +1113,18 @@ ,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*time_usage.video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*time_usage.vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)v_pts):0 + ,(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 ); } 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*time_usage.video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*time_usage.vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)v_pts):0 + ,(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 ); fflush(stdout); @@ -1293,11 +1290,11 @@ MSG_D("\ndec_ahead_main: schedule %u on screen\n",player_idx); t2=GetTimer()-t2; tt = t2*0.000001f; - time_usage.vout+=tt; + mp_data->bench->vout+=tt; if(mp_conf.benchmark) { /* we need compute draw_slice+change_frame here */ - time_usage.cur_vout+=tt; - if((time_usage.cur_video+time_usage.cur_vout+time_usage.cur_audio)*sh_video->fps > 1) + mp_data->bench->cur_vout+=tt; + if((mp_data->bench->cur_video+mp_data->bench->cur_vout+mp_data->bench->cur_audio)*sh_video->fps > 1) bench_dropped_frames ++; } } @@ -1396,7 +1393,7 @@ #ifdef USE_OSD // Set OSD: - if(osd_level){ + if(mp_conf.osd_level){ int len=((demuxer->movi_end-demuxer->movi_start)>>8); if (len>0){ if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; @@ -1410,7 +1407,7 @@ c_total=0; 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 - time_usage.audio=0; time_usage.audio_decode=0; time_usage.video=0; time_usage.vout=0; + 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 @@ -1442,42 +1439,42 @@ static void init_benchmark(void) { - time_usage.max_audio=0; time_usage.max_video=0; time_usage.max_vout=0; - time_usage.min_audio=HUGE; time_usage.min_video=HUGE; time_usage.min_vout=HUGE; + 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; - time_usage.min_audio_decode=HUGE; - time_usage.max_audio_decode=0; + mp_data->bench->min_audio_decode=HUGE; + mp_data->bench->max_audio_decode=0; bench_dropped_frames=0; - time_usage.max_demux=0; - time_usage.demux=0; - time_usage.min_demux=HUGE; + mp_data->bench->max_demux=0; + mp_data->bench->demux=0; + mp_data->bench->min_demux=HUGE; - time_usage.cur_video=0; - time_usage.cur_vout=0; - time_usage.cur_audio=0; + mp_data->bench->cur_video=0; + mp_data->bench->cur_vout=0; + mp_data->bench->cur_audio=0; max_av_resync=0; } static void show_benchmark(void) { - double tot=(time_usage.video+time_usage.vout+time_usage.audio+time_usage.audio_decode+time_usage.demux+time_usage.c2); + 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; - time_usage.total_start=GetTimer()-time_usage.total_start; - total_time_usage = (float)time_usage.total_start*0.000001; + 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", - time_usage.video,time_usage.vout,time_usage.audio+time_usage.audio_decode, - time_usage.demux,time_usage.c2,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,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*time_usage.video/total_time_usage, - 100.0*time_usage.vout/total_time_usage, - 100.0*(time_usage.audio+time_usage.audio_decode)/total_time_usage, - 100.0*time_usage.demux/total_time_usage, - 100.0*time_usage.c2/total_time_usage, + 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); MSG_INFO("\nREAL RESULTS: from %u was dropped=%u\n" ,our_n_frames,xp_drop_frame_cnt); @@ -1489,12 +1486,12 @@ if( mp_conf.xp <= XP_Video ) MSG_STATUS("A:%6.1f %4.1f%%\r" ,sh_audio->timer-ao_get_delay(ao_data) - ,(sh_audio->timer>0.5)?100.0*(time_usage.audio+time_usage.audio_decode)/(double)sh_audio->timer:0 + ,(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*(time_usage.audio+time_usage.audio_decode)/(double)sh_audio->timer:0 + ,(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() ); } @@ -1978,7 +1975,7 @@ if(osd_function==OSD_PAUSE||osd_function==OSD_DVDMENU) { mp_cmd_t* cmd; if (vo_inited && sh_video) { - if(osd_level>1 && !*in_pause) { + if(mp_conf.osd_level>1 && !*in_pause) { *in_pause = 1; return -1; } @@ -2113,9 +2110,9 @@ if(sh_video) { int v = cmd->args[0].v.i; if(v < 0) - osd_level=(osd_level+1)%4; + mp_conf.osd_level=(mp_conf.osd_level+1)%4; else - osd_level= v > 3 ? 3 : v; + mp_conf.osd_level= v > 3 ? 3 : v; } break; case MP_CMD_MUTE: mixer_mute(); @@ -2127,7 +2124,7 @@ else mixer_decvolume(); #ifdef USE_OSD - if(osd_level){ + if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec vo_data->osd_progbar_type=OSD_VOLUME; vo_data->osd_progbar_value=(mixer_getbothvolume()*256.0)/100.0; @@ -2143,7 +2140,7 @@ if(v_cont < -100) v_cont = -100; if(mpcv_set_colors(sh_video,VO_EC_CONTRAST,v_cont)){ #ifdef USE_OSD - if(osd_level){ + if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec vo_data->osd_progbar_type=OSD_CONTRAST; vo_data->osd_progbar_value=((v_cont)<<8)/100; @@ -2161,7 +2158,7 @@ if(v_bright < -100) v_bright = -100; if(mpcv_set_colors(sh_video,VO_EC_BRIGHTNESS,v_bright)){ #ifdef USE_OSD - if(osd_level){ + if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec vo_data->osd_progbar_type=OSD_BRIGHTNESS; vo_data->osd_progbar_value=((v_bright)<<8)/100; @@ -2179,7 +2176,7 @@ if(v_hue < -100) v_hue = -100; if(mpcv_set_colors(sh_video,VO_EC_HUE,v_hue)){ #ifdef USE_OSD - if(osd_level){ + if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec vo_data->osd_progbar_type=OSD_HUE; vo_data->osd_progbar_value=((v_hue)<<8)/100; @@ -2197,7 +2194,7 @@ if(v_saturation < -100) v_saturation = -100; if(mpcv_set_colors(sh_video,VO_EC_SATURATION,v_saturation)){ #ifdef USE_OSD - if(osd_level){ + if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec vo_data->osd_progbar_type=OSD_SATURATION; vo_data->osd_progbar_value=((v_saturation)<<8)/100; @@ -2528,7 +2525,7 @@ //================== MAIN: ========================== main: - if(!sh_video) osd_level = 0; + if(!sh_video) mp_conf.osd_level = 0; else if(sh_video->fps<60) osd.info_factor=sh_video->fps/2; /* 0.5 sec */ //================ SETUP AUDIO ========================== @@ -2583,9 +2580,9 @@ if(!mp_conf.nortc && rtc_fd>0) { close(rtc_fd); rtc_fd=-1; } MSG_V("Using %s timing\n",rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()"); - time_usage.total_start=GetTimer(); - time_usage.audio=0; time_usage.audio_decode=0; time_usage.video=0; - time_usage.audio_decode_correction=0; + 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; if(mp_conf.benchmark) init_benchmark(); Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-10-27 14:53:25 UTC (rev 227) +++ mplayerxp/mplayer.h 2012-10-27 15:04:43 UTC (rev 228) @@ -61,6 +61,7 @@ char* video_driver; //"mga"; // default char* audio_driver; // sub: + int osd_level; char* font_name; float font_factor; char* sub_name; @@ -70,25 +71,6 @@ }mp_conf_t; extern mp_conf_t mp_conf; -/* non-configurable through command line stuff */ -typedef struct mp_data_s { - int seek_time; - int output_quality; - any_t* mconfig; -}mp_data_t; -extern mp_data_t* mp_data; - -extern unsigned mplayer_accel; -extern int use_pts_fix2; - -extern void exit_player(char* how); -extern void mpxp_resync_audio_stream(void); -extern void mpxp_reset_vcache(void); -extern void __exit_sighandler(void); - -extern void mplayer_put_key(int code); -extern int mplayer_get_key(void); - /* Benchmarking */ typedef struct time_usage_s { double video; @@ -112,5 +94,24 @@ double min_vout; double total_start; }time_usage_t; -extern time_usage_t time_usage; + +/* non-configurable through command line stuff */ +typedef struct mp_data_s { + int seek_time; + int output_quality; + any_t* mconfig; + time_usage_t*bench; +}mp_data_t; +extern mp_data_t* mp_data; + +extern unsigned mplayer_accel; +extern int use_pts_fix2; + +extern void exit_player(char* how); +extern void mpxp_resync_audio_stream(void); +extern void mpxp_reset_vcache(void); +extern void __exit_sighandler(void); + +extern void mplayer_put_key(int code); +extern int mplayer_get_key(void); #endif Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-27 14:53:25 UTC (rev 227) +++ mplayerxp/xmp_core.c 2012-10-27 15:04:43 UTC (rev 228) @@ -233,7 +233,7 @@ unsigned rc=0; static float prev_delta=64; float delta,max_frame_delay;/* delay for decoding of top slow frame */ - max_frame_delay = time_usage.max_video+time_usage.max_vout; + max_frame_delay = mp_data->bench->max_video+mp_data->bench->max_vout; /* TODO: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 09:41:01
|
Revision: 239 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=239&view=rev Author: nickols_k Date: 2012-10-29 09:40:53 +0000 (Mon, 29 Oct 2012) Log Message: ----------- combine static variables into structure Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/mplayer.h Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-29 09:00:56 UTC (rev 238) +++ mplayerxp/mplayer.c 2012-10-29 09:40:53 UTC (rev 239) @@ -69,11 +69,22 @@ /************************************************************************** - Playtree + Private data **************************************************************************/ +#define INITED_VO 0x00000001 +#define INITED_AO 0x00000002 +#define INITED_GETCH2 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_ALL 0xFFFFFFFF -static play_tree_t* playtree; - #define PT_NEXT_ENTRY 1 #define PT_PREV_ENTRY -1 #define PT_NEXT_SRC 2 @@ -81,6 +92,23 @@ #define PT_UP_NEXT 3 #define PT_UP_PREV -3 +typedef struct priv_s { + unsigned inited_flags; + int vo_inited; + int ao_inited; + unsigned mpxp_after_seek; + int osd_show_framedrop; + int osd_function; +/* mp_conf.benchmark: */ + unsigned bench_dropped_frames; + float max_av_resync; +// A-V sync: + float c_total; +// priv data + demuxer_t* demuxer; + play_tree_t*playtree; +}priv_t; + /************************************************************************** Decoding ahead **************************************************************************/ @@ -88,33 +116,16 @@ volatile unsigned xp_drop_frame_cnt=0; float xp_screen_pts; -static unsigned mpxp_after_seek=0; int audio_eof=0; + demux_stream_t *d_video=NULL; -static int osd_show_framedrop = 0; -static int osd_function=OSD_PLAY; - demux_stream_t *d_audio=NULL; demux_stream_t *d_dvdsub=NULL; -static demuxer_t *demuxer=NULL; ao_data_t* ao_data=NULL; vo_data_t* vo_data=NULL; pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; -static int vo_inited=0; -static int ao_inited=0; -//ao_functions_t *audio_out=NULL; - -/* mp_conf.benchmark: */ -static unsigned bench_dropped_frames=0; -static float max_av_resync=0; - -// A-V sync: -static float c_total=0; - -static uint32_t our_n_frames=0; - /************************************************************************ Special case: inital audio PTS: example: some movies has a_pts = v_pts = XX sec @@ -174,6 +185,16 @@ #endif static void mpxp_init_structs(void) { + mp_data=random_malloc(sizeof(mp_data_t),1000); + memset(mp_data,0,sizeof(mp_data_t)); + mp_data->seek_time=-1; + mp_data->bench=malloc(sizeof(time_usage_t)); + mp_data->use_pts_fix2=-1; + memset(mp_data->bench,0,sizeof(time_usage_t)); + mp_data->priv=malloc(sizeof(priv_t)); + memset(mp_data->priv,0,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 @@ -197,28 +218,14 @@ mp_conf.has_dvdsub=1; mp_conf.osd_level=2; mp_conf.playbackspeed_factor=1.0; - mp_data=random_malloc(sizeof(mp_data_t),1000); - memset(mp_data,0,sizeof(mp_data_t)); - mp_data->seek_time=-1; - mp_data->bench=malloc(sizeof(time_usage_t)); - mp_data->use_pts_fix2=-1; - memset(mp_data->bench,0,sizeof(time_usage_t)); } -static unsigned int inited_flags=0; -#define INITED_VO 0x00000001 -#define INITED_AO 0x00000002 -#define INITED_GETCH2 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_ALL 0xFFFFFFFF +static void mpxp_uninit_structs(void) { + free(mp_data->bench); + free(mp_data->priv); + free(mp_data); + mp_data=NULL; +} /* XP audio buffer */ typedef struct audio_buffer_index_s { @@ -571,85 +578,86 @@ void uninit_player(unsigned int mask){ - stream_t* stream=demuxer->stream; - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + priv_t*priv=mp_data->priv; + stream_t* stream=priv->demuxer->stream; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; + sh_video_t* sh_video=priv->demuxer->video->sh; fflush(stdout); fflush(stderr); - mask=inited_flags&mask; + mask=priv->inited_flags&mask; MP_UNIT("uninit_xp"); xmp_uninit_engine(0); if (mask&INITED_SPUDEC){ - inited_flags&=~INITED_SPUDEC; + priv->inited_flags&=~INITED_SPUDEC; MP_UNIT("uninit_spudec"); spudec_free(vo_data->spudec); vo_data->spudec=NULL; } if (mask&INITED_VOBSUB){ - inited_flags&=~INITED_VOBSUB; + priv->inited_flags&=~INITED_VOBSUB; MP_UNIT("uninit_vobsub"); vobsub_close(vo_data->vobsub); vo_data->vobsub=NULL; } if(mask&INITED_VCODEC){ - inited_flags&=~INITED_VCODEC; + priv->inited_flags&=~INITED_VCODEC; MP_UNIT("uninit_vcodec"); mpcv_uninit(sh_video); sh_video=NULL; } if(mask&INITED_VO){ - inited_flags&=~INITED_VO; + priv->inited_flags&=~INITED_VO; MP_UNIT("uninit_vo"); vo_uninit(vo_data); } if(mask&INITED_ACODEC){ - inited_flags&=~INITED_ACODEC; + priv->inited_flags&=~INITED_ACODEC; MP_UNIT("uninit_acodec"); mpca_uninit(sh_audio); sh_audio=NULL; } if(mask&INITED_AO){ - inited_flags&=~INITED_AO; + priv->inited_flags&=~INITED_AO; MP_UNIT("uninit_ao"); ao_uninit(ao_data); } if(mask&INITED_GETCH2){ - inited_flags&=~INITED_GETCH2; + priv->inited_flags&=~INITED_GETCH2; MP_UNIT("uninit_getch2"); // restore terminal: getch2_disable(); } if(mask&INITED_DEMUXER){ - inited_flags&=~INITED_DEMUXER; - MP_UNIT("free_demuxer"); - FREE_DEMUXER(demuxer); + priv->inited_flags&=~INITED_DEMUXER; + MP_UNIT("free_priv->demuxer"); + free_demuxer(priv->demuxer); } if(mask&INITED_STREAM){ - inited_flags&=~INITED_STREAM; + priv->inited_flags&=~INITED_STREAM; MP_UNIT("uninit_stream"); if(stream) free_stream(stream); stream=NULL; } if(mask&INITED_INPUT){ - inited_flags&=~INITED_INPUT; + priv->inited_flags&=~INITED_INPUT; MP_UNIT("uninit_input"); mp_input_uninit(); } #ifdef USE_SUB if(mask&INITED_SUBTITLE){ - inited_flags&=~INITED_SUBTITLE; + priv->inited_flags&=~INITED_SUBTITLE; MP_UNIT("sub_free"); mp_input_uninit(); sub_free( mp_data->subtitles ); @@ -663,28 +671,28 @@ void exit_player(char* how){ - fflush(stdout); - fflush(stderr); - uninit_player(INITED_ALL); + fflush(stdout); + fflush(stderr); + uninit_player(INITED_ALL); - MP_UNIT("exit_player"); + MP_UNIT("exit_player"); - sws_uninit(); - if(how) MSG_HINT(MSGTR_Exiting,how); - MSG_DBG2("max framesize was %d bytes\n",max_framesize); - if(mp_data->mconfig) m_config_free(mp_data->mconfig); - mp_msg_uninit(); - free(mp_data->bench); - free(mp_data); - if(how) exit(0); - return; /* Still try coredump!!!*/ + sws_uninit(); + if(how) MSG_HINT(MSGTR_Exiting,how); + 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(how) exit(0); + return; /* Still try coredump!!!*/ } static void soft_exit_player(void) { - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + 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); @@ -702,8 +710,7 @@ MSG_DBG2("max framesize was %d bytes\n",max_framesize); if(mp_data->mconfig) m_config_free(mp_data->mconfig); mp_msg_uninit(); - free(mp_data->bench); - free(mp_data); + mpxp_uninit_structs(); exit(0); } @@ -764,25 +771,25 @@ // The function return a new value for eof. static int libmpdemux_was_interrupted(int eof) { - mp_cmd_t* cmd; - if((cmd = mp_input_get_cmd(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; + mp_cmd_t* cmd; + if((cmd = mp_input_get_cmd(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; } unsigned xp_num_cpu; @@ -931,10 +938,11 @@ list_codecs(1); } -int decore_audio( int _xp_id ) +int decore_audio( unsigned _xp_id ) { - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + 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 eof = 0; /*========================== PLAY AUDIO ============================*/ while(sh_audio){ @@ -978,7 +986,7 @@ else { MSG_V("audio_stream_eof\n"); - inited_flags&=~INITED_AO; + priv->inited_flags&=~INITED_AO; MP_UNIT("uninit_ao"); ao_uninit(ao_data); } @@ -1046,29 +1054,30 @@ void update_osd( float v_pts ) { -static char osd_text_buffer[64]; -static int osd_last_pts=-303; + 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&&demuxer->movi_length!=UINT_MAX)?demuxer->movi_length-v_pts:v_pts; - int addon=(mp_conf.osd_level==3&&demuxer->movi_length!=UINT_MAX)?-1:1; + 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&&demuxer->movi_length!=UINT_MAX) ++pts; + 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 (osd_show_framedrop) { + if (priv->osd_show_framedrop) { sprintf(osd_text_tmp, "Framedrop: %s",mp_conf.frame_dropping>1?"hard":mp_conf.frame_dropping?"vo":"none"); - osd_show_framedrop--; + priv->osd_show_framedrop--; } else #ifdef ENABLE_DEC_AHEAD_DEBUG - if(mp_conf.verbose) sprintf(osd_text_tmp,"%c %02d:%02d:%02d",osd_function,pts/3600,(pts/60)%60,pts%60); - else sprintf(osd_text_tmp,"%c %02d:%02d:%02d",osd_function,pts/3600,(pts/60)%60,pts%60); + 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",osd_function,pts/3600,(pts/60)%60,pts%60); + 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); @@ -1085,8 +1094,9 @@ //================= Update OSD ==================== static void __show_status_line(float a_pts,float v_pts,float delay,float AV_delay) { + priv_t*priv=mp_data->priv; MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d [frms: [%i]]\n", - a_pts-delay,v_pts,AV_delay,c_total + a_pts-delay,v_pts,AV_delay,priv->c_total ,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 @@ -1098,7 +1108,8 @@ } static void show_status_line_no_apts(float v_pts) { - sh_audio_t* sh_audio=demuxer->audio->sh; + priv_t*priv=mp_data->priv; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; if(mp_conf.av_sync_pts && sh_audio && (!audio_eof || ao_get_delay(ao_data))) { float a_pts = sh_audio->timer-ao_get_delay(ao_data); MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" @@ -1126,8 +1137,9 @@ static void vplayer_check_chapter_change(frame_attr_t* shva_prev,float v_pts) { - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + priv_t*priv=mp_data->priv; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; + sh_video_t* sh_video=priv->demuxer->video->sh; if(mp_data->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) @@ -1152,8 +1164,9 @@ static float vplayer_compute_sleep_time(frame_attr_t* shva_prev) { - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + priv_t*priv=mp_data->priv; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; + sh_video_t* sh_video=priv->demuxer->video->sh; float sleep_time=0; if(sh_audio) { /* FIXME!!! need the same technique to detect audio_eof as for video_eof! @@ -1173,9 +1186,10 @@ return sleep_time; } -static int vplayer_do_sleep(int rtc_fd,float sleep_time,float v_pts) +static int vplayer_do_sleep(int rtc_fd,float sleep_time) { - sh_audio_t* sh_audio=demuxer->audio->sh; + priv_t*priv=mp_data->priv; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; #define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ #define XP_MIN_AUDIOBUFF 0.05 #define XP_MAX_TIMESLICE 0.1 @@ -1215,8 +1229,9 @@ static float max_pts_correction=0; int mpxp_play_video( int rtc_fd ) { - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + priv_t*priv=mp_data->priv; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; + sh_video_t* sh_video=priv->demuxer->video->sh; float v_pts=0; float sleep_time=0; int can_blit=0; @@ -1263,8 +1278,8 @@ static int drop_message=0; if(!drop_message && xp_core.video->num_slow_frames > 50) { drop_message=1; - if(mpxp_after_seek) mpxp_after_seek--; - else MSG_WARN(MSGTR_SystemTooSlow); + if(priv->mpxp_after_seek) priv->mpxp_after_seek--; + else MSG_WARN(MSGTR_SystemTooSlow); } MSG_D("\ndec_ahead_main: stalling: %i %i\n",dae_cuurr_vplayed(),dae_curr_decoded()); /* Don't burn CPU here! With using of v_pts for A-V sync we will enter @@ -1280,9 +1295,9 @@ MP_UNIT("sleep"); GetRelativeTime(); /* reset timer */ sleep_time=vplayer_compute_sleep_time(&shva_prev); - if(mp_conf.benchmark && sleep_time < 0 && sleep_time < max_av_resync) max_av_resync=sleep_time; + if(mp_conf.benchmark && sleep_time < 0 && sleep_time < priv->max_av_resync) priv->max_av_resync=sleep_time; if(!(vo_data->flags&256)){ /* flag 256 means: libvo driver does its timing (dvb card) */ - if(!vplayer_do_sleep(rtc_fd,sleep_time,v_pts)) return 0; + if(!vplayer_do_sleep(rtc_fd,sleep_time)) return 0; } player_idx=dae_next_played(xp_core.video); @@ -1296,7 +1311,7 @@ /* we need compute draw_slice+change_frame here */ mp_data->bench->cur_vout+=tt; if((mp_data->bench->cur_video+mp_data->bench->cur_vout+mp_data->bench->cur_audio)*sh_video->fps > 1) - bench_dropped_frames ++; + priv->bench_dropped_frames ++; } } MP_UNIT(NULL); @@ -1342,7 +1357,7 @@ sh_audio->timer+=x; if(mp_conf.xp>=XP_VAPlay) pthread_mutex_unlock(&audio_timer_mutex); - c_total+=x; + priv->c_total+=x; if(mp_conf.benchmark && mp_conf.verbose) __show_status_line(a_pts,v_pts,delay,AV_delay); } } else { @@ -1352,15 +1367,16 @@ return 0; } -void mpxp_seek( int _xp_id, osd_args_t *osd,const seek_args_t* seek) +void mpxp_seek( osd_args_t *osd,const seek_args_t* seek) { - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + 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 seek_rval=1; audio_eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { - seek_rval=demux_seek_r(demuxer,seek); - mpxp_after_seek=25; /* 1 sec delay */ + seek_rval=demux_seek_r(priv->demuxer,seek); + priv->mpxp_after_seek=25; /* 1 sec delay */ } if(seek_rval){ mp_data->seek_time = GetTimerMS(); @@ -1397,17 +1413,17 @@ #ifdef USE_OSD // Set OSD: if(mp_conf.osd_level){ - int len=((demuxer->movi_end-demuxer->movi_start)>>8); + 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=(demuxer->filepos-demuxer->movi_start)/len; + vo_data->osd_progbar_value=(priv->demuxer->filepos-priv->demuxer->movi_start)/len; vo_osd_changed(OSDTYPE_PROGBAR); } } #endif if(sh_video) { - c_total=0; + priv->c_total=0; 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; @@ -1424,16 +1440,17 @@ void mpxp_reset_vcache(void) { - sh_video_t* sh_video=demuxer->video->sh; - unsigned i; + 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(main_id,NULL,&seek); + if(sh_video) mpxp_seek(NULL,&seek); return; } void mpxp_resync_audio_stream(void) { - sh_audio_t* sh_audio=demuxer->audio->sh; + priv_t*priv=mp_data->priv; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; mpca_resync_stream(sh_audio); } @@ -1444,26 +1461,28 @@ 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; + priv_t*priv=mp_data->priv; + 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; - bench_dropped_frames=0; + mp_data->bench->min_audio_decode=HUGE; + mp_data->bench->max_audio_decode=0; + priv->bench_dropped_frames=0; - mp_data->bench->max_demux=0; - mp_data->bench->demux=0; - mp_data->bench->min_demux=HUGE; + 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; + mp_data->bench->cur_video=0; + mp_data->bench->cur_vout=0; + mp_data->bench->cur_audio=0; - max_av_resync=0; + priv->max_av_resync=0; } static void show_benchmark(void) { + priv_t*priv=mp_data->priv; 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; @@ -1481,14 +1500,16 @@ 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" - ,our_n_frames,xp_drop_frame_cnt); - MSG_INFO("\nMax. A-V resync is: %f\n",fabs(max_av_resync)); + ,nframes,xp_drop_frame_cnt); + MSG_INFO("\nMax. A-V resync is: %f\n",fabs(priv->max_av_resync)); } static void show_benchmark_status(void) { - sh_audio_t* sh_audio=demuxer->audio->sh; + priv_t*priv=mp_data->priv; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; if( mp_conf.xp <= XP_Video ) MSG_STATUS("A:%6.1f %4.1f%%\r" ,sh_audio->timer-ao_get_delay(ao_data) @@ -1507,6 +1528,7 @@ static void mpxp_init_keyboard_fifo(void) { + priv_t*priv=mp_data->priv; #ifdef HAVE_TERMCAP load_termcap(NULL); // load key-codes #endif @@ -1520,7 +1542,7 @@ mp_input_add_cmd_fd(0,1,NULL,NULL); else if(!mp_conf.use_stdin) mp_input_add_key_fd(0,1,NULL,NULL); - inited_flags|=INITED_INPUT; + priv->inited_flags|=INITED_INPUT; } static void mpxp_init_osd(void) { @@ -1555,6 +1577,7 @@ } static char * mpxp_init_output_subsystems(void) { + priv_t*priv=mp_data->priv; char* rs=NULL; unsigned i; // check video_out driver name: @@ -1569,9 +1592,9 @@ } } MP_UNIT("vo_register"); - vo_inited = (vo_register(vo_data,mp_conf.video_driver)!=NULL)?1:0; + priv->vo_inited = (vo_register(vo_data,mp_conf.video_driver)!=NULL)?1:0; - if(!vo_inited){ + if(!priv->vo_inited){ MSG_FATAL(MSGTR_InvalidVOdriver,mp_conf.video_driver?mp_conf.video_driver:"?"); exit_player(MSGTR_Exit_error); } @@ -1596,8 +1619,8 @@ mp_conf.audio_driver[i] = '\0'; } } - ao_inited=(ao_register(mp_conf.audio_driver)!=NULL)?1:0; - if (!ao_inited){ + priv->ao_inited=(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); } @@ -1605,6 +1628,7 @@ } 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){ @@ -1612,7 +1636,7 @@ if(vo_data->vobsub==NULL) MSG_ERR(MSGTR_CantLoadSub,mp_conf.vobsub_name); else { - inited_flags|=INITED_VOBSUB; + 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); @@ -1628,13 +1652,14 @@ if(vo_data->vobsub) { mp_conf.sub_auto=0; // don't do autosub for textsubs if vobsub found - inited_flags|=INITED_VOBSUB; + priv->inited_flags|=INITED_VOBSUB; } return forced_subs_only; } static int mpxp_handle_playlist(const char *filename) { - stream_t* stream=demuxer->stream; + priv_t*priv=mp_data->priv; + stream_t* stream=priv->demuxer->stream; int eof=0; play_tree_t* entry; // Handle playlist @@ -1670,7 +1695,8 @@ static void mpxp_init_dvd_nls(void) { /* Add NLS support here */ - stream_t* stream=demuxer->stream; + 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"); @@ -1693,8 +1719,9 @@ } static void mpxp_print_stream_formats(void) { - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + 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]:"); @@ -1721,14 +1748,15 @@ } static void mpxp_read_video_properties(void) { - sh_video_t* sh_video=demuxer->video->sh; + priv_t*priv=mp_data->priv; + sh_video_t* sh_video=priv->demuxer->video->sh; 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", - demuxer->file_format,sh_video->fourcc, sh_video->src_w,sh_video->src_h, + 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 */ @@ -1744,8 +1772,9 @@ } static void mpxp_read_subtitles(const char *filename,int forced_subs_only,int stream_dump_type) { - sh_video_t* sh_video=demuxer->video->sh; - stream_t* stream=demuxer->stream; + 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"); @@ -1767,7 +1796,7 @@ } if (vo_data->spudec!=NULL) { - inited_flags|=INITED_SPUDEC; + priv->inited_flags|=INITED_SPUDEC; // Apply current settings for forced subs spudec_set_forced_subs_only(vo_data->spudec,forced_subs_only); } @@ -1785,14 +1814,15 @@ : "default.sub", sh_video->fps ); } if(mp_data->subtitles) { - inited_flags|=INITED_SUBTITLE; + priv->inited_flags|=INITED_SUBTITLE; if(stream_dump_type>1) list_sub_file(mp_data->subtitles); } #endif } static void mpxp_find_acodec(void) { - sh_audio_t* sh_audio=demuxer->audio->sh; + priv_t*priv=mp_data->priv; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; // Go through the codec.conf and find the best codec... sh_audio->codec=NULL; if(mp_conf.audio_family) MSG_INFO(MSGTR_TryForceAudioFmt,mp_conf.audio_family); @@ -1824,7 +1854,8 @@ } static int mpxp_find_vcodec(void) { - sh_video_t* sh_video=demuxer->video->sh; + priv_t*priv=mp_data->priv; + sh_video_t* sh_video=priv->demuxer->video->sh; int rc=0; MP_UNIT("init_video_codec"); /* Go through the codec.conf and find the best codec...*/ @@ -1860,7 +1891,7 @@ MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf")); sh_video = d_video->sh = NULL; rc=-1; - } else inited_flags|=INITED_VCODEC; + } else priv->inited_flags|=INITED_VCODEC; 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); @@ -1868,8 +1899,9 @@ } static int mpxp_configure_audio(void) { - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + 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 rc=0; const ao_info_t *info=ao_get_info(); MP_UNIT("setup_audio"); @@ -1915,7 +1947,7 @@ sh_audio=d_audio->sh=NULL; if(sh_video == NULL) rc=-1; } else { - inited_flags|=INITED_AO; + priv->inited_flags|=INITED_AO; MP_UNIT("af_init"); if(!mpca_init_filters(sh_audio, (int)(sh_audio->samplerate), @@ -1930,8 +1962,9 @@ } static void mpxp_run_ahead_engine(void) { - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + 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); @@ -1948,17 +1981,18 @@ } static void mpxp_print_audio_status(void) { - sh_audio_t* sh_audio=demuxer->audio->sh; + priv_t*priv=mp_data->priv; + sh_audio_t* sh_audio=priv->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=demuxer->movi_length-ipts; + rpts=priv->demuxer->movi_length-ipts; h = ipts/3600; m = (ipts/60)%60; s = ipts%60; - if(demuxer->movi_length!=UINT_MAX) { + if(priv->demuxer->movi_length!=UINT_MAX) { rh = rpts/3600; rm = (rpts/60)%60; rs = rpts%60; @@ -1973,19 +2007,20 @@ #ifdef USE_OSD static int mpxp_paint_osd(int* osd_visible,int* in_pause) { - stream_t* stream=demuxer->stream; - sh_audio_t* sh_audio=demuxer->audio->sh; - sh_video_t* sh_video=demuxer->video->sh; + priv_t*priv=mp_data->priv; + stream_t* stream=priv->demuxer->stream; + sh_audio_t* sh_audio=priv->demuxer->audio->sh; + sh_video_t* sh_video=priv->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 (!((osd_function == OSD_PAUSE)||(osd_function==OSD_DVDMENU))) - osd_function = OSD_PLAY; + if (!((priv->osd_function == OSD_PAUSE)||(priv->osd_function==OSD_DVDMENU))) + priv->osd_function = OSD_PLAY; } } - if(osd_function==OSD_DVDMENU) { + if(priv->osd_function==OSD_DVDMENU) { rect_highlight_t hl; if(stream->driver->control(stream,SCTRL_VID_GET_HILIGHT,&hl)==SCTRL_OK) { osd_set_nav_box (hl.sx, hl.sy, hl.ex, hl.ey); @@ -1993,9 +2028,9 @@ vo_osd_changed (OSDTYPE_DVDNAV); } } - if(osd_function==OSD_PAUSE||osd_function==OSD_DVDMENU) { + if(priv->osd_function==OSD_PAUSE||priv->osd_function==OSD_DVDMENU) { mp_cmd_t* cmd; - if (vo_inited && sh_video) { + if (priv->vo_inited && sh_video) { if(mp_conf.osd_level>1 && !*in_pause) { *in_pause = 1; return -1; @@ -2007,7 +2042,7 @@ fflush(stdout); } - if (ao_inited && sh_audio) { + if (priv->ao_inited && sh_audio) { if( mp_conf.xp >= XP_VAPlay ) { xp_core.in_pause=1; while( !dec_ahead_can_aseek ) usleep(0); @@ -2016,7 +2051,7 @@ } while( (cmd = mp_input_get_cmd(20,1,1)) == NULL) { - if(sh_video && vo_inited) vo_check_events(vo_data); + if(sh_video && priv->vo_inited) vo_check_events(vo_data); usleep(20000); } @@ -2025,15 +2060,15 @@ mp_cmd_free(cmd); } - if(osd_function==OSD_PAUSE) osd_function=OSD_PLAY; - if (ao_inited && sh_audio) { + if(priv->osd_function==OSD_PAUSE) priv->osd_function=OSD_PLAY; + if (priv->ao_inited && sh_audio) { ao_resume(ao_data); // resume audio if( mp_conf.xp >= XP_VAPlay ) { xp_core.in_pause=0; __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); } } - if (vo_inited && sh_video) + if (priv->vo_inited && sh_video) vo_resume(vo_data); // resume video *in_pause=0; (void)GetRelativeTime(); // keep TF around FT in next cycle @@ -2049,8 +2084,9 @@ }input_state_t; static int mpxp_handle_input(seek_args_t* seek,osd_args_t* osd,input_state_t* state) { - stream_t* stream=demuxer->stream; - sh_video_t* sh_video=demuxer->video->sh; + priv_t*priv=mp_data->priv; + stream_t* stream=priv->demuxer->stream; + sh_video_t* sh_video=priv->demuxer->video->sh; int v_bright=0; int v_cont=0; int v_hue=0; @@ -2071,12 +2107,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) osd_function= (v > dae_played_fra(xp_core.video).v_pts) ? OSD_FFW : OSD_REW; + if(sh_video) priv->osd_function= (v > dae_played_fra(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) osd_function= (v > 0) ? OSD_FFW : OSD_REW; + if(sh_video) priv->osd_function= (v > 0) ? OSD_FFW : OSD_REW; seek->secs+= v; } } break; @@ -2086,17 +2122,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(demuxer, demuxer->audio->id+1)); + MSG_INFO("ID_AUDIO_TRACK=%i\n",demuxer_switch_audio_r(priv->demuxer, priv->demuxer->audio->id+1)); break; case MP_CMD_SWITCH_VIDEO : - MSG_INFO("ID_VIDEO_TRACK=%i\n",demuxer_switch_video_r(demuxer, demuxer->video->id+1)); + MSG_INFO("ID_VIDEO_TRACK=%i\n",demuxer_switch_video_r(priv->demuxer, priv->demuxer->video->id+1)); break; case MP_CMD_SWITCH_SUB : - MSG_INFO("ID_SUB_TRACK=%i\n",demuxer_switch_subtitle_r(demuxer, demuxer->sub->id+1)); + MSG_INFO("ID_SUB_TRACK=%i\n",demuxer_switch_subtitle_r(priv->demuxer, priv->demuxer->sub->id+1)); break; case MP_CMD_FRAME_STEP : case MP_CMD_PAUSE : { - osd_function=OSD_PAUSE; + priv->osd_function=OSD_PAUSE; } break; case MP_CMD_SOFT_QUIT : { soft_exit_player(); @@ -2233,7 +2269,7 @@ mp_conf.frame_dropping = (mp_conf.frame_dropping+1)%3; else mp_conf.frame_dropping = v > 2 ? 2 : v; - osd_show_framedrop = osd->info_factor; + priv->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; @@ -2252,10 +2288,10 @@ stream->type|=STREAMTYPE_MENU; state->need_repaint=1; } - osd_function=OSD_DVDMENU; + priv->osd_function=OSD_DVDMENU; if(cmd->args[0].v.i==MP_CMD_DVDNAV_SELECT) { - osd_function=NULL; + priv->osd_function=NULL; state->need_repaint=1; state->after_dvdmenu=1; state->next_file=1; @@ -2308,6 +2344,7 @@ seek_args_t seek_args = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; mpxp_init_structs(); + priv_t*priv=mp_data->priv; vo_data=vo_preinit_structs(); init_signal_handling(); @@ -2319,9 +2356,9 @@ // memset(&vtune,0,sizeof(vo_tune_info_t)); /* Test for cpu capabilities (and corresponding OS support) for optimizing */ - playtree = play_tree_new(); + priv->playtree = play_tree_new(); - mp_data->mconfig = m_config_new(playtree); + mp_data->mconfig = m_config_new(priv->playtree); m_config_register_options(mp_data->mconfig,mplayer_opts); // TODO : add something to let modules register their options mp_register_options(mp_data->mconfig); @@ -2343,11 +2380,11 @@ MSG_ERR("MPlayerXP requires working copy of libswscaler\n"); return 0; } - if(mp_conf.shuffle_playback) playtree->flags|=PLAY_TREE_RND; - else playtree->flags&=~PLAY_TREE_RND; - playtree = play_tree_cleanup(playtree); - if(playtree) { - playtree_iter = play_tree_iter_new(playtree,mp_data->mconfig); + if(mp_conf.shuffle_playback) priv->playtree->flags|=PLAY_TREE_RND; + else priv->playtree->flags&=~PLAY_TREE_RND; + priv->playtree = play_tree_cleanup(priv->playtree); + if(priv->playtree) { + playtree_iter = play_tree_iter_new(priv->playtree,mp_data->mconfig); if(playtree_iter) { if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { play_tree_iter_free(playtree_iter); @@ -2390,7 +2427,7 @@ // or cache filling if(!mp_conf.use_stdin && !mp_conf.slave_mode){ getch2_enable(); // prepare stdin for hotkeys... - inited_flags|=INITED_GETCH2; + priv->inited_flags|=INITED_GETCH2; } ao_subdevice=mpxp_init_output_subsystems(); @@ -2399,17 +2436,19 @@ forced_subs_only=mpxp_init_vobsub(filename); MP_UNIT("mplayer"); - if(!input_state.after_dvdmenu && demuxer) { - free_stream(demuxer->stream); - demuxer->stream=NULL; - free_demuxer(demuxer); - demuxer=NULL; + 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; } d_audio=NULL; d_video=NULL; - if(demuxer) { - demuxer->audio->sh=NULL; - demuxer->video->sh=NULL; + if(priv->demuxer) { + priv->demuxer->audio->sh=NULL; + priv->demuxer->video->sh=NULL; } //============ Open & Sync STREAM --- fork cache2 ==================== stream_dump_type=0; @@ -2426,7 +2465,7 @@ eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY); goto goto_next_file; } - inited_flags|=INITED_STREAM; + priv->inited_flags|=INITED_STREAM; if(stream->type & STREAMTYPE_TEXT) { eof=mpxp_handle_playlist(filename); @@ -2445,7 +2484,7 @@ // DUMP STREAMS: if(stream_dump_type==1) dump_stream(stream); -//============ Open DEMUXERS --- DETECT file type ======================= +//============ Open priv->demuxerS --- DETECT file type ======================= if(mp_conf.playbackspeed_factor!=1.0) mp_conf.has_audio=0; initial_audio_pts=HUGE; if(!mp_conf.has_audio) mp_conf.audio_id=-2; // do NOT read audio packets... @@ -2454,14 +2493,14 @@ MP_UNIT("demux_open"); - if(!input_state.after_dvdmenu) demuxer=demux_open(stream,file_format,mp_conf.audio_id,mp_conf.video_id,mp_conf.dvdsub_id); - if(!demuxer) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR - inited_flags|=INITED_DEMUXER; + 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; input_state.after_dvdmenu=0; - d_audio=demuxer->audio; - d_video=demuxer->video; - d_dvdsub=demuxer->sub; + d_audio=priv->demuxer->audio; + d_video=priv->demuxer->video; + d_dvdsub=priv->demuxer->sub; /* Add NLS support here */ mpxp_init_dvd_nls(); @@ -2471,8 +2510,8 @@ sh_audio_t* sh_audio; sh_video_t* sh_video; - sh_audio=demuxer->audio->sh; - sh_video=demuxer->video->sh; + sh_audio=priv->demuxer->audio->sh; + sh_video=priv->demuxer->video->sh; mpxp_print_stream_formats(); @@ -2494,7 +2533,7 @@ if(sh_audio) mpxp_find_acodec(); if(stream_dump_type>1) { - dump_mux_init(demuxer); + dump_mux_init(priv->demuxer); goto dump_file; } @@ -2515,11 +2554,11 @@ } } - if(sh_audio) inited_flags|=INITED_ACODEC; + if(sh_audio) priv->inited_flags|=INITED_ACODEC; if(stream_dump_type>1) { dump_file: - dump_mux(demuxer,mp_conf.av_sync_pts,mp_conf.seek_to_sec,mp_conf.play_n_frames); + dump_mux(priv->demuxer,mp_conf.av_sync_pts,mp_conf.seek_to_sec,mp_conf.play_n_frames); goto goto_next_file; } /*================== Init VIDEO (codec & libvo) ==========================*/ @@ -2549,7 +2588,7 @@ vf_showlist(sh_video->vfilter); // ========== Init display (sh_video->src_w*sh_video->src_h/out_fmt) ============ - inited_flags|=INITED_VO; + priv->inited_flags|=INITED_VO; MSG_V("INFO: Video OUT driver init OK!\n"); MP_UNIT("init_libvo"); fflush(stdout); @@ -2586,7 +2625,7 @@ if(mp_conf.verbose) MSG_V("Freeing %d unused audio chunks\n",d_audio->packs); ds_free_packs(d_audio); // free buffered chunks d_audio->id=-2; // do not read audio chunks - if(ao_inited) uninit_player(INITED_AO); // close device + if(priv->ao_inited) uninit_player(INITED_AO); // close device } if(!sh_video){ @@ -2594,12 +2633,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(vo_inited) uninit_player(INITED_VO); + if(priv->vo_inited) uninit_player(INITED_VO); } if(!sh_audio && !sh_video) exit_player("Nothing to do"); - if(demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf! + if(priv->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; @@ -2618,7 +2657,7 @@ if(mp_conf.benchmark) init_benchmark(); /* display clip info */ - demux_info_print(demuxer,filename); + demux_info_print(priv->demuxer,filename); mpxp_run_ahead_engine(); @@ -2669,7 +2708,7 @@ /*========================== PLAY VIDEO ============================*/ if(input_state.need_repaint) goto repaint; - if((sh_video->is_static ||(stream->type&STREAMTYPE_MENU)==STREAMTYPE_MENU) && our_n_frames) { + if((sh_video->is_static ||(stream->type&STREAMTYPE_MENU)==STREAMTYPE_MENU) && xp_core.video->num_played_frames) { /* don't decode if it's picture */ usleep(0); } else { @@ -2684,7 +2723,6 @@ if((mpxp_paint_osd(&osd.visible,&in_pause))!=0) goto repaint; #endif } /* else if(!sh_video) */ - our_n_frames++; //================= Keyboard events, SEEKing ==================== @@ -2728,7 +2766,7 @@ seek_args.secs -= (xp_is_bad_pts?shvad.v_pts:d_video->pts)-shvap.v_pts; } - mpxp_seek(main_id,&osd,&seek_args); + mpxp_seek(&osd,&seek_args); audio_eof=0; seek_args.secs=0; @@ -2794,14 +2832,14 @@ flg=INITED_ALL; if(input_state.after_dvdmenu) flg &=~(INITED_STREAM|INITED_DEMUXER); uninit_player(flg&(~INITED_INPUT)); /* TODO: |(~INITED_AO)|(~INITED_VO) */ - vo_inited=0; - ao_inited=0; + priv->vo_inited=0; + priv->ao_inited=0; eof = 0; audio_eof=0; goto play_next_file; } - if(stream_dump_type>1) dump_mux_close(demuxer); + if(stream_dump_type>1) dump_mux_close(priv->demuxer); exit_player(MSGTR_Exit_eof); return 1; Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-10-29 09:00:56 UTC (rev 238) +++ mplayerxp/mplayer.h 2012-10-29 09:40:53 UTC (rev 239) @@ -105,6 +105,7 @@ any_t* subtitles; any_t* mconfig; time_usage_t*bench; + any_t* priv; }mp_data_t; extern mp_data_t* mp_data; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 11:39:09
|
Revision: 244 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=244&view=rev Author: nickols_k Date: 2012-10-29 11:38:55 +0000 (Mon, 29 Oct 2012) Log Message: ----------- move uncommon stuff into osdep Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libao2/ao_null.c mplayerxp/libao2/ao_wav.c mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_dvdpcm.c mplayerxp/libmpcodecs/ad_faad.c mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpcodecs/ad_hwac3.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/ad_qtaudio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/liba52/downmix.c mplayerxp/libmpcodecs/liba52/imdct.c mplayerxp/libmpcodecs/liba52/resample.c mplayerxp/libmpcodecs/libdca/downmix.c mplayerxp/libmpcodecs/libdca/resample.c mplayerxp/libmpcodecs/libnuppelvideo/minilzo.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpdemux/asf.h mplayerxp/libmpdemux/aviheader.h mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/demux_aiff.c mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_film.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mov.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_pva.c mplayerxp/libmpdemux/demux_ra.c mplayerxp/libmpdemux/demux_real.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/mux_lavf.c mplayerxp/libmpdemux/mux_mpxp64.c mplayerxp/libmpdemux/mux_raw.c mplayerxp/libmpdemux/pnm.c mplayerxp/libmpdemux/realrtsp/md5.c mplayerxp/libmpdemux/realrtsp/real.c mplayerxp/libmpdemux/realrtsp/rmff.c mplayerxp/libvo/aclib.c mplayerxp/libvo/osd.c mplayerxp/libvo/video_out.c mplayerxp/libvo/vo_vesa.c mplayerxp/loader/win32.c mplayerxp/mplayer.c mplayerxp/osdep/Makefile mplayerxp/osdep/lrmi.c mplayerxp/osdep/vbelib.c mplayerxp/postproc/af_format.c mplayerxp/postproc/af_mp.c mplayerxp/postproc/af_mp.h mplayerxp/postproc/af_raw.c mplayerxp/postproc/dsp.c mplayerxp/postproc/postprocess.c mplayerxp/postproc/swscale.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_eq.c mplayerxp/postproc/vf_framestep.c mplayerxp/postproc/vf_noise.c mplayerxp/postproc/vf_pp.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_unsharp.c Added Paths: ----------- mplayerxp/osdep/bswap.h mplayerxp/osdep/cpudetect.c mplayerxp/osdep/cpudetect.h mplayerxp/osdep/cputable.h mplayerxp/osdep/mangle.h mplayerxp/osdep/mm_accel.h Removed Paths: ------------- mplayerxp/bswap.h mplayerxp/cpudetect.c mplayerxp/cpudetect.h mplayerxp/cputable.h mplayerxp/libmpcodecs/liba52/mangle.h mplayerxp/libmpcodecs/libdca/mangle.h mplayerxp/libmpdemux/bswap.h mplayerxp/mangle.h mplayerxp/mm_accel.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/Makefile 2012-10-29 11:38:55 UTC (rev 244) @@ -23,7 +23,7 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS_COMMON = cpudetect.c mp_msg.c mp_image.c +SRCS_COMMON = mp_msg.c mp_image.c SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c SRCS_MPLAYER+= xmp_core.c Deleted: mplayerxp/bswap.h =================================================================== --- mplayerxp/bswap.h 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/bswap.h 2012-10-29 11:38:55 UTC (rev 244) @@ -1,199 +0,0 @@ -#ifndef __BSWAP_H__ -#define __BSWAP_H__ - -#ifdef HAVE_CONFIG_H -#include "mp_config.h" -#endif - -#ifdef HAVE_BYTESWAP_H -#include <byteswap.h> -#else - -#include <inttypes.h> /* for __WORDSIZE */ - -#define MAKE_FOURCC( ch0, ch1, ch2, ch3 ) \ - (((long)(unsigned char)(ch3) ) | \ - ( (long)(unsigned char)(ch2) << 8 ) | \ - ( (long)(unsigned char)(ch1) << 16 ) | \ - ( (long)(unsigned char)(ch0) << 24 ) ) -#define MAKE_TWOCC(ch0, ch1) \ - ((short)(unsigned char)(ch0) |\ - ((short)(unsigned char)(ch1) << 8)) - - -#if defined(__i386__) -inline static unsigned short ByteSwap16(unsigned short x) -{ - __asm("xchgb %b0,%h0" : - "=q" (x) : - "0" (x)); - return x; -} -#define bswap_16(x) ByteSwap16(x) - -inline static unsigned int ByteSwap32(unsigned int x) -{ -#if __CPU__ > 386 - __asm("bswap %0": - "=r" (x) : -#else - __asm("xchgb %b0,%h0\n" - " rorl $16,%0\n" - " xchgb %b0,%h0": - "=q" (x) : -#endif - "0" (x)); - return x; -} -#define bswap_32(x) ByteSwap32(x) - -inline static unsigned long long int ByteSwap64(unsigned long long int x) -{ - register union { __extension__ unsigned long long int __ll; - unsigned long int __l[2]; } __x; - asm("xchgl %0,%1": - "=r"(__x.__l[0]),"=r"(__x.__l[1]): - "0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32)))); - return __x.__ll; -} -#define bswap_64(x) ByteSwap64(x) - -#elif defined(__x86_64__) - -inline static unsigned short ByteSwap16(unsigned short x) -{ - __asm("rorw $8, %w0" : - "=r" (x) : - "0" (x) : - "cc"); - return x; -} -#define bswap_16(x) ByteSwap16(x) - -inline static unsigned int ByteSwap32(unsigned int x) -{ - __asm("bswapl %0": - "=r" (x) : - "0" (x)); - return x; -} -#define bswap_32(x) ByteSwap32(x) - -inline static unsigned long long int ByteSwap64(unsigned long long int x) -{ - __asm("bswapq %0": - "=r" (x) : - "0" (x)); - return x; -} -#define bswap_64(x) ByteSwap64(x) - -#else - -#define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8) - - -// code from bits/byteswap.h (C) 1997, 1998 Free Software Foundation, Inc. -#define bswap_32(x) \ - ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) - -#if __WORDSIZE >= 64 -# define bswap_64(x) \ - ((((x) & 0xff00000000000000ull) >> 56) \ - | (((x) & 0x00ff000000000000ull) >> 40) \ - | (((x) & 0x0000ff0000000000ull) >> 24) \ - | (((x) & 0x000000ff00000000ull) >> 8) \ - | (((x) & 0x00000000ff000000ull) << 8) \ - | (((x) & 0x0000000000ff0000ull) << 24) \ - | (((x) & 0x000000000000ff00ull) << 40) \ - | (((x) & 0x00000000000000ffull) << 56)) -#else -#define bswap_64(x) \ - (__extension__ \ - ({ union { __extension__ unsigned long long int __ll; \ - unsigned long int __l[2]; } __w, __r; \ - __w.__ll = (x); \ - __r.__l[0] = bswap_32 (__w.__l[1]); \ - __r.__l[1] = bswap_32 (__w.__l[0]); \ - __r.__ll; })) -#endif -#endif /* !ARCH_X86 */ - -#endif /* !HAVE_BYTESWAP_H */ - -inline static float bswap_flt(float x) { - union {uint32_t i; float f;} u; - u.f = x; - u.i = bswap_32(u.i); - return u.f; -} - -inline static double bswap_dbl(double x) { - union {uint64_t i; double d;} u; - u.d = x; - u.i = bswap_64(u.i); - return u.d; -} - -inline static long double bswap_ldbl(long double x) { - union {char d[10]; long double ld;} uin; - union {char d[10]; long double ld;} uout; - uin.ld = x; - uout.d[0] = uin.d[9]; - uout.d[1] = uin.d[8]; - uout.d[2] = uin.d[7]; - uout.d[3] = uin.d[6]; - uout.d[4] = uin.d[5]; - uout.d[5] = uin.d[4]; - uout.d[6] = uin.d[3]; - uout.d[7] = uin.d[2]; - uout.d[8] = uin.d[1]; - uout.d[9] = uin.d[0]; - return uout.ld; -} - -// be2me ... BigEndian to MachineEndian -// le2me ... LittleEndian to MachineEndian - -#ifdef WORDS_BIGENDIAN -#define be2me_16(x) (x) -#define be2me_32(x) (x) -#define be2me_64(x) (x) -#define me2be_16(x) (x) -#define me2be_32(x) (x) -#define me2be_64(x) (x) -#define le2me_16(x) bswap_16(x) -#define le2me_32(x) bswap_32(x) -#define le2me_64(x) bswap_64(x) -#define me2le_16(x) bswap_16(x) -#define me2le_32(x) bswap_32(x) -#define me2le_64(x) bswap_64(x) -#define be2me_flt(x) (x) -#define be2me_dbl(x) (x) -#define be2me_ldbl(x) (x) -#define le2me_flt(x) bswap_flt(x) -#define le2me_dbl(x) bswap_dbl(x) -#define le2me_ldbl(x) bswap_ldbl(x) -#else -#define be2me_16(x) bswap_16(x) -#define be2me_32(x) bswap_32(x) -#define be2me_64(x) bswap_64(x) -#define me2be_16(x) bswap_16(x) -#define me2be_32(x) bswap_32(x) -#define me2be_64(x) bswap_64(x) -#define le2me_16(x) (x) -#define le2me_32(x) (x) -#define le2me_64(x) (x) -#define me2le_16(x) (x) -#define me2le_32(x) (x) -#define me2le_64(x) (x) -#define be2me_flt(x) bswap_flt(x) -#define be2me_dbl(x) bswap_dbl(x) -#define be2me_ldbl(x) bswap_ldbl(x) -#define le2me_flt(x) (x) -#define le2me_dbl(x) (x) -#define le2me_ldbl(x) (x) -#endif - -#endif Deleted: mplayerxp/cpudetect.c =================================================================== --- mplayerxp/cpudetect.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/cpudetect.c 2012-10-29 11:38:55 UTC (rev 244) @@ -1,373 +0,0 @@ -#include "mp_config.h" -#include "cpudetect.h" -#include "help_mp.h" -#define MSGT_CLASS MSGT_CPUDETECT -#include "__mp_msg.h" -CpuCaps gCpuCaps; - -#ifdef HAVE_MALLOC -#include <malloc.h> -#endif -#include <stdlib.h> -#include <string.h> - -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) - -#include <stdio.h> - -#ifdef __FreeBSD__ -#include <sys/types.h> -#include <sys/sysctl.h> -#endif - -#ifdef __linux__ -#include <signal.h> -#endif - -//#define X86_FXSR_MAGIC -/* Thanks to the FreeBSD project for some of this cpuid code, and - * help understanding how to use it. Thanks to the Mesa - * team for SSE support detection and more cpu detect code. - */ - -/* I believe this code works. However, it has only been used on a PII and PIII */ - -static void check_os_katmai_support( void ); - -// return TRUE if cpuid supported -static int has_cpuid() -{ -#ifdef ARCH_X86_64 - return 1; -#else - int a, c; -// code from libavcodec: - __asm__ __volatile__ ( - /* See if CPUID instruction is supported ... */ - /* ... Get copies of EFLAGS into eax and ecx */ - "pushf\n\t" - "pop %0\n\t" - "mov %0, %1\n\t" - /* ... Toggle the ID bit in one copy and store */ - /* to the EFLAGS reg */ - "xor $0x200000, %0\n\t" - "push %0\n\t" - "popf\n\t" - /* ... Get the (hopefully modified) EFLAGS */ - "pushf\n\t" - "pop %0\n\t" - : "=a" (a), "=c" (c) - : - : "cc" - ); - return (a!=c); -#endif -} - -static void -do_cpuid(unsigned int ax, unsigned int *p) -{ - __asm __volatile( - "cpuid;" - : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (ax) - ); -} - -void GetCpuCaps( CpuCaps *caps) -{ - unsigned int regs[4]; - unsigned int regs2[4]; - - memset(caps, 0, sizeof(*caps)); - caps->isX86=1; - caps->cl_size=32; /* default */ - if (!has_cpuid()) { - MSG_WARN("CPUID not supported!???\n"); - return; - } - do_cpuid(0x00000000, regs); // get _max_ cpuid level and vendor name - MSG_V("CPU vendor name: %.4s%.4s%.4s max cpuid level: %d\n", - (char*) (regs+1),(char*) (regs+3),(char*) (regs+2), regs[0]); - if (regs[0]>=0x00000001) - { - char *tmpstr; - unsigned cl_size; - - do_cpuid(0x00000001, regs2); - - tmpstr=GetCpuFriendlyName(regs, regs2); - MSG_V("CPU: %s ",tmpstr); - free(tmpstr); - - caps->cpuType=(regs2[0] >> 8)&0xf; - if(caps->cpuType==0xf){ - // use extended family (P4, IA64) - caps->cpuType=8+((regs2[0]>>20)&255); - } - caps->cpuStepping=regs2[0] & 0xf; - MSG_V("(Type: %d, Stepping: %d)\n", - caps->cpuType, caps->cpuStepping); - - // general feature flags: - caps->hasMMX = (regs2[3] & (1 << 23 )) >> 23; // 0x0800000 - caps->hasSSE = (regs2[3] & (1 << 25 )) >> 25; // 0x2000000 - caps->hasSSE2 = (regs2[3] & (1 << 26 )) >> 26; // 0x4000000 - caps->hasSSE3 = (regs2[2] & 1); // 0x0000001 - caps->hasSSSE3 =(regs2[2] & (1 << 9 )) >> 9; // 0x0000100 - caps->hasFMA = (regs2[2] & (1 << 12 )) >>12; // 0x0000800 - caps->hasSSE41 =(regs2[2] & (1 << 19 )) >>19; // 0x0080000 - caps->hasSSE42 =(regs2[2] & (1 << 20 )) >>20; // 0x0100000 - caps->hasAES =(regs2[2] & (1 << 25 )) >>25; // 0x02000000 - caps->hasAVX =(regs2[2] & (1 << 28 )) >>28; // 0x10000000 - caps->hasMMX2 = caps->hasSSE; // SSE cpus supports mmxext too - cl_size = ((regs2[1] >> 8) & 0xFF)*8; - if(cl_size) caps->cl_size = cl_size; - } - do_cpuid(0x80000000, regs); - if (regs[0]>=0x80000001) { - MSG_V("extended cpuid-level: %d\n",regs[0]&0x7FFFFFFF); - do_cpuid(0x80000001, regs2); - caps->hasMMX |= (regs2[3] & (1 << 23 )) >> 23; // 0x0800000 - caps->hasMMX2 |= (regs2[3] & (1 << 22 )) >> 22; // 0x400000 - caps->has3DNow = (regs2[3] & (1 << 31 )) >> 31; //0x80000000 - caps->has3DNowExt = (regs2[3] & (1 << 30 )) >> 30; - } - if(regs[0]>=0x80000006) - { - do_cpuid(0x80000006, regs2); - MSG_V("extended cache-info: %d\n",regs2[2]); - caps->cl_size = regs2[2] & 0xFF; - } - MSG_V("Detected cache-line size is %u bytes\n",caps->cl_size); - MSG_V("cpudetect: 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 -); -} - - -#define CPUID_EXTFAMILY ((regs2[0] >> 20)&0xFF) /* 27..20 */ -#define CPUID_EXTMODEL ((regs2[0] >> 16)&0x0F) /* 19..16 */ -#define CPUID_TYPE ((regs2[0] >> 12)&0x04) /* 13..12 */ -#define CPUID_FAMILY ((regs2[0] >> 8)&0x0F) /* 11..08 */ -#define CPUID_MODEL ((regs2[0] >> 4)&0x0F) /* 07..04 */ -#define CPUID_STEPPING ((regs2[0] >> 0)&0x0F) /* 03..00 */ - -char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]){ -#include "cputable.h" /* get cpuname and cpuvendors */ - char vendor[17]; - char *retname; - int i; - - if (NULL==(retname=(char*)malloc(256))) { - MSG_ERR(MSGTR_OutOfMemory); - exit(1); - } - - sprintf(vendor,"%.4s%.4s%.4s",(char*)(regs+1),(char*)(regs+3),(char*)(regs+2)); - - for(i=0; i<MAX_VENDORS; i++){ - if(!strcmp(cpuvendors[i].string,vendor)){ - if(cpuname[i][CPUID_FAMILY][CPUID_MODEL]){ - snprintf(retname,255,"%s %s",cpuvendors[i].name,cpuname[i][CPUID_FAMILY][CPUID_MODEL]); - } else { - snprintf(retname,255,"unknown %s %d. Generation CPU",cpuvendors[i].name,CPUID_FAMILY); - MSG_ERR("unknown %s CPU:\n" - "Vendor: %s\n" - "Type: %d\n" - "Family: %d (ext: %d)\n" - "Model: %d (ext: %d)\n" - "Stepping: %d\n" - "Please send the above info along with the exact CPU name" - "to the MPlayer-Developers, so we can add it to the list!\n" - ,cpuvendors[i].name - ,cpuvendors[i].string - ,CPUID_TYPE - ,CPUID_FAMILY,CPUID_EXTFAMILY - ,CPUID_MODEL,CPUID_EXTMODEL - ,CPUID_STEPPING); - } - } - } - - //printf("Detected CPU: %s\n", retname); - return retname; -} - -#undef CPUID_EXTFAMILY -#undef CPUID_EXTMODEL -#undef CPUID_TYPE -#undef CPUID_FAMILY -#undef CPUID_MODEL -#undef CPUID_STEPPING - - -#if defined(__linux__) && defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC) -static void sigill_handler_sse( int signal, struct sigcontext sc ) -{ - MSG_ERR( "SIGILL, " ); - - /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1" - * instructions are 3 bytes long. We must increment the instruction - * pointer manually to avoid repeated execution of the offending - * instruction. - * - * If the SIGILL is caused by a divide-by-zero when unmasked - * exceptions aren't supported, the SIMD FPU status and control - * word will be restored at the end of the test, so we don't need - * to worry about doing it here. Besides, we may not be able to... - */ - sc.eip += 3; - - gCpuCaps.hasSSE=0; -} - -static void sigfpe_handler_sse( int signal, struct sigcontext sc ) -{ - MSG_ERR( "SIGFPE, " ); - - if ( sc.fpstate->magic != 0xffff ) { - /* Our signal context has the extended FPU state, so reset the - * divide-by-zero exception mask and clear the divide-by-zero - * exception bit. - */ - sc.fpstate->mxcsr |= 0x00000200; - sc.fpstate->mxcsr &= 0xfffffffb; - } else { - /* If we ever get here, we're completely hosed. - */ - MSG_ERR( "\n\n" ); - MSG_ERR( "SSE enabling test failed badly!" ); - } -} -#endif /* __linux__ && _POSIX_SOURCE && X86_FXSR_MAGIC */ - -/* If we're running on a processor that can do SSE, let's see if we - * are allowed to or not. This will catch 2.4.0 or later kernels that - * haven't been configured for a Pentium III but are running on one, - * and RedHat patched 2.2 kernels that have broken exception handling - * support for user space apps that do SSE. - */ -static void check_os_katmai_support( void ) -{ -#if !defined(ARCH_X86_64) -#if defined(__FreeBSD__) - int has_sse=0, ret; - size_t len=sizeof(has_sse); - - ret = sysctlbyname("hw.instruction_sse", &has_sse, &len, NULL, 0); - if (ret || !has_sse) - gCpuCaps.hasSSE=0; - -#elif defined(__linux__) -#if defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC) - struct sigaction saved_sigill; - struct sigaction saved_sigfpe; - - /* Save the original signal handlers. - */ - sigaction( SIGILL, NULL, &saved_sigill ); - sigaction( SIGFPE, NULL, &saved_sigfpe ); - - signal( SIGILL, (void (*)(int))sigill_handler_sse ); - signal( SIGFPE, (void (*)(int))sigfpe_handler_sse ); - - /* Emulate test for OSFXSR in CR4. The OS will set this bit if it - * supports the extended FPU save and restore required for SSE. If - * we execute an SSE instruction on a PIII and get a SIGILL, the OS - * doesn't support Streaming SIMD Exceptions, even if the processor - * does. - */ - if ( gCpuCaps.hasSSE ) { - MSG_V( "Testing OS support for SSE... " ); - -// __asm __volatile ("xorps %%xmm0, %%xmm0"); - __asm __volatile ("xorps %xmm0, %xmm0"); - - if ( gCpuCaps.hasSSE ) { - MSG_V( "yes.\n" ); - } else { - MSG_V( "no!\n" ); - } - } - - /* Emulate test for OSXMMEXCPT in CR4. The OS will set this bit if - * it supports unmasked SIMD FPU exceptions. If we unmask the - * exceptions, do a SIMD divide-by-zero and get a SIGILL, the OS - * doesn't support unmasked SIMD FPU exceptions. If we get a SIGFPE - * as expected, we're okay but we need to clean up after it. - * - * Are we being too stringent in our requirement that the OS support - * unmasked exceptions? Certain RedHat 2.2 kernels enable SSE by - * setting CR4.OSFXSR but don't support unmasked exceptions. Win98 - * doesn't even support them. We at least know the user-space SSE - * support is good in kernels that do support unmasked exceptions, - * and therefore to be safe I'm going to leave this test in here. - */ - if ( gCpuCaps.hasSSE ) { - MSG_V( "Testing OS support for SSE unmasked exceptions... " ); - -// test_os_katmai_exception_support(); - - if ( gCpuCaps.hasSSE ) { - MSG_V( "yes.\n" ); - } else { - MSG_V( "no!\n" ); - } - } - - /* Restore the original signal handlers. - */ - sigaction( SIGILL, &saved_sigill, NULL ); - sigaction( SIGFPE, &saved_sigfpe, NULL ); - - /* If we've gotten to here and the XMM CPUID bit is still set, we're - * safe to go ahead and hook out the SSE code throughout Mesa. - */ - if ( gCpuCaps.hasSSE ) { - MSG_V( "Tests of OS support for SSE passed.\n" ); - } else { - MSG_WARN( "Tests of OS support for SSE failed!\n" ); - } -#else - /* We can't use POSIX signal handling to test the availability of - * SSE, so we disable it by default. - */ - MSG_WARN( "Cannot test OS support for SSE, disabling to be safe.\n" ); - gCpuCaps.hasSSE=0; -#endif /* _POSIX_SOURCE && X86_FXSR_MAGIC */ -#else - /* Do nothing on other platforms for now. - */ - MSG_V( "Not testing OS support for SSE, leaving disabled.\n" ); - gCpuCaps.hasSSE=0; -#endif /* __linux__ */ -#endif /*ARCH_X86_64*/ -} -#else /* ARCH_X86 */ - -void GetCpuCaps( CpuCaps *caps) -{ - caps->cpuType=0; - caps->cpuStepping=0; - caps->hasMMX=0; - caps->hasMMX2=0; - caps->has3DNow=0; - caps->has3DNowExt=0; - caps->hasSSE=0; - caps->hasSSE2=0; - caps->isX86=0; -} -#endif /* !ARCH_X86 */ Deleted: mplayerxp/cpudetect.h =================================================================== --- mplayerxp/cpudetect.h 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/cpudetect.h 2012-10-29 11:38:55 UTC (rev 244) @@ -1,67 +0,0 @@ -#ifndef CPUDETECT_H -#define CPUDETECT_H - -#include "mplayer.h" - -#ifdef ARCH_X86_64 -# define REGa rax -# define REGb rbx -# define REGBP rbp -# define REGSP rsp -# define REG_a "rax" -# define REG_b "rbx" -# define REG_c "rcx" -# define REG_d "rdx" -# define REG_S "rsi" -# define REG_D "rdi" -# define REG_SP "rsp" -# define REG_BP "rbp" -#else -# define REGa eax -# define REGb ebx -# define REGBP ebp -# define REGSP esp -# define REG_a "eax" -# define REG_b "ebx" -# define REG_c "ecx" -# define REG_d "edx" -# define REG_S "esi" -# define REG_D "edi" -# define REG_SP "esp" -# define REG_BP "ebp" -#endif - -#define CPUTYPE_I386 3 -#define CPUTYPE_I486 4 -#define CPUTYPE_I586 5 -#define CPUTYPE_I686 6 - -typedef struct cpucaps_s { - int cpuType; - int cpuStepping; - int hasMMX; - int hasMMX2; - int has3DNow; - int has3DNowExt; - int hasSSE; - int hasSSE2; - int hasSSE3; - int hasSSSE3; - int hasFMA; - int hasSSE41; - int hasSSE42; - int hasAES; - int hasAVX; - int isX86; - unsigned cl_size; /* size of cache line */ -} CpuCaps; - -extern CpuCaps gCpuCaps; - -void GetCpuCaps(CpuCaps *caps); - -/* returned value is malloc()'ed so free() it after use */ -char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]); - -#endif /* !CPUDETECT_H */ - Deleted: mplayerxp/cputable.h =================================================================== --- mplayerxp/cputable.h 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/cputable.h 2012-10-29 11:38:55 UTC (rev 244) @@ -1,474 +0,0 @@ -/* cputable.h - Maps CPUID to real CPU name. - * Copyleft 2001 by Felix Buenemann <atmosfear at users dot sourceforge dot net> - * This file comes under the GNU GPL, see www.fsf.org for more info! - */ - -#define MAX_VENDORS 8 /* Number of CPU Vendors */ - -//#define N_UNKNOWN "unknown" -//#define N_UNKNOWNEXT "unknown extended model" -#define N_UNKNOWN "" -#define N_UNKNOWNEXT "" - -#define F_UNKNOWN { \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN, \ -N_UNKNOWN \ -} - -static const char *cpuname - /* Vendor */ [MAX_VENDORS] - /* Family */ [16] - /* Model */ [16] - ={ - /* Intel Corporation, "GenuineIntel" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 i386 */ F_UNKNOWN, /* XXX new 386 chips may support CPUID! */ - /* 4 i486 */ { - /* 0 */ "i486DX-25/33", /* only few of these */ - /* 1 */ "i486DX-50", /* support CPUID! */ - /* 2 */ "i486SX", - /* 3 */ "i486DX2", /* CPUID only on new chips! */ - /* 4 */ "i486SL", - /* 5 */ "i486SX2", - /* 6 */ N_UNKNOWN, - /* 7 */ "i486DX2/write-back", /* returns 3 in write-through mode */ - /* 8 */ "i486DX4", - /* 9 */ "i486DX4/write-back", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - }, - /* 5 i586 */ { - /* 0 */ "Pentium P5 A-step", - /* 1 */ "Pentium P5", - /* 2 */ "Pentium P54C", - /* 3 */ "Pentium OverDrive P24T", - /* 4 */ "Pentium MMX P55C", - /* 5 */ N_UNKNOWN, /* XXX DX4 OverDrive? */ - /* 6 */ N_UNKNOWN, /* XXX P5 OverDrive? */ - /* 7 */ "Pentium P54C (new)", - /* 8 */ "Pentium MMX P55C (new)", - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - }, - /* 6 i686 */ { - /* 0 */ "PentiumPro A-step", - /* 1 */ "PentiumPro", - /* 2 */ N_UNKNOWN, - /* 3 */ "Pentium II Klamath/Pentium II OverDrive", - /* 4 */ N_UNKNOWN, /* XXX P55CT - OverDrive for P54? */ - /* 5 */ "Celeron Covington/Pentium II Deschutes,Tonga/Pentium II Xeon", - /* 6 */ "Celeron A Mendocino/Pentium II Dixon", - /* 7 */ "Pentium III Katmai/Pentium III Xeon Tanner", - /* 8 */ "Celeron 2/Pentium III Coppermine,Geyserville", - /* 9 */ N_UNKNOWN, - /* A */ "Pentium III Xeon Cascades", - /* B */ "Celeron 2/Pentium III Tualatin", - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - }, - /* 7 IA-64 */ { /* FIXME */ - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - }, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F extended family (P4/new IA-64)*/ { - /* 0 */ "Pentium 4 Willamette", - /* 1 */ "Pentium 4 Xeon Foster", /*?*/ - /* XXX 0.13\xB5m P4 Northwood ??? */ - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWNEXT - } - }, - /* United Microelectronics Corporation, "UMC UMC UMC " */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 486 (U5) */ { - /* 0 */ N_UNKNOWN, - /* 1 */ "486DX U5D", - /* 2 */ "486SX U5S", - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 5 */ F_UNKNOWN, - /* 6 */ F_UNKNOWN, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* Advanced Micro Devices, "AuthenticAMD" (very rare: "AMD ISBETTER") */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 486/5x86 */ { - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ "486DX2", - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ "486DX2/write-back", - /* 8 */ "486DX4/5x86", - /* 9 */ "486DX4/write-back", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* E */ "5x86", - /* F */ "5x86/write-back" - }, - /* 5 K5/K6 */ { - /* 0 */ "K5 SSA5 (PR75,PR90,PR100)", - /* 1 */ "K5 5k86 (PR120,PR133)", - /* 2 */ "K5 5k86 (PR166)", - /* 3 */ "K5 5k86 (PR200)", - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ "K6", - /* 7 */ "K6 Little Foot", - /* 8 */ "K6-2", - /* 9 */ "K6-III Chomper", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ "K6-2+/K6-III+ Sharptooth", - /* E */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 K7 */ { - /* 0 */ N_UNKNOWN, /* Argon? */ - /* 1 */ "Athlon K7", - /* 2 */ "Athlon K75 Pluto,Orion", - /* 3 */ "Duron SF Spitfire", - /* 4 */ "Athlon TB Thunderbird", - /* 5 */ N_UNKNOWN, - /* 6 */ "Athlon 4 PM Palomino/Athlon MP Multiprocessor/Athlon XP eXtreme Performance", - /* 7 */ "Duron MG Morgan", - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* Cyrix Corp./VIA Inc., "CyrixInstead" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 5x86 */ { - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ "MediaGX", - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ "5x86", /* CPUID maybe only on newer chips */ - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 5 M1 */ { - /* 0 */ "M1 test-sample", /*?*/ - /* 1 */ N_UNKNOWN, - /* 2 */ "6x86 M1", - /* 3 */ N_UNKNOWN, - /* 4 */ "GXm", - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 M2 */ { - /* 0 */ "6x86MX M2/M-II", - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ "Cyrix III Joshua (M2 core)", - /* 6 */ "Cyrix III Samuel (WinChip C5A core)", - /* 7 */ "C3 Samuel 2 (WinChip C5B core)", - /* 8 */ N_UNKNOWN, /* XXX Samuel 3/Ezra? */ - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* NexGen Inc., "NexGenDriven" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 */ F_UNKNOWN, - /* 5 Nx586 */ { - /* 0 */ "Nx586/Nx586FPU", /* only newer ones support CPUID! */ - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 */ F_UNKNOWN, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* IDT/Centaur/VIA, "CentaurHauls" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 */ F_UNKNOWN, - /* 5 IDT C6 WinChip */ { - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ "WinChip C6", - /* 5 */ N_UNKNOWN, - /* 6 */ "Samuel", - /* 7 */ N_UNKNOWN, - /* 8 */ "WinChip 2 C6+,W2,W2A,W2B", - /* 9 */ "WinChip 3 W3", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - - }, - /* 6 */ F_UNKNOWN, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* Rise, "RiseRiseRise" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 */ F_UNKNOWN, - /* 5 mP6 */ { - /* 0 */ "mP6 iDragon 6401,6441 Kirin", - /* 1 */ "mP6 iDragon 6510 Lynx", - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ N_UNKNOWN, - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ "mP6 iDragon II", - /* 9 */ "mP6 iDragon II (new)", - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 */ F_UNKNOWN, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - }, - /* Transmeta, "GenuineTMx86" */ { - /* 0 */ F_UNKNOWN, - /* 1 */ F_UNKNOWN, - /* 2 */ F_UNKNOWN, - /* 3 */ F_UNKNOWN, - /* 4 */ F_UNKNOWN, - /* 5 Crusoe */ { - /* 0 */ N_UNKNOWN, - /* 1 */ N_UNKNOWN, - /* 2 */ N_UNKNOWN, - /* 3 */ N_UNKNOWN, - /* 4 */ "Crusoe TM3x00,TM5x00", - /* 5 */ N_UNKNOWN, - /* 6 */ N_UNKNOWN, - /* 7 */ N_UNKNOWN, - /* 8 */ N_UNKNOWN, - /* 9 */ N_UNKNOWN, - /* A */ N_UNKNOWN, - /* B */ N_UNKNOWN, - /* E */ N_UNKNOWN, - /* C */ N_UNKNOWN, - /* D */ N_UNKNOWN, - /* F */ N_UNKNOWN - }, - /* 6 */ F_UNKNOWN, - /* 7 */ F_UNKNOWN, - /* 8 */ F_UNKNOWN, - /* 9 */ F_UNKNOWN, - /* A */ F_UNKNOWN, - /* B */ F_UNKNOWN, - /* C */ F_UNKNOWN, - /* D */ F_UNKNOWN, - /* E */ F_UNKNOWN, - /* F */ F_UNKNOWN - } -}; - -#undef N_UNKNOWNEXT -#undef N_UNKNOWN -#undef F_UNKNOWN - -static const struct { - char string[13]; - char name[48]; -} cpuvendors[MAX_VENDORS] ={ - {"GenuineIntel","Intel"}, - {"UMC UMC UMC ","United Microelectronics Corporation"}, - {"AuthenticAMD","Advanced Micro Devices"}, - {"CyrixInstead","Cyrix/VIA"}, - {"NexGenDriven","NexGen"}, - {"CentaurHauls","IDT/Centaur/VIA"}, - {"RiseRiseRise","Rise"}, - {"GenuineTMx86","Transmeta"} -}; - Modified: mplayerxp/libao2/ao_null.c =================================================================== --- mplayerxp/libao2/ao_null.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libao2/ao_null.c 2012-10-29 11:38:55 UTC (rev 244) @@ -6,9 +6,9 @@ #include <sys/time.h> #include "mp_config.h" -#include "../bswap.h" +#include "osdep/bswap.h" -#include "../libmpdemux/mrl.h" +#include "libmpdemux/mrl.h" #include "afmt.h" #include "audio_out.h" #include "audio_out_internal.h" Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libao2/ao_wav.c 2012-10-29 11:38:55 UTC (rev 244) @@ -25,12 +25,12 @@ #include <string.h> #include "xmp_core.h" -#include "../bswap.h" +#include "osdep/bswap.h" #include "postproc/af_format.h" #include "afmt.h" #include "audio_out.h" #include "audio_out_internal.h" -#include "../libvo/video_out.h" +#include "libvo/video_out.h" #include "help_mp.h" #include "ao_msg.h" Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-10-29 11:38:55 UTC (rev 244) @@ -9,15 +9,15 @@ #include "mp_config.h" #include "help_mp.h" -#include "cpudetect.h" +#include "osdep/cpudetect.h" -#include "../mm_accel.h" -#include "../mplayer.h" +#include "osdep/mm_accel.h" +#include "mplayer.h" #include "liba52/a52.h" #include "ad_a52.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" -#include "../postproc/af.h" +#include "postproc/af.h" #define MAX_AC3_FRAME 3840 @@ -25,7 +25,7 @@ uint32_t mpxp_a52_accel=0; uint32_t mpxp_a52_flags=0; -#include "bswap.h" +#include "osdep/bswap.h" static const ad_info_t info = { Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-10-29 11:38:55 UTC (rev 244) @@ -9,15 +9,15 @@ #include "mp_config.h" #include "help_mp.h" -#include "cpudetect.h" +#include "osdep/cpudetect.h" #include "libdca/dca.h" -#include "../mm_accel.h" -#include "../mplayer.h" -#include "../bswap.h" +#include "osdep/mm_accel.h" +#include "mplayer.h" +#include "osdep/bswap.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" -#include "../postproc/af.h" +#include "postproc/af.h" #define MAX_AC5_FRAME 4096 @@ -31,8 +31,6 @@ }dca_priv_t; -#include "bswap.h" - static const ad_info_t info = { "DTS Coherent Acoustics", Modified: mplayerxp/libmpcodecs/ad_dvdpcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_dvdpcm.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/ad_dvdpcm.c 2012-10-29 11:38:55 UTC (rev 244) @@ -2,8 +2,8 @@ #include <stdlib.h> #include <unistd.h> #include "ad_internal.h" -#include "bswap.h" -#include "../libao2/afmt.h" +#include "osdep/bswap.h" +#include "libao2/afmt.h" static const ad_info_t info = { Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/ad_faad.c 2012-10-29 11:38:55 UTC (rev 244) @@ -11,16 +11,16 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "help_mp.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "codecs_ld.h" #include "mp_config.h" #include "ad_internal.h" -#include "../mplayer.h" -#include "../cpudetect.h" -#include "../mm_accel.h" +#include "mplayer.h" +#include "osdep/cpudetect.h" +#include "osdep/mm_accel.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" -#include "../postproc/af.h" +#include "postproc/af.h" static const ad_info_t info = { Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-29 11:38:55 UTC (rev 244) @@ -10,7 +10,7 @@ #include "mp_config.h" #include "help_mp.h" -#include "bswap.h" +#include "osdep/bswap.h" #define FF_API_OLD_DECODE_AUDIO 1 #include "libavcodec/avcodec.h" Modified: mplayerxp/libmpcodecs/ad_hwac3.c =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-29 11:38:55 UTC (rev 244) @@ -10,9 +10,9 @@ #include "mp_config.h" #include "help_mp.h" #include "codecs_ld.h" -#include "cpudetect.h" +#include "osdep/cpudetect.h" -#include "../libao2/afmt.h" +#include "libao2/afmt.h" #include "ad_a52.h" #define IEC61937_DATA_TYPE_AC3 1 Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-29 11:38:55 UTC (rev 244) @@ -5,9 +5,9 @@ #include "ad_internal.h" #include "libvo/fastmemcpy.h" #include "mp_config.h" -#include "../mplayer.h" -#include "../cpudetect.h" -#include "../mm_accel.h" +#include "mplayer.h" +#include "osdep/cpudetect.h" +#include "osdep/mm_accel.h" #include "codecs_ld.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" Modified: mplayerxp/libmpcodecs/ad_qtaudio.c =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-29 11:38:55 UTC (rev 244) @@ -6,11 +6,11 @@ #include "mp_config.h" #include "ad_internal.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "codecs_ld.h" -#include "../mplayer.h" +#include "mplayer.h" #ifdef WIN32_LOADER -#include "../../loader/ldt_keeper.h" +#include "loader/ldt_keeper.h" #endif #ifdef MACOSX Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-29 11:38:55 UTC (rev 244) @@ -10,7 +10,7 @@ #endif #include <stdlib.h> #include <unistd.h> -#include "../mplayer.h" +#include "mplayer.h" #include "help_mp.h" #include "osdep/timer.h" @@ -38,7 +38,7 @@ vf_cfg_t vf_cfg; // Configuration for audio filters #include "postproc/postprocess.h" -#include "cpudetect.h" +#include "osdep/cpudetect.h" #include "vd_msg.h" extern int v_bright; Modified: mplayerxp/libmpcodecs/liba52/downmix.c =================================================================== --- mplayerxp/libmpcodecs/liba52/downmix.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/liba52/downmix.c 2012-10-29 11:38:55 UTC (rev 244) @@ -21,15 +21,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../../mp_config.h" +#include "mp_config.h" #include <string.h> #include <inttypes.h> #include "a52.h" #include "a52_internal.h" -#include "../../mm_accel.h" -#include "../../cpudetect.h" +#include "osdep/mm_accel.h" +#include "osdep/cpudetect.h" #define CONVERT(acmod,output) (((output) << 3) + (acmod)) Modified: mplayerxp/libmpcodecs/liba52/imdct.c =================================================================== --- mplayerxp/libmpcodecs/liba52/imdct.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/liba52/imdct.c 2012-10-29 11:38:55 UTC (rev 244) @@ -24,7 +24,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../../mp_config.h" +#include "mp_config.h" #include <math.h> #include <stdio.h> @@ -35,7 +35,7 @@ #include "a52.h" #include "a52_internal.h" -#include "../../mm_accel.h" +#include "osdep/mm_accel.h" typedef struct complex_s { sample_t real; Deleted: mplayerxp/libmpcodecs/liba52/mangle.h =================================================================== --- mplayerxp/libmpcodecs/liba52/mangle.h 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/liba52/mangle.h 2012-10-29 11:38:55 UTC (rev 244) @@ -1,2 +0,0 @@ -#include "../mangle.h" - Modified: mplayerxp/libmpcodecs/liba52/resample.c =================================================================== --- mplayerxp/libmpcodecs/liba52/resample.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/liba52/resample.c 2012-10-29 11:38:55 UTC (rev 244) @@ -4,14 +4,14 @@ // a52_resample() should do the conversion. -#include "../../mp_config.h" +#include "mp_config.h" #include <inttypes.h> #include <stdio.h> #include "a52.h" #include "a52_internal.h" -#include "../../mm_accel.h" -#include "../../mangle.h" -#include "../../cpudetect.h" +#include "osdep/mm_accel.h" +#include "osdep/mangle.h" +#include "osdep/cpudetect.h" int (* a52_resample) (float * _f, int16_t * s16)=NULL; int (* a52_resample32) (float * _f, float * s16)=NULL; Modified: mplayerxp/libmpcodecs/libdca/downmix.c =================================================================== --- mplayerxp/libmpcodecs/libdca/downmix.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/libdca/downmix.c 2012-10-29 11:38:55 UTC (rev 244) @@ -22,12 +22,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../../mp_config.h" +#include "mp_config.h" #include <string.h> #include <inttypes.h> -#include "../../cpudetect.h" +#include "osdep/cpudetect.h" #include "dca.h" #include "dca_internal.h" @@ -344,7 +344,7 @@ return -1; /* NOTREACHED */ } -#include "../../mm_accel.h" +#include "osdep/mm_accel.h" #undef HAVE_MMX #undef HAVE_MMX2 Deleted: mplayerxp/libmpcodecs/libdca/mangle.h =================================================================== --- mplayerxp/libmpcodecs/libdca/mangle.h 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/libdca/mangle.h 2012-10-29 11:38:55 UTC (rev 244) @@ -1,2 +0,0 @@ -#include "../mangle.h" - Modified: mplayerxp/libmpcodecs/libdca/resample.c =================================================================== --- mplayerxp/libmpcodecs/libdca/resample.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/libdca/resample.c 2012-10-29 11:38:55 UTC (rev 244) @@ -8,10 +8,10 @@ #include <stdio.h> #include "dca.h" #include "dca_internal.h" -#include "../../mp_config.h" -#include "../../mm_accel.h" -#include "../../mangle.h" -#include "../../cpudetect.h" +#include "mp_config.h" +#include "osdep/mm_accel.h" +#include "osdep/mangle.h" +#include "osdep/cpudetect.h" int (* dca_resample) (float * _f, int16_t * s16)=NULL; int (* dca_resample32) (float * _f, float * s16)=NULL; Modified: mplayerxp/libmpcodecs/libnuppelvideo/minilzo.c =================================================================== --- mplayerxp/libmpcodecs/libnuppelvideo/minilzo.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/libnuppelvideo/minilzo.c 2012-10-29 11:38:55 UTC (rev 244) @@ -56,7 +56,7 @@ #endif #include <stdio.h> -#include "cpudetect.h" +#include "osdep/cpudetect.h" #ifndef __LZO_CONF_H #define __LZO_CONF_H Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-29 11:38:55 UTC (rev 244) @@ -13,13 +13,13 @@ #include "help_mp.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "vd_internal.h" #include "codecs_ld.h" -#include "../postproc/postprocess.h" -#include "../postproc/vf.h" -#include "../libvo/video_out.h" +#include "postproc/postprocess.h" +#include "postproc/vf.h" +#include "libvo/video_out.h" static const vd_info_t info = { "FFmpeg's libavcodec codec family", Modified: mplayerxp/libmpcodecs/vd_libmpeg2.c =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-10-29 11:38:55 UTC (rev 244) @@ -11,11 +11,11 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "mp_config.h" -#include "../mplayer.h" +#include "mplayer.h" #include "vd_internal.h" -#include "../cpudetect.h" -#include "../mm_accel.h" -#include "../postproc/postprocess.h" +#include "osdep/cpudetect.h" +#include "osdep/mm_accel.h" +#include "postproc/postprocess.h" #include "codecs_ld.h" static const vd_info_t info = Modified: mplayerxp/libmpcodecs/vd_qtvideo.c =================================================================== --- mplayerxp/libmpcodecs/vd_qtvideo.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/vd_qtvideo.c 2012-10-29 11:38:55 UTC (rev 244) @@ -2,7 +2,7 @@ #include <stdlib.h> #include "mp_config.h" -#include "../mplayer.h" +#include "mplayer.h" #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ @@ -28,7 +28,7 @@ LIBVD_EXTERN(qtvideo) -#include "../bswap.h" +#include "osdep/bswap.h" #ifdef MACOSX #include <QuickTime/ImageCodec.h> Modified: mplayerxp/libmpcodecs/vd_xanim.c =================================================================== --- mplayerxp/libmpcodecs/vd_xanim.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpcodecs/vd_xanim.c 2012-10-29 11:38:55 UTC (rev 244) @@ -14,7 +14,7 @@ #include <stdarg.h> /* va_alist, va_start, va_end */ #include <errno.h> /* strerror, errno */ -#include "bswap.h" +#include "osdep/bswap.h" #include "libmpconf/codec-cfg.h" Modified: mplayerxp/libmpdemux/asf.h =================================================================== --- mplayerxp/libmpdemux/asf.h 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/asf.h 2012-10-29 11:38:55 UTC (rev 244) @@ -3,7 +3,7 @@ //#include "cp_config.h" /* for WORDS_BIGENDIAN */ #include <inttypes.h> -#include "bswap.h" +#include "osdep/bswap.h" #ifndef MIN #define MIN(a,b) ((a<b)?a:b) Modified: mplayerxp/libmpdemux/aviheader.h =================================================================== --- mplayerxp/libmpdemux/aviheader.h 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/aviheader.h 2012-10-29 11:38:55 UTC (rev 244) @@ -2,7 +2,7 @@ #define _aviheader_h //#include "mp_config.h" /* get correct definition WORDS_BIGENDIAN */ -#include "bswap.h" +#include "osdep/bswap.h" /* * Some macros to swap little endian structures read from an AVI file Deleted: mplayerxp/libmpdemux/bswap.h =================================================================== --- mplayerxp/libmpdemux/bswap.h 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/bswap.h 2012-10-29 11:38:55 UTC (rev 244) @@ -1,2 +0,0 @@ -/* Let it be for now*/ -#include "../bswap.h" Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/cache2.c 2012-10-29 11:38:55 UTC (rev 244) @@ -1,4 +1,4 @@ -#include "../mp_config.h" +#include "mp_config.h" #define READ_USLEEP_TIME 10000 #define FILL_USLEEP_TIME 50000 @@ -14,14 +14,14 @@ #include <pthread.h> #include "stream.h" -#include "../sig_hand.h" -#include "../osdep/timer.h" -#include "../cpudetect.h" -#include "bswap.h" -#include "../libvo/fastmemcpy.h" -#include "../help_mp.h" +#include "sig_hand.h" +#include "osdep/timer.h" +#include "osdep/cpudetect.h" +#include "osdep/bswap.h" +#include "libvo/fastmemcpy.h" +#include "help_mp.h" #include "mpdemux.h" -#include "../mplayer.h" +#include "mplayer.h" #include "demux_msg.h" #ifndef min Modified: mplayerxp/libmpdemux/demux_aiff.c =================================================================== --- mplayerxp/libmpdemux/demux_aiff.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_aiff.c 2012-10-29 11:38:55 UTC (rev 244) @@ -1,8 +1,8 @@ -#include "../mp_config.h" +#include "mp_config.h" #include <stdlib.h> #include <stdio.h> -#include "bswap.h" +#include "osdep/bswap.h" #include "stream.h" #include "demuxer.h" Modified: mplayerxp/libmpdemux/demux_asf.c =================================================================== --- mplayerxp/libmpdemux/demux_asf.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_asf.c 2012-10-29 11:38:55 UTC (rev 244) @@ -4,15 +4,15 @@ #include <stdlib.h> #include <unistd.h> -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "stream.h" #include "asf.h" #include "demuxer.h" #include "stheader.h" -#include "../libmpcodecs/dec_audio.h" +#include "libmpcodecs/dec_audio.h" #include "aviprint.h" #include "demux_msg.h" /* Modified: mplayerxp/libmpdemux/demux_audio.c =================================================================== --- mplayerxp/libmpdemux/demux_audio.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_audio.c 2012-10-29 11:38:55 UTC (rev 244) @@ -1,4 +1,4 @@ -#include "../mp_config.h" +#include "mp_config.h" #include <stdlib.h> #include <stdio.h> @@ -7,9 +7,9 @@ #include "stheader.h" #include "genres.h" #include <limits.h> -#include "../libmpcodecs/dec_audio.h" +#include "libmpcodecs/dec_audio.h" #include "aviprint.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "mp3_hdr.h" #include <string.h> #ifdef MP_DEBUG Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-29 11:38:55 UTC (rev 244) @@ -4,14 +4,14 @@ #include <stdlib.h> #include <unistd.h> -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "aviheader.h" #include "libmpcodecs/dec_audio.h" #include "libmpconf/cfgparser.h" Modified: mplayerxp/libmpdemux/demux_film.c =================================================================== --- mplayerxp/libmpdemux/demux_film.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_film.c 2012-10-29 11:38:55 UTC (rev 244) @@ -16,10 +16,10 @@ #include <stdlib.h> #include <unistd.h> -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-10-29 11:38:55 UTC (rev 244) @@ -22,7 +22,7 @@ #include "help_mp.h" #include <dlfcn.h> -#include "../bswap.h" +#include "osdep/bswap.h" #include "libmpsub/vobsub.h" #include "libmpsub/subreader.h" #include "libvo/sub.h" Modified: mplayerxp/libmpdemux/demux_mov.c =================================================================== --- mplayerxp/libmpdemux/demux_mov.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_mov.c 2012-10-29 11:38:55 UTC (rev 244) @@ -21,14 +21,14 @@ #include <stdlib.h> #include <unistd.h> -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "qtpalette.h" #include "parse_mp4.h" // .MP4 specific stuff Modified: mplayerxp/libmpdemux/demux_mpg.c =================================================================== --- mplayerxp/libmpdemux/demux_mpg.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_mpg.c 2012-10-29 11:38:55 UTC (rev 244) @@ -10,8 +10,8 @@ #include <stdlib.h> #include <unistd.h> -#include "bswap.h" -#include "../mp_config.h" +#include "osdep/bswap.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-29 11:38:55 UTC (rev 244) @@ -8,7 +8,7 @@ #define __USE_ISOC99 1 /* for lrint */ #include <math.h> -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" @@ -18,7 +18,7 @@ #include "nls/nls.h" #include "libmpsub/subreader.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "aviheader.h" #include "libmpcodecs/dec_audio.h" #include "libvo/sub.h" Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-29 11:38:55 UTC (rev 244) @@ -12,16 +12,16 @@ #include <theora/theora.h> #endif -#include "../mplayer.h" -#include "bswap.h" +#include "mplayer.h" +#include "osdep/bswap.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" #include "aviprint.h" -#include "../libmpcodecs/codecs_ld.h" -#include "../libmpcodecs/dec_audio.h" -#include "../libvo/video_out.h" +#include "libmpcodecs/codecs_ld.h" +#include "libmpcodecs/dec_audio.h" +#include "libvo/video_out.h" #include "demux_msg.h" #define BLOCK_SIZE 4096 Modified: mplayerxp/libmpdemux/demux_pva.c =================================================================== --- mplayerxp/libmpdemux/demux_pva.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_pva.c 2012-10-29 11:38:55 UTC (rev 244) @@ -26,14 +26,14 @@ #include <stdlib.h> #include <string.h> -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "demux_msg.h" /* @@ -42,7 +42,7 @@ #define PVA_MAX_VIDEO_PACK_LEN 6*1024 -#define VIDEOSTREAM 0x01 +#define VIDEOSTREAM 0x01 #define MAINAUDIOSTREAM 0x02 typedef struct { Modified: mplayerxp/libmpdemux/demux_ra.c =================================================================== --- mplayerxp/libmpdemux/demux_ra.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_ra.c 2012-10-29 11:38:55 UTC (rev 244) @@ -8,13 +8,13 @@ #include <limits.h> #include <unistd.h> -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "aviprint.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-29 11:38:55 UTC (rev 244) @@ -23,15 +23,15 @@ #include <stdlib.h> #include <unistd.h> -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "aviprint.h" -#include "../libmpcodecs/dec_audio.h" +#include "libmpcodecs/dec_audio.h" #include "demux_msg.h" #define MKTAG(a, b, c, d) (a | (b << 8) | (c << 16) | (d << 24)) Modified: mplayerxp/libmpdemux/demux_smjpeg.c =================================================================== --- mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-29 11:38:55 UTC (rev 244) @@ -16,13 +16,13 @@ #include <unistd.h> #include <string.h> /* strtok */ -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "demux_msg.h" static int smjpeg_probe(demuxer_t* demuxer){ Modified: mplayerxp/libmpdemux/demux_ts.c =================================================================== --- mplayerxp/libmpdemux/demux_ts.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_ts.c 2012-10-29 11:38:55 UTC (rev 244) @@ -27,16 +27,16 @@ #include <stdlib.h> #include <string.h> -#include "../mp_config.h" -#include "../mplayer.h" +#include "mp_config.h" +#include "mplayer.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "parse_es.h" #include "stheader.h" -#include "../libmpcodecs/dec_audio.h" +#include "libmpcodecs/dec_audio.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "mpeg_hdr.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_ty.c 2012-10-29 11:38:55 UTC (rev 244) @@ -35,8 +35,8 @@ #include <time.h> #include <stdarg.h> -#include "../mp_config.h" -#include "bswap.h" +#include "mp_config.h" +#include "osdep/bswap.h" #include "help_mp.h" #include "stream.h" Modified: mplayerxp/libmpdemux/demux_viv.c =================================================================== --- mplayerxp/libmpdemux/demux_viv.c 2012-10-29 11:01:14 UTC (rev 243) +++ mplayerxp/libmpdemux/demux_viv.c 2012-10-29 11:38:55 UTC (rev 244) @@ -10,13 +10,13 @@ #include <unistd.h> #include <string.h> /* strtok */ -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" -#include "bswap.h" +#include "osdep/bswap.h" #include "demux_msg.h" #include "libmpconf/cfgpa... [truncated message content] |
From: <nic...@us...> - 2012-10-29 12:34:57
|
Revision: 245 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=245&view=rev Author: nickols_k Date: 2012-10-29 12:34:45 +0000 (Mon, 29 Oct 2012) Log Message: ----------- move fastmemcpy into osdep Modified Paths: -------------- mplayerxp/libao2/ao_sdl.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/demux_bmp.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/stream.c mplayerxp/libvo/Makefile 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/vosub_vidix.c mplayerxp/mp_image.c mplayerxp/osdep/Makefile mplayerxp/postproc/af_export.c mplayerxp/postproc/af_ffenc.c mplayerxp/postproc/af_scaletempo.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_denoise3d.c mplayerxp/postproc/vf_dint.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_il.c mplayerxp/postproc/vf_menu.c mplayerxp/postproc/vf_mirror.c mplayerxp/postproc/vf_noise.c mplayerxp/postproc/vf_panscan.c mplayerxp/postproc/vf_perspective.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_yuy2.c mplayerxp/postproc/vf_yvu9.c Added Paths: ----------- mplayerxp/osdep/aclib.c mplayerxp/osdep/aclib_template.c mplayerxp/osdep/fastmemcpy.h Removed Paths: ------------- mplayerxp/libvo/aclib.c mplayerxp/libvo/aclib_template.c mplayerxp/libvo/fastmemcpy.h Modified: mplayerxp/libao2/ao_sdl.c =================================================================== --- mplayerxp/libao2/ao_sdl.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libao2/ao_sdl.c 2012-10-29 12:34:45 UTC (rev 245) @@ -17,7 +17,7 @@ #include "audio_out_internal.h" #include "afmt.h" #include <SDL/SDL.h> -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "ao_msg.h" static ao_info_t info = Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-29 12:34:45 UTC (rev 245) @@ -3,11 +3,11 @@ #include <unistd.h> #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" -#include "libvo/fastmemcpy.h" #include "mp_config.h" #include "mplayer.h" #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" +#include "osdep/fastmemcpy.h" #include "codecs_ld.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-10-29 12:34:45 UTC (rev 245) @@ -16,10 +16,10 @@ #include "ad.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" -#include "../mplayer.h" +#include "mplayer.h" #include "libmpdemux/demuxer_r.h" #include "postproc/af.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "ad_msg.h" #ifdef USE_FAKE_MONO Modified: mplayerxp/libmpcodecs/vd_xanim.c =================================================================== --- mplayerxp/libmpcodecs/vd_xanim.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libmpcodecs/vd_xanim.c 2012-10-29 12:34:45 UTC (rev 245) @@ -20,7 +20,7 @@ #include "libvo/img_format.h" #include "osdep/timer.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "mp_config.h" #include "vd_internal.h" #include "codecs_ld.h" Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libmpdemux/cache2.c 2012-10-29 12:34:45 UTC (rev 245) @@ -18,7 +18,7 @@ #include "osdep/timer.h" #include "osdep/cpudetect.h" #include "osdep/bswap.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "help_mp.h" #include "mpdemux.h" #include "mplayer.h" Modified: mplayerxp/libmpdemux/demux_bmp.c =================================================================== --- mplayerxp/libmpdemux/demux_bmp.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libmpdemux/demux_bmp.c 2012-10-29 12:34:45 UTC (rev 245) @@ -8,15 +8,15 @@ #include <unistd.h> #include <inttypes.h> -#include "../mp_config.h" +#include "mp_config.h" #include "help_mp.h" #include "stream.h" #include "demuxer.h" #include "stheader.h" -#include "../libvo/img_format.h" -#include "../libvo/fastmemcpy.h" +#include "libvo/img_format.h" +#include "osdep/fastmemcpy.h" #ifdef HAVE_SDL_IMAGE #include <SDL/SDL_image.h> Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-29 12:34:45 UTC (rev 245) @@ -10,9 +10,9 @@ #include <sys/stat.h> #include "stream.h" -#include "../mp_config.h" -#include "../help_mp.h" -#include "../mplayer.h" +#include "mp_config.h" +#include "help_mp.h" +#include "mplayer.h" #include "libmpsub/subreader.h" #include "libmpconf/cfgparser.h" #include "nls/nls.h" @@ -20,7 +20,7 @@ #include "demuxer.h" #include "stheader.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "libvo/sub.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/s_tv.c =================================================================== --- mplayerxp/libmpdemux/s_tv.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libmpdemux/s_tv.c 2012-10-29 12:34:45 UTC (rev 245) @@ -17,7 +17,7 @@ #include <stdlib.h> #include <string.h> #include "stream.h" -#include "../input/input.h" +#include "input/input.h" #include "mrl.h" /* some default values */ @@ -61,10 +61,10 @@ #include "demuxer.h" #include "stheader.h" -#include "../libao2/afmt.h" -#include "../libvo/img_format.h" -#include "../libvo/fastmemcpy.h" -#include "../libao2/audio_out.h" +#include "libao2/afmt.h" +#include "libvo/img_format.h" +#include "osdep/fastmemcpy.h" +#include "libao2/audio_out.h" #include "tv.h" Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libmpdemux/stream.c 2012-10-29 12:34:45 UTC (rev 245) @@ -10,11 +10,11 @@ #include <signal.h> #include <sys/wait.h> -#include "../mp_config.h" -#include "../mplayer.h" +#include "mp_config.h" +#include "mplayer.h" #include "help_mp.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "stream.h" #include "demuxer.h" Modified: mplayerxp/libvo/Makefile =================================================================== --- mplayerxp/libvo/Makefile 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/Makefile 2012-10-29 12:34:45 UTC (rev 245) @@ -3,7 +3,7 @@ LIBNAME = libvo.a -SRCS=aspect.c aclib.c osd.c font_load.c video_out.c vo_null.c img_format.c sub.c screenshot.c +SRCS=aspect.c osd.c font_load.c video_out.c vo_null.c img_format.c sub.c screenshot.c ifeq ($(HAVE_SDL),yes) SRCS+=vo_sdl.c endif Deleted: mplayerxp/libvo/aclib.c =================================================================== --- mplayerxp/libvo/aclib.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/aclib.c 2012-10-29 12:34:45 UTC (rev 245) @@ -1,98 +0,0 @@ -#include <stdio.h> -#include <pthread.h> -#include "mp_config.h" -#include "mplayer.h" -#define MSGT_CLASS MSGT_GLOBAL -#include "__mp_msg.h" - -#if defined(USE_FASTMEMCPY) -#include "fastmemcpy.h" -#include "osdep/cpudetect.h" - -#define BLOCK_SIZE 4096 -#define CONFUSION_FACTOR 0 - -#define PVECTOR_ACCEL_H "aclib_template.c" -#include "pvector/pvector_inc.h" - -/* - aclib - advanced C library ;) - This file contains functions which improve and expand standard C-library - see aclib_template.c ... this file only contains runtime cpu detection and config options stuff - runtime cpu detection by michael niedermayer (mic...@gm...) is under GPL -*/ - -static any_t* init_fast_memcpy(any_t* to, const any_t* from, size_t len) -{ -#ifdef __SSE2__ - if(gCpuCaps.hasSSE2) - { - MSG_V("Using SSE2 optimized memcpy\n"); - fast_memcpy_ptr = fast_memcpy_SSE2; - } - else -#endif -#ifndef __x86_64__ -#ifdef __SSE__ - if(gCpuCaps.hasMMX2) - { - MSG_V("Using MMX2 optimized memcpy\n"); - fast_memcpy_ptr = fast_memcpy_SSE; - } - else -#endif -//#ifdef __MMX__ -// if(gCpuCaps.hasMMX) -// { -// MSG_V("Using MMX optimized memcpy\n"); -// fast_memcpy_ptr = fast_memcpy_MMX; -// } -// else -//#endif -#endif - { - MSG_V("Using generic memcpy\n"); - fast_memcpy_ptr = memcpy; /* prior to mmx we use the standart memcpy */ - } - return (*fast_memcpy_ptr)(to,from,len); -} - -static any_t* init_stream_copy(any_t* to, const any_t* from, size_t len) -{ -#ifdef __SSE2__ - if(gCpuCaps.hasSSE2) - { - MSG_V("Using SSE2 optimized agpcpy\n"); - fast_stream_copy_ptr = fast_stream_copy_SSE2; - } -#endif -#ifndef __x86_64__ -#ifdef __SSE__ - if(gCpuCaps.hasMMX2) - { - MSG_V("Using MMX2 optimized agpcpy\n"); - fast_stream_copy_ptr = fast_stream_copy_SSE; - } - else -#endif -//#ifdef __MMX__ -// if(gCpuCaps.hasMMX) -// { -// MSG_V("Using MMX optimized agpcpy\n"); -// fast_stream_copy_ptr = fast_stream_copy_MMX; -// } -// else -//#endif -#endif - { - MSG_V("Using generic optimized agpcpy\n"); - fast_stream_copy_ptr = memcpy; /* prior to mmx we use the standart memcpy */ - } - return (*fast_stream_copy_ptr)(to,from,len); -} - -any_t*(*fast_memcpy_ptr)(any_t* to, const any_t* from, size_t len) = init_fast_memcpy; -any_t*(*fast_stream_copy_ptr)(any_t* to, const any_t* from, size_t len) = init_stream_copy; - -#endif /* use fastmemcpy */ - Deleted: mplayerxp/libvo/aclib_template.c =================================================================== --- mplayerxp/libvo/aclib_template.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/aclib_template.c 2012-10-29 12:34:45 UTC (rev 245) @@ -1,179 +0,0 @@ -/* - aclib - advanced C library ;) - This file contains functions which improve and expand standard C-library -*/ -#include "pvector/pvector.h" - -#ifdef HAVE_INT_PVECTOR -/* for small memory blocks (<256 bytes) this version is faster */ -#undef small_memcpy -#ifdef __x86_64__ -#define small_memcpy(to,from,n)\ -{\ -register unsigned long int siz;\ -register unsigned long int dummy;\ - siz=n&0x7; n>>=3;\ - if(siz)\ -__asm__ __volatile__(\ - "rep; movsb"\ - :"=&D"(to), "=&S"(from), "=&c"(dummy)\ -/* It's most portable way to notify compiler */\ -/* that edi, esi and ecx are clobbered in asm block. */\ -/* Thanks to A'rpi for hint!!! */\ - :"0" (to), "1" (from),"2" (siz)\ - : "memory","cc");\ - if(n)\ -__asm__ __volatile__(\ - "rep; movsq"\ - :"=&D"(to), "=&S"(from), "=&c"(dummy)\ -/* It's most portable way to notify compiler */\ -/* that edi, esi and ecx are clobbered in asm block. */\ -/* Thanks to A'rpi for hint!!! */\ - :"0" (to), "1" (from),"2" (n)\ - : "memory","cc");\ -} -#else -#define small_memcpy(to,from,n)\ -{\ -register unsigned long int dummy;\ -__asm__ __volatile__(\ - "rep; movsb"\ - :"=&D"(to), "=&S"(from), "=&c"(dummy)\ -/* It's most portable way to notify compiler */\ -/* that edi, esi and ecx are clobbered in asm block. */\ -/* Thanks to A'rpi for hint!!! */\ - :"0" (to), "1" (from),"2" (n)\ - : "memory","cc");\ -} -#endif - -#undef MIN_LEN -#if defined( OPTIMIZE_MMX ) && !defined( OPTIMIZE_MMX2 ) -#define MIN_LEN 0x800 /* 2K blocks. Was found experimentally */ -#else -#define MIN_LEN __IVEC_SIZE*8 -#endif - -#undef FAST_MEMORY_COPY -#define FAST_MEMORY_COPY(to,from, len)\ -{\ - any_t*retval;\ - const unsigned char *cfrom=from;\ - unsigned char *tto=to;\ - const unsigned block_size = __IVEC_SIZE*8;\ - __ivec iarr[8];\ - size_t i;\ - retval = to;\ - if(!len) return retval;\ -\ - _ivec_prefetch(&cfrom[0]);\ - _ivec_prefetch(&cfrom[32]);\ - _ivec_prefetch(&cfrom[64]);\ - _ivec_prefetch(&cfrom[96]);\ - _ivec_prefetch(&cfrom[128]);\ - _ivec_prefetch(&cfrom[160]);\ - _ivec_prefetch(&cfrom[192]);\ - _ivec_prefetch(&cfrom[224]);\ - _ivec_prefetch(&cfrom[256]);\ -\ - if(len >= MIN_LEN)\ - {\ - register unsigned long int delta;\ - /* Align destinition to cache-line size -boundary */\ - delta = ((unsigned long int)tto)&(gCpuCaps.cl_size-1);\ - if(delta) {\ - delta=gCpuCaps.cl_size-delta;\ - len -= delta;\ - small_memcpy(tto, cfrom, delta);\ - }\ - i = len/block_size;\ - len&=(block_size-1);\ - /*\ - This algorithm is top effective when the code consequently\ - reads and writes blocks which have size of cache line.\ - Size of cache line is processor-dependent.\ - It will, however, be a minimum of 32 bytes on any processors.\ - It would be better to have a number of instructions which\ - perform reading and writing to be multiple to a number of\ - processor's decoders, but it's not always possible.\ - */\ - if(((unsigned long)cfrom) & 15)\ - /* 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]);\ - cfrom+=block_size;\ - tto+=block_size;\ - }\ - else\ - /* 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]);\ - cfrom+=block_size;\ - tto+=block_size;\ - }\ - MEM_SFENCE\ - _ivec_empty();\ - }\ - /*\ - * Now do the tail of the block\ - */\ - if(len) small_memcpy(tto, cfrom, len);\ - return retval;\ -} - -#undef MEM_STORE -#undef MEM_SFENCE -#define MEM_STORE _ivec_stream -#define MEM_SFENCE _ivec_sfence(); -static inline any_t* PVECTOR_RENAME(fast_stream_copy)(any_t* to, const any_t* from, size_t len) -{ - MSG_DBG3("fast_stream_copy(%p, %p, %u) [cl_size=%u]\n",to,from,len,gCpuCaps.cl_size); - FAST_MEMORY_COPY(to,from,len); -} - -#undef MEM_STORE -#undef MEM_SFENCE -#define MEM_STORE _ivec_storea -#define MEM_SFENCE -static inline any_t* PVECTOR_RENAME(fast_memcpy)(any_t* to, const any_t* from, size_t len) -{ - MSG_DBG3("fast_memcpy(%p, %p, %u) [cl_size=%u]\n",to,from,len,gCpuCaps.cl_size); - FAST_MEMORY_COPY(to,from,len); -} -#endif Deleted: mplayerxp/libvo/fastmemcpy.h =================================================================== --- mplayerxp/libvo/fastmemcpy.h 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/fastmemcpy.h 2012-10-29 12:34:45 UTC (rev 245) @@ -1,55 +0,0 @@ -#ifndef __MPLAYER_MEMCPY -#define __MPLAYER_MEMCPY 1 - -#include "../mp_config.h" - -#ifdef USE_FASTMEMCPY -#include <stddef.h> -#include <string.h> /* memcpy prototypes */ -extern any_t* (*fast_memcpy_ptr)(any_t* to, const any_t* from, size_t len); -extern any_t* (*fast_stream_copy_ptr)(any_t* to, const any_t* from, size_t len); -#define memcpy(a,b,c) (*fast_memcpy_ptr)(a,b,c) -#define stream_copy(a,b,c) (*fast_stream_copy_ptr)(a,b,c) -#else -#define stream_copy(a,b,c) memcpy(a,b,c) -#endif - -static inline any_t* stream_copy_pic(any_t* dst, const any_t* src, int bytesPerLine, int height, int dstStride, int srcStride) -{ - int i; - any_t*retval=dst; - - if(dstStride == srcStride) stream_copy(dst, src, srcStride*height); - else - { - for(i=0; i<height; i++) - { - stream_copy(dst, src, bytesPerLine); - src+= srcStride; - dst+= dstStride; - } - } - - return retval; -} - -static inline any_t* memcpy_pic(any_t* dst, const any_t* src, int bytesPerLine, int height, int dstStride, int srcStride) -{ - int i; - any_t*retval=dst; - - if(dstStride == srcStride) memcpy(dst, src, srcStride*height); - else - { - for(i=0; i<height; i++) - { - memcpy(dst, src, bytesPerLine); - src+= srcStride; - dst+= dstStride; - } - } - - return retval; -} - -#endif Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/video_out.c 2012-10-29 12:34:45 UTC (rev 245) @@ -35,7 +35,7 @@ #include "xmp_core.h" #include "osdep/my_malloc.h" #include "mplayer.h" -#include "fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "img_format.h" #include "screenshot.h" #include "osdep/bswap.h" Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/vo_dga.c 2012-10-29 12:34:45 UTC (rev 245) @@ -20,8 +20,8 @@ #include <string.h> #include <errno.h> -#include "../mp_config.h" -#include "../mplayer.h" +#include "mp_config.h" +#include "mplayer.h" #include "video_out.h" #include "video_out_internal.h" #include "aspect.h" @@ -37,7 +37,7 @@ #include "x11_common.h" -#include "fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "dri_vo.h" //#define VO_DGA_DBG 1 //#undef HAVE_DGA2 Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/vo_fbdev.c 2012-10-29 12:34:45 UTC (rev 245) @@ -23,10 +23,10 @@ #include <linux/fb.h> #include "mp_config.h" -#include "../mplayer.h" +#include "mplayer.h" #include "video_out.h" #include "video_out_internal.h" -#include "fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "sub.h" #ifdef CONFIG_VIDIX #include "vosub_vidix.h" @@ -34,7 +34,7 @@ #include "aspect.h" #include "osd.h" #include "dri_vo.h" -#include "../libmpdemux/mrl.h" +#include "libmpdemux/mrl.h" LIBVO_EXTERN(fbdev) Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/vo_opengl.c 2012-10-29 12:34:45 UTC (rev 245) @@ -51,7 +51,7 @@ #ifdef CONFIG_GUI #include "gui/interface.h" #endif -#include "fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "postproc/vfcap.h" #include "vo_msg.h" Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/vo_sdl.c 2012-10-29 12:34:45 UTC (rev 245) @@ -113,7 +113,7 @@ #include "video_out.h" -#include "fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "sub.h" #include "aspect.h" Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/vo_vesa.c 2012-10-29 12:34:45 UTC (rev 245) @@ -34,7 +34,7 @@ #include "video_out.h" #include "video_out_internal.h" -#include "fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "sub.h" #include "osdep/vbelib.h" #include "osdep/bswap.h" Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/vo_x11.c 2012-10-29 12:34:45 UTC (rev 245) @@ -38,7 +38,7 @@ #include "x11_common.h" -#include "fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "sub.h" #include "postproc/swscale.h" /* for MODE_RGB(BGR) definitions */ Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/vo_xv.c 2012-10-29 12:34:45 UTC (rev 245) @@ -31,7 +31,7 @@ #include "x11_common.h" -#include "fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "sub.h" #include "aspect.h" #include "dri_vo.h" Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/libvo/vosub_vidix.c 2012-10-29 12:34:45 UTC (rev 245) @@ -20,8 +20,8 @@ #include <string.h> #include <errno.h> -#include "../mp_config.h" -#include "../mplayer.h" +#include "mp_config.h" +#include "mplayer.h" #ifdef HAVE_MEMALIGN #include <malloc.h> #endif @@ -30,12 +30,12 @@ #include "video_out.h" #include "vosub_vidix.h" -#include "fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "osd.h" #include "sub.h" #include "video_out.h" #include "dri_vo.h" -#include "../mp_image.h" +#include "mp_image.h" #include "vo_msg.h" #ifndef min Modified: mplayerxp/mp_image.c =================================================================== --- mplayerxp/mp_image.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/mp_image.c 2012-10-29 12:34:45 UTC (rev 245) @@ -11,7 +11,7 @@ #include "libvo/img_format.h" #include "mp_image.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #define MSGT_CLASS MSGT_CPLAYER #include "__mp_msg.h" Modified: mplayerxp/osdep/Makefile =================================================================== --- mplayerxp/osdep/Makefile 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/osdep/Makefile 2012-10-29 12:34:45 UTC (rev 245) @@ -3,7 +3,7 @@ LIBNAME = libosdep.a -SRCS=cpudetect.c getch2.c timer-lx.c timer.c shmem.c get_path.c my_malloc.c my_profile.c +SRCS=aclib.c cpudetect.c getch2.c timer-lx.c timer.c shmem.c get_path.c my_malloc.c my_profile.c OBJS=$(SRCS:.c=.o) ifeq ($(TARGET_OS),LINUX_GNU) Copied: mplayerxp/osdep/aclib.c (from rev 244, mplayerxp/libvo/aclib.c) =================================================================== --- mplayerxp/osdep/aclib.c (rev 0) +++ mplayerxp/osdep/aclib.c 2012-10-29 12:34:45 UTC (rev 245) @@ -0,0 +1,98 @@ +#include <stdio.h> +#include <pthread.h> +#include "mp_config.h" +#include "mplayer.h" +#define MSGT_CLASS MSGT_GLOBAL +#include "__mp_msg.h" + +#if defined(USE_FASTMEMCPY) +#include "fastmemcpy.h" +#include "osdep/cpudetect.h" + +#define BLOCK_SIZE 4096 +#define CONFUSION_FACTOR 0 + +#define PVECTOR_ACCEL_H "aclib_template.c" +#include "pvector/pvector_inc.h" + +/* + aclib - advanced C library ;) + This file contains functions which improve and expand standard C-library + see aclib_template.c ... this file only contains runtime cpu detection and config options stuff + runtime cpu detection by michael niedermayer (mic...@gm...) is under GPL +*/ + +static any_t* init_fast_memcpy(any_t* to, const any_t* from, size_t len) +{ +#ifdef __SSE2__ + if(gCpuCaps.hasSSE2) + { + MSG_V("Using SSE2 optimized memcpy\n"); + fast_memcpy_ptr = fast_memcpy_SSE2; + } + else +#endif +#ifndef __x86_64__ +#ifdef __SSE__ + if(gCpuCaps.hasMMX2) + { + MSG_V("Using MMX2 optimized memcpy\n"); + fast_memcpy_ptr = fast_memcpy_SSE; + } + else +#endif +//#ifdef __MMX__ +// if(gCpuCaps.hasMMX) +// { +// MSG_V("Using MMX optimized memcpy\n"); +// fast_memcpy_ptr = fast_memcpy_MMX; +// } +// else +//#endif +#endif + { + MSG_V("Using generic memcpy\n"); + fast_memcpy_ptr = memcpy; /* prior to mmx we use the standart memcpy */ + } + return (*fast_memcpy_ptr)(to,from,len); +} + +static any_t* init_stream_copy(any_t* to, const any_t* from, size_t len) +{ +#ifdef __SSE2__ + if(gCpuCaps.hasSSE2) + { + MSG_V("Using SSE2 optimized agpcpy\n"); + fast_stream_copy_ptr = fast_stream_copy_SSE2; + } +#endif +#ifndef __x86_64__ +#ifdef __SSE__ + if(gCpuCaps.hasMMX2) + { + MSG_V("Using MMX2 optimized agpcpy\n"); + fast_stream_copy_ptr = fast_stream_copy_SSE; + } + else +#endif +//#ifdef __MMX__ +// if(gCpuCaps.hasMMX) +// { +// MSG_V("Using MMX optimized agpcpy\n"); +// fast_stream_copy_ptr = fast_stream_copy_MMX; +// } +// else +//#endif +#endif + { + MSG_V("Using generic optimized agpcpy\n"); + fast_stream_copy_ptr = memcpy; /* prior to mmx we use the standart memcpy */ + } + return (*fast_stream_copy_ptr)(to,from,len); +} + +any_t*(*fast_memcpy_ptr)(any_t* to, const any_t* from, size_t len) = init_fast_memcpy; +any_t*(*fast_stream_copy_ptr)(any_t* to, const any_t* from, size_t len) = init_stream_copy; + +#endif /* use fastmemcpy */ + Copied: mplayerxp/osdep/aclib_template.c (from rev 229, mplayerxp/libvo/aclib_template.c) =================================================================== --- mplayerxp/osdep/aclib_template.c (rev 0) +++ mplayerxp/osdep/aclib_template.c 2012-10-29 12:34:45 UTC (rev 245) @@ -0,0 +1,179 @@ +/* + aclib - advanced C library ;) + This file contains functions which improve and expand standard C-library +*/ +#include "pvector/pvector.h" + +#ifdef HAVE_INT_PVECTOR +/* for small memory blocks (<256 bytes) this version is faster */ +#undef small_memcpy +#ifdef __x86_64__ +#define small_memcpy(to,from,n)\ +{\ +register unsigned long int siz;\ +register unsigned long int dummy;\ + siz=n&0x7; n>>=3;\ + if(siz)\ +__asm__ __volatile__(\ + "rep; movsb"\ + :"=&D"(to), "=&S"(from), "=&c"(dummy)\ +/* It's most portable way to notify compiler */\ +/* that edi, esi and ecx are clobbered in asm block. */\ +/* Thanks to A'rpi for hint!!! */\ + :"0" (to), "1" (from),"2" (siz)\ + : "memory","cc");\ + if(n)\ +__asm__ __volatile__(\ + "rep; movsq"\ + :"=&D"(to), "=&S"(from), "=&c"(dummy)\ +/* It's most portable way to notify compiler */\ +/* that edi, esi and ecx are clobbered in asm block. */\ +/* Thanks to A'rpi for hint!!! */\ + :"0" (to), "1" (from),"2" (n)\ + : "memory","cc");\ +} +#else +#define small_memcpy(to,from,n)\ +{\ +register unsigned long int dummy;\ +__asm__ __volatile__(\ + "rep; movsb"\ + :"=&D"(to), "=&S"(from), "=&c"(dummy)\ +/* It's most portable way to notify compiler */\ +/* that edi, esi and ecx are clobbered in asm block. */\ +/* Thanks to A'rpi for hint!!! */\ + :"0" (to), "1" (from),"2" (n)\ + : "memory","cc");\ +} +#endif + +#undef MIN_LEN +#if defined( OPTIMIZE_MMX ) && !defined( OPTIMIZE_MMX2 ) +#define MIN_LEN 0x800 /* 2K blocks. Was found experimentally */ +#else +#define MIN_LEN __IVEC_SIZE*8 +#endif + +#undef FAST_MEMORY_COPY +#define FAST_MEMORY_COPY(to,from, len)\ +{\ + any_t*retval;\ + const unsigned char *cfrom=from;\ + unsigned char *tto=to;\ + const unsigned block_size = __IVEC_SIZE*8;\ + __ivec iarr[8];\ + size_t i;\ + retval = to;\ + if(!len) return retval;\ +\ + _ivec_prefetch(&cfrom[0]);\ + _ivec_prefetch(&cfrom[32]);\ + _ivec_prefetch(&cfrom[64]);\ + _ivec_prefetch(&cfrom[96]);\ + _ivec_prefetch(&cfrom[128]);\ + _ivec_prefetch(&cfrom[160]);\ + _ivec_prefetch(&cfrom[192]);\ + _ivec_prefetch(&cfrom[224]);\ + _ivec_prefetch(&cfrom[256]);\ +\ + if(len >= MIN_LEN)\ + {\ + register unsigned long int delta;\ + /* Align destinition to cache-line size -boundary */\ + delta = ((unsigned long int)tto)&(gCpuCaps.cl_size-1);\ + if(delta) {\ + delta=gCpuCaps.cl_size-delta;\ + len -= delta;\ + small_memcpy(tto, cfrom, delta);\ + }\ + i = len/block_size;\ + len&=(block_size-1);\ + /*\ + This algorithm is top effective when the code consequently\ + reads and writes blocks which have size of cache line.\ + Size of cache line is processor-dependent.\ + It will, however, be a minimum of 32 bytes on any processors.\ + It would be better to have a number of instructions which\ + perform reading and writing to be multiple to a number of\ + processor's decoders, but it's not always possible.\ + */\ + if(((unsigned long)cfrom) & 15)\ + /* 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]);\ + cfrom+=block_size;\ + tto+=block_size;\ + }\ + else\ + /* 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]);\ + cfrom+=block_size;\ + tto+=block_size;\ + }\ + MEM_SFENCE\ + _ivec_empty();\ + }\ + /*\ + * Now do the tail of the block\ + */\ + if(len) small_memcpy(tto, cfrom, len);\ + return retval;\ +} + +#undef MEM_STORE +#undef MEM_SFENCE +#define MEM_STORE _ivec_stream +#define MEM_SFENCE _ivec_sfence(); +static inline any_t* PVECTOR_RENAME(fast_stream_copy)(any_t* to, const any_t* from, size_t len) +{ + MSG_DBG3("fast_stream_copy(%p, %p, %u) [cl_size=%u]\n",to,from,len,gCpuCaps.cl_size); + FAST_MEMORY_COPY(to,from,len); +} + +#undef MEM_STORE +#undef MEM_SFENCE +#define MEM_STORE _ivec_storea +#define MEM_SFENCE +static inline any_t* PVECTOR_RENAME(fast_memcpy)(any_t* to, const any_t* from, size_t len) +{ + MSG_DBG3("fast_memcpy(%p, %p, %u) [cl_size=%u]\n",to,from,len,gCpuCaps.cl_size); + FAST_MEMORY_COPY(to,from,len); +} +#endif Copied: mplayerxp/osdep/fastmemcpy.h (from rev 229, mplayerxp/libvo/fastmemcpy.h) =================================================================== --- mplayerxp/osdep/fastmemcpy.h (rev 0) +++ mplayerxp/osdep/fastmemcpy.h 2012-10-29 12:34:45 UTC (rev 245) @@ -0,0 +1,55 @@ +#ifndef __MPLAYER_MEMCPY +#define __MPLAYER_MEMCPY 1 + +#include "../mp_config.h" + +#ifdef USE_FASTMEMCPY +#include <stddef.h> +#include <string.h> /* memcpy prototypes */ +extern any_t* (*fast_memcpy_ptr)(any_t* to, const any_t* from, size_t len); +extern any_t* (*fast_stream_copy_ptr)(any_t* to, const any_t* from, size_t len); +#define memcpy(a,b,c) (*fast_memcpy_ptr)(a,b,c) +#define stream_copy(a,b,c) (*fast_stream_copy_ptr)(a,b,c) +#else +#define stream_copy(a,b,c) memcpy(a,b,c) +#endif + +static inline any_t* stream_copy_pic(any_t* dst, const any_t* src, int bytesPerLine, int height, int dstStride, int srcStride) +{ + int i; + any_t*retval=dst; + + if(dstStride == srcStride) stream_copy(dst, src, srcStride*height); + else + { + for(i=0; i<height; i++) + { + stream_copy(dst, src, bytesPerLine); + src+= srcStride; + dst+= dstStride; + } + } + + return retval; +} + +static inline any_t* memcpy_pic(any_t* dst, const any_t* src, int bytesPerLine, int height, int dstStride, int srcStride) +{ + int i; + any_t*retval=dst; + + if(dstStride == srcStride) memcpy(dst, src, srcStride*height); + else + { + for(i=0; i<height; i++) + { + memcpy(dst, src, bytesPerLine); + src+= srcStride; + dst+= dstStride; + } + } + + return retval; +} + +#endif Modified: mplayerxp/postproc/af_export.c =================================================================== --- mplayerxp/postproc/af_export.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/af_export.c 2012-10-29 12:34:45 UTC (rev 245) @@ -1,7 +1,7 @@ /* This audio filter exports the incomming signal to other processes using memory mapping. Memory mapped area contains a header: - int nch, - int size, + int nch, + int size, unsigned long long counter (updated every time the contents of the area changes), the rest is payload (non-interleaved). @@ -12,7 +12,7 @@ #include <string.h> #include <inttypes.h> #include <unistd.h> -#include "../mp_config.h" +#include "mp_config.h" #ifdef HAVE_SYS_MMAN_H #include <sys/types.h> @@ -22,9 +22,9 @@ #include <fcntl.h> #include "af.h" -#include "../help_mp.h" -#include "../osdep/get_path.h" -#include "libvo/fastmemcpy.h" +#include "help_mp.h" +#include "osdep/get_path.h" +#include "osdep/fastmemcpy.h" #define DEF_SZ 512 // default buffer size (in samples) #define SHARED_FILE "mplayer-af_export" /* default file name Modified: mplayerxp/postproc/af_ffenc.c =================================================================== --- mplayerxp/postproc/af_ffenc.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/af_ffenc.c 2012-10-29 12:34:45 UTC (rev 245) @@ -4,8 +4,8 @@ #include <dlfcn.h> #include "mp_config.h" #include "libavcodec/avcodec.h" -#include "../libmpcodecs/codecs_ld.h" -#include "../libvo/fastmemcpy.h" +#include "libmpcodecs/codecs_ld.h" +#include "osdep/fastmemcpy.h" #include "af.h" #define MIN_LIBAVCODEC_VERSION_INT ((51<<16)+(0<<8)+0) Modified: mplayerxp/postproc/af_scaletempo.c =================================================================== --- mplayerxp/postproc/af_scaletempo.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/af_scaletempo.c 2012-10-29 12:34:45 UTC (rev 245) @@ -34,7 +34,7 @@ #include <stdlib.h> #include <string.h> #include <limits.h> -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "af.h" Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf.c 2012-10-29 12:34:45 UTC (rev 245) @@ -2,7 +2,7 @@ #include <stdlib.h> #include <string.h> -#include "../mp_config.h" +#include "mp_config.h" #ifdef HAVE_MALLOC #include <malloc.h> #endif @@ -15,7 +15,7 @@ #include "mp_image.h" #include "vf.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "libmpconf/codec-cfg.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_delogo.c =================================================================== --- mplayerxp/postproc/vf_delogo.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_delogo.c 2012-10-29 12:34:45 UTC (rev 245) @@ -34,7 +34,7 @@ #include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "pp_msg.h" //===========================================================================// Modified: mplayerxp/postproc/vf_denoise3d.c =================================================================== --- mplayerxp/postproc/vf_denoise3d.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_denoise3d.c 2012-10-29 12:34:45 UTC (rev 245) @@ -22,16 +22,16 @@ #include <inttypes.h> #include <math.h> -#include "../mp_config.h" +#include "mp_config.h" #ifdef HAVE_MALLOC #include <malloc.h> #endif -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "pp_msg.h" #define PARAM1_DEFAULT 4.0 Modified: mplayerxp/postproc/vf_dint.c =================================================================== --- mplayerxp/postproc/vf_dint.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_dint.c 2012-10-29 12:34:45 UTC (rev 245) @@ -3,11 +3,11 @@ #include <string.h> #include <inttypes.h> -#include "../mp_config.h" -#include "../libvo/fastmemcpy.h" +#include "mp_config.h" +#include "osdep/fastmemcpy.h" #include "mp_image.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "vf.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_down3dright.c =================================================================== --- mplayerxp/postproc/vf_down3dright.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_down3dright.c 2012-10-29 12:34:45 UTC (rev 245) @@ -10,7 +10,7 @@ #include "mp_image.h" #include "vf.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "postproc/swscale.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_expand.c =================================================================== --- mplayerxp/postproc/vf_expand.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_expand.c 2012-10-29 12:34:45 UTC (rev 245) @@ -4,18 +4,18 @@ #include <stdlib.h> #include <string.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #ifdef OSD_SUPPORT -#include "../libvo/video_out.h" -#include "../libvo/sub.h" -#include "../libvo/osd.h" +#include "libvo/video_out.h" +#include "libvo/sub.h" +#include "libvo/osd.h" #endif #include "pp_msg.h" Modified: mplayerxp/postproc/vf_il.c =================================================================== --- mplayerxp/postproc/vf_il.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_il.c 2012-10-29 12:34:45 UTC (rev 245) @@ -22,16 +22,16 @@ #include <inttypes.h> #include <assert.h> -#include "../mp_config.h" +#include "mp_config.h" #ifdef HAVE_MALLOC #include <malloc.h> #endif -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_menu.c =================================================================== --- mplayerxp/postproc/vf_menu.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_menu.c 2012-10-29 12:34:45 UTC (rev 245) @@ -16,7 +16,7 @@ #include "mp_image.h" #include "vf.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "libvo/video_out.h" #include "libvo/font_load.h" #include "input/input.h" Modified: mplayerxp/postproc/vf_mirror.c =================================================================== --- mplayerxp/postproc/vf_mirror.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_mirror.c 2012-10-29 12:34:45 UTC (rev 245) @@ -3,14 +3,14 @@ #include <string.h> #include <inttypes.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" -#include "../postproc/swscale.h" +#include "osdep/fastmemcpy.h" +#include "postproc/swscale.h" #include "pp_msg.h" typedef void (* __FASTCALL__ mirror_f)(unsigned char* dst,unsigned char* src,unsigned dststride,unsigned srcstride,unsigned w,unsigned h,unsigned bpp,unsigned int fmt,int finalize); Modified: mplayerxp/postproc/vf_noise.c =================================================================== --- mplayerxp/postproc/vf_noise.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_noise.c 2012-10-29 12:34:45 UTC (rev 245) @@ -32,7 +32,7 @@ #include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "pp_msg.h" #define MAX_NOISE 4096 Modified: mplayerxp/postproc/vf_panscan.c =================================================================== --- mplayerxp/postproc/vf_panscan.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_panscan.c 2012-10-29 12:34:45 UTC (rev 245) @@ -4,17 +4,17 @@ #include <stdlib.h> #include <string.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #ifdef OSD_SUPPORT -#include "../libvo/sub.h" -#include "../libvo/osd.h" +#include "libvo/sub.h" +#include "libvo/osd.h" #endif #include "pp_msg.h" Modified: mplayerxp/postproc/vf_perspective.c =================================================================== --- mplayerxp/postproc/vf_perspective.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_perspective.c 2012-10-29 12:34:45 UTC (rev 245) @@ -23,16 +23,16 @@ #include <assert.h> #include <math.h> -#include "../mp_config.h" +#include "mp_config.h" #ifdef HAVE_MALLOC #include <malloc.h> #endif -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "pp_msg.h" #define SUB_PIXEL_BITS 8 Modified: mplayerxp/postproc/vf_raw.c =================================================================== --- mplayerxp/postproc/vf_raw.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_raw.c 2012-10-29 12:34:45 UTC (rev 245) @@ -7,14 +7,14 @@ #include <string.h> #include <inttypes.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" -#include "../postproc/swscale.h" +#include "osdep/fastmemcpy.h" +#include "postproc/swscale.h" #include "pp_msg.h" struct vf_priv_s { Modified: mplayerxp/postproc/vf_rectangle.c =================================================================== --- mplayerxp/postproc/vf_rectangle.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_rectangle.c 2012-10-29 12:34:45 UTC (rev 245) @@ -4,7 +4,7 @@ #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "pp_msg.h" struct vf_priv_s { Modified: mplayerxp/postproc/vf_rgb2bgr.c =================================================================== --- mplayerxp/postproc/vf_rgb2bgr.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_rgb2bgr.c 2012-10-29 12:34:45 UTC (rev 245) @@ -3,13 +3,13 @@ #include <string.h> #include <inttypes.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "libswscale/rgb2rgb.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_rotate.c =================================================================== --- mplayerxp/postproc/vf_rotate.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_rotate.c 2012-10-29 12:34:45 UTC (rev 245) @@ -3,14 +3,14 @@ #include <string.h> #include <inttypes.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" -#include "../postproc/swscale.h" +#include "osdep/fastmemcpy.h" +#include "postproc/swscale.h" #include "pp_msg.h" struct vf_priv_s { Modified: mplayerxp/postproc/vf_scale.c =================================================================== --- mplayerxp/postproc/vf_scale.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_scale.c 2012-10-29 12:34:45 UTC (rev 245) @@ -11,7 +11,7 @@ #include "vf.h" #include "libvo/video_out.h" -#include "libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "swscale.h" #include "libavutil/log.h" #include "vf_scale.h" Modified: mplayerxp/postproc/vf_smartblur.c =================================================================== --- mplayerxp/postproc/vf_smartblur.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_smartblur.c 2012-10-29 12:34:45 UTC (rev 245) @@ -22,7 +22,7 @@ #include <inttypes.h> #include <assert.h> -#include "../mp_config.h" +#include "mp_config.h" #ifdef USE_SETLOCALE #include <locale.h> @@ -32,11 +32,11 @@ #include <malloc.h> #endif -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" -#include "../postproc/swscale.h" +#include "osdep/fastmemcpy.h" +#include "postproc/swscale.h" #include "vf_scale.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_softpulldown.c =================================================================== --- mplayerxp/postproc/vf_softpulldown.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_softpulldown.c 2012-10-29 12:34:45 UTC (rev 245) @@ -2,14 +2,14 @@ #include <stdlib.h> #include <string.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" -#include "../libvo/sub.h" +#include "osdep/fastmemcpy.h" +#include "libvo/sub.h" #include "pp_msg.h" struct vf_priv_s { Modified: mplayerxp/postproc/vf_swapuv.c =================================================================== --- mplayerxp/postproc/vf_swapuv.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_swapuv.c 2012-10-29 12:34:45 UTC (rev 245) @@ -22,16 +22,16 @@ #include <inttypes.h> #include <assert.h> -#include "../mp_config.h" +#include "mp_config.h" #ifdef HAVE_MALLOC #include <malloc.h> #endif -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_test.c =================================================================== --- mplayerxp/postproc/vf_test.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_test.c 2012-10-29 12:34:45 UTC (rev 245) @@ -21,13 +21,13 @@ #include <string.h> #include <inttypes.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" #include "swscale.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "pp_msg.h" //===========================================================================// Modified: mplayerxp/postproc/vf_unsharp.c =================================================================== --- mplayerxp/postproc/vf_unsharp.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_unsharp.c 2012-10-29 12:34:45 UTC (rev 245) @@ -34,10 +34,10 @@ #include <malloc.h> #endif -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "pp_msg.h" #ifndef MIN Modified: mplayerxp/postproc/vf_yuy2.c =================================================================== --- mplayerxp/postproc/vf_yuy2.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_yuy2.c 2012-10-29 12:34:45 UTC (rev 245) @@ -3,13 +3,13 @@ #include <string.h> #include <inttypes.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "libswscale/rgb2rgb.h" #include "vf_scale.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_yvu9.c =================================================================== --- mplayerxp/postproc/vf_yvu9.c 2012-10-29 11:38:55 UTC (rev 244) +++ mplayerxp/postproc/vf_yvu9.c 2012-10-29 12:34:45 UTC (rev 245) @@ -3,13 +3,13 @@ #include <string.h> #include <inttypes.h> -#include "../mp_config.h" +#include "mp_config.h" -#include "../libvo/img_format.h" +#include "libvo/img_format.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "osdep/fastmemcpy.h" #include "libswscale/rgb2rgb.h" #include "pp_msg.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 12:47:10
|
Revision: 246 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=246&view=rev Author: nickols_k Date: 2012-10-29 12:47:00 +0000 (Mon, 29 Oct 2012) Log Message: ----------- more accurate placement of eof variable Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-29 12:34:45 UTC (rev 245) +++ mplayerxp/mplayer.c 2012-10-29 12:47:00 UTC (rev 246) @@ -116,7 +116,6 @@ volatile unsigned xp_drop_frame_cnt=0; float xp_screen_pts; -int audio_eof=0; ao_data_t* ao_data=NULL; vo_data_t* vo_data=NULL; @@ -967,7 +966,7 @@ // Update buffer if needed MP_UNIT("mpca_decode"); // Enter AUDIO decoder module t=GetTimer(); - while(sh_audio->a_buffer_len<playsize && !audio_eof){ + while(sh_audio->a_buffer_len<playsize && !xp_core.audio->eof){ if(mp_conf.xp>=XP_VideoAudio) { 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); @@ -989,7 +988,7 @@ MP_UNIT("uninit_ao"); ao_uninit(ao_data); } - audio_eof=1; + xp_core.audio->eof=1; break; } } @@ -1109,7 +1108,7 @@ static void show_status_line_no_apts(float v_pts) { priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; - if(mp_conf.av_sync_pts && sh_audio && (!audio_eof || ao_get_delay(ao_data))) { + if(mp_conf.av_sync_pts && sh_audio && (!xp_core.audio->eof || ao_get_delay(ao_data))) { float a_pts = sh_audio->timer-ao_get_delay(ao_data); MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" ,a_pts @@ -1168,10 +1167,10 @@ sh_video_t* sh_video=priv->demuxer->video->sh; float sleep_time=0; if(sh_audio) { - /* FIXME!!! need the same technique to detect audio_eof as for video_eof! + /* FIXME!!! need the same technique to detect xp_core.audio->eof as for video_eof! often ao_get_delay() never returns 0 :( */ - if(audio_eof && !get_delay_audio_buffer()) goto nosound_model; - if((!audio_eof || ao_get_delay(ao_data)) && + 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))) sleep_time=xp_screen_pts-(sh_audio->timer-ao_get_delay(ao_data)); else if(mp_data->use_pts_fix2 && sh_audio->chapter_change) @@ -1192,7 +1191,7 @@ #define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ #define XP_MIN_AUDIOBUFF 0.05 #define XP_MAX_TIMESLICE 0.1 - if(sh_audio && (!audio_eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { + if(sh_audio && (!xp_core.audio->eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { float t; if( mp_conf.xp < XP_VAPlay ) { @@ -1241,7 +1240,7 @@ shva_prev=dae_played_fra(xp_core.video); final_frame = shva_prev.eof; - if(xp_core.eof && final_frame) return 1; + if(xp_core.video->eof && final_frame) return 1; can_blit=dae_try_inc_played(xp_core.video); /* <-- TRY SWITCH TO NEXT FRAME */ shva=dae_next_played_fra(xp_core.video); @@ -1250,14 +1249,14 @@ /*------------------------ frame decoded. --------------------*/ /* blit frame */ - if(xp_core.eof) can_blit=1; /* force blitting until end of stream will be reached */ + if(xp_core.video->eof) can_blit=1; /* force blitting until end of stream will be reached */ vplayer_check_chapter_change(&shva_prev,v_pts); #if 0 MSG_INFO("initial_audio_pts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" ,initial_audio_pts -,audio_eof -,sh_audio && !audio_eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 -,sh_audio && !audio_eof?sh_audio->timer-ao_get_delay(ao_data):0 +,xp_core.audio->eof +,sh_audio && !xp_core.audio->eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 +,sh_audio && !xp_core.audio->eof?sh_audio->timer-ao_get_delay(ao_data):0 ,shva.v_pts ,shva.stream_pts ,shva.duration); @@ -1320,7 +1319,7 @@ /* FIXME: this block was added to fix A-V resync caused by some strange things like playing 48KHz audio on 44.1KHz soundcard and other. Now we know PTS of every audio frame so don't need to have it */ - if(sh_audio && (!audio_eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { + if(sh_audio && (!xp_core.audio->eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { float a_pts=0; // unplayed bytes in our and soundcard/dma buffer: @@ -1374,7 +1373,7 @@ sh_video_t* sh_video=priv->demuxer->video->sh; demux_stream_t *d_dvdsub=priv->demuxer->sub; int seek_rval=1; - audio_eof=0; + xp_core.audio->eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { seek_rval=demux_seek_r(priv->demuxer,seek); priv->mpxp_after_seek=25; /* 1 sec delay */ @@ -2710,7 +2709,7 @@ if(mp_conf.benchmark && mp_conf.verbose) show_benchmark_status(); else mpxp_print_audio_status(); - if(mp_conf.xp >= XP_VAPlay) { usleep(100000); eof = audio_eof; } + if(mp_conf.xp >= XP_VAPlay) { usleep(100000); eof = xp_core.audio->eof; } goto read_input; } else { int l_eof; @@ -2759,7 +2758,7 @@ if(mp_conf.loop_times==1) mp_conf.loop_times=-1; eof=0; - audio_eof=0; + xp_core.audio->eof=0; seek_args.flags=DEMUX_SEEK_SET|DEMUX_SEEK_PERCENTS; seek_args.secs=0; // seek to start of movie (0%) } @@ -2777,7 +2776,7 @@ mpxp_seek(&osd,&seek_args); - audio_eof=0; + xp_core.audio->eof=0; seek_args.secs=0; seek_args.flags=DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS; @@ -2844,7 +2843,7 @@ priv->vo_inited=0; priv->ao_inited=0; eof = 0; - audio_eof=0; + xp_core.audio->eof=0; goto play_next_file; } Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-29 12:34:45 UTC (rev 245) +++ mplayerxp/xmp_core.c 2012-10-29 12:47:00 UTC (rev 246) @@ -222,7 +222,7 @@ free_buf = get_free_audio_buffer(); if( free_buf == -1 ) { /* End of file */ - xp_core.a_eof = 1; + xp_core.audio->eof = 1; return 0; } if( free_buf < (int)sh_audio->audio_out_minsize ) /* full */ @@ -357,8 +357,8 @@ float v_pts,mpeg_timer=HUGE; priv->state=Pth_Run; - xp_core.eof = 0; - xp_core.a_eof=0; + priv->dae->eof = 0; + xp_core.audio->eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); __MP_UNIT(priv->p_idx,"dec_ahead"); priv->pid = getpid(); @@ -373,7 +373,7 @@ d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS; else xp_is_bad_pts = mp_conf.av_sync_pts?0:1; -while(!xp_core.eof){ +while(!priv->dae->eof){ unsigned char* start=NULL; int in_size; if(priv->state==Pth_Canceling) break; @@ -400,7 +400,7 @@ in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,sh_video->fps); if(in_size<0) { xp_core.video->fra[xp_core.video->decoder_idx].eof=1; - xp_core.eof=1; + priv->dae->eof=1; break; } /* in_size==0: it's or broken stream or demuxer's bug */ @@ -484,10 +484,10 @@ usleep(1); } /*------------------------ frame decoded. --------------------*/ -} /* while(!xp_core.eof)*/ +} /* while(!priv->dae->eof)*/ if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { - while(!xp_core.a_eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { + while(!xp_core.audio->eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { __MP_UNIT(priv->p_idx,"decode audio"); if(!xp_thread_decode_audio()) usleep(1); __MP_UNIT(priv->p_idx,NULL); @@ -510,8 +510,8 @@ float d; priv->state=Pth_Run; - xp_core.eof = 0; - xp_core.a_eof=0; + xp_core.video->eof=0; + xp_core.audio->eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); priv->pid = getpid(); __MP_UNIT(priv->p_idx,"dec_ahead"); @@ -525,7 +525,7 @@ } __MP_UNIT(priv->p_idx,"decode audio"); while((ret = xp_thread_decode_audio()) == 2) {/* Almost empty buffer */ - if(xp_core.a_eof) break; + if(xp_core.audio->eof) break; } dec_ahead_can_adseek=1; @@ -534,7 +534,7 @@ __MP_UNIT(priv->p_idx,"sleep"); LOCK_AUDIO_DECODE(); if(priv->state!=Pth_Canceling) { - if(xp_core.a_eof) { + if(xp_core.audio->eof) { __MP_UNIT(priv->p_idx,"wait end of work"); pthread_cond_wait( &audio_decode_cond, &audio_decode_mutex ); } else if(ret==0) { /* Full buffer or end of file */ @@ -734,26 +734,6 @@ xp_core.mpxp_threads[i]->state=Pth_Run; while(xp_core.mpxp_threads[i]->state==Pth_ASleep) usleep(0); } -#if 0 - if(mp_conf.xp && !pthread_is_living && !a_pthread_is_living) { - return; - } - if(!xp_core.has_audio) - decore_audio(xp_id); - else - xp_thread_decode_audio(); - - if(xp_core.has_video) { - while(dae_curr_vdecoded() == dae_curr_vplayed() && !xp_core.eof) - usleep(1); /* Wait for thread to decode first frame */ - } - - if(a_pthread_is_living) - __MP_SYNCHRONIZE(audio_decode_mutex,pthread_cond_signal(&audio_decode_cond)); - - if(pthread_audio_is_living) - __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); -#endif } #define MIN_AUDIO_TIME 0.05 @@ -828,7 +808,7 @@ samples = 10; min_audio = MAX_AUDIO_TIME; max_audio = 0; - } else if( !xp_core.a_eof && collect_samples) { + } else if( !xp_core.audio->eof && collect_samples) { if( dec_ahead_audio_delay < min_audio ) min_audio = dec_ahead_audio_delay; if( dec_ahead_audio_delay > max_audio ) @@ -925,7 +905,7 @@ MSG_T("sig_dec_ahead_video\n"); mp_msg_flush(); - xp_core.eof = 1; + xp_core.video->eof = 1; xp_core.video->fra[dae_curr_vdecoded()].eof=1; /* Unlock all mutex Modified: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-10-29 12:34:45 UTC (rev 245) +++ mplayerxp/xmp_core.h 2012-10-29 12:47:00 UTC (rev 246) @@ -33,6 +33,7 @@ unsigned nframes; /* number of frames in buffer */ frame_attr_t* fra; /* frame related attributes */ any_t* sh; /* corresponded sh_audio_t or sh_video_t */ + int eof; /* EOF for stream */ /* for statistics */ unsigned num_slow_frames;/* number of frames which were delayed due slow computer */ long long int num_played_frames; @@ -65,13 +66,11 @@ dec_ahead_engine_t* audio; volatile int in_pause; volatile int in_resize; - volatile int eof; /* XMP engine */ mpxp_thread_t* mpxp_threads[MAX_MPXP_THREADS]; unsigned num_threads; pthread_t main_pth_id; /* doubtful stuff */ - int a_eof; // audio eof unsigned num_a_buffs; // number of audio buffers unsigned num_v_buffs; // number of video buffers }xp_core_t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 13:12:21
|
Revision: 248 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=248&view=rev Author: nickols_k Date: 2012-10-29 13:12:12 +0000 (Mon, 29 Oct 2012) Log Message: ----------- cleanups Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/xmp_core.c Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-29 12:54:02 UTC (rev 247) +++ mplayerxp/mplayer.c 2012-10-29 13:12:12 UTC (rev 248) @@ -114,8 +114,6 @@ **************************************************************************/ #include "xmp_core.h" -float xp_screen_pts; - ao_data_t* ao_data=NULL; vo_data_t* vo_data=NULL; pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; @@ -1159,7 +1157,7 @@ } } -static float vplayer_compute_sleep_time(frame_attr_t* shva_prev) +static float vplayer_compute_sleep_time(frame_attr_t* shva_prev,float screen_pts) { priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; @@ -1171,7 +1169,7 @@ 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))) - sleep_time=xp_screen_pts-(sh_audio->timer-ao_get_delay(ao_data)); + sleep_time=screen_pts-(sh_audio->timer-ao_get_delay(ao_data)); else if(mp_data->use_pts_fix2 && sh_audio->chapter_change) sleep_time=0; else @@ -1230,6 +1228,7 @@ 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; + float screen_pts=0; float v_pts=0; float sleep_time=0; int can_blit=0; @@ -1262,7 +1261,7 @@ #endif /*--------- add OSD to the next frame contents ---------*/ if(can_blit) { - xp_screen_pts=v_pts-(mp_conf.av_sync_pts?0:initial_audio_pts); + screen_pts=v_pts-(mp_conf.av_sync_pts?0:initial_audio_pts); #ifdef USE_OSD MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); MP_UNIT("draw_osd"); @@ -1292,7 +1291,7 @@ /* It's time to sleep ;)...*/ MP_UNIT("sleep"); GetRelativeTime(); /* reset timer */ - sleep_time=vplayer_compute_sleep_time(&shva_prev); + sleep_time=vplayer_compute_sleep_time(&shva_prev,screen_pts); if(mp_conf.benchmark && sleep_time < 0 && sleep_time < priv->max_av_resync) priv->max_av_resync=sleep_time; if(!(vo_data->flags&256)){ /* flag 256 means: libvo driver does its timing (dvb card) */ if(!vplayer_do_sleep(rtc_fd,sleep_time)) return 0; Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-29 12:54:02 UTC (rev 247) +++ mplayerxp/xmp_core.c 2012-10-29 13:12:12 UTC (rev 248) @@ -176,7 +176,6 @@ pthread_mutex_t audio_decode_mutex=PTHREAD_MUTEX_INITIALIZER; pthread_cond_t audio_decode_cond=PTHREAD_COND_INITIALIZER; -extern volatile float xp_screen_pts; volatile int dec_ahead_can_aseek=0; /* It is safe to seek audio */ volatile int dec_ahead_can_adseek=1; /* It is safe to seek audio buffer thread */ @@ -260,6 +259,7 @@ static unsigned compute_frame_dropping(sh_video_t* sh_video,float v_pts,float drop_barrier) { unsigned rc=0; + float screen_pts=dae_played_fra(xp_core.video).v_pts-(mp_conf.av_sync_pts?0:initial_audio_pts); 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; @@ -275,7 +275,7 @@ - while(video.pts < audio.pts) video.seek_to_key_frame(video.get_next_key_frame(video.get_cur_pos())) */ - delta=v_pts-xp_screen_pts; + delta=v_pts-screen_pts; if(max_frame_delay*3 > drop_barrier) { if(drop_barrier < (float)(xp_core.num_v_buffs-2)/sh_video->fps) drop_barrier += 1/sh_video->fps; else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 17:15:55
|
Revision: 253 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=253&view=rev Author: nickols_k Date: 2012-10-29 17:15:43 +0000 (Mon, 29 Oct 2012) Log Message: ----------- add mp_malloc statistics Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-29 16:03:18 UTC (rev 252) +++ mplayerxp/mplayer.c 2012-10-29 17:15:43 UTC (rev 253) @@ -575,9 +575,14 @@ void uninit_player(unsigned int mask){ priv_t*priv=mp_data->priv; - stream_t* stream=priv->demuxer->stream; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - sh_video_t* sh_video=priv->demuxer->video->sh; + 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; @@ -2378,13 +2383,13 @@ mp_register_options(mp_data->mconfig); parse_cfgfiles(mp_data->mconfig); - if(m_config_parse_command_line(mp_data->mconfig, argc, argv, envp) < 0) exit(1); // error parsing cmdline + if(m_config_parse_command_line(mp_data->mconfig, argc, argv, envp) < 0) + exit_player("Error parse command line"); // error parsing cmdline if(!mp_conf.xp) { MSG_ERR("Error: detected option: -core.xp=0\n" "Note! Single-thread mode is not longer supported by MPlayerXP\n"); - mpxp_uninit_structs(); - return 0; + exit_player(MSGTR_Exit_quit); } xp_num_cpu=get_number_cpu(); @@ -2393,11 +2398,11 @@ #endif if(!sws_init()) { MSG_ERR("MPlayerXP requires working copy of libswscaler\n"); - mpxp_uninit_structs(); - return 0; + exit_player(MSGTR_Exit_quit); } if(mp_conf.shuffle_playback) priv->playtree->flags|=PLAY_TREE_RND; else priv->playtree->flags&=~PLAY_TREE_RND; + priv->playtree = play_tree_cleanup(priv->playtree); if(priv->playtree) { playtree_iter = play_tree_iter_new(priv->playtree,mp_data->mconfig); @@ -2416,8 +2421,7 @@ if(!filename){ show_help(); - mpxp_uninit_structs(); - return 0; + exit_player(MSGTR_Exit_quit); } // Many users forget to include command line in bugreports... Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-10-29 16:03:18 UTC (rev 252) +++ mplayerxp/osdep/mp_malloc.c 2012-10-29 17:15:43 UTC (rev 253) @@ -115,9 +115,13 @@ typedef struct priv_s { unsigned rnd_limit; unsigned every_nth_call; + // statistics unsigned long long int total_calls; - // statistics unsigned long long int num_allocs; + // local statistics + int enable_stat; + unsigned long long int stat_total_calls; + unsigned long long int stat_num_allocs; }priv_t; static priv_t* priv; @@ -132,7 +136,7 @@ void mp_uninit_malloc(int verbose) { if(priv->num_allocs && verbose) - MSG_WARN("Warning: from %lli total calls of alloc() were not freed %lli buffers\n",priv->total_calls,priv->num_allocs); + MSG_WARN("Warning! From %lli total calls of alloc() were not freed %lli buffers\n",priv->total_calls,priv->num_allocs); free(priv); priv=NULL; } @@ -141,12 +145,19 @@ { any_t* rb,*rnd_buff=NULL; if(!priv) mp_init_malloc(1000,10); - if(priv->total_calls%priv->every_nth_call==0) - rnd_buff=malloc(rand()%priv->rnd_limit); + if(priv->every_nth_call && priv->rnd_limit) { + if(priv->total_calls%priv->every_nth_call==0) { + rnd_buff=malloc(rand()%priv->rnd_limit); + } + } rb = malloc(__size); if(rnd_buff) free(rnd_buff); priv->total_calls++; priv->num_allocs++; + if(priv->enable_stat) { + priv->stat_total_calls++; + priv->stat_num_allocs++; + } return rb; } @@ -164,6 +175,7 @@ { if(!priv) mp_init_malloc(1000,10); priv->num_allocs++; + if(priv->enable_stat) priv->stat_num_allocs++; return memalign(boundary,__size); } @@ -172,11 +184,31 @@ if(!priv) mp_init_malloc(1000,10); free(__ptr); priv->num_allocs--; + if(priv->enable_stat) priv->stat_num_allocs--; } + char * mp_strdup(const char *src) { - char *rs; - unsigned len=strlen(src); - rs=mp_malloc(len+1); - strcpy(rs,src); + char *rs=NULL; + if(src) { + unsigned len=strlen(src); + rs=mp_malloc(len+1); + strcpy(rs,src); + } return rs; } + +void __FASTCALL__ mp_open_malloc_stat(void) { + if(!priv) mp_init_malloc(1000,10); + priv->enable_stat=1; + priv->stat_total_calls=priv->stat_num_allocs=0ULL; +} + +unsigned long long __FASTCALL__ mp_close_malloc_stat(int verbose) { + if(!priv) mp_init_malloc(1000,10); + priv->enable_stat=0; + if(verbose) + MSG_INFO("mp_malloc stat: from %lli total calls of alloc() were not freed %lli buffers\n" + ,priv->stat_total_calls + ,priv->stat_num_allocs); + return priv->stat_num_allocs; +} Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-10-29 16:03:18 UTC (rev 252) +++ mplayerxp/osdep/mplib.h 2012-10-29 17:15:43 UTC (rev 253) @@ -38,6 +38,9 @@ extern void __FASTCALL__ mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call); extern void __FASTCALL__ mp_uninit_malloc(int verbose); +extern void __FASTCALL__ mp_open_malloc_stat(void); +extern unsigned long long __FASTCALL__ mp_close_malloc_stat(int verbose); + extern any_t* __FASTCALL__ mp_malloc(size_t __size); extern any_t* __FASTCALL__ mp_mallocz(size_t __size); extern any_t* __FASTCALL__ mp_realloc(any_t*__ptr, size_t __size); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-30 07:35:35
|
Revision: 256 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=256&view=rev Author: nickols_k Date: 2012-10-30 07:35:22 +0000 (Tue, 30 Oct 2012) Log Message: ----------- combine some variables into structures Modified Paths: -------------- mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/mp_msg.c mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-10-29 17:30:41 UTC (rev 255) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-10-30 07:35:22 UTC (rev 256) @@ -6,6 +6,7 @@ #include "help_mp.h" #include "mplayer.h" +#include "xmp_core.h" #include "libmpdemux/stream.h" #include "libmpdemux/demuxer.h" @@ -121,10 +122,10 @@ } } else - if(initial_audio_pts_corr.need_correction==1) + if(xp_core.initial_apts_corr.need_correction==1) { - initial_audio_pts += ((float)(initial_audio_pts_corr.pts_bytes-initial_audio_pts_corr.nbytes))/(float)sh_audio->i_bps; - initial_audio_pts_corr.need_correction=0; + 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" ,sh_audio->codec->codec_name Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-29 17:30:41 UTC (rev 255) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-30 07:35:22 UTC (rev 256) @@ -21,7 +21,7 @@ { float retval; demuxer_t*demuxer=ds->demuxer; - initial_audio_pts_corr.need_correction=0; + xp_core.initial_apts_corr.need_correction=0; MSG_DBG2("initial_apts from: stream_pts=%f pts_bytes=%u got_bytes=%u i_bps=%u\n" ,ds->pts,ds_tell_pts(ds),nbytes,((sh_audio_t*)ds->demuxer->audio->sh)->i_bps); /* FIXUP AUDIO PTS*/ @@ -47,9 +47,9 @@ retval = ds->pts+ds->pts_corr+((float)(ds_tell_pts(ds)-nbytes))/(float)(((sh_audio_t*)ds->demuxer->audio->sh)->i_bps); else { - initial_audio_pts_corr.need_correction=1; - initial_audio_pts_corr.pts_bytes=ds_tell_pts(ds); - initial_audio_pts_corr.nbytes=nbytes; + xp_core.initial_apts_corr.need_correction=1; + xp_core.initial_apts_corr.pts_bytes=ds_tell_pts(ds); + xp_core.initial_apts_corr.nbytes=nbytes; retval = ds->pts; } MSG_DBG2("initial_apts is: %f\n",retval); @@ -66,7 +66,7 @@ if(mp_conf.benchmark) t=GetTimer(); retval = demux_getc(ds); *pts=get_ds_stream_pts(ds,1); - if(initial_audio_pts == HUGE) initial_audio_pts=*pts; + if(xp_core.initial_apts == HUGE) xp_core.initial_apts=*pts; if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; @@ -111,7 +111,7 @@ if(mp_conf.benchmark) t=GetTimer(); retval = demux_read_data(ds,mem,len); *pts=get_ds_stream_pts(ds,retval); - if(initial_audio_pts == HUGE) initial_audio_pts=*pts; + if(xp_core.initial_apts == HUGE) xp_core.initial_apts=*pts; if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; @@ -135,7 +135,7 @@ if(mp_conf.benchmark) t=GetTimer(); retval = ds_get_packet(ds,start); *pts=get_ds_stream_pts(ds,retval); - if(initial_audio_pts == HUGE) initial_audio_pts=*pts; + if(xp_core.initial_apts == HUGE) xp_core.initial_apts=*pts; if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; Modified: mplayerxp/mp_msg.c =================================================================== --- mplayerxp/mp_msg.c 2012-10-29 17:30:41 UTC (rev 255) +++ mplayerxp/mp_msg.c 2012-10-30 07:35:22 UTC (rev 256) @@ -12,71 +12,96 @@ #define _bg(x) ((x) >> 4) #define _fg(x) ((x) & 0x0f) -static int _color[8] = {0,4,2,6,1,5,3,7}; -char vtmp[100]; +typedef struct priv_s { + int _color[8]; + char vtmp[100]; + char scol[9][20]; + pthread_mutex_t mp_msg_mutex; +}priv_t; uint32_t mp_msg_filter=0xFFFFFFFF; -static char scol[9][20]; const char hl[9] = { 0xC, 0x4, 0xE, 0xA, 0xB, 0x7, 0x9, 0x3, 0x7 }; -pthread_mutex_t mp_msg_mutex=PTHREAD_MUTEX_INITIALIZER; static char *_2ansi(unsigned char attr) { + priv_t*priv=mp_data->msg_priv; int bg = _bg(attr); - int bc = _color[bg & 7]; + int bc = priv->_color[bg & 7]; - sprintf(vtmp, + sprintf(priv->vtmp, "\033[%d;3%d;4%d%sm", _fg(attr) > 7, - _color[_fg(attr) & 7], + priv->_color[_fg(attr) & 7], bc, bg > 7 ? ";5" : "" ); - return vtmp; + return priv->vtmp; } void mp_msg_init(int verbose) { + pthread_mutexattr_t attr; unsigned i; - for(i=0;i<sizeof(hl)/sizeof(char);i++) memcpy(scol[i],_2ansi(hl[i]),sizeof(scol[0])); + 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])); } -const char * msg_prefix[] = +void mp_msg_uninit(void) { -"GLOBAL", -"PLAYER", -"LIBVO", -"LIBAO", -"DEMUX", -"CFGPRS", -"DECAUD", -"DECVID", -"VOBSUB", -"OSDEP", -"SPUDEC", -"PLAYTR", -"INPUT", -"OSD", -"CPUDTC", -"CODCFG", -"SWS", -"FINDSB", -"SUBRDR", -"POSTPR" + 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" }; void mp_msg_c( unsigned x, const char *srcfile,unsigned linenum,const char *format, ... ){ /* TODO: more useful usage of module_id */ + 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; /* do not display */ if((mod&mp_msg_filter)==0) return; /* do not display */ - pthread_mutex_lock(&mp_msg_mutex); - if(isatty(fileno(stderr))) - fprintf(stderr,scol[level<9?level:8]); + 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; @@ -100,13 +125,7 @@ if(format[strlen(format)-1]=='\n') was_eol=1; else was_eol=0; fflush(stderr); - pthread_mutex_unlock(&mp_msg_mutex); + if(priv) pthread_mutex_unlock(&priv->mp_msg_mutex); } void mp_msg_flush(void) { fflush(stderr); } - -void mp_msg_uninit(void) -{ - if(isatty(fileno(stderr))) fprintf(stderr,scol[8]); - mp_msg_flush(); -} Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-29 17:30:41 UTC (rev 255) +++ mplayerxp/mplayer.c 2012-10-30 07:35:22 UTC (rev 256) @@ -139,15 +139,6 @@ ao_data_t* ao_data=NULL; vo_data_t* vo_data=NULL; -/************************************************************************ - Special case: inital audio PTS: - example: some movies has a_pts = v_pts = XX sec - but mplayerxp always starts audio playback at 0 sec -************************************************************************/ -static pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; -float initial_audio_pts=HUGE; -initial_audio_pts_correction_t initial_audio_pts_corr; - /************************************************************************** Config file **************************************************************************/ @@ -176,7 +167,6 @@ #include "fifo.h" /**************************************************************************/ - static void mpxp_init_structs(void) { mp_data=mp_malloc(sizeof(mp_data_t)); memset(mp_data,0,sizeof(mp_data_t)); @@ -221,7 +211,11 @@ mp_uninit_malloc(1); } +/************************************************************************ + AUDIO XP-CORE! ToDo: rewrite it in packet-mode +************************************************************************/ /* XP audio buffer */ +static pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; typedef struct audio_buffer_index_s { float pts; int index; @@ -1265,8 +1259,8 @@ if(xp_core.video->eof) can_blit=1; /* force blitting until end of stream will be reached */ vplayer_check_chapter_change(&shva_prev,v_pts); #if 0 -MSG_INFO("initial_audio_pts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" -,initial_audio_pts +MSG_INFO("xp_core.initial_apts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" +,xp_core.initial_apts ,xp_core.audio->eof ,sh_audio && !xp_core.audio->eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 ,sh_audio && !xp_core.audio->eof?sh_audio->timer-ao_get_delay(ao_data):0 @@ -1276,7 +1270,7 @@ #endif /*--------- add OSD to the next frame contents ---------*/ if(can_blit) { - screen_pts=v_pts-(mp_conf.av_sync_pts?0:initial_audio_pts); + screen_pts=v_pts-(mp_conf.av_sync_pts?0:xp_core.initial_apts); #ifdef USE_OSD MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); MP_UNIT("draw_osd"); @@ -2508,7 +2502,7 @@ //============ Open priv->demuxerS --- DETECT file type ======================= if(mp_conf.playbackspeed_factor!=1.0) mp_conf.has_audio=0; - initial_audio_pts=HUGE; + xp_core.initial_apts=HUGE; if(!mp_conf.has_audio) mp_conf.audio_id=-2; // do NOT read audio packets... if(!mp_conf.has_video) mp_conf.video_id=-2; // do NOT read video packets... if(!mp_conf.has_dvdsub) mp_conf.dvdsub_id=-2;// do NOT read subtitle packets... @@ -2788,7 +2782,7 @@ if(seek_args.secs && sh_video) { frame_attr_t shvap = dae_played_fra(xp_core.video); frame_attr_t shvad = xp_core.video->fra[dae_prev_decoded(xp_core.video)]; - seek_args.secs -= (xp_is_bad_pts?shvad.v_pts:d_video->pts)-shvap.v_pts; + seek_args.secs -= (xp_core.bad_pts?shvad.v_pts:d_video->pts)-shvap.v_pts; } mpxp_seek(&osd,&seek_args); Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-10-29 17:30:41 UTC (rev 255) +++ mplayerxp/mplayer.h 2012-10-30 07:35:22 UTC (rev 256) @@ -4,16 +4,6 @@ #include <pthread.h> #include "mp_config.h" -typedef struct initial_audio_pts_correction_s -{ - int need_correction; - int pts_bytes; - int nbytes; -}initial_audio_pts_correction_t; - -extern initial_audio_pts_correction_t initial_audio_pts_corr; -extern float initial_audio_pts; - typedef struct mp_conf_s { int has_video; int has_audio; @@ -106,6 +96,7 @@ any_t* mconfig; time_usage_t*bench; any_t* priv; + any_t* msg_priv; }mp_data_t; extern mp_data_t* mp_data; Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-10-29 17:30:41 UTC (rev 255) +++ mplayerxp/osdep/mp_malloc.c 2012-10-30 07:35:22 UTC (rev 256) @@ -162,7 +162,6 @@ } any_t* mp_realloc(any_t*__ptr, size_t __size) { return realloc(__ptr,__size); } -any_t* mp_calloc (size_t __nelem, size_t __size) { return mp_mallocz(__nelem*__size); } any_t* mp_mallocz (size_t __size) { any_t* rp; Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-10-29 17:30:41 UTC (rev 255) +++ mplayerxp/osdep/mplib.h 2012-10-30 07:35:22 UTC (rev 256) @@ -44,7 +44,7 @@ extern any_t* __FASTCALL__ mp_malloc(size_t __size); extern any_t* __FASTCALL__ mp_mallocz(size_t __size); extern any_t* __FASTCALL__ mp_realloc(any_t*__ptr, size_t __size); -extern any_t* __FASTCALL__ mp_calloc (size_t __nelem, size_t __size); +static inline any_t* mp_calloc (size_t __nelem, size_t __size) { return mp_mallocz(__nelem*__size); } extern any_t* __FASTCALL__ mp_memalign (size_t boundary, size_t __size); extern void __FASTCALL__ mp_free(any_t*__ptr); extern char * __FASTCALL__ mp_strdup(const char *src); Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-29 17:30:41 UTC (rev 255) +++ mplayerxp/xmp_core.c 2012-10-30 07:35:22 UTC (rev 256) @@ -37,6 +37,7 @@ void xmp_init(void) { memset(&xp_core,0,sizeof(xp_core_t)); + xp_core.initial_apts=HUGE; } void xmp_uninit(void) {} @@ -195,8 +196,6 @@ any_t* audio_play_routine( any_t* arg ); -int xp_is_bad_pts=0; - /* Audio stuff */ volatile float dec_ahead_audio_delay; static int xp_thread_decode_audio(void) @@ -257,7 +256,7 @@ static unsigned compute_frame_dropping(sh_video_t* sh_video,float v_pts,float drop_barrier) { unsigned rc=0; - float screen_pts=dae_played_fra(xp_core.video).v_pts-(mp_conf.av_sync_pts?0:initial_audio_pts); + float screen_pts=dae_played_fra(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; @@ -354,13 +353,13 @@ priv->name = "video decoder+vf"; 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) - xp_is_bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || + 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 || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_PS || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS; else - xp_is_bad_pts = mp_conf.av_sync_pts?0:1; + xp_core.bad_pts = mp_conf.av_sync_pts?0:1; while(!priv->dae->eof){ unsigned char* start=NULL; int in_size; @@ -369,7 +368,7 @@ pt_sleep: priv->state=Pth_ASleep; while(priv->state==Pth_ASleep) usleep(0); - if(xp_is_bad_pts) mpeg_timer=HUGE; + if(xp_core.bad_pts) mpeg_timer=HUGE; continue; } __MP_UNIT(priv->p_idx,"dec_ahead 1"); @@ -394,7 +393,7 @@ /* in_size==0: it's or broken stream or demuxer's bug */ if(in_size==0 && priv->state!=Pth_Canceling) continue; /* frame was decoded into current decoder_idx */ - if(xp_is_bad_pts) { + if(xp_core.bad_pts) { if(mpeg_timer==HUGE) mpeg_timer=v_pts; else if( mpeg_timer-duration<v_pts ) { mpeg_timer=v_pts; @@ -442,14 +441,14 @@ if(!blit_frame && drop_param) priv->dae->num_dropped_frames++; if(blit_frame) { unsigned idx=dae_curr_vdecoded(); - if(xp_is_bad_pts) + if(xp_core.bad_pts) xp_core.video->fra[idx].v_pts=mpeg_timer; else xp_core.video->fra[idx].v_pts = v_pts; xp_core.video->fra[idx].stream_pts = v_pts; xp_core.video->fra[idx].duration=duration; xp_core.video->fra[idx].eof=0; - if(!xp_is_bad_pts) { + if(!xp_core.bad_pts) { int _idx = dae_prev_vdecoded(); xp_core.video->fra[_idx].duration=v_pts-xp_core.video->fra[_idx].v_pts; } @@ -715,7 +714,7 @@ reset_audio_buffer(); /* Ugly hack: but we should read audio packet before video after seeking. Else we'll get picture destortion on the screen */ - initial_audio_pts=HUGE; + xp_core.initial_apts=HUGE; unsigned i; for(i=1;i<xp_core.num_threads;i++) { Modified: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-10-29 17:30:41 UTC (rev 255) +++ mplayerxp/xmp_core.h 2012-10-30 07:35:22 UTC (rev 256) @@ -59,6 +59,13 @@ volatile enum mpxp_thread_state state; }mpxp_thread_t; +typedef struct initial_audio_pts_correction_s +{ + int need_correction; + int pts_bytes; + int nbytes; +}initial_audio_pts_correction_t; + #define main_id 0 typedef struct xp_core_s { int has_video; @@ -74,6 +81,9 @@ /* doubtful stuff */ unsigned num_a_buffs; // number of audio buffers unsigned num_v_buffs; // number of video buffers + int bad_pts; // for MPEGxx codecs + float initial_apts; + initial_audio_pts_correction_t initial_apts_corr; }xp_core_t; extern xp_core_t xp_core; @@ -153,8 +163,6 @@ #define __MP_ATOMIC(OP) { static pthread_mutex_t loc_mutex; pthread_mutex_lock(&loc_mutex); OP; pthread_mutex_unlock(&loc_mutex); } #define __MP_SYNCHRONIZE(mtx,OP) { pthread_mutex_lock(&mtx); OP; pthread_mutex_unlock(&mtx); } -extern int xp_is_bad_pts; - extern volatile int dec_ahead_can_aseek; /* stream - pointer to openned stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-30 16:33:54
|
Revision: 263 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=263&view=rev Author: nickols_k Date: 2012-10-30 16:33:40 +0000 (Tue, 30 Oct 2012) Log Message: ----------- combine some variables into structure Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_dmo.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/sub_cc.c mplayerxp/libmpdemux/sub_cc.h mplayerxp/libmpdemux/sub_ty.c mplayerxp/libvo/aspect.c mplayerxp/libvo/screenshot.c mplayerxp/libvo/x11_common.c mplayerxp/mp_msg.c mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/postproc/postprocess.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/cfg-mplayer.h 2012-10-30 16:33:40 UTC (rev 263) @@ -2,10 +2,6 @@ * config for cfgparser */ -extern uint32_t mp_msg_filter; -#ifdef HAVE_PNG -extern int z_compression; -#endif #ifdef HAVE_SDL //extern char *sdl_driver; extern int sdl_noxv; @@ -13,40 +9,7 @@ extern int sdl_forcegl; //extern char *sdl_adriver; #endif -#ifdef USE_FAKE_MONO -extern int fakemono; // defined in dec_audio.c -#endif -extern int subcc_enabled; - -#ifdef HAVE_AA -extern int vo_aa_parseoption(struct config * conf, char *opt, char * param); -extern void vo_aa_revertoption(config_t* opt,char* param); -#endif - -#ifdef HAVE_ZR -extern int vo_zr_parseoption(struct config * conf, char *opt, char * param); -extern void vo_zr_revertoption(config_t* opt,char* pram); -#endif - -#ifdef HAVE_XINERAMA -extern int xinerama_screen; -#endif - -extern int enable_xp_audio; - -/* from libvo/aspect.c */ -extern float monitor_pixel_aspect; - -/* from dec_audio, currently used for ac3surround decoder only */ -extern int audio_output_channels; - -extern int sws_flags; -extern int readPPOpt(any_t*conf, char *arg); -extern char *npp_options; - -extern int shuffle_playback; - extern int network_prefer_ipv4; extern char *network_username; extern char *network_password; @@ -205,8 +168,8 @@ {"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", &subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, "enable DVD Closed Caption (CC) subtitles"}, - {"nocc", &subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, "disable DVD Closed Caption (CC) subtitles"}, + {"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"}, @@ -219,7 +182,7 @@ {"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", &xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, "tells MPlayerXP the display for movie playback"}, + {"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}, }; @@ -229,13 +192,10 @@ {"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", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, "select number of audio output channels to be used"}, + {"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"}, -#ifdef USE_FAKE_MONO - {"stereo", &fakemono, CONF_TYPE_INT, CONF_RANGE, 0, 2, "selects type of MP2/MP3 stereo output"}, -#endif {NULL, NULL, 0, 0, 0, 0, NULL}, }; @@ -251,7 +211,7 @@ {"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", &monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, "sets the aspect-ratio of a single pixel of TV screen"}, + {"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"}, @@ -264,10 +224,9 @@ {"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", &npp_options, CONF_TYPE_STRING, 0, 0, 0, "specifies options of post-processing"}, - {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, "specifies the quality of the software scaler"}, + {"pp", &mp_conf.npp_options, CONF_TYPE_STRING, 0, 0, 0, "specifies options of post-processing"}, #ifdef HAVE_PNG - {"z", &z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 9, "specifies compression level for PNG output"}, + {"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"}, @@ -308,7 +267,7 @@ {"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_msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, "specifies filter for verbosed messages"}, + {"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" }, Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-10-30 16:33:40 UTC (rev 263) @@ -8,6 +8,7 @@ #include "codecs_ld.h" #include "mp_config.h" +#include "mplayer.h" #include "help_mp.h" #include "osdep/cpudetect.h" @@ -41,9 +42,6 @@ }; LIBAD_EXTERN(a52) - -extern int audio_output_channels; - int a52_fillbuff(sh_audio_t *sh_audio,float *pts){ int length=0; int flags=0; @@ -127,7 +125,7 @@ sh->samplesize=4; sh->sample_format=AFMT_FLOAT32; } - sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*6; + sh->audio_out_minsize=mp_conf.ao_channels*sh->samplesize*256*6; sh->audio_in_minsize=MAX_AC3_FRAME; sh->context=mp_malloc(sizeof(a52_priv_t)); return 1; @@ -151,7 +149,7 @@ } /* 'a52 cannot upmix' hotfix:*/ a52_printinfo(sh_audio); - sh_audio->channels=audio_output_channels; + sh_audio->channels=mp_conf.ao_channels; while(sh_audio->channels>0){ switch(sh_audio->channels){ case 1: mpxp_a52_flags=A52_MONO; break; Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-10-30 16:33:40 UTC (rev 263) @@ -8,6 +8,7 @@ #include "codecs_ld.h" #include "mp_config.h" +#include "mplayer.h" #include "help_mp.h" #include "osdep/cpudetect.h" @@ -46,8 +47,6 @@ LIBAD_EXTERN(dca) -extern int audio_output_channels; - int dca_fillbuff(sh_audio_t *sh_audio,float *pts){ int length=0,flen=0; int flags=0; @@ -127,7 +126,7 @@ sh->samplesize=4; sh->sample_format=AFMT_FLOAT32; } - sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*8; + sh->audio_out_minsize=mp_conf.ao_channels*sh->samplesize*256*8; sh->audio_in_minsize=MAX_AC5_FRAME; sh->context=mp_malloc(sizeof(dca_priv_t)); return 1; @@ -151,7 +150,7 @@ } /* 'dca cannot upmix' hotfix:*/ dca_printinfo(sh_audio); - sh_audio->channels=audio_output_channels; + sh_audio->channels=mp_conf.ao_channels; while(sh_audio->channels>0){ switch(sh_audio->channels){ case 1: mpxp_dca_flags=DCA_MONO; break; Modified: mplayerxp/libmpcodecs/ad_dmo.c =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpcodecs/ad_dmo.c 2012-10-30 16:33:40 UTC (rev 263) @@ -6,6 +6,7 @@ #include "codecs_ld.h" #include "mp_config.h" +#include "mplayer.h" #include "help_mp.h" #include "osdep/mplib.h" #include "ad_internal.h" @@ -40,13 +41,11 @@ return 1; } -extern int audio_output_channels; - static int preinit(sh_audio_t *sh_audio) { dmo_priv_t*priv; - int chans=(audio_output_channels==sh_audio->wf->nChannels) ? - audio_output_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1); + int chans=(mp_conf.ao_channels==sh_audio->wf->nChannels) ? + mp_conf.ao_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1); if(!(sh_audio->context=mp_malloc(sizeof(dmo_priv_t)))) return 0; priv=sh_audio->context; if(!(priv->ds_adec=DMO_AudioDecoder_Open(sh_audio->codec->dll_name,&sh_audio->codec->guid,sh_audio->wf,chans))) Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-30 16:33:40 UTC (rev 263) @@ -180,7 +180,6 @@ ,MPG123_LSEEK_FAILED /**< Low-level seek failed. */ }; -extern int fakemono; static void (*mpg123_init_ptr)(void); #define mpg123_init() (*mpg123_init_ptr)() static void (*mpg123_exit_ptr)(void); Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-10-30 16:33:40 UTC (rev 263) @@ -24,11 +24,7 @@ #include "osdep/mplib.h" #include "ad_msg.h" -#ifdef USE_FAKE_MONO -int fakemono=0; -#endif /* used for ac3surround decoder - set using -channels option */ -int audio_output_channels = 2; af_cfg_t af_cfg; // Configuration for audio filters static const ad_functions_t* mpadec; Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-30 16:33:40 UTC (rev 263) @@ -77,7 +77,6 @@ #include "libvo/video_out.h" -extern char *npp_options; static int vcodec_inited=0; typedef struct priv_s { @@ -220,7 +219,7 @@ unsigned avc_version=0; priv_t *vdff_ctx; int pp_flags,rc; - if(npp_options) pp2_init(); + if(mp_conf.npp_options) pp2_init(); if(!vcodec_inited){ // avcodec_init(); avcodec_register_all(); @@ -381,7 +380,7 @@ MSG_V("INFO: libavcodec.so (%06X) video codec[%c%c%c%c] init OK!\n" ,avc_version ,((char *)&sh->fourcc)[0],((char *)&sh->fourcc)[1],((char *)&sh->fourcc)[2],((char *)&sh->fourcc)[3]); - if(npp_options) + if(mp_conf.npp_options) { pp_flags=0; switch(sh->codec->outfmt[sh->outfmtidx]) Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpdemux/demux_ty.c 2012-10-30 16:33:40 UTC (rev 263) @@ -36,6 +36,7 @@ #include <stdarg.h> #include "mp_config.h" +#include "mplayer.h" #include "osdep/bswap.h" #include "help_mp.h" @@ -706,7 +707,7 @@ lastXDS[ 0x06 ] = type; lastXDS[ 0x07 ] = b >> 8; lastXDS[ 0x08 ] = b; - if ( subcc_enabled ) + if ( mp_conf.subcc_enabled ) demux_ty_CopyToDemuxPacket( demux->video, lastXDS, 0x09, demux->filepos + offset, tivo->lastVideoPTS ); } @@ -814,7 +815,7 @@ if( i == 0x1B3 || i == 0x1B8 ) break; // found it! if( !i || !skip_video_packet( d_video ) ) break; // EOF? } - if ( subcc_enabled ) + if ( mp_conf.subcc_enabled ) ty_ClearOSD( 0 ); } Modified: mplayerxp/libmpdemux/sub_cc.c =================================================================== --- mplayerxp/libmpdemux/sub_cc.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpdemux/sub_cc.c 2012-10-30 16:33:40 UTC (rev 263) @@ -18,6 +18,7 @@ #include <string.h> #include "mp_config.h" +#include "mplayer.h" #include "sub_cc.h" #include "libmpsub/subreader.h" @@ -29,7 +30,6 @@ #define CC_MAX_LINE_LENGTH 64 -int subcc_enabled=0; static char chartbl[128]; static subtitle buf1,buf2; @@ -328,7 +328,7 @@ void subcc_process_data(const unsigned char *inputdata,unsigned int len) { - if(!subcc_enabled) return; + if(!mp_conf.subcc_enabled) return; if(!inited) subcc_init(); subcc_decode(inputdata, len); Modified: mplayerxp/libmpdemux/sub_cc.h =================================================================== --- mplayerxp/libmpdemux/sub_cc.h 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpdemux/sub_cc.h 2012-10-30 16:33:40 UTC (rev 263) @@ -1,8 +1,6 @@ #ifndef SUB_CC_H #define SUB_CC_H -extern int subcc_enabled; - void subcc_init(void); void subcc_process_data(const unsigned char *inputdata,unsigned int len); Modified: mplayerxp/libmpdemux/sub_ty.c =================================================================== --- mplayerxp/libmpdemux/sub_ty.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libmpdemux/sub_ty.c 2012-10-30 16:33:40 UTC (rev 263) @@ -14,6 +14,7 @@ #include <string.h> #include "mp_config.h" +#include "mplayer.h" #include "help_mp.h" #include "sub_cc.h" @@ -862,7 +863,7 @@ sub_justify = 1; - if ( subcc_enabled ) + if ( mp_conf.subcc_enabled ) { if ( tyOSDInited == 0 ) { Modified: mplayerxp/libvo/aspect.c =================================================================== --- mplayerxp/libvo/aspect.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libvo/aspect.c 2012-10-30 16:33:40 UTC (rev 263) @@ -9,7 +9,6 @@ #include "vo_msg.h" float monitor_aspect=0; -float monitor_pixel_aspect=1; static struct { uint32_t orgw; // real width @@ -33,7 +32,7 @@ void __FASTCALL__ aspect_save_screenres(uint32_t scrw, uint32_t scrh){ aspdat.scrw = scrw; aspdat.scrh = scrh; - monitor_aspect = monitor_pixel_aspect * scrw / scrh; + monitor_aspect = mp_conf.monitor_pixel_aspect * scrw / scrh; } /* aspect is called with the source resolution and the Modified: mplayerxp/libvo/screenshot.c =================================================================== --- mplayerxp/libvo/screenshot.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libvo/screenshot.c 2012-10-30 16:33:40 UTC (rev 263) @@ -38,8 +38,6 @@ }sshot_priv_t; static sshot_priv_t sshot = { RGB, 0, 0 }; #ifdef HAVE_PNG -int z_compression = Z_NO_COMPRESSION; - struct pngdata { FILE * fp; png_structp png_ptr; @@ -89,7 +87,7 @@ png_init_io(png.png_ptr, png.fp); /* set the zlib compression level */ - png_set_compression_level(png.png_ptr, z_compression); + png_set_compression_level(png.png_ptr, mp_conf.z_compression); png_set_IHDR(png.png_ptr, png.info_ptr, sshot.image_width, sshot.image_height, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, @@ -211,8 +209,8 @@ return -1; } #ifdef HAVE_PNG - if((z_compression >= 0) && (z_compression <= 9)) { - if(z_compression == 0) { + if((mp_conf.z_compression >= 0) && (mp_conf.z_compression <= 9)) { + if(mp_conf.z_compression == 0) { MSG_HINT("PNG Warning: compression level set to 0, compression disabled!\n"); MSG_HINT("PNG Info: Use the -z <n> switch to set compression level from 0 to 9.\n"); MSG_HINT("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n"); @@ -222,9 +220,9 @@ MSG_WARN("PNG Warning: compression level out of range setting to 1!\n"); MSG_WARN("PNG Info: Use the -z <n> switch to set compression level from 0 to 9.\n"); MSG_WARN("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n"); - z_compression = Z_BEST_SPEED; + mp_conf.z_compression = Z_BEST_SPEED; } - MSG_V("PNG Compression level %i\n", z_compression); + MSG_V("PNG Compression level %i\n", mp_conf.z_compression); #endif dstStride[0]=sshot.image_width*3; dstStride[1]= Modified: mplayerxp/libvo/x11_common.c =================================================================== --- mplayerxp/libvo/x11_common.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/libvo/x11_common.c 2012-10-30 16:33:40 UTC (rev 263) @@ -78,10 +78,6 @@ #endif }priv_t; -#ifdef HAVE_XINERAMA -int xinerama_screen; -#endif - int __FASTCALL__ vo_x11_Shmem_Flag(vo_data_t*vo) { priv_t*priv=(priv_t*)vo->priv2; @@ -306,13 +302,13 @@ int num_screens; screens = XineramaQueryScreens(vo->mDisplay, &num_screens); - if(xinerama_screen >= num_screens) xinerama_screen = 0; + if(mp_conf.xinerama_screen >= num_screens) mp_conf.xinerama_screen = 0; if (! vo_conf.screenwidth) - vo_conf.screenwidth=screens[xinerama_screen].width; + vo_conf.screenwidth=screens[mp_conf.xinerama_screen].width; if (! vo_conf.screenheight) - vo_conf.screenheight=screens[xinerama_screen].height; - priv->xinerama_x = screens[xinerama_screen].x_org; - priv->xinerama_y = screens[xinerama_screen].y_org; + vo_conf.screenheight=screens[mp_conf.xinerama_screen].height; + priv->xinerama_x = screens[mp_conf.xinerama_screen].x_org; + priv->xinerama_y = screens[mp_conf.xinerama_screen].y_org; XFree(screens); } else Modified: mplayerxp/mp_msg.c =================================================================== --- mplayerxp/mp_msg.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/mp_msg.c 2012-10-30 16:33:40 UTC (rev 263) @@ -18,7 +18,6 @@ char scol[9][20]; pthread_mutex_t mp_msg_mutex; }priv_t; -uint32_t mp_msg_filter=0xFFFFFFFF; const char hl[9] = { 0xC, 0x4, 0xE, 0xA, 0xB, 0x7, 0x9, 0x3, 0x7 }; static char *_2ansi(unsigned char attr) @@ -96,7 +95,7 @@ static int was_eol=1; if(mp_data) priv=mp_data->msg_priv; if(level>mp_conf.verbose+MSGL_V-1) return; /* do not display */ - if((mod&mp_msg_filter)==0) return; /* do not display */ + if((mod&mp_conf.msg_filter)==0) return; /* do not display */ if(priv) { pthread_mutex_lock(&priv->mp_msg_mutex); if(isatty(fileno(stderr))) Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/mplayer.c 2012-10-30 16:33:40 UTC (rev 263) @@ -219,6 +219,9 @@ 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; } static void mpxp_uninit_structs(void) { @@ -1953,7 +1956,7 @@ MP_UNIT("af_preinit"); ao_data->samplerate=mp_conf.force_srate?mp_conf.force_srate:sh_audio->samplerate; - ao_data->channels=audio_output_channels?audio_output_channels:sh_audio->channels; + ao_data->channels=mp_conf.ao_channels?mp_conf.ao_channels:sh_audio->channels; ao_data->format=sh_audio->sample_format; #if 1 if(!mpca_preinit_filters(sh_audio, Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/mplayer.h 2012-10-30 16:33:40 UTC (rev 263) @@ -2,6 +2,7 @@ #define __MPLAYERXP_MAIN 1 #include <pthread.h> +#include <stdint.h> #include "mp_config.h" typedef struct mp_conf_s { @@ -10,6 +11,7 @@ int has_dvdsub; int use_stdin; int slave_mode; + uint32_t msg_filter; // XP-core int xp; /* XP-mode */ int gomp; /* currently it's experimental feature */ @@ -59,6 +61,13 @@ float sub_fps; int sub_auto; char* vobsub_name; + int subcc_enabled; +// others + char* npp_options; + int ao_channels; + int z_compression; + int xinerama_screen; + float monitor_pixel_aspect; }mp_conf_t; extern mp_conf_t mp_conf; Modified: mplayerxp/postproc/postprocess.c =================================================================== --- mplayerxp/postproc/postprocess.c 2012-10-30 15:15:18 UTC (rev 262) +++ mplayerxp/postproc/postprocess.c 2012-10-30 16:33:40 UTC (rev 263) @@ -13,8 +13,6 @@ #define MSGT_CLASS MSGT_PP #include "__mp_msg.h" -char * npp_options=NULL; - extern void exit_player(char *); pp_context *pp2_get_context(int width, int height, int flags) { @@ -29,7 +27,7 @@ int pp2_init(void) { - if(strcmp(npp_options,"help")==0) + if(strcmp(mp_conf.npp_options,"help")==0) { if(pp_help) MSG_INFO(*pp_help); else MSG_ERR("Can't access to PP's help\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-30 17:46:18
|
Revision: 265 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=265&view=rev Author: nickols_k Date: 2012-10-30 17:46:02 +0000 (Tue, 30 Oct 2012) Log Message: ----------- size optimization Modified Paths: -------------- mplayerxp/dump.c mplayerxp/fifo.c mplayerxp/libao2/ao_alsa9.c mplayerxp/libao2/ao_esd.c mplayerxp/libao2/ao_jack.c mplayerxp/libao2/ao_nas.c mplayerxp/libao2/ao_null.c mplayerxp/libao2/ao_openal.c mplayerxp/libao2/ao_oss.c mplayerxp/libao2/ao_sdl.c mplayerxp/libao2/ao_wav.c mplayerxp/libao2/audio_out.c mplayerxp/libmpcodecs/ad_libdv.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/vd_divx4.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpcodecs/vd_xvid.c mplayerxp/libmpconf/m_struct.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/cddb.c mplayerxp/libmpdemux/demux_aiff.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_dv.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mov.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_nuv.c mplayerxp/libmpdemux/demux_pva.c mplayerxp/libmpdemux/demux_ra.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_smjpeg.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demux_viv.c mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/demux_y4m.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/http.c mplayerxp/libmpdemux/librtsp/rtsp_rtp.c mplayerxp/libmpdemux/mux_mpxp64.c mplayerxp/libmpdemux/mux_raw.c mplayerxp/libmpdemux/muxer.c mplayerxp/libmpdemux/network.c mplayerxp/libmpdemux/parse_mp4.c mplayerxp/libmpdemux/s_dvdread.c mplayerxp/libmpdemux/s_ftp.c mplayerxp/libmpdemux/stream.c mplayerxp/libmpdemux/sub_cc.c mplayerxp/libmpdemux/sub_ty.c mplayerxp/libmpdemux/tvi_dummy.c mplayerxp/libmpdemux/tvi_v4l.c mplayerxp/libvo/font_load.c mplayerxp/libvo/sub.c mplayerxp/libvo/video_out.c 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/x11_common.c 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_VideoDecoder.c mplayerxp/loader/dshow/inputpin.c mplayerxp/loader/module.c mplayerxp/loader/win32.c mplayerxp/mp_image.c mplayerxp/mplayer.c mplayerxp/postproc/af.c mplayerxp/postproc/af_channels.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf_1bpp.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_denoise3d.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_il.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_smartblur.c mplayerxp/postproc/vf_test.c mplayerxp/postproc/vf_unsharp.c mplayerxp/postproc/vf_vo.c mplayerxp/sig_hand.c mplayerxp/xmp_core.c Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/dump.c 2012-10-30 17:46:02 UTC (rev 265) @@ -119,9 +119,8 @@ char stream_dump_name[1024]; /* TODO copy it from demuxer */ if(demuxer->priv) return; - demuxer->priv=mp_malloc(sizeof(priv_t)); + demuxer->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=demuxer->priv; - memset(priv,0,sizeof(priv_t)); /* describe other useless dumps */ priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; if(port) Modified: mplayerxp/fifo.c =================================================================== --- mplayerxp/fifo.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/fifo.c 2012-10-30 17:46:02 UTC (rev 265) @@ -82,10 +82,9 @@ CBFifoBuffer *cb_fifo_alloc(unsigned int size) { - CBFifoBuffer *f= mp_malloc(sizeof(CBFifoBuffer)); + CBFifoBuffer *f= mp_mallocz(sizeof(CBFifoBuffer)); if(!f) return NULL; - memset(f,0,sizeof(CBFifoBuffer)); f->buffer = mp_malloc(size); f->end = f->buffer + size; cb_fifo_reset(f); Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/ao_alsa9.c 2012-10-30 17:46:02 UTC (rev 265) @@ -320,9 +320,8 @@ char *alsa_port=NULL; char alsa_device[ALSA_DEVICE_SIZE]; UNUSED(flags); - ao->priv=mp_malloc(sizeof(priv_t)); + ao->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=ao->priv; - memset(priv,0,sizeof(priv_t)); priv->first=1; priv->handler = NULL; Modified: mplayerxp/libao2/ao_esd.c =================================================================== --- mplayerxp/libao2/ao_esd.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/ao_esd.c 2012-10-30 17:46:02 UTC (rev 265) @@ -163,9 +163,8 @@ */ static int init(ao_data_t* ao,unsigned flags) { - ao->priv=mp_malloc(sizeof(priv_t)); + ao->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=ao->priv; - memset(priv,0,sizeof(priv_t)); priv->fd=priv->play_fd=-1; char *server = ao->subdevice; /* NULL for localhost */ UNUSED(flags); Modified: mplayerxp/libao2/ao_jack.c =================================================================== --- mplayerxp/libao2/ao_jack.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/ao_jack.c 2012-10-30 17:46:02 UTC (rev 265) @@ -213,9 +213,7 @@ } #endif static int init(ao_data_t* ao,unsigned flags) { - ao->priv=mp_malloc(sizeof(priv_t)); - priv_t*priv=ao->priv; - memset(priv,0,sizeof(priv_t)); + ao->priv=mp_mallocz(sizeof(priv_t)); UNUSED(flags); return 1; } Modified: mplayerxp/libao2/ao_nas.c =================================================================== --- mplayerxp/libao2/ao_nas.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/ao_nas.c 2012-10-30 17:46:02 UTC (rev 265) @@ -416,9 +416,8 @@ static int init(ao_data_t* ao,unsigned flags) { - ao->priv=mp_malloc(sizeof(priv_t)); + ao->priv=mp_mallocz(sizeof(priv_t)); priv_t* priv=ao->priv; - memset(priv, 0, sizeof(priv_t)); UNUSED(flags); return 1; } Modified: mplayerxp/libao2/ao_null.c =================================================================== --- mplayerxp/libao2/ao_null.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/ao_null.c 2012-10-30 17:46:02 UTC (rev 265) @@ -107,9 +107,8 @@ // open & setup audio device // return: 1=success 0=fail static int __FASTCALL__ init(ao_data_t* ao,unsigned flags){ - ao->priv=mp_malloc(sizeof(priv_t)); + ao->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv = (priv_t*)ao->priv; - memset(priv,0,sizeof(priv_t)); char *null_dev=NULL,*mode=NULL; UNUSED(flags); if (ao->subdevice) { Modified: mplayerxp/libao2/ao_openal.c =================================================================== --- mplayerxp/libao2/ao_openal.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/ao_openal.c 2012-10-30 17:46:02 UTC (rev 265) @@ -93,9 +93,8 @@ #endif static int init(ao_data_t* ao,unsigned flags) { - ao->priv=mp_malloc(sizeof(priv_t)); + ao->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=ao->priv; - memset(priv,0,sizeof(priv_t)); UNUSED(flags); priv->alc_dev = alcOpenDevice(NULL); if (!priv->alc_dev) { Modified: mplayerxp/libao2/ao_oss.c =================================================================== --- mplayerxp/libao2/ao_oss.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/ao_oss.c 2012-10-30 17:46:02 UTC (rev 265) @@ -199,9 +199,8 @@ static int __FASTCALL__ init(ao_data_t* ao,unsigned flags){ char *mixer_channels [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; UNUSED(flags); - ao->priv=mp_malloc(sizeof(priv_t)); + ao->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=ao->priv; - memset(priv,0,sizeof(priv_t)); priv->dsp=PATH_DEV_DSP; priv->mixer_channel=SOUND_MIXER_PCM; priv->fd=-1; @@ -321,7 +320,7 @@ any_t* data; ao->buffersize=0; #ifdef HAVE_AUDIO_SELECT - data=mp_malloc(ao->outburst); memset(data,0,ao->outburst); + data=mp_mallocz(ao->outburst); while(ao->buffersize<0x40000){ fd_set rfds; struct timeval tv; Modified: mplayerxp/libao2/ao_sdl.c =================================================================== --- mplayerxp/libao2/ao_sdl.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/ao_sdl.c 2012-10-30 17:46:02 UTC (rev 265) @@ -148,8 +148,7 @@ { unsigned i; UNUSED(flags); - ao->priv=mp_malloc(sizeof(priv_t)); - memset(ao->priv,0,sizeof(priv_t)); + ao->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=ao->priv; priv->volume=127; /* Allocate ring-priv->buffer memory */ Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/ao_wav.c 2012-10-30 17:46:02 UTC (rev 265) @@ -99,9 +99,8 @@ static int init(ao_data_t* ao,unsigned flags) { // set defaults UNUSED(flags); - ao->priv=mp_malloc(sizeof(priv_t)); + ao->priv=mp_mallocz(sizeof(priv_t)); priv_t* priv=ao->priv; - memset(priv,0,sizeof(priv_t)); priv->pcm_waveheader=1; return 1; } Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libao2/audio_out.c 2012-10-30 17:46:02 UTC (rev 265) @@ -207,8 +207,7 @@ { ao_data_t* ao; int retval; - ao=mp_malloc(sizeof(ao_data_t)); - memset(ao,0,sizeof(ao_data_t)); + ao=mp_mallocz(sizeof(ao_data_t)); if(subdevice) ao->subdevice=mp_strdup(subdevice); ao->outburst=OUTBURST; ao->buffersize=-1; Modified: mplayerxp/libmpcodecs/ad_libdv.c =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpcodecs/ad_libdv.c 2012-10-30 17:46:02 UTC (rev 265) @@ -59,8 +59,7 @@ sh->channels=h->nChannels; sh->samplerate=h->nSamplesPerSec; sh->samplesize=(h->wBitsPerSample+7)/8; - priv = mp_malloc(sizeof(libdv_priv_t)); - memset(priv,0,sizeof(libdv_priv_t)); + priv = mp_mallocz(sizeof(libdv_priv_t)); priv->decoder=init_global_rawdv_decoder(); sh->context = priv; for (i=0; i < 4; i++) Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-30 17:46:02 UTC (rev 265) @@ -272,8 +272,7 @@ sh->samplesize=4; sh->sample_format=AFMT_FLOAT32; mpg123_init(); - priv = mp_malloc(sizeof(mp3_priv_t)); - memset(priv,0,sizeof(mp3_priv_t)); + priv = mp_mallocz(sizeof(mp3_priv_t)); sh->context = priv; priv->mh = mpg123_new(NULL,&err); if(err) { Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-10-30 17:46:02 UTC (rev 265) @@ -73,8 +73,7 @@ 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_malloc(sh_audio->a_in_buffer_size); - memset(sh_audio->a_in_buffer,0,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; } @@ -84,12 +83,11 @@ 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_malloc(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); return 0; } - memset(sh_audio->a_buffer,0,sh_audio->a_buffer_size); sh_audio->a_buffer_len=0; if(!mpadec->init(sh_audio)){ @@ -237,8 +235,7 @@ sh_audio->af_bps = afs->output.rate*afs->output.nch*afs->output.bps; sh_audio->a_buffer_size=out_maxsize; - sh_audio->a_buffer=mp_malloc(sh_audio->a_buffer_size); - memset(sh_audio->a_buffer,0,sh_audio->a_buffer_size); + sh_audio->a_buffer=mp_mallocz(sh_audio->a_buffer_size); sh_audio->a_buffer_len=0; af_showconf(afs->first); Modified: mplayerxp/libmpcodecs/vd_divx4.c =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpcodecs/vd_divx4.c 2012-10-30 17:46:02 UTC (rev 265) @@ -200,9 +200,8 @@ MSG_ERR("Unsupported out_fmt: 0x%X\n",sh->codec->outfmt[sh->outfmtidx]); return 0; } - if(!(p=mp_malloc(sizeof(priv_t)))) { MSG_ERR("Out of memory\n"); return 0; } + if(!(p=mp_mallocz(sizeof(priv_t)))) { MSG_ERR("Out of memory\n"); return 0; } sh->context=p; - memset(p,0,sizeof(priv_t)); if(!(p->decoder=getDecore_ptr(sh->fourcc))) { char *p=(char *)&(sh->fourcc); MSG_ERR("Can't find decoder for %c%c%c%c fourcc\n",p[0],p[1],p[2],p[3]); Modified: mplayerxp/libmpcodecs/vd_vfw.c =================================================================== --- mplayerxp/libmpcodecs/vd_vfw.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpcodecs/vd_vfw.c 2012-10-30 17:46:02 UTC (rev 265) @@ -128,8 +128,7 @@ return 0; } - priv->o_bih=mp_malloc(temp_len); - memset(priv->o_bih, 0, temp_len); + priv->o_bih=mp_mallocz(temp_len); priv->o_bih->biSize = temp_len; ret = ICDecompressGetFormat(priv->hic, sh_video->bih, priv->o_bih); Modified: mplayerxp/libmpcodecs/vd_xvid.c =================================================================== --- mplayerxp/libmpcodecs/vd_xvid.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpcodecs/vd_xvid.c 2012-10-30 17:46:02 UTC (rev 265) @@ -363,8 +363,7 @@ ,xvid_gbl_info.num_threads ,xvid_gbl_info.cpu_flags); - p = mp_malloc(sizeof(priv_t)); - memset(p,0,sizeof(priv_t)); + p = mp_mallocz(sizeof(priv_t)); p->cs = cs; p->hdl = dec_p.handle; p->vo_initialized = 0; Modified: mplayerxp/libmpconf/m_struct.c =================================================================== --- mplayerxp/libmpconf/m_struct.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpconf/m_struct.c 2012-10-30 17:46:02 UTC (rev 265) @@ -43,7 +43,7 @@ r = mp_calloc(1,st->size); memcpy(r,st->defaults,st->size); - + for(i = 0 ; st->fields[i].name ; i++) { if(st->fields[i].type->flags & M_OPT_TYPE_DYNAMIC) memset(M_ST_MB_P(r,st->fields[i].p),0,st->fields[i].type->size); @@ -106,7 +106,7 @@ m_struct_copy(const m_struct_t* st, any_t* obj) { any_t* r = mp_malloc(st->size); int i; - + memcpy(r,obj,st->size); for(i = 0 ; st->fields[i].name ; i++) { if(st->fields[i].type->flags & M_OPT_TYPE_DYNAMIC) Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/cache2.c 2012-10-30 17:46:02 UTC (rev 265) @@ -194,15 +194,14 @@ static cache_vars_t* __FASTCALL__ c2_cache_init(int size,int sector){ pthread_mutex_t tmpl=PTHREAD_MUTEX_INITIALIZER; - cache_vars_t* c=mp_malloc(sizeof(cache_vars_t)); + cache_vars_t* c=mp_mallocz(sizeof(cache_vars_t)); char *pmem; unsigned i,num; - memset(c,0,sizeof(cache_vars_t)); c->npackets=num=size/sector; /* collection of all c2_packets in continuous memory area minimizes cache pollution and speedups cache as C+D=3.27% instead of 4.77% */ i=sizeof(cache_packet_t)*num; - c->packets=mp_malloc(i); + c->packets=mp_mallocz(i); c->mem=mp_malloc(num*sector); if(!c->packets || !c->mem) { @@ -210,7 +209,6 @@ mp_free(c); return 0; } - memset(c->packets,0,i); pmem = c->mem; MSG_DBG2("For cache navigation was allocated %u bytes as %u packets (%u/%u)\n",i,num,size,sector); c->first=c->last=0; Modified: mplayerxp/libmpdemux/cdda.c =================================================================== --- mplayerxp/libmpdemux/cdda.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/cdda.c 2012-10-30 17:46:02 UTC (rev 265) @@ -80,8 +80,7 @@ unsigned char arr[256]; int st_inited; - priv = (cdda_priv*)mp_malloc(sizeof(cdda_priv)); - memset(priv, 0, sizeof(cdda_priv)); + priv = (cdda_priv*)mp_mallocz(sizeof(cdda_priv)); priv->cd = cdio_cddap_identify(dev,mp_conf.verbose?1:0,NULL); Modified: mplayerxp/libmpdemux/cddb.c =================================================================== --- mplayerxp/libmpdemux/cddb.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/cddb.c 2012-10-30 17:46:02 UTC (rev 265) @@ -574,14 +574,12 @@ cd_info_t* __FASTCALL__ cd_info_new() { cd_info_t *cd_info = NULL; - cd_info = (cd_info_t*)mp_malloc(sizeof(cd_info_t)); + cd_info = (cd_info_t*)mp_mallocz(sizeof(cd_info_t)); if( cd_info==NULL ) { MSG_FATAL("Memory allocation failed\n"); return NULL; } - memset(cd_info, 0, sizeof(cd_info_t)); - return cd_info; } @@ -606,13 +604,11 @@ if( cd_info==NULL || track_name==NULL ) return NULL; - cd_track = (cd_track_t*)mp_malloc(sizeof(cd_track_t)); + cd_track = (cd_track_t*)mp_mallocz(sizeof(cd_track_t)); if( cd_track==NULL ) { MSG_FATAL("Memory allocation failed\n"); return NULL; } - memset(cd_track, 0, sizeof(cd_track_t)); - cd_track->name = (char*)mp_malloc(strlen(track_name)+1); if( cd_track->name==NULL ) { MSG_FATAL("Memory allocation failed\n"); Modified: mplayerxp/libmpdemux/demux_aiff.c =================================================================== --- mplayerxp/libmpdemux/demux_aiff.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_aiff.c 2012-10-30 17:46:02 UTC (rev 265) @@ -52,8 +52,7 @@ s = demuxer->stream; sh_audio = new_sh_audio(demuxer,0); - priv=demuxer->priv=mp_malloc(sizeof(priv_t)); - memset(priv,0,sizeof(priv_t)); + priv=demuxer->priv=mp_mallocz(sizeof(priv_t)); sh_audio->wf = w = (WAVEFORMATEX*)mp_malloc(sizeof(WAVEFORMATEX)); w->wFormatTag = 0x1; sh_audio->wtag = mmioFOURCC('r','a','w',' '); /* S16BE */ w->nChannels = sh_audio->channels = Modified: mplayerxp/libmpdemux/demux_audio.c =================================================================== --- mplayerxp/libmpdemux/demux_audio.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_audio.c 2012-10-30 17:46:02 UTC (rev 265) @@ -865,9 +865,8 @@ assert(demuxer != NULL); assert(demuxer->stream != NULL); #endif - - priv = (da_priv_t*)mp_malloc(sizeof(da_priv_t)); - memset(priv,0,sizeof(da_priv_t)); + + priv = (da_priv_t*)mp_mallocz(sizeof(da_priv_t)); s = demuxer->stream; stream_reset(s); stream_seek(s,s->start_pos); Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-30 17:46:02 UTC (rev 265) @@ -289,10 +289,8 @@ print_avisuperindex_chunk(s); msize = sizeof (uint32_t) * s->wLongsPerEntry * s->nEntriesInUse; - s->aIndex = mp_malloc(msize); - memset (s->aIndex, 0, msize); - s->stdidx = mp_malloc (s->nEntriesInUse * sizeof (avistdindex_chunk)); - memset (s->stdidx, 0, s->nEntriesInUse * sizeof (avistdindex_chunk)); + s->aIndex = mp_mallocz(msize); + s->stdidx = mp_mallocz(s->nEntriesInUse * sizeof (avistdindex_chunk)); // now the real index of indices for (i=0; i<s->nEntriesInUse; i++) { @@ -309,8 +307,7 @@ break; } case ckidSTREAMFORMAT: { // read 'strf' if(last_fccType==streamtypeVIDEO){ - sh_video->bih=mp_calloc((chunksize<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):chunksize,1); -// sh_video->bih=mp_malloc(chunksize); memset(sh_video->bih,0,chunksize); + sh_video->bih=mp_mallocz((chunksize<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):chunksize); MSG_V("found 'bih', %u bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER)); stream_read(demuxer->stream,(char*) sh_video->bih,chunksize); le2me_BITMAPINFOHEADER(sh_video->bih); // swap to machine endian @@ -363,8 +360,7 @@ } else if(last_fccType==streamtypeAUDIO){ unsigned wf_size = chunksize<sizeof(WAVEFORMATEX)?sizeof(WAVEFORMATEX):chunksize; - sh_audio->wf=mp_calloc(wf_size,1); -// sh_audio->wf=mp_malloc(chunksize); memset(sh_audio->wf,0,chunksize); + sh_audio->wf=mp_mallocz(wf_size); MSG_V("found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX)); stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize); le2me_WAVEFORMATEX(sh_audio->wf); @@ -1144,10 +1140,9 @@ demux_stream_t *d_video=demuxer->video; sh_audio_t *sh_audio=NULL; sh_video_t *sh_video=NULL; - avi_priv_t* priv=mp_malloc(sizeof(avi_priv_t)); + avi_priv_t* priv=mp_mallocz(sizeof(avi_priv_t)); // priv struct: - memset(priv,0,sizeof(avi_priv_t)); demuxer->priv=(any_t*)priv; //---- AVI header: Modified: mplayerxp/libmpdemux/demux_dv.c =================================================================== --- mplayerxp/libmpdemux/demux_dv.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_dv.c 2012-10-30 17:46:02 UTC (rev 265) @@ -210,8 +210,7 @@ // custom fourcc for internal MPlayer use sh_audio->wtag = mmioFOURCC('R', 'A', 'D', 'V'); - sh_audio->wf = mp_malloc(sizeof(WAVEFORMATEX)); - memset(sh_audio->wf, 0, sizeof(WAVEFORMATEX)); + sh_audio->wf = mp_mallocz(sizeof(WAVEFORMATEX)); sh_audio->wf->wFormatTag = sh_audio->wtag; sh_audio->wf->nChannels = dv_decoder->audio->num_channels; sh_audio->wf->wBitsPerSample = 16; Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-10-30 17:46:02 UTC (rev 265) @@ -2281,7 +2281,7 @@ mkv_d->audio_tracks[mkv_d->last_aid] = track->tnum; sh_a->ds = demuxer->audio; - sh_a->wf = mp_malloc (sizeof (WAVEFORMATEX)); + sh_a->wf = mp_mallocz (sizeof (WAVEFORMATEX)); if (track->ms_compat && (track->private_size >= sizeof(WAVEFORMATEX))) { WAVEFORMATEX *wf = (WAVEFORMATEX *)track->private_data; @@ -2304,7 +2304,6 @@ } else { - memset(sh_a->wf, 0, sizeof (WAVEFORMATEX)); if (!strcmp(track->codec_id, MKV_A_MP3) || !strcmp(track->codec_id, MKV_A_MP2)) track->a_formattag = 0x0055; Modified: mplayerxp/libmpdemux/demux_mov.c =================================================================== --- mplayerxp/libmpdemux/demux_mov.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_mov.c 2012-10-30 17:46:02 UTC (rev 265) @@ -302,12 +302,10 @@ int flags=0; int no=0; unsigned ver; - mov_priv_t* priv=mp_malloc(sizeof(mov_priv_t)); + mov_priv_t* priv=mp_mallocz(sizeof(mov_priv_t)); MSG_V("Checking for MOV\n"); - memset(priv,0,sizeof(mov_priv_t)); - while(1){ int i; int skipped=8; @@ -611,8 +609,7 @@ return; } if(!priv->track_db) MSG_V("--------------\n"); - trak=mp_malloc(sizeof(mov_track_t)); - memset(trak,0,sizeof(mov_track_t)); + trak=mp_mallocz(sizeof(mov_track_t)); MSG_V("MOV: Track #%d:\n",priv->track_db); trak->id=priv->track_db; priv->tracks[priv->track_db]=trak; @@ -917,8 +914,7 @@ } MSG_V("Fourcc: %.4s\n",&trak->fourcc); // Emulate WAVEFORMATEX struct: - sh->wf=mp_malloc(sizeof(WAVEFORMATEX)); - memset(sh->wf,0,sizeof(WAVEFORMATEX)); + sh->wf=mp_mallocz(sizeof(WAVEFORMATEX)); sh->wf->wFormatTag=afourcc2wtag(sh->wtag); sh->wf->nChannels=sh->channels; sh->wf->wBitsPerSample=(trak->stdata[18]<<8)+trak->stdata[19]; @@ -1147,8 +1143,7 @@ // emulate BITMAPINFOHEADER: if (palette_count) { - sh->bih=mp_malloc(sizeof(BITMAPINFOHEADER) + palette_count * 4); - memset(sh->bih,0,sizeof(BITMAPINFOHEADER) + palette_count * 4); + sh->bih=mp_mallocz(sizeof(BITMAPINFOHEADER) + palette_count * 4); sh->bih->biSize=40 + palette_count * 4; // fetch the relevant fields flag = BE_16(trak->stdata[hdr_ptr]); @@ -1235,16 +1230,14 @@ MSG_ERR( "Invalid extradata size %d, skipping\n",trak->stream_header_len); trak->stream_header_len = 0; } - sh->bih=mp_malloc(sizeof(BITMAPINFOHEADER) + trak->stream_header_len); - memset(sh->bih,0,sizeof(BITMAPINFOHEADER) + trak->stream_header_len); + sh->bih=mp_mallocz(sizeof(BITMAPINFOHEADER) + trak->stream_header_len); sh->bih->biSize=40 + trak->stream_header_len; memcpy(((unsigned char *)sh->bih)+40, trak->stream_header, trak->stream_header_len); mp_free (trak->stream_header); trak->stream_header_len = 0; trak->stream_header = NULL; } else { - sh->bih=mp_malloc(sizeof(BITMAPINFOHEADER)); - memset(sh->bih,0,sizeof(BITMAPINFOHEADER)); + sh->bih=mp_mallocz(sizeof(BITMAPINFOHEADER)); sh->bih->biSize=40; } } Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-30 17:46:02 UTC (rev 265) @@ -466,8 +466,7 @@ hsize=stream_read_qword_le(s); /* header size */ // priv struct: - priv=mp_malloc(sizeof(mpxpav64_priv_t)); - memset(priv,0,sizeof(mpxpav64_priv_t)); + priv=mp_mallocz(sizeof(mpxpav64_priv_t)); demuxer->priv=(any_t*)priv; demuxer->video->id=-1; demuxer->audio->id=-1; Modified: mplayerxp/libmpdemux/demux_nuv.c =================================================================== --- mplayerxp/libmpdemux/demux_nuv.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_nuv.c 2012-10-30 17:46:02 UTC (rev 265) @@ -265,9 +265,8 @@ sh_audio->wtag = 0x1; sh_audio->channels = 2; sh_audio->samplerate = 44100; - - sh_audio->wf = mp_malloc(sizeof(WAVEFORMATEX)); - memset(sh_audio->wf, 0, sizeof(WAVEFORMATEX)); + + sh_audio->wf = mp_mallocz(sizeof(WAVEFORMATEX)); sh_audio->wf->wFormatTag = sh_audio->wtag; sh_audio->wf->nChannels = sh_audio->channels; sh_audio->wf->wBitsPerSample = 16; Modified: mplayerxp/libmpdemux/demux_pva.c =================================================================== --- mplayerxp/libmpdemux/demux_pva.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_pva.c 2012-10-30 17:46:02 UTC (rev 265) @@ -129,20 +129,19 @@ 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_audio_t *sh_audio = new_sh_audio(demuxer,0); - + pva_priv_t * priv; - + stream_reset(demuxer->stream); stream_seek(demuxer->stream,0); - priv=mp_malloc(sizeof(pva_priv_t)); + priv=mp_mallocz(sizeof(pva_priv_t)); demuxer->flags|=DEMUXF_SEEKABLE; - + demuxer->priv=priv; - memset(demuxer->priv,0,sizeof(pva_priv_t)); - + if(!pva_sync(demuxer)) { MSG_ERR("Not a PVA file.\n"); @@ -150,36 +149,36 @@ } //printf("priv->just_synced %s after initial sync!\n",priv->just_synced?"set":"UNSET"); - + 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. */ - + 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; Modified: mplayerxp/libmpdemux/demux_ra.c =================================================================== --- mplayerxp/libmpdemux/demux_ra.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_ra.c 2012-10-30 17:46:02 UTC (rev 265) @@ -99,11 +99,10 @@ int i; char *buf; - if ((ra_priv = (ra_priv_t *)mp_malloc(sizeof(ra_priv_t))) == NULL) { - MSG_ERR(MSGTR_OutOfMemory); - return 0; - } - memset(ra_priv, 0, sizeof(ra_priv_t)); + if ((ra_priv = (ra_priv_t *)mp_mallocz(sizeof(ra_priv_t))) == NULL) { + MSG_ERR(MSGTR_OutOfMemory); + return 0; + } demuxer->priv = ra_priv; sh = new_sh_audio(demuxer, 0); @@ -225,8 +224,7 @@ } /* Fill WAVEFORMATEX */ - sh->wf = mp_malloc(sizeof(WAVEFORMATEX)); - memset(sh->wf, 0, sizeof(WAVEFORMATEX)); + sh->wf = mp_mallocz(sizeof(WAVEFORMATEX)); sh->wf->nChannels = sh->channels; sh->wf->wBitsPerSample = sh->samplesize; sh->wf->nSamplesPerSec = sh->samplerate; Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-30 17:46:02 UTC (rev 265) @@ -323,8 +323,7 @@ if (c != MKTAG('.', 'R', 'M', 'F')) return 0; /* bad magic */ - priv = mp_malloc(sizeof(real_priv_t)); - memset(priv, 0, sizeof(real_priv_t)); + priv = mp_mallocz(sizeof(real_priv_t)); demuxer->priv = priv; demuxer->file_format=DEMUXER_TYPE_REAL; return 1; @@ -1076,8 +1075,7 @@ } /* Emulate WAVEFORMATEX struct: */ - sh->wf = mp_malloc(sizeof(WAVEFORMATEX)); - memset(sh->wf, 0, sizeof(WAVEFORMATEX)); + sh->wf = mp_mallocz(sizeof(WAVEFORMATEX)); sh->wf->nChannels = sh->channels; sh->wf->wBitsPerSample = sh->samplesize*8; sh->wf->nSamplesPerSec = sh->samplerate; @@ -1179,8 +1177,7 @@ sh_audio_t *sh = new_sh_audio(demuxer, stream_id); /* Emulate WAVEFORMATEX struct: */ - sh->wf = mp_malloc(sizeof(WAVEFORMATEX)); - memset(sh->wf, 0, sizeof(WAVEFORMATEX)); + sh->wf = mp_mallocz(sizeof(WAVEFORMATEX)); sh->wf->nChannels = 0;//sh->channels; sh->wf->wBitsPerSample = 16; sh->wf->nSamplesPerSec = 0;//sh->samplerate; Modified: mplayerxp/libmpdemux/demux_smjpeg.c =================================================================== --- mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-30 17:46:02 UTC (rev 265) @@ -120,10 +120,9 @@ sh_video = new_sh_video(demuxer, 0); demuxer->video->sh = sh_video; sh_video->ds = demuxer->video; - - sh_video->bih = mp_malloc(sizeof(BITMAPINFOHEADER)); - memset(sh_video->bih, 0, sizeof(BITMAPINFOHEADER)); + sh_video->bih = mp_mallocz(sizeof(BITMAPINFOHEADER)); + stream_skip(demuxer->stream, 4); /* number of frames */ // sh_video->fps = 24; sh_video->src_w = stream_read_word(demuxer->stream); @@ -144,9 +143,8 @@ demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; - sh_audio->wf = mp_malloc(sizeof(WAVEFORMATEX)); - memset(sh_audio->wf, 0, sizeof(WAVEFORMATEX)); - + sh_audio->wf = mp_mallocz(sizeof(WAVEFORMATEX)); + sh_audio->samplerate = stream_read_word(demuxer->stream); sh_audio->wf->wBitsPerSample = stream_read_char(demuxer->stream); sh_audio->channels = stream_read_char(demuxer->stream); Modified: mplayerxp/libmpdemux/demux_ts.c =================================================================== --- mplayerxp/libmpdemux/demux_ts.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_ts.c 2012-10-30 17:46:02 UTC (rev 265) @@ -2064,10 +2064,9 @@ { ES_stream_t *tss; - tss = mp_malloc(sizeof(ES_stream_t)); + tss = mp_mallocz(sizeof(ES_stream_t)); if(! tss) return NULL; - memset(tss, 0, sizeof(ES_stream_t)); tss->pid = pid; tss->last_cc = -1; tss->type = UNKNOWN; Modified: mplayerxp/libmpdemux/demux_viv.c =================================================================== --- mplayerxp/libmpdemux/demux_viv.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_viv.c 2012-10-30 17:46:02 UTC (rev 265) @@ -112,8 +112,7 @@ if (!demux->priv) { - priv = mp_malloc(sizeof(vivo_priv_t)); - memset(priv, 0, sizeof(vivo_priv_t)); + priv = mp_mallocz(sizeof(vivo_priv_t)); demux->priv = priv; priv->supported = 0; } @@ -268,8 +267,7 @@ MSG_DBG2("header block 1 size: %d\n",len); //stream_skip(demuxer->stream,len); - priv=mp_malloc(sizeof(vivo_priv_t)); - memset(priv,0,sizeof(vivo_priv_t)); + priv=mp_mallocz(sizeof(vivo_priv_t)); demuxer->priv=priv; #if 0 @@ -607,8 +605,7 @@ sh->src_h = height; // emulate BITMAPINFOHEADER: - sh->bih=mp_malloc(sizeof(BITMAPINFOHEADER)); - memset(sh->bih,0,sizeof(BITMAPINFOHEADER)); + sh->bih=mp_mallocz(sizeof(BITMAPINFOHEADER)); sh->bih->biSize=40; if (priv->width) sh->bih->biWidth = priv->width; @@ -672,8 +669,7 @@ } // Emulate WAVEFORMATEX struct: - sh->wf=mp_malloc(sizeof(WAVEFORMATEX)); - memset(sh->wf,0,sizeof(WAVEFORMATEX)); + sh->wf=mp_mallocz(sizeof(WAVEFORMATEX)); sh->wf->wFormatTag=sh->wtag; sh->wf->nChannels=1; /* 1 channels for both Siren and G.723 */ Modified: mplayerxp/libmpdemux/demux_vqf.c =================================================================== --- mplayerxp/libmpdemux/demux_vqf.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_vqf.c 2012-10-30 17:46:02 UTC (rev 265) @@ -53,9 +53,8 @@ s = demuxer->stream; sh_audio = new_sh_audio(demuxer,0); - sh_audio->wf = w = (WAVEFORMATEX*)mp_malloc(sizeof(WAVEFORMATEX)+sizeof(headerInfo)); + sh_audio->wf = w = (WAVEFORMATEX*)mp_mallocz(sizeof(WAVEFORMATEX)+sizeof(headerInfo)); hi = (headerInfo *)&w[1]; - memset(hi,0,sizeof(headerInfo)); w->wFormatTag = 0x1; sh_audio->wtag = mmioFOURCC('T','W','I','N'); /* TWinVQ */ w->nChannels = sh_audio->channels = 2; w->nSamplesPerSec = sh_audio->samplerate = 44100; Modified: mplayerxp/libmpdemux/demux_y4m.c =================================================================== --- mplayerxp/libmpdemux/demux_y4m.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demux_y4m.c 2012-10-30 17:46:02 UTC (rev 265) @@ -206,8 +206,7 @@ sh->fourcc = mmioFOURCC('Y', 'V', '1', '2'); - sh->bih=mp_malloc(sizeof(BITMAPINFOHEADER)); - memset(sh->bih,0,sizeof(BITMAPINFOHEADER)); + sh->bih=mp_mallocz(sizeof(BITMAPINFOHEADER)); sh->bih->biSize=40; sh->bih->biWidth = sh->src_w; sh->bih->biHeight = sh->src_h; Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-30 17:46:02 UTC (rev 265) @@ -138,8 +138,7 @@ } demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){ - demuxer_t *d=mp_malloc(sizeof(demuxer_t)); - memset(d,0,sizeof(demuxer_t)); + demuxer_t *d=mp_mallocz(sizeof(demuxer_t)); d->stream=stream; d->movi_start=stream->start_pos; d->movi_end=stream->end_pos; @@ -151,8 +150,7 @@ d->video=new_demuxer_stream(d,v_id); d->sub=new_demuxer_stream(d,s_id); d->file_format=type; - d->info=mp_malloc(sizeof(demuxer_info_t)); - memset(d->info,0,sizeof(demuxer_info_t)); + d->info=mp_mallocz(sizeof(demuxer_info_t)); stream_reset(stream); stream_seek(stream,stream->start_pos); return d; Modified: mplayerxp/libmpdemux/http.c =================================================================== --- mplayerxp/libmpdemux/http.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/http.c 2012-10-30 17:46:02 UTC (rev 265) @@ -20,9 +20,8 @@ http_new_header() { HTTP_header_t *http_hdr; - http_hdr = (HTTP_header_t*)mp_malloc(sizeof(HTTP_header_t)); + http_hdr = (HTTP_header_t*)mp_mallocz(sizeof(HTTP_header_t)); if( http_hdr==NULL ) return NULL; - memset( http_hdr, 0, sizeof(HTTP_header_t) ); return http_hdr; } Modified: mplayerxp/libmpdemux/librtsp/rtsp_rtp.c =================================================================== --- mplayerxp/libmpdemux/librtsp/rtsp_rtp.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/librtsp/rtsp_rtp.c 2012-10-30 17:46:02 UTC (rev 265) @@ -610,7 +610,7 @@ is_multicast ? RTSP_MULTICAST_PORT : RTSP_UNICAST_CLIENT_PORT, client_rtp_port, client_rtcp_port); MSG_V("RTSP Transport: %s\n", temp_buf); - + rtsp_unschedule_field (rtsp_session, RTSP_SESSION); rtsp_schedule_field (rtsp_session, temp_buf); Modified: mplayerxp/libmpdemux/mux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/mux_mpxp64.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/mux_mpxp64.c 2012-10-30 17:46:02 UTC (rev 265) @@ -168,17 +168,14 @@ MSG_ERR("Too many streams! increase MUXER_MAX_STREAMS !\n"); return NULL; } - s=mp_malloc(sizeof(muxer_stream_t)); - memset(s,0,sizeof(muxer_stream_t)); + s=mp_mallocz(sizeof(muxer_stream_t)); if(!s) return NULL; // no mem!? if(!muxer->priv) { - muxer->priv=mp_malloc(sizeof(priv_mpxpav64_t)); - memset(muxer->priv,0,sizeof(priv_mpxpav64_t)); + muxer->priv=mp_mallocz(sizeof(priv_mpxpav64_t)); ((priv_mpxpav64_t *)muxer->priv)->prev_seek=-SEEKPOINT_THRESHOLD*2; } - s->priv=mp_malloc(sizeof(priv_mpxpav64_stream_t)); - memset(s->priv,0,sizeof(priv_mpxpav64_stream_t)); + s->priv=mp_mallocz(sizeof(priv_mpxpav64_stream_t)); muxer->streams[muxer->avih.dwStreams]=s; s->type=type; s->id=muxer->avih.dwStreams; Modified: mplayerxp/libmpdemux/mux_raw.c =================================================================== --- mplayerxp/libmpdemux/mux_raw.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/mux_raw.c 2012-10-30 17:46:02 UTC (rev 265) @@ -35,16 +35,14 @@ MSG_ERR("Too many streams! increase MUXER_MAX_STREAMS !\n"); return NULL; } - s=mp_malloc(sizeof(muxer_stream_t)); - memset(s,0,sizeof(muxer_stream_t)); + s=mp_mallocz(sizeof(muxer_stream_t)); if(!s) return NULL; // no mem!? muxer->streams[muxer->avih.dwStreams]=s; s->type=type; s->id=muxer->avih.dwStreams; s->timer=0.0; s->muxer=muxer; - s->priv=mp_malloc(sizeof(priv_raw_stream_t)); - memset(s->priv,0,sizeof(priv_raw_stream_t)); + s->priv=mp_mallocz(sizeof(priv_raw_stream_t)); s->size=0; switch(type){ case MUXER_TYPE_VIDEO: Modified: mplayerxp/libmpdemux/muxer.c =================================================================== --- mplayerxp/libmpdemux/muxer.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/muxer.c 2012-10-30 17:46:02 UTC (rev 265) @@ -35,8 +35,7 @@ } muxer_t *muxer_new_muxer(const char *type,const char *subtype,FILE *f){ - muxer_t* muxer=mp_malloc(sizeof(muxer_t)); - memset(muxer,0,sizeof(muxer_t)); + muxer_t* muxer=mp_mallocz(sizeof(muxer_t)); muxer->file = f; // if(!strcmp(type,"lavf")) { if(!muxer_init_muxer_lavf(muxer,subtype)) { mp_free(muxer); muxer=NULL; }} // else Modified: mplayerxp/libmpdemux/network.c =================================================================== --- mplayerxp/libmpdemux/network.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/network.c 2012-10-30 17:46:02 UTC (rev 265) @@ -94,12 +94,11 @@ streaming_ctrl_t * streaming_ctrl_new(void) { streaming_ctrl_t *streaming_ctrl; - streaming_ctrl = (streaming_ctrl_t*)mp_malloc(sizeof(streaming_ctrl_t)); + streaming_ctrl = (streaming_ctrl_t*)mp_mallocz(sizeof(streaming_ctrl_t)); if( streaming_ctrl==NULL ) { MSG_FATAL(MSGTR_OutOfMemory); return NULL; } - memset( streaming_ctrl, 0, sizeof(streaming_ctrl_t) ); return streaming_ctrl; } Modified: mplayerxp/libmpdemux/parse_mp4.c =================================================================== --- mplayerxp/libmpdemux/parse_mp4.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/parse_mp4.c 2012-10-30 17:46:02 UTC (rev 265) @@ -39,11 +39,11 @@ uint8_t len; #ifdef MP4_DUMPATOM {int i; - MSG_DBG2("ESDS Dump (%dbyte):\n", datalen); + MSG_DBG2("ESDS Dump (%dbyte):\n", datalen); for(i = 0; i < datalen; i++) MSG_DBG2("%02X ", data[i]); MSG_DBG2("\nESDS Dumped\n");} -#endif +#endif memset(esds, 0, sizeof(esds_t)); esds->version = stream_read_char(s); Modified: mplayerxp/libmpdemux/s_dvdread.c =================================================================== --- mplayerxp/libmpdemux/s_dvdread.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/s_dvdread.c 2012-10-30 17:46:02 UTC (rev 265) @@ -709,9 +709,9 @@ return 0; } --dvd_angle; // remap 1.. -> 0.. - + // store data - d=mp_malloc(sizeof(dvd_priv_t)); memset(d,0,sizeof(dvd_priv_t)); + d=mp_mallocz(sizeof(dvd_priv_t)); d->dvd=dvd; d->title=0; d->vmg_file=vmg_file; Modified: mplayerxp/libmpdemux/s_ftp.c =================================================================== --- mplayerxp/libmpdemux/s_ftp.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/s_ftp.c 2012-10-30 17:46:02 UTC (rev 265) @@ -371,8 +371,7 @@ MSG_ERR("[ftp] Bad url\n"); return 0; } - p=stream->priv=mp_malloc(sizeof(struct stream_priv_s)); - memset(p,0,sizeof(struct stream_priv_s)); + p=stream->priv=mp_mallocz(sizeof(struct stream_priv_s)); p->user=url->username?url->username:"anonymous"; p->pass=url->password?url->password:"no@spam"; p->host=url->hostname; Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/stream.c 2012-10-30 17:46:02 UTC (rev 265) @@ -219,9 +219,8 @@ } stream_t* __FASTCALL__ new_memory_stream(const unsigned char* data,int len){ - stream_t *s=mp_malloc(sizeof(stream_t)+len); + stream_t *s=mp_mallocz(sizeof(stream_t)+len); if(s==NULL) return NULL; - memset(s,0,sizeof(stream_t)); s->fd=-1; s->type=STREAMTYPE_MEMORY; s->buf_pos=0; s->buf_len=len; @@ -236,10 +235,9 @@ } stream_t* __FASTCALL__ new_stream(int type){ - stream_t *s=mp_malloc(sizeof(stream_t)); + stream_t *s=mp_mallocz(sizeof(stream_t)); if(s==NULL) return NULL; - memset(s,0,sizeof(stream_t)); - + s->fd=-1; s->type=type; s->sector_size=STREAM_BUFFER_SIZE; Modified: mplayerxp/libmpdemux/sub_cc.c =================================================================== --- mplayerxp/libmpdemux/sub_cc.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/sub_cc.c 2012-10-30 17:46:02 UTC (rev 265) @@ -112,8 +112,7 @@ if(!bb->lines) {bb->lines++; cursor_pos=0;} if(bb->text[bb->lines - 1]==NULL) { - bb->text[bb->lines - 1]=mp_malloc(CC_MAX_LINE_LENGTH); - memset(bb->text[bb->lines - 1],0,CC_MAX_LINE_LENGTH); + bb->text[bb->lines - 1]=mp_mallocz(CC_MAX_LINE_LENGTH); cursor_pos=0; } Modified: mplayerxp/libmpdemux/sub_ty.c =================================================================== --- mplayerxp/libmpdemux/sub_ty.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/sub_ty.c 2012-10-30 17:46:02 UTC (rev 265) @@ -224,9 +224,9 @@ if ( CC_mode != CURRENT ) return 0; } - + // preamble address code (row & indent) - if ( b2 & 0x40 ) + if ( b2 & 0x40 ) { TY_CC_CUR_Y = CC_row[ ( ( b1 << 1 ) & 14 ) | ( ( b2 >> 5 ) & 1 ) ]; @@ -443,7 +443,7 @@ TY_CC_CUR_X = 1; TY_CC_CUR_Y = -1; - + TY_CC_ptr = TY_CC_buf; memset( TY_CC_buf, 0, sizeof( TY_CC_buf ) ); } Modified: mplayerxp/libmpdemux/tvi_dummy.c =================================================================== --- mplayerxp/libmpdemux/tvi_dummy.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/tvi_dummy.c 2012-10-30 17:46:02 UTC (rev 265) @@ -126,13 +126,12 @@ if (!h) return(NULL); - h->priv = (priv_t *)mp_malloc(sizeof(priv_t)); + h->priv = (priv_t *)mp_mallocz(sizeof(priv_t)); if (!h->priv) { mp_free(h); return(NULL); } - memset(h->priv, 0, sizeof(priv_t)); h->info = &info; h->functions = &functions; h->seq = 0; Modified: mplayerxp/libmpdemux/tvi_v4l.c =================================================================== --- mplayerxp/libmpdemux/tvi_v4l.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libmpdemux/tvi_v4l.c 2012-10-30 17:46:02 UTC (rev 265) @@ -224,10 +224,9 @@ priv->height = priv->capability.minheight; MSG_V( " Inputs: %d\n", priv->capability.channels); - priv->channels = (struct video_channel *)mp_malloc(sizeof(struct video_channel)*priv->capability.channels); + priv->channels = (struct video_channel *)mp_mallocz(sizeof(struct video_channel)*priv->capability.channels); if (!priv->channels) goto malloc_failed; - memset(priv->channels, 0, sizeof(struct video_channel)*priv->capability.channels); for (i = 0; i < priv->capability.channels; i++) { priv->channels[i].channel = i; @@ -334,11 +333,9 @@ priv->nbuf = priv->mbuf.frames; /* video buffers */ - priv->buf = (struct video_mmap *)mp_malloc(priv->nbuf * sizeof(struct video_mmap)); + priv->buf = (struct video_mmap *)mp_mallocz(priv->nbuf * sizeof(struct video_mmap)); if (!priv->buf) goto malloc_failed; - memset(priv->buf, 0, priv->nbuf * sizeof(struct video_mmap)); - /* audio init */ #if 1 priv->audio_fd = open(priv->audio_device, O_RDONLY); Modified: mplayerxp/libvo/font_load.c =================================================================== --- mplayerxp/libvo/font_load.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/font_load.c 2012-10-30 17:46:02 UTC (rev 265) @@ -53,8 +53,7 @@ int fontdb=-1; int version=0; -desc=mp_malloc(sizeof(font_desc_t));if(!desc) return NULL; -memset(desc,0,sizeof(font_desc_t)); +desc=mp_mallocz(sizeof(font_desc_t));if(!desc) return NULL; f=fopen(fname,"rt");if(!f){ MSG_ERR("font: can't open file: %s\n",fname); mp_free(desc); return NULL;} Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/sub.c 2012-10-30 17:46:02 UTC (rev 265) @@ -411,8 +411,7 @@ } mp_osd_obj_t* __FASTCALL__ new_osd_obj(int type){ - mp_osd_obj_t* osd=mp_malloc(sizeof(mp_osd_obj_t)); - memset(osd,0,sizeof(mp_osd_obj_t)); + mp_osd_obj_t* osd=mp_mallocz(sizeof(mp_osd_obj_t)); osd->next=vo_osd_list; vo_osd_list=osd; osd->type=type; Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/video_out.c 2012-10-30 17:46:02 UTC (rev 265) @@ -181,14 +181,12 @@ vo_conf.da_buffs=64; vo_conf.WinID=-1; - vo=mp_malloc(sizeof(vo_data_t)); - memset(vo,0,sizeof(vo_data_t)); + vo=mp_mallocz(sizeof(vo_data_t)); vo->window = None; vo->osd_progbar_type=-1; vo->osd_progbar_value=100; // 0..256 - vo->vo_priv=mp_malloc(sizeof(vo_priv_t)); - memset(vo->vo_priv,0,sizeof(vo_priv_t)); + vo->vo_priv=mp_mallocz(sizeof(vo_priv_t)); vo_priv_t* priv=(vo_priv_t*)vo->vo_priv; pthread_mutexattr_init(&attr); pthread_mutex_init(&priv->surfaces_mutex,&attr); Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vo_dga.c 2012-10-30 17:46:02 UTC (rev 265) @@ -752,9 +752,8 @@ MSG_V( "vo_dga: Unknown subdevice: %s\n",arg); return ENOSYS; } - vo->priv=mp_malloc(sizeof(priv_t)); + vo->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=(priv_t*)vo->priv; - memset(priv,0,sizeof(priv_t)); priv->num_buffers=1; return 0; } Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vo_fbdev.c 2012-10-30 17:46:02 UTC (rev 265) @@ -1111,9 +1111,8 @@ static uint32_t __FASTCALL__ preinit(vo_data_t*vo,const char *arg) { - vo->priv=mp_malloc(sizeof(priv_t)); + vo->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=(priv_t*)vo->priv; - memset(priv,0,sizeof(priv_t)); priv_conf.mode_cfgfile = "/etc/priv->modes"; priv->vt_doit = 1; priv->pre_init_err = 0; Modified: mplayerxp/libvo/vo_null.c =================================================================== --- mplayerxp/libvo/vo_null.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vo_null.c 2012-10-30 17:46:02 UTC (rev 265) @@ -184,9 +184,7 @@ MSG_ERR("vo_null: Unknown subdevice: %s\n",arg); return ENOSYS; } - vo->priv=mp_malloc(sizeof(priv_t)); - priv_t*priv=(priv_t*)vo->priv; - memset(priv,0,sizeof(priv_t)); + vo->priv=mp_mallocz(sizeof(priv_t)); return 0; } Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vo_opengl.c 2012-10-30 17:46:02 UTC (rev 265) @@ -332,9 +332,8 @@ static uint32_t __FASTCALL__ preinit(vo_data_t*vo,const char *arg) { - vo->priv=mp_malloc(sizeof(priv_t)); + vo->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=(priv_t*)vo->priv; - memset(priv,0,sizeof(priv_t)); priv->num_buffers=1; UNUSED(arg); if (!vo_x11_init(vo)) return -1; Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vo_sdl.c 2012-10-30 17:46:02 UTC (rev 265) @@ -1199,11 +1199,8 @@ static uint32_t __FASTCALL__ preinit(vo_data_t*vo,const char *arg) { - priv_t *priv = mp_malloc(sizeof(priv_t)); + priv_t *priv = mp_mallocz(sizeof(priv_t)); vo->priv=priv; - memset(priv,0,sizeof(priv_t)); - memset(priv->rgbsurface,0,sizeof(priv->rgbsurface)); - memset(priv->overlay,0,sizeof(priv->overlay)); priv->num_buffs = 1; priv->surface = NULL; if(arg) strcpy(sdl_subdevice,arg); Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vo_vesa.c 2012-10-30 17:46:02 UTC (rev 265) @@ -719,9 +719,8 @@ int pre_init_err = 0; MSG_DBG2("vo_vesa: preinit(%s) was called\n",arg); MSG_DBG3("vo_vesa: subdevice %s is being initialized\n",arg); - vo->priv=mp_malloc(sizeof(priv_t)); + vo->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=(priv_t*)vo->priv; - memset(priv,0,sizeof(priv_t)); priv->subdev_flags = 0xFFFFFFFEUL; if(arg) priv->subdev_flags = parseSubDevice(vo,arg); #ifdef CONFIG_VIDIX Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vo_x11.c 2012-10-30 17:46:02 UTC (rev 265) @@ -322,9 +322,8 @@ static uint32_t __FASTCALL__ preinit(vo_data_t*vo,const char *arg) { - vo->priv=mp_malloc(sizeof(priv_t)); + vo->priv=mp_mallocz(sizeof(priv_t)); priv_t* priv=(priv_t*)vo->priv; - memset(priv,0,sizeof(priv_t)); priv->num_buffers=1; if(arg) { Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vo_xv.c 2012-10-30 17:46:02 UTC (rev 265) @@ -563,9 +563,8 @@ static uint32_t __FASTCALL__ preinit(vo_data_t*vo,const char *arg) { - vo->priv=mp_malloc(sizeof(priv_t)); + vo->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=(priv_t*)vo->priv; - memset(priv,0,sizeof(priv_t)); priv->num_buffers=1; if(arg) { MSG_ERR("vo_xv: Unknown subdevice: %s\n",arg); Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vo_xvidix.c 2012-10-30 17:46:02 UTC (rev 265) @@ -397,9 +397,8 @@ static uint32_t __FASTCALL__ preinit(vo_data_t*vo,const char *arg) { - vo->priv=mp_malloc(sizeof(priv_t)); + vo->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=(priv_t*)vo->priv; - memset(priv,0,sizeof(priv_t)); if (arg) priv->name = mp_strdup(arg); else { Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/vosub_vidix.c 2012-10-30 17:46:02 UTC (rev 265) @@ -618,10 +618,8 @@ int err; static int reent=0; MSG_DBG2("vidix_preinit(%s) was called\n",drvname); - priv_t* priv=mp_malloc(sizeof(priv_t)); + priv_t* priv=mp_mallocz(sizeof(priv_t)); vo->priv3=priv; - memset(priv,0,sizeof(priv_t)); - memset(priv->bm_buffs,0,sizeof(priv->bm_buffs)); ALLOC_VIDIX_STRUCTS() if(vdlGetVersion() != VIDIX_VERSION) { MSG_FATAL("You have wrong version of VIDIX library\n"); Modified: mplayerxp/libvo/x11_common.c =================================================================== --- mplayerxp/libvo/x11_common.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/libvo/x11_common.c 2012-10-30 17:46:02 UTC (rev 265) @@ -271,9 +271,8 @@ if(vo->depthonscreen) return 1; // already called - vo->priv2=mp_malloc(sizeof(priv_t)); + vo->priv2=mp_mallocz(sizeof(priv_t)); priv_t*priv=(priv_t*)vo->priv2; - memset(priv,0,sizeof(priv_t)); priv->CompletionType=-1; XSetErrorHandler(x11_errorhandler); Modified: mplayerxp/loader/dmo/DMO_AudioDecoder.c =================================================================== --- mplayerxp/loader/dmo/DMO_AudioDecoder.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/loader/dmo/DMO_AudioDecoder.c 2012-10-30 17:46:02 UTC (rev 265) @@ -49,17 +49,17 @@ #ifdef HAVE_WIN32LOADER Setup_LDT_Keeper(); Setup_FS_Segment(); -#endif +#endif this = mp_malloc(sizeof(DMO_AudioDecoder)); - + this->m_iFlushed=1; - + sz = 18 + wf->cbSize; this->m_sVhdr = mp_malloc(sz); memcpy(this->m_sVhdr, wf, sz); this->m_sVhdr2 = mp_malloc(18); memcpy(this->m_sVhdr2, this->m_sVhdr, 18); - + pWF = (WAVEFORMATEX*)this->m_sVhdr2; pWF->wFormatTag = 1; pWF->wBitsPerSample = 16; @@ -67,7 +67,7 @@ pWF->nBlockAlign = 2*pWF->nChannels; //pWF->nChannels * (pWF->wBitsPerSample + 7) / 8; pWF->nAvgBytesPerSec = pWF->nBlockAlign * pWF->nSamplesPerSec; pWF->cbSize = 0; - + memset(&this->m_sOurType, 0, sizeof(this->m_sOurType)); this->m_sOurType.majortype=MEDIATYPE_Audio; this->m_sOurType.subtype=MEDIASUBTYPE_PCM; Modified: mplayerxp/loader/dmo/DMO_VideoDecoder.c =================================================================== --- mplayerxp/loader/dmo/DMO_VideoDecoder.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/loader/dmo/DMO_VideoDecoder.c 2012-10-30 17:46:02 UTC (rev 265) @@ -99,10 +99,9 @@ DMO_VideoDecoder *this; HRESULT result; ct* c; - - this = mp_malloc(sizeof(DMO_VideoDecoder)); - memset( this, 0, sizeof(DMO_VideoDecoder)); - + + this = mp_mallocz(sizeof(DMO_VideoDecoder)); + this->m_sVhdr2 = 0; this->m_iLastQuality = -1; this->m_iMaxAuto = maxauto; Modified: mplayerxp/loader/dmo/dmo.c =================================================================== --- mplayerxp/loader/dmo/dmo.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/loader/dmo/dmo.c 2012-10-30 17:46:02 UTC (rev 265) @@ -32,11 +32,10 @@ { HRESULT hr = 0; const char* em = NULL; - DMO_Filter* This = (DMO_Filter*) mp_malloc(sizeof(DMO_Filter)); + DMO_Filter* This = (DMO_Filter*) mp_mallocz(sizeof(DMO_Filter)); if (!This) return NULL; - memset(This, 0, sizeof(DMO_Filter)); #ifdef HAVE_WIN32LOADER CodecAlloc(); #endif Modified: mplayerxp/loader/driver.c =================================================================== --- mplayerxp/loader/driver.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/loader/driver.c 2012-10-30 17:46:02 UTC (rev 265) @@ -162,10 +162,9 @@ printf("Loading codec DLL: '%s'\n",filename); #endif - hDriver = (NPDRVR) mp_malloc(sizeof(DRVR)); + hDriver = (NPDRVR) mp_mallocz(sizeof(DRVR)); if (!hDriver) return ((HDRVR) 0); - memset((any_t*)hDriver, 0, sizeof(DRVR)); #ifdef HAVE_WIN32LOADER CodecAlloc(); Modified: mplayerxp/loader/dshow/DS_VideoDecoder.c =================================================================== --- mplayerxp/loader/dshow/DS_VideoDecoder.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/loader/dshow/DS_VideoDecoder.c 2012-10-30 17:46:02 UTC (rev 265) @@ -96,10 +96,9 @@ DS_VideoDecoder *this; HRESULT result; ct* c; - - this = mp_malloc(sizeof(DS_VideoDecoder)); - memset( this, 0, sizeof(DS_VideoDecoder)); - + + this = mp_mallocz(sizeof(DS_VideoDecoder)); + this->m_sVhdr2 = 0; this->m_iLastQuality = -1; this->m_iMaxAuto = maxauto; Modified: mplayerxp/loader/dshow/inputpin.c =================================================================== --- mplayerxp/loader/dshow/inputpin.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/loader/dshow/inputpin.c 2012-10-30 17:46:02 UTC (rev 265) @@ -1214,7 +1214,7 @@ This->refcount = 1; This->pin = (IPin*) CRemotePin2Create(This); - This->vt = (IBaseFilter_vt*) mp_malloc(sizeof(IBaseFilter_vt)); + This->vt = (IBaseFilter_vt*) mp_mallocz(sizeof(IBaseFilter_vt)); if (!This->pin || !This->vt) { @@ -1222,7 +1222,6 @@ return NULL; } - memset(This->vt, 0, sizeof(IBaseFilter_vt)); This->vt->QueryInterface = CBaseFilter2_QueryInterface; This->vt->AddRef = CBaseFilter2_AddRef; This->vt->Release = CBaseFilter2_Release; @@ -1377,7 +1376,7 @@ This->remote_pin = rpin; This->refcount = 1; - This->vt = (IPin_vt*) mp_malloc(sizeof(IPin_vt)); + This->vt = (IPin_vt*) mp_mallocz(sizeof(IPin_vt)); if (!This->vt) { @@ -1385,7 +1384,6 @@ return NULL; } - memset(This->vt, 0, sizeof(IPin_vt)); This->vt->QueryInterface = CRemotePin_QueryInterface; This->vt->AddRef = CRemotePin_AddRef; This->vt->Release = CRemotePin_Release; @@ -1466,7 +1464,7 @@ This->parent = p; This->refcount = 1; - This->vt = (IPin_vt*) mp_malloc(sizeof(IPin_vt)); + This->vt = (IPin_vt*) mp_mallocz(sizeof(IPin_vt)); if (!This->vt) { @@ -1474,7 +1472,6 @@ return NULL; } - memset(This->vt, 0, sizeof(IPin_vt)); This->vt->QueryInterface = CRemotePin2_QueryInterface; This->vt->AddRef = CRemotePin2_AddRef; This->vt->Release = CRemotePin2_Release; Modified: mplayerxp/loader/module.c =================================================================== --- mplayerxp/loader/module.c 2012-10-30 16:47:49 UTC (rev 264) +++ mplayerxp/loader/module.c 2012-10-30 17:46:02 UTC (rev 265) @@ -830,8 +830,7 @@ // memory management: case 0x150011: //NewPtrClear case 0x150012: //NewPtrSysClear - reg->eax=(uint32_t)mp_malloc(((uint32_t *)stack_base)[1]); - memset((any_t*)reg->eax,0,((uint32_t *)stack_base)[1]); + reg->eax=(uint32_t)mp_mallocz(((uint32... [truncated message content] |
From: <nic...@us...> - 2012-10-31 14:00:36
|
Revision: 266 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=266&view=rev Author: nickols_k Date: 2012-10-31 14:00:16 +0000 (Wed, 31 Oct 2012) Log Message: ----------- use enums instead of #define where it's possible Modified Paths: -------------- mplayerxp/dump.c mplayerxp/fifo.h mplayerxp/input/in_msg.h mplayerxp/input/input.h mplayerxp/input/joystick.h mplayerxp/input/mouse.h mplayerxp/libao2/ao_msg.h mplayerxp/libao2/ao_null.c mplayerxp/libao2/audio_out.h mplayerxp/libmpcodecs/ad.c mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/ad_msg.h mplayerxp/libmpcodecs/codecs_ld.c mplayerxp/libmpcodecs/liba52/a52.h mplayerxp/libmpcodecs/liba52/a52_internal.h mplayerxp/libmpcodecs/libdca/dca.h mplayerxp/libmpcodecs/libdca/dca_internal.h mplayerxp/libmpcodecs/libdca/resample.c mplayerxp/libmpcodecs/libnuppelvideo/lzoconf.h mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_msg.h mplayerxp/libmpconf/cfgparser.c mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpconf/codec-cfg.c mplayerxp/libmpconf/codec-cfg.h mplayerxp/libmpconf/m_option.c mplayerxp/libmpconf/m_option.h mplayerxp/libmpconf/m_property.c mplayerxp/libmpconf/m_property.h mplayerxp/libmpconf/m_struct.c mplayerxp/libmpconf/m_struct.h mplayerxp/libmpconf/subopt-helper.c mplayerxp/libmpconf/subopt-helper.h mplayerxp/libmpdemux/asf.h mplayerxp/libmpdemux/demux_aiff.c mplayerxp/libmpdemux/demux_bmp.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_msg.h mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/demuxer_r.h mplayerxp/libmpdemux/freesdp/priv.h mplayerxp/libmpdemux/frequencies.h mplayerxp/libmpdemux/genres.h mplayerxp/libmpdemux/librtsp/rtsp.h mplayerxp/libmpdemux/matroska.h mplayerxp/libmpdemux/mpxpav64.h mplayerxp/libmpdemux/mrl.h mplayerxp/libmpdemux/muxer.h mplayerxp/libmpdemux/parse_es.h mplayerxp/libmpdemux/parse_mp4.h mplayerxp/libmpdemux/pnm.h mplayerxp/libmpdemux/realrtsp/rmff.h mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/s_oss.c mplayerxp/libmpdemux/stream.h mplayerxp/libmpdemux/tcp.h mplayerxp/libmpdemux/tv.h mplayerxp/libmpdemux/yuv4mpeg.h mplayerxp/libmpsub/find_sub.c mplayerxp/libmpsub/spudec.c mplayerxp/libmpsub/subreader.c mplayerxp/libmpsub/subreader.h mplayerxp/libmpsub/vobsub.c mplayerxp/libplaytree/asxparser.c mplayerxp/libplaytree/asxparser.h mplayerxp/libplaytree/playtree.c mplayerxp/libplaytree/playtree.h mplayerxp/libplaytree/playtreeparser.c mplayerxp/libvo/aspect.h mplayerxp/libvo/dri_vo.h mplayerxp/libvo/img_format.h mplayerxp/libvo/sub.c mplayerxp/libvo/sub.h mplayerxp/libvo/video_out.h mplayerxp/libvo/videodev_mjpeg.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_msg.h mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/wskeys.h mplayerxp/mixer.h mplayerxp/mp_image.c mplayerxp/mp_image.h mplayerxp/mp_msg.c mplayerxp/mp_msg.h mplayerxp/mplayer.c mplayerxp/nls/help_mp-en.h mplayerxp/nls/help_mp-ru.h mplayerxp/nls/nls_msg.h mplayerxp/osdep/aclib.c mplayerxp/osdep/bswap.h mplayerxp/osdep/cpudetect.c mplayerxp/osdep/cpudetect.h mplayerxp/osdep/cputable.h mplayerxp/osdep/keycodes.h mplayerxp/osdep/mm_accel.h mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h mplayerxp/osdep/osdep_msg.h mplayerxp/osdep/vbelib.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_control.h mplayerxp/postproc/af_delay.c mplayerxp/postproc/af_dummy.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_format.h mplayerxp/postproc/af_hrtf.c mplayerxp/postproc/af_hrtf.h mplayerxp/postproc/af_lp.c mplayerxp/postproc/af_mp.c mplayerxp/postproc/af_mp.h mplayerxp/postproc/af_pan.c mplayerxp/postproc/af_raw.c mplayerxp/postproc/af_resample.c mplayerxp/postproc/af_resample.h 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/dsp.h mplayerxp/postproc/libmenu/menu.h mplayerxp/postproc/libmenu/menu_list.h mplayerxp/postproc/mpc_info.h mplayerxp/postproc/postprocess.c mplayerxp/postproc/pp_msg.h mplayerxp/postproc/swscale.c mplayerxp/postproc/swscale.h mplayerxp/postproc/vf.h mplayerxp/postproc/vfcap.h mplayerxp/sig_hand.c mplayerxp/sig_hand.h mplayerxp/xmp_core.c mplayerxp/xmp_core.h Added Paths: ----------- mplayerxp/xmp_enums.h Removed Paths: ------------- mplayerxp/__mp_msg.h Deleted: mplayerxp/__mp_msg.h =================================================================== --- mplayerxp/__mp_msg.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/__mp_msg.h 2012-10-31 14:00:16 UTC (rev 266) @@ -1,29 +0,0 @@ -#ifndef __MP_MSG_H -#define __MP_MSG_H -#include "./mp_msg.h" -#undef MSG_INFO -#undef MSG_FATAL -#undef MSG_WARN -#undef MSG_ERR -#undef MSG_V -#undef MSG_OK -#undef MSG_DBG2 -#undef MSG_DBG3 -#undef MSG_HINT -#undef MSG_STATUS -#define MSG_INFO(args...) mp_msg(MSGT_CLASS,MSGL_INFO,__FILE__,__LINE__,##args ) -#define MSG_FATAL(args...) mp_msg(MSGT_CLASS,MSGL_FATAL,__FILE__,__LINE__,##args ) -#define MSG_WARN(args...) mp_msg(MSGT_CLASS,MSGL_WARN,__FILE__,__LINE__,##args ) -#define MSG_ERR(args...) mp_msg(MSGT_CLASS,MSGL_ERR,__FILE__,__LINE__,##args ) -#define MSG_V(args...) mp_msg(MSGT_CLASS,MSGL_V,__FILE__,__LINE__,##args ) -#define MSG_OK(args...) mp_msg(MSGT_CLASS,MSGL_OK,__FILE__,__LINE__,##args ) -#define MSG_HINT(args...) mp_msg(MSGT_CLASS,MSGL_HINT,__FILE__,__LINE__,##args ) -#define MSG_STATUS(args...) mp_msg(MSGT_CLASS,MSGL_STATUS,__FILE__,__LINE__,##args ) -#ifdef MP_DEBUG -#define MSG_DBG2(args...) mp_msg(MSGT_CLASS,MSGL_DBG2,__FILE__,__LINE__,##args ) -#define MSG_DBG3(args...) mp_msg(MSGT_CLASS,MSGL_DBG3,__FILE__,__LINE__,##args ) -#else -#define MSG_DBG2(args...) -#define MSG_DBG3(args...) -#endif -#endif Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/dump.c 2012-10-31 14:00:16 UTC (rev 266) @@ -18,7 +18,7 @@ #include "libmpdemux/mrl.h" #include "osdep/mplib.h" #define MSGT_CLASS MSGT_GLOBAL -#include "__mp_msg.h" +#include "mp_msg.h" static char *media=NULL,*port=NULL; Modified: mplayerxp/fifo.h =================================================================== --- mplayerxp/fifo.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/fifo.h 2012-10-31 14:00:16 UTC (rev 266) @@ -6,7 +6,7 @@ #ifndef MSGT_CLASS #define MSGT_CLASS MSGT_GLOBAL #endif -#include "__mp_msg.h" +#include "mp_msg.h" #include <stdint.h> #include <stddef.h> Modified: mplayerxp/input/in_msg.h =================================================================== --- mplayerxp/input/in_msg.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/input/in_msg.h 2012-10-31 14:00:16 UTC (rev 266) @@ -1,28 +1,7 @@ #ifndef IN_MSG_H #define IN_MSG_H -#include "../mp_msg.h" -#undef MSG_INFO -#undef MSG_FATAL -#undef MSG_WARN -#undef MSG_ERR -#undef MSG_V -#undef MSG_OK -#undef MSG_DBG2 -#undef MSG_DBG3 -#undef MSG_HINT -#define MSG_INFO(args...) mp_msg(MSGT_INPUT,MSGL_INFO,__FILE__,__LINE__, ##args ) -#define MSG_FATAL(args...) mp_msg(MSGT_INPUT,MSGL_FATAL,__FILE__,__LINE__, ##args ) -#define MSG_WARN(args...) mp_msg(MSGT_INPUT,MSGL_WARN,__FILE__,__LINE__, ##args ) -#define MSG_ERR(args...) mp_msg(MSGT_INPUT,MSGL_ERR,__FILE__,__LINE__, ##args ) -#define MSG_V(args...) mp_msg(MSGT_INPUT,MSGL_V,__FILE__,__LINE__, ##args ) -#define MSG_OK(args...) mp_msg(MSGT_INPUT,MSGL_OK,__FILE__,__LINE__, ##args ) -#define MSG_HINT(args...) mp_msg(MSGT_INPUT,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifdef MP_DEBUG -#define MSG_DBG2(args...) mp_msg(MSGT_INPUT,MSGL_DBG2,__FILE__,__LINE__, ##args ) -#define MSG_DBG3(args...) mp_msg(MSGT_INPUT,MSGL_DBG3,__FILE__,__LINE__, ##args ) -#else -#define MSG_DBG2(args...) -#define MSG_DBG3(args...) +#define MSGT_CLASS MSGT_INPUT +#include "mp_msg.h" + #endif -#endif Modified: mplayerxp/input/input.h =================================================================== --- mplayerxp/input/input.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/input/input.h 2012-10-31 14:00:16 UTC (rev 266) @@ -1,106 +1,108 @@ +#ifndef INPUT_H_INCLUDED +#define INPUT_H_ICLUDED 1 + // All commands id -#define MP_CMD_SEEK 0 -#define MP_CMD_RESERVED_0 1 -#define MP_CMD_QUIT 2 -#define MP_CMD_PAUSE 3 -#define MP_CMD_SOFT_QUIT 4 -#define MP_CMD_PLAY_TREE_STEP 5 -#define MP_CMD_PLAY_TREE_UP_STEP 6 -#define MP_CMD_PLAY_ALT_SRC_STEP 7 -#define MP_CMD_RESERVED_1 8 -#define MP_CMD_OSD 9 -#define MP_CMD_VOLUME 10 -#define MP_CMD_RESERVED_2 11 -#define MP_CMD_CONTRAST 12 -#define MP_CMD_BRIGHTNESS 13 -#define MP_CMD_HUE 14 -#define MP_CMD_SATURATION 15 -#define MP_CMD_FRAMEDROPPING 16 -#define MP_CMD_TV_STEP_CHANNEL 17 -#define MP_CMD_TV_STEP_NORM 18 -#define MP_CMD_TV_STEP_CHANNEL_LIST 19 -#define MP_CMD_VO_FULLSCREEN 20 -#define MP_CMD_SUB_POS 21 -#define MP_CMD_DVDNAV 22 -#define MP_CMD_VO_SCREENSHOT 23 -#define MP_CMD_PANSCAN 24 -#define MP_CMD_MUTE 25 -#define MP_CMD_LOADFILE 26 -#define MP_CMD_LOADLIST 27 -#define MP_CMD_VF_CHANGE_RECTANGLE 28 -#define MP_CMD_GAMMA 29 -#define MP_CMD_SUB_VISIBILITY 30 -#define MP_CMD_VOBSUB_LANG 31 -#define MP_CMD_MENU 32 -#define MP_CMD_SET_MENU 33 -#define MP_CMD_GET_TIME_LENGTH 34 -#define MP_CMD_GET_PERCENT_POS 35 -#define MP_CMD_SUB_STEP 36 -#define MP_CMD_TV_SET_CHANNEL 37 +enum { + MP_CMD_SEEK =0, + MP_CMD_RESERVED_0 =1, + MP_CMD_QUIT =2, + MP_CMD_PAUSE =3, + MP_CMD_SOFT_QUIT =4, + MP_CMD_PLAY_TREE_STEP =5, + MP_CMD_PLAY_TREE_UP_STEP =6, + MP_CMD_PLAY_ALT_SRC_STEP =7, + MP_CMD_RESERVED_1 =8, + MP_CMD_OSD =9, + MP_CMD_VOLUME =10, + MP_CMD_RESERVED_2 =11, + MP_CMD_CONTRAST =12, + MP_CMD_BRIGHTNESS =13, + MP_CMD_HUE =14, + MP_CMD_SATURATION =15, + MP_CMD_FRAMEDROPPING =16, + MP_CMD_TV_STEP_CHANNEL =17, + MP_CMD_TV_STEP_NORM =18, + MP_CMD_TV_STEP_CHANNEL_LIST =19, + MP_CMD_VO_FULLSCREEN =20, + MP_CMD_SUB_POS =21, + MP_CMD_DVDNAV =22, + MP_CMD_VO_SCREENSHOT =23, + MP_CMD_PANSCAN =24, + MP_CMD_MUTE =25, + MP_CMD_LOADFILE =26, + MP_CMD_LOADLIST =27, + MP_CMD_VF_CHANGE_RECTANGLE =28, + MP_CMD_GAMMA =29, + MP_CMD_SUB_VISIBILITY =30, + MP_CMD_VOBSUB_LANG =31, + MP_CMD_MENU =32, + MP_CMD_SET_MENU =33, + MP_CMD_GET_TIME_LENGTH =34, + MP_CMD_GET_PERCENT_POS =35, + MP_CMD_SUB_STEP =36, + MP_CMD_TV_SET_CHANNEL =37, #ifdef USE_EDL -#define MP_CMD_EDL_MARK 38 + MP_CMD_EDL_MARK =38, #endif -#define MP_CMD_SUB_ALIGNMENT 39 -#define MP_CMD_TV_LAST_CHANNEL 40 -#define MP_CMD_OSD_SHOW_TEXT 41 -#define MP_CMD_TV_STEP_CHANNEL_UP 42 -#define MP_CMD_TV_STEP_CHANNEL_DOWN 43 + MP_CMD_SUB_ALIGNMENT =39, + MP_CMD_TV_LAST_CHANNEL =40, + MP_CMD_OSD_SHOW_TEXT =41, + MP_CMD_TV_STEP_CHANNEL_UP =42, + MP_CMD_TV_STEP_CHANNEL_DOWN =43, -#define MP_CMD_SPEED_INCR 44 -#define MP_CMD_SPEED_MULT 45 -#define MP_CMD_SPEED_SET 46 + MP_CMD_SPEED_INCR =44, + MP_CMD_SPEED_MULT =45, + MP_CMD_SPEED_SET =46, -#define MP_CMD_SWITCH_AUDIO 47 -#define MP_CMD_SWITCH_VIDEO 48 -#define MP_CMD_SWITCH_SUB 49 + MP_CMD_SWITCH_AUDIO =47, + MP_CMD_SWITCH_VIDEO =48, + MP_CMD_SWITCH_SUB =49, -#define MP_CMD_FRAME_STEP 56 + MP_CMD_FRAME_STEP =56, -#define MP_CMD_DVDNAV_EVENT 6000 - -#define MP_CMD_DVDNAV_UP 1 -#define MP_CMD_DVDNAV_DOWN 2 -#define MP_CMD_DVDNAV_LEFT 3 -#define MP_CMD_DVDNAV_RIGHT 4 -#define MP_CMD_DVDNAV_MENU 5 -#define MP_CMD_DVDNAV_SELECT 6 - + MP_CMD_DVDNAV_EVENT =6000, /// Console command -#define MP_CMD_CHELP 7000 -#define MP_CMD_CEXIT 7001 -#define MP_CMD_CHIDE 7002 -#define MP_CMD_CRUN 7003 + MP_CMD_CHELP =7000, + MP_CMD_CEXIT =7001, + MP_CMD_CHIDE =7002, + MP_CMD_CRUN =7003 +}; +enum { + MP_CMD_DVDNAV_UP =1, + MP_CMD_DVDNAV_DOWN =2, + MP_CMD_DVDNAV_LEFT =3, + MP_CMD_DVDNAV_RIGHT =4, + MP_CMD_DVDNAV_MENU =5, + MP_CMD_DVDNAV_SELECT=6, +}; +enum { // The args types -#define MP_CMD_ARG_INT 0 -#define MP_CMD_ARG_FLOAT 1 -#define MP_CMD_ARG_STRING 2 -#define MP_CMD_ARG_VOID 3 + MP_CMD_ARG_INT =0, + MP_CMD_ARG_FLOAT =1, + MP_CMD_ARG_STRING =2, + MP_CMD_ARG_VOID =3, #ifndef MP_CMD_MAX_ARGS -#define MP_CMD_MAX_ARGS 10 + MP_CMD_MAX_ARGS =10 #endif - +}; // Error codes for the drivers -// An error occured but we can continue -#define MP_INPUT_ERROR -1 -// A fatal error occured, this driver should be removed -#define MP_INPUT_DEAD -2 -// No input were avaible -#define MP_INPUT_NOTHING -3 - +enum { + MP_INPUT_ERROR =-1,// An error occured but we can continue + MP_INPUT_DEAD =-2,// A fatal error occured, this driver should be removed + MP_INPUT_NOTHING =-3 // No input were avaible +}; // For the keys drivers, if possible you can send key up and key down // events. Key up is the default, to send a key down you must or the key // code with MP_KEY_DOWN -#define MP_KEY_DOWN (1<<29) -// Use this when the key shouldn't be auto-repeated (like mouse buttons) -#define MP_NO_REPEAT_KEY (1<<28) +enum { + MP_KEY_DOWN =(1<<29), + MP_NO_REPEAT_KEY =(1<<28), // Use this when the key shouldn't be auto-repeated (like mouse buttons) + MP_MAX_KEY_DOWN =32 +}; -#ifndef MP_MAX_KEY_DOWN -#define MP_MAX_KEY_DOWN 32 -#endif - typedef union mp_cmd_arg_value { int i; float f; @@ -211,3 +213,4 @@ void mp_input_print_keys(void); void mp_input_print_cmds(void); void mp_input_print_binds(void); +#endif Modified: mplayerxp/input/joystick.h =================================================================== --- mplayerxp/input/joystick.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/input/joystick.h 2012-10-31 14:00:16 UTC (rev 266) @@ -1,39 +1,43 @@ +#ifndef JOYSTICK_H_INCLUDED +#define JOYSTICK_H_INCLUDED 1 -#define JOY_BASE (0x100+128) -#define JOY_AXIS0_PLUS (JOY_BASE+0) -#define JOY_AXIS0_MINUS (JOY_BASE+1) -#define JOY_AXIS1_PLUS (JOY_BASE+2) -#define JOY_AXIS1_MINUS (JOY_BASE+3) -#define JOY_AXIS2_PLUS (JOY_BASE+4) -#define JOY_AXIS2_MINUS (JOY_BASE+5) -#define JOY_AXIS3_PLUS (JOY_BASE+6) -#define JOY_AXIS3_MINUS (JOY_BASE+7) -#define JOY_AXIS4_PLUS (JOY_BASE+8) -#define JOY_AXIS4_MINUS (JOY_BASE+9) -#define JOY_AXIS5_PLUS (JOY_BASE+10) -#define JOY_AXIS5_MINUS (JOY_BASE+11) -#define JOY_AXIS6_PLUS (JOY_BASE+12) -#define JOY_AXIS6_MINUS (JOY_BASE+13) -#define JOY_AXIS7_PLUS (JOY_BASE+14) -#define JOY_AXIS7_MINUS (JOY_BASE+15) -#define JOY_AXIS8_PLUS (JOY_BASE+16) -#define JOY_AXIS8_MINUS (JOY_BASE+17) -#define JOY_AXIS9_PLUS (JOY_BASE+18) -#define JOY_AXIS9_MINUS (JOY_BASE+19) +enum { + JOY_BASE =(0x100+128), + JOY_AXIS0_PLUS =(JOY_BASE+0), + JOY_AXIS0_MINUS =(JOY_BASE+1), + JOY_AXIS1_PLUS =(JOY_BASE+2), + JOY_AXIS1_MINUS =(JOY_BASE+3), + JOY_AXIS2_PLUS =(JOY_BASE+4), + JOY_AXIS2_MINUS =(JOY_BASE+5), + JOY_AXIS3_PLUS =(JOY_BASE+6), + JOY_AXIS3_MINUS =(JOY_BASE+7), + JOY_AXIS4_PLUS =(JOY_BASE+8), + JOY_AXIS4_MINUS =(JOY_BASE+9), + JOY_AXIS5_PLUS =(JOY_BASE+10), + JOY_AXIS5_MINUS =(JOY_BASE+11), + JOY_AXIS6_PLUS =(JOY_BASE+12), + JOY_AXIS6_MINUS =(JOY_BASE+13), + JOY_AXIS7_PLUS =(JOY_BASE+14), + JOY_AXIS7_MINUS =(JOY_BASE+15), + JOY_AXIS8_PLUS =(JOY_BASE+16), + JOY_AXIS8_MINUS =(JOY_BASE+17), + JOY_AXIS9_PLUS =(JOY_BASE+18), + JOY_AXIS9_MINUS =(JOY_BASE+19) +}; +enum { + JOY_BTN_BASE=((0x100+148)|(1<<28)), + JOY_BTN0 =(JOY_BTN_BASE+0), + JOY_BTN1 =(JOY_BTN_BASE+1), + JOY_BTN2 =(JOY_BTN_BASE+2), + JOY_BTN3 =(JOY_BTN_BASE+3), + JOY_BTN4 =(JOY_BTN_BASE+4), + JOY_BTN5 =(JOY_BTN_BASE+5), + JOY_BTN6 =(JOY_BTN_BASE+6), + JOY_BTN7 =(JOY_BTN_BASE+7), + JOY_BTN8 =(JOY_BTN_BASE+8), + JOY_BTN9 =(JOY_BTN_BASE+9) +}; -#define JOY_BTN_BASE ((0x100+148)|MP_NO_REPEAT_KEY) -#define JOY_BTN0 (JOY_BTN_BASE+0) -#define JOY_BTN1 (JOY_BTN_BASE+1) -#define JOY_BTN2 (JOY_BTN_BASE+2) -#define JOY_BTN3 (JOY_BTN_BASE+3) -#define JOY_BTN4 (JOY_BTN_BASE+4) -#define JOY_BTN5 (JOY_BTN_BASE+5) -#define JOY_BTN6 (JOY_BTN_BASE+6) -#define JOY_BTN7 (JOY_BTN_BASE+7) -#define JOY_BTN8 (JOY_BTN_BASE+8) -#define JOY_BTN9 (JOY_BTN_BASE+9) - int mp_input_joystick_init(const char* dev); - int mp_input_joystick_read(int fd); - +#endif Modified: mplayerxp/input/mouse.h =================================================================== --- mplayerxp/input/mouse.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/input/mouse.h 2012-10-31 14:00:16 UTC (rev 266) @@ -1,25 +1,30 @@ +#ifndef MOUSE_H_INCLUDED +#define MOUSE_H_INCLUDED 1 - -#define MOUSE_BASE ((0x100+256)|MP_NO_REPEAT_KEY) -#define MOUSE_BTN0 (MOUSE_BASE+0) -#define MOUSE_BTN1 (MOUSE_BASE+1) -#define MOUSE_BTN2 (MOUSE_BASE+2) -#define MOUSE_BTN3 (MOUSE_BASE+3) -#define MOUSE_BTN4 (MOUSE_BASE+4) -#define MOUSE_BTN5 (MOUSE_BASE+5) -#define MOUSE_BTN6 (MOUSE_BASE+6) -#define MOUSE_BTN7 (MOUSE_BASE+7) -#define MOUSE_BTN8 (MOUSE_BASE+8) -#define MOUSE_BTN9 (MOUSE_BASE+9) - -#define MOUSE_BASE_DBL (0x300|MP_NO_REPEAT_KEY) -#define MOUSE_BTN0_DBL (MOUSE_BASE_DBL+0) -#define MOUSE_BTN1_DBL (MOUSE_BASE_DBL+1) -#define MOUSE_BTN2_DBL (MOUSE_BASE_DBL+2) -#define MOUSE_BTN3_DBL (MOUSE_BASE_DBL+3) -#define MOUSE_BTN4_DBL (MOUSE_BASE_DBL+4) -#define MOUSE_BTN5_DBL (MOUSE_BASE_DBL+5) -#define MOUSE_BTN6_DBL (MOUSE_BASE_DBL+6) -#define MOUSE_BTN7_DBL (MOUSE_BASE_DBL+7) -#define MOUSE_BTN8_DBL (MOUSE_BASE_DBL+8) -#define MOUSE_BTN9_DBL (MOUSE_BASE_DBL+9) +enum { + MOUSE_BASE=((0x100+256)|MP_NO_REPEAT_KEY), + MOUSE_BTN0=(MOUSE_BASE+0), + MOUSE_BTN1=(MOUSE_BASE+1), + MOUSE_BTN2=(MOUSE_BASE+2), + MOUSE_BTN3=(MOUSE_BASE+3), + MOUSE_BTN4=(MOUSE_BASE+4), + MOUSE_BTN5=(MOUSE_BASE+5), + MOUSE_BTN6=(MOUSE_BASE+6), + MOUSE_BTN7=(MOUSE_BASE+7), + MOUSE_BTN8=(MOUSE_BASE+8), + MOUSE_BTN9=(MOUSE_BASE+9) +}; +enum { + MOUSE_BASE_DBL=(0x300|MP_NO_REPEAT_KEY), + MOUSE_BTN0_DBL=(MOUSE_BASE_DBL+0), + MOUSE_BTN1_DBL=(MOUSE_BASE_DBL+1), + MOUSE_BTN2_DBL=(MOUSE_BASE_DBL+2), + MOUSE_BTN3_DBL=(MOUSE_BASE_DBL+3), + MOUSE_BTN4_DBL=(MOUSE_BASE_DBL+4), + MOUSE_BTN5_DBL=(MOUSE_BASE_DBL+5), + MOUSE_BTN6_DBL=(MOUSE_BASE_DBL+6), + MOUSE_BTN7_DBL=(MOUSE_BASE_DBL+7), + MOUSE_BTN8_DBL=(MOUSE_BASE_DBL+8), + MOUSE_BTN9_DBL=(MOUSE_BASE_DBL+9) +}; +#endif \ No newline at end of file Modified: mplayerxp/libao2/ao_msg.h =================================================================== --- mplayerxp/libao2/ao_msg.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libao2/ao_msg.h 2012-10-31 14:00:16 UTC (rev 266) @@ -1,28 +1,7 @@ #ifndef AO_MSG_H #define AO_MSG_H -#include "../mp_msg.h" -#undef MSG_INFO -#undef MSG_FATAL -#undef MSG_WARN -#undef MSG_ERR -#undef MSG_V -#undef MSG_OK -#undef MSG_DBG2 -#undef MSG_DBG3 -#undef MSG_HINT -#define MSG_INFO(args...) mp_msg(MSGT_AO,MSGL_INFO,__FILE__,__LINE__, ##args ) -#define MSG_FATAL(args...) mp_msg(MSGT_AO,MSGL_FATAL,__FILE__,__LINE__, ##args ) -#define MSG_WARN(args...) mp_msg(MSGT_AO,MSGL_WARN,__FILE__,__LINE__, ##args ) -#define MSG_ERR(args...) mp_msg(MSGT_AO,MSGL_ERR,__FILE__,__LINE__, ##args ) -#define MSG_V(args...) mp_msg(MSGT_AO,MSGL_V,__FILE__,__LINE__, ##args ) -#define MSG_OK(args...) mp_msg(MSGT_AO,MSGL_OK,__FILE__,__LINE__, ##args ) -#define MSG_HINT(args...) mp_msg(MSGT_AO,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifdef MP_DEBUG -#define MSG_DBG2(args...) mp_msg(MSGT_AO,MSGL_DBG2,__FILE__,__LINE__, ##args ) -#define MSG_DBG3(args...) mp_msg(MSGT_AO,MSGL_DBG3,__FILE__,__LINE__, ##args ) -#else -#define MSG_DBG2(args...) -#define MSG_DBG3(args...) +#define MSGT_CLASS MSGT_AO +#include "mp_msg.h" + #endif -#endif Modified: mplayerxp/libao2/ao_null.c =================================================================== --- mplayerxp/libao2/ao_null.c 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libao2/ao_null.c 2012-10-31 14:00:16 UTC (rev 266) @@ -34,11 +34,11 @@ int wav_mode; }priv_t; -#define WAV_ID_RIFF MAKE_FOURCC(0x46,0x46,0x49,0x52) /* "RIFF" */ -#define WAV_ID_WAVE MAKE_FOURCC(0x45,0x56,0x41,0x57) /* "WAVE" */ -#define WAV_ID_FMT MAKE_FOURCC(0x20,0x74,0x6d,0x66) /* "fmt " */ -#define WAV_ID_DATA MAKE_FOURCC(0x61,0x74,0x61,0x64) /* "data" */ -#define WAV_ID_PCM MAKE_TWOCC(0x00,0x01) +#define WAV_ID_RIFF FOURCC_TAG(0x46,0x46,0x49,0x52) /* "RIFF" */ +#define WAV_ID_WAVE FOURCC_TAG(0x45,0x56,0x41,0x57) /* "WAVE" */ +#define WAV_ID_FMT FOURCC_TAG(0x20,0x74,0x6d,0x66) /* "fmt " */ +#define WAV_ID_DATA FOURCC_TAG(0x61,0x74,0x61,0x64) /* "data" */ +#define WAV_ID_PCM TWOCC_TAG (0x00,0x01) struct WaveHeader { Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libao2/audio_out.h 2012-10-31 14:00:16 UTC (rev 266) @@ -1,6 +1,7 @@ #ifndef __AUDIO_OUT_H #define __AUDIO_OUT_H 1 -#include "../mp_config.h" +#include "mp_config.h" +#include "xmp_enums.h" /** Text description of AO-driver */ typedef struct ao_info_s { @@ -34,7 +35,7 @@ * @param arg argument associated with command * @return CONTROL_OK if success CONTROL_FALSE CONTROL_ERROR CONTROL_NA otherwise **/ - int (* __FASTCALL__ control)(ao_data_t*,int cmd,long arg); + ControlCodes (* __FASTCALL__ control)(ao_data_t*,int cmd,long arg); /** Preinitializes driver * @param flag currently unused @@ -80,21 +81,15 @@ extern const ao_functions_t* audio_out_drivers[]; /**< NULL terminated array of all drivers */ -#define CONTROL_OK 1 -#define CONTROL_TRUE 1 -#define CONTROL_FALSE 0 -#define CONTROL_UNKNOWN -1 -#define CONTROL_ERROR -2 -#define CONTROL_NA -3 - -#define AOCONTROL_SET_DEVICE 1 /**< Sets new audio device (example: /dev/dsp2) */ -#define AOCONTROL_GET_DEVICE 2 /**< Query current audio device (example: /dev/dsp) */ -#define AOCONTROL_QUERY_FORMAT 3 /**< Test for support of given format */ -#define AOCONTROL_QUERY_CHANNELS 4 /**< Test for support of a given number of channels */ -#define AOCONTROL_QUERY_RATE 5 /**< Test for support of given rate */ -#define AOCONTROL_GET_VOLUME 6 /**< Query volume level */ -#define AOCONTROL_SET_VOLUME 7 /**< Sets new volume level */ - +enum { + AOCONTROL_SET_DEVICE =1, /**< Sets new audio device (example: /dev/dsp2) */ + AOCONTROL_GET_DEVICE =2, /**< Query current audio device (example: /dev/dsp) */ + AOCONTROL_QUERY_FORMAT =3, /**< Test for support of given format */ + AOCONTROL_QUERY_CHANNELS =4, /**< Test for support of a given number of channels */ + AOCONTROL_QUERY_RATE =5, /**< Test for support of given rate */ + AOCONTROL_GET_VOLUME =6, /**< Query volume level */ + AOCONTROL_SET_VOLUME =7 /**< Sets new volume level */ +}; typedef struct ao_control_vol_s { float left; float right; Modified: mplayerxp/libmpcodecs/ad.c =================================================================== --- mplayerxp/libmpcodecs/ad.c 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/ad.c 2012-10-31 14:00:16 UTC (rev 266) @@ -12,6 +12,7 @@ #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" #include "ad.h" +#include "ad_msg.h" /* Missed vorbis, mad, dshow */ Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/ad.h 2012-10-31 14:00:16 UTC (rev 266) @@ -5,39 +5,31 @@ #define AD_H_INCLUDED 1 #include "libmpconf/cfgparser.h" +#include "xmp_enums.h" typedef struct ad_info_s { - /* driver description ("Autodesk FLI/FLC Animation decoder" */ - const char *descr; - /* driver name ("dshow") */ - const char *driver_name; - /* interface author/maintainer */ - const char *author; - /* URL of homepage */ - const char *url; + const char *descr; /* driver description ("Autodesk FLI/FLC Animation decoder" */ + const char *driver_name; /* driver name ("dshow") */ + const char *author; /* interface author/maintainer */ + const char *url; /* URL of homepage */ } ad_info_t; -#define CONTROL_OK 1 -#define CONTROL_TRUE 1 -#define CONTROL_FALSE 0 -#define CONTROL_UNKNOWN -1 -#define CONTROL_ERROR -2 -#define CONTROL_NA -3 +enum { + ADCTRL_RESYNC_STREAM=0, + ADCTRL_SKIP_FRAME =1 +}; -#define ADCTRL_RESYNC_STREAM 0 -#define ADCTRL_SKIP_FRAME 1 - /* interface of video decoder drivers */ typedef struct ad_functions_s { - const ad_info_t *info; - const config_t* options;/**< Optional: MPlayerXP's option related */ - int (*preinit)(sh_audio_t *); - int (*init)(sh_audio_t *sh); - void (*uninit)(sh_audio_t *sh); - int (*control)(sh_audio_t *sh,int cmd,any_t* arg, ...); - unsigned (*decode)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); + const ad_info_t *info; + const config_t* options;/**< Optional: MPlayerXP's option related */ + int (*preinit)(sh_audio_t *); + int (*init)(sh_audio_t *sh); + void (*uninit)(sh_audio_t *sh); + ControlCodes (*control)(sh_audio_t *sh,int cmd,any_t* arg, ...); + unsigned (*decode)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); } ad_functions_t; // NULL terminated array of all drivers Modified: mplayerxp/libmpcodecs/ad_msg.h =================================================================== --- mplayerxp/libmpcodecs/ad_msg.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/ad_msg.h 2012-10-31 14:00:16 UTC (rev 266) @@ -1,26 +1,7 @@ #ifndef AD_MSG_H #define AD_MSG_H 1 -#undef MSG_WARN -#undef MSG_HINT -#undef MSG_V -#undef MSG_INFO -#undef MSG_ERR -#undef MSG_FATAL -#undef MSG_DBG2 -#undef MSG_DBG3 -#undef MSG_OK -#define MSG_INFO(args...) mp_msg(MSGT_DECAUDIO,MSGL_INFO,__FILE__,__LINE__, ##args ) -#define MSG_FATAL(args...) mp_msg(MSGT_DECAUDIO,MSGL_FATAL,__FILE__,__LINE__, ##args ) -#define MSG_WARN(args...) mp_msg(MSGT_DECAUDIO,MSGL_WARN,__FILE__,__LINE__, ##args ) -#define MSG_ERR(args...) mp_msg(MSGT_DECAUDIO,MSGL_ERR,__FILE__,__LINE__, ##args ) -#define MSG_V(args...) mp_msg(MSGT_DECAUDIO,MSGL_V,__FILE__,__LINE__, ##args ) -#define MSG_OK(args...) mp_msg(MSGT_DECAUDIO,MSGL_OK,__FILE__,__LINE__, ##args ) -#define MSG_HINT(args...) mp_msg(MSGT_DECAUDIO,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifdef MP_DEBUG -#define MSG_DBG2(args...) mp_msg(MSGT_DECAUDIO,MSGL_DBG2,__FILE__,__LINE__, ##args ) -#define MSG_DBG3(args...) mp_msg(MSGT_DECAUDIO,MSGL_DBG3,__FILE__,__LINE__, ##args ) -#else -#define MSG_DBG2(args...) -#define MSG_DBG3(args...) + +#define MSGT_CLASS MSGT_DECAUDIO +#include "mp_msg.h" + #endif -#endif Modified: mplayerxp/libmpcodecs/codecs_ld.c =================================================================== --- mplayerxp/libmpcodecs/codecs_ld.c 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/codecs_ld.c 2012-10-31 14:00:16 UTC (rev 266) @@ -7,10 +7,10 @@ #include <string.h> #include <stdarg.h> #include "codecs_ld.h" -#include "../mp_config.h" -#include "../help_mp.h" +#include "mp_config.h" +#include "help_mp.h" #define MSGT_CLASS MSGT_GLOBAL -#include "../__mp_msg.h" +#include "mp_msg.h" any_t* ld_codec(const char *name,const char *url_hint) { Modified: mplayerxp/libmpcodecs/liba52/a52.h =================================================================== --- mplayerxp/libmpcodecs/liba52/a52.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/liba52/a52.h 2012-10-31 14:00:16 UTC (rev 266) @@ -34,22 +34,23 @@ typedef struct a52_state_s a52_state_t; -#define A52_CHANNEL 0 -#define A52_MONO 1 -#define A52_STEREO 2 -#define A52_3F 3 -#define A52_2F1R 4 -#define A52_3F1R 5 -#define A52_2F2R 6 -#define A52_3F2R 7 -#define A52_CHANNEL1 8 -#define A52_CHANNEL2 9 -#define A52_DOLBY 10 -#define A52_CHANNEL_MASK 15 +enum { + A52_CHANNEL =0, + A52_MONO =1, + A52_STEREO =2, + A52_3F =3, + A52_2F1R =4, + A52_3F1R =5, + A52_2F2R =6, + A52_3F2R =7, + A52_CHANNEL1=8, + A52_CHANNEL2=9, + A52_DOLBY =10, + A52_CHANNEL_MASK=15, + A52_LFE =16, + A52_ADJUST_LEVEL=32 +}; -#define A52_LFE 16 -#define A52_ADJUST_LEVEL 32 - a52_state_t * a52_init (uint32_t mm_accel); sample_t * a52_samples (a52_state_t * state); extern int a52_syncinfo (uint8_t * buf, int * flags, @@ -66,5 +67,4 @@ extern int (* a52_resample) (float * _f, int16_t * s16); extern int (* a52_resample32) (float * _f, float * s16); - #endif /* A52_H */ Modified: mplayerxp/libmpcodecs/liba52/a52_internal.h =================================================================== --- mplayerxp/libmpcodecs/liba52/a52_internal.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/liba52/a52_internal.h 2012-10-31 14:00:16 UTC (rev 266) @@ -93,16 +93,18 @@ #define LEVEL_45DB 0.5946035575013605 #define LEVEL_6DB 0.5 -#define EXP_REUSE (0) -#define EXP_D15 (1) -#define EXP_D25 (2) -#define EXP_D45 (3) - -#define DELTA_BIT_REUSE (0) -#define DELTA_BIT_NEW (1) -#define DELTA_BIT_NONE (2) -#define DELTA_BIT_RESERVED (3) - +enum { + EXP_REUSE =0, + EXP_D15 =1, + EXP_D25 =2, + EXP_D45 =3 +}; +enum { + DELTA_BIT_REUSE =0, + DELTA_BIT_NEW =1, + DELTA_BIT_NONE =2, + DELTA_BIT_RESERVED =3 +}; void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, int start, int end, int fastleak, int slowleak, expbap_t * expbap); Modified: mplayerxp/libmpcodecs/libdca/dca.h =================================================================== --- mplayerxp/libmpcodecs/libdca/dca.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/libdca/dca.h 2012-10-31 14:00:16 UTC (rev 266) @@ -24,14 +24,8 @@ #define DCA_H #include "mp_config.h" +#include "osdep/mm_accel.h" -/* x86 accelerations */ -#define MM_ACCEL_X86_MMX 0x80000000 -#define MM_ACCEL_X86_3DNOW 0x40000000 -#define MM_ACCEL_X86_MMXEXT 0x20000000 - -uint32_t mm_accel (void); - #if defined(LIBDTS_FIXED) typedef int32_t sample_t; typedef int32_t level_t; @@ -45,26 +39,28 @@ typedef struct dca_state_s dca_state_t; -#define DCA_MONO 0 -#define DCA_CHANNEL 1 -#define DCA_STEREO 2 -#define DCA_STEREO_SUMDIFF 3 -#define DCA_STEREO_TOTAL 4 -#define DCA_3F 5 -#define DCA_2F1R 6 -#define DCA_3F1R 7 -#define DCA_2F2R 8 -#define DCA_3F2R 9 -#define DCA_4F2R 10 +enum { + DCA_MONO =0, + DCA_CHANNEL =1, + DCA_STEREO =2, + DCA_STEREO_SUMDIFF=3, + DCA_STEREO_TOTAL=4, + DCA_3F =5, + DCA_2F1R =6, + DCA_3F1R =7, + DCA_2F2R =8, + DCA_3F2R =9, + DCA_4F2R =10, -#define DCA_DOLBY 101 /* FIXME */ + DCA_DOLBY =101, /* FIXME */ -#define DCA_CHANNEL_MAX DCA_3F2R /* We don't handle anything above that */ -#define DCA_CHANNEL_BITS 6 -#define DCA_CHANNEL_MASK 0x3F + DCA_CHANNEL_MAX=DCA_3F2R, /* We don't handle anything above that */ + DCA_CHANNEL_BITS=6, + DCA_CHANNEL_MASK=0x3F, -#define DCA_LFE 0x80 -#define DCA_ADJUST_LEVEL 0x100 + DCA_LFE =0x80, + DCA_ADJUST_LEVEL=0x100 +}; extern dca_state_t * dca_init (uint32_t mm_accel); extern int dca_syncinfo (dca_state_t *state, uint8_t * buf, int * flags, Modified: mplayerxp/libmpcodecs/libdca/dca_internal.h =================================================================== --- mplayerxp/libmpcodecs/libdca/dca_internal.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/libdca/dca_internal.h 2012-10-31 14:00:16 UTC (rev 266) @@ -24,13 +24,14 @@ extern uint32_t dca_accel; -#define DCA_SUBFRAMES_MAX (16) -#define DCA_PRIM_CHANNELS_MAX (5) -#define DCA_SUBBANDS (32) -#define DCA_ABITS_MAX (32) /* Should be 28 */ -#define DCA_SUBSUBFAMES_MAX (4) -#define DCA_LFE_MAX (3) - +enum { + DCA_SUBFRAMES_MAX =16, + DCA_PRIM_CHANNELS_MAX=5, + DCA_SUBBANDS =32, + DCA_ABITS_MAX =32, /* Should be 28 */ + DCA_SUBSUBFAMES_MAX =4, + DCA_LFE_MAX =3 +}; struct dca_state_s { /* Frame header */ Modified: mplayerxp/libmpcodecs/libdca/resample.c =================================================================== --- mplayerxp/libmpcodecs/libdca/resample.c 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/libdca/resample.c 2012-10-31 14:00:16 UTC (rev 266) @@ -22,11 +22,11 @@ #include "resample_mmx.c" #endif -any_t* dca_resample_init(dca_state_t * state,uint32_t mm_accel,int flags,int chans){ +any_t* dca_resample_init(dca_state_t * state,uint32_t _mm_accel,int flags,int chans){ any_t* tmp; #ifdef CAN_COMPILE_MMX - if(mm_accel&MM_ACCEL_X86_MMX){ + if(_mm_accel&MM_ACCEL_X86_MMX){ tmp=dca_resample_MMX(state,flags,chans); if(tmp){ if(dca_resample==NULL) fprintf(stderr, "Using MMX optimized resampler\n"); @@ -42,16 +42,16 @@ dca_resample=tmp; return tmp; } - + fprintf(stderr, "Unimplemented resampler for mode 0x%X -> %d channels conversion - Contact MPlayer developers!\n", flags, chans); return NULL; } -any_t* dca_resample_init_float(dca_state_t * state,uint32_t mm_accel,int flags,int chans){ +any_t* dca_resample_init_float(dca_state_t * state,uint32_t _mm_accel,int flags,int chans){ any_t* tmp; #if 0 //#if defined( ARCH_X86 ) || defined(ARCH_X86_64) - if(mm_accel&MM_ACCEL_X86_MMX){ + if(_mm_accel&MM_ACCEL_X86_MMX){ tmp=dca_resample_MMX(state,flags,chans); if(tmp){ if(dca_resample==NULL) fprintf(stderr, "Using MMX optimized resampler\n"); Modified: mplayerxp/libmpcodecs/libnuppelvideo/lzoconf.h =================================================================== --- mplayerxp/libmpcodecs/libnuppelvideo/lzoconf.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/libnuppelvideo/lzoconf.h 2012-10-31 14:00:16 UTC (rev 266) @@ -306,17 +306,18 @@ * values are errors, positive values will be used for special but * normal events. */ -#define LZO_E_OK 0 -#define LZO_E_ERROR (-1) -#define LZO_E_OUT_OF_MEMORY (-2) /* not used right now */ -#define LZO_E_NOT_COMPRESSIBLE (-3) /* not used right now */ -#define LZO_E_INPUT_OVERRUN (-4) -#define LZO_E_OUTPUT_OVERRUN (-5) -#define LZO_E_LOOKBEHIND_OVERRUN (-6) -#define LZO_E_EOF_NOT_FOUND (-7) -#define LZO_E_INPUT_NOT_CONSUMED (-8) +enum { + LZO_E_OK =0, + LZO_E_ERROR =-1, + LZO_E_OUT_OF_MEMORY =-2, /* not used right now */ + LZO_E_NOT_COMPRESSIBLE =-3, /* not used right now */ + LZO_E_INPUT_OVERRUN =-4, + LZO_E_OUTPUT_OVERRUN =-5, + LZO_E_LOOKBEHIND_OVERRUN =-6, + LZO_E_EOF_NOT_FOUND =-7, + LZO_E_INPUT_NOT_CONSUMED =-8 +}; - /* lzo_init() should be the first function you call. * Check the return code ! * Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/vd.h 2012-10-31 14:00:16 UTC (rev 266) @@ -2,46 +2,37 @@ #define VD_H_INCLUDED 1 #include "libmpconf/cfgparser.h" +#include "xmp_enums.h" typedef struct vd_info_s { - /* driver description ("Autodesk FLI/FLC Animation decoder" */ - const char *descr; - /* driver name ("dshow") */ - const char *driver_name; - /* interface author/maintainer */ - const char *author; - /* URL of homepage */ - const char *url; + const char *descr; /* driver description ("Autodesk FLI/FLC Animation decoder" */ + const char *driver_name; /* driver name ("dshow") */ + const char *author; /* interface author/maintainer */ + const char *url; /* URL of homepage */ } vd_info_t; /* interface of video decoder drivers */ typedef struct vd_functions_s { - const vd_info_t *info; - const config_t* options;/**< Optional: MPlayerXP's option related */ - int (*init)(sh_video_t *sh); - void (*uninit)(sh_video_t *sh); - int (*control)(sh_video_t *sh,int cmd,any_t* arg, ...); - mp_image_t* (*decode)(sh_video_t *sh,any_t* data,int len,int flags); + const vd_info_t *info; + const config_t* options;/**< Optional: MPlayerXP's option related */ + int (*init)(sh_video_t *sh); + void (*uninit)(sh_video_t *sh); + ControlCodes (*control)(sh_video_t *sh,int cmd,any_t* arg, ...); + mp_image_t* (*decode)(sh_video_t *sh,any_t* data,int len,int flags); } vd_functions_t; // NULL terminated array of all drivers extern const vd_functions_t* mpcodecs_vd_drivers[]; -#define CONTROL_OK 1 -#define CONTROL_TRUE 1 -#define CONTROL_FALSE 0 -#define CONTROL_UNKNOWN -1 -#define CONTROL_ERROR -2 -#define CONTROL_NA -3 - -#define VDCTRL_QUERY_FORMAT 3 /* test for availabilty of a format */ -#define VDCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */ -#define VDCTRL_SET_PP_LEVEL 5 /* set postprocessing level */ -#define VDCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ -#define VDCTRL_RESYNC_STREAM 7 /* resync video stream if needed */ - +enum { + VDCTRL_QUERY_FORMAT =3, /* test for availabilty of a format */ + VDCTRL_QUERY_MAX_PP_LEVEL =4, /* test for postprocessing support (max level) */ + VDCTRL_SET_PP_LEVEL =5, /* set postprocessing level */ + VDCTRL_SET_EQUALIZER =6, /* set color options (brightness,contrast etc) */ + VDCTRL_RESYNC_STREAM =7 /* resync video stream if needed */ +}; // callbacks: int mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune); mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,int w, int h); Modified: mplayerxp/libmpcodecs/vd_msg.h =================================================================== --- mplayerxp/libmpcodecs/vd_msg.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpcodecs/vd_msg.h 2012-10-31 14:00:16 UTC (rev 266) @@ -1,26 +1,7 @@ #ifndef VD_MSG_H #define VD_MSG_H 1 -#undef MSG_WARN -#undef MSG_HINT -#undef MSG_V -#undef MSG_INFO -#undef MSG_ERR -#undef MSG_FATAL -#undef MSG_DBG2 -#undef MSG_DBG3 -#undef MSG_OK -#define MSG_INFO(args...) mp_msg(MSGT_DECVIDEO,MSGL_INFO,__FILE__,__LINE__, ##args ) -#define MSG_FATAL(args...) mp_msg(MSGT_DECVIDEO,MSGL_FATAL,__FILE__,__LINE__, ##args ) -#define MSG_WARN(args...) mp_msg(MSGT_DECVIDEO,MSGL_WARN,__FILE__,__LINE__, ##args ) -#define MSG_ERR(args...) mp_msg(MSGT_DECVIDEO,MSGL_ERR,__FILE__,__LINE__, ##args ) -#define MSG_V(args...) mp_msg(MSGT_DECVIDEO,MSGL_V,__FILE__,__LINE__, ##args ) -#define MSG_OK(args...) mp_msg(MSGT_DECVIDEO,MSGL_OK,__FILE__,__LINE__, ##args ) -#define MSG_HINT(args...) mp_msg(MSGT_DECVIDEO,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifdef MP_DEBUG -#define MSG_DBG2(args...) mp_msg(MSGT_DECVIDEO,MSGL_DBG2,__FILE__,__LINE__, ##args ) -#define MSG_DBG3(args...) mp_msg(MSGT_DECVIDEO,MSGL_DBG3,__FILE__,__LINE__, ##args ) -#else -#define MSG_DBG2(args...) -#define MSG_DBG3(args...) + +#define MSGT_CLASS MSGT_DECVIDEO +#include "mp_msg.h" + #endif -#endif Modified: mplayerxp/libmpconf/cfgparser.c =================================================================== --- mplayerxp/libmpconf/cfgparser.c 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpconf/cfgparser.c 2012-10-31 14:00:16 UTC (rev 266) @@ -39,7 +39,7 @@ #include "cfgparser.h" #include "osdep/mplib.h" #define MSGT_CLASS MSGT_CFGPARSER -#include "__mp_msg.h" +#include "mp_msg.h" typedef int (*cfg_func_arg_param_t)(const config_t *,const char *,const char *); typedef int (*cfg_func_param_t)(const config_t *,const char *); Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpconf/cfgparser.h 2012-10-31 14:00:16 UTC (rev 266) @@ -6,32 +6,34 @@ #define __CONFIG_H /* config types */ -#define CONF_TYPE_FLAG 0 -#define CONF_TYPE_INT 1 -#define CONF_TYPE_FLOAT 2 -#define CONF_TYPE_STRING 3 -#define CONF_TYPE_PRINT 4 -#define CONF_TYPE_FUNC 5 -#define CONF_TYPE_FUNC_PARAM 6 -#define CONF_TYPE_FUNC_FULL 7 -#define CONF_TYPE_SUBCONFIG 8 - - -#define ERR_NOT_AN_OPTION -1 -#define ERR_MISSING_PARAM -2 -#define ERR_OUT_OF_RANGE -3 -#define ERR_FUNC_ERR -4 -#define ERR_NO_SUBCONF -5 - +enum { + CONF_TYPE_FLAG =0, + CONF_TYPE_INT =1, + CONF_TYPE_FLOAT =2, + CONF_TYPE_STRING =3, + CONF_TYPE_PRINT =4, + CONF_TYPE_FUNC =5, + CONF_TYPE_FUNC_PARAM=6, + CONF_TYPE_FUNC_FULL =7, + CONF_TYPE_SUBCONFIG =8 +}; +enum { + ERR_NOT_AN_OPTION =-1, + ERR_MISSING_PARAM =-2, + ERR_OUT_OF_RANGE =-3, + ERR_FUNC_ERR =-4, + ERR_NO_SUBCONF =-5 +}; /* config flags */ -#define CONF_MIN (1<<0) -#define CONF_MAX (1<<1) -#define CONF_RANGE (CONF_MIN|CONF_MAX) -#define CONF_NOCFG (1<<2) -#define CONF_NOCMD (1<<3) -#define CONF_GLOBAL (1<<4) -#define CONF_NOSAVE (1<<5) - +enum { + CONF_MIN =(1<<0), + CONF_MAX =(1<<1), + CONF_RANGE =(CONF_MIN|CONF_MAX), + CONF_NOCFG =(1<<2), + CONF_NOCMD =(1<<3), + CONF_GLOBAL =(1<<4), + CONF_NOSAVE =(1<<5) +}; typedef struct config config_t; typedef struct m_config m_config_t; typedef struct config_save config_save_t; @@ -41,37 +43,37 @@ typedef void (*cfg_default_func_t)(config_t *,const char*); struct config { - const char *name; - any_t* const p; - unsigned int type; - unsigned int flags; - float min,max; - const char *help; + const char *name; + any_t* const p; + unsigned int type; + unsigned int flags; + float min,max; + const char *help; }; struct m_config { - const config_t** opt_list; - config_save_t** config_stack; - any_t**dynamics; - unsigned dynasize; - int cs_level; - int parser_mode; /* COMMAND_LINE or CONFIG_FILE */ - int flags; - const char* sub_conf; // When we save a subconfig - play_tree_t* pt; // play tree we use for playlist option, etc - play_tree_t* last_entry; // last added entry - play_tree_t* last_parent; // if last_entry is NULL we must create child of this - int recursion_depth; + const config_t** opt_list; + config_save_t** config_stack; + any_t**dynamics; + unsigned dynasize; + int cs_level; + int parser_mode; /* COMMAND_LINE or CONFIG_FILE */ + int flags; + const char* sub_conf; // When we save a subconfig + play_tree_t* pt; // play tree we use for playlist option, etc + play_tree_t* last_entry; // last added entry + play_tree_t* last_parent; // if last_entry is NULL we must create child of this + int recursion_depth; }; struct config_save { - const config_t* opt; - union { - int as_int; - float as_float; - any_t* as_pointer; - } param; - char* opt_name; + const config_t* opt; + union { + int as_int; + float as_float; + any_t* as_pointer; + } param; + char* opt_name; }; /* parse_config_file returns: Modified: mplayerxp/libmpconf/codec-cfg.c =================================================================== --- mplayerxp/libmpconf/codec-cfg.c 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpconf/codec-cfg.c 2012-10-31 14:00:16 UTC (rev 266) @@ -24,9 +24,8 @@ #include "codec-cfg.h" #include "osdep/mplib.h" #define MSGT_CLASS MSGT_CODECCFG -#include "__mp_msg.h" +#include "mp_msg.h" - #define MAX_NR_TOKEN 16 #define MAX_LINE_LEN 1000 Modified: mplayerxp/libmpconf/codec-cfg.h =================================================================== --- mplayerxp/libmpconf/codec-cfg.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpconf/codec-cfg.h 2012-10-31 14:00:16 UTC (rev 266) @@ -3,26 +3,28 @@ #include <stdint.h> -#define CODECS_MAX_FOURCC 128 -#define CODECS_MAX_OUTFMT 16 -#define CODECS_MAX_INFMT 16 - +enum { + CODECS_MAX_FOURCC =128, + CODECS_MAX_OUTFMT =16, + CODECS_MAX_INFMT =16 +}; +enum { // Global flags: -#define CODECS_FLAG_SEEKABLE (1<<0) -#define CODECS_FLAG_SELECTED (1<<15) /* for internal use */ + CODECS_FLAG_SEEKABLE =(1<<0), + CODECS_FLAG_SELECTED =(1<<15), /* for internal use */ // Outfmt flags: -#define CODECS_FLAG_FLIP (1<<0) -#define CODECS_FLAG_NOFLIP (1<<1) -#define CODECS_FLAG_YUVHACK (1<<2) + CODECS_FLAG_FLIP =(1<<0), + CODECS_FLAG_NOFLIP =(1<<1), + CODECS_FLAG_YUVHACK =(1<<2), -#define CODECS_STATUS__MIN 0 -#define CODECS_STATUS_NOT_WORKING 0 -#define CODECS_STATUS_UNTESTED -1 -#define CODECS_STATUS_PROBLEMS 1 -#define CODECS_STATUS_WORKING 2 -#define CODECS_STATUS__MAX 2 - + CODECS_STATUS__MIN =0, + CODECS_STATUS_NOT_WORKING =0, + CODECS_STATUS_UNTESTED =-1, + CODECS_STATUS_PROBLEMS =1, + CODECS_STATUS_WORKING =2, + CODECS_STATUS__MAX =2 +}; #ifndef GUID_TYPE #define GUID_TYPE typedef struct { Modified: mplayerxp/libmpconf/m_option.c =================================================================== --- mplayerxp/libmpconf/m_option.c 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpconf/m_option.c 2012-10-31 14:00:16 UTC (rev 266) @@ -18,7 +18,7 @@ #include "libmpdemux/url.h" #include "osdep/mplib.h" #define MSGT_CLASS MSGT_CPLAYER -#include "__mp_msg.h" +#include "mp_msg.h" // Don't mp_free for 'production' atm #ifndef MP_DEBUG Modified: mplayerxp/libmpconf/m_option.h =================================================================== --- mplayerxp/libmpconf/m_option.h 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpconf/m_option.h 2012-10-31 14:00:16 UTC (rev 266) @@ -55,33 +55,28 @@ /// Callback used by m_option_type_func options. typedef int (*m_opt_func_t)(const m_option_t *); -#define END_AT_NONE 0 -#define END_AT_TIME 1 -#define END_AT_SIZE 2 +enum { + END_AT_NONE=0, + END_AT_TIME=1, + END_AT_SIZE=2 +}; typedef struct { - double pos; - int type; + double pos; + int type; } m_time_size_t; /// Extra definition needed for \ref m_option_type_obj_settings_list options. typedef struct { - /// Pointer to an array of pointer to some object type description struct. - any_t** list; - /// Offset of the object type name (char*) in the description struct. - any_t* name_off; - /// Offset of the object type info string (char*) in the description struct. - any_t* info_off; - /// \brief Offset of the object type parameter description (\ref m_struct_st) - /// in the description struct. - any_t* desc_off; + any_t** list; /// Pointer to an array of pointer to some object type description struct. + any_t* name_off; /// Offset of the object type name (char*) in the description struct. + any_t* info_off; /// Offset of the object type info string (char*) in the description struct. + any_t* desc_off; /// \brief Offset of the object type parameter description (\ref m_struct_st) in the description struct. } m_obj_list_t; /// The data type used by \ref m_option_type_obj_settings_list. typedef struct m_obj_settings { - /// Type of the object. - char* name; - /// NULL terminated array of parameter/value pairs. - char** attribs; + char* name; /// Type of the object. + char** attribs; /// NULL terminated array of parameter/value pairs. } m_obj_settings_t; /// A parser to set up a list of objects. @@ -93,14 +88,10 @@ /// Extra definition needed for \ref m_option_type_obj_presets options. typedef struct { - /// Description of the struct holding the presets. - struct m_struct_st* in_desc; - /// Description of the struct that should be set by the presets. - struct m_struct_st* out_desc; - /// Pointer to an array of structs defining the various presets. - any_t* presets; - /// Offset of the preset's name inside the in_struct. - any_t* name_off; + struct m_struct_st* in_desc; /// Description of the struct holding the presets. + struct m_struct_st* out_desc; /// Description of the struct that should be set by the presets. + any_t* presets; /// Pointer to an array of structs defining the various presets. + any_t* name_off; /// Offset of the preset's name inside the in_struct. } m_obj_presets_t; /// Set several fields in a struct at once. @@ -120,10 +111,8 @@ /// Extra definition needed for \ref m_option_type_obj_params options. typedef struct { - /// Field descriptions. - const struct m_struct_st* desc; - /// Field separator to use. - char separator; + const struct m_struct_st* desc; /// Field descriptions. + char separator; /// Field separator to use. } m_obj_params_t; /// Parse a set of parameters. @@ -134,8 +123,8 @@ extern const m_option_type_t m_option_type_obj_params; typedef struct { - int start; - int end; + int start; + int end; } m_span_t; /// Ready made settings to parse a \ref m_span_t with a start-end syntax. extern const m_obj_params_t m_span_params_def; @@ -169,17 +158,14 @@ /// Option type description struct m_option_type { - char* name; - /// Syntax description, etc - char* comments; - /// Size needed for the data. - unsigned int size; - /// See \ref OptionTypeFlags. - unsigned int flags; - + char* name; + char* comments; /// Syntax description, etc + unsigned int size; /// Size needed for the data. + unsigned int flags; /// See \ref OptionTypeFlags. + /// Parse the data from a string. /** It is the only required function, all others can be NULL. - * + * * \param opt The option that is parsed. * \param name The full option name. * \param param The parameter to parse. @@ -189,15 +175,15 @@ * \return On error a negative value is returned, on success the number of arguments * consumed. For details see \ref OptionParserReturn. */ - int (*parse)(const m_option_t* opt,const char *name, char *param, any_t* dst, int src); - + int (*parse)(const m_option_t* opt,const char *name, char *param, any_t* dst, int src); + /// Print back a value in string form. /** \param opt The option to print. * \param val Pointer to the memory holding the data to be printed. * \return An allocated string containing the text value or (any_t*)-1 * on error. */ - char* (*print)(const m_option_t* opt, any_t* val); + char* (*print)(const m_option_t* opt, any_t* val); /** \name * These functions are called to save/set/restore the status of the @@ -212,21 +198,21 @@ * \param dst Pointer to the destination memory. * \param src Pointer to the source memory. */ - void (*save)(const m_option_t* opt,any_t* dst, any_t* src); - + void (*save)(const m_option_t* opt,any_t* dst, any_t* src); + /// Set the value in the program (dst) from a save slot. /** \param opt The option to copy. * \param dst Pointer to the destination memory. * \param src Pointer to the source memory. */ - void (*set)(const m_option_t* opt,any_t* dst, any_t* src); + void (*set)(const m_option_t* opt,any_t* dst, any_t* src); /// Copy the data between two save slots. If NULL and size is > 0 a memcpy will be used. /** \param opt The option to copy. * \param dst Pointer to the destination memory. * \param src Pointer to the source memory. */ - void (*copy)(const m_option_t* opt,any_t* dst, any_t* src); + void (*copy)(const m_option_t* opt,any_t* dst, any_t* src); //@} /// Free the data allocated for a save slot. @@ -234,7 +220,7 @@ * \param dst Pointer to the data, usually a pointer that should be freed and * set to NULL. */ - void (*mp_free)(any_t* dst); + void (*mp_free)(any_t* dst); }; ///@} @@ -243,93 +229,49 @@ /** \ingroup Options */ struct m_option { - /// Option name. - const char *name; - - /// Reserved for higher level APIs, it shouldn't be used by parsers. + const char *name; /// Option name. /** The suboption parser and func types do use it. They should instead * use the priv field but this was inherited from older versions of the * config code. */ - any_t*p; - - /// Option type. - const m_option_type_t* type; - - /// See \ref OptionFlags. - unsigned int flags; - - /// \brief Mostly useful for numeric types, the \ref M_OPT_MIN flags must - /// also be set. - double min; - - /// \brief Mostly useful for numeric types, the \ref M_OPT_MAX flags must - /// also be set. - double max; - - /// Type dependent data (for all kinds of extended settings). + any_t*p; /// Reserved for higher level APIs, it shouldn't be used by parsers. + const m_option_type_t* type; /// Option type. + unsigned int flags; /// See \ref OptionFlags. + double min; /// \brief Mostly useful for numeric types, the \ref M_OPT_MIN flags must also be set. + double max; /// \brief Mostly useful for numeric types, the \ref M_OPT_MAX flags must also be set. /** This used to be a function pointer to hold a 'reverse to defaults' func. * Now it can be used to pass any type of extra args needed by the parser. * Passing a 'default func' is still valid for all func based option types. */ - any_t* priv; + any_t* priv; /// Type dependent data (for all kinds of extended settings). }; /// \defgroup OptionFlags Option flags ///@{ - -/// The option has a minimum set in \ref m_option::min. -#define M_OPT_MIN (1<<0) - -/// The option has a maximum set in \ref m_option::max. -#define M_OPT_MAX (1<<1) - -/// The option has a minimum and maximum in \ref m_option::min and \ref m_option::max. -#define M_OPT_RANGE (M_OPT_MIN|M_OPT_MAX) - -/// The option is forbidden in config files. -#define M_OPT_NOCFG (1<<2) - -/// The option is forbidden on the command line. -#define M_OPT_NOCMD (1<<3) - +enum { + M_OPT_MIN =(1<<0), /// The option has a minimum set in \ref m_option::min. + M_OPT_MAX =(1<<1), /// The option has a maximum set in \ref m_option::max. + M_OPT_RANGE =(M_OPT_MIN|M_OPT_MAX), /// The option has a minimum and maximum in \ref m_option::min and \ref m_option::max. + M_OPT_NOCFG =(1<<2), /// The option is forbidden in config files. + M_OPT_NOCMD =(1<<3), /// The option is forbidden on the command line. /// The option is global in the \ref Config. /** It won't be saved on push and the command line parser will set it when * it's parsed (i.e. it won't be set later) * e.g options : -v, -quiet */ -#define M_OPT_GLOBAL (1<<4) - + M_OPT_GLOBAL =(1<<4), /// The \ref Config won't save this option on push. /** It won't be saved on push but the command line parser will add it with * its entry (i.e. it may be set later) * e.g options : -include */ -#define M_OPT_NOSAVE (1<<5) + M_OPT_NOSAVE =(1<<5), + M_OPT_OLD =(1<<6) /// \brief The \ref Config will emulate the old behavior by pushing the option only if it was set by the user. -/// \brief The \ref Config will emulate the old behavior by pushing the -/// option only if it was set by the user. -#define M_OPT_OLD (1<<6) - -/// \defgroup OldOptionFlags Backward compatibility -/// -/// These are kept for compatibility with older code. -/// @{ -#if 0 -#define CONF_MIN M_OPT_MIN -#define CONF_MAX M_OPT_MAX -#define CONF_RANGE M_OPT_RANGE -#define CONF_NOCFG M_OPT_NOCFG -#define CONF_NOCMD M_OPT_NOCMD -#define CONF_GLOBAL M_OPT_GLOBAL -#define CONF_NOSAVE M_OPT_NOSAVE -#define CONF_OLD M_OPT_OLD -#endif +}; ///@} -///@} - /// \defgroup OptionTypeFlags Option type flags /// \ingroup OptionTypes /// @@ -337,6 +279,7 @@ /// ///@{ +enum { /// Suboption parser flag. /** When this flag is set, m_option::p should point to another m_option * array. Only the parse function will be called. If dst is set, it should @@ -345,13 +288,13 @@ * Also note that suboptions may be directly accessed by using * -option:subopt blah. */ -#define M_OPT_TYPE_HAS_CHILD (1<<0) + M_OPT_TYPE_HAS_CHILD =(1<<0), /// Wildcard matching flag. /** If set the option type has a use for option names ending with a * * (used for -aa*), this only affects the option name matching. */ -#define M_OPT_TYPE_ALLOW_WILDCARD (1<<1) + M_OPT_TYPE_ALLOW_WILDCARD =(1<<1), /// Dynamic data type. /** This flag indicates that the data is dynamically allocated (m_option::p @@ -359,7 +302,7 @@ * replaces the initial value of such variables with a dynamic copy in case * the initial value is statically allocated (pretty common with strings). */ -#define M_OPT_TYPE_DYNAMIC (1<<2) + M_OPT_TYPE_DYNAMIC =(1<<2), /// Indirect option type. /** If this is set the parse function doesn't directly return @@ -370,8 +313,8 @@ * target var. It's used by the callback-based options as the callback call * may append later on. */ -#define M_OPT_TYPE_INDIRECT (1<<3) - + M_OPT_TYPE_INDIRECT =(1<<3) +}; ///@} ///////////////////////////// Parser flags //////////////////////////////////////// @@ -384,11 +327,10 @@ /// an argument when parsing from the command line. ///@{ -/// Set when parsing from a config file. -#define M_CONFIG_FILE 0 -/// Set when parsing command line arguments. -#define M_COMMAND_LINE 1 - +enum { + M_CONFIG_FILE=0, /// Set when parsing from a config file. + M_COMMAND_LINE=1 /// Set when parsing command line arguments. +}; ///@} /// \defgroup OptionParserReturn Option parser return code @@ -403,47 +345,21 @@ /// On error one of the following (negative) error codes is returned: ///@{ -/// For use by higher level APIs when the option name is invalid. -#define M_OPT_UNKNOWN -1 - -/// Returned when a parameter is needed but wasn't provided. -#define M_OPT_MISSING_PARAM -2 - -/// Returned when the given parameter couldn't be parsed. -#define M_OPT_INVALID -3 - -/// \brief Returned if the value is "out of range". The exact meaning may -/// vary from type to type. -#define M_OPT_OUT_OF_RANGE -4 - -/// Returned if the parser failed for any other reason than a bad parameter. -#define M_OPT_PARSER_ERR -5 - -/// Returned when MPlayer should exit. Used by various help stuff. -/** M_OPT_EXIT must be the lowest number on this list. - */ -#define M_OPT_EXIT -6 - -/// \defgroup OldOptionParserReturn Backward compatibility -/// -/// These are kept for compatibility with older code. -/// -///@{ -#if 0 -#define ERR_NOT_AN_OPTION M_OPT_UNKNOWN -#define ERR_MISSING_PARAM M_OPT_MISSING_PARAM -#define ERR_OUT_OF_RANGE M_OPT_OUT_OF_RANGE -#define ERR_FUNC_ERR M_OPT_PARSER_ERR -#endif +enum { + M_OPT_UNKNOWN =-1, /// For use by higher level APIs when the option name is invalid. + M_OPT_MISSING_PARAM =-2, /// Returned when a parameter is needed but wasn't provided. + M_OPT_INVALID =-3, /// Returned when the given parameter couldn't be parsed. + M_OPT_OUT_OF_RANGE =-4, /// \brief Returned if the value is "out of range". The exact meaning may vary from type to type. + M_OPT_PARSER_ERR =-5, /// Returned if the parser failed for any other reason than a bad parameter. + M_OPT_EXIT =-6 /// Returned when MPlayer should exit. Used by various help stuff. M_OPT_EXIT must be the lowest number on this list. +}; ///@} -///@} - /// Find the option matching the given name in the list. /** \ingroup Options * This function takes the possible wildcards into account (see * \ref M_OPT_TYPE_ALLOW_WILDCARD). - * + * * \param list Pointer to an array of \ref m_option. * \param name Name of the option. * \return The matching option or NULL. Modified: mplayerxp/libmpconf/m_property.c =================================================================== --- mplayerxp/libmpconf/m_property.c 2012-10-30 17:46:02 UTC (rev 265) +++ mplayerxp/libmpconf/m_property.c 2012-10-31 14:00:16 UTC (rev 266) @@ -15,7 +15,7 @@ #include "help_mp.h" #include "osdep/mplib.h" #define MSGT_CLASS MSGT_CPLAYER -#include "__mp_msg.h" +#include "mp_msg.h" #define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5)) @@ -217,14 +217,14 @@ switch(action) { case M_PROPERTY_SET: if(!arg) return 0; - M_PROPERTY_CLAMP(prop,*(int*)arg); + *(int*)arg=M_PROPERTY_CLAMP(prop,*(int*)arg); *var = *(int*)arg; return 1; case M_PROPERTY_STEP_UP: case M_PROPERTY_STEP_DOWN: *var += (arg ? *(int*)arg : 1) * (action == M_... [truncated message content] |
From: <nic...@us...> - 2012-10-31 14:58:56
|
Revision: 268 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=268&view=rev Author: nickols_k Date: 2012-10-31 14:58:47 +0000 (Wed, 31 Oct 2012) Log Message: ----------- re-enterability Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/fifo.h mplayerxp/mixer.c mplayerxp/mixer.h mplayerxp/mplayer.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-31 14:29:38 UTC (rev 267) +++ mplayerxp/cfg-mplayer.h 2012-10-31 14:58:47 UTC (rev 268) @@ -2,6 +2,7 @@ * config for cfgparser */ +extern const char *oss_mixer_device; #ifdef HAVE_SDL //extern char *sdl_driver; extern int sdl_noxv; Modified: mplayerxp/fifo.h =================================================================== --- mplayerxp/fifo.h 2012-10-31 14:29:38 UTC (rev 267) +++ mplayerxp/fifo.h 2012-10-31 14:58:47 UTC (rev 268) @@ -3,9 +3,6 @@ * a very simple circular buffer FIFO implementation */ #include "mp_config.h" -#ifndef MSGT_CLASS -#define MSGT_CLASS MSGT_GLOBAL -#endif #include "mp_msg.h" #include <stdint.h> Modified: mplayerxp/mixer.c =================================================================== --- mplayerxp/mixer.c 2012-10-31 14:29:38 UTC (rev 267) +++ mplayerxp/mixer.c 2012-10-31 14:58:47 UTC (rev 268) @@ -1,4 +1,3 @@ - #include <string.h> #include <sys/ioctl.h> #include <fcntl.h> @@ -9,64 +8,62 @@ #include "mixer.h" #include "libao2/audio_out.h" -extern ao_data_t* ao_data; - -void mixer_getvolume( float *l,float *r ) +void mixer_getvolume(ao_data_t* ao, float *l,float *r ) { ao_control_vol_t vol; *l=0; *r=0; - if(CONTROL_OK != ao_control(ao_data,AOCONTROL_GET_VOLUME,(long)&vol)) return; + if(CONTROL_OK != ao_control(ao,AOCONTROL_GET_VOLUME,(long)&vol)) return; *r=vol.right; *l=vol.left; } -void mixer_setvolume( float l,float r ) +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_data,AOCONTROL_SET_VOLUME,(long)&vol); + ao_control(ao,AOCONTROL_SET_VOLUME,(long)&vol); } #define MIXER_CHANGE 3 -void mixer_incvolume( void ) +void mixer_incvolume(ao_data_t* ao) { float mixer_l, mixer_r; - mixer_getvolume( &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( mixer_l,mixer_r ); + mixer_setvolume(ao, mixer_l,mixer_r ); } -void mixer_decvolume( void ) +void mixer_decvolume(ao_data_t* ao) { float mixer_l, mixer_r; - mixer_getvolume( &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( mixer_l,mixer_r ); + mixer_setvolume(ao, mixer_l,mixer_r ); } -float mixer_getbothvolume( void ) +float mixer_getbothvolume(ao_data_t* ao) { float mixer_l, mixer_r; - mixer_getvolume( &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( void ) +void mixer_mute(ao_data_t* ao) { - if ( muted ) { mixer_setvolume( mute_l,mute_r ); muted=0; } + if ( muted ) { mixer_setvolume(ao, mute_l,mute_r ); muted=0; } else { - mixer_getvolume( &mute_l,&mute_r ); - mixer_setvolume( 0,0 ); + mixer_getvolume(ao, &mute_l,&mute_r ); + mixer_setvolume(ao, 0,0 ); muted=1; } } Modified: mplayerxp/mixer.h =================================================================== --- mplayerxp/mixer.h 2012-10-31 14:29:38 UTC (rev 267) +++ mplayerxp/mixer.h 2012-10-31 14:58:47 UTC (rev 268) @@ -1,16 +1,15 @@ - #ifndef __MPLAYER_MIXER #define __MPLAYER_MIXER +#include "libao2/audio_out.h" -extern const char *oss_mixer_device; -extern void mixer_getvolume( float *l,float *r ); -extern void mixer_setvolume( float l,float r ); -extern void mixer_incvolume( void ); -extern void mixer_decvolume( void ); -extern float mixer_getbothvolume( void ); -void mixer_mute( void ); +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( float v ) { mixer_setvolume( v,v ); } +static inline void mixer_setbothvolume(ao_data_t* ao, float v ) { mixer_setvolume(ao,v,v); } #endif Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-31 14:29:38 UTC (rev 267) +++ mplayerxp/mplayer.c 2012-10-31 14:58:47 UTC (rev 268) @@ -33,11 +33,21 @@ #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 "cfg-mplayer-def.h" +#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 @@ -53,7 +63,7 @@ #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" @@ -61,8 +71,9 @@ #include "dump.h" #include "nls/nls.h" #include "postproc/libmenu/menu.h" +#include "mixer.h" -#define ABS(x) (((x)>=0)?(x):(-(x))) +#include "xmp_core.h" #define MSGT_CLASS MSGT_CPLAYER #include "mp_msg.h" @@ -91,6 +102,8 @@ static x86_features_t x86; #endif +#define ABS(x) (((x)>=0)?(x):(-(x))) + #define INITED_VO 0x00000001 #define INITED_AO 0x00000002 #define INITED_GETCH2 0x00000004 @@ -136,7 +149,6 @@ /************************************************************************** Decoding ahead **************************************************************************/ -#include "xmp_core.h" ao_data_t* ao_data=NULL; vo_data_t* vo_data=NULL; @@ -151,24 +163,10 @@ UNUSED(conf); return m_config_parse_config_file(mp_data->mconfig, filename); } +#include "cfg-mplayer.h" -#include "osdep/get_path.h" - -/************************************************************************** - Input media streaming & demultiplexer: -**************************************************************************/ - -#include "libmpdemux/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "libmpdemux/parse_es.h" - -#include "libmpcodecs/dec_video.h" -#include "libmpcodecs/dec_audio.h" - -/* Common FIFO functions, and keyboard/event FIFO code */ -#include "fifo.h" /**************************************************************************/ +extern void mp_register_options(m_config_t* cfg); static int mpxp_init_antiviral_protection(int verbose) { @@ -757,11 +755,6 @@ __exit_sighandler(); } -extern void mp_register_options(m_config_t* cfg); - -#include "mixer.h" -#include "cfg-mplayer.h" - void parse_cfgfiles( m_config_t* conf ) { char *conffile; @@ -2211,19 +2204,19 @@ mp_conf.osd_level= v > 3 ? 3 : v; } break; case MP_CMD_MUTE: - mixer_mute(); + mixer_mute(ao_data); break; case MP_CMD_VOLUME : { int v = cmd->args[0].v.i; if(v > 0) - mixer_incvolume(); + mixer_incvolume(ao_data); else - mixer_decvolume(); + mixer_decvolume(ao_data); #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec vo_data->osd_progbar_type=OSD_VOLUME; - vo_data->osd_progbar_value=(mixer_getbothvolume()*256.0)/100.0; + vo_data->osd_progbar_value=(mixer_getbothvolume(ao_data)*256.0)/100.0; vo_osd_changed(OSDTYPE_PROGBAR); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-31 17:46:00
|
Revision: 271 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=271&view=rev Author: nickols_k Date: 2012-10-31 17:45:52 +0000 (Wed, 31 Oct 2012) Log Message: ----------- use inline functions instead of #define Modified Paths: -------------- mplayerxp/libmpcodecs/vd.c mplayerxp/libmpdemux/yuv4mpeg.c mplayerxp/libvo/osd.h mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/x11_common.c mplayerxp/mplayer.c Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libmpcodecs/vd.c 2012-10-31 17:45:52 UTC (rev 271) @@ -188,13 +188,13 @@ // autodetect flipping if(vo_conf.flip==0){ - VO_FLIP_UNSET(vo_data); + vo_FLIP_UNSET(vo_data); if(sh->codec->outflags[j]&CODECS_FLAG_FLIP) if(!(sh->codec->outflags[j]&CODECS_FLAG_NOFLIP)) - VO_FLIP_SET(vo_data); + vo_FLIP_SET(vo_data); } - if(vo_data->flags&VFCAP_FLIPPED) VO_FLIP_REVERT(vo_data); - if(VO_FLIP(vo_data) && !(vo_data->flags&VFCAP_FLIP)){ + 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"); } Modified: mplayerxp/libmpdemux/yuv4mpeg.c =================================================================== --- mplayerxp/libmpdemux/yuv4mpeg.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libmpdemux/yuv4mpeg.c 2012-10-31 17:45:52 UTC (rev 271) @@ -29,9 +29,9 @@ #include <stdlib.h> #include <string.h> #include "yuv4mpeg.h" -#include "yuv4mpeg_intern.h" #include "demux_msg.h" #include "osdep/mplib.h" +#include "yuv4mpeg_intern.h" /* quick test of two ratios for equality (i.e. identical components) */ #define Y4M_RATIO_EQL(a,b) ( ((a).n == (b).n) && ((a).d == (b).d) ) @@ -153,7 +153,7 @@ static int y4m_snprint_xtags(char *s, int maxn, y4m_xtag_list_t *xtags) { int i, room; - + for (i = 0, room = maxn - 1; i < xtags->count; i++) { int n = snprintf(s, room + 1, " %s", xtags->tags[i]); if ((n < 0) || (n > room)) return Y4M_ERR_HEADER; Modified: mplayerxp/libvo/osd.h =================================================================== --- mplayerxp/libvo/osd.h 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libvo/osd.h 2012-10-31 17:45:52 UTC (rev 271) @@ -15,11 +15,11 @@ extern draw_alpha_f vo_draw_alpha_rgb32_ptr; extern draw_alpha_f vo_draw_alpha_rgb15_ptr; extern draw_alpha_f vo_draw_alpha_rgb16_ptr; -#define vo_draw_alpha_yv12(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_yv12_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) -#define vo_draw_alpha_yuy2(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_yuy2_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) -#define vo_draw_alpha_uyvy(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_uyvy_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) -#define vo_draw_alpha_rgb24(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_rgb24_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) -#define vo_draw_alpha_rgb32(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_rgb32_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) -#define vo_draw_alpha_rgb15(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_rgb15_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) -#define vo_draw_alpha_rgb16(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_rgb16_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) +static inline void vo_draw_alpha_yv12(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_yv12_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } +static inline void vo_draw_alpha_yuy2(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_yuy2_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } +static inline void vo_draw_alpha_uyvy(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_uyvy_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } +static inline void vo_draw_alpha_rgb24(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_rgb24_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } +static inline void vo_draw_alpha_rgb32(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_rgb32_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } +static inline void vo_draw_alpha_rgb15(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_rgb15_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } +static inline void vo_draw_alpha_rgb16(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_rgb16_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } #endif Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libvo/video_out.h 2012-10-31 17:45:52 UTC (rev 271) @@ -182,19 +182,19 @@ const subtitle* sub; int osd_changed_flag; }vo_data_t; -#define VO_ZOOM(vo) ((vo)->flags&VOFLAG_SWSCALE) -#define VO_ZOOM_SET(vo) ((vo)->flags|=VOFLAG_SWSCALE) -#define VO_ZOOM_UNSET(vo) ((vo)->flags&=~VOFLAG_SWSCALE) -#define VO_FS(vo) ((vo)->flags&VOFLAG_FULLSCREEN) -#define VO_FS_SET(vo) ((vo)->flags|=VOFLAG_FULLSCREEN) -#define VO_FS_UNSET(vo) ((vo)->flags&=~VOFLAG_FULLSCREEN) -#define VO_VM(vo) ((vo)->flags&VOFLAG_MODESWITCHING) -#define VO_VM_SET(vo) ((vo)->flags|=VOFLAG_MODESWITCHING) -#define VO_VM_UNSET(vo) ((vo)->flags&=~VOFLAG_MODESWITCHING) -#define VO_FLIP(vo) ((vo)->flags&VOFLAG_FLIPPING) -#define VO_FLIP_SET(vo) ((vo)->flags|=VOFLAG_FLIPPING) -#define VO_FLIP_UNSET(vo) ((vo)->flags&=~VOFLAG_FLIPPING) -#define VO_FLIP_REVERT(vo) ((vo)->flags^=VOFLAG_FLIPPING) +static inline int vo_ZOOM(const vo_data_t*vo) { return vo->flags&VOFLAG_SWSCALE; } +static inline void vo_ZOOM_SET(vo_data_t*vo) { vo->flags|=VOFLAG_SWSCALE; } +static inline void vo_ZOOM_UNSET(vo_data_t*vo) { vo->flags&=~VOFLAG_SWSCALE; } +static inline int vo_FS(const vo_data_t*vo) { return vo->flags&VOFLAG_FULLSCREEN; } +static inline void vo_FS_SET(vo_data_t*vo) { vo->flags|=VOFLAG_FULLSCREEN; } +static inline void vo_FS_UNSET(vo_data_t*vo) { vo->flags&=~VOFLAG_FULLSCREEN; } +static inline int vo_VM(const vo_data_t*vo) { return vo->flags&VOFLAG_MODESWITCHING; } +static inline void vo_VM_SET(vo_data_t*vo) { vo->flags|=VOFLAG_MODESWITCHING; } +static inline void vo_VM_UNSET(vo_data_t*vo) { vo->flags&=~VOFLAG_MODESWITCHING; } +static inline int vo_FLIP(const vo_data_t*vo) { return vo->flags&VOFLAG_FLIPPING; } +static inline void vo_FLIP_SET(vo_data_t*vo) { vo->flags|=VOFLAG_FLIPPING; } +static inline void vo_FLIP_UNSET(vo_data_t*vo) { vo->flags&=~VOFLAG_FLIPPING; } +static inline void vo_FLIP_REVERT(vo_data_t*vo){ vo->flags^=VOFLAG_FLIPPING; } /** VO-driver interface */ typedef struct vo_functions_s Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libvo/vo_fbdev.c 2012-10-31 17:45:52 UTC (rev 271) @@ -841,12 +841,12 @@ } if (priv->pre_init_err) return 1; - if (priv_conf.mode_name && !VO_VM(vo)) { + if (priv_conf.mode_name && !vo_VM(vo)) { MSG_ERR(FBDEV "-fbmode can only be used with -vm\n"); return 1; } - if (VO_VM(vo) && (parse_fbmode_cfg(vo,priv_conf.mode_cfgfile) < 0)) return 1; - if (d_width && (VO_ZOOM(vo) || VO_VM(vo))) { + if (vo_VM(vo) && (parse_fbmode_cfg(vo,priv_conf.mode_cfgfile) < 0)) return 1; + if (d_width && (vo_ZOOM(vo) || vo_VM(vo))) { priv->out_width = d_width; priv->out_height = d_height; } else { @@ -863,7 +863,7 @@ return 1; } fb_mode2fb_vinfo(priv->mode, &priv->vinfo); - } else if (VO_VM(vo)) { + } else if (vo_VM(vo)) { priv->monitor_hfreq = str2range(priv_conf.monitor_hfreq_str); priv->monitor_vfreq = str2range(priv_conf.monitor_vfreq_str); priv->monitor_dotclock = str2range(priv_conf.monitor_dotclock_str); @@ -925,7 +925,7 @@ break; } - if (VO_FLIP(vo) && ((((priv->pixel_format & 0xff) + 7) / 8) != priv->pixel_size)) { + if (vo_FLIP(vo) && ((((priv->pixel_format & 0xff) + 7) / 8) != priv->pixel_size)) { MSG_ERR(FBDEV "Flipped output with depth conversion is not " "supported\n"); return 1; @@ -977,12 +977,12 @@ memset(priv->next_frame,0,sizeof(priv->next_frame)); priv->out_width=width; priv->out_height=height; - if(VO_ZOOM(vo)) { + if(vo_ZOOM(vo)) { aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); aspect_save_screenres(priv->xres,priv->yres); aspect(&priv->out_width,&priv->out_height,A_ZOOM); - } else if(VO_FS(vo)) { + } else if(vo_FS(vo)) { priv->out_width = priv->xres; priv->out_height = priv->yres; } Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libvo/vo_opengl.c 2012-10-31 17:45:52 UTC (rev 271) @@ -132,7 +132,7 @@ glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); glRasterPos2i(x, y); - glPixelZoom(sx,VO_FLIP(vo)?sy:-sy); + glPixelZoom(sx,vo_FLIP(vo)?sy:-sy); } static void resize(vo_data_t*vo,int x,int y){ @@ -172,12 +172,12 @@ priv->image_width = width; priv->image_format=format; - if ( VO_FS(vo) ) { vo->dest.w=d_width; vo->dest.h=d_height; } + if ( vo_FS(vo) ) { vo->dest.w=d_width; vo->dest.h=d_height; } priv->num_buffers=vo_conf.da_buffs; aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); - aspect(&d_width,&d_height,VO_ZOOM(vo)?A_ZOOM:A_NOZOOM); + aspect(&d_width,&d_height,vo_ZOOM(vo)?A_ZOOM:A_NOZOOM); vo_x11_calcpos(vo,&hint,d_width,d_height,flags); hint.flags = PPosition | PSize; @@ -208,7 +208,7 @@ ((vo_conf.WinID==0) ? 0 : (PointerMotionMask | ButtonPressMask | ButtonReleaseMask ))); XSetStandardProperties(vo->mDisplay, vo->window, hello, hello, None, NULL, 0, &hint); - if ( VO_FS(vo) ) vo_x11_decoration(vo, vo->mDisplay,vo->window,0 ); + if ( vo_FS(vo) ) vo_x11_decoration(vo, vo->mDisplay,vo->window,0 ); XMapWindow(vo->mDisplay, vo->window); #ifdef HAVE_XINERAMA vo_x11_xinerama_move(vo,vo->mDisplay,vo->window,&hint); @@ -217,7 +217,7 @@ XFlush(vo->mDisplay); XSync(vo->mDisplay, False); #ifdef HAVE_XF86VM - if ( VO_VM(vo) ) { + if ( vo_VM(vo) ) { /* Grab the mouse pointer in our window */ XGrabPointer( vo->mDisplay, vo->window, True, 0, GrabModeAsync, GrabModeAsync, Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libvo/vo_sdl.c 2012-10-31 17:45:52 UTC (rev 271) @@ -926,7 +926,7 @@ retval = VO_EVENT_RESIZE; } else if ( keypressed == SDLK_n ) { #ifdef HAVE_X11 - aspect(&priv->dstwidth, &priv->dstheight,VO_ZOOM(vo)?A_ZOOM:A_NOZOOM); + aspect(&priv->dstwidth, &priv->dstheight,vo_ZOOM(vo)?A_ZOOM:A_NOZOOM); #endif if (priv->surface->w != priv->dstwidth || priv->surface->h != priv->dstheight) { if(set_video_mode(vo,priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags)!=0) exit(EXIT_FAILURE); Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libvo/vo_x11.c 2012-10-31 17:45:52 UTC (rev 271) @@ -145,7 +145,7 @@ aspect_save_prescale(d_width,d_height); aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); - aspect(&d_width,&d_height,VO_FS(vo)?A_ZOOM:A_NOZOOM); + aspect(&d_width,&d_height,vo_FS(vo)?A_ZOOM:A_NOZOOM); vo_x11_calcpos(vo,&hint,d_width,d_height,flags); hint.flags=PPosition | PSize; @@ -167,7 +167,7 @@ xswamask=CWBackPixel | CWBorderPixel | CWColormap; #ifdef HAVE_XF86VM - if ( VO_VM(vo) ) { + if ( vo_VM(vo) ) { xswa.override_redirect=True; xswamask|=CWOverrideRedirect; } @@ -185,7 +185,7 @@ } vo_x11_classhint( vo->mDisplay,vo->window,"vo_x11" ); vo_x11_hidecursor(vo->mDisplay,vo->window); - if ( VO_FS(vo) ) vo_x11_decoration(vo,vo->mDisplay,vo->window,0 ); + if ( vo_FS(vo) ) vo_x11_decoration(vo,vo->mDisplay,vo->window,0 ); XSelectInput( vo->mDisplay,vo->window,StructureNotifyMask ); XSetStandardProperties( vo->mDisplay,vo->window,title,title,None,NULL,0,&hint ); XMapWindow( vo->mDisplay,vo->window ); @@ -205,7 +205,7 @@ ((vo_conf.WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask)) ); #ifdef HAVE_XF86VM - if ( VO_VM(vo) ) { + if ( vo_VM(vo) ) { /* Grab the mouse pointer in our window */ XGrabPointer(vo->mDisplay, vo->window, True, 0, GrabModeAsync, GrabModeAsync, Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libvo/vo_xv.c 2012-10-31 17:45:52 UTC (rev 271) @@ -283,13 +283,13 @@ priv->image_width = width; priv->image_format=format; - if ( VO_FS(vo) ) { vo->dest.w=d_width; vo->dest.h=d_height; } + if ( vo_FS(vo) ) { vo->dest.w=d_width; vo->dest.h=d_height; } priv->num_buffers=vo_conf.da_buffs; aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); - aspect(&d_width,&d_height,VO_ZOOM(vo)?A_ZOOM:A_NOZOOM); + aspect(&d_width,&d_height,vo_ZOOM(vo)?A_ZOOM:A_NOZOOM); vo_x11_calcpos(vo,&hint,d_width,d_height,flags); hint.flags = PPosition | PSize; @@ -320,7 +320,7 @@ ((vo_conf.WinID==0) ? 0 : (PointerMotionMask | ButtonPressMask | ButtonReleaseMask))); XSetStandardProperties(vo->mDisplay, vo->window, hello, hello, None, NULL, 0, &hint); - if ( VO_FS(vo) ) vo_x11_decoration(vo,vo->mDisplay,vo->window,0 ); + if ( vo_FS(vo) ) vo_x11_decoration(vo,vo->mDisplay,vo->window,0 ); XMapWindow(vo->mDisplay, vo->window); #ifdef HAVE_XINERAMA vo_x11_xinerama_move(vo,vo->mDisplay,vo->window,&hint); @@ -329,7 +329,7 @@ XFlush(vo->mDisplay); XSync(vo->mDisplay, False); #ifdef HAVE_XF86VM - if ( VO_VM(vo) ) { + if ( vo_VM(vo) ) { /* Grab the mouse pointer in our window */ XGrabPointer(vo->mDisplay, vo->window, True, 0, GrabModeAsync, GrabModeAsync, @@ -409,8 +409,8 @@ XTranslateCoordinates( vo->mDisplay,vo->window,priv->mRoot,0,0,&priv->drwcX,&priv->drwcY,&priv->mRoot ); MSG_V( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",priv->drwcX,priv->drwcY,priv->drwX,priv->drwY,priv->drwWidth,priv->drwHeight ); - aspect(&priv->dwidth,&priv->dheight,VO_ZOOM(vo)?A_ZOOM:A_NOZOOM); - if ( VO_FS(vo) ) { + aspect(&priv->dwidth,&priv->dheight,vo_ZOOM(vo)?A_ZOOM:A_NOZOOM); + if ( vo_FS(vo) ) { aspect(&priv->dwidth,&priv->dheight,A_ZOOM); priv->drwX=( vo_conf.screenwidth - (priv->dwidth > vo_conf.screenwidth?vo_conf.screenwidth:priv->dwidth) ) / 2; priv->drwcX+=priv->drwX; @@ -477,8 +477,8 @@ XTranslateCoordinates( vo->mDisplay,vo->window,priv->mRoot,0,0,&priv->drwcX,&priv->drwcY,&priv->mRoot ); MSG_V( "[xv-resize] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",priv->drwcX,priv->drwcY,priv->drwX,priv->drwY,priv->drwWidth,priv->drwHeight ); - aspect(&priv->dwidth,&priv->dheight,VO_ZOOM(vo)?A_ZOOM:A_NOZOOM); - if ( VO_FS(vo) ) { + aspect(&priv->dwidth,&priv->dheight,vo_ZOOM(vo)?A_ZOOM:A_NOZOOM); + if ( vo_FS(vo) ) { aspect(&priv->dwidth,&priv->dheight,A_ZOOM); priv->drwX=( vo_conf.screenwidth - (priv->dwidth > vo_conf.screenwidth?vo_conf.screenwidth:priv->dwidth) ) / 2; priv->drwcX+=priv->drwX; @@ -491,7 +491,7 @@ } if ( e & VO_EVENT_EXPOSE ) { XvShmPutImage(vo->mDisplay, priv->port, vo->window, vo->gc, priv->image[priv->expose_idx], 0, 0, priv->image_width, priv->image_height, priv->drwX, priv->drwY, 1, 1, False); - XvShmPutImage(vo->mDisplay, priv->port, vo->window, vo->gc, priv->image[priv->expose_idx], 0, 0, priv->image_width, priv->image_height, priv->drwX,priv->drwY,priv->drwWidth,(VO_FS(vo)?priv->drwHeight - 1:priv->drwHeight), False); + XvShmPutImage(vo->mDisplay, priv->port, vo->window, vo->gc, priv->image[priv->expose_idx], 0, 0, priv->image_width, priv->image_height, priv->drwX,priv->drwY,priv->drwWidth,(vo_FS(vo)?priv->drwHeight - 1:priv->drwHeight), False); } return e|VO_EVENT_FORCE_UPDATE; } @@ -502,7 +502,7 @@ priv->expose_idx=idx; XvShmPutImage(vo->mDisplay, priv->port, vo->window, vo->gc, priv->image[idx], 0, 0, priv->image_width, priv->image_height, - priv->drwX,priv->drwY,priv->drwWidth,(VO_FS(vo)?priv->drwHeight - 1:priv->drwHeight), + priv->drwX,priv->drwY,priv->drwWidth,(vo_FS(vo)?priv->drwHeight - 1:priv->drwHeight), False); if (priv->num_buffers>1) XFlush(vo->mDisplay); else XSync(vo->mDisplay, False); Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libvo/vo_xvidix.c 2012-10-31 17:45:52 UTC (rev 271) @@ -80,12 +80,12 @@ XTranslateCoordinates(vo->mDisplay, vo->window, priv->mRoot, 0, 0, &priv->drwcX, &priv->drwcY, &priv->mRoot); - if (!VO_FS(vo)) + if (!vo_FS(vo)) MSG_V( "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n", priv->drwcX, priv->drwcY, priv->drwX, priv->drwY, priv->drwWidth, priv->drwHeight); /* following stuff copied from vo_xmga.c */ - if (VO_FS(vo)) { + if (vo_FS(vo)) { priv->drwX = (vo_conf.screenwidth - (priv->dwidth > vo_conf.screenwidth ? vo_conf.screenwidth : priv->dwidth)) / 2; priv->drwcX += priv->drwX; priv->drwY = (vo_conf.screenheight - (priv->dheight > vo_conf.screenheight ? vo_conf.screenheight : priv->dheight)) / 2; @@ -153,7 +153,7 @@ XClearWindow( vo->mDisplay,vo->window ); XSetForeground(vo->mDisplay, vo->gc, priv->fgColor); XFillRectangle(vo->mDisplay, vo->window, vo->gc, priv->drwX, priv->drwY, priv->drwWidth, - (VO_FS(vo) ? priv->drwHeight - 1 : priv->drwHeight)); + (vo_FS(vo) ? priv->drwHeight - 1 : priv->drwHeight)); /* flush, update drawable */ XFlush(vo->mDisplay); @@ -223,7 +223,7 @@ priv->win_w = d_width; priv->win_h = d_height; - if (VO_FS(vo)) { vo->dest.w=d_width; vo->dest.h=d_height; } + if (vo_FS(vo)) { vo->dest.w=d_width; vo->dest.h=d_height; } priv->X_already_started++; @@ -247,8 +247,8 @@ aspect(&d_width, &d_height,flags & VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); - if (VO_FS(vo)) { /* fullscreen */ - if (VO_ZOOM(vo)) aspect(&d_width, &d_height, A_ZOOM); + if (vo_FS(vo)) { /* fullscreen */ + if (vo_ZOOM(vo)) aspect(&d_width, &d_height, A_ZOOM); else { d_width = vo_conf.screenwidth; d_height = vo_conf.screenheight; @@ -269,7 +269,7 @@ window_depth = 24; XMatchVisualInfo(vo->mDisplay, vo->mScreen, window_depth, TrueColor, &vinfo); - xswa.background_pixel = VO_FS(vo) ? BlackPixel(vo->mDisplay, vo->mScreen) : priv->fgColor; + xswa.background_pixel = vo_FS(vo) ? BlackPixel(vo->mDisplay, vo->mScreen) : priv->fgColor; xswa.border_pixel = 0; xswa.colormap = XCreateColormap(vo->mDisplay, RootWindow(vo->mDisplay, vo->mScreen), vinfo.visual, AllocNone); @@ -290,7 +290,7 @@ vo_x11_classhint(vo->mDisplay, vo->window, "xvidix"); vo_x11_hidecursor(vo->mDisplay, vo->window); - if (VO_FS(vo)) vo_x11_decoration(vo,vo->mDisplay, vo->window, 0); + if (vo_FS(vo)) vo_x11_decoration(vo,vo->mDisplay, vo->window, 0); XGetNormalHints(vo->mDisplay, vo->window, &hint); hint.x = priv->win_x; Modified: mplayerxp/libvo/x11_common.c =================================================================== --- mplayerxp/libvo/x11_common.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/libvo/x11_common.c 2012-10-31 17:45:52 UTC (rev 271) @@ -750,7 +750,7 @@ hint->width=d_width; hint->height=d_height; #ifdef HAVE_XF86VM - if ( VO_VM(vo) ) { + if ( vo_VM(vo) ) { vm_width=d_width; vm_height=d_height; vo_vm_switch(vo,vm_width, vm_height,&modeline_width, &modeline_height); hint->x=(vo_conf.screenwidth-modeline_width)/2; @@ -760,7 +760,7 @@ } else #endif - if ( VO_FS(vo) ) { + if ( vo_FS(vo) ) { hint->width=vo_conf.screenwidth; hint->height=vo_conf.screenheight; hint->x=0; @@ -772,13 +772,13 @@ { priv_t*priv=(priv_t*)vo->priv2; XUnmapWindow( vo->mDisplay,vo->window ); - if ( !VO_FS(vo) ) { - VO_FS_SET(vo); + if ( !vo_FS(vo) ) { + vo_FS_SET(vo); priv->prev=vo->dest; vo->dest.x=0; vo->dest.y=0; vo->dest.w=vo_conf.screenwidth; vo->dest.h=vo_conf.screenheight; vo_x11_decoration(vo,vo->mDisplay,vo->window,0 ); } else { - VO_FS_UNSET(vo); + vo_FS_UNSET(vo); vo->dest=priv->prev; vo_x11_decoration(vo,vo->mDisplay,vo->window,1 ); } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-31 17:14:17 UTC (rev 270) +++ mplayerxp/mplayer.c 2012-10-31 17:45:52 UTC (rev 271) @@ -1890,10 +1890,10 @@ /* Go through the codec.conf and find the best codec...*/ sh_video->inited=0; 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); + 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: */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-01 14:02:37
|
Revision: 273 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=273&view=rev Author: nickols_k Date: 2012-11-01 14:02:30 +0000 (Thu, 01 Nov 2012) Log Message: ----------- new extensions of mp_malloc Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-01 08:38:09 UTC (rev 272) +++ mplayerxp/mplayer.c 2012-11-01 14:02:30 UTC (rev 273) @@ -172,9 +172,9 @@ static int mpxp_init_antiviral_protection(int verbose) { int rc; - rc=mp_mprotect(antiviral_hole1,sizeof(antiviral_hole1),MP_PROT_NONE); - rc|=mp_mprotect(antiviral_hole2,sizeof(antiviral_hole2),MP_PROT_NONE); - rc|=mp_mprotect(antiviral_hole3,sizeof(antiviral_hole3),MP_PROT_NONE); + 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)); @@ -187,7 +187,7 @@ static int mpxp_test_antiviral_protection(int verbose) { int rc; - if(verbose) MSG_INFO("Right now MPlayerXP should make coredump!\n"); + if(verbose) MSG_INFO("Your've specified test-av option!\nRight now MPlayerXP should make coredump!\n"); rc=antiviral_hole1[0]|antiviral_hole2[0]|antiviral_hole2[0]; MSG_ERR("Antiviral protection of MPlayerXP doesn't work!"); return rc; @@ -2379,7 +2379,7 @@ int forced_subs_only=0; seek_args_t seek_args = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; - mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); + mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); // MPA_FLG_BACKTRACE mpxp_init_structs(); priv_t*priv=mp_data->priv; Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-11-01 08:38:09 UTC (rev 272) +++ mplayerxp/osdep/mp_malloc.c 2012-11-01 14:02:30 UTC (rev 273) @@ -6,112 +6,20 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> +#include <signal.h> #include <malloc.h> +#include <limits.h> #include <time.h> +#include <unistd.h> +#include <execinfo.h> -#ifdef ENABLE_DEBUG_MALLOC -any_t*my_malloc(size_t __size) -{ - char *retval; - long msize,mval; - msize = __size; - retval = mp_malloc(msize+2*sizeof(long)); - if(retval) - { - mval = (long)retval; - memcpy(retval,&msize,sizeof(long)); - memcpy(retval+msize+sizeof(long),&mval,sizeof(long)); - retval += sizeof(long); - } -// printf("mp_malloc returns: %08X for size: %08X\n",retval,__size); - return retval; -} +typedef struct mp_slot_s { + any_t* page_ptr; + size_t size; + size_t ncalls; + any_t* calls[10]; +}mp_slot_t; -any_t*my_realloc(any_t*__ptr, size_t __size) -{ - char *retval,*myptr; - long crc,osize; - long msize,mval; - msize = __size; - myptr = __ptr; - if(__ptr) - { - memcpy(&osize,(char *)__ptr-sizeof(long),sizeof(long)); - memcpy(&crc,(char *)__ptr+osize,sizeof(long)); - if(crc != (long)((char *)__ptr-sizeof(long))) - { - printf("Internal error: my_realloc found out memory corruption!\n"); - printf("INFO: ptr=%p ptr[0]=%lX crc=%lX\n", - __ptr, - osize, - crc); -#ifdef __i386__ - __asm __volatile(".short 0xffff":::"memory"); -#endif - } - myptr -= sizeof(long); - } - retval = mp_realloc(myptr,__size+2*sizeof(long)); - { - mval = (long)retval; - memcpy(retval,&msize,sizeof(long)); - memcpy(retval+__size+sizeof(long),&mval,sizeof(long)); - retval += sizeof(long); - } - return retval; -} - -any_t*my_calloc (size_t __nelem, size_t __size) -{ - char *retval; - long my_size; - long msize,mval; - msize = __nelem*__size; - retval = mp_malloc(msize+2*sizeof(long)); - if(retval) - { - mval = (long)retval; - memset(retval+sizeof(long),0,msize); - memcpy(retval,&msize,sizeof(long)); - memcpy(retval+msize+sizeof(long),&mval,sizeof(long)); - retval += sizeof(long); - } - return retval; -} - -void my_free(any_t*__ptr) -{ - any_t*myptr; - long crc,osize; - if(__ptr) - { - myptr = (char *)__ptr-sizeof(long); - memcpy(&osize,(char *)myptr,sizeof(long)); - memcpy(&crc,(char *)myptr+osize+sizeof(long),sizeof(long)); - if(crc != (long)myptr) - { - printf("Internal error: my_free found out memory corruption!\n"); - printf("INFO: ptr=%p ptr[0]=%lX crc=%lX\n", - __ptr, - osize, - crc); -#ifdef __i386__ - __asm __volatile(".short 0xffff":::"memory"); -#endif - } - mp_free((char *)__ptr-sizeof(long)); - } -} - -char * my_strdup(const char *s) -{ - any_t*a; - a = my_malloc(strlen(s)+1); - strcpy(a,s); - return a; -} -#endif - typedef struct priv_s { unsigned rnd_limit; unsigned every_nth_call; @@ -123,9 +31,156 @@ int enable_stat; unsigned long long int stat_total_calls; unsigned long long int stat_num_allocs; + mp_slot_t* slots; + size_t nslots; }priv_t; 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) { + unsigned npages = size/__VM_PAGE_SIZE__; + unsigned fullsize; + if(size%__VM_PAGE_SIZE__) npages++; + npages++; + fullsize=npages*__VM_PAGE_SIZE__; + return fullsize; +} +static any_t* prot_last_page(any_t* rp,size_t fullsize) { return rp+(fullsize-__VM_PAGE_SIZE__); } +static void __prot_print_slots(void) { + size_t i; + for(i=0;i<priv->nslots;i++) { + MSG_INFO("slot[%u] address: %p size: %u\n",i,priv->slots[i].page_ptr,priv->slots[i].size); + } +} + +static size_t prot_find_slot_idx(any_t* ptr) { + size_t i; + for(i=0;i<priv->nslots;i++) { + if(priv->slots[i].page_ptr==ptr) return i; + } + return UINT_MAX; +} + +static mp_slot_t* prot_find_slot(any_t* ptr) { + size_t idx=prot_find_slot_idx(ptr); + if(idx!=UINT_MAX) return &priv->slots[idx]; + return NULL; +} + +static mp_slot_t* prot_append_slot(any_t*ptr,size_t size) { + mp_slot_t* slot; + if(!priv->slots) slot=malloc(sizeof(mp_slot_t)); + else slot=realloc(priv->slots,sizeof(mp_slot_t)*(priv->nslots+1)); + priv->slots=slot; + memset(&priv->slots[priv->nslots],0,sizeof(mp_slot_t)); + priv->slots[priv->nslots].page_ptr=ptr; + priv->slots[priv->nslots].size=size; + priv->nslots++; + return &priv->slots[priv->nslots-1]; +} + +static void prot_free_slot(any_t* ptr) { + size_t idx=prot_find_slot_idx(ptr); + if(idx!=UINT_MAX) { + memmove(&priv->slots[idx],&priv->slots[idx+1],sizeof(mp_slot_t)*(priv->nslots-(idx+1))); + priv->slots=realloc(priv->slots,sizeof(mp_slot_t)*(priv->nslots-1)); + priv->nslots--; + } +} + +static any_t* __prot_malloc(size_t size) { + any_t* rp; + size_t fullsize=prot_fullsize(size); + rp=mp_memalign(__VM_PAGE_SIZE__,fullsize); + if(rp) { + prot_append_slot(rp,size); + // protect last page here + mprotect(prot_last_page(rp,fullsize),__VM_PAGE_SIZE__,MP_DENY_ALL); + rp+=fullsize-__VM_PAGE_SIZE__-size; + } + return rp; +} + +static void __prot_free(any_t*ptr) { + any_t *page_ptr=prot_page_align(ptr); + free(page_ptr); + mp_slot_t* slot=prot_find_slot(page_ptr); + if(!slot) { + printf("Internal error! Can't find slot for address: %p\n",ptr); + __prot_print_slots(); + kill(getpid(), SIGILL); + } + size_t fullsize=prot_fullsize(slot->size); + mprotect(prot_last_page(page_ptr,fullsize),__VM_PAGE_SIZE__,MP_PROT_READ|MP_PROT_WRITE); + prot_free_slot(ptr); +} + +#define min(a,b) ((a)<(b)?(a):(b)) +static any_t* __prot_realloc(any_t*ptr,size_t size) { + any_t* rp; + if((rp=__prot_malloc(size))!=NULL && ptr) { + mp_slot_t* slot=prot_find_slot(prot_page_align(ptr)); + if(!slot) { + printf("Internal error! Can't find slot for address: %p\n",ptr); + __prot_print_slots(); + kill(getpid(), SIGILL); + } + memcpy(rp,ptr,min(slot->size,size)); + __prot_free(ptr); + } + return rp; +} + +static any_t* prot_malloc(size_t size) { + any_t* rp; + rp=__prot_malloc(size); + return rp; +} + +static any_t* prot_realloc(any_t*ptr,size_t size) { + any_t* rp; + rp=__prot_realloc(ptr,size); + return rp; +} + +static void prot_free(any_t*ptr) { + __prot_free(ptr); +} + +static __always_inline any_t* bt_malloc(size_t size) { + any_t*rp; + mp_slot_t* slot; + rp=malloc(size); + if(rp) { + slot=prot_append_slot(rp,size); + slot->ncalls=backtrace(slot->calls,10); + } + return rp; +} + +static __always_inline any_t* bt_realloc(any_t*ptr,size_t size) { + return realloc(ptr,size); +} + +static __always_inline void bt_free(any_t*ptr) { + mp_slot_t* slot=prot_find_slot(ptr); + if(!slot) { + MSG_WARN("Internal error! Can't find slot for address: %p\n",ptr); + } + prot_free_slot(ptr); + free(ptr); +} + +static void bt_print_slots(void) { + size_t i,j; + for(i=0;i<priv->nslots;i++) { + MSG_INFO("Alloc's address: %p size: %u bt_stack: %u\n",priv->slots[i].page_ptr,priv->slots[i].size,priv->slots[i].ncalls); + for(j=0;j<priv->slots[i].ncalls;j++) { + MSG_INFO(" %p\n",priv->slots[i].calls[j]); + } + } +} +/* ================== HEAD ======================= */ void mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags) { if(!priv) priv=malloc(sizeof(priv_t)); @@ -139,6 +194,7 @@ { if(priv->num_allocs && verbose) MSG_WARN("Warning! From %lli total calls of alloc() were not freed %lli buffers\n",priv->total_calls,priv->num_allocs); + if(priv->flags&MPA_FLG_BACKTRACE) bt_print_slots(); free(priv); priv=NULL; } @@ -147,12 +203,14 @@ { any_t* rb,*rnd_buff=NULL; if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); - if(priv->every_nth_call && priv->rnd_limit) { + if(priv->every_nth_call && priv->rnd_limit && !priv->flags) { if(priv->total_calls%priv->every_nth_call==0) { rnd_buff=malloc(rand()%priv->rnd_limit); } } - rb = malloc(__size); + if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) rb=prot_malloc(__size); + else if(priv->flags&MPA_FLG_BACKTRACE) rb=bt_malloc(__size); + else rb=malloc(__size); if(rnd_buff) free(rnd_buff); priv->total_calls++; priv->num_allocs++; @@ -163,14 +221,35 @@ return rb; } -any_t* mp_realloc(any_t*__ptr, size_t __size) { return realloc(__ptr,__size); } +any_t* mp_realloc(any_t*__ptr, size_t __size) { + any_t* rp; + if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) rp=prot_realloc(__ptr,__size); + else if(priv->flags&MPA_FLG_BACKTRACE) rp=bt_realloc(__ptr,__size); + else rp=realloc(__ptr,__size); + return rp; +} +void mp_free(any_t*__ptr) +{ + if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); + if(__ptr) { + if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) prot_free(__ptr); + else if(priv->flags&MPA_FLG_BACKTRACE) bt_free(__ptr); + else free(__ptr); + priv->num_allocs--; + if(priv->enable_stat) priv->stat_num_allocs--; + } +} + +/* ================ APPENDIX ==================== */ + any_t* mp_mallocz (size_t __size) { any_t* rp; rp=mp_malloc(__size); if(rp) memset(rp,0,__size); return rp; } + /* randomizing of memalign is useless feature */ any_t* mp_memalign (size_t boundary, size_t __size) { @@ -180,20 +259,12 @@ return memalign(boundary,__size); } -void mp_free(any_t*__ptr) -{ - if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); - free(__ptr); - priv->num_allocs--; - if(priv->enable_stat) priv->stat_num_allocs--; -} - char * mp_strdup(const char *src) { char *rs=NULL; if(src) { unsigned len=strlen(src); rs=mp_malloc(len+1); - strcpy(rs,src); + if(rs) strcpy(rs,src); } return rs; } Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-11-01 08:38:09 UTC (rev 272) +++ mplayerxp/osdep/mplib.h 2012-11-01 14:02:30 UTC (rev 273) @@ -61,7 +61,7 @@ MP_PROT_READ =0x1, /* Page can be read. */ MP_PROT_WRITE =0x2, /* Page can be written. */ MP_PROT_EXEC =0x4, /* Page can be executed. */ - MP_PROT_NONE =0x0, /* Page can not be accessed. */ + 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); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-01 15:53:59
|
Revision: 274 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=274&view=rev Author: nickols_k Date: 2012-11-01 15:53:52 +0000 (Thu, 01 Nov 2012) Log Message: ----------- cleanups and few memory leaks-- Modified Paths: -------------- mplayerxp/libmpconf/codec-cfg.c mplayerxp/libmpconf/codec-cfg.h mplayerxp/mplayer.c mplayerxp/osdep/mp_malloc.c mplayerxp/xmp_core.c Modified: mplayerxp/libmpconf/codec-cfg.c =================================================================== --- mplayerxp/libmpconf/codec-cfg.c 2012-11-01 14:02:30 UTC (rev 273) +++ mplayerxp/libmpconf/codec-cfg.c 2012-11-01 15:53:52 UTC (rev 274) @@ -389,6 +389,11 @@ static int nr_vcodecs = 0; static int nr_acodecs = 0; +void free_codec_cfg(void) { + if(video_codecs) mp_free(video_codecs); + if(audio_codecs) mp_free(audio_codecs); +} + int parse_codec_cfg(const char *cfgfile) { codecs_t *codec = NULL; // current codec Modified: mplayerxp/libmpconf/codec-cfg.h =================================================================== --- mplayerxp/libmpconf/codec-cfg.h 2012-11-01 14:02:30 UTC (rev 273) +++ mplayerxp/libmpconf/codec-cfg.h 2012-11-01 15:53:52 UTC (rev 274) @@ -61,5 +61,5 @@ extern codecs_t* find_codec(unsigned int fourcc,unsigned int *fourccmap,const codecs_t *start,int audioflag); extern void list_codecs(int audioflag); extern void codecs_reset_selection(int audioflag); - +extern void free_codec_cfg(void); #endif Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-01 14:02:30 UTC (rev 273) +++ mplayerxp/mplayer.c 2012-11-01 15:53:52 UTC (rev 274) @@ -230,9 +230,12 @@ } static void mpxp_uninit_structs(void) { + free_codec_cfg(); 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(1); @@ -640,6 +643,7 @@ priv->inited_flags&=~INITED_VO; MP_UNIT("uninit_vo"); vo_uninit(vo_data); + vo_data=NULL; } if(mask&INITED_ACODEC){ @@ -653,6 +657,7 @@ priv->inited_flags&=~INITED_AO; MP_UNIT("uninit_ao"); ao_uninit(ao_data); + ao_data=NULL; } if(mask&INITED_GETCH2){ Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-11-01 14:02:30 UTC (rev 273) +++ mplayerxp/osdep/mp_malloc.c 2012-11-01 15:53:52 UTC (rev 274) @@ -3,6 +3,7 @@ #define MSGT_CLASS MSGT_OSDEP #include "mp_msg.h" +#include <ctype.h> #include <string.h> #include <stdio.h> #include <stdlib.h> @@ -83,9 +84,9 @@ size_t idx=prot_find_slot_idx(ptr); if(idx!=UINT_MAX) { memmove(&priv->slots[idx],&priv->slots[idx+1],sizeof(mp_slot_t)*(priv->nslots-(idx+1))); - priv->slots=realloc(priv->slots,sizeof(mp_slot_t)*(priv->nslots-1)); priv->nslots--; - } + priv->slots=realloc(priv->slots,sizeof(mp_slot_t)*priv->nslots); + } else printf("Internal error! Can't find slot for address: %p\n",ptr); } static any_t* __prot_malloc(size_t size) { @@ -101,6 +102,8 @@ return rp; } +static any_t* __prot_memalign(size_t boundary,size_t size) { UNUSED(boundary); return __prot_malloc(size); } + static void __prot_free(any_t*ptr) { any_t *page_ptr=prot_page_align(ptr); free(page_ptr); @@ -137,6 +140,12 @@ return rp; } +static any_t* prot_memalign(size_t boundary,size_t size) { + any_t* rp; + rp=__prot_memalign(boundary,size); + return rp; +} + static any_t* prot_realloc(any_t*ptr,size_t size) { any_t* rp; rp=__prot_realloc(ptr,size); @@ -158,15 +167,36 @@ return rp; } +static __always_inline any_t* bt_memalign(size_t boundary,size_t size) { + any_t*rp; + mp_slot_t* slot; + rp=memalign(boundary,size); + if(rp) { + slot=prot_append_slot(rp,size); + slot->ncalls=backtrace(slot->calls,10); + } + return rp; +} + static __always_inline any_t* bt_realloc(any_t*ptr,size_t size) { - return realloc(ptr,size); + any_t* rp; + mp_slot_t* slot; + if(!ptr) return bt_malloc(size); + rp=realloc(ptr,size); + if(rp) { + slot=prot_find_slot(ptr); + if(!slot) MSG_WARN("Internal error! Can't find slot for address: %p\n",ptr); + else { + slot->page_ptr=rp; // update address after realloc + slot->size=size; + } + } + return rp; } static __always_inline void bt_free(any_t*ptr) { mp_slot_t* slot=prot_find_slot(ptr); - if(!slot) { - MSG_WARN("Internal error! Can't find slot for address: %p\n",ptr); - } + if(!slot) MSG_WARN("Internal error! Can't find slot for address: %p\n",ptr); prot_free_slot(ptr); free(ptr); } @@ -174,13 +204,28 @@ static void bt_print_slots(void) { size_t i,j; for(i=0;i<priv->nslots;i++) { - MSG_INFO("Alloc's address: %p size: %u bt_stack: %u\n",priv->slots[i].page_ptr,priv->slots[i].size,priv->slots[i].ncalls); + char *s; + int printable=1; + MSG_INFO("address: %p size: %u dump: ",priv->slots[i].page_ptr,priv->slots[i].size); + s=priv->slots[i].page_ptr; + for(j=0;j<min(priv->slots[i].size,20);j++) { + if(!isprint(s[j])) { + printable=0; + break; + } + } + if(printable) MSG_INFO("%20s",s); + else for(j=0;j<min(priv->slots[i].size,10);j++) { + MSG_INFO("%02X ",(unsigned char)s[j]); + } + MSG_INFO("\n"); for(j=0;j<priv->slots[i].ncalls;j++) { MSG_INFO(" %p\n",priv->slots[i].calls[j]); } } + MSG_HINT("For source lines print in (gdb): list *0xADDRESS\n"); } -/* ================== HEAD ======================= */ +/* ================== HEAD FUNCTIONS ======================= */ void mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags) { if(!priv) priv=malloc(sizeof(priv_t)); @@ -192,9 +237,14 @@ void mp_uninit_malloc(int verbose) { - if(priv->num_allocs && verbose) - MSG_WARN("Warning! From %lli total calls of alloc() were not freed %lli buffers\n",priv->total_calls,priv->num_allocs); - if(priv->flags&MPA_FLG_BACKTRACE) bt_print_slots(); + if(priv->flags&MPA_FLG_BACKTRACE) { + if(priv->nslots) + MSG_WARN("Warning! %lli slots were not freed\n",priv->nslots); + } else { + if(priv->num_allocs && verbose) + MSG_WARN("Warning! From %lli total calls of alloc() were not freed %lli buffers\n",priv->total_calls,priv->num_allocs); + } + if(priv->flags&MPA_FLG_BACKTRACE && verbose) bt_print_slots(); free(priv); priv=NULL; } @@ -221,6 +271,23 @@ return rb; } +/* randomizing of memalign is useless feature */ +any_t* mp_memalign (size_t boundary, size_t __size) +{ + any_t* rb; + if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); + if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) rb=prot_memalign(boundary,__size); + else if(priv->flags&MPA_FLG_BACKTRACE) rb=bt_memalign(boundary,__size); + else rb=memalign(boundary,__size); + priv->total_calls++; + priv->num_allocs++; + if(priv->enable_stat) { + priv->stat_total_calls++; + priv->stat_num_allocs++; + } + return rb; +} + any_t* mp_realloc(any_t*__ptr, size_t __size) { any_t* rp; if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) rp=prot_realloc(__ptr,__size); @@ -250,15 +317,6 @@ return rp; } -/* randomizing of memalign is useless feature */ -any_t* mp_memalign (size_t boundary, size_t __size) -{ - if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); - priv->num_allocs++; - if(priv->enable_stat) priv->stat_num_allocs++; - return memalign(boundary,__size); -} - char * mp_strdup(const char *src) { char *rs=NULL; if(src) { Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-11-01 14:02:30 UTC (rev 273) +++ mplayerxp/xmp_core.c 2012-11-01 15:53:52 UTC (rev 274) @@ -40,7 +40,11 @@ xp_core->initial_apts=HUGE; } -void xmp_uninit(void) { mp_free(xp_core); xp_core=NULL; } +void xmp_uninit(void) { + mp_free(xp_core->mpxp_threads[0]); + mp_free(xp_core); + xp_core=NULL; +} unsigned xmp_register_main(sig_handler_t sigfunc) { unsigned idx=0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-02 10:55:07
|
Revision: 280 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=280&view=rev Author: nickols_k Date: 2012-11-02 10:54:56 +0000 (Fri, 02 Nov 2012) Log Message: ----------- use ffmpeg's audio decoders as last hope Modified Paths: -------------- mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/mplayer.c Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2012-11-02 09:08:44 UTC (rev 279) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2012-11-02 10:54:56 UTC (rev 280) @@ -12,17 +12,51 @@ #include "help_mp.h" #include "osdep/bswap.h" #include "osdep/mplib.h" +#include "libmpconf/codec-cfg.h" #define FF_API_OLD_DECODE_AUDIO 1 #include "libavcodec/avcodec.h" +#include "libavformat/riff.h" #include "codecs_ld.h" +static int acodec_inited; + +struct codecs_st* __FASTCALL__ find_ffmpeg_audio(sh_audio_t* sh) { + unsigned i; + struct codecs_st* acodec = NULL; + const char *what="AVCodecID"; + enum AVCodecID id = ff_codec_get_id(ff_codec_wav_tags,sh->wtag); + if (id <= 0) { + prn_err: + MSG_ERR("Cannot find %s for for '0x%X' tag! Try force -ac option\n" + ,what + ,sh->wtag); + return 0; + } + if(!acodec_inited){ +// avcodec_init(); + avcodec_register_all(); + acodec_inited=1; + } + AVCodec *codec=avcodec_find_decoder(id); + if(!codec) { what="AVCodec"; goto prn_err; } + + acodec=mp_mallocz(sizeof(struct codecs_st)); + strcpy(acodec->dll_name,avcodec_get_name(id)); + strcpy(acodec->driver_name,"ffmpeg"); + strcpy(acodec->codec_name,acodec->dll_name); + if(codec->sample_fmts) + for(i=0;i<CODECS_MAX_OUTFMT;i++) { + if(codec->sample_fmts[i]==-1) break; + acodec->outfmt[i]=ff_codec_get_tag(ff_codec_wav_tags,codec->sample_fmts[i]); + } + return acodec; +} + #ifndef FF_INPUT_BUFFER_PADDING_SIZE #define FF_INPUT_BUFFER_PADDING_SIZE 8 #endif -static int acodec_inited; - static const ad_info_t info = { "FFmpeg/libavcodec audio decoders", Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-11-02 09:08:44 UTC (rev 279) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-11-02 10:54:56 UTC (rev 280) @@ -14,7 +14,6 @@ #include "libmpconf/codec-cfg.h" #include "dec_audio.h" -#include "ad.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" #include "mplayer.h" @@ -29,6 +28,16 @@ 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; +} + int mpca_init(sh_audio_t *sh_audio) { unsigned i; Modified: mplayerxp/libmpcodecs/dec_audio.h =================================================================== --- mplayerxp/libmpcodecs/dec_audio.h 2012-11-02 09:08:44 UTC (rev 279) +++ mplayerxp/libmpcodecs/dec_audio.h 2012-11-02 10:54:56 UTC (rev 280) @@ -1,11 +1,16 @@ #ifndef DEC_AUDIO_H_INCLUDED #define DEC_AUDIO_H_INCLUDED 1 +#include "ad.h" + // dec_audio.c: +extern const ad_functions_t* __FASTCALL__ mpca_find_driver(const char *name); extern int __FASTCALL__ 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 void __FASTCALL__ mpca_resync_stream(sh_audio_t *sh_audio); extern void __FASTCALL__ mpca_skip_frame(sh_audio_t *sh_audio); +struct codecs_st; +extern struct codecs_st* __FASTCALL__ find_ffmpeg_audio(sh_audio_t*); extern int mpca_init_filters(sh_audio_t *sh_audio, int in_samplerate, int in_channels, int in_format, int in_bps, Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-02 09:08:44 UTC (rev 279) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-02 10:54:56 UTC (rev 280) @@ -233,6 +233,7 @@ strcpy(sh->codec->dll_name,"ffmpeg"); strcpy(sh->codec->driver_name,"ffmpeg"); strcpy(sh->codec->codec_name,avcodec_get_name(id)); + if(codec->pix_fmts) for(i=0;i<CODECS_MAX_OUTFMT;i++) { if(codec->pix_fmts[i]==-1) break; sh->codec->outfmt[i]=avcodec_pix_fmt_to_codec_tag(codec->pix_fmts[i]); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-02 09:08:44 UTC (rev 279) +++ mplayerxp/mplayer.c 2012-11-02 10:54:56 UTC (rev 280) @@ -1864,6 +1864,7 @@ } static void mpxp_find_acodec(void) { + int found=0; priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; demux_stream_t *d_audio=priv->demuxer->audio; @@ -1871,7 +1872,6 @@ sh_audio->codec=NULL; if(mp_conf.audio_family) MSG_INFO(MSGTR_TryForceAudioFmt,mp_conf.audio_family); while(1) { - const char *fmt; sh_audio->codec=find_codec(sh_audio->wtag,NULL,sh_audio->codec,1); if(!sh_audio->codec) { if(mp_conf.audio_family) { @@ -1880,21 +1880,31 @@ mp_conf.audio_family=NULL; continue; } - 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("codecs.conf")); - sh_audio=d_audio->sh=NULL; 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; - 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); - break; + if(mpca_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; + } + 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("codecs.conf")); + sh_audio=d_audio->sh=NULL; + } } static int mpxp_find_vcodec(void) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-02 17:03:12
|
Revision: 285 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=285&view=rev Author: nickols_k Date: 2012-11-02 17:03:04 +0000 (Fri, 02 Nov 2012) Log Message: ----------- split XP_CORE into separate files Modified Paths: -------------- mplayerxp/Makefile mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/xmp_core.c mplayerxp/xmp_core.h mplayerxp/xmp_vplayer.c Added Paths: ----------- mplayerxp/xmp_adecoder.c mplayerxp/xmp_adecoder.h mplayerxp/xmp_aplayer.c mplayerxp/xmp_aplayer.h mplayerxp/xmp_vdecoder.c mplayerxp/xmp_vdecoder.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-02 16:03:16 UTC (rev 284) +++ mplayerxp/Makefile 2012-11-02 17:03:04 UTC (rev 285) @@ -25,7 +25,7 @@ SRCS_COMMON = mp_msg.c mp_image.c SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c -SRCS_MPLAYER+= xmp_core.c xmp_vplayer.c +SRCS_MPLAYER+= xmp_core.c xmp_aplayer.c xmp_vplayer.c xmp_vdecoder.c xmp_adecoder.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-02 16:03:16 UTC (rev 284) +++ mplayerxp/mplayer.c 2012-11-02 17:03:04 UTC (rev 285) @@ -74,6 +74,7 @@ #include "xmp_core.h" #include "xmp_vplayer.h" +#include "xmp_adecoder.h" #define MSGT_CLASS MSGT_CPLAYER #include "mp_msg.h" @@ -236,362 +237,6 @@ mp_uninit_malloc(mp_conf.verbose); } -/************************************************************************ - AUDIO XP-CORE! ToDo: rewrite it in packet-mode -************************************************************************/ -/* XP audio buffer */ -pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; -typedef struct audio_buffer_index_s { - float pts; - int index; -} audio_buffer_index_t; - -typedef struct audio_buffer_s { - unsigned char* buffer; - int head; - int tail; - unsigned len; - unsigned size; - int min_reserv; - int min_len; - int eof; - int HasReset; - int blocked_readers; - pthread_mutex_t head_mutex; - pthread_mutex_t tail_mutex; - pthread_cond_t wait_buffer_cond; - sh_audio_t *sh_audio; - - audio_buffer_index_t *indices; - int index_head; - int index_tail; - int index_len; -} audio_buffer_t; - -audio_buffer_t audio_buffer; - -int init_audio_buffer( int size, int min_reserv, int indices, sh_audio_t *sha ) -{ - MSG_V("Using audio buffer %i bytes (min reserve = %i, indices %i)\n",size,min_reserv, indices); - if( !(audio_buffer.buffer = mp_malloc(size)) ) - return ENOMEM; - if( !(audio_buffer.indices = mp_malloc(indices*sizeof(audio_buffer_index_t))) ) { - mp_free(audio_buffer.buffer); - audio_buffer.buffer=NULL; - return ENOMEM; - } - audio_buffer.index_len=indices; - audio_buffer.index_head=0; - audio_buffer.index_tail=0; - audio_buffer.head = 0; - audio_buffer.tail = 0; - audio_buffer.len = size; - audio_buffer.size = size; - audio_buffer.min_reserv = min_reserv; - audio_buffer.min_len = size/indices+1; - audio_buffer.eof = 0; - audio_buffer.HasReset = 0; - audio_buffer.blocked_readers = 0; - pthread_mutex_init( &audio_buffer.head_mutex, NULL); - pthread_mutex_init( &audio_buffer.tail_mutex, NULL); - pthread_cond_init( &audio_buffer.wait_buffer_cond, NULL); - audio_buffer.sh_audio = sha; - return 0; -} - -void uninit_audio_buffer(void) -{ - audio_buffer.eof = 1; - - if( audio_buffer.blocked_readers > 0 ) { /* Make blocked reader exit */ - int loops = 10; - pthread_cond_broadcast( &audio_buffer.wait_buffer_cond ); - while( audio_buffer.blocked_readers > 0 && loops > 0 ) { - usleep(1); - loops--; - } - if( audio_buffer.blocked_readers > 0 ) - MSG_V("uninit_audio_buffer: %d blocked readers did not wake up\n", - audio_buffer.blocked_readers); - } - - audio_buffer.index_len=0; - audio_buffer.index_head=0; - audio_buffer.index_tail=0; - audio_buffer.head = 0; - audio_buffer.tail = 0; - audio_buffer.len = 0; - audio_buffer.size = 0; - audio_buffer.min_reserv = 0; - audio_buffer.min_len = 0; - audio_buffer.HasReset = 0; - audio_buffer.blocked_readers = 0; - - pthread_mutex_lock( &audio_buffer.head_mutex ); - pthread_mutex_unlock( &audio_buffer.head_mutex ); - pthread_mutex_destroy( &audio_buffer.head_mutex ); - - pthread_mutex_lock( &audio_buffer.tail_mutex ); - pthread_mutex_unlock( &audio_buffer.tail_mutex ); - pthread_mutex_destroy( &audio_buffer.tail_mutex ); - - pthread_cond_destroy( &audio_buffer.wait_buffer_cond ); - - if( audio_buffer.buffer ) - mp_free( audio_buffer.buffer ); - audio_buffer.buffer = NULL; - - if( audio_buffer.indices ) - mp_free( audio_buffer.indices ); - audio_buffer.indices = NULL; - /* audio_buffer.sh_audio = ?; */ -} - -int read_audio_buffer( sh_audio_t *audio, unsigned char *buffer, unsigned minlen, unsigned maxlen, float *pts ) -{ - unsigned len = 0; - int l = 0; - int next_idx; - int head_idx; - int head_pos; - int head; - UNUSED(audio); - pthread_mutex_lock( &audio_buffer.tail_mutex ); - - while( len < minlen ) { - if( audio_buffer.tail == audio_buffer.head ) { - if( audio_buffer.eof ) { - break; - } - audio_buffer.blocked_readers++; - dec_ahead_can_aseek=1; /* Safe to seek while we wait for data */ - pthread_cond_wait(&audio_buffer.wait_buffer_cond, &audio_buffer.tail_mutex ); - dec_ahead_can_aseek=0; - audio_buffer.blocked_readers--; - if( audio_buffer.HasReset ) { - audio_buffer.HasReset = 0; - len = 0; - l =0; - } - continue; - } - - l = min( (int)(maxlen - len), audio_buffer.head - audio_buffer.tail ); - if(l<0) { - l = min( maxlen - len, audio_buffer.len - audio_buffer.tail ); - if( l == 0 ) { - if( audio_buffer.head != audio_buffer.tail ) - audio_buffer.tail = 0; - continue; - } - } - - memcpy( &buffer[len], &audio_buffer.buffer[audio_buffer.tail], l ); - len += l; - audio_buffer.tail += l; - if( audio_buffer.tail >= audio_buffer.len && audio_buffer.tail != audio_buffer.head ) - audio_buffer.tail = 0; - } - - if( len > 0 ) { /* get pts to return and calculate next pts */ - next_idx = (audio_buffer.index_tail+1)%audio_buffer.index_len; - head_idx = audio_buffer.index_head; - head_pos = audio_buffer.indices[(head_idx-1+audio_buffer.index_len)%audio_buffer.index_len].index; - head = audio_buffer.head; - if( next_idx != head_idx && audio_buffer.indices[next_idx].index == audio_buffer.indices[audio_buffer.index_tail].index ) { - audio_buffer.index_tail = next_idx; /* Buffer was empty */ - next_idx = (audio_buffer.index_tail+1)%audio_buffer.index_len; - } - *pts = audio_buffer.indices[audio_buffer.index_tail].pts; - - MSG_DBG3("audio_ahead: len %i, tail %i pts %.3f tail_idx %3i head_idx %3i head_pos %3i\n", len,audio_buffer.tail,*pts, audio_buffer.index_tail, head_idx, head_pos ); - while( next_idx != head_idx && - ((audio_buffer.tail <= head && - (audio_buffer.indices[next_idx].index <= audio_buffer.tail || - head_pos < audio_buffer.indices[next_idx].index)) || - (head < audio_buffer.indices[next_idx].index && - audio_buffer.indices[next_idx].index <= audio_buffer.tail))) { - MSG_DBG3("audio_ahead: next_idx %3i index %3i \n", next_idx, audio_buffer.indices[next_idx].index); - next_idx=(next_idx+1)%audio_buffer.index_len; - } - audio_buffer.index_tail = (next_idx-1+audio_buffer.index_len)%audio_buffer.index_len; - if( audio_buffer.indices[audio_buffer.index_tail].index != audio_buffer.tail ) { - int buff_len = audio_buffer.len; - MSG_DBG3("audio_ahead: orig idx %3i pts %.3f pos %i \n",audio_buffer.index_tail, audio_buffer.indices[audio_buffer.index_tail].pts,audio_buffer.indices[audio_buffer.index_tail].index ); - audio_buffer.indices[audio_buffer.index_tail].pts += (float)((audio_buffer.tail - audio_buffer.indices[audio_buffer.index_tail].index + buff_len) % buff_len) / (float)audio_buffer.sh_audio->af_bps; - audio_buffer.indices[audio_buffer.index_tail].index = audio_buffer.tail; - MSG_DBG3("audio_ahead: read next_idx %3i next_pts %.3f pos %i \n", audio_buffer.index_tail,audio_buffer.indices[audio_buffer.index_tail].pts,audio_buffer.indices[audio_buffer.index_tail].index ); - } - } - - pthread_mutex_unlock( &audio_buffer.tail_mutex ); - - return len; -} - -float get_delay_audio_buffer(void) -{ - int delay = audio_buffer.head - audio_buffer.tail; - if( delay < 0 ) - delay += audio_buffer.len; - return (float)delay / (float)audio_buffer.sh_audio->af_bps; -} - -int decode_audio_buffer(unsigned len) -{ - priv_t*priv=mp_data->priv; - demux_stream_t *d_audio=priv->demuxer->audio; - int ret, blen, l, l2; - int next_idx; - unsigned int t; - - pthread_mutex_lock( &audio_buffer.head_mutex ); - - t = GetTimer(); - if (len < audio_buffer.sh_audio->audio_out_minsize) - len = audio_buffer.sh_audio->audio_out_minsize; - - if( audio_buffer.size - audio_buffer.head <= audio_buffer.min_reserv ) { - if( audio_buffer.tail == 0 ) { - pthread_mutex_unlock( &audio_buffer.head_mutex ); - return 0; - } - audio_buffer.len = audio_buffer.head; - audio_buffer.head = 0; - len = min( len, audio_buffer.tail - audio_buffer.head - audio_buffer.min_reserv); - if( len < audio_buffer.sh_audio->audio_out_minsize ) { - pthread_mutex_unlock( &audio_buffer.head_mutex ); - return 0; - } - } - - blen = audio_buffer.size - audio_buffer.head; - if( (l = (blen - audio_buffer.min_reserv)) < len ) { - len = max(l,audio_buffer.sh_audio->audio_out_minsize); - } - - if( (l = (audio_buffer.tail - audio_buffer.head)) > 0 ) { - blen = l; - l -= audio_buffer.min_reserv; - if( l < len ) { - len = l; - if( len < audio_buffer.sh_audio->audio_out_minsize ) { - pthread_mutex_unlock( &audio_buffer.head_mutex ); - return 0; - } - } - } - MSG_DBG3("decode audio %d h %d, t %d, l %d \n", len, audio_buffer.head, audio_buffer.tail, audio_buffer.len); - - 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); - if( ret <= 0 ) - break; - - next_idx = (audio_buffer.index_head+1)%audio_buffer.index_len; - if( next_idx != audio_buffer.index_tail ) { - MSG_DBG3("decode audio idx %3i tail %3i next pts %.3f %i\n",audio_buffer.index_head, audio_buffer.index_tail, pts, audio_buffer.head ); - audio_buffer.indices[audio_buffer.index_head].pts = pts; - audio_buffer.indices[audio_buffer.index_head].index = audio_buffer.head; - audio_buffer.index_head = next_idx; - } - audio_buffer.head+=ret; - MSG_DBG3("new head %6d \n", audio_buffer.head); - l += ret; - l2 -= ret; - blen -= ret; - } - MSG_DBG2("decoded audio %d diff %d\n", l, l - len); - - if( ret <= 0 && d_audio->eof) { - MSG_V("audio eof\n"); - audio_buffer.eof=1; - pthread_mutex_unlock( &audio_buffer.head_mutex ); - pthread_mutex_lock( &audio_buffer.tail_mutex ); - pthread_cond_broadcast( &audio_buffer.wait_buffer_cond ); - pthread_mutex_unlock( &audio_buffer.tail_mutex ); - return 0; - } - - if( audio_buffer.head > audio_buffer.len ) - audio_buffer.len=audio_buffer.head; - if( audio_buffer.head >= audio_buffer.size && audio_buffer.tail > 0 ) - audio_buffer.head = 0; - - 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; - 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; - } - - pthread_mutex_unlock( &audio_buffer.head_mutex ); - - - blen = audio_buffer.head - audio_buffer.tail; - if( blen < 0 ) - blen += audio_buffer.len; - if( blen < MAX_OUTBURST ) { - return 2; - } - return 1; -} - -void reset_audio_buffer(void) -{ - pthread_mutex_lock( &audio_buffer.head_mutex ); - pthread_mutex_lock( &audio_buffer.tail_mutex ); - - audio_buffer.tail = audio_buffer.head; - audio_buffer.len = audio_buffer.size; - audio_buffer.eof = 0; - audio_buffer.HasReset = 1; - audio_buffer.index_tail = audio_buffer.index_head; - - pthread_mutex_unlock( &audio_buffer.tail_mutex ); - pthread_mutex_unlock( &audio_buffer.head_mutex ); -} - -int get_len_audio_buffer(void) -{ - int len = audio_buffer.head - audio_buffer.tail; - if( len < 0 ) - len += audio_buffer.len; - return len; -} - -int get_free_audio_buffer(void) -{ - int len; - - if( audio_buffer.eof ) - return -1; - - if( audio_buffer.size - audio_buffer.head < audio_buffer.min_reserv && - audio_buffer.tail > 0 ) { - pthread_mutex_lock( &audio_buffer.head_mutex ); - audio_buffer.len = audio_buffer.head; - audio_buffer.head = 0; - pthread_mutex_unlock( &audio_buffer.head_mutex ); - } - - len = audio_buffer.tail - audio_buffer.head; - if( len <= 0 ) - len += audio_buffer.size; - len -= audio_buffer.min_reserv; - - if( len <= 0 ) - return 0; - - return len; -} - - void uninit_player(unsigned int mask){ priv_t*priv=mp_data->priv; stream_t* stream=NULL; @@ -713,7 +358,6 @@ return; /* Still try coredump!!!*/ } - static void soft_exit_player(void) { priv_t*priv=mp_data->priv; @@ -973,119 +617,6 @@ list_codecs(1); } -int decore_audio( unsigned _xp_id ) -{ - 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 eof = 0; -/*========================== PLAY AUDIO ============================*/ -while(sh_audio){ - unsigned int t; - double tt; - int playsize; - float pts=HUGE; - int ret=0; - - ao_data->pts=sh_audio->timer*90000.0; - playsize=ao_get_space(ao_data); - - if(!playsize) { - if(sh_video) - break; // buffer is full, do not block here!!! - usec_sleep(10000); // Wait a tick before retry - continue; - } - - if(playsize>MAX_OUTBURST) playsize=MAX_OUTBURST; // we shouldn't exceed it! - //if(playsize>outburst) playsize=outburst; - - // Update buffer if needed - MP_UNIT("mpca_decode"); // Enter AUDIO decoder module - t=GetTimer(); - while(sh_audio->a_buffer_len<playsize && !xp_core->audio->eof){ - if(mp_conf.xp>=XP_VideoAudio) { - 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], - 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; - else { - if(!d_audio->eof) - break; - if(!sh_video) - eof = PT_NEXT_ENTRY; - else - { - MSG_V("audio_stream_eof\n"); - priv->inited_flags&=~INITED_AO; - MP_UNIT("uninit_ao"); - ao_uninit(ao_data); - } - xp_core->audio->eof=1; - break; - } - } - MP_UNIT("play_audio"); // Leave AUDIO decoder module - t=GetTimer()-t; - tt = t*0.000001f; - mp_data->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(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; - - if(mp_conf.xp>=XP_VAPlay) dec_ahead_audio_delay=ao_get_delay(ao_data); - - playsize=ao_play(ao_data,sh_audio->a_buffer,playsize,0); - - if(playsize>0){ - sh_audio->a_buffer_len-=playsize; - memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); - if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) - pthread_mutex_lock(&audio_timer_mutex); - if(mp_data->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) { - sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - } else { - sh_audio->timer=sh_audio->a_pts-(float)sh_audio->a_pts_pos/(float)sh_audio->af_bps; - MSG_V("Audio chapter change detected\n"); - sh_audio->chapter_change=1; - sh_audio->a_pts = HUGE; - } - } else if(pts != HUGE) { - if(pts < 1.0 && sh_audio->timer > 2.0) { - sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - sh_audio->a_pts=pts; - sh_audio->a_pts_pos=sh_audio->a_buffer_len-ret; - } else { - sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); - sh_audio->a_pts=HUGE; - } - } else - sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - } else if(mp_conf.av_sync_pts && pts!=HUGE) - sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); - else - sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) - pthread_mutex_unlock(&audio_timer_mutex); - } - - break; - } // if(sh_audio) - return eof; -} - #ifdef USE_OSD //================= Update OSD ==================== @@ -2484,8 +2015,7 @@ if(mp_conf.play_n_frames<0) eof = PT_NEXT_ENTRY; } - if( mp_conf.xp < XP_VAPlay ) - eof |= decore_audio(main_id); + eof |= xp_core->audio->eof; /*========================== UPDATE TIMERS ============================*/ MP_UNIT("Update timers"); if(!sh_video) { Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-11-02 16:03:16 UTC (rev 284) +++ mplayerxp/mplayer.h 2012-11-02 17:03:04 UTC (rev 285) @@ -114,7 +114,6 @@ extern void update_osd( float v_pts ); -extern float get_delay_audio_buffer(void); extern pthread_mutex_t audio_timer_mutex; extern void exit_player(char* how); Added: mplayerxp/xmp_adecoder.c =================================================================== --- mplayerxp/xmp_adecoder.c (rev 0) +++ mplayerxp/xmp_adecoder.c 2012-11-02 17:03:04 UTC (rev 285) @@ -0,0 +1,520 @@ +#include "mplayer.h" +#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 <errno.h> +#include <stdio.h> +#include <unistd.h> // for usleep() +#include <math.h> + +#ifdef ENABLE_DEC_AHEAD_DEBUG +#define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) +#else +#define MSG_T(args...) +#endif + +extern int get_free_audio_buffer(void); + +/************************************************************************ + AUDIO XP-CORE! ToDo: rewrite it in packet-mode +************************************************************************/ +/* XP audio buffer */ +pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; +typedef struct audio_buffer_index_s { + float pts; + int index; +} audio_buffer_index_t; + +typedef struct audio_buffer_s { + unsigned char* buffer; + int head; + int tail; + unsigned len; + unsigned size; + int min_reserv; + int min_len; + int eof; + int HasReset; + int blocked_readers; + pthread_mutex_t head_mutex; + pthread_mutex_t tail_mutex; + pthread_cond_t wait_buffer_cond; + sh_audio_t *sh_audio; + + audio_buffer_index_t *indices; + int index_head; + int index_tail; + int index_len; +} audio_buffer_t; + +audio_buffer_t audio_buffer; + +int init_audio_buffer( int size, int min_reserv, int indices, sh_audio_t *sha ) +{ + MSG_V("Using audio buffer %i bytes (min reserve = %i, indices %i)\n",size,min_reserv, indices); + if( !(audio_buffer.buffer = mp_malloc(size)) ) + return ENOMEM; + if( !(audio_buffer.indices = mp_malloc(indices*sizeof(audio_buffer_index_t))) ) { + mp_free(audio_buffer.buffer); + audio_buffer.buffer=NULL; + return ENOMEM; + } + audio_buffer.index_len=indices; + audio_buffer.index_head=0; + audio_buffer.index_tail=0; + audio_buffer.head = 0; + audio_buffer.tail = 0; + audio_buffer.len = size; + audio_buffer.size = size; + audio_buffer.min_reserv = min_reserv; + audio_buffer.min_len = size/indices+1; + audio_buffer.eof = 0; + audio_buffer.HasReset = 0; + audio_buffer.blocked_readers = 0; + pthread_mutex_init( &audio_buffer.head_mutex, NULL); + pthread_mutex_init( &audio_buffer.tail_mutex, NULL); + pthread_cond_init( &audio_buffer.wait_buffer_cond, NULL); + audio_buffer.sh_audio = sha; + return 0; +} + +void uninit_audio_buffer(void) +{ + audio_buffer.eof = 1; + + if( audio_buffer.blocked_readers > 0 ) { /* Make blocked reader exit */ + int loops = 10; + pthread_cond_broadcast( &audio_buffer.wait_buffer_cond ); + while( audio_buffer.blocked_readers > 0 && loops > 0 ) { + usleep(1); + loops--; + } + if( audio_buffer.blocked_readers > 0 ) + MSG_V("uninit_audio_buffer: %d blocked readers did not wake up\n", + audio_buffer.blocked_readers); + } + + audio_buffer.index_len=0; + audio_buffer.index_head=0; + audio_buffer.index_tail=0; + audio_buffer.head = 0; + audio_buffer.tail = 0; + audio_buffer.len = 0; + audio_buffer.size = 0; + audio_buffer.min_reserv = 0; + audio_buffer.min_len = 0; + audio_buffer.HasReset = 0; + audio_buffer.blocked_readers = 0; + + pthread_mutex_lock( &audio_buffer.head_mutex ); + pthread_mutex_unlock( &audio_buffer.head_mutex ); + pthread_mutex_destroy( &audio_buffer.head_mutex ); + + pthread_mutex_lock( &audio_buffer.tail_mutex ); + pthread_mutex_unlock( &audio_buffer.tail_mutex ); + pthread_mutex_destroy( &audio_buffer.tail_mutex ); + + pthread_cond_destroy( &audio_buffer.wait_buffer_cond ); + + if( audio_buffer.buffer ) + mp_free( audio_buffer.buffer ); + audio_buffer.buffer = NULL; + + if( audio_buffer.indices ) + mp_free( audio_buffer.indices ); + audio_buffer.indices = NULL; + /* audio_buffer.sh_audio = ?; */ +} + +int read_audio_buffer( sh_audio_t *audio, unsigned char *buffer, unsigned minlen, unsigned maxlen, float *pts ) +{ + unsigned len = 0; + int l = 0; + int next_idx; + int head_idx; + int head_pos; + int head; + UNUSED(audio); + pthread_mutex_lock( &audio_buffer.tail_mutex ); + + while( len < minlen ) { + if( audio_buffer.tail == audio_buffer.head ) { + if( audio_buffer.eof ) { + break; + } + audio_buffer.blocked_readers++; + dec_ahead_can_aseek=1; /* Safe to seek while we wait for data */ + pthread_cond_wait(&audio_buffer.wait_buffer_cond, &audio_buffer.tail_mutex ); + dec_ahead_can_aseek=0; + audio_buffer.blocked_readers--; + if( audio_buffer.HasReset ) { + audio_buffer.HasReset = 0; + len = 0; + l =0; + } + continue; + } + + l = min( (int)(maxlen - len), audio_buffer.head - audio_buffer.tail ); + if(l<0) { + l = min( maxlen - len, audio_buffer.len - audio_buffer.tail ); + if( l == 0 ) { + if( audio_buffer.head != audio_buffer.tail ) + audio_buffer.tail = 0; + continue; + } + } + + memcpy( &buffer[len], &audio_buffer.buffer[audio_buffer.tail], l ); + len += l; + audio_buffer.tail += l; + if( audio_buffer.tail >= audio_buffer.len && audio_buffer.tail != audio_buffer.head ) + audio_buffer.tail = 0; + } + + if( len > 0 ) { /* get pts to return and calculate next pts */ + next_idx = (audio_buffer.index_tail+1)%audio_buffer.index_len; + head_idx = audio_buffer.index_head; + head_pos = audio_buffer.indices[(head_idx-1+audio_buffer.index_len)%audio_buffer.index_len].index; + head = audio_buffer.head; + if( next_idx != head_idx && audio_buffer.indices[next_idx].index == audio_buffer.indices[audio_buffer.index_tail].index ) { + audio_buffer.index_tail = next_idx; /* Buffer was empty */ + next_idx = (audio_buffer.index_tail+1)%audio_buffer.index_len; + } + *pts = audio_buffer.indices[audio_buffer.index_tail].pts; + + MSG_DBG3("audio_ahead: len %i, tail %i pts %.3f tail_idx %3i head_idx %3i head_pos %3i\n", len,audio_buffer.tail,*pts, audio_buffer.index_tail, head_idx, head_pos ); + while( next_idx != head_idx && + ((audio_buffer.tail <= head && + (audio_buffer.indices[next_idx].index <= audio_buffer.tail || + head_pos < audio_buffer.indices[next_idx].index)) || + (head < audio_buffer.indices[next_idx].index && + audio_buffer.indices[next_idx].index <= audio_buffer.tail))) { + MSG_DBG3("audio_ahead: next_idx %3i index %3i \n", next_idx, audio_buffer.indices[next_idx].index); + next_idx=(next_idx+1)%audio_buffer.index_len; + } + audio_buffer.index_tail = (next_idx-1+audio_buffer.index_len)%audio_buffer.index_len; + if( audio_buffer.indices[audio_buffer.index_tail].index != audio_buffer.tail ) { + int buff_len = audio_buffer.len; + MSG_DBG3("audio_ahead: orig idx %3i pts %.3f pos %i \n",audio_buffer.index_tail, audio_buffer.indices[audio_buffer.index_tail].pts,audio_buffer.indices[audio_buffer.index_tail].index ); + audio_buffer.indices[audio_buffer.index_tail].pts += (float)((audio_buffer.tail - audio_buffer.indices[audio_buffer.index_tail].index + buff_len) % buff_len) / (float)audio_buffer.sh_audio->af_bps; + audio_buffer.indices[audio_buffer.index_tail].index = audio_buffer.tail; + MSG_DBG3("audio_ahead: read next_idx %3i next_pts %.3f pos %i \n", audio_buffer.index_tail,audio_buffer.indices[audio_buffer.index_tail].pts,audio_buffer.indices[audio_buffer.index_tail].index ); + } + } + + pthread_mutex_unlock( &audio_buffer.tail_mutex ); + + return len; +} + +float get_delay_audio_buffer(void) +{ + int delay = audio_buffer.head - audio_buffer.tail; + if( delay < 0 ) + delay += audio_buffer.len; + return (float)delay / (float)audio_buffer.sh_audio->af_bps; +} + +int decode_audio_buffer(demux_stream_t *d_audio,unsigned len) +{ + int ret, blen, l, l2; + int next_idx; + unsigned int t; + + pthread_mutex_lock( &audio_buffer.head_mutex ); + + t = GetTimer(); + if (len < audio_buffer.sh_audio->audio_out_minsize) + len = audio_buffer.sh_audio->audio_out_minsize; + + if( audio_buffer.size - audio_buffer.head <= audio_buffer.min_reserv ) { + if( audio_buffer.tail == 0 ) { + pthread_mutex_unlock( &audio_buffer.head_mutex ); + return 0; + } + audio_buffer.len = audio_buffer.head; + audio_buffer.head = 0; + len = min( len, audio_buffer.tail - audio_buffer.head - audio_buffer.min_reserv); + if( len < audio_buffer.sh_audio->audio_out_minsize ) { + pthread_mutex_unlock( &audio_buffer.head_mutex ); + return 0; + } + } + + blen = audio_buffer.size - audio_buffer.head; + if( (l = (blen - audio_buffer.min_reserv)) < len ) { + len = max(l,audio_buffer.sh_audio->audio_out_minsize); + } + + if( (l = (audio_buffer.tail - audio_buffer.head)) > 0 ) { + blen = l; + l -= audio_buffer.min_reserv; + if( l < len ) { + len = l; + if( len < audio_buffer.sh_audio->audio_out_minsize ) { + pthread_mutex_unlock( &audio_buffer.head_mutex ); + return 0; + } + } + } + MSG_DBG3("decode audio %d h %d, t %d, l %d \n", len, audio_buffer.head, audio_buffer.tail, audio_buffer.len); + + 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); + if( ret <= 0 ) + break; + + next_idx = (audio_buffer.index_head+1)%audio_buffer.index_len; + if( next_idx != audio_buffer.index_tail ) { + MSG_DBG3("decode audio idx %3i tail %3i next pts %.3f %i\n",audio_buffer.index_head, audio_buffer.index_tail, pts, audio_buffer.head ); + audio_buffer.indices[audio_buffer.index_head].pts = pts; + audio_buffer.indices[audio_buffer.index_head].index = audio_buffer.head; + audio_buffer.index_head = next_idx; + } + audio_buffer.head+=ret; + MSG_DBG3("new head %6d \n", audio_buffer.head); + l += ret; + l2 -= ret; + blen -= ret; + } + MSG_DBG2("decoded audio %d diff %d\n", l, l - len); + + if( ret <= 0 && d_audio->eof) { + MSG_V("audio eof\n"); + audio_buffer.eof=1; + pthread_mutex_unlock( &audio_buffer.head_mutex ); + pthread_mutex_lock( &audio_buffer.tail_mutex ); + pthread_cond_broadcast( &audio_buffer.wait_buffer_cond ); + pthread_mutex_unlock( &audio_buffer.tail_mutex ); + return 0; + } + + if( audio_buffer.head > audio_buffer.len ) + audio_buffer.len=audio_buffer.head; + if( audio_buffer.head >= audio_buffer.size && audio_buffer.tail > 0 ) + audio_buffer.head = 0; + + 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; + 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; + } + + pthread_mutex_unlock( &audio_buffer.head_mutex ); + + + blen = audio_buffer.head - audio_buffer.tail; + if( blen < 0 ) + blen += audio_buffer.len; + if( blen < MAX_OUTBURST ) { + return 2; + } + return 1; +} + +void reset_audio_buffer(void) +{ + pthread_mutex_lock( &audio_buffer.head_mutex ); + pthread_mutex_lock( &audio_buffer.tail_mutex ); + + audio_buffer.tail = audio_buffer.head; + audio_buffer.len = audio_buffer.size; + audio_buffer.eof = 0; + audio_buffer.HasReset = 1; + audio_buffer.index_tail = audio_buffer.index_head; + + pthread_mutex_unlock( &audio_buffer.tail_mutex ); + pthread_mutex_unlock( &audio_buffer.head_mutex ); +} + +int get_len_audio_buffer(void) +{ + int len = audio_buffer.head - audio_buffer.tail; + if( len < 0 ) + len += audio_buffer.len; + return len; +} + +int get_free_audio_buffer(void) +{ + int len; + + if( audio_buffer.eof ) + return -1; + + if( audio_buffer.size - audio_buffer.head < audio_buffer.min_reserv && + audio_buffer.tail > 0 ) { + pthread_mutex_lock( &audio_buffer.head_mutex ); + audio_buffer.len = audio_buffer.head; + audio_buffer.head = 0; + pthread_mutex_unlock( &audio_buffer.head_mutex ); + } + + len = audio_buffer.tail - audio_buffer.head; + if( len <= 0 ) + len += audio_buffer.size; + len -= audio_buffer.min_reserv; + + if( len <= 0 ) + return 0; + + return len; +} + + +/* Audio stuff */ +volatile float dec_ahead_audio_delay; +int xp_thread_decode_audio(demux_stream_t *d_audio) +{ + sh_audio_t* sh_audio=xp_core->audio->sh; + sh_video_t* sh_video=NULL; + if(xp_core->video) sh_video=xp_core->video->sh; + int free_buf, vbuf_size, pref_buf; + unsigned len=0; + + free_buf = get_free_audio_buffer(); + + if( free_buf == -1 ) { /* End of file */ + xp_core->audio->eof = 1; + return 0; + } + if( free_buf < (int)sh_audio->audio_out_minsize ) /* full */ + return 0; + + len = get_len_audio_buffer(); + + if( len < MAX_OUTBURST ) /* Buffer underrun */ + return decode_audio_buffer(d_audio,MAX_OUTBURST); + + if(xp_core->video) { + /* Match video buffer */ + vbuf_size = dae_get_decoder_outrun(xp_core->video); + pref_buf = vbuf_size / sh_video->fps * sh_audio->af_bps; + pref_buf -= len; + if( pref_buf > 0 ) { + len = min( pref_buf, free_buf ); + if( len > sh_audio->audio_out_minsize ) { + return decode_audio_buffer(d_audio,len); + } + } + } else + return decode_audio_buffer(d_audio,min(free_buf,MAX_OUTBURST)); + + return 0; +} + +static volatile int dec_ahead_can_adseek=1; /* It is safe to seek audio buffer thread */ +/* this routine decodes audio only */ +any_t* a_dec_ahead_routine( any_t* arg ) +{ + mpxp_thread_t* priv=arg; + sh_audio_t* sh_audio=priv->dae->sh; + demux_stream_t *d_audio=sh_audio->ds; + + int ret, retval; + struct timeval now; + struct timespec timeout; + float d; + + priv->state=Pth_Run; + if(xp_core->video) xp_core->video->eof=0; + xp_core->audio->eof=0; + MSG_T("\nDEC_AHEAD: entering...\n"); + priv->pid = getpid(); + __MP_UNIT(priv->p_idx,"dec_ahead"); + + dec_ahead_can_adseek=0; + while(priv->state!=Pth_Canceling) { + if(priv->state==Pth_Sleep) { + priv->state=Pth_ASleep; + while(priv->state==Pth_ASleep) usleep(0); + continue; + } + __MP_UNIT(priv->p_idx,"decode audio"); + while((ret = xp_thread_decode_audio(d_audio)) == 2) {/* Almost empty buffer */ + if(xp_core->audio->eof) break; + } + dec_ahead_can_adseek=1; + + if(priv->state==Pth_Canceling) break; + + __MP_UNIT(priv->p_idx,"sleep"); + LOCK_AUDIO_DECODE(); + if(priv->state!=Pth_Canceling) { + if(xp_core->audio->eof) { + __MP_UNIT(priv->p_idx,"wait end of work"); + pthread_cond_wait( &audio_decode_cond, &audio_decode_mutex ); + } else if(ret==0) { /* Full buffer or end of file */ + if(audio_play_in_sleep) { /* Sleep a little longer than player thread */ + timeout.tv_nsec = audio_play_timeout.tv_nsec + 10000; + if( timeout.tv_nsec > 1000000000l ) { + timeout.tv_nsec-=1000000000l; + timeout.tv_sec = audio_play_timeout.tv_sec; + } else + timeout.tv_sec = audio_play_timeout.tv_sec; + } else { + if(xp_core->in_pause) + d = 1.0; + else + d = 0.1; + gettimeofday(&now,NULL); + timeout.tv_nsec = now.tv_usec * 1000 + d*1000000000l; + if( timeout.tv_nsec > 1000000000l ) { + timeout.tv_nsec-=1000000000l; + timeout.tv_sec = now.tv_sec + 1; + } else + timeout.tv_sec = now.tv_sec; + } + pthread_cond_timedwait( &audio_decode_cond, &audio_decode_mutex, &timeout ); + } else + usleep(1); + } + UNLOCK_AUDIO_DECODE(); + + if(priv->state==Pth_Canceling) break; + + __MP_UNIT(priv->p_idx,"seek"); + LOCK_AUDIO_DECODE(); +#if 0 + while(priv->state==Pth_Sleep && priv->state!=Pth_Canceling) { + gettimeofday(&now,NULL); + timeout.tv_nsec = now.tv_usec * 1000; + timeout.tv_sec = now.tv_sec + 1; + retval = pthread_cond_timedwait( &audio_decode_cond, &audio_decode_mutex, &timeout ); + if( retval == ETIMEDOUT ) + MSG_V("Audio decode seek timeout\n"); + } +#endif + dec_ahead_can_adseek = 0; /* Not safe to seek */ + UNLOCK_AUDIO_DECODE(); + } + __MP_UNIT(priv->p_idx,"exit"); + dec_ahead_can_adseek = 1; + priv->state=Pth_Stand; + return arg; /* terminate thread here !!! */ +} + +void sig_audio_decode( void ) +{ + MSG_T("sig_audio_decode\n"); + mp_msg_flush(); + + dec_ahead_can_adseek=1; + + UNLOCK_AUDIO_DECODE(); + + xmp_killall_threads(pthread_self()); + __exit_sighandler(); +} Property changes on: mplayerxp/xmp_adecoder.c ___________________________________________________________________ Added: svn:eol-style + native Added: mplayerxp/xmp_adecoder.h =================================================================== --- mplayerxp/xmp_adecoder.h (rev 0) +++ mplayerxp/xmp_adecoder.h 2012-11-02 17:03:04 UTC (rev 285) @@ -0,0 +1,14 @@ +#ifndef XMP_ADECODER_H_INCLUDED +#define XMP_ADECODER_H_INCLUDED 1 + +extern int get_len_audio_buffer(void); +extern float get_delay_audio_buffer(void); +extern int init_audio_buffer(int size, int min_reserv, int indices, sh_audio_t *sh_audio); +extern void uninit_audio_buffer(void); +extern void reset_audio_buffer(void); +extern int read_audio_buffer(sh_audio_t *audio, unsigned char *buffer, unsigned minlen, unsigned maxlen, float *pts ); + +extern any_t* a_dec_ahead_routine( any_t* arg ); +extern void sig_audio_decode( void ); +extern int xp_thread_decode_audio(demux_stream_t *d_audio); +#endif Property changes on: mplayerxp/xmp_adecoder.h ___________________________________________________________________ Added: svn:eol-style + native Added: mplayerxp/xmp_aplayer.c =================================================================== --- mplayerxp/xmp_aplayer.c (rev 0) +++ mplayerxp/xmp_aplayer.c 2012-11-02 17:03:04 UTC (rev 285) @@ -0,0 +1,297 @@ +#include "mplayer.h" +#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 <stdio.h> +#include <unistd.h> // for usleep() +#include <pthread.h> +#include <math.h> + +#ifdef ENABLE_DEC_AHEAD_DEBUG +#define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) +#else +#define MSG_T(args...) +#endif + +#define MIN_AUDIO_TIME 0.05 +#define NOTHING_PLAYED (-1.0) +#define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ + +extern ao_data_t*ao_data; + +static int decore_audio(demux_stream_t *d_audio,sh_audio_t* sh_audio,sh_video_t*sh_video,unsigned _xp_id ) +{ + int eof = 0; +/*========================== PLAY AUDIO ============================*/ +while(sh_audio){ + unsigned int t; + double tt; + int playsize; + float pts=HUGE; + int ret=0; + + ao_data->pts=sh_audio->timer*90000.0; + playsize=ao_get_space(ao_data); + + if(!playsize) { + if(sh_video) + break; // buffer is full, do not block here!!! + usec_sleep(10000); // Wait a tick before retry + continue; + } + + if(playsize>MAX_OUTBURST) playsize=MAX_OUTBURST; // we shouldn't exceed it! + //if(playsize>outburst) playsize=outburst; + + // Update buffer if needed + MP_UNIT("mpca_decode"); // Enter AUDIO decoder module + t=GetTimer(); + while(sh_audio->a_buffer_len<playsize && !xp_core->audio->eof){ + if(mp_conf.xp>=XP_VideoAudio) { + 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], + 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; + else { + if(!d_audio->eof) break; + xp_core->audio->eof=1; + break; + } + } + MP_UNIT("play_audio"); // Leave AUDIO decoder module + t=GetTimer()-t; + tt = t*0.000001f; + mp_data->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(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; + + if(mp_conf.xp>=XP_VAPlay) dec_ahead_audio_delay=ao_get_delay(ao_data); + + playsize=ao_play(ao_data,sh_audio->a_buffer,playsize,0); + + if(playsize>0){ + sh_audio->a_buffer_len-=playsize; + memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); + if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) + pthread_mutex_lock(&audio_timer_mutex); + if(mp_data->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) { + sh_audio->timer+=playsize/(float)(sh_audio->af_bps); + } else { + sh_audio->timer=sh_audio->a_pts-(float)sh_audio->a_pts_pos/(float)sh_audio->af_bps; + MSG_V("Audio chapter change detected\n"); + sh_audio->chapter_change=1; + sh_audio->a_pts = HUGE; + } + } else if(pts != HUGE) { + if(pts < 1.0 && sh_audio->timer > 2.0) { + sh_audio->timer+=playsize/(float)(sh_audio->af_bps); + sh_audio->a_pts=pts; + sh_audio->a_pts_pos=sh_audio->a_buffer_len-ret; + } else { + sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); + sh_audio->a_pts=HUGE; + } + } else + sh_audio->timer+=playsize/(float)(sh_audio->af_bps); + } else if(mp_conf.av_sync_pts && pts!=HUGE) + sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); + else + sh_audio->timer+=playsize/(float)(sh_audio->af_bps); + if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) + pthread_mutex_unlock(&audio_timer_mutex); + } + + break; + } // if(sh_audio) + return eof; +} + + +extern ao_data_t* ao_data; +any_t* audio_play_routine( any_t* arg ) +{ + mpxp_thread_t* priv=arg; + sh_audio_t* sh_audio=priv->dae->sh; + demux_stream_t *d_audio=sh_audio->ds; + demuxer_t *demuxer=d_audio->demuxer; + sh_video_t* sh_video=demuxer->video->sh; + + int eof = 0; + struct timeval now; + struct timespec timeout; + float d; + int retval; + const float MAX_AUDIO_TIME = (float)ao_get_space(ao_data) / sh_audio->af_bps + ao_get_delay(ao_data); + float min_audio_time = MAX_AUDIO_TIME; + float min_audio, max_audio; + int samples, collect_samples; + float audio_buff_max, audio_buff_norm, audio_buff_min, audio_buff_alert; + + audio_buff_alert = max(XP_MIN_TIMESLICE, min(MIN_AUDIO_TIME,MAX_AUDIO_TIME/4)); + audio_buff_max = max(audio_buff_alert, min(MAX_AUDIO_TIME-XP_MIN_TIMESLICE, audio_buff_alert*4)); + audio_buff_min = min(audio_buff_max, audio_buff_alert*2); + audio_buff_norm = (audio_buff_max + audio_buff_min) / 2; + + MSG_DBG2("alert %f, min %f, norm %f, max %f \n", audio_buff_alert, audio_buff_min, audio_buff_norm, audio_buff_max ); + + samples = 5; + collect_samples = 1; + min_audio = MAX_AUDIO_TIME; + max_audio = 0; + + priv->pid = getpid(); + __MP_UNIT(priv->p_idx,"audio_play_routine"); + priv->state=Pth_Run; + dec_ahead_can_aseek=0; + + while(priv->state!=Pth_Canceling) { + if(priv->state==Pth_Sleep) { + priv->state=Pth_ASleep; + while(priv->state==Pth_ASleep) usleep(0); + continue; + } + __MP_UNIT(priv->p_idx,"audio decore_audio"); + dec_ahead_audio_delay = NOTHING_PLAYED; + eof = decore_audio(d_audio,sh_audio,sh_video,priv->p_idx); + + if(priv->state==Pth_Canceling) break; + + __MP_UNIT(priv->p_idx,"audio sleep"); + + dec_ahead_can_aseek = 1; /* Safe for other threads to seek */ + + if( dec_ahead_audio_delay == NOTHING_PLAYED ) { /* To fast, we can sleep longer */ + if( min_audio_time > audio_buff_alert ) { + min_audio_time *= 0.75; + MSG_DBG2("To fast, set min_audio_time %.5f (delay %5f) \n", min_audio_time, dec_ahead_audio_delay ); + } + collect_samples = 1; + samples = 5; + min_audio = MAX_AUDIO_TIME; + max_audio = 0; + } else if( dec_ahead_audio_delay <= audio_buff_alert ) { /* To slow, sleep shorter */ + if ( min_audio_time < MAX_AUDIO_TIME ) { + min_audio_time *= 2.0; + MSG_DBG2("To slow, set min_audio_time %.5f (delay %5f) \n", min_audio_time, dec_ahead_audio_delay ); + } + collect_samples = 1; + samples = 10; + min_audio = MAX_AUDIO_TIME; + max_audio = 0; + } else if( !xp_core->audio->eof && collect_samples) { + if( dec_ahead_audio_delay < min_audio ) + min_audio = dec_ahead_audio_delay; + if( dec_ahead_audio_delay > max_audio ) + max_audio = dec_ahead_audio_delay; + samples--; + + if( samples <= 0 ) { + if( min_audio > audio_buff_max ) { + min_audio_time -= min_audio-audio_buff_norm; + collect_samples = 1; + MSG_DBG2("Decrease min_audio_time %.5f (min %.5f max %.5f) \n", min_audio_time, min_audio, max_audio ); + } else if( max_audio < audio_buff_min ) { + min_audio_time *= 1.25; + collect_samples = 1; + MSG_DBG2("Increase min_audio_time %.5f (min %.5f max %.5f) \n", min_audio_time, min_audio, max_audio ); + } else { + collect_samples = 0; /* No change, stop */ + MSG_DBG2("Stop collecting samples time %.5f (min %.5f max %.5f) \n", min_audio_time, min_audio, max_audio ); + } + if(collect_samples) { + samples = 5; + min_audio = MAX_AUDIO_TIME; + max_audio = 0; + } + } + } + + LOCK_AUDIO_PLAY(); + d = ao_get_delay(ao_data) - min_audio_time; + if( d > 0 ) { + gettimeofday(&now,NULL); + audio_play_timeout.tv_nsec = now.tv_usec * 1000 + d*1000000000l; + if( audio_play_timeout.tv_nsec > 1000000000l ) { + audio_play_timeout.tv_nsec-=1000000000l; + audio_play_timeout.tv_sec = now.tv_sec + 1; + } else + audio_play_timeout.tv_sec = now.tv_sec; + audio_play_in_sleep=1; + pthread_cond_timedwait( &audio_play_cond, &audio_play_mutex, &audio_play_timeout ); + audio_play_in_sleep=0; + } + UNLOCK_AUDIO_PLAY(); + + if(priv->state==Pth_Canceling) break; + + LOCK_AUDIO_PLAY(); + if(eof && priv->state!=Pth_Canceling) { + __MP_UNIT(priv->p_idx,"wait end of work"); + pthread_cond_wait( &audio_play_cond, &audio_play_mutex ); + } + UNLOCK_AUDIO_PLAY(); + + if(priv->state==Pth_Canceling) break; + + __MP_UNIT(priv->p_idx,"audio pause"); + LOCK_AUDIO_PLAY(); + while( xp_core->in_pause && priv->state!=Pth_Canceling) { + pthread_cond_wait( &audio_play_cond, &audio_play_mutex ); + } + UNLOCK_AUDIO_PLAY(); + + if(priv->state==Pth_Canceling) break; + + __MP_UNIT(priv->p_idx,"audio seek"); + LOCK_AUDIO_PLAY(); +#if 0 + while( priv->state==Pth_Sleep && priv->state!=Pth_Canceling) { + gettimeofday(&now,NULL); + timeout.tv_nsec = now.tv_usec * 1000; + timeout.tv_sec = now.tv_sec + 1; + retval = pthread_cond_timedwait( &audio_play_cond, &audio_play_mutex, &timeout ); + if( retval == ETIMEDOUT ) + MSG_V("Audio seek timeout\n"); + } +#endif + dec_ahead_can_aseek = 0; /* Not safe to seek */ + UNLOCK_AUDIO_PLAY(); + } + fflush(stdout); + __MP_UNIT(priv->p_idx,"audio exit"); + dec_ahead_can_aseek=1; + priv->state=Pth_Stand; + return arg; +} + +void sig_audio_play( void ) +{ + MSG_T("sig_audio_play\n"); + mp_msg_flush(); + + dec_ahead_can_aseek=1; + + UNLOCK_AUDIO_PLAY(); + + xmp_killall_threads(pthread_self()); + __exit_sighandler(); +} Property changes on: mplayerxp/xmp_aplayer.c ___________________________________________________________________ Added: svn:eol-style + native Added: mplayerxp/xmp_aplayer.h =================================================================== --- mplayerxp/xmp_aplayer.h (rev 0) +++ mplayerxp/xmp_aplayer.h 2012-11-02 17:03:04 UTC (rev 285) @@ -0,0 +1,6 @@ +#ifndef XMP_APLAYER_H_INCLUDED +#define XMP_APLAYER_H_INCLUDED 1 + +extern any_t* audio_play_routine( any_t* arg ); +extern void sig_audio_play( void ); +#endif Property changes on: mplayerxp/xmp_aplayer.h ___________________________________________________________________ Added: svn:eol-style + native Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-11-02 16:03:16 UTC (rev 284) +++ mplayerxp/xmp_core.c 2012-11-02 17:03:04 UTC (rev 285) @@ -20,7 +20,10 @@ #include "mp_msg.h" #include "xmp_core.h" +#include "xmp_aplayer.h" #include "xmp_vplayer.h" +#include "xmp_adecoder.h" +#include "xmp_vdecoder.h" #include "mplayer.h" #include "libao2/audio_out.h" @@ -198,418 +201,11 @@ pthread_cond_t audio_decode_cond=PTHREAD_COND_INITIALIZER; volatile int dec_ahead_can_aseek=0; /* It is safe to seek audio */ -volatile int dec_ahead_can_adseek=1; /* It is safe to seek audio buffer thread */ -extern int decore_audio( int xp_id ); -extern void update_osd( float v_pts ); - /* To let audio decoder thread sleep as long as player */ -static struct timespec audio_play_timeout; -static int audio_play_in_sleep=0; +struct timespec audio_play_timeout; +int audio_play_in_sleep=0; -extern int init_audio_buffer(int size, int min_reserv, int indices, sh_audio_t *sh_audio); -extern void uninit_audio_buffer(void); -extern int read_audio_buffer(sh_audio_t *audio, unsigned char *buffer, unsigned minlen, unsigned maxlen ); -extern float get_delay_audio_buffer(void); -extern int decode_audio_buffer(unsigned len); -extern void reset_audio_buffer(void); -extern int get_len_audio_buffer(void); -extern int get_free_audio_buffer(void); - -any_t* audio_play_routine( any_t* arg ); - -/* Audio stuff */ -volatile float dec_ahead_audio_delay; -static int xp_thread_decode_audio(void) -{ - sh_audio_t* sh_audio=xp_core->audio->sh; - sh_video_t* sh_video=NULL; - if(xp_core->video) sh_video=xp_core->video->sh; - int free_buf, vbuf_size, pref_buf; - unsigned len=0; - - free_buf = get_free_audio_buffer(); - - if( free_buf == -1 ) { /* End of file */ - xp_core->audio->eof = 1; - return 0; - } - if( free_buf < (int)sh_audio->audio_out_minsize ) /* full */ - return 0; - - len = get_len_audio_buffer(); - - if( len < MAX_OUTBURST ) /* Buffer underrun */ - return decode_audio_buffer(MAX_OUTBURST); - - if(xp_core->video) { - /* Match video buffer */ - vbuf_size = dae_get_decoder_outrun(xp_core->video); - pref_buf = vbuf_size / sh_video->fps * sh_audio->af_bps; - pref_buf -= len; - if( pref_buf > 0 ) { - len = min( pref_buf, free_buf ); - if( len > sh_audio->audio_out_minsize ) { - return decode_audio_buffer(len); - } - } - } else - return decode_audio_buffer(min(free_buf,MAX_OUTBURST)); - - return 0; -} - - -/* this routine decodes video+audio but intends to be video only */ - -static void show_warn_cant_sync(sh_video_t*sh_video,float max_frame_delay) { - static int warned=0; - static float prev_warn_delay=0; - if(!warned || max_frame_delay > prev_warn_delay) { - warned=1; - MSG_WARN("*********************************************\n" - "** Can't stabilize A-V sync!!! **\n" - "*********************************************\n" - "Try increase number of buffer for decoding ahead\n" - "Exist: %u, need: %u\n" - ,xp_core->num_v_buffs,(unsigned)(max_frame_delay*3*sh_video->fps)+3); - prev_warn_delay=max_frame_delay; - } -} - -static unsigned compute_frame_dropping(sh_video_t* sh_video,float v_pts,float drop_barrier) { - unsigned rc=0; - 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; - - /* - TODO: - Replace the constants with some values which are depended on - xp_core->num_v_buffs and max_frame_delay to find out the smoothest way - to display frames on slow machines. - MAYBE!!!: (won't work with some realmedia streams for example) - Try to borrow avifile's logic (btw, GPL'ed ;) for very slow systems: - - fill a full buffer (is not always reachable) - - while(video.pts < audio.pts) - video.seek_to_key_frame(video.get_next_key_frame(video.get_cur_pos())) - */ - delta=v_pts-screen_pts; - if(max_frame_delay*3 > drop_barrier) { - if(drop_barrier < (float)(xp_core->num_v_buffs-2)/sh_video->fps) drop_barrier += 1/sh_video->fps; - else - if(mp_conf.verbose) show_warn_cant_sync(sh_video,max_frame_delay); - } - if(delta > drop_barrier) rc=0; - else if(delta < max_frame_delay*3) rc=1; - else { - unsigned fr_skip_divisor; - /* - if(delta < drop_barrier/4) fr_skip_divisor=1; -- drop every frame is not smooth thing - else - */ - if(delta < drop_barrier/2) fr_skip_divisor=2; - else - if(delta < drop_barrier*2/3) fr_skip_divisor=3; - else - fr_skip_divisor=4; /* delta < drop_barrier */ - rc = (dae_curr_vdecoded(xp_core)%fr_skip_divisor)?0:1; - if(delta>prev_delta) rc=0; - } - MSG_D("DEC_AHEAD: max_frame_delay*3=%f drop_barrier=%f prev_delta=%f delta=%f(v_pts=%f screen_pts=%f) n_fr_to_drop=%u\n",max_frame_delay*3,drop_barrier,prev_delta,delta,v_pts,xp_screen_pts,xp_n_frame_to_drop); - prev_delta=delta; - return rc; -} - -static void reorder_pts_in_mpeg(void) { - unsigned idx0=0, idx1, idx2, idx3; - - idx1 = dae_curr_vdecoded(xp_core); - idx2 = dae_prev_vdecoded(xp_core); - xmp_frame_t* fra=xp_core->video->frame; - while( dae_curr_vplayed(xp_core) != idx2 && - fra[idx2].v_pts > fra[idx1].v_pts && - fra[idx2].v_pts < fra[idx1].v_pts+1.0 ) { - float tmp; - tmp = fra[idx1].v_pts; - fra[idx1].v_pts = fra[idx2].v_pts; - fra[idx2].v_pts = tmp; - - fra[idx2].duration = fra[idx1].v_pts - fra[idx2].v_pts; - - idx3=(idx2-1)%xp_core->num_v_buffs; - if(fra[idx2].v_pts > fra[idx3].v_pts && - fra[idx2].v_pts - fra[idx3].v_pts < 1.0) - fra[idx3].duration = fra[idx2].v_pts - fra[idx3].v_pts; - - if(idx1 != dae_curr_vdecoded(xp_core)) fra[idx1].duration = fra[idx0].v_pts - fra[idx1].v_pts; - - idx0 = idx1; - idx1 = idx2; - idx2=(idx2-1)%xp_core->num_v_buffs; - } -} - -any_t* Va_dec_ahead_routine( any_t* arg ) -{ - mpxp_thread_t* priv=arg; - sh_video_t* sh_video=priv->dae->sh; - demux_stream_t *d_video=sh_video->ds; - - float duration=0; - float drop_barrier; - int blit_frame=0; - int drop_param=0; - unsigned xp_n_frame_to_drop; - float v_pts,mpeg_timer=HUGE; - - priv->state=Pth_Run; - priv->dae->eof = 0; - if(xp_core->audio) xp_core->audio->eof=0; - MSG_T("\nDEC_AHEAD: entering...\n"); - __MP_UNIT(priv->p_idx,"dec_ahead"); - priv->pid = getpid(); - if(!(xp_core->audio && mp_conf.xp < XP_VAFull)) - priv->name = "video decoder+vf"; - 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) - 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 || - d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_PS || - d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS; - else - xp_core->bad_pts = mp_conf.av_sync_pts?0:1; -while(!priv->dae->eof){ - unsigned char* start=NULL; - int in_size; - if(priv->state==Pth_Canceling) break; - if(priv->state==Pth_Sleep) { -pt_sleep: - priv->state=Pth_ASleep; - while(priv->state==Pth_ASleep) usleep(0); - if(xp_core->bad_pts) mpeg_timer=HUGE; - continue; - } - __MP_UNIT(priv->p_idx,"dec_ahead 1"); - -/* get it! */ -#if 0 - /* prevent reent access to non-reent demuxer */ - //if(sh_video->num_frames>200) *((char*)0x100) = 1; // Testing crash - if(xp_core->audio && mp_conf.xp<XP_VAFull) { - __MP_UNIT(priv->p_idx,"decode audio"); - while(2==xp_thread_decode_audio()) ; - __MP_UNIT(priv->p_idx,"dec_ahead 2"); - } -#endif -/*-------------------- Decode a frame: -----------------------*/ - in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,sh_video->fps); - if(in_size<0) { - dae_decoded_mark_eof(xp_core->video); - priv->dae->eof=1; - break; - } - /* in_size==0: it's or broken stream or demuxer's bug */ - if(in_size==0 && priv->state!=Pth_Canceling) continue; - /* frame was decoded into current decoder_idx */ - if(xp_core->bad_pts) { - if(mpeg_timer==HUGE) mpeg_timer=v_pts; - else if( mpeg_timer-duration<v_pts ) { - mpeg_timer=v_pts; - MSG_DBG2("Sync mpeg pts %f\n", mpeg_timer); - } - else mpeg_timer+=duration; - } - /* compute frame dropping */ - xp_n_frame_to_drop=0; - if(mp_conf.frame_dropping) { - 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,v_pts,drop_barrier); - } /* if( mp_conf.frame_dropping ) */ - if(!finite(v_pts)) MSG_WARN("Bug of demuxer! Value of video pts=%f\n",v_pts); -#if 0 -/* - We can't seriously examine question of too slow machines - by motivation reasons -*/ -if(ada_active_frame) /* don't emulate slow systems until xp_players are not started */ -{ - int i,delay; /* sleeping 200 ms is far enough for 25 fps */ - delay=xp_n_frame_to_drop?0:20; - for(i=0;i<delay;i++) usleep(0); -} -#endif - if(xp_n_frame_to_drop) drop_param=mp_conf.frame_dropping; - else drop_param=0; - /* decode: */ - if(mp_data->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; - if(drop_param) mpcv_set_quality(sh_video,0); - else - if(mp_conf.autoq) mpcv_set_quality(sh_video,our_quality>0?our_quality:0); - } - blit_frame=mpcv_decode(sh_video,start,in_size,drop_param,v_pts); -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); - } - if(!blit_frame && drop_param) priv->dae->num_dropped_frames++; - if(blit_frame) { - unsigned idx=dae_curr_vdecoded(xp_core); - if(xp_core->bad_pts) - xp_core->video->frame[idx].v_pts=mpeg_timer; - else - xp_core->video->frame[idx].v_pts = v_pts; - xp_core->video->frame[idx].duration=duration; - dae_decoded_clear_eof(xp_core->video); - if(!xp_core->bad_pts) { - int _idx = dae_prev_vdecoded(xp_core); - xp_core->video->frame[_idx].duration=v_pts-xp_core->video->frame[_idx].v_pts; - } - if(mp_conf.frame_reorder) reorder_pts_in_mpeg(); - } /* if (blit_frame) */ - - /* ------------ sleep --------------- */ - /* sleep if thread is too fast ;) */ - if(blit_frame) - while(!dae_inc_decoded(xp_core->video)) { - MSG_T("DEC_AHEAD: sleep: player=%i decoder=%i)\n" - ,dae_curr_vplayed(),dae_curr_vdecoded()); - if(priv->state==Pth_Canceling) goto pt_exit; - if(priv->state==Pth_Sleep) goto pt_sleep; - if(xp_core->audio && mp_conf.xp<XP_VAFull) { - __MP_UNIT(priv->p_idx,"decode audio"); - xp_thread_decode_audio(); - __MP_UNIT(priv->p_idx,"dec_ahead 5"); - } - usleep(1); - } -/*------------------------ frame decoded. --------------------*/ -} /* while(!priv->dae->eof)*/ - -if(xp_core->audio && mp_conf.xp<XP_VAFull) { - while(!xp_core->audio->eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { - __MP_UNIT(priv->p_idx,"decode audio"); - if(!xp_thread_decode_audio()) usleep(1); - __MP_UNIT(priv->p_idx,NULL); - } -} - pt_exit: - MSG_T("\nDEC_AHEAD: leaving...\n"); - priv->state=Pth_Stand; - return arg; /* terminate thread here !!! */ -} - -/* this routine decodes audio only */ -any_t* a_dec_ahead_routine( any_t* arg ) -{ - mpxp_thread_... [truncated message content] |
From: <nic...@us...> - 2012-11-03 11:36:21
|
Revision: 287 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=287&view=rev Author: nickols_k Date: 2012-11-03 11:36:13 +0000 (Sat, 03 Nov 2012) Log Message: ----------- change -core.xp behaviour. Note: seeking works only when -core.xp>=3 Modified Paths: -------------- DOCS/mplayerxp.1 ffmpeg/doc/examples/pc-uninstalled/libavcodec.pc ffmpeg/doc/examples/pc-uninstalled/libavformat.pc ffmpeg/doc/examples/pc-uninstalled/libavutil.pc ffmpeg/doc/examples/pc-uninstalled/libpostproc.pc ffmpeg/doc/examples/pc-uninstalled/libswscale.pc mplayerxp/cfg-mplayer.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.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/vosub_vidix.c mplayerxp/mplayer.c mplayerxp/xmpcore/xmp_aplayer.c mplayerxp/xmpcore/xmp_core.c mplayerxp/xmpcore/xmp_core.h mplayerxp/xmpcore/xmp_vdecoder.c mplayerxp/xmpcore/xmp_vplayer.c Modified: DOCS/mplayerxp.1 =================================================================== --- DOCS/mplayerxp.1 2012-11-02 17:31:28 UTC (rev 286) +++ DOCS/mplayerxp.1 2012-11-03 11:36:13 UTC (rev 287) @@ -39,20 +39,19 @@ .LP .SH "XP OPTIONS" .TP -.B \-core.xp\ <0-4> -start MPlayerXP in XP mode. You should get smoothness (fixed FPS on the screen) -with UP systems and decoding speedup with SMP. - 0 : XP mode off - 1 : Decode video in separate thread - 2 : Decode audio and video in the same separate thread - 3 : As 2 plus audio playing in separate thread -.B [default] - 4 : Decode video and audio and play audio in three different threads +.B \-core.xp\ +Specifies number cpus to use for playback. + 0 : not playback possible. (Immediate exit) + 1 : build multi-thread model for Uni-Processor systems + 2 : build multi-thread model for Dual-Processors systems + 3 : build multi-thread model for Tripple-Processors systems + 4+: build multi-thread model for Multi-Processors systems +By default this value is autodetected depends on number CPU, but you +may force prefered multi-thread model. .TP -.B \-core.da_buffs +.B \-core.xp_buffs Allows you specify number of buffers for decoding ahead. -You can set it from 5 upto 64. 64 is default. (I recommend to use -10 buffers as minimum to avoid screen juddering and other negative factors). +You can set it from 3 upto 1024. 64 is default. .I NOTE: .B (For both - UP and SMP) drivers which provide direct BES access will change it automatically Modified: ffmpeg/doc/examples/pc-uninstalled/libavcodec.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libavcodec.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libavcodec.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 54.59.100 Requires: libavutil = 51.73.101 Conflicts: -Libs: -L${libdir} -lavcodec -ljack -lasound -Wl,-rpath,/usr/X11/lib64 -L/usr/X11/lib64 -lSDL -lpthread -lm -pthread -lbz2 -lz -lrt +Libs: -L${libdir} -lavcodec64 -ljack -lasound -Wl,-rpath,/usr/X11/lib64 -L/usr/X11/lib64 -lSDL -lpthread -lm -pthread -lbz2 -lz -lrt Cflags: -I${includedir} Modified: ffmpeg/doc/examples/pc-uninstalled/libavformat.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libavformat.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libavformat.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 54.29.104 Requires: libavcodec = 54.59.100 Conflicts: -Libs: -L${libdir} -lavformat -ljack -lasound -Wl,-rpath,/usr/X11/lib64 -L/usr/X11/lib64 -lSDL -lpthread -lm -pthread -lbz2 -lz -lrt +Libs: -L${libdir} -lavformat64 -ljack -lasound -Wl,-rpath,/usr/X11/lib64 -L/usr/X11/lib64 -lSDL -lpthread -lm -pthread -lbz2 -lz -lrt Cflags: -I${includedir} Modified: ffmpeg/doc/examples/pc-uninstalled/libavutil.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libavutil.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libavutil.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 51.73.101 Requires: Conflicts: -Libs: -L${libdir} -lavutil -lm +Libs: -L${libdir} -lavutil64 -lm Cflags: -I${includedir} Modified: ffmpeg/doc/examples/pc-uninstalled/libpostproc.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libpostproc.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libpostproc.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 52.0.100 Requires: libavutil = 51.73.101 Conflicts: -Libs: -L${libdir} -lpostproc +Libs: -L${libdir} -lpostproc64 Cflags: -I${includedir} Modified: ffmpeg/doc/examples/pc-uninstalled/libswscale.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libswscale.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libswscale.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 2.1.101 Requires: libavutil = 51.73.101 Conflicts: -Libs: -L${libdir} -lswscale -lm +Libs: -L${libdir} -lswscale64 -lm Cflags: -I${includedir} Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/cfg-mplayer.h 2012-11-03 11:36:13 UTC (rev 287) @@ -37,11 +37,11 @@ */ static const config_t xpcore_config[]={ - {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, 4, "starts MPlayerXP in multi-thread and multi-buffer XP mode"}, + {"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"}, - {"da_buffs", &vo_conf.da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, "specifies number of buffers for decoding-ahead in XP mode"}, + {"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"}, Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/video_out.c 2012-11-03 11:36:13 UTC (rev 287) @@ -178,7 +178,7 @@ memset(&vo_conf,0,sizeof(vo_conf_t)); vo_conf.movie_aspect=-1.0; vo_conf.flip=-1; - vo_conf.da_buffs=64; + vo_conf.xp_buffs=64; vo_conf.WinID=-1; vo=mp_mallocz(sizeof(vo_data_t)); Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/video_out.h 2012-11-03 11:36:13 UTC (rev 287) @@ -132,7 +132,7 @@ int WinID; /* output window id */ int vsync; - unsigned da_buffs; /**< contains number of buffers for decoding ahead */ + unsigned xp_buffs; /**< contains number of buffers for decoding ahead */ unsigned use_bm; /**< indicates user's agreement for using busmastering */ vo_gamma_t gamma; Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_dga.c 2012-11-03 11:36:13 UTC (rev 287) @@ -724,7 +724,7 @@ dest_frame_size = priv->width*HW_MODE.vdm_bytespp*priv->vp_height; priv->num_buffers = (ram_size*1024)/dest_frame_size; - if(priv->num_buffers > vo_conf.da_buffs) priv->num_buffers = vo_conf.da_buffs; + if(priv->num_buffers > vo_conf.xp_buffs) priv->num_buffers = vo_conf.xp_buffs; if(priv->num_buffers > MAX_DRI_BUFFERS) priv->num_buffers = MAX_DRI_BUFFERS; for(freq=1;freq<priv->num_buffers;freq++) { Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_fbdev.c 2012-11-03 11:36:13 UTC (rev 287) @@ -1025,7 +1025,7 @@ MSG_DBG2(FBDEV "priv->L123123875 @ %p\n", priv->L123123875); MSG_V(FBDEV "pixel per priv->line: %d\n", priv->line_len / priv->pixel_size); - priv->total_fr=vo_conf.da_buffs; + priv->total_fr=vo_conf.xp_buffs; for(i=0;i<priv->total_fr;i++) if (!(priv->next_frame[i] = (uint8_t *) mp_malloc(priv->out_width * priv->out_height * priv->pixel_size))) { MSG_ERR(FBDEV "Can't mp_malloc priv->next_frame: %s\n", strerror(errno)); Modified: mplayerxp/libvo/vo_null.c =================================================================== --- mplayerxp/libvo/vo_null.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_null.c 2012-11-03 11:36:13 UTC (rev 287) @@ -69,7 +69,7 @@ size_t i; priv->image_width = width; priv->image_height = height; - priv->num_frames = vo_conf.da_buffs; + priv->num_frames = vo_conf.xp_buffs; priv->fourcc=format; UNUSED(d_width); UNUSED(d_height); Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_opengl.c 2012-11-03 11:36:13 UTC (rev 287) @@ -174,7 +174,7 @@ if ( vo_FS(vo) ) { vo->dest.w=d_width; vo->dest.h=d_height; } - priv->num_buffers=vo_conf.da_buffs; + priv->num_buffers=vo_conf.xp_buffs; aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); aspect(&d_width,&d_height,vo_ZOOM(vo)?A_ZOOM:A_NOZOOM); Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_sdl.c 2012-11-03 11:36:13 UTC (rev 287) @@ -734,7 +734,7 @@ { priv_t *priv = vo->priv; unsigned i,retval; - priv->num_buffs=vo_conf.da_buffs; + priv->num_buffs=vo_conf.xp_buffs; #ifdef CONFIG_VIDIX if(!vidix_name) { #endif Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_vesa.c 2012-11-03 11:36:13 UTC (rev 287) @@ -52,8 +52,6 @@ #define min(a,b) ((a)<(b)?(a):(b)) #endif -#define UNUSED(x) ((void)(x)) /**< Removes warning about unused arguments */ - static vo_info_t vo_info = { "VESA VBE 2.0 video output" @@ -602,7 +600,7 @@ ,vsize); MSG_V(" at %08lXh",(unsigned long)lfb); MSG_V("\n"); - if(!(priv->multi_size = fillMultiBuffer(vo,vsize,vo_conf.da_buffs))) return -1; + if(!(priv->multi_size = fillMultiBuffer(vo,vsize,vo_conf.xp_buffs))) return -1; if(priv->multi_size < 2) MSG_ERR("vo_vesa: Can't use double buffering: not enough video memory\n"); else MSG_V("vo_vesa: using %u buffers for multi buffering\n",priv->multi_size); } Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_x11.c 2012-11-03 11:36:13 UTC (rev 287) @@ -126,7 +126,7 @@ UNUSED(info); - priv->num_buffers=vo_conf.da_buffs; + priv->num_buffers=vo_conf.xp_buffs; if (!title) title = mp_strdup("MPlayerXP X11 (XImage/Shm) render"); Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_xv.c 2012-11-03 11:36:13 UTC (rev 287) @@ -285,7 +285,7 @@ if ( vo_FS(vo) ) { vo->dest.w=d_width; vo->dest.h=d_height; } - priv->num_buffers=vo_conf.da_buffs; + priv->num_buffers=vo_conf.xp_buffs; aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vosub_vidix.c 2012-11-03 11:36:13 UTC (rev 287) @@ -140,7 +140,7 @@ vidix_stop(vo); vdlClose(priv->handler); if(vo_conf.use_bm) { - for(i=0;i<vo_conf.da_buffs;i++) { + for(i=0;i<vo_conf.xp_buffs;i++) { if(priv->bm_locked) munlock(priv->bm_buffs[i],priv->play->frame_size); mp_free(priv->bm_buffs[i]); priv->bm_buffs[i]=NULL; @@ -405,7 +405,7 @@ priv->play->dest.w = dst_width; priv->play->dest.h = dst_height; priv->play->num_frames=(vo_conf.use_bm!=1)?NUM_FRAMES-1:1; - if(priv->play->num_frames > vo_conf.da_buffs) priv->play->num_frames = vo_conf.da_buffs; + 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]) { @@ -456,7 +456,7 @@ if(priv->cap->flags & FLAG_DMA) { int psize = getpagesize(); priv->bm_locked=1; - for(i=0;i<vo_conf.da_buffs;i++) { + for(i=0;i<vo_conf.xp_buffs;i++) { if(!priv->bm_buffs[i]) priv->bm_buffs[i] = mp_memalign(psize, priv->play->frame_size); if(!(priv->bm_buffs[i])) { MSG_ERR("Can't allocate memory for busmastering\n"); @@ -592,7 +592,7 @@ if(priv->inited) return (*server_control)(vo,request,data); break; case VOCTRL_GET_NUM_FRAMES: - *(uint32_t *)data = (vo_conf.use_bm == 1) ? vo_conf.da_buffs : priv->play->num_frames; + *(uint32_t *)data = (vo_conf.use_bm == 1) ? vo_conf.xp_buffs : priv->play->num_frames; return CONTROL_TRUE; case DRI_GET_SURFACE_CAPS: vidix_dri_get_surface_caps(vo,data); @@ -624,7 +624,7 @@ if(vdlGetVersion() != VIDIX_VERSION) { MSG_FATAL("You have wrong version of VIDIX library\n"); mp_free(priv); - return NULL; + return -1; } priv->handler = vdlOpen(VIDIX_PATH, drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, @@ -633,12 +633,12 @@ if(priv->handler == NULL) { MSG_FATAL("Couldn't find working VIDIX driver\n"); mp_free(priv); - return NULL; + return -1; } if((err=vdlGetCapability(priv->handler,priv->cap)) != 0) { MSG_FATAL("Couldn't get capability: %s\n",strerror(err)); mp_free(priv); - return NULL; + return -1; } else MSG_V("Driver capability: %X\n",priv->cap->flags); MSG_V("Using: %s by %s\n",priv->cap->name,priv->cap->author); @@ -651,5 +651,5 @@ } priv->vo_server = server; priv->inited=1; - return priv; + return 0; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/mplayer.c 2012-11-03 11:36:13 UTC (rev 287) @@ -188,6 +188,16 @@ return rc; } +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; @@ -201,7 +211,7 @@ memset(&x86,-1,sizeof(x86_features_t)); #endif memset(&mp_conf,0,sizeof(mp_conf_t)); - mp_conf.xp=XP_VAPlay; + mp_conf.xp=get_number_cpu(); mp_conf.audio_id=-1; mp_conf.video_id=-1; mp_conf.dvdsub_id=-1; @@ -463,17 +473,6 @@ return eof; } -unsigned xp_num_cpu; -static unsigned get_number_cpu(void) { -#ifdef _OPENMP - return omp_get_num_procs(); -#else - /* TODO ? */ - return 1; -#endif -} - - #if defined( ARCH_X86 ) || defined(ARCH_X86_64) static void get_mmx_optimizations( void ) { @@ -803,7 +802,7 @@ { priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; - if( mp_conf.xp <= XP_Video ) + 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 @@ -1354,7 +1353,7 @@ } if (priv->ao_inited && sh_audio) { - if( mp_conf.xp >= XP_VAPlay ) { + if(xmp_test_model(XMP_Run_AudioPlayer)) { xp_core->in_pause=1; while( !dec_ahead_can_aseek ) usleep(0); } @@ -1374,7 +1373,7 @@ if(priv->osd_function==OSD_PAUSE) priv->osd_function=OSD_PLAY; if (priv->ao_inited && sh_audio) { ao_resume(ao_data); // resume audio - if( mp_conf.xp >= XP_VAPlay ) { + if(xmp_test_model(XMP_Run_AudioPlayer)) { xp_core->in_pause=0; __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); } @@ -1712,7 +1711,7 @@ } } - xp_core->num_a_buffs = vo_conf.da_buffs; + xp_core->num_a_buffs = vo_conf.xp_buffs; init_player(); @@ -2002,6 +2001,7 @@ ,xp_core->mpxp_threads[idx]->name ,xp_core->mpxp_threads[idx]->pid ,xp_core->mpxp_threads[idx]->pth_id); + //==================== START PLAYING ======================= MSG_OK(MSGTR_StartPlaying);fflush(stdout); @@ -2018,34 +2018,20 @@ eof |= xp_core->audio->eof; /*========================== UPDATE TIMERS ============================*/ MP_UNIT("Update timers"); + if(sh_video && input_state.need_repaint) goto repaint; + if(sh_audio) eof = xp_core->audio->eof; + if(sh_video) eof|=dae_played_eof(xp_core->video); if(!sh_video) { if(mp_conf.benchmark && mp_conf.verbose) show_benchmark_status(); else mpxp_print_audio_status(); - - if(mp_conf.xp >= XP_VAPlay) { usleep(100000); eof = xp_core->audio->eof; } - goto read_input; - } else { - int l_eof; - -/*========================== PLAY VIDEO ============================*/ - if(input_state.need_repaint) goto repaint; - if((sh_video->is_static ||(stream->type&STREAMTYPE_MENU)==STREAMTYPE_MENU) && xp_core->video->num_played_frames) { - /* don't decode if it's picture */ - usleep(0); - } else { + } + usleep(250000); +//read_input: + vo_check_events(vo_data); repaint: - usleep(100000); - l_eof = dae_played_eof(xp_core->video); - //mpxp_play_video(rtc_fd); - eof |= l_eof; - if(eof) goto do_loop; - } - vo_check_events(vo_data); -read_input: #ifdef USE_OSD - if((mpxp_paint_osd(&osd.visible,&in_pause))!=0) goto repaint; + if((mpxp_paint_osd(&osd.visible,&in_pause))!=0) goto repaint; #endif - } /* else if(!sh_video) */ //================= Keyboard events, SEEKing ==================== @@ -2064,7 +2050,6 @@ seek_args.secs += d; mp_conf.seek_to_sec = NULL; } -do_loop: /* Looping. */ if(eof && mp_conf.loop_times>=0) { MSG_V("loop_times = %d, eof = %d\n", mp_conf.loop_times,eof); Modified: mplayerxp/xmpcore/xmp_aplayer.c =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_aplayer.c 2012-11-03 11:36:13 UTC (rev 287) @@ -26,7 +26,7 @@ extern ao_data_t*ao_data; -static int decore_audio(demux_stream_t *d_audio,sh_audio_t* sh_audio,sh_video_t*sh_video,unsigned _xp_id ) +static int decore_audio(demux_stream_t *d_audio,sh_audio_t* sh_audio,sh_video_t*sh_video) { int eof = 0; /*========================== PLAY AUDIO ============================*/ @@ -54,11 +54,10 @@ MP_UNIT("mpca_decode"); // Enter AUDIO decoder module t=GetTimer(); while(sh_audio->a_buffer_len<playsize && !xp_core->audio->eof){ - if(mp_conf.xp>=XP_VideoAudio) { + if(!xmp_test_model(XMP_Run_AudioPlayback)) { 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 - { + } else { ret=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); } @@ -81,14 +80,14 @@ } if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; - if(mp_conf.xp>=XP_VAPlay) dec_ahead_audio_delay=ao_get_delay(ao_data); + 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); if(playsize>0){ sh_audio->a_buffer_len-=playsize; memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); - if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) + 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(sh_audio->a_pts != HUGE) { @@ -116,7 +115,7 @@ sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); else sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) + if(!mp_conf.av_sync_pts && xmp_test_model(XMP_Run_AudioPlayer)) pthread_mutex_unlock(&audio_timer_mutex); } @@ -161,6 +160,8 @@ priv->pid = getpid(); __MP_UNIT(priv->p_idx,"audio_play_routine"); priv->state=Pth_Run; + if(xmp_test_model(XMP_Run_AudioPlayback)) + priv->name = "audio decoder+player"; dec_ahead_can_aseek=0; while(priv->state!=Pth_Canceling) { @@ -171,7 +172,7 @@ } __MP_UNIT(priv->p_idx,"audio decore_audio"); dec_ahead_audio_delay = NOTHING_PLAYED; - eof = decore_audio(d_audio,sh_audio,sh_video,priv->p_idx); + eof = decore_audio(d_audio,sh_audio,sh_video); if(priv->state==Pth_Canceling) break; Modified: mplayerxp/xmpcore/xmp_core.c =================================================================== --- mplayerxp/xmpcore/xmp_core.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_core.c 2012-11-03 11:36:13 UTC (rev 287) @@ -209,24 +209,53 @@ /* Min audio buffer to keep mp_free, used to tell differ between full and empty buffer */ #define MIN_BUFFER_RESERV 8 +static unsigned xmp_engine_compute_model(sh_video_t *shv, sh_audio_t *sha) { + unsigned rc; + rc=0; + if(!shv && sha) { + switch(mp_conf.xp) { + case XP_UniCore: rc=XMP_Run_AudioPlayback; break; + default: rc=XMP_Run_AudioPlayer|XMP_Run_AudioDecoder; break; + } + } else if(shv && !sha) { + switch(mp_conf.xp) { + default: + case XP_UniCore: rc=XMP_Run_VideoPlayer|XMP_Run_VideoDecoder; break; + } + } else { /* both shv and sha */ + switch(mp_conf.xp) { + case XP_UniCore: + rc=XMP_Run_VideoPlayer|XMP_Run_VA_Decoder|XMP_Run_AudioPlayer; break; + case XP_DualCore: + rc=XMP_Run_VideoPlayer|XMP_Run_VideoDecoder|XMP_Run_AudioPlayback; break; + default: /* TripleCore */ + rc=XMP_Run_VideoPlayer|XMP_Run_VideoDecoder|XMP_Run_AudioPlayer|XMP_Run_AudioDecoder; break; + } + } + return rc; +} + int xmp_init_engine(sh_video_t *shv, sh_audio_t *sha) { + xp_core->flags=xmp_engine_compute_model(shv,sha); if(shv) { xp_core->video=mp_mallocz(sizeof(dec_ahead_engine_t)); dae_init(xp_core->video,xp_core->num_v_buffs,shv); } - if(mp_conf.xp>=XP_VideoAudio && sha) { - int asize; - unsigned o_bps; - unsigned min_reserv; - o_bps=sha->afilter_inited?sha->af_bps:sha->o_bps; - if(xp_core->video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core->num_v_buffs/shv->fps))+MIN_BUFFER_RESERV; - else asize = o_bps*xp_core->num_a_buffs; - /* FIXME: get better indices from asize/real_audio_packet_size */ - min_reserv = sha->audio_out_minsize; - if (o_bps > sha->o_bps) - min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; - init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); + if(sha) { + if(xmp_test_model(XMP_Run_AudioPlayer)) { + int asize; + unsigned o_bps; + unsigned min_reserv; + o_bps=sha->afilter_inited?sha->af_bps:sha->o_bps; + if(xp_core->video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core->num_v_buffs/shv->fps))+MIN_BUFFER_RESERV; + else asize = o_bps*xp_core->num_a_buffs; + /* FIXME: get better indices from asize/real_audio_packet_size */ + min_reserv = sha->audio_out_minsize; + if (o_bps > sha->o_bps) + min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; + init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); + } xp_core->audio=mp_mallocz(sizeof(dec_ahead_engine_t)); dae_init(xp_core->audio,xp_core->num_a_buffs,sha); } @@ -284,12 +313,12 @@ int xmp_run_decoders( void ) { unsigned rc; - if((xp_core->audio && mp_conf.xp >= XP_VAFull) || !xp_core->video) { - if((rc=xmp_register_thread(xp_core->audio,sig_audio_decode,a_dec_ahead_routine,"audio decoder+af"))==UINT_MAX) return rc; + if(xp_core->audio && xmp_test_model(XMP_Run_AudioDecoder)) { + if((rc=xmp_register_thread(xp_core->audio,sig_audio_decode,a_dec_ahead_routine,"audio decoder"))==UINT_MAX) return rc; while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } - if(xp_core->video) { - if((rc=xmp_register_thread(xp_core->video,sig_video_decode,xmp_video_decoder,"video+audio decoders+filters"))==UINT_MAX) return rc; + if(xp_core->video && xmp_test_model(XMP_Run_VideoDecoder|XMP_Run_VA_Decoder)) { + if((rc=xmp_register_thread(xp_core->video,sig_video_decode,xmp_video_decoder,"video+audio decoders"))==UINT_MAX) return rc; while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } return 0; @@ -298,11 +327,11 @@ int xmp_run_players(void) { unsigned rc; - if( xp_core->audio && mp_conf.xp >= XP_VAPlay ) { + if(xp_core->audio && xmp_test_model(XMP_Run_AudioPlayer|XMP_Run_AudioPlayback)) { if((rc=xmp_register_thread(xp_core->audio,sig_audio_play,audio_play_routine,"audio player"))==UINT_MAX) return rc; while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } - if( xp_core->video ) { + if(xp_core->video && xmp_test_model(XMP_Run_VideoPlayer)) { if((rc=xmp_register_thread(xp_core->video,sig_video_play,xmp_video_player,"video player"))==UINT_MAX) return rc; while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } Modified: mplayerxp/xmpcore/xmp_core.h =================================================================== --- mplayerxp/xmpcore/xmp_core.h 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_core.h 2012-11-03 11:36:13 UTC (rev 287) @@ -15,10 +15,8 @@ #include "libmpdemux/demuxer_r.h" #include "libvo/video_out.h" -//#define ENABLE_DEC_AHEAD_DEBUG 1 +enum xp_modes { XP_NA=0, XP_UniCore, XP_DualCore, XP_TripleCore, XP_MultiCore }; -enum xp_modes { XP_NA=0, XP_Video, XP_VideoAudio, XP_VAPlay, XP_VAFull }; - typedef struct xmp_frame_s { float v_pts; /* presentation time-stamp from input stream @@ -56,6 +54,15 @@ typedef any_t*(*mpxp_routine_t)(any_t*); typedef void (*sig_handler_t)(void); +typedef enum xmp_model { + XMP_Run_AudioPlayer =0x00000001, + XMP_Run_AudioPlayback =0x00000002, /* audio player+decoder together */ + XMP_Run_VideoPlayer =0x00000004, + XMP_Run_VA_Decoder =0x00000008, /* audio+video decoders together */ + XMP_Run_AudioDecoder =0x00000010, + XMP_Run_VideoDecoder =0x00000020 +}xmp_model_e; + typedef struct mpxp_thread_s { unsigned p_idx; const char* name; @@ -76,6 +83,7 @@ }initial_audio_pts_correction_t; typedef struct xp_core_s { + xmp_model_e flags; dec_ahead_engine_t* video; dec_ahead_engine_t* audio; volatile int in_pause; @@ -93,6 +101,8 @@ }xp_core_t; extern xp_core_t *xp_core; +static inline int xmp_test_model(unsigned value) { return (xp_core->flags&value)!=0; } + extern void xmp_init(void); extern void xmp_uninit(void); Modified: mplayerxp/xmpcore/xmp_vdecoder.c =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-03 11:36:13 UTC (rev 287) @@ -129,8 +129,8 @@ MSG_T("\nDEC_AHEAD: entering...\n"); __MP_UNIT(priv->p_idx,"dec_ahead"); priv->pid = getpid(); - if(!(xp_core->audio && mp_conf.xp < XP_VAFull)) - priv->name = "video decoder+vf"; + 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) xp_core->bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || @@ -152,7 +152,6 @@ continue; } __MP_UNIT(priv->p_idx,"dec_ahead 1"); - /* get it! */ #if 0 /* prevent reent access to non-reent demuxer */ @@ -243,7 +242,7 @@ ,dae_curr_vplayed(),dae_curr_vdecoded()); if(priv->state==Pth_Canceling) goto pt_exit; if(priv->state==Pth_Sleep) goto pt_sleep; - if(xp_core->audio && mp_conf.xp<XP_VAFull) { + if(xp_core->audio && xmp_test_model(XMP_Run_VA_Decoder)) { __MP_UNIT(priv->p_idx,"decode audio"); xp_thread_decode_audio(d_audio); __MP_UNIT(priv->p_idx,"dec_ahead 5"); @@ -253,7 +252,7 @@ /*------------------------ frame decoded. --------------------*/ } /* while(!priv->dae->eof)*/ -if(xp_core->audio && mp_conf.xp<XP_VAFull) { +if(xp_core->audio && xmp_test_model(XMP_Run_VA_Decoder)) { while(!xp_core->audio->eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { __MP_UNIT(priv->p_idx,"decode audio"); if(!xp_thread_decode_audio(d_audio)) usleep(1); Modified: mplayerxp/xmpcore/xmp_vplayer.c =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_vplayer.c 2012-11-03 11:36:13 UTC (rev 287) @@ -118,7 +118,7 @@ if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { float t; - if( mp_conf.xp < XP_VAPlay ) { + if(xmp_test_model(XMP_Run_AudioPlayback)) { t=ao_get_delay(ao_data)-XP_MIN_AUDIOBUFF; if(t>XP_MAX_TIMESLICE) t=XP_MAX_TIMESLICE; @@ -127,7 +127,7 @@ usleep(t*1000000); sleep_time-=GetRelativeTime(); - if(mp_conf.xp >= XP_VAPlay || t<XP_MAX_TIMESLICE || sleep_time>XP_MAX_TIMESLICE) { + if(xmp_test_model(XMP_Run_AudioPlayer) || t<XP_MAX_TIMESLICE || sleep_time>XP_MAX_TIMESLICE) { // exit due no sound in soundcard return 0; } @@ -237,7 +237,7 @@ // unplayed bytes in our and soundcard/dma buffer: float delay=ao_get_delay(ao_data)+(float)sh_audio->a_buffer_len/(float)sh_audio->af_bps; - if(mp_conf.xp>=XP_VideoAudio) + if(xmp_test_model(XMP_Run_AudioPlayer)) delay += get_delay_audio_buffer(); if(pts_from_bps){ @@ -264,10 +264,10 @@ if(x<-max_pts_correction) x=-max_pts_correction; else if(x> max_pts_correction) x= max_pts_correction; max_pts_correction=shva.duration*0.10; // +-10% of time - if(mp_conf.xp>=XP_VAPlay) + if(xmp_test_model(XMP_Run_AudioPlayer)) pthread_mutex_lock(&audio_timer_mutex); sh_audio->timer+=x; - if(mp_conf.xp>=XP_VAPlay) + if(xmp_test_model(XMP_Run_AudioPlayer)) pthread_mutex_unlock(&audio_timer_mutex); if(mp_conf.benchmark && mp_conf.verbose) __show_status_line(a_pts,v_pts,delay,AV_delay); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-03 15:54:26
|
Revision: 292 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=292&view=rev Author: nickols_k Date: 2012-11-03 15:54:18 +0000 (Sat, 03 Nov 2012) Log Message: ----------- move mp_image and sig_hand into better place Modified Paths: -------------- mplayerxp/Makefile mplayerxp/dump.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/stheader.h mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vosub_vidix.c mplayerxp/mplayer.c mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu_cmdlist.c mplayerxp/postproc/libmenu/menu_console.c mplayerxp/postproc/libmenu/menu_filesel.c mplayerxp/postproc/libmenu/menu_list.c mplayerxp/postproc/libmenu/menu_param.c mplayerxp/postproc/libmenu/menu_pt.c mplayerxp/postproc/libmenu/menu_txt.c mplayerxp/postproc/vf.c 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 mplayerxp/xmpcore/Makefile Added Paths: ----------- mplayerxp/xmpcore/mp_image.c mplayerxp/xmpcore/mp_image.h mplayerxp/xmpcore/sig_hand.c mplayerxp/xmpcore/sig_hand.h Removed Paths: ------------- mplayerxp/mp_image.c mplayerxp/mp_image.h mplayerxp/sig_hand.c mplayerxp/sig_hand.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/Makefile 2012-11-03 15:54:18 UTC (rev 292) @@ -23,8 +23,8 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS_COMMON = mp_msg.c mp_image.c -SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c +SRCS_COMMON = mp_msg.c +SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c dump.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/dump.c 2012-11-03 15:54:18 UTC (rev 292) @@ -10,7 +10,7 @@ #include "mp_config.h" #include "dump.h" -#include "sig_hand.h" +#include "xmpcore/sig_hand.h" #include "help_mp.h" #include "input/input.h" #include "mplayer.h" Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-03 15:54:18 UTC (rev 292) @@ -18,7 +18,7 @@ #include "libmpdemux/demuxer.h" #include "libmpdemux/parse_es.h" #include "libmpdemux/stheader.h" -#include "sig_hand.h" +#include "xmpcore/sig_hand.h" #include "libmpconf/codec-cfg.h" Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/libmpdemux/cache2.c 2012-11-03 15:54:18 UTC (rev 292) @@ -14,7 +14,7 @@ #include <pthread.h> #include "stream.h" -#include "sig_hand.h" +#include "xmpcore/sig_hand.h" #include "osdep/timer.h" #include "osdep/cpudetect.h" #include "osdep/bswap.h" Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/libmpdemux/stheader.h 2012-11-03 15:54:18 UTC (rev 292) @@ -7,7 +7,7 @@ #include "loader/wine/avifmt.h" #include "loader/wine/vfw.h" -#include "../mp_image.h" +#include "xmpcore/mp_image.h" typedef struct sh_audio_s { int aid; Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/libvo/video_out.h 2012-11-03 15:54:18 UTC (rev 292) @@ -20,7 +20,7 @@ #include "sub.h" #include "libmpsub/subreader.h" #include "img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "xmpcore/xmp_enums.h" enum { Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/libvo/vo_sdl.c 2012-11-03 15:54:18 UTC (rev 292) @@ -128,7 +128,7 @@ #include "osdep/keycodes.h" #include "dri_vo.h" #include "video_out_internal.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #ifdef CONFIG_VIDIX #include "vosub_vidix.h" #endif Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/libvo/vo_x11.c 2012-11-03 15:54:18 UTC (rev 292) @@ -45,7 +45,7 @@ #include "postproc/swscale.h" /* for MODE_RGB(BGR) definitions */ #include "video_out_internal.h" #include "dri_vo.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vo_msg.h" LIBVO_EXTERN( x11 ) Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/libvo/vo_xv.c 2012-11-03 15:54:18 UTC (rev 292) @@ -36,7 +36,7 @@ #include "sub.h" #include "aspect.h" #include "dri_vo.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include <X11/extensions/Xv.h> #include <X11/extensions/Xvlib.h> Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/libvo/vosub_vidix.c 2012-11-03 15:54:18 UTC (rev 292) @@ -33,7 +33,7 @@ #include "sub.h" #include "video_out.h" #include "dri_vo.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vo_msg.h" #ifndef min Deleted: mplayerxp/mp_image.c =================================================================== --- mplayerxp/mp_image.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/mp_image.c 2012-11-03 15:54:18 UTC (rev 292) @@ -1,221 +0,0 @@ -#include "mp_config.h" -#include "mplayer.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "osdep/mplib.h" -#include "libvo/img_format.h" -#include "mp_image.h" -#include "osdep/fastmemcpy.h" -#define MSGT_CLASS MSGT_CPLAYER -#include "mp_msg.h" - -void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ - mpi->flags&=~(MP_IMGFLAG_PLANAR|MP_IMGFLAG_YUV|MP_IMGFLAG_SWAPPED); - mpi->imgfmt=out_fmt; - if(out_fmt == IMGFMT_MPEGPES){ - mpi->bpp=0; - return; - } - if(out_fmt == IMGFMT_ZRMJPEGNI || - out_fmt == IMGFMT_ZRMJPEGIT || - out_fmt == IMGFMT_ZRMJPEGIB){ - mpi->bpp=0; - return; - } - if(IMGFMT_IS_XVMC(out_fmt)){ - mpi->bpp=0; - return; - } - mpi->num_planes=1; - if (IMGFMT_IS_RGB(out_fmt) || IMGFMT_IS_BGR(out_fmt)) { - mpi->bpp = rgbfmt_depth(out_fmt); - if(IMGFMT_IS_BGR(out_fmt)) mpi->flags|=MP_IMGFLAG_SWAPPED; - return; - } - mpi->flags|=MP_IMGFLAG_YUV; - mpi->num_planes=3; - switch(out_fmt){ - case IMGFMT_I420: - case IMGFMT_IYUV: - mpi->flags|=MP_IMGFLAG_SWAPPED; - case IMGFMT_YV12: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=12; - mpi->chroma_width=(mpi->width>>1); - mpi->chroma_height=(mpi->height>>1); - mpi->chroma_x_shift=1; - mpi->chroma_y_shift=1; - return; - case IMGFMT_420A: - case IMGFMT_IF09: - mpi->num_planes=4; - case IMGFMT_YVU9: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=9; - mpi->chroma_width=(mpi->width>>2); - mpi->chroma_height=(mpi->height>>2); - mpi->chroma_x_shift=2; - mpi->chroma_y_shift=2; - return; - case IMGFMT_444P16_LE: - case IMGFMT_444P16_BE: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=48; - mpi->chroma_width=(mpi->width); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=0; - mpi->chroma_y_shift=0; - return; - case IMGFMT_444P: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=24; - mpi->chroma_width=(mpi->width); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=0; - mpi->chroma_y_shift=0; - return; - case IMGFMT_422P16_LE: - case IMGFMT_422P16_BE: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=32; - mpi->chroma_width=(mpi->width>>1); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=1; - mpi->chroma_y_shift=0; - return; - case IMGFMT_422P: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=16; - mpi->chroma_width=(mpi->width>>1); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=1; - mpi->chroma_y_shift=0; - return; - case IMGFMT_420P16_LE: - case IMGFMT_420P16_BE: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=24; - mpi->chroma_width=(mpi->width>>2); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=2; - mpi->chroma_y_shift=0; - return; - case IMGFMT_411P: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=12; - mpi->chroma_width=(mpi->width>>2); - mpi->chroma_height=(mpi->height); - mpi->chroma_x_shift=2; - mpi->chroma_y_shift=0; - return; - case IMGFMT_Y800: - case IMGFMT_Y8: - /* they're planar ones, but for easier handling use them as packed */ -// mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=8; - mpi->num_planes=1; - return; - case IMGFMT_UYVY: - mpi->flags|=MP_IMGFLAG_SWAPPED; - case IMGFMT_YUY2: - mpi->bpp=16; - mpi->num_planes=1; - return; - case IMGFMT_NV12: - mpi->flags|=MP_IMGFLAG_SWAPPED; - case IMGFMT_NV21: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=12; - mpi->num_planes=2; - mpi->chroma_width=(mpi->width>>0); - mpi->chroma_height=(mpi->height>>1); - mpi->chroma_x_shift=0; - mpi->chroma_y_shift=1; - return; - } - MSG_WARN("mp_image: Unknown out_fmt: 0x%X\n",out_fmt); - mpi->bpp=0; -} - -mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx){ - mp_image_t* mpi=(mp_image_t*)mp_mallocz(sizeof(mp_image_t)); - if(!mpi) return NULL; // error! - mpi->xp_idx = xp_idx; - mpi->width=mpi->w=w; - mpi->height=mpi->h=h; - return mpi; -} - -void free_mp_image(mp_image_t* mpi){ - if(!mpi) return; - if(mpi->flags&MP_IMGFLAG_ALLOCATED){ - /* becouse we allocate the whole image in once */ - if(mpi->planes[0]) mp_free(mpi->planes[0]); - } - mp_free(mpi); -} - -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_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; - } 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 { - if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; - } - mpi->flags|=MP_IMGFLAG_ALLOCATED; -} - -void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi) { - if(mpi->flags&MP_IMGFLAG_PLANAR){ - memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0],mpi->stride[0]); - memcpy_pic(dmpi->planes[1],mpi->planes[1], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1],mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2],mpi->stride[2]); - } else { - memcpy_pic(dmpi->planes[0],mpi->planes[0], - mpi->w*(dmpi->bpp/8), mpi->h, - dmpi->stride[0],mpi->stride[0]); - } -} - -void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned h) -{ - *dmpi = *mpi; - dmpi->y = y; - dmpi->h = h; - dmpi->chroma_height = h >> mpi->chroma_y_shift; - dmpi->xp_idx = mpi->xp_idx; -} Deleted: mplayerxp/mp_image.h =================================================================== --- mplayerxp/mp_image.h 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/mp_image.h 2012-11-03 15:54:18 UTC (rev 292) @@ -1,100 +0,0 @@ -#ifndef __MP_IMAGE_H -#define __MP_IMAGE_H 1 - -#include "mp_config.h" - -//--------- codec's requirements (filled by the codec/vf) --------- - -//--- buffer content restrictions: -enum { - MP_IMGFLAG_PRESERVE=0x00001, // set if buffer content shouldn't be modified: - MP_IMGFLAG_READABLE=0x00002 // set if buffer content will be READ for next frame's MC: (I/P mpeg frames) -}; - -//--- buffer width/stride/plane restrictions: (used for direct rendering) -enum { -// stride _have_to_ be aligned to MB boundary: [for DR restrictions] - MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE =0x00004, /* no flag - should be neg value of MP_IMGFLAG_ACCEPT_STRIDE */ -// stride should be aligned to MB boundary: [for buffer allocation] - MP_IMGFLAG_PREFER_ALIGNED_STRIDE =0x00008, /* sould be no flag - everything prefer aligned strides */ - MP_IMGFLAG_ACCEPT_STRIDE =0x00010, // codec accept any stride (>=width): - MP_IMGFLAG_ACCEPT_WIDTH =0x00020, // codec accept any width (width*bpp=stride -> stride%bpp==0) (>=width): -//--- for planar formats only: -// uses only stride[0], and stride[1]=stride[2]=stride[0]>>mpi->chroma_x_shift - MP_IMGFLAG_COMMON_STRIDE =0x00040, /* UNUSED */ -// uses only planes[0], and calculates planes[1,2] from width,height,imgfmt - MP_IMGFLAG_COMMON_PLANE =0x00080, /* UNUSED */ - MP_IMGFLAGMASK_RESTRICTIONS =0x000FF, -//--------- color info (filled by mp_image_setfmt() ) ----------- - MP_IMGFLAG_PLANAR =0x00100, // set if number of planes > 1 - MP_IMGFLAG_YUV =0x00200, // set if it's YUV colorspace - MP_IMGFLAG_SWAPPED =0x00400, // set if it's swapped (BGR or YVU) plane/byteorder - MP_IMGFLAG_RGB_PALETTE =0x00800, // using palette for RGB data - MP_IMGFLAGMASK_COLORS =0x00F00, -// codec uses drawing/rendering callbacks (draw_slice()-like thing, DR method 2) -// [the codec will set this flag if it supports callbacks, and the vo _may_ -// clear it in get_image() if draw_slice() not implemented] - MP_IMGFLAG_DRAW_CALLBACK =0x01000, - MP_IMGFLAG_DIRECT =0x02000, // set if it's in video buffer/memory: [set by vo/vf's get_image() !!!] - MP_IMGFLAG_ALLOCATED =0x04000, // set if buffer is allocated (used in destination images): - MP_IMGFLAG_TYPE_DISPLAYED =0x08000, // buffer type was printed (do NOT set this flag - it's for INTERNAL USE!!!) - MP_IMGFLAG_FINAL =0x10000, // buffer is video memory - MP_IMGFLAG_RENDERED =0x20000, // final buffer was already painted - MP_IMGFLAG_FINALIZED =0x40000 // indicates final step of image processing from CPU side!!! -}; - -/* codec doesn't support any form of direct rendering - it has own buffer */ -enum { - MP_IMGTYPE_EXPORT =0, // allocation. so we just export its buffer pointers: - MP_IMGTYPE_STATIC =1, // codec requires a static WO buffer, but it does only partial updates later: - MP_IMGTYPE_TEMP =2, // codec just needs some WO memory, where it writes/copies the whole frame to: - MP_IMGTYPE_IP =3, // I+P type, requires 2+ independent static R/W buffers - MP_IMGTYPE_IPB =4, // I+P+B type, requires 2+ independent static R/W and 1+ temp WO buffers - - MP_MAX_PLANES =4 -}; -enum { - MP_IMGFIELD_ORDERED =0x01, - MP_IMGFIELD_TOP_FIRST =0x02, - MP_IMGFIELD_REPEAT_FIRST =0x04, - MP_IMGFIELD_TOP =0x08, - MP_IMGFIELD_BOTTOM =0x10, - MP_IMGFIELD_INTERLACED =0x20 -}; -#include <stdlib.h> -#include <limits.h> - -enum { XP_IDX_INVALID=UINT_MAX }; -typedef struct mp_image_s { - unsigned xp_idx; /* index of xp_frame associated with this image */ - unsigned int flags; - unsigned char type; - unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 - unsigned int imgfmt; - unsigned width,height; // stored dimensions - int x,y,w,h; // slice dimensions - unsigned num_planes; - unsigned char* planes[MP_MAX_PLANES]; - unsigned int stride[MP_MAX_PLANES]; - char * qscale; - unsigned qstride; - unsigned qscale_type; // 0->mpeg1/4/h263, 1->mpeg2 - unsigned pict_type; // 0->unknown, 1->I, 2->P, 3->B - unsigned fields; - /* these are only used by planar formats Y,U(Cb),V(Cr) */ - int chroma_width; - int chroma_height; - int chroma_x_shift; // horizontal - int chroma_y_shift; // vertical - any_t* priv; /* for private use by filter or vo driver (to store buffer id or dmpi) */ -} mp_image_t; - -extern void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt); -extern mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx); -extern void free_mp_image(mp_image_t* mpi); -extern mp_image_t* alloc_mpi(unsigned w, unsigned h, unsigned int fmt,unsigned xp_idx); -extern void mpi_alloc_planes(mp_image_t *mpi); -extern void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi); -extern void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned height); - -#endif Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/mplayer.c 2012-11-03 15:54:18 UTC (rev 292) @@ -23,7 +23,7 @@ #include "version.h" #include "mp_config.h" -#include "sig_hand.h" +#include "xmpcore/sig_hand.h" #include "mplayer.h" #include "osdep/mplib.h" #include "postproc/swscale.h" Modified: mplayerxp/postproc/libmenu/menu.c =================================================================== --- mplayerxp/postproc/libmenu/menu.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/libmenu/menu.c 2012-11-03 15:54:18 UTC (rev 292) @@ -17,7 +17,7 @@ #include "libvo/img_format.h" #include "libvo/video_out.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "libmpconf/m_option.h" #include "libmpconf/m_struct.h" #include "menu.h" Modified: mplayerxp/postproc/libmenu/menu_cmdlist.c =================================================================== --- mplayerxp/postproc/libmenu/menu_cmdlist.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/libmenu/menu_cmdlist.c 2012-11-03 15:54:18 UTC (rev 292) @@ -7,7 +7,7 @@ #include <string.h> #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "libmpconf/m_option.h" #include "libmpconf/m_struct.h" Modified: mplayerxp/postproc/libmenu/menu_console.c =================================================================== --- mplayerxp/postproc/libmenu/menu_console.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/libmenu/menu_console.c 2012-11-03 15:54:18 UTC (rev 292) @@ -14,7 +14,7 @@ #include <errno.h> #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "libmpdemux/stream.h" #include "libmpconf/cfgparser.h" Modified: mplayerxp/postproc/libmenu/menu_filesel.c =================================================================== --- mplayerxp/postproc/libmenu/menu_filesel.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/libmenu/menu_filesel.c 2012-11-03 15:54:18 UTC (rev 292) @@ -19,7 +19,7 @@ #include "libmpconf/cfgparser.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "menu.h" #include "menu_list.h" Modified: mplayerxp/postproc/libmenu/menu_list.c =================================================================== --- mplayerxp/postproc/libmenu/menu_list.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/libmenu/menu_list.c 2012-11-03 15:54:18 UTC (rev 292) @@ -7,7 +7,7 @@ #include "libvo/img_format.h" #include "libvo/sub.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "libmpconf/m_struct.h" #include "menu.h" Modified: mplayerxp/postproc/libmenu/menu_param.c =================================================================== --- mplayerxp/postproc/libmenu/menu_param.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/libmenu/menu_param.c 2012-11-03 15:54:18 UTC (rev 292) @@ -19,7 +19,7 @@ #include "libplaytree/asxparser.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "menu.h" #include "menu_list.h" Modified: mplayerxp/postproc/libmenu/menu_pt.c =================================================================== --- mplayerxp/postproc/libmenu/menu_pt.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/libmenu/menu_pt.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "help_mp.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "libmpconf/m_struct.h" #include "libmpconf/m_option.h" Modified: mplayerxp/postproc/libmenu/menu_txt.c =================================================================== --- mplayerxp/postproc/libmenu/menu_txt.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/libmenu/menu_txt.c 2012-11-03 15:54:18 UTC (rev 292) @@ -8,7 +8,7 @@ #include "libvo/img_format.h" #include "libvo/sub.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "libmpdemux/stream.h" #include "libmpconf/cfgparser.h" Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf.c 2012-11-03 15:54:18 UTC (rev 292) @@ -9,7 +9,7 @@ #include "libvo/img_format.h" #include "libvo/video_out.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_1bpp.c =================================================================== --- mplayerxp/postproc/vf_1bpp.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_1bpp.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "postproc/swscale.h" Modified: mplayerxp/postproc/vf_2xsai.c =================================================================== --- mplayerxp/postproc/vf_2xsai.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_2xsai.c 2012-11-03 15:54:18 UTC (rev 292) @@ -5,8 +5,8 @@ #include "mp_config.h" -#include "../libvo/img_format.h" -#include "../mp_image.h" +#include "libvo/img_format.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_aspect.c =================================================================== --- mplayerxp/postproc/vf_aspect.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_aspect.c 2012-11-03 15:54:18 UTC (rev 292) @@ -7,7 +7,7 @@ #include "libvo/img_format.h" #include "osdep/mplib.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_delogo.c =================================================================== --- mplayerxp/postproc/vf_delogo.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_delogo.c 2012-11-03 15:54:18 UTC (rev 292) @@ -28,7 +28,7 @@ #include "osdep/cpudetect.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_denoise3d.c =================================================================== --- mplayerxp/postproc/vf_denoise3d.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_denoise3d.c 2012-11-03 15:54:18 UTC (rev 292) @@ -25,7 +25,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_dint.c =================================================================== --- mplayerxp/postproc/vf_dint.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_dint.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "osdep/fastmemcpy.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "libvo/img_format.h" #include "osdep/mplib.h" #include "vf.h" Modified: mplayerxp/postproc/vf_down3dright.c =================================================================== --- mplayerxp/postproc/vf_down3dright.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_down3dright.c 2012-11-03 15:54:18 UTC (rev 292) @@ -7,7 +7,7 @@ #include "osdep/cpudetect.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_eq.c =================================================================== --- mplayerxp/postproc/vf_eq.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_eq.c 2012-11-03 15:54:18 UTC (rev 292) @@ -20,7 +20,7 @@ #include "libvo/img_format.h" #include "libvo/video_out.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_expand.c =================================================================== --- mplayerxp/postproc/vf_expand.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_expand.c 2012-11-03 15:54:18 UTC (rev 292) @@ -7,7 +7,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_flip.c =================================================================== --- mplayerxp/postproc/vf_flip.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_flip.c 2012-11-03 15:54:18 UTC (rev 292) @@ -23,7 +23,7 @@ #include "config.h" #include "pp_msg.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "libvo/video_out.h" Modified: mplayerxp/postproc/vf_format.c =================================================================== --- mplayerxp/postproc/vf_format.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_format.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "pp_msg.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_framestep.c =================================================================== --- mplayerxp/postproc/vf_framestep.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_framestep.c 2012-11-03 15:54:18 UTC (rev 292) @@ -56,7 +56,7 @@ #include "osdep/cpudetect.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "osdep/mplib.h" #include "vf.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_il.c =================================================================== --- mplayerxp/postproc/vf_il.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_il.c 2012-11-03 15:54:18 UTC (rev 292) @@ -25,7 +25,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_menu.c =================================================================== --- mplayerxp/postproc/vf_menu.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_menu.c 2012-11-03 15:54:18 UTC (rev 292) @@ -9,7 +9,7 @@ #include "mplayer.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_mirror.c =================================================================== --- mplayerxp/postproc/vf_mirror.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_mirror.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_noise.c =================================================================== --- mplayerxp/postproc/vf_noise.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_noise.c 2012-11-03 15:54:18 UTC (rev 292) @@ -26,7 +26,7 @@ #include "osdep/cpudetect.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_ow.c =================================================================== --- mplayerxp/postproc/vf_ow.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_ow.c 2012-11-03 15:54:18 UTC (rev 292) @@ -34,7 +34,7 @@ #include "libvo/img_format.h" #include "osdep/mplib.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_palette.c =================================================================== --- mplayerxp/postproc/vf_palette.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_palette.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "postproc/swscale.h" Modified: mplayerxp/postproc/vf_panscan.c =================================================================== --- mplayerxp/postproc/vf_panscan.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_panscan.c 2012-11-03 15:54:18 UTC (rev 292) @@ -7,7 +7,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_perspective.c =================================================================== --- mplayerxp/postproc/vf_perspective.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_perspective.c 2012-11-03 15:54:18 UTC (rev 292) @@ -26,7 +26,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_pp.c =================================================================== --- mplayerxp/postproc/vf_pp.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_pp.c 2012-11-03 15:54:18 UTC (rev 292) @@ -9,7 +9,7 @@ #include "osdep/mplib.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "postprocess.h" Modified: mplayerxp/postproc/vf_raw.c =================================================================== --- mplayerxp/postproc/vf_raw.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_raw.c 2012-11-03 15:54:18 UTC (rev 292) @@ -10,7 +10,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_rectangle.c =================================================================== --- mplayerxp/postproc/vf_rectangle.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_rectangle.c 2012-11-03 15:54:18 UTC (rev 292) @@ -1,7 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_rgb2bgr.c =================================================================== --- mplayerxp/postproc/vf_rgb2bgr.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_rgb2bgr.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_rotate.c =================================================================== --- mplayerxp/postproc/vf_rotate.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_rotate.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_scale.c =================================================================== --- mplayerxp/postproc/vf_scale.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_scale.c 2012-11-03 15:54:18 UTC (rev 292) @@ -7,7 +7,7 @@ #include "osdep/cpudetect.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "libvo/video_out.h" Modified: mplayerxp/postproc/vf_smartblur.c =================================================================== --- mplayerxp/postproc/vf_smartblur.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_smartblur.c 2012-11-03 15:54:18 UTC (rev 292) @@ -29,7 +29,7 @@ #endif #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_softpulldown.c =================================================================== --- mplayerxp/postproc/vf_softpulldown.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_softpulldown.c 2012-11-03 15:54:18 UTC (rev 292) @@ -5,7 +5,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_swapuv.c =================================================================== --- mplayerxp/postproc/vf_swapuv.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_swapuv.c 2012-11-03 15:54:18 UTC (rev 292) @@ -25,7 +25,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_test.c =================================================================== --- mplayerxp/postproc/vf_test.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_test.c 2012-11-03 15:54:18 UTC (rev 292) @@ -24,7 +24,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "swscale.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_unsharp.c =================================================================== --- mplayerxp/postproc/vf_unsharp.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_unsharp.c 2012-11-03 15:54:18 UTC (rev 292) @@ -31,7 +31,7 @@ #endif #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" #include "osdep/mplib.h" Modified: mplayerxp/postproc/vf_vo.c =================================================================== --- mplayerxp/postproc/vf_vo.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_vo.c 2012-11-03 15:54:18 UTC (rev 292) @@ -4,7 +4,7 @@ #include "mp_config.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "vfcap.h" #include "libvo/video_out.h" Modified: mplayerxp/postproc/vf_yuvcsp.c =================================================================== --- mplayerxp/postproc/vf_yuvcsp.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_yuvcsp.c 2012-11-03 15:54:18 UTC (rev 292) @@ -7,7 +7,7 @@ #include "libvo/img_format.h" #include "osdep/mplib.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_yuy2.c =================================================================== --- mplayerxp/postproc/vf_yuy2.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_yuy2.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/postproc/vf_yvu9.c =================================================================== --- mplayerxp/postproc/vf_yvu9.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/postproc/vf_yvu9.c 2012-11-03 15:54:18 UTC (rev 292) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "libvo/img_format.h" -#include "mp_image.h" +#include "xmpcore/mp_image.h" #include "vf.h" #include "osdep/fastmemcpy.h" Deleted: mplayerxp/sig_hand.c =================================================================== --- mplayerxp/sig_hand.c 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/sig_hand.c 2012-11-03 15:54:18 UTC (rev 292) @@ -1,102 +0,0 @@ -/* - MplayerXP's Signal handling -*/ -#include "mp_config.h" -#include "mplayer.h" -#ifndef _GNU_SOURCE -#define _GNU_SOURCE /* to get definition of strsignal */ -#endif -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <sys/resource.h> -#include "sig_hand.h" -#include <sys/types.h> -#include <unistd.h> -#include <stdlib.h> -#include "xmpcore/xmp_core.h" -#include "mp_msg.h" -#include "osdep/mplib.h" -#define MSGT_CLASS MSGT_CPLAYER -#include "mp_msg.h" - -#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 (); -} -#endif -static void my_callback(int signo) -{ - int i; - pthread_t _self = pthread_self(); - for(i=0; i < xp_core->num_threads && !pthread_equal(xp_core->mpxp_threads[i]->pth_id, _self); i++); - if(i >= xp_core->num_threads || - !pthread_equal(xp_core->mpxp_threads[i]->pth_id, _self)) i = 0; /* Use 0 as default handler */ - - mp_msg(MSGT_CPLAYER,MSGL_FATAL,__FILE__,__LINE__,"catching signal: %s in thread: %s (%i) in module: %s\n" - ,strsignal(signo) - ,xp_core->mpxp_threads[i]->name - ,i - ,xp_core->mpxp_threads[i]->unit); -#ifdef HAVE_BACKTRACE - dump_trace(); -#endif - xp_core->mpxp_threads[i]->sigfunc(); - - signal(signo,SIG_DFL); /* try coredump*/ - - return; -} - -void init_signal_handling( void ) -{ -#ifdef MP_DEBUG - /*========= Catch terminate signals: ================*/ - /* terminate requests:*/ - signal(SIGTERM,my_callback); /* kill*/ - signal(SIGHUP,my_callback); /* kill -HUP / xterm closed*/ - - signal(SIGINT,my_callback); /* Interrupt from keyboard */ - - signal(SIGQUIT,my_callback); /* Quit from keyboard */ - /* fatal errors: */ - signal(SIGBUS,my_callback); /* bus error */ - signal(SIGSEGV,my_callback); /* segfault */ - signal(SIGILL,my_callback); /* illegal instruction */ - signal(SIGFPE,my_callback); /* floating point exc. */ - signal(SIGABRT,my_callback); /* abort() */ -#endif -#ifdef RLIMIT_CORE - { - /* on many systems default coresize is 0. - Enable any coresize here. */ - struct rlimit rl; - getrlimit(RLIMIT_CORE,&rl); - rl.rlim_cur = rl.rlim_max; - setrlimit(RLIMIT_CORE,&rl); - } -#endif -} Deleted: mplayerxp/sig_hand.h =================================================================== --- mplayerxp/sig_hand.h 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/sig_hand.h 2012-11-03 15:54:18 UTC (rev 292) @@ -1,18 +0,0 @@ -/* - MplayerXP's Signal handling -*/ -#ifndef __SIG_HAND_H -#define __SIG_HAND_H 1 - -#include <sys/types.h> -#include "xmpcore/xmp_core.h" - -static inline void __MP_UNIT(unsigned id,const char *name) { xp_core->mpxp_threads[id]->unit=name; } -static inline void MP_UNIT(const char *name) { xp_core->mpxp_threads[main_id]->unit=name; } - -extern void init_signal_handling( void ); -extern void uninit_signal_handling( int xp_id ); - -#endif - - Modified: mplayerxp/xmpcore/Makefile =================================================================== --- mplayerxp/xmpcore/Makefile 2012-11-03 15:35:56 UTC (rev 291) +++ mplayerxp/xmpcore/Makefile 2012-11-03 15:54:18 UTC (rev 292) @@ -3,6 +3,7 @@ LIBNAME = libxmpcore.a SRCS=xmp_core.c xmp_aplayer.c xmp_vplayer.c xmp_vdecoder.c xmp_adecoder.c +SRCS+=mp_image.c sig_hand.c OBJS=$(SRCS:.c=.o) CFLAGS = $(OPTFLAGS) -I. -I.. -Wall Copied: mplayerxp/xmpcore/mp_image.c (from rev 286, mplayerxp/mp_image.c) =================================================================== --- mplayerxp/xmpcore/mp_image.c (rev 0) +++ mplayerxp/xmpcore/mp_image.c 2012-11-03 15:54:18 UTC (rev 292) @@ -0,0 +1,221 @@ +#include "mp_config.h" +#include "mplayer.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "osdep/mplib.h" +#include "libvo/img_format.h" +#include "mp_image.h" +#include "osdep/fastmemcpy.h" +#define MSGT_CLASS MSGT_CPLAYER +#include "mp_msg.h" + +void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ + mpi->flags&=~(MP_IMGFLAG_PLANAR|MP_IMGFLAG_YUV|MP_IMGFLAG_SWAPPED); + mpi->imgfmt=out_fmt; + if(out_fmt == IMGFMT_MPEGPES){ + mpi->bpp=0; + return; + } + if(out_fmt == IMGFMT_ZRMJPEGNI || + out_fmt == IMGFMT_ZRMJPEGIT || + out_fmt == IMGFMT_ZRMJPEGIB){ + mpi->bpp=0; + return; + } + if(IMGFMT_IS_XVMC(out_fmt)){ + mpi->bpp=0; + return; + } + mpi->num_planes=1; + if (IMGFMT_IS_RGB(out_fmt) || IMGFMT_IS_BGR(out_fmt)) { + mpi->bpp = rgbfmt_depth(out_fmt); + if(IMGFMT_IS_BGR(out_fmt)) mpi->flags|=MP_IMGFLAG_SWAPPED; + return; + } + mpi->flags|=MP_IMGFLAG_YUV; + mpi->num_planes=3; + switch(out_fmt){ + case IMGFMT_I420: + case IMGFMT_IYUV: + mpi->flags|=MP_IMGFLAG_SWAPPED; + case IMGFMT_YV12: + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=12; + mpi->chroma_width=(mpi->width>>1); + mpi->chroma_height=(mpi->height>>1); + mpi->chroma_x_shift=1; + mpi->chroma_y_shift=1; + return; + case IMGFMT_420A: + case IMGFMT_IF09: + mpi->num_planes=4; + case IMGFMT_YVU9: + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=9; + mpi->chroma_width=(mpi->width>>2); + mpi->chroma_height=(mpi->height>>2); + mpi->chroma_x_shift=2; + mpi->chroma_y_shift=2; + return; + case IMGFMT_444P16_LE: + case IMGFMT_444P16_BE: + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=48; + mpi->chroma_width=(mpi->width); + mpi->chroma_height=(mpi->height); + mpi->chroma_x_shift=0; + mpi->chroma_y_shift=0; + return; + case IMGFMT_444P: + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=24; + mpi->chroma_width=(mpi->width); + mpi->chroma_height=(mpi->height); + mpi->chroma_x_shift=0; + mpi->chroma_y_shift=0; + return; + case IMGFMT_422P16_LE: + case IMGFMT_422P16_BE: + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=32; + mpi->chroma_width=(mpi->width>>1); + mpi->chroma_height=(mpi->height); + mpi->chroma_x_shift=1; + mpi->chroma_y_shift=0; + return; + case IMGFMT_422P: + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=16; + mpi->chroma_width=(mpi->width>>1); + mpi->chroma_height=(mpi->height); + mpi->chroma_x_shift=1; + mpi->chroma_y_shift=0; + return; + case IMGFMT_420P16_LE: + case IMGFMT_420P16_BE: + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=24; + mpi->chroma_width=(mpi->width>>2); + mpi->chroma_height=(mpi->height); + mpi->chroma_x_shift=2; + mpi->chroma_y_shift=0; + return; + case IMGFMT_411P: + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=12; + mpi->chroma_width=(mpi->width>>2); + mpi->chroma_height=(mpi->height); + mpi->chroma_x_shift=2; + mpi->chroma_y_shift=0; + return; + case IMGFMT_Y800: + case IMGFMT_Y8: + /* they're planar ones, but for easier handling use them as packed */ +// mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=8; + mpi->num_planes=1; + return; + case IMGFMT_UYVY: + mpi->flags|=MP_IMGFLAG_SWAPPED; + case IMGFMT_YUY2: + mpi->bpp=16; + mpi->num_planes=1; + return; + case IMGFMT_NV12: + mpi->flags|=MP_IMGFLAG_SWAPPED; + case IMGFMT_NV21: + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=12; + mpi->num_planes=2; + mpi->chroma_width=(mpi->width>>0); + mpi->chroma_height=(mpi->height>>1); + mpi->chroma_x_shift=0; + mpi->chroma_y_shift=1; + return; + } + MSG_WARN("mp_image: Unknown out_fmt: 0x%X\n",out_fmt); + mpi->bpp=0; +} + +mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx){ + mp_image_t* mpi=(mp_image_t*)mp_mallocz(sizeof(mp_image_t)); + if(!mpi) return NULL; // error! + mpi->xp_idx = xp_idx; + mpi->width=mpi->w=w; + mpi->height=mpi->h=h; + return mpi; +} + +void free_mp_image(mp_image_t* mpi){ + if(!mpi) return; + if(mpi->flags&MP_IMGFLAG_ALLOCATED){ + /* becouse we allocate the whole image in once */ + if(mpi->planes[0]) mp_free(mpi->planes[0]); + } + mp_free(mpi); +} + +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_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; + } 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 { + if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; + } + mpi->flags|=MP_IMGFLAG_ALLOCATED; +} + +void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi) { + if(mpi->flags&MP_IMGFLAG_PLANAR){ + memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w, mpi->h, + dmpi->stride[0],mpi->stride[0]); + memcpy_pic(dmpi->planes[1],mpi->planes[1], mpi->chroma_width, mpi->chroma_height, + dmpi->stride[1],mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height, + dmpi->stride[2],mpi->stride[2]); + } else { + memcpy_pic(dmpi->planes[0],mpi->planes[0], + mpi->w*(dmpi->bpp/8), mpi->h, + dmpi->stride[0],mpi->stride[0]); + } +} + +void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned h) +{ + *dmpi = *mpi; + dmpi->y = y; + dmpi->h = h; + dmpi->chroma_height = h >> mpi->chroma_y_shift; + dmpi->xp_idx = mpi->xp_idx; +} Copied: mplayerxp/xmpcore/mp_image.h (from rev 286, mplayerxp/mp_image.h) =================================================================== --- mplayerxp/xmpcore/mp_image.h (rev 0) +++ mplayerxp/xmpcore/mp_image.h 2012-11-03 15:54:18 UTC (rev 292) @@ -0,0 +1,100 @@ +#ifndef __MP_IMAGE_H +#define __MP_IMAGE_H 1 + +#include "mp_config.h" + +//--------- codec's requirements (filled by the codec/vf) --------- + +//--- buffer content restrictions: +enum { + MP_IMGFLAG_PRESERVE=0x00001, // set if buffer content shouldn't be modified: + MP_IMGFLAG_READABLE=0x00002 // set if buffer content will be READ for next frame's MC: (I/P mpeg frames) +}; + +//--- buffer width/stride/plane restrictions: (used for direct rendering) +enum { +// stride _have_to_ be aligned to MB boundary: [for DR restrictions] + MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE =0x00004, /* no flag - should be neg value of MP_IMGFLAG_ACCEPT_STRIDE */ +// stride should be aligned to MB boundary: [for buffer allocation] + MP_IMGFLAG_PREFER_ALIGNED_STRIDE =0x00008, /* sould be no flag - everything prefer aligned strides */ + MP_IMGFLAG_ACCEPT_STRIDE =0x00010, // codec accept any stride (>=width): + MP_IMGFLAG_ACCEPT_WIDTH =0x00020, // codec accept any width (width*bpp=stride -> stride%bpp==0) (>=width): +//--- for planar formats only: +// uses only stride[0], and stride[1]=stride[2]=stride[0]>>mpi->chroma_x_shift + MP_IMGFLAG_COMMON_STRIDE =0x00040, /* UNUSED */ +// uses only planes[0], and calculates planes[1,2] from width,height,imgfmt + MP_IMGFLAG_COMMON_PLANE =0x00080, /* UNUSED */ + MP_IMGFLAGMASK_RESTRICTIONS =0x000FF, +//--------- color info (filled by mp_image_setfmt() ) ----------- + MP_IMGFLAG_PLANAR =0x00100, // set if number of planes > 1 + MP_IMGFLAG_YUV =0x00200, // set if it's YUV colorspace + MP_IMGFLAG_SWAPPED =0x00400, // set if it's swapped (BGR or YVU) plane/byteorder + MP_IMGFLAG_RGB_PALETTE =0x00800, // using palette for RGB data + MP_IMGFLAGMASK_COLORS =0x00F00, +// codec uses drawing/rendering callbacks (draw_slice()-like thing, DR method 2) +// [the codec will set this flag if it supports callbacks, and the vo _may_ +// clear it in get_image() if draw_slice() not implemented] + MP_IMGFLAG_DRAW_CALLBACK =0x01000, + MP_IMGFLAG_DIRECT =0x02000, // set if it's in video buffer/memory: [set by vo/vf's get_image() !!!] + MP_IMGFLAG_ALLOCATED =0x04000, // set if buffer is allocated (used in destination images): + MP_IMGFLAG_TYPE_DISPLAYED =0x08000, // buffer type was printed (do NOT set this flag - it's for INTERNAL USE!!!) + MP_IMGFLAG_FINAL =0x10000, // buffer is video memory + MP_IMGFLAG_RENDERED =0x20000, // final buffer was already painted + MP_IMGFLAG_FINALIZED =0x40000 // indicates final step of image processing from CPU side!!! +}; + +/* codec doesn't support any form of direct rendering - it has own buffer */ +enum { + MP_IMGTYPE_EXPORT =0, // allocation. so we just export its buffer pointers: + MP_IMGTYPE_STATIC =1, // codec requires a static WO buffer, but it does only partial updates later: + MP_IMGTYPE_TEMP =2, // codec just needs some WO memory, where it writes/copies the whole frame to: + MP_IMGTYPE_IP =3, // I+P type, requires 2+ independent static R/W buffers + MP_IMGTYPE_IPB =4, // I+P+B type, requires 2+ independent static R/W and 1+ temp WO buffers + + MP_MAX_PLANES =4 +}; +enum { + MP_IMGFIELD_ORDERED =0x01, + MP_IMGFIELD_TOP_FIRST =0x02, + MP_IMGFIELD_REPEAT_FIRST =0x04, + MP_IMGFIELD_TOP =0x08, + MP_IMGFIELD_BOTTOM =0x10, + MP_IMGFIELD_INTERLACED =0x20 +}; +#include <stdlib.h> +#include <limits.h> + +enum { XP_IDX_INVALID=UINT_MAX }; +typedef struct mp_image_s { + unsigned xp_idx; /* index of xp_frame associated with this image */ + unsigned int flags; + unsigned char type; + unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 + unsigned int imgfmt; + unsigned width,height; // stored dimensions + int x,y,w,h; // slice dimensions + unsigned num_planes; + unsigned char* planes[MP_MAX_PLANES]; + unsigned int stride[MP_MAX_PLANES]; + char * qscale; + unsigned qstride; + unsigned qscale_type; // 0->mpeg1/4/h263, 1->mpeg2 + unsigned pict_type; // 0->unknown, 1->I, 2->P, 3->B + unsigned fields; + /* these are only used by planar formats Y,U(Cb),V(Cr) */ + int chroma_width; + int chroma_height; + int chroma_x_shift; // horizontal + int chroma_y_shift; // vertical + any_t* priv; /* for private use by filter or vo driver (to store buffer id or dmpi) */ +} mp_image_t; + +extern void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt); +extern mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx); +extern void free_mp_image(mp_image_t* mpi); +extern mp_image_t* alloc_mpi(unsigned w, unsigned h, unsigned int fmt,unsigned xp_idx); +extern void mpi_alloc_planes(mp_image_t *mpi); +extern void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi); +extern void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned height); + +#endif Copied: mplayerxp/xmpcore/sig_hand.c (from rev 286, mplayerxp/sig_hand.c) =================================================================== --- mplayerxp/xmpcore/sig_hand.c (rev 0) +++ mplayerxp/xmpcore/sig_hand.c 2012-11-03 15:54:18 UTC (rev 292) @@ -0,0 +1,102 @@ +/* + MplayerXP's Signal handling +*/ +#include "mp_config.h" +#include "mplayer.h" +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* to get definition of strsignal */ +#endif +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <signal.h> +#include <sys/resource.h> +#include "sig_hand.h" +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include "xmpcore/xmp_core.h" +#include "mp_msg.h" +#include "osdep/mplib.h" +#define MSGT_CLASS MSGT_CPLAYER +#include "mp_msg.h" + +#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 (); +} +#endif +static void my_callback(int signo) +{ + int i; + pthread_t _self = pthread_self(); + for(i=0; i < xp_core->num_threads && !pthread_equal(xp_core->mpxp_threads[i]->pth_id, _self); i++); + if(i >= xp_core->num_threads || + !pthread_equal(xp_core->mpxp_threads[i]->pth_id, _self)) i = 0; /* Use 0 as default handler */ + + mp_msg(MSGT_CPLAYER,MSGL_FATAL,__FILE__,__LINE__,"catching signal: %s in thread: %s (%i) in module: %s\n" + ,strsignal(signo) + ,xp_core->mpxp_threads[i]->name + ,i + ,xp_core->mpxp_threads[i]->unit); +#ifdef HAVE_BACKTRACE + dump_trace(); +#endif + xp_core->mpxp_threads[i]->sigfunc(); + + signal(signo,SIG_DFL); /* try coredump*/ + + return; +} + +void init_signal_handling( void ) +{ +#ifdef MP_DEBUG + /*========= Catch terminate signals: ================*/ + /* terminate requests:*/ + signal(SIGTERM,my_callback); /* kill*/ + signal(SIGHUP,my_callback); /* kill -HUP / xterm closed*/ + + signal(SIGINT,my_callback); /* Interrupt from keyboard */ + + signal(SIGQUIT,my_callback); /* Quit from keyboard */ + /* fatal errors: */ + signal(SIGBUS,my_callback); /* bus error */ + signal(SIGSEGV,my_callback); /* segfault */ + signal(SIGILL,my_callback); /* illegal instruction */ + signal(SIGFPE,my_callback); /* floating point exc. */ + signal(SIGABRT,my_callback); /* abort() */ +#endif +#ifdef RLIMIT_CORE + { + /* on many systems default coresize is 0. + Enable any coresize here. */ + struct rlimit rl; + getrlimit(RLIMIT_CORE,&rl); + rl.rlim_cur = rl.rlim_max; + setrlimit(RLIMIT_CORE,&rl); + } +#endif +} Copied: mplayerxp/xmpcore/sig_hand.h (from rev 286, mplayerxp/sig_hand.h) =================================================================== --- mplayerxp/xmpcore/sig_hand.h (rev 0) +++ mplayerxp/xmpcore/sig_hand.h 2012-11-03 15:54:18 UTC (rev 292) @@ -0,0 +1,18 @@ +/* + MplayerXP's Signal handling +*/ +#ifndef __SIG_HAND_H +#define __SIG_HAND_H 1 + +#include <sys/types.h> +#include "xmpcore/xmp_core.h" + +static inline void __MP_UNIT(unsigned id,const char *name) { xp_core->mpxp_threads[id]->unit=name; } +static inline void MP_UNIT(const char *name) { xp_core->mpxp_threads[main_id]->unit=name; } + +extern void init_signal_handling( void ); +extern void uninit_signal_handling( int xp_id ); + +#endif + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-03 16:20:48
|
Revision: 294 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=294&view=rev Author: nickols_k Date: 2012-11-03 16:20:40 +0000 (Sat, 03 Nov 2012) Log Message: ----------- move -play.frames into better place Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/xmpcore/xmp_vdecoder.c Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-03 15:58:48 UTC (rev 293) +++ mplayerxp/mplayer.c 2012-11-03 16:20:40 UTC (rev 294) @@ -2010,11 +2010,6 @@ while(!eof){ int in_pause=0; - if(mp_conf.play_n_frames>=0){ - --mp_conf.play_n_frames; - if(mp_conf.play_n_frames<0) eof = PT_NEXT_ENTRY; - } - eof |= xp_core->audio->eof; /*========================== UPDATE TIMERS ============================*/ MP_UNIT("Update timers"); Modified: mplayerxp/xmpcore/xmp_vdecoder.c =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-03 15:58:48 UTC (rev 293) +++ mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-03 16:20:40 UTC (rev 294) @@ -165,10 +165,12 @@ /*-------------------- Decode a frame: -----------------------*/ in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,sh_video->fps); if(in_size<0) { + pt_exit_loop: dae_decoded_mark_eof(xp_core->video); priv->dae->eof=1; break; } + if(mp_conf.play_n_frames>0 && xp_core->video->num_decoded_frames >= mp_conf.play_n_frames) goto pt_exit_loop; /* in_size==0: it's or broken stream or demuxer's bug */ if(in_size==0 && priv->state!=Pth_Canceling) continue; /* frame was decoded into current decoder_idx */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-03 19:08:56
|
Revision: 295 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=295&view=rev Author: nickols_k Date: 2012-11-03 19:08:50 +0000 (Sat, 03 Nov 2012) Log Message: ----------- add hook for suspect calls in mp_malloc Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/osdep/mp_malloc.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-11-03 16:20:40 UTC (rev 294) +++ mplayerxp/cfg-mplayer.h 2012-11-03 19:08:50 UTC (rev 295) @@ -48,6 +48,7 @@ {"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}, }; Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-03 16:20:40 UTC (rev 294) +++ mplayerxp/mplayer.c 2012-11-03 19:08:50 UTC (rev 295) @@ -1653,7 +1653,9 @@ int forced_subs_only=0; seek_args_t seek_args = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; - mp_init_malloc(argv[0],1000,10,MPA_FLG_RANDOMIZER); // MPA_FLG_BACKTRACE + mp_conf.malloc_debug=0; + for(i=0;i<argc;i++) if(strcmp(argv[i],"-core.malloc-debug")==0) { mp_conf.malloc_debug=1; break; } + mp_init_malloc(argv[0],1000,10,mp_conf.malloc_debug?MPA_FLG_BACKTRACE:MPA_FLG_RANDOMIZER); mpxp_init_structs(); priv_t*priv=mp_data->priv; Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-11-03 16:20:40 UTC (rev 294) +++ mplayerxp/mplayer.h 2012-11-03 19:08:50 UTC (rev 295) @@ -13,6 +13,7 @@ int slave_mode; uint32_t msg_filter; int test_av; + int malloc_debug; // XP-core int xp; /* XP-mode */ int gomp; /* currently it's experimental feature */ Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-11-03 16:20:40 UTC (rev 294) +++ mplayerxp/osdep/mp_malloc.c 2012-11-03 19:08:50 UTC (rev 295) @@ -21,6 +21,11 @@ any_t* calls[10]; }mp_slot_t; +typedef struct mp_slot_container_s { + mp_slot_t* slots; + size_t nslots; +}mp_slot_container_t; + typedef struct priv_s { const char* argv0; unsigned rnd_limit; @@ -29,8 +34,9 @@ /* for randomizer */ unsigned long long int total_calls; /* backtrace and protector slots */ - mp_slot_t* slots; - size_t nslots; + mp_slot_container_t mallocs;/* not freed mallocs */ + mp_slot_container_t reallocs; /* suspect reallocs */ + mp_slot_container_t frees; /* suspect free */ }priv_t; static priv_t* priv; @@ -44,46 +50,49 @@ return fullsize; } static any_t* prot_last_page(any_t* rp,size_t fullsize) { return rp+(fullsize-__VM_PAGE_SIZE__); } -static void __prot_print_slots(void) { +static void __prot_print_slots(mp_slot_container_t* c) { size_t i; - for(i=0;i<priv->nslots;i++) { - MSG_INFO("slot[%u] address: %p size: %u\n",i,priv->slots[i].page_ptr,priv->slots[i].size); + for(i=0;i<c->nslots;i++) { + MSG_INFO("slot[%u] address: %p size: %u\n" + ,i + ,c->slots[i].page_ptr + ,c->slots[i].size); } } -static size_t prot_find_slot_idx(any_t* ptr) { +static size_t prot_find_slot_idx(mp_slot_container_t* c,any_t* ptr) { size_t i; - for(i=0;i<priv->nslots;i++) { - if(priv->slots[i].page_ptr==ptr) return i; + for(i=0;i<c->nslots;i++) { + if(c->slots[i].page_ptr==ptr) return i; } return UINT_MAX; } -static mp_slot_t* prot_find_slot(any_t* ptr) { - size_t idx=prot_find_slot_idx(ptr); - if(idx!=UINT_MAX) return &priv->slots[idx]; +static mp_slot_t* prot_find_slot(mp_slot_container_t* c,any_t* ptr) { + size_t idx=prot_find_slot_idx(c,ptr); + if(idx!=UINT_MAX) return &c->slots[idx]; return NULL; } -static mp_slot_t* prot_append_slot(any_t*ptr,size_t size) { - mp_slot_t* slot; - if(!priv->slots) slot=malloc(sizeof(mp_slot_t)); - else slot=realloc(priv->slots,sizeof(mp_slot_t)*(priv->nslots+1)); - priv->slots=slot; - memset(&priv->slots[priv->nslots],0,sizeof(mp_slot_t)); - priv->slots[priv->nslots].page_ptr=ptr; - priv->slots[priv->nslots].size=size; - priv->nslots++; - return &priv->slots[priv->nslots-1]; +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)); + c->slots=s; + memset(&c->slots[c->nslots],0,sizeof(mp_slot_t)); + c->slots[c->nslots].page_ptr=ptr; + c->slots[c->nslots].size=size; + c->nslots++; + return &c->slots[c->nslots-1]; } -static void prot_free_slot(any_t* ptr) { - size_t idx=prot_find_slot_idx(ptr); +static void prot_free_slot(mp_slot_container_t* c,any_t* ptr) { + size_t idx=prot_find_slot_idx(c,ptr); if(idx!=UINT_MAX) { - memmove(&priv->slots[idx],&priv->slots[idx+1],sizeof(mp_slot_t)*(priv->nslots-(idx+1))); - priv->nslots--; - priv->slots=realloc(priv->slots,sizeof(mp_slot_t)*priv->nslots); - } else printf("Internal error! Can't find slot for address: %p\n",ptr); + 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); + } else printf("[prot_free_slot] Internal error! Can't find slot for address: %p\n",ptr); } static any_t* __prot_malloc(size_t size) { @@ -91,7 +100,7 @@ size_t fullsize=prot_fullsize(size); rp=mp_memalign(__VM_PAGE_SIZE__,fullsize); if(rp) { - prot_append_slot(rp,size); + prot_append_slot(&priv->mallocs,rp,size); // protect last page here mprotect(prot_last_page(rp,fullsize),__VM_PAGE_SIZE__,MP_DENY_ALL); rp+=fullsize-__VM_PAGE_SIZE__-size; @@ -104,25 +113,25 @@ static void __prot_free(any_t*ptr) { any_t *page_ptr=prot_page_align(ptr); free(page_ptr); - mp_slot_t* slot=prot_find_slot(page_ptr); + mp_slot_t* slot=prot_find_slot(&priv->mallocs,page_ptr); if(!slot) { - printf("Internal error! Can't find slot for address: %p\n",ptr); - __prot_print_slots(); + printf("[__prot_free] suspect call found! Can't find slot for address: %p\n",ptr); + __prot_print_slots(&priv->mallocs); kill(getpid(), SIGILL); } size_t fullsize=prot_fullsize(slot->size); mprotect(prot_last_page(page_ptr,fullsize),__VM_PAGE_SIZE__,MP_PROT_READ|MP_PROT_WRITE); - prot_free_slot(ptr); + prot_free_slot(&priv->mallocs,ptr); } #define min(a,b) ((a)<(b)?(a):(b)) static any_t* __prot_realloc(any_t*ptr,size_t size) { any_t* rp; if((rp=__prot_malloc(size))!=NULL && ptr) { - mp_slot_t* slot=prot_find_slot(prot_page_align(ptr)); + mp_slot_t* slot=prot_find_slot(&priv->mallocs,prot_page_align(ptr)); if(!slot) { - printf("Internal error! Can't find slot for address: %p\n",ptr); - __prot_print_slots(); + printf("[__prot_realloc] suspect call found! Can't find slot for address: %p\n",ptr); + __prot_print_slots(&priv->mallocs); kill(getpid(), SIGILL); } memcpy(rp,ptr,min(slot->size,size)); @@ -158,7 +167,7 @@ mp_slot_t* slot; rp=malloc(size); if(rp) { - slot=prot_append_slot(rp,size); + slot=prot_append_slot(&priv->mallocs,rp,size); slot->ncalls=backtrace(slot->calls,10); } return rp; @@ -166,10 +175,10 @@ static __always_inline any_t* bt_memalign(size_t boundary,size_t size) { any_t*rp; - mp_slot_t* slot; rp=memalign(boundary,size); if(rp) { - slot=prot_append_slot(rp,size); + mp_slot_t* slot; + slot=prot_append_slot(&priv->mallocs,rp,size); slot->ncalls=backtrace(slot->calls,10); } return rp; @@ -181,9 +190,13 @@ if(!ptr) return bt_malloc(size); rp=realloc(ptr,size); if(rp) { - slot=prot_find_slot(ptr); - if(!slot) MSG_WARN("BT Internal error! Can't find slot for address: %p\n",ptr); - else { + slot=prot_find_slot(&priv->mallocs,ptr); + if(!slot) { + MSG_WARN("[bt_realloc] suspect call found! Can't find slot for address: %p\n",ptr); + mp_slot_t* _slot; + _slot=prot_append_slot(&priv->reallocs,ptr,size); + _slot->ncalls=backtrace(_slot->calls,10); + } else { slot->page_ptr=rp; // update address after realloc slot->size=size; } @@ -192,9 +205,15 @@ } static __always_inline void bt_free(any_t*ptr) { - mp_slot_t* slot=prot_find_slot(ptr); - if(!slot) MSG_WARN("BT Internal error! Can't find slot for address: %p\n",ptr); - prot_free_slot(ptr); + mp_slot_t* slot=prot_find_slot(&priv->mallocs,ptr); + if(!slot) { + MSG_WARN("[bt_free] suspect call found! Can't find slot for address: %p\n",ptr); + mp_slot_t* _slot; + _slot=prot_append_slot(&priv->frees,ptr,0); + _slot->ncalls=backtrace(_slot->calls,10); + return; + } + prot_free_slot(&priv->mallocs,ptr); free(ptr); } @@ -260,31 +279,28 @@ return NULL; } -static void bt_print_slots(void) { - bt_cache_t* cache=init_bt_cache(); +static void bt_print_slots(bt_cache_t* cache,mp_slot_container_t* c) { size_t i,j; - for(i=0;i<priv->nslots;i++) { + for(i=0;i<c->nslots;i++) { char *s; int printable=1; - MSG_INFO("address: %p size: %u dump: ",priv->slots[i].page_ptr,priv->slots[i].size); - s=priv->slots[i].page_ptr; - for(j=0;j<min(priv->slots[i].size,20);j++) { + MSG_INFO("address: %p size: %u dump: ",c->slots[i].page_ptr,c->slots[i].size); + s=c->slots[i].page_ptr; + for(j=0;j<min(c->slots[i].size,20);j++) { if(!isprint(s[j])) { printable=0; break; } } if(printable) MSG_INFO("%20s",s); - else for(j=0;j<min(priv->slots[i].size,10);j++) { + else for(j=0;j<min(c->slots[i].size,10);j++) { MSG_INFO("%02X ",(unsigned char)s[j]); } MSG_INFO("\n"); - for(j=0;j<priv->slots[i].ncalls;j++) { - MSG_INFO("%s%p -> %s\n",j==0?"bt=>":" ",priv->slots[i].calls[j],addr2line(cache,priv->slots[i].calls[j])); + for(j=0;j<c->slots[i].ncalls;j++) { + MSG_INFO("%s%p -> %s\n",j==0?"bt=>":" ",c->slots[i].calls[j],addr2line(cache,c->slots[i].calls[j])); } } - MSG_HINT("For source lines you may also print in (gdb): list *0xADDRESS\n"); - uninit_bt_cache(cache); } /* ================== HEAD FUNCTIONS ======================= */ void mp_init_malloc(const char *argv0,unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags) @@ -299,12 +315,36 @@ void mp_uninit_malloc(int verbose) { + int done=0; + bt_cache_t* cache=init_bt_cache(); if(priv->flags&MPA_FLG_BACKTRACE) { - if(priv->nslots) { - MSG_WARN("Warning! %lli slots were not freed\n",priv->nslots); - if(verbose) bt_print_slots(); + if(priv->mallocs.nslots) { + unsigned long total; + unsigned i; + total=0; + for(i=0;i<priv->mallocs.nslots;i++) total+=priv->mallocs.slots[i].size; + MSG_WARN("Warning! %lli slots were not freed. Totally %llu bytes was leaked\n",priv->mallocs.nslots,total); } + if(verbose) { + if(priv->mallocs.nslots) { + MSG_INFO("****** List of malloced but not freed pointers *******\n"); + bt_print_slots(cache,&priv->mallocs); + done=1; + } + if(priv->reallocs.nslots) { + MSG_INFO("\n****** List of suspect realloc() calls *******\n"); + bt_print_slots(cache,&priv->reallocs); + done=1; + } + if(priv->frees.nslots) { + MSG_INFO("\n****** List of suspect free() calls *******\n"); + bt_print_slots(cache,&priv->frees); + done=1; + } + } } + if(done) MSG_HINT("\nFor source lines you may also print in (gdb): list *0xADDRESS\n"); + uninit_bt_cache(cache); free(priv); priv=NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-07 15:12:00
|
Revision: 301 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=301&view=rev Author: nickols_k Date: 2012-11-07 15:11:47 +0000 (Wed, 07 Nov 2012) Log Message: ----------- bound arrays test: use libswresample for resampler Modified Paths: -------------- mplayerxp/Makefile mplayerxp/configure mplayerxp/mplayer.c mplayerxp/postproc/af.c mplayerxp/postproc/af_channels.c mplayerxp/postproc/af_crystality.c mplayerxp/postproc/af_echo3d.c mplayerxp/postproc/af_format.c mplayerxp/postproc/af_resample.c Removed Paths: ------------- mplayerxp/postproc/af_resample.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/Makefile 2012-11-07 15:11:47 UTC (rev 301) @@ -30,6 +30,7 @@ FF_LIBS = ../ffmpeg/libavcodec/libavcodec$(FF_SUFFIX).a \ ../ffmpeg/libswscale/libswscale$(FF_SUFFIX).a \ + ../ffmpeg/libswresample/libswresample$(FF_SUFFIX).a \ ../ffmpeg/libpostproc/libpostproc$(FF_SUFFIX).a \ ../ffmpeg/libavformat/libavformat$(FF_SUFFIX).a \ ../ffmpeg/libavutil/libavutil$(FF_SUFFIX).a Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/configure 2012-11-07 15:11:47 UTC (rev 301) @@ -320,7 +320,7 @@ add_cflags "-I$srcdir/../ffmpeg" print_config HAVE_ mp_config.h mp_config.mak ffmpeg # Configuring external ffmpeg stuff -ffmpeg_args="--enable-static --disable-shared --enable-gpl --enable-pthreads --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --disable-avdevice --disable-avfilter --disable-avresample --disable-swresample" +ffmpeg_args="--enable-static --disable-shared --enable-gpl --enable-pthreads --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --disable-avdevice --disable-avfilter --disable-avresample" if test -n $host ; then _arch=$host_arch x86_32 && _arch="i686" @@ -332,7 +332,7 @@ test "$debug" != "0" && ffmpeg_args="$ffmpeg_args --enable-debug=$debug" enabled $profile && ffmpeg_args="$ffmpeg_args --enable-profile" if test -f "../ffmpeg/libavcodec/libavcodec$ff_libsuffix.a"; then -echocheck "ffmpeg was already configured for $ff_libsuffix" +echocheck "ffmpeg was already configured for $_arch" else echocheck "configuring ffmpeg stuff: --cc=\"$cc\" $ffmpeg_args" cd ../ffmpeg Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/mplayer.c 2012-11-07 15:11:47 UTC (rev 301) @@ -1656,6 +1656,8 @@ mp_conf.malloc_debug=0; for(i=0;i<argc;i++) if(strcmp(argv[i],"-core.malloc-debug")==0) { mp_conf.malloc_debug=1; break; } mp_init_malloc(argv[0],1000,10,mp_conf.malloc_debug?MPA_FLG_BACKTRACE:MPA_FLG_RANDOMIZER); +// mp_init_malloc(argv[0],1000,10,MPA_FLG_BOUNDS_CHECK); +// mp_init_malloc(argv[0],1000,10,MPA_FLG_BEFORE_CHECK); mpxp_init_structs(); priv_t*priv=mp_data->priv; Modified: mplayerxp/postproc/af.c =================================================================== --- mplayerxp/postproc/af.c 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/postproc/af.c 2012-11-07 15:11:47 UTC (rev 301) @@ -227,7 +227,7 @@ else s->last=af->prev; - // Uninitialize af and mp_free memory + // Uninitialize af and mp_free memory af->uninit(af); mp_free(af); } @@ -245,15 +245,14 @@ af_data_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(af_data_t)); - else - memcpy(&in,af->prev->data,sizeof(af_data_t)); + // Check if this is the first filter + if(!af->prev) memcpy(&in,&(s->input),sizeof(af_data_t)); + else memcpy(&in,af->prev->data,sizeof(af_data_t)); + // Reset just in case... in.audio=NULL; in.len=0; - + rv = af->control(af,AF_CONTROL_REINIT,&in); switch(rv){ case CONTROL_OK: @@ -264,58 +263,44 @@ af_instance_t* _new = NULL; // Insert channels filter if((af->prev?af->prev->data->nch:s->input.nch) != in.nch){ - // Create channels filter - if(NULL == (_new = af_prepend(s,af,"channels"))) - return CONTROL_ERROR; - // Set number of output channels - if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_CHANNELS,&in.nch))) - return rv; + if(NULL == (_new = af_prepend(s,af,"channels"))) return CONTROL_ERROR; + if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_CHANNELS,&in.nch))) return rv; // Initialize channels filter if(!_new->prev) memcpy(&in,&(s->input),sizeof(af_data_t)); else memcpy(&in,_new->prev->data,sizeof(af_data_t)); - if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_REINIT,&in))) - return rv; + if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_REINIT,&in))) return rv; } // Insert rate filter if((af->prev?af->prev->data->rate:s->input.rate) != in.rate){ - // Create channels filter - if(NULL == (_new = af_prepend(s,af,"resample"))) - return CONTROL_ERROR; - // Set number of output channels - if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_RESAMPLE_RATE,&in.rate))) - return rv; + if(NULL == (_new = af_prepend(s,af,"resample"))) return CONTROL_ERROR; + if(CONTROL_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_data_t)); else memcpy(&in,_new->prev->data,sizeof(af_data_t)); if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_REINIT,&in))) { +#if 0 af_instance_t* af2 = af_prepend(s,af,"format"); // Init the new filter if(af2) { if((CONTROL_OK != af2->control(af2,AF_CONTROL_FORMAT_BPS,&(in.bps))) - || (CONTROL_OK != af2->control(af2,AF_CONTROL_FORMAT_FMT,&(in.format)))) - return -1; - if(CONTROL_OK != af_reinit(s,af2)) - return -1; + || (CONTROL_OK != af2->control(af2,AF_CONTROL_FORMAT_FMT,&(in.format)))) return -1; + if(CONTROL_OK != af_reinit(s,af2)) return -1; rv = _new->control(_new,AF_CONTROL_REINIT,&in); } +#endif return rv; } } // Insert format filter - if(((af->prev?af->prev->data->format:s->input.format) != in.format) || + if(((af->prev?af->prev->data->format:s->input.format) != in.format) || ((af->prev?af->prev->data->bps:s->input.bps) != in.bps)){ - // Create format filter - if(NULL == (_new = af_prepend(s,af,"format"))) - return CONTROL_ERROR; - // Set output bits per sample - if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_FORMAT_BPS,&in.bps)) || - CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_FORMAT_FMT,&in.format))) - return rv; + if(NULL == (_new = af_prepend(s,af,"format"))) return CONTROL_ERROR; + if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_FORMAT_BPS,&in.bps)) || + CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_FORMAT_FMT,&in.format))) return rv; // Initialize format filter if(!_new->prev) memcpy(&in,&(s->input),sizeof(af_data_t)); else memcpy(&in,_new->prev->data,sizeof(af_data_t)); - if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_REINIT,&in))) - return rv; + if(CONTROL_OK != (rv = _new->control(_new,AF_CONTROL_REINIT,&in))) return rv; } if(!_new){ // Should _never_ happen MSG_ERR("[libaf] Unable to correct audio format. " Modified: mplayerxp/postproc/af_channels.c =================================================================== --- mplayerxp/postproc/af_channels.c 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/postproc/af_channels.c 2012-11-07 15:11:47 UTC (rev 301) @@ -249,12 +249,12 @@ static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { af_data_t* c = data; // Current working data - af_data_t* l = af->data; // Local data af_channels_t* s = af->setup; int i; if(CONTROL_OK != RESIZE_LOCAL_BUFFER(af,data)) return NULL; + af_data_t* l = af->data; // Local data // Reset unused channels memset(l->audio,0,(c->len*af->mul.n)/af->mul.d); Modified: mplayerxp/postproc/af_crystality.c =================================================================== --- mplayerxp/postproc/af_crystality.c 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/postproc/af_crystality.c 2012-11-07 15:11:47 UTC (rev 301) @@ -331,7 +331,7 @@ int acount; // counter float lval, rval; // value float sal, sar; // sum - float al, ar; + float al, ar; float a1l, a1r; }; Modified: mplayerxp/postproc/af_echo3d.c =================================================================== --- mplayerxp/postproc/af_echo3d.c 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/postproc/af_echo3d.c 2012-11-07 15:11:47 UTC (rev 301) @@ -166,7 +166,7 @@ af->data->format = AF_FORMAT_NE | AF_FORMAT_F; af->data->bps = 4; init_echo3d(s,af->data->rate); - + return af_test_output(af,arg); } case AF_CONTROL_COMMAND_LINE:{ @@ -182,7 +182,7 @@ return CONTROL_UNKNOWN; } -// Deallocate memory +// Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { if(af->data) Modified: mplayerxp/postproc/af_format.c =================================================================== --- mplayerxp/postproc/af_format.c 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/postproc/af_format.c 2012-11-07 15:11:47 UTC (rev 301) @@ -280,11 +280,11 @@ // Helper functions to check sanity for input arguments // Sanity check for bytes per sample -static int __FASTCALL__ check_bps(int bps) +static int __FASTCALL__ check_bps(const char *pfx,int bps) { if(bps != 4 && bps != 3 && bps != 2 && bps != 1){ - MSG_ERR("[format] The number of bytes per sample" - " must be 1, 2, 3 or 4. Current value is %i \n",bps); + MSG_ERR("[%s-format] The number of bytes per sample" + " must be 1, 2, 3 or 4. Current value is %i \n",pfx,bps); return CONTROL_ERROR; } return CONTROL_OK; @@ -311,15 +311,15 @@ char buf1[256],buf2[256]; switch(cmd){ case AF_CONTROL_REINIT:{ - // Make sure this filter isn't redundant + // Make sure this filter isn't redundant if(af->data->format == ((af_data_t*)arg)->format && af->data->bps == ((af_data_t*)arg)->bps) return CONTROL_DETACH; // Check for errors in configuraton - if((CONTROL_OK != check_bps(((af_data_t*)arg)->bps)) || + if((CONTROL_OK != check_bps("new",((af_data_t*)arg)->bps)) || (CONTROL_OK != check_format(((af_data_t*)arg)->format)) || - (CONTROL_OK != check_bps(af->data->bps)) || + (CONTROL_OK != check_bps("prev",af->data->bps)) || (CONTROL_OK != check_format(af->data->format))) return CONTROL_ERROR; @@ -341,7 +341,7 @@ int format = AF_FORMAT_NE; // Convert string to format format = str2fmt((char *)arg,&bps); - + if((CONTROL_OK != af->control(af,AF_CONTROL_FORMAT_BPS | AF_CONTROL_SET,&bps)) || (CONTROL_OK != af->control(af,AF_CONTROL_FORMAT_FMT | AF_CONTROL_SET,&format))) return CONTROL_ERROR; @@ -349,9 +349,9 @@ } case AF_CONTROL_FORMAT_BPS | AF_CONTROL_SET: // Reinit must be called after this function has been called - + // Check for errors in configuraton - if(CONTROL_OK != check_bps(*(int*)arg)) + if(CONTROL_OK != check_bps("arg",*(int*)arg)) return CONTROL_ERROR; af->data->bps = *(int*)arg; @@ -370,7 +370,7 @@ return CONTROL_UNKNOWN; } -// Deallocate memory +// Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { if(af->data) @@ -382,12 +382,12 @@ // Filter data through filter static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { - af_data_t* l = af->data; // Local data af_data_t* c = data; // Current working data int len = c->len/c->bps; // Lenght in samples of current audio block if(CONTROL_OK != RESIZE_LOCAL_BUFFER(af,data)) return NULL; + af_data_t* l = af->data; // Local data // Change to cpu native endian format if((c->format&AF_FORMAT_END_MASK)!=AF_FORMAT_NE) @@ -429,7 +429,7 @@ break; default: // Input must be int - + // Change signed/unsigned if((c->format&AF_FORMAT_SIGN_MASK) != (l->format&AF_FORMAT_SIGN_MASK)){ if((c->format&AF_FORMAT_SIGN_MASK) == AF_FORMAT_US) @@ -593,5 +593,5 @@ for(i=0;i<len;i++) ((int32_t*)out)[i]=(int32_t)(INT_MIN+((uint32_t*)in)[i]); break; - } + } } Modified: mplayerxp/postproc/af_resample.c =================================================================== --- mplayerxp/postproc/af_resample.c 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/postproc/af_resample.c 2012-11-07 15:11:47 UTC (rev 301) @@ -11,433 +11,189 @@ /* This audio filter changes the sample rate. */ #include <stdio.h> #include <stdlib.h> +#include <signal.h> #include <unistd.h> #include <inttypes.h> +#include "libavutil/audioconvert.h" +#include "libswresample/swresample.h" + #include "af.h" #include "dsp.h" #include "osdep/mplib.h" #include "pp_msg.h" -/* Below definition selects the length of each poly phase component. - Valid definitions are L8 and L16, where the number denotes the - length of the filter. This definition affects the computational - complexity (see play()), the performance (see filter.h) and the - memory usage. The filterlenght is choosen to 8 if the machine is - slow and to 16 if the machine is fast and has MMX. -*/ +uint64_t layouts[]={ + 0, + AV_CH_LAYOUT_MONO, + AV_CH_LAYOUT_STEREO, + AV_CH_LAYOUT_SURROUND, + AV_CH_LAYOUT_4POINT0, + AV_CH_LAYOUT_5POINT0, + AV_CH_LAYOUT_5POINT1, + AV_CH_LAYOUT_7POINT0, + AV_CH_LAYOUT_7POINT1 +}; -#if __CPU__ < 686 // This machine is slow -#define L8 -#else -#define L16 -#endif - -#include "af_resample.h" - -// Filtering types -#define RSMP_LIN (0<<0) // Linear interpolation -#define RSMP_INT (1<<0) // 16 bit integer -#define RSMP_FLOAT (2<<0) // 32 bit floating point -#define RSMP_MASK (3<<0) - -// Defines for sloppy or exact resampling -#define FREQ_SLOPPY (0<<2) -#define FREQ_EXACT (1<<2) -#define FREQ_MASK (1<<2) - -// Accuracy for linear interpolation -#define STEPACCURACY 32 - -// 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 - 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 up; // Up sampling factor - uint64_t step; // Step size for linear interpolation - uint64_t pt; // Pointer remainder for linear interpolation - int setup; // Setup parameters cmdline or through postcreate - int ifreq; -} af_resample_t; - -// Euclids algorithm for calculating Greatest Common Divisor GCD(a,b) -// Extended for negative and 0 values. If both are 0 the result is 1. -// The sign of the result will be so that it has the same sign as b. -static inline int gcd(register int a, register int b) -{ - int b_org = b; - while (b != 0) { - a %= b; - if (a == 0) - break; - b %= a; - } - // the result is either in a or b. As the other one is 0 just add them. - a += b; - if (!a) - return 1; - if (a * b_org < 0) - return 1;//-a; - return a; +static uint64_t get_ch_layout(unsigned nch) { + if(nch < sizeof(layouts)/sizeof(uint64_t)) + return layouts[nch]; + return 0; } -/** - * \brief cancel down a fraction f - * \param f fraction to cancel down - * \ingroup af_filter - */ -static void frac_cancel(frac_t *f) { - int _gcd = gcd(f->n, f->d); - f->n /= _gcd; - f->d /= _gcd; -} - -// 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; - int16_t* in16 = ((int16_t*)c->audio); - int16_t* out16 = ((int16_t*)l->audio); - int32_t* in32 = ((int32_t*)c->audio); - int32_t* out32 = ((int32_t*)l->audio); - 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]; - pt+=step; +static enum AVSampleFormat get_sample_format(unsigned fmt,unsigned nbps) { + switch(nbps) { + case 1: if((fmt&AF_FORMAT_SIGN_MASK) == AF_FORMAT_US) return AV_SAMPLE_FMT_U8; + break; + case 2: if((fmt&AF_FORMAT_SIGN_MASK) == AF_FORMAT_SI && + (fmt&AF_FORMAT_POINT_MASK) == AF_FORMAT_I && + (fmt&AF_FORMAT_END_MASK) == AF_FORMAT_NE) return AV_SAMPLE_FMT_S16; + break; + case 4: if((fmt&AF_FORMAT_POINT_MASK) == AF_FORMAT_I) { + if((fmt&AF_FORMAT_SIGN_MASK) == AF_FORMAT_SI && + (fmt&AF_FORMAT_POINT_MASK) == AF_FORMAT_I && + (fmt&AF_FORMAT_END_MASK) == AF_FORMAT_NE) return AV_SAMPLE_FMT_S32; + } + else return AV_SAMPLE_FMT_FLT; + break; + case 8: if((fmt&AF_FORMAT_POINT_MASK) == AF_FORMAT_F) return AV_SAMPLE_FMT_DBL; + break; } - s->pt=pt & ((1LL<<STEPACCURACY)-1); - break; - case 2: - end/=2; - while(pt < end){ - out32[len++]=in32[pt>>STEPACCURACY]; - pt+=step; - } - len=(len<<1); - s->pt=pt & ((1LL<<STEPACCURACY)-1); - break; - default: - end /=nch; - while(pt < end){ - tmp=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; + return AV_SAMPLE_FMT_NONE; } -/* Determine resampling type and format */ -static int __FASTCALL__ set_types(struct af_instance_s* af, af_data_t* data) -{ - af_resample_t* s = af->setup; - int rv = CONTROL_OK; - float rd = 0; +// local data +typedef struct af_resample_s { + struct SwrContext* ctx; + unsigned irate; + unsigned inch; + unsigned ifmt; + unsigned ibps; +} af_resample_t; - // Make sure this filter isn't redundant - if((af->data->rate == data->rate) || (af->data->rate == 0)) - return CONTROL_DETACH; - - /* If sloppy and small resampling difference (2%) */ - rd = abs((float)af->data->rate - (float)data->rate)/(float)data->rate; - if((((s->setup & FREQ_MASK) == FREQ_SLOPPY) && (rd < 0.02) && - (data->format != (AF_FORMAT_NE | AF_FORMAT_F))) || - ((s->setup & RSMP_MASK) == RSMP_LIN)){ - s->setup = (s->setup & ~RSMP_MASK) | RSMP_LIN; - af->data->format = AF_FORMAT_NE | AF_FORMAT_SI; - af->data->bps = 2; - MSG_V("[resample] Using linear interpolation. \n"); - } - else{ - /* If the input format is float or if float is explicitly selected - use float, otherwise use int */ - if((data->format == (AF_FORMAT_NE | AF_FORMAT_F)) || - ((s->setup & RSMP_MASK) == RSMP_FLOAT)){ - s->setup = (s->setup & ~RSMP_MASK) | RSMP_FLOAT; - af->data->format = AF_FORMAT_NE | AF_FORMAT_F; - af->data->bps = 4; - } - else{ - s->setup = (s->setup & ~RSMP_MASK) | RSMP_INT; - af->data->format = AF_FORMAT_NE | AF_FORMAT_SI; - af->data->bps = 2; - } - MSG_V("[resample] Using %s processing and %s frequency conversion.\n", - ((s->setup & RSMP_MASK) == RSMP_FLOAT)?"floating point":"integer", - ((s->setup & FREQ_MASK) == FREQ_SLOPPY)?"inexact":"exact"); - } - - if(af->data->format != data->format || af->data->bps != data->bps) { - char buff[256]; - MSG_V("[resample] doesn't fork with '%s' input format\n",fmt2str(data->format,data->bps,buff,sizeof(buff))); - rv = CONTROL_FALSE; - } - data->format = af->data->format; - data->bps = af->data->bps; - af->data->nch = data->nch; - return rv; -} - // Initialization and runtime control static ControlCodes __FASTCALL__ control(struct af_instance_s* af, int cmd, any_t* arg) { - af_resample_t* s = (af_resample_t*)af->setup; - switch(cmd){ - case AF_CONTROL_REINIT:{ - af_data_t* n = (af_data_t*)arg; // New configuration - int i,d = 0; - int rv = CONTROL_OK; + af_resample_t* s = (af_resample_t*)af->setup; + switch(cmd){ + case AF_CONTROL_REINIT: { + enum AVSampleFormat avfmt; + uint64_t nch; + af_data_t* n = (af_data_t*)arg; // New configuration + int rv = CONTROL_OK; - // Free space for circular bufers - s->ifreq=n->rate; - if(s->xq){ - for(i=1;i<af->data->nch;i++) - if(s->xq[i]) - mp_free(s->xq[i]); - mp_free(s->xq); - } + if(s->ctx) { swr_free(&s->ctx); s->ctx=NULL; } + // Make sure this filter isn't redundant + if((af->data->rate == n->rate) || (af->data->rate == 0)) { + MSG_V("[af_resample] detach due: %i -> %i Hz\n", + af->data->rate,n->rate); + return CONTROL_DETACH; + } + avfmt=get_sample_format(n->format,n->bps); + nch=get_ch_layout(n->nch); + if(avfmt==AV_SAMPLE_FMT_NONE) rv=CONTROL_ERROR; + if(nch==0) rv=CONTROL_ERROR; + if(rv!=CONTROL_OK) { + char buff[256]; + MSG_V("[af_resample] doesn't work with '%s' x %i\n" + ,fmt2str(n->format,n->bps,buff,sizeof(buff)) + ,n->nch); + } + s->ctx = swr_alloc_set_opts(NULL, + nch, avfmt,af->data->rate, + nch, avfmt,n->rate, + 0, NULL); + if(swr_init(s->ctx)<0) { + MSG_ERR("[af_resample] Cannot init swr_init\n"); + rv=CONTROL_ERROR; + } - if(CONTROL_DETACH == (rv = set_types(af,n))) - return CONTROL_DETACH; + af->data->format = n->format; + af->data->bps = n->bps; + af->data->nch = n->nch; - // If linear interpolation - if((s->setup & RSMP_MASK) == RSMP_LIN){ - s->pt=0LL; - s->step=((uint64_t)n->rate<<STEPACCURACY)/(uint64_t)af->data->rate+1LL; - MSG_DBG2("[resample] Linear interpolation step: 0x%016X.\n", - s->step); - af->mul.n = af->data->rate; - af->mul.d = n->rate; - frac_cancel(&af->mul); - return rv; - } - - // Calculate up and down sampling factors - d=gcd(af->data->rate,n->rate); - - // If sloppy resampling is enabled limit the upsampling factor - if(((s->setup & FREQ_MASK) == FREQ_SLOPPY) && (af->data->rate/d > 5000)){ - int up=af->data->rate/2; - int dn=n->rate/2; - int m=2; - while(af->data->rate/(d*m) > 50){ - d=gcd(up,dn); - up/=2; dn/=2; m*=2; - } - d*=m; - } - - // Create space for circular bufers - s->xq = mp_malloc(n->nch*sizeof(any_t*)); - for(i=0;i<n->nch;i++) - s->xq[i] = mp_malloc(2*L*af->data->bps); - s->xi = 0; - - // Check if the the design needs to be redone - if(s->up != af->data->rate/d || s->dn != n->rate/d){ - float* w; - float* wt; - float fc; - int j; - if(af->data->rate/d && n->rate/d) - { - s->up = af->data->rate/d; - s->dn = n->rate/d; - } - else if(af->data->rate/d) - { - s->up=(af->data->rate/d)*(d/n->rate); - s->dn=1; - } - else - { - s->up=1; - s->dn=n->rate/d*(d/af->data->rate); - } - - // Calculate cuttof frequency for filter - fc = 1/(float)(max(s->up,s->dn)); - // Allocate space for polyphase filter bank and protptype filter - w = mp_malloc(sizeof(float) * s->up *L); - if(NULL != s->w) - mp_free(s->w); - s->w = mp_malloc(L*s->up*af->data->bps); - - // Design prototype filter type using Kaiser window with beta = 10 - if(NULL == w || NULL == s->w || - -1 == design_fir(s->up*L, w, &fc, LP|KAISER , 10.0)){ - MSG_ERR("[resample] Unable to design prototype filter.\n"); - return CONTROL_ERROR; - } - // Copy data from prototype to polyphase filter - wt=w; - for(j=0;j<L;j++){//Columns - for(i=0;i<s->up;i++){//Rows - if((s->setup & RSMP_MASK) == RSMP_INT){ - float t=(float)s->up*32767.0*(*wt); - ((int16_t*)s->w)[i*L+j] = (int16_t)((t>=0.0)?(t+0.5):(t-0.5)); - } - else - ((float*)s->w)[i*L+j] = (float)s->up*(*wt); - wt++; + s->irate=n->rate; + s->inch=n->nch; + s->ifmt=n->format; + s->ibps=n->bps; + // Set multiplier and delay + af->delay = (double)swr_get_delay(s->ctx,1000); + af->mul.n = af->data->rate; + af->mul.d = n->rate; + return rv; } - } - mp_free(w); + case AF_CONTROL_SHOWCONF: + MSG_INFO("[af_resample] New filter designed (%i -> %i Hz)\n", s->irate,af->data->rate); + return CONTROL_OK; + case AF_CONTROL_COMMAND_LINE:{ + int rate=0; + sscanf((char*)arg,"%i", &rate); + return af->control(af,AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET, &rate); + } + case AF_CONTROL_POST_CREATE: return CONTROL_OK; + case AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET: { + af->data->rate = ((int*)arg)[0]; + return CONTROL_OK; + } + default: break; } - - // Set multiplier and delay - af->delay = (double)(1000*L/2)/((double)n->rate); - af->mul.n = s->up; - af->mul.d = s->dn; - return rv; - } - case AF_CONTROL_SHOWCONF: - MSG_INFO("[af_resample] New filter designed up: %i down: %i (%i -> %i Hz)\n", s->up, s->dn,s->ifreq,af->data->rate); - return CONTROL_OK; - case AF_CONTROL_COMMAND_LINE:{ - af_resample_t* s = (af_resample_t*)af->setup; - int rate=0; - int type=RSMP_INT; - int sloppy=1; - sscanf((char*)arg,"%i:%i:%i", &rate, &sloppy, &type); - s->setup = (sloppy?FREQ_SLOPPY:FREQ_EXACT) | - (clamp(type,RSMP_LIN,RSMP_FLOAT)); - return af->control(af,AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET, &rate); - } - case AF_CONTROL_POST_CREATE: - if((((af_cfg_t*)arg)->force & AF_INIT_FORMAT_MASK) == AF_INIT_FLOAT) - ((af_resample_t*)af->setup)->setup = RSMP_FLOAT; - return CONTROL_OK; - case AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET: - // Reinit must be called after this function has been called - - // Sanity check - if(((int*)arg)[0] < 4000 || ((int*)arg)[0] > 192000){ - MSG_ERR("[resample] The output sample frequency " - "must be between 4kHz and 192kHz. Current value is %i \n", - ((int*)arg)[0]); - return CONTROL_ERROR; - } - - af->data->rate=((int*)arg)[0]; - MSG_V("[resample] Changing sample rate " - "to %iHz\n",af->data->rate); - return CONTROL_OK; - default: break; - } - return CONTROL_UNKNOWN; + return CONTROL_UNKNOWN; } // Deallocate memory static void __FASTCALL__ uninit(struct af_instance_s* af) { - if(af->data) - mp_free(af->data); + af_resample_t* s = (af_resample_t*)af->setup; + if(af->data) { + if(af->data->audio) mp_free(af->data->audio); + mp_free(af->data); + } + if(s->ctx) swr_free(&s->ctx); + s->ctx=NULL; } // Filter data through filter static af_data_t* __FASTCALL__ play(struct af_instance_s* af, af_data_t* data,int final) { - int len = 0; // Length of output data - af_data_t* c = data; // Current working data - af_data_t* l = af->data; // Local data - af_resample_t* s = (af_resample_t*)af->setup; - uint32_t ci = l->nch; // Index for channels - uint32_t nch = l->nch; // Number of channels - uint32_t up = s->up; - uint32_t dn = s->dn; - uint32_t ns = c->len/l->bps; - register int32_t i = 0; - register uint32_t wi = 0; - register uint32_t xi = 0; + int rc; + af_data_t* c = data; // Current working data + af_resample_t* s = (af_resample_t*)af->setup; - if(CONTROL_OK != RESIZE_LOCAL_BUFFER(af,data)) - return NULL; + if (CONTROL_OK != RESIZE_LOCAL_BUFFER(af, data)) return NULL; + af_data_t* l = af->data; // Local data + uint8_t* ain[SWR_CH_MAX]; + const uint8_t* aout[SWR_CH_MAX]; - // Run resampling - switch(s->setup & RSMP_MASK){ - case(RSMP_INT): -# define FORMAT_I 1 - if(s->up>s->dn){ -# define UP -# include "af_resample.h" -# undef UP - } - else{ -# define DN -# include "af_resample.h" -# undef DN - } - break; - case(RSMP_FLOAT): -# undef FORMAT_I -# define FORMAT_F 1 - if(s->up>s->dn){ -# define UP -# include "af_resample.h" -# undef UP - } - else{ -# define DN -# include "af_resample.h" -# undef DN - } - break; - case(RSMP_LIN): - len = linint(c, l, s); - break; - } + aout[0]=l->audio; + ain[0]=c->audio; - // Save values that needs to be kept for next time - s->wi = wi; - s->xi = xi; - // Set output data - c->audio = l->audio; - c->len = len*l->bps; - c->rate = l->rate; + rc=swr_convert(s->ctx,aout,l->len/(l->nch*l->bps),ain,c->len/(c->nch*c->bps)); + if(rc<0) MSG_ERR("%i=swr_convert\n",rc); + else l->len=rc*l->nch*l->bps; - return c; + return l; } // Allocate memory and set function pointers static ControlCodes __FASTCALL__ 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(af_data_t)); - af->setup=mp_calloc(1,sizeof(af_resample_t)); - if(af->data == NULL || af->setup == NULL) - return CONTROL_ERROR; - ((af_resample_t*)af->setup)->setup = RSMP_INT | FREQ_SLOPPY; - return CONTROL_OK; + af->control=control; + af->uninit=uninit; + af->play=play; + af->mul.n=1; + af->mul.d=1; + af->data=mp_calloc(1,sizeof(af_data_t)); + af->setup=mp_calloc(1,sizeof(af_resample_t)); + if(af->data == NULL || af->setup == NULL) return CONTROL_ERROR; + return CONTROL_OK; } // Description of this plugin const af_info_t af_info_resample = { - "Sample frequency conversion", - "resample", - "Anders", - "", - AF_FLAGS_REENTRANT, - open + "Sample frequency conversion", + "resample", + "Anders", + "", + AF_FLAGS_REENTRANT, + open }; Deleted: mplayerxp/postproc/af_resample.h =================================================================== --- mplayerxp/postproc/af_resample.h 2012-11-07 15:09:02 UTC (rev 300) +++ mplayerxp/postproc/af_resample.h 2012-11-07 15:11:47 UTC (rev 301) @@ -1,144 +0,0 @@ -/*============================================================================= -// -// This software has been released under the terms of the GNU General Public -// license. See http://www.gnu.org/copyleft/gpl.html for details. -// -// Copyright 2002 Anders Johansson aj...@at... -// -//============================================================================= -*/ - -/* 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 -*/ - -#undef L -#undef SHIFT -#undef FORMAT -#undef FIR -#undef ADDQUE - -/* The lenght Lxx definition selects the length of each poly phase - component. Valid definitions are L8 and L16 where the number - defines the nuber of taps. This definition affects the - computational complexity, the performance and the memory usage. -*/ - -/* The FORMAT_x parameter selects the sample format type currently - float and int16 are supported. Thes two formats are selected by - defining eiter FORMAT_F or FORMAT_I. The advantage of using float - is that the amplitude and therefore the SNR isn't affected by the - filtering, the disadvantage is that it is a lot slower. -*/ - -#if defined(FORMAT_I) -#define SHIFT >>16 -#define FORMAT int16_t -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -#define FIR(x,w,y) {y[0]=FIR_i16(x,w);} -#endif -#else -#define SHIFT -#define FORMAT float -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -#define FIR(x,w,y) {y[0]=FIR_f32(x,w);} -#endif -#endif - -// Short filter -#if defined(L8) - -#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] \ - + w[4]*x[4]+w[5]*x[5]+w[6]*x[6]+w[7]*x[7] ) SHIFT -#endif - - -#else /* L8/L16 */ - -#define L 16 -// 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] \ - + w[4] *x[4] +w[5] *x[5] +w[6] *x[6] +w[7] *x[7] \ - + w[8] *x[8] +w[9] *x[9] +w[10]*x[10]+w[11]*x[11] \ - + w[12]*x[12]+w[13]*x[13]+w[14]*x[14]+w[15]*x[15] ) SHIFT -#endif -#endif /* L8/L16 */ - -// Macro to add data to circular que -#define ADDQUE(xi,xq,in)\ - xq[xi]=xq[(xi)+L]=*(in);\ - xi=((xi)-1)&(L-1); - -#if defined(UP) - - uint32_t inc = s->up/s->dn; - uint32_t level = s->up%s->dn; - register FORMAT* w = s->w; - - // Index current channel - while(ci--){ - // Temporary pointers - register FORMAT* x = s->xq[ci]; - register FORMAT* in = ((FORMAT*)c->audio)+ci; - register FORMAT* out = ((FORMAT*)l->audio)+ci; - FORMAT* end = in+ns; // Block loop end - wi = s->wi; xi = s->xi; - - while(in < end){ - register uint32_t i = inc; - if(wi<level) i++; - - ADDQUE(xi,x,in); - in+=nch; - while(i--){ - // 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; - } - } - - } -#endif /* UP */ - -#if defined(DN) /* DN */ - uint32_t inc = s->dn/s->up; - uint32_t level = s->dn%s->up; - FORMAT* w = s->w; - - // Index current channel - while(ci--){ - // Temporary pointers - register FORMAT* x = s->xq[ci]; - register FORMAT* in = ((FORMAT*)c->audio)+ci; - register FORMAT* out = ((FORMAT*)l->audio)+ci; - register FORMAT* end = in+ns; // Block loop end - i = s->i; wi = s->wi; xi = s->xi; - - while(in < end){ - - ADDQUE(xi,x,in); - in+=nch; - if((--i)<=0){ - // Run the FIR filter - if(out<l->audio+l->len-L) 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++; - } - } - } - s->i = i; -#endif /* DN */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-07 17:24:27
|
Revision: 303 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=303&view=rev Author: nickols_k Date: 2012-11-07 17:24:16 +0000 (Wed, 07 Nov 2012) Log Message: ----------- preview of next step in XP-CORE development Modified Paths: -------------- mplayerxp/postproc/af_center.c mplayerxp/xmpcore/Makefile Added Paths: ----------- mplayerxp/xmpcore/mp_aframe.c mplayerxp/xmpcore/mp_aframe.h Modified: mplayerxp/postproc/af_center.c =================================================================== --- mplayerxp/postproc/af_center.c 2012-11-07 16:44:37 UTC (rev 302) +++ mplayerxp/postproc/af_center.c 2012-11-07 17:24:16 UTC (rev 303) @@ -27,7 +27,7 @@ // Initialization and runtime control static ControlCodes control(struct af_instance_s* af, int cmd, any_t* arg) { - af_center_t* s = af->setup; + af_center_t* s = af->setup; switch(cmd){ case AF_CONTROL_REINIT:{ Modified: mplayerxp/xmpcore/Makefile =================================================================== --- mplayerxp/xmpcore/Makefile 2012-11-07 16:44:37 UTC (rev 302) +++ mplayerxp/xmpcore/Makefile 2012-11-07 17:24:16 UTC (rev 303) @@ -3,7 +3,7 @@ LIBNAME = libxmpcore.a SRCS=xmp_core.c xmp_aplayer.c xmp_vplayer.c xmp_vdecoder.c xmp_adecoder.c -SRCS+=mp_image.c sig_hand.c +SRCS+=mp_aframe.c mp_image.c sig_hand.c OBJS=$(SRCS:.c=.o) CFLAGS = $(OPTFLAGS) -I. -I.. -Wall Added: mplayerxp/xmpcore/mp_aframe.c =================================================================== --- mplayerxp/xmpcore/mp_aframe.c (rev 0) +++ mplayerxp/xmpcore/mp_aframe.c 2012-11-07 17:24:16 UTC (rev 303) @@ -0,0 +1,19 @@ +#include "mp_aframe.h" +#include "osdep/mplib.h" + +mp_aframe_t* new_mp_aframe(unsigned rate,unsigned nch,unsigned format,unsigned xp_idx) { + mp_aframe_t* mpaf = mp_mallocz(sizeof(mp_aframe_t)); + if(!mpaf) return NULL; + mpaf->rate = rate; + mpaf->nch = nch; + mpaf->format = format; + mpaf->xp_idx = xp_idx; + return mpaf; +} + +int free_mp_aframe(mp_aframe_t* mpaf) { + if(!mpaf) return 0; + if(mpaf->audio) mp_free(mpaf->audio); + mp_free(mpaf); + return 1; +} Property changes on: mplayerxp/xmpcore/mp_aframe.c ___________________________________________________________________ Added: svn:eol-style + native Added: mplayerxp/xmpcore/mp_aframe.h =================================================================== --- mplayerxp/xmpcore/mp_aframe.h (rev 0) +++ mplayerxp/xmpcore/mp_aframe.h 2012-11-07 17:24:16 UTC (rev 303) @@ -0,0 +1,54 @@ +#ifndef __MP_AUDIO_FRAME_INCLUDED_H +#define __MP_AUDIO_FRAME_INCLUDED_H 1 + +#include "mp_config.h" + +/* The sample format system is based on bitmasks. The + format definition only refers to the storage format not the + resolution. */ +typedef enum mpaf_format_enum{ + MPAF_BPS_MASK =0x00000FFFUL, /* byte per sample */ +// Endianess + MPAF_BE =0x00000000UL, // Big Endian + MPAF_LE =0x00001000UL, // Little Endian + MPAF_END_MASK =0x00001000UL, +#if WORDS_BIGENDIAN // Native endian of cpu + MPAF_NE =MPAF_BE, +#else + MPAF_NE =MPAF_LE, +#endif +// Signed/unsigned + MPAF_SI =0x00000000UL, // SIgned + MPAF_US =0x00002000UL, // Un Signed + MPAF_SIGN_MASK =0x00002000UL, +// Fixed or floating point + MPAF_I =0x00000000UL, // Integer + MPAF_F =0x00004000UL, // Foating point + MPAF_POINT_MASK =0x00004000UL, +// Special flags refering to non pcm data + MPAF_PCM =0x00010000UL, // + MPAF_A_LAW =0x00060000UL, // + MPAF_MU_LAW =0x00070000UL, // + MPAF_IMA_ADPCM =0x00110000UL, // Same as 16 bit signed int + MPAF_MPEG2 =0x00500000UL, // MPEG1 layer2 audio + MPAF_MPEG3 =0x00550000UL, // MPEG1 layer3 audio + MPAF_AC3 =0x20000000UL, // Dolby Digital AC3 + MPAF_SPECIAL_MASK =0xFFFF0000UL +}mpaf_format_e; + +typedef struct mp_audio_frame_s { + unsigned flags; /* currently unused */ + float pts; /* PTS if this frame */ + unsigned xp_idx;/* index in ring buffer */ + any_t* audio; /* data of audio frame */ + unsigned len; /* length of data */ + /*------ stream description ----------*/ + unsigned rate; /* rate of audio */ + unsigned nch; /* number of channels */ + mpaf_format_e format;/* PCM format of audio */ +}mp_aframe_t; + +extern mp_aframe_t* new_mp_aframe(unsigned rate,unsigned nch,mpaf_format_e format,unsigned xp_idx); +extern int free_mp_aframe(mp_aframe_t* mpaf); + +#endif Property changes on: mplayerxp/xmpcore/mp_aframe.h ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |