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

Wrapper for AVHWDeviceType. More...

#include <hwcontext.h>

Public Member Functions

constexpr DeviceType (AVHWDeviceType type=AV_HWDEVICE_TYPE_NONE) noexcept
 Wrap an FFmpeg device type.
 operator AVHWDeviceType () const noexcept
 Implicit conversion to the FFmpeg type, so the wrapper can be passed to FFmpeg calls unchanged.
AVHWDeviceType get () const noexcept
 The wrapped FFmpeg type.
bool isNone () const noexcept
 Whether the wrapper holds no device type.
const char * name () const noexcept
 FFmpeg name of the device type, or "none".

Static Public Member Functions

static DeviceType fromName (const char *name) noexcept
 Look a device type up by its FFmpeg name.
static DeviceType fromName (const std::string &name) noexcept
 Look a device type up by its FFmpeg name.

Detailed Description

Device types are looked up by name at runtime, so the wrapper works with FFmpeg versions that do not know newer enum values.

Examples
api2-hw-decode.cpp, api2-hw-encode.cpp, api2-hw-probe.cpp, api2-hw-scale.cpp, and api2-hw-transcode.cpp.

Constructor & Destructor Documentation

◆ DeviceType()

av::hw::DeviceType::DeviceType ( AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE)
inlineconstexprnoexcept
Parameters
typethe FFmpeg type to wrap; the default means "none"

Member Function Documentation

◆ fromName() [1/2]

DeviceType av::hw::DeviceType::fromName ( const char * name)
staticnoexcept

Lookup is by name on purpose: the code does not depend on enumeration values that older FFmpeg versions do not have.

Parameters
namea null-terminated name such as "vaapi"; must not be null
Returns
the matching type, or a "none" wrapper when FFmpeg does not know the name or the backend is not compiled in
Examples
api2-hw-decode.cpp, api2-hw-encode.cpp, api2-hw-scale.cpp, and api2-hw-transcode.cpp.

◆ fromName() [2/2]

DeviceType av::hw::DeviceType::fromName ( const std::string & name)
staticnoexcept
Parameters
namea name such as "vaapi"
Returns
the matching type, or a "none" wrapper when the name is unknown or the backend is not compiled in

◆ get()

AVHWDeviceType av::hw::DeviceType::get ( ) const
inlinenoexcept
Returns
the wrapped AVHWDeviceType

◆ isNone()

bool av::hw::DeviceType::isNone ( ) const
inlinenoexcept
Returns
true when the wrapped value is AV_HWDEVICE_TYPE_NONE
Examples
api2-hw-decode.cpp, api2-hw-encode.cpp, api2-hw-scale.cpp, and api2-hw-transcode.cpp.

◆ name()

const char * av::hw::DeviceType::name ( ) const
noexcept
Returns
a static string owned by FFmpeg; do not free it
Examples
api2-hw-decode.cpp, and api2-hw-probe.cpp.

◆ operator AVHWDeviceType()

av::hw::DeviceType::operator AVHWDeviceType ( ) const
inlinenoexcept
Returns
the wrapped AVHWDeviceType

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