Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] AAC/HE-AAC encoder (powered by libfdk-aac) #1387

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ addons:
- scons
- qtkeychain-dev
- liblilv-dev
- libfdk-aac-dev
before_install:
# Virtual X, needed for analyzer waveform tests
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DISPLAY=:99.0 ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh -e /etc/init.d/xvfb start ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install scons portaudio libsndfile libogg libvorbis portmidi taglib libshout protobuf flac ffmpeg qt chromaprint rubberband libmodplug libid3tag libmad mp4v2 faad2 wavpack opusfile lilv lame sound-touch; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install scons portaudio libsndfile libogg libvorbis portmidi taglib libshout protobuf flac ffmpeg qt chromaprint rubberband libmodplug libid3tag libmad mp4v2 faad2 wavpack opusfile lilv lame sound-touch fdk-aac; fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this, because we dynamic load the library.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have tests that exercise AAC encoding? won't those fail w/o the library being installed?


install:
####
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ for:

install:
- sudo apt-get update
- sudo apt-get -y install gdb libavformat-dev libchromaprint-dev libfaad-dev libflac-dev libid3tag0-dev libmad0-dev libmodplug-dev libmp3lame-dev libmp4v2-dev libopus-dev libopusfile-dev libportmidi-dev libprotobuf-dev libqt5opengl5-dev libqt5sql5-sqlite libqt5svg5-dev librubberband-dev libshout3-dev libsndfile1-dev libsqlite3-dev libtag1-dev libupower-glib-dev libusb-1.0-0-dev libwavpack-dev portaudio19-dev protobuf-compiler qt5-default qtscript5-dev libqt5x11extras5-dev scons qtkeychain-dev liblilv-dev libsoundtouch-dev
- sudo apt-get -y install gdb libavformat-dev libchromaprint-dev libfaad-dev libflac-dev libid3tag0-dev libmad0-dev libmodplug-dev libmp3lame-dev libmp4v2-dev libopus-dev libopusfile-dev libportmidi-dev libprotobuf-dev libqt5opengl5-dev libqt5sql5-sqlite libqt5svg5-dev librubberband-dev libshout3-dev libsndfile1-dev libsqlite3-dev libtag1-dev libupower-glib-dev libusb-1.0-0-dev libwavpack-dev portaudio19-dev protobuf-compiler qt5-default qtscript5-dev libqt5x11extras5-dev scons qtkeychain-dev liblilv-dev libsoundtouch-dev libfdk-aac-dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this, because we dynamic load the library.


build_script:
- scons -j4 test=1 mad=1 faad=1 ffmpeg=1 opus=1 modplug=1 wv=1 hss1394=0 virtualize=0 debug_assertions_fatal=1 verbose=0 localecompare=1
Expand Down
9 changes: 8 additions & 1 deletion build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,11 @@ def configure(self, build, conf):
if not conf.CheckLib(['libmp3lame', 'libmp3lame-static']):
raise Exception("Could not find libmp3lame.")

class FdkAac(Dependence):
def configure(self, build, conf):
if not conf.CheckLib(['libfdk-aac']):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be removed. It would be required without our dynamic loading code.

raise Exception("Could not find libfdk-aac.")

class MixxxCore(Feature):

def description(self):
Expand Down Expand Up @@ -1174,6 +1179,8 @@ def sources(self, build):
"src/encoder/encoderwave.cpp",
"src/encoder/encoderwavesettings.cpp",
'src/encoder/encoderopussettings.cpp',
"src/encoder/encoderfdkaac.cpp"
"src/encoder/encoderfdkaacsettings.cpp",

"src/util/sleepableqthread.cpp",
"src/util/statsmanager.cpp",
Expand Down Expand Up @@ -1507,7 +1514,7 @@ def depends(self, build):
FidLib, SndFile, FLAC, OggVorbis, OpenGL, TagLib, ProtoBuf,
Chromaprint, RubberBand, SecurityFramework, CoreServices, IOKit,
QtScriptByteArray, Reverb, FpClassify, PortAudioRingBuffer, LAME,
QueenMaryDsp]
QueenMaryDsp, FdkAac]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed.


def post_dependency_check_configure(self, build, conf):
"""Sets up additional things in the Environment that must happen
Expand Down
Binary file added lib/libshout_2.3.1-3aac1.debian.tar.xz
Binary file not shown.
3 changes: 3 additions & 0 deletions src/broadcast/defs_broadcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#define BROADCAST_FORMAT_MP3 "MP3"
#define BROADCAST_FORMAT_OV "OggVorbis"
#define BROADCAST_FORMAT_OPUS "Opus"
#define BROADCAST_FORMAT_AAC "AAC"
#define BROADCAST_FORMAT_HEAAC "HEAAC"
#define BROADCAST_FORMAT_HEAACV2 "HEAACV2"

// EngineNetworkStream can't use locking mechanisms to protect its
// internal worker list against concurrency issues, as it is used by
Expand Down
16 changes: 15 additions & 1 deletion src/encoder/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
#endif
#include "encoder/encoderopussettings.h"

#include "encoder/encoderfdkaac.h"
#include "encoder/encoderfdkaacsettings.h"

#include <QList>

EncoderFactory EncoderFactory::factory;
Expand All @@ -49,10 +52,12 @@ EncoderFactory::EncoderFactory() {
m_formats.append(Encoder::Format("FLAC", ENCODING_FLAC, true));
m_formats.append(Encoder::Format("MP3", ENCODING_MP3, false));
m_formats.append(Encoder::Format("OGG Vorbis", ENCODING_OGG, false));

#ifdef __OPUS__
m_formats.append(Encoder::Format("Opus", ENCODING_OPUS, false));
#endif
m_formats.append(Encoder::Format("AAC",ENCODING_AAC, false, "m4a"));
m_formats.append(Encoder::Format("HE-AAC",ENCODING_HEAAC, false, "m4a"));
m_formats.append(Encoder::Format("HE-AACv2",ENCODING_HEAACV2, false, "m4a"));
}

const QList<Encoder::Format> EncoderFactory::getFormats() const
Expand Down Expand Up @@ -116,6 +121,11 @@ EncoderPointer EncoderFactory::getNewEncoder(Encoder::Format format,
pEncoder->setEncoderSettings(EncoderOpusSettings(pConfig));
}
#endif
} else if (format.internalName == ENCODING_AAC ||
format.internalName == ENCODING_HEAAC ||
format.internalName == ENCODING_HEAACV2) {
pEncoder = std::make_shared<EncoderFdkAac>(pCallback, format.internalName);
pEncoder->setEncoderSettings(EncoderFdkAacSettings(pConfig));
else {
qWarning() << "Unsupported format requested! " << format.internalName;
DEBUG_ASSERT(false);
Expand All @@ -140,6 +150,10 @@ EncoderSettingsPointer EncoderFactory::getEncoderSettings(Encoder::Format format
return std::make_shared<EncoderVorbisSettings>(pConfig);
} else if (format.internalName == ENCODING_OPUS) {
return std::make_shared<EncoderOpusSettings>(pConfig);
} else if (format.internalName == ENCODING_AAC ||
format.internalName == ENCODING_HEAAC ||
format.internalName == ENCODING_HEAACV2) {
return std::make_shared<EncoderFdkAacSettings>(pConfig);
} else {
qWarning() << "Unsupported format requested! " << format.internalName;
DEBUG_ASSERT(false);
Expand Down
11 changes: 9 additions & 2 deletions src/encoder/encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ class Encoder {
public:
class Format {
public:
Format(QString labelIn, QString nameIn, bool losslessIn) :
label(labelIn), internalName(nameIn), lossless(losslessIn) {}
Format(QString labelIn, QString nameIn, bool losslessIn,
QString fileExtIn = QString::null) :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be simpler to use QString() instead of QString::null

label(labelIn), internalName(nameIn), lossless(losslessIn),
fileExtension(fileExtIn){
if(fileExtension == QString::null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use .isEmpty() instead of == QString::null

fileExtension = label;
}
}
QString label;
QString internalName;
bool lossless;
QString fileExtension;
};

Encoder() {}
Expand Down
Loading