summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libhb/common.h3
-rw-r--r--libhb/hb.c2
-rw-r--r--libhb/internal.h4
-rw-r--r--libhb/work.c9
-rw-r--r--macosx/Controller.m3
5 files changed, 9 insertions, 12 deletions
diff --git a/libhb/common.h b/libhb/common.h
index bfd4b9b00..c73ac871f 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -1067,4 +1067,7 @@ const char * const * hb_h264_levels();
// x264 option name/synonym helper
const char * hb_x264_encopt_name( const char * name );
+void hb_prevent_sleep( hb_handle_t * );
+void hb_allow_sleep( hb_handle_t * );
+
#endif
diff --git a/libhb/hb.c b/libhb/hb.c
index bd7999d7e..5c0c66b2b 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -1551,7 +1551,7 @@ void hb_start( hb_handle_t * h )
h->paused = 0;
h->work_die = 0;
- h->work_thread = hb_work_init( h, h->jobs, &h->work_die, &h->work_error, &h->current_job );
+ h->work_thread = hb_work_init( h->jobs, &h->work_die, &h->work_error, &h->current_job );
}
/**
diff --git a/libhb/internal.h b/libhb/internal.h
index 2e890a752..4a2f775a9 100644
--- a/libhb/internal.h
+++ b/libhb/internal.h
@@ -39,8 +39,6 @@ void hb_title_close( hb_title_t ** );
**********************************************************************/
int hb_get_pid( hb_handle_t * );
void hb_set_state( hb_handle_t *, hb_state_t * );
-void hb_prevent_sleep( hb_handle_t * );
-void hb_allow_sleep( hb_handle_t * );
/***********************************************************************
* fifo.c
@@ -231,7 +229,7 @@ hb_thread_t * hb_scan_init( hb_handle_t *, volatile int * die,
const char * path, int title_index,
hb_title_set_t * title_set, int preview_count,
int store_previews, uint64_t min_duration );
-hb_thread_t * hb_work_init( hb_handle_t * handle, hb_list_t * jobs,
+hb_thread_t * hb_work_init( hb_list_t * jobs,
volatile int * die, int * error, hb_job_t ** job );
void ReadLoop( void * _w );
hb_work_object_t * hb_muxer_init( hb_job_t * );
diff --git a/libhb/work.c b/libhb/work.c
index 3ca4c7675..6dd111401 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -41,11 +41,10 @@ static void filter_loop( void * );
* @param die Handle to user inititated exit indicator.
* @param error Handle to error indicator.
*/
-hb_thread_t * hb_work_init( hb_handle_t * handle, hb_list_t * jobs, volatile int * die, int * error, hb_job_t ** job )
+hb_thread_t * hb_work_init( hb_list_t * jobs, volatile int * die, int * error, hb_job_t ** job )
{
hb_work_t * work = calloc( sizeof( hb_work_t ), 1 );
- work->handle = handle;
work->jobs = jobs;
work->current_job = job;
work->die = die;
@@ -83,22 +82,16 @@ static void work_func( void * _work )
hb_log( "%d job(s) to process", hb_list_count( work->jobs ) );
- hb_prevent_sleep( work->handle );
-
while( !*work->die && ( job = hb_list_item( work->jobs, 0 ) ) )
{
hb_list_rem( work->jobs, job );
job->die = work->die;
*(work->current_job) = job;
-
InitWorkState( job->h );
do_job( job );
-
*(work->current_job) = NULL;
}
- hb_allow_sleep( work->handle );
-
*(work->error) = HB_ERROR_NONE;
free( work );
diff --git a/macosx/Controller.m b/macosx/Controller.m
index 79ef5da5e..76a30aa51 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -2815,6 +2815,7 @@ fWorkingCount = 0;
else
{
[self writeToActivityLog: "incrementQueueItemDone there are no more pending encodes"];
+ hb_allow_sleep( fQueueEncodeLibhb );
/*Since there are no more items to encode, go to queueCompletedAlerts for user specified alerts after queue completed*/
[self queueCompletedAlerts];
}
@@ -2863,6 +2864,8 @@ fWorkingCount = 0;
/* This assumes that we have re-scanned and loaded up a new queue item to send to libhb as fQueueEncodeLibhb */
- (void) processNewQueueEncode
{
+ hb_prevent_sleep( fQueueEncodeLibhb );
+
hb_list_t * list = hb_get_titles( fQueueEncodeLibhb );
hb_title_t * title = (hb_title_t *) hb_list_item( list,0 ); // is always zero since now its a single title scan
hb_job_t * job = title->job;