FfmpegFrame.H File Reference

#include "Util/Types.H"
#include "Video/VideoFormat.H"
#include <libavcodec/avcodec.h>
Include dependency graph for FfmpegFrame.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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.

Detailed Description

Conversions between ffmpeg's AVFrame and our VideoFrame

Definition in file FfmpegFrame.H.


Function Documentation

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().

Generated on Sun May 8 08:42:53 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3