|
avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
|
The SampleFormat class is a simple proxy class for AVSampleFormat. More...
#include <sampleformat.h>
Public Types | |
| enum | Alignment { AlignDefault = 0 , AlignNone = 1 } |
| Alignment expected from a sample buffer. More... | |
| using | Parent = PixSampleFmtWrapper<SampleFormat, AVSampleFormat> |
| The wrapper this type builds on. | |
Public Member Functions | |
| SampleFormat ()=default | |
| Create an unset format, equivalent to AV_SAMPLE_FMT_NONE. | |
| SampleFormat (const char *name) noexcept | |
| Look a sample format up by name. | |
| SampleFormat (const std::string &name) noexcept | |
| Look a sample format up by name. | |
| const char * | name (OptionalErrorCode ec=throws()) const |
| Name of the format. | |
| SampleFormat | alternativeSampleFormat (bool isPlanar) const noexcept |
| The same numeric type in the requested layout. | |
| SampleFormat | packedSampleFormat () const noexcept |
| The packed variant of this format. | |
| SampleFormat | planarSampleFormat () const noexcept |
| The planar variant of this format. | |
| bool | isPlanar () const noexcept |
| Whether the channels are stored in separate planes. | |
| size_t | bytesPerSample (OptionalErrorCode ec=throws()) const |
| Bytes needed for one sample of one channel. | |
| size_t | bitsPerSample (OptionalErrorCode ec=throws()) const |
| Bits per sample of one channel. | |
| size_t | requiredBufferSize (int nbChannels, int nbSamples, int align, OptionalErrorCode ec=throws()) const |
| Size of a buffer for the given amount of audio. | |
| size_t | requiredBufferSize (int nbChannels, int nbSamples, int align, int &lineSize, OptionalErrorCode ec=throws()) const |
| Size of a buffer for the given amount of audio, and its line size. | |
| Public Member Functions inherited from PixSampleFmtWrapper< SampleFormat, AVSampleFormat > | |
| constexpr | PixSampleFmtWrapper ()=default |
| Create a wrapper holding NoneValue. | |
| constexpr | PixSampleFmtWrapper (AVSampleFormat fmt) noexcept |
| Wrap a raw enum value. | |
| operator AVSampleFormat () const noexcept | |
| Implicit conversion to the FFmpeg enum. | |
| AVSampleFormat | get () const noexcept |
| The stored enum value. | |
| operator AVSampleFormat & () noexcept | |
| Mutable access to the stored value. | |
| SampleFormat & | operator= (AVSampleFormat fmt) noexcept |
| Assign a raw enum value. | |
| void | set (AVSampleFormat fmt) noexcept |
| Assign a raw enum value. | |
| operator AVSampleFormat () const noexcept | |
| Implicit conversion to the FFmpeg enum. | |
| operator AVSampleFormat & () noexcept | |
| Mutable access to the stored value. | |
Static Public Member Functions | |
| static size_t | requiredBufferSize (SampleFormat fmt, int nbChannels, int nbSamples, int align, OptionalErrorCode ec=throws()) |
| Size of a buffer for the given amount of audio. | |
| static size_t | requiredBufferSize (SampleFormat fmt, int nbChannels, int nbSamples, int align, int &lineSize, OptionalErrorCode ec=throws()) |
| Size of a buffer for the given amount of audio, and its line size. | |
| static void | fillArrays (uint8_t **audioData, int *linesize, const uint8_t *buf, int nbChannels, int nbSamples, SampleFormat fmt, int align, OptionalErrorCode ec=throws()) |
| Point the per-channel data pointers at a contiguous buffer. | |
| static void | setSilence (uint8_t **audioData, int offset, int nbSamples, int nbChannels, SampleFormat fmt) |
| Write silence into a buffer. | |
Additional Inherited Members | |
| Protected Attributes inherited from PixSampleFmtWrapper< SampleFormat, AVSampleFormat > | |
| AVSampleFormat | m_fmt |
| The stored enum value. | |
It allows to quckly ask some info about sample format. Only base one is provided. Audio sample format descriptor.
Describes how samples of one channel are stored: the numeric type, the interleaving, and therefore how much memory a buffer needs.
|
explicitnoexcept |
| name | the name FFmpeg uses, for example "s16" |
|
explicitnoexcept |
| name | the name FFmpeg uses, for example "s16" |
|
noexcept |
| isPlanar | true for a planar format, false for a packed one |
| size_t av::SampleFormat::bitsPerSample | ( | OptionalErrorCode | ec = throws() | ) | const |
Unlike bytesPerSample(), this reports the stored depth of the type, so a 24-bit sample in a 32-bit container reports 24.
| ec | holder for the error code |
| size_t av::SampleFormat::bytesPerSample | ( | OptionalErrorCode | ec = throws() | ) | const |
| ec | holder for the error code |
|
static |
| audioData | array that receives one pointer per plane |
| linesize | array that receives the line size per plane |
| buf | the buffer to split |
| nbChannels | number of channels |
| nbSamples | number of samples per channel |
| fmt | sample format |
| align | an Alignment value |
| ec | holder for the error code |
|
noexcept |
| const char * av::SampleFormat::name | ( | OptionalErrorCode | ec = throws() | ) | const |
| ec | holder for the error code; an unset format reports an error |
|
noexcept |
|
noexcept |
| size_t av::SampleFormat::requiredBufferSize | ( | int | nbChannels, |
| int | nbSamples, | ||
| int | align, | ||
| int & | lineSize, | ||
| OptionalErrorCode | ec = throws() ) const |
| nbChannels | number of channels |
| nbSamples | number of samples per channel |
| align | an Alignment value |
| lineSize | receives the size of one line in bytes |
| ec | holder for the error code |
| size_t av::SampleFormat::requiredBufferSize | ( | int | nbChannels, |
| int | nbSamples, | ||
| int | align, | ||
| OptionalErrorCode | ec = throws() ) const |
| nbChannels | number of channels |
| nbSamples | number of samples per channel |
| align | an Alignment value |
| ec | holder for the error code |
|
static |
| fmt | sample format |
| nbChannels | number of channels |
| nbSamples | number of samples per channel |
| align | an Alignment value |
| lineSize | receives the size of one line in bytes |
| ec | holder for the error code |
|
static |
| fmt | sample format |
| nbChannels | number of channels |
| nbSamples | number of samples per channel |
| align | an Alignment value |
| ec | holder for the error code |
|
static |
The silent value depends on the format: zero for unsigned samples and for floating point, the middle of the range for signed ones.
| audioData | per-plane data pointers |
| offset | offset in bytes to start at |
| nbSamples | number of samples per channel to silence |
| nbChannels | number of channels |
| fmt | sample format |