diff options
author | Rodeo <[email protected]> | 2015-06-27 22:12:12 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2015-06-27 22:12:12 +0000 |
commit | bd62cb066f87fa45a9d9c6c88a43d85c8cfe5f7b (patch) | |
tree | 9907d20e050e66b38576fc81589eeef786e4945d /libhb/qsv_common.c | |
parent | 1572b921587434e2363cc94502cde97ad6279536 (diff) |
QSV: load required plug-ins before encoding, too.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7327 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/qsv_common.c')
-rw-r--r-- | libhb/qsv_common.c | 88 |
1 files changed, 54 insertions, 34 deletions
diff --git a/libhb/qsv_common.c b/libhb/qsv_common.c index 3b8179886..a34eb67d8 100644 --- a/libhb/qsv_common.c +++ b/libhb/qsv_common.c @@ -249,26 +249,10 @@ static int query_capabilities(mfxSession session, mfxVersion version, hb_qsv_inf /* Reset capabilities before querying */ info->capabilities = 0; - /* Load optional codec plug-ins */ - if (HB_CHECK_MFX_VERSION(version, 1, 8)) + /* Load required MFX plug-ins */ + if ((mfxPluginList = hb_qsv_load_plugins(info, session, version)) == NULL) { - if ((mfxPluginList = hb_list_init()) == NULL) - { - hb_log("query_capabilities: hb_list_init() failed"); - return 0; - } - - if (!qsv_implementation_is_hardware(info->implementation)) - { - if (info->codec_id == MFX_CODEC_HEVC) - { - if (MFXVideoUSER_Load(session, &MFX_PLUGINID_HEVCE_SW, 0) < MFX_ERR_NONE) - { - return 0; // mandatory plugin, this encoder is unavailable - } - hb_list_add(mfxPluginList, &MFX_PLUGINID_HEVCE_SW); - } - } + return 0; // the required plugin(s) couldn't be loaded } /* @@ -578,21 +562,8 @@ static int query_capabilities(mfxSession session, mfxVersion version, hb_qsv_inf } } - /* Unload optional codec plug-ins */ - if (HB_CHECK_MFX_VERSION(version, 1, 8)) - { - mfxPluginUID *pluginUID; - - for (int i = 0; i < hb_list_count(mfxPluginList); i++) - { - if ((pluginUID = hb_list_item(mfxPluginList, i)) != NULL) - { - MFXVideoUSER_UnLoad(session, pluginUID); - } - } - - hb_list_close(&mfxPluginList); - } + /* Unload MFX plug-ins */ + hb_qsv_unload_plugins(&mfxPluginList, session, version); return 0; } @@ -814,6 +785,55 @@ hb_qsv_info_t* hb_qsv_info_get(int encoder) } } +hb_list_t* hb_qsv_load_plugins(hb_qsv_info_t *info, mfxSession session, mfxVersion version) +{ + hb_list_t *mfxPluginList = hb_list_init(); + if (mfxPluginList == NULL) + { + hb_log("hb_qsv_load_plugins: hb_list_init() failed"); + goto fail; + } + + if (HB_CHECK_MFX_VERSION(version, 1, 8)) + { + if (info->codec_id == MFX_CODEC_HEVC) + { + if (HB_CHECK_MFX_VERSION(version, 1, 15)) + { + if (MFXVideoUSER_Load(session, &MFX_PLUGINID_HEVCE_SW, 0) < MFX_ERR_NONE) + { + goto fail; + } + hb_list_add(mfxPluginList, (void*)&MFX_PLUGINID_HEVCE_SW); + } + } + } + + return mfxPluginList; + +fail: + hb_list_close(&mfxPluginList); + return NULL; +} + +void hb_qsv_unload_plugins(hb_list_t **_l, mfxSession session, mfxVersion version) +{ + mfxPluginUID *pluginUID; + hb_list_t *mfxPluginList = *_l; + + if (mfxPluginList != NULL && HB_CHECK_MFX_VERSION(version, 1, 8)) + { + for (int i = 0; i < hb_list_count(mfxPluginList); i++) + { + if ((pluginUID = hb_list_item(mfxPluginList, i)) != NULL) + { + MFXVideoUSER_UnLoad(session, pluginUID); + } + } + } + hb_list_close(_l); +} + const char* hb_qsv_decode_get_codec_name(enum AVCodecID codec_id) { switch (codec_id) |