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::FFmpegAudioDecoder Class Referencefinal

implements audio decoding via FFmpeg. More...

#include <FFmpegAudioDecoder.h>

Inheritance diagram for HephAudio::FFmpegAudioDecoder:
HephAudio::IAudioDecoder

Public Member Functions

 FFmpegAudioDecoder ()
 
 FFmpegAudioDecoder (const std::filesystem::path &filePath)
 
 FFmpegAudioDecoder (FFmpegAudioDecoder &&rhs) noexcept
 
 FFmpegAudioDecoder (const FFmpegAudioDecoder &)=delete
 
 ~FFmpegAudioDecoder ()
 
FFmpegAudioDecoderoperator= (const FFmpegAudioDecoder &)=delete
 
FFmpegAudioDecoderoperator= (FFmpegAudioDecoder &&rhs) noexcept
 
void ChangeFile (const std::filesystem::path &newFilePath) override
 
void CloseFile () override
 
bool IsFileOpen () const override
 
AudioFormatInfo GetOutputFormatInfo () const override
 
size_t GetFrameCount () const override
 
bool Seek (size_t frameIndex) override
 
AudioBuffer Decode () override
 
AudioBuffer Decode (size_t frameCount) override
 
AudioBuffer Decode (size_t frameIndex, size_t frameCount) override
 
AudioBuffer Decode (const EncodedAudioBuffer &encodedBuffer) override
 
- Public Member Functions inherited from HephAudio::IAudioDecoder
virtual ~IAudioDecoder ()=default
 

Additional Inherited Members

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

Detailed Description

implements audio decoding via FFmpeg.

Constructor & Destructor Documentation

◆ FFmpegAudioDecoder() [1/3]

HephAudio::FFmpegAudioDecoder::FFmpegAudioDecoder ( )

creates a new instance and initializes it with default values.

◆ FFmpegAudioDecoder() [2/3]

HephAudio::FFmpegAudioDecoder::FFmpegAudioDecoder ( const std::filesystem::path & filePath)

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

Parameters
filePathpath of the file that will be decoded.

◆ FFmpegAudioDecoder() [3/3]

HephAudio::FFmpegAudioDecoder::FFmpegAudioDecoder ( FFmpegAudioDecoder && rhs)
noexcept

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

Parameters
rhsinstance whose data will be moved.

◆ ~FFmpegAudioDecoder()

HephAudio::FFmpegAudioDecoder::~FFmpegAudioDecoder ( )

releases the resources and destroys the instance.

Member Function Documentation

◆ ChangeFile()

void HephAudio::FFmpegAudioDecoder::ChangeFile ( const std::filesystem::path & newFilePath)
overridevirtual

changes the decoded file.

Implements HephAudio::IAudioDecoder.

◆ CloseFile()

void HephAudio::FFmpegAudioDecoder::CloseFile ( )
overridevirtual

closes the file that's being decoded and releases the resources allocated for decoding.

Implements HephAudio::IAudioDecoder.

◆ IsFileOpen()

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

checks whether a file is currently open for decoding.

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

Implements HephAudio::IAudioDecoder.

◆ GetOutputFormatInfo()

AudioFormatInfo HephAudio::FFmpegAudioDecoder::GetOutputFormatInfo ( ) const
overridevirtual

gets the AudioFormatInfo the audio file will be decoded to.

Implements HephAudio::IAudioDecoder.

◆ GetFrameCount()

size_t HephAudio::FFmpegAudioDecoder::GetFrameCount ( ) const
overridevirtual

gets the number of audio frames the audio file contains.

Implements HephAudio::IAudioDecoder.

◆ Seek()

bool HephAudio::FFmpegAudioDecoder::Seek ( size_t frameIndex)
overridevirtual

seeks an audio frame in the file.

Parameters
frameIndexindex of the audio frame.
Returns
true if the frame is found, otherwise false.

Implements HephAudio::IAudioDecoder.

◆ Decode() [1/4]

AudioBuffer HephAudio::FFmpegAudioDecoder::Decode ( )
overridevirtual

decodes the audio file.

Implements HephAudio::IAudioDecoder.

◆ Decode() [2/4]

AudioBuffer HephAudio::FFmpegAudioDecoder::Decode ( size_t frameCount)
overridevirtual

decodes the audio file.

Parameters
frameCountnumber of frames to decode.

Implements HephAudio::IAudioDecoder.

◆ Decode() [3/4]

AudioBuffer HephAudio::FFmpegAudioDecoder::Decode ( size_t frameIndex,
size_t frameCount )
overridevirtual

decodes the specified portion of the audio file.

Parameters
frameIndexindex of the first frame that will be decoded.
frameCountnumber of frames to decode.

Implements HephAudio::IAudioDecoder.

◆ Decode() [4/4]

AudioBuffer HephAudio::FFmpegAudioDecoder::Decode ( const EncodedAudioBuffer & encodedBuffer)
overridevirtual

decodes the encoded audio data in the memory.

Parameters
encodedBufferthe buffer that contains the encoded audio data.

Implements HephAudio::IAudioDecoder.