Miam-Player  0.8.0
A nice music player
QtAV::AudioOutputBackend Class Referenceabstract

#include <AudioOutputBackend.h>

Inheritance diagram for QtAV::AudioOutputBackend:

Public Types

enum  BufferControl {
  User = 0, Blocking = 1, BytesCallback = 1 << 1, CountCallback = 1 << 2,
  PlayedCount = 1 << 3, PlayedBytes = 1 << 4, OffsetIndex = 1 << 5, OffsetBytes = 1 << 6,
  WritableBytes = 1 << 7
}
 The BufferControl enum Used to adapt to different audio playback backend. More...
 

Signals

void volumeReported (qreal value)
 
void muteReported (bool value)
 

Public Member Functions

 AudioOutputBackend (AudioOutput::DeviceFeatures f, QObject *parent)
 AudioOutputBackend Specify supported features by the backend. More...
 
virtual ~AudioOutputBackend ()
 
virtual QString name () const =0
 
virtual bool open ()=0
 
virtual bool close ()=0
 
virtual bool write (const QByteArray &data)=0
 
virtual bool play ()=0
 
virtual bool flush ()
 
virtual bool clear ()
 
virtual bool isSupported (const AudioFormat &format) const
 
virtual bool isSupported (AudioFormat::SampleFormat) const
 
virtual bool isSupported (AudioFormat::ChannelLayout) const
 
virtual AudioFormat::SampleFormat preferredSampleFormat () const
 preferredSampleFormat More...
 
virtual AudioFormat::ChannelLayout preferredChannelLayout () const
 preferredChannelLayout More...
 
virtual BufferControl bufferControl () const =0
 
virtual void onCallback ()
 
virtual int getPlayedCount ()
 
virtual int getPlayedBytes ()
 getPlayedBytes reimplement this if bufferControl() is PlayedBytes. More...
 
virtual int getOffset ()
 
virtual int getOffsetByBytes ()
 
virtual int getWritableBytes ()
 
AudioOutput::DeviceFeatures supportedFeatures ()
 
virtual bool setVolume (qreal value)
 setVolume Set volume by backend api. More...
 
virtual qreal getVolume () const
 
virtual bool setMute (bool value=true)
 
virtual bool getMute () const
 

Static Public Member Functions

static QStringList defaultPriority ()
 
template<class C >
static bool Register (AudioOutputBackendId id, const char *name)
 
static AudioOutputBackendcreate (AudioOutputBackendId id)
 
static AudioOutputBackendcreate (const char *name)
 
static AudioOutputBackendIdnext (AudioOutputBackendId *id=0)
 next More...
 
static const char * name (AudioOutputBackendId id)
 
static AudioOutputBackendId id (const char *name)
 

Public Attributes

AudioOutputaudio
 
bool available
 
int buffer_size
 
int buffer_count
 
AudioFormat format
 

Member Enumeration Documentation

◆ BufferControl

The BufferControl enum Used to adapt to different audio playback backend.

Usually you don't need this in application level development.

Enumerator
User 
Blocking 
BytesCallback 
CountCallback 
PlayedCount 
PlayedBytes 
OffsetIndex 
OffsetBytes 
WritableBytes 

Constructor & Destructor Documentation

◆ AudioOutputBackend()

QtAV::AudioOutputBackend::AudioOutputBackend ( AudioOutput::DeviceFeatures  f,
QObject *  parent 
)

AudioOutputBackend Specify supported features by the backend.

Use this for new backends.

◆ ~AudioOutputBackend()

virtual QtAV::AudioOutputBackend::~AudioOutputBackend ( )
inlinevirtual

Member Function Documentation

◆ bufferControl()

virtual BufferControl QtAV::AudioOutputBackend::bufferControl ( ) const
pure virtual

◆ clear()

virtual bool QtAV::AudioOutputBackend::clear ( )
inlinevirtual

◆ close()

virtual bool QtAV::AudioOutputBackend::close ( )
pure virtual

◆ create() [1/2]

static AudioOutputBackend* QtAV::AudioOutputBackend::create ( AudioOutputBackendId  id)
static

◆ create() [2/2]

static AudioOutputBackend* QtAV::AudioOutputBackend::create ( const char *  name)
static

◆ defaultPriority()

static QStringList QtAV::AudioOutputBackend::defaultPriority ( )
static

◆ flush()

virtual bool QtAV::AudioOutputBackend::flush ( )
inlinevirtual

◆ getMute()

virtual bool QtAV::AudioOutputBackend::getMute ( ) const
inlinevirtual

◆ getOffset()

virtual int QtAV::AudioOutputBackend::getOffset ( )
inlinevirtual

◆ getOffsetByBytes()

virtual int QtAV::AudioOutputBackend::getOffsetByBytes ( )
inlinevirtual

◆ getPlayedBytes()

virtual int QtAV::AudioOutputBackend::getPlayedBytes ( )
inlinevirtual

getPlayedBytes reimplement this if bufferControl() is PlayedBytes.

Returns
the bytes played since last dequeue the buffer queue

◆ getPlayedCount()

virtual int QtAV::AudioOutputBackend::getPlayedCount ( )
inlinevirtual

◆ getVolume()

virtual qreal QtAV::AudioOutputBackend::getVolume ( ) const
inlinevirtual

◆ getWritableBytes()

virtual int QtAV::AudioOutputBackend::getWritableBytes ( )
inlinevirtual

◆ id()

static AudioOutputBackendId QtAV::AudioOutputBackend::id ( const char *  name)
static

◆ isSupported() [1/3]

virtual bool QtAV::AudioOutputBackend::isSupported ( const AudioFormat format) const
inlinevirtual

◆ isSupported() [2/3]

virtual bool QtAV::AudioOutputBackend::isSupported ( AudioFormat::SampleFormat  ) const
inlinevirtual

◆ isSupported() [3/3]

virtual bool QtAV::AudioOutputBackend::isSupported ( AudioFormat::ChannelLayout  ) const
inlinevirtual

◆ muteReported

void QtAV::AudioOutputBackend::muteReported ( bool  value)
signal

◆ name() [1/2]

virtual QString QtAV::AudioOutputBackend::name ( ) const
pure virtual

◆ name() [2/2]

static const char* QtAV::AudioOutputBackend::name ( AudioOutputBackendId  id)
static

◆ next()

static AudioOutputBackendId* QtAV::AudioOutputBackend::next ( AudioOutputBackendId id = 0)
static

next

Parameters
idNULL to get the first id address
Returns
address of id or NULL if not found/end

◆ onCallback()

virtual void QtAV::AudioOutputBackend::onCallback ( )
virtual

◆ open()

virtual bool QtAV::AudioOutputBackend::open ( )
pure virtual

◆ play()

virtual bool QtAV::AudioOutputBackend::play ( )
pure virtual

◆ preferredChannelLayout()

virtual AudioFormat::ChannelLayout QtAV::AudioOutputBackend::preferredChannelLayout ( ) const
inlinevirtual

preferredChannelLayout

Returns
the preferred channel layout. default is stereo

◆ preferredSampleFormat()

virtual AudioFormat::SampleFormat QtAV::AudioOutputBackend::preferredSampleFormat ( ) const
inlinevirtual

preferredSampleFormat

Returns
the preferred sample format. default is signed16 packed If the specified format is not supported, resample to preffered format

◆ Register()

template<class C >
static bool QtAV::AudioOutputBackend::Register ( AudioOutputBackendId  id,
const char *  name 
)
inlinestatic

◆ setMute()

virtual bool QtAV::AudioOutputBackend::setMute ( bool  value = true)
inlinevirtual

◆ setVolume()

virtual bool QtAV::AudioOutputBackend::setVolume ( qreal  value)
inlinevirtual

setVolume Set volume by backend api.

If backend can not set the given volume, or SetVolume feature is not set, software implemention will be used.

Parameters
value>=0
Returns
true if success

◆ supportedFeatures()

AudioOutput::DeviceFeatures QtAV::AudioOutputBackend::supportedFeatures ( )
inline

◆ volumeReported

void QtAV::AudioOutputBackend::volumeReported ( qreal  value)
signal

◆ write()

virtual bool QtAV::AudioOutputBackend::write ( const QByteArray &  data)
pure virtual

Member Data Documentation

◆ audio

AudioOutput* QtAV::AudioOutputBackend::audio

◆ available

bool QtAV::AudioOutputBackend::available

◆ buffer_count

int QtAV::AudioOutputBackend::buffer_count

◆ buffer_size

int QtAV::AudioOutputBackend::buffer_size

◆ format

AudioFormat QtAV::AudioOutputBackend::format

The documentation for this class was generated from the following file: