diff --git a/app/common/timecodefunctions.cpp b/app/common/timecodefunctions.cpp index cf304a3cc..94b4ee3b0 100644 --- a/app/common/timecodefunctions.cpp +++ b/app/common/timecodefunctions.cpp @@ -30,7 +30,7 @@ QString olive::timestamp_to_timecode(const int64_t ×tamp, const rational& timebase, const TimecodeDisplay& display) { - double timestamp_dbl = (rational(timestamp) * timebase).ToDouble(); + double timestamp_dbl = (rational(timestamp) * timebase).toDouble(); switch (display) { case kTimecodeFrames: @@ -52,7 +52,7 @@ QString olive::timestamp_to_timecode(const int64_t ×tamp, } else { rational frame_rate = timebase.flipped(); - int frames = qRound((timestamp_dbl - total_seconds) * frame_rate.ToDouble()); + int frames = qRound((timestamp_dbl - total_seconds) * frame_rate.toDouble()); return QString("%1:%2:%3;%4").arg(padded(hours, 2), padded(mins, 2), diff --git a/app/core.cpp b/app/core.cpp index 5e41a8d3a..637bc4f25 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -278,11 +278,11 @@ void Core::CreateNewSequence() new_sequence->AddNode(ii); ClipBlock* cb1 = new ClipBlock(); - cb1->set_length(1); + cb1->set_length(2); new_sequence->AddNode(cb1); ClipBlock* cb2 = new ClipBlock(); - cb2->set_length(1); + cb2->set_length(4); new_sequence->AddNode(cb2); TimelineOutput* tb = new TimelineOutput(); diff --git a/app/decoder/ffmpeg/ffmpegdecoder.cpp b/app/decoder/ffmpeg/ffmpegdecoder.cpp index 6fe0ee740..1d2ae3c15 100644 --- a/app/decoder/ffmpeg/ffmpegdecoder.cpp +++ b/app/decoder/ffmpeg/ffmpegdecoder.cpp @@ -167,8 +167,8 @@ FramePtr FFmpegDecoder::Retrieve(const rational &timecode, const rational &lengt return nullptr; } -// avcodec_flush_buffers(codec_ctx_); -// av_seek_frame(fmt_ctx_, avstream_->index, 0, AVSEEK_FLAG_BACKWARD); + //avcodec_flush_buffers(codec_ctx_); + //av_seek_frame(fmt_ctx_, avstream_->index, 0, AVSEEK_FLAG_BACKWARD); // Allocate and init a packet for reading encoded data AVPacket pkt; @@ -219,6 +219,8 @@ FramePtr FFmpegDecoder::Retrieve(const rational &timecode, const rational &lengt } } +// qDebug() << dec_frame->pts << ","; + // Handle any errors received during the frame retrieve process if (ret < 0) { qWarning() << tr("Failed to retrieve frame from FFmpeg decoder: %1").arg(ret); diff --git a/app/dialog/sequence/sequence.cpp b/app/dialog/sequence/sequence.cpp index eb0c88785..7ab988796 100644 --- a/app/dialog/sequence/sequence.cpp +++ b/app/dialog/sequence/sequence.cpp @@ -205,14 +205,14 @@ void SequenceDialog::AddFrameRate(const rational &r) { frame_rate_list_.append(r); - video_frame_rate_field_->addItem(tr("%1 FPS").arg(r.ToDouble())); + video_frame_rate_field_->addItem(tr("%1 FPS").arg(r.toDouble())); } void SequenceDialog::AddSampleRate(const rational &rate) { sample_rate_list_.append(rate); - audio_sample_rate_field_->addItem(tr("%1 Hz").arg(rate.ToDouble())); + audio_sample_rate_field_->addItem(tr("%1 Hz").arg(rate.toDouble())); } void SequenceDialog::AddChannelLayout(int layout) diff --git a/app/node/block/clip/clip.cpp b/app/node/block/clip/clip.cpp index bf749096d..84ee8052b 100644 --- a/app/node/block/clip/clip.cpp +++ b/app/node/block/clip/clip.cpp @@ -20,6 +20,8 @@ #include "clip.h" +#include + ClipBlock::ClipBlock() { texture_input_ = new NodeInput(); @@ -59,11 +61,18 @@ NodeInput *ClipBlock::texture_input() void ClipBlock::Process(const rational &time) { + qDebug() << "Clip received time" << time.numerator() << "/" << time.denominator(); + // Run default node processing Block::Process(time); // We convert the time given (timeline time) to media time - rational media_time = time - in() + media_in_; +// rational media_time = time - in() + media_in_; + rational media_time = time - in(); + + qDebug() << "In time" << in().numerator() << "/" << in().denominator(); + qDebug() << "Media In time" << media_in_.numerator() << "/" << media_in_.denominator(); + qDebug() << "Media sent time" << media_time.numerator() << "/" << media_time.denominator(); // Retrieve texture texture_output()->set_value(texture_input_->get_value(media_time)); diff --git a/app/widget/timelineview/timelineviewrect.cpp b/app/widget/timelineview/timelineviewrect.cpp index 4c4ebf76a..0e76506ed 100644 --- a/app/widget/timelineview/timelineviewrect.cpp +++ b/app/widget/timelineview/timelineviewrect.cpp @@ -10,7 +10,7 @@ TimelineViewRect::TimelineViewRect(QGraphicsItem* parent) : void TimelineViewRect::SetTimebase(const rational &timebase) { timebase_ = timebase; - timebase_dbl_ = timebase_.ToDouble(); + timebase_dbl_ = timebase_.toDouble(); UpdateRect(); } @@ -28,5 +28,5 @@ bool TimelineViewRect::TimebaseIsValid() double TimelineViewRect::TimeToScreenCoord(const rational &time) { - return time.ToDouble() / timebase_dbl_ * scale_; + return time.toDouble() / timebase_dbl_ * scale_; } diff --git a/app/widget/timeruler/timeruler.cpp b/app/widget/timeruler/timeruler.cpp index 6cfe05963..e1b37956c 100644 --- a/app/widget/timeruler/timeruler.cpp +++ b/app/widget/timeruler/timeruler.cpp @@ -113,7 +113,7 @@ void TimeRuler::paintEvent(QPaintEvent *e) // Depending on the scale, we don't need all the lines drawn or else they'll start to become unhelpful // Determine an even number to divide the frame count by - int rough_frames_in_second = qRound(time_base_.flipped().ToDouble()); + int rough_frames_in_second = qRound(time_base_.flipped().toDouble()); int test_divider = 1; while (!((rough_frames_in_second%test_divider == 0 || test_divider > rough_frames_in_second) && scale_ * test_divider >= minimum_gap_between_lines_)) { @@ -124,7 +124,7 @@ void TimeRuler::paintEvent(QPaintEvent *e) } } double reverse_divider = double(rough_frames_in_second) / double(test_divider); - qreal real_divider = qMax(1.0, time_base_.flipped().ToDouble() / reverse_divider); + qreal real_divider = qMax(1.0, time_base_.flipped().toDouble() / reverse_divider); // Set where the loop ends (affected by text) int loop_start = - playhead_width_; @@ -136,7 +136,7 @@ void TimeRuler::paintEvent(QPaintEvent *e) int text_y = 0; if (text_visible_) { QFontMetrics fm = p.fontMetrics(); - double width_of_second = time_base_.flipped().ToDouble() * scale_; + double width_of_second = time_base_.flipped().toDouble() * scale_; int average_text_width = QFontMetricsWidth(&fm, olive::timestamp_to_timecode(0, time_base_, kTimecodeDisplay)); half_average_text_width = average_text_width/2; while (width_of_second * text_skip < average_text_width) { @@ -180,7 +180,7 @@ void TimeRuler::paintEvent(QPaintEvent *e) if (qFloor(double(unit)/real_divider) > qFloor(double(last_unit)/real_divider)) { // Determine if this unit is a whole second or not - int sec = qFloor(double(unit) * time_base_.ToDouble()); + int sec = qFloor(double(unit) * time_base_.toDouble()); if (sec > last_sec) { // This line marks a second so we make it long