GStreamerVideoSource QML Type
由自定义 GStreamer 二进制文件支持的视频源。更多内容...
| Import Statement: | import QtMultimedia |
| In C++: | QGStreamerVideoSource |
属性
- active : bool
- gstBinDescription : string
方法
详细说明
根据 GStreamer bin 描述构建视频源,并通过其 `nativeVideoSource ` 属性将其附加到 `CaptureSession ` 上。
对于任何标准情况,我们建议使用Camera 而不是此类型,除非您需要 GStreamer 特有的配置来处理任何自定义视频源。
默认情况下,该类型仅在 meta-qt6 构建中可用。在支持 GStreamer 的自定义构建中,可通过启用gstreamer_qt_api 功能来启用它。
QtMultimedia 必须配合gstreamer 媒体后端运行,该类才能正常工作。
Item {
CaptureSession {
nativeVideoSource: GStreamerVideoSource {
gstElementDescription: "videotestsrc name=testsrc"
active: true
}
videoOutput: preview
}
VideoOutput {
id: preview
}
}另请参阅 CaptureSession 和Camera 。
属性文档
active : bool
描述视频源当前是否处于活动状态。
如果视频源已连接到CaptureSession ,则该属性表示底层的GstElement 是否已附加到媒体捕获会话中的GstPipeline 中。
gstBinDescription : string [read-only]
描述与视频源相关的 GStreamer bin 描述。
在 QML 中,此属性是必需的。
GStreamer 后端会解析该描述并创建一个 bin,该 bin 可作为捕获会话的视频源。
有关描述字符串的语法,请参阅GStreamer 文档。
如果指定的描述无效,导致无法创建 bin,则构建的GStreamerVideoSource 将无法正常工作,且该属性将返回一个空字符串。
注意: GStreamerVideoSource 不会对提供的bin描述进行任何额外验证,因此如果创建的GstBin 不代表GstPipeline 的视频输入,则GStreamerVideoSource 和相关的CaptureSession 可能会出现异常行为。
方法文档
void start()
启动视频源。
这相当于将active 属性设置为true 。
void stop()
停止视频源。
这相当于将active 属性设置为false 。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.