6 #include <libavcodec/avcodec.h>
7 #include <libavutil/pixdesc.h>
19 , _pixelFormat(pixelFormat)
63 LOG_WARN(
"Incorrect pixel format when get size of video frame: return a size of 0.")
69 throw std::runtime_error(
"unable to determine image buffer size");
79 os <<
"Unable to allocate an image frame of ";
80 os <<
"width = " << desc.
_width <<
", ";
81 os <<
"height = " << desc.
_height <<
", ";
83 throw std::runtime_error(os.str());
94 const int imageSize =
getSize();
95 unsigned char* imageBuffer =
new unsigned char[imageSize];
96 memset(imageBuffer, value, imageSize);
108 std::stringstream os;
110 throw std::runtime_error(os.str());
Description to create a video frame.
VideoFrame(const VideoFrameDesc &ref)
const std::string avProfileFrameRate
std::string getDescriptionFromErrorCode(const int code)
Get the string description corresponding to the error code provided by ffmpeg/libav.
std::map< std::string, std::string > Profile
AVPixelFormat getAVPixelFormat(const std::string &pixelFormat)
Get the corresponding AVPixelFormat from the pixel format name.
const std::string avProfilePixelFormat
AVPixelFormat _pixelFormat
AVPixelFormat getPixelFormat() const
void assign(const unsigned char value)
Assign the given value to all the data of the picture.
VideoFrameDesc(const size_t width=0, const size_t height=0, const AVPixelFormat pixelFormat=AV_PIX_FMT_NONE)
size_t getSize() const
in bytes/**
void allocateAVPicture(const VideoFrameDesc &desc)
Allocate the image buffer of the frame.
This class describes decoded (raw) audio or video data.
const std::string avProfileWidth
const std::string avProfileHeight
void setParameters(const ProfileLoader::Profile &profile)
Set the attributes from the given profile.