diff options
author | Rodeo <[email protected]> | 2014-04-05 01:10:32 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2014-04-05 01:10:32 +0000 |
commit | 423bb762f6ac74000c76b0cff88cf5987af7609d (patch) | |
tree | 8a3afc2073d8fbedceb210e54fd27f25a94d692b /libhb/enc_qsv.c | |
parent | a7d3e4c994edb814da5b202cdd8b1c5a3b56f48d (diff) |
enc_qsv: simplify qsv_enc_init.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6147 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/enc_qsv.c')
-rw-r--r-- | libhb/enc_qsv.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c index 0fd9fbded..7f85420f7 100644 --- a/libhb/enc_qsv.c +++ b/libhb/enc_qsv.c @@ -161,11 +161,12 @@ static const char* qsv_h264_level_xlat(int level) return NULL; } -int qsv_enc_init(av_qsv_context *qsv, hb_work_private_t *pv) +int qsv_enc_init(hb_work_private_t *pv) { - int i = 0; + av_qsv_context *qsv = pv->job->qsv.ctx; + hb_job_t *job = pv->job; mfxStatus sts; - hb_job_t *job = pv->job; + int i; if (pv->init_done) { @@ -1284,36 +1285,26 @@ int encqsvWork(hb_work_object_t *w, hb_buffer_t **buf_in, hb_buffer_t **buf_out) hb_work_private_t *pv = w->private_data; hb_job_t *job = pv->job; hb_buffer_t *in = *buf_in, *buf; - av_qsv_context *qsv = job->qsv.ctx; - av_qsv_space *qsv_encode; hb_buffer_t *last_buf = NULL; mfxStatus sts = MFX_ERR_NONE; int is_end = 0; av_qsv_list *received_item = NULL; av_qsv_stage *stage = NULL; - while (1) + while (qsv_enc_init(pv) >= 2) { - int ret = qsv_enc_init(qsv, pv); - qsv = job->qsv.ctx; - qsv_encode = qsv->enc_space; - if (ret >= 2) - { - av_qsv_sleep(1); - } - else - { - break; - } + av_qsv_sleep(1); // encoding not initialized, wait and repeat the call } *buf_out = NULL; if (*job->die) { - // unrecoverable error in qsv_enc_init - return HB_WORK_DONE; + return HB_WORK_DONE; // unrecoverable error, don't attempt to encode } + av_qsv_context *qsv = job->qsv.ctx; + av_qsv_space *qsv_encode = job->qsv.ctx->enc_space; + if (in->size <= 0) { // do delayed frames yet |