Commit 49f3721c authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: don't use mach_absolute_time() (introduced in...

macosx: don't use mach_absolute_time() (introduced in 5ead92ff) on PowerPC-based Macs as this breaks the playback of a certain set of AVI and WMV files
parent 3aafd4a8
......@@ -359,7 +359,7 @@ static inline void __vlc_cond_wait( const char * psz_file, int i_line,
#define vlc_cond_timedwait( P_COND, P_MUTEX, DEADLINE ) \
__vlc_cond_timedwait( __FILE__, __LINE__, P_COND, P_MUTEX, DEADLINE )
#ifdef __APPLE__
#if defined(__APPLE__) && !defined(__powerpc__)
# include <sys/time.h> /* gettimeofday in vlc_cond_timedwait */
#endif
......@@ -369,7 +369,7 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
mtime_t deadline )
{
#if defined(LIBVLC_USE_PTHREAD)
#ifdef __APPLE__
#if defined(__APPLE__) && !defined(__powerpc__)
/* mdate() is mac_absolute_time on osx, which we must convert to do
* the same base than gettimeofday() on which pthread_cond_timedwait
* counts on. */
......
......@@ -60,7 +60,7 @@
# include <sys/time.h>
#endif
#ifdef __APPLE__
#if defined(__APPLE__) && !defined(__powerpc__)
# include <mach/mach.h>
# include <mach/mach_time.h>
#endif
......@@ -177,7 +177,7 @@ static inline unsigned mprec( void )
#endif
}
#ifdef __APPLE__
#if defined(__APPLE__) && !defined(__powerpc__)
static mach_timebase_info_data_t mtime_timebase_info;
static pthread_once_t mtime_timebase_info_once = PTHREAD_ONCE_INIT;
static void mtime_init_timebase(void)
......@@ -211,7 +211,7 @@ mtime_t mdate( void )
#elif defined( HAVE_KERNEL_OS_H )
res = real_time_clock_usecs();
#elif defined( __APPLE__ )
#elif defined(__APPLE__) && !defined(__powerpc__)
pthread_once(&mtime_timebase_info_once, mtime_init_timebase);
uint64_t date = mach_absolute_time();
......@@ -364,7 +364,7 @@ void mwait( mtime_t date )
ts.tv_sec = d.quot; ts.tv_nsec = d.rem * 1000;
while( clock_nanosleep( CLOCK_REALTIME, 0, &ts, NULL ) == EINTR );
}
#elif defined( __APPLE__ ) /* The version that should be used, if it was cancelable */
#elif defined(__APPLE__) && !defined(__powerpc__) /* The version that should be used, if it was cancelable */
pthread_once(&mtime_timebase_info_once, mtime_init_timebase);
uint64_t mach_time = date * 1000 * mtime_timebase_info.denom / mtime_timebase_info.numer;
mach_wait_until(mach_time);
......@@ -414,7 +414,7 @@ void msleep( mtime_t delay )
while( nanosleep( &ts_delay, &ts_delay ) && ( errno == EINTR ) );
#elif defined( __APPLE__ ) /* The version that should be used, if it was cancelable */
#elif defined( __APPLE__) && !defined(__powerpc__) /* The version that should be used, if it was cancelable */
pthread_once(&mtime_timebase_info_once, mtime_init_timebase);
uint64_t mach_time = delay * 1000 * mtime_timebase_info.denom / mtime_timebase_info.numer;
mach_wait_until(mach_time + mach_absolute_time());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment