* libhb initialization routine. * @param verbose HB_DEBUG_NONE or HB_DEBUG_ALL. * @return Handle to hb_handle_t for use on all subsequent calls to libhb. */
| 204 | * @return Handle to hb_handle_t for use on all subsequent calls to libhb. |
| 205 | */ |
| 206 | hb_handle_t * hb_init( int verbose ) |
| 207 | { |
| 208 | hb_handle_t * h = calloc( sizeof( hb_handle_t ), 1 ); |
| 209 | |
| 210 | /* See hb_deep_log() and hb_log() in common.c */ |
| 211 | hb_log_level_set(h, verbose); |
| 212 | |
| 213 | h->id = hb_instance_counter++; |
| 214 | |
| 215 | /* Initialize opaque for PowerManagement purposes */ |
| 216 | h->system_sleep_opaque = hb_system_sleep_opaque_init(); |
| 217 | |
| 218 | h->title_set.list_title = hb_list_init(); |
| 219 | h->jobs = hb_list_init(); |
| 220 | |
| 221 | h->state_lock = hb_lock_init(); |
| 222 | h->state.state = HB_STATE_IDLE; |
| 223 | |
| 224 | h->pause_lock = hb_lock_init(); |
| 225 | h->pause_date = -1; |
| 226 | |
| 227 | h->interjob = calloc( sizeof( hb_interjob_t ), 1 ); |
| 228 | |
| 229 | /* Start library thread */ |
| 230 | hb_log( "hb_init: starting libhb thread" ); |
| 231 | h->die = 0; |
| 232 | h->main_thread = hb_thread_init( "libhb", thread_func, h, |
| 233 | HB_NORMAL_PRIORITY ); |
| 234 | |
| 235 | return h; |
| 236 | } |
| 237 | |
| 238 | // Make sure these strings at least exist in the executable even though |
| 239 | // they may not all be visible in the frontend. |