Sayonara Player
Converter.h
1 /* Converter.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4  *
5  * This file is part of sayonara Indexyer
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 #ifndef AUDIOCONVERTER_H
22 #define AUDIOCONVERTER_H
23 
24 #include <QObject>
25 #include <QProcess>
26 #include "Utils/Pimpl.h"
27 
28 class MetaDataList;
29 class MetaData;
30 
31 class Converter :
32  public QObject
33 {
34  Q_OBJECT
35  PIMPL(Converter)
36 
37 signals:
38  void sigFinished();
39  void sigProgress(int percent);
40 
41 public:
42  Converter(int quality, QObject* parent=nullptr);
43  virtual ~Converter();
44 
45  virtual QStringList supportedInputFormats() const=0;
46  virtual QString binary() const=0;
47 
48  QString loggingDirectory() const;
49  QString targetDirectory() const;
50  QString targetFile(const MetaData& md) const;
51  void addMetadata(const MetaDataList& tracks);
52  int errorCount() const;
53  int quality() const;
54  int fileCount() const;
55  bool isAvailable() const;
56 
57 private:
58  bool startProcess(const QString& processName, const QStringList& arguments);
59 
60 protected:
61  virtual QStringList processEntry(const MetaData& md) const=0;
62  virtual QString extension() const=0;
63 
64 public slots:
65  void start(int numThreads, const QString& targetDir);
66  void stop();
67 
68 private slots:
69  void processFinished(int ret, QProcess::ExitStatus status);
70  void errorOccured(QProcess::ProcessError err);
71 };
72 
73 #endif // OGGCONVERTER_H
MetaDataList
The MetaDataList class.
Definition: MetaDataList.h:37
Converter
Definition: Converter.h:33
MetaData
The MetaData class.
Definition: MetaData.h:47