Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
G3D::VideoOutput Class Reference

Saves video to disk in a variety of popular formats, including AVI and MPEG. More...

Inherits G3D::ReferenceCountedObject.

Classes

class  Settings
 

Public Types

enum  InternalCodecID {
  CODEC_ID_NONE,
  CODEC_ID_MPEG1VIDEO,
  CODEC_ID_MPEG2VIDEO,
  CODEC_ID_MPEG2VIDEO_XVMC,
  CODEC_ID_H261,
  CODEC_ID_H263,
  CODEC_ID_RV10,
  CODEC_ID_RV20,
  CODEC_ID_MJPEG,
  CODEC_ID_MJPEGB,
  CODEC_ID_LJPEG,
  CODEC_ID_SP5X,
  CODEC_ID_JPEGLS,
  CODEC_ID_MPEG4,
  CODEC_ID_RAWVIDEO,
  CODEC_ID_MSMPEG4V1,
  CODEC_ID_MSMPEG4V2,
  CODEC_ID_MSMPEG4V3,
  CODEC_ID_WMV1,
  CODEC_ID_WMV2,
  CODEC_ID_H263P,
  CODEC_ID_H263I,
  CODEC_ID_FLV1,
  CODEC_ID_SVQ1,
  CODEC_ID_SVQ3,
  CODEC_ID_DVVIDEO,
  CODEC_ID_HUFFYUV,
  CODEC_ID_CYUV,
  CODEC_ID_H264,
  CODEC_ID_INDEO3,
  CODEC_ID_VP3,
  CODEC_ID_THEORA,
  CODEC_ID_ASV1,
  CODEC_ID_ASV2,
  CODEC_ID_FFV1,
  CODEC_ID_4XM,
  CODEC_ID_VCR1,
  CODEC_ID_CLJR,
  CODEC_ID_MDEC,
  CODEC_ID_ROQ,
  CODEC_ID_INTERPLAY_VIDEO,
  CODEC_ID_XAN_WC3,
  CODEC_ID_XAN_WC4,
  CODEC_ID_RPZA,
  CODEC_ID_CINEPAK,
  CODEC_ID_WS_VQA,
  CODEC_ID_MSRLE,
  CODEC_ID_MSVIDEO1,
  CODEC_ID_IDCIN,
  CODEC_ID_8BPS,
  CODEC_ID_SMC,
  CODEC_ID_FLIC,
  CODEC_ID_TRUEMOTION1,
  CODEC_ID_VMDVIDEO,
  CODEC_ID_MSZH,
  CODEC_ID_ZLIB,
  CODEC_ID_QTRLE,
  CODEC_ID_SNOW,
  CODEC_ID_TSCC,
  CODEC_ID_ULTI,
  CODEC_ID_QDRAW,
  CODEC_ID_VIXL,
  CODEC_ID_QPEG,
  CODEC_ID_PNG,
  CODEC_ID_PPM,
  CODEC_ID_PBM,
  CODEC_ID_PGM,
  CODEC_ID_PGMYUV,
  CODEC_ID_PAM,
  CODEC_ID_FFVHUFF,
  CODEC_ID_RV30,
  CODEC_ID_RV40,
  CODEC_ID_VC1,
  CODEC_ID_WMV3,
  CODEC_ID_LOCO,
  CODEC_ID_WNV1,
  CODEC_ID_AASC,
  CODEC_ID_INDEO2,
  CODEC_ID_FRAPS,
  CODEC_ID_TRUEMOTION2,
  CODEC_ID_BMP,
  CODEC_ID_CSCD,
  CODEC_ID_MMVIDEO,
  CODEC_ID_ZMBV,
  CODEC_ID_AVS,
  CODEC_ID_SMACKVIDEO,
  CODEC_ID_NUV,
  CODEC_ID_KMVC,
  CODEC_ID_FLASHSV,
  CODEC_ID_CAVS,
  CODEC_ID_JPEG2000,
  CODEC_ID_VMNC,
  CODEC_ID_VP5,
  CODEC_ID_VP6,
  CODEC_ID_VP6F,
  CODEC_ID_TARGA,
  CODEC_ID_DSICINVIDEO,
  CODEC_ID_TIERTEXSEQVIDEO,
  CODEC_ID_TIFF,
  CODEC_ID_GIF,
  CODEC_ID_DXA,
  CODEC_ID_DNXHD,
  CODEC_ID_THP,
  CODEC_ID_SGI,
  CODEC_ID_C93,
  CODEC_ID_BETHSOFTVID,
  CODEC_ID_PTX,
  CODEC_ID_TXD,
  CODEC_ID_VP6A,
  CODEC_ID_AMV,
  CODEC_ID_VB,
  CODEC_ID_PCX,
  CODEC_ID_SUNRAST,
  CODEC_ID_INDEO4,
  CODEC_ID_INDEO5,
  CODEC_ID_MIMIC,
  CODEC_ID_RL2,
  CODEC_ID_ESCAPE124,
  CODEC_ID_DIRAC,
  CODEC_ID_BFI,
  CODEC_ID_CMV,
  CODEC_ID_MOTIONPIXELS,
  CODEC_ID_TGV,
  CODEC_ID_TGQ,
  CODEC_ID_TQI,
  CODEC_ID_AURA,
  CODEC_ID_AURA2,
  CODEC_ID_V210X,
  CODEC_ID_TMV,
  CODEC_ID_V210,
  CODEC_ID_DPX,
  CODEC_ID_MAD,
  CODEC_ID_FRWU,
  CODEC_ID_FLASHSV2,
  CODEC_ID_CDGRAPHICS,
  CODEC_ID_R210,
  CODEC_ID_ANM,
  CODEC_ID_BINKVIDEO,
  CODEC_ID_IFF_ILBM,
  CODEC_ID_IFF_BYTERUN1,
  CODEC_ID_KGV1,
  CODEC_ID_YOP,
  CODEC_ID_VP8,
  CODEC_ID_PICTOR,
  CODEC_ID_ANSI,
  CODEC_ID_A64_MULTI,
  CODEC_ID_A64_MULTI5,
  CODEC_ID_R10K,
  CODEC_ID_MXPEG,
  CODEC_ID_LAGARITH,
  CODEC_ID_PRORES,
  CODEC_ID_JV,
  CODEC_ID_DFA,
  CODEC_ID_WMV3IMAGE,
  CODEC_ID_VC1IMAGE,
  CODEC_ID_UTVIDEO,
  CODEC_ID_BMV_VIDEO,
  CODEC_ID_VBLE,
  CODEC_ID_DXTORY,
  CODEC_ID_V410,
  CODEC_ID_XWD,
  CODEC_ID_CDXL,
  CODEC_ID_XBM,
  CODEC_ID_ZEROCODEC,
  CODEC_ID_MSS1,
  CODEC_ID_MSA1,
  CODEC_ID_TSCC2,
  CODEC_ID_MTS2,
  CODEC_ID_CLLC,
  CODEC_ID_MSS2,
  CODEC_ID_LAST
}
 A mirror of AVCodecID defined by internal ffmpeg headers that we don't want to expose. More...
 
typedef shared_ptr< VideoOutputRef
 

Public Member Functions

 ~VideoOutput ()
 
void abort ()
 Aborts writing video file and ends encoding.
 
void append (const shared_ptr< Texture > &frame, bool invertY=false)
 
void append (const PixelTransferBuffer::Ref &frame)
 
void append (class RenderDevice *rd, bool useBackBuffer=false)
 Append the current frame on the RenderDevice to this video.
 
void append (shared_ptr< class VideoInput > in)
 Appends all frames from in, which must have the same dimensions as this.
 
void append (const Image1unorm8::Ref &frame)
 Reserved for future use.
 
void append (const Image3unorm8::Ref &frame)
 
void append (const Image4unorm8::Ref &frame)
 Reserved for future use.
 
void append (const Image1::Ref &frame)
 Reserved for future use.
 
void append (const Image3::Ref &frame)
 
void append (const Image4::Ref &frame)
 Reserved for future use.
 
void commit ()
 Finishes writing video file and ends encoding.
 
const std::stringfilename () const
 
bool finished ()
 

Static Public Member Functions

static Ref create (const std::string &filename, const Settings &settings)
 Video files have a file format and a codec.
 
static void getSupportedCodecs (Array< InternalCodecID > &c)
 Tests each codec for whether it is supported on this operating system.
 
static void getSupportedCodecs (Array< std::string > &c)
 
static bool supports (InternalCodecID c)
 Returns true if this operating system/G3D build supports this codec.
 
static const char * toString (InternalCodecID c)
 Returns a human readable name for the codec.
 

Protected Member Functions

 VideoOutput ()
 
const uint8convertFrame (const uint8 *frame, const ImageFormat *format, bool invertY)
 Flips the frame and adjusts format if needed.
 
void encodeFrame (const uint8 *frame, const ImageFormat *format, bool invertY=false)
 
void initialize (const std::string &filename, const Settings &settings)
 

Protected Attributes

uint8m_avEncodingBuffer
 
int m_avEncodingBufferSize
 
AVFormatContext * m_avFormatContext
 
uint8m_avInputBuffer
 
AVFrame * m_avInputFrame
 
AVOutputFormat * m_avOutputFormat
 
AVStream * m_avStream
 
std::string m_filename
 
bool m_isFinished
 
bool m_isInitialized
 
Settings m_settings
 
Array< uint8m_temp
 Used by convertFrame to hold the temporary frame being prepared for output.
 

Detailed Description

Saves video to disk in a variety of popular formats, including AVI and MPEG.

BETA API Likely to receive incompatible changes in future releases.

Member Typedef Documentation

typedef shared_ptr<VideoOutput> G3D::VideoOutput::Ref

Member Enumeration Documentation

A mirror of AVCodecID defined by internal ffmpeg headers that we don't want to expose.

Enumerator:
CODEC_ID_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ODEC_ID_PAM 
CODEC_ID_FFVHUFF 
CODEC_ID_RV30 
CODEC_ID_RV40 
CODEC_ID_VC1 
CODEC_ID_WMV3 
CODEC_ID_LOCO 
CODEC_ID_WNV1 
CODEC_ID_AASC 
CODEC_ID_INDEO2 
CODEC_ID_FRAPS 
CODEC_ID_TRUEMOTION2 
CODEC_ID_BMP 
CODEC_ID_CSCD 
CODEC_ID_MMVIDEO 
CODEC_ID_ZMBV 
CODEC_ID_AVS 
CODEC_ID_SMACKVIDEO 
CODEC_ID_NUV 
CODEC_ID_KMVC 
CODEC_ID_FLASHSV 
CODEC_ID_CAVS 
CODEC_ID_JPEG2000 
CODEC_ID_VMNC 
CODEC_ID_VP5 
CODEC_ID_VP6 
CODEC_ID_VP6F 
CODEC_ID_TARGA 
CODEC_ID_DSICINVIDEO 
CODEC_ID_TIERTEXSEQVIDEO 
CODEC_ID_TIFF 
CODEC_ID_GIF 
CODEC_ID_DXA 
CODEC_ID_DNXHD 
CODEC_ID_THP 
CODEC_ID_SGI 
CODEC_ID_C93 
CODEC_ID_BETHSOFTVID 
CODEC_ID_PTX 
CODEC_ID_TXD 
CODEC_ID_VP6A 
CODEC_ID_AMV 
CODEC_ID_VB 
CODEC_ID_PCX 
CODEC_ID_SUNRAST 
CODEC_ID_INDEO4 
CODEC_ID_INDEO5 
CODEC_ID_MIMIC 
CODEC_ID_RL2 
CODEC_ID_ESCAPE124 
CODEC_ID_DIRAC 
CODEC_ID_BFI 
CODEC_ID_CMV 
CODEC_ID_MOTIONPIXELS 
CODEC_ID_TGV 
CODEC_ID_TGQ 
CODEC_ID_TQI 
CODEC_ID_AURA 
CODEC_ID_AURA2 
CODEC_ID_V210X 
CODEC_ID_TMV 
CODEC_ID_V210 
CODEC_ID_DPX 
CODEC_ID_MAD 
CODEC_ID_FRWU 
CODEC_ID_FLASHSV2 
CODEC_ID_CDGRAPHICS 
CODEC_ID_R210 
CODEC_ID_ANM 
CODEC_ID_BINKVIDEO 
CODEC_ID_IFF_ILBM 
CODEC_ID_IFF_BYTERUN1 
CODEC_ID_KGV1 
CODEC_ID_YOP 
CODEC_ID_VP8 
CODEC_ID_PICTOR 
CODEC_ID_ANSI 
CODEC_ID_A64_MULTI 
CODEC_ID_A64_MULTI5 
CODEC_ID_R10K 
CODEC_ID_MXPEG 
CODEC_ID_LAGARITH 
CODEC_ID_PRORES 
CODEC_ID_JV 
CODEC_ID_DFA 
CODEC_ID_WMV3IMAGE 
CODEC_ID_VC1IMAGE 
CODEC_ID_UTVIDEO 
CODEC_ID_BMV_VIDEO 
CODEC_ID_VBLE 
CODEC_ID_DXTORY 
CODEC_ID_V410 
CODEC_ID_XWD 
CODEC_ID_CDXL 
CODEC_ID_XBM 
CODEC_ID_ZEROCODEC 
CODEC_ID_MSS1 
CODEC_ID_MSA1 
CODEC_ID_TSCC2 
CODEC_ID_MTS2 
CODEC_ID_CLLC 
CODEC_ID_MSS2 
CODEC_ID_LAST 

Constructor & Destructor Documentation

G3D::VideoOutput::VideoOutput ( )
protected
G3D::VideoOutput::~VideoOutput ( )

Member Function Documentation

void G3D::VideoOutput::abort ( )

Aborts writing video file and ends encoding.

void G3D::VideoOutput::append ( const shared_ptr< Texture > &  frame,
bool  invertY = false 
)
void G3D::VideoOutput::append ( const PixelTransferBuffer::Ref frame)
void G3D::VideoOutput::append ( class RenderDevice rd,
bool  useBackBuffer = false 
)

Append the current frame on the RenderDevice to this video.

Parameters
useBackBufferIf true, read from the back buffer (the current frame) instead of the front buffer.
void G3D::VideoOutput::append ( shared_ptr< class VideoInput in)

Appends all frames from in, which must have the same dimensions as this.

void G3D::VideoOutput::append ( const Image1unorm8::Ref frame)

Reserved for future use.

void G3D::VideoOutput::append ( const Image3unorm8::Ref frame)
void G3D::VideoOutput::append ( const Image4unorm8::Ref frame)

Reserved for future use.

void G3D::VideoOutput::append ( const Image1::Ref frame)

Reserved for future use.

void G3D::VideoOutput::append ( const Image3::Ref frame)
void G3D::VideoOutput::append ( const Image4::Ref frame)

Reserved for future use.

void G3D::VideoOutput::commit ( )

Finishes writing video file and ends encoding.

const uint8* G3D::VideoOutput::convertFrame ( const uint8 frame,
const ImageFormat format,
bool  invertY 
)
protected

Flips the frame and adjusts format if needed.

This routine does not support any planar input formats

static Ref G3D::VideoOutput::create ( const std::string filename,
const Settings settings 
)
static

Video files have a file format and a codec.

VideoOutput chooses the file format based on the filename's extension (e.g., .avi creates an AVI file) and the codec based on Settings::codec

void G3D::VideoOutput::encodeFrame ( const uint8 frame,
const ImageFormat format,
bool  invertY = false 
)
protected
const std::string& G3D::VideoOutput::filename ( ) const
inline
bool G3D::VideoOutput::finished ( )
inline
static void G3D::VideoOutput::getSupportedCodecs ( Array< InternalCodecID > &  c)
static

Tests each codec for whether it is supported on this operating system.

static void G3D::VideoOutput::getSupportedCodecs ( Array< std::string > &  c)
static
void G3D::VideoOutput::initialize ( const std::string filename,
const Settings settings 
)
protected
static bool G3D::VideoOutput::supports ( InternalCodecID  c)
static

Returns true if this operating system/G3D build supports this codec.

static const char* G3D::VideoOutput::toString ( InternalCodecID  c)
static

Returns a human readable name for the codec.

Member Data Documentation

uint8* G3D::VideoOutput::m_avEncodingBuffer
protected
int G3D::VideoOutput::m_avEncodingBufferSize
protected
AVFormatContext* G3D::VideoOutput::m_avFormatContext
protected
uint8* G3D::VideoOutput::m_avInputBuffer
protected
AVFrame* G3D::VideoOutput::m_avInputFrame
protected
AVOutputFormat* G3D::VideoOutput::m_avOutputFormat
protected
AVStream* G3D::VideoOutput::m_avStream
protected
std::string G3D::VideoOutput::m_filename
protected

Referenced by filename().

bool G3D::VideoOutput::m_isFinished
protected

Referenced by finished().

bool G3D::VideoOutput::m_isInitialized
protected
Settings G3D::VideoOutput::m_settings
protected
Array<uint8> G3D::VideoOutput::m_temp
protected

Used by convertFrame to hold the temporary frame being prepared for output.


documentation generated on Sat Jan 12 2013 22:49:57 using doxygen 1.8.2