Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

VideoOutput

The VideoOutput type allows you to render video or camera viewfinder. More...

Inherits Item

Properties

Methods

Detailed Description

VideoOutput is part of the QtMultimedia 5.0 module.

 import QtQuick 2.0
 import QtMultimedia 5.0

 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:

  • Some transformations like rotations
  • Having other QtQuick items on top of the VideoOutput item

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

Screen Saver

If it is likely that an application will be playing video for an extended period of time without user interaction it may be necessary to disable the platform's screen saver. The ScreenSaver (from QtSystemInfo) may be used to disable the screensaver in this fashion:

 import QtSystemInfo 5.0

 ScreenSaver { screenSaverEnabled: false }

See also MediaPlayer and Camera.

Property Documentation

read-onlycontentRect : 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.

See also 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.


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.


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.


read-onlysourceRect : rectangle

This property holds the area of the source video content that is considered for rendering. The values are in source pixel coordinates.

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.

The orientation setting does not affect this rectangle.


Method Documentation

QPointF VideoOutput::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.


QPointF VideoOutput::mapPointToItem(const QPointF & point) const

Given a point 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 VideoOutput::mapPointToItemNormalized(const QPointF & point) const

Given a point 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 VideoOutput::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.


QRectF VideoOutput::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 VideoOutput::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 VideoOutput::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.


Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web