From f6b9076a6dc42d9519739419792f176d4b120381 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 26 Jul 2008 21:58:00 +0000 Subject: Use GetTimerMS() instead of time() with srand. This is more portable and avoids generating the same random numbers for a whole second (and on MinGW for some unexplainable reason for almost 10 seconds). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27353 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 88cd58473a..dfd2192450 100644 --- a/mplayer.c +++ b/mplayer.c @@ -2556,9 +2556,8 @@ int i; int gui_no_filename=0; - srand((int) time(NULL)); - InitTimer(); + srand(GetTimerMS()); mp_msg_init(); -- cgit v1.2.3 From 4b141479da70665db8d5780c9ca9e430c9dd1f09 Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 30 Jul 2008 12:01:30 +0000 Subject: Start unifying names of internal preprocessor directives. Replace all USE_ prefixes by CONFIG_ prefixes to indicate options which are configurable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27373 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 74 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index dfd2192450..f497afa40c 100644 --- a/mplayer.c +++ b/mplayer.c @@ -105,10 +105,10 @@ char *heartbeat_cmd; #endif /* __linux__ */ #endif /* HAVE_RTC */ -#ifdef USE_TV +#ifdef CONFIG_TV #include "stream/tv.h" #endif -#ifdef USE_RADIO +#ifdef CONFIG_RADIO #include "stream/stream_radio.h" #endif @@ -163,11 +163,11 @@ static int max_framesize=0; #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" -#ifdef USE_DVDREAD +#ifdef CONFIG_DVDREAD #include "stream/stream_dvd.h" #endif -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV #include "stream/stream_dvdnav.h" #endif @@ -278,7 +278,7 @@ int file_filter=1; // cache2: int stream_cache_size=-1; -#ifdef USE_STREAM_CACHE +#ifdef CONFIG_STREAM_CACHE extern int cache_fill_status; float stream_cache_min_percent=20.0; @@ -325,7 +325,7 @@ char *vobsub_name=NULL; int subcc_enabled=0; int suboverlap_enabled = 1; -#ifdef USE_ASS +#ifdef CONFIG_ASS #include "libass/ass.h" #include "libass/ass_mp.h" #endif @@ -568,7 +568,7 @@ char *get_metadata (metadata_t type) { /// step size of mixer changes int volstep = 3; -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV static void mp_dvdnav_context_free(MPContext *ctx){ if (ctx->nav_smpi) free_mp_image(ctx->nav_smpi); ctx->nav_smpi = NULL; @@ -628,7 +628,7 @@ void uninit_player(unsigned int mask){ current_module="uninit_vo"; mpctx->video_out->uninit(); mpctx->video_out=NULL; -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV mp_dvdnav_context_free(mpctx); #endif } @@ -708,7 +708,7 @@ void exit_player_with_rc(const char* how, int rc){ #endif free_osd_list(); -#ifdef USE_ASS +#ifdef CONFIG_ASS ass_library_done(ass_library); #endif @@ -1016,7 +1016,7 @@ static int playtree_add_playlist(play_tree_t* entry) void add_subtitles(char *filename, float fps, int noerr) { sub_data *subd; -#ifdef USE_ASS +#ifdef CONFIG_ASS ass_track_t *asst = 0; #endif @@ -1025,9 +1025,9 @@ void add_subtitles(char *filename, float fps, int noerr) } subd = sub_read_file(filename, fps); -#ifdef USE_ASS +#ifdef CONFIG_ASS if (ass_enabled) -#ifdef USE_ICONV +#ifdef CONFIG_ICONV asst = ass_read_file(ass_library, filename, sub_cp); #else asst = ass_read_file(ass_library, filename, 0); @@ -1042,7 +1042,7 @@ void add_subtitles(char *filename, float fps, int noerr) mp_msg(MSGT_CPLAYER, noerr ? MSGL_WARN : MSGL_ERR, MSGTR_CantLoadSub, filename_recode(filename)); -#ifdef USE_ASS +#ifdef CONFIG_ASS if (!asst && !subd) return; mpctx->set_of_ass_tracks[mpctx->set_of_sub_size] = asst; #else @@ -1091,7 +1091,7 @@ void init_vo_spudec(void) { vo_spudec=spudec_new_scaled(palette, width, height); } -#ifdef USE_DVDREAD +#ifdef CONFIG_DVDREAD if (vo_spudec==NULL && mpctx->stream->type==STREAMTYPE_DVD) { current_module="spudec_init_dvdread"; vo_spudec=spudec_new_scaled(((dvd_priv_t *)(mpctx->stream->priv))->cur_pgc->palette, @@ -1099,7 +1099,7 @@ void init_vo_spudec(void) { } #endif -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV if (vo_spudec==NULL && mpctx->stream->type==STREAMTYPE_DVDNAV) { unsigned int *palette = mp_dvdnav_get_spu_clut(mpctx->stream); current_module="spudec_init_dvdnav"; @@ -1262,7 +1262,7 @@ static void print_status(float a_pos, float a_v, float corr) if (sh_video) saddf(line, &pos, width, "%d %d ", drop_frame_cnt, output_quality); -#ifdef USE_STREAM_CACHE +#ifdef CONFIG_STREAM_CACHE // cache stats if (stream_cache_size > 0) saddf(line, &pos, width, "%d%% ", cache_fill_status); @@ -1812,7 +1812,7 @@ static float timing_sleep(float time_frame) return time_frame; } -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV #ifndef FF_B_TYPE #define FF_B_TYPE 3 #endif @@ -1939,7 +1939,7 @@ static void mp_dvdnav_save_smpi(int in_size, if (decoded_frame && mpctx->nav_smpi != decoded_frame) mpctx->nav_smpi = mp_dvdnav_copy_mpi(mpctx->nav_smpi,decoded_frame); } -#endif /* USE_DVDNAV */ +#endif /* CONFIG_DVDNAV */ static void adjust_sync_and_print_status(int between_frames, float timing_error) { @@ -2175,7 +2175,7 @@ int reinit_video_chain(void) { sh_video->vfilter=(void*)vf_menu; #endif -#ifdef USE_ASS +#ifdef CONFIG_ASS if(ass_enabled) { int i; int insert = 1; @@ -2200,7 +2200,7 @@ int reinit_video_chain(void) { sh_video->vfilter=(void*)append_filters(sh_video->vfilter); -#ifdef USE_ASS +#ifdef CONFIG_ASS if (ass_enabled) ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_INIT_EOSD, ass_library); #endif @@ -2261,7 +2261,7 @@ static double update_video(int *blit_frame) frame_time = sh_video->next_frame_time; in_size = video_read_frame(sh_video, &sh_video->next_frame_time, &start, force_fps); -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV /// wait, still frame or EOF if (mpctx->stream->type == STREAMTYPE_DVDNAV && in_size < 0) { if (mp_dvdnav_is_eof(mpctx->stream)) return -1; @@ -2284,14 +2284,14 @@ static double update_video(int *blit_frame) update_teletext(sh_video, mpctx->demuxer, 0); update_osd_msg(); current_module = "decode_video"; -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV decoded_frame = mp_dvdnav_restore_smpi(&in_size,&start,decoded_frame); /// still frame has been reached, no need to decode if (in_size > 0 && !decoded_frame) #endif decoded_frame = decode_video(sh_video, start, in_size, drop_frame, sh_video->pts); -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV /// save back last still frame for future display mp_dvdnav_save_smpi(in_size,start,decoded_frame); #endif @@ -2570,11 +2570,11 @@ int gui_no_filename=0; m_config_preparse_command_line(mconfig,argc,argv); print_version(); -#if defined(WIN32) && defined(USE_WIN32DLL) +#if defined(WIN32) && defined(CONFIG_WIN32DLL) set_path_env(); -#endif /*WIN32 && USE_WIN32DLL*/ +#endif /*WIN32 && CONFIG_WIN32DLL*/ -#ifdef USE_TV +#ifdef CONFIG_TV stream_tv_defaults.immediate = 1; #endif @@ -2812,7 +2812,7 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){ vo_init_osd(); -#ifdef USE_ASS +#ifdef CONFIG_ASS ass_library = ass_init(); #endif @@ -2850,7 +2850,7 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){ mp_msg(MSGT_CPLAYER, MSGL_V, "Using %s timing\n", softsleep?"software":timer_name); -#ifdef USE_TERMCAP +#ifdef CONFIG_TERMCAP if ( !use_gui ) load_termcap(NULL); // load key-codes #endif @@ -3195,7 +3195,7 @@ if(stream_dump_type==5){ exit_player_with_rc(MSGTR_Exit_eof, 0); } -#ifdef USE_DVDREAD +#ifdef CONFIG_DVDREAD if(mpctx->stream->type==STREAMTYPE_DVD){ current_module="dvd lang->id"; if(audio_id==-1) audio_id=dvd_aid_from_lang(mpctx->stream,audio_lang); @@ -3208,7 +3208,7 @@ if(mpctx->stream->type==STREAMTYPE_DVD){ } #endif -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV if(mpctx->stream->type==STREAMTYPE_DVDNAV){ current_module="dvdnav lang->id"; if(audio_id==-1) audio_id=mp_dvdnav_aid_from_lang(mpctx->stream,audio_lang); @@ -3317,7 +3317,7 @@ if (mpctx->stream->type != STREAMTYPE_DVD && mpctx->stream->type != STREAMTYPE_D if (mpctx->global_sub_size <= mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id) mpctx->global_sub_size = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id + 1; -#ifdef USE_ASS +#ifdef CONFIG_ASS if (ass_enabled && ass_library) { for (i = 0; i < mpctx->demuxer->num_attachments; ++i) { demux_attachment_t* att = mpctx->demuxer->attachments + i; @@ -3663,7 +3663,7 @@ if (end_at.type == END_AT_SIZE) { end_at.type = END_AT_NONE; } -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV mp_dvdnav_context_free(mpctx); if (mpctx->stream->type == STREAMTYPE_DVDNAV) { mp_dvdnav_read_wait(mpctx->stream, 0, 1); @@ -3810,7 +3810,7 @@ if(auto_quality>0){ } // end if(mpctx->sh_video) -#ifdef USE_DVDNAV +#ifdef CONFIG_DVDNAV if (mpctx->stream->type == STREAMTYPE_DVDNAV) { nav_highlight_t hl; mp_dvdnav_get_highlight (mpctx->stream, &hl); @@ -3904,7 +3904,7 @@ if(rel_seek_secs || abs_seek_pos){ if(guiIntfStruct.Playing==0) break; // STOP if(guiIntfStruct.Playing==2) mpctx->osd_function=OSD_PAUSE; if ( guiIntfStruct.DiskChanged || guiIntfStruct.NewPlay ) goto goto_next_file; -#ifdef USE_DVDREAD +#ifdef CONFIG_DVDREAD if ( mpctx->stream->type == STREAMTYPE_DVD ) { dvd_priv_t * dvdp = mpctx->stream->priv; @@ -3966,7 +3966,7 @@ if(mpctx->set_of_sub_size > 0) { current_module="sub_free"; for(i = 0; i < mpctx->set_of_sub_size; ++i) { sub_free(mpctx->set_of_subtitles[i]); -#ifdef USE_ASS +#ifdef CONFIG_ASS if(mpctx->set_of_ass_tracks[i]) ass_free_track( mpctx->set_of_ass_tracks[i] ); #endif @@ -3975,7 +3975,7 @@ if(mpctx->set_of_sub_size > 0) { } vo_sub_last = vo_sub=NULL; subdata=NULL; -#ifdef USE_ASS +#ifdef CONFIG_ASS ass_track = NULL; if(ass_library) ass_clear_fonts(ass_library); @@ -4022,7 +4022,7 @@ while(mpctx->playtree_iter != NULL) { #ifdef HAVE_NEW_GUI if(use_gui && !mpctx->playtree_iter) { -#ifdef USE_DVDREAD +#ifdef CONFIG_DVDREAD if(!guiIntfStruct.DiskChanged) #endif mplEnd(); -- cgit v1.2.3