Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
renderfunctions.cpp File Reference
#include "renderfunctions.h"
#include <libavformat/avformat.h>
#include <QOpenGLFramebufferObject>
#include <QApplication>
#include <QDesktopWidget>
#include <QDebug>
#include "timeline/clip.h"
#include "timeline/sequence.h"
#include "project/media.h"
#include "effects/effect.h"
#include "project/footage.h"
#include "effects/transition.h"
#include "ui/collapsiblewidget.h"
#include "rendering/audio.h"
#include "global/math.h"
#include "global/config.h"
#include "panels/timeline.h"
#include "panels/viewer.h"

Functions

void PrepareToDraw (QOpenGLFunctions *f)
 
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 (Clip *c, Effect *e, double timecode, GLTextureCoords &coords, GLuint &composite_texture, bool &fbo_switcher, bool &texture_failed, int data)
 
long rescale_frame_number (long framenumber, double source_frame_rate, double target_frame_rate)
 Rescale a frame number between two frame rates. More...
 
double get_timecode (Clip *c, long playhead)
 Get timecode. More...
 
long playhead_to_clip_frame (Clip *c, long playhead)
 Convert playhead frame number to a clip frame number. More...
 
double playhead_to_clip_seconds (Clip *c, long playhead)
 Converts the playhead to clip seconds. More...
 
int64_t seconds_to_timestamp (Clip *c, double seconds)
 Convert seconds to FFmpeg timestamp. More...
 
int64_t playhead_to_timestamp (Clip *c, long playhead)
 Convert Timeline playhead to FFmpeg timestamp. More...
 
void close_active_clips (Sequence *s)
 Close all open clips in a Sequence. More...
 

Function Documentation

void close_active_clips ( Sequence s)

Close all open clips in a Sequence.

Closes any currently open clips on a Sequence and waits for them to close before returning. This may be slow as a result on large Sequence objects. If a Clip is a nested Sequence, this function calls itself recursively on that Sequence too.

Parameters
sThe Sequence to close all clips on.
void draw_clip ( QOpenGLContext *  ctx,
GLuint  fbo,
GLuint  texture,
bool  clear 
)
GLuint draw_clip ( QOpenGLFramebufferObject *  fbo,
GLuint  texture,
bool  clear 
)
void full_blit ( )
double get_timecode ( Clip c,
long  playhead 
)

Get timecode.

Get the current clip/media time from the Timeline playhead in seconds. For instance if the playhead was at the start of a clip (whose in point wasn't trimmed), this would be 0.0 as it's the start of the clip/media;

Parameters
cClip to get the timecode of
playheadSequence playhead to convert to a clip/media timecode
Returns

Timecode in seconds

long playhead_to_clip_frame ( Clip c,
long  playhead 
)

Convert playhead frame number to a clip frame number.

Converts a Timeline playhead to a the current clip's frame. Equivalent to PLAYHEAD - CLIP_TIMELINE_IN + CLIP_MEDIA_IN. All keyframes are in clip frames.

Parameters
cThe clip to get the current frame number of
playheadThe current Timeline frame number
Returns

The curren frame number of the clip at playhead

double playhead_to_clip_seconds ( Clip c,
long  playhead 
)

Converts the playhead to clip seconds.

Get the current timecode at the playhead in terms of clip seconds.

FIXME: Possible duplicate of get_timecode()? Will need to research this more.

Parameters
cClip to return clip seconds of.
playheadCurrent Timeline playhead to convert to clip seconds
Returns

Clip time in seconds

int64_t playhead_to_timestamp ( Clip c,
long  playhead 
)

Convert Timeline playhead to FFmpeg timestamp.

Used for interaction with FFmpeg, converts the Timeline playhead to a timestamp in AVStream->time_base units.

Parameters
cClip to get timestamp of
playheadTimeline playhead to convert to a timestamp
Returns

An FFmpeg-compatible timestamp in AVStream->time_base units.

void PrepareToDraw ( QOpenGLFunctions *  f)
void process_effect ( Clip c,
Effect e,
double  timecode,
GLTextureCoords coords,
GLuint &  composite_texture,
bool &  fbo_switcher,
bool &  texture_failed,
int  data 
)
long rescale_frame_number ( long  framenumber,
double  source_frame_rate,
double  target_frame_rate 
)

Rescale a frame number between two frame rates.

Converts a frame number from one frame rate to its equivalent in another frame rate

Parameters
framenumberThe frame number to convert
source_frame_rateFrame rate that the frame number is currently in
target_frame_rateFrame rate to convert to
Returns

Rescaled frame number

int64_t seconds_to_timestamp ( Clip c,
double  seconds 
)

Convert seconds to FFmpeg timestamp.

Used for interaction with FFmpeg, converts seconds in a floating-point value to a timestamp in AVStream->time_base units.

Parameters
cClip to get timestamp of
secondsClip time in seconds
Returns

An FFmpeg-compatible timestamp in AVStream->time_base units.