Sayonara Player
Converter.h
1 /* Converter.h */
2 
3 /* Copyright (C) 2011-2019 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef AUDIOCONVERTER_H
24 #define AUDIOCONVERTER_H
25 
26 #include <QObject>
27 #include <QProcess>
28 #include "Utils/Pimpl.h"
29 
30 class MetaDataList;
31 class MetaData;
32 
33 class Converter :
34  public QObject
35 {
36  Q_OBJECT
37  PIMPL(Converter)
38 
39 signals:
40  void sig_finished();
41  void sig_progress(int percent);
42 
43 public:
44  Converter(int quality, QObject* parent=nullptr);
45  virtual ~Converter();
46 
47  virtual QStringList supported_input_formats() const=0;
48  virtual QString binary() const=0;
49 
50  QString log_directory() const;
51  QString target_file(const MetaData& md) const;
52  void add_metadata(const MetaDataList& v_md);
53  int num_errors() const;
54  int quality() const;
55  int num_files() const;
56  bool is_available() const;
57 
58 private:
59  bool start_process(const QString& process_name, const QStringList& arguments);
60 
61 protected:
62  virtual QStringList process_entry(const MetaData& md) const=0;
63  virtual QString extension() const=0;
64 
65 public slots:
66  void start(int num_threads, const QString& target_dir);
67  void stop();
68 
69 private slots:
70  void process_finished(int ret);
71  void error_occured(QProcess::ProcessError err);
72 };
73 
74 #endif // OGGCONVERTER_H
The MetaData class.
Definition: MetaData.h:44
The MetaDataList class.
Definition: MetaDataList.h:37
Definition: Converter.h:33