简体   繁体   English

DirectShow停止/恢复直播

[英]DirectShow stop/resume live stream

I'm using DirectShow to play audio/video files in my application. 我正在使用DirectShow在我的应用程序中播放音频/视频文件。 I use IGraphBuilder::RenderFile() to build the filter graph and the IMediaControl interface to play/pause/stop the media. 我使用IGraphBuilder :: RenderFile()来构建过滤器图形,使用IMediaControl接口来播放/暂停/停止媒体。 This works fine for local media files, but causes problems with live mms streams. 这适用于本地媒体文件,但会导致实时mms流出现问题。

If I call IMediaControl::Stop() on a live stream, the stream will stop playing as expected. 如果我在实时流上调用IMediaControl :: Stop() ,则流将按预期停止播放。 However, if I call IMediaControl::Run() to resume the stream, nothing happens. 但是,如果我调用IMediaControl :: Run()来恢复流,则没有任何反应。 The graph generates an EC_COMPLETE event, but the video does not play anymore. 该图生成EC_COMPLETE事件,但视频不再播放。

Calling IMediaControl::Pause() followed by IMediaControl::Run() will resume the stream where it left off, but will eventually stop. 调用IMediaControl :: Pause()后跟IMediaControl :: Run()将恢复它停止的流,但最终会停止。 It seems to just playback the data that was in the buffer when IMediaControl::Pause() was called, instead of re-syncing with the live stream. 它似乎只是在调用IMediaControl :: Pause()时回放缓冲区中的数据,而不是重新与实时流同步。

Does anybody know how to resume playing a live stream without destroying and rebuilding the filter graph? 有没有人知道如何在不破坏和重建过滤器图的情况下恢复播放实时流?

  1. Why are you calling Stop()? 你为什么叫Stop()? you should call Pause() 你应该调用Pause()
  2. The DirectShow Filters for MMS are know to have problems with MMS, for starters they don't support the latest MMS 9 (that comes with Win 2003) protocol. 已知MMS的DirectShow过滤器存在MMS问题,对于初学者而言,他们不支持最新的MMS 9(Win 2003附带)协议。 You should use the Media Player Control or the Format SDK if you want proper support for MMS. 如果您需要适当的MMS支持,则应使用Media Player Control或Format SDK。

The behavior indicates that one of the filters in the graph exhibits buggy behavior. 该行为表明图表中的一个过滤器表现出错误的行为。 The filter has to be replaced if you want to be able to re-run the feed. 如果您希望能够重新运行Feed,则必须更换过滤器。 Also there is no good source filter to render mms:// streams which are obsolete themselves as protocol. 此外,没有好的源过滤器来呈现mms://流,这些流本身已作为协议过时。 Windows Media Player in Windows 7 is using its private DirectShow filter which is not available to applications. Windows 7中的Windows Media Player正在使用其专用的DirectShow过滤器,该过滤器不适用于应用程序。 You might end up using custom source filter based on Windows Media Format SDK, or a third party replacement. 您最终可能会使用基于Windows Media Format SDK或第三方替代品的自定义源过滤器。

UPDATE: In Windows XP, mms:// URLs are rednered by Windows Media Splitter filter (wmpasf.dll). 更新:在Windows XP中, Windows Media Splitter过滤器(wmpasf.dll)会对mms:// URL进行更新。 It is obviously responsible for the bug in question. 它显然是对有问题的bug负责。 So, if you are still going to use it, you might have to remove, re-add a new instance of the filter and re-render its pins in order to restart streaming. 因此,如果您仍然要使用它,您可能必须删除,重新添加过滤器的新实例并重新渲染其引脚以重新启动流式传输。 As I mentioned, this filter is no longer available in more recent versions of Windows (Windows 7 at the very least). 正如我所提到的,在最新版本的Windows(至少是Windows 7)中不再提供此过滤器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM