MediaDevice

Unified wrapper for audio/video capture devices.

Declared in src/libs/libvideo/media/MediaDevice.hpp
Inherits QObject
Group video

Detailed description

MediaDevice combines QAudioDevice and QCameraDevice into a single interface. Provides live preview with video frames or audio waveform visualization.

See also MediaDeviceModel, MediaDeviceManager.

Property documentation

details property

[read-only] details : const QString

This property holds a line that names the video part and the audio part of the device.

The text has the form "Video: <description> | Audio: <description>". A part that the device does not have is not in the text.

Access functions:

  • QString details() const

hasAudio property

[read-only] hasAudio : const bool

This property holds whether the device has an audio part.

The value is true after setAudioDevice().

Access functions:

  • bool hasAudio() const

hasVideo property

[read-only] hasVideo : const bool

This property holds whether the device has a video part.

The value is true after setVideoDevice().

Access functions:

  • bool hasVideo() const

name property

[read-only] name : const QString

This property holds the name of the device, for display.

The name is the description of the camera when the device has video, else the description of the audio device. A device with neither is "Unknown Device".

Access functions:

  • QString name() const

previewActive property

previewActive : bool

This property holds whether the device captures a live preview.

When the value becomes true, a device with video starts a video preview, and a device with only audio starts an audio scope. Each renders previewPixmap again every 100 ms. When the value becomes false, both stop and the preview pixmap is cleared. A change emits previewActiveChanged() and previewPixmapChanged(). The default is false.

Access functions:

  • bool previewActive() const
  • void setPreviewActive(bool active)

Notifier signal:

  • void previewActiveChanged()

previewPixmap property

[read-only] previewPixmap : const QPixmap

This property holds the latest preview image, at thumbnailSize().

The image is a video frame, or for an audio-only device a waveform scope. It is null when previewActive is false. Each new image emits previewPixmapChanged().

Access functions:

  • QPixmap previewPixmap() const

Notifier signal:

  • void previewPixmapChanged()
In this section