galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::media::Video Class Referencefinal

Plays an MPEG-1 video. More...

#include <Video.hpp>

+ Collaboration diagram for galaxy::media::Video:

Public Member Functions

 Video ()
 Constructor.
 
 ~Video ()
 Destructor.
 
bool load (const std::string &file)
 Load a MPEG-1 from video file.
 
void build ()
 Build opengl data.
 
void update ()
 Update video decoder.
 
void render ()
 Render video.
 
bool is_finished () const
 Check if video is finished.
 
double get_time () const
 Get current playtime.
 
double get_framerate () const
 Get video framerate.
 
int get_samplerate () const
 Get video sample rate.
 
double get_duration () const
 Get video duration.
 

Private Member Functions

unsigned int create_texture (unsigned int index, const char *uniform)
 Internal function to generate video frame texture.
 
void update_texture (unsigned int unit, unsigned int texture, const plm_plane_t *plane)
 Internal function to update video frame data.
 

Private Attributes

plm_t * m_plm
 PLM decoder data.
 
ma_device * m_audio
 Audio data.
 
meta::vector< uint8_t > m_buffer
 Video data buffer.
 
std::unique_ptr< RingBuffer > m_audio_buffer
 Buffer for audio decoding.
 
unsigned int m_texture_y
 PLM video frame y.
 
unsigned int m_texture_cb
 PLM video frame cb.
 
unsigned int m_texture_cr
 PLM video frame cr.
 
unsigned int m_vao
 PLM video frame vertex array object.
 
unsigned int m_vbo
 PLM video frame vertex buffer.
 
unsigned int m_ibo
 PLM video frame index buffer.
 
graphics::Shader m_shader
 PLM video shader.
 

Detailed Description

Plays an MPEG-1 video.

No audio support yet.

Definition at line 26 of file Video.hpp.

Constructor & Destructor Documentation

◆ Video()

galaxy::media::Video::Video ( )

Constructor.

Definition at line 48 of file Video.cpp.

◆ ~Video()

galaxy::media::Video::~Video ( )

Destructor.

Definition at line 61 of file Video.cpp.

Member Function Documentation

◆ load()

bool galaxy::media::Video::load ( const std::string & file)
nodiscard

Load a MPEG-1 from video file.

Parameters
fileFile to load.
Returns
True if successful.

Definition at line 101 of file Video.cpp.

+ Here is the call graph for this function:

◆ build()

void galaxy::media::Video::build ( )

Build opengl data.

Definition at line 178 of file Video.cpp.

+ Here is the call graph for this function:

◆ update()

void galaxy::media::Video::update ( )

Update video decoder.

Definition at line 199 of file Video.cpp.

◆ render()

void galaxy::media::Video::render ( )

Render video.

Definition at line 212 of file Video.cpp.

+ Here is the call graph for this function:

◆ is_finished()

bool galaxy::media::Video::is_finished ( ) const
nodiscard

Check if video is finished.

Returns
True if finished.

Definition at line 221 of file Video.cpp.

◆ get_time()

double galaxy::media::Video::get_time ( ) const
nodiscard

Get current playtime.

Returns
In seconds.

Definition at line 231 of file Video.cpp.

◆ get_framerate()

double galaxy::media::Video::get_framerate ( ) const
nodiscard

Get video framerate.

Returns
Double.

Definition at line 241 of file Video.cpp.

◆ get_samplerate()

int galaxy::media::Video::get_samplerate ( ) const
nodiscard

Get video sample rate.

Returns
Int.

Definition at line 251 of file Video.cpp.

◆ get_duration()

double galaxy::media::Video::get_duration ( ) const
nodiscard

Get video duration.

Returns
Double.

Definition at line 261 of file Video.cpp.

◆ create_texture()

unsigned int galaxy::media::Video::create_texture ( unsigned int index,
const char * uniform )
private

Internal function to generate video frame texture.

Parameters
indexSampler index.
uniformShader uniform index.
Returns
Returns created texture id from OpenGL.

Definition at line 271 of file Video.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_texture()

void galaxy::media::Video::update_texture ( unsigned int unit,
unsigned int texture,
const plm_plane_t * plane )
private

Internal function to update video frame data.

Parameters
unitTexture unit.
textureGL texture handle.
planePLM decoder data.

Definition at line 292 of file Video.cpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_plm

plm_t* galaxy::media::Video::m_plm
private

PLM decoder data.

Definition at line 128 of file Video.hpp.

◆ m_audio

ma_device* galaxy::media::Video::m_audio
private

Audio data.

Definition at line 133 of file Video.hpp.

◆ m_buffer

meta::vector<uint8_t> galaxy::media::Video::m_buffer
private

Video data buffer.

Definition at line 138 of file Video.hpp.

◆ m_audio_buffer

std::unique_ptr<RingBuffer> galaxy::media::Video::m_audio_buffer
private

Buffer for audio decoding.

Definition at line 143 of file Video.hpp.

◆ m_texture_y

unsigned int galaxy::media::Video::m_texture_y
private

PLM video frame y.

Definition at line 148 of file Video.hpp.

◆ m_texture_cb

unsigned int galaxy::media::Video::m_texture_cb
private

PLM video frame cb.

Definition at line 153 of file Video.hpp.

◆ m_texture_cr

unsigned int galaxy::media::Video::m_texture_cr
private

PLM video frame cr.

Definition at line 158 of file Video.hpp.

◆ m_vao

unsigned int galaxy::media::Video::m_vao
private

PLM video frame vertex array object.

Definition at line 163 of file Video.hpp.

◆ m_vbo

unsigned int galaxy::media::Video::m_vbo
private

PLM video frame vertex buffer.

Definition at line 168 of file Video.hpp.

◆ m_ibo

unsigned int galaxy::media::Video::m_ibo
private

PLM video frame index buffer.

Definition at line 173 of file Video.hpp.

◆ m_shader

graphics::Shader galaxy::media::Video::m_shader
private

PLM video shader.

Definition at line 178 of file Video.hpp.


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