merged with master

This commit is contained in:
itsmattkc
2019-03-25 12:43:23 +11:00
83 changed files with 7823 additions and 1469 deletions
+1
View File
@@ -653,6 +653,7 @@ void Cacher::CacheVideoWorker() {
// again, an EOF isn't an "error" but will how we add frames (see below)
qCritical() << "Failed to retrieve frame from buffersink." << retrieve_code;
break;
} else if (decoded_frame->pts != AV_NOPTS_VALUE) {
+26 -15
View File
@@ -20,17 +20,6 @@
#include "exportthread.h"
#include "global/global.h"
#include "timeline/sequence.h"
#include "panels/panels.h"
#include "ui/viewerwidget.h"
#include "rendering/renderthread.h"
#include "rendering/renderfunctions.h"
#include "rendering/audio.h"
#include "ui/mainwindow.h"
#include "global/debug.h"
extern "C" {
#include <libavformat/avformat.h>
#include <libavutil/opt.h>
@@ -42,6 +31,17 @@ extern "C" {
#include <QOffscreenSurface>
#include <QOpenGLPaintDevice>
#include <QPainter>
#include <QtMath>
#include "global/global.h"
#include "timeline/sequence.h"
#include "panels/panels.h"
#include "ui/viewerwidget.h"
#include "rendering/renderthread.h"
#include "rendering/renderfunctions.h"
#include "rendering/audio.h"
#include "ui/mainwindow.h"
#include "global/debug.h"
ExportThread::ExportThread(const ExportParams &params,
const VideoCodecParams& vparams,
@@ -91,7 +91,18 @@ bool ExportThread::Encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx,
}
packet->stream_index = stream->index;
if (rescale) av_packet_rescale_ts(packet, codec_ctx->time_base, stream->time_base);
if (rescale) {
if (packet->pts != AV_NOPTS_VALUE) {
packet->pts = qRound(packet->pts * av_q2d(codec_ctx->time_base) / av_q2d(stream->time_base));
}
if (packet->dts != AV_NOPTS_VALUE) {
packet->dts = qRound(packet->dts * av_q2d(codec_ctx->time_base) / av_q2d(stream->time_base));
}
if (packet->duration > 0) {
packet->duration = qRound(packet->duration * av_q2d(codec_ctx->time_base) / av_q2d(stream->time_base));
}
//av_packet_rescale_ts(packet, codec_ctx->time_base, stream->time_base);
}
av_interleaved_write_frame(ofmt_ctx, packet);
av_packet_unref(packet);
}
@@ -468,10 +479,10 @@ void ExportThread::Export()
// Convert raw RGBA buffer to format expected by the encoder
sws_scale(sws_ctx, video_frame->data, video_frame->linesize, 0, video_frame->height, sws_frame->data, sws_frame->linesize);
sws_frame->pts = qRound(timecode_secs/av_q2d(video_stream->time_base));
sws_frame->pts = qRound(timecode_secs/av_q2d(vcodec_ctx->time_base));
// Send frame to encoder
if (!Encode(fmt_ctx, vcodec_ctx, sws_frame, &video_pkt, video_stream, false)) {
if (!Encode(fmt_ctx, vcodec_ctx, sws_frame, &video_pkt, video_stream, true)) {
return;
}
@@ -577,7 +588,7 @@ void ExportThread::Export()
// Flush remaining packets out of video and audio encoders
while (continueVideo && continueAudio) {
if (continueVideo) {
continueVideo = Encode(fmt_ctx, vcodec_ctx, nullptr, &video_pkt, video_stream, false);
continueVideo = Encode(fmt_ctx, vcodec_ctx, nullptr, &video_pkt, video_stream, true);
}
if (continueAudio) {
continueAudio = Encode(fmt_ctx, acodec_ctx, nullptr, &audio_pkt, audio_stream, true);
+4 -2
View File
@@ -696,8 +696,10 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams &params) {
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, textureID);
// set texture filter to bilinear
params.ctx->functions()->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
params.ctx->functions()->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//params.ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
//params.ctx->functions()->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
params.ctx->functions()->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
params.ctx->functions()->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// draw clip on screen according to gl coordinates
params.pipeline->bind();
+16
View File
@@ -370,6 +370,22 @@ void RenderThread::cancel() {
wait();
}
void RenderThread::wait_until_paused()
{
// Wait for thread to finish whatever it's doing before proceeding.
//
// FIXME: This is slow. Perhaps there's a better way...
if (wait_lock_.tryLock()) {
wait_lock_.unlock();
return;
} else {
wait_lock_.lock();
wait_lock_.unlock();
}
}
void RenderThread::delete_buffers() {
composite_buffer.Destroy();
front_buffer_1.Destroy();
+1 -1
View File
@@ -55,7 +55,7 @@ public:
int idivider = 0);
bool did_texture_fail();
void cancel();
void wait_until_paused();
public slots:
// cleanup functions