don't use shared ptrs on streams
This commit is contained in:
@@ -48,7 +48,7 @@ Decoder::Decoder() :
|
||||
{
|
||||
}
|
||||
|
||||
bool Decoder::Open(StreamPtr fs)
|
||||
bool Decoder::Open(Stream *fs)
|
||||
{
|
||||
QMutexLocker locker(&mutex_);
|
||||
|
||||
|
||||
+4
-4
@@ -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
|
||||
@@ -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();
|
||||
@@ -242,7 +242,7 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
||||
|
||||
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 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
||||
// 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 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
||||
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 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
||||
} 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 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
||||
} 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 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
||||
// 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;
|
||||
@@ -446,10 +446,8 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
||||
// We actually have footage we can return instead of nullptr
|
||||
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);
|
||||
|
||||
@@ -77,7 +77,7 @@ Footage *OIIODecoder::Probe(const QString& filename, const QAtomicInt* cancelled
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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_;
|
||||
|
||||
+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());
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
@@ -134,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.
|
||||
@@ -148,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
|
||||
@@ -196,9 +201,9 @@ 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(Footage* footage, const QString& filename);
|
||||
static bool CompareFootageToItsFilename(Footage* footage);
|
||||
@@ -238,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
|
||||
|
||||
@@ -296,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;
|
||||
}
|
||||
@@ -304,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) {
|
||||
@@ -333,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;
|
||||
}
|
||||
|
||||
@@ -207,9 +207,9 @@ void Project::ColorConfigChanged()
|
||||
QVector<Item*> footage = this->get_items_of_type(Item::kFootage);
|
||||
|
||||
foreach (Item* item, footage) {
|
||||
foreach (StreamPtr s, static_cast<Footage*>(item)->streams()) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,9 +220,9 @@ void Project::DefaultColorSpaceChanged()
|
||||
QVector<Item*> footage = this->get_items_of_type(Item::kFootage);
|
||||
|
||||
foreach (Item* item, footage) {
|
||||
foreach (StreamPtr s, static_cast<Footage*>(item)->streams()) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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_;
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ void ProjectImportTask::Import(Folder *folder, QFileInfoList import, int &counte
|
||||
void ProjectImportTask::ValidateImageSequence(Footage *footage, QFileInfoList& info_list, int index)
|
||||
{
|
||||
// Heuristically determine whether this file is part of an image sequence or not
|
||||
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.
|
||||
@@ -229,7 +229,7 @@ bool ProjectImportTask::ItemIsStillImageFootageOnly(Footage* footage)
|
||||
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
|
||||
@@ -245,7 +245,7 @@ bool ProjectImportTask::CompareStillImageSize(Footage* footage, const QSize &sz)
|
||||
return false;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -101,9 +96,9 @@ void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m) const
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -120,7 +115,7 @@ void FootageComboBox::UpdateText()
|
||||
|
||||
if (footage_) {
|
||||
// Use combobox functions to show the footage name
|
||||
addItem(FootageToString(footage_.get()));
|
||||
addItem(FootageToString(footage_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,13 +41,16 @@ 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) const;
|
||||
@@ -58,7 +61,7 @@ private:
|
||||
|
||||
const Folder* root_;
|
||||
|
||||
StreamPtr footage_;
|
||||
Stream* footage_;
|
||||
|
||||
bool only_show_ready_footage_;
|
||||
};
|
||||
|
||||
@@ -146,11 +146,9 @@ QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QU
|
||||
bool found = false;
|
||||
|
||||
foreach (Item* item, footage) {
|
||||
const QList<StreamPtr>& streams = static_cast<Footage*>(item)->streams();
|
||||
|
||||
foreach (StreamPtr s, streams) {
|
||||
if (s.get() == loaded_stream) {
|
||||
con.input->set_standard_value(QVariant::fromValue(s));
|
||||
foreach (Stream* s, static_cast<Footage*>(item)->streams()) {
|
||||
if (s == loaded_stream) {
|
||||
con.input->set_standard_value(Node::PtrToValue(s));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
QMap<MediaInput*, StreamPtr> stream_data_;
|
||||
QMap<MediaInput*, Stream*> stream_data_;
|
||||
|
||||
Project* project_;
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -416,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());
|
||||
@@ -479,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);
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -75,20 +75,20 @@ void FootageViewerWidget::SetFootage(Footage *footage)
|
||||
sequence_.set_parameters_from_footage({footage_});
|
||||
|
||||
// Use first of each stream
|
||||
VideoStreamPtr video_stream = nullptr;
|
||||
AudioStreamPtr audio_stream = nullptr;
|
||||
VideoStream* video_stream = nullptr;
|
||||
AudioStream* audio_stream = nullptr;
|
||||
|
||||
foreach (StreamPtr s, footage_->streams()) {
|
||||
foreach (Stream* s, footage_->streams()) {
|
||||
if (!s->enabled()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!audio_stream && s->type() == Stream::kAudio) {
|
||||
audio_stream = std::static_pointer_cast<AudioStream>(s);
|
||||
audio_stream = static_cast<AudioStream*>(s);
|
||||
}
|
||||
|
||||
if (!video_stream && s->type() == Stream::kVideo) {
|
||||
video_stream = std::static_pointer_cast<VideoStream>(s);
|
||||
video_stream = static_cast<VideoStream*>(s);
|
||||
}
|
||||
|
||||
if (audio_stream && video_stream) {
|
||||
@@ -142,7 +142,7 @@ void FootageViewerWidget::StartFootageDragInternal(bool enable_video, bool enabl
|
||||
if (!enable_video || !enable_audio) {
|
||||
quint64 stream_disabler = 0x1;
|
||||
|
||||
foreach (StreamPtr s, GetFootage()->streams()) {
|
||||
foreach (Stream* s, GetFootage()->streams()) {
|
||||
if ((s->type() == Stream::kVideo && !enable_video)
|
||||
|| (s->type() == Stream::kAudio && !enable_audio)) {
|
||||
enabled_stream_flags &= ~stream_disabler;
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
QVariant GizmoTraverser::ProcessVideoFootage(StreamPtr stream, const rational &input_time)
|
||||
QVariant GizmoTraverser::ProcessVideoFootage(VideoStream *stream, const rational &input_time)
|
||||
{
|
||||
Q_UNUSED(input_time)
|
||||
|
||||
VideoStreamPtr image_stream = std::static_pointer_cast<VideoStream>(stream);
|
||||
VideoStream* image_stream = static_cast<VideoStream*>(stream);
|
||||
|
||||
return QVector2D(image_stream->width() * image_stream->pixel_aspect_ratio().toDouble(),
|
||||
image_stream->height());
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual QVariant ProcessVideoFootage(StreamPtr stream, const rational &input_time) override;
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* stream, const rational &input_time) override;
|
||||
|
||||
virtual QVariant ProcessShader(const Node *node, const TimeRange &range, const ShaderJob& job) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user