Make encoder name conversion functions static to the base class.
[Rockbox.git] / rbutil / rbutilqt / encoders.h
blobb5460de3ab395c48a124bd6120fbda5de971d509
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: encoders.h 15212 2007-10-19 21:49:07Z domonoky $
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef ENCODERS_H
21 #define ENCODERS_H
23 #include <QtCore>
25 #include "rbsettings.h"
27 extern "C"
29 #include "rbspeex.h"
33 class EncBase : public QObject
35 Q_OBJECT
36 public:
37 EncBase(QObject *parent );
39 virtual bool encode(QString input,QString output)
40 {(void)input; (void)output; return false;}
41 virtual bool start(){return false;}
42 virtual bool stop(){return false;}
43 virtual void showCfg(){}
44 virtual bool configOk(){return false;}
46 void setCfg(RbSettings *sett){settings = sett;}
47 static QString getEncoderName(QString);
48 static EncBase* getEncoder(QString);
49 static QStringList getEncoderList(void);
51 public slots:
52 virtual void accept(void){}
53 virtual void reject(void){}
54 virtual void reset(void){}
55 private:
56 static void initEncodernamesList(void);
58 protected:
59 RbSettings* settings;
61 static QMap<QString,QString> encoderList;
62 static QMap<QString,EncBase*> encoderCache;
67 class EncExes : public EncBase
69 Q_OBJECT
70 public:
71 EncExes(QString name,QObject *parent = NULL);
72 virtual bool encode(QString input,QString output);
73 virtual bool start();
74 virtual bool stop() {return true;}
75 virtual void showCfg();
76 virtual bool configOk();
78 private:
79 QString m_name;
80 QString m_EncExec;
81 QString m_EncOpts;
82 QMap<QString,QString> m_TemplateMap;
83 QString m_EncTemplate;
86 class EncRbSpeex : public EncBase
88 Q_OBJECT
89 public:
90 EncRbSpeex(QObject *parent = NULL);
91 virtual bool encode(QString input,QString output);
92 virtual bool start();
93 virtual bool stop() {return true;}
94 virtual void showCfg();
95 virtual bool configOk();
97 private:
98 float quality;
99 float volume;
100 int complexity;
101 bool narrowband;
103 float defaultQuality;
104 float defaultVolume;
105 int defaultComplexity;
106 bool defaultBand;
110 #endif