| 112 | } |
| 113 | |
| 114 | STDMETHODIMP CDecodeManager::CreateDecoder(const CMediaType *pmt, AVCodecID codec, const MediaSideDataFFMpeg *pSideData) |
| 115 | { |
| 116 | CAutoLock decoderLock(this); |
| 117 | |
| 118 | DbgLog( |
| 119 | (LOG_TRACE, 10, L"CDecodeThread::CreateDecoder(): Creating new decoder for codec %S", avcodec_get_name(codec))); |
| 120 | HRESULT hr = S_OK; |
| 121 | BOOL bWMV9 = FALSE; |
| 122 | |
| 123 | BOOL bHWDecBlackList = _wcsicmp(m_processName.c_str(), L"dllhost.exe") == 0 || |
| 124 | _wcsicmp(m_processName.c_str(), L"explorer.exe") == 0 || |
| 125 | _wcsicmp(m_processName.c_str(), L"ReClockHelper.dll") == 0; |
| 126 | DbgLog((LOG_TRACE, 10, L"-> Process is %s, blacklist: %d", m_processName.c_str(), bHWDecBlackList)); |
| 127 | |
| 128 | BITMAPINFOHEADER *pBMI = nullptr; |
| 129 | videoFormatTypeHandler(*pmt, &pBMI); |
| 130 | |
| 131 | CreateSideDataCache(pSideData); |
| 132 | |
| 133 | // disable HW for DVD decoding |
| 134 | if (m_pLAVVideo->GetDecodeFlags() & LAV_VIDEO_DEC_FLAG_DVD) |
| 135 | bHWDecBlackList = true; |
| 136 | |
| 137 | // Try reusing the current HW decoder |
| 138 | if (m_pDecoder && m_bHWDecoder && !bHWDecBlackList && !m_bHWDecoderFailed && HWFORMAT_ENABLED && HWRESOLUTION_ENABLED) |
| 139 | { |
| 140 | DbgLog((LOG_TRACE, 10, L"-> Trying to re-use old HW Decoder")); |
| 141 | hr = m_pDecoder->InitDecoder(codec, pmt, &m_SideDataCache); |
| 142 | goto done; |
| 143 | } |
| 144 | SAFE_DELETE(m_pDecoder); |
| 145 | |
| 146 | LAVHWAccel hwAccel = m_pLAVVideo->GetHWAccel(); |
| 147 | if (!bHWDecBlackList && hwAccel != HWAccel_None && !m_bHWDecoderFailed && HWFORMAT_ENABLED && HWRESOLUTION_ENABLED) |
| 148 | { |
| 149 | DbgLog((LOG_TRACE, 10, L"-> Trying Hardware Codec %d", hwAccel)); |
| 150 | m_pDecoder = CreateHWAccelDecoder(hwAccel); |
| 151 | m_bHWDecoder = TRUE; |
| 152 | } |
| 153 | |
| 154 | softwaredec: |
| 155 | // Fallback for software |
| 156 | if (!m_pDecoder) |
| 157 | { |
| 158 | DbgLog((LOG_TRACE, 10, L"-> No HW Codec, using Software")); |
| 159 | m_bHWDecoder = FALSE; |
| 160 | if (m_pLAVVideo->GetUseMSWMV9Decoder() && (codec == AV_CODEC_ID_VC1 || codec == AV_CODEC_ID_WMV3) && |
| 161 | !m_bWMV9Failed) |
| 162 | { |
| 163 | m_pDecoder = CreateDecoderWMV9MFT(); |
| 164 | bWMV9 = TRUE; |
| 165 | } |
| 166 | else if (codec == AV_CODEC_ID_H264_MVC) |
| 167 | { |
| 168 | m_pDecoder = CreateDecoderMSDKMVC(); |
| 169 | } |
| 170 | else |
| 171 | m_pDecoder = CreateDecoderAVCodec(); |
nothing calls this directly
no test coverage detected