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  · 

QAudioDecoder Class

The QAudioDecoder class allows decoding audio. More...

 #include <QAudioDecoder>

This class is under development and is subject to change.

Inherits: QMediaObject.

Public Types

enum Error { NoError, ResourceError, FormatError, AccessDeniedError, ServiceMissingError }
enum State { StoppedState, DecodingState }

Properties

Public Functions

QAudioDecoder(QObject * parent = 0)
~QAudioDecoder()
QAudioFormat audioFormat() const
bool bufferAvailable() const
qint64 duration() const
Error error() const
QString errorString() const
qint64 position() const
QAudioBuffer read() const
void setAudioFormat(const QAudioFormat & format)
void setSourceDevice(QIODevice * device)
void setSourceFilename(const QString & fileName)
QIODevice * sourceDevice() const
QString sourceFilename() const
State state() const

Public Slots

void start()
void stop()
  • 1 public slot inherited from QObject

Signals

void bufferAvailableChanged(bool available)
void bufferReady()
void durationChanged(qint64 duration)
void error(QAudioDecoder::Error error)
void finished()
void formatChanged(const QAudioFormat & format)
void positionChanged(qint64 position)
void sourceChanged()
void stateChanged(QAudioDecoder::State state)

Static Public Members

QtMultimedia::SupportEstimate hasSupport(const QString & mimeType, const QStringList & codecs = QStringList())
  • 11 static public members inherited from QObject

Additional Inherited Members

  • 2 protected functions inherited from QMediaObject
  • 9 protected functions inherited from QObject

Detailed Description

The QAudioDecoder class allows decoding audio.

The QAudioDecoder class is a high level class for decoding local audio media files. It is similar to the QMediaPlayer class except that audio is provided back through this API rather than routed directly to audio hardware, and playlists and network and streaming based media is not supported.

See also QAudioBuffer.

Member Type Documentation

enum QAudioDecoder::Error

Defines a media player error condition.

ConstantValueDescription
QAudioDecoder::NoError0No error has occurred.
QAudioDecoder::ResourceError1A media resource couldn't be resolved.
QAudioDecoder::FormatError2The format of a media resource isn't supported.
QAudioDecoder::AccessDeniedError3There are not the appropriate permissions to play a media resource.
QAudioDecoder::ServiceMissingError4A valid playback service was not found, playback cannot proceed.

enum QAudioDecoder::State

Defines the current state of a media player.

ConstantValueDescription
QAudioDecoder::StoppedState0The decoder is not decoding. Decoding will start at the start of the media.
QAudioDecoder::DecodingState1The audio player is currently decoding media.

Property Documentation

bufferAvailable : const bool

Access functions:

bool bufferAvailable() const

Notifier signal:

void bufferAvailableChanged(bool available)

error : const QString

This property holds a string describing the last error condition.

Access functions:

QString errorString() const

See also error().

sourceFilename : QString

This property holds the active filename being decoded by the decoder object.

Access functions:

QString sourceFilename() const
void setSourceFilename(const QString & fileName)

Notifier signal:

void sourceChanged()

state : const State

This property holds the audio decoder's playback state.

By default this property is QAudioDecoder::Stopped

Access functions:

State state() const

Notifier signal:

void stateChanged(QAudioDecoder::State state)

See also start() and stop().

Member Function Documentation

QAudioDecoder::QAudioDecoder(QObject * parent = 0)

Construct an QAudioDecoder instance parented to parent.

QAudioDecoder::~QAudioDecoder()

Destroys the audio decoder object.

QAudioFormat QAudioDecoder::audioFormat() const

Returns the current audio format of the decoded stream.

Any buffers returned should have this format.

See also setAudioFormat() and formatChanged().

void QAudioDecoder::bufferReady() [signal]

Signals that a new decoded audio buffer is available to be read.

See also read() and bufferAvailable().

qint64 QAudioDecoder::duration() const

Returns total duration (in milliseconds) of the audio stream or -1 if not available.

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

Signals that the estimated duration of the decoded data has changed.

See also positionChanged().

Error QAudioDecoder::error() const

Returns the current error state.

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

Signals that an error condition has occurred.

See also errorString().

void QAudioDecoder::finished() [signal]

Signals that the decoding has finished successfully. If decoding fails, error signal is emitted instead.

See also start(), stop(), and error().

void QAudioDecoder::formatChanged(const QAudioFormat & format) [signal]

Signals that the current audio format of the decoder has changed to format.

See also audioFormat() and setAudioFormat().

QtMultimedia::SupportEstimate QAudioDecoder::hasSupport(const QString & mimeType, const QStringList & codecs = QStringList()) [static]

Returns the level of support an audio decoder has for a mimeType and a set of codecs.

qint64 QAudioDecoder::position() const

Returns position (in milliseconds) of the last buffer read from the decoder or -1 if no buffers have been read.

void QAudioDecoder::positionChanged(qint64 position) [signal]

Signals that the current position of the decoder has changed.

See also durationChanged().

QAudioBuffer QAudioDecoder::read() const

Read a buffer from the decoder. Returns invalid buffer on failure.

void QAudioDecoder::setAudioFormat(const QAudioFormat & format)

Set the desired audio format for decoded samples to format.

This property can only be set while the decoder is stopped. Setting this property at other times will be ignored.

If the decoder does not support this format, error() will be set to FormatError.

If you do not specify a format, the format of the decoded audio itself will be used. Otherwise, some format conversion will be applied.

If you wish to reset the decoded format to that of the original audio file, you can specify an invalid format.

See also audioFormat().

void QAudioDecoder::setSourceDevice(QIODevice * device)

Sets the current audio QIODevice to device.

When this property is set any current decoding is stopped, and any audio buffers are discarded.

You can only specify either a source filename or a source QIODevice. Setting one will unset the other.

See also sourceDevice().

QIODevice * QAudioDecoder::sourceDevice() const

Returns the current source QIODevice, if one was set. If setSourceFilename() was called, this will be 0.

See also setSourceDevice().

void QAudioDecoder::start() [slot]

Starts decoding the audio resource.

As data gets decoded, the bufferReady() signal will be emitted when enough data has been decoded. Calling read() will then return an audio buffer without blocking.

Alternatively, if you wish to block until enough data has been decoded, you can call read() at any time to block until a buffer is ready.

See also read().

void QAudioDecoder::stop() [slot]

Stop decoding audio. Calling start() again will resume decoding from the beginning.

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