VideoOutput QML 类型

渲染视频 (或摄像头取景器)。 更多...

import 语句: import QtMultimedia 5.8

特性

方法

详细描述

Rectangle {
    width: 800
    height: 600
    color: "black"
    MediaPlayer {
        id: player
        source: "file://video.webm"
        autoPlay: true
    }
    VideoOutput {
        id: videoOutput
        source: player
        anchors.fill: parent
    }
}
					

The VideoOutput item supports untransformed, stretched, and uniformly scaled video presentation. For a description of stretched uniformly scaled presentation, see the fillMode property description.

The VideoOutput item works with backends that support either QVideoRendererControl or QVideoWindowControl . If the backend only supports QVideoWindowControl , the video is rendered onto an overlay window that is layered on top of the QtQuick window. Due to the nature of the video overlays, certain features are not available for these kind of backends:

Most backends however do support QVideoRendererControl and therefore don't have the limitations listed above.

另请参阅 MediaPlayer and Camera .

特性文档编制

autoOrientation : bool

This property allows you to enable and disable auto orientation of the video stream, so that its orientation always matches the orientation of the screen. If autoOrientation is enabled, the orientation property is overwritten.

默认情况下 autoOrientation 被禁用。

This QML property was introduced in QtMultimedia 5.2.

另请参阅 orientation .

contentRect : rectangle

This property holds the item coordinates of the area that would contain video to render. With certain fill modes, this rectangle will be larger than the visible area of the VideoOutput .

This property is useful when other coordinates are specified in terms of the source dimensions - this applied for relative (normalized) frame coordinates in the range of 0 to 1.0.

Areas outside this will be transparent.

另请参阅 mapRectToItem() and mapPointToItem() .

fillMode : enumeration

Set this property to define how the video is scaled to fit the target area.

  • Stretch - the video is scaled to fit.
  • PreserveAspectFit - the video is scaled uniformly to fit without cropping
  • PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary

The default fill mode is PreserveAspectFit.

过滤 : list < 对象 >

This property holds the list of video filters that are run on the video frames. The order of the filters in the list matches the order in which they will be invoked on the video frames. The objects in the list must be instances of a subclass of QAbstractVideoFilter .

另请参阅 QAbstractVideoFilter .

orientation : int

In some cases the source video stream requires a certain orientation to be correct. This includes sources like a camera viewfinder, where the displayed viewfinder should match reality, no matter what rotation the rest of the user interface has.

This property allows you to apply a rotation (in steps of 90 degrees) to compensate for any user interface rotation, with positive values in the anti-clockwise direction.

The orientation change will also affect the mapping of coordinates from source to viewport.

另请参阅 autoOrientation .

source : variant

This property holds the source item providing the video frames like MediaPlayer or Camera.

If you are extending your own C++ classes to interoperate with VideoOutput , you can either provide a QObject based class with a mediaObject property that exposes a QMediaObject derived class that has a QVideoRendererControl available, or you can provide a QObject based class with a writable videoSurface property that can accept a QAbstractVideoSurface based class and can follow the correct protocol to deliver QVideoFrames to it.

sourceRect : rectangle

This property holds the area of the source video content that is considered for rendering. The values are in source pixel coordinates, adjusted for the source's pixel aspect ratio.

Note that typically the top left corner of this rectangle will be 0,0 while the width and height will be the width and height of the input content. Only when the video source has a viewport set, these values will differ.

The orientation setting does not affect this rectangle.

另请参阅 QVideoSurfaceFormat::pixelAspectRatio() and QVideoSurfaceFormat::viewport() .


方法文档编制

QPointF mapNormalizedPointToItem (const QPointF & point ) const

Given normalized coordinates point (that is, each component in the range of 0 to 1.0), return the mapped point that it corresponds to (in item coordinates). This mapping is affected by the orientation.

Depending on the fill mode, this point may lie outside the rendered rectangle.

QRectF mapNormalizedRectToItem (const QRectF & rectangle ) const

Given a rectangle rectangle in normalized coordinates (that is, each component in the range of 0 to 1.0), return the mapped rectangle that it corresponds to (in item coordinates). This mapping is affected by the orientation.

Depending on the fill mode, this rectangle may extend outside the rendered rectangle.

QPointF mapPointToItem (const QPointF & point ) const

给定点 point in source coordinates, return the corresponding point in item coordinates. This mapping is affected by the orientation.

Depending on the fill mode, this point may lie outside the rendered rectangle.

QPointF mapPointToSource (const QPointF & point ) const

给定点 point in item coordinates, return the corresponding point in source coordinates. This mapping is affected by the orientation.

If the supplied point lies outside the rendered area, the returned point will be outside the source rectangle.

QPointF mapPointToSourceNormalized (const QPointF & point ) const

给定点 point in item coordinates, return the corresponding point in normalized source coordinates. This mapping is affected by the orientation.

If the supplied point lies outside the rendered area, the returned point will be outside the source rectangle. No clamping is performed.

QRectF mapRectToItem (const QRectF & rectangle ) const

Given a rectangle rectangle in source coordinates, return the corresponding rectangle in item coordinates. This mapping is affected by the orientation.

Depending on the fill mode, this rectangle may extend outside the rendered rectangle.

QRectF mapRectToSource (const QRectF & rectangle ) const

Given a rectangle rectangle in item coordinates, return the corresponding rectangle in source coordinates. This mapping is affected by the orientation.

This mapping is affected by the orientation.

If the supplied point lies outside the rendered area, the returned point will be outside the source rectangle.

QRectF mapRectToSourceNormalized (const QRectF & rectangle ) const

Given a rectangle rectangle in item coordinates, return the corresponding rectangle in normalized source coordinates. This mapping is affected by the orientation.

This mapping is affected by the orientation.

If the supplied point lies outside the rendered area, the returned point will be outside the source rectangle. No clamping is performed.