use frame rate and timebase less interchangeably

This commit is contained in:
itsmattkc
2021-04-07 13:08:25 +10:00
parent 898ea25e89
commit bb32048c65
22 changed files with 187 additions and 85 deletions
+7 -5
View File
@@ -74,6 +74,7 @@ public:
format_(format)
{
set_default_footage_parameters();
timebase_ = sample_rate_as_time_base();
}
int sample_rate() const
@@ -98,11 +99,7 @@ public:
rational time_base() const
{
if (timebase_.isNull()) {
return rational(1, sample_rate());
} else {
return timebase_;
}
return timebase_;
}
void set_time_base(const rational& timebase)
@@ -110,6 +107,11 @@ public:
timebase_ = timebase;
}
rational sample_rate_as_time_base() const
{
return rational(1, sample_rate());
}
Format format() const
{
return format_;
+2
View File
@@ -56,6 +56,7 @@ void FrameHashCache::SetHash(const rational &time, const QByteArray &hash, const
if (job.range.Contains(time)
&& job_time < job.job_time) {
// Hash here has changed since this frame started rendering, discard it
qDebug() << "Discarded hash because old";
return;
}
}
@@ -71,6 +72,7 @@ void FrameHashCache::SetHash(const rational &time, const QByteArray &hash, const
void FrameHashCache::SetTimebase(const rational &tb)
{
qDebug() << "Hello timebase" << tb;
timebase_ = tb;
}
+1 -1
View File
@@ -62,7 +62,7 @@ void RenderProcessor::Run()
NodeOutput texture_output = viewer->GetConnectedTextureOutput();
if (texture_output.IsValid()) {
table = GenerateTable(texture_output.node(), texture_output.output(),
TimeRange(time, time + video_params.time_base()));
TimeRange(time, time + video_params.frame_rate_as_time_base()));
}
TexturePtr texture = table.Get(NodeValue::kTexture).value<TexturePtr>();
+2 -1
View File
@@ -112,7 +112,8 @@ VideoParams::VideoParams(int width, int height, const rational &time_base, Forma
channel_count_(nb_channels),
pixel_aspect_ratio_(pixel_aspect_ratio),
interlacing_(interlacing),
divider_(divider)
divider_(divider),
frame_rate_(time_base.flipped())
{
calculate_effective_size();
validate_pixel_aspect_ratio();
+5
View File
@@ -122,6 +122,11 @@ public:
time_base_ = r;
}
rational frame_rate_as_time_base() const
{
return frame_rate_.flipped();
}
int divider() const
{
return divider_;