]> git.sesse.net Git - x264/blobdiff - common/frame.c
don't overwrite pthread* namespace, because system headers might define those functio...
[x264] / common / frame.c
index 99529d0ae2a20352556bf3060e897c59bf40f95f..f721e79da3b3a858fd763d398ff6889a9b916e8f 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#include <stdio.h>
-#include <string.h>
-#ifndef _MSC_VER
-#include <unistd.h>
-#endif
-
 #include "common.h"
 
 #define PADH 32
@@ -134,8 +128,8 @@ x264_frame_t *x264_frame_new( x264_t *h )
         for( j = 0; j < h->param.i_bframe + 2; j++ )
             CHECKED_MALLOC( frame->i_row_satds[i][j], i_lines/16 * sizeof(int) );
 
-    pthread_mutex_init( &frame->mutex, NULL );
-    pthread_cond_init( &frame->cv, NULL );
+    x264_pthread_mutex_init( &frame->mutex, NULL );
+    x264_pthread_cond_init( &frame->cv, NULL );
 
     return frame;
 
@@ -161,8 +155,8 @@ void x264_frame_delete( x264_frame_t *frame )
     x264_free( frame->mv[1] );
     x264_free( frame->ref[0] );
     x264_free( frame->ref[1] );
-    pthread_mutex_destroy( &frame->mutex );
-    pthread_cond_destroy( &frame->cv );
+    x264_pthread_mutex_destroy( &frame->mutex );
+    x264_pthread_cond_destroy( &frame->cv );
     x264_free( frame );
 }
 
@@ -815,18 +809,18 @@ void x264_deblock_init( int cpu, x264_deblock_function_t *pf )
 #ifdef HAVE_PTHREAD
 void x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed )
 {
-    pthread_mutex_lock( &frame->mutex );
+    x264_pthread_mutex_lock( &frame->mutex );
     frame->i_lines_completed = i_lines_completed;
-    pthread_cond_broadcast( &frame->cv );
-    pthread_mutex_unlock( &frame->mutex );
+    x264_pthread_cond_broadcast( &frame->cv );
+    x264_pthread_mutex_unlock( &frame->mutex );
 }
 
 void x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed )
 {
-    pthread_mutex_lock( &frame->mutex );
+    x264_pthread_mutex_lock( &frame->mutex );
     while( frame->i_lines_completed < i_lines_completed )
-        pthread_cond_wait( &frame->cv, &frame->mutex );
-    pthread_mutex_unlock( &frame->mutex );
+        x264_pthread_cond_wait( &frame->cv, &frame->mutex );
+    x264_pthread_mutex_unlock( &frame->mutex );
 }
 
 #else