Miam-Player  0.8.0
A nice music player
QtAV::AudioFormat Class Reference

#include <AudioFormat.h>

Public Types

enum  SampleFormat {
  SampleFormat_Unknown = 0, SampleFormat_Input = SampleFormat_Unknown, SampleFormat_Unsigned8 = 1 | kUnsigned, SampleFormat_Signed8 = 1,
  SampleFormat_Unigned16 = 2 | kUnsigned, SampleFormat_Signed16 = 2, SampleFormat_Unsigned24 = 3 | kUnsigned, SampleFormat_Signed24 = 3,
  SampleFormat_Unsigned32 = 4 | kUnsigned, SampleFormat_Signed32 = 4, SampleFormat_Float = 4 | kFloat, SampleFormat_Double = 8 | kFloat,
  SampleFormat_Unsigned8Planar = SampleFormat_Unsigned8 | kPlanar, SampleFormat_Signed16Planar = SampleFormat_Signed16 | kPlanar, SampleFormat_Signed32Planar = SampleFormat_Signed32 | kPlanar, SampleFormat_FloatPlanar = SampleFormat_Float | kPlanar,
  SampleFormat_DoublePlanar = SampleFormat_Double | kPlanar
}
 The SampleFormat enum s8, u16, u24, s24, u32 are not listed in ffmpeg sample format and have not planar format. More...
 
enum  ChannelLayout {
  ChannelLayout_Left, ChannelLayout_Right, ChannelLayout_Center, ChannelLayout_Mono = ChannelLayout_Center,
  ChannelLayout_Stereo, ChannelLayout_Unsupported
}
 

Public Member Functions

 AudioFormat ()
 
 AudioFormat (const AudioFormat &other)
 
 ~AudioFormat ()
 
AudioFormatoperator= (const AudioFormat &other)
 
bool operator== (const AudioFormat &other) const
 
bool operator!= (const AudioFormat &other) const
 
bool isValid () const
 
bool isFloat () const
 
bool isUnsigned () const
 
bool isPlanar () const
 
int planeCount () const
 
void setSampleRate (int sampleRate)
 
int sampleRate () const
 
void setChannelLayoutFFmpeg (qint64 layout)
 setChannelLayout and setChannelLayoutFFmpeg also sets the correct channels if channels does not match. More...
 
qint64 channelLayoutFFmpeg () const
 
void setChannelLayout (ChannelLayout layout)
 
ChannelLayout channelLayout () const
 
QString channelLayoutName () const
 
void setChannels (int channels)
 setChannels also sets the default layout for this channels if channels does not match. More...
 
int channels () const
 channels For planar format, channel count == plane count. More...
 
void setSampleFormat (SampleFormat sampleFormat)
 
SampleFormat sampleFormat () const
 
void setSampleFormatFFmpeg (int ffSampleFormat)
 
int sampleFormatFFmpeg () const
 
QString sampleFormatName () const
 
qint32 bytesForDuration (qint64 duration) const
 
qint64 durationForBytes (qint32 byteCount) const
 
qint32 bytesForFrames (qint32 frameCount) const
 
qint32 framesForBytes (qint32 byteCount) const
 
qint32 framesForDuration (qint64 duration) const
 
qint64 durationForFrames (qint32 frameCount) const
 
int bytesPerFrame () const
 Returns the number of bytes required to represent one frame (a sample in each channel) in this format. More...
 
int bytesPerSample () const
 Returns the current sample size value, in bytes. More...
 
int sampleSize () const
 
int bitRate () const
 
int bytesPerSecond () const
 

Static Public Member Functions

static ChannelLayout channelLayoutFromFFmpeg (qint64 clff)
 
static qint64 channelLayoutToFFmpeg (ChannelLayout cl)
 
static SampleFormat sampleFormatFromFFmpeg (int fffmt)
 
static int sampleFormatToFFmpeg (SampleFormat fmt)
 
static bool isPlanar (SampleFormat format)
 
static SampleFormat planarSampleFormat (SampleFormat fmt)
 
static SampleFormat packedSampleFormat (SampleFormat fmt)
 

Member Enumeration Documentation

Enumerator
ChannelLayout_Left 
ChannelLayout_Right 
ChannelLayout_Center 
ChannelLayout_Mono 
ChannelLayout_Stereo 
ChannelLayout_Unsupported 

The SampleFormat enum s8, u16, u24, s24, u32 are not listed in ffmpeg sample format and have not planar format.

pcm_s24le will be decoded as s32-24bit in ffmpeg, it's encoded as 32 bits, but raw sample has 24 bits

Enumerator
SampleFormat_Unknown 
SampleFormat_Input 
SampleFormat_Unsigned8 
SampleFormat_Signed8 
SampleFormat_Unigned16 
SampleFormat_Signed16 
SampleFormat_Unsigned24 
SampleFormat_Signed24 
SampleFormat_Unsigned32 
SampleFormat_Signed32 
SampleFormat_Float 
SampleFormat_Double 
SampleFormat_Unsigned8Planar 
SampleFormat_Signed16Planar 
SampleFormat_Signed32Planar 
SampleFormat_FloatPlanar 
SampleFormat_DoublePlanar 

Constructor & Destructor Documentation

QtAV::AudioFormat::AudioFormat ( )
QtAV::AudioFormat::AudioFormat ( const AudioFormat other)
QtAV::AudioFormat::~AudioFormat ( )

Member Function Documentation

int QtAV::AudioFormat::bitRate ( ) const
qint32 QtAV::AudioFormat::bytesForDuration ( qint64  duration) const
qint32 QtAV::AudioFormat::bytesForFrames ( qint32  frameCount) const
int QtAV::AudioFormat::bytesPerFrame ( ) const

Returns the number of bytes required to represent one frame (a sample in each channel) in this format.

Returns 0 if this format is invalid.

int QtAV::AudioFormat::bytesPerSample ( ) const

Returns the current sample size value, in bytes.

See also
bytesPerFrame()
int QtAV::AudioFormat::bytesPerSecond ( ) const
ChannelLayout QtAV::AudioFormat::channelLayout ( ) const
qint64 QtAV::AudioFormat::channelLayoutFFmpeg ( ) const
static ChannelLayout QtAV::AudioFormat::channelLayoutFromFFmpeg ( qint64  clff)
static
QString QtAV::AudioFormat::channelLayoutName ( ) const
static qint64 QtAV::AudioFormat::channelLayoutToFFmpeg ( ChannelLayout  cl)
static
int QtAV::AudioFormat::channels ( ) const

channels For planar format, channel count == plane count.

For packed format, plane count is 1

Returns
qint64 QtAV::AudioFormat::durationForBytes ( qint32  byteCount) const
qint64 QtAV::AudioFormat::durationForFrames ( qint32  frameCount) const
qint32 QtAV::AudioFormat::framesForBytes ( qint32  byteCount) const
qint32 QtAV::AudioFormat::framesForDuration ( qint64  duration) const
bool QtAV::AudioFormat::isFloat ( ) const
static bool QtAV::AudioFormat::isPlanar ( SampleFormat  format)
static
bool QtAV::AudioFormat::isPlanar ( ) const
bool QtAV::AudioFormat::isUnsigned ( ) const
bool QtAV::AudioFormat::isValid ( ) const
bool QtAV::AudioFormat::operator!= ( const AudioFormat other) const
AudioFormat& QtAV::AudioFormat::operator= ( const AudioFormat other)
bool QtAV::AudioFormat::operator== ( const AudioFormat other) const
static SampleFormat QtAV::AudioFormat::packedSampleFormat ( SampleFormat  fmt)
static
static SampleFormat QtAV::AudioFormat::planarSampleFormat ( SampleFormat  fmt)
static
int QtAV::AudioFormat::planeCount ( ) const
SampleFormat QtAV::AudioFormat::sampleFormat ( ) const
int QtAV::AudioFormat::sampleFormatFFmpeg ( ) const
static SampleFormat QtAV::AudioFormat::sampleFormatFromFFmpeg ( int  fffmt)
static
QString QtAV::AudioFormat::sampleFormatName ( ) const
static int QtAV::AudioFormat::sampleFormatToFFmpeg ( SampleFormat  fmt)
static
int QtAV::AudioFormat::sampleRate ( ) const
int QtAV::AudioFormat::sampleSize ( ) const
void QtAV::AudioFormat::setChannelLayout ( ChannelLayout  layout)
void QtAV::AudioFormat::setChannelLayoutFFmpeg ( qint64  layout)

setChannelLayout and setChannelLayoutFFmpeg also sets the correct channels if channels does not match.

void QtAV::AudioFormat::setChannels ( int  channels)

setChannels also sets the default layout for this channels if channels does not match.

void QtAV::AudioFormat::setSampleFormat ( SampleFormat  sampleFormat)
void QtAV::AudioFormat::setSampleFormatFFmpeg ( int  ffSampleFormat)
void QtAV::AudioFormat::setSampleRate ( int  sampleRate)

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