kwave  18.07.70
Compression.h
Go to the documentation of this file.
1 /***************************************************************************
2  Compression.h - Wrapper for a compression
3  -------------------
4  begin : Fri Jan 25 2013
5  copyright : (C) 2013 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef COMPRESSION_H
19 #define COMPRESSION_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QList>
25 #include <QMap>
26 #include <QSharedData>
27 #include <QSharedDataPointer>
28 
29 #include "libkwave/SampleFormat.h"
30 
31 namespace Kwave
32 {
33 
34  class Q_DECL_EXPORT Compression
35  {
36  public:
37 
43  typedef enum {
44  INVALID = -1,
45  NONE = 0,
46  G722 = 501,
47  G711_ULAW = 502,
48  G711_ALAW = 503,
49  APPLE_ACE2 = 504,
50  APPLE_ACE8 = 505,
51  APPLE_MAC3 = 506,
52  APPLE_MAC6 = 507,
53  G726 = 517,
54  G728 = 518,
55  DVI_AUDIO = 519,
56  GSM = 520,
57  FS1016 = 521,
58  DV = 522,
59  MS_ADPCM = 523,
60  FLAC = 530,
61  ALAC = 540,
62  MPEG_LAYER_I = 600,
66  OGG_OPUS
67  } Type;
68 
72  Compression();
73 
78  explicit Compression(const Type value);
79 
84  explicit Compression(const Kwave::Compression &other);
85 
87  virtual ~Compression() {}
88 
90  inline void assign(Type t) { m_type = t; }
91 
96  QString name() const;
97 
101  QString preferredMimeType() const;
102 
107  QList<Kwave::SampleFormat> sampleFormats() const;
108 
113  bool hasABR() const;
114 
119  bool hasVBR() const;
120 
122  inline int toInt() const { return static_cast<int>(m_type); }
123 
125  static Kwave::Compression::Type fromInt(int i);
126 
128  static int toAudiofile(Kwave::Compression::Type compression);
129 
131  static Kwave::Compression::Type fromAudiofile(int af_compression);
132 
133  private:
134 
136  static void fillMap();
137 
138  private:
139 
141  Type m_type;
142 
143  private:
144 
146  class Info
147  {
148  public:
149 
151  Info();
152 
154  Info(const Info &other);
155 
165  Info(const QString &name,
166  const QString &mime_type,
167  const QList<Kwave::SampleFormat> &sample_formats,
168  bool has_abr,
169  bool has_vbr
170  );
171 
173  virtual ~Info();
174 
175  public:
176 
178  QString m_name;
179 
181  QString m_mime_type;
182 
184  QList<Kwave::SampleFormat> m_sample_formats;
185 
187  bool m_has_abr;
188 
190  bool m_has_vbr;
191  };
192 
193  private:
194 
196  static QMap<int, Kwave::Compression::Info> m_map;
197  };
198 
199 }
200 
201 #endif /* COMPRESSION_H */
202 
203 //***************************************************************************
204 //***************************************************************************
void assign(Type t)
Definition: Compression.h:90
Definition: App.h:33
static QMap< int, Kwave::Compression::Info > m_map
Definition: Compression.h:196
const char name[16]
Definition: memcpy.c:510
QList< Kwave::SampleFormat > m_sample_formats
Definition: Compression.h:184
virtual ~Compression()
Definition: Compression.h:87
int toInt() const
Definition: Compression.h:122