project window shows accurate timecodes now
This commit is contained in:
@@ -21,6 +21,7 @@ TextEffect::TextEffect(Clip *c) : Effect(c), texture(NULL) {
|
||||
|
||||
ui_layout->addWidget(new QLabel("Text:"), 0, 0);
|
||||
text_val = new QTextEdit();
|
||||
text_val->setUndoRedoEnabled(true);
|
||||
ui_layout->addWidget(text_val, 0, 1);
|
||||
|
||||
ui_layout->addWidget(new QLabel("Size:"), 1, 0);
|
||||
|
||||
+16
-4
@@ -1,6 +1,7 @@
|
||||
#include "previewgenerator.h"
|
||||
|
||||
#include "media.h"
|
||||
#include "panels/viewer.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
@@ -22,6 +23,8 @@ PreviewGenerator::PreviewGenerator(QTreeWidgetItem* i, Media* m) : QThread(0), f
|
||||
}
|
||||
|
||||
void PreviewGenerator::parse_media() {
|
||||
bool contains_still_image = false;
|
||||
|
||||
// detect video/audio streams in file
|
||||
for (int i=0;i<(int)fmt_ctx->nb_streams;i++) {
|
||||
// Find the decoder for the video stream
|
||||
@@ -37,11 +40,16 @@ void PreviewGenerator::parse_media() {
|
||||
append = true;
|
||||
}
|
||||
if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
bool infinite_length = (fmt_ctx->streams[i]->avg_frame_rate.den == 0);
|
||||
if (fmt_ctx->streams[i]->avg_frame_rate.den == 0) { // source is LIKELY a still image
|
||||
ms->infinite_length = true;
|
||||
contains_still_image = true;
|
||||
ms->video_frame_rate = 0;
|
||||
} else {
|
||||
ms->infinite_length = false;
|
||||
ms->video_frame_rate = av_q2d(fmt_ctx->streams[i]->avg_frame_rate);
|
||||
}
|
||||
ms->video_width = fmt_ctx->streams[i]->codecpar->width;
|
||||
ms->video_height = fmt_ctx->streams[i]->codecpar->height;
|
||||
ms->video_frame_rate = (infinite_length) ? 0 : av_q2d(fmt_ctx->streams[i]->avg_frame_rate);
|
||||
ms->infinite_length = infinite_length;
|
||||
if (append) media->video_tracks.append(ms);
|
||||
} else if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
ms->audio_channels = fmt_ctx->streams[i]->codecpar->channels;
|
||||
@@ -63,7 +71,11 @@ void PreviewGenerator::parse_media() {
|
||||
emit set_icon(ICON_TYPE_VIDEO);
|
||||
}
|
||||
|
||||
item->setText(1, QString::number(media->length));
|
||||
if (!contains_still_image || media->audio_tracks.size() > 0) {
|
||||
double frame_rate = 30;
|
||||
if (!contains_still_image && media->video_tracks.size() > 0) frame_rate = media->video_tracks.at(0)->video_frame_rate;
|
||||
item->setText(1, frame_to_timecode(media->get_length_in_frames(frame_rate), TIMECODE_DROP, frame_rate));
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewGenerator::generate_waveform() {
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ Viewer::~Viewer()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString Viewer::frame_to_timecode(long f, int view, double frame_rate) {
|
||||
QString frame_to_timecode(long f, int view, double frame_rate) {
|
||||
if (view == TIMECODE_FRAMES) {
|
||||
return QString::number(f);
|
||||
}
|
||||
|
||||
+1
-3
@@ -16,6 +16,7 @@ class Viewer;
|
||||
}
|
||||
|
||||
bool frame_rate_is_droppable(float rate);
|
||||
QString frame_to_timecode(long f, int view, double frame_rate);
|
||||
|
||||
class Viewer : public QDockWidget
|
||||
{
|
||||
@@ -44,9 +45,6 @@ private slots:
|
||||
void on_pushButton_4_clicked();
|
||||
|
||||
void on_pushButton_3_clicked();
|
||||
|
||||
private:
|
||||
QString frame_to_timecode(long f, int view, double frame_rate);
|
||||
};
|
||||
|
||||
#endif // VIEWER_H
|
||||
|
||||
Reference in New Issue
Block a user