Blue screen when using the IAMStreamConfig interface

101 Views Asked by At

Having a problem regarding the use of IAMStreamConfig interface.

I have the following code to set the output format:

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;
    }
}

Till yesterday I never had any problem with any device, but yesterday I tested this with a new video source, Osprey 850e SDI, and I always get a blue screen when trying to set the format:

streamConfig.SetFormat(newMediaType)

The format being set is YUY2.

Anyone ever came across a similar issue or has any suggestions?

Thank you.

EDIT:

These are the details of the media type supplied:

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
0

There are 0 best solutions below