directshow - 使用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
解决方案
推荐阅读
- google-sheets-api - 阅读 Google 电子表格条件格式信息
- java - 如何在空列表中使用 Java Stream
- python - 如何在 Mac 上的 IDLE 上全屏显示
- android - 模拟器无法正确启动“错误:检测到挂起的线程”
- mysql - 如何构造具有多个条件的复杂 MySQL 查询
- c# - File.ReadAllBytes & Memorystream.ToArray 返回错误数据
- go - 具有 interface{} 参数的方法的接口不起作用
- google-apps-script - 具有命名值的 Googlescript 代码不起作用
- java - Spring Security - 覆盖 WebSecurityConfigurerAdapter 的配置(AuthenticationManagerBuilder)是否会影响全局应用程序?
- magento2 - 如何在管理面板中修复“处理您的请求时出错 :: 指定无效的父 ID (Magento_Backend::mgs)”..?