MythTV  master
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
AudioConvert Class Reference

#include <audioconvert.h>

Collaboration diagram for AudioConvert:
Collaboration graph
[legend]

Public Member Functions

 AudioConvert (AudioFormat in, AudioFormat out)
 
virtual ~AudioConvert ()
 
int Process (void *out, const void *in, int bytes, bool noclip=false)
 Process Parameters: out : destination buffer where converted samples will be copied in : source buffer bytes: size in bytes of source buffer. More...
 
AudioFormat Out (void)
 
AudioFormat In (void)
 
bool operator== (AudioConvert &rhs) const
 
bool operator!= (AudioConvert &rhs) const
 
void DeinterleaveSamples (int channels, uint8_t *output, const uint8_t *input, int data_size)
 
void InterleaveSamples (int channels, uint8_t *output, const uint8_t *const *input, int data_size)
 
void InterleaveSamples (int channels, uint8_t *output, const uint8_t *input, int data_size)
 

Static Public Member Functions

static int toFloat (AudioFormat format, void *out, const void *in, int bytes)
 Convert integer samples to floats. More...
 
static int fromFloat (AudioFormat format, void *out, const void *in, int bytes)
 Convert float samples to integers. More...
 
static void MonoToStereo (void *dst, const void *src, int samples)
 Convert a mono stream to stereo by copying and interleaving samples. More...
 
static void DeinterleaveSamples (AudioFormat format, int channels, uint8_t *output, const uint8_t *input, int data_size)
 Deinterleave input samples Deinterleave audio samples and compact them. More...
 
static void InterleaveSamples (AudioFormat format, int channels, uint8_t *output, const uint8_t *const *input, int data_size)
 Interleave input samples Planar audio is contained in array of pointers Interleave audio samples (convert from planar format) More...
 
static void InterleaveSamples (AudioFormat format, int channels, uint8_t *output, const uint8_t *input, int data_size)
 Interleave input samples Interleave audio samples (convert from planar format) More...
 

Private Attributes

AudioConvertInternalm_ctx {nullptr}
 
AudioFormat m_in
 
AudioFormat m_out
 

Detailed Description

Definition at line 32 of file audioconvert.h.

Constructor & Destructor Documentation

◆ AudioConvert()

AudioConvert::AudioConvert ( AudioFormat  in,
AudioFormat  out 
)
inline

Definition at line 36 of file audioconvert.h.

◆ ~AudioConvert()

AudioConvert::~AudioConvert ( )
virtual

Definition at line 633 of file audioconvert.cpp.

Member Function Documentation

◆ Process()

int AudioConvert::Process ( void *  out,
const void *  in,
int  bytes,
bool  noclip = false 
)

Process Parameters: out : destination buffer where converted samples will be copied in : source buffer bytes: size in bytes of source buffer.

Convert samples from one format to another.

Return Value: size in bytes of samples converted or <= 0 if error

Consumes 'bytes' bytes from in and returns the numer of bytes written to out return negative number if error

Definition at line 645 of file audioconvert.cpp.

Referenced by AudioOutput::DecodeAudio().

◆ Out()

AudioFormat AudioConvert::Out ( void  )
inline

Definition at line 49 of file audioconvert.h.

Referenced by AudioOutput::DecodeAudio().

◆ In()

AudioFormat AudioConvert::In ( void  )
inline

Definition at line 50 of file audioconvert.h.

◆ operator==()

bool AudioConvert::operator== ( AudioConvert rhs) const
inline

Definition at line 52 of file audioconvert.h.

◆ operator!=()

bool AudioConvert::operator!= ( AudioConvert rhs) const
inline

Definition at line 54 of file audioconvert.h.

◆ DeinterleaveSamples() [1/2]

void AudioConvert::DeinterleaveSamples ( int  channels,
uint8_t *  output,
const uint8_t *  input,
int  data_size 
)

Definition at line 869 of file audioconvert.cpp.

Referenced by AudioOutputUtil::DeinterleaveSamples().

◆ InterleaveSamples() [1/4]

void AudioConvert::InterleaveSamples ( int  channels,
uint8_t *  output,
const uint8_t *const *  input,
int  data_size 
)

◆ InterleaveSamples() [2/4]

void AudioConvert::InterleaveSamples ( int  channels,
uint8_t *  output,
const uint8_t *  input,
int  data_size 
)

Definition at line 883 of file audioconvert.cpp.

◆ toFloat()

int AudioConvert::toFloat ( AudioFormat  format,
void *  out,
const void *  in,
int  bytes 
)
static

Convert integer samples to floats.

Consumes 'bytes' bytes from in and returns the numer of bytes written to out

Definition at line 518 of file audioconvert.cpp.

Referenced by Process(), and AudioOutputUtil::toFloat().

◆ fromFloat()

int AudioConvert::fromFloat ( AudioFormat  format,
void *  out,
const void *  in,
int  bytes 
)
static

Convert float samples to integers.

Consumes 'bytes' bytes from in and returns the numer of bytes written to out

Definition at line 548 of file audioconvert.cpp.

Referenced by AudioOutputUtil::fromFloat(), and Process().

◆ MonoToStereo()

void AudioConvert::MonoToStereo ( void *  dst,
const void *  src,
int  samples 
)
static

Convert a mono stream to stereo by copying and interleaving samples.

Definition at line 721 of file audioconvert.cpp.

Referenced by AudioOutputUtil::MonoToStereo().

◆ DeinterleaveSamples() [2/2]

void AudioConvert::DeinterleaveSamples ( AudioFormat  format,
int  channels,
uint8_t *  output,
const uint8_t *  input,
int  data_size 
)
static

Deinterleave input samples Deinterleave audio samples and compact them.

Definition at line 755 of file audioconvert.cpp.

◆ InterleaveSamples() [3/4]

void AudioConvert::InterleaveSamples ( AudioFormat  format,
int  channels,
uint8_t *  output,
const uint8_t *const *  input,
int  data_size 
)
static

Interleave input samples Planar audio is contained in array of pointers Interleave audio samples (convert from planar format)

Definition at line 824 of file audioconvert.cpp.

◆ InterleaveSamples() [4/4]

void AudioConvert::InterleaveSamples ( AudioFormat  format,
int  channels,
uint8_t *  output,
const uint8_t *  input,
int  data_size 
)
static

Interleave input samples Interleave audio samples (convert from planar format)

Definition at line 850 of file audioconvert.cpp.

Member Data Documentation

◆ m_ctx

AudioConvertInternal* AudioConvert::m_ctx {nullptr}
private

Definition at line 81 of file audioconvert.h.

Referenced by Process(), and ~AudioConvert().

◆ m_in

AudioFormat AudioConvert::m_in
private

◆ m_out

AudioFormat AudioConvert::m_out
private

Definition at line 82 of file audioconvert.h.

Referenced by operator!=(), operator==(), and Process().


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