libgpac
Documentation of the core library of GPAC
out_video.c File Reference
#include <gpac/filters.h>
#include <gpac/constants.h>
#include <gpac/modules/video_out.h>
#include <gpac/color.h>
#include "../compositor/gl_inc.h"
+ Include dependency graph for out_video.c:

Data Structures

struct  GF_VideoOutCtx
 

Macros

#define VOUT_USE_OPENGL
 
#define DEL_SHADER(_a)   if (_a) { glDeleteShader(_a); _a = 0; }
 
#define DEL_PROGRAM(_a)   if (_a) { glDeleteProgram(_a); _a = 0; }
 
#define GF_SHADERID   u32
 
#define DEF_VIDEO_AUDIO_ADVANCE_MS   15
 
#define OFFS(_n)   #_n, offsetof(GF_VideoOutCtx, _n)
 

Enumerations

enum  GF_VideoOutMode { MODE_GL , MODE_GL_PBO , MODE_2D , MODE_2D_SOFT }
 
enum  {
  FLIP_NO , FLIP_VERT , FLIP_HORIZ , FLIP_BOTH ,
  FLIP_BOTH2
}
 

Functions

static GF_Err vout_draw_frame (GF_VideoOutCtx *ctx)
 
static void vout_make_gl_current (GF_VideoOutCtx *ctx)
 
static Bool vout_compile_shader (GF_SHADERID shader_id, const char *name, const char *source)
 
static void vout_reset_overlay (GF_Filter *filter, GF_VideoOutCtx *ctx)
 
static void vout_set_caption (GF_VideoOutCtx *ctx)
 
static GF_Err resize_video_output (GF_VideoOutCtx *ctx, u32 dw, u32 dh)
 
static void load_gl_tx_matrix (GF_VideoOutCtx *ctx)
 
static GF_Err vout_configure_pid (GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
 
static Bool vout_on_event (void *cbk, GF_Event *evt)
 
GF_VideoOutputgf_filter_claim_opengl_provider (GF_Filter *filter)
 
Bool gf_filter_unclaim_opengl_provider (GF_Filter *filter, GF_VideoOutput *vout)
 
void gf_filter_load_script (GF_Filter *filter, const char *js_file, const char *filters_blacklist)
 
static GF_Err vout_initialize (GF_Filter *filter)
 
static void vout_finalize (GF_Filter *filter)
 
static void vout_draw_overlay (GF_VideoOutCtx *ctx)
 
static void vout_draw_gl_quad (GF_VideoOutCtx *ctx, Bool flip_texture)
 
static void vout_draw_gl_hw_textures (GF_VideoOutCtx *ctx, GF_FilterFrameInterface *hwf)
 
static void vbo_changed (GF_VideoOutCtx *ctx)
 
static void vout_draw_gl (GF_VideoOutCtx *ctx, GF_FilterPacket *pck)
 
void vout_draw_2d (GF_VideoOutCtx *ctx, GF_FilterPacket *pck)
 
static GF_Err vout_process (GF_Filter *filter)
 
static Bool vout_process_event (GF_Filter *filter, const GF_FilterEvent *fevt)
 
GF_Err vout_update_arg (GF_Filter *filter, const char *arg_name, const GF_PropertyValue *new_val)
 
const GF_FilterRegister * vout_register (GF_FilterSession *session)
 

Variables

static char * default_glsl_vertex
 
static u32 nb_vout_inst =0
 
static const GF_FilterArgs VideoOutArgs []
 
static const GF_FilterCapability VideoOutCaps []
 
GF_FilterRegister VideoOutRegister
 

Data Structure Documentation

◆ GF_VideoOutCtx

struct GF_VideoOutCtx
+ Collaboration diagram for GF_VideoOutCtx:
Data Fields
char * drv
u32 disp
Bool vsync
Bool linear
Bool fullscreen
Bool drop
Bool hide
Bool step
Bool vjs
Bool async
GF_Fraction64 dur
Double speed
Double hold
u32 back
u32 vflip
u32 vrot
GF_PropVec2i wsize
GF_PropVec2i owsize
GF_PropVec2i wpos
Double start
u32 buffer
u32 mbuffer
u32 rbuffer
u32 wid
GF_Fraction vdelay
const char * out
GF_PropUIntList dumpframes
char * oltxt
GF_PropVec4i olwnd
GF_PropVec2i olsize
GF_PropData oldata
Double media_offset
GF_Filter * filter
GF_FilterPid * pid
u32 width
u32 height
u32 stride
u32 pfmt
u32 timescale
GF_Fraction fps
GF_VideoOutput * video_out
u64 first_cts_plus_one
u64 clock_at_first_cts
u64 last_frame_clock
u64 clock_at_first_frame
u32 last_pck_dur_us
Bool aborted
u32 display_width
u32 display_height
Bool display_changed
Float dh
Float dw
Float oh
Float ow
Bool has_alpha
u32 nb_frames
u32 key_states
Float c_w
Float c_h
Float c_x
Float c_y
u32 raw_grab
GF_DisplayOrientationType screen_orientation
GLint glsl_program
GF_SHADERID vertex_shader
GF_SHADERID fragment_shader
GF_GLTextureWrapper tx
GLuint overlay_tx
GLuint vbo_vx
GLuint vbo_tx
u32 num_textures
u32 uv_w
u32 uv_h
u32 uv_stride
u32 bit_depth
Bool is_yuv
Bool in_fullscreen
u32 nb_drawn
GF_Fraction sar
Bool force_release
GF_FilterPacket * last_pck
s64 pid_delay
Bool buffer_done
Bool no_buffering
Bool dump_done
u32 dump_f_idx
char * dump_buffer
Bool force_vout
Bool do_seek
Bool update_oldata
Bool full_range
s32 cmx
u64 rebuffer
Bool force_reconfig_pid
u32 pid_vflip
u32 pid_vrot
Bool too_slow

Macro Definition Documentation

◆ VOUT_USE_OPENGL

#define VOUT_USE_OPENGL

◆ DEL_SHADER

#define DEL_SHADER (   _a)    if (_a) { glDeleteShader(_a); _a = 0; }

◆ DEL_PROGRAM

#define DEL_PROGRAM (   _a)    if (_a) { glDeleteProgram(_a); _a = 0; }

◆ GF_SHADERID

#define GF_SHADERID   u32

◆ DEF_VIDEO_AUDIO_ADVANCE_MS

#define DEF_VIDEO_AUDIO_ADVANCE_MS   15

◆ OFFS

#define OFFS (   _n)    #_n, offsetof(GF_VideoOutCtx, _n)

Enumeration Type Documentation

◆ GF_VideoOutMode

Enumerator
MODE_GL 
MODE_GL_PBO 
MODE_2D 
MODE_2D_SOFT 

◆ anonymous enum

anonymous enum
Enumerator
FLIP_NO 
FLIP_VERT 
FLIP_HORIZ 
FLIP_BOTH 
FLIP_BOTH2 

Function Documentation

◆ vout_draw_frame()

static GF_Err vout_draw_frame ( GF_VideoOutCtx ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vout_make_gl_current()

static void vout_make_gl_current ( GF_VideoOutCtx ctx)
static
+ Here is the caller graph for this function:

◆ vout_compile_shader()

static Bool vout_compile_shader ( GF_SHADERID  shader_id,
const char *  name,
const char *  source 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vout_reset_overlay()

static void vout_reset_overlay ( GF_Filter *  filter,
GF_VideoOutCtx ctx 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vout_set_caption()

static void vout_set_caption ( GF_VideoOutCtx ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resize_video_output()

static GF_Err resize_video_output ( GF_VideoOutCtx ctx,
u32  dw,
u32  dh 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_gl_tx_matrix()

static void load_gl_tx_matrix ( GF_VideoOutCtx ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vout_configure_pid()

static GF_Err vout_configure_pid ( GF_Filter *  filter,
GF_FilterPid *  pid,
Bool  is_remove 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vout_on_event()

static Bool vout_on_event ( void *  cbk,
GF_Event evt 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_claim_opengl_provider()

GF_VideoOutput* gf_filter_claim_opengl_provider ( GF_Filter *  filter)
+ Here is the caller graph for this function:

◆ gf_filter_unclaim_opengl_provider()

Bool gf_filter_unclaim_opengl_provider ( GF_Filter *  filter,
GF_VideoOutput vout 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_load_script()

void gf_filter_load_script ( GF_Filter *  filter,
const char *  js_file,
const char *  filters_blacklist 
)
+ Here is the caller graph for this function:

◆ vout_initialize()

static GF_Err vout_initialize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ vout_finalize()

static void vout_finalize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ vout_draw_overlay()

static void vout_draw_overlay ( GF_VideoOutCtx ctx)
static
+ Here is the caller graph for this function:

◆ vout_draw_gl_quad()

static void vout_draw_gl_quad ( GF_VideoOutCtx ctx,
Bool  flip_texture 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vout_draw_gl_hw_textures()

static void vout_draw_gl_hw_textures ( GF_VideoOutCtx ctx,
GF_FilterFrameInterface hwf 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vbo_changed()

static void vbo_changed ( GF_VideoOutCtx ctx)
static
+ Here is the caller graph for this function:

◆ vout_draw_gl()

static void vout_draw_gl ( GF_VideoOutCtx ctx,
GF_FilterPacket *  pck 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vout_draw_2d()

void vout_draw_2d ( GF_VideoOutCtx ctx,
GF_FilterPacket *  pck 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vout_process()

static GF_Err vout_process ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ vout_process_event()

static Bool vout_process_event ( GF_Filter *  filter,
const GF_FilterEvent *  fevt 
)
static
+ Here is the call graph for this function:

◆ vout_update_arg()

GF_Err vout_update_arg ( GF_Filter *  filter,
const char *  arg_name,
const GF_PropertyValue *  new_val 
)
+ Here is the call graph for this function:

◆ vout_register()

const GF_FilterRegister* vout_register ( GF_FilterSession *  session)

Variable Documentation

◆ default_glsl_vertex

char* default_glsl_vertex
static
Initial value:
= "\
attribute vec4 gfVertex;\n\
attribute vec4 gfTexCoord;\n\
uniform mat4 gfModViewProjMatrix;\n\
uniform mat4 gfTextureMatrix;\n\
uniform bool hasTextureMatrix;\n\
varying vec2 TexCoord;\n\
void main(void)\n\
{\n\
gl_Position = gfModViewProjMatrix * gfVertex;\n\
if (hasTextureMatrix) {\n\
TexCoord = vec2(gfTextureMatrix * gfTexCoord);\n\
} else {\n\
TexCoord = vec2(gfTexCoord);\n\
}\n\
}"

◆ nb_vout_inst

u32 nb_vout_inst =0
static

◆ VideoOutArgs

const GF_FilterArgs VideoOutArgs[]
static

◆ VideoOutCaps

const GF_FilterCapability VideoOutCaps[]
static
Initial value:
=
{
}
@ GF_CODECID_RAW
Definition: constants.h:600
@ GF_STREAM_VISUAL
Definition: constants.h:64
#define CAP_UINT(_f, _a, _b)
Definition: filters.h:2172
#define GF_CAPS_INPUT
Definition: filters.h:2220
@ GF_PROP_PID_CODECID
Definition: filters.h:1116
@ GF_PROP_PID_STREAM_TYPE
Definition: filters.h:1112

◆ VideoOutRegister

GF_FilterRegister VideoOutRegister
Initial value:
= {
.name = "vout",
GF_FS_SET_HELP("This filter displays a single visual input PID in a window.\n"
"The window is created unless a window handle (HWND, xWindow, etc) is indicated in the config file ( [Temp]OSWnd=ptr).\n"
"The output uses GPAC video output module indicated in [-drv]() option or in the config file (see GPAC core help).\n"
"The video output module can be further configured (see GPAC core help).\n"
"The filter can use OpenGL or 2D blit of the graphics card, depending on the OS support.\n"
"The filter can be used do dump frames as written by the graphics card (GPU read-back) using [-dumpframes]().\n"
"In this case, the window is not visible and only the listed frames are drawn to the GPU.\n"
"The pixel format of the dumped frame is always RGB in OpenGL and matches the video backbuffer format in 2D mode.\n"
)
.private_size = sizeof(GF_VideoOutCtx),
.initialize = vout_initialize,
.finalize = vout_finalize,
.configure_pid = vout_configure_pid,
.process = vout_process,
.process_event = vout_process_event,
.update_arg = vout_update_arg,
.hint_class_type = GF_FS_CLASS_MM_IO
}
#define GF_FS_SET_HELP(_help)
Definition: filters.h:2372
#define SETCAPS(__struct)
Definition: filters.h:2364
@ GF_FS_REG_MAIN_THREAD
Definition: filters.h:2387
@ GF_FS_CLASS_MM_IO
Definition: filters.h:2447
attribute Array args
Definition: jsf.idl:24
static GF_Err vout_initialize(GF_Filter *filter)
Definition: out_video.c:939
static const GF_FilterArgs VideoOutArgs[]
Definition: out_video.c:2282
static GF_Err vout_process(GF_Filter *filter)
Definition: out_video.c:1703
static Bool vout_process_event(GF_Filter *filter, const GF_FilterEvent *fevt)
Definition: out_video.c:2180
static const GF_FilterCapability VideoOutCaps[]
Definition: out_video.c:2341
static void vout_finalize(GF_Filter *filter)
Definition: out_video.c:1052
GF_Err vout_update_arg(GF_Filter *filter, const char *arg_name, const GF_PropertyValue *new_val)
Definition: out_video.c:2199
static GF_Err vout_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
Definition: out_video.c:367
Definition: out_video.c:93