[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[592] mplayerxp/xmpcore
Brought to you by:
olov
From: <nic...@us...> - 2012-12-21 14:05:40
|
Revision: 592 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=592&view=rev Author: nickols_k Date: 2012-12-21 14:05:31 +0000 (Fri, 21 Dec 2012) Log Message: ----------- convert MSG_* into mpxp_ostream compatible output Modified Paths: -------------- mplayerxp/xmpcore/sig_hand.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aframe.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_core.cpp mplayerxp/xmpcore/xmp_core.h mplayerxp/xmpcore/xmp_image.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/xmpcore/sig_hand.cpp =================================================================== --- mplayerxp/xmpcore/sig_hand.cpp 2012-12-21 11:07:21 UTC (rev 591) +++ mplayerxp/xmpcore/sig_hand.cpp 2012-12-21 14:05:31 UTC (rev 592) @@ -27,7 +27,7 @@ /* A dummy function to make the backtrace more interesting. */ static void dump_trace (void) { show_backtrace("Obtained %zd stack frames.\n",mp_conf.max_trace); - MSG_HINT("\nFor source lines you may also print in (gdb): list *0xADDRESS\n"); + mpxp_hint<<std::endl<<"For source lines you may also print in (gdb): list *0xADDRESS"<<std::endl; } static void my_callback(int signo) @@ -38,11 +38,9 @@ if(i >= mpxp_context().engine().xp_core->num_threads || !pthread_equal(mpxp_context().engine().xp_core->mpxp_threads[i]->pth_id, _self)) i = 0; /* Use 0 as default handler */ - MSG_FATAL("catching signal: %s in thread: %s (%i) in module: %s\n" - ,strsignal(signo) - ,mpxp_context().engine().xp_core->mpxp_threads[i]->name - ,i - ,mpxp_context().engine().xp_core->mpxp_threads[i]->unit); + mpxp_fatal<<"catching signal: "<<strsignal(signo) + <<" in thread: "<<mpxp_context().engine().xp_core->mpxp_threads[i]->name + <<" ("<<i<<") in module: %s"<<mpxp_context().engine().xp_core->mpxp_threads[i]->unit<<std::endl; dump_trace(); #ifdef NDEBUG mpxp_context().engine().xp_core->mpxp_threads[i]->sigfunc(); Modified: mplayerxp/xmpcore/xmp_adecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.cpp 2012-12-21 11:07:21 UTC (rev 591) +++ mplayerxp/xmpcore/xmp_adecoder.cpp 2012-12-21 14:05:31 UTC (rev 592) @@ -21,12 +21,6 @@ /* Audio stuff */ volatile float dec_ahead_audio_delay; namespace mpxp { -#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); /************************************************************************ @@ -65,7 +59,7 @@ 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); + mpxp_v<<"Using audio buffer "<<size<<" bytes (min reserve = "<<min_reserv<<", indices "<<indices<<")"<<std::endl; if( !(audio_buffer.buffer = new unsigned char[size]) ) return ENOMEM; if( !(audio_buffer.indices = new audio_buffer_index_t[indices])) { @@ -104,8 +98,7 @@ loops--; } if( audio_buffer.blocked_readers > 0 ) - MSG_V("uninit_audio_buffer: %d blocked readers did not wake up\n", - audio_buffer.blocked_readers); + mpxp_v<<"uninit_audio_buffer: "<<audio_buffer.blocked_readers<<" blocked readers did not wake up"<<std::endl; } audio_buffer.index_len=0; @@ -197,23 +190,29 @@ } *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 ); + mpxp_dbg3<<"audio_ahead: len "<<len<<", tail "<<audio_buffer.tail + <<" pts "<<*pts<<" tail_idx "<<audio_buffer.index_tail + <<" head_idx "<<head_idx<<" head_pos "<<head_pos<<std::endl; 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); + mpxp_dbg3<<"audio_ahead: next_idx "<<next_idx<<" index"<<audio_buffer.indices[next_idx].index<<std::endl; 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 ); + mpxp_dbg3<<"audio_ahead: orig idx "<<audio_buffer.index_tail + <<" pts "<<audio_buffer.indices[audio_buffer.index_tail].pts + <<" pos "<<audio_buffer.indices[audio_buffer.index_tail].index<<std::endl; 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 ); + mpxp_dbg3<<"audio_ahead: read next_idx "<<audio_buffer.index_tail + <<" next_pts "<<audio_buffer.indices[audio_buffer.index_tail].pts + <<" pos "<<audio_buffer.indices[audio_buffer.index_tail].index<<std::endl; } } @@ -272,7 +271,7 @@ } } } - MSG_DBG3("decode audio %d h %d, t %d, l %d \n", len, audio_buffer.head, audio_buffer.tail, audio_buffer.len); + mpxp_dbg3<<"decode audio "<<len<<" h "<<audio_buffer.head<<", t "<<audio_buffer.tail<<", l "<<audio_buffer.len<<std::endl; for( l = 0, l2 = len, ret = 0; l < len && l2 >= audio_buffer.sh_audio->audio_out_minsize; ) { float pts; @@ -282,21 +281,23 @@ 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 ); + mpxp_dbg3<<"decode audio idx "<<audio_buffer.index_head + <<" tail "<<audio_buffer.index_tail + <<" next pts "<<pts<<" "<<audio_buffer.head<<std::endl; 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); + mpxp_dbg3<<"new head "<<audio_buffer.head<<std::endl; l += ret; l2 -= ret; blen -= ret; } - MSG_DBG2("decoded audio %d diff %d\n", l, l - len); + mpxp_dbg2<<"decoded audio "<<l<<" diff "<<(l - len)<<std::endl; if( ret <= 0 && d_audio->eof) { - MSG_V("audio eof\n"); + mpxp_v<<"audio eof"<<std::endl; audio_buffer.eof=1; pthread_mutex_unlock( &audio_buffer.head_mutex ); pthread_mutex_lock( &audio_buffer.tail_mutex ); @@ -437,7 +438,7 @@ priv->state=Pth_Run; if(mpxp_context().engine().xp_core->video) mpxp_context().engine().xp_core->video->eof=0; mpxp_context().engine().xp_core->audio->eof=0; - MSG_T("\nDEC_AHEAD: entering...\n"); + mpxp_dbg2<<std::endl<<"DEC_AHEAD: entering..."<<std::endl; priv->pid = getpid(); __MP_UNIT(priv->p_idx,"dec_ahead"); @@ -500,7 +501,7 @@ 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"); + mpxp_v<<"Audio decode seek timeout"<<std::endl; } #endif dec_ahead_can_adseek = 0; /* Not safe to seek */ @@ -514,7 +515,7 @@ void sig_audio_decode( void ) { - MSG_T("sig_audio_decode\n"); + mpxp_dbg2<<"sig_audio_decode"<<std::endl; mpxp_print_flush(); dec_ahead_can_adseek=1; Modified: mplayerxp/xmpcore/xmp_aframe.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aframe.cpp 2012-12-21 11:07:21 UTC (rev 591) +++ mplayerxp/xmpcore/xmp_aframe.cpp 2012-12-21 14:05:31 UTC (rev 592) @@ -44,7 +44,7 @@ break; } //This can not happen .... - MSG_FATAL("[af_mp] Unrecognized input audio format %i\n",ifmt); + mpxp_fatal<<"[af_mp] Unrecognized input audio format "<<ifmt<<std::endl; break; } return ofmt; @@ -261,7 +261,7 @@ if(strcasecmp(str,fmt_aliases[i].name)==0) return mpaf_format_e(fmt_aliases[i].wtag<<16); } bad_fmt: - MSG_ERR("[af_format] Bad value %s. Examples: S08LE U24BE S32 MP3 AC3\n",str); + mpxp_err<<"[af_format] Bad value "<<str<<". Examples: S08LE U24BE S32 MP3 AC3"<<std::endl; return mpaf_format_e(MPAF_BE); } Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-21 11:07:21 UTC (rev 591) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-21 14:05:31 UTC (rev 592) @@ -21,17 +21,10 @@ #include "xmp_aplayer.h" #include "xmp_adecoder.h" +static const float MIN_AUDIO_TIME=0.05f; +static const float NOTHING_PLAYED=-1.0f; +static const float XP_MIN_TIMESLICE=0.010f; /* under Linux on x86 min time_slice = 10 ms */ -#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 */ - namespace mpxp { static int decore_audio(Demuxer_Stream *d_audio,sh_audio_t* sh_audio,sh_video_t*sh_video) @@ -104,7 +97,7 @@ 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"); + mpxp_v<<"Audio chapter change detected"<<std::endl; sh_audio->chapter_change=1; sh_audio->a_pts = HUGE; } @@ -154,7 +147,7 @@ audio_buff_min = std::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 ); + mpxp_dbg2<<"alert "<<audio_buff_alert<<", min "<<audio_buff_min<<", norm "<<audio_buff_norm<<", max"<<audio_buff_max<<std::endl; samples = 5; collect_samples = 1; @@ -187,7 +180,7 @@ 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 ); + mpxp_dbg2<<"To fast, set min_audio_time "<<min_audio_time<<" (delay "<<dec_ahead_audio_delay<<")"<<std::endl; } collect_samples = 1; samples = 5; @@ -196,7 +189,7 @@ } 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 ); + mpxp_dbg2<<"To slow, set min_audio_time "<<min_audio_time<<" (delay "<<dec_ahead_audio_delay<<")"<<std::endl; } collect_samples = 1; samples = 10; @@ -213,14 +206,14 @@ 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 ); + mpxp_dbg2<<"Decrease min_audio_time "<<min_audio_time<<" (min "<<min_audio<<" max "<<max_audio<<")"<<std::endl; } 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 ); + mpxp_dbg2<<"Increase min_audio_time "<<min_audio_time<<" (min "<<min_audio<<" max "<<max_audio<<")"<<std::endl; } 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 ); + mpxp_dbg2<<"Stop collecting samples time "<<min_audio_time<<" (min "<<min_audio<<" max "<<max_audio<<")"<<std::endl; } if(collect_samples) { samples = 5; @@ -275,7 +268,7 @@ 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"); + mpxp_v<<"Audio seek timeout"<<std::endl; } #endif dec_ahead_can_aseek = 0; /* Not safe to seek */ @@ -290,7 +283,7 @@ void sig_audio_play( void ) { - MSG_T("sig_audio_play\n"); + mpxp_dbg2<<"sig_audio_play"<<std::endl; mpxp_print_flush(); dec_ahead_can_aseek=1; Modified: mplayerxp/xmpcore/xmp_core.cpp =================================================================== --- mplayerxp/xmpcore/xmp_core.cpp 2012-12-21 11:07:21 UTC (rev 591) +++ mplayerxp/xmpcore/xmp_core.cpp 2012-12-21 14:05:31 UTC (rev 592) @@ -26,7 +26,6 @@ #include "libmpcodecs/dec_audio.h" #include "sig_hand.h" -#define DA_PREFIX "DEC_AHEAD:" #include "player_msg.h" #include "osdep/timer.h" #include "mplayerxp.h" @@ -46,17 +45,10 @@ struct timespec audio_play_timeout; int audio_play_in_sleep=0; +static const int MIN_BUFFER_RESERV=8; /* Min audio buffer to keep mp_free, used to tell differ between full and empty buffer */ -#define MIN_BUFFER_RESERV 8 namespace mpxp { - -#ifdef ENABLE_DEC_AHEAD_DEBUG -#define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) -#else -#define MSG_T(args...) -#endif - void xmp_init(void) { mpxp_context().engine().xp_core=new(zeromem) xp_core_t; mpxp_context().engine().xp_core->initial_apts=HUGE; @@ -83,7 +75,7 @@ } static void print_stopped_thread(unsigned idx) { - MSG_OK("*** stop thread: [%i] %s\n",idx,mpxp_context().engine().xp_core->mpxp_threads[idx]->name); + mpxp_ok<<"*** stop thread: ["<<idx<<"] "<<mpxp_context().engine().xp_core->mpxp_threads[idx]->name<<std::endl; } void xmp_killall_threads(pthread_t _self) @@ -291,7 +283,7 @@ pthread_attr_init(&attr); rc=pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); if(rc) { - MSG_ERR("running thread: attr_setdetachstate fault!!!\n"); + mpxp_err<<"running thread: attr_setdetachstate fault!!!"<<std::endl; pthread_attr_destroy(&attr); return rc; } Modified: mplayerxp/xmpcore/xmp_core.h =================================================================== --- mplayerxp/xmpcore/xmp_core.h 2012-12-21 11:07:21 UTC (rev 591) +++ mplayerxp/xmpcore/xmp_core.h 2012-12-21 14:05:31 UTC (rev 592) @@ -174,22 +174,11 @@ extern pthread_mutex_t audio_decode_mutex; extern pthread_cond_t audio_decode_cond; -#ifdef ENABLE_DEC_AHEAD_DEBUG -#include "mpxp_msg.h" -#ifndef DA_PREFIX -#define DA_PREFIX "dec_ahead:" -#endif -#define MSG_D(args...) { mp_msg(MSGT_GLOBAL, MSGL_V, __FILE__, __LINE__, ## args ); mp_msg_flush(); } -#else -#define MSG_D(args...) -#endif +inline void LOCK_AUDIO_PLAY() { pthread_mutex_lock(&audio_play_mutex); } +inline void UNLOCK_AUDIO_PLAY() { pthread_mutex_unlock(&audio_play_mutex); } +inline void LOCK_AUDIO_DECODE() { pthread_mutex_lock(&audio_decode_mutex); } +inline void UNLOCK_AUDIO_DECODE() { pthread_mutex_unlock(&audio_decode_mutex); } -#define LOCK_AUDIO_PLAY() { MSG_D(DA_PREFIX"LOCK_AUDIO_PLAY\n"); pthread_mutex_lock(&audio_play_mutex); } -#define UNLOCK_AUDIO_PLAY() { MSG_D(DA_PREFIX"UNLOCK_AUDIO_PLAY\n"); pthread_mutex_unlock(&audio_play_mutex); } - -#define LOCK_AUDIO_DECODE() { MSG_D(DA_PREFIX"LOCK_AUDIO_DECODE\n"); pthread_mutex_lock(&audio_decode_mutex); } -#define UNLOCK_AUDIO_DECODE() { MSG_D(DA_PREFIX"UNLOCK_AUDIO_DECODE\n"); pthread_mutex_unlock(&audio_decode_mutex); } - #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); } Modified: mplayerxp/xmpcore/xmp_image.cpp =================================================================== --- mplayerxp/xmpcore/xmp_image.cpp 2012-12-21 11:07:21 UTC (rev 591) +++ mplayerxp/xmpcore/xmp_image.cpp 2012-12-21 14:05:31 UTC (rev 592) @@ -136,7 +136,7 @@ mpi->chroma_y_shift=1; return; } - MSG_WARN("mp_image: Unknown out_fmt: 0x%X\n",out_fmt); + mpxp_warn<<"mp_image: Unknown out_fmt: 0x"<<std::hex<<out_fmt<<std::endl; show_backtrace("outfmt",10); mpi->bpp=0; } Modified: mplayerxp/xmpcore/xmp_vdecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-12-21 11:07:21 UTC (rev 591) +++ mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-12-21 14:05:31 UTC (rev 592) @@ -15,13 +15,6 @@ #include "xmp_vdecoder.h" namespace mpxp { - -#ifdef ENABLE_DEC_AHEAD_DEBUG -#define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) -#else -#define MSG_T(args...) -#endif - /* 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) { @@ -29,12 +22,11 @@ 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" - ,mpxp_context().engine().xp_core->num_v_buffs,(unsigned)(max_frame_delay*3*sh_video->fps)+3); + mpxp_warn<<"*********************************************"<<std::endl; + mpxp_warn<<"** Can't stabilize A-V sync!!! **"<<std::endl; + mpxp_warn<<"*********************************************"<<std::endl; + mpxp_warn<<"Try increase number of buffer for decoding ahead"<<std::endl; + mpxp_warn<<"Exist: "<<mpxp_context().engine().xp_core->num_v_buffs<<", need: "<<((unsigned)(max_frame_delay*3*sh_video->fps)+3)<<std::endl; prev_warn_delay=max_frame_delay; } } @@ -79,7 +71,12 @@ rc = (dae_curr_vdecoded(mpxp_context().engine().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); + mpxp_dbg2<<"DEC_AHEAD: max_frame_delay*3="<<(max_frame_delay*3) + <<" drop_barrier="<<drop_barrier + <<" prev_delta="<<prev_delta + <<" delta="<<delta + <<"(v_pts="<<v_pts<<" screen_pts="<<screen_pts + <<") n_fr_to_drop="<<rc<<std::endl; prev_delta=delta; return rc; } @@ -132,7 +129,7 @@ priv->state=Pth_Run; priv->dae->eof = 0; if(mpxp_context().engine().xp_core->audio) mpxp_context().engine().xp_core->audio->eof=0; - MSG_T("\nDEC_AHEAD: entering...\n"); + mpxp_dbg2<<std::endl<<"DEC_AHEAD: entering..."<<std::endl; __MP_UNIT(priv->p_idx,"dec_ahead"); priv->pid = getpid(); if(!xmp_test_model(XMP_Run_VA_Decoder) && mpxp_context().engine().xp_core->audio) @@ -180,7 +177,7 @@ if(mpeg_timer==HUGE) mpeg_timer=frame->pts; else if( mpeg_timer-duration<frame->pts ) { mpeg_timer=frame->pts; - MSG_DBG2("Sync mpeg pts %f\n", mpeg_timer); + mpxp_dbg2<<"Sync mpeg pts "<<mpeg_timer<<std::endl; } else mpeg_timer+=frame->duration; } @@ -192,7 +189,7 @@ /* Ugly solution: disable frame dropping right after seeking! */ if(cur_time - mpxp_context().seek_time > (mpxp_context().engine().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(!finite(frame->pts)) mpxp_warn<<"Bug of demuxer! Value of video pts="<<frame->pts<<std::endl; if(frame->type!=VideoFrame) escape_player("VideoDecoder doesn't parse non video frames",mp_conf.max_trace); #if 0 /* @@ -220,7 +217,7 @@ } frame->flags=drop_param; blit_frame=mpcv_decode(mpxp_context().video().decoder,frame); -MSG_DBG2("DECODER: %i[%i] %f\n",dae_curr_vdecoded(mpxp_context().engine().xp_core),frame->len,frame->pts); + mpxp_dbg2<<"DECODER: "<<dae_curr_vdecoded(mpxp_context().engine().xp_core)<<"["<<frame->len<<"] "<<frame->pts<<std::endl; if(mpxp_context().output_quality) { if(drop_param) mpcv_set_quality(mpxp_context().video().decoder,mpxp_context().output_quality); } @@ -244,8 +241,6 @@ /* sleep if thread is too fast ;) */ if(blit_frame) while(!dae_inc_decoded(mpxp_context().engine().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(mpxp_context().engine().xp_core->audio && xmp_test_model(XMP_Run_VA_Decoder)) { @@ -267,14 +262,14 @@ } } pt_exit: - MSG_T("\nDEC_AHEAD: leaving...\n"); + mpxp_dbg2<<std::endl<<"DEC_AHEAD: leaving..."<<std::endl; priv->state=Pth_Stand; return arg; /* terminate thread here !!! */ } void sig_video_decode( void ) { - MSG_T("sig_video_decode\n"); + mpxp_dbg2<<"sig_video_decode"<<std::endl; mpxp_print_flush(); mpxp_context().engine().xp_core->video->eof = 1; Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-21 11:07:21 UTC (rev 591) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-21 14:05:31 UTC (rev 592) @@ -23,49 +23,40 @@ float max_pts_correction=0; namespace mpxp { -#ifdef ENABLE_DEC_AHEAD_DEBUG -#define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) -#else -#define MSG_T(args...) -#endif - static void __show_status_line(float a_pts,float v_pts,float delay,float AV_delay) { - 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 - ,mpxp_context().engine().xp_core->video->num_played_frames,mpxp_context().engine().xp_core->video->num_decoded_frames - ,(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(mpxp_context().engine().xp_core) - ); - fflush(stdout); + mpxp_status <<"A:"<<(a_pts-delay) + <<" V:"<<v_pts + <<" A-V:"<<AV_delay + <<" "<<mpxp_context().engine().xp_core->video->num_played_frames + <<"/"<<mpxp_context().engine().xp_core->video->num_decoded_frames + <<" "<<((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<<"%" + <<" [frms: ["<<dae_curr_vplayed(mpxp_context().engine().xp_core)<<"]]\r"; + mpxp_status.flush(); } static void show_status_line_no_apts(sh_audio_t* sh_audio,float v_pts) { if(mp_conf.av_sync_pts && sh_audio && (!mpxp_context().engine().xp_core->audio->eof || mpxp_context().audio().output->get_delay())) { float a_pts = sh_audio->timer-mpxp_context().audio().output->get_delay(); - 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 - ,v_pts - ,a_pts-v_pts - ,0.0 - ,mpxp_context().engine().xp_core->video->num_played_frames,mpxp_context().engine().xp_core->video->num_decoded_frames - ,(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 - ); + mpxp_status<<"A:"<<a_pts + <<" V:"<<v_pts + <<" A-V:"<<(a_pts-v_pts) + <<" ct: "<<mpxp_context().engine().xp_core->video->num_played_frames + <<"/"<<mpxp_context().engine().xp_core->video->num_decoded_frames + <<" "<<((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<<"\r"; } else - MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d\r" - ,v_pts - ,mpxp_context().engine().xp_core->video->num_played_frames - ,(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); + mpxp_status<<"V:"<<v_pts + <<" "<<mpxp_context().engine().xp_core->video->num_played_frames + <<" "<<((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<<"\r"; + mpxp_status.flush(); } static void vplayer_check_chapter_change(sh_audio_t* sh_audio,sh_video_t* sh_video,xmp_frame_t* shva_prev,float v_pts) @@ -75,17 +66,17 @@ while(v_pts < 1.0 && sh_audio->timer==0.0 && mpxp_context().audio().output->get_delay()==0.0) yield_timeslice(); /* Wait for audio to start play */ if(sh_audio->timer > 2.0 && v_pts < 1.0) { - MSG_V("Video chapter change detected\n"); + mpxp_v<<"Video chapter change detected"<<std::endl; sh_video->chapter_change=1; } else { sh_video->chapter_change=0; } } else if(v_pts < 1.0 && shva_prev->v_pts > 2.0) { - MSG_V("Video chapter change detected\n"); + mpxp_v<<"Video chapter change detected"<<std::endl; sh_video->chapter_change=1; } if(sh_video->chapter_change && sh_audio->chapter_change) { - MSG_V("Reset chapter change\n"); + mpxp_v<<"Reset chapter change"<<std::endl; sh_video->chapter_change=0; sh_audio->chapter_change=0; } @@ -114,11 +105,11 @@ return sleep_time; } +static const float XP_MIN_TIMESLICE=0.010f; /* under Linux on x86 min time_slice = 10 ms */ +static const float XP_MIN_AUDIOBUFF=0.05f; +static const float XP_MAX_TIMESLICE=0.1f; static int vplayer_do_sleep(sh_audio_t* sh_audio,int rtc_fd,float sleep_time) { -#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(!mpxp_context().engine().xp_core->audio) sh_audio=NULL; if(sh_audio && (!mpxp_context().engine().xp_core->audio->eof || mpxp_context().audio().output->get_delay()) && sleep_time>XP_MAX_TIMESLICE) { float t; @@ -169,20 +160,9 @@ if(mpxp_context().engine().xp_core->video->eof) can_blit=1; /* force blitting until end of stream will be reached */ vplayer_check_chapter_change(sh_audio,sh_video,&shva_prev,v_pts); -#if 0 -MSG_INFO("mpxp_context().engine().xp_core->initial_apts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" -,mpxp_context().engine().xp_core->initial_apts -,mpxp_context().engine().xp_core->audio->eof -,sh_audio && !mpxp_context().engine().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 && !mpxp_context().engine().xp_core->audio->eof?sh_audio->timer-ao_get_delay(mpxp_context().audio().output):0 -,shva.v_pts -,shva.stream_pts -,shva.duration); -#endif /*--------- add OSD to the next frame contents ---------*/ if(can_blit) { #ifdef USE_OSD - MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); MP_UNIT("draw_osd"); update_osd(shva.v_pts); mpxp_context().video().output->draw_osd(dae_next_played(mpxp_context().engine().xp_core->video)); @@ -198,7 +178,7 @@ else for(unsigned j=0;MSGTR_SystemTooSlow[j];j++) mpxp_warn<<MSGTR_SystemTooSlow[j]<<std::endl; } - MSG_D("\ndec_ahead_main: stalling: %i %i\n",dae_cuurr_vplayed(),dae_curr_decoded()); + mpxp_dbg2<<std::endl<<"dec_ahead_main: stalling: "<<dae_curr_vplayed(mpxp_context().engine().xp_core)<<" "<<dae_curr_vdecoded(mpxp_context().engine().xp_core)<<std::endl; /* Don't burn CPU here! With using of v_pts for A-V sync we will enter xp_decore_video without any delay (like while(1);) Sleeping for 10 ms doesn't matter with frame dropping */ @@ -220,7 +200,7 @@ player_idx=dae_next_played(mpxp_context().engine().xp_core->video); mpxp_context().video().output->select_frame(player_idx); dae_inc_played(mpxp_context().engine().xp_core->video); - MSG_D("\ndec_ahead_main: schedule %u on screen\n",player_idx); + mpxp_dbg2<<std::endl<<"dec_ahead_main: schedule "<<player_idx<<" on screen"<<std::endl; t2=GetTimer()-t2; tt = t2*0.000001f; mpxp_context().bench->vout+=tt; @@ -249,7 +229,7 @@ if(!delay_corrected) if(a_pts) delay_corrected=1; a_pts+=(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - MSG_DBG2("### A:%8.3f (%8.3f) V:%8.3f A-V:%7.4f \n",a_pts,a_pts-delay,v_pts,(a_pts-delay)-v_pts); + mpxp_dbg2<<"### A:"<<a_pts<<" ("<<(a_pts-delay)<<") V:"<<v_pts<<" A-V:"<<((a_pts-delay)-v_pts)<<std::endl; if(delay_corrected && can_blit){ float AV_delay=0; /* average of A-V timestamp differences */ @@ -284,7 +264,7 @@ priv->state=Pth_Run; priv->dae->eof = 0; if(mpxp_context().engine().xp_core->audio) mpxp_context().engine().xp_core->audio->eof=0; - MSG_T("\nDEC_AHEAD: entering...\n"); + mpxp_dbg2<<std::endl<<"DEC_AHEAD: entering..."<<std::endl; __MP_UNIT(priv->p_idx,"dec_ahead"); priv->pid = getpid(); @@ -300,14 +280,14 @@ priv->dae->eof=mpxp_play_video(demuxer,sh_audio,sh_video); /*------------------------ frame decoded. --------------------*/ } /* while(!priv->dae->eof)*/ - MSG_T("\nDEC_AHEAD: leaving...\n"); + mpxp_dbg2<<"DEC_AHEAD: leaving..."<<std::endl; priv->state=Pth_Stand; return arg; /* terminate thread here !!! */ } void sig_video_play( void ) { - MSG_T("sig_audio_play\n"); + mpxp_dbg2<<"sig_audio_play"<<std::endl; mpxp_print_flush(); dec_ahead_can_aseek=1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |