mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Play looping MP4 behind auth screen
This commit is contained in:
parent
77a21609a8
commit
8c3aa6542e
6 changed files with 352 additions and 0 deletions
51
include/rendering/video_player.hpp
Normal file
51
include/rendering/video_player.hpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
typedef unsigned int GLuint;
|
||||
|
||||
namespace wowee {
|
||||
namespace rendering {
|
||||
|
||||
class VideoPlayer {
|
||||
public:
|
||||
VideoPlayer();
|
||||
~VideoPlayer();
|
||||
|
||||
bool open(const std::string& path);
|
||||
void update(float deltaTime);
|
||||
void close();
|
||||
|
||||
bool isReady() const { return textureReady; }
|
||||
GLuint getTextureId() const { return textureId; }
|
||||
int getWidth() const { return width; }
|
||||
int getHeight() const { return height; }
|
||||
|
||||
private:
|
||||
bool decodeNextFrame();
|
||||
void uploadFrame();
|
||||
|
||||
void* formatCtx = nullptr;
|
||||
void* codecCtx = nullptr;
|
||||
void* frame = nullptr;
|
||||
void* rgbFrame = nullptr;
|
||||
void* packet = nullptr;
|
||||
void* swsCtx = nullptr;
|
||||
|
||||
int videoStreamIndex = -1;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
double frameTime = 1.0 / 30.0;
|
||||
double accumulator = 0.0;
|
||||
bool eof = false;
|
||||
|
||||
GLuint textureId = 0;
|
||||
bool textureReady = false;
|
||||
std::string sourcePath;
|
||||
std::vector<uint8_t> rgbBuffer;
|
||||
};
|
||||
|
||||
} // namespace rendering
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue