OSDN Git Service

disable asserts in libdvdnav except when configured with --debug=max
[handbrake-jp/handbrake-jp-git.git] / libhb / hb.c
index 1b899e3..0541b9f 100644 (file)
@@ -49,6 +49,7 @@ struct hb_handle_s
 
 hb_lock_t *hb_avcodec_lock;
 hb_work_object_t * hb_objects = NULL;
+int hb_process_initialized = 0;
 
 static void thread_func( void * );
 
@@ -94,6 +95,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;
 
@@ -158,7 +169,8 @@ hb_handle_t * hb_init( int verbose, int update_check )
     h->die         = 0;
     h->main_thread = hb_thread_init( "libhb", thread_func, h,
                                      HB_NORMAL_PRIORITY );
-    hb_register( &hb_sync );
+    hb_register( &hb_sync_video );
+    hb_register( &hb_sync_audio );
        hb_register( &hb_decmpeg2 );
        hb_register( &hb_decvobsub );
     hb_register( &hb_encvobsub );
@@ -178,6 +190,7 @@ hb_handle_t * hb_init( int verbose, int update_check )
        hb_register( &hb_encfaac );
        hb_register( &hb_enclame );
        hb_register( &hb_encvorbis );
+       hb_register( &hb_muxer );
 #ifdef __APPLE__
        hb_register( &hb_encca_aac );
 #endif
@@ -255,7 +268,8 @@ hb_handle_t * hb_init_dl( int verbose, int update_check )
     h->main_thread = hb_thread_init( "libhb", thread_func, h,
                                      HB_NORMAL_PRIORITY );
 
-    hb_register( &hb_sync );
+    hb_register( &hb_sync_video );
+    hb_register( &hb_sync_audio );
        hb_register( &hb_decmpeg2 );
        hb_register( &hb_decvobsub );
     hb_register( &hb_encvobsub );
@@ -275,6 +289,7 @@ hb_handle_t * hb_init_dl( int verbose, int update_check )
        hb_register( &hb_encfaac );
        hb_register( &hb_enclame );
        hb_register( &hb_encvorbis );
+       hb_register( &hb_muxer );
 #ifdef __APPLE__
        hb_register( &hb_encca_aac );
 #endif
@@ -645,7 +660,7 @@ void hb_set_anamorphic_size( hb_job_t * job,
     int cropped_width = title->width - job->crop[2] - job->crop[3] ;
     int cropped_height = title->height - job->crop[0] - job->crop[1] ;
     double storage_aspect = (double)cropped_width / (double)cropped_height;
-    int mod = job->anamorphic.modulus ? job->anamorphic.modulus : 16;
+    int mod = job->modulus ? job->modulus : 16;
     double aspect = title->aspect;
     
     int pixel_aspect_width  = job->anamorphic.par_width;
@@ -1450,7 +1465,8 @@ void hb_set_state( hb_handle_t * h, hb_state_t * s )
     hb_lock( h->pause_lock );
     hb_lock( h->state_lock );
     memcpy( &h->state, s, sizeof( hb_state_t ) );
-    if( h->state.state == HB_STATE_WORKING )
+    if( h->state.state == HB_STATE_WORKING ||
+        h->state.state == HB_STATE_SEARCHING )
     {
         /* XXX Hack */
         if (h->job_count < 1)