1. Ivan Andrianov
  2. fftranscoder

Commits

Ivan Andrianov  committed 3794946

Fixed Lame encoder to be consistent with library changes.

  • Participants
  • Parent commits 440aaa1
  • Branches devel

Comments (0)

Files changed (5)

File src/codecs/plugins/lameencoder/CMakeLists.txt

View file
  • Ignore whitespace
   #lameencoderplugin.cpp
 )
 
-set(Lame_ENCODER_MOC_SRCS
-  lameencoderplugin.h
-)
-
-qt4_wrap_cpp(Lame_ENCODER_SRCS_CXX ${Lame_ENCODER_MOC_SRCS})
-
 add_library(lame_encoder MODULE ${Lame_ENCODER_SRCS_CXX})
 
 target_link_libraries(lame_encoder fftranscoder_codecs ${QT_QTCORE_LIBRARY}

File src/codecs/plugins/lameencoder/lameencoder.cpp

View file
  • Ignore whitespace
  */
 
 #include "lameencoder.h"
-#include "lameencoder_p.h"
+
+#include <lame/lame.h>
 
 #include <codecs/frame.h>
 
+class LameEncoder::Private
+{
+    Q_DISABLE_COPY(LameEncoder::Private)
+
+public:
+    Private();
+    ~Private();
+
+    void initValues();
+
+    bool createEncoder();
+    bool createMetaData();
+    bool initEncoder();
+
+    bool writeTag(const char * tagName, const char * tagValue);
+    bool writeStringTag(const char * tagName, const QString & tagValue);
+    bool writeIntTag(const char * tagName, uint tagValue);
+    bool writeArtistName();
+    bool writeAlbumName();
+    bool writeYear();
+    bool writeTrackName();
+    bool writeTrackNumber();
+
+    QString fileName;
+
+    StreamInfo streamInfo;
+    TagBlock tagBlock;
+    uint quality;
+
+    lame_global_flags * encoder;
+    // XXX metadata
+
+    bool isMetaDataWritten;
+    bool isMetaDataWrittenSuccessfully;
+};
+
 LameEncoder::LameEncoder(const QString & fileName) :
-        d(new LameEncoderPrivate())
+        d(new LameEncoder::Private())
 {
     d->fileName = fileName;
     d->initValues();
     return false;
 }
 
-LameEncoderPrivate::LameEncoderPrivate()
+LameEncoder::Private::Private()
 {
 }
 
-LameEncoderPrivate::~LameEncoderPrivate()
+LameEncoder::Private::~Private()
 {
 }
 
-void LameEncoderPrivate::initValues()
+void LameEncoder::Private::initValues()
 {
     streamInfo = StreamInfo(2, 44100, 2);
 
     isMetaDataWrittenSuccessfully = false;
 }
 
-bool LameEncoderPrivate::createEncoder()
+bool LameEncoder::Private::createEncoder()
 {
     encoder = lame_init();
     return encoder && lame_set_in_samplerate(encoder, streamInfo.sampleRate())
             && lame_set_quality(encoder, 7 - quality);
 }
 
-bool LameEncoderPrivate::createMetaData()
+bool LameEncoder::Private::createMetaData()
 {
     // TODO metaData = Lame__metadata_object_new(Lame__METADATA_TYPE_VORBIS_COMMENT);
     //return metaData && writeArtistName() && writeAlbumName() && writeYear()
     return true;
 }
 
-bool LameEncoderPrivate::initEncoder()
+bool LameEncoder::Private::initEncoder()
 {
     return lame_init_params(encoder) != -1;
 }
 
-bool LameEncoderPrivate::writeTag(const char * tagName, const char * tagValue)
+bool LameEncoder::Private::writeTag(const char * tagName, const char * tagValue)
 {
     // TODO Lame__StreamMetadata_VorbisComment_Entry entry;
     //return Lame__metadata_object_vorbiscomment_entry_from_name_value_pair(
     return true;
 }
 
-bool LameEncoderPrivate::writeStringTag(const char * tagName,
+bool LameEncoder::Private::writeStringTag(const char * tagName,
         const QString & tagValue)
 {
     if(!tagValue.isEmpty())
     return true;
 }
 
-bool LameEncoderPrivate::writeIntTag(const char * tagName, uint tagValue)
+bool LameEncoder::Private::writeIntTag(const char * tagName, uint tagValue)
 {
     if(tagValue > 0)
     {
     return true;
 }
 
-bool LameEncoderPrivate::writeArtistName()
+bool LameEncoder::Private::writeArtistName()
 {
     return writeStringTag("ARTIST", tagBlock.artistName());
 }
 
-bool LameEncoderPrivate::writeAlbumName()
+bool LameEncoder::Private::writeAlbumName()
 {
     return writeStringTag("ALBUM", tagBlock.albumName());
 }
 
-bool LameEncoderPrivate::writeYear()
+bool LameEncoder::Private::writeYear()
 {
     return writeIntTag("DATE", tagBlock.year());
 }
 
-bool LameEncoderPrivate::writeTrackName()
+bool LameEncoder::Private::writeTrackName()
 {
     return writeStringTag("TITLE", tagBlock.trackName());
 }
 
-bool LameEncoderPrivate::writeTrackNumber()
+bool LameEncoder::Private::writeTrackNumber()
 {
     return writeIntTag("TRACKNUMBER", tagBlock.trackNumber());
 }

File src/codecs/plugins/lameencoder/lameencoder.h

View file
  • Ignore whitespace
 #ifndef LAMEENCODER_H
 #define LAMEENCODER_H
 
-#include <QString>
-#include <QScopedPointer>
+#include <QtCore/QString>
+#include <QtCore/QScopedPointer>
 
 #include <codecs/encoder.h>
 #include <codecs/streaminfo.h>
 }
 }
 
-class LameEncoderPrivate;
-
 using FFTranscoder::Codecs::Encoder;
 using FFTranscoder::Codecs::Frame;
 using FFTranscoder::Codecs::StreamInfo;
     virtual bool flush();
 
 private:
-    QScopedPointer<LameEncoderPrivate> d;
+    class Private;
+    QScopedPointer<Private> d;
 };
 
 #endif // LAMEENCODER_H

File src/codecs/plugins/lameencoder/lameencoder_p.h

  • Ignore whitespace
-/*
- * Copyright (C) 2012 by Ivan Andrianov
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef LAMEENCODER_P_H
-#define LAMEENCODER_P_H
-
-#include <QString>
-
-#include <lame/lame.h>
-
-#include <codecs/streaminfo.h>
-#include <codecs/tagblock.h>
-
-using FFTranscoder::Codecs::TagBlock;
-
-class LameEncoder;
-
-class LameEncoderPrivate
-{
-    Q_DISABLE_COPY(LameEncoderPrivate)
-
-public:
-    LameEncoderPrivate();
-    ~LameEncoderPrivate();
-
-    void initValues();
-
-    bool createEncoder();
-    bool createMetaData();
-    bool initEncoder();
-
-    bool writeTag(const char * tagName, const char * tagValue);
-    bool writeStringTag(const char * tagName, const QString & tagValue);
-    bool writeIntTag(const char * tagName, uint tagValue);
-    bool writeArtistName();
-    bool writeAlbumName();
-    bool writeYear();
-    bool writeTrackName();
-    bool writeTrackNumber();
-
-    QString fileName;
-
-    StreamInfo streamInfo;
-    TagBlock tagBlock;
-    uint quality;
-
-    lame_global_flags * encoder;
-    // XXX metadata
-
-    bool isMetaDataWritten;
-    bool isMetaDataWrittenSuccessfully;
-};
-
-#endif // LAMEENCODER_P_H

File src/codecs/plugins/lameencoder/lameencoderplugin.h

View file
  • Ignore whitespace
 #ifndef LAMEENCODERPLUGIN_H
 #define LAMEENCODERPLUGIN_H
 
-#include <QString>
-#include <QObject>
+#include <QtCore/QString>
+#include <QtCore/QObject>
 
 #include <codecs/encoderplugin.h>