Olive
Functions
renderfunctions.cpp File Reference
#include "renderfunctions.h"
#include <QOpenGLFramebufferObject>
#include <QApplication>
#include <QDesktopWidget>
#include <QDebug>
#include "project/clip.h"
#include "project/sequence.h"
#include "project/media.h"
#include "project/effect.h"
#include "project/footage.h"
#include "project/transition.h"
#include "ui/collapsiblewidget.h"
#include "playback/audio.h"
#include "playback/playback.h"
#include "io/math.h"
#include "io/config.h"
#include "panels/timeline.h"
#include "panels/viewer.h"
#include <libavformat/avformat.h>

Functions

void full_blit ()
 
void draw_clip (QOpenGLContext *ctx, GLuint fbo, GLuint texture, bool clear)
 
GLuint draw_clip (QOpenGLFramebufferObject *fbo, GLuint texture, bool clear)
 
void process_effect (ClipPtr c, EffectPtr e, double timecode, GLTextureCoords &coords, GLuint &composite_texture, bool &fbo_switcher, bool &texture_failed, int data)
 
GLuint compose_sequence (ComposeSequenceParams &params)
 Compose a frame of a given sequence. More...
 
void compose_audio (Viewer *viewer, SequencePtr seq, int playback_speed)
 Convenience wrapper function for compose_sequence() to render audio. More...
 

Function Documentation

◆ compose_audio()

void compose_audio ( Viewer viewer,
SequencePtr  seq,
int  playback_speed 
)

Convenience wrapper function for compose_sequence() to render audio.

Much of the functionality provided (and parameters required) by compose_sequence() is only useful/necessary for video rendering. For audio rendering, this function is easier to handle and will correctly set up compose_sequence() to render audio without the cumbersome effort of setting up a ComposeSequenceParams object.

Parameters
viewerThe Viewer object calling this function
seqThe Sequence whose audio to render.
playback_speedThe current playback speed (controlled by Shuttle Left/Right)

◆ compose_sequence()

GLuint compose_sequence ( ComposeSequenceParams params)

Compose a frame of a given sequence.

For any given Sequence, this function will render the current frame indicated by Sequence::playhead. Will automatically open and close clips (memory allocation and file handles) as necessary, communicate with the Clip::cacher objects to retrieve upcoming frames and store them in memory, run Effect processing functions, and finally composite all the currently active clips together into a final texture.

Will sometimes render a frame incomplete or inaccurately, e.g. if a video file hadn't finished opening by the time of the render or a clip's cacher didn't have the requested frame available at the time of the render. If so, the texture_failed variable of params will be set to TRUE. Check this after calling compose_sequence() and if it is TRUE, compose_sequence() should be called again later to attempt another render (unless the Sequence is being played, in which case just play the next frame rather than redrawing an old frame).

Parameters
paramsA struct of parameters to use while rendering.
Returns
A reference to the OpenGL texture resulting from the render. Will usually be equal to ComposeSequenceParams::main_attachment unless it's rendering a nested sequence, in which case it'll be a reference to one of the textures referenced by Clip::fbo. Can be used directly to draw the rendered frame.

◆ draw_clip() [1/2]

void draw_clip ( QOpenGLContext *  ctx,
GLuint  fbo,
GLuint  texture,
bool  clear 
)

◆ draw_clip() [2/2]

GLuint draw_clip ( QOpenGLFramebufferObject *  fbo,
GLuint  texture,
bool  clear 
)

◆ full_blit()

void full_blit ( )

◆ process_effect()

void process_effect ( ClipPtr  c,
EffectPtr  e,
double  timecode,
GLTextureCoords coords,
GLuint &  composite_texture,
bool &  fbo_switcher,
bool &  texture_failed,
int  data 
)