| 
				
				
					
				
				
				 | 
			
			 | 
			@@ -39,6 +39,7 @@ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include <windows.h> | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include <process.h> | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/attributes.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/common.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/internal.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/mem.h" | 
		
		
	
	
		
			
				| 
				
					
				
				
					
				
				
				 | 
			
			 | 
			@@ -87,15 +88,15 @@ static BOOL (WINAPI *cond_wait)(pthread_cond_t *cond, pthread_mutex_t *mutex, | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#define WaitForSingleObject(a, b) WaitForSingleObjectEx(a, b, FALSE) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#endif | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static unsigned __stdcall attribute_align_arg win32thread_worker(void *arg) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static av_unused unsigned __stdcall attribute_align_arg win32thread_worker(void *arg) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    pthread_t *h = arg; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    h->ret = h->func(h->arg); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    return 0; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			} | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static int pthread_create(pthread_t *thread, const void *unused_attr, | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                          void *(*start_routine)(void*), void *arg) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static av_unused int pthread_create(pthread_t *thread, const void *unused_attr, | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                                    void *(*start_routine)(void*), void *arg) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    thread->func   = start_routine; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    thread->arg    = arg; | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -104,7 +105,7 @@ static int pthread_create(pthread_t *thread, const void *unused_attr, | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    return !thread->handle; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			} | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static void pthread_join(pthread_t thread, void **value_ptr) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static av_unused void pthread_join(pthread_t thread, void **value_ptr) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    DWORD ret = WaitForSingleObject(thread.handle, INFINITE); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (ret != WAIT_OBJECT_0) | 
		
		
	
	
		
			
				| 
				
					
				
				
					
				
				
				 | 
			
			 | 
			@@ -146,7 +147,7 @@ typedef struct  win32_cond_t { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    volatile int is_broadcast; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			} win32_cond_t; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static int pthread_cond_init(pthread_cond_t *cond, const void *unused_attr) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static av_unused int pthread_cond_init(pthread_cond_t *cond, const void *unused_attr) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    win32_cond_t *win32_cond = NULL; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (cond_init) { | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -171,7 +172,7 @@ static int pthread_cond_init(pthread_cond_t *cond, const void *unused_attr) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    return 0; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			} | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static void pthread_cond_destroy(pthread_cond_t *cond) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static av_unused void pthread_cond_destroy(pthread_cond_t *cond) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    win32_cond_t *win32_cond = cond->ptr; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    /* native condition variables do not destroy */ | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -187,7 +188,7 @@ static void pthread_cond_destroy(pthread_cond_t *cond) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    cond->ptr = NULL; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			} | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static void pthread_cond_broadcast(pthread_cond_t *cond) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static av_unused void pthread_cond_broadcast(pthread_cond_t *cond) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    win32_cond_t *win32_cond = cond->ptr; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    int have_waiter; | 
		
		
	
	
		
			
				| 
				
					
				
				
					
				
				
				 | 
			
			 | 
			@@ -218,7 +219,7 @@ static void pthread_cond_broadcast(pthread_cond_t *cond) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    pthread_mutex_unlock(&win32_cond->mtx_broadcast); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			} | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static av_unused int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    win32_cond_t *win32_cond = cond->ptr; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    int last_waiter; | 
		
		
	
	
		
			
				| 
				
					
				
				
					
				
				
				 | 
			
			 | 
			@@ -250,7 +251,7 @@ static int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    return pthread_mutex_lock(mutex); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			} | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static void pthread_cond_signal(pthread_cond_t *cond) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static av_unused void pthread_cond_signal(pthread_cond_t *cond) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    win32_cond_t *win32_cond = cond->ptr; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    int have_waiter; | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -275,7 +276,7 @@ static void pthread_cond_signal(pthread_cond_t *cond) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    pthread_mutex_unlock(&win32_cond->mtx_broadcast); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			} | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static void w32thread_init(void) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			static av_unused void w32thread_init(void) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#if _WIN32_WINNT < 0x0600 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    HANDLE kernel_dll = GetModuleHandle(TEXT("kernel32.dll")); | 
		
		
	
	
		
			
				| 
				
					
				
				
				
				 | 
			
			 | 
			
  |