kwave  18.07.70
CodecPlugin.h
Go to the documentation of this file.
1 /*************************************************************************
2  CodecPlugin.h - base class for codec plugins
3  -------------------
4  begin : Fri Dec 28 2012
5  copyright : (C) 2012 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 CODEC_PLUGIN_H
19 #define CODEC_PLUGIN_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QList>
25 
26 #include "libkwave/Plugin.h"
27 
28 namespace Kwave
29 {
30  class Decoder;
31  class Encoder;
32 
33  class Q_DECL_EXPORT CodecPlugin: public Kwave::Plugin
34  {
35  public:
36 
38  typedef struct {
40  QList<Kwave::Encoder *> m_encoder;
41  QList<Kwave::Decoder *> m_decoder;
42  } Codec;
43 
50  CodecPlugin(QObject *parent, const QVariantList &args, Codec &codec);
51 
53  virtual ~CodecPlugin() Q_DECL_OVERRIDE;
54 
60  virtual void load(QStringList &/* params */) Q_DECL_OVERRIDE;
61 
67  virtual void unload() Q_DECL_OVERRIDE;
68 
73  virtual QList<Kwave::Decoder *> createDecoder() = 0;
74 
79  virtual QList<Kwave::Encoder *> createEncoder() = 0;
80 
81  protected:
82 
87  template<class T> QList<Kwave::Decoder *> singleDecoder()
88  {
89  QList<Kwave::Decoder *> list;
90  list.append(new(std::nothrow) T);
91  return list;
92  }
93 
98  template<class T> QList<Kwave::Encoder *> singleEncoder()
99  {
100  QList<Kwave::Encoder *> list;
101  list.append(new(std::nothrow) T);
102  return list;
103  }
104 
105  private:
106 
109  };
110 }
111 
113 #define EMPTY_CODEC {0, QList<Kwave::Encoder *>(), QList<Kwave::Decoder *>() }
114 
115 #endif /* CODEC_PLUGIN_H */
116 
117 //***************************************************************************
118 //***************************************************************************
QList< Kwave::Encoder * > m_encoder
Definition: CodecPlugin.h:40
Definition: App.h:33
QList< Kwave::Decoder * > m_decoder
Definition: CodecPlugin.h:41
QList< Kwave::Encoder * > singleEncoder()
Definition: CodecPlugin.h:98