diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2009-04-29 21:29:35 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2009-04-29 21:29:35 +0000 |
commit | 357d35c20eef7873fb6397814f38b721024f2795 (patch) | |
tree | b8617001832287d9ef3ccfb3712ab884029854eb /rbutil/rbutilqt/base/encoders.h | |
parent | 5b85ef6006ae8e88694c62806f7f178eab4d3ba9 (diff) | |
download | rockbox-357d35c20eef7873fb6397814f38b721024f2795.tar.gz rockbox-357d35c20eef7873fb6397814f38b721024f2795.zip |
rbutil: move the tts and encoders and its settings interface to base/
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20825 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/encoders.h')
-rw-r--r-- | rbutil/rbutilqt/base/encoders.h | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/encoders.h b/rbutil/rbutilqt/base/encoders.h new file mode 100644 index 0000000000..d5d1723a46 --- /dev/null +++ b/rbutil/rbutilqt/base/encoders.h | |||
@@ -0,0 +1,133 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2007 by Dominik Wenger | ||
10 | * $Id$ | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef ENCODERS_H | ||
23 | #define ENCODERS_H | ||
24 | |||
25 | #include <QtCore> | ||
26 | |||
27 | #include "rbsettings.h" | ||
28 | #include "encttssettings.h" | ||
29 | #include "rbspeex.h" | ||
30 | |||
31 | |||
32 | class EncBase : public EncTtsSettingInterface | ||
33 | { | ||
34 | Q_OBJECT | ||
35 | public: | ||
36 | EncBase(QObject *parent ); | ||
37 | |||
38 | //! Child class should encode a wav file | ||
39 | virtual bool encode(QString input,QString output) =0; | ||
40 | //! Child class should do startup | ||
41 | virtual bool start()=0; | ||
42 | //! Child class should stop | ||
43 | virtual bool stop()=0; | ||
44 | |||
45 | // settings | ||
46 | //! Child class should return true when configuration is ok | ||
47 | virtual bool configOk()=0; | ||
48 | //! Child class should fill in the setttingsList | ||
49 | virtual void generateSettings() = 0; | ||
50 | //! Chlid class should commit the from SettingsList to permanent storage | ||
51 | virtual void saveSettings() = 0; | ||
52 | |||
53 | // static functions | ||
54 | static QString getEncoderName(QString name); | ||
55 | static EncBase* getEncoder(QObject* parent,QString name); | ||
56 | static QStringList getEncoderList(void); | ||
57 | |||
58 | //set the config. users of Encoder classes, always have to call this first | ||
59 | void setCfg(RbSettings *sett){settings = sett;} | ||
60 | private: | ||
61 | static void initEncodernamesList(void); | ||
62 | |||
63 | protected: | ||
64 | RbSettings* settings; | ||
65 | |||
66 | static QMap<QString,QString> encoderList; | ||
67 | }; | ||
68 | |||
69 | |||
70 | class EncExes : public EncBase | ||
71 | { | ||
72 | enum ESettings | ||
73 | { | ||
74 | eEXEPATH, | ||
75 | eEXEOPTIONS | ||
76 | }; | ||
77 | |||
78 | Q_OBJECT | ||
79 | public: | ||
80 | EncExes(QString name,QObject *parent = NULL); | ||
81 | bool encode(QString input,QString output); | ||
82 | bool start(); | ||
83 | bool stop() {return true;} | ||
84 | |||
85 | // setting | ||
86 | bool configOk(); | ||
87 | void generateSettings(); | ||
88 | void saveSettings(); | ||
89 | |||
90 | private: | ||
91 | QString m_name; | ||
92 | QString m_EncExec; | ||
93 | QString m_EncOpts; | ||
94 | QMap<QString,QString> m_TemplateMap; | ||
95 | QString m_EncTemplate; | ||
96 | }; | ||
97 | |||
98 | class EncRbSpeex : public EncBase | ||
99 | { | ||
100 | enum ESettings | ||
101 | { | ||
102 | eVOLUME, | ||
103 | eQUALITY, | ||
104 | eCOMPLEXITY, | ||
105 | eNARROWBAND | ||
106 | }; | ||
107 | |||
108 | Q_OBJECT | ||
109 | public: | ||
110 | EncRbSpeex(QObject *parent = NULL); | ||
111 | bool encode(QString input,QString output); | ||
112 | bool start(); | ||
113 | bool stop() {return true;} | ||
114 | |||
115 | // for settings view | ||
116 | bool configOk(); | ||
117 | void generateSettings(); | ||
118 | void saveSettings(); | ||
119 | |||
120 | private: | ||
121 | float quality; | ||
122 | float volume; | ||
123 | int complexity; | ||
124 | bool narrowband; | ||
125 | |||
126 | float defaultQuality; | ||
127 | float defaultVolume; | ||
128 | int defaultComplexity; | ||
129 | bool defaultBand; | ||
130 | }; | ||
131 | |||
132 | |||
133 | #endif | ||