various: allow users to override the start and end index of image sequences

Also includes various fixes to footage property setting/signalling.
This commit is contained in:
itsmattkc
2020-03-09 19:58:42 +11:00
parent 0131d83256
commit 16b072fa98
11 changed files with 181 additions and 26 deletions
+7 -5
View File
@@ -91,11 +91,13 @@ bool ImageStream::premultiplied_alpha() const
void ImageStream::set_premultiplied_alpha(bool e)
{
premultiplied_alpha_ = e;
emit ParametersChanged();
}
const QString &ImageStream::colorspace() const
const QString &ImageStream::colorspace(bool default_if_empty) const
{
if (colorspace_.isEmpty()) {
if (colorspace_.isEmpty() && default_if_empty) {
return footage()->project()->default_input_colorspace();
} else {
return colorspace_;
@@ -106,7 +108,7 @@ void ImageStream::set_colorspace(const QString &color)
{
colorspace_ = color;
emit ColorSpaceChanged();
emit ParametersChanged();
}
void ImageStream::ColorConfigChanged()
@@ -123,13 +125,13 @@ void ImageStream::ColorConfigChanged()
}
// Either way, the color calculation has likely changed so we signal here
emit ColorSpaceChanged();
emit ParametersChanged();
}
void ImageStream::DefaultColorSpaceChanged()
{
// If no colorspace is set, this stream uses the default color space and it's just changed
if (colorspace_.isEmpty()) {
emit ColorSpaceChanged();
emit ParametersChanged();
}
}
+1 -4
View File
@@ -43,12 +43,9 @@ public:
bool premultiplied_alpha() const;
void set_premultiplied_alpha(bool e);
const QString& colorspace() const;
const QString& colorspace(bool default_if_empty = true) const;
void set_colorspace(const QString& color);
signals:
void ColorSpaceChanged();
protected:
virtual void FootageSetEvent(Footage*) override;
+2
View File
@@ -107,6 +107,8 @@ const int64_t &Stream::duration() const
void Stream::set_duration(const int64_t &duration)
{
duration_ = duration;
emit ParametersChanged();
}
bool Stream::enabled() const
+2
View File
@@ -115,6 +115,8 @@ protected:
signals:
void IndexChanged();
void ParametersChanged();
private:
Footage* footage_;
+13 -1
View File
@@ -27,7 +27,8 @@
const int64_t VideoStream::kEndTimestamp = AV_NOPTS_VALUE;
VideoStream::VideoStream() :
start_time_(0)
start_time_(0),
is_image_sequence_(false)
{
set_type(kVideo);
}
@@ -57,6 +58,17 @@ const int64_t &VideoStream::start_time() const
void VideoStream::set_start_time(const int64_t &start_time)
{
start_time_ = start_time;
emit ParametersChanged();
}
bool VideoStream::is_image_sequence() const
{
return is_image_sequence_;
}
void VideoStream::set_image_sequence(bool e)
{
is_image_sequence_ = e;
}
int64_t VideoStream::get_closest_timestamp_in_frame_index(const rational &time)
+6
View File
@@ -25,6 +25,7 @@
class VideoStream : public ImageStream
{
Q_OBJECT
public:
VideoStream();
@@ -43,6 +44,9 @@ public:
const int64_t& start_time() const;
void set_start_time(const int64_t& start_time);
bool is_image_sequence() const;
void set_image_sequence(bool e);
int64_t get_closest_timestamp_in_frame_index(const rational& time);
int64_t get_closest_timestamp_in_frame_index(int64_t timestamp);
void clear_frame_index();
@@ -62,6 +66,8 @@ private:
QMutex index_access_lock_;
bool is_image_sequence_;
};
using VideoStreamPtr = std::shared_ptr<VideoStream>;