| 1660 | //------------------------------------------------------------------- |
| 1661 | |
| 1662 | HRESULT WmfMediaEngine::CreateOutputNode(IMFStreamDescriptor* pSourceSD, IMFTopologyNode** ppNode) |
| 1663 | { |
| 1664 | |
| 1665 | TComPtr<IMFTopologyNode> OutputNode; |
| 1666 | TComPtr<IMFMediaTypeHandler> pHandler; |
| 1667 | TComPtr<IMFActivate> pRendererActivate; |
| 1668 | |
| 1669 | GUID guidMajorType = GUID_NULL; |
| 1670 | HRESULT hr = S_OK; |
| 1671 | |
| 1672 | // Get the stream ID. |
| 1673 | DWORD streamID = 0; |
| 1674 | pSourceSD->GetStreamIdentifier(&streamID); // Just for debugging, ignore any failures. |
| 1675 | |
| 1676 | // Get the media type handler for the stream. |
| 1677 | CHECK_HR(hr = pSourceSD->GetMediaTypeHandler(&pHandler)); |
| 1678 | |
| 1679 | // Get the major media type. |
| 1680 | CHECK_HR(hr = pHandler->GetMajorType(&guidMajorType)); |
| 1681 | |
| 1682 | // Create a downstream node. |
| 1683 | CHECK_HR(hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &OutputNode)); |
| 1684 | |
| 1685 | // Create an IMFActivate object for the renderer, based on the media type. |
| 1686 | if (MFMediaType_Video == guidMajorType) |
| 1687 | { |
| 1688 | // Create the video renderer. |
| 1689 | AXME_TRACE("Stream {}: video stream\n", streamID); |
| 1690 | // CHECK_HR(hr = MFCreateVideoRendererActivate(hwndVideo, &pRendererActivate)); |
| 1691 | auto Sampler = MFUtils::MakeComPtr<MFVideoSampler>(this); |
| 1692 | TComPtr<IMFMediaType>& InputType = m_videoInputType; |
| 1693 | CHECK_HR(hr = pHandler->GetCurrentMediaType(InputType.ReleaseAndGetAddressOf())); |
| 1694 | |
| 1695 | // Create output type |
| 1696 | GUID SubType; |
| 1697 | CHECK_HR(hr = InputType->GetGUID(MF_MT_SUBTYPE, &SubType)); |
| 1698 | |
| 1699 | auto strType = MFUtils::GetVideoTypeName(SubType); |
| 1700 | AXME_TRACE("WmfMediaEngine: Input video type: {}", strType); |
| 1701 | |
| 1702 | m_bIsH264 = SubType == MFVideoFormat_H264 || SubType == MFVideoFormat_H264_ES; |
| 1703 | m_bIsHEVC = SubType == MFVideoFormat_HEVC || SubType == MFVideoFormat_HEVC_ES; |
| 1704 | |
| 1705 | GUID VideoOutputFormat; |
| 1706 | if ((SubType == MFVideoFormat_HEVC) || (SubType == MFVideoFormat_HEVC_ES) || (SubType == MFVideoFormat_NV12) || |
| 1707 | (SubType == MFVideoFormat_IYUV)) |
| 1708 | { |
| 1709 | VideoOutputFormat = MFVideoFormat_NV12; |
| 1710 | } |
| 1711 | else |
| 1712 | { |
| 1713 | const bool Uncompressed = (SubType == MFVideoFormat_RGB555) || (SubType == MFVideoFormat_RGB565) || |
| 1714 | (SubType == MFVideoFormat_RGB24) || (SubType == MFVideoFormat_RGB32) || |
| 1715 | (SubType == MFVideoFormat_ARGB32); |
| 1716 | |
| 1717 | VideoOutputFormat = Uncompressed ? MFVideoFormat_RGB32 : MFVideoFormat_YUY2; |
| 1718 | } |
| 1719 |
nothing calls this directly
no test coverage detected