Olive
previewgenerator.h
Go to the documentation of this file.
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef PREVIEWGENERATOR_H
22 #define PREVIEWGENERATOR_H
23 
24 #include <QThread>
25 #include <QSemaphore>
26 #include <QDir>
27 
28 #include "project/footage.h"
29 #include "project/media.h"
30 
31 extern "C" {
32 #include <libavformat/avformat.h>
33 #include <libavcodec/avcodec.h>
34 #include <libswscale/swscale.h>
35 #include <libswresample/swresample.h>
36 }
37 
38 class PreviewGenerator : public QThread
39 {
40  Q_OBJECT
41 public:
43  void run();
44  void cancel();
45 private:
46  void parse_media();
47  bool retrieve_preview(const QString &hash);
48  void generate_waveform();
49  void finalize_media();
50  AVFormatContext* fmt_ctx;
55  bool replace;
56  bool cancelled;
57  QDir data_dir;
58  QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
59  QString get_waveform_path(const QString& hash, const FootageStream &ms);
60 };
61 
62 #endif // PREVIEWGENERATOR_H
bool retrieve_preview(const QString &hash)
Definition: previewgenerator.cpp:133
bool replace
Definition: previewgenerator.h:55
PreviewGenerator(Media *, FootagePtr, bool)
Definition: previewgenerator.cpp:42
void cancel()
Definition: previewgenerator.cpp:583
QDir data_dir
Definition: previewgenerator.h:57
bool cancelled
Definition: previewgenerator.h:56
Definition: previewgenerator.h:38
QString get_waveform_path(const QString &hash, const FootageStream &ms)
Definition: previewgenerator.cpp:504
std::shared_ptr< Footage > FootagePtr
Definition: footage.h:103
bool retrieve_duration
Definition: previewgenerator.h:53
Definition: media.h:42
void generate_waveform()
Definition: previewgenerator.cpp:211
void finalize_media()
Definition: previewgenerator.cpp:188
Definition: footage.h:44
Media * media
Definition: previewgenerator.h:51
QString get_thumbnail_path(const QString &hash, const FootageStream &ms)
Definition: previewgenerator.cpp:500
void parse_media()
Definition: previewgenerator.cpp:60
bool contains_still_image
Definition: previewgenerator.h:54
void run()
Definition: previewgenerator.cpp:508
AVFormatContext * fmt_ctx
Definition: previewgenerator.h:50
FootagePtr footage
Definition: previewgenerator.h:52