HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
HephAudio::FFmpegAudioEncoder Class Referencefinal

implements audio encoding via FFmpeg. More...

#include <FFmpegAudioEncoder.h>

Inheritance diagram for HephAudio::FFmpegAudioEncoder:
HephAudio::IAudioEncoder

Public Member Functions

 FFmpegAudioEncoder ()
 
 FFmpegAudioEncoder (const std::filesystem::path &filePath, const AudioFormatInfo &outputFormatInfo, bool overwrite)
 
 FFmpegAudioEncoder (FFmpegAudioEncoder &&rhs) noexcept
 
 FFmpegAudioEncoder (const FFmpegAudioEncoder &)=delete
 
 ~FFmpegAudioEncoder ()
 
FFmpegAudioEncoderoperator= (const FFmpegAudioEncoder &)=delete
 
FFmpegAudioEncoderoperator= (FFmpegAudioEncoder &&rhs) noexcept
 
void ChangeFile (const std::filesystem::path &newAudioFilePath, const AudioFormatInfo &outputFormatInfo, bool overwrite) override
 
void CloseFile () override
 
bool IsFileOpen () const override
 
void Encode (const AudioBuffer &bufferToEncode) override
 
void Encode (const AudioBuffer &inputBuffer, EncodedAudioBuffer &outputBuffer) override
 
void Transcode (const EncodedAudioBuffer &inputBuffer, EncodedAudioBuffer &outputBuffer) override
 
- Public Member Functions inherited from HephAudio::IAudioEncoder
virtual ~IAudioEncoder ()=default
 

Static Public Member Functions

static void Transcode (const std::filesystem::path &inputFilePath, const std::filesystem::path &outputFilePath, bool overwrite)
 
static void Transcode (const std::filesystem::path &inputFilePath, const std::filesystem::path &outputFilePath, AudioFormatInfo outputFormatInfo, bool overwrite)
 

Additional Inherited Members

- Protected Attributes inherited from HephAudio::IAudioEncoder
std::filesystem::path filePath
 

Detailed Description

implements audio encoding via FFmpeg.

Constructor & Destructor Documentation

◆ FFmpegAudioEncoder() [1/3]

HephAudio::FFmpegAudioEncoder::FFmpegAudioEncoder ( )

creates a new instance and initializes it with default values.

◆ FFmpegAudioEncoder() [2/3]

HephAudio::FFmpegAudioEncoder::FFmpegAudioEncoder ( const std::filesystem::path & filePath,
const AudioFormatInfo & outputFormatInfo,
bool overwrite )

creates a new instance and initializes it with the provided values.

Parameters
filePathpath of the file that will be decoded.
outputFormatInfodescribes the output format.
overwriteindicates whether to write over the file if already exists.

◆ FFmpegAudioEncoder() [3/3]

HephAudio::FFmpegAudioEncoder::FFmpegAudioEncoder ( FFmpegAudioEncoder && rhs)
noexcept

creates a new instance and moves the rhs's data to it.

Parameters
rhsinstance whose data will be moved.

◆ ~FFmpegAudioEncoder()

HephAudio::FFmpegAudioEncoder::~FFmpegAudioEncoder ( )

releases the resources and destroys the instance.

Member Function Documentation

◆ ChangeFile()

void HephAudio::FFmpegAudioEncoder::ChangeFile ( const std::filesystem::path & newAudioFilePath,
const AudioFormatInfo & outputFormatInfo,
bool overwrite )
overridevirtual

changes the file that will store the encoded audio data.

Parameters
outputFormatInfotarget format.
overwriteindicates whether to write over the file if it already exists.

Implements HephAudio::IAudioEncoder.

◆ CloseFile()

void HephAudio::FFmpegAudioEncoder::CloseFile ( )
overridevirtual

closes the file and releases the resources allocated for encoding.

Implements HephAudio::IAudioEncoder.

◆ IsFileOpen()

bool HephAudio::FFmpegAudioEncoder::IsFileOpen ( ) const
overridevirtual

checks whether a file is currently open.

Returns
true if a file is currently open, otherwise false.

Implements HephAudio::IAudioEncoder.

◆ Encode() [1/2]

void HephAudio::FFmpegAudioEncoder::Encode ( const AudioBuffer & bufferToEncode)
overridevirtual

encodes the provided audio data and writes it to the file.

Implements HephAudio::IAudioEncoder.

◆ Encode() [2/2]

void HephAudio::FFmpegAudioEncoder::Encode ( const AudioBuffer & inputBuffer,
EncodedAudioBuffer & outputBuffer )
overridevirtual

encodes the provided audio data and writes it to the outputBuffer.

Parameters
inputBufferthe buffer that contains the audio data that will be encoded.
outputBufferthe buffer that will store the encoded audio data.

Implements HephAudio::IAudioEncoder.

◆ Transcode()

void HephAudio::FFmpegAudioEncoder::Transcode ( const EncodedAudioBuffer & inputBuffer,
EncodedAudioBuffer & outputBuffer )
overridevirtual

transcodes the provided audio data and writes it to the outputBuffer.

Parameters
inputBufferthe buffer that contains the audio data that will be transcoded.
outputBufferthe buffer that will store the transcoded audio data.

Implements HephAudio::IAudioEncoder.