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>

Inherits QObject and QMediaBindableInterface.

Public Types

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

Properties

  • 1 property inherited from QObject

Public Functions

QMediaRecorder ( QMediaObject * mediaObject, QObject * parent = 0 )
~QMediaRecorder ()
QString audioCodecDescription ( const QString & codec ) const
QAudioEncoderSettings audioSettings () const
QtMultimediaKit::AvailabilityError availabilityError () const
QStringList availableExtendedMetaData () const
QList<QtMultimediaKit::MetaData> availableMetaData () const
QString containerDescription ( const QString & mimeType ) const
QString containerMimeType () const
qint64 duration () const
Error error () const
QString errorString () const
QVariant extendedMetaData ( const QString & key ) const
bool isAvailable () const
bool isMetaDataAvailable () const
bool isMetaDataWritable () const
bool isMuted () const
QVariant metaData ( QtMultimediaKit::MetaData key ) const
QUrl outputLocation () const
void setEncodingSettings ( const QAudioEncoderSettings & audio, const QVideoEncoderSettings & video = QVideoEncoderSettings(), const QString & container = QString() )
void setExtendedMetaData ( const QString & key, const QVariant & value )
void setMetaData ( QtMultimediaKit::MetaData key, const QVariant & value )
bool setOutputLocation ( const QUrl & location )
State state () const
QStringList supportedAudioCodecs () const
QList<int> supportedAudioSampleRates ( const QAudioEncoderSettings & settings = QAudioEncoderSettings(), bool * continuous = 0 ) const
QStringList supportedContainers () 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

Reimplemented Public Functions

virtual QMediaObject * mediaObject () const

Public Slots

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

Signals

void durationChanged ( qint64 duration )
void error ( QMediaRecorder::Error error )
void metaDataAvailableChanged ( bool available )
void metaDataChanged ()
void metaDataWritableChanged ( bool writable )
void mutedChanged ( bool muted )
void stateChanged ( QMediaRecorder::State state )

Additional Inherited Members

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.

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

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

     recorder->setEncodingSettings(audioSettings);

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

See also QAudioCaptureSource.

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 )

metaDataAvailable : const bool

This property holds whether access to a media object's meta-data is available.

If this is true there is meta-data available, otherwise there is no meta-data available.

Access functions:

bool isMetaDataAvailable () const

Notifier signal:

void metaDataAvailableChanged ( bool available )

metaDataWritable : const bool

This property holds whether a media object's meta-data is writable.

If this is true the meta-data is writable, otherwise the meta-data is read-only.

Access functions:

bool isMetaDataWritable () const

Notifier signal:

void metaDataWritableChanged ( bool writable )

muted : bool

This property holds whether a recording audio stream is muted.

Access functions:

bool isMuted () const
void setMuted ( bool muted )

Notifier signal:

void mutedChanged ( bool muted )

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 but a network URL was passed. If the service does not support media recording this setting the output location will always fail.

The location can be relative or empty; in this case the recorder uses the system specific place and file naming scheme. After recording has stated, QMediaRecorder::outputLocation() returns the actual output location.

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().

QtMultimediaKit::AvailabilityError QMediaRecorder::availabilityError () const

Returns the availability error code.

QStringList QMediaRecorder::availableExtendedMetaData () const

Returns a list of keys there is extended meta-data available for.

QList<QtMultimediaKit::MetaData> QMediaRecorder::availableMetaData () const

Returns a list of keys there is meta-data available for.

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

Returns a description of a container format mimeType.

QString QMediaRecorder::containerMimeType () const

Returns the MIME type of the selected container format.

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().

QVariant QMediaRecorder::extendedMetaData ( const QString & key ) const

Returns the value associated with a meta-data key.

The naming and type of extended meta-data is not standardized, so the values and meaning of keys may vary between backends.

See also setExtendedMetaData().

bool QMediaRecorder::isAvailable () const

Returns true if media recorder service ready to use.

QMediaObject * QMediaRecorder::mediaObject () const [virtual]

Reimplemented from QMediaBindableInterface::mediaObject().

Returns the QMediaObject instance that this QMediaRecorder is bound too, or 0 otherwise.

QVariant QMediaRecorder::metaData ( QtMultimediaKit::MetaData key ) const

Returns the value associated with a meta-data key.

See also setMetaData().

void QMediaRecorder::metaDataAvailableChanged ( bool available ) [signal]

Signals that the available state of a media object's meta-data has changed.

void QMediaRecorder::metaDataChanged () [signal]

Signals that a media object's meta-data has changed.

void QMediaRecorder::metaDataWritableChanged ( bool writable ) [signal]

Signals that the writable state of a media object's meta-data has changed.

void QMediaRecorder::mutedChanged ( bool muted ) [signal]

Signals that the muted state has changed. If true the recording is being muted.

void QMediaRecorder::pause () [slot]

Pause recording.

void QMediaRecorder::record () [slot]

Start recording.

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

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

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

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

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

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

void QMediaRecorder::setExtendedMetaData ( const QString & key, const QVariant & value )

Sets a value for a meta-data key.

The naming and type of extended meta-data is not standardized, so the values and meaning of keys may vary between backends.

See also extendedMetaData().

void QMediaRecorder::setMetaData ( QtMultimediaKit::MetaData key, const QVariant & value )

Sets a value for a meta-data key.

See also metaData().

State QMediaRecorder::state () const

Returns 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.

This can be used 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::supportedContainers () 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().

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
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 80
  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. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  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 6
Page suivante

Le Qt Developer Network au hasard

Logo

Combiner licence, à propos et fermer d'une dernière manière

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. 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.1
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