[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[495] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-01 15:51:37
|
Revision: 495 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=495&view=rev Author: nickols_k Date: 2012-12-01 15:51:26 +0000 (Sat, 01 Dec 2012) Log Message: ----------- initial level of MPXPContext protection Modified Paths: -------------- mplayerxp/libmpcodecs/ad_a52.cpp mplayerxp/libmpcodecs/ad_dca.cpp mplayerxp/libmpcodecs/ad_faad.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/vd_dshow.cpp mplayerxp/libmpcodecs/vd_libmpeg2.cpp mplayerxp/libmpcodecs/vd_vfw.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libmpstream/cache2.cpp mplayerxp/libplaytree/asxparser.cpp mplayerxp/mp_msg.cpp mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/libmpcodecs/ad_a52.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_a52.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpcodecs/ad_a52.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -155,7 +155,7 @@ float pts; int flags=0; /* Dolby AC3 audio:*/ - mpxp_a52_accel = MPXPCtx->mplayer_accel; + mpxp_a52_accel = mpxp_context().mplayer_accel; mpxp_a52_state=a52_init (mpxp_a52_accel); if (mpxp_a52_state == NULL) { MSG_ERR("A52 init failed\n"); Modified: mplayerxp/libmpcodecs/ad_dca.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dca.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpcodecs/ad_dca.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -156,7 +156,7 @@ float pts; int flags=0; /* Dolby AC3 audio:*/ - mpxp_dca_accel = MPXPCtx->mplayer_accel; + mpxp_dca_accel = mpxp_context().mplayer_accel; mpxp_dca_state = dca_init(mpxp_dca_accel); if (mpxp_dca_state == NULL) { MSG_ERR("dca init failed\n"); Modified: mplayerxp/libmpcodecs/ad_faad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_faad.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpcodecs/ad_faad.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -193,7 +193,7 @@ float pts; int NeAAC_init; NeAACDecConfigurationPtr NeAAC_conf; - if(!(NeAAC_hdec = NeAACDecOpen(MPXPCtx->mplayer_accel))) { + if(!(NeAAC_hdec = NeAACDecOpen(mpxp_context().mplayer_accel))) { MSG_WARN("FAAD: Failed to open the decoder!\n"); // XXX: deal with cleanup! return MPXP_False; } Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -305,11 +305,11 @@ t2=GetTimer();t=t2-t; tt = t*0.000001f; - MPXPCtx->bench->video+=tt; + mpxp_context().bench->video+=tt; if(mp_conf.benchmark || mp_conf.frame_dropping) { - if(tt > MPXPCtx->bench->max_video) MPXPCtx->bench->max_video=tt; - if(tt < MPXPCtx->bench->min_video) MPXPCtx->bench->min_video=tt; - MPXPCtx->bench->cur_video=tt; + if(tt > mpxp_context().bench->max_video) mpxp_context().bench->max_video=tt; + if(tt < mpxp_context().bench->min_video) mpxp_context().bench->min_video=tt; + mpxp_context().bench->cur_video=tt; } if(frame->flags) return 0; @@ -318,12 +318,12 @@ t2=GetTimer()-t2; tt=t2*0.000001f; - MPXPCtx->bench->vout+=tt; + mpxp_context().bench->vout+=tt; if(mp_conf.benchmark || mp_conf.frame_dropping) { - if(tt > MPXPCtx->bench->max_vout) MPXPCtx->bench->max_vout = tt; - if(tt < MPXPCtx->bench->min_vout) MPXPCtx->bench->min_vout = tt; - MPXPCtx->bench->cur_vout=tt; + if(tt > mpxp_context().bench->max_vout) mpxp_context().bench->max_vout = tt; + if(tt < mpxp_context().bench->min_vout) mpxp_context().bench->min_vout = tt; + mpxp_context().bench->cur_vout=tt; } return 1; @@ -345,12 +345,12 @@ Demuxer_Stream *d_dvdsub=sh_video->ds->demuxer->sub; #ifdef USE_SUB // find sub - if(MPXPCtx->subtitles && v_pts>0){ + if(mpxp_context().subtitles && v_pts>0){ float pts=v_pts; if(mp_conf.sub_fps==0) mp_conf.sub_fps=sh_video->fps; MP_UNIT("find_sub"); if (pts > sub_last_pts || pts < sub_last_pts-1.0 ) { - find_sub(MPXPCtx->subtitles,sub_uses_time?(100*pts):(pts*mp_conf.sub_fps),vo_data); // FIXME! frame counter... + find_sub(mpxp_context().subtitles,sub_uses_time?(100*pts):(pts*mp_conf.sub_fps),vo_data); // FIXME! frame counter... sub_last_pts = pts; } MP_UNIT(NULL); Modified: mplayerxp/libmpcodecs/vd_dshow.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_dshow.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpcodecs/vd_dshow.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -89,7 +89,7 @@ default: DS_VideoDecoder_SetDestFmt(reinterpret_cast<DS_VideoDecoder*>(sh->context),out_fmt&255,0); // RGB/BGR } - DS_SetAttr_DivX("Quality",MPXPCtx->output_quality); + DS_SetAttr_DivX("Quality",mpxp_context().output_quality); DS_VideoDecoder_StartInternal(reinterpret_cast<DS_VideoDecoder*>(sh->context)); MSG_V("INFO: Win32/DShow init OK!\n"); return MPXP_Ok; Modified: mplayerxp/libmpcodecs/vd_libmpeg2.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -261,7 +261,7 @@ priv_t *priv; if(!load_lib("libmpeg2"SLIBSUFFIX)) return MPXP_False; sh->context=priv=new(zeromem) priv_t; - if(!(priv->mpeg2dec=mpeg2_init(MPXPCtx->mplayer_accel))) return MPXP_False; + if(!(priv->mpeg2dec=mpeg2_init(mpxp_context().mplayer_accel))) return MPXP_False; return mpcodecs_config_vf(opaque,sh->src_w,sh->src_h); } Modified: mplayerxp/libmpcodecs/vd_vfw.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_vfw.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpcodecs/vd_vfw.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -173,7 +173,7 @@ // avi_header.our_in_buffer=mp_malloc(avi_header.video.dwSuggestedBufferSize); // FIXME!!!! - ICSendMessage(priv->hic, ICM_USER+80, (long)(&MPXPCtx->output_quality), 0); + ICSendMessage(priv->hic, ICM_USER+80, (long)(&mpxp_context().output_quality), 0); // don't do this palette mess always, it makes div3 dll crashing... if(sh_video->codec->outfmt[sh_video->outfmtidx]==IMGFMT_BGR8){ Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -362,7 +362,7 @@ if(!ad) MSG_WARN("Failed to open audio demuxer: %s\n",demux_conf.audio_stream); else if(ad->audio->sh && ((sh_audio_t*)ad->audio->sh)->wtag == 0x55) // MP3 - m_config_set_flag(MPXPCtx->mconfig,"mp3.hr-seek",1); // Enable high res seeking + m_config_set_flag(mpxp_context().mconfig,"mp3.hr-seek",1); // Enable high res seeking } if(ss) { sd = demux_open_stream(ss,-2,-2,dvdsub_id); Modified: mplayerxp/libmpdemux/demuxer_r.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_r.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpdemux/demuxer_r.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -88,10 +88,10 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - MPXPCtx->bench->demux+=tt; - MPXPCtx->bench->audio_decode_correction=tt; - if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; - if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; + mpxp_context().bench->demux+=tt; + mpxp_context().bench->audio_decode_correction=tt; + if(tt > mpxp_context().bench->max_demux) mpxp_context().bench->max_demux=tt; + if(tt < mpxp_context().bench->min_demux) mpxp_context().bench->min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -116,9 +116,9 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - MPXPCtx->bench->demux+=tt; - if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; - if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; + mpxp_context().bench->demux+=tt; + if(tt > mpxp_context().bench->max_demux) mpxp_context().bench->max_demux=tt; + if(tt < mpxp_context().bench->min_demux) mpxp_context().bench->min_demux=tt; } UNLOCK_DEMUXER(); return frame; @@ -139,10 +139,10 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - MPXPCtx->bench->demux+=tt; - MPXPCtx->bench->audio_decode_correction=tt; - if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; - if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; + mpxp_context().bench->demux+=tt; + mpxp_context().bench->audio_decode_correction=tt; + if(tt > mpxp_context().bench->max_demux) mpxp_context().bench->max_demux=tt; + if(tt < mpxp_context().bench->min_demux) mpxp_context().bench->min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -163,10 +163,10 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - MPXPCtx->bench->demux+=tt; - MPXPCtx->bench->audio_decode_correction=tt; - if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; - if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; + mpxp_context().bench->demux+=tt; + mpxp_context().bench->audio_decode_correction=tt; + if(tt > mpxp_context().bench->max_demux) mpxp_context().bench->max_demux=tt; + if(tt < mpxp_context().bench->min_demux) mpxp_context().bench->min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -194,9 +194,9 @@ { t2=GetTimer();t=t2-t; tt = t*0.000001f; - MPXPCtx->bench->demux+=tt; - if(tt > MPXPCtx->bench->max_demux) MPXPCtx->bench->max_demux=tt; - if(tt < MPXPCtx->bench->min_demux) MPXPCtx->bench->min_demux=tt; + mpxp_context().bench->demux+=tt; + if(tt > mpxp_context().bench->max_demux) mpxp_context().bench->max_demux=tt; + if(tt < mpxp_context().bench->min_demux) mpxp_context().bench->min_demux=tt; } UNLOCK_DEMUXER(); return retval; Modified: mplayerxp/libmpstream/cache2.cpp =================================================================== --- mplayerxp/libmpstream/cache2.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libmpstream/cache2.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -255,9 +255,9 @@ if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; tt = t*0.000001f; - MPXPCtx->bench->c2+=tt; - if(tt > MPXPCtx->bench->max_c2) MPXPCtx->bench->max_c2=tt; - if(tt < MPXPCtx->bench->min_c2) MPXPCtx->bench->min_c2=tt; + mpxp_context().bench->c2+=tt; + if(tt > mpxp_context().bench->max_c2) mpxp_context().bench->max_c2=tt; + if(tt < mpxp_context().bench->min_c2) mpxp_context().bench->min_c2=tt; } if(!cfill) usleep(FILL_USLEEP_TIME); // idle if(priv->state==Pth_Canceling) break; Modified: mplayerxp/libplaytree/asxparser.cpp =================================================================== --- mplayerxp/libplaytree/asxparser.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/libplaytree/asxparser.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -450,7 +450,7 @@ return; } val = asx_get_attrib("VALUE",attribs); - if(m_config_get_option(MPXPCtx->mconfig,name) == NULL) { + if(m_config_get_option(mpxp_context().mconfig,name) == NULL) { MSG_WARN("Found unknow param in asx: %s",name); if(val) MSG_WARN("=%s\n",val); Modified: mplayerxp/mp_msg.cpp =================================================================== --- mplayerxp/mp_msg.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/mp_msg.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -25,7 +25,7 @@ static char *_2ansi(unsigned char attr) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->msg_priv); + priv_t*priv=reinterpret_cast<priv_t*>(mpxp_context().msg_priv); int bg = _bg(attr); int bc = priv->_color[bg & 7]; @@ -44,7 +44,7 @@ unsigned i; int _color[8]={0,4,2,6,1,5,3,7}; priv_t*priv=new priv_t; - MPXPCtx->msg_priv=priv; + mpxp_context().msg_priv=priv; memcpy(priv->_color,_color,sizeof(_color)); pthread_mutex_init(&priv->mp_msg_mutex,NULL); for(i=0;i<sizeof(hl)/sizeof(char);i++) memcpy(priv->scol[i],_2ansi(hl[i]),sizeof(priv->scol[0])); @@ -52,7 +52,7 @@ void mpxp_print_uninit(void) { - priv_t*priv=reinterpret_cast<priv_t*>(MPXPCtx->msg_priv); + priv_t*priv=reinterpret_cast<priv_t*>(mpxp_context().msg_priv); if(isatty(fileno(stderr))) fprintf(stderr,priv->scol[8]); mpxp_print_flush(); pthread_mutex_destroy(&priv->mp_msg_mutex); @@ -92,7 +92,7 @@ unsigned mod=x&0x0FFFFFFF; static int was_eol=1; priv_t*priv=NULL; - if(MPXPCtx) priv=reinterpret_cast<priv_t*>(MPXPCtx->msg_priv); + priv=reinterpret_cast<priv_t*>(mpxp_context().msg_priv); if(level>mp_conf.verbose+MSGL_V-1) return 0; /* do not display */ if((mod&mp_conf.msg_filter)==0) return 0; /* do not display */ if(priv) { Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/mplayerxp.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -249,7 +249,7 @@ MPXPContext::~MPXPContext() { delete bench; } static volatile char antiviral_hole2[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; -MPXPContext* MPXPCtx=NULL; +static MPXPContext* MPXPCtx(new(zeromem) MPXPContext); xp_core_t* xp_core=NULL; static volatile char antiviral_hole3[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; volatile MPXPSecureKeys* secure_keys; @@ -260,6 +260,8 @@ ao_data_t* ao_data=NULL; Video_Output* vo_data=NULL; /**************************************************************************/ +MPXPContext& mpxp_context() { return *MPXPCtx; } + static int mpxp_init_antiviral_protection(int verbose) { int rc; @@ -300,7 +302,6 @@ } static void mpxp_init_structs(void) { - MPXPCtx=new(zeromem) MPXPContext; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) memset(&x86,-1,sizeof(x86_features_t)); #endif @@ -310,10 +311,8 @@ #ifdef ENABLE_WIN32LOADER free_codec_cfg(); #endif - delete MPXPCtx; if(vo_data) delete vo_data; if(ao_data) delete ao_data; - MPXPCtx=NULL; xmp_uninit(); mp_uninit_malloc(mp_conf.verbose); } @@ -371,7 +370,7 @@ if(mask&INITED_VCODEC){ inited_flags&=~INITED_VCODEC; MP_UNIT("uninit_vcodec"); - mpcv_uninit(MPXPCtx->video.decoder); + mpcv_uninit(mpxp_context().video.decoder); sh_video=NULL; } @@ -385,7 +384,7 @@ if(mask&INITED_ACODEC){ inited_flags&=~INITED_ACODEC; MP_UNIT("uninit_acodec"); - mpca_uninit(MPXPCtx->audio.decoder); + mpca_uninit(mpxp_context().audio.decoder); sh_audio=NULL; } @@ -410,10 +409,10 @@ if(mask&INITED_SUBTITLE){ inited_flags&=~INITED_SUBTITLE; MP_UNIT("sub_free"); - sub_free( MPXPCtx->subtitles ); + sub_free( mpxp_context().subtitles ); mp_conf.sub_name=NULL; vo_data->sub=NULL; - MPXPCtx->subtitles=NULL; + mpxp_context().subtitles=NULL; } #endif MP_UNIT(NULL); @@ -423,12 +422,12 @@ fflush(stdout); fflush(stderr); - MPXPCtx->MPXPSys.uninit_player(INITED_ALL); + mpxp_context().MPXPSys.uninit_player(INITED_ALL); MP_UNIT("exit_player"); if(why) MSG_HINT(MSGTR_Exiting,why); - if(MPXPCtx->mconfig) m_config_free(MPXPCtx->mconfig); + if(mpxp_context().mconfig) m_config_free(mpxp_context().mconfig); mpxp_print_uninit(); mpxp_uninit_structs(); if(why) exit(0); @@ -561,12 +560,12 @@ gCpuCaps.hasAES, gCpuCaps.hasAVX, gCpuCaps.hasFMA); - if(gCpuCaps.hasMMX) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_MMX; - if(gCpuCaps.hasMMX2) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_MMXEXT; - if(gCpuCaps.hasSSE) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_SSE; - if(gCpuCaps.has3DNow) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_3DNOW; - if(gCpuCaps.has3DNowExt) MPXPCtx->mplayer_accel |= MM_ACCEL_X86_3DNOWEXT; - MSG_V("MPXPCtx->mplayer_accel=%i\n",MPXPCtx->mplayer_accel); + if(gCpuCaps.hasMMX) mpxp_context().mplayer_accel |= MM_ACCEL_X86_MMX; + if(gCpuCaps.hasMMX2) mpxp_context().mplayer_accel |= MM_ACCEL_X86_MMXEXT; + if(gCpuCaps.hasSSE) mpxp_context().mplayer_accel |= MM_ACCEL_X86_SSE; + if(gCpuCaps.has3DNow) mpxp_context().mplayer_accel |= MM_ACCEL_X86_3DNOW; + if(gCpuCaps.has3DNowExt) mpxp_context().mplayer_accel |= MM_ACCEL_X86_3DNOWEXT; + MSG_V("mpxp_context().mplayer_accel=%i\n",mpxp_context().mplayer_accel); } #endif @@ -639,8 +638,8 @@ } void show_long_help(void) { - MPXPSystem& MPXPSys=MPXPCtx->MPXPSys; - m_config_show_options(MPXPCtx->mconfig); + MPXPSystem& MPXPSys=mpxp_context().MPXPSys; + m_config_show_options(mpxp_context().mconfig); mp_input_print_binds(MPXPSys.libinput()); print_stream_drivers(); vo_data->print_help(); @@ -668,7 +667,7 @@ //================= Update OSD ==================== void update_osd( float v_pts ) { - MPXPSystem& MPXPSys=MPXPCtx->MPXPSys; + MPXPSystem& MPXPSys=mpxp_context().MPXPSys; static char osd_text_buffer[64]; static int osd_last_pts=-303; //================= Update OSD ==================== @@ -715,10 +714,10 @@ xp_core->audio->eof=0; if(_seek->secs || _seek->flags&DEMUX_SEEK_SET) { seek_rval=demux_seek_r(_demuxer,_seek); - MPXPCtx->mpxp_after_seek=25; /* 1 sec delay */ + mpxp_context().mpxp_after_seek=25; /* 1 sec delay */ } if(seek_rval){ - MPXPCtx->seek_time = GetTimerMS(); + mpxp_context().seek_time = GetTimerMS(); // success: /* FIXME there should be real seeking for vobsub */ @@ -733,14 +732,14 @@ if(sh_video){ MP_UNIT("seek_video_reset"); - mpcv_resync_stream(MPXPCtx->video.decoder); + mpcv_resync_stream(mpxp_context().video.decoder); vo_data->reset(); sh_video->chapter_change=-1; } if(sh_audio){ MP_UNIT("seek_audio_reset"); - mpca_resync_stream(MPXPCtx->audio.decoder); + mpca_resync_stream(mpxp_context().audio.decoder); ao_reset(ao_data); // stop audio, throwing away buffered data } @@ -764,7 +763,7 @@ if(sh_video) { max_pts_correction=0.1; if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; // to rewert to PLAY pointer after 1 sec - MPXPCtx->bench->audio=0; MPXPCtx->bench->audio_decode=0; MPXPCtx->bench->video=0; MPXPCtx->bench->vout=0; + mpxp_context().bench->audio=0; mpxp_context().bench->audio_decode=0; mpxp_context().bench->video=0; mpxp_context().bench->vout=0; if(vo_data->spudec) { unsigned char* packet=NULL; while(ds_get_packet_sub_r(d_dvdsub,&packet)>0) ; // Empty stream @@ -778,7 +777,7 @@ void mpxp_reset_vcache(void) { - MPXPSystem& MPXPSys=MPXPCtx->MPXPSys; + MPXPSystem& MPXPSys=mpxp_context().MPXPSys; sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys.demuxer()->video->sh); seek_args_t _seek = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; if(sh_video) MPXPSys.seek(NULL,&_seek); @@ -787,7 +786,7 @@ void mpxp_resync_audio_stream(void) { - mpca_resync_stream(MPXPCtx->audio.decoder); + mpca_resync_stream(mpxp_context().audio.decoder); } static void __FASTCALL__ mpxp_stream_event_handler(stream_t *s,const stream_packet_t *sp) @@ -797,39 +796,39 @@ static void init_benchmark(void) { - MPXPCtx->bench->max_audio=0; MPXPCtx->bench->max_video=0; MPXPCtx->bench->max_vout=0; - MPXPCtx->bench->min_audio=HUGE; MPXPCtx->bench->min_video=HUGE; MPXPCtx->bench->min_vout=HUGE; + mpxp_context().bench->max_audio=0; mpxp_context().bench->max_video=0; mpxp_context().bench->max_vout=0; + mpxp_context().bench->min_audio=HUGE; mpxp_context().bench->min_video=HUGE; mpxp_context().bench->min_vout=HUGE; - MPXPCtx->bench->min_audio_decode=HUGE; - MPXPCtx->bench->max_audio_decode=0; + mpxp_context().bench->min_audio_decode=HUGE; + mpxp_context().bench->max_audio_decode=0; - MPXPCtx->bench->max_demux=0; - MPXPCtx->bench->demux=0; - MPXPCtx->bench->min_demux=HUGE; + mpxp_context().bench->max_demux=0; + mpxp_context().bench->demux=0; + mpxp_context().bench->min_demux=HUGE; - MPXPCtx->bench->cur_video=0; - MPXPCtx->bench->cur_vout=0; - MPXPCtx->bench->cur_audio=0; + mpxp_context().bench->cur_video=0; + mpxp_context().bench->cur_vout=0; + mpxp_context().bench->cur_audio=0; } static void show_benchmark(void) { - double tot=(MPXPCtx->bench->video+MPXPCtx->bench->vout+MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode+MPXPCtx->bench->demux+MPXPCtx->bench->c2); + double tot=(mpxp_context().bench->video+mpxp_context().bench->vout+mpxp_context().bench->audio+mpxp_context().bench->audio_decode+mpxp_context().bench->demux+mpxp_context().bench->c2); double total_time_usage; - MPXPCtx->bench->total_start=GetTimer()-MPXPCtx->bench->total_start; - total_time_usage = (float)MPXPCtx->bench->total_start*0.000001; + mpxp_context().bench->total_start=GetTimer()-mpxp_context().bench->total_start; + total_time_usage = (float)mpxp_context().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", - MPXPCtx->bench->video,MPXPCtx->bench->vout,MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode, - MPXPCtx->bench->demux,MPXPCtx->bench->c2,tot); + mpxp_context().bench->video,mpxp_context().bench->vout,mpxp_context().bench->audio+mpxp_context().bench->audio_decode, + mpxp_context().bench->demux,mpxp_context().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*MPXPCtx->bench->video/total_time_usage, - 100.0*MPXPCtx->bench->vout/total_time_usage, - 100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/total_time_usage, - 100.0*MPXPCtx->bench->demux/total_time_usage, - 100.0*MPXPCtx->bench->c2/total_time_usage, + 100.0*mpxp_context().bench->video/total_time_usage, + 100.0*mpxp_context().bench->vout/total_time_usage, + 100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/total_time_usage, + 100.0*mpxp_context().bench->demux/total_time_usage, + 100.0*mpxp_context().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" @@ -838,17 +837,17 @@ static void show_benchmark_status(void) { - MPXPSystem& MPXPSys=MPXPCtx->MPXPSys; + MPXPSystem& MPXPSys=mpxp_context().MPXPSys; sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys.demuxer()->audio->sh); if(xmp_test_model(XMP_Run_AudioPlayback)) MSG_STATUS("A:%6.1f %4.1f%%\r" ,sh_audio->timer-ao_get_delay(ao_data) - ,(sh_audio->timer>0.5)?100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)sh_audio->timer:0 + ,(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().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*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)sh_audio->timer:0 + ,(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)sh_audio->timer:0 ,get_delay_audio_buffer() ); } @@ -867,7 +866,7 @@ } void mplayer_put_key(int code){ - MPXPSystem& MPXPSys=MPXPCtx->MPXPSys; + MPXPSystem& MPXPSys=mpxp_context().MPXPSys; mp_cmd_t* cmd; cmd=mp_input_get_cmd_from_keys(MPXPSys.libinput(),1,&code); mp_input_queue_cmd(MPXPSys.libinput(),cmd); @@ -1110,15 +1109,15 @@ // check .sub MP_UNIT("read_subtitles_file"); if(mp_conf.sub_name){ - MPXPCtx->subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); - if(!MPXPCtx->subtitles) MSG_ERR(MSGTR_CantLoadSub,mp_conf.sub_name); + mpxp_context().subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); + if(!mpxp_context().subtitles) MSG_ERR(MSGTR_CantLoadSub,mp_conf.sub_name); } else if(mp_conf.sub_auto) { // auto load sub file ... - MPXPCtx->subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) + mpxp_context().subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) : "default.sub", sh_video->fps ); } - if(MPXPCtx->subtitles) { + if(mpxp_context().subtitles) { inited_flags|=INITED_SUBTITLE; - if(stream_dump_type>1) list_sub_file(MPXPCtx->subtitles); + if(stream_dump_type>1) list_sub_file(mpxp_context().subtitles); } #endif } @@ -1130,7 +1129,7 @@ Demuxer_Stream *d_audio=_demuxer->audio; sh_audio->codec=NULL; mpca=mpca_init(sh_audio); // try auto-probe first - if(mpca) { MPXPCtx->audio.decoder=mpca; found=1; } + if(mpca) { mpxp_context().audio.decoder=mpca; found=1; } #ifdef ENABLE_WIN32LOADER if(!found) { // Go through the codec.conf and find the best codec... @@ -1198,7 +1197,7 @@ if(vo_conf.softzoom) vo_data->ZOOM_SET(); if(vo_conf.flip>0) vo_data->FLIP_SET(); if(vo_conf.vidmode) vo_data->VM_SET(); - if((MPXPCtx->video.decoder=mpcv_init(sh_video,mp_conf.video_codec,mp_conf.video_family,-1,_libinput))) sh_video->inited=1; + if((mpxp_context().video.decoder=mpcv_init(sh_video,mp_conf.video_codec,mp_conf.video_family,-1,_libinput))) sh_video->inited=1; #ifdef ENABLE_WIN32LOADER if(!sh_video->inited) { /* Go through the codec.conf and find the best codec...*/ @@ -1219,7 +1218,7 @@ } } /* Use lavc decoders as last hope */ - if(!sh_video->inited) MPXPCtx->video.decoder=mpcv_lavc_init(sh_video,_libinput); + if(!sh_video->inited) mpxp_context().video.decoder=mpcv_lavc_init(sh_video,_libinput); #endif if(!sh_video->inited) { @@ -1525,7 +1524,7 @@ else v_cont+=v; if(v_cont > 100) v_cont=100; if(v_cont < -100) v_cont = -100; - if(mpcv_set_colors(MPXPCtx->video.decoder,VO_EC_CONTRAST,v_cont)==MPXP_Ok) { + if(mpcv_set_colors(mpxp_context().video.decoder,VO_EC_CONTRAST,v_cont)==MPXP_Ok) { #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -1543,7 +1542,7 @@ else v_bright+=v; if(v_bright > 100) v_bright = 100; if(v_bright < -100) v_bright = -100; - if(mpcv_set_colors(MPXPCtx->video.decoder,VO_EC_BRIGHTNESS,v_bright)==MPXP_Ok) { + if(mpcv_set_colors(mpxp_context().video.decoder,VO_EC_BRIGHTNESS,v_bright)==MPXP_Ok) { #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -1561,7 +1560,7 @@ else v_hue+=v; if(v_hue > 100) v_hue = 100; if(v_hue < -100) v_hue = -100; - if(mpcv_set_colors(MPXPCtx->video.decoder,VO_EC_HUE,v_hue)==MPXP_Ok) { + if(mpcv_set_colors(mpxp_context().video.decoder,VO_EC_HUE,v_hue)==MPXP_Ok) { #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -1579,7 +1578,7 @@ else v_saturation+=v; if(v_saturation > 100) v_saturation = 100; if(v_saturation < -100) v_saturation = -100; - if(mpcv_set_colors(MPXPCtx->video.decoder,VO_EC_SATURATION,v_saturation)==MPXP_Ok) { + if(mpcv_set_colors(mpxp_context().video.decoder,VO_EC_SATURATION,v_saturation)==MPXP_Ok) { #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -1693,7 +1692,7 @@ secure_keys=ptr_protector.protect(new MPXPSecureKeys(10)); mpxp_init_structs(); - MPXPSystem& MPXPSys=MPXPCtx->MPXPSys; + MPXPSystem& MPXPSys=mpxp_context().MPXPSys; vo_data=new(zeromem) Video_Output; init_signal_handling(); @@ -1708,13 +1707,13 @@ MPXPSys.playtree = play_tree_new(); - MPXPCtx->mconfig = m_config_new(MPXPSys.playtree,MPXPSys.libinput()); - m_config_register_options(MPXPCtx->mconfig,mplayer_opts); + mpxp_context().mconfig = m_config_new(MPXPSys.playtree,MPXPSys.libinput()); + m_config_register_options(mpxp_context().mconfig,mplayer_opts); // TODO : add something to let modules register their options - mp_register_options(MPXPCtx->mconfig); - parse_cfgfiles(MPXPCtx->mconfig); + mp_register_options(mpxp_context().mconfig); + parse_cfgfiles(mpxp_context().mconfig); - if(m_config_parse_command_line(MPXPCtx->mconfig, argc, argv, envp)!=MPXP_Ok) + if(m_config_parse_command_line(mpxp_context().mconfig, argc, argv, envp)!=MPXP_Ok) exit_player("Error parse command line"); // error parsing cmdline if(!mp_conf.xp) { @@ -1741,7 +1740,7 @@ MPXPSys.playtree = play_tree_cleanup(MPXPSys.playtree); if(MPXPSys.playtree) { - playtree_iter = play_tree_iter_new(MPXPSys.playtree,MPXPCtx->mconfig); + playtree_iter = play_tree_iter_new(MPXPSys.playtree,mpxp_context().mconfig); if(playtree_iter) { if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { play_tree_iter_free(playtree_iter); @@ -1890,8 +1889,8 @@ /* is it non duplicate block fro find_acodec() ??? */ if(sh_audio){ MSG_V("Initializing audio codec...\n"); - if(!MPXPCtx->audio.decoder) { - if((MPXPCtx->audio.decoder=mpca_init(sh_audio))==NULL){ + if(!mpxp_context().audio.decoder) { + if((mpxp_context().audio.decoder=mpca_init(sh_audio))==NULL){ MSG_ERR(MSGTR_CouldntInitAudioCodec); d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); @@ -1931,12 +1930,12 @@ /* Auto quality option enabled*/ MPXP_Rc rc; unsigned quality; - rc=mpcv_get_quality_max(MPXPCtx->video.decoder,&quality); - if(rc==MPXP_Ok) MPXPCtx->output_quality=quality; - if(mp_conf.autoq>MPXPCtx->output_quality) mp_conf.autoq=MPXPCtx->output_quality; - else MPXPCtx->output_quality=mp_conf.autoq; - MSG_V("AutoQ: setting quality to %d\n",MPXPCtx->output_quality); - mpcv_set_quality(MPXPCtx->video.decoder,MPXPCtx->output_quality); + rc=mpcv_get_quality_max(mpxp_context().video.decoder,&quality); + if(rc==MPXP_Ok) mpxp_context().output_quality=quality; + if(mp_conf.autoq>mpxp_context().output_quality) mp_conf.autoq=mpxp_context().output_quality; + else mpxp_context().output_quality=mp_conf.autoq; + MSG_V("AutoQ: setting quality to %d\n",mpxp_context().output_quality); + mpcv_set_quality(mpxp_context().video.decoder,mpxp_context().output_quality); } vf_showlist(reinterpret_cast<vf_instance_t*>(sh_video->vfilter)); @@ -1965,9 +1964,9 @@ d_video->demuxer->file_format == DEMUXER_TYPE_H264_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_PS || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS))) - MPXPCtx->use_pts_fix2=1; + mpxp_context().use_pts_fix2=1; else - MPXPCtx->use_pts_fix2=0; + mpxp_context().use_pts_fix2=0; if(sh_video) sh_video->chapter_change=0; @@ -1996,13 +1995,13 @@ } /* Init timers and benchmarking */ - MPXPCtx->rtc_fd=InitTimer(); - if(!mp_conf.nortc && MPXPCtx->rtc_fd>0) { close(MPXPCtx->rtc_fd); MPXPCtx->rtc_fd=-1; } - MSG_V("Using %s timing\n",MPXPCtx->rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()"); + mpxp_context().rtc_fd=InitTimer(); + if(!mp_conf.nortc && mpxp_context().rtc_fd>0) { close(mpxp_context().rtc_fd); mpxp_context().rtc_fd=-1; } + MSG_V("Using %s timing\n",mpxp_context().rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()"); - MPXPCtx->bench->total_start=GetTimer(); - MPXPCtx->bench->audio=0; MPXPCtx->bench->audio_decode=0; MPXPCtx->bench->video=0; - MPXPCtx->bench->audio_decode_correction=0; + mpxp_context().bench->total_start=GetTimer(); + mpxp_context().bench->audio=0; mpxp_context().bench->audio_decode=0; mpxp_context().bench->video=0; + mpxp_context().bench->audio_decode_correction=0; if(mp_conf.benchmark) init_benchmark(); @@ -2019,7 +2018,7 @@ let thread will decode ahead! We may print something in block window ;) */ - MPXPCtx->seek_time = GetTimerMS(); + mpxp_context().seek_time = GetTimerMS(); if(sh_video) dae_wait_decoder_outrun(xp_core->video); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/mplayerxp.h 2012-12-01 15:51:26 UTC (rev 495) @@ -149,8 +149,9 @@ audio_processing_t& audio; video_processing_t& video; }; - extern MPXPContext* MPXPCtx; + MPXPContext& mpxp_context(); + unsigned get_number_cpu(void); void show_help(void); void show_long_help(void); Modified: mplayerxp/xmpcore/xmp_adecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/xmpcore/xmp_adecoder.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -276,7 +276,7 @@ for( l = 0, l2 = len, ret = 0; l < len && l2 >= audio_buffer.sh_audio->audio_out_minsize; ) { float pts; - ret = mpca_decode(MPXPCtx->audio.decoder, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&pts); + ret = mpca_decode(mpxp_context().audio.decoder, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&pts); if( ret <= 0 ) break; @@ -313,12 +313,12 @@ pthread_cond_signal( &audio_buffer.wait_buffer_cond ); t=GetTimer()-t; - MPXPCtx->bench->audio_decode+=t*0.000001f; - MPXPCtx->bench->audio_decode-=MPXPCtx->bench->audio_decode_correction; + mpxp_context().bench->audio_decode+=t*0.000001f; + mpxp_context().bench->audio_decode-=mpxp_context().bench->audio_decode_correction; if(mp_conf.benchmark) { - if(t > MPXPCtx->bench->max_audio_decode) MPXPCtx->bench->max_audio_decode = t; - if(t < MPXPCtx->bench->min_audio_decode) MPXPCtx->bench->min_audio_decode = t; + if(t > mpxp_context().bench->max_audio_decode) mpxp_context().bench->max_audio_decode = t; + if(t < mpxp_context().bench->min_audio_decode) mpxp_context().bench->min_audio_decode = t; } pthread_mutex_unlock( &audio_buffer.head_mutex ); Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -65,7 +65,7 @@ ret=read_audio_buffer(sh_audio,(unsigned char *)&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(MPXPCtx->audio.decoder,(unsigned char *)&sh_audio->a_buffer[sh_audio->a_buffer_len], + ret=mpca_decode(mpxp_context().audio.decoder,(unsigned char *)&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; @@ -78,12 +78,12 @@ MP_UNIT("play_audio"); // Leave AUDIO decoder module t=GetTimer()-t; tt = t*0.000001f; - MPXPCtx->bench->audio+=tt; + mpxp_context().bench->audio+=tt; if(mp_conf.benchmark) { - if(tt > MPXPCtx->bench->max_audio) MPXPCtx->bench->max_audio = tt; - if(tt < MPXPCtx->bench->min_audio) MPXPCtx->bench->min_audio = tt; - MPXPCtx->bench->cur_audio=tt; + if(tt > mpxp_context().bench->max_audio) mpxp_context().bench->max_audio = tt; + if(tt < mpxp_context().bench->min_audio) mpxp_context().bench->min_audio = tt; + mpxp_context().bench->cur_audio=tt; } if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; @@ -96,7 +96,7 @@ memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); if(!mp_conf.av_sync_pts && xmp_test_model(XMP_Run_AudioPlayer)) pthread_mutex_lock(&audio_timer_mutex); - if(MPXPCtx->use_pts_fix2) { + if(mpxp_context().use_pts_fix2) { if(sh_audio->a_pts != HUGE) { sh_audio->a_pts_pos-=playsize; if(sh_audio->a_pts_pos > -ao_get_delay(ao_data)*sh_audio->af_bps) { Modified: mplayerxp/xmpcore/xmp_vdecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -44,7 +44,7 @@ float screen_pts=dae_played_frame(xp_core->video).v_pts-(mp_conf.av_sync_pts?0:xp_core->initial_apts); static float prev_delta=64; float delta,max_frame_delay;/* delay for decoding of top slow frame */ - max_frame_delay = MPXPCtx->bench->max_video+MPXPCtx->bench->max_vout; + max_frame_delay = mpxp_context().bench->max_video+mpxp_context().bench->max_vout; /* TODO: @@ -138,7 +138,7 @@ if(!xmp_test_model(XMP_Run_VA_Decoder) && xp_core->audio) priv->name = "video decoder"; drop_barrier=(float)(xp_core->num_v_buffs/2)*(1/sh_video->fps); - if(mp_conf.av_sync_pts == -1 && !MPXPCtx->use_pts_fix2) + if(mp_conf.av_sync_pts == -1 && !mpxp_context().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 || @@ -190,7 +190,7 @@ int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ - if(cur_time - MPXPCtx->seek_time > (xp_core->num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(sh_video,frame->pts,drop_barrier); + if(cur_time - mpxp_context().seek_time > (xp_core->num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(sh_video,frame->pts,drop_barrier); } /* if( mp_conf.frame_dropping ) */ if(!finite(frame->pts)) MSG_WARN("Bug of demuxer! Value of video pts=%f\n",frame->pts); if(frame->type!=VideoFrame) escape_player("VideoDecoder doesn't parse non video frames",mp_conf.max_trace); @@ -209,20 +209,20 @@ if(xp_n_frame_to_drop) drop_param=mp_conf.frame_dropping; else drop_param=0; /* decode: */ - if(MPXPCtx->output_quality) { + if(mpxp_context().output_quality) { unsigned total = xp_core->num_v_buffs/2; unsigned distance = dae_get_decoder_outrun(xp_core->video); int our_quality; - our_quality = MPXPCtx->output_quality*distance/total; - if(drop_param) mpcv_set_quality(MPXPCtx->video.decoder,0); + our_quality = mpxp_context().output_quality*distance/total; + if(drop_param) mpcv_set_quality(mpxp_context().video.decoder,0); else - if(mp_conf.autoq) mpcv_set_quality(MPXPCtx->video.decoder,our_quality>0?our_quality:0); + if(mp_conf.autoq) mpcv_set_quality(mpxp_context().video.decoder,our_quality>0?our_quality:0); } frame->flags=drop_param; - blit_frame=mpcv_decode(MPXPCtx->video.decoder,frame); + blit_frame=mpcv_decode(mpxp_context().video.decoder,frame); MSG_DBG2("DECODER: %i[%i] %f\n",dae_curr_vdecoded(xp_core),frame->len,frame->pts); - if(MPXPCtx->output_quality) { - if(drop_param) mpcv_set_quality(MPXPCtx->video.decoder,MPXPCtx->output_quality); + if(mpxp_context().output_quality) { + if(drop_param) mpcv_set_quality(mpxp_context().video.decoder,mpxp_context().output_quality); } if(!blit_frame && drop_param) priv->dae->num_dropped_frames++; if(blit_frame) { Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-11-30 16:28:49 UTC (rev 494) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-01 15:51:26 UTC (rev 495) @@ -31,10 +31,10 @@ MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d [frms: [%i]]\n", a_pts-delay,v_pts,AV_delay ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames - ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)v_pts):0 - ,MPXPCtx->output_quality + ,(v_pts>0.5)?(int)(100.0*mpxp_context().bench->video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*mpxp_context().bench->vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)v_pts):0 + ,mpxp_context().output_quality ,dae_curr_vplayed(xp_core) ); fflush(stdout); @@ -49,26 +49,26 @@ ,a_pts-v_pts ,0.0 ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames - ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)v_pts):0 - ,MPXPCtx->output_quality + ,(v_pts>0.5)?(int)(100.0*mpxp_context().bench->video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*mpxp_context().bench->vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)v_pts):0 + ,mpxp_context().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*MPXPCtx->bench->video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*MPXPCtx->bench->vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(MPXPCtx->bench->audio+MPXPCtx->bench->audio_decode)/(double)v_pts):0 - ,MPXPCtx->output_quality + ,(v_pts>0.5)?(int)(100.0*mpxp_context().bench->video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*mpxp_context().bench->vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)v_pts):0 + ,mpxp_context().output_quality ); fflush(stdout); } static void vplayer_check_chapter_change(sh_audio_t* sh_audio,sh_video_t* sh_video,xmp_frame_t* shva_prev,float v_pts) { - if(MPXPCtx->use_pts_fix2 && sh_audio) { + if(mpxp_context().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) yield_timeslice(); /* Wait for audio to start play */ @@ -98,10 +98,10 @@ often ao_get_delay() never returns 0 :( */ if(xp_core->audio->eof && !get_delay_audio_buffer()) goto nosound_model; if((!xp_core->audio->eof || ao_get_delay(ao_data)) && - (!MPXPCtx->use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) + (!mpxp_context().use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) sleep_time=screen_pts-((sh_audio->timer-ao_get_delay(ao_data)) +(mp_conf.av_sync_pts?0:xp_core->initial_apts)); - else if(MPXPCtx->use_pts_fix2 && sh_audio->chapter_change) + else if(mpxp_context().use_pts_fix2 && sh_audio->chapter_change) sleep_time=0; else goto nosound_model; @@ -192,7 +192,7 @@ static int drop_message=0; if(!drop_message && xp_core->video->num_slow_frames > 50) { drop_message=1; - if(MPXPCtx->mpxp_after_seek) MPXPCtx->mpxp_after_seek--; + if(mpxp_context().mpxp_after_seek) mpxp_context().mpxp_after_seek--; else MSG_WARN(MSGTR_SystemTooSlow); } MSG_D("\ndec_ahead_main: stalling: %i %i\n",dae_cuurr_vplayed(),dae_curr_decoded()); @@ -211,7 +211,7 @@ sleep_time=vplayer_compute_sleep_time(sh_audio,sh_video,&shva_prev,v_pts); if(!(vo_data->flags&256)){ /* flag 256 means: libvo driver does its timing (dvb card) */ - if(!vplayer_do_sleep(sh_audio,MPXPCtx->rtc_fd,sleep_time)) return 0; + if(!vplayer_do_sleep(sh_audio,mpxp_context().rtc_fd,sleep_time)) return 0; } player_idx=dae_next_played(xp_core->video); @@ -220,10 +220,10 @@ MSG_D("\ndec_ahead_main: schedule %u on screen\n",player_idx); t2=GetTimer()-t2; tt = t2*0.000001f; - MPXPCtx->bench->vout+=tt; + mpxp_context().bench->vout+=tt; if(mp_conf.benchmark) { /* we need compute draw_slice+change_frame here */ - MPXPCtx->bench->cur_vout+=tt; + mpxp_context().bench->cur_vout+=tt; } } MP_UNIT(NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |