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_);
|
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
|
* 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.
|
* 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
|
* @brief Retrieves a video frame from footage
|
||||||
@@ -209,7 +209,7 @@ protected:
|
|||||||
QString GetIndexFilename();
|
QString GetIndexFilename();
|
||||||
|
|
||||||
struct CurrentlyConforming {
|
struct CurrentlyConforming {
|
||||||
StreamPtr stream;
|
Stream* stream;
|
||||||
AudioParams params;
|
AudioParams params;
|
||||||
|
|
||||||
bool operator==(const CurrentlyConforming& rhs) const
|
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.
|
* This function is NOT thread safe and should therefore only be called by thread safe functions.
|
||||||
*/
|
*/
|
||||||
StreamPtr stream() const
|
Stream* stream() const
|
||||||
{
|
{
|
||||||
return stream_;
|
return stream_;
|
||||||
}
|
}
|
||||||
@@ -242,7 +242,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
SampleBufferPtr RetrieveAudioFromConform(const QString& conform_filename, const TimeRange &range);
|
SampleBufferPtr RetrieveAudioFromConform(const QString& conform_filename, const TimeRange &range);
|
||||||
|
|
||||||
StreamPtr stream_;
|
Stream* stream_;
|
||||||
|
|
||||||
QMutex mutex_;
|
QMutex mutex_;
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ bool FFmpegDecoder::OpenInternal()
|
|||||||
FramePtr FFmpegDecoder::RetrieveStillImage(const rational &timecode, const int ÷r)
|
FramePtr FFmpegDecoder::RetrieveStillImage(const rational &timecode, const int ÷r)
|
||||||
{
|
{
|
||||||
// This is a still image
|
// 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();
|
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 it's an image sequence, we'll probably need to transform the filename
|
||||||
if (is->video_type() == VideoStream::kVideoTypeImageSequence) {
|
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);
|
img_filename = TransformImageSequenceFileName(stream()->footage()->filename(), ts);
|
||||||
} else {
|
} else {
|
||||||
@@ -126,8 +126,8 @@ FramePtr FFmpegDecoder::RetrieveStillImage(const rational &timecode, const int &
|
|||||||
frame->height,
|
frame->height,
|
||||||
native_pix_fmt_,
|
native_pix_fmt_,
|
||||||
native_channel_count_,
|
native_channel_count_,
|
||||||
std::static_pointer_cast<VideoStream>(stream())->pixel_aspect_ratio(),
|
is->pixel_aspect_ratio(),
|
||||||
std::static_pointer_cast<VideoStream>(stream())->interlacing(),
|
is->interlacing(),
|
||||||
divider));
|
divider));
|
||||||
output_frame->set_timestamp(timecode);
|
output_frame->set_timestamp(timecode);
|
||||||
output_frame->allocate();
|
output_frame->allocate();
|
||||||
@@ -150,7 +150,7 @@ FramePtr FFmpegDecoder::RetrieveStillImage(const rational &timecode, const int &
|
|||||||
|
|
||||||
FramePtr FFmpegDecoder::RetrieveVideoInternal(const rational &timecode, const int ÷r)
|
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) {
|
if (scale_divider_ != divider) {
|
||||||
FreeScaler();
|
FreeScaler();
|
||||||
@@ -187,8 +187,8 @@ FramePtr FFmpegDecoder::RetrieveVideoInternal(const rational &timecode, const in
|
|||||||
vs->height(),
|
vs->height(),
|
||||||
native_pix_fmt_,
|
native_pix_fmt_,
|
||||||
native_channel_count_,
|
native_channel_count_,
|
||||||
std::static_pointer_cast<VideoStream>(stream())->pixel_aspect_ratio(),
|
vs->pixel_aspect_ratio(),
|
||||||
std::static_pointer_cast<VideoStream>(stream())->interlacing(),
|
vs->interlacing(),
|
||||||
divider));
|
divider));
|
||||||
copy->set_timestamp(timecode);
|
copy->set_timestamp(timecode);
|
||||||
copy->allocate();
|
copy->allocate();
|
||||||
@@ -242,7 +242,7 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
|||||||
|
|
||||||
int64_t footage_duration = fmt_ctx->duration;
|
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
|
// Dump it into the Footage object
|
||||||
for (unsigned int i=0;i<fmt_ctx->nb_streams;i++) {
|
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
|
// Find decoder for this stream, if it exists we can proceed
|
||||||
AVCodec* decoder = avcodec_find_decoder(avstream->codecpar->codec_id);
|
AVCodec* decoder = avcodec_find_decoder(avstream->codecpar->codec_id);
|
||||||
|
|
||||||
StreamPtr str;
|
Stream* str;
|
||||||
|
|
||||||
if (decoder
|
if (decoder
|
||||||
&& (avstream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO
|
&& (avstream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO
|
||||||
@@ -330,7 +330,7 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
|||||||
av_packet_free(&pkt);
|
av_packet_free(&pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoStreamPtr video_stream = std::make_shared<VideoStream>();
|
VideoStream* video_stream = new VideoStream();
|
||||||
|
|
||||||
if (image_is_still) {
|
if (image_is_still) {
|
||||||
video_stream->set_video_type(VideoStream::kVideoTypeStill);
|
video_stream->set_video_type(VideoStream::kVideoTypeStill);
|
||||||
@@ -355,7 +355,7 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Create an audio stream object
|
// 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;
|
uint64_t channel_layout = avstream->codecpar->channel_layout;
|
||||||
if (!channel_layout) {
|
if (!channel_layout) {
|
||||||
@@ -401,7 +401,7 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// This is data we can't utilize at the moment, but we make a Stream object anyway to keep parity with the file
|
// 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
|
// Set the correct codec type based on FFmpeg's result
|
||||||
switch (avstream->codecpar->codec_type) {
|
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
|
// Check if we could pick up any streams in this file
|
||||||
bool found_valid_streams = false;
|
bool found_valid_streams = false;
|
||||||
|
|
||||||
foreach (StreamPtr stream, streams) {
|
foreach (Stream* stream, streams) {
|
||||||
if (stream->type() != Stream::kUnknown) {
|
if (stream->type() != Stream::kUnknown) {
|
||||||
found_valid_streams = true;
|
found_valid_streams = true;
|
||||||
break;
|
break;
|
||||||
@@ -446,10 +446,8 @@ Footage *FFmpegDecoder::Probe(const QString& filename, const QAtomicInt* cancell
|
|||||||
// We actually have footage we can return instead of nullptr
|
// We actually have footage we can return instead of nullptr
|
||||||
footage = new Footage();
|
footage = new Footage();
|
||||||
|
|
||||||
// Copy streams over
|
// Add streams
|
||||||
foreach (StreamPtr stream, streams) {
|
footage->add_streams(streams);
|
||||||
footage->add_stream(stream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +467,6 @@ QString FFmpegDecoder::FFmpegError(int error_code)
|
|||||||
bool FFmpegDecoder::ConformAudioInternal(const QString &filename, const AudioParams ¶ms, const QAtomicInt *cancelled)
|
bool FFmpegDecoder::ConformAudioInternal(const QString &filename, const AudioParams ¶ms, const QAtomicInt *cancelled)
|
||||||
{
|
{
|
||||||
// Iterate through each audio frame and extract the PCM data
|
// Iterate through each audio frame and extract the PCM data
|
||||||
AudioStreamPtr audio_stream = std::static_pointer_cast<AudioStream>(stream());
|
|
||||||
|
|
||||||
// Seek to starting point
|
// Seek to starting point
|
||||||
instance_.Seek(0);
|
instance_.Seek(0);
|
||||||
@@ -810,7 +807,7 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const int64_t& target_t
|
|||||||
|
|
||||||
void FFmpegDecoder::InitScaler(int divider)
|
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_width = VideoParams::GetScaledDimension(vs->width(), divider);
|
||||||
int scaled_height = VideoParams::GetScaledDimension(vs->height(), 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();
|
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_width(in->spec().width);
|
||||||
image_stream->set_height(in->spec().height);
|
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
|
// If we can open the filename provided, assume everything is working (even if this is an image
|
||||||
// sequence with potentially missing frame)
|
// sequence with potentially missing frame)
|
||||||
if (OpenImageHandler(stream()->footage()->filename())) {
|
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) {
|
if (video_stream->video_type() == VideoStream::kVideoTypeStill) {
|
||||||
last_sequence_index_ = 0;
|
last_sequence_index_ = 0;
|
||||||
@@ -123,7 +123,7 @@ bool OIIODecoder::OpenInternal()
|
|||||||
|
|
||||||
FramePtr OIIODecoder::RetrieveVideoInternal(const rational &timecode, const int& divider)
|
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;
|
int64_t sequence_index;
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ struct XMLNodeData {
|
|||||||
QHash<quintptr, Node*> node_ptrs;
|
QHash<quintptr, Node*> node_ptrs;
|
||||||
QHash<quintptr, NodeOutput*> output_ptrs;
|
QHash<quintptr, NodeOutput*> output_ptrs;
|
||||||
QList<SerializedConnection> desired_connections;
|
QList<SerializedConnection> desired_connections;
|
||||||
QHash<quintptr, StreamPtr> footage_ptrs;
|
QHash<quintptr, Stream*> footage_ptrs;
|
||||||
QList<FootageConnection> footage_connections;
|
QList<FootageConnection> footage_connections;
|
||||||
QList<BlockLink> block_links;
|
QList<BlockLink> block_links;
|
||||||
QHash<quintptr, Item*> item_ptrs;
|
QHash<quintptr, Item*> item_ptrs;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, Footage *foota
|
|||||||
int first_usable_stream = -1;
|
int first_usable_stream = -1;
|
||||||
|
|
||||||
for (int i=0;i<footage_->streams().size();i++) {
|
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);
|
QListWidgetItem* item = new QListWidgetItem(stream->description(), track_list);
|
||||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||||
@@ -78,10 +78,10 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, Footage *foota
|
|||||||
|
|
||||||
switch (stream->type()) {
|
switch (stream->type()) {
|
||||||
case Stream::kVideo:
|
case Stream::kVideo:
|
||||||
stacked_widget_->addWidget(new VideoStreamProperties(std::static_pointer_cast<VideoStream>(stream)));
|
stacked_widget_->addWidget(new VideoStreamProperties(static_cast<VideoStream*>(stream)));
|
||||||
break;
|
break;
|
||||||
case Stream::kAudio:
|
case Stream::kAudio:
|
||||||
stacked_widget_->addWidget(new AudioStreamProperties(std::static_pointer_cast<AudioStream>(stream)));
|
stacked_widget_->addWidget(new AudioStreamProperties(static_cast<AudioStream*>(stream)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
stacked_widget_->addWidget(new StreamProperties());
|
stacked_widget_->addWidget(new StreamProperties());
|
||||||
@@ -175,7 +175,7 @@ void FootagePropertiesDialog::FootageChangeCommand::undo_internal()
|
|||||||
footage_->set_name(old_name_);
|
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),
|
UndoCommand(command),
|
||||||
stream_(stream),
|
stream_(stream),
|
||||||
old_enabled_(stream->enabled()),
|
old_enabled_(stream->enabled()),
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ private:
|
|||||||
|
|
||||||
class StreamEnableChangeCommand : public UndoCommand {
|
class StreamEnableChangeCommand : public UndoCommand {
|
||||||
public:
|
public:
|
||||||
StreamEnableChangeCommand(StreamPtr stream,
|
StreamEnableChangeCommand(Stream* stream,
|
||||||
bool enabled,
|
bool enabled,
|
||||||
QUndoCommand* command = nullptr);
|
QUndoCommand* command = nullptr);
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ private:
|
|||||||
virtual void undo_internal() override;
|
virtual void undo_internal() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StreamPtr stream_;
|
Stream* stream_;
|
||||||
|
|
||||||
bool old_enabled_;
|
bool old_enabled_;
|
||||||
bool new_enabled_;
|
bool new_enabled_;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
AudioStreamProperties::AudioStreamProperties(AudioStreamPtr stream) :
|
AudioStreamProperties::AudioStreamProperties(AudioStream *stream) :
|
||||||
stream_(stream)
|
stream_(stream)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ namespace olive {
|
|||||||
class AudioStreamProperties : public StreamProperties
|
class AudioStreamProperties : public StreamProperties
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AudioStreamProperties(AudioStreamPtr stream);
|
AudioStreamProperties(AudioStream* stream);
|
||||||
|
|
||||||
virtual void Accept(QUndoCommand* parent) override;
|
virtual void Accept(QUndoCommand* parent) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioStreamPtr stream_;
|
AudioStream* stream_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
VideoStreamProperties::VideoStreamProperties(VideoStreamPtr stream) :
|
VideoStreamProperties::VideoStreamProperties(VideoStream *stream) :
|
||||||
stream_(stream),
|
stream_(stream),
|
||||||
video_premultiply_alpha_(nullptr)
|
video_premultiply_alpha_(nullptr)
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ VideoStreamProperties::VideoStreamProperties(VideoStreamPtr stream) :
|
|||||||
|
|
||||||
int imgseq_row = 0;
|
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);
|
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) {
|
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;
|
int64_t new_dur = imgseq_end_time_->GetValue() - imgseq_start_time_->GetValue() + 1;
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ bool VideoStreamProperties::SanityCheck()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoStreamProperties::VideoStreamChangeCommand::VideoStreamChangeCommand(VideoStreamPtr stream,
|
VideoStreamProperties::VideoStreamChangeCommand::VideoStreamChangeCommand(VideoStream *stream,
|
||||||
bool premultiplied,
|
bool premultiplied,
|
||||||
QString colorspace,
|
QString colorspace,
|
||||||
VideoParams::Interlacing interlacing,
|
VideoParams::Interlacing interlacing,
|
||||||
@@ -218,7 +218,7 @@ void VideoStreamProperties::VideoStreamChangeCommand::undo_internal()
|
|||||||
stream_->set_pixel_aspect_ratio(old_pixel_ar_);
|
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),
|
UndoCommand(parent),
|
||||||
video_stream_(video_stream),
|
video_stream_(video_stream),
|
||||||
new_start_index_(start_index),
|
new_start_index_(start_index),
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class VideoStreamProperties : public StreamProperties
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VideoStreamProperties(VideoStreamPtr stream);
|
VideoStreamProperties(VideoStream* stream);
|
||||||
|
|
||||||
virtual void Accept(QUndoCommand* parent) override;
|
virtual void Accept(QUndoCommand* parent) override;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* @brief Attached video stream
|
* @brief Attached video stream
|
||||||
*/
|
*/
|
||||||
VideoStreamPtr stream_;
|
VideoStream* stream_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Setting for associated/premultiplied alpha
|
* @brief Setting for associated/premultiplied alpha
|
||||||
@@ -85,7 +85,7 @@ private:
|
|||||||
|
|
||||||
class VideoStreamChangeCommand : public UndoCommand {
|
class VideoStreamChangeCommand : public UndoCommand {
|
||||||
public:
|
public:
|
||||||
VideoStreamChangeCommand(VideoStreamPtr stream,
|
VideoStreamChangeCommand(VideoStream* stream,
|
||||||
bool premultiplied,
|
bool premultiplied,
|
||||||
QString colorspace,
|
QString colorspace,
|
||||||
VideoParams::Interlacing interlacing,
|
VideoParams::Interlacing interlacing,
|
||||||
@@ -99,7 +99,7 @@ private:
|
|||||||
virtual void undo_internal() override;
|
virtual void undo_internal() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VideoStreamPtr stream_;
|
VideoStream* stream_;
|
||||||
|
|
||||||
bool new_premultiplied_;
|
bool new_premultiplied_;
|
||||||
QString new_colorspace_;
|
QString new_colorspace_;
|
||||||
@@ -115,7 +115,7 @@ private:
|
|||||||
|
|
||||||
class ImageSequenceChangeCommand : public UndoCommand {
|
class ImageSequenceChangeCommand : public UndoCommand {
|
||||||
public:
|
public:
|
||||||
ImageSequenceChangeCommand(VideoStreamPtr video_stream,
|
ImageSequenceChangeCommand(VideoStream* video_stream,
|
||||||
int64_t start_index,
|
int64_t start_index,
|
||||||
int64_t duration,
|
int64_t duration,
|
||||||
const rational& frame_rate,
|
const rational& frame_rate,
|
||||||
@@ -128,7 +128,7 @@ private:
|
|||||||
virtual void undo_internal() override;
|
virtual void undo_internal() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VideoStreamPtr video_stream_;
|
VideoStream* video_stream_;
|
||||||
|
|
||||||
int64_t new_start_index_;
|
int64_t new_start_index_;
|
||||||
int64_t old_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) {
|
} else if (data_type == kRational) {
|
||||||
return value.value<rational>().toString();
|
return value.value<rational>().toString();
|
||||||
} else if (data_type == kFootage) {
|
} 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
|
} else if (data_type == kTexture
|
||||||
|| data_type == kSamples
|
|| data_type == kSamples
|
||||||
|| data_type == kBuffer) {
|
|| data_type == kBuffer) {
|
||||||
|
|||||||
@@ -40,14 +40,14 @@ QVector<Node::CategoryID> MediaInput::Category() const
|
|||||||
return {kCategoryInput};
|
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
|
bool MediaInput::IsMedia() const
|
||||||
@@ -76,20 +76,20 @@ NodeValueTable MediaInput::Value(NodeValueDatabase &value) const
|
|||||||
|
|
||||||
void MediaInput::FootageChanged()
|
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_) {
|
if (new_footage == connected_footage_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connected_footage_) {
|
if (connected_footage_) {
|
||||||
disconnect(connected_footage_.get(), &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
disconnect(connected_footage_, &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
connected_footage_ = new_footage;
|
connected_footage_ = new_footage;
|
||||||
|
|
||||||
if (connected_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;
|
virtual QVector<CategoryID> Category() const override;
|
||||||
|
|
||||||
StreamPtr stream();
|
Stream* stream() const;
|
||||||
void SetStream(StreamPtr s);
|
void SetStream(Stream *s);
|
||||||
|
|
||||||
virtual bool IsMedia() const override;
|
virtual bool IsMedia() const override;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
NodeInput* footage_input_;
|
NodeInput* footage_input_;
|
||||||
|
|
||||||
StreamPtr connected_footage_;
|
Stream* connected_footage_;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void FootageChanged();
|
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
|
// We have one exception for FOOTAGE types, since we resolve the footage into a frame in the renderer
|
||||||
if (input->data_type() == NodeParam::kFootage) {
|
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) {
|
if (stream) {
|
||||||
// Add footage details to hash
|
// 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());
|
hash.addData(QString::number(stream->index()).toUtf8());
|
||||||
|
|
||||||
if (stream->type() == Stream::kVideo) {
|
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
|
// Current color config and space
|
||||||
hash.addData(image_stream->footage()->project()->color_manager()->GetConfigFilename().toUtf8());
|
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
|
// Footage timestamp
|
||||||
if (stream->type() == Stream::kVideo) {
|
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());
|
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;
|
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(stream)
|
||||||
Q_UNUSED(input_time)
|
Q_UNUSED(input_time)
|
||||||
@@ -110,7 +110,7 @@ QVariant NodeTraverser::ProcessVideoFootage(StreamPtr stream, const rational &in
|
|||||||
return QVariant();
|
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(stream)
|
||||||
Q_UNUSED(input_time)
|
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;
|
QList<NodeValue>* take_this_value_list = nullptr;
|
||||||
|
|
||||||
if (v.type() == NodeParam::kFootage) {
|
if (v.type() == NodeParam::kFootage) {
|
||||||
StreamPtr s = v.data().value<StreamPtr>();
|
Stream* s = Node::ValueToPtr<Stream>(v.data());
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
if (s->type() == Stream::kVideo) {
|
if (s->type() == Stream::kVideo) {
|
||||||
@@ -214,7 +214,8 @@ void NodeTraverser::PostProcessTable(const Node *node, const TimeRange &range, N
|
|||||||
if (!got_cached_frame) {
|
if (!got_cached_frame) {
|
||||||
// Retrieve video frames
|
// Retrieve video frames
|
||||||
foreach (const NodeValue& v, video_footage_to_retrieve) {
|
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()) {
|
if (stream->footage()->IsValid()) {
|
||||||
QVariant value = ProcessVideoFootage(stream, range.in());
|
QVariant value = ProcessVideoFootage(stream, range.in());
|
||||||
@@ -246,10 +247,11 @@ void NodeTraverser::PostProcessTable(const Node *node, const TimeRange &range, N
|
|||||||
|
|
||||||
// Retrieve audio samples
|
// Retrieve audio samples
|
||||||
foreach (const NodeValue& v, audio_footage_to_retrieve) {
|
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()) {
|
if (stream->footage()->IsValid()) {
|
||||||
QVariant value = ProcessAudioFootage(v.data().value<StreamPtr>(), range);
|
QVariant value = ProcessAudioFootage(stream, range);
|
||||||
|
|
||||||
if (!value.isNull()) {
|
if (!value.isNull()) {
|
||||||
output_params.Push(NodeParam::kSamples, value, node);
|
output_params.Push(NodeParam::kSamples, value, node);
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ protected:
|
|||||||
|
|
||||||
virtual NodeValueTable GenerateBlockTable(const TrackOutput *track, const TimeRange& range);
|
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);
|
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
|
#endif // AUDIOSTREAM_H
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void Footage::Save(QXmlStreamWriter *writer) const
|
|||||||
TimelinePoints::Save(writer);
|
TimelinePoints::Save(writer);
|
||||||
writer->writeEndElement(); // points
|
writer->writeEndElement(); // points
|
||||||
|
|
||||||
foreach (StreamPtr stream, streams_) {
|
foreach (Stream* stream, streams_) {
|
||||||
writer->writeStartElement(QStringLiteral("stream"));
|
writer->writeStartElement(QStringLiteral("stream"));
|
||||||
stream->Save(writer);
|
stream->Save(writer);
|
||||||
writer->writeEndElement(); // stream
|
writer->writeEndElement(); // stream
|
||||||
@@ -119,23 +119,27 @@ void Footage::set_timestamp(const qint64 &t)
|
|||||||
timestamp_ = t;
|
timestamp_ = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Footage::add_stream(StreamPtr s)
|
void Footage::add_stream(Stream* s)
|
||||||
{
|
{
|
||||||
// Set its footage parent to this
|
// Set its footage parent to this
|
||||||
s->set_footage(this);
|
s->setParent(this);
|
||||||
|
|
||||||
// Add a copy of this stream to the list
|
// Add a copy of this stream to the list
|
||||||
streams_.append(s);
|
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
|
int Footage::stream_count() const
|
||||||
@@ -161,16 +165,15 @@ void Footage::set_decoder(const QString &id)
|
|||||||
QIcon Footage::icon()
|
QIcon Footage::icon()
|
||||||
{
|
{
|
||||||
if (valid_ && !streams_.isEmpty()) {
|
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 (s && static_cast<VideoStream*>(s)->video_type() != VideoStream::kVideoTypeStill) {
|
||||||
if (std::static_pointer_cast<VideoStream>(first_stream)->video_type() == VideoStream::kVideoTypeStill) {
|
return icon::Video;
|
||||||
return icon::Image;
|
} else if (HasEnabledStreamsOfType(Stream::kAudio)) {
|
||||||
} else {
|
|
||||||
return icon::Video;
|
|
||||||
}
|
|
||||||
} else if (first_stream->type() == Stream::kAudio) {
|
|
||||||
return icon::Audio;
|
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()
|
QString Footage::duration()
|
||||||
{
|
{
|
||||||
// Find longest stream duration
|
// Find longest stream duration
|
||||||
StreamPtr longest_stream = nullptr;
|
Stream* longest_stream = nullptr;
|
||||||
rational longest;
|
rational longest;
|
||||||
|
|
||||||
foreach (StreamPtr stream, streams_) {
|
foreach (Stream* stream, streams_) {
|
||||||
if (stream->enabled() && (stream->type() == Stream::kVideo || stream->type() == Stream::kAudio)) {
|
if (stream->enabled() && (stream->type() == Stream::kVideo || stream->type() == Stream::kAudio)) {
|
||||||
rational this_stream_dur = Timecode::timestamp_to_time(stream->duration(),
|
rational this_stream_dur = Timecode::timestamp_to_time(stream->duration(),
|
||||||
stream->timebase());
|
stream->timebase());
|
||||||
@@ -197,7 +200,7 @@ QString Footage::duration()
|
|||||||
|
|
||||||
if (longest_stream) {
|
if (longest_stream) {
|
||||||
if (longest_stream->type() == Stream::kVideo) {
|
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) {
|
if (video_stream->video_type() != VideoStream::kVideoTypeStill) {
|
||||||
int64_t duration = video_stream->duration();
|
int64_t duration = video_stream->duration();
|
||||||
@@ -214,8 +217,6 @@ QString Footage::duration()
|
|||||||
Core::instance()->GetTimecodeDisplay());
|
Core::instance()->GetTimecodeDisplay());
|
||||||
}
|
}
|
||||||
} else if (longest_stream->type() == Stream::kAudio) {
|
} 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
|
// If we're showing in a timecode, we prefer showing audio in seconds instead
|
||||||
Timecode::Display display = Core::instance()->GetTimecodeDisplay();
|
Timecode::Display display = Core::instance()->GetTimecodeDisplay();
|
||||||
if (display == Timecode::kTimecodeDropFrame
|
if (display == Timecode::kTimecodeDropFrame
|
||||||
@@ -238,16 +239,16 @@ QString Footage::rate()
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasStreamsOfType(Stream::kVideo)) {
|
if (HasEnabledStreamsOfType(Stream::kVideo)) {
|
||||||
// This is a video editor, prioritize video streams
|
// 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) {
|
if (video_stream->video_type() != VideoStream::kVideoTypeStill) {
|
||||||
return QCoreApplication::translate("Footage", "%1 FPS").arg(video_stream->frame_rate().toDouble());
|
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
|
// 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());
|
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 enabled_streams = 0;
|
||||||
quint64 stream_enabler = 1;
|
quint64 stream_enabler = 1;
|
||||||
|
|
||||||
foreach (StreamPtr s, streams_) {
|
foreach (Stream* s, streams_) {
|
||||||
if (s->enabled()) {
|
if (s->enabled()) {
|
||||||
enabled_streams |= stream_enabler;
|
enabled_streams |= stream_enabler;
|
||||||
}
|
}
|
||||||
@@ -276,10 +277,10 @@ void Footage::ClearStreams()
|
|||||||
streams_.clear();
|
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
|
// Return true if any streams are video streams
|
||||||
foreach (StreamPtr stream, streams_) {
|
foreach (Stream* stream, streams_) {
|
||||||
if (stream->enabled() && stream->type() == type) {
|
if (stream->enabled() && stream->type() == type) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -288,9 +289,9 @@ bool Footage::HasStreamsOfType(const Stream::Type &type) const
|
|||||||
return false;
|
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) {
|
if (stream->enabled() && stream->type() == type) {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
@@ -336,7 +337,7 @@ void Footage::UpdateTooltip()
|
|||||||
QString tip = QCoreApplication::translate("Footage", "Filename: %1").arg(filename());
|
QString tip = QCoreApplication::translate("Footage", "Filename: %1").arg(filename());
|
||||||
|
|
||||||
if (!streams_.isEmpty()) {
|
if (!streams_.isEmpty()) {
|
||||||
foreach (StreamPtr s, streams_) {
|
foreach (Stream* s, streams_) {
|
||||||
if (s->enabled()) {
|
if (s->enabled()) {
|
||||||
tip.append("\n");
|
tip.append("\n");
|
||||||
tip.append(s->description());
|
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.
|
* 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.
|
* @brief Retrieve a stream at the given index.
|
||||||
@@ -148,12 +150,15 @@ public:
|
|||||||
*
|
*
|
||||||
* The stream at the index provided
|
* 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
|
* @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
|
* @brief Retrieve total number of streams in this Footage file
|
||||||
@@ -196,9 +201,9 @@ public:
|
|||||||
*
|
*
|
||||||
* The stream type to check for
|
* 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 CompareFootageToFile(Footage* footage, const QString& filename);
|
||||||
static bool CompareFootageToItsFilename(Footage* footage);
|
static bool CompareFootageToItsFilename(Footage* footage);
|
||||||
@@ -238,7 +243,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* @brief Internal streams array
|
* @brief Internal streams array
|
||||||
*/
|
*/
|
||||||
QList<StreamPtr> streams_;
|
QVector<Stream*> streams_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Internal attached decoder ID
|
* @brief Internal attached decoder ID
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
Stream::Stream() :
|
Stream::Stream() :
|
||||||
footage_(nullptr),
|
|
||||||
type_(kUnknown),
|
type_(kUnknown),
|
||||||
enabled_(true)
|
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) {
|
XMLAttributeLoop(reader, attr) {
|
||||||
if (attr.name() == QStringLiteral("type")) {
|
if (attr.name() == QStringLiteral("type")) {
|
||||||
Stream::Type type = static_cast<Stream::Type>(attr.value().toInt());
|
Stream::Type type = static_cast<Stream::Type>(attr.value().toInt());
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Stream::kVideo:
|
case Stream::kVideo:
|
||||||
stream = std::make_shared<VideoStream>();
|
stream = new VideoStream();
|
||||||
break;
|
break;
|
||||||
case Stream::kAudio:
|
case Stream::kAudio:
|
||||||
stream = std::make_shared<AudioStream>();
|
stream = new AudioStream();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
stream = std::make_shared<Stream>();
|
stream = new Stream();
|
||||||
stream->set_type(type);
|
stream->set_type(type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -62,6 +61,10 @@ StreamPtr Stream::Load(QXmlStreamReader *reader, XMLNodeData &xml_node_data, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!stream) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
while (XMLReadNextStartElement(reader)) {
|
while (XMLReadNextStartElement(reader)) {
|
||||||
if (reader->name() == QStringLiteral("ptr")) {
|
if (reader->name() == QStringLiteral("ptr")) {
|
||||||
xml_node_data.footage_ptrs.insert(reader->readElementText().toULongLong(), stream);
|
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
|
Footage *Stream::footage() const
|
||||||
{
|
{
|
||||||
return footage_;
|
return dynamic_cast<Footage*>(parent());
|
||||||
}
|
|
||||||
|
|
||||||
void Stream::set_footage(Footage *f)
|
|
||||||
{
|
|
||||||
footage_ = f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const rational &Stream::timebase() const
|
const rational &Stream::timebase() const
|
||||||
|
|||||||
@@ -33,8 +33,6 @@
|
|||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
class Footage;
|
class Footage;
|
||||||
class Stream;
|
|
||||||
using StreamPtr = std::shared_ptr<Stream>;
|
|
||||||
struct XMLNodeData;
|
struct XMLNodeData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,7 +67,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual ~Stream() override;
|
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;
|
void Save(QXmlStreamWriter *writer) const;
|
||||||
|
|
||||||
@@ -79,7 +77,6 @@ public:
|
|||||||
void set_type(const Type& type);
|
void set_type(const Type& type);
|
||||||
|
|
||||||
Footage* footage() const;
|
Footage* footage() const;
|
||||||
void set_footage(Footage* f);
|
|
||||||
|
|
||||||
const rational& timebase() const;
|
const rational& timebase() const;
|
||||||
void set_timebase(const rational& timebase);
|
void set_timebase(const rational& timebase);
|
||||||
@@ -109,8 +106,6 @@ signals:
|
|||||||
void ParametersChanged();
|
void ParametersChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Footage* footage_;
|
|
||||||
|
|
||||||
rational timebase_;
|
rational timebase_;
|
||||||
|
|
||||||
int64_t duration_;
|
int64_t duration_;
|
||||||
@@ -127,7 +122,4 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <QMetaType>
|
|
||||||
Q_DECLARE_METATYPE(olive::StreamPtr)
|
|
||||||
|
|
||||||
#endif // STREAM_H
|
#endif // STREAM_H
|
||||||
|
|||||||
@@ -174,8 +174,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using VideoStreamPtr = std::shared_ptr<VideoStream>;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // VIDEOSTREAM_H
|
#endif // VIDEOSTREAM_H
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
|
|||||||
bool found_audio_params = false;
|
bool found_audio_params = false;
|
||||||
|
|
||||||
foreach (Footage* f, footage) {
|
foreach (Footage* f, footage) {
|
||||||
foreach (StreamPtr s, f->streams()) {
|
foreach (Stream* s, f->streams()) {
|
||||||
if (!s->enabled()) {
|
if (!s->enabled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -304,7 +304,7 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
|
|||||||
switch (s->type()) {
|
switch (s->type()) {
|
||||||
case Stream::kVideo:
|
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 this is a video stream, use these parameters
|
||||||
if (!found_video_params) {
|
if (!found_video_params) {
|
||||||
@@ -333,7 +333,7 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
|
|||||||
}
|
}
|
||||||
case Stream::kAudio:
|
case Stream::kAudio:
|
||||||
if (!found_audio_params) {
|
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));
|
set_audio_params(AudioParams(as->sample_rate(), as->channel_layout(), AudioParams::kInternalFormat));
|
||||||
found_audio_params = true;
|
found_audio_params = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,9 +207,9 @@ void Project::ColorConfigChanged()
|
|||||||
QVector<Item*> footage = this->get_items_of_type(Item::kFootage);
|
QVector<Item*> footage = this->get_items_of_type(Item::kFootage);
|
||||||
|
|
||||||
foreach (Item* item, footage) {
|
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) {
|
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);
|
QVector<Item*> footage = this->get_items_of_type(Item::kFootage);
|
||||||
|
|
||||||
foreach (Item* item, footage) {
|
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) {
|
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) {
|
if (!stream) {
|
||||||
qWarning() << "Attempted to resolve the decoder of a null 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());
|
QMutexLocker locker(decoder_cache_->mutex());
|
||||||
|
|
||||||
DecoderPtr decoder = decoder_cache_->value(stream.get());
|
DecoderPtr decoder = decoder_cache_->value(stream);
|
||||||
|
|
||||||
if (!decoder) {
|
if (!decoder) {
|
||||||
// No decoder
|
// No decoder
|
||||||
decoder = Decoder::CreateFromID(stream->footage()->decoder());
|
decoder = Decoder::CreateFromID(stream->footage()->decoder());
|
||||||
|
|
||||||
if (decoder->Open(stream)) {
|
if (decoder->Open(stream)) {
|
||||||
decoder_cache_->insert(stream.get(), decoder);
|
decoder_cache_->insert(stream, decoder);
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Failed to open decoder for" << stream->footage()->filename()
|
qWarning() << "Failed to open decoder for" << stream->footage()->filename()
|
||||||
<< "::" << stream->index();
|
<< "::" << 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;
|
TexturePtr value = nullptr;
|
||||||
|
|
||||||
// Check the still frame cache. On large frames such as high resolution still images, uploading
|
// 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
|
// and color managing them for every frame is a waste of time, so we implement a small cache here
|
||||||
// to optimize such a situation
|
// to optimize such a situation
|
||||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream);
|
|
||||||
const VideoParams& video_params = ticket_->property("vparam").value<VideoParams>();
|
const VideoParams& video_params = ticket_->property("vparam").value<VideoParams>();
|
||||||
|
|
||||||
ColorManager* color_manager = Node::ValueToPtr<ColorManager>(ticket_->property("colormanager"));
|
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>(
|
StillImageCache::EntryPtr want_entry = std::make_shared<StillImageCache::Entry>(
|
||||||
nullptr,
|
nullptr,
|
||||||
stream,
|
video_stream,
|
||||||
ColorProcessor::GenerateID(color_manager, video_stream->colorspace(), color_manager->GetReferenceColorSpace()),
|
ColorProcessor::GenerateID(color_manager, video_stream->colorspace(), color_manager->GetReferenceColorSpace()),
|
||||||
video_stream->premultiplied_alpha(),
|
video_stream->premultiplied_alpha(),
|
||||||
footage_divider,
|
footage_divider,
|
||||||
@@ -325,7 +324,7 @@ QVariant RenderProcessor::ProcessVideoFootage(StreamPtr stream, const rational &
|
|||||||
|
|
||||||
still_image_cache_->mutex()->unlock();
|
still_image_cache_->mutex()->unlock();
|
||||||
|
|
||||||
DecoderPtr decoder = ResolveDecoderFromInput(stream);
|
DecoderPtr decoder = ResolveDecoderFromInput(video_stream);
|
||||||
|
|
||||||
if (decoder) {
|
if (decoder) {
|
||||||
FramePtr frame = decoder->RetrieveVideo(input_time,
|
FramePtr frame = decoder->RetrieveVideo(input_time,
|
||||||
@@ -367,7 +366,7 @@ QVariant RenderProcessor::ProcessVideoFootage(StreamPtr stream, const rational &
|
|||||||
return QVariant::fromValue(value);
|
return QVariant::fromValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RenderProcessor::ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time)
|
QVariant RenderProcessor::ProcessAudioFootage(AudioStream *stream, const TimeRange &input_time)
|
||||||
{
|
{
|
||||||
QVariant value;
|
QVariant value;
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual NodeValueTable GenerateBlockTable(const TrackOutput *track, const TimeRange &range) override;
|
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;
|
virtual QVariant ProcessShader(const Node *node, const TimeRange &range, const ShaderJob& job) override;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ private:
|
|||||||
|
|
||||||
void Run();
|
void Run();
|
||||||
|
|
||||||
DecoderPtr ResolveDecoderFromInput(StreamPtr stream);
|
DecoderPtr ResolveDecoderFromInput(Stream* stream);
|
||||||
|
|
||||||
RenderTicketPtr ticket_;
|
RenderTicketPtr ticket_;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <QWaitCondition>
|
#include <QWaitCondition>
|
||||||
|
|
||||||
#include "common/rational.h"
|
#include "common/rational.h"
|
||||||
#include "project/item/footage/stream.h"
|
#include "project/item/footage/videostream.h"
|
||||||
#include "render/texture.h"
|
#include "render/texture.h"
|
||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
@@ -14,7 +14,7 @@ class StillImageCache
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct Entry {
|
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;
|
texture = t;
|
||||||
stream = s;
|
stream = s;
|
||||||
@@ -26,7 +26,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
TexturePtr texture;
|
TexturePtr texture;
|
||||||
StreamPtr stream;
|
VideoStream* stream;
|
||||||
QString colorspace;
|
QString colorspace;
|
||||||
bool alpha_is_associated;
|
bool alpha_is_associated;
|
||||||
int divider;
|
int divider;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
ConformTask::ConformTask(AudioStreamPtr stream, const AudioParams& params) :
|
ConformTask::ConformTask(AudioStream *stream, const AudioParams& params) :
|
||||||
stream_(stream),
|
stream_(stream),
|
||||||
params_(params)
|
params_(params)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ class ConformTask : public Task
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ConformTask(AudioStreamPtr stream, const AudioParams& params);
|
ConformTask(AudioStream* stream, const AudioParams& params);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool Run() override;
|
virtual bool Run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioStreamPtr stream_;
|
AudioStream* stream_;
|
||||||
|
|
||||||
AudioParams params_;
|
AudioParams params_;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
PreCacheTask::PreCacheTask(VideoStreamPtr footage, Sequence* sequence) :
|
PreCacheTask::PreCacheTask(VideoStream *footage, Sequence* sequence) :
|
||||||
RenderTask(new ViewerOutput(), sequence->video_params(), sequence->audio_params()),
|
RenderTask(new ViewerOutput(), sequence->video_params(), sequence->audio_params()),
|
||||||
footage_(footage)
|
footage_(footage)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class PreCacheTask : public RenderTask
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PreCacheTask(VideoStreamPtr footage, Sequence* sequence);
|
PreCacheTask(VideoStream* footage, Sequence* sequence);
|
||||||
|
|
||||||
virtual ~PreCacheTask() override;
|
virtual ~PreCacheTask() override;
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ protected:
|
|||||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples, qint64 job_time) override;
|
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples, qint64 job_time) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VideoStreamPtr footage_;
|
VideoStream* footage_;
|
||||||
|
|
||||||
MediaInput* video_node_;
|
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)
|
void ProjectImportTask::ValidateImageSequence(Footage *footage, QFileInfoList& info_list, int index)
|
||||||
{
|
{
|
||||||
// Heuristically determine whether this file is part of an image sequence or not
|
// 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
|
// By this point we've established that video contains a single still image stream. Now we'll
|
||||||
// see if it ends with numbers.
|
// see if it ends with numbers.
|
||||||
@@ -229,7 +229,7 @@ bool ProjectImportTask::ItemIsStillImageFootageOnly(Footage* footage)
|
|||||||
return false;
|
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_stream->video_type() != VideoStream::kVideoTypeStill) {
|
||||||
// If video type is not a still, this definitely isn't a video stream
|
// 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;
|
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();
|
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()));
|
QAction* selected = menu.exec(parentWidget()->mapToGlobal(pos()));
|
||||||
|
|
||||||
if (selected != nullptr) {
|
if (selected != nullptr) {
|
||||||
SetFootage(selected->data().value<StreamPtr>());
|
SetFootage(Node::ValueToPtr<Stream>(selected->data()));
|
||||||
|
|
||||||
emit FootageChanged(footage_);
|
emit FootageChanged(footage_);
|
||||||
}
|
}
|
||||||
@@ -69,12 +69,7 @@ void FootageComboBox::SetOnlyShowReadyFootage(bool e)
|
|||||||
only_show_ready_footage_ = e;
|
only_show_ready_footage_ = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamPtr FootageComboBox::SelectedFootage()
|
void FootageComboBox::SetFootage(Stream *f)
|
||||||
{
|
|
||||||
return footage_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FootageComboBox::SetFootage(StreamPtr f)
|
|
||||||
{
|
{
|
||||||
// Remove existing single item used to show the footage name
|
// Remove existing single item used to show the footage name
|
||||||
footage_ = f;
|
footage_ = f;
|
||||||
@@ -101,9 +96,9 @@ void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m) const
|
|||||||
Menu* stream_menu = new Menu(footage->name(), m);
|
Menu* stream_menu = new Menu(footage->name(), m);
|
||||||
m->addMenu(stream_menu);
|
m->addMenu(stream_menu);
|
||||||
|
|
||||||
foreach (StreamPtr stream, footage->streams()) {
|
foreach (Stream* stream, footage->streams()) {
|
||||||
QAction* stream_action = stream_menu->addAction(FootageToString(stream.get()));
|
QAction* stream_action = stream_menu->addAction(FootageToString(stream));
|
||||||
stream_action->setData(QVariant::fromValue(stream));
|
stream_action->setData(Node::PtrToValue(stream));
|
||||||
stream_action->setIcon(stream->icon());
|
stream_action->setIcon(stream->icon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +115,7 @@ void FootageComboBox::UpdateText()
|
|||||||
|
|
||||||
if (footage_) {
|
if (footage_) {
|
||||||
// Use combobox functions to show the footage name
|
// Use combobox functions to show the footage name
|
||||||
addItem(FootageToString(footage_.get()));
|
addItem(FootageToString(footage_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,13 +41,16 @@ public:
|
|||||||
|
|
||||||
void SetOnlyShowReadyFootage(bool e);
|
void SetOnlyShowReadyFootage(bool e);
|
||||||
|
|
||||||
StreamPtr SelectedFootage();
|
Stream* SelectedFootage() const
|
||||||
|
{
|
||||||
|
return footage_;
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SetFootage(StreamPtr f);
|
void SetFootage(Stream* f);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void FootageChanged(StreamPtr f);
|
void FootageChanged(Stream* f);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void TraverseFolder(const Folder *f, QMenu* m) const;
|
void TraverseFolder(const Folder *f, QMenu* m) const;
|
||||||
@@ -58,7 +61,7 @@ private:
|
|||||||
|
|
||||||
const Folder* root_;
|
const Folder* root_;
|
||||||
|
|
||||||
StreamPtr footage_;
|
Stream* footage_;
|
||||||
|
|
||||||
bool only_show_ready_footage_;
|
bool only_show_ready_footage_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -146,11 +146,9 @@ QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QU
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
foreach (Item* item, footage) {
|
foreach (Item* item, footage) {
|
||||||
const QList<StreamPtr>& streams = static_cast<Footage*>(item)->streams();
|
foreach (Stream* s, static_cast<Footage*>(item)->streams()) {
|
||||||
|
if (s == loaded_stream) {
|
||||||
foreach (StreamPtr s, streams) {
|
con.input->set_standard_value(Node::PtrToValue(s));
|
||||||
if (s.get() == loaded_stream) {
|
|
||||||
con.input->set_standard_value(QVariant::fromValue(s));
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ void NodeParamViewWidgetBridge::UpdateWidgetValues()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NodeParam::kFootage:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,8 @@
|
|||||||
|
|
||||||
namespace olive {
|
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(),
|
return QVariant::fromValue(VideoParams(video_stream->width(),
|
||||||
video_stream->height(),
|
video_stream->height(),
|
||||||
video_stream->timebase(),
|
video_stream->timebase(),
|
||||||
@@ -34,10 +32,8 @@ QVariant NodeTableTraverser::ProcessVideoFootage(StreamPtr stream, const rationa
|
|||||||
video_stream->pixel_aspect_ratio()));
|
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(),
|
return QVariant::fromValue(AudioParams(audio_stream->sample_rate(),
|
||||||
audio_stream->channel_layout(),
|
audio_stream->channel_layout(),
|
||||||
AudioParams::kInternalFormat));
|
AudioParams::kInternalFormat));
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ public:
|
|||||||
NodeTableTraverser() = default;
|
NodeTableTraverser() = default;
|
||||||
|
|
||||||
protected:
|
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;
|
bool all_items_are_footage_or_sequence = true;
|
||||||
|
|
||||||
foreach (Item* i, context_menu_items_) {
|
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;
|
all_items_have_video_streams = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,11 +416,12 @@ void ProjectExplorer::OpenContextMenuItemInNewWindow()
|
|||||||
|
|
||||||
void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
||||||
{
|
{
|
||||||
QList<VideoStreamPtr> video_streams;
|
QVector<VideoStream*> video_streams;
|
||||||
|
|
||||||
// To get here, the `context_menu_items_` must be all kFootage
|
// To get here, the `context_menu_items_` must be all kFootage
|
||||||
foreach (Item* i, context_menu_items_) {
|
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) {
|
if (s) {
|
||||||
video_streams.append(s);
|
video_streams.append(s);
|
||||||
@@ -430,7 +431,7 @@ void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
|||||||
Sequence* sequence = Node::ValueToPtr<Sequence>(a->data());
|
Sequence* sequence = Node::ValueToPtr<Sequence>(a->data());
|
||||||
|
|
||||||
// Start a background task for proxying
|
// 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);
|
PreCacheTask* proxy_task = new PreCacheTask(video_stream, sequence);
|
||||||
TaskManager::instance()->AddTask(proxy_task);
|
TaskManager::instance()->AddTask(proxy_task);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ protected:
|
|||||||
virtual void undo_internal() override;
|
virtual void undo_internal() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<MediaInput*, StreamPtr> stream_data_;
|
QMap<MediaInput*, Stream*> stream_data_;
|
||||||
|
|
||||||
Project* project_;
|
Project* project_;
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
|||||||
quint64 enabled_streams = footage.streams();
|
quint64 enabled_streams = footage.streams();
|
||||||
|
|
||||||
// Loop through all streams in footage
|
// 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());
|
Timeline::TrackType track_type = TrackTypeFromStreamType(stream->type());
|
||||||
|
|
||||||
quint64 cached_enabled_streams = enabled_streams;
|
quint64 cached_enabled_streams = enabled_streams;
|
||||||
@@ -239,7 +239,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
|||||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||||
|
|
||||||
if (stream->type() == Stream::kVideo
|
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,
|
// 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
|
// or we may use another stream's length depending on the circumstance
|
||||||
contains_image_stream = true;
|
contains_image_stream = true;
|
||||||
@@ -260,7 +260,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
|||||||
// Increment track count for this track type
|
// Increment track count for this track type
|
||||||
track_offsets[track_type]++;
|
track_offsets[track_type]++;
|
||||||
|
|
||||||
ghost->SetData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(stream));
|
ghost->SetData(TimelineViewGhostItem::kAttachedFootage, Node::PtrToValue(stream));
|
||||||
ghost->SetMode(Timeline::kMove);
|
ghost->SetMode(Timeline::kMove);
|
||||||
|
|
||||||
footage_ghosts.append(ghost);
|
footage_ghosts.append(ghost);
|
||||||
@@ -416,7 +416,7 @@ void ImportTool::DropGhosts(bool insert)
|
|||||||
for (int i=0;i<parent()->GetGhostItems().size();i++) {
|
for (int i=0;i<parent()->GetGhostItems().size();i++) {
|
||||||
TimelineViewGhostItem* ghost = parent()->GetGhostItems().at(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();
|
ClipBlock* clip = new ClipBlock();
|
||||||
clip->set_media_in(ghost->GetMediaIn());
|
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
|
// Link any clips so far that share the same Footage with this one
|
||||||
for (int j=0;j<i;j++) {
|
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()) {
|
if (footage_compare->footage() == footage_stream->footage()) {
|
||||||
Block::Link(block_items.at(j), clip);
|
Block::Link(block_items.at(j), clip);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace olive {
|
|||||||
|
|
||||||
TimelineViewGhostItem::TimelineViewGhostItem() :
|
TimelineViewGhostItem::TimelineViewGhostItem() :
|
||||||
track_adj_(0),
|
track_adj_(0),
|
||||||
stream_(nullptr),
|
|
||||||
mode_(Timeline::kNone),
|
mode_(Timeline::kNone),
|
||||||
can_have_zero_length_(true),
|
can_have_zero_length_(true),
|
||||||
can_move_tracks_(true),
|
can_move_tracks_(true),
|
||||||
|
|||||||
@@ -127,8 +127,6 @@ private:
|
|||||||
|
|
||||||
int track_adj_;
|
int track_adj_;
|
||||||
|
|
||||||
StreamPtr stream_;
|
|
||||||
|
|
||||||
Timeline::MovementMode mode_;
|
Timeline::MovementMode mode_;
|
||||||
|
|
||||||
bool can_have_zero_length_;
|
bool can_have_zero_length_;
|
||||||
|
|||||||
@@ -75,20 +75,20 @@ void FootageViewerWidget::SetFootage(Footage *footage)
|
|||||||
sequence_.set_parameters_from_footage({footage_});
|
sequence_.set_parameters_from_footage({footage_});
|
||||||
|
|
||||||
// Use first of each stream
|
// Use first of each stream
|
||||||
VideoStreamPtr video_stream = nullptr;
|
VideoStream* video_stream = nullptr;
|
||||||
AudioStreamPtr audio_stream = nullptr;
|
AudioStream* audio_stream = nullptr;
|
||||||
|
|
||||||
foreach (StreamPtr s, footage_->streams()) {
|
foreach (Stream* s, footage_->streams()) {
|
||||||
if (!s->enabled()) {
|
if (!s->enabled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!audio_stream && s->type() == Stream::kAudio) {
|
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) {
|
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) {
|
if (audio_stream && video_stream) {
|
||||||
@@ -142,7 +142,7 @@ void FootageViewerWidget::StartFootageDragInternal(bool enable_video, bool enabl
|
|||||||
if (!enable_video || !enable_audio) {
|
if (!enable_video || !enable_audio) {
|
||||||
quint64 stream_disabler = 0x1;
|
quint64 stream_disabler = 0x1;
|
||||||
|
|
||||||
foreach (StreamPtr s, GetFootage()->streams()) {
|
foreach (Stream* s, GetFootage()->streams()) {
|
||||||
if ((s->type() == Stream::kVideo && !enable_video)
|
if ((s->type() == Stream::kVideo && !enable_video)
|
||||||
|| (s->type() == Stream::kAudio && !enable_audio)) {
|
|| (s->type() == Stream::kAudio && !enable_audio)) {
|
||||||
enabled_stream_flags &= ~stream_disabler;
|
enabled_stream_flags &= ~stream_disabler;
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
QVariant GizmoTraverser::ProcessVideoFootage(StreamPtr stream, const rational &input_time)
|
QVariant GizmoTraverser::ProcessVideoFootage(VideoStream *stream, const rational &input_time)
|
||||||
{
|
{
|
||||||
Q_UNUSED(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(),
|
return QVector2D(image_stream->width() * image_stream->pixel_aspect_ratio().toDouble(),
|
||||||
image_stream->height());
|
image_stream->height());
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
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;
|
virtual QVariant ProcessShader(const Node *node, const TimeRange &range, const ShaderJob& job) override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user