diff --git a/plugins/codec_mp3/ID3_QIODeviceReader.h b/plugins/codec_mp3/ID3_QIODeviceReader.h index 47361a0c..8daf3ac3 100644 --- a/plugins/codec_mp3/ID3_QIODeviceReader.h +++ b/plugins/codec_mp3/ID3_QIODeviceReader.h @@ -1,79 +1,82 @@ /************************************************************************* ID3_QIODeviceReader.h - Adapter between QIODevice and ID3_Reader ------------------- begin : Wed Aug 14 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 ID3_QIODEVICE_READER_H #define ID3_QIODEVICE_READER_H #include "config.h" #include #include class QIODevice; namespace Kwave { /** * @class ID3_QIODeviceReader * Adapter between QIODevice and ID3_Reader */ class ID3_QIODeviceReader: public ID3_Reader { public: /** Constructor */ explicit ID3_QIODeviceReader(QIODevice &source); /** Destructor */ virtual ~ID3_QIODeviceReader(); /** Close the source. Not implemented. */ - virtual void close(); + virtual void close() Q_DECL_OVERRIDE; /** Get the start position, always zero */ - virtual ID3_Reader::pos_type getBeg(); + virtual ID3_Reader::pos_type getBeg() Q_DECL_OVERRIDE; /** Get the end position, identical to size()-1 */ - virtual ID3_Reader::pos_type getEnd(); + virtual ID3_Reader::pos_type getEnd() Q_DECL_OVERRIDE; /** Returns the current position */ - virtual ID3_Reader::pos_type getCur(); + virtual ID3_Reader::pos_type getCur() Q_DECL_OVERRIDE; /** Sets a new position and returns the new one */ - virtual ID3_Reader::pos_type setCur(ID3_Reader::pos_type pos=0); + virtual ID3_Reader::pos_type setCur(ID3_Reader::pos_type pos = 0) + Q_DECL_OVERRIDE; /** Reads out one single character */ - virtual ID3_Reader::int_type readChar(); + virtual ID3_Reader::int_type readChar() Q_DECL_OVERRIDE; /** Reads one character without advancing the current position */ - virtual ID3_Reader::int_type peekChar(); + virtual ID3_Reader::int_type peekChar() Q_DECL_OVERRIDE; /** Read out a block of characters */ - virtual size_type readChars(char_type buf[], size_type len); - virtual size_type readChars(char buf[], size_type len); + virtual size_type readChars(char_type buf[], size_type len) + Q_DECL_OVERRIDE; + virtual size_type readChars(char buf[], size_type len) + Q_DECL_OVERRIDE; private: /** reference to a QIODevice that is used as source */ QIODevice &m_source; }; } #endif /* ID3_QIODEVICE_READER_H */ //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_mp3/ID3_QIODeviceWriter.h b/plugins/codec_mp3/ID3_QIODeviceWriter.h index ea30a15f..53e21177 100644 --- a/plugins/codec_mp3/ID3_QIODeviceWriter.h +++ b/plugins/codec_mp3/ID3_QIODeviceWriter.h @@ -1,90 +1,93 @@ /************************************************************************* ID3_QIODeviceWriter.h - Adapter between QIODevice and ID3_Writer ------------------- 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 ID3_QIODEVICE_WRITER_H #define ID3_QIODEVICE_WRITER_H #include "config.h" #include #include class QIODevice; namespace Kwave { /** * @class ID3_QIODeviceWriter * Adapter between QIODevice and ID3_Writer */ class ID3_QIODeviceWriter: public ID3_Writer { public: /** Constructor */ explicit ID3_QIODeviceWriter(QIODevice &dest); /** Destructor */ virtual ~ID3_QIODeviceWriter(); /** Close the destination. Not implemented. */ - virtual void close(); + virtual void close() Q_DECL_OVERRIDE; /** Flush the destination, not implemented (not needed) */ - virtual void flush(); + virtual void flush() Q_DECL_OVERRIDE; /** Get the start position, always zero */ - virtual ID3_Writer::pos_type getBeg(); + virtual ID3_Writer::pos_type getBeg() Q_DECL_OVERRIDE; /** Get the end position, identical to size()-1 */ - virtual ID3_Writer::pos_type getEnd(); + virtual ID3_Writer::pos_type getEnd() Q_DECL_OVERRIDE; /** Returns the current position */ - virtual ID3_Writer::pos_type getCur(); + virtual ID3_Writer::pos_type getCur() Q_DECL_OVERRIDE; /** Returns the number of bytes written */ - virtual ID3_Writer::size_type getSize(); + virtual ID3_Writer::size_type getSize() Q_DECL_OVERRIDE; /** Returns the maximum number of bytes written */ - virtual ID3_Writer::size_type getMaxSize(); + virtual ID3_Writer::size_type getMaxSize() Q_DECL_OVERRIDE; /** * Write up to len characters into buf and advance the internal position * accordingly. */ virtual ID3_Writer::size_type writeChars( - const ID3_Writer::char_type buf[], ID3_Writer::size_type len); + const ID3_Writer::char_type buf[], ID3_Writer::size_type len) + Q_DECL_OVERRIDE; + virtual ID3_Writer::size_type writeChars( - const char buf[], ID3_Writer::size_type len); + const char buf[], ID3_Writer::size_type len) + Q_DECL_OVERRIDE; /** returns true if the writer has readed eof (always false) */ - virtual bool atEnd(); + virtual bool atEnd() Q_DECL_OVERRIDE; private: /** reference to a QIODevice that is used as destination */ QIODevice &m_dest; /** number of bytes written */ ID3_Writer::size_type m_written; }; } #endif /* ID3_QIODEVICE_WRITER_H */ //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_mp3/MP3CodecPlugin.h b/plugins/codec_mp3/MP3CodecPlugin.h index 4f7e27af..57912222 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); + virtual void load(QStringList ¶ms) Q_DECL_OVERRIDE; /** * 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); + virtual QStringList *setup(QStringList &previous_params) Q_DECL_OVERRIDE; /** Creates a new decoder */ - virtual QList createDecoder(); + virtual QList createDecoder() Q_DECL_OVERRIDE; /** Creates a new encoder */ - virtual QList createEncoder(); + virtual QList createEncoder() Q_DECL_OVERRIDE; 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_mp3/MP3Decoder.h b/plugins/codec_mp3/MP3Decoder.h index 35b54543..03452eee 100644 --- a/plugins/codec_mp3/MP3Decoder.h +++ b/plugins/codec_mp3/MP3Decoder.h @@ -1,138 +1,139 @@ /************************************************************************* MP3Decoder.h - decoder for MP3 data ------------------- begin : Wed Aug 07 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 MP3_DECODER_H #define MP3_DECODER_H #include "config.h" #include // needs libmad-devel package #include #include #include "libkwave/Decoder.h" #include "libkwave/FileInfo.h" #include "ID3_PropertyMap.h" class ID3_Frame; class ID3_Tag; class QWidget; namespace Kwave { class MP3Decoder: public Kwave::Decoder { public: /** Constructor */ MP3Decoder(); /** Destructor */ virtual ~MP3Decoder(); /** Returns a new instance of the decoder */ - virtual Kwave::Decoder *instance(); + virtual Kwave::Decoder *instance() Q_DECL_OVERRIDE; /** * Opens the source and decodes the header information. * @param widget a widget that can be used for displaying * message boxes or dialogs * @param source file or other source with a stream of bytes * @return true if succeeded, false on errors */ - virtual bool open(QWidget *widget, QIODevice &source); + virtual bool open(QWidget *widget, QIODevice &source) Q_DECL_OVERRIDE; /** * Decodes a stream of bytes into a MultiWriter * @param widget a widget that can be used for displaying * message boxes or dialogs * @param dst MultiWriter that receives the audio data * @return true if succeeded, false on errors */ - virtual bool decode(QWidget *widget, Kwave::MultiWriter &dst); + virtual bool decode(QWidget *widget, Kwave::MultiWriter &dst) + Q_DECL_OVERRIDE; /** * Closes the source. */ - virtual void close(); + virtual void close() Q_DECL_OVERRIDE; /** Callback for filling libmad's input buffer */ enum mad_flow fillInput(struct mad_stream *stream); /** Calback for processing libmad's output */ enum mad_flow processOutput(void *data, struct mad_header const *header, struct mad_pcm *pcm); /** Callback for handling stream errors */ enum mad_flow handleError(void *data, struct mad_stream *stream, struct mad_frame *frame); private: /** parse MP3 headers */ bool parseMp3Header(const Mp3_Headerinfo &header, QWidget *widget); /** parse all known ID3 tags */ bool parseID3Tags(ID3_Tag &tag); /** * parse a ID3 frame into a string * @param frame a ID3 frame * @return QString with the content */ QString parseId3Frame2String(const ID3_Frame *frame); private: /** property - to - ID3 mapping */ ID3_PropertyMap m_property_map; /** source of the raw mp3 data */ QIODevice *m_source; /** destination of the audio data */ Kwave::MultiWriter *m_dest; /** buffer for libmad */ unsigned char *m_buffer; /** size of m_buffer in bytes */ int m_buffer_size; /** number of prepended bytes / id3v2 tag */ size_t m_prepended_bytes; /** number of appended bytes / id3v1 tag */ size_t m_appended_bytes; /** number of failures */ unsigned int m_failures; /** widget used for displaying error messages */ QWidget *m_parent_widget; }; } #endif /* MP3_DECODER_H */ //*************************************************************************** //*************************************************************************** diff --git a/plugins/codec_mp3/MP3Encoder.h b/plugins/codec_mp3/MP3Encoder.h index e08c16f5..07e3f93f 100644 --- a/plugins/codec_mp3/MP3Encoder.h +++ b/plugins/codec_mp3/MP3Encoder.h @@ -1,127 +1,129 @@ /************************************************************************* MP3Encoder.h - export of MP3 data via "lame" ------------------- begin : Sat May 19 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_ENCODER_H #define MP3_ENCODER_H #include "config.h" #include #include #include #include #include "libkwave/Encoder.h" #include "ID3_PropertyMap.h" class ID3_Tag; class QIODevice; class QWidget; namespace Kwave { class MultiTrackReader; class MP3Encoder: public Kwave::Encoder { Q_OBJECT public: /** Constructor */ MP3Encoder(); /** Destructor */ virtual ~MP3Encoder(); /** Returns a new instance of the encoder */ - virtual Kwave::Encoder *instance(); + virtual Kwave::Encoder *instance() Q_DECL_OVERRIDE; /** * Encodes a signal into a stream of bytes. * @param widget a widget that can be used for displaying * message boxes or dialogs * @param src MultiTrackReader used as source of the audio data * @param dst file or other source to receive a stream of bytes * @param meta_data meta data of the file to save * @return true if succeeded, false on errors */ virtual bool encode(QWidget *widget, Kwave::MultiTrackReader &src, QIODevice &dst, - const Kwave::MetaDataList &meta_data); + const Kwave::MetaDataList &meta_data) + Q_DECL_OVERRIDE; /** Returns a list of supported file properties */ - virtual QList supportedProperties(); + virtual QList supportedProperties() + Q_DECL_OVERRIDE; private slots: /** called when data from the external process is available */ void dataAvailable(); private: /** * encode all meta data into ID3 tags * @param meta_data reference to the meta data to encode * @param tag the ID3 tag to receive the ID3 frames */ void encodeID3Tags(const Kwave::MetaDataList &meta_data, ID3_Tag &tag); private: /** property - to - ID3 mapping */ ID3_PropertyMap m_property_map; /** lock for protecting m_dst and m_process */ QMutex m_lock; /** pointer to the QIODevice for storing, used while encoding */ QIODevice *m_dst; /** the external process with the encoder */ QProcess m_process; /** path to the external program */ QString m_program; /** list with commandline parameters */ QStringList m_params; /** * buffer for writing to the encoder * @note The size of this buffer should never be bigger than * PIPE_BUF (see POSIX.1-2001), otherwise there could be some * leftover when writing to the stdin queue of the process * which would be caught and queued up within Qt. * After some time that leads to a critically increasing memory * consumption and a large delay when the progress bar has * reached 99%. */ quint8 m_write_buffer[PIPE_BUF]; /** buffer for reading from the encoder (size is not critical) */ char m_read_buffer[PIPE_BUF]; }; } #endif /* MP3_ENCODER_H */ //*************************************************************************** //***************************************************************************