简体   繁体   English

Media Foundation屏幕截图钩

[英]Media Foundation screenshot hook

It is required to take at the right time a screenshot from the application (it can be blocked, collapsed or even in a different session). 需要在适当的时候从应用程序中截取屏幕截图(可以将其截屏,折叠或什至在另一个会话中)。 The application plays a video stream through the Media Foundation: 该应用程序通过Media Foundation播放视频流:

As I understand it is necessary to intercept MFCreateMediaSession , what to receive IMFMediaSession , only here what further with this object to do? 据我了解,有必要拦截MFCreateMediaSession ,接收什么IMFMediaSession ,仅在此对象进一步做什么? And can it be accessed from another thread? 并且可以从另一个线程访问它吗?

I see that you wrote application on base of Media Foundation for playing of video -and you need take video images as a separated decoded frames. 我看到您在Media Foundation的基础上编写了用于播放视频的应用程序-您需要将视频图像作为单独的解码帧进行拍摄。 So, you have two opportunities: 因此,您有两个机会:

  1. take video frames from renderer: the regular Media Foundation renderer has IMFVideoDisplayControl interface - on MSDN IMFVideoDisplayControl - it has command GetCurrentImage - retrieves a copy of the current image being displayed by the video renderer - on MSDN GetCurrentImage . 从渲染器获取视频帧:常规Media Foundation渲染器具有IMFVideoDisplayControl接口-在MSDN上IMFVideoDisplayControl-具有命令GetCurrentImage检索视频渲染器正在显示的当前图像的副本-在MSDN GetCurrentImage上
  2. The second way - attach sample grabber sink to the video pipeline - Media Foundation function MFCreateSampleGrabberSinkActivate allows create sink from sample grabber object with IMFSampleGrabberSinkCallback interface - it allows get decoded video images in format of Bitmap images in System Memory. 第二种方法-将样本采集器接收器连接到视频管道MFCreateSampleGrabberSinkActivate Foundation函数MFCreateSampleGrabberSinkActivate允许使用IMFSampleGrabberSinkCallback接口从样本采集器对象创建接收器-它允许以系统内存中位图图像格式获取解码的视频图像。 Using of sample grabber is more difficult, and I can recommend my project Capturing Video from Web-camera on Windows 7 and 8 by using Media Foundation for researching of the such way. 使用样本采集卡更加困难,我可以通过使用Media Foundation来推荐我的项目Windows 7和8上的“从网络摄像机捕获视频” ,以这种方式进行研究。

Regards. 问候。

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

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