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

All toFloat variants require 16 byte aligned input and output buffers on x86 for SSE optimised operation The SSE code processes 16 bytes at a time and leaves any remainder for the C. More...

#include <audiooutpututil.h>

Static Public Member Functions

static bool has_hardware_fpu ()
 Returns true if platform has an FPU. More...
 
static void AdjustVolume (void *buffer, int len, int volume, bool music, bool upmix)
 Adjust the volume of samples. More...
 
static void MuteChannel (int obits, int channels, int ch, void *buffer, int bytes)
 Mute individual channels through mono->stereo duplication. More...
 
static char * GeneratePinkFrames (char *frames, int channels, int channel, int count, int bits=16)
 
static int DecodeAudio (AVCodecContext *ctx, uint8_t *buffer, int &data_size, const AVPacket *pkt)
 DecodeAudio Decode an audio packet, and compact it if data is planar Return negative error code if an error occurred during decoding or the number of bytes consumed from the input AVPacket data_size contains the size of decoded data copied into buffer. More...
 
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...
 

Static Public Attributes

static const int MAX_SIZE_BUFFER = 192000
 MAX_SIZE_BUFFER is the maximum size of a buffer to be used with DecodeAudio. More...
 

Detailed Description

All toFloat variants require 16 byte aligned input and output buffers on x86 for SSE optimised operation The SSE code processes 16 bytes at a time and leaves any remainder for the C.

Definition at line 12 of file audiooutpututil.h.

Member Function Documentation

◆ has_hardware_fpu()

bool AudioOutputUtil::has_hardware_fpu ( )
static

Returns true if platform has an FPU.

for the time being, this test is limited to testing if SSE2 is supported

Definition at line 56 of file audiooutpututil.cpp.

Referenced by AvFormatDecoder::DecoderWillDownmix().

◆ AdjustVolume()

void AudioOutputUtil::AdjustVolume ( void *  buf,
int  len,
int  volume,
bool  music,
bool  upmix 
)
static

Adjust the volume of samples.

Makes a crude attempt to normalise the relative volumes of PCM from mythmusic, PCM from video and upmixed AC-3

Definition at line 101 of file audiooutpututil.cpp.

Referenced by AudioOutputBase::AddData().

◆ MuteChannel()

void AudioOutputUtil::MuteChannel ( int  obits,
int  channels,
int  ch,
void *  buffer,
int  bytes 
)
static

Mute individual channels through mono->stereo duplication.

Mute given channel (left or right) by copying right or left channel over.

Definition at line 178 of file audiooutpututil.cpp.

Referenced by AudioOutputBase::GetAudioData().

◆ GeneratePinkFrames()

char * AudioOutputUtil::GeneratePinkFrames ( char *  frames,
int  channels,
int  channel,
int  count,
int  bits = 16 
)
static

Definition at line 199 of file audiooutpututil.cpp.

Referenced by AudioTestThread::run().

◆ DecodeAudio()

int AudioOutputUtil::DecodeAudio ( AVCodecContext *  ctx,
uint8_t *  buffer,
int &  data_size,
const AVPacket *  pkt 
)
static

DecodeAudio Decode an audio packet, and compact it if data is planar Return negative error code if an error occurred during decoding or the number of bytes consumed from the input AVPacket data_size contains the size of decoded data copied into buffer.

Definition at line 243 of file audiooutpututil.cpp.

Referenced by MythRAOPConnection::decodeAudioPacket().

◆ toFloat()

int AudioOutputUtil::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 70 of file audiooutpututil.cpp.

Referenced by AudioOutputBase::AddData(), and AVFormatWriter::WriteAudioFrame().

◆ fromFloat()

int AudioOutputUtil::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 81 of file audiooutpututil.cpp.

Referenced by AudioOutputDigitalEncoder::Encode(), and AudioOutputBase::GetAudioData().

◆ MonoToStereo()

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

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

Definition at line 90 of file audiooutpututil.cpp.

Referenced by AudioOutputBase::CopyWithUpmix().

◆ DeinterleaveSamples()

void AudioOutputUtil::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 314 of file audiooutpututil.cpp.

Referenced by AudioOutputDigitalEncoder::Encode(), and AVFormatWriter::WriteAudioFrame().

◆ InterleaveSamples() [1/2]

void AudioOutputUtil::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 326 of file audiooutpututil.cpp.

Referenced by DecodeAudio().

◆ InterleaveSamples() [2/2]

void AudioOutputUtil::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 337 of file audiooutpututil.cpp.

Member Data Documentation

◆ MAX_SIZE_BUFFER

const int AudioOutputUtil::MAX_SIZE_BUFFER = 192000
static

MAX_SIZE_BUFFER is the maximum size of a buffer to be used with DecodeAudio.

Definition at line 28 of file audiooutpututil.h.

Referenced by NuppelDecoder::NuppelDecoder().


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