diff options
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.c | 18 | ||||
-rw-r--r-- | libhb/common.h | 4 |
2 files changed, 17 insertions, 5 deletions
diff --git a/libhb/common.c b/libhb/common.c index 45d207cb2..7a9679f3a 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -36,6 +36,8 @@ int hb_audio_bitrates_count = sizeof( hb_audio_bitrates ) / sizeof( hb_rate_t ); int hb_audio_bitrates_default = 8; /* 128 kbps */ +static hb_error_handler_t *error_handler = NULL; + hb_mixdown_t hb_audio_mixdowns[] = { { "Mono", "HB_AMIXDOWN_MONO", "mono", HB_AMIXDOWN_MONO }, { "Stereo", "HB_AMIXDOWN_STEREO", "stereo", HB_AMIXDOWN_STEREO }, @@ -530,12 +532,8 @@ void hb_log( char * log, ... ) void hb_error( char * log, ... ) { char string[181]; /* 180 chars + \0 */ - time_t _now; - struct tm * now; va_list args; - extern void hb_error_handler(const char *errmsg); - /* Convert the message to a string */ va_start( args, log ); vsnprintf( string, 180, log, args ); @@ -544,7 +542,17 @@ void hb_error( char * log, ... ) /* * Got the error in a single string, send it off to be dispatched. */ - hb_error_handler(string); + if( error_handler ) + { + error_handler( string ); + } else { + hb_log( string ); + } +} + +void hb_register_error_handler( hb_error_handler_t * handler ) +{ + error_handler = handler; } /********************************************************************** diff --git a/libhb/common.h b/libhb/common.h index 416a93eb6..0fc36473d 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -550,4 +550,8 @@ extern hb_filter_object_t hb_filter_deinterlace; extern hb_filter_object_t hb_filter_deblock; extern hb_filter_object_t hb_filter_denoise; +typedef void hb_error_handler_t( const char *errmsg ); + +extern void hb_register_error_handler( hb_error_handler_t * handler ); + #endif |