diff --git a/libkwave/CodecPlugin.cpp b/libkwave/CodecPlugin.cpp index 2497cc43..b098891e 100644 --- a/libkwave/CodecPlugin.cpp +++ b/libkwave/CodecPlugin.cpp @@ -1,80 +1,82 @@ /************************************************************************* CodecPlugin.cpp - base class for codec plugins ------------------- begin : Fri Dec 28 2012 copyright : (C) 2012 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "config.h" #include "libkwave/CodecManager.h" #include "libkwave/CodecPlugin.h" #include "libkwave/Decoder.h" #include "libkwave/Encoder.h" /***************************************************************************/ Kwave::CodecPlugin::CodecPlugin(QObject *parent, const QVariantList &args, Codec &codec) :Kwave::Plugin(parent, args), m_codec(codec) { } /***************************************************************************/ Kwave::CodecPlugin::~CodecPlugin() { } /***************************************************************************/ void Kwave::CodecPlugin::load(QStringList &/* params */) { use(); m_codec.m_use_count++; if (m_codec.m_use_count == 1) { m_codec.m_encoder = createEncoder(); - if (m_codec.m_encoder) - Kwave::CodecManager::registerEncoder(*m_codec.m_encoder); + if (!m_codec.m_encoder.isEmpty()) + foreach (Kwave::Encoder *enc, m_codec.m_encoder) + if (enc) Kwave::CodecManager::registerEncoder(*enc); m_codec.m_decoder = createDecoder(); - if (m_codec.m_decoder) - Kwave::CodecManager::registerDecoder(*m_codec.m_decoder); + if (!m_codec.m_decoder.isEmpty()) + foreach (Kwave::Decoder *dec, m_codec.m_decoder) + Kwave::CodecManager::registerDecoder(*dec); } } /***************************************************************************/ void Kwave::CodecPlugin::unload() { m_codec.m_use_count--; if (m_codec.m_use_count < 1) { - if (m_codec.m_decoder) { - Kwave::CodecManager::unregisterDecoder(m_codec.m_decoder); - delete m_codec.m_decoder; - m_codec.m_decoder = 0; + while (!m_codec.m_decoder.isEmpty()) { + Kwave::Decoder *dec = m_codec.m_decoder.takeLast(); + Kwave::CodecManager::unregisterDecoder(dec); + delete dec; } - if (m_codec.m_encoder) { - Kwave::CodecManager::unregisterEncoder(m_codec.m_encoder); - delete m_codec.m_encoder; - m_codec.m_encoder = 0; + while (!m_codec.m_encoder.isEmpty()) { + Kwave::Encoder *enc = m_codec.m_encoder.takeLast(); + Kwave::CodecManager::unregisterEncoder(enc); + delete enc; } } release(); } /***************************************************************************/ /***************************************************************************/ diff --git a/libkwave/CodecPlugin.h b/libkwave/CodecPlugin.h index 87125f13..85a571e1 100644 --- a/libkwave/CodecPlugin.h +++ b/libkwave/CodecPlugin.h @@ -1,84 +1,118 @@ /************************************************************************* CodecPlugin.h - base class for codec plugins ------------------- begin : Fri Dec 28 2012 copyright : (C) 2012 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef CODEC_PLUGIN_H #define CODEC_PLUGIN_H #include "config.h" #include +#include #include "libkwave/Plugin.h" namespace Kwave { class Decoder; class Encoder; class Q_DECL_EXPORT CodecPlugin: public Kwave::Plugin { public: /** container for codecs */ typedef struct { - int m_use_count; /**< use count */ - Kwave::Encoder *m_encoder; /**< pointer to a Kwave::Encoder */ - Kwave::Decoder *m_decoder; /**< pointer to a Kwave::Decoder */ + int m_use_count; /**< use count */ + QList m_encoder; /**< list of encoders */ + QList m_decoder; /**< list of decoders */ } Codec; /** * Constructor * @param parent pointer to the corresponding plugin manager * @param args argument list, containts internal meta data * @param codec reference to a static container for the codec */ CodecPlugin(QObject *parent, const QVariantList &args, Codec &codec); /** Destructor */ virtual ~CodecPlugin(); /** * Gets called when the plugin is first loaded. Registers new encoder * and decoder on first call, all subsequenct calls only increment * the reference count of the existing encoder/decoder instances. */ virtual void load(QStringList &/* params */); /** * Gets called before the plugin is unloaded. Decrements the use count * of existing encoder/decoder instances and removes them if zero * gets reached. */ virtual void unload(); - /** Creates a new decoder instance */ - virtual Kwave::Decoder *createDecoder() = 0; + /** + * Create a new set of decoders + * @return list of decoders, may be empty + */ + virtual QList createDecoder() = 0; - /** Creates a new encoder instance */ - virtual Kwave::Encoder *createEncoder() = 0; + /** + * Create a new set of encoders + * @return list of encoders, may be empty + */ + virtual QList createEncoder() = 0; + + protected: + + /** + * helper template to return a list with a single decoder, + * for use within createDecoder() + */ + template QList singleDecoder() + { + QList list; + list.append(new(std::nothrow) T); + return list; + } + + /** + * helper template to return a list with a single encoder, + * for use within createEncoder() + */ + template QList singleEncoder() + { + QList list; + list.append(new(std::nothrow) T); + return list; + } private: /** reference to the static container with encoder/decoder/usecount */ Codec &m_codec; }; } +/** initializer for an empty Kwave::CodecPlugin::Codec */ +#define EMPTY_CODEC {0, QList(), QList() } + #endif /* CODEC_PLUGIN_H */ //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_ascii/AsciiCodecPlugin.cpp b/plugins/codec_ascii/AsciiCodecPlugin.cpp index 9f6001ce..bce0ba68 100644 --- a/plugins/codec_ascii/AsciiCodecPlugin.cpp +++ b/plugins/codec_ascii/AsciiCodecPlugin.cpp @@ -1,61 +1,61 @@ /************************************************************************* AsciiCodecPlugin.cpp - import/export of ASCII data ------------------- begin : Sun Nov 28 2006 copyright : (C) 2006 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "config.h" #include #include "libkwave/CodecManager.h" #include "libkwave/PluginManager.h" #include "AsciiCodecPlugin.h" #include "AsciiDecoder.h" #include "AsciiEncoder.h" // static instance of the codec container -Kwave::CodecPlugin::Codec Kwave::AsciiCodecPlugin::m_codec = {0, 0, 0}; +Kwave::CodecPlugin::Codec Kwave::AsciiCodecPlugin::m_codec = EMPTY_CODEC; KWAVE_PLUGIN(codec_ascii, AsciiCodecPlugin) /***************************************************************************/ Kwave::AsciiCodecPlugin::AsciiCodecPlugin(QObject *parent, const QVariantList &args) :Kwave::CodecPlugin(parent, args, m_codec) { } /***************************************************************************/ Kwave::AsciiCodecPlugin::~AsciiCodecPlugin() { } /***************************************************************************/ -Kwave::Decoder *Kwave::AsciiCodecPlugin::createDecoder() +QList Kwave::AsciiCodecPlugin::createDecoder() { - return new Kwave::AsciiDecoder(); + return singleDecoder(); } /***************************************************************************/ -Kwave::Encoder *Kwave::AsciiCodecPlugin::createEncoder() +QList Kwave::AsciiCodecPlugin::createEncoder() { - return new Kwave::AsciiEncoder(); + return singleEncoder(); } /***************************************************************************/ #include "AsciiCodecPlugin.moc" /***************************************************************************/ /***************************************************************************/ diff --git a/plugins/codec_ascii/AsciiCodecPlugin.h b/plugins/codec_ascii/AsciiCodecPlugin.h index 96fea1ef..224a6197 100644 --- a/plugins/codec_ascii/AsciiCodecPlugin.h +++ b/plugins/codec_ascii/AsciiCodecPlugin.h @@ -1,69 +1,69 @@ /************************************************************************* AsciiCodecPlugin.h - import/export of ASCII data ------------------- begin : Sun Nov 26 2006 copyright : (C) 2006 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef ASCII_CODEC_PLUGIN_H #define ASCII_CODEC_PLUGIN_H #include "config.h" #include "libkwave/CodecPlugin.h" #include "libkwave/Compression.h" namespace Kwave { class AsciiCodecPlugin: public Kwave::CodecPlugin { Q_OBJECT public: /** * Constructor * @param parent reference to our plugin manager * @param args argument list [unused] */ AsciiCodecPlugin(QObject *parent, const QVariantList &args); /** Destructor */ virtual ~AsciiCodecPlugin(); - /** Creates a new decoder instance */ - virtual Kwave::Decoder *createDecoder(); + /** Creates a new decoder */ + virtual QList createDecoder(); - /** Creates a new encoder instance */ - virtual Kwave::Encoder *createEncoder(); + /** Creates a new encoder */ + virtual QList createEncoder(); private: /** static codec container */ static CodecPlugin::Codec m_codec; }; } #define LOAD_MIME_TYPES \ addMimeType("audio/x-audio-ascii", \ i18n("ASCII encoded audio"), "*.ascii"); #define REGISTER_COMPRESSION_TYPES \ addCompression(Kwave::Compression::NONE); /** prefix used for encoding metadata / properties */ #define META_PREFIX _("## ") #endif /* ASCII_CODEC_PLUGIN_H */ //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_audiofile/AudiofileCodecPlugin.cpp b/plugins/codec_audiofile/AudiofileCodecPlugin.cpp index 7632df51..c1b032d2 100644 --- a/plugins/codec_audiofile/AudiofileCodecPlugin.cpp +++ b/plugins/codec_audiofile/AudiofileCodecPlugin.cpp @@ -1,59 +1,59 @@ /************************************************************************* AudiofileCodecPlugin.cpp - import/export through libaudiofile ------------------- begin : Tue May 28 2002 copyright : (C) 2002 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "config.h" #include #include "libkwave/CodecManager.h" #include "libkwave/PluginManager.h" #include "AudiofileCodecPlugin.h" #include "AudiofileDecoder.h" // static instance of the codec container -Kwave::CodecPlugin::Codec Kwave::AudiofileCodecPlugin::m_codec = {0, 0, 0}; +Kwave::CodecPlugin::Codec Kwave::AudiofileCodecPlugin::m_codec = EMPTY_CODEC; KWAVE_PLUGIN(codec_audiofile, AudiofileCodecPlugin) /***************************************************************************/ Kwave::AudiofileCodecPlugin::AudiofileCodecPlugin(QObject *parent, const QVariantList &args) :Kwave::CodecPlugin(parent, args, m_codec) { } /***************************************************************************/ Kwave::AudiofileCodecPlugin::~AudiofileCodecPlugin() { } /***************************************************************************/ -Kwave::Decoder *Kwave::AudiofileCodecPlugin::createDecoder() +QList Kwave::AudiofileCodecPlugin::createDecoder() { - return new Kwave::AudiofileDecoder(); + return singleDecoder(); } /***************************************************************************/ -Kwave::Encoder *Kwave::AudiofileCodecPlugin::createEncoder() +QList Kwave::AudiofileCodecPlugin::createEncoder() { - return 0; /* not implemented */ + return QList(); /* not implemented */ } /***************************************************************************/ #include "AudiofileCodecPlugin.moc" /***************************************************************************/ /***************************************************************************/ diff --git a/plugins/codec_audiofile/AudiofileCodecPlugin.h b/plugins/codec_audiofile/AudiofileCodecPlugin.h index baf25a49..3a9c1069 100644 --- a/plugins/codec_audiofile/AudiofileCodecPlugin.h +++ b/plugins/codec_audiofile/AudiofileCodecPlugin.h @@ -1,57 +1,57 @@ /************************************************************************* AudiofileCodecPlugin.h - import/export through libaudiofile ------------------- begin : Tue May 28 2002 copyright : (C) 2002 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef AUDIOFILE_CODEC_PLUGIN_H #define AUDIOFILE_CODEC_PLUGIN_H #include "config.h" #include "libkwave/CodecPlugin.h" namespace Kwave { class AudiofileCodecPlugin: public Kwave::CodecPlugin { Q_OBJECT public: /** * Constructor * @param parent reference to our plugin manager * @param args argument list [unused] */ AudiofileCodecPlugin(QObject *parent, const QVariantList &args); /** Destructor */ virtual ~AudiofileCodecPlugin(); - /** Creates a new decoder instance */ - virtual Kwave::Decoder *createDecoder(); + /** Creates a new decoder */ + virtual QList createDecoder(); - /** Creates a new encoder instance */ - virtual Kwave::Encoder *createEncoder(); + /** Creates a new encoder */ + virtual QList createEncoder(); private: /** static codec container */ static CodecPlugin::Codec m_codec; }; } #endif /* AUDIOFILE_CODEC_PLUGIN_H */ //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_flac/FlacCodecPlugin.cpp b/plugins/codec_flac/FlacCodecPlugin.cpp index fd00b4ce..e0bae5cd 100644 --- a/plugins/codec_flac/FlacCodecPlugin.cpp +++ b/plugins/codec_flac/FlacCodecPlugin.cpp @@ -1,61 +1,61 @@ /************************************************************************* FlacCodecPlugin.cpp - import/export of FLAC data ------------------- begin : Tue Feb 28 2004 copyright : (C) 2004 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "config.h" #include #include "libkwave/CodecManager.h" #include "libkwave/PluginManager.h" #include "FlacCodecPlugin.h" #include "FlacDecoder.h" #include "FlacEncoder.h" // static instance of the codec container -Kwave::CodecPlugin::Codec Kwave::FlacCodecPlugin::m_codec = {0, 0, 0}; +Kwave::CodecPlugin::Codec Kwave::FlacCodecPlugin::m_codec = EMPTY_CODEC; KWAVE_PLUGIN(codec_flac, FlacCodecPlugin) /***************************************************************************/ Kwave::FlacCodecPlugin::FlacCodecPlugin(QObject *parent, const QVariantList &args) :Kwave::CodecPlugin(parent, args, m_codec) { } /***************************************************************************/ Kwave::FlacCodecPlugin::~FlacCodecPlugin() { } /***************************************************************************/ -Kwave::Decoder *Kwave::FlacCodecPlugin::createDecoder() +QList Kwave::FlacCodecPlugin::createDecoder() { - return new Kwave::FlacDecoder(); + return singleDecoder(); } /***************************************************************************/ -Kwave::Encoder *Kwave::FlacCodecPlugin::createEncoder() +QList Kwave::FlacCodecPlugin::createEncoder() { - return new Kwave::FlacEncoder(); + return singleEncoder(); } /***************************************************************************/ #include "FlacCodecPlugin.moc" /***************************************************************************/ /***************************************************************************/ diff --git a/plugins/codec_flac/FlacCodecPlugin.h b/plugins/codec_flac/FlacCodecPlugin.h index 374cfb89..32fd34fd 100644 --- a/plugins/codec_flac/FlacCodecPlugin.h +++ b/plugins/codec_flac/FlacCodecPlugin.h @@ -1,69 +1,69 @@ /************************************************************************* FlacCodecPlugin.h - import/export of FLAC data ------------------- begin : Tue Feb 28 2004 copyright : (C) 2004 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef FLAC_CODEC_PLUGIN_H #define FLAC_CODEC_PLUGIN_H #include "config.h" #include "libkwave/CodecPlugin.h" #include "libkwave/Compression.h" class QStringList; namespace Kwave { class FlacCodecPlugin: public Kwave::CodecPlugin { Q_OBJECT public: /** * Constructor * @param parent reference to our plugin manager * @param args argument list [unused] */ FlacCodecPlugin(QObject *parent, const QVariantList &args); /** Destructor */ virtual ~FlacCodecPlugin(); - /** Creates a new decoder instance */ - virtual Kwave::Decoder *createDecoder(); + /** Creates a new decoder */ + virtual QList createDecoder(); - /** Creates a new encoder instance */ - virtual Kwave::Encoder *createEncoder(); + /** Creates a new encoder */ + virtual QList createEncoder(); private: /** static codec container */ static CodecPlugin::Codec m_codec; }; } #define REGISTER_MIME_TYPES \ addMimeType("audio/x-flac", i18n("FLAC audio"), "*.flac"); #define REGISTER_COMPRESSION_TYPES \ addCompression(Kwave::Compression::FLAC); #define DEFAULT_MIME_TYPE "audio/x-flac" #endif /* FLAC_CODEC_PLUGIN_H */ //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_mp3/MP3CodecPlugin.cpp b/plugins/codec_mp3/MP3CodecPlugin.cpp index c32e4ab6..6eaa38c2 100644 --- a/plugins/codec_mp3/MP3CodecPlugin.cpp +++ b/plugins/codec_mp3/MP3CodecPlugin.cpp @@ -1,94 +1,94 @@ /************************************************************************* MP3CodecPlugin.cpp - import and export of MP3 data ------------------- begin : Mon May 28 2012 copyright : (C) 2012 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "config.h" #include "libkwave/CodecManager.h" #include "libkwave/String.h" #include "MP3CodecPlugin.h" #include "MP3Decoder.h" #include "MP3Encoder.h" #include "MP3EncoderDialog.h" KWAVE_PLUGIN(codec_mp3, MP3CodecPlugin) // static instance of the codec container -Kwave::CodecPlugin::Codec Kwave::MP3CodecPlugin::m_codec = {0, 0, 0}; +Kwave::CodecPlugin::Codec Kwave::MP3CodecPlugin::m_codec = EMPTY_CODEC; /***************************************************************************/ Kwave::MP3CodecPlugin::MP3CodecPlugin(QObject *parent, const QVariantList &args) :Kwave::CodecPlugin(parent, args, m_codec) { } /***************************************************************************/ Kwave::MP3CodecPlugin::~MP3CodecPlugin() { } /***************************************************************************/ void Kwave::MP3CodecPlugin::load(QStringList ¶ms) { emitCommand(_("menu (plugin:setup(codec_mp3), Settings/%1)").arg( i18n("MP3 Encoder Setup"))); Kwave::CodecPlugin::load(params); } //*************************************************************************** QStringList *Kwave::MP3CodecPlugin::setup(QStringList &previous_params) { Q_UNUSED(previous_params); // create the setup dialog MP3EncoderDialog *dialog = new MP3EncoderDialog(parentWidget()); Q_ASSERT(dialog); if (!dialog) return 0; QStringList *list = new QStringList(); Q_ASSERT(list); if (list && dialog->exec()) { // user has pressed "OK" dialog->save(); } else { // user pressed "Cancel" if (list) delete list; list = 0; } if (dialog) delete dialog; return list; } /***************************************************************************/ -Kwave::Decoder *Kwave::MP3CodecPlugin::createDecoder() +QList Kwave::MP3CodecPlugin::createDecoder() { - return new Kwave::MP3Decoder(); + return singleDecoder(); } /***************************************************************************/ -Kwave::Encoder *Kwave::MP3CodecPlugin::createEncoder() +QList Kwave::MP3CodecPlugin::createEncoder() { - return new Kwave::MP3Encoder(); + return singleEncoder(); } //*************************************************************************** #include "MP3CodecPlugin.moc" //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_mp3/MP3CodecPlugin.h b/plugins/codec_mp3/MP3CodecPlugin.h index 4aa99a41..4f7e27af 100644 --- a/plugins/codec_mp3/MP3CodecPlugin.h +++ b/plugins/codec_mp3/MP3CodecPlugin.h @@ -1,99 +1,99 @@ /************************************************************************* MP3CodecPlugin.h - import and export of MP3 data ------------------- begin : Mon May 28 2012 copyright : (C) 2012 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef MP3_CODEC_PLUGIN_H #define MP3_CODEC_PLUGIN_H #include "config.h" #include "libkwave/CodecPlugin.h" #include "libkwave/Compression.h" namespace Kwave { class MP3CodecPlugin: public Kwave::CodecPlugin { Q_OBJECT public: /** * Constructor * @param parent reference to our plugin manager * @param args argument list [unused] */ MP3CodecPlugin(QObject *parent, const QVariantList &args); /** Destructor */ virtual ~MP3CodecPlugin(); /** @see Kwave::Plugin::load() */ virtual void load(QStringList ¶ms); /** * Shows a dialog to set up the plugin, configure all paths, * presets and other parameters... * @param previous_params the parameters of a previous call * @return a string list with all parameters or null if the * setup (dialog) has been canceled */ virtual QStringList *setup(QStringList &previous_params); - /** Creates a new decoder instance */ - virtual Kwave::Decoder *createDecoder(); + /** Creates a new decoder */ + virtual QList createDecoder(); - /** Creates a new encoder instance */ - virtual Kwave::Encoder *createEncoder(); + /** Creates a new encoder */ + virtual QList createEncoder(); private: /** static codec container */ static CodecPlugin::Codec m_codec; }; } /* see RFC3003 */ #define REGISTER_MIME_TYPES { \ addMimeType( \ "audio/x-mp3, audio/mpeg", \ i18n("MPEG layer III audio"), \ "*.mp3" \ ); \ \ addMimeType( \ "audio/mpeg, audio/x-mp2", \ i18n("MPEG layer II audio"), \ "*.mp2" \ ); \ \ addMimeType( \ "audio/mpeg, audio/x-mpga", \ i18n("MPEG layer I audio"), \ "*.mpga *.mpg *.mp1" \ ); \ } #define REGISTER_COMPRESSION_TYPES { \ addCompression(Kwave::Compression::MPEG_LAYER_I); \ addCompression(Kwave::Compression::MPEG_LAYER_II); \ addCompression(Kwave::Compression::MPEG_LAYER_III); \ } #endif /* MP3_CODEC_PLUGIN_H */ //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_ogg/OggCodecPlugin.cpp b/plugins/codec_ogg/OggCodecPlugin.cpp index a380b19e..89b7b762 100644 --- a/plugins/codec_ogg/OggCodecPlugin.cpp +++ b/plugins/codec_ogg/OggCodecPlugin.cpp @@ -1,60 +1,60 @@ /************************************************************************* OggCodecPlugin.cpp - import/export of audio in an Ogg container ------------------- begin : Tue Sep 10 2002 copyright : (C) 2002 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "config.h" #include #include "libkwave/CodecManager.h" #include "OggCodecPlugin.h" #include "OggDecoder.h" #include "OggEncoder.h" KWAVE_PLUGIN(codec_ogg, OggCodecPlugin) // static instance of the codec container -Kwave::CodecPlugin::Codec Kwave::OggCodecPlugin::m_codec = {0, 0, 0}; +Kwave::CodecPlugin::Codec Kwave::OggCodecPlugin::m_codec = EMPTY_CODEC; /***************************************************************************/ Kwave::OggCodecPlugin::OggCodecPlugin(QObject *parent, const QVariantList &args) :Kwave::CodecPlugin(parent, args, m_codec) { } /***************************************************************************/ Kwave::OggCodecPlugin::~OggCodecPlugin() { } /***************************************************************************/ -Kwave::Decoder *Kwave::OggCodecPlugin::createDecoder() +QList Kwave::OggCodecPlugin::createDecoder() { - return new Kwave::OggDecoder(); + return singleDecoder(); } /***************************************************************************/ -Kwave::Encoder *Kwave::OggCodecPlugin::createEncoder() +QList Kwave::OggCodecPlugin::createEncoder() { - return new Kwave::OggEncoder(); + return singleEncoder(); } //*************************************************************************** #include "OggCodecPlugin.moc" //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_ogg/OggCodecPlugin.h b/plugins/codec_ogg/OggCodecPlugin.h index c8b2f8a6..ae5c773e 100644 --- a/plugins/codec_ogg/OggCodecPlugin.h +++ b/plugins/codec_ogg/OggCodecPlugin.h @@ -1,82 +1,82 @@ /************************************************************************* OggCodecPlugin.h - import/export of audio in an Ogg container ------------------- begin : Tue Sep 10 2002 copyright : (C) 2002 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef OGG_CODEC_PLUGIN_H #define OGG_CODEC_PLUGIN_H #include "config.h" #include "libkwave/CodecPlugin.h" #include "libkwave/Compression.h" namespace Kwave { class OggCodecPlugin: public Kwave::CodecPlugin { Q_OBJECT public: /** * Constructor * @param parent reference to our plugin manager * @param args argument list [unused] */ OggCodecPlugin(QObject *parent, const QVariantList &args); /** Destructor */ virtual ~OggCodecPlugin(); - /** Creates a new decoder instance */ - virtual Kwave::Decoder *createDecoder(); + /** Creates a new decoder */ + virtual QList createDecoder(); - /** Creates a new encoder instance */ - virtual Kwave::Encoder *createEncoder(); + /** Creates a new encoder */ + virtual QList createEncoder(); private: /** static codec container */ static CodecPlugin::Codec m_codec; }; } #define REGISTER_OGG_OPUS_MIME_TYPES \ /* Ogg audio, as per RFC5334, RFC4288 and RFC4855 */ \ addMimeType( \ "audio/ogg, application/ogg, audio/opus", \ i18n("Ogg Opus audio"), \ "*.opus" \ ); #define REGISTER_OGG_VORBIS_MIME_TYPES \ addMimeType( \ "audio/ogg, audio/x-ogg, application/x-ogg, audio/x-vorbis+ogg", \ i18n("Ogg Vorbis audio"), \ "*.ogg" \ ); #define REGISTER_COMPRESSION_TYPE_OGG_OPUS \ addCompression(Kwave::Compression::OGG_OPUS); #define REGISTER_COMPRESSION_TYPE_OGG_VORBIS \ addCompression(Kwave::Compression::OGG_VORBIS); #define DEFAULT_MIME_TYPE "audio/ogg" #endif /* OGG_CODEC_PLUGIN_H */ //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_wav/WavCodecPlugin.cpp b/plugins/codec_wav/WavCodecPlugin.cpp index b824e728..afc06549 100644 --- a/plugins/codec_wav/WavCodecPlugin.cpp +++ b/plugins/codec_wav/WavCodecPlugin.cpp @@ -1,58 +1,58 @@ /************************************************************************* WavCodecPlugin.cpp - import/export of wav data ------------------- begin : Sun Mar 10 2002 copyright : (C) 2002 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "config.h" #include "libkwave/CodecManager.h" #include "WavCodecPlugin.h" #include "WavDecoder.h" #include "WavEncoder.h" KWAVE_PLUGIN(codec_wav, WavCodecPlugin) // static instance of the codec container -Kwave::CodecPlugin::Codec Kwave::WavCodecPlugin::m_codec = {0, 0, 0}; +Kwave::CodecPlugin::Codec Kwave::WavCodecPlugin::m_codec = EMPTY_CODEC; /***************************************************************************/ Kwave::WavCodecPlugin::WavCodecPlugin(QObject *parent, const QVariantList &args) :Kwave::CodecPlugin(parent, args, m_codec) { } /***************************************************************************/ Kwave::WavCodecPlugin::~WavCodecPlugin() { } /***************************************************************************/ -Kwave::Decoder *Kwave::WavCodecPlugin::createDecoder() +QList Kwave::WavCodecPlugin::createDecoder() { - return new Kwave::WavDecoder(); + return singleDecoder(); } /***************************************************************************/ -Kwave::Encoder *Kwave::WavCodecPlugin::createEncoder() +QList Kwave::WavCodecPlugin::createEncoder() { - return new Kwave::WavEncoder(); + return singleEncoder(); } //*************************************************************************** #include "WavCodecPlugin.moc" //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_wav/WavCodecPlugin.h b/plugins/codec_wav/WavCodecPlugin.h index 8a87e3a8..64fa7e4f 100644 --- a/plugins/codec_wav/WavCodecPlugin.h +++ b/plugins/codec_wav/WavCodecPlugin.h @@ -1,58 +1,58 @@ /************************************************************************* WavCodecPlugin.h - import/export of wav data ------------------- begin : Sun Mar 10 2002 copyright : (C) 2002 by Thomas Eschenbacher email : Thomas.Eschenbacher@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef WAV_CODEC_PLUGIN_H #define WAV_CODEC_PLUGIN_H #include "config.h" #include "libkwave/CodecPlugin.h" namespace Kwave { class WavCodecPlugin: public Kwave::CodecPlugin { Q_OBJECT public: /** * Constructor * @param parent reference to our plugin manager * @param args argument list [unused] */ WavCodecPlugin(QObject *parent, const QVariantList &args); /** Destructor */ virtual ~WavCodecPlugin(); - /** Creates a new decoder instance */ - virtual Kwave::Decoder *createDecoder(); + /** Creates a new decoder */ + virtual QList createDecoder(); - /** Creates a new encoder instance */ - virtual Kwave::Encoder *createEncoder(); + /** Creates a new encoder */ + virtual QList createEncoder(); private: /** static codec container */ static CodecPlugin::Codec m_codec; }; } #endif /* WAV_CODEC_PLUGIN_H */ //*************************************************************************** //***************************************************************************