#include "Video/FfmpegFrame.H"
#include "Image/Image.H"
#include "Image/Pixels.H"
#include "Image/color_conversions.H"
#include "Video/VideoFrame.H"
#include "rutz/trace.h"
Go to the source code of this file.
Defines | |
#define | PIX_FMT_UYVY411 PIX_FMT_UYYVYY411 |
#define | PIX_FMT_RGBA32 PIX_FMT_RGB32 |
#define | PIX_FMT_YUV422 PIX_FMT_YUYV422 |
#define | PFCASE(X) case X: return std::string(#X); break |
Functions | |
static VideoFrame | yuv420p_to_VideoFrame (const AVFrame *pic, const PixelFormat fmt, const Dims &dims) |
static VideoFrame | yuv422p_to_VideoFrame (const AVFrame *pic, const PixelFormat fmt, const Dims &dims) |
static VideoFrame | yuv411p_to_VideoFrame (const AVFrame *pic, const PixelFormat fmt, const Dims &dims) |
VideoFormat | convertAVPixelFormatToVideoFormat (const PixelFormat fmt) |
Get the VideoFormat enum that corresponds to ffmpeg's PixelFormat enum. | |
VideoFrame | convertAVFrameToVideoFrame (const AVFrame *pic, const PixelFormat fmt, const Dims &dims) |
Make a VideoFrame from an AVFrame from ffmpeg. | |
Image< PixRGB< byte > > | convertAVFrameToRGB (const AVFrame *pic, const PixelFormat fmt, const Dims &dims) |
Make a color Image from an AVFrame from ffmpeg. | |
bool | convertVideoFrameToAVFrame (const VideoFrame &vidframe, const PixelFormat fmt, AVFrame *pic) |
Fill an ffmpeg AVFrame from a VideoFrame. | |
std::string | convertToString (const PixelFormat fmt) |
Conversion from ffmpeg's PixelFormat enum to string. |
Conversions between ffmpeg's AVFrame and our VideoFrame
Definition in file FfmpegFrame.C.
Image<PixRGB<byte> > convertAVFrameToRGB | ( | const AVFrame * | pic, | |
const PixelFormat | fmt, | |||
const Dims & | dims | |||
) |
Make a color Image from an AVFrame from ffmpeg.
Definition at line 271 of file FfmpegFrame.C.
References convertAVFrameToVideoFrame(), Image< T >::getArrayPtr(), Dims::h(), Dims::isEmpty(), VideoFrame::toRgb(), Dims::w(), and ZEROS.
Referenced by FfmpegPacketDecoder::readRGB(), and FfmpegDecoder::readRGB().
VideoFrame convertAVFrameToVideoFrame | ( | const AVFrame * | pic, | |
const PixelFormat | fmt, | |||
const Dims & | dims | |||
) |
Make a VideoFrame from an AVFrame from ffmpeg.
The returned VideoFrame object will contain a private copy of the data from the AVFrame, so it is safe to reuse or discard the AVFrame object after calling this function.
Definition at line 246 of file FfmpegFrame.C.
Referenced by convertAVFrameToRGB(), FfmpegDecoder::readVideoFrame(), FfmpegPacketDecoder::readVideoFrame(), and RTSPGrabber::run().
VideoFormat convertAVPixelFormatToVideoFormat | ( | const PixelFormat | fmt | ) |
Get the VideoFormat enum that corresponds to ffmpeg's PixelFormat enum.
Definition at line 225 of file FfmpegFrame.C.
Referenced by FfmpegPacketDecoder::peekFrameSpec(), and FfmpegDecoder::peekFrameSpec().
std::string convertToString | ( | const PixelFormat | fmt | ) |
Conversion from ffmpeg's PixelFormat enum to string.
< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
< Packed pixel, Y0 Cb Y1 Cr
< Packed pixel, 3 bytes per pixel, RGBRGB...
< Packed pixel, 3 bytes per pixel, BGRBGR...
< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
< always stored in cpu endianness
< always stored in cpu endianness, most significant bit to 1
< 0 is white
< 0 is black
< 8 bit with RGBA palette
< Planar YUV 4:2:0 full scale (jpeg)
< Planar YUV 4:2:2 full scale (jpeg)
< Planar YUV 4:4:4 full scale (jpeg)
< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
Definition at line 357 of file FfmpegFrame.C.
bool convertVideoFrameToAVFrame | ( | const VideoFrame & | vidframe, | |
const PixelFormat | fmt, | |||
AVFrame * | pic | |||
) |
Fill an ffmpeg AVFrame from a VideoFrame.
Returns true if there was a successful conversion, false otherwise -- conversion can fail if vidframe.getMode() doesn't match the requested PixelFormat; in that case your best bet is to just convert the VideoFrame to RGB with vidframe.toRgb() and then do your work in RGB mode instead.
Definition at line 299 of file FfmpegFrame.C.
References VideoFrame::getBuffer(), VideoFrame::getDims(), VideoFrame::getMode(), Dims::h(), and Dims::w().