ported ALL effects to opengl

This commit is contained in:
itsmattkc
2018-09-02 16:57:50 +10:00
parent cf35ea23bb
commit 0e8810109a
30 changed files with 485 additions and 168 deletions
-9
View File
@@ -347,9 +347,6 @@ void open_clip_worker(Clip* clip) {
}
clip->cache_B.frames[i]->linesize[0] = dstW*4;
}
clip->comp_frame_size = dstW * dstH * 4;
clip->comp_frame = new uchar[clip->comp_frame_size];
} else if (clip->stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
// if FFmpeg can't pick up the channel layout (usually WAV), assume
// based on channel count (doesn't support surround sound sources yet)
@@ -418,16 +415,10 @@ void cache_clip_worker(Clip* clip, long playhead, bool write_A, bool write_B, bo
}
void close_clip_worker(Clip* clip) {
for (int i=0;i<clip->effects.size();i++) {
clip->effects.at(i)->close();
}
// closes ffmpeg file handle and frees any memory used for caching
MediaStream* ms = static_cast<Media*>(clip->media)->get_stream_from_file_index(clip->track < 0, clip->media_stream);
if (clip->track < 0) {
sws_freeContext(clip->sws_ctx);
delete [] clip->comp_frame;
} else {
swr_free(&clip->swr_ctx);
}
+8 -9
View File
@@ -55,8 +55,14 @@ void close_clip(Clip* clip) {
clip->texture = NULL;
}
for (int i=0;i<clip->effects.size();i++) {
clip->effects.at(i)->close();
}
if (clip->fbo != NULL) {
delete clip->fbo;
delete clip->fbo[0];
delete clip->fbo[1];
delete [] clip->fbo;
clip->fbo = NULL;
}
@@ -178,14 +184,7 @@ bool get_clip_frame(Clip* c, long playhead) {
c->texture->allocateStorage(QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
}
memcpy(c->comp_frame, current_frame->data[0], c->comp_frame_size);
for (int i=0;i<c->effects.size();i++) {
if (c->effects.at(i)->is_enabled() && c->effects.at(i)->enable_image) {
c->effects.at(i)->process_image(sequence_clip_time, c->comp_frame, current_frame->width, current_frame->height);
}
}
c->texture->setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, c->comp_frame);
c->texture->setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, current_frame->data[0]);
c->texture_frame = clip_time;
return true;