c# - 使用MCI从内存中播放avi流

标签 c# c++ windows avi

我正在尝试使用 C# 中的 MCI 播放压缩的 AVI 文件。到目前为止,我可以通过打开文件来播放它。

我打开文件的方式是这样的:

String opencommand = "open \"" + file + "\" type mpegvideo alias someMovie shareable";    
int error;    
error = Avi.mciSendString(opencommand, null, 0, IntPtr.Zero);

其中 file 是文件路径。这样视频播放效果很好。

如果我能够从已经使用 AVIFileOpen() 加载的流中播放它,对我来说会好得多。和来自 avifil32.dll 的 AVIFileGetStream()。从 MSDN 文档看来我应该能够做到这一点。他们这么说here :

"MCI can open AVI files by using a file-interface pointer or a stream-interface pointer. To open a file by using either type of interface pointer, specify an at sign (@) followed by the interface pointer in place of the file or device name for the lpszDevice parameter. For more information about the file and stream interfaces, see "AVIFile Functions and Macros .""

但不幸的是,他们没有详细说明,我不知道我应该做什么。 “流接口(interface)指针”实际上是什么意思,我从哪里得到它?因为 MSDN 肯定不会尝试解释他们发明的术语。

最佳答案

所以部分地回答我自己的问题:接口(interface)指针的假定用法似乎是这样的:

Avi.AVIFileOpen(ref aviFile, fileName, Avi.OF_SHARE_DENY_WRITE, 0);
Avi.mciSensString("open @" + aviFile + " type mpegvideo alias someMovie", null, 0, IntPtr.Zero);

其中“aviFile”是指向由 AviFileOpen() 填充的文件接口(interface)的指针。我还尝试使用 AviFileGetStream() 获取流接口(interface)指针并将其传递给 MCI,但指针均无效,MCI 提示找不到文件。

据 MS 称,这是一个已知的问题,当然尚未解决,bug所以除了将文件路径传递给 MCI 之外,这里没有什么可做的。

关于c# - 使用MCI从内存中播放avi流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/601781/

相关文章:

c# - 将谓词中的 Guid 与 MySql.Data.Entity 进行比较时,序列不包含任何元素

c# - 我应该如何在 F# 项目中序列化来自 Refit 的 JSON?

c++ - 在QT中使用鼠标捕获全局键盘

c++ - C++ 运算符 "*"是左关联还是右关联?

c++ - QLabel 自动缩放

windows - 如何在 Windows Vista 中模拟/替换/重新启用经典混音器控件(或命令)?

c++ - 在 C++ 中使用 WinApi 进行多线程

windows - Powershell 上的 .bat 文件 : linux command is not understood

javascript - 带有表单标签的 ASP.NET Core - 验证表单 onsubmit 并阻止提交

c# - 我可以在 LINQ to Entities 中动态构建 where 子句吗?