avcpp  2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
pixelformat.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <iostream>
5 
6 #include "averror.h"
7 #include "ffmpeg.h"
8 
9 extern "C" {
10 #include <libavutil/pixfmt.h>
11 #include <libavutil/pixdesc.h>
12 }
13 
14 // We need not to be back compatible:
15 #ifdef PixelFormat
16 #undef PixelFormat
17 #endif
18 
19 namespace av {
20 
26 class PixelFormat : public PixSampleFmtWrapper<PixelFormat, AVPixelFormat>
27 {
28 public:
30  using Parent::Parent;
31 
32  PixelFormat() = default;
33  explicit PixelFormat(const char* name) noexcept;
34  explicit PixelFormat(const std::string& name) noexcept;
35 
36  // Info functions
37  const char* name(OptionalErrorCode ec = throws()) const;
38 
39  const AVPixFmtDescriptor* descriptor(OptionalErrorCode ec = throws()) const;
40 
41  int bitsPerPixel(OptionalErrorCode ec = throws()) const;
42 
43  size_t planesCount(OptionalErrorCode ec = throws()) const;
44 
45  PixelFormat swapEndianness() const noexcept;
46 
47  // See FF_LOSS_xxx flags
48  size_t convertionLoss(PixelFormat dstFmt, bool srcHasAlpha = false) const noexcept;
49 };
50 
51 } // namespace av
52 
PixSampleFmtWrapper
Definition: ffmpeg.h:140
av::PixelFormat::convertionLoss
size_t convertionLoss(PixelFormat dstFmt, bool srcHasAlpha=false) const noexcept
Definition: pixelformat.cpp:61
averror.h
ffmpeg.h
av::PixelFormat::name
const char * name(OptionalErrorCode ec=throws()) const
Definition: pixelformat.cpp:15
av::OptionalErrorCode
Definition: averror.h:63
av::PixelFormat::swapEndianness
PixelFormat swapEndianness() const noexcept
Definition: pixelformat.cpp:56
av::PixelFormat::descriptor
const AVPixFmtDescriptor * descriptor(OptionalErrorCode ec=throws()) const
Definition: pixelformat.cpp:26
av::PixelFormat::bitsPerPixel
int bitsPerPixel(OptionalErrorCode ec=throws()) const
Definition: pixelformat.cpp:37
av::PixelFormat::PixelFormat
PixelFormat()=default
av::PixelFormat
The PixelFormat class is a simple wrapper for AVPixelFormat that allow to acces it it properties.
Definition: pixelformat.h:26
av
Definition: audioresampler.cpp:8
av::PixelFormat::planesCount
size_t planesCount(OptionalErrorCode ec=throws()) const
Definition: pixelformat.cpp:44