X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=libhb%2Fwork.c;h=72d12d75a1e841b1f91b100ef4b48e6637ab8144;hb=28b197219fe781529c60d1f445b8b3a1de0d19b4;hp=5b3f914c2c34ad6eb2d711833a4acca3bf2dd1c4;hpb=c857b7445f49f5b7bb9ac73ac8336288c49562aa;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/libhb/work.c b/libhb/work.c index 5b3f914c..72d12d75 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -22,7 +22,7 @@ static void work_func(); static void do_job( hb_job_t *, int cpu_count ); static void work_loop( void * ); -#define FIFO_SIZE 32 +#define FIFO_CPU_MULT 8 /** * Allocates work object and launches work thread with work_func. @@ -176,10 +176,10 @@ static void do_job( hb_job_t * job, int cpu_count ) } hb_log (" + PixelRatio: %d, width:%d, height: %d",job->pixel_ratio,job->width, job->height); job->fifo_mpeg2 = hb_fifo_init( 2048 ); - job->fifo_raw = hb_fifo_init( FIFO_SIZE ); - job->fifo_sync = hb_fifo_init( FIFO_SIZE ); - job->fifo_render = hb_fifo_init( FIFO_SIZE ); - job->fifo_mpeg4 = hb_fifo_init( FIFO_SIZE ); + job->fifo_raw = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); + job->fifo_sync = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); + job->fifo_render = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); + job->fifo_mpeg4 = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); /* Synchronization */ hb_list_add( job->list_work, ( w = getWork( WORK_SYNC ) ) ); @@ -239,8 +239,8 @@ static void do_job( hb_job_t * job, int cpu_count ) { hb_log( " + subtitle %x, %s", subtitle->id, subtitle->lang ); - subtitle->fifo_in = hb_fifo_init( FIFO_SIZE ); - subtitle->fifo_raw = hb_fifo_init( FIFO_SIZE ); + subtitle->fifo_in = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); + subtitle->fifo_raw = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); /* * Disable forced subtitles if we didn't find any in the scan @@ -326,9 +326,9 @@ static void do_job( hb_job_t * job, int cpu_count ) /* audioCodecsSupportMono and audioCodecsSupport6Ch are the same for now, but this may change in the future, so they are separated for flexibility */ int audioCodecsSupportMono = ((audio->codec == HB_ACODEC_AC3 || - audio->codec == HB_ACODEC_DCA) && job->acodec == HB_ACODEC_FAAC); + audio->codec == HB_ACODEC_DCA) && (job->acodec == HB_ACODEC_FAAC || job->acodec == HB_ACODEC_VORBIS)); int audioCodecsSupport6Ch = ((audio->codec == HB_ACODEC_AC3 || - audio->codec == HB_ACODEC_DCA) && job->acodec == HB_ACODEC_FAAC); + audio->codec == HB_ACODEC_DCA) && (job->acodec == HB_ACODEC_FAAC || job->acodec == HB_ACODEC_VORBIS)); /* find out what the format of our source audio is */ switch (audio->input_channel_layout & HB_INPUT_CH_LAYOUT_DISCRETE_NO_LFE_MASK) { @@ -439,9 +439,9 @@ static void do_job( hb_job_t * job, int cpu_count ) /* set up the audio work structures */ audio->fifo_in = hb_fifo_init( 2048 ); - audio->fifo_raw = hb_fifo_init( FIFO_SIZE ); - audio->fifo_sync = hb_fifo_init( FIFO_SIZE ); - audio->fifo_out = hb_fifo_init( FIFO_SIZE ); + audio->fifo_raw = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); + audio->fifo_sync = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); + audio->fifo_out = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); switch( audio->codec ) { @@ -576,8 +576,6 @@ static void do_job( hb_job_t * job, int cpu_count ) hb_fifo_close( &job->fifo_render ); hb_fifo_close( &job->fifo_mpeg4 ); - hb_buffer_pool_free(); - for (i=0; i < hb_list_count(title->list_subtitle); i++) { subtitle = hb_list_item( title->list_subtitle, i); if( subtitle ) @@ -619,9 +617,12 @@ static void do_job( hb_job_t * job, int cpu_count ) subtitle_lowest_id = subtitle->id; } - if ( subtitle->forced_hits > 0 ) + if( subtitle->forced_hits > 0 ) { - subtitle_forced_id = subtitle->id; + if( subtitle_forced_id == 0 ) + { + subtitle_forced_id = subtitle->id; + } } } @@ -689,6 +690,8 @@ static void do_job( hb_job_t * job, int cpu_count ) } } + hb_buffer_pool_free(); + hb_title_close( &job->title ); free( job ); }