From: Tim C. <tc...@au...> - 2003-05-26 19:40:03
|
Would everyone please take a look at this patch to see if it is more acceptable than placing #ifdef _MSC_VER throughout the code? I did not build this on Linux (yet) since I do not develop on my crappy Linux machine. NOTE: Not a single #ifdef _MSC_VER in the code! Thanks, -Tim Index: src/xine-engine/audio_out.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/xine-engine/audio_out.c,v retrieving revision 1.128 diff -u -r1.128 audio_out.c --- src/xine-engine/audio_out.c 25 May 2003 21:34:59 -0000 1.128 +++ src/xine-engine/audio_out.c 26 May 2003 19:36:13 -0000 @@ -416,13 +416,9 @@ num_frames = pts_len * this->frames_per_kpts / 1024; if (this->xine->verbosity >= XINE_VERBOSITY_LOG) -#ifndef _MSC_VER - printf ("audio_out: inserting %d 0-frames to fill a gap of %lld pts\n", + + printf ("audio_out: inserting %d 0-frames to fill a gap of %" PRId64 " pts\n", num_frames, pts_len); -#else - printf ("audio_out: inserting %d 0-frames to fill a gap of %I64d pts\n", - num_frames, pts_len); -#endif /* _MSC_VER */ if ((this->output.mode == AO_CAP_MODE_A52) || (this->output.mode == AO_CAP_MODE_AC5)) { write_pause_burst(this,num_frames); @@ -760,6 +756,8 @@ resample_sync_t *info = &this->resample_sync_info; int64_t avg_gap = 0; double factor; + double diff; + double duration; int i; if (abs(gap) > AO_MAX_GAP) { @@ -790,12 +788,9 @@ if (abs(avg_gap) > RESAMPLE_REDUCE_GAP_THRESHOLD && !info->reduce_gap) { info->reduce_gap = 1; this->resample_sync_factor = (avg_gap < 0) ? 0.995 : 1.005; + #ifdef LOG_RESAMPLE_SYNC -#ifndef _MSC_VER - printf("audio_out: sample rate adjusted to reduce gap: gap=%lld\n", avg_gap); -#else - printf("audio_out: sample rate adjusted to reduce gap: gap=%I64d\n", avg_gap); -#endif /* _MSC_VER */ + printf("audio_out: sample rate adjusted to reduce gap: gap=%" PRId64 "\n", avg_gap); #endif return 0; @@ -837,11 +832,10 @@ this->resample_sync_factor); #endif /* we want to add factor * num_frames to each buffer */ -#ifdef _MSC_VER - factor = (int64_t)gap_diff / (int64_t)info->window_duration + info->last_factor; -#else - factor = (double)gap_diff / (double)info->window_duration + info->last_factor; -#endif /* _MSC_VER */ + diff = gap_diff; + duration = (int64_t)info->window_duration + (int64_t)info->last_factor; + factor = diff / duration; + info->last_factor = factor; this->resample_sync_factor = 1.0 + factor; @@ -984,13 +978,8 @@ hw_vpts = cur_time; #ifdef LOG -#ifndef _MSC_VER - printf ("audio_out: current delay is %lld, current time is %lld\n", - delay, cur_time); -#else - printf ("audio_out: current delay is %I64d, current time is %I64d\n", + printf ("audio_out: current delay is %" PRId64 ", current time is %" PRId64 "\n", delay, cur_time); -#endif /* _MSC_VER */ #endif /* External A52 decoder delay correction */ if ((this->output.mode==AO_CAP_MODE_A52) || (this->output.mode==AO_CAP_MODE_AC5)) @@ -1004,13 +993,8 @@ */ gap = in_buf->vpts - hw_vpts; #ifdef LOG -#ifndef _MSC_VER - printf ("audio_out: hw_vpts : %lld buffer_vpts : %lld gap : %lld\n", + printf ("audio_out: hw_vpts : %" PRId64 " buffer_vpts : %" PRId64 " gap : %" PRId64 "\n", hw_vpts, in_buf->vpts, gap); -#else - printf ("audio_out: hw_vpts : %I64d buffer_vpts : %I64d gap : %I64d\n", - hw_vpts, in_buf->vpts, gap); -#endif /* _MSC_VER */ #endif if (this->resample_sync_method) { @@ -1038,13 +1022,8 @@ fifo_append (this->free_fifo, in_buf); #ifdef LOG -#ifndef _MSC_VER - printf ("audio_out: audio package (vpts = %lld, gap = %lld) dropped\n", - in_buf->vpts, gap); -#else - printf ("audio_out: audio package (vpts = %I64d, gap = %I64d) dropped\n", + printf ("audio_out: audio package (vpts = %" PRId64 ", gap = %" PRId64 ") dropped\n", in_buf->vpts, gap); -#endif /* _MSC_VER */ #endif in_buf = NULL; @@ -1381,13 +1360,8 @@ buf->extra_info->vpts = buf->vpts; #ifdef LOG -#ifndef _MSC_VER - printf ("audio_out: ao_put_buffer, pts=%lld, vpts=%lld, flushmode=%d\n", - pts, buf->vpts, this->discard_buffers); -#else - printf ("audio_out: ao_put_buffer, pts=%I64d, vpts=%I64d, flushmode=%d\n", + printf ("audio_out: ao_put_buffer, pts=%" PRId64 ", vpts=%" PRId64 ", flushmode=%d\n", pts, buf->vpts, this->discard_buffers); -#endif /* _MSC_VER */ #endif if (!this->discard_buffers) |