render: properly defined "out of bounds time" behavior with footage
If a user extends a clip beyond the footage's length, they can choose whether they want a black frame, the last frame continued, or for the footage to loop infinitely (same for extending earlier than the start of footage).
This commit is contained in:
@@ -29,14 +29,17 @@ class FootageJob
|
||||
{
|
||||
public:
|
||||
FootageJob() :
|
||||
type_(Track::kNone)
|
||||
type_(Track::kNone),
|
||||
loop_mode_(Footage::kLoopModeOff)
|
||||
{
|
||||
}
|
||||
|
||||
FootageJob(const QString& decoder, const QString& filename, Track::Type type) :
|
||||
FootageJob(const QString& decoder, const QString& filename, Track::Type type, const rational& length, Footage::LoopMode loop_mode) :
|
||||
decoder_(decoder),
|
||||
filename_(filename),
|
||||
type_(type)
|
||||
type_(type),
|
||||
length_(length),
|
||||
loop_mode_(loop_mode)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -85,6 +88,26 @@ public:
|
||||
cache_path_ = p;
|
||||
}
|
||||
|
||||
const rational& length() const
|
||||
{
|
||||
return length_;
|
||||
}
|
||||
|
||||
void set_length(const rational& length)
|
||||
{
|
||||
length_ = length;
|
||||
}
|
||||
|
||||
Footage::LoopMode loop_mode() const
|
||||
{
|
||||
return loop_mode_;
|
||||
}
|
||||
|
||||
void set_loop_mode(Footage::LoopMode loop_mode)
|
||||
{
|
||||
loop_mode_ = loop_mode;
|
||||
}
|
||||
|
||||
private:
|
||||
QString decoder_;
|
||||
|
||||
@@ -98,6 +121,10 @@ private:
|
||||
|
||||
QString cache_path_;
|
||||
|
||||
rational length_;
|
||||
|
||||
Footage::LoopMode loop_mode_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -424,6 +424,7 @@ QVariant RenderProcessor::ProcessAudioFootage(const FootageJob &stream, const Ti
|
||||
|
||||
SampleBufferPtr frame = decoder->RetrieveAudio(input_time, audio_params,
|
||||
stream.cache_path(),
|
||||
stream.loop_mode(),
|
||||
&IsCancelled());
|
||||
|
||||
if (frame) {
|
||||
|
||||
Reference in New Issue
Block a user