播放带有自定义叠加层图形的视频 [英] Play a video with custom overlay graphics

查看:91
本文介绍了播放带有自定义叠加层图形的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用播放"和停止"按钮等在一个简单的GUI中播放视频(带有声音).Qt的Phonon模块中有一些类和小部件来做到这一点,并提供了一些示例.好的,这似乎很简单.

I want to play a video (with sound) in a simple GUI with "play" and "stop" buttons etc. There are classes and widgets in Qt's Phonon module for doing that, and several examples. OK, so that seems to be simple.

但是现在我需要在流式视频图像之上绘制一些自定义图形(取决于视频中的当前时间).我没有在Qt文档中找到关于此的任何信息.这样做的规范方法是什么?我是否只是创建一个自定义VideoWidget小部件并覆盖其paintEvent?在这里的另一个问题中,某个人似乎对此有麻烦.

But now I need to draw some custom graphics (that depend on the current time in the video) on top of the streamed video image. I have not found anything about this in the Qt documentation. What's the canonical way of doing this? Do I just create a custom VideoWidget widget and override its paintEvent? In another question here, some guy seemed to have trouble with this.

任何指针将不胜感激.

推荐答案

使用QGraphicsView和QGraphicsWidgets.您可以将您的Phonon :: VideoWidget放在QGraphicsProxyWidget内,然后它可用作QGraphicsWidget.

Use QGraphicsView and QGraphicsWidgets. You can put your Phonon::VideoWidget inside a QGraphicsProxyWidget and it becomes usable as a QGraphicsWidget.

对于自定义叠加层,继承QGraphicsWidget并重写paint函数以绘制您的自定义窗口小部件.您可以将它们添加到场景中,它们将显示在视频窗口小部件的顶部.

For custom overlays, inherit QGraphicsWidget and override the paint function to draw your custom widgets. You can add them to your scene and they will appear on top of your video widget.

这篇关于播放带有自定义叠加层图形的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆