绘制视频并在顶部添加文字

发布于 2024-08-21 11:22:49 字数 457 浏览 3 评论 0原文

我正在开发一个应用程序,但遇到了一个问题,我似乎无法找到解决方案。该应用程序是用 vc++ 编写的。我需要做的是显示 YUV 视频源,并在其顶部显示文本。

现在,它可以通过使用 GDI 在 OnPaint 方法中绘制文本以及在 DirectDraw 覆盖上绘制视频来正常工作。我需要摆脱覆盖层,因为它会导致很多问题。它不适用于某些显卡、vista、7 等。

我无法找到一种方法以更兼容的方式完成相同的事情。我可以使用带有后台缓冲区的 DirectDraw 绘制视频并将其复制到主缓冲区就好了。这里的问题是,由于视频刷新的次数,在 GDI 中绘制的文本会闪烁。如果可能的话,我真的很想保持绘制文本的代码完整,因为它运行良好。

有没有办法将文本直接绘制到 DirectDraw 缓冲区或内存缓冲区或其他东西,然后将其 blt 到后台缓冲区?我应该一起考虑另一种方法吗?两个重要的操作系统是 XP 和 7。如果有人有任何想法请告诉我,我将对其进行测试。谢谢。

I am working on an application and I have a problem I just cant seem to find a solution for. The application is written in vc++. What I need to do is display a YUV video feed with text on top of it.

Right now it works correctly by drawing the text in the OnPaint method using GDI and the video on a DirectDraw overlay. I need to get rid of the overlay because it causes to many problems. It wont work on some video cards, vista, 7, etc.

I cant figure out a way to complete the same thing in a more compatible way. I can draw the video using DirectDraw with a back buffer and copy it to the primary buffer just fine. The issue here is that the text being drawn in GDI flashes because of the amount of times the video is refreshed. I would really like to keep the code to draw the text intact if possible since it works well.

Is there a way to draw the text directly to a DirectDraw buffer or memory buffer or something and then blt it to the back buffer? Should I be looking at another method all together? The two important OS's are XP and 7. If anyone has any ideas just let me know and I will test them out. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

↙温凉少女 2024-08-28 11:22:49

尝试查看 microsoft.com 上的 DirectShow 和 Ticker 示例:

DirectShow Ticker 示例

此示例使用视频混合渲染器来混合视频和文本。它使用 IVMRMixerBitmap9 接口将文本混合到视频窗口的底部。

DirectShow 用于构建过滤器图来播放音频或视频流,添加不同的过滤器以实现不同的效果以及视频和音频样本的操作。

Try to look into DirectShow and the Ticker sample on microsoft.com:

DirectShow Ticker sample

This sample uses the Video Mixing Renderer to blend video and text. It uses the IVMRMixerBitmap9 interface to blend text onto the bottom portion of the video window.

DirectShow is for building filter graphs for playing back audio or video streams an adding different filters for different effects and manipulation of video and audio samples.

哆兒滾 2024-08-28 11:22:49

除了使用 DirectShow 的视频混合渲染器之外,您还可以使用 ISampleGrabber 接口。优点是,它是一个也可以与其他渲染器一起使用的过滤器,例如,当不在屏幕上显示视频但通过网络流式传输或将其转储到文件时。

Instead of using the Video Mixing Renderer of DirectShow, you can also use the ISampleGrabber interface. The advantage is, that it is a filter which can be used with other renderers as well, for example when not showing the video on the screen but streaming it over network or dumping it to a file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文