finished merge of viewer and footage
This commit is contained in:
@@ -39,7 +39,7 @@ NodeParamViewArrayWidget::NodeParamViewArrayWidget(Node *node, const QString &in
|
||||
|
||||
connect(node_, &Node::InputArraySizeChanged, this, &NodeParamViewArrayWidget::UpdateCounter);
|
||||
|
||||
UpdateCounter(input_, node_->InputArraySize(input_));
|
||||
UpdateCounter(input_, 0, node_->InputArraySize(input_));
|
||||
}
|
||||
|
||||
void NodeParamViewArrayWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
@@ -49,8 +49,9 @@ void NodeParamViewArrayWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
emit DoubleClicked();
|
||||
}
|
||||
|
||||
void NodeParamViewArrayWidget::UpdateCounter(const QString& input, int new_size)
|
||||
void NodeParamViewArrayWidget::UpdateCounter(const QString& input, int old_size, int new_size)
|
||||
{
|
||||
Q_UNUSED(old_size)
|
||||
if (input == input_) {
|
||||
count_lbl_->setText(tr("%1 element(s)").arg(new_size));
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ private:
|
||||
QLabel* count_lbl_;
|
||||
|
||||
private slots:
|
||||
void UpdateCounter(const QString &input, int new_size);
|
||||
void UpdateCounter(const QString &input, int old_size, int new_size);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -418,8 +418,10 @@ void NodeParamViewItemBody::ArrayCollapseBtnPressed(bool checked)
|
||||
emit ArrayExpandedChanged(checked);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::InputArraySizeChanged(const QString& input, int size)
|
||||
void NodeParamViewItemBody::InputArraySizeChanged(const QString& input, int old_sz, int size)
|
||||
{
|
||||
Q_UNUSED(old_sz)
|
||||
|
||||
Node* node = static_cast<Node*>(sender());
|
||||
|
||||
ArrayUI& array_ui = array_ui_[{node, input}];
|
||||
|
||||
@@ -137,7 +137,7 @@ private slots:
|
||||
|
||||
void ArrayCollapseBtnPressed(bool checked);
|
||||
|
||||
void InputArraySizeChanged(const QString &input, int size);
|
||||
void InputArraySizeChanged(const QString &input, int old_sz, int size);
|
||||
|
||||
void ArrayAppendClicked();
|
||||
|
||||
|
||||
@@ -95,6 +95,8 @@ ProjectExplorer::ProjectExplorer(QWidget *parent) :
|
||||
connect(tree_view_, &ProjectExplorerTreeView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
||||
connect(list_view_, &ProjectExplorerListView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
||||
connect(icon_view_, &ProjectExplorerIconView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
||||
|
||||
connect(&model_, &ProjectViewModel::ItemRemoved, this, &ProjectExplorer::ItemRemoved);
|
||||
}
|
||||
|
||||
const ProjectToolbar::ViewType &ProjectExplorer::view_type() const
|
||||
|
||||
@@ -100,6 +100,8 @@ signals:
|
||||
*/
|
||||
void DoubleClickedItem(Node* item);
|
||||
|
||||
void ItemRemoved(Node* node);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Get all the blocks that solely rely on an input node
|
||||
|
||||
@@ -103,10 +103,10 @@ void TimeBasedWidget::ConnectViewerNode(ViewerOutput *node)
|
||||
scrollbar_->ConnectTimelinePoints(viewer_node_->GetTimelinePoints());
|
||||
|
||||
if (auto_set_timebase_) {
|
||||
if (!viewer_node_->video_params().time_base().isNull()) {
|
||||
SetTimebase(viewer_node_->video_params().time_base());
|
||||
} else if (viewer_node_->audio_params().sample_rate() > 0) {
|
||||
SetTimebase(viewer_node_->audio_params().time_base());
|
||||
if (!viewer_node_->GetVideoParams().time_base().isNull()) {
|
||||
SetTimebase(viewer_node_->GetVideoParams().time_base());
|
||||
} else if (viewer_node_->GetAudioParams().sample_rate() > 0) {
|
||||
SetTimebase(viewer_node_->GetAudioParams().time_base());
|
||||
} else {
|
||||
SetTimebase(rational());
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ void TimelineWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
|
||||
ruler()->SetPlaybackCache(n->video_frame_cache());
|
||||
|
||||
SetTimebase(n->video_params().time_base());
|
||||
SetTimebase(n->GetVideoParams().time_base());
|
||||
|
||||
for (int i=0;i<views_.size();i++) {
|
||||
Track::Type track_type = static_cast<Track::Type>(i);
|
||||
@@ -522,12 +522,12 @@ void TimelineWidget::DecreaseTrackHeight()
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::InsertFootageAtPlayhead(const QVector<Footage*>& footage)
|
||||
void TimelineWidget::InsertFootageAtPlayhead(const QVector<ViewerOutput*>& footage)
|
||||
{
|
||||
import_tool_->PlaceAt(footage, GetTime(), true);
|
||||
}
|
||||
|
||||
void TimelineWidget::OverwriteFootageAtPlayhead(const QVector<Footage *> &footage)
|
||||
void TimelineWidget::OverwriteFootageAtPlayhead(const QVector<ViewerOutput *> &footage)
|
||||
{
|
||||
import_tool_->PlaceAt(footage, GetTime(), false);
|
||||
}
|
||||
@@ -1005,7 +1005,7 @@ void TimelineWidget::SetViewTimestamp(const int64_t &ts)
|
||||
if (use_audio_time_units_ && i == Track::kAudio) {
|
||||
view->view()->SetTime(Timecode::rescale_timestamp(ts,
|
||||
timebase(),
|
||||
GetConnectedNode()->audio_params().time_base()));
|
||||
GetConnectedNode()->GetAudioParams().time_base()));
|
||||
} else {
|
||||
view->view()->SetTime(ts);
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ void TimelineWidget::ViewTimestampChanged(int64_t ts)
|
||||
{
|
||||
if (use_audio_time_units_ && sender() == views_.at(Track::kAudio)) {
|
||||
ts = Timecode::rescale_timestamp(ts,
|
||||
GetConnectedNode()->audio_params().time_base(),
|
||||
GetConnectedNode()->GetAudioParams().time_base(),
|
||||
timebase());
|
||||
}
|
||||
|
||||
@@ -1050,7 +1050,7 @@ void TimelineWidget::UpdateViewTimebases()
|
||||
TimelineAndTrackView* view = views_.at(i);
|
||||
|
||||
if (use_audio_time_units_ && i == Track::kAudio) {
|
||||
view->view()->SetTimebase(GetConnectedNode()->audio_params().time_base());
|
||||
view->view()->SetTimebase(GetConnectedNode()->GetAudioParams().time_base());
|
||||
} else {
|
||||
view->view()->SetTimebase(timebase());
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ public:
|
||||
|
||||
void DecreaseTrackHeight();
|
||||
|
||||
void InsertFootageAtPlayhead(const QVector<Footage *> &footage);
|
||||
void InsertFootageAtPlayhead(const QVector<ViewerOutput *> &footage);
|
||||
|
||||
void OverwriteFootageAtPlayhead(const QVector<Footage *> &footage);
|
||||
void OverwriteFootageAtPlayhead(const QVector<ViewerOutput *> &footage);
|
||||
|
||||
void ToggleLinksOnSelected();
|
||||
|
||||
|
||||
@@ -40,25 +40,6 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
Track::Type TrackTypeFromStreamType(Stream::Type stream_type)
|
||||
{
|
||||
switch (stream_type) {
|
||||
case Stream::kVideo:
|
||||
return Track::kVideo;
|
||||
case Stream::kAudio:
|
||||
return Track::kAudio;
|
||||
case Stream::kSubtitle:
|
||||
// Temporarily disabled until we figure out a better thing to do with this
|
||||
//return Track::kSubtitle;
|
||||
case Stream::kUnknown:
|
||||
case Stream::kData:
|
||||
case Stream::kAttachment:
|
||||
break;
|
||||
}
|
||||
|
||||
return Track::kNone;
|
||||
}
|
||||
|
||||
ImportTool::ImportTool(TimelineWidget *parent) :
|
||||
TimelineTool(parent)
|
||||
{
|
||||
@@ -81,7 +62,7 @@ void ImportTool::DragEnter(TimelineViewMouseEvent *event)
|
||||
|
||||
// Variables to deserialize into
|
||||
quintptr item_ptr;
|
||||
QVector<Footage::StreamReference> enabled_streams;
|
||||
QVector<Track::Reference> enabled_streams;
|
||||
|
||||
// Set drag start position
|
||||
drag_start_ = event->GetCoordinates();
|
||||
@@ -95,15 +76,11 @@ void ImportTool::DragEnter(TimelineViewMouseEvent *event)
|
||||
Node* item = reinterpret_cast<Node*>(item_ptr);
|
||||
|
||||
// Check if Item is Footage
|
||||
if (dynamic_cast<Footage*>(item)) {
|
||||
|
||||
Footage* f = static_cast<Footage*>(item);
|
||||
|
||||
if (f->IsValid()) {
|
||||
// If the Item is Footage, we can create a Ghost from it
|
||||
dragged_footage_.insert(f, enabled_streams);
|
||||
}
|
||||
ViewerOutput* f = dynamic_cast<ViewerOutput*>(item);
|
||||
|
||||
if (f && f->GetTotalStreamCount()) {
|
||||
// If the Item is Footage, we can create a Ghost from it
|
||||
dragged_footage_.insert(f, enabled_streams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,18 +168,18 @@ void ImportTool::DragDrop(TimelineViewMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void ImportTool::PlaceAt(const QVector<Footage *> &footage, const rational &start, bool insert)
|
||||
void ImportTool::PlaceAt(const QVector<ViewerOutput *> &footage, const rational &start, bool insert)
|
||||
{
|
||||
QMap<Footage*, QVector<Footage::StreamReference> > refs;
|
||||
QMap<ViewerOutput*, QVector<Track::Reference> > refs;
|
||||
|
||||
foreach (Footage* f, footage) {
|
||||
foreach (ViewerOutput* f, footage) {
|
||||
refs.insert(f, f->GetEnabledStreamsAsReferences());
|
||||
}
|
||||
|
||||
PlaceAt(refs, start, insert);
|
||||
}
|
||||
|
||||
void ImportTool::PlaceAt(const QMap<Footage*, QVector<Footage::StreamReference> > &footage, const rational &start, bool insert)
|
||||
void ImportTool::PlaceAt(const QMap<ViewerOutput*, QVector<Track::Reference> > &footage, const rational &start, bool insert)
|
||||
{
|
||||
dragged_footage_ = footage;
|
||||
|
||||
@@ -214,7 +191,7 @@ void ImportTool::PlaceAt(const QMap<Footage*, QVector<Footage::StreamReference>
|
||||
DropGhosts(insert);
|
||||
}
|
||||
|
||||
void ImportTool::FootageToGhosts(rational ghost_start, const QMap<Footage *, QVector<Footage::StreamReference> > &sorted, const rational& dest_tb, const int& track_start)
|
||||
void ImportTool::FootageToGhosts(rational ghost_start, const QMap<ViewerOutput *, QVector<Track::Reference> > &sorted, const rational& dest_tb, const int& track_start)
|
||||
{
|
||||
for (auto it=sorted.cbegin(); it!=sorted.cend(); it++) {
|
||||
// Each stream is offset by one track per track "type", we keep track of them in this vector
|
||||
@@ -225,12 +202,12 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QMap<Footage *, QVe
|
||||
rational footage_duration;
|
||||
bool contains_image_stream = false;
|
||||
|
||||
foreach (const Footage::StreamReference& ref, it.value()) {
|
||||
Track::Type track_type = TrackTypeFromStreamType(ref.type());
|
||||
foreach (const Track::Reference& ref, it.value()) {
|
||||
Track::Type track_type = ref.type();
|
||||
|
||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||
|
||||
if (ref.type() == Stream::kVideo && it.key()->GetVideoParams(ref.index()).video_type() == VideoParams::kVideoTypeStill) {
|
||||
if (ref.type() == Track::kVideo && it.key()->GetVideoParams(ref.index()).video_type() == VideoParams::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;
|
||||
@@ -245,7 +222,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QMap<Footage *, QVe
|
||||
int64_t dur;
|
||||
rational tb;
|
||||
|
||||
if (ref.type() == Stream::kVideo) {
|
||||
if (ref.type() == Track::kVideo) {
|
||||
VideoParams vp = it.key()->GetVideoParams(ref.index());
|
||||
dur = vp.duration();
|
||||
tb = vp.time_base();
|
||||
@@ -265,7 +242,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QMap<Footage *, QVe
|
||||
// Increment track count for this track type
|
||||
track_offsets[track_type]++;
|
||||
|
||||
TimelineViewGhostItem::AttachedFootage af = {it.key(), it.key()->GetStringFromReference(ref)};
|
||||
TimelineViewGhostItem::AttachedFootage af = {it.key(), ref.ToString()};
|
||||
ghost->SetData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(af));
|
||||
ghost->SetMode(Timeline::kMove);
|
||||
|
||||
@@ -365,7 +342,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
|
||||
if (behavior == kDWSAuto) {
|
||||
|
||||
QVector<Footage*> footage_only;
|
||||
QVector<ViewerOutput*> footage_only;
|
||||
|
||||
for (auto it=dragged_footage_.cbegin(); it!=dragged_footage_.cend(); it++) {
|
||||
if (!footage_only.contains(it.key())) {
|
||||
@@ -393,7 +370,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
command->add_child(new FolderAddChild(Core::instance()->GetSelectedFolderInActiveProject(), new_sequence));
|
||||
new_sequence->add_default_nodes(command);
|
||||
|
||||
FootageToGhosts(0, dragged_footage_, new_sequence->video_params().time_base(), 0);
|
||||
FootageToGhosts(0, dragged_footage_, new_sequence->GetVideoParams().time_base(), 0);
|
||||
|
||||
sequence = new_sequence;
|
||||
|
||||
@@ -431,8 +408,8 @@ void ImportTool::DropGhosts(bool insert)
|
||||
command->add_child(new NodeAddCommand(dst_graph, clip));
|
||||
command->add_child(new NodeSetPositionToOffsetOfAnotherNodeCommand(clip, footage_stream.footage, QPointF(2, 0)));
|
||||
|
||||
switch (footage_stream.footage->GetTypeFromOutput(footage_stream.output)) {
|
||||
case Stream::kVideo:
|
||||
switch (Track::Reference::TypeFromString(footage_stream.output)) {
|
||||
case Track::kVideo:
|
||||
{
|
||||
TransformDistortNode* transform = new TransformDistortNode();
|
||||
command->add_child(new NodeAddCommand(dst_graph, transform));
|
||||
@@ -442,7 +419,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
command->add_child(new NodeSetPositionToOffsetOfAnotherNodeCommand(transform, clip, QPointF(-1, 0)));
|
||||
break;
|
||||
}
|
||||
case Stream::kAudio:
|
||||
case Track::kAudio:
|
||||
{
|
||||
VolumeNode* volume_node = new VolumeNode();
|
||||
command->add_child(new NodeAddCommand(dst_graph, volume_node));
|
||||
|
||||
@@ -35,8 +35,8 @@ public:
|
||||
virtual void DragLeave(QDragLeaveEvent *event) override;
|
||||
virtual void DragDrop(TimelineViewMouseEvent *event) override;
|
||||
|
||||
void PlaceAt(const QVector<Footage*> &footage, const rational& start, bool insert);
|
||||
void PlaceAt(const QMap<Footage *, QVector<Footage::StreamReference> > &footage, const rational& start, bool insert);
|
||||
void PlaceAt(const QVector<ViewerOutput *> &footage, const rational& start, bool insert);
|
||||
void PlaceAt(const QMap<ViewerOutput *, QVector<Track::Reference> > &footage, const rational& start, bool insert);
|
||||
|
||||
enum DropWithoutSequenceBehavior {
|
||||
kDWSAsk,
|
||||
@@ -46,13 +46,13 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
void FootageToGhosts(rational ghost_start, const QMap<Footage*, QVector<Footage::StreamReference> > &footage, const rational &dest_tb, const int &track_start);
|
||||
void FootageToGhosts(rational ghost_start, const QMap<ViewerOutput *, QVector<Track::Reference> > &footage, const rational &dest_tb, const int &track_start);
|
||||
|
||||
void PrepGhosts(const rational &frame, const int &track_index);
|
||||
|
||||
void DropGhosts(bool insert);
|
||||
|
||||
QMap<Footage*, QVector<Footage::StreamReference> > dragged_footage_;
|
||||
QMap<ViewerOutput*, QVector<Track::Reference> > dragged_footage_;
|
||||
|
||||
int import_pre_buffer_;
|
||||
|
||||
|
||||
@@ -344,23 +344,6 @@ Track::Type TimelineView::ConnectedTrackType()
|
||||
return Track::kNone;
|
||||
}
|
||||
|
||||
Stream::Type TimelineView::TrackTypeToStreamType(Track::Type track_type)
|
||||
{
|
||||
switch (track_type) {
|
||||
case Track::kNone:
|
||||
case Track::kCount:
|
||||
break;
|
||||
case Track::kVideo:
|
||||
return Stream::kVideo;
|
||||
case Track::kAudio:
|
||||
return Stream::kAudio;
|
||||
case Track::kSubtitle:
|
||||
return Stream::kSubtitle;
|
||||
}
|
||||
|
||||
return Stream::kUnknown;
|
||||
}
|
||||
|
||||
TimelineCoordinate TimelineView::ScreenToCoordinate(const QPoint& pt)
|
||||
{
|
||||
return SceneToCoordinate(mapToScene(pt));
|
||||
|
||||
@@ -114,7 +114,6 @@ protected:
|
||||
|
||||
private:
|
||||
Track::Type ConnectedTrackType();
|
||||
Stream::Type TrackTypeToStreamType(Track::Type track_type);
|
||||
|
||||
TimelineCoordinate ScreenToCoordinate(const QPoint& pt);
|
||||
TimelineCoordinate SceneToCoordinate(const QPointF& pt);
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
};
|
||||
|
||||
struct AttachedFootage {
|
||||
Footage* footage;
|
||||
ViewerOutput* footage;
|
||||
QString output;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ FootageViewerWidget::FootageViewerWidget(QWidget *parent) :
|
||||
|
||||
void FootageViewerWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
{
|
||||
super::ConnectNodeInternal(n);
|
||||
|
||||
SetTimestamp(cached_timestamps_.value(n, 0));
|
||||
}
|
||||
|
||||
@@ -50,6 +52,8 @@ void FootageViewerWidget::DisconnectNodeInternal(ViewerOutput *n)
|
||||
// Cache timestamp in case this footage is opened again later
|
||||
cached_timestamps_.insert(n, GetTimestamp());
|
||||
SetTimestamp(0);
|
||||
|
||||
super::DisconnectNodeInternal(n);
|
||||
}
|
||||
|
||||
void FootageViewerWidget::StartFootageDragInternal(bool enable_video, bool enable_audio)
|
||||
@@ -64,15 +68,15 @@ void FootageViewerWidget::StartFootageDragInternal(bool enable_video, bool enabl
|
||||
QByteArray encoded_data;
|
||||
QDataStream data_stream(&encoded_data, QIODevice::WriteOnly);
|
||||
|
||||
QVector<Footage::StreamReference> streams = GetConnectedNode()->GetEnabledStreamsAsReferences();
|
||||
QVector<Track::Reference> streams = GetConnectedNode()->GetEnabledStreamsAsReferences();
|
||||
|
||||
// Disable streams that have been disabled
|
||||
if (!enable_video || !enable_audio) {
|
||||
for (int i=0; i<streams.size(); i++) {
|
||||
const Footage::StreamReference& ref = streams.at(i);
|
||||
const Track::Reference& ref = streams.at(i);
|
||||
|
||||
if ((ref.type() == Stream::kVideo && !enable_video)
|
||||
|| (ref.type() == Stream::kAudio && !enable_audio)) {
|
||||
if ((ref.type() == Track::kVideo && !enable_video)
|
||||
|| (ref.type() == Track::kAudio && !enable_audio)) {
|
||||
streams.removeAt(i);
|
||||
i--;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
playback_speed_(0),
|
||||
frame_cache_job_time_(0),
|
||||
color_menu_enabled_(true),
|
||||
override_color_manager_(nullptr),
|
||||
time_changed_from_timer_(false),
|
||||
pause_autocache_during_playback_(false),
|
||||
prequeuing_(false)
|
||||
@@ -183,30 +182,22 @@ void ViewerWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
connect(n->video_frame_cache(), &FrameHashCache::Shifted, this, &ViewerWidget::ViewerShiftedRange);
|
||||
connect(n, &ViewerOutput::TextureInputChanged, this, &ViewerWidget::UpdateStack);
|
||||
|
||||
InterlacingChangedSlot(n->video_params().interlacing());
|
||||
VideoParams vp = n->GetVideoParams();
|
||||
|
||||
InterlacingChangedSlot(vp.interlacing());
|
||||
|
||||
ruler()->SetPlaybackCache(n->video_frame_cache());
|
||||
|
||||
SetViewerResolution(n->video_params().width(), n->video_params().height());
|
||||
SetViewerPixelAspect(n->video_params().pixel_aspect_ratio());
|
||||
SetViewerResolution(vp.width(), vp.height());
|
||||
SetViewerPixelAspect(vp.pixel_aspect_ratio());
|
||||
last_length_ = rational();
|
||||
LengthChangedSlot(n->GetLength());
|
||||
|
||||
ColorManager* using_manager;
|
||||
if (override_color_manager_) {
|
||||
using_manager = override_color_manager_;
|
||||
} else if (n->parent()) {
|
||||
using_manager = n->project()->color_manager();
|
||||
} else {
|
||||
qWarning() << "Failed to find a suitable color manager for the connected viewer node";
|
||||
using_manager = nullptr;
|
||||
}
|
||||
ColorManager* color_manager = n->project()->color_manager();
|
||||
|
||||
auto_cacher_.SetColorManager(using_manager);
|
||||
|
||||
display_widget_->ConnectColorManager(using_manager);
|
||||
display_widget_->ConnectColorManager(color_manager);
|
||||
foreach (ViewerWindow* window, windows_) {
|
||||
window->display_widget()->ConnectColorManager(using_manager);
|
||||
window->display_widget()->ConnectColorManager(color_manager);
|
||||
}
|
||||
|
||||
UpdateStack();
|
||||
@@ -244,7 +235,6 @@ void ViewerWidget::DisconnectNodeInternal(ViewerOutput *n)
|
||||
foreach (ViewerWindow* window, windows_) {
|
||||
window->display_widget()->DisconnectColorManager();
|
||||
}
|
||||
auto_cacher_.SetColorManager(nullptr);
|
||||
|
||||
waveform_view_->SetViewer(nullptr);
|
||||
waveform_view_->ConnectTimelinePoints(nullptr);
|
||||
@@ -286,13 +276,6 @@ bool ViewerWidget::IsPlaying() const
|
||||
return playback_speed_ != 0;
|
||||
}
|
||||
|
||||
void ViewerWidget::ConnectViewerNode(ViewerOutput *node, ColorManager* color_manager)
|
||||
{
|
||||
override_color_manager_ = color_manager;
|
||||
|
||||
super::ConnectViewerNode(node);
|
||||
}
|
||||
|
||||
void ViewerWidget::SetColorMenuEnabled(bool enabled)
|
||||
{
|
||||
color_menu_enabled_ = enabled;
|
||||
@@ -332,7 +315,7 @@ void ViewerWidget::SetFullScreen(QScreen *screen)
|
||||
connect(vw->display_widget(), &ViewerDisplayWidget::customContextMenuRequested, this, &ViewerWidget::ShowContextMenu);
|
||||
|
||||
if (GetConnectedNode()) {
|
||||
vw->SetVideoParams(GetConnectedNode()->video_params());
|
||||
vw->SetVideoParams(GetConnectedNode()->GetVideoParams());
|
||||
vw->display_widget()->SetDeinterlacing(vw->display_widget()->IsDeinterlacing());
|
||||
}
|
||||
|
||||
@@ -541,26 +524,28 @@ void ViewerWidget::PauseInternal()
|
||||
|
||||
void ViewerWidget::PushScrubbedAudio()
|
||||
{
|
||||
if (!IsPlaying() && Config::Current()["AudioScrubbing"].toBool()) {
|
||||
if (!IsPlaying() && GetConnectedNode() && Config::Current()["AudioScrubbing"].toBool()) {
|
||||
// Get audio src device from renderer
|
||||
AudioPlaybackCache::PlaybackDevice* audio_src = GetConnectedNode()->audio_playback_cache()->CreatePlaybackDevice();
|
||||
const AudioParams& params = GetConnectedNode()->audio_playback_cache()->GetParameters();
|
||||
|
||||
if (audio_src->open(QIODevice::ReadOnly)) {
|
||||
const AudioParams& params = GetConnectedNode()->audio_playback_cache()->GetParameters();
|
||||
if (params.is_valid()) {
|
||||
AudioPlaybackCache::PlaybackDevice* audio_src = GetConnectedNode()->audio_playback_cache()->CreatePlaybackDevice();
|
||||
|
||||
// FIXME: Hardcoded scrubbing interval (20ms)
|
||||
int size_of_sample = params.time_to_bytes(rational(20, 1000));
|
||||
if (audio_src->open(QIODevice::ReadOnly)) {
|
||||
// FIXME: Hardcoded scrubbing interval (20ms)
|
||||
int size_of_sample = params.time_to_bytes(rational(20, 1000));
|
||||
|
||||
// Push audio
|
||||
audio_src->seek(params.time_to_bytes(GetTime()));
|
||||
QByteArray frame_audio = audio_src->read(size_of_sample);
|
||||
AudioManager::instance()->SetOutputParams(params);
|
||||
AudioManager::instance()->PushToOutput(frame_audio);
|
||||
// Push audio
|
||||
audio_src->seek(params.time_to_bytes(GetTime()));
|
||||
QByteArray frame_audio = audio_src->read(size_of_sample);
|
||||
AudioManager::instance()->SetOutputParams(params);
|
||||
AudioManager::instance()->PushToOutput(frame_audio);
|
||||
|
||||
audio_src->close();
|
||||
audio_src->close();
|
||||
}
|
||||
|
||||
delete audio_src;
|
||||
}
|
||||
|
||||
delete audio_src;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,10 +641,12 @@ void ViewerWidget::FinishPlayPreprocess()
|
||||
int64_t playback_start_time = ruler()->GetTime();
|
||||
|
||||
AudioPlaybackCache* audio_cache = GetConnectedNode()->audio_playback_cache();
|
||||
AudioManager::instance()->SetOutputParams(audio_cache->GetParameters());
|
||||
AudioManager::instance()->StartOutput(audio_cache,
|
||||
audio_cache->GetParameters().time_to_bytes(GetTime()),
|
||||
playback_speed_);
|
||||
if (audio_cache->GetParameters().is_valid()) {
|
||||
AudioManager::instance()->SetOutputParams(audio_cache->GetParameters());
|
||||
AudioManager::instance()->StartOutput(audio_cache,
|
||||
audio_cache->GetParameters().time_to_bytes(GetTime()),
|
||||
playback_speed_);
|
||||
}
|
||||
|
||||
playback_timer_.Start(playback_start_time, playback_speed_, timebase_dbl());
|
||||
display_widget_->ResetFPSTimer();
|
||||
@@ -869,7 +856,7 @@ void ViewerWidget::ShowContextMenu(const QPoint &pos)
|
||||
|
||||
{
|
||||
// Deinterlace Option
|
||||
if (GetConnectedNode()->video_params().interlacing() != VideoParams::kInterlaceNone) {
|
||||
if (GetConnectedNode()->GetVideoParams().interlacing() != VideoParams::kInterlaceNone) {
|
||||
QAction* deinterlace_action = menu.addAction(tr("Deinterlace"));
|
||||
deinterlace_action->setCheckable(true);
|
||||
deinterlace_action->setChecked(display_widget_->IsDeinterlacing());
|
||||
@@ -1176,9 +1163,11 @@ void ViewerWidget::InterlacingChangedSlot(VideoParams::Interlacing interlacing)
|
||||
|
||||
void ViewerWidget::UpdateRendererVideoParameters()
|
||||
{
|
||||
display_widget_->SetVideoParams(GetConnectedNode()->video_params());
|
||||
VideoParams vp = GetConnectedNode()->GetVideoParams();
|
||||
|
||||
display_widget_->SetVideoParams(vp);
|
||||
foreach (ViewerWindow* window, windows_) {
|
||||
window->display_widget()->SetVideoParams(GetConnectedNode()->video_params());
|
||||
window->display_widget()->SetVideoParams(vp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,6 @@ public:
|
||||
|
||||
bool IsPlaying() const;
|
||||
|
||||
void ConnectViewerNode(ViewerOutput *node, ColorManager *color_manager = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable the color management menu
|
||||
*
|
||||
@@ -155,7 +153,7 @@ protected:
|
||||
|
||||
virtual void ConnectNodeInternal(ViewerOutput *) override;
|
||||
virtual void DisconnectNodeInternal(ViewerOutput *) override;
|
||||
virtual void ConnectedNodeChanged(ViewerOutput*n) override;
|
||||
virtual void ConnectedNodeChanged(ViewerOutput *) override;
|
||||
|
||||
virtual void ScaleChangedEvent(const double& s) override;
|
||||
|
||||
@@ -217,8 +215,6 @@ private:
|
||||
|
||||
bool color_menu_enabled_;
|
||||
|
||||
ColorManager* override_color_manager_;
|
||||
|
||||
bool time_changed_from_timer_;
|
||||
|
||||
bool play_in_to_out_only_;
|
||||
|
||||
@@ -37,8 +37,10 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
#define super ManagedDisplayWidget
|
||||
|
||||
ViewerDisplayWidget::ViewerDisplayWidget(QWidget *parent) :
|
||||
ManagedDisplayWidget(parent),
|
||||
super(parent),
|
||||
deinterlace_texture_(nullptr),
|
||||
signal_cursor_color_(false),
|
||||
gizmos_(nullptr),
|
||||
@@ -219,7 +221,7 @@ void ViewerDisplayWidget::mousePressEvent(QMouseEvent *event)
|
||||
emit DragStarted();
|
||||
}
|
||||
|
||||
ManagedDisplayWidget::mousePressEvent(event);
|
||||
super::mousePressEvent(event);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -246,7 +248,7 @@ void ViewerDisplayWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
} else {
|
||||
|
||||
// Default behavior
|
||||
ManagedDisplayWidget::mouseMoveEvent(event);
|
||||
super::mouseMoveEvent(event);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -269,11 +271,29 @@ void ViewerDisplayWidget::mouseReleaseEvent(QMouseEvent *event)
|
||||
} else {
|
||||
|
||||
// Default behavior
|
||||
ManagedDisplayWidget::mouseReleaseEvent(event);
|
||||
super::mouseReleaseEvent(event);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerDisplayWidget::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
emit DragEntered();
|
||||
super::dragEnterEvent(event);
|
||||
}
|
||||
|
||||
void ViewerDisplayWidget::dragLeaveEvent(QDragLeaveEvent *event)
|
||||
{
|
||||
emit DragLeft();
|
||||
super::dragLeaveEvent(event);
|
||||
}
|
||||
|
||||
void ViewerDisplayWidget::dropEvent(QDropEvent *event)
|
||||
{
|
||||
emit Dropped();
|
||||
super::dropEvent(event);
|
||||
}
|
||||
|
||||
void ViewerDisplayWidget::OnPaint()
|
||||
{
|
||||
// Clear background to empty
|
||||
@@ -402,7 +422,7 @@ void ViewerDisplayWidget::OnPaint()
|
||||
|
||||
void ViewerDisplayWidget::OnDestroy()
|
||||
{
|
||||
ManagedDisplayWidget::OnDestroy();
|
||||
super::OnDestroy();
|
||||
|
||||
texture_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -170,6 +170,12 @@ signals:
|
||||
*/
|
||||
void CursorColor(const Color& reference, const Color& display);
|
||||
|
||||
void DragEntered();
|
||||
|
||||
void DragLeft();
|
||||
|
||||
void Dropped();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Override the mouse press event for the DragStarted() signal and gizmos
|
||||
@@ -186,6 +192,12 @@ protected:
|
||||
*/
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
||||
virtual void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
|
||||
virtual void dragLeaveEvent(QDragLeaveEvent* event) override;
|
||||
|
||||
virtual void dropEvent(QDropEvent* event) override;
|
||||
|
||||
protected slots:
|
||||
/**
|
||||
* @brief Paint function to display the texture (received in SetTexture()) on screen.
|
||||
|
||||
Reference in New Issue
Block a user