UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
FrameUploader Class Reference

#include <opengl_utils.hpp>

Collaboration diagram for FrameUploader:
Collaboration graph

Public Member Functions

void attach_dst_texture (Texture *tex)
 
void enable_pbo (bool enable)
 
std::vector< codec_t > get_supported_codecs ()
 
void put_frame (video_frame *f, bool pbo_frame=false)
 

Private Attributes

codec_t configured_codec = VIDEO_CODEC_NONE
 
std::unique_ptr< Frame_convertor > conv
 
Texture * tex = nullptr
 
std::unique_ptr< GlBuffer > upload_pbo
 

Detailed Description

Class which takes an ultragrid video_frame and turns it into opengl texture

Definition at line 324 of file opengl_utils.hpp.

Member Function Documentation

◆ attach_dst_texture()

void FrameUploader::attach_dst_texture ( Texture * tex)
inline

Definition at line 327 of file opengl_utils.hpp.

327{ this->tex = tex; }

References tex.

Referenced by FlatVideoScene::init(), and PanoramaScene::put_frame().

◆ enable_pbo()

void FrameUploader::enable_pbo ( bool enable)
inline

Definition at line 329 of file opengl_utils.hpp.

329 {
330 if(enable)
331 upload_pbo = std::make_unique<GlBuffer>();
332 else
333 upload_pbo.reset();
334 }
std::unique_ptr< GlBuffer > upload_pbo

References upload_pbo.

Referenced by FlatVideoScene::init().

◆ get_supported_codecs()

std::vector< codec_t > FrameUploader::get_supported_codecs ( )

Definition at line 340 of file opengl_utils.cpp.

340 {
341 std::vector<codec_t> ret;
342
343 ret.push_back(RGB);
344 ret.push_back(RGBA);
345
347 ret.insert(ret.end(), cvt.begin(), cvt.end());
348
349 return ret;
350}
std::vector< codec_t > get_convertor_supported_codecs()
@ RGB
RGB 8-bit (packed into 24-bit word)
Definition types.h:80
@ RGBA
RGBA 8-bit, big-endian.
Definition types.h:70

References get_convertor_supported_codecs(), RGB, and RGBA.

Referenced by PanoramaScene::get_codecs().

Here is the call graph for this function:

◆ put_frame()

void FrameUploader::put_frame ( video_frame * f,
bool pbo_frame = false )

Definition at line 321 of file opengl_utils.cpp.

321 {
322 assert(tex);
323 tex->allocate(f->tiles[0].width, f->tiles[0].height, GL_RGB);
324 glBindTexture(GL_TEXTURE_2D, tex->get());
325 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
326 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
327 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
328 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
329
330 if(!conv || f->color_spec != configured_codec){
332 conv->set_pbo(upload_pbo.get());
334 }
335 assert(conv && "Frame uploader for codec not A;");
336 conv->attach_texture(*tex);
337 conv->put_frame(f, pbo_frame);
338}
std::unique_ptr< Frame_convertor > conv
codec_t configured_codec
GLuint get() const
void allocate(int w, int h, GLint internal_fmt)
std::unique_ptr< Frame_convertor > get_convertor_for_codec(codec_t codec)
unsigned int width
Definition types.h:280
unsigned int height
Definition types.h:281
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
Definition types.h:345
codec_t color_spec
Definition types.h:306

References Texture::allocate(), video_frame::color_spec, configured_codec, conv, Texture::get(), get_convertor_for_codec(), tile::height, tex, video_frame::tiles, upload_pbo, and tile::width.

Referenced by FlatVideoScene::put_frame(), and PanoramaScene::put_frame().

Here is the call graph for this function:

Member Data Documentation

◆ configured_codec

codec_t FrameUploader::configured_codec = VIDEO_CODEC_NONE
private

Definition at line 340 of file opengl_utils.hpp.

Referenced by put_frame().

◆ conv

std::unique_ptr<Frame_convertor> FrameUploader::conv
private

Definition at line 339 of file opengl_utils.hpp.

Referenced by put_frame().

◆ tex

Texture* FrameUploader::tex = nullptr
private

Definition at line 341 of file opengl_utils.hpp.

Referenced by attach_dst_texture(), and put_frame().

◆ upload_pbo

std::unique_ptr<GlBuffer> FrameUploader::upload_pbo
private

Definition at line 342 of file opengl_utils.hpp.

Referenced by enable_pbo(), and put_frame().


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