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

Owner of an AVPixelFormat array allocated by FFmpeg. More...

#include <hwcontext.h>

Public Types

using iterator = PixelFormatRange::iterator
 Iterator type of the owned array.

Public Member Functions

 PixelFormatList ()=default
 Create an empty list.
 PixelFormatList (AVPixelFormat *formats) noexcept
 Take ownership of a format array allocated by FFmpeg.
 ~PixelFormatList ()
 Free the owned array.
 PixelFormatList (PixelFormatList &&other) noexcept
 Move the array out of another list.
PixelFormatList & operator= (PixelFormatList &&other) noexcept
 Move assignment: frees the current array and takes the other one.
 PixelFormatList (const PixelFormatList &)=delete
 Copying is disabled: the list owns its array.
PixelFormatList & operator= (const PixelFormatList &)=delete
 Copy assignment is disabled: the list owns its array.
PixelFormatRange range () const noexcept
 Non-owning view over the array.
iterator begin () const noexcept
 First format.
iterator end () const noexcept
 One past the last format.
size_t size () const noexcept
 Number of formats.
bool empty () const noexcept
 Whether the list has no formats.
std::vector< PixelFormat > toVector () const
 Copy the list into a vector.

Detailed Description

The class is a range itself. Iteration returns a non-owning view.

Constructor & Destructor Documentation

◆ PixelFormatList() [1/2]

av::hw::PixelFormatList::PixelFormatList ( AVPixelFormat * formats)
inlineexplicitnoexcept
Parameters
formatsarray terminated by AV_PIX_FMT_NONE, as returned by av_hwframe_transfer_get_formats() and friends; may be null
Note
The array is freed with av_freep() in the destructor. Do not free it yourself and do not pass an array you do not own.

◆ PixelFormatList() [2/2]

av::hw::PixelFormatList::PixelFormatList ( PixelFormatList && other)
inlinenoexcept
Parameters
otherthe list to move from; left empty

Member Function Documentation

◆ begin()

iterator av::hw::PixelFormatList::begin ( ) const
inlinenoexcept
Returns
an iterator at the first element

◆ empty()

bool av::hw::PixelFormatList::empty ( ) const
inlinenoexcept
Returns
true when the list is empty

◆ end()

iterator av::hw::PixelFormatList::end ( ) const
inlinenoexcept
Returns
the past-the-end iterator

◆ operator=()

PixelFormatList & av::hw::PixelFormatList::operator= ( PixelFormatList && other)
noexcept
Parameters
otherthe list to move from; left empty
Returns
this list

◆ range()

PixelFormatRange av::hw::PixelFormatList::range ( ) const
inlinenoexcept
Returns
a view that is valid while this list is alive

◆ size()

size_t av::hw::PixelFormatList::size ( ) const
inlinenoexcept
Returns
the element count

◆ toVector()

std::vector< PixelFormat > av::hw::PixelFormatList::toVector ( ) const
inline
Returns
a vector with the same formats

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