Merge branch 'master' into hashremoval

This commit is contained in:
itsmattkc
2022-05-16 09:12:49 -07:00
969 changed files with 4837 additions and 2393 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2021 Olive Team
# Copyright (C) 2022 Olive Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2021 Olive Team
# Copyright (C) 2022 Olive Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+4 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -222,6 +222,9 @@ public:
} else if (s.at(0) == 'a') {
// Audio stream
return Track::kAudio;
} else if (s.at(0) == 's') {
// Subtitle stream
return Track::kSubtitle;
}
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2021 Olive Team
# Copyright (C) 2022 Olive Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+42 -3
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@ namespace olive {
const QString ViewerOutput::kVideoParamsInput = QStringLiteral("video_param_in");
const QString ViewerOutput::kAudioParamsInput = QStringLiteral("audio_param_in");
const QString ViewerOutput::kSubtitleParamsInput = QStringLiteral("subtitle_param_in");
const QString ViewerOutput::kTextureInput = QStringLiteral("tex_in");
const QString ViewerOutput::kSamplesInput = QStringLiteral("samples_in");
const QString ViewerOutput::kVideoAutoCacheInput = QStringLiteral("video_autocache_in");
@@ -48,6 +49,8 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
AddInput(kAudioParamsInput, NodeValue::kAudioParams, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable | kInputFlagArray | kInputFlagHidden));
AddInput(kSubtitleParamsInput, NodeValue::kSubtitleParams, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable | kInputFlagArray | kInputFlagHidden));
if (create_buffer_inputs) {
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
AddInput(kSamplesInput, NodeValue::kSamples, InputFlags(kInputFlagNotKeyframable));
@@ -98,6 +101,7 @@ QString ViewerOutput::duration() const
// Get first enabled streams
VideoParams video = GetFirstEnabledVideoStream();
AudioParams audio = GetFirstEnabledAudioStream();
SubtitleParams sub = GetFirstEnabledSubtitleStream();
if (video.is_valid() && video.video_type() != VideoParams::kVideoTypeStill) {
// Prioritize video
@@ -111,6 +115,8 @@ QString ViewerOutput::duration() const
}
using_timebase = audio.sample_rate_as_time_base();
} else if (sub.is_valid()) {
using_timebase = OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>();
}
if (using_timebase.isNull()) {
@@ -149,6 +155,11 @@ bool ViewerOutput::HasEnabledAudioStreams() const
return GetFirstEnabledAudioStream().is_valid();
}
bool ViewerOutput::HasEnabledSubtitleStreams() const
{
return GetFirstEnabledSubtitleStream().is_valid();
}
VideoParams ViewerOutput::GetFirstEnabledVideoStream() const
{
int sz = GetVideoStreamCount();
@@ -179,6 +190,21 @@ AudioParams ViewerOutput::GetFirstEnabledAudioStream() const
return AudioParams();
}
SubtitleParams ViewerOutput::GetFirstEnabledSubtitleStream() const
{
int sz = GetSubtitleStreamCount();
for (int i=0; i<sz; i++) {
SubtitleParams sp = GetSubtitleParams(i);
if (sp.enabled()) {
return sp;
}
}
return SubtitleParams();
}
void ViewerOutput::set_default_parameters()
{
int width = OLIVE_CONFIG("DefaultSequenceWidth").toInt();
@@ -274,6 +300,16 @@ QVector<Track::Reference> ViewerOutput::GetEnabledStreamsAsReferences() const
}
}
{
int sp_sz = GetSubtitleStreamCount();
for (int i=0; i<sp_sz; i++) {
if (GetSubtitleParams(i).enabled()) {
refs.append(Track::Reference(Track::kSubtitle, i));
}
}
}
return refs;
}
@@ -283,6 +319,7 @@ void ViewerOutput::Retranslate()
SetInputName(kVideoParamsInput, tr("Video Parameters"));
SetInputName(kAudioParamsInput, tr("Audio Parameters"));
SetInputName(kSubtitleParamsInput, tr("Subtitle Parameters"));
if (HasInputWithID(kTextureInput)) {
SetInputName(kTextureInput, tr("Texture"));
@@ -342,7 +379,7 @@ rational ViewerOutput::VerifyLengthInternal(Track::Type type) const
switch (type) {
case Track::kVideo:
if (IsInputConnected(kTextureInput)) {
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kTextureInput), GetValueHintForInput(kTextureInput), TimeRange(0, 0));
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kTextureInput), TimeRange(0, 0));
rational r = t.Get(NodeValue::kRational, QStringLiteral("length")).value<rational>();
if (!r.isNaN()) {
return r;
@@ -351,7 +388,7 @@ rational ViewerOutput::VerifyLengthInternal(Track::Type type) const
break;
case Track::kAudio:
if (IsInputConnected(kSamplesInput)) {
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kSamplesInput), GetValueHintForInput(kSamplesInput), TimeRange(0, 0));
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kSamplesInput), TimeRange(0, 0));
rational r = t.Get(NodeValue::kRational, QStringLiteral("length")).value<rational>();;
if (!r.isNaN()) {
return r;
@@ -518,6 +555,8 @@ int ViewerOutput::AddStream(Track::Type type, const QVariant& value)
id = kVideoParamsInput;
} else if (type == Track::kAudio) {
id = kAudioParamsInput;
} else if (type == Track::kSubtitle) {
id = kSubtitleParamsInput;
} else {
return -1;
}
+27 -3
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
#include "render/audioparams.h"
#include "render/audioplaybackcache.h"
#include "render/framehashcache.h"
#include "render/videoparams.h"
#include "render/subtitleparams.h"
#include "render/videoparams.h"
#include "timeline/timelinepoints.h"
@@ -88,6 +88,17 @@ public:
}
}
SubtitleParams GetSubtitleParams(int index = 0) const
{
// This check isn't strictly necessary (GetStandardValue will return a null VideoParams anyway),
// but it does suppress a warning message that we don't need
if (index < InputArraySize(kSubtitleParamsInput)) {
return GetStandardValue(kSubtitleParamsInput, index).value<SubtitleParams>();
} else {
return SubtitleParams();
}
}
void SetVideoParams(const VideoParams &video, int index = 0)
{
SetStandardValue(kVideoParamsInput, QVariant::fromValue(video), index);
@@ -98,6 +109,11 @@ public:
SetStandardValue(kAudioParamsInput, QVariant::fromValue(audio), index);
}
void SetSubtitleParams(const SubtitleParams &subs, int index = 0)
{
SetStandardValue(kSubtitleParamsInput, QVariant::fromValue(subs), index);
}
int GetVideoStreamCount() const
{
return InputArraySize(kVideoParamsInput);
@@ -108,16 +124,23 @@ public:
return InputArraySize(kAudioParamsInput);
}
int GetSubtitleStreamCount() const
{
return InputArraySize(kSubtitleParamsInput);
}
int GetTotalStreamCount() const
{
return GetVideoStreamCount() + GetAudioStreamCount();
return GetVideoStreamCount() + GetAudioStreamCount() + GetSubtitleStreamCount();
}
bool HasEnabledVideoStreams() const;
bool HasEnabledAudioStreams() const;
bool HasEnabledSubtitleStreams() const;
VideoParams GetFirstEnabledVideoStream() const;
AudioParams GetFirstEnabledAudioStream() const;
SubtitleParams GetFirstEnabledSubtitleStream() const;
const rational &GetLength() const { return last_length_; }
const rational &GetVideoLength() const { return video_length_; }
@@ -191,6 +214,7 @@ public:
static const QString kVideoParamsInput;
static const QString kAudioParamsInput;
static const QString kSubtitleParamsInput;
static const QString kTextureInput;
static const QString kSamplesInput;