From ac797923ab0fe26b3ba79d2f4b96f957ddf44bf4 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 6 Feb 2010 21:09:29 +0000 Subject: libhb dll fix by RandomEngy git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3101 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/hb.c | 17 +++++++++++++++++ libhb/hb.h | 2 ++ test/test.c | 5 ----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libhb/hb.c b/libhb/hb.c index ad51962c5..11afcc137 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -49,9 +49,16 @@ struct hb_handle_s hb_lock_t *hb_avcodec_lock; hb_work_object_t * hb_objects = NULL; +hb_process_initialized = 0; static void thread_func( void * ); + +int hello_world(){ + return 55555; +} + + void hb_avcodec_init() { hb_avcodec_lock = hb_lock_init(); @@ -94,6 +101,16 @@ void hb_register( hb_work_object_t * w ) */ hb_handle_t * hb_init( int verbose, int update_check ) { + if (!hb_process_initialized) + { +#ifdef USE_PTHREAD +#if defined( _WIN32 ) || defined( __MINGW32__ ) + pthread_win32_process_attach_np(); +#endif +#endif + hb_process_initialized =1; + } + hb_handle_t * h = calloc( sizeof( hb_handle_t ), 1 ); uint64_t date; diff --git a/libhb/hb.h b/libhb/hb.h index 04d87b2be..2603c1a5f 100644 --- a/libhb/hb.h +++ b/libhb/hb.h @@ -26,6 +26,8 @@ int hb_get_build( hb_handle_t * ); number and points 'version' to a version description. Returns a negative value otherwise. */ int hb_check_update( hb_handle_t * h, char ** version ); + + int hello_world(); /* hb_set_cpu_count() Force libhb to act as if you had X CPU(s). diff --git a/test/test.c b/test/test.c index 6355746d4..ad4ea514a 100644 --- a/test/test.c +++ b/test/test.c @@ -187,11 +187,6 @@ int main( int argc, char ** argv ) return 1; } -#if defined( PTW32_STATIC_LIB ) - pthread_win32_process_attach_np(); - pthread_win32_thread_attach_np(); -#endif - /* Register our error handler */ hb_register_error_handler(&hb_cli_error_handler); -- cgit v1.2.3