added more icons and fixed playback bug

This commit is contained in:
itsmattkc
2018-08-03 07:41:15 +10:00
parent 4700d02e6f
commit e08b565a2b
16 changed files with 181 additions and 186 deletions
+6
View File
@@ -30,5 +30,11 @@
<file>slide.png</file> <file>slide.png</file>
<file>slide-disabled.png</file> <file>slide-disabled.png</file>
<file>throbber.png</file> <file>throbber.png</file>
<file>magnet.png</file>
<file>magnet-disabled.png</file>
<file>zoomin.png</file>
<file>zoomin-disabled.png</file>
<file>zoomout.png</file>
<file>zoomout-disabled.png</file>
</qresource> </qresource>
</RCC> </RCC>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

+2 -1
View File
@@ -53,7 +53,8 @@ Timeline::Timeline(QWidget *parent) :
ui->video_area->bottom_align = true; ui->video_area->bottom_align = true;
ui->splitter->setOpaqueResize(false); ui->video_area->container = ui->videoScrollArea;
ui->audio_area->container = ui->audioScrollArea;
tool_buttons.append(ui->toolArrowButton); tool_buttons.append(ui->toolArrowButton);
tool_buttons.append(ui->toolEditButton); tool_buttons.append(ui->toolEditButton);
+117 -133
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>523</width> <width>901</width>
<height>376</height> <height>592</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -62,18 +62,6 @@
</property> </property>
<item> <item>
<widget class="QPushButton" name="toolArrowButton"> <widget class="QPushButton" name="toolArrowButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Pointer Tool (V)</string> <string>Pointer Tool (V)</string>
</property> </property>
@@ -85,12 +73,6 @@
<normaloff>:/icons/arrow.png</normaloff> <normaloff>:/icons/arrow.png</normaloff>
<disabledoff>:/icons/arrow-disabled.png</disabledoff>:/icons/arrow.png</iconset> <disabledoff>:/icons/arrow-disabled.png</disabledoff>:/icons/arrow.png</iconset>
</property> </property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -98,12 +80,6 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="toolEditButton"> <widget class="QPushButton" name="toolEditButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Edit Tool (X)</string> <string>Edit Tool (X)</string>
</property> </property>
@@ -115,12 +91,6 @@
<normaloff>:/icons/beam.png</normaloff> <normaloff>:/icons/beam.png</normaloff>
<disabledoff>:/icons/beam-disabled.png</disabledoff>:/icons/beam.png</iconset> <disabledoff>:/icons/beam-disabled.png</disabledoff>:/icons/beam.png</iconset>
</property> </property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -128,12 +98,6 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="toolRippleButton"> <widget class="QPushButton" name="toolRippleButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Ripple Tool (B)</string> <string>Ripple Tool (B)</string>
</property> </property>
@@ -145,12 +109,6 @@
<normaloff>:/icons/ripple.png</normaloff> <normaloff>:/icons/ripple.png</normaloff>
<disabledoff>:/icons/ripple-disabled.png</disabledoff>:/icons/ripple.png</iconset> <disabledoff>:/icons/ripple-disabled.png</disabledoff>:/icons/ripple.png</iconset>
</property> </property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -158,12 +116,6 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="toolRollingButton"> <widget class="QPushButton" name="toolRollingButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Rolling Tool (N)</string> <string>Rolling Tool (N)</string>
</property> </property>
@@ -175,12 +127,6 @@
<normaloff>:/icons/rolling.png</normaloff> <normaloff>:/icons/rolling.png</normaloff>
<disabledoff>:/icons/rolling-disabled.png</disabledoff>:/icons/rolling.png</iconset> <disabledoff>:/icons/rolling-disabled.png</disabledoff>:/icons/rolling.png</iconset>
</property> </property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -188,12 +134,6 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="toolRazorButton"> <widget class="QPushButton" name="toolRazorButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Razor Tool (C)</string> <string>Razor Tool (C)</string>
</property> </property>
@@ -205,12 +145,6 @@
<normaloff>:/icons/razor.png</normaloff> <normaloff>:/icons/razor.png</normaloff>
<disabledoff>:/icons/razor-disabled.png</disabledoff>:/icons/razor.png</iconset> <disabledoff>:/icons/razor-disabled.png</disabledoff>:/icons/razor.png</iconset>
</property> </property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -218,12 +152,6 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="toolSlipButton"> <widget class="QPushButton" name="toolSlipButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Slip Tool (Y)</string> <string>Slip Tool (Y)</string>
</property> </property>
@@ -236,12 +164,6 @@
<disabledon>:/icons/slip-disabled.png</disabledon> <disabledon>:/icons/slip-disabled.png</disabledon>
</iconset> </iconset>
</property> </property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -249,12 +171,6 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="toolSlideButton"> <widget class="QPushButton" name="toolSlideButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Slide Tool (U)</string> <string>Slide Tool (U)</string>
</property> </property>
@@ -267,12 +183,6 @@
<disabledon>:/icons/slide-disabled.png</disabledon> <disabledon>:/icons/slide-disabled.png</disabledon>
</iconset> </iconset>
</property> </property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -280,14 +190,14 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="snappingButton"> <widget class="QPushButton" name="snappingButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text"> <property name="text">
<string>S</string> <string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/magnet.png</normalon>
<disabledon>:/icons/magnet-disabled.png</disabledon>
</iconset>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
@@ -299,33 +209,33 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton_4"> <widget class="QPushButton" name="pushButton_4">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Zoom In (=)</string> <string>Zoom In (=)</string>
</property> </property>
<property name="text"> <property name="text">
<string>+</string> <string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/zoomin.png</normalon>
<disabledon>:/icons/zoomin-disabled.png</disabledon>
</iconset>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton_5"> <widget class="QPushButton" name="pushButton_5">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Zoom Out (-)</string> <string>Zoom Out (-)</string>
</property> </property>
<property name="text"> <property name="text">
<string>-</string> <string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/zoomout.png</normalon>
<disabledon>:/icons/zoomout-disabled.png</disabledon>
</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -348,7 +258,7 @@
<item> <item>
<widget class="ScrollArea" name="timeline_area"> <widget class="ScrollArea" name="timeline_area">
<property name="verticalScrollBarPolicy"> <property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum> <enum>Qt::ScrollBarAlwaysOff</enum>
</property> </property>
<property name="horizontalScrollBarPolicy"> <property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum> <enum>Qt::ScrollBarAlwaysOn</enum>
@@ -361,11 +271,11 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>408</width> <width>819</width>
<height>327</height> <height>551</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
@@ -399,27 +309,101 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<widget class="TimelineWidget" name="video_area" native="true"> <widget class="QScrollArea" name="videoScrollArea">
<property name="sizePolicy"> <property name="frameShape">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <enum>QFrame::NoFrame</enum>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="focusPolicy"> <property name="verticalScrollBarPolicy">
<enum>Qt::ClickFocus</enum> <enum>Qt::ScrollBarAlwaysOn</enum>
</property> </property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>802</width>
<height>266</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="TimelineWidget" name="video_area" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
<widget class="TimelineWidget" name="audio_area" native="true"> <widget class="QScrollArea" name="audioScrollArea">
<property name="sizePolicy"> <property name="frameShape">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <enum>QFrame::NoFrame</enum>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="focusPolicy"> <property name="verticalScrollBarPolicy">
<enum>Qt::ClickFocus</enum> <enum>Qt::ScrollBarAlwaysOn</enum>
</property> </property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>802</width>
<height>265</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="TimelineWidget" name="audio_area" native="true">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
</widget> </widget>
</item> </item>
+6 -5
View File
@@ -176,21 +176,22 @@ void reset_cache(Clip* c, long target_frame) {
if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
// seeks to nearest keyframe (target_frame represents internal clip frame) // seeks to nearest keyframe (target_frame represents internal clip frame)
av_seek_frame(c->formatCtx, ms->file_index, clip_frame_to_seconds(c, target_frame) / timebase, AVSEEK_FLAG_BACKWARD);
av_seek_frame(c->formatCtx, ms->file_index, (int64_t) qFloor(clip_frame_to_seconds(c, target_frame) / timebase), AVSEEK_FLAG_BACKWARD);
qDebug() << target_frame;
// play up to the frame we actually want // play up to the frame we actually want
long retrieved_frame = 0; long retrieved_frame = 0;
AVFrame* temp = av_frame_alloc(); AVFrame* temp = av_frame_alloc();
do { do {
retrieve_next_frame(c, temp); retrieve_next_frame(c, temp);
if (retrieved_frame == 0) { if (retrieved_frame == 0) {
if (target_frame != 0) { if (target_frame != 0) retrieved_frame = floor(temp->pts * timebase * av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, temp)));
retrieved_frame = floor(temp->pts * timebase * av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, temp)));
}
} else { } else {
retrieved_frame++; retrieved_frame++;
} }
} while (retrieved_frame < target_frame); } while (retrieved_frame < target_frame);
av_frame_free(&temp); av_frame_free(&temp);
} else if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { } else if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
// seek (target_frame represents timeline timecode in frames, not clip timecode) // seek (target_frame represents timeline timecode in frames, not clip timecode)
+7 -14
View File
@@ -75,7 +75,7 @@ void cache_clip(Clip* clip, long playhead, bool write_A, bool write_B, bool rese
void get_clip_frame(Clip* c, long playhead) { void get_clip_frame(Clip* c, long playhead) {
if (c->open) { if (c->open) {
long clip_time = seconds_to_clip_frame(c, playhead_to_seconds(c, playhead)); long clip_time = refactor_frame_number(playhead - c->timeline_in + c->clip_in, c->sequence->frame_rate, av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame)));
// do we need to update the texture? // do we need to update the texture?
MediaStream* ms = static_cast<Media*>(c->media)->get_stream_from_file_index(c->media_stream); MediaStream* ms = static_cast<Media*>(c->media)->get_stream_from_file_index(c->media_stream);
@@ -139,15 +139,8 @@ void get_clip_frame(Clip* c, long playhead) {
bool write_A = (!using_cache_A && !c->cache_A.unread); bool write_A = (!using_cache_A && !c->cache_A.unread);
bool write_B = (!using_cache_B && !c->cache_B.unread); bool write_B = (!using_cache_B && !c->cache_B.unread);
if (write_A || write_B) { if (write_A || write_B) {
long playhead; // if we have no cache and need to seek, start us at the current playhead, otherwise start at the end of the current cache
if (cache_needs_reset) { cache_clip(c, (cache_needs_reset) ? clip_time : cache_offset + c->cache_size, write_A, write_B, cache_needs_reset, NULL);
// if we have no cache and need to seek, start us at the current playhead...
playhead = clip_time;
} else {
// ...otherwise start at the end of the current cache
playhead = cache_offset + c->cache_size;
}
cache_clip(c, playhead, write_A, write_B, cache_needs_reset, NULL);
} }
c->lock.unlock(); c->lock.unlock();
} }
@@ -175,12 +168,12 @@ void get_clip_frame(Clip* c, long playhead) {
} }
} }
float playhead_to_seconds(Clip* c, long playhead) { double playhead_to_seconds(Clip* c, long playhead) {
// returns time in seconds // returns time in seconds
return (qMax((long) 0, playhead - c->timeline_in) + c->clip_in)/c->sequence->frame_rate; return (qMax((long) 0, playhead - c->timeline_in) + c->clip_in)/c->sequence->frame_rate;
} }
long seconds_to_clip_frame(Clip* c, float seconds) { long seconds_to_clip_frame(Clip* c, double seconds) {
// returns time as frame number (according to clip's frame rate) // returns time as frame number (according to clip's frame rate)
if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
return floor(seconds*av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame))); return floor(seconds*av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame)));
@@ -190,9 +183,9 @@ long seconds_to_clip_frame(Clip* c, float seconds) {
} }
} }
float clip_frame_to_seconds(Clip* c, long clip_frame) { double clip_frame_to_seconds(Clip* c, long clip_frame) {
// returns frame number in decimal seconds // returns frame number in decimal seconds
return (float) clip_frame / c->sequence->frame_rate; return (double) clip_frame / av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame));
} }
int retrieve_next_frame(Clip* c, AVFrame* f) { int retrieve_next_frame(Clip* c, AVFrame* f) {
+3 -3
View File
@@ -19,9 +19,9 @@ void cache_video_worker(Clip* c, long playhead, ClipCache* cache);
void handle_media(Sequence* sequence, long playhead, bool multithreaded); void handle_media(Sequence* sequence, long playhead, bool multithreaded);
void reset_cache(Clip* c, long target_frame); void reset_cache(Clip* c, long target_frame);
void get_clip_frame(Clip* c, long playhead); void get_clip_frame(Clip* c, long playhead);
float playhead_to_seconds(Clip* c, long playhead); double playhead_to_seconds(Clip* c, long playhead);
long seconds_to_clip_frame(Clip* c, float seconds); long seconds_to_clip_frame(Clip* c, double seconds);
float clip_frame_to_seconds(Clip* c, long clip_frame); double clip_frame_to_seconds(Clip* c, long clip_frame);
int retrieve_next_frame(Clip* c, AVFrame* f); int retrieve_next_frame(Clip* c, AVFrame* f);
void retrieve_next_frame_raw_data(Clip* c, AVFrame* output); void retrieve_next_frame_raw_data(Clip* c, AVFrame* output);
bool is_clip_active(Clip* c, long playhead); bool is_clip_active(Clip* c, long playhead);
+1 -1
View File
@@ -91,7 +91,7 @@ void Clip::reset_audio() {
audio_reset = true; audio_reset = true;
frame_sample_index = 0; frame_sample_index = 0;
audio_buffer_write = 0; audio_buffer_write = 0;
reached_end = false; reached_end = false;
break; break;
case MEDIA_TYPE_SEQUENCE: case MEDIA_TYPE_SEQUENCE:
{ {
+33 -22
View File
@@ -1349,27 +1349,44 @@ int color_brightness(int r, int g, int b) {
void TimelineWidget::redraw_clips() { void TimelineWidget::redraw_clips() {
// Draw clips // Draw clips
if (sequence != NULL) { if (sequence != NULL) {
int panel_width = panel_timeline->getScreenPointFromFrame(sequence->getEndFrame()) + 100; // get widget width and height
int video_track_limit = 0;
int audio_track_limit = 0;
long end_frame = 0;
for (int i=0;i<sequence->clip_count();i++) {
Clip* clip = sequence->get_clip(i);
if (clip != NULL) {
end_frame = qMax(end_frame, clip->timeline_out);
video_track_limit = qMin(video_track_limit, clip->track);
audio_track_limit = qMax(audio_track_limit, clip->track);
}
}
int panel_width = panel_timeline->getScreenPointFromFrame(end_frame) + 100;
int panel_height = 0;
if (bottom_align) {
for (int i=-1;i>=video_track_limit;i--) {
panel_height += panel_timeline->calculate_track_height(i, -1);
}
} else {
for (int i=0;i<=audio_track_limit;i++) {
panel_height += panel_timeline->calculate_track_height(i, -1);
}
}
if (minimumWidth() != panel_width || clip_pixmap.height() != height()) { if (minimumWidth() != panel_width || /*clip_pixmap.height() != height() || */panel_height != minimumHeight()) {
setMinimumWidth(panel_width); setMinimumWidth(panel_width);
clip_pixmap = QPixmap(qMax(width(), panel_width), height()); container->setMinimumWidth(panel_width);
setMinimumHeight(panel_height);
clip_pixmap = QPixmap(qMax(width(), panel_width), qMax(height(), panel_height));
} }
clip_pixmap.fill(Qt::transparent); clip_pixmap.fill(Qt::transparent);
QPainter clip_painter(&clip_pixmap); QPainter clip_painter(&clip_pixmap);
int video_track_limit = 0;
int audio_track_limit = 0;
QColor transition_color(255, 0, 0, 16); QColor transition_color(255, 0, 0, 16);
for (int i=0;i<sequence->clip_count();i++) { for (int i=0;i<sequence->clip_count();i++) {
Clip* clip = sequence->get_clip(i); Clip* clip = sequence->get_clip(i);
if (clip != NULL && is_track_visible(clip->track)) { if (clip != NULL && is_track_visible(clip->track)) {
if (clip->track < 0 && clip->track < video_track_limit) { // video clip
video_track_limit = clip->track;
} else if (clip->track > audio_track_limit) {
audio_track_limit = clip->track;
}
QRect clip_rect(panel_timeline->getScreenPointFromFrame(clip->timeline_in), getScreenPointFromTrack(clip->track), clip->getLength() * panel_timeline->zoom, panel_timeline->calculate_track_height(clip->track, -1)); QRect clip_rect(panel_timeline->getScreenPointFromFrame(clip->timeline_in), getScreenPointFromTrack(clip->track), clip->getLength() * panel_timeline->zoom, panel_timeline->calculate_track_height(clip->track, -1));
clip_painter.fillRect(clip_rect, QColor(clip->color_r, clip->color_g, clip->color_b)); clip_painter.fillRect(clip_rect, QColor(clip->color_r, clip->color_g, clip->color_b));
@@ -1378,13 +1395,8 @@ void TimelineWidget::redraw_clips() {
QRect text_rect(clip_rect.left() + CLIP_TEXT_PADDING, clip_rect.top() + CLIP_TEXT_PADDING, clip_rect.width() - CLIP_TEXT_PADDING - 1, clip_rect.height() - CLIP_TEXT_PADDING - 1); QRect text_rect(clip_rect.left() + CLIP_TEXT_PADDING, clip_rect.top() + CLIP_TEXT_PADDING, clip_rect.width() - CLIP_TEXT_PADDING - 1, clip_rect.height() - CLIP_TEXT_PADDING - 1);
// draw clip transitions // draw clip transitions
for (char i=0;i<2;i++) { for (int i=0;i<2;i++) {
Transition* t; Transition* t = (i == 0) ? clip->opening_transition : clip->closing_transition;
if (i == 0) {
t = clip->opening_transition;
} else {
t = clip->closing_transition;
}
if (t != NULL) { if (t != NULL) {
int transition_width = panel_timeline->getScreenPointFromFrame(t->length); int transition_width = panel_timeline->getScreenPointFromFrame(t->length);
int transition_height = clip_rect.height() * 0.6; int transition_height = clip_rect.height() * 0.6;
@@ -1522,9 +1534,8 @@ void TimelineWidget::redraw_clips() {
} }
} else { } else {
// only draw lines for audio tracks // only draw lines for audio tracks
for (int i=0;i<audio_track_limit;i++) { for (int i=0;i<audio_track_limit;i++) {
// TODO just make i+1? int line_y = getScreenPointFromTrack(i) + panel_timeline->calculate_track_height(i, -1);
int line_y = getScreenPointFromTrack(i) + panel_timeline->calculate_track_height(i, -1);
clip_painter.drawLine(0, line_y, rect().width(), line_y); clip_painter.drawLine(0, line_y, rect().width(), line_y);
} }
} }
+4 -3
View File
@@ -19,11 +19,13 @@ class TimelineAction;
class TimelineWidget : public QWidget { class TimelineWidget : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit TimelineWidget(QWidget *parent = 0); explicit TimelineWidget(QWidget *parent = 0);
bool bottom_align; bool bottom_align;
void redraw_clips(); void redraw_clips();
QWidget* container;
protected: protected:
void paintEvent(QPaintEvent*); void paintEvent(QPaintEvent*);
void resizeEvent(QResizeEvent*); void resizeEvent(QResizeEvent*);
@@ -60,8 +62,7 @@ private:
int predicted_video_height; int predicted_video_height;
double predicted_new_frame_rate; double predicted_new_frame_rate;
int predicted_audio_freq; int predicted_audio_freq;
int predicted_audio_layout; int predicted_audio_layout;
signals: signals:
public slots: public slots:
+2 -4
View File
@@ -89,12 +89,10 @@ void ViewerWidget::paintEvent(QPaintEvent *e) {
void ViewerWidget::compose_sequence(Clip* nest, bool render_audio) { void ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
Sequence* s = sequence; Sequence* s = sequence;
long playhead = panel_timeline->playhead; long playhead = panel_timeline->playhead;
if (nest != NULL) { if (nest != NULL) {
s = static_cast<Sequence*>(nest->media); s = static_cast<Sequence*>(nest->media);
// qDebug() << "nested sequence was null:" << (s == NULL);
playhead += nest->clip_in - nest->timeline_in; playhead += nest->clip_in - nest->timeline_in;
playhead = refactor_frame_number(playhead, sequence->frame_rate, s->frame_rate); playhead = refactor_frame_number(playhead, sequence->frame_rate, s->frame_rate);
} }