DDraceNetwork Docs
CVideo Class Reference

#include <video.h>

Inheritance diagram for CVideo:
[legend]
Collaboration diagram for CVideo:
[legend]

Classes

class  CAudioBuffer
 
class  CAudioRecorderThread
 
class  CVideoBuffer
 
class  CVideoRecorderThread
 

Public Member Functions

 CVideo (IGraphics *pGraphics, ISound *pSound, IStorage *pStorage, int Width, int Height, const char *pName)
 
 ~CVideo ()
 
bool Start () override REQUIRES(!g_WriteLock)
 
void Stop () override
 
void Pause (bool Pause) override
 
bool IsRecording () override
 
void NextVideoFrame () override
 
void NextVideoFrameThread () override
 
void NextAudioFrame (ISoundMixFunc Mix) override
 
void NextAudioFrameTimeline (ISoundMixFunc Mix) override
 
- Public Member Functions inherited from IVideo
virtual ~IVideo ()
 
virtual bool Start ()=0
 
virtual void Stop ()=0
 
virtual void Pause (bool Pause)=0
 
virtual bool IsRecording ()=0
 
virtual void NextVideoFrame ()=0
 
virtual void NextVideoFrameThread ()=0
 
virtual void NextAudioFrame (ISoundMixFunc Mix)=0
 
virtual void NextAudioFrameTimeline (ISoundMixFunc Mix)=0
 

Static Public Member Functions

static IVideoCurrent ()
 
static void Init ()
 
- Static Public Member Functions inherited from IVideo
static IVideoCurrent ()
 
static int64_t Time ()
 
static float LocalTime ()
 
static void SetLocalStartTime (int64_t LocalStartTime)
 
static void SetFPS (int FPS)
 

Private Member Functions

void RunVideoThread (size_t ParentThreadIndex, size_t ThreadIndex) REQUIRES(!g_WriteLock)
 
void FillVideoFrame (size_t ThreadIndex) REQUIRES(!g_WriteLock)
 
void UpdateVideoBufferFromGraphics (size_t ThreadIndex)
 
void RunAudioThread (size_t ParentThreadIndex, size_t ThreadIndex) REQUIRES(!g_WriteLock)
 
void FillAudioFrame (size_t ThreadIndex)
 
bool OpenVideo ()
 
bool OpenAudio ()
 
AVFrame * AllocPicture (enum AVPixelFormat PixFmt, int Width, int Height)
 
AVFrame * AllocAudioFrame (enum AVSampleFormat SampleFmt, uint64_t ChannelLayout, int SampleRate, int NbSamples)
 
void WriteFrame (COutputStream *pStream, size_t ThreadIndex) REQUIRES(g_WriteLock)
 
void FinishFrames (COutputStream *pStream)
 
void CloseStream (COutputStream *pStream)
 
bool AddStream (COutputStream *pStream, AVFormatContext *pFormatContext, const AVCodec **ppCodec, enum AVCodecID CodecId) const
 

Private Attributes

IGraphicsm_pGraphics
 
IStoragem_pStorage
 
ISoundm_pSound
 
int m_Width
 
int m_Height
 
char m_aName [256]
 
uint64_t m_VideoFrameIndex = 0
 
uint64_t m_AudioFrameIndex = 0
 
int m_FPS
 
bool m_Started
 
bool m_Stopped
 
bool m_Recording
 
size_t m_VideoThreads = 2
 
size_t m_CurVideoThreadIndex = 0
 
size_t m_AudioThreads = 2
 
size_t m_CurAudioThreadIndex = 0
 
std::vector< std::unique_ptr< CVideoRecorderThread > > m_vpVideoThreads
 
std::vector< std::unique_ptr< CAudioRecorderThread > > m_vpAudioThreads
 
std::atomic< int32_t > m_ProcessingVideoFrame
 
std::atomic< int32_t > m_ProcessingAudioFrame
 
bool m_HasAudio
 
std::vector< CVideoBufferm_vVideoBuffers
 
std::vector< CAudioBufferm_vAudioBuffers
 
COutputStream m_VideoStream
 
COutputStream m_AudioStream
 
const AVCodec * m_pVideoCodec
 
const AVCodec * m_pAudioCodec
 
AVDictionary * m_pOptDict
 
AVFormatContext * m_pFormatContext
 
const AVOutputFormat * m_pFormat
 

Additional Inherited Members

- Static Protected Attributes inherited from IVideo
static IVideoms_pCurrentVideo = 0
 
static int64_t ms_Time = 0
 
static int64_t ms_LocalStartTime = 0
 
static float ms_LocalTime = 0
 
static int64_t ms_TickTime = 0
 

Constructor & Destructor Documentation

◆ CVideo()

CVideo::CVideo ( IGraphics pGraphics,
ISound pSound,
IStorage pStorage,
int  Width,
int  Height,
const char *  pName 
)

◆ ~CVideo()

CVideo::~CVideo ( )

Member Function Documentation

◆ AddStream()

bool CVideo::AddStream ( COutputStream pStream,
AVFormatContext *  pFormatContext,
const AVCodec **  ppCodec,
enum AVCodecID  CodecId 
) const
private

◆ AllocAudioFrame()

AVFrame * CVideo::AllocAudioFrame ( enum AVSampleFormat  SampleFmt,
uint64_t  ChannelLayout,
int  SampleRate,
int  NbSamples 
)
private

◆ AllocPicture()

AVFrame * CVideo::AllocPicture ( enum AVPixelFormat  PixFmt,
int  Width,
int  Height 
)
private

◆ CloseStream()

void CVideo::CloseStream ( COutputStream pStream)
private

◆ Current()

static IVideo * CVideo::Current ( )
inlinestatic

◆ FillAudioFrame()

void CVideo::FillAudioFrame ( size_t  ThreadIndex)
private

◆ FillVideoFrame()

void CVideo::FillVideoFrame ( size_t  ThreadIndex)
private

◆ FinishFrames()

void CVideo::FinishFrames ( COutputStream pStream)
private

◆ Init()

void CVideo::Init ( )
static

◆ IsRecording()

bool CVideo::IsRecording ( )
inlineoverridevirtual

Implements IVideo.

◆ NextAudioFrame()

void CVideo::NextAudioFrame ( ISoundMixFunc  Mix)
overridevirtual

Implements IVideo.

◆ NextAudioFrameTimeline()

void CVideo::NextAudioFrameTimeline ( ISoundMixFunc  Mix)
overridevirtual

Implements IVideo.

◆ NextVideoFrame()

void CVideo::NextVideoFrame ( )
overridevirtual

Implements IVideo.

◆ NextVideoFrameThread()

void CVideo::NextVideoFrameThread ( )
overridevirtual

Implements IVideo.

◆ OpenAudio()

bool CVideo::OpenAudio ( )
private

◆ OpenVideo()

bool CVideo::OpenVideo ( )
private

◆ Pause()

void CVideo::Pause ( bool  Pause)
overridevirtual

Implements IVideo.

◆ RunAudioThread()

void CVideo::RunAudioThread ( size_t  ParentThreadIndex,
size_t  ThreadIndex 
)
private

◆ RunVideoThread()

void CVideo::RunVideoThread ( size_t  ParentThreadIndex,
size_t  ThreadIndex 
)
private

◆ Start()

bool CVideo::Start ( )
overridevirtual

Implements IVideo.

◆ Stop()

void CVideo::Stop ( )
overridevirtual

Implements IVideo.

◆ UpdateVideoBufferFromGraphics()

void CVideo::UpdateVideoBufferFromGraphics ( size_t  ThreadIndex)
private

◆ WriteFrame()

void CVideo::WriteFrame ( COutputStream pStream,
size_t  ThreadIndex 
)
private

Member Data Documentation

◆ m_aName

char CVideo::m_aName[256]
private

◆ m_AudioFrameIndex

uint64_t CVideo::m_AudioFrameIndex = 0
private

◆ m_AudioStream

COutputStream CVideo::m_AudioStream
private

◆ m_AudioThreads

size_t CVideo::m_AudioThreads = 2
private

◆ m_CurAudioThreadIndex

size_t CVideo::m_CurAudioThreadIndex = 0
private

◆ m_CurVideoThreadIndex

size_t CVideo::m_CurVideoThreadIndex = 0
private

◆ m_FPS

int CVideo::m_FPS
private

◆ m_HasAudio

bool CVideo::m_HasAudio
private

◆ m_Height

int CVideo::m_Height
private

◆ m_pAudioCodec

const AVCodec* CVideo::m_pAudioCodec
private

◆ m_pFormat

const AVOutputFormat* CVideo::m_pFormat
private

◆ m_pFormatContext

AVFormatContext* CVideo::m_pFormatContext
private

◆ m_pGraphics

IGraphics* CVideo::m_pGraphics
private

◆ m_pOptDict

AVDictionary* CVideo::m_pOptDict
private

◆ m_ProcessingAudioFrame

std::atomic<int32_t> CVideo::m_ProcessingAudioFrame
private

◆ m_ProcessingVideoFrame

std::atomic<int32_t> CVideo::m_ProcessingVideoFrame
private

◆ m_pSound

ISound* CVideo::m_pSound
private

◆ m_pStorage

IStorage* CVideo::m_pStorage
private

◆ m_pVideoCodec

const AVCodec* CVideo::m_pVideoCodec
private

◆ m_Recording

bool CVideo::m_Recording
private

◆ m_Started

bool CVideo::m_Started
private

◆ m_Stopped

bool CVideo::m_Stopped
private

◆ m_vAudioBuffers

std::vector<CAudioBuffer> CVideo::m_vAudioBuffers
private

◆ m_VideoFrameIndex

uint64_t CVideo::m_VideoFrameIndex = 0
private

◆ m_VideoStream

COutputStream CVideo::m_VideoStream
private

◆ m_VideoThreads

size_t CVideo::m_VideoThreads = 2
private

◆ m_vpAudioThreads

std::vector<std::unique_ptr<CAudioRecorderThread> > CVideo::m_vpAudioThreads
private

◆ m_vpVideoThreads

std::vector<std::unique_ptr<CVideoRecorderThread> > CVideo::m_vpVideoThreads
private

◆ m_vVideoBuffers

std::vector<CVideoBuffer> CVideo::m_vVideoBuffers
private

◆ m_Width

int CVideo::m_Width
private

The documentation for this class was generated from the following files: