IVideoWindow::p ut_WindowStyle 抛出“不支持这样的接口”

本文关键字:接口 不支持 抛出 ut WindowStyle IVideoWindow | 更新日期: 2023-09-27 18:37:06

我有一个围绕DirectShow库的C#控件。 虽然我不确定它是否相关,但我运行的是Windows CE 6.0R3。尝试使用该控件播放 WMA 音频文件时,以下代码引发异常 "No such interface supported"

m_graph = new DShowGraph(mediaFile);
m_graphBuilder = m_graph.Open();
m_videoWindow = (IVideoWindow)m_graph.GetVideoWindow();
if (m_videoWindow == null)
{
    // this is not hit
}
try
{
    m_videoWindow.put_WindowStyle((int)(WS.CHILD | WS.VISIBLE | WS.CLIPSIBLINGS));
}
catch (Exception ex)
{
    // I end up here
}

Open调用如下所示(错误处理等经过修剪):

private IGraphBuilder _graphBuilder;
internal IGraphBuilder Open()
{
    object filterGraph = ClassId.CoCreateInstance(ClassId.FilterGraph);
    _graphBuilder = (IGraphBuilder)filterGraph;
    _graphBuilder.RenderFile(_input, null);
    return _graphBuilder;
}

GetVideoWindow 调用看起来很简单:

public IVideoWindow GetVideoWindow()
{
    if (_graphBuilder == null)
        return null;
    return (IVideoWindow)(_graphBuilder);
}

奇怪的是,在Windows CE 5.0下运行时,使用相同的控制DLL,相同的应用程序和相同的媒体文件,这一切都可以正常工作。

我怀疑这可能与我们正在播放纯音频文件的事实有关(检查现在视频文件是否出现相同的问题),但我不太精通 Direct Show,所以我想确切地了解这里发生了什么。

调试的一大挑战是我的办公室里没有故障硬件 - 它在客户的现场,所以我必须进行更改,发送它们并等待回复。 虽然这不会影响问题,但它确实会影响我快速跟进建议或跟进任何人可能遇到的问题的能力。

编辑1

播放 WMV 文件工作正常,因此它与文件仅音频有关。 我们无法测试 MP3 以查看它是否是 WMA 编解码器问题,因为设备 OEM 由于担心许可而未在操作系统中包含 MP3 编解码器。

IVideoWindow::p ut_WindowStyle 抛出“不支持这样的接口”

图形的IVideoWindow只不过是转发到视频渲染过滤器的底层IVideoWindow。使用纯音频管道,您没有视频渲染器(显然),IVideoWindow没有多大意义。该接口仍然可用,但是一旦您尝试调用方法,就没有什么可转发的,因此会出现错误。