首页 > 解决方案 > 使用IAMStreamConfig接口时蓝屏

问题描述

在使用 IAMStreamConfig 接口时遇到问题。

我有以下代码来设置输出格式:

private void SetFormat(IAMStreamConfig streamConfig, VideoCapabilities resolution = null)
{
    int capabilitiesCount = 0, capabilitySize = 0;
    AMMediaType newMediaType = null;
    var caps = new VideoStreamConfigCaps();

    streamConfig.GetNumberOfCapabilities(out capabilitiesCount, out capabilitySize);

    for (int i = 0; i < capabilitiesCount; i++)
    {
        try
        {
            var vc = new VideoCapabilities(streamConfig, i);

            if (resolution == vc || resolution == null)
            {
                if (streamConfig.GetStreamCaps(i, out newMediaType, caps) == 0)
                    break;
            }
        }
        catch { }
    }

    if (newMediaType != null)
    {
        if (averageTimePerFrame >= 0)
        {
            unsafe
            {
                VideoInfoHeader* vih = (VideoInfoHeader*)newMediaType.FormatPtr;
                vih->AverageTimePerFrame = averageTimePerFrame;
            }
        }

        streamConfig.SetFormat(newMediaType);

        newMediaType.Dispose();
        newMediaType = null;
    }
}

直到昨天,我的任何设备都没有出现任何问题,但昨天我使用新的视频源 Osprey 850e SDI 进行了测试,尝试设置格式时总是出现蓝屏:

streamConfig.SetFormat(newMediaType)

设置的格式是 YUY2。

有人遇到过类似的问题或有什么建议吗?

谢谢你。

编辑:

这些是提供的媒体类型的详细信息:

Major Type: 73646976-0000-0010-8000-00aa00389b71  WMMEDIATYPE_Video
Sub Type:   59565955-0000-0010-8000-00aa00389b71  MEDIASUBTYPE_UYVY
Fixed Size Samples: true
Temporal Compression: false
Sample Size 691200
Format Type: 05589f80-c356-11ce-bf01-00aa0055595a WMFORMAT_VideoInfo
unkPtr: 0
Format Size: 88
FormatPtr: 111386040

标签: directshowdirectshow.net

解决方案


推荐阅读