Skip to content

Commit

Permalink
QSV: simplify a check.
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/qsv@5682 b64f7644-9d1e-0410-96f1-a4d463321fa5
  • Loading branch information
twalker314 committed Aug 3, 2013
1 parent e2bcc92 commit 93f6c40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 32 deletions.
10 changes: 0 additions & 10 deletions libhb/decavcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1802,13 +1802,3 @@ static void decodeAudio(hb_audio_t *audio, hb_work_private_t *pv, uint8_t *data,
}
}
}

#ifdef USE_QSV
char* get_codec_id(hb_work_private_t *pv){
char *ret = "";
if( pv && pv->video_codec_opened > 0 && pv->context && pv->context->codec )
ret = pv->context->codec->name;

return ret;
}
#endif
35 changes: 13 additions & 22 deletions libhb/enc_qsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ struct hb_work_private_s
mfxExtCodingOption2 qsv_coding_option2_config;
};

extern char* get_codec_id(hb_work_private_t *pv);

// for DTS generation (when MSDK API < 1.6 or VFR)
static void hb_qsv_add_new_dts(hb_list_t *list, int64_t new_dts)
{
Expand Down Expand Up @@ -177,29 +175,22 @@ static int64_t hb_qsv_pop_next_dts(hb_list_t *list)
return next_dts;
}

int qsv_enc_init( av_qsv_context* qsv, hb_work_private_t * pv ){
mfxStatus sts;
int qsv_enc_init(av_qsv_context *qsv, hb_work_private_t *pv)
{
int i = 0;
int is_encode_only = 0;

hb_job_t * job = pv->job;

if(!qsv){
int x = 0;
for(;x < hb_list_count( job->list_work );x++){
hb_work_object_t * w = hb_list_item( job->list_work, x );
if(w->id == WORK_DECAVCODECV || w->id == WORK_DECMPEG2){
char *codec = get_codec_id(w->private_data);
is_encode_only = strstr(codec,"qsv") == 0 ? 1 : 0;
if(is_encode_only)
qsv = av_mallocz( sizeof( av_qsv_context ) );
else
hb_error( "Wrong settings for decode/encode" );
break;
}
mfxStatus sts;
hb_job_t *job = pv->job;

int is_encode_only = !hb_qsv_decode_is_enabled(job);
if (qsv == NULL)
{
if (!is_encode_only)
{
hb_error("qsv_enc_init: decode enabled but no context!");
return 3;
}
qsv = av_mallocz(sizeof(av_qsv_context));
}
if(!qsv && !is_encode_only) return 3;

av_qsv_space* qsv_encode = qsv->enc_space;

Expand Down

0 comments on commit 93f6c40

Please sign in to comment.