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