Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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 
46  static void AnalyzeMedia(Media*);
47 private:
48  void parse_media();
49  bool retrieve_preview(const QString &hash);
50  void generate_waveform();
51  void finalize_media();
52  void invalidate_media(const QString& error_msg);
53  QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
54  QString get_waveform_path(const QString& hash, const FootageStream &ms);
55 
56  AVFormatContext* fmt_ctx_;
61  bool cancelled_;
62  QDir data_dir_;
63 };
64 
65 #endif // PREVIEWGENERATOR_H
void invalidate_media(const QString &error_msg)
Definition: previewgenerator.cpp:227
void generate_waveform()
Definition: previewgenerator.cpp:235
void run()
Definition: previewgenerator.cpp:536
bool contains_still_image_
Definition: previewgenerator.h:60
Media * media_
Definition: previewgenerator.h:57
void cancel()
Definition: previewgenerator.cpp:615
Definition: previewgenerator.h:38
AVFormatContext * fmt_ctx_
Definition: previewgenerator.h:56
PreviewGenerator(Media *)
Definition: previewgenerator.cpp:42
QDir data_dir_
Definition: previewgenerator.h:62
bool cancelled_
Definition: previewgenerator.h:61
void finalize_media()
Definition: previewgenerator.cpp:196
Definition: footage.h:49
Definition: media.h:45
QString get_thumbnail_path(const QString &hash, const FootageStream &ms)
Definition: previewgenerator.cpp:528
bool retrieve_preview(const QString &hash)
Definition: previewgenerator.cpp:143
QString get_waveform_path(const QString &hash, const FootageStream &ms)
Definition: previewgenerator.cpp:532
static void AnalyzeMedia(Media *)
Definition: previewgenerator.cpp:620
void parse_media()
Definition: previewgenerator.cpp:67
bool retrieve_duration_
Definition: previewgenerator.h:59
Footage * footage_
Definition: previewgenerator.h:58
Definition: footage.h:68