diff options
Diffstat (limited to 'libhb/hb.c')
-rw-r--r-- | libhb/hb.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/libhb/hb.c b/libhb/hb.c index 35e341b8a..bf8845609 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -70,7 +70,6 @@ struct hb_handle_s hb_work_object_t * hb_objects = NULL; int hb_instance_counter = 0; -int hb_process_initialized = 0; static void thread_func( void * ); @@ -355,26 +354,6 @@ void hb_register( hb_work_object_t * w ) hb_objects = w; } -/** - * Ensures that the process has been initialized. - */ -static void process_init() -{ - if (!hb_process_initialized) - { -#if defined( SYS_MINGW ) && defined( PTW32_STATIC_LIB ) - pthread_win32_process_attach_np(); -#endif - -#if defined( _WIN32 ) || defined( __MINGW32__ ) - setvbuf( stdout, NULL, _IONBF, 0 ); - setvbuf( stderr, NULL, _IONBF, 0 ); -#endif - hb_process_initialized = 1; - } - -} - void (*hb_log_callback)(const char* message); static void redirect_thread_func(void *); @@ -388,8 +367,6 @@ static void redirect_thread_func(void *); */ void hb_register_logger( void (*log_cb)(const char* message) ) { - process_init(); - hb_log_callback = log_cb; hb_thread_init("ioredirect", redirect_thread_func, NULL, HB_NORMAL_PRIORITY); } @@ -402,8 +379,6 @@ void hb_register_logger( void (*log_cb)(const char* message) ) */ hb_handle_t * hb_init( int verbose, int update_check ) { - process_init(); - hb_handle_t * h = calloc( sizeof( hb_handle_t ), 1 ); uint64_t date; @@ -1694,6 +1669,22 @@ void hb_close( hb_handle_t ** _h ) *_h = NULL; } +int hb_global_init() +{ + int result = 0; + + result = hb_platform_init(); + if (result < 0) + { + hb_error("Platform specific initialization failed!"); + return -1; + } + + hb_common_global_init(); + + return result; +} + /** * Cleans up libhb at a process level. Call before the app closes. Removes preview directory. */ |