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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QMediaRecorder Class Reference

The QMediaRecorder class is used for the recording of media content. More...

    #include <QMediaRecorder>

This class is under development and is subject to change.

Inherits QMediaObject.


Public Types

enum Error { NoError, ResourceError, FormatError }
enum State { StoppedState, RecordingState, PausedState }

Properties


Public Functions

QMediaRecorder ( QMediaObject * mediaObject, QObject * parent = 0 )
~QMediaRecorder ()
QString audioCodecDescription ( const QString & codec ) const
QAudioEncoderSettings audioSettings () const
qint64 duration () const
Error error () const
QString errorString () const
QString format () const
QString formatDescription ( const QString & mimeType ) const
QUrl outputLocation () const
void setEncodingSettings ( const QAudioEncoderSettings & audio, const QVideoEncoderSettings & video = QVideoEncoderSettings(), const QString & format = QString() )
bool setOutputLocation ( const QUrl & location )
State state () const
QStringList supportedAudioCodecs () const
QList<int> supportedAudioSampleRates ( const QAudioEncoderSettings & settings = QAudioEncoderSettings(), bool * continuous = 0 ) const
QStringList supportedFormats () const
QList<qreal> supportedFrameRates ( const QVideoEncoderSettings & settings = QVideoEncoderSettings(), bool * continuous = 0 ) const
QList<QSize> supportedResolutions ( const QVideoEncoderSettings & settings = QVideoEncoderSettings(), bool * continuous = 0 ) const
QStringList supportedVideoCodecs () const
QString videoCodecDescription ( const QString & codec ) const
QVideoEncoderSettings videoSettings () const

Public Slots

void pause ()
void record ()
void stop ()
  • 1 public slot inherited from QObject

Signals

void durationChanged ( qint64 duration )
void error ( QMediaRecorder::Error error )
void stateChanged ( QMediaRecorder::State state )

Additional Inherited Members

  • 1 public type inherited from QObject
  • 4 static public members inherited from QObject
  • 2 protected functions inherited from QMediaObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QMediaRecorder class is used for the recording of media content.

The QMediaRecorder class is a high level media recording class. It's not intended to be used alone but for accessing the media recording functions of other media objects, like QRadioTuner, or QAudioCaptureSource.

If the radio is used as a source, recording is only possible when the source is in appropriate state

    // Audio only recording
    audioSource = new QAudioCaptureSource;
    recorder = new QMediaRecorder(audioSource);

    QAudioEncoderSettings audioSettings;
    audioSettings.setCodec("audio/vorbis");
    audioSettings.setQuality(QtMedia::HighQuality);

    recorder->setEncodingSettings(audioSettings);

    recorder->setOutputLocation(QUrl::fromLocalFile(fileName));
    recorder->record();

Member Type Documentation

enum QMediaRecorder::Error

ConstantValueDescription
QMediaRecorder::NoError0No Errors.
QMediaRecorder::ResourceError1Device is not ready or not available.
QMediaRecorder::FormatError2Current format is not supported.

enum QMediaRecorder::State

ConstantValueDescription
QMediaRecorder::StoppedState0The recorder is not active.
QMediaRecorder::RecordingState1The recorder is currently active and producing data.
QMediaRecorder::PausedState2The recorder is paused.


Property Documentation

duration : const qint64

This property holds the recorded media duration in milliseconds.

Access functions:

qint64 duration () const

Notifier signal:

void durationChanged ( qint64 duration )

outputLocation : QUrl

This property holds the destination location of media content.

Setting the location can fail for example when the service supports only local file system locations while the network url was passed, or the service doesn't support media recording.

Access functions:

QUrl outputLocation () const
bool setOutputLocation ( const QUrl & location )

Member Function Documentation

QMediaRecorder::QMediaRecorder ( QMediaObject * mediaObject, QObject * parent = 0 )

Constructs a media recorder which records the media produced by mediaObject.

The parent is passed to QMediaObject.

QMediaRecorder::~QMediaRecorder ()

Destroys a media recorder object.

QString QMediaRecorder::audioCodecDescription ( const QString & codec ) const

Returns a description of an audio codec.

QAudioEncoderSettings QMediaRecorder::audioSettings () const

Returns the audio encoder settings being used.

See also setEncodingSettings().

void QMediaRecorder::durationChanged ( qint64 duration )   [signal]

Signals that the duration of the recorded media has changed.

Error QMediaRecorder::error () const

Returns the current error state.

See also errorString().

void QMediaRecorder::error ( QMediaRecorder::Error error )   [signal]

Signals that an error has occurred.

QString QMediaRecorder::errorString () const

Returns a string describing the current error state.

See also error().

QString QMediaRecorder::format () const

Returns the MIME type of the selected container format.

QString QMediaRecorder::formatDescription ( const QString & mimeType ) const

Returns a description of a container format mimeType.

void QMediaRecorder::pause ()   [slot]

Pause recording.

void QMediaRecorder::record ()   [slot]

Start recording.

This is an asynchronous call, with signal stateCahnged(QMediaRecorder::RecordingState) being emited when recording started, otherwise error() signal is emited.

void QMediaRecorder::setEncodingSettings ( const QAudioEncoderSettings & audio, const QVideoEncoderSettings & video = QVideoEncoderSettings(), const QString & format = QString() )

Sets the audio and video encoder settings and container format MIME type.

It's only possible to change setttings when the encoder is in the QMediaEncoder::StoppedState state.

If some parameters are not specified, or null settings are passed, the encoder choose the default encoding parameters, depending on media source properties. But while setEncodingSettings is optional, the backend can preload encoding pipeline to improve recording startup time.

See also audioSettings(), videoSettings(), and format().

State QMediaRecorder::state () const

Return the current media recorder state.

See also QMediaRecorder::State.

void QMediaRecorder::stateChanged ( QMediaRecorder::State state )   [signal]

Signals that a media recorder's state has changed.

void QMediaRecorder::stop ()   [slot]

Stop recording.

QStringList QMediaRecorder::supportedAudioCodecs () const

Returns a list of supported audio codecs.

QList<int> QMediaRecorder::supportedAudioSampleRates ( const QAudioEncoderSettings & settings = QAudioEncoderSettings(), bool * continuous = 0 ) const

Returns a list of supported audio sample rates.

If non null audio settings parameter is passed, the returned list is reduced to sample rates supported with partial settings applied.

It can be used for example to query the list of sample rates, supported by specific audio codec.

If the encoder supports arbitrary sample rates within the supported rates range, *continuous is set to true, otherwise *continuous is set to false.

QStringList QMediaRecorder::supportedFormats () const

Returns a list of MIME types of supported container formats.

QList<qreal> QMediaRecorder::supportedFrameRates ( const QVideoEncoderSettings & settings = QVideoEncoderSettings(), bool * continuous = 0 ) const

Returns a list of frame rates video can be encoded at.

If non null video settings parameter is passed, the returned list is reduced to frame rates supported with partial settings like video codec or resolution applied.

If the encoder supports arbitrary frame rates within the supported range, *continuous is set to true, otherwise *continuous is set to false.

See also QVideoEncoderSettings::frameRate().

QList<QSize> QMediaRecorder::supportedResolutions ( const QVideoEncoderSettings & settings = QVideoEncoderSettings(), bool * continuous = 0 ) const

Returns a list of resolutions video can be encoded at.

If non null video settings parameter is passed, the returned list is reduced to resolution supported with partial settings like video codec or framerate applied.

If the encoder supports arbitrary resolutions within the supported range, *continuous is set to true, otherwise *continuous is set to false.

See also QVideoEncoderSettings::resolution().

QStringList QMediaRecorder::supportedVideoCodecs () const

Returns a list of supported video codecs.

QString QMediaRecorder::videoCodecDescription ( const QString & codec ) const

Returns a description of a video codec.

See also setEncodingSettings().

QVideoEncoderSettings QMediaRecorder::videoSettings () const

Returns the video encoder settings being used.

See also setEncodingSettings().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 7
Page suivante

Le blog Digia au hasard

Logo

Créer des applications avec un style Metro avec Qt, exemples en QML et C++, un article de Digia Qt traduit par Thibaut Cuvelier

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

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 qtmobility-1.0-tp
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