Merge branch 'master' of https://github.com/olive-editor/olive
This commit is contained in:
@@ -48,7 +48,7 @@ Decoder::Decoder() :
|
||||
{
|
||||
}
|
||||
|
||||
bool Decoder::Open(StreamPtr fs)
|
||||
bool Decoder::Open(Stream *fs)
|
||||
{
|
||||
QMutexLocker locker(&mutex_);
|
||||
|
||||
@@ -203,7 +203,7 @@ QVector<DecoderPtr> ReceiveListOfAllDecoders()
|
||||
return decoders;
|
||||
}
|
||||
|
||||
FootagePtr Decoder::Probe(Project* project, const QString &filename, const QAtomicInt* cancelled)
|
||||
Footage* Decoder::Probe(Project* project, const QString &filename, const QAtomicInt* cancelled)
|
||||
{
|
||||
// Check for a valid filename
|
||||
if (filename.isEmpty()) {
|
||||
@@ -229,7 +229,7 @@ FootagePtr Decoder::Probe(Project* project, const QString &filename, const QAtom
|
||||
|
||||
DecoderPtr decoder = decoder_list.at(i);
|
||||
|
||||
FootagePtr footage = decoder->Probe(filename, cancelled);
|
||||
Footage* footage = decoder->Probe(filename, cancelled);
|
||||
|
||||
if (footage) {
|
||||
QFileInfo file_info(filename);
|
||||
|
||||
+6
-6
@@ -86,7 +86,7 @@ public:
|
||||
* already open and the stream == the stream provided. Returns FALSE if the stream couldn't
|
||||
* be opened OR if already open and the stream is NOT the same.
|
||||
*/
|
||||
bool Open(StreamPtr fs);
|
||||
bool Open(Stream* fs);
|
||||
|
||||
/**
|
||||
* @brief Retrieves a video frame from footage
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
*
|
||||
* TRUE if a Decoder was successfully able to parse and probe this file. FALSE if not.
|
||||
*/
|
||||
static FootagePtr Probe(Project *project, const QString& filename, const QAtomicInt *cancelled);
|
||||
static Footage *Probe(Project *project, const QString& filename, const QAtomicInt *cancelled);
|
||||
|
||||
/**
|
||||
* @brief Generate a Footage object from a file
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
*
|
||||
* This function is re-entrant.
|
||||
*/
|
||||
virtual FootagePtr Probe(const QString& filename, const QAtomicInt* cancelled) const = 0;
|
||||
virtual Footage *Probe(const QString& filename, const QAtomicInt* cancelled) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Closes media/deallocates memory
|
||||
@@ -209,7 +209,7 @@ protected:
|
||||
QString GetIndexFilename();
|
||||
|
||||
struct CurrentlyConforming {
|
||||
StreamPtr stream;
|
||||
Stream* stream;
|
||||
AudioParams params;
|
||||
|
||||
bool operator==(const CurrentlyConforming& rhs) const
|
||||
@@ -223,7 +223,7 @@ protected:
|
||||
*
|
||||
* This function is NOT thread safe and should therefore only be called by thread safe functions.
|
||||
*/
|
||||
StreamPtr stream() const
|
||||
Stream* stream() const
|
||||
{
|
||||
return stream_;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ signals:
|
||||
private:
|
||||
SampleBufferPtr RetrieveAudioFromConform(const QString& conform_filename, const TimeRange &range);
|
||||
|
||||
StreamPtr stream_;
|
||||
Stream* stream_;
|
||||
|
||||
QMutex mutex_;
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ bool FFmpegDecoder::OpenInternal()
|
||||
FramePtr FFmpegDecoder::RetrieveStillImage(const rational &timecode, const int ÷r)
|
||||
{
|
||||
// This is a still image
|
||||
VideoStreamPtr is = std::static_pointer_cast<VideoStream>(stream());
|
||||
VideoStream* is = static_cast<VideoStream*>(stream());
|
||||
|
||||
QString img_filename = stream()->footage()->filename();
|
||||
|
||||
@@ -103,7 +103,7 @@ FramePtr FFmpegDecoder::RetrieveStillImage(const rational &timecode, const int &
|
||||
|
||||
// If it's an image sequence, we'll probably need to transform the filename
|
||||
if (is->video_type() == VideoStream::kVideoTypeImageSequence) {
|
||||
ts = std::static_pointer_cast<VideoStream>(stream())->get_time_in_timebase_units(timecode);
|
||||
ts = static_cast<VideoStream*>(stream())->get_time_in_timebase_units(timecode);
|
||||
|
||||
img_filename = TransformImageSequenceFileName(stream()->footage()->filename(), ts);
|
||||
} else {
|
||||
@@ -126,8 +126,8 @@ FramePtr FFmpegDecoder::RetrieveStillImage(const rational &timecode, const int &
|
||||
frame->height,
|
||||
native_pix_fmt_,
|
||||
native_channel_count_,
|
||||
std::static_pointer_cast<VideoStream>(stream())->pixel_aspect_ratio(),
|
||||
std::static_pointer_cast<VideoStream>(stream())->interlacing(),
|
||||
is->pixel_aspect_ratio(),
|
||||
is->interlacing(),
|
||||
divider));
|
||||
output_frame->set_timestamp(timecode);
|
||||
output_frame->allocate();
|
||||
@@ -150,7 +150,7 @@ FramePtr FFmpegDecoder::RetrieveStillImage(const rational &timecode, const int &
|
||||
|
||||
FramePtr FFmpegDecoder::RetrieveVideoInternal(const rational &timecode, const int ÷r)
|
||||
{
|
||||
VideoStreamPtr vs = std::static_pointer_cast<VideoStream>(stream());
|
||||
VideoStream* vs = static_cast<VideoStream*>(stream());
|
||||
|
||||
if (scale_divider_ != divider) {
|
||||
FreeScaler();
|
||||
@@ -187,8 +187,8 @@ FramePtr FFmpegDecoder::RetrieveVideoInternal(const rational &timecode, const in
|
||||
vs->height(),
|
||||
native_pix_fmt_,
|
||||
native_channel_count_,
|
||||
std::static_pointer_cast<VideoStream>(stream())->pixel_aspect_ratio(),
|
||||
std::static_pointer_cast<VideoStream>(stream())->interlacing(),
|
||||
vs->pixel_aspect_ratio(),
|
||||
vs->interlacing(),
|
||||
divider));
|
||||
copy->set_timestamp(timecode);
|
||||
copy->allocate();
|
||||
@@ -218,13 +218,13 @@ QString FFmpegDecoder::id()
|
||||
return QStringLiteral("ffmpeg");
|
||||
}
|
||||
|
||||
FootagePtr FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancelled) const
|
||||
Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancelled) const
|
||||
{
|
||||
// Variable for receiving errors from FFmpeg
|
||||
int error_code;
|
||||
|
||||
// Result to return
|
||||
FootagePtr footage = nullptr;
|
||||
Footage* footage = nullptr;
|
||||
|
||||
// Convert QString to a C string
|
||||
QByteArray ba = filename.toUtf8();
|
||||
@@ -242,7 +242,7 @@ FootagePtr FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cance
|
||||
|
||||
int64_t footage_duration = fmt_ctx->duration;
|
||||
|
||||
QVector<StreamPtr> streams(fmt_ctx->nb_streams);
|
||||
QVector<Stream*> streams(fmt_ctx->nb_streams);
|
||||
|
||||
// Dump it into the Footage object
|
||||
for (unsigned int i=0;i<fmt_ctx->nb_streams;i++) {
|
||||
@@ -252,7 +252,7 @@ FootagePtr FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cance
|
||||
// Find decoder for this stream, if it exists we can proceed
|
||||
AVCodec* decoder = avcodec_find_decoder(avstream->codecpar->codec_id);
|
||||
|
||||
StreamPtr str;
|
||||
Stream* str;
|
||||
|
||||
if (decoder
|
||||
&& (avstream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO
|
||||
@@ -330,7 +330,7 @@ FootagePtr FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cance
|
||||
av_packet_free(&pkt);
|
||||
}
|
||||
|
||||
VideoStreamPtr video_stream = std::make_shared<VideoStream>();
|
||||
VideoStream* video_stream = new VideoStream();
|
||||
|
||||
if (image_is_still) {
|
||||
video_stream->set_video_type(VideoStream::kVideoTypeStill);
|
||||
@@ -355,7 +355,7 @@ FootagePtr FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cance
|
||||
} else {
|
||||
|
||||
// Create an audio stream object
|
||||
AudioStreamPtr audio_stream = std::make_shared<AudioStream>();
|
||||
AudioStream* audio_stream = new AudioStream();
|
||||
|
||||
uint64_t channel_layout = avstream->codecpar->channel_layout;
|
||||
if (!channel_layout) {
|
||||
@@ -401,7 +401,7 @@ FootagePtr FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cance
|
||||
} else {
|
||||
|
||||
// This is data we can't utilize at the moment, but we make a Stream object anyway to keep parity with the file
|
||||
str = std::make_shared<Stream>();
|
||||
str = new Stream();
|
||||
|
||||
// Set the correct codec type based on FFmpeg's result
|
||||
switch (avstream->codecpar->codec_type) {
|
||||
@@ -435,7 +435,7 @@ FootagePtr FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cance
|
||||
// Check if we could pick up any streams in this file
|
||||
bool found_valid_streams = false;
|
||||
|
||||
foreach (StreamPtr stream, streams) {
|
||||
foreach (Stream* stream, streams) {
|
||||
if (stream->type() != Stream::kUnknown) {
|
||||
found_valid_streams = true;
|
||||
break;
|
||||
@@ -444,12 +444,10 @@ FootagePtr FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cance
|
||||
|
||||
if (found_valid_streams) {
|
||||
// We actually have footage we can return instead of nullptr
|
||||
footage = std::make_shared<Footage>();
|
||||
footage = new Footage();
|
||||
|
||||
// Copy streams over
|
||||
foreach (StreamPtr stream, streams) {
|
||||
footage->add_stream(stream);
|
||||
}
|
||||
// Add streams
|
||||
footage->add_streams(streams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,7 +467,6 @@ QString FFmpegDecoder::FFmpegError(int error_code)
|
||||
bool FFmpegDecoder::ConformAudioInternal(const QString &filename, const AudioParams ¶ms, const QAtomicInt *cancelled)
|
||||
{
|
||||
// Iterate through each audio frame and extract the PCM data
|
||||
AudioStreamPtr audio_stream = std::static_pointer_cast<AudioStream>(stream());
|
||||
|
||||
// Seek to starting point
|
||||
instance_.Seek(0);
|
||||
@@ -810,7 +807,7 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const int64_t& target_t
|
||||
|
||||
void FFmpegDecoder::InitScaler(int divider)
|
||||
{
|
||||
VideoStream* vs = static_cast<VideoStream*>(stream().get());
|
||||
VideoStream* vs = static_cast<VideoStream*>(stream());
|
||||
|
||||
int scaled_width = VideoParams::GetScaledDimension(vs->width(), divider);
|
||||
int scaled_height = VideoParams::GetScaledDimension(vs->height(), divider);
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
virtual bool SupportsVideo() override{return true;}
|
||||
virtual bool SupportsAudio() override{return true;}
|
||||
|
||||
virtual FootagePtr Probe(const QString& filename, const QAtomicInt* cancelled) const override;
|
||||
virtual Footage* Probe(const QString& filename, const QAtomicInt* cancelled) const override;
|
||||
|
||||
protected:
|
||||
virtual bool OpenInternal() override;
|
||||
|
||||
@@ -51,7 +51,7 @@ QString OIIODecoder::id()
|
||||
return QStringLiteral("oiio");
|
||||
}
|
||||
|
||||
FootagePtr OIIODecoder::Probe(const QString& filename, const QAtomicInt* cancelled) const
|
||||
Footage *OIIODecoder::Probe(const QString& filename, const QAtomicInt* cancelled) const
|
||||
{
|
||||
Q_UNUSED(cancelled)
|
||||
|
||||
@@ -75,9 +75,9 @@ FootagePtr OIIODecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FootagePtr footage = std::make_shared<Footage>();
|
||||
Footage* footage = new Footage();
|
||||
|
||||
VideoStreamPtr image_stream = std::make_shared<VideoStream>();
|
||||
VideoStream* image_stream = new VideoStream();
|
||||
|
||||
image_stream->set_width(in->spec().width);
|
||||
image_stream->set_height(in->spec().height);
|
||||
@@ -108,7 +108,7 @@ bool OIIODecoder::OpenInternal()
|
||||
// If we can open the filename provided, assume everything is working (even if this is an image
|
||||
// sequence with potentially missing frame)
|
||||
if (OpenImageHandler(stream()->footage()->filename())) {
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream());
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(stream());
|
||||
|
||||
if (video_stream->video_type() == VideoStream::kVideoTypeStill) {
|
||||
last_sequence_index_ = 0;
|
||||
@@ -123,7 +123,7 @@ bool OIIODecoder::OpenInternal()
|
||||
|
||||
FramePtr OIIODecoder::RetrieveVideoInternal(const rational &timecode, const int& divider)
|
||||
{
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream());
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(stream());
|
||||
|
||||
int64_t sequence_index;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
virtual bool SupportsVideo() override{return true;}
|
||||
|
||||
virtual FootagePtr Probe(const QString& filename, const QAtomicInt* cancelled) const override;
|
||||
virtual Footage* Probe(const QString& filename, const QAtomicInt* cancelled) const override;
|
||||
|
||||
protected:
|
||||
virtual bool OpenInternal() override;
|
||||
|
||||
@@ -58,7 +58,7 @@ struct XMLNodeData {
|
||||
QHash<quintptr, Node*> node_ptrs;
|
||||
QHash<quintptr, NodeOutput*> output_ptrs;
|
||||
QList<SerializedConnection> desired_connections;
|
||||
QHash<quintptr, StreamPtr> footage_ptrs;
|
||||
QHash<quintptr, Stream*> footage_ptrs;
|
||||
QList<FootageConnection> footage_connections;
|
||||
QList<BlockLink> block_links;
|
||||
QHash<quintptr, Item*> item_ptrs;
|
||||
|
||||
+22
-15
@@ -378,7 +378,7 @@ void Core::CreateNewFolder()
|
||||
Folder* folder = active_project_panel->GetSelectedFolder();
|
||||
|
||||
// Create new folder
|
||||
ItemPtr new_folder = std::make_shared<Folder>();
|
||||
Folder* new_folder = new Folder();
|
||||
|
||||
// Set a default name
|
||||
new_folder->set_name(tr("New Folder"));
|
||||
@@ -391,7 +391,7 @@ void Core::CreateNewFolder()
|
||||
Core::instance()->undo_stack()->push(aic);
|
||||
|
||||
// Trigger an automatic rename so users can enter the folder name
|
||||
active_project_panel->Edit(new_folder.get());
|
||||
active_project_panel->Edit(new_folder);
|
||||
}
|
||||
|
||||
void Core::CreateNewSequence()
|
||||
@@ -404,18 +404,19 @@ void Core::CreateNewSequence()
|
||||
}
|
||||
|
||||
// Create new sequence
|
||||
SequencePtr new_sequence = CreateNewSequenceForProject(active_project);
|
||||
Sequence* new_sequence = CreateNewSequenceForProject(active_project);
|
||||
|
||||
// Set all defaults for the sequence
|
||||
new_sequence->set_default_parameters();
|
||||
|
||||
SequenceDialog sd(new_sequence.get(), SequenceDialog::kNew, main_window_);
|
||||
SequenceDialog sd(new_sequence, SequenceDialog::kNew, main_window_);
|
||||
|
||||
// Make sure SequenceDialog doesn't make an undo command for editing the sequence, since we make an undo command for
|
||||
// adding it later on
|
||||
sd.SetUndoable(false);
|
||||
|
||||
if (sd.exec() == QDialog::Accepted) {
|
||||
|
||||
// Create an undoable command
|
||||
ProjectViewModel::AddItemCommand* aic = new ProjectViewModel::AddItemCommand(GetActiveProjectModel(),
|
||||
GetSelectedFolderInActiveProject(),
|
||||
@@ -425,7 +426,13 @@ void Core::CreateNewSequence()
|
||||
|
||||
Core::instance()->undo_stack()->push(aic);
|
||||
|
||||
Core::instance()->main_window()->OpenSequence(new_sequence.get());
|
||||
Core::instance()->main_window()->OpenSequence(new_sequence);
|
||||
|
||||
} else {
|
||||
|
||||
// If the dialog was accepted, ownership goes to the AddItemCommand. But if we get here, just delete
|
||||
delete new_sequence;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,7 +545,7 @@ bool Core::StartHeadlessExport()
|
||||
|
||||
if (task_dialog.Run()) {
|
||||
std::unique_ptr<Project> p = std::unique_ptr<Project>(plm.GetLoadedProject());
|
||||
QList<ItemPtr> items = p->get_items_of_type(Item::kSequence);
|
||||
QVector<Item*> items = p->get_items_of_type(Item::kSequence);
|
||||
|
||||
// Check if this project contains sequences
|
||||
if (items.isEmpty()) {
|
||||
@@ -546,7 +553,7 @@ bool Core::StartHeadlessExport()
|
||||
return false;
|
||||
}
|
||||
|
||||
SequencePtr sequence = nullptr;
|
||||
Sequence* sequence = nullptr;
|
||||
|
||||
// Check if this project contains multiple sequences
|
||||
if (items.size() > 1) {
|
||||
@@ -579,9 +586,9 @@ bool Core::StartHeadlessExport()
|
||||
}
|
||||
}
|
||||
|
||||
sequence = std::static_pointer_cast<Sequence>(items.at(sequence_index));
|
||||
sequence = static_cast<Sequence*>(items.at(sequence_index));
|
||||
} else {
|
||||
sequence = std::static_pointer_cast<Sequence>(items.first());
|
||||
sequence = static_cast<Sequence*>(items.first());
|
||||
}
|
||||
|
||||
ExportParams params;
|
||||
@@ -1087,9 +1094,9 @@ void Core::LabelNodes(const QVector<Node *> &nodes) const
|
||||
}
|
||||
}
|
||||
|
||||
SequencePtr Core::CreateNewSequenceForProject(Project* project) const
|
||||
Sequence *Core::CreateNewSequenceForProject(Project* project) const
|
||||
{
|
||||
SequencePtr new_sequence = std::make_shared<Sequence>();
|
||||
Sequence* new_sequence = new Sequence();
|
||||
|
||||
// Get default name for this sequence (in the format "Sequence N", the first that doesn't exist)
|
||||
int sequence_number = 1;
|
||||
@@ -1282,12 +1289,12 @@ void Core::CacheActiveSequence(bool in_out_only)
|
||||
|
||||
bool Core::ValidateFootageInLoadedProject(Project* project, const QString& project_saved_url)
|
||||
{
|
||||
QList<FootagePtr> footage_we_couldnt_validate;
|
||||
QVector<Footage*> footage_we_couldnt_validate;
|
||||
|
||||
QList<ItemPtr> project_footage = project->get_items_of_type(Item::kFootage);
|
||||
QVector<Item*> project_footage = project->get_items_of_type(Item::kFootage);
|
||||
|
||||
foreach (ItemPtr item, project_footage) {
|
||||
FootagePtr footage = std::static_pointer_cast<Footage>(item);
|
||||
foreach (Item* item, project_footage) {
|
||||
Footage* footage = static_cast<Footage*>(item);
|
||||
|
||||
if (!QFileInfo::exists(footage->filename()) && !project_saved_url.isEmpty()) {
|
||||
// If the footage doesn't exist, it might have moved with the project
|
||||
|
||||
+1
-1
@@ -246,7 +246,7 @@ public:
|
||||
/**
|
||||
* @brief Create a new sequence named appropriately for the active project
|
||||
*/
|
||||
SequencePtr CreateNewSequenceForProject(Project *project) const;
|
||||
Sequence* CreateNewSequenceForProject(Project *project) const;
|
||||
|
||||
/**
|
||||
* @brief Opens a project from the recently opened list
|
||||
|
||||
@@ -69,7 +69,7 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, Footage *foota
|
||||
int first_usable_stream = -1;
|
||||
|
||||
for (int i=0;i<footage_->streams().size();i++) {
|
||||
StreamPtr stream = footage_->stream(i);
|
||||
Stream* stream = footage_->stream(i);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem(stream->description(), track_list);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
@@ -78,10 +78,10 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, Footage *foota
|
||||
|
||||
switch (stream->type()) {
|
||||
case Stream::kVideo:
|
||||
stacked_widget_->addWidget(new VideoStreamProperties(std::static_pointer_cast<VideoStream>(stream)));
|
||||
stacked_widget_->addWidget(new VideoStreamProperties(static_cast<VideoStream*>(stream)));
|
||||
break;
|
||||
case Stream::kAudio:
|
||||
stacked_widget_->addWidget(new AudioStreamProperties(std::static_pointer_cast<AudioStream>(stream)));
|
||||
stacked_widget_->addWidget(new AudioStreamProperties(static_cast<AudioStream*>(stream)));
|
||||
break;
|
||||
default:
|
||||
stacked_widget_->addWidget(new StreamProperties());
|
||||
@@ -175,7 +175,7 @@ void FootagePropertiesDialog::FootageChangeCommand::undo_internal()
|
||||
footage_->set_name(old_name_);
|
||||
}
|
||||
|
||||
FootagePropertiesDialog::StreamEnableChangeCommand::StreamEnableChangeCommand(StreamPtr stream, bool enabled, QUndoCommand *command) :
|
||||
FootagePropertiesDialog::StreamEnableChangeCommand::StreamEnableChangeCommand(Stream *stream, bool enabled, QUndoCommand *command) :
|
||||
UndoCommand(command),
|
||||
stream_(stream),
|
||||
old_enabled_(stream->enabled()),
|
||||
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
|
||||
class StreamEnableChangeCommand : public UndoCommand {
|
||||
public:
|
||||
StreamEnableChangeCommand(StreamPtr stream,
|
||||
StreamEnableChangeCommand(Stream* stream,
|
||||
bool enabled,
|
||||
QUndoCommand* command = nullptr);
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
StreamPtr stream_;
|
||||
Stream* stream_;
|
||||
|
||||
bool old_enabled_;
|
||||
bool new_enabled_;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
AudioStreamProperties::AudioStreamProperties(AudioStreamPtr stream) :
|
||||
AudioStreamProperties::AudioStreamProperties(AudioStream *stream) :
|
||||
stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace olive {
|
||||
class AudioStreamProperties : public StreamProperties
|
||||
{
|
||||
public:
|
||||
AudioStreamProperties(AudioStreamPtr stream);
|
||||
AudioStreamProperties(AudioStream* stream);
|
||||
|
||||
virtual void Accept(QUndoCommand* parent) override;
|
||||
|
||||
private:
|
||||
AudioStreamPtr stream_;
|
||||
AudioStream* stream_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
VideoStreamProperties::VideoStreamProperties(VideoStreamPtr stream) :
|
||||
VideoStreamProperties::VideoStreamProperties(VideoStream *stream) :
|
||||
stream_(stream),
|
||||
video_premultiply_alpha_(nullptr)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ VideoStreamProperties::VideoStreamProperties(VideoStreamPtr stream) :
|
||||
|
||||
int imgseq_row = 0;
|
||||
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(stream.get());
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(stream);
|
||||
|
||||
imgseq_layout->addWidget(new QLabel(tr("Start Index:")), imgseq_row, 0);
|
||||
|
||||
@@ -146,7 +146,7 @@ void VideoStreamProperties::Accept(QUndoCommand *parent)
|
||||
}
|
||||
|
||||
if (stream_->video_type() == VideoStream::kVideoTypeImageSequence) {
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream_);
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(stream_);
|
||||
|
||||
int64_t new_dur = imgseq_end_time_->GetValue() - imgseq_start_time_->GetValue() + 1;
|
||||
|
||||
@@ -177,7 +177,7 @@ bool VideoStreamProperties::SanityCheck()
|
||||
return true;
|
||||
}
|
||||
|
||||
VideoStreamProperties::VideoStreamChangeCommand::VideoStreamChangeCommand(VideoStreamPtr stream,
|
||||
VideoStreamProperties::VideoStreamChangeCommand::VideoStreamChangeCommand(VideoStream *stream,
|
||||
bool premultiplied,
|
||||
QString colorspace,
|
||||
VideoParams::Interlacing interlacing,
|
||||
@@ -218,7 +218,7 @@ void VideoStreamProperties::VideoStreamChangeCommand::undo_internal()
|
||||
stream_->set_pixel_aspect_ratio(old_pixel_ar_);
|
||||
}
|
||||
|
||||
VideoStreamProperties::ImageSequenceChangeCommand::ImageSequenceChangeCommand(VideoStreamPtr video_stream, int64_t start_index, int64_t duration, const rational &frame_rate, QUndoCommand *parent) :
|
||||
VideoStreamProperties::ImageSequenceChangeCommand::ImageSequenceChangeCommand(VideoStream *video_stream, int64_t start_index, int64_t duration, const rational &frame_rate, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
video_stream_(video_stream),
|
||||
new_start_index_(start_index),
|
||||
|
||||
@@ -36,7 +36,7 @@ class VideoStreamProperties : public StreamProperties
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VideoStreamProperties(VideoStreamPtr stream);
|
||||
VideoStreamProperties(VideoStream* stream);
|
||||
|
||||
virtual void Accept(QUndoCommand* parent) override;
|
||||
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
/**
|
||||
* @brief Attached video stream
|
||||
*/
|
||||
VideoStreamPtr stream_;
|
||||
VideoStream* stream_;
|
||||
|
||||
/**
|
||||
* @brief Setting for associated/premultiplied alpha
|
||||
@@ -85,7 +85,7 @@ private:
|
||||
|
||||
class VideoStreamChangeCommand : public UndoCommand {
|
||||
public:
|
||||
VideoStreamChangeCommand(VideoStreamPtr stream,
|
||||
VideoStreamChangeCommand(VideoStream* stream,
|
||||
bool premultiplied,
|
||||
QString colorspace,
|
||||
VideoParams::Interlacing interlacing,
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
VideoStreamPtr stream_;
|
||||
VideoStream* stream_;
|
||||
|
||||
bool new_premultiplied_;
|
||||
QString new_colorspace_;
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
|
||||
class ImageSequenceChangeCommand : public UndoCommand {
|
||||
public:
|
||||
ImageSequenceChangeCommand(VideoStreamPtr video_stream,
|
||||
ImageSequenceChangeCommand(VideoStream* video_stream,
|
||||
int64_t start_index,
|
||||
int64_t duration,
|
||||
const rational& frame_rate,
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
VideoStreamPtr video_stream_;
|
||||
VideoStream* video_stream_;
|
||||
|
||||
int64_t new_start_index_;
|
||||
int64_t old_start_index_;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
FootageRelinkDialog::FootageRelinkDialog(const QList<FootagePtr>& footage, QWidget* parent) :
|
||||
FootageRelinkDialog::FootageRelinkDialog(const QVector<Footage *> &footage, QWidget* parent) :
|
||||
QDialog(parent),
|
||||
footage_(footage)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ FootageRelinkDialog::FootageRelinkDialog(const QList<FootagePtr>& footage, QWidg
|
||||
table_->header()->setStretchLastSection(false);
|
||||
|
||||
for (int i=0; i<footage.size(); i++) {
|
||||
FootagePtr f = footage.at(i);
|
||||
Footage* f = footage.at(i);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
|
||||
QWidget* item_actions = new QWidget();
|
||||
@@ -87,7 +87,7 @@ FootageRelinkDialog::FootageRelinkDialog(const QList<FootagePtr>& footage, QWidg
|
||||
|
||||
void FootageRelinkDialog::UpdateFootageItem(int index)
|
||||
{
|
||||
FootagePtr f = footage_.at(index);
|
||||
Footage* f = footage_.at(index);
|
||||
QTreeWidgetItem* item = table_->topLevelItem(index);
|
||||
item->setIcon(0, f->icon());
|
||||
item->setText(1, f->filename());
|
||||
@@ -96,7 +96,7 @@ void FootageRelinkDialog::UpdateFootageItem(int index)
|
||||
void FootageRelinkDialog::BrowseForFootage()
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
FootagePtr f = footage_.at(index);
|
||||
Footage* f = footage_.at(index);
|
||||
|
||||
QFileInfo info(f->filename());
|
||||
|
||||
@@ -124,7 +124,7 @@ void FootageRelinkDialog::BrowseForFootage()
|
||||
|
||||
// Check all other footage files for matches
|
||||
for (int it=0; it<footage_.size(); it++) {
|
||||
FootagePtr other_footage = footage_.at(it);
|
||||
Footage* other_footage = footage_.at(it);
|
||||
|
||||
// Ignore current footage file and footage that's already valid of course
|
||||
if (index != it && !other_footage->IsValid()) {
|
||||
|
||||
@@ -32,14 +32,14 @@ class FootageRelinkDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FootageRelinkDialog(const QList<FootagePtr>& footage, QWidget* parent = nullptr);
|
||||
FootageRelinkDialog(const QVector<Footage*>& footage, QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
void UpdateFootageItem(int index);
|
||||
|
||||
QTreeWidget* table_;
|
||||
|
||||
QList<FootagePtr> footage_;
|
||||
QVector<Footage*> footage_;
|
||||
|
||||
private slots:
|
||||
void BrowseForFootage();
|
||||
|
||||
@@ -41,6 +41,8 @@ set(OLIVE_SOURCES
|
||||
node/keyframe.cpp
|
||||
node/node.h
|
||||
node/node.cpp
|
||||
node/nodecopypaste.h
|
||||
node/nodecopypaste.cpp
|
||||
node/output.h
|
||||
node/output.cpp
|
||||
node/param.h
|
||||
|
||||
+5
-3
@@ -21,16 +21,18 @@
|
||||
#ifndef NODEGRAPH_H
|
||||
#define NODEGRAPH_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "node/node.h"
|
||||
#include "project/item/item.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
/**
|
||||
* @brief A collection of nodes
|
||||
*
|
||||
* This doesn't technically need to be a derivative of Item, but since both Item and NodeGraph need
|
||||
* to be QObject derivatives, this simplifies Sequence.
|
||||
*/
|
||||
class NodeGraph : public QObject
|
||||
class NodeGraph : public Item
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ QString NodeInput::ValueToString(const DataType& data_type, const QVariant &valu
|
||||
} else if (data_type == kRational) {
|
||||
return value.value<rational>().toString();
|
||||
} else if (data_type == kFootage) {
|
||||
return QString::number(reinterpret_cast<quintptr>(value.value<StreamPtr>().get()));
|
||||
return QString::number(value.value<quintptr>());
|
||||
} else if (data_type == kTexture
|
||||
|| data_type == kSamples
|
||||
|| data_type == kBuffer) {
|
||||
|
||||
@@ -40,14 +40,14 @@ QVector<Node::CategoryID> MediaInput::Category() const
|
||||
return {kCategoryInput};
|
||||
}
|
||||
|
||||
StreamPtr MediaInput::stream()
|
||||
Stream *MediaInput::stream() const
|
||||
{
|
||||
return footage_input_->get_standard_value().value<StreamPtr>();
|
||||
return Node::ValueToPtr<Stream>(footage_input_->get_standard_value());
|
||||
}
|
||||
|
||||
void MediaInput::SetStream(StreamPtr s)
|
||||
void MediaInput::SetStream(Stream* s)
|
||||
{
|
||||
footage_input_->set_standard_value(QVariant::fromValue(s));
|
||||
footage_input_->set_standard_value(Node::PtrToValue(s));
|
||||
}
|
||||
|
||||
bool MediaInput::IsMedia() const
|
||||
@@ -76,20 +76,20 @@ NodeValueTable MediaInput::Value(NodeValueDatabase &value) const
|
||||
|
||||
void MediaInput::FootageChanged()
|
||||
{
|
||||
StreamPtr new_footage = footage_input_->get_standard_value().value<StreamPtr>();
|
||||
Stream* new_footage = footage_input_->get_standard_value().value<Stream*>();
|
||||
|
||||
if (new_footage == connected_footage_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (connected_footage_) {
|
||||
disconnect(connected_footage_.get(), &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
||||
disconnect(connected_footage_, &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
||||
}
|
||||
|
||||
connected_footage_ = new_footage;
|
||||
|
||||
if (connected_footage_) {
|
||||
connect(connected_footage_.get(), &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
||||
connect(connected_footage_, &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ public:
|
||||
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
|
||||
StreamPtr stream();
|
||||
void SetStream(StreamPtr s);
|
||||
Stream* stream() const;
|
||||
void SetStream(Stream *s);
|
||||
|
||||
virtual bool IsMedia() const override;
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
protected:
|
||||
NodeInput* footage_input_;
|
||||
|
||||
StreamPtr connected_footage_;
|
||||
Stream* connected_footage_;
|
||||
|
||||
private slots:
|
||||
void FootageChanged();
|
||||
|
||||
+3
-3
@@ -430,7 +430,7 @@ void Node::Hash(QCryptographicHash &hash, const rational& time) const
|
||||
|
||||
// We have one exception for FOOTAGE types, since we resolve the footage into a frame in the renderer
|
||||
if (input->data_type() == NodeParam::kFootage) {
|
||||
StreamPtr stream = input->get_standard_value().value<StreamPtr>();
|
||||
Stream* stream = Node::ValueToPtr<Stream>(input->get_standard_value());
|
||||
|
||||
if (stream) {
|
||||
// Add footage details to hash
|
||||
@@ -445,7 +445,7 @@ void Node::Hash(QCryptographicHash &hash, const rational& time) const
|
||||
hash.addData(QString::number(stream->index()).toUtf8());
|
||||
|
||||
if (stream->type() == Stream::kVideo) {
|
||||
VideoStreamPtr image_stream = std::static_pointer_cast<VideoStream>(stream);
|
||||
VideoStream* image_stream = static_cast<VideoStream*>(stream);
|
||||
|
||||
// Current color config and space
|
||||
hash.addData(image_stream->footage()->project()->color_manager()->GetConfigFilename().toUtf8());
|
||||
@@ -460,7 +460,7 @@ void Node::Hash(QCryptographicHash &hash, const rational& time) const
|
||||
|
||||
// Footage timestamp
|
||||
if (stream->type() == Stream::kVideo) {
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream);
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(stream);
|
||||
|
||||
int64_t video_ts = Timecode::time_to_timestamp(input_time, video_stream->timebase());
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
void NodeCopyPasteWidget::CopyNodesToClipboard(const QVector<Node *> &nodes, void *userdata)
|
||||
void NodeCopyPasteService::CopyNodesToClipboard(const QVector<Node *> &nodes, void *userdata)
|
||||
{
|
||||
QString copy_str;
|
||||
|
||||
@@ -56,7 +56,7 @@ void NodeCopyPasteWidget::CopyNodesToClipboard(const QVector<Node *> &nodes, voi
|
||||
Core::CopyStringToClipboard(copy_str);
|
||||
}
|
||||
|
||||
QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QUndoCommand* command, void *userdata)
|
||||
QVector<Node *> NodeCopyPasteService::PasteNodesFromClipboard(Sequence *graph, QUndoCommand* command, void *userdata)
|
||||
{
|
||||
QString clipboard = Core::PasteStringFromClipboard();
|
||||
|
||||
@@ -135,7 +135,7 @@ QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QU
|
||||
// Connect footage to existing footage if it exists
|
||||
if (!xml_node_data.footage_connections.isEmpty()) {
|
||||
// Get list of all footage from project
|
||||
QList<ItemPtr> footage = graph->project()->get_items_of_type(Item::kFootage);
|
||||
QVector<Item*> footage = graph->project()->get_items_of_type(Item::kFootage);
|
||||
|
||||
if (!footage.isEmpty()) {
|
||||
foreach (const XMLNodeData::FootageConnection& con, xml_node_data.footage_connections) {
|
||||
@@ -145,12 +145,10 @@ QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QU
|
||||
|
||||
bool found = false;
|
||||
|
||||
foreach (ItemPtr item, footage) {
|
||||
const QList<StreamPtr>& streams = std::static_pointer_cast<Footage>(item)->streams();
|
||||
|
||||
foreach (StreamPtr s, streams) {
|
||||
if (s.get() == loaded_stream) {
|
||||
con.input->set_standard_value(QVariant::fromValue(s));
|
||||
foreach (Item* item, footage) {
|
||||
foreach (Stream* s, static_cast<Footage*>(item)->streams()) {
|
||||
if (s == loaded_stream) {
|
||||
con.input->set_standard_value(Node::PtrToValue(s));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -168,11 +166,11 @@ QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QU
|
||||
return pasted_nodes;
|
||||
}
|
||||
|
||||
void NodeCopyPasteWidget::CopyNodesToClipboardInternal(QXmlStreamWriter*, void*)
|
||||
void NodeCopyPasteService::CopyNodesToClipboardInternal(QXmlStreamWriter*, void*)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeCopyPasteWidget::PasteNodesFromClipboardInternal(QXmlStreamReader* reader, XMLNodeData &xml_node_data, void*)
|
||||
void NodeCopyPasteService::PasteNodesFromClipboardInternal(QXmlStreamReader* reader, XMLNodeData &xml_node_data, void*)
|
||||
{
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
@@ -29,10 +29,10 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
class NodeCopyPasteWidget
|
||||
class NodeCopyPasteService
|
||||
{
|
||||
public:
|
||||
NodeCopyPasteWidget() = default;
|
||||
NodeCopyPasteService() = default;
|
||||
|
||||
protected:
|
||||
void CopyNodesToClipboard(const QVector<Node *> &nodes, void* userdata = nullptr);
|
||||
@@ -102,7 +102,7 @@ NodeValueTable NodeTraverser::GenerateBlockTable(const TrackOutput *track, const
|
||||
return table;
|
||||
}
|
||||
|
||||
QVariant NodeTraverser::ProcessVideoFootage(StreamPtr stream, const rational &input_time)
|
||||
QVariant NodeTraverser::ProcessVideoFootage(VideoStream *stream, const rational &input_time)
|
||||
{
|
||||
Q_UNUSED(stream)
|
||||
Q_UNUSED(input_time)
|
||||
@@ -110,7 +110,7 @@ QVariant NodeTraverser::ProcessVideoFootage(StreamPtr stream, const rational &in
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant NodeTraverser::ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time)
|
||||
QVariant NodeTraverser::ProcessAudioFootage(AudioStream *stream, const TimeRange &input_time)
|
||||
{
|
||||
Q_UNUSED(stream)
|
||||
Q_UNUSED(input_time)
|
||||
@@ -188,7 +188,7 @@ void NodeTraverser::PostProcessTable(const Node *node, const TimeRange &range, N
|
||||
QList<NodeValue>* take_this_value_list = nullptr;
|
||||
|
||||
if (v.type() == NodeParam::kFootage) {
|
||||
StreamPtr s = v.data().value<StreamPtr>();
|
||||
Stream* s = Node::ValueToPtr<Stream>(v.data());
|
||||
|
||||
if (s) {
|
||||
if (s->type() == Stream::kVideo) {
|
||||
@@ -214,7 +214,8 @@ void NodeTraverser::PostProcessTable(const Node *node, const TimeRange &range, N
|
||||
if (!got_cached_frame) {
|
||||
// Retrieve video frames
|
||||
foreach (const NodeValue& v, video_footage_to_retrieve) {
|
||||
StreamPtr stream = v.data().value<StreamPtr>();
|
||||
// Assume this is a VideoStream, we did a type check earlier in the function
|
||||
VideoStream* stream = Node::ValueToPtr<VideoStream>(v.data());
|
||||
|
||||
if (stream->footage()->IsValid()) {
|
||||
QVariant value = ProcessVideoFootage(stream, range.in());
|
||||
@@ -246,10 +247,11 @@ void NodeTraverser::PostProcessTable(const Node *node, const TimeRange &range, N
|
||||
|
||||
// Retrieve audio samples
|
||||
foreach (const NodeValue& v, audio_footage_to_retrieve) {
|
||||
StreamPtr stream = v.data().value<StreamPtr>();
|
||||
// Assume this is an AudioStream, we did a type check earlier in the function
|
||||
AudioStream* stream = Node::ValueToPtr<AudioStream>(v.data());
|
||||
|
||||
if (stream->footage()->IsValid()) {
|
||||
QVariant value = ProcessAudioFootage(v.data().value<StreamPtr>(), range);
|
||||
QVariant value = ProcessAudioFootage(stream, range);
|
||||
|
||||
if (!value.isNull()) {
|
||||
output_params.Push(NodeParam::kSamples, value, node);
|
||||
|
||||
@@ -46,9 +46,9 @@ protected:
|
||||
|
||||
virtual NodeValueTable GenerateBlockTable(const TrackOutput *track, const TimeRange& range);
|
||||
|
||||
virtual QVariant ProcessVideoFootage(StreamPtr stream, const rational &input_time);
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* stream, const rational &input_time);
|
||||
|
||||
virtual QVariant ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time);
|
||||
virtual QVariant ProcessAudioFootage(AudioStream* stream, const TimeRange &input_time);
|
||||
|
||||
virtual QVariant ProcessShader(const Node *node, const TimeRange &range, const ShaderJob& job);
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ void ProjectPanel::UpdateSubtitle()
|
||||
do {
|
||||
folder_path.prepend(QStringLiteral("/%1").arg(item->name()));
|
||||
|
||||
item = item->parent();
|
||||
item = item->item_parent();
|
||||
} while (item != project()->root());
|
||||
|
||||
project_title.append(folder_path);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define TIMEBASEDPANEL_H
|
||||
|
||||
#include "widget/panel/panel.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
@@ -61,20 +61,20 @@ void Folder::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, uint ver
|
||||
return;
|
||||
}
|
||||
|
||||
ItemPtr child;
|
||||
Item* child;
|
||||
|
||||
if (reader->name() == QStringLiteral("folder")) {
|
||||
child = std::make_shared<Folder>();
|
||||
child = new Folder();
|
||||
} else if (reader->name() == QStringLiteral("footage")) {
|
||||
child = std::make_shared<Footage>();
|
||||
child = new Footage();
|
||||
} else if (reader->name() == QStringLiteral("sequence")) {
|
||||
child = std::make_shared<Sequence>();
|
||||
child = new Sequence();
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
continue;
|
||||
}
|
||||
|
||||
add_child(child);
|
||||
child->setParent(this);
|
||||
child->Load(reader, xml_node_data, version, cancelled);
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ void Folder::Save(QXmlStreamWriter *writer) const
|
||||
|
||||
writer->writeAttribute(QStringLiteral("ptr"), QString::number(reinterpret_cast<quintptr>(this)));
|
||||
|
||||
foreach (ItemPtr child, children()) {
|
||||
foreach (Item* child, children()) {
|
||||
switch (child->type()) {
|
||||
case Item::kFootage:
|
||||
writer->writeStartElement(QStringLiteral("footage"));
|
||||
|
||||
@@ -63,8 +63,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
using AudioStreamPtr = std::shared_ptr<AudioStream>;
|
||||
|
||||
}
|
||||
|
||||
#endif // AUDIOSTREAM_H
|
||||
|
||||
@@ -78,7 +78,7 @@ void Footage::Save(QXmlStreamWriter *writer) const
|
||||
TimelinePoints::Save(writer);
|
||||
writer->writeEndElement(); // points
|
||||
|
||||
foreach (StreamPtr stream, streams_) {
|
||||
foreach (Stream* stream, streams_) {
|
||||
writer->writeStartElement(QStringLiteral("stream"));
|
||||
stream->Save(writer);
|
||||
writer->writeEndElement(); // stream
|
||||
@@ -119,23 +119,27 @@ void Footage::set_timestamp(const qint64 &t)
|
||||
timestamp_ = t;
|
||||
}
|
||||
|
||||
void Footage::add_stream(StreamPtr s)
|
||||
void Footage::add_stream(Stream* s)
|
||||
{
|
||||
// Set its footage parent to this
|
||||
s->set_footage(this);
|
||||
s->setParent(this);
|
||||
|
||||
// Add a copy of this stream to the list
|
||||
streams_.append(s);
|
||||
}
|
||||
|
||||
StreamPtr Footage::stream(int index) const
|
||||
void Footage::add_streams(const QVector<Stream *> &streams)
|
||||
{
|
||||
return streams_.at(index);
|
||||
foreach (Stream* s, streams) {
|
||||
s->setParent(this);
|
||||
}
|
||||
|
||||
streams_.append(streams);
|
||||
}
|
||||
|
||||
const QList<StreamPtr> &Footage::streams() const
|
||||
Stream* Footage::stream(int index) const
|
||||
{
|
||||
return streams_;
|
||||
return streams_.at(index);
|
||||
}
|
||||
|
||||
int Footage::stream_count() const
|
||||
@@ -161,16 +165,15 @@ void Footage::set_decoder(const QString &id)
|
||||
QIcon Footage::icon()
|
||||
{
|
||||
if (valid_ && !streams_.isEmpty()) {
|
||||
StreamPtr first_stream = streams_.first();
|
||||
// Prioritize video > audio > image
|
||||
Stream* s = get_first_enabled_stream_of_type(Stream::kVideo);
|
||||
|
||||
if (first_stream->type() == Stream::kVideo) {
|
||||
if (std::static_pointer_cast<VideoStream>(first_stream)->video_type() == VideoStream::kVideoTypeStill) {
|
||||
return icon::Image;
|
||||
} else {
|
||||
return icon::Video;
|
||||
}
|
||||
} else if (first_stream->type() == Stream::kAudio) {
|
||||
if (s && static_cast<VideoStream*>(s)->video_type() != VideoStream::kVideoTypeStill) {
|
||||
return icon::Video;
|
||||
} else if (HasEnabledStreamsOfType(Stream::kAudio)) {
|
||||
return icon::Audio;
|
||||
} else if (s && static_cast<VideoStream*>(s)->video_type() == VideoStream::kVideoTypeStill) {
|
||||
return icon::Image;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,10 +183,10 @@ QIcon Footage::icon()
|
||||
QString Footage::duration()
|
||||
{
|
||||
// Find longest stream duration
|
||||
StreamPtr longest_stream = nullptr;
|
||||
Stream* longest_stream = nullptr;
|
||||
rational longest;
|
||||
|
||||
foreach (StreamPtr stream, streams_) {
|
||||
foreach (Stream* stream, streams_) {
|
||||
if (stream->enabled() && (stream->type() == Stream::kVideo || stream->type() == Stream::kAudio)) {
|
||||
rational this_stream_dur = Timecode::timestamp_to_time(stream->duration(),
|
||||
stream->timebase());
|
||||
@@ -197,7 +200,7 @@ QString Footage::duration()
|
||||
|
||||
if (longest_stream) {
|
||||
if (longest_stream->type() == Stream::kVideo) {
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(longest_stream);
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(longest_stream);
|
||||
|
||||
if (video_stream->video_type() != VideoStream::kVideoTypeStill) {
|
||||
int64_t duration = video_stream->duration();
|
||||
@@ -214,8 +217,6 @@ QString Footage::duration()
|
||||
Core::instance()->GetTimecodeDisplay());
|
||||
}
|
||||
} else if (longest_stream->type() == Stream::kAudio) {
|
||||
AudioStreamPtr audio_stream = std::static_pointer_cast<AudioStream>(longest_stream);
|
||||
|
||||
// If we're showing in a timecode, we prefer showing audio in seconds instead
|
||||
Timecode::Display display = Core::instance()->GetTimecodeDisplay();
|
||||
if (display == Timecode::kTimecodeDropFrame
|
||||
@@ -238,16 +239,16 @@ QString Footage::rate()
|
||||
return QString();
|
||||
}
|
||||
|
||||
if (HasStreamsOfType(Stream::kVideo)) {
|
||||
if (HasEnabledStreamsOfType(Stream::kVideo)) {
|
||||
// This is a video editor, prioritize video streams
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(get_first_stream_of_type(Stream::kVideo));
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(get_first_enabled_stream_of_type(Stream::kVideo));
|
||||
|
||||
if (video_stream->video_type() != VideoStream::kVideoTypeStill) {
|
||||
return QCoreApplication::translate("Footage", "%1 FPS").arg(video_stream->frame_rate().toDouble());
|
||||
}
|
||||
} else if (HasStreamsOfType(Stream::kAudio)) {
|
||||
} else if (HasEnabledStreamsOfType(Stream::kAudio)) {
|
||||
// No video streams, return audio
|
||||
AudioStreamPtr audio_stream = std::static_pointer_cast<AudioStream>(streams_.first());
|
||||
AudioStream* audio_stream = static_cast<AudioStream*>(streams_.first());
|
||||
return QCoreApplication::translate("Footage", "%1 Hz").arg(audio_stream->sample_rate());
|
||||
}
|
||||
|
||||
@@ -259,7 +260,7 @@ quint64 Footage::get_enabled_stream_flags() const
|
||||
quint64 enabled_streams = 0;
|
||||
quint64 stream_enabler = 1;
|
||||
|
||||
foreach (StreamPtr s, streams_) {
|
||||
foreach (Stream* s, streams_) {
|
||||
if (s->enabled()) {
|
||||
enabled_streams |= stream_enabler;
|
||||
}
|
||||
@@ -276,10 +277,10 @@ void Footage::ClearStreams()
|
||||
streams_.clear();
|
||||
}
|
||||
|
||||
bool Footage::HasStreamsOfType(const Stream::Type &type) const
|
||||
bool Footage::HasEnabledStreamsOfType(const Stream::Type &type) const
|
||||
{
|
||||
// Return true if any streams are video streams
|
||||
foreach (StreamPtr stream, streams_) {
|
||||
foreach (Stream* stream, streams_) {
|
||||
if (stream->enabled() && stream->type() == type) {
|
||||
return true;
|
||||
}
|
||||
@@ -288,9 +289,9 @@ bool Footage::HasStreamsOfType(const Stream::Type &type) const
|
||||
return false;
|
||||
}
|
||||
|
||||
StreamPtr Footage::get_first_stream_of_type(const Stream::Type &type) const
|
||||
Stream *Footage::get_first_enabled_stream_of_type(const Stream::Type &type) const
|
||||
{
|
||||
foreach (StreamPtr stream, streams_) {
|
||||
foreach (Stream* stream, streams_) {
|
||||
if (stream->enabled() && stream->type() == type) {
|
||||
return stream;
|
||||
}
|
||||
@@ -299,7 +300,7 @@ StreamPtr Footage::get_first_stream_of_type(const Stream::Type &type) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Footage::CompareFootageToFile(FootagePtr footage, const QString &filename)
|
||||
bool Footage::CompareFootageToFile(Footage *footage, const QString &filename)
|
||||
{
|
||||
// Heuristic to determine if file has changed
|
||||
QFileInfo info(filename);
|
||||
@@ -311,9 +312,9 @@ bool Footage::CompareFootageToFile(FootagePtr footage, const QString &filename)
|
||||
} else {
|
||||
// Footage may have changed and we'll have to re-probe it. It also may not have, in which
|
||||
// case nothing needs to change.
|
||||
ItemPtr item = Decoder::Probe(footage->project(), filename, nullptr);
|
||||
std::unique_ptr<Footage> item(Decoder::Probe(footage->project(), filename, nullptr));
|
||||
|
||||
if (item && item->type() == footage->type()) {
|
||||
if (item) {
|
||||
// Item is the same type, that's a good sign. Let's look for any differences.
|
||||
// FIXME: Implement this
|
||||
return true;
|
||||
@@ -325,7 +326,7 @@ bool Footage::CompareFootageToFile(FootagePtr footage, const QString &filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Footage::CompareFootageToItsFilename(FootagePtr footage)
|
||||
bool Footage::CompareFootageToItsFilename(Footage *footage)
|
||||
{
|
||||
return CompareFootageToFile(footage, footage->filename());
|
||||
}
|
||||
@@ -336,7 +337,7 @@ void Footage::UpdateTooltip()
|
||||
QString tip = QCoreApplication::translate("Footage", "Filename: %1").arg(filename());
|
||||
|
||||
if (!streams_.isEmpty()) {
|
||||
foreach (StreamPtr s, streams_) {
|
||||
foreach (Stream* s, streams_) {
|
||||
if (s->enabled()) {
|
||||
tip.append("\n");
|
||||
tip.append(s->description());
|
||||
|
||||
@@ -32,9 +32,6 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
class Footage;
|
||||
using FootagePtr = std::shared_ptr<Footage>;
|
||||
|
||||
/**
|
||||
* @brief A reference to an external media file with metadata in a project structure
|
||||
*
|
||||
@@ -44,6 +41,7 @@ using FootagePtr = std::shared_ptr<Footage>;
|
||||
*/
|
||||
class Footage : public Item, public TimelinePoints
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief Footage Constructor
|
||||
@@ -136,7 +134,9 @@ public:
|
||||
*
|
||||
* A pointer to a stream object. The Footage takes ownership of this object and will free it when it's deleted.
|
||||
*/
|
||||
void add_stream(StreamPtr s);
|
||||
void add_stream(Stream *s);
|
||||
|
||||
void add_streams(const QVector<Stream*>& streams);
|
||||
|
||||
/**
|
||||
* @brief Retrieve a stream at the given index.
|
||||
@@ -150,12 +150,15 @@ public:
|
||||
*
|
||||
* The stream at the index provided
|
||||
*/
|
||||
StreamPtr stream(int index) const;
|
||||
Stream *stream(int index) const;
|
||||
|
||||
/**
|
||||
* @brief Returns a list of the streams in this Footage
|
||||
*/
|
||||
const QList<StreamPtr>& streams() const;
|
||||
const QVector<Stream*>& streams() const
|
||||
{
|
||||
return streams_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieve total number of streams in this Footage file
|
||||
@@ -198,12 +201,12 @@ public:
|
||||
*
|
||||
* The stream type to check for
|
||||
*/
|
||||
bool HasStreamsOfType(const Stream::Type& type) const;
|
||||
bool HasEnabledStreamsOfType(const Stream::Type& type) const;
|
||||
|
||||
StreamPtr get_first_stream_of_type(const Stream::Type& type) const;
|
||||
Stream* get_first_enabled_stream_of_type(const Stream::Type& type) const;
|
||||
|
||||
static bool CompareFootageToFile(FootagePtr footage, const QString& filename);
|
||||
static bool CompareFootageToItsFilename(FootagePtr footage);
|
||||
static bool CompareFootageToFile(Footage* footage, const QString& filename);
|
||||
static bool CompareFootageToItsFilename(Footage* footage);
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -240,7 +243,7 @@ private:
|
||||
/**
|
||||
* @brief Internal streams array
|
||||
*/
|
||||
QList<StreamPtr> streams_;
|
||||
QVector<Stream*> streams_;
|
||||
|
||||
/**
|
||||
* @brief Internal attached decoder ID
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
namespace olive {
|
||||
|
||||
Stream::Stream() :
|
||||
footage_(nullptr),
|
||||
type_(kUnknown),
|
||||
enabled_(true)
|
||||
{
|
||||
@@ -37,22 +36,22 @@ Stream::~Stream()
|
||||
{
|
||||
}
|
||||
|
||||
StreamPtr Stream::Load(QXmlStreamReader *reader, XMLNodeData &xml_node_data, const QAtomicInt* cancelled)
|
||||
Stream *Stream::Load(QXmlStreamReader *reader, XMLNodeData &xml_node_data, const QAtomicInt* cancelled)
|
||||
{
|
||||
StreamPtr stream;
|
||||
Stream* stream = nullptr;
|
||||
|
||||
XMLAttributeLoop(reader, attr) {
|
||||
if (attr.name() == QStringLiteral("type")) {
|
||||
Stream::Type type = static_cast<Stream::Type>(attr.value().toInt());
|
||||
switch (type) {
|
||||
case Stream::kVideo:
|
||||
stream = std::make_shared<VideoStream>();
|
||||
stream = new VideoStream();
|
||||
break;
|
||||
case Stream::kAudio:
|
||||
stream = std::make_shared<AudioStream>();
|
||||
stream = new AudioStream();
|
||||
break;
|
||||
default:
|
||||
stream = std::make_shared<Stream>();
|
||||
stream = new Stream();
|
||||
stream->set_type(type);
|
||||
break;
|
||||
}
|
||||
@@ -62,6 +61,10 @@ StreamPtr Stream::Load(QXmlStreamReader *reader, XMLNodeData &xml_node_data, con
|
||||
}
|
||||
}
|
||||
|
||||
if (!stream) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("ptr")) {
|
||||
xml_node_data.footage_ptrs.insert(reader->readElementText().toULongLong(), stream);
|
||||
@@ -121,12 +124,7 @@ void Stream::set_type(const Stream::Type &type)
|
||||
|
||||
Footage *Stream::footage() const
|
||||
{
|
||||
return footage_;
|
||||
}
|
||||
|
||||
void Stream::set_footage(Footage *f)
|
||||
{
|
||||
footage_ = f;
|
||||
return dynamic_cast<Footage*>(parent());
|
||||
}
|
||||
|
||||
const rational &Stream::timebase() const
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
namespace olive {
|
||||
|
||||
class Footage;
|
||||
class Stream;
|
||||
using StreamPtr = std::shared_ptr<Stream>;
|
||||
struct XMLNodeData;
|
||||
|
||||
/**
|
||||
@@ -69,7 +67,7 @@ public:
|
||||
*/
|
||||
virtual ~Stream() override;
|
||||
|
||||
static StreamPtr Load(QXmlStreamReader* reader, XMLNodeData& xml_node_data, const QAtomicInt* cancelled);
|
||||
static Stream* Load(QXmlStreamReader* reader, XMLNodeData& xml_node_data, const QAtomicInt* cancelled);
|
||||
|
||||
void Save(QXmlStreamWriter *writer) const;
|
||||
|
||||
@@ -79,7 +77,6 @@ public:
|
||||
void set_type(const Type& type);
|
||||
|
||||
Footage* footage() const;
|
||||
void set_footage(Footage* f);
|
||||
|
||||
const rational& timebase() const;
|
||||
void set_timebase(const rational& timebase);
|
||||
@@ -109,8 +106,6 @@ signals:
|
||||
void ParametersChanged();
|
||||
|
||||
private:
|
||||
Footage* footage_;
|
||||
|
||||
rational timebase_;
|
||||
|
||||
int64_t duration_;
|
||||
@@ -127,7 +122,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#include <QMetaType>
|
||||
Q_DECLARE_METATYPE(olive::StreamPtr)
|
||||
|
||||
#endif // STREAM_H
|
||||
|
||||
@@ -174,8 +174,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
using VideoStreamPtr = std::shared_ptr<VideoStream>;
|
||||
|
||||
}
|
||||
|
||||
#endif // VIDEOSTREAM_H
|
||||
|
||||
+28
-73
@@ -23,7 +23,7 @@
|
||||
namespace olive {
|
||||
|
||||
Item::Item() :
|
||||
parent_(nullptr),
|
||||
item_parent_(nullptr),
|
||||
project_(nullptr)
|
||||
{
|
||||
}
|
||||
@@ -32,65 +32,6 @@ Item::~Item()
|
||||
{
|
||||
}
|
||||
|
||||
void Item::add_child(ItemPtr c)
|
||||
{
|
||||
if (c->parent_ == this) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->parent_ != nullptr) {
|
||||
c->parent_->remove_child(c.get());
|
||||
}
|
||||
|
||||
children_.append(c);
|
||||
c->parent_ = this;
|
||||
}
|
||||
|
||||
void Item::remove_child(Item *c)
|
||||
{
|
||||
if (c->parent_ != this) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove all instances of this child in the list
|
||||
for (int i=0;i<children_.size();i++) {
|
||||
if (children_.at(i).get() == c) {
|
||||
children_.removeAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
c->parent_ = nullptr;
|
||||
}
|
||||
|
||||
int Item::child_count() const
|
||||
{
|
||||
return children_.size();
|
||||
}
|
||||
|
||||
Item *Item::child(int i) const
|
||||
{
|
||||
return children_.at(i).get();
|
||||
}
|
||||
|
||||
const QList<ItemPtr> &Item::children() const
|
||||
{
|
||||
return children_;
|
||||
}
|
||||
|
||||
ItemPtr Item::get_shared_ptr() const
|
||||
{
|
||||
QList<ItemPtr> siblings = parent()->children();
|
||||
|
||||
foreach (ItemPtr s, siblings) {
|
||||
if (s.get() == this) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const QString &Item::name() const
|
||||
{
|
||||
return name_;
|
||||
@@ -123,17 +64,12 @@ QString Item::rate()
|
||||
return QString();
|
||||
}
|
||||
|
||||
Item *Item::parent() const
|
||||
{
|
||||
return parent_;
|
||||
}
|
||||
|
||||
const Item *Item::root() const
|
||||
{
|
||||
const Item* item = this;
|
||||
|
||||
while (item->parent()) {
|
||||
item = item->parent();
|
||||
while (item->item_parent()) {
|
||||
item = item->item_parent();
|
||||
}
|
||||
|
||||
return item;
|
||||
@@ -151,11 +87,11 @@ void Item::set_project(Project *project)
|
||||
project_ = project;
|
||||
}
|
||||
|
||||
QList<ItemPtr> Item::get_children_of_type(Type type, bool recursive) const
|
||||
QVector<Item *> Item::get_children_of_type(Type type, bool recursive) const
|
||||
{
|
||||
QList<ItemPtr> list;
|
||||
QVector<Item *> list;
|
||||
|
||||
foreach (ItemPtr item, children_) {
|
||||
foreach (Item* item, item_children_) {
|
||||
if (item->type() == type) {
|
||||
list.append(item);
|
||||
}
|
||||
@@ -182,12 +118,31 @@ void Item::NameChangedEvent(const QString &)
|
||||
{
|
||||
}
|
||||
|
||||
void Item::childEvent(QChildEvent *event)
|
||||
{
|
||||
QObject::childEvent(event);
|
||||
|
||||
Item* cast_test = dynamic_cast<Item*>(event->child());
|
||||
|
||||
if (cast_test) {
|
||||
if (event->type() == QEvent::ChildAdded) {
|
||||
|
||||
item_children_.append(cast_test);
|
||||
cast_test->item_parent_ = this;
|
||||
|
||||
} else if (event->type() == QEvent::ChildRemoved) {
|
||||
|
||||
item_children_.removeOne(cast_test);
|
||||
cast_test->item_parent_ = nullptr;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Item::ChildExistsWithNameInternal(const QString &name, Item *folder)
|
||||
{
|
||||
// Loop through all children
|
||||
for (int i=0;i<folder->child_count();i++) {
|
||||
Item* child = folder->child(i);
|
||||
|
||||
foreach (Item* child, folder->item_children_) {
|
||||
// If this child has the same name, return true
|
||||
if (child->name() == name) {
|
||||
return true;
|
||||
|
||||
+26
-17
@@ -37,17 +37,15 @@ namespace olive {
|
||||
|
||||
class Project;
|
||||
|
||||
class Item;
|
||||
using ItemPtr = std::shared_ptr<Item>;
|
||||
|
||||
/**
|
||||
* @brief A base-class representing any element in a Project
|
||||
*
|
||||
* Project objects implement a parent-child hierarchy of Items that can be used throughout the Project. The Item class
|
||||
* itself is abstract and will need to be subclassed to be used in a Project.
|
||||
*/
|
||||
class Item
|
||||
class Item : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Type {
|
||||
kFolder,
|
||||
@@ -65,21 +63,26 @@ public:
|
||||
*/
|
||||
virtual ~Item();
|
||||
|
||||
DISABLE_COPY_MOVE(Item)
|
||||
|
||||
virtual void Load(QXmlStreamReader* reader, XMLNodeData &xml_node_data, uint version, const QAtomicInt *cancelled) = 0;
|
||||
|
||||
virtual void Save(QXmlStreamWriter* writer) const = 0;
|
||||
|
||||
virtual Type type() const = 0;
|
||||
|
||||
void add_child(ItemPtr c);
|
||||
void remove_child(Item* c);
|
||||
int child_count() const;
|
||||
Item* child(int i) const;
|
||||
const QList<ItemPtr>& children() const;
|
||||
int item_child_count() const
|
||||
{
|
||||
return item_children_.size();
|
||||
}
|
||||
|
||||
ItemPtr get_shared_ptr() const;
|
||||
Item* item_child(int i) const
|
||||
{
|
||||
return item_children_.at(i);
|
||||
}
|
||||
|
||||
const QVector<Item*>& children() const
|
||||
{
|
||||
return item_children_;
|
||||
}
|
||||
|
||||
const QString& name() const;
|
||||
void set_name(const QString& n);
|
||||
@@ -93,13 +96,17 @@ public:
|
||||
|
||||
virtual QString rate();
|
||||
|
||||
Item *parent() const;
|
||||
Item *item_parent() const
|
||||
{
|
||||
return item_parent_;
|
||||
}
|
||||
|
||||
const Item* root() const;
|
||||
|
||||
Project* project() const;
|
||||
void set_project(Project* project);
|
||||
|
||||
QList<ItemPtr> get_children_of_type(Type type, bool recursive) const;
|
||||
QVector<Item*> get_children_of_type(Type type, bool recursive) const;
|
||||
|
||||
virtual bool CanHaveChildren() const;
|
||||
|
||||
@@ -108,12 +115,14 @@ public:
|
||||
protected:
|
||||
virtual void NameChangedEvent(const QString& name);
|
||||
|
||||
virtual void childEvent(QChildEvent *event) override;
|
||||
|
||||
private:
|
||||
bool ChildExistsWithNameInternal(const QString& name, Item* folder);
|
||||
static bool ChildExistsWithNameInternal(const QString& name, Item* folder);
|
||||
|
||||
QList<ItemPtr> children_;
|
||||
QVector<Item*> item_children_;
|
||||
|
||||
Item* parent_;
|
||||
Item* item_parent_;
|
||||
|
||||
Project* project_;
|
||||
|
||||
|
||||
@@ -171,12 +171,6 @@ void Sequence::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, uint v
|
||||
|
||||
// Link blocks
|
||||
XMLLinkBlocks(xml_node_data);
|
||||
|
||||
// Ensure this and all children are in the main thread
|
||||
// NOTE: It might be good to move the Item system to QObjects so they inherit their thread
|
||||
if (QThread::currentThread() != qApp->thread()) {
|
||||
moveToThread(qApp->thread());
|
||||
}
|
||||
}
|
||||
|
||||
void Sequence::Save(QXmlStreamWriter *writer) const
|
||||
@@ -302,7 +296,7 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
|
||||
bool found_audio_params = false;
|
||||
|
||||
foreach (Footage* f, footage) {
|
||||
foreach (StreamPtr s, f->streams()) {
|
||||
foreach (Stream* s, f->streams()) {
|
||||
if (!s->enabled()) {
|
||||
continue;
|
||||
}
|
||||
@@ -310,7 +304,7 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
|
||||
switch (s->type()) {
|
||||
case Stream::kVideo:
|
||||
{
|
||||
VideoStream* vs = static_cast<VideoStream*>(s.get());
|
||||
VideoStream* vs = static_cast<VideoStream*>(s);
|
||||
|
||||
// If this is a video stream, use these parameters
|
||||
if (!found_video_params) {
|
||||
@@ -339,7 +333,7 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
|
||||
}
|
||||
case Stream::kAudio:
|
||||
if (!found_audio_params) {
|
||||
AudioStream* as = static_cast<AudioStream*>(s.get());
|
||||
AudioStream* as = static_cast<AudioStream*>(s);
|
||||
set_audio_params(AudioParams(as->sample_rate(), as->channel_layout(), AudioParams::kInternalFormat));
|
||||
found_audio_params = true;
|
||||
}
|
||||
|
||||
@@ -31,14 +31,12 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
class Sequence;
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
/**
|
||||
* @brief The main timeline object, an graph of edited clips that forms a complete edit
|
||||
*/
|
||||
class Sequence : public Item, public NodeGraph, public TimelinePoints
|
||||
class Sequence : public NodeGraph, public TimelinePoints
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Sequence();
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ ColorManager *Project::color_manager()
|
||||
return &color_manager_;
|
||||
}
|
||||
|
||||
QList<ItemPtr> Project::get_items_of_type(Item::Type type) const
|
||||
QVector<Item *> Project::get_items_of_type(Item::Type type) const
|
||||
{
|
||||
return root_.get_children_of_type(type, true);
|
||||
}
|
||||
@@ -204,12 +204,12 @@ const QString &Project::cache_path(bool default_if_empty) const
|
||||
|
||||
void Project::ColorConfigChanged()
|
||||
{
|
||||
QList<ItemPtr> footage = this->get_items_of_type(Item::kFootage);
|
||||
QVector<Item*> footage = this->get_items_of_type(Item::kFootage);
|
||||
|
||||
foreach (ItemPtr item, footage) {
|
||||
foreach (StreamPtr s, std::static_pointer_cast<Footage>(item)->streams()) {
|
||||
foreach (Item* item, footage) {
|
||||
foreach (Stream* s, static_cast<Footage*>(item)->streams()) {
|
||||
if (s->type() == Stream::kVideo) {
|
||||
std::static_pointer_cast<VideoStream>(s)->ColorConfigChanged();
|
||||
static_cast<VideoStream*>(s)->ColorConfigChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,12 +217,12 @@ void Project::ColorConfigChanged()
|
||||
|
||||
void Project::DefaultColorSpaceChanged()
|
||||
{
|
||||
QList<ItemPtr> footage = this->get_items_of_type(Item::kFootage);
|
||||
QVector<Item*> footage = this->get_items_of_type(Item::kFootage);
|
||||
|
||||
foreach (ItemPtr item, footage) {
|
||||
foreach (StreamPtr s, std::static_pointer_cast<Footage>(item)->streams()) {
|
||||
foreach (Item* item, footage) {
|
||||
foreach (Stream* s, static_cast<Footage*>(item)->streams()) {
|
||||
if (s->type() == Stream::kVideo) {
|
||||
std::static_pointer_cast<VideoStream>(s)->DefaultColorSpaceChanged();
|
||||
static_cast<VideoStream*>(s)->DefaultColorSpaceChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
ColorManager* color_manager();
|
||||
|
||||
QList<ItemPtr> get_items_of_type(Item::Type type) const;
|
||||
QVector<Item*> get_items_of_type(Item::Type type) const;
|
||||
|
||||
bool is_modified() const;
|
||||
void set_modified(bool e);
|
||||
|
||||
@@ -64,7 +64,7 @@ QModelIndex ProjectViewModel::index(int row, int column, const QModelIndex &pare
|
||||
Item* item_parent = GetItemObjectFromIndex(parent);
|
||||
|
||||
// Return an index to this object
|
||||
return createIndex(row, column, item_parent->child(row));
|
||||
return createIndex(row, column, item_parent->item_child(row));
|
||||
}
|
||||
|
||||
QModelIndex ProjectViewModel::parent(const QModelIndex &child) const
|
||||
@@ -73,7 +73,7 @@ QModelIndex ProjectViewModel::parent(const QModelIndex &child) const
|
||||
Item* item = GetItemObjectFromIndex(child);
|
||||
|
||||
// Get Item's parent object
|
||||
Item* par = item->parent();
|
||||
Item* par = item->item_parent();
|
||||
|
||||
// If the parent is the root, return an empty index
|
||||
if (par == project_->root()) {
|
||||
@@ -99,11 +99,11 @@ int ProjectViewModel::rowCount(const QModelIndex &parent) const
|
||||
|
||||
// If the index is the root, return the root child count
|
||||
if (parent == QModelIndex()) {
|
||||
return project_->root()->child_count();
|
||||
return project_->root()->item_child_count();
|
||||
}
|
||||
|
||||
// Otherwise, the index must contain a valid pointer, so we just return its child count
|
||||
return GetItemObjectFromIndex(parent)->child_count();
|
||||
return GetItemObjectFromIndex(parent)->item_child_count();
|
||||
}
|
||||
|
||||
int ProjectViewModel::columnCount(const QModelIndex &parent) const
|
||||
@@ -375,7 +375,7 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action
|
||||
|
||||
// If we didn't drop onto an item, find the nearest parent folder (should eventually terminate at root either way)
|
||||
while (!drop_item->CanHaveChildren()) {
|
||||
drop_item = drop_item->parent();
|
||||
drop_item = drop_item->item_parent();
|
||||
}
|
||||
|
||||
// Trigger an import
|
||||
@@ -385,7 +385,7 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action
|
||||
return false;
|
||||
}
|
||||
|
||||
void ProjectViewModel::AddChild(Item *parent, ItemPtr child)
|
||||
void ProjectViewModel::AddChild(Item *parent, Item *child)
|
||||
{
|
||||
QModelIndex parent_index;
|
||||
|
||||
@@ -393,14 +393,14 @@ void ProjectViewModel::AddChild(Item *parent, ItemPtr child)
|
||||
parent_index = CreateIndexFromItem(parent);
|
||||
}
|
||||
|
||||
beginInsertRows(parent_index, parent->child_count(), parent->child_count());
|
||||
beginInsertRows(parent_index, parent->item_child_count(), parent->item_child_count());
|
||||
|
||||
parent->add_child(child);
|
||||
child->setParent(parent);
|
||||
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void ProjectViewModel::RemoveChild(Item *parent, Item *child)
|
||||
void ProjectViewModel::RemoveChild(Item *parent, Item *child, QObject *new_parent)
|
||||
{
|
||||
QModelIndex parent_index;
|
||||
|
||||
@@ -412,7 +412,7 @@ void ProjectViewModel::RemoveChild(Item *parent, Item *child)
|
||||
|
||||
beginRemoveRows(parent_index, child_row, child_row);
|
||||
|
||||
parent->remove_child(child);
|
||||
child->setParent(new_parent);
|
||||
|
||||
endRemoveRows();
|
||||
}
|
||||
@@ -435,11 +435,11 @@ int ProjectViewModel::IndexOfChild(Item *item) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
Item* parent = item->parent();
|
||||
Item* parent = item->item_parent();
|
||||
|
||||
if (parent != nullptr) {
|
||||
for (int i=0;i<parent->child_count();i++) {
|
||||
if (parent->child(i) == item) {
|
||||
for (int i=0;i<parent->item_child_count();i++) {
|
||||
if (parent->item_child(i) == item) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -452,7 +452,7 @@ int ProjectViewModel::ChildCount(const QModelIndex &index)
|
||||
{
|
||||
Item* item = GetItemObjectFromIndex(index);
|
||||
|
||||
return item->child_count();
|
||||
return item->item_child_count();
|
||||
}
|
||||
|
||||
Item *ProjectViewModel::GetItemObjectFromIndex(const QModelIndex &index) const
|
||||
@@ -468,7 +468,7 @@ bool ProjectViewModel::ItemIsParentOfChild(Item *parent, Item *child) const
|
||||
{
|
||||
// Loop through parent hierarchy checking if `parent` is one of its parents
|
||||
do {
|
||||
child = child->parent();
|
||||
child = child->item_parent();
|
||||
|
||||
if (parent == child) {
|
||||
return true;
|
||||
@@ -484,11 +484,10 @@ void ProjectViewModel::MoveItemInternal(Item *item, Item *destination)
|
||||
|
||||
QModelIndex destination_index = CreateIndexFromItem(destination);
|
||||
|
||||
beginMoveRows(item_index.parent(), item_index.row(), item_index.row(), destination_index, destination->child_count());
|
||||
beginMoveRows(item_index.parent(), item_index.row(), item_index.row(),
|
||||
destination_index, destination->item_child_count());
|
||||
|
||||
ItemPtr item_ptr = item->get_shared_ptr();
|
||||
|
||||
destination->add_child(item_ptr);
|
||||
item->setParent(destination);
|
||||
|
||||
endMoveRows();
|
||||
}
|
||||
@@ -553,13 +552,18 @@ void ProjectViewModel::RenameItemCommand::undo_internal()
|
||||
model_->RenameChild(item_, old_name_);
|
||||
}
|
||||
|
||||
ProjectViewModel::AddItemCommand::AddItemCommand(ProjectViewModel* model, Item* folder, ItemPtr child, QUndoCommand* parent) :
|
||||
ProjectViewModel::AddItemCommand::AddItemCommand(ProjectViewModel* model, Item* folder, Item* child, QUndoCommand* parent) :
|
||||
UndoCommand(parent),
|
||||
model_(model),
|
||||
parent_(folder),
|
||||
child_(child),
|
||||
done_(false)
|
||||
child_(child)
|
||||
{
|
||||
// Ensure all operations are done in folder's thread
|
||||
if (memory_manager_.thread() != parent_->thread()) {
|
||||
memory_manager_.moveToThread(parent_->thread());
|
||||
}
|
||||
|
||||
child_->setParent(&memory_manager_);
|
||||
}
|
||||
|
||||
Project *ProjectViewModel::AddItemCommand::GetRelevantProject() const
|
||||
@@ -570,22 +574,24 @@ Project *ProjectViewModel::AddItemCommand::GetRelevantProject() const
|
||||
void ProjectViewModel::AddItemCommand::redo_internal()
|
||||
{
|
||||
model_->AddChild(parent_, child_);
|
||||
|
||||
done_ = true;
|
||||
}
|
||||
|
||||
void ProjectViewModel::AddItemCommand::undo_internal()
|
||||
{
|
||||
model_->RemoveChild(parent_, child_.get());
|
||||
|
||||
done_ = false;
|
||||
model_->RemoveChild(parent_, child_, &memory_manager_);
|
||||
}
|
||||
|
||||
ProjectViewModel::RemoveItemCommand::RemoveItemCommand(ProjectViewModel *model, ItemPtr item, QUndoCommand *parent) :
|
||||
ProjectViewModel::RemoveItemCommand::RemoveItemCommand(ProjectViewModel *model, Item *item, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
model_(model),
|
||||
item_(item)
|
||||
{
|
||||
// Ensure all operations are done in folder's thread
|
||||
parent_ = item_->item_parent();
|
||||
|
||||
if (memory_manager_.thread() != item_->thread()) {
|
||||
memory_manager_.moveToThread(item_->thread());
|
||||
}
|
||||
}
|
||||
|
||||
Project *ProjectViewModel::RemoveItemCommand::GetRelevantProject() const
|
||||
@@ -595,8 +601,7 @@ Project *ProjectViewModel::RemoveItemCommand::GetRelevantProject() const
|
||||
|
||||
void ProjectViewModel::RemoveItemCommand::redo_internal()
|
||||
{
|
||||
parent_ = item_->parent();
|
||||
model_->RemoveChild(parent_, item_.get());
|
||||
model_->RemoveChild(parent_, item_, &memory_manager_);
|
||||
}
|
||||
|
||||
void ProjectViewModel::RemoveItemCommand::undo_internal()
|
||||
|
||||
@@ -100,8 +100,8 @@ public:
|
||||
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
|
||||
|
||||
/** Other model functions */
|
||||
void AddChild(Item* parent, ItemPtr child);
|
||||
void RemoveChild(Item* parent, Item* child);
|
||||
void AddChild(Item* parent, Item* child);
|
||||
void RemoveChild(Item* parent, Item* child, QObject* new_parent);
|
||||
void RenameChild(Item* item, const QString& name);
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
*/
|
||||
class AddItemCommand : public UndoCommand {
|
||||
public:
|
||||
AddItemCommand(ProjectViewModel* model, Item* folder, ItemPtr child, QUndoCommand* parent = nullptr);
|
||||
AddItemCommand(ProjectViewModel* model, Item* folder, Item *child, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -169,8 +169,9 @@ public:
|
||||
private:
|
||||
ProjectViewModel* model_;
|
||||
Item* parent_;
|
||||
ItemPtr child_;
|
||||
bool done_;
|
||||
Item* child_;
|
||||
QObject memory_manager_;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -178,7 +179,7 @@ public:
|
||||
*/
|
||||
class RemoveItemCommand : public UndoCommand {
|
||||
public:
|
||||
RemoveItemCommand(ProjectViewModel* model, ItemPtr item, QUndoCommand* parent = nullptr);
|
||||
RemoveItemCommand(ProjectViewModel* model, Item* item, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -189,10 +190,9 @@ public:
|
||||
|
||||
private:
|
||||
ProjectViewModel* model_;
|
||||
|
||||
ItemPtr item_;
|
||||
|
||||
Item* item_;
|
||||
Item* parent_;
|
||||
QObject memory_manager_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ void RenderProcessor::Run()
|
||||
}
|
||||
}
|
||||
|
||||
DecoderPtr RenderProcessor::ResolveDecoderFromInput(StreamPtr stream)
|
||||
DecoderPtr RenderProcessor::ResolveDecoderFromInput(Stream *stream)
|
||||
{
|
||||
if (!stream) {
|
||||
qWarning() << "Attempted to resolve the decoder of a null stream";
|
||||
@@ -162,14 +162,14 @@ DecoderPtr RenderProcessor::ResolveDecoderFromInput(StreamPtr stream)
|
||||
|
||||
QMutexLocker locker(decoder_cache_->mutex());
|
||||
|
||||
DecoderPtr decoder = decoder_cache_->value(stream.get());
|
||||
DecoderPtr decoder = decoder_cache_->value(stream);
|
||||
|
||||
if (!decoder) {
|
||||
// No decoder
|
||||
decoder = Decoder::CreateFromID(stream->footage()->decoder());
|
||||
|
||||
if (decoder->Open(stream)) {
|
||||
decoder_cache_->insert(stream.get(), decoder);
|
||||
decoder_cache_->insert(stream, decoder);
|
||||
} else {
|
||||
qWarning() << "Failed to open decoder for" << stream->footage()->filename()
|
||||
<< "::" << stream->index();
|
||||
@@ -262,14 +262,13 @@ NodeValueTable RenderProcessor::GenerateBlockTable(const TrackOutput *track, con
|
||||
}
|
||||
}
|
||||
|
||||
QVariant RenderProcessor::ProcessVideoFootage(StreamPtr stream, const rational &input_time)
|
||||
QVariant RenderProcessor::ProcessVideoFootage(VideoStream *video_stream, const rational &input_time)
|
||||
{
|
||||
TexturePtr value = nullptr;
|
||||
|
||||
// Check the still frame cache. On large frames such as high resolution still images, uploading
|
||||
// and color managing them for every frame is a waste of time, so we implement a small cache here
|
||||
// to optimize such a situation
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream);
|
||||
const VideoParams& video_params = ticket_->property("vparam").value<VideoParams>();
|
||||
|
||||
ColorManager* color_manager = Node::ValueToPtr<ColorManager>(ticket_->property("colormanager"));
|
||||
@@ -284,7 +283,7 @@ QVariant RenderProcessor::ProcessVideoFootage(StreamPtr stream, const rational &
|
||||
|
||||
StillImageCache::EntryPtr want_entry = std::make_shared<StillImageCache::Entry>(
|
||||
nullptr,
|
||||
stream,
|
||||
video_stream,
|
||||
ColorProcessor::GenerateID(color_manager, video_stream->colorspace(), color_manager->GetReferenceColorSpace()),
|
||||
video_stream->premultiplied_alpha(),
|
||||
footage_divider,
|
||||
@@ -325,7 +324,7 @@ QVariant RenderProcessor::ProcessVideoFootage(StreamPtr stream, const rational &
|
||||
|
||||
still_image_cache_->mutex()->unlock();
|
||||
|
||||
DecoderPtr decoder = ResolveDecoderFromInput(stream);
|
||||
DecoderPtr decoder = ResolveDecoderFromInput(video_stream);
|
||||
|
||||
if (decoder) {
|
||||
FramePtr frame = decoder->RetrieveVideo(input_time,
|
||||
@@ -367,7 +366,7 @@ QVariant RenderProcessor::ProcessVideoFootage(StreamPtr stream, const rational &
|
||||
return QVariant::fromValue(value);
|
||||
}
|
||||
|
||||
QVariant RenderProcessor::ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time)
|
||||
QVariant RenderProcessor::ProcessAudioFootage(AudioStream *stream, const TimeRange &input_time)
|
||||
{
|
||||
QVariant value;
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ public:
|
||||
protected:
|
||||
virtual NodeValueTable GenerateBlockTable(const TrackOutput *track, const TimeRange &range) override;
|
||||
|
||||
virtual QVariant ProcessVideoFootage(StreamPtr stream, const rational &input_time) override;
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* video_stream, const rational &input_time) override;
|
||||
|
||||
virtual QVariant ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time) override;
|
||||
virtual QVariant ProcessAudioFootage(AudioStream* stream, const TimeRange &input_time) override;
|
||||
|
||||
virtual QVariant ProcessShader(const Node *node, const TimeRange &range, const ShaderJob& job) override;
|
||||
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
|
||||
void Run();
|
||||
|
||||
DecoderPtr ResolveDecoderFromInput(StreamPtr stream);
|
||||
DecoderPtr ResolveDecoderFromInput(Stream* stream);
|
||||
|
||||
RenderTicketPtr ticket_;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include "common/rational.h"
|
||||
#include "project/item/footage/stream.h"
|
||||
#include "project/item/footage/videostream.h"
|
||||
#include "render/texture.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -14,7 +14,7 @@ class StillImageCache
|
||||
{
|
||||
public:
|
||||
struct Entry {
|
||||
Entry(TexturePtr t, StreamPtr s, const QString& cs, bool a, int d, const rational& i, bool w)
|
||||
Entry(TexturePtr t, VideoStream* s, const QString& cs, bool a, int d, const rational& i, bool w)
|
||||
{
|
||||
texture = t;
|
||||
stream = s;
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
}
|
||||
|
||||
TexturePtr texture;
|
||||
StreamPtr stream;
|
||||
VideoStream* stream;
|
||||
QString colorspace;
|
||||
bool alpha_is_associated;
|
||||
int divider;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
ConformTask::ConformTask(AudioStreamPtr stream, const AudioParams& params) :
|
||||
ConformTask::ConformTask(AudioStream *stream, const AudioParams& params) :
|
||||
stream_(stream),
|
||||
params_(params)
|
||||
{
|
||||
|
||||
@@ -31,13 +31,13 @@ class ConformTask : public Task
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConformTask(AudioStreamPtr stream, const AudioParams& params);
|
||||
ConformTask(AudioStream* stream, const AudioParams& params);
|
||||
|
||||
protected:
|
||||
virtual bool Run() override;
|
||||
|
||||
private:
|
||||
AudioStreamPtr stream_;
|
||||
AudioStream* stream_;
|
||||
|
||||
AudioParams params_;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
PreCacheTask::PreCacheTask(VideoStreamPtr footage, Sequence* sequence) :
|
||||
PreCacheTask::PreCacheTask(VideoStream *footage, Sequence* sequence) :
|
||||
RenderTask(new ViewerOutput(), sequence->video_params(), sequence->audio_params()),
|
||||
footage_(footage)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ class PreCacheTask : public RenderTask
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreCacheTask(VideoStreamPtr footage, Sequence* sequence);
|
||||
PreCacheTask(VideoStream* footage, Sequence* sequence);
|
||||
|
||||
virtual ~PreCacheTask() override;
|
||||
|
||||
@@ -44,7 +44,7 @@ protected:
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples, qint64 job_time) override;
|
||||
|
||||
private:
|
||||
VideoStreamPtr footage_;
|
||||
VideoStream* footage_;
|
||||
|
||||
MediaInput* video_node_;
|
||||
|
||||
|
||||
@@ -93,8 +93,9 @@ void ProjectImportTask::Import(Folder *folder, QFileInfoList import, int &counte
|
||||
// Only proceed if the empty actually has files in it
|
||||
if (!entry_list.isEmpty()) {
|
||||
// Create a folder corresponding to the directory
|
||||
Folder* f = new Folder();
|
||||
|
||||
ItemPtr f = std::make_shared<Folder>();
|
||||
f->moveToThread(folder->thread());
|
||||
|
||||
f->set_name(file_info.fileName());
|
||||
|
||||
@@ -105,22 +106,25 @@ void ProjectImportTask::Import(Folder *folder, QFileInfoList import, int &counte
|
||||
parent_command);
|
||||
|
||||
// Recursively follow this path
|
||||
Import(static_cast<Folder*>(f.get()), entry_list, counter, parent_command);
|
||||
Import(f, entry_list, counter, parent_command);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
FootagePtr item = Decoder::Probe(model_->project(), file_info.absoluteFilePath(),
|
||||
&IsCancelled());
|
||||
Footage* footage = Decoder::Probe(model_->project(), file_info.absoluteFilePath(),
|
||||
&IsCancelled());
|
||||
|
||||
if (footage) {
|
||||
// Move footage to main thread
|
||||
footage->moveToThread(folder->thread());
|
||||
|
||||
if (item) {
|
||||
// See if this footage is an image sequence
|
||||
ValidateImageSequence(item, import, i);
|
||||
ValidateImageSequence(footage, import, i);
|
||||
|
||||
// Create undoable command that adds the items to the model
|
||||
new ProjectViewModel::AddItemCommand(model_,
|
||||
folder,
|
||||
item,
|
||||
footage,
|
||||
parent_command);
|
||||
} else {
|
||||
// Add to list so we can tell the user about it later
|
||||
@@ -135,15 +139,10 @@ void ProjectImportTask::Import(Folder *folder, QFileInfoList import, int &counte
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectImportTask::ValidateImageSequence(ItemPtr item, QFileInfoList& info_list, int index)
|
||||
void ProjectImportTask::ValidateImageSequence(Footage *footage, QFileInfoList& info_list, int index)
|
||||
{
|
||||
// Heuristically determine whether this file is part of an image sequence or not
|
||||
if (!ItemIsStillImageFootageOnly(item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
FootagePtr footage = std::static_pointer_cast<Footage>(item);
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(footage->streams().first());
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(footage->streams().first());
|
||||
|
||||
// By this point we've established that video contains a single still image stream. Now we'll
|
||||
// see if it ends with numbers.
|
||||
@@ -159,8 +158,8 @@ void ProjectImportTask::ValidateImageSequence(ItemPtr item, QFileInfoList& info_
|
||||
|
||||
// See if the same decoder can retrieve surrounding files
|
||||
DecoderPtr decoder = Decoder::CreateFromID(footage->decoder());
|
||||
ItemPtr previous_file = decoder->Probe(previous_img_fn, nullptr);
|
||||
ItemPtr next_file = decoder->Probe(next_img_fn, nullptr);
|
||||
Footage* previous_file = decoder->Probe(previous_img_fn, nullptr);
|
||||
Footage* next_file = decoder->Probe(next_img_fn, nullptr);
|
||||
|
||||
// Finally see if these files have the same dimensions
|
||||
if ((previous_file && CompareStillImageSize(previous_file, dim))
|
||||
@@ -218,15 +217,8 @@ void ProjectImportTask::ValidateImageSequence(ItemPtr item, QFileInfoList& info_
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectImportTask::ItemIsStillImageFootageOnly(ItemPtr item)
|
||||
bool ProjectImportTask::ItemIsStillImageFootageOnly(Footage* footage)
|
||||
{
|
||||
if (item->type() != Item::kFootage) {
|
||||
// Item isn't footage, definitely isn't an image sequence
|
||||
return false;
|
||||
}
|
||||
|
||||
FootagePtr footage = std::static_pointer_cast<Footage>(item);
|
||||
|
||||
if (footage->stream_count() != 1) {
|
||||
// Footage with more than one stream (usually video+audio) most likely isn't an image sequence
|
||||
return false;
|
||||
@@ -237,7 +229,7 @@ bool ProjectImportTask::ItemIsStillImageFootageOnly(ItemPtr item)
|
||||
return false;
|
||||
}
|
||||
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(footage->streams().first());
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(footage->streams().first());
|
||||
|
||||
if (video_stream->video_type() != VideoStream::kVideoTypeStill) {
|
||||
// If video type is not a still, this definitely isn't a video stream
|
||||
@@ -247,14 +239,13 @@ bool ProjectImportTask::ItemIsStillImageFootageOnly(ItemPtr item)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ProjectImportTask::CompareStillImageSize(ItemPtr item, const QSize &sz)
|
||||
bool ProjectImportTask::CompareStillImageSize(Footage* footage, const QSize &sz)
|
||||
{
|
||||
if (!ItemIsStillImageFootageOnly(item)) {
|
||||
if (!ItemIsStillImageFootageOnly(footage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FootagePtr footage = std::static_pointer_cast<Footage>(item);
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(footage->streams().first());
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(footage->streams().first());
|
||||
|
||||
return video_stream->width() == sz.width() && video_stream->height() == sz.height();
|
||||
}
|
||||
|
||||
@@ -59,11 +59,11 @@ protected:
|
||||
private:
|
||||
void Import(Folder* folder, QFileInfoList import, int& counter, QUndoCommand *parent_command);
|
||||
|
||||
void ValidateImageSequence(ItemPtr item, QFileInfoList &info_list, int index);
|
||||
void ValidateImageSequence(Footage *footage, QFileInfoList &info_list, int index);
|
||||
|
||||
static bool ItemIsStillImageFootageOnly(ItemPtr item);
|
||||
static bool ItemIsStillImageFootageOnly(Footage *footage);
|
||||
|
||||
static bool CompareStillImageSize(ItemPtr item, const QSize& sz);
|
||||
static bool CompareStillImageSize(Footage *footage, const QSize& sz);
|
||||
|
||||
static int64_t GetImageSequenceLimit(const QString &start_fn, int64_t start, bool up);
|
||||
|
||||
|
||||
@@ -76,12 +76,12 @@ bool LoadOTIOTask::Run()
|
||||
}
|
||||
|
||||
// Keep track of imported footage
|
||||
QMap<QString, FootagePtr> imported_footage;
|
||||
QMap<QString, Footage*> imported_footage;
|
||||
|
||||
foreach (auto timeline, timelines) {
|
||||
SequencePtr sequence = std::make_shared<Sequence>();
|
||||
Sequence* sequence = new Sequence();
|
||||
sequence->set_name(QString::fromStdString(timeline->name()));
|
||||
project_->root()->add_child(sequence);
|
||||
sequence->setParent(project_->root());
|
||||
|
||||
ViewerOutput* seq_viewer = sequence->viewer_output();
|
||||
|
||||
@@ -160,22 +160,22 @@ bool LoadOTIOTask::Run()
|
||||
// Link footage
|
||||
QString footage_url = QString::fromStdString(static_cast<OTIO::ExternalReference*>(otio_clip->media_reference())->target_url());
|
||||
|
||||
FootagePtr probed_item;
|
||||
Footage* probed_item;
|
||||
|
||||
if (imported_footage.contains(footage_url)) {
|
||||
probed_item = imported_footage.value(footage_url);
|
||||
} else {
|
||||
probed_item = Decoder::Probe(project_, footage_url, &IsCancelled());
|
||||
imported_footage.insert(footage_url, probed_item);
|
||||
project_->root()->add_child(probed_item);
|
||||
probed_item->setParent(project_->root());
|
||||
}
|
||||
|
||||
if (probed_item && probed_item->type() == Item::kFootage) {
|
||||
MediaInput* media = new MediaInput();
|
||||
if (track->track_type() == Timeline::kTrackTypeVideo) {
|
||||
media->SetStream(probed_item->get_first_stream_of_type(Stream::kVideo));
|
||||
media->SetStream(probed_item->get_first_enabled_stream_of_type(Stream::kVideo));
|
||||
} else {
|
||||
media->SetStream(probed_item->get_first_stream_of_type(Stream::kAudio));
|
||||
media->SetStream(probed_item->get_first_enabled_stream_of_type(Stream::kAudio));
|
||||
}
|
||||
sequence->AddNode(media);
|
||||
|
||||
@@ -188,19 +188,8 @@ bool LoadOTIOTask::Run()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sequence->moveToThread(qApp->thread());
|
||||
}
|
||||
|
||||
// Ugly hack to move footage streams to main thread
|
||||
/*foreach (ItemPtr item, imported_footage) {
|
||||
if (item && item->type() == Item::kFootage) {
|
||||
foreach (StreamPtr stream, std::static_pointer_cast<Footage>(item)->streams()) {
|
||||
stream->moveToThread(qApp->thread());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
project_->moveToThread(qApp->thread());
|
||||
|
||||
return true;
|
||||
|
||||
@@ -39,7 +39,7 @@ SaveOTIOTask::SaveOTIOTask(Project *project) :
|
||||
|
||||
bool SaveOTIOTask::Run()
|
||||
{
|
||||
QList<ItemPtr> sequences = project_->get_items_of_type(Item::kSequence);
|
||||
QVector<Item*> sequences = project_->get_items_of_type(Item::kSequence);
|
||||
|
||||
if (sequences.isEmpty()) {
|
||||
SetError(tr("Project contains no sequences to export."));
|
||||
@@ -48,8 +48,8 @@ bool SaveOTIOTask::Run()
|
||||
|
||||
std::vector<opentimelineio::v1_0::SerializableObject*> serialized;
|
||||
|
||||
foreach (ItemPtr item, sequences) {
|
||||
SequencePtr seq = std::static_pointer_cast<Sequence>(item);
|
||||
foreach (Item* item, sequences) {
|
||||
Sequence* seq = static_cast<Sequence*>(item);
|
||||
|
||||
auto otio_timeline = SerializeTimeline(seq);
|
||||
|
||||
@@ -91,7 +91,7 @@ bool SaveOTIOTask::Run()
|
||||
return (es == opentimelineio::v1_0::ErrorStatus::OK);
|
||||
}
|
||||
|
||||
opentimelineio::v1_0::Timeline *SaveOTIOTask::SerializeTimeline(SequencePtr sequence)
|
||||
opentimelineio::v1_0::Timeline *SaveOTIOTask::SerializeTimeline(Sequence *sequence)
|
||||
{
|
||||
auto otio_timeline = new opentimelineio::v1_0::Timeline(sequence->name().toStdString());
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ protected:
|
||||
virtual bool Run() override;
|
||||
|
||||
private:
|
||||
opentimelineio::v1_0::Timeline* SerializeTimeline(SequencePtr sequence);
|
||||
opentimelineio::v1_0::Timeline* SerializeTimeline(Sequence* sequence);
|
||||
|
||||
opentimelineio::v1_0::Track* SerializeTrack(TrackOutput* track);
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ add_subdirectory(curvewidget)
|
||||
add_subdirectory(flowlayout)
|
||||
add_subdirectory(focusablelineedit)
|
||||
add_subdirectory(footagecombobox)
|
||||
add_subdirectory(handmovableview)
|
||||
add_subdirectory(keyframeview)
|
||||
add_subdirectory(manageddisplay)
|
||||
add_subdirectory(menu)
|
||||
add_subdirectory(nodecombobox)
|
||||
add_subdirectory(nodecopypaste)
|
||||
add_subdirectory(nodetableview)
|
||||
add_subdirectory(nodetreeview)
|
||||
add_subdirectory(nodeparamview)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "widget/nodeparamview/nodeparamviewkeyframecontrol.h"
|
||||
#include "widget/nodeparamview/nodeparamviewwidgetbridge.h"
|
||||
#include "widget/nodetreeview/nodetreeview.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ FootageComboBox::FootageComboBox(QWidget *parent) :
|
||||
|
||||
void FootageComboBox::showPopup()
|
||||
{
|
||||
if (root_ == nullptr || root_->child_count() == 0) {
|
||||
if (root_ == nullptr || root_->item_child_count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ void FootageComboBox::showPopup()
|
||||
QAction* selected = menu.exec(parentWidget()->mapToGlobal(pos()));
|
||||
|
||||
if (selected != nullptr) {
|
||||
SetFootage(selected->data().value<StreamPtr>());
|
||||
SetFootage(Node::ValueToPtr<Stream>(selected->data()));
|
||||
|
||||
emit FootageChanged(footage_);
|
||||
}
|
||||
@@ -69,12 +69,7 @@ void FootageComboBox::SetOnlyShowReadyFootage(bool e)
|
||||
only_show_ready_footage_ = e;
|
||||
}
|
||||
|
||||
StreamPtr FootageComboBox::SelectedFootage()
|
||||
{
|
||||
return footage_;
|
||||
}
|
||||
|
||||
void FootageComboBox::SetFootage(StreamPtr f)
|
||||
void FootageComboBox::SetFootage(Stream *f)
|
||||
{
|
||||
// Remove existing single item used to show the footage name
|
||||
footage_ = f;
|
||||
@@ -82,10 +77,9 @@ void FootageComboBox::SetFootage(StreamPtr f)
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m)
|
||||
void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m) const
|
||||
{
|
||||
for (int i=0;i<f->child_count();i++) {
|
||||
Item* child = f->child(i);
|
||||
foreach (Item* child, f->children()) {
|
||||
|
||||
if (child->CanHaveChildren()) {
|
||||
|
||||
@@ -102,13 +96,15 @@ void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m)
|
||||
Menu* stream_menu = new Menu(footage->name(), m);
|
||||
m->addMenu(stream_menu);
|
||||
|
||||
foreach (StreamPtr stream, footage->streams()) {
|
||||
QAction* stream_action = stream_menu->addAction(FootageToString(stream.get()));
|
||||
stream_action->setData(QVariant::fromValue(stream));
|
||||
foreach (Stream* stream, footage->streams()) {
|
||||
QAction* stream_action = stream_menu->addAction(FootageToString(stream));
|
||||
stream_action->setData(Node::PtrToValue(stream));
|
||||
stream_action->setIcon(stream->icon());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +115,7 @@ void FootageComboBox::UpdateText()
|
||||
|
||||
if (footage_) {
|
||||
// Use combobox functions to show the footage name
|
||||
addItem(FootageToString(footage_.get()));
|
||||
addItem(FootageToString(footage_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,16 +41,19 @@ public:
|
||||
|
||||
void SetOnlyShowReadyFootage(bool e);
|
||||
|
||||
StreamPtr SelectedFootage();
|
||||
Stream* SelectedFootage() const
|
||||
{
|
||||
return footage_;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void SetFootage(StreamPtr f);
|
||||
void SetFootage(Stream* f);
|
||||
|
||||
signals:
|
||||
void FootageChanged(StreamPtr f);
|
||||
void FootageChanged(Stream* f);
|
||||
|
||||
private:
|
||||
void TraverseFolder(const Folder *f, QMenu* m);
|
||||
void TraverseFolder(const Folder *f, QMenu* m) const;
|
||||
|
||||
void UpdateText();
|
||||
|
||||
@@ -58,7 +61,7 @@ private:
|
||||
|
||||
const Folder* root_;
|
||||
|
||||
StreamPtr footage_;
|
||||
Stream* footage_;
|
||||
|
||||
bool only_show_ready_footage_;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2020 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
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/handmovableview/handmovableview.h
|
||||
widget/handmovableview/handmovableview.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -33,7 +33,7 @@
|
||||
namespace olive {
|
||||
|
||||
KeyframeViewBase::KeyframeViewBase(QWidget *parent) :
|
||||
TimelineViewBase(parent),
|
||||
TimeBasedView(parent),
|
||||
dragging_bezier_point_(nullptr),
|
||||
currently_autoselecting_(false)
|
||||
{
|
||||
@@ -275,7 +275,7 @@ void KeyframeViewBase::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
||||
void KeyframeViewBase::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimelineViewBase::ScaleChangedEvent(scale);
|
||||
TimeBasedView::ScaleChangedEvent(scale);
|
||||
|
||||
QMap<NodeKeyframe*, KeyframeViewItem*>::const_iterator iterator;
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
#include "node/keyframe.h"
|
||||
#include "widget/curvewidget/beziercontrolpointitem.h"
|
||||
#include "widget/menu/menu.h"
|
||||
#include "widget/timelinewidget/view/timelineviewbase.h"
|
||||
#include "widget/timebased/timebasedview.h"
|
||||
#include "widget/timetarget/timetarget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class KeyframeViewBase : public TimelineViewBase, public TimeTargetObject
|
||||
class KeyframeViewBase : public TimeBasedView, public TimeTargetObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -125,7 +125,7 @@ NodeParamView::NodeParamView(QWidget *parent) :
|
||||
// Set a default scale - FIXME: Hardcoded
|
||||
SetScale(120);
|
||||
|
||||
SetMaximumScale(TimelineViewBase::kMaximumScale);
|
||||
SetMaximumScale(TimeBasedView::kMaximumScale);
|
||||
|
||||
// Pickup on widget focus changes
|
||||
connect(qApp,
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "node/node.h"
|
||||
#include "nodeparamviewitem.h"
|
||||
#include "widget/keyframeview/keyframeview.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ void NodeParamViewWidgetBridge::UpdateWidgetValues()
|
||||
break;
|
||||
}
|
||||
case NodeParam::kFootage:
|
||||
static_cast<FootageComboBox*>(widgets_.first())->SetFootage(input_->get_value_at_time(node_time).value<StreamPtr>());
|
||||
static_cast<FootageComboBox*>(widgets_.first())->SetFootage(Node::ValueToPtr<Stream>(input_->get_value_at_time(node_time)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
QVariant NodeTableTraverser::ProcessVideoFootage(StreamPtr stream, const rational &input_time)
|
||||
QVariant NodeTableTraverser::ProcessVideoFootage(VideoStream *video_stream, const rational &input_time)
|
||||
{
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream);
|
||||
|
||||
return QVariant::fromValue(VideoParams(video_stream->width(),
|
||||
video_stream->height(),
|
||||
video_stream->timebase(),
|
||||
@@ -34,10 +32,8 @@ QVariant NodeTableTraverser::ProcessVideoFootage(StreamPtr stream, const rationa
|
||||
video_stream->pixel_aspect_ratio()));
|
||||
}
|
||||
|
||||
QVariant NodeTableTraverser::ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time)
|
||||
QVariant NodeTableTraverser::ProcessAudioFootage(AudioStream *audio_stream, const TimeRange &input_time)
|
||||
{
|
||||
AudioStreamPtr audio_stream = std::static_pointer_cast<AudioStream>(stream);
|
||||
|
||||
return QVariant::fromValue(AudioParams(audio_stream->sample_rate(),
|
||||
audio_stream->channel_layout(),
|
||||
AudioParams::kInternalFormat));
|
||||
|
||||
@@ -31,9 +31,9 @@ public:
|
||||
NodeTableTraverser() = default;
|
||||
|
||||
protected:
|
||||
virtual QVariant ProcessVideoFootage(StreamPtr stream, const rational &input_time);
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* video_stream, const rational &input_time);
|
||||
|
||||
virtual QVariant ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time);
|
||||
virtual QVariant ProcessAudioFootage(AudioStream* audio_stream, const TimeRange &input_time);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define NODETABLEWIDGET_H
|
||||
|
||||
#include "nodetableview.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include "node/graph.h"
|
||||
#include "node/nodecopypaste.h"
|
||||
#include "nodeviewscene.h"
|
||||
#include "widget/timelinewidget/view/handmovableview.h"
|
||||
#include "widget/nodecopypaste/nodecopypaste.h"
|
||||
#include "widget/handmovableview/handmovableview.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace olive {
|
||||
* This widget takes a NodeGraph object and constructs a QGraphicsScene representing its data, viewing and allowing
|
||||
* the user to make modifications to it.
|
||||
*/
|
||||
class NodeView : public HandMovableView, public NodeCopyPasteWidget
|
||||
class NodeView : public HandMovableView, public NodeCopyPasteService
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -307,7 +307,7 @@ void ProjectExplorer::ShowContextMenu()
|
||||
bool all_items_are_footage_or_sequence = true;
|
||||
|
||||
foreach (Item* i, context_menu_items_) {
|
||||
if (i->type() == Item::kFootage && !static_cast<Footage*>(i)->HasStreamsOfType(Stream::kVideo)) {
|
||||
if (i->type() == Item::kFootage && !static_cast<Footage*>(i)->HasEnabledStreamsOfType(Stream::kVideo)) {
|
||||
all_items_have_video_streams = false;
|
||||
}
|
||||
|
||||
@@ -324,15 +324,15 @@ void ProjectExplorer::ShowContextMenu()
|
||||
Menu* proxy_menu = new Menu(tr("Pre-Cache"), &menu);
|
||||
menu.addMenu(proxy_menu);
|
||||
|
||||
QList<ItemPtr> sequences = project()->get_items_of_type(Item::kSequence);
|
||||
QVector<Item*> sequences = project()->get_items_of_type(Item::kSequence);
|
||||
|
||||
if (sequences.isEmpty()) {
|
||||
QAction* a = proxy_menu->addAction(tr("No sequences exist in project"));
|
||||
a->setEnabled(false);
|
||||
} else {
|
||||
foreach (ItemPtr i, sequences) {
|
||||
foreach (Item* i, sequences) {
|
||||
QAction* a = proxy_menu->addAction(tr("For \"%1\"").arg(i->name()));
|
||||
a->setData(Node::PtrToValue(i.get()));
|
||||
a->setData(Node::PtrToValue(i));
|
||||
}
|
||||
|
||||
connect(proxy_menu, &Menu::triggered, this, &ProjectExplorer::ContextMenuStartProxy);
|
||||
@@ -416,11 +416,12 @@ void ProjectExplorer::OpenContextMenuItemInNewWindow()
|
||||
|
||||
void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
||||
{
|
||||
QList<VideoStreamPtr> video_streams;
|
||||
QVector<VideoStream*> video_streams;
|
||||
|
||||
// To get here, the `context_menu_items_` must be all kFootage
|
||||
foreach (Item* i, context_menu_items_) {
|
||||
VideoStreamPtr s = std::static_pointer_cast<VideoStream>(static_cast<Footage*>(i)->get_first_stream_of_type(Stream::kVideo));
|
||||
Footage* f = static_cast<Footage*>(i);
|
||||
VideoStream* s = static_cast<VideoStream*>(f->get_first_enabled_stream_of_type(Stream::kVideo));
|
||||
|
||||
if (s) {
|
||||
video_streams.append(s);
|
||||
@@ -430,7 +431,7 @@ void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
||||
Sequence* sequence = Node::ValueToPtr<Sequence>(a->data());
|
||||
|
||||
// Start a background task for proxying
|
||||
foreach (VideoStreamPtr video_stream, video_streams) {
|
||||
foreach (VideoStream* video_stream, video_streams) {
|
||||
PreCacheTask* proxy_task = new PreCacheTask(video_stream, sequence);
|
||||
TaskManager::instance()->AddTask(proxy_task);
|
||||
}
|
||||
@@ -501,7 +502,7 @@ Folder *ProjectExplorer::GetSelectedFolder() const
|
||||
|
||||
// If this item is not a folder, presumably it's parent is
|
||||
if (!sel_item->CanHaveChildren()) {
|
||||
sel_item = sel_item->parent();
|
||||
sel_item = sel_item->item_parent();
|
||||
|
||||
Q_ASSERT(sel_item->CanHaveChildren());
|
||||
}
|
||||
@@ -545,11 +546,11 @@ QList<MediaInput *> ProjectExplorer::GetMediaNodesUsingFootage(Footage *item)
|
||||
QList<MediaInput *> list;
|
||||
|
||||
// Get all sequences.
|
||||
QList<ItemPtr> sequences = model_.project()->get_items_of_type(Item::kSequence);
|
||||
QVector<Item*> sequences = model_.project()->get_items_of_type(Item::kSequence);
|
||||
|
||||
// Footage can contain multiple streams, all of which need to be dealt with
|
||||
foreach (ItemPtr s, sequences) {
|
||||
const QList<Node*>& nodes = static_cast<Sequence*>(s.get())->nodes();
|
||||
foreach (Item* s, sequences) {
|
||||
const QList<Node*>& nodes = static_cast<Sequence*>(s)->nodes();
|
||||
foreach (Node* n, nodes) {
|
||||
if (n->IsMedia()) {
|
||||
MediaInput* media_node = static_cast<MediaInput*>(n);
|
||||
@@ -677,7 +678,7 @@ void ProjectExplorer::DeleteSelected()
|
||||
break;
|
||||
}
|
||||
|
||||
new ProjectViewModel::RemoveItemCommand(&model_, item->get_shared_ptr(), command);
|
||||
new ProjectViewModel::RemoveItemCommand(&model_, item, command);
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
|
||||
@@ -41,7 +41,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
QMap<MediaInput*, StreamPtr> stream_data_;
|
||||
QMap<MediaInput*, Stream*> stream_data_;
|
||||
|
||||
Project* project_;
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
|
||||
#include "resizablescrollbar.h"
|
||||
#include "timeline/timelinepoints.h"
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class ResizableTimelineScrollBar : public ResizableScrollBar, public TimelineScaledObject
|
||||
class ResizableTimelineScrollBar : public ResizableScrollBar, public TimeScaledObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/nodecopypaste/nodecopypaste.h
|
||||
widget/nodecopypaste/nodecopypaste.cpp
|
||||
widget/snapservice/snapservice.cpp
|
||||
widget/snapservice/snapservice.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -16,7 +16,11 @@
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/timebased/timebased.h
|
||||
widget/timebased/timebased.cpp
|
||||
widget/timebased/timebasedview.cpp
|
||||
widget/timebased/timebasedview.h
|
||||
widget/timebased/timebasedwidget.cpp
|
||||
widget/timebased/timebasedwidget.h
|
||||
widget/timebased/timescaledobject.cpp
|
||||
widget/timebased/timescaledobject.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
+25
-25
@@ -18,7 +18,7 @@
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewbase.h"
|
||||
#include "timebasedview.h"
|
||||
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QMouseEvent>
|
||||
@@ -30,9 +30,9 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
const double TimelineViewBase::kMaximumScale = 8192;
|
||||
const double TimeBasedView::kMaximumScale = 8192;
|
||||
|
||||
TimelineViewBase::TimelineViewBase(QWidget *parent) :
|
||||
TimeBasedView::TimeBasedView(QWidget *parent) :
|
||||
HandMovableView(parent),
|
||||
playhead_(0),
|
||||
playhead_scene_left_(-1),
|
||||
@@ -53,7 +53,7 @@ TimelineViewBase::TimelineViewBase(QWidget *parent) :
|
||||
SetDefaultDragMode(NoDrag);
|
||||
|
||||
// Signal to update bounding rect when the scene changes
|
||||
connect(&scene_, &QGraphicsScene::changed, this, &TimelineViewBase::UpdateSceneRect);
|
||||
connect(&scene_, &QGraphicsScene::changed, this, &TimeBasedView::UpdateSceneRect);
|
||||
|
||||
// Always enforce maximum scale
|
||||
SetMaximumScale(kMaximumScale);
|
||||
@@ -64,13 +64,13 @@ TimelineViewBase::TimelineViewBase(QWidget *parent) :
|
||||
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
}
|
||||
|
||||
void TimelineViewBase::TimebaseChangedEvent(const rational &)
|
||||
void TimeBasedView::TimebaseChangedEvent(const rational &)
|
||||
{
|
||||
// Timebase influences position/visibility of playhead
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void TimelineViewBase::EnableSnap(const QList<rational> &points)
|
||||
void TimeBasedView::EnableSnap(const QList<rational> &points)
|
||||
{
|
||||
snapped_ = true;
|
||||
snap_time_ = points;
|
||||
@@ -78,28 +78,28 @@ void TimelineViewBase::EnableSnap(const QList<rational> &points)
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void TimelineViewBase::DisableSnap()
|
||||
void TimeBasedView::DisableSnap()
|
||||
{
|
||||
snapped_ = false;
|
||||
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void TimelineViewBase::SetSnapService(SnapService *service)
|
||||
void TimeBasedView::SetSnapService(SnapService *service)
|
||||
{
|
||||
snap_service_ = service;
|
||||
}
|
||||
|
||||
const double &TimelineViewBase::GetYScale() const
|
||||
const double &TimeBasedView::GetYScale() const
|
||||
{
|
||||
return y_scale_;
|
||||
}
|
||||
|
||||
void TimelineViewBase::VerticalScaleChangedEvent(double)
|
||||
void TimeBasedView::VerticalScaleChangedEvent(double)
|
||||
{
|
||||
}
|
||||
|
||||
void TimelineViewBase::SetYScale(const double &y_scale)
|
||||
void TimeBasedView::SetYScale(const double &y_scale)
|
||||
{
|
||||
y_scale_ = y_scale;
|
||||
|
||||
@@ -110,7 +110,7 @@ void TimelineViewBase::SetYScale(const double &y_scale)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineViewBase::SetTime(const int64_t time)
|
||||
void TimeBasedView::SetTime(const int64_t time)
|
||||
{
|
||||
playhead_ = time;
|
||||
|
||||
@@ -118,7 +118,7 @@ void TimelineViewBase::SetTime(const int64_t time)
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void TimelineViewBase::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
void TimeBasedView::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
{
|
||||
QGraphicsView::drawForeground(painter, rect);
|
||||
|
||||
@@ -154,12 +154,12 @@ void TimelineViewBase::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
}
|
||||
}
|
||||
|
||||
rational TimelineViewBase::GetPlayheadTime() const
|
||||
rational TimeBasedView::GetPlayheadTime() const
|
||||
{
|
||||
return Timecode::timestamp_to_time(playhead_, timebase());
|
||||
}
|
||||
|
||||
bool TimelineViewBase::PlayheadPress(QMouseEvent *event)
|
||||
bool TimeBasedView::PlayheadPress(QMouseEvent *event)
|
||||
{
|
||||
QPointF scene_pos = mapToScene(event->pos());
|
||||
|
||||
@@ -170,7 +170,7 @@ bool TimelineViewBase::PlayheadPress(QMouseEvent *event)
|
||||
return dragging_playhead_;
|
||||
}
|
||||
|
||||
bool TimelineViewBase::PlayheadMove(QMouseEvent *event)
|
||||
bool TimeBasedView::PlayheadMove(QMouseEvent *event)
|
||||
{
|
||||
if (!dragging_playhead_) {
|
||||
return false;
|
||||
@@ -198,7 +198,7 @@ bool TimelineViewBase::PlayheadMove(QMouseEvent *event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TimelineViewBase::PlayheadRelease(QMouseEvent*)
|
||||
bool TimeBasedView::PlayheadRelease(QMouseEvent*)
|
||||
{
|
||||
if (dragging_playhead_) {
|
||||
dragging_playhead_ = false;
|
||||
@@ -213,19 +213,19 @@ bool TimelineViewBase::PlayheadRelease(QMouseEvent*)
|
||||
return false;
|
||||
}
|
||||
|
||||
qreal TimelineViewBase::GetPlayheadX()
|
||||
qreal TimeBasedView::GetPlayheadX()
|
||||
{
|
||||
return TimeToScene(Timecode::timestamp_to_time(playhead_, timebase()));
|
||||
}
|
||||
|
||||
void TimelineViewBase::SetEndTime(const rational &length)
|
||||
void TimeBasedView::SetEndTime(const rational &length)
|
||||
{
|
||||
end_time_ = length;
|
||||
|
||||
UpdateSceneRect();
|
||||
}
|
||||
|
||||
void TimelineViewBase::UpdateSceneRect()
|
||||
void TimeBasedView::UpdateSceneRect()
|
||||
{
|
||||
QRectF bounding_rect = scene_.itemsBoundingRect();
|
||||
|
||||
@@ -244,16 +244,16 @@ void TimelineViewBase::UpdateSceneRect()
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineViewBase::resizeEvent(QResizeEvent *event)
|
||||
void TimeBasedView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QGraphicsView::resizeEvent(event);
|
||||
|
||||
UpdateSceneRect();
|
||||
}
|
||||
|
||||
void TimelineViewBase::ScaleChangedEvent(const double &scale)
|
||||
void TimeBasedView::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimelineScaledObject::ScaleChangedEvent(scale);
|
||||
TimeScaledObject::ScaleChangedEvent(scale);
|
||||
|
||||
// Update scene rect
|
||||
UpdateSceneRect();
|
||||
@@ -262,7 +262,7 @@ void TimelineViewBase::ScaleChangedEvent(const double &scale)
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
bool TimelineViewBase::HandleZoomFromScroll(QWheelEvent *event)
|
||||
bool TimeBasedView::HandleZoomFromScroll(QWheelEvent *event)
|
||||
{
|
||||
if (WheelEventIsAZoomEvent(event)) {
|
||||
// If CTRL is held (or a preference is set to swap CTRL behavior), we zoom instead of scrolling
|
||||
@@ -326,7 +326,7 @@ bool TimelineViewBase::HandleZoomFromScroll(QWheelEvent *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TimelineViewBase::WheelEventIsAZoomEvent(QWheelEvent *event)
|
||||
bool TimeBasedView::WheelEventIsAZoomEvent(QWheelEvent *event)
|
||||
{
|
||||
return (static_cast<bool>(event->modifiers() & Qt::ControlModifier) == !Config::Current()["ScrollZooms"].toBool());
|
||||
}
|
||||
+5
-5
@@ -24,17 +24,17 @@
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "core.h"
|
||||
#include "handmovableview.h"
|
||||
#include "widget/timelinewidget/snapservice.h"
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "timescaledobject.h"
|
||||
#include "widget/handmovableview/handmovableview.h"
|
||||
#include "widget/snapservice/snapservice.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class TimelineViewBase : public HandMovableView, public TimelineScaledObject
|
||||
class TimeBasedView : public HandMovableView, public TimeScaledObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimelineViewBase(QWidget* parent = nullptr);
|
||||
TimeBasedView(QWidget* parent = nullptr);
|
||||
|
||||
static const double kMaximumScale;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
***/
|
||||
|
||||
#include "timebased.h"
|
||||
#include "timebasedwidget.h"
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QUndoCommand>
|
||||
@@ -132,7 +132,7 @@ void TimeBasedWidget::UpdateMaximumScroll()
|
||||
scrollbar_->setMaximum(qMax(0, qCeil(TimeToScene(length)) - width()));
|
||||
}
|
||||
|
||||
foreach (TimelineViewBase* base, timeline_views_) {
|
||||
foreach (TimeBasedView* base, timeline_views_) {
|
||||
base->SetEndTime(length);
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@ TimelinePoints *TimeBasedWidget::GetConnectedTimelinePoints() const
|
||||
return points_;
|
||||
}
|
||||
|
||||
void TimeBasedWidget::ConnectTimelineView(TimelineViewBase *base)
|
||||
void TimeBasedWidget::ConnectTimelineView(TimeBasedView *base)
|
||||
{
|
||||
timeline_views_.append(base);
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "node/output/viewer/viewer.h"
|
||||
#include "timeline/timelinecommon.h"
|
||||
#include "widget/resizablescrollbar/resizabletimelinescrollbar.h"
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
#include "widget/timelinewidget/view/timelineview.h"
|
||||
#include "widget/timeruler/timeruler.h"
|
||||
|
||||
@@ -121,7 +121,7 @@ protected:
|
||||
|
||||
TimelinePoints* GetConnectedTimelinePoints() const;
|
||||
|
||||
void ConnectTimelineView(TimelineViewBase* base);
|
||||
void ConnectTimelineView(TimeBasedView* base);
|
||||
|
||||
void PassWheelEventsToScrollBar(QObject* object);
|
||||
|
||||
@@ -194,7 +194,7 @@ private:
|
||||
|
||||
TimelinePoints* points_;
|
||||
|
||||
QList<TimelineViewBase*> timeline_views_;
|
||||
QList<TimeBasedView*> timeline_views_;
|
||||
|
||||
bool toggle_show_all_;
|
||||
|
||||
+16
-16
@@ -18,7 +18,7 @@
|
||||
|
||||
***/
|
||||
|
||||
#include "timelinescaledobject.h"
|
||||
#include "timescaledobject.h"
|
||||
|
||||
#include <cfloat>
|
||||
#include <QtMath>
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
const int TimelineScaledObject::kCalculateDimensionsPadding = 10;
|
||||
const int TimeScaledObject::kCalculateDimensionsPadding = 10;
|
||||
|
||||
TimelineScaledObject::TimelineScaledObject() :
|
||||
TimeScaledObject::TimeScaledObject() :
|
||||
scale_(1.0),
|
||||
min_scale_(0),
|
||||
max_scale_(DBL_MAX)
|
||||
@@ -37,7 +37,7 @@ TimelineScaledObject::TimelineScaledObject() :
|
||||
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetTimebase(const rational &timebase)
|
||||
void TimeScaledObject::SetTimebase(const rational &timebase)
|
||||
{
|
||||
timebase_ = timebase;
|
||||
timebase_dbl_ = timebase_.toDouble();
|
||||
@@ -45,17 +45,17 @@ void TimelineScaledObject::SetTimebase(const rational &timebase)
|
||||
TimebaseChangedEvent(timebase);
|
||||
}
|
||||
|
||||
const rational &TimelineScaledObject::timebase() const
|
||||
const rational &TimeScaledObject::timebase() const
|
||||
{
|
||||
return timebase_;
|
||||
}
|
||||
|
||||
const double &TimelineScaledObject::timebase_dbl() const
|
||||
const double &TimeScaledObject::timebase_dbl() const
|
||||
{
|
||||
return timebase_dbl_;
|
||||
}
|
||||
|
||||
rational TimelineScaledObject::SceneToTime(const double &x, const double &x_scale, const rational &timebase, bool round)
|
||||
rational TimeScaledObject::SceneToTime(const double &x, const double &x_scale, const rational &timebase, bool round)
|
||||
{
|
||||
double unscaled_time = x / x_scale / timebase.toDouble();
|
||||
|
||||
@@ -72,17 +72,17 @@ rational TimelineScaledObject::SceneToTime(const double &x, const double &x_scal
|
||||
return rational(rounded_x_mvmt * timebase.numerator(), timebase.denominator());
|
||||
}
|
||||
|
||||
double TimelineScaledObject::TimeToScene(const rational &time)
|
||||
double TimeScaledObject::TimeToScene(const rational &time)
|
||||
{
|
||||
return time.toDouble() * scale_;
|
||||
}
|
||||
|
||||
rational TimelineScaledObject::SceneToTime(const double &x, bool round)
|
||||
rational TimeScaledObject::SceneToTime(const double &x, bool round)
|
||||
{
|
||||
return SceneToTime(x, scale_, timebase_, round);
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetMaximumScale(const double &max)
|
||||
void TimeScaledObject::SetMaximumScale(const double &max)
|
||||
{
|
||||
max_scale_ = max;
|
||||
|
||||
@@ -91,7 +91,7 @@ void TimelineScaledObject::SetMaximumScale(const double &max)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetMinimumScale(const double &min)
|
||||
void TimeScaledObject::SetMinimumScale(const double &min)
|
||||
{
|
||||
min_scale_ = min;
|
||||
|
||||
@@ -100,12 +100,12 @@ void TimelineScaledObject::SetMinimumScale(const double &min)
|
||||
}
|
||||
}
|
||||
|
||||
const double& TimelineScaledObject::GetScale() const
|
||||
const double& TimeScaledObject::GetScale() const
|
||||
{
|
||||
return scale_;
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetScale(const double& scale)
|
||||
void TimeScaledObject::SetScale(const double& scale)
|
||||
{
|
||||
Q_ASSERT(scale > 0);
|
||||
|
||||
@@ -114,17 +114,17 @@ void TimelineScaledObject::SetScale(const double& scale)
|
||||
ScaleChangedEvent(scale_);
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetScaleFromDimensions(double viewport_width, double content_width)
|
||||
void TimeScaledObject::SetScaleFromDimensions(double viewport_width, double content_width)
|
||||
{
|
||||
SetScale(CalculateScaleFromDimensions(viewport_width, content_width));
|
||||
}
|
||||
|
||||
double TimelineScaledObject::CalculateScaleFromDimensions(double viewport_sz, double content_sz)
|
||||
double TimeScaledObject::CalculateScaleFromDimensions(double viewport_sz, double content_sz)
|
||||
{
|
||||
return static_cast<double>(viewport_sz / kCalculateDimensionsPadding * (kCalculateDimensionsPadding-1)) / static_cast<double>(content_sz);
|
||||
}
|
||||
|
||||
double TimelineScaledObject::CalculatePaddingFromDimensionScale(double viewport_sz)
|
||||
double TimeScaledObject::CalculatePaddingFromDimensionScale(double viewport_sz)
|
||||
{
|
||||
return (viewport_sz / (kCalculateDimensionsPadding * 2));
|
||||
}
|
||||
+7
-4
@@ -27,11 +27,14 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
class TimelineScaledObject
|
||||
/**
|
||||
* @brief Provides base functionality for any object that uses time and scale
|
||||
*/
|
||||
class TimeScaledObject
|
||||
{
|
||||
public:
|
||||
TimelineScaledObject();
|
||||
virtual ~TimelineScaledObject() = default;
|
||||
TimeScaledObject();
|
||||
virtual ~TimeScaledObject() = default;
|
||||
|
||||
void SetTimebase(const rational &timebase);
|
||||
|
||||
@@ -75,7 +78,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class TimelineScaledWidget : public QWidget, public TimelineScaledObject
|
||||
class TimelineScaledWidget : public QWidget, public TimeScaledObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -21,12 +21,8 @@ add_subdirectory(view)
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/timelinewidget/snapservice.h
|
||||
widget/timelinewidget/snapservice.cpp
|
||||
widget/timelinewidget/timelineandtrackview.h
|
||||
widget/timelinewidget/timelineandtrackview.cpp
|
||||
widget/timelinewidget/timelinescaledobject.h
|
||||
widget/timelinewidget/timelinescaledobject.cpp
|
||||
widget/timelinewidget/timelinewidget.h
|
||||
widget/timelinewidget/timelinewidget.cpp
|
||||
widget/timelinewidget/timelinewidgetselections.h
|
||||
|
||||
@@ -160,7 +160,7 @@ TimelineWidget::TimelineWidget(QWidget *parent) :
|
||||
// FIXME: Magic number
|
||||
SetScale(90.0);
|
||||
|
||||
SetMaximumScale(TimelineViewBase::kMaximumScale);
|
||||
SetMaximumScale(TimeBasedView::kMaximumScale);
|
||||
SetAutoSetTimebase(false);
|
||||
|
||||
connect(Core::instance(), &Core::ToolChanged, this, &TimelineWidget::ToolChanged);
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
|
||||
#include "core.h"
|
||||
#include "node/block/transition/transition.h"
|
||||
#include "node/nodecopypaste.h"
|
||||
#include "node/output/viewer/viewer.h"
|
||||
#include "snapservice.h"
|
||||
#include "timeline/timelinecommon.h"
|
||||
#include "timelineandtrackview.h"
|
||||
#include "widget/nodecopypaste/nodecopypaste.h"
|
||||
#include "widget/slider/timeslider.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/snapservice/snapservice.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
#include "widget/timelinewidget/timelinewidgetselections.h"
|
||||
#include "widget/timelinewidget/tool/import.h"
|
||||
#include "widget/timelinewidget/tool/tool.h"
|
||||
@@ -45,7 +45,7 @@ namespace olive {
|
||||
*
|
||||
* Encapsulates TimelineViews, TimeRulers, and scrollbars for a complete widget to manipulate Timelines
|
||||
*/
|
||||
class TimelineWidget : public TimeBasedWidget, public NodeCopyPasteWidget, public SnapService
|
||||
class TimelineWidget : public TimeBasedWidget, public NodeCopyPasteService, public SnapService
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -224,7 +224,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
quint64 enabled_streams = footage.streams();
|
||||
|
||||
// Loop through all streams in footage
|
||||
foreach (StreamPtr stream, footage.footage()->streams()) {
|
||||
foreach (Stream* stream, footage.footage()->streams()) {
|
||||
Timeline::TrackType track_type = TrackTypeFromStreamType(stream->type());
|
||||
|
||||
quint64 cached_enabled_streams = enabled_streams;
|
||||
@@ -239,7 +239,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||
|
||||
if (stream->type() == Stream::kVideo
|
||||
&& std::static_pointer_cast<VideoStream>(stream)->video_type() == VideoStream::kVideoTypeStill) {
|
||||
&& static_cast<VideoStream*>(stream)->video_type() == VideoStream::kVideoTypeStill) {
|
||||
// Stream is essentially length-less - we may use the default still image length in config,
|
||||
// or we may use another stream's length depending on the circumstance
|
||||
contains_image_stream = true;
|
||||
@@ -260,7 +260,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
// Increment track count for this track type
|
||||
track_offsets[track_type]++;
|
||||
|
||||
ghost->SetData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(stream));
|
||||
ghost->SetData(TimelineViewGhostItem::kAttachedFootage, Node::PtrToValue(stream));
|
||||
ghost->SetMode(Timeline::kMove);
|
||||
|
||||
footage_ghosts.append(ghost);
|
||||
@@ -353,7 +353,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
Project* active_project = Core::instance()->GetActiveProject();
|
||||
|
||||
if (active_project) {
|
||||
SequencePtr new_sequence = Core::instance()->CreateNewSequenceForProject(active_project);
|
||||
Sequence* new_sequence = Core::instance()->CreateNewSequenceForProject(active_project);
|
||||
|
||||
new_sequence->set_default_parameters();
|
||||
|
||||
@@ -371,7 +371,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
|
||||
} else {
|
||||
|
||||
SequenceDialog sd(new_sequence.get(), SequenceDialog::kNew, parent());
|
||||
SequenceDialog sd(new_sequence, SequenceDialog::kNew, parent());
|
||||
sd.SetUndoable(false);
|
||||
|
||||
if (sd.exec() != QDialog::Accepted) {
|
||||
@@ -390,11 +390,15 @@ void ImportTool::DropGhosts(bool insert)
|
||||
|
||||
FootageToGhosts(0, dragged_footage_, new_sequence->video_params().time_base(), 0);
|
||||
|
||||
dst_graph = new_sequence.get();
|
||||
dst_graph = new_sequence;
|
||||
viewer_node = new_sequence->viewer_output();
|
||||
|
||||
// Set this as the sequence to open
|
||||
open_sequence = new_sequence.get();
|
||||
open_sequence = new_sequence;
|
||||
} else {
|
||||
// If the sequence is valid, ownership is passed to AddItemCommand.
|
||||
// Otherwise, we're responsible for deleting it.
|
||||
delete new_sequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,7 +416,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
for (int i=0;i<parent()->GetGhostItems().size();i++) {
|
||||
TimelineViewGhostItem* ghost = parent()->GetGhostItems().at(i);
|
||||
|
||||
StreamPtr footage_stream = ghost->GetData(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>();
|
||||
Stream* footage_stream = Node::ValueToPtr<Stream>(ghost->GetData(TimelineViewGhostItem::kAttachedFootage));
|
||||
|
||||
ClipBlock* clip = new ClipBlock();
|
||||
clip->set_media_in(ghost->GetMediaIn());
|
||||
@@ -475,7 +479,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
|
||||
// Link any clips so far that share the same Footage with this one
|
||||
for (int j=0;j<i;j++) {
|
||||
StreamPtr footage_compare = parent()->GetGhostItems().at(j)->GetData(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>();
|
||||
Stream* footage_compare = Node::ValueToPtr<Stream>(parent()->GetGhostItems().at(j)->GetData(TimelineViewGhostItem::kAttachedFootage));
|
||||
|
||||
if (footage_compare->footage() == footage_stream->footage()) {
|
||||
Block::Link(block_items.at(j), clip);
|
||||
|
||||
@@ -68,7 +68,7 @@ void ZoomTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
// Normalize scale to 1.0 scale
|
||||
double scene_width = (scene_right - scene_left) / parent()->GetScale();
|
||||
|
||||
double new_scale = qMin(TimelineViewBase::kMaximumScale, static_cast<double>(reference_view->viewport()->width()) / scene_width);
|
||||
double new_scale = qMin(TimeBasedView::kMaximumScale, static_cast<double>(reference_view->viewport()->width()) / scene_width);
|
||||
|
||||
parent()->SetScale(new_scale);
|
||||
|
||||
|
||||
@@ -16,19 +16,15 @@
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/timelinewidget/view/handmovableview.h
|
||||
widget/timelinewidget/view/handmovableview.cpp
|
||||
widget/timelinewidget/view/timelineview.h
|
||||
widget/timelinewidget/view/timelineview.cpp
|
||||
widget/timelinewidget/view/timelineviewmouseevent.h
|
||||
widget/timelinewidget/view/timelineview.h
|
||||
widget/timelinewidget/view/timelineviewmouseevent.cpp
|
||||
widget/timelinewidget/view/timelineviewrect.h
|
||||
widget/timelinewidget/view/timelineviewmouseevent.h
|
||||
widget/timelinewidget/view/timelineviewrect.cpp
|
||||
widget/timelinewidget/view/timelineviewbase.h
|
||||
widget/timelinewidget/view/timelineviewbase.cpp
|
||||
widget/timelinewidget/view/timelineviewblockitem.h
|
||||
widget/timelinewidget/view/timelineviewrect.h
|
||||
widget/timelinewidget/view/timelineviewblockitem.cpp
|
||||
widget/timelinewidget/view/timelineviewghostitem.h
|
||||
widget/timelinewidget/view/timelineviewblockitem.h
|
||||
widget/timelinewidget/view/timelineviewghostitem.cpp
|
||||
widget/timelinewidget/view/timelineviewghostitem.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
namespace olive {
|
||||
|
||||
TimelineView::TimelineView(Qt::Alignment vertical_alignment, QWidget *parent) :
|
||||
TimelineViewBase(parent),
|
||||
TimeBasedView(parent),
|
||||
selections_(nullptr),
|
||||
ghosts_(nullptr),
|
||||
show_beam_cursor_(false),
|
||||
@@ -59,7 +59,7 @@ void TimelineView::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
if (dragMode() != GetDefaultDragMode()) {
|
||||
TimelineViewBase::mousePressEvent(event);
|
||||
TimeBasedView::mousePressEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
if (dragMode() != GetDefaultDragMode()) {
|
||||
TimelineViewBase::mouseMoveEvent(event);
|
||||
TimeBasedView::mouseMoveEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ void TimelineView::mouseReleaseEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
if (dragMode() != GetDefaultDragMode()) {
|
||||
TimelineViewBase::mouseReleaseEvent(event);
|
||||
TimeBasedView::mouseReleaseEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ void TimelineView::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
}
|
||||
|
||||
// Draw standard TimelineViewBase things (such as playhead)
|
||||
TimelineViewBase::drawForeground(painter, rect);
|
||||
TimeBasedView::drawForeground(painter, rect);
|
||||
}
|
||||
|
||||
void TimelineView::ToolChangedEvent(Tool::Item tool)
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
#include <QDropEvent>
|
||||
|
||||
#include "node/block/clip/clip.h"
|
||||
#include "timelineviewbase.h"
|
||||
#include "timelineviewblockitem.h"
|
||||
#include "timelineviewmouseevent.h"
|
||||
#include "timelineviewghostitem.h"
|
||||
#include "widget/timebased/timebasedview.h"
|
||||
#include "widget/timelinewidget/undo/undo.h"
|
||||
#include "undo/undostack.h"
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace olive {
|
||||
*
|
||||
* This widget primarily exposes users to viewing and modifying Block nodes, usually through a TimelineOutput node.
|
||||
*/
|
||||
class TimelineView : public TimelineViewBase
|
||||
class TimelineView : public TimeBasedView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace olive {
|
||||
|
||||
TimelineViewGhostItem::TimelineViewGhostItem() :
|
||||
track_adj_(0),
|
||||
stream_(nullptr),
|
||||
mode_(Timeline::kNone),
|
||||
can_have_zero_length_(true),
|
||||
can_move_tracks_(true),
|
||||
|
||||
@@ -127,8 +127,6 @@ private:
|
||||
|
||||
int track_adj_;
|
||||
|
||||
StreamPtr stream_;
|
||||
|
||||
Timeline::MovementMode mode_;
|
||||
|
||||
bool can_have_zero_length_;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -48,14 +48,14 @@ TimelineCoordinate TimelineViewMouseEvent::GetCoordinates(bool round_time) const
|
||||
return TimelineCoordinate(GetFrame(round_time), track_);
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers TimelineViewMouseEvent::GetModifiers() const
|
||||
const Qt::KeyboardModifiers &TimelineViewMouseEvent::GetModifiers() const
|
||||
{
|
||||
return modifiers_;
|
||||
}
|
||||
|
||||
rational TimelineViewMouseEvent::GetFrame(bool round) const
|
||||
{
|
||||
return TimelineScaledObject::SceneToTime(scene_x_, scale_x_, timebase_, round);
|
||||
return TimeScaledObject::SceneToTime(scene_x_, scale_x_, timebase_, round);
|
||||
}
|
||||
|
||||
const TrackReference &TimelineViewMouseEvent::GetTrack() const
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
const Qt::KeyboardModifiers& modifiers = Qt::NoModifier);
|
||||
|
||||
TimelineCoordinate GetCoordinates(bool round_time = false) const;
|
||||
const Qt::KeyboardModifiers GetModifiers() const;
|
||||
const Qt::KeyboardModifiers& GetModifiers() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the time at this cursor point
|
||||
|
||||
@@ -50,14 +50,14 @@ void TimelineViewRect::SetTrack(const TrackReference &track)
|
||||
|
||||
void TimelineViewRect::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimelineScaledObject::ScaleChangedEvent(scale);
|
||||
TimeScaledObject::ScaleChangedEvent(scale);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
void TimelineViewRect::TimebaseChangedEvent(const rational &tb)
|
||||
{
|
||||
TimelineScaledObject::TimebaseChangedEvent(tb);
|
||||
TimeScaledObject::TimebaseChangedEvent(tb);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
#include <QGraphicsRectItem>
|
||||
|
||||
#include "timeline/timelinecoordinate.h"
|
||||
#include "../timelinescaledobject.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
/**
|
||||
* @brief A base class for graphical representations of Block nodes
|
||||
*/
|
||||
class TimelineViewRect : public QGraphicsRectItem, public TimelineScaledObject
|
||||
class TimelineViewRect : public QGraphicsRectItem, public TimeScaledObject
|
||||
{
|
||||
public:
|
||||
TimelineViewRect(QGraphicsItem* parent = nullptr);
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
#include "common/rational.h"
|
||||
#include "timeline/timelinepoints.h"
|
||||
#include "widget/timelinewidget/snapservice.h"
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "widget/snapservice/snapservice.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user