Support Forum       G3D Web Page     
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::VideoOutput Class Reference

Creates video files such as mp4/h264 from provided frames or textures. More...

Inherits G3D::ReferenceCountedObject.

Classes

class  Encoder
 
class  Settings
 

Public Member Functions

 ~VideoOutput ()
 
void abort ()
 Aborts writing video file and ends encoding. More...
 
void append (const shared_ptr< Texture > &frame, bool invertY=false)
 
void append (const shared_ptr< PixelTransferBuffer > &frame)
 
void append (class RenderDevice *rd, bool useBackBuffer=false)
 Append the current frame on the RenderDevice to this video. More...
 
void commit ()
 Finishes writing video file and ends encoding. More...
 
const String & filename () const
 
bool finished ()
 
const Settings & settings () const
 

Static Public Member Functions

static shared_ptr< VideoOutput > create (const String &filename, const Settings &settings)
 Video files have a file format and a codec. More...
 

Protected Member Functions

 VideoOutput (const String &filename, const Settings &settings)
 
void encodeFrame (const uint8 *pixels, const ImageFormat *format)
 
bool initialize ()
 
void shutdown ()
 
bool validSettings ()
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

AVFilterContext * m_avBufferSink
 
AVFilterContext * m_avBufferSrc
 
AVFilterGraph * m_avFilterGraph
 
AVFormatContext * m_avFormatContext
 
AVDictionary * m_avOptions
 
AVCodecContext * m_avVideoContext
 
AVStream * m_avVideoStream
 
String m_filename
 
int m_framecount
 
bool m_isFinished
 
bool m_isInitialized
 
Settings m_settings
 

Detailed Description

Creates video files such as mp4/h264 from provided frames or textures.

Constructor & Destructor Documentation

◆ VideoOutput()

G3D::VideoOutput::VideoOutput ( const String &  filename,
const Settings &  settings 
)
protected

◆ ~VideoOutput()

G3D::VideoOutput::~VideoOutput ( )

Member Function Documentation

◆ abort()

void G3D::VideoOutput::abort ( )

Aborts writing video file and ends encoding.

◆ append() [1/3]

void G3D::VideoOutput::append ( const shared_ptr< Texture > &  frame,
bool  invertY = false 
)

◆ append() [2/3]

void G3D::VideoOutput::append ( const shared_ptr< PixelTransferBuffer > &  frame)

◆ append() [3/3]

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. to be replaced/removed.

◆ commit()

void G3D::VideoOutput::commit ( )

Finishes writing video file and ends encoding.

◆ create()

static shared_ptr<VideoOutput> G3D::VideoOutput::create ( const 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

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ encodeFrame()

void G3D::VideoOutput::encodeFrame ( const uint8 *  pixels,
const ImageFormat *  format 
)
protected

◆ filename()

const String& G3D::VideoOutput::filename ( ) const
inline

◆ finished()

bool G3D::VideoOutput::finished ( )
inline

◆ initialize()

bool G3D::VideoOutput::initialize ( )
protected

◆ settings()

const Settings& G3D::VideoOutput::settings ( ) const
inline

◆ shutdown()

void G3D::VideoOutput::shutdown ( )
protected

◆ validSettings()

bool G3D::VideoOutput::validSettings ( )
protected

Member Data Documentation

◆ m_avBufferSink

AVFilterContext* G3D::VideoOutput::m_avBufferSink
protected

◆ m_avBufferSrc

AVFilterContext* G3D::VideoOutput::m_avBufferSrc
protected

◆ m_avFilterGraph

AVFilterGraph* G3D::VideoOutput::m_avFilterGraph
protected

◆ m_avFormatContext

AVFormatContext* G3D::VideoOutput::m_avFormatContext
protected

◆ m_avOptions

AVDictionary* G3D::VideoOutput::m_avOptions
protected

◆ m_avVideoContext

AVCodecContext* G3D::VideoOutput::m_avVideoContext
protected

◆ m_avVideoStream

AVStream* G3D::VideoOutput::m_avVideoStream
protected

◆ m_filename

String G3D::VideoOutput::m_filename
protected

Referenced by filename().

◆ m_framecount

int G3D::VideoOutput::m_framecount
protected

◆ m_isFinished

bool G3D::VideoOutput::m_isFinished
protected

Referenced by finished().

◆ m_isInitialized

bool G3D::VideoOutput::m_isInitialized
protected

◆ m_settings

Settings G3D::VideoOutput::m_settings
protected

Referenced by settings().


documentation generated on Wed Nov 24 2021 08:02:02 using doxygen 1.8.15