OSDN Git Service

Set creation/modified time of the encoded file the same value as the original file...
[lamexp/LameXP.git] / src / Encoder_Abstract.h
index 7e0d35a..188d573 100644 (file)
@@ -1,11 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
 // LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@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.
+// (at your option) any later version, but always including the *additional*
+// restrictions defined in the "License.txt" file.
 //
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 #pragma once
 
+//Internal
+#include "Global.h"
 #include "Tool_Abstract.h"
 #include "Model_AudioFile.h"
 
+//MUtils
+#include <MUtils/Exception.h>
+
 class QProcess;
 class QStringList;
 class QMutex;
@@ -35,16 +41,19 @@ public:
        {
                TYPE_BITRATE = 0,
                TYPE_APPROX_BITRATE = 1,
-               TYPE_QUALITY_LEVEL = 2,
-               TYPE_COMPRESSION_LEVEL = 3,
-               TYPE_UNCOMPRESSED = 4
+               TYPE_QUALITY_LEVEL_INT = 2,
+               TYPE_QUALITY_LEVEL_FLT = 3,
+               TYPE_COMPRESSION_LEVEL = 4,
+               TYPE_UNCOMPRESSED = 5
        }
        value_type_t;
 
-       virtual bool isModeSupported(int mode) const = 0;       //Returns whether the encoder does support the current RC mode
-       virtual int valueCount(int mode) const = 0;                     //The number of bitrate/quality values for current RC mode
+       virtual bool isModeSupported(int mode)   const = 0;     //Returns whether the encoder does support the current RC mode
+       virtual int valueCount(int mode)         const = 0;     //The number of bitrate/quality values for current RC mode
        virtual int valueAt(int mode, int index) const = 0;     //The bitrate/quality value at 'index' for the current RC mode
-       virtual int valueType(int mode) const = 0;                      //The display type of the values for the current RC mode
+       virtual int valueType(int mode)          const = 0;     //The display type of the values for the current RC mode
+       virtual const char* description(void)    const = 0;     //Description of the encoder that can be displayed to the user
+       virtual const char* extension(void)      const = 0;     //The default file extension for files created by this encoder
 };
 
 class AbstractEncoder : public AbstractTool
@@ -56,9 +65,8 @@ public:
        virtual ~AbstractEncoder(void);
 
        //Internal encoder API
-       virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag) = 0;
+       virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag) = 0;
        virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) = 0;
-       virtual QString extension(void) = 0;
        virtual const unsigned int *supportedSamplerates(void);
        virtual const unsigned int *supportedChannelCount(void);
        virtual const unsigned int *supportedBitdepths(void);
@@ -70,9 +78,10 @@ public:
        virtual void setCustomParams(const QString &customParams);
 
        //Encoder info
+       virtual const AbstractEncoderInfo *toEncoderInfo(void) const = 0;
        static const AbstractEncoderInfo *getEncoderInfo(void)
        {
-               throw "This method is supposed to be re-implemented in derived classes!";
+               MUTILS_THROW("This method shall be re-implemented in derived classes!");
                return NULL;
        }