avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
av::ChannelLayout Class Reference

Owning channel layout. More...

#include <channellayout.h>

Inheritance diagram for av::ChannelLayout:

Public Member Functions

 ChannelLayout ()=default
 Create an empty layout that owns nothing.
 ChannelLayout (const ChannelLayoutView &view)
 Copy a view into an owning layout.
 ChannelLayout (const ChannelLayout &other)
 Deep copy of a layout.
ChannelLayout & operator= (const ChannelLayout &other)
 Deep copy assignment; the previous contents are released.
 ChannelLayout (ChannelLayout &&other)
 Move a layout.
ChannelLayout & operator= (ChannelLayout &&other)
 Move assignment; the previous contents are released.
 ~ChannelLayout ()
 Release the owned description.
 ChannelLayout (std::bitset< 64 > mask)
 Build a layout from a bit mask.
 ChannelLayout (const char *str)
 Build a layout from its textual form.
 ChannelLayout (int channels)
 Build the default layout for a channel count.
void release ()
 Give up control of the owned description.
 ChannelLayoutView () noexcept
 Create an empty, invalid view.
 ChannelLayoutView (const AVChannelLayout &layout) noexcept
 Wrap an FFmpeg channel layout.
Public Member Functions inherited from av::ChannelLayoutView
 ChannelLayoutView () noexcept
 Create an empty, invalid view.
 ChannelLayoutView (const AVChannelLayout &layout) noexcept
 Wrap an FFmpeg channel layout.
AVChannelLayout * raw ()
 The underlying FFmpeg layout, mutable.
const AVChannelLayout * raw () const
 The underlying FFmpeg layout, read-only.
int channels () const noexcept
 Number of channels in the layout.
uint64_t layout () const noexcept
 The layout as a bit mask when it can be expressed as one.
uint64_t subset (uint64_t mask) const noexcept
 Intersection of the layout with a mask.
bool isValid () const noexcept
 Whether the view refers to a usable layout.
std::string describe () const
 Text description of the layout.
void describe (std::string &desc) const
 Text description of the layout into an existing string.
int index (AVChannel channel) const
 Position of a speaker in the layout.
int index (const char *name) const
 Position of a speaker in the layout, by name.
AVChannel channel (unsigned int index) const
 Speaker at a position.
AVChannel channel (const char *name) const
 Speaker by name.
bool operator== (const ChannelLayoutView &other) const noexcept
 Compare two layouts.
ChannelLayout clone () const
 Deep copy of the layout.

Additional Inherited Members

Static Public Member Functions inherited from av::ChannelLayoutView
template<typename Callable>
static void iterate (Callable callable)
 Iterate the standard layouts FFmpeg knows about.
static void dumpLayouts ()
 Print every standard layout through the FFmpeg log system.
Protected Attributes inherited from av::ChannelLayoutView
AVChannelLayout m_layout {}
 The viewed layout; for the view it is a shallow copy of the descriptor.

Detailed Description

Holds the description allocated by FFmpeg and releases it on destruction; copying duplicates it, moving transfers it. release() exists for the case where the description is handed over to an FFmpeg structure that takes ownership.

Constructor & Destructor Documentation

◆ ChannelLayout() [1/6]

av::ChannelLayout::ChannelLayout ( const ChannelLayoutView & view)
explicit
Parameters
viewthe layout to copy

◆ ChannelLayout() [2/6]

av::ChannelLayout::ChannelLayout ( const ChannelLayout & other)
Parameters
otherthe layout to copy

◆ ChannelLayout() [3/6]

av::ChannelLayout::ChannelLayout ( ChannelLayout && other)
Parameters
otherthe layout to move from; left empty

◆ ChannelLayout() [4/6]

av::ChannelLayout::ChannelLayout ( std::bitset< 64 > mask)
explicit
Parameters
maskthe AV_CH_* bits that are present

◆ ChannelLayout() [5/6]

av::ChannelLayout::ChannelLayout ( const char * str)
explicit
Parameters
stra description such as "stereo" or "FL+FR+FC"; invalid input leaves the layout empty

◆ ChannelLayout() [6/6]

av::ChannelLayout::ChannelLayout ( int channels)
explicit
Parameters
channelsnumber of channels, for example 2 for stereo

Member Function Documentation

◆ ChannelLayoutView()

av::ChannelLayoutView::ChannelLayoutView ( const AVChannelLayout & layout)
noexcept

The conversion is implicit on purpose, so an AVChannelLayout can be passed where a view is expected.

Parameters
layoutthe layout to view; it must outlive the view

◆ operator=() [1/2]

ChannelLayout & av::ChannelLayout::operator= ( ChannelLayout && other)
Parameters
otherthe layout to move from; left empty
Returns
this layout

◆ operator=() [2/2]

ChannelLayout & av::ChannelLayout::operator= ( const ChannelLayout & other)
Parameters
otherthe layout to copy
Returns
this layout

◆ release()

void av::ChannelLayout::release ( )

Used after the layout has been moved into an FFmpeg structure that now owns it, so the destructor does not free it twice.


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