| 652 | }; |
| 653 | |
| 654 | HRESULT CLAVVideo::CreateDecoder(const CMediaType *pmt) |
| 655 | { |
| 656 | DbgLog((LOG_TRACE, 10, L"::CreateDecoder(): Creating new decoder...")); |
| 657 | HRESULT hr = S_OK; |
| 658 | |
| 659 | AVCodecID codec = FindCodecId(pmt); |
| 660 | if (codec == AV_CODEC_ID_NONE) |
| 661 | { |
| 662 | return VFW_E_TYPE_NOT_ACCEPTED; |
| 663 | } |
| 664 | |
| 665 | // Check if codec is activated |
| 666 | for (int i = 0; i < Codec_VideoNB; ++i) |
| 667 | { |
| 668 | const codec_config_t *config = get_codec_config((LAVVideoCodec)i); |
| 669 | bool bMatched = false; |
| 670 | for (int k = 0; k < config->nCodecs; ++k) |
| 671 | { |
| 672 | if (config->codecs[k] == codec) |
| 673 | { |
| 674 | bMatched = true; |
| 675 | break; |
| 676 | } |
| 677 | } |
| 678 | if (bMatched && !m_settings.bFormats[i]) |
| 679 | { |
| 680 | DbgLog((LOG_TRACE, 10, L"-> Codec is disabled")); |
| 681 | return VFW_E_TYPE_NOT_ACCEPTED; |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | if (codec == AV_CODEC_ID_H264_MVC && !m_settings.bH264MVCOverride) |
| 686 | { |
| 687 | DbgLog((LOG_TRACE, 10, L"-> H.264 MVC override, refusing")); |
| 688 | return VFW_E_TYPE_NOT_ACCEPTED; |
| 689 | } |
| 690 | |
| 691 | ILAVPinInfo *pPinInfo = nullptr; |
| 692 | hr = FindPinIntefaceInGraph(m_pInput, IID_ILAVPinInfo, (void **)&pPinInfo); |
| 693 | if (SUCCEEDED(hr)) |
| 694 | { |
| 695 | memset(&m_LAVPinInfo, 0, sizeof(m_LAVPinInfo)); |
| 696 | |
| 697 | m_LAVPinInfoValid = TRUE; |
| 698 | m_LAVPinInfo.flags = pPinInfo->GetStreamFlags(); |
| 699 | m_LAVPinInfo.pix_fmt = (AVPixelFormat)pPinInfo->GetPixelFormat(); |
| 700 | m_LAVPinInfo.has_b_frames = pPinInfo->GetHasBFrames(); |
| 701 | |
| 702 | SafeRelease(&pPinInfo); |
| 703 | } |
| 704 | else |
| 705 | { |
| 706 | m_LAVPinInfoValid = FALSE; |
| 707 | } |
| 708 | |
| 709 | // Clear old sidedata |
| 710 | memset(&m_SideData, 0, sizeof(m_SideData)); |
| 711 |
nothing calls this directly
no test coverage detected