improved replace media and made it undoable
This commit is contained in:
@@ -6,6 +6,8 @@ extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
#include "project/clip.h"
|
||||
|
||||
Media::Media() : ready(false) {}
|
||||
|
||||
Media::~Media() {
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@
|
||||
#include <QPixmap>
|
||||
|
||||
struct Sequence;
|
||||
struct Clip;
|
||||
|
||||
struct MediaStream {
|
||||
int file_index;
|
||||
@@ -39,7 +40,7 @@ struct Media {
|
||||
bool ready;
|
||||
|
||||
long get_length_in_frames(double frame_rate);
|
||||
MediaStream* get_stream_from_file_index(int index);
|
||||
MediaStream* get_stream_from_file_index(int index);
|
||||
void reset();
|
||||
};
|
||||
|
||||
|
||||
+12
-4
@@ -18,7 +18,15 @@ extern "C" {
|
||||
#include <libswresample/swresample.h>
|
||||
}
|
||||
|
||||
PreviewGenerator::PreviewGenerator(QTreeWidgetItem* i, Media* m) : QThread(0), fmt_ctx(NULL), item(i), media(m), retrieve_duration(false), contains_still_image(false) {
|
||||
PreviewGenerator::PreviewGenerator(QTreeWidgetItem* i, Media* m, bool r) :
|
||||
QThread(0),
|
||||
fmt_ctx(NULL),
|
||||
item(i),
|
||||
media(m),
|
||||
retrieve_duration(false),
|
||||
contains_still_image(false),
|
||||
replace(r)
|
||||
{
|
||||
connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
|
||||
}
|
||||
|
||||
@@ -72,9 +80,9 @@ void PreviewGenerator::finalize_media() {
|
||||
media->ready = true;
|
||||
|
||||
if (media->video_tracks.size() == 0) {
|
||||
emit set_icon(ICON_TYPE_AUDIO);
|
||||
emit set_icon(ICON_TYPE_AUDIO, replace);
|
||||
} else {
|
||||
emit set_icon(ICON_TYPE_VIDEO);
|
||||
emit set_icon(ICON_TYPE_VIDEO, replace);
|
||||
}
|
||||
|
||||
if (!contains_still_image || media->audio_tracks.size() > 0) {
|
||||
@@ -290,7 +298,7 @@ void PreviewGenerator::run() {
|
||||
avformat_close_input(&fmt_ctx);
|
||||
}
|
||||
if (error) {
|
||||
emit set_icon(ICON_TYPE_ERROR);
|
||||
emit set_icon(ICON_TYPE_ERROR, replace);
|
||||
} else {
|
||||
item->setToolTip(0, QString());
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ class PreviewGenerator : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreviewGenerator(QTreeWidgetItem*, Media*);
|
||||
PreviewGenerator(QTreeWidgetItem*, Media*, bool);
|
||||
void run();
|
||||
signals:
|
||||
void set_icon(int);
|
||||
void set_icon(int, bool);
|
||||
private:
|
||||
void parse_media();
|
||||
void generate_waveform();
|
||||
@@ -29,6 +29,7 @@ private:
|
||||
AVFormatContext* fmt_ctx;
|
||||
bool retrieve_duration;
|
||||
bool contains_still_image;
|
||||
bool replace;
|
||||
};
|
||||
|
||||
#endif // PREVIEWGENERATOR_H
|
||||
|
||||
Reference in New Issue
Block a user