mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
AacDecoder is now compiling under OS X
This commit is contained in:
parent
ae82180470
commit
5d92761bda
@ -51,6 +51,7 @@ include_directories (
|
|||||||
add_subdirectory(src/core)
|
add_subdirectory(src/core)
|
||||||
add_subdirectory(src/musikbox)
|
add_subdirectory(src/musikbox)
|
||||||
add_subdirectory(src/contrib/taglib_plugin)
|
add_subdirectory(src/contrib/taglib_plugin)
|
||||||
|
add_subdirectory(src/contrib/aacdecoder)
|
||||||
add_subdirectory(src/contrib/oggdecoder)
|
add_subdirectory(src/contrib/oggdecoder)
|
||||||
add_subdirectory(src/contrib/mpg123decoder)
|
add_subdirectory(src/contrib/mpg123decoder)
|
||||||
add_subdirectory(src/contrib/flacdecoder)
|
add_subdirectory(src/contrib/flacdecoder)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "AacDecoder.h"
|
#include "AacDecoder.h"
|
||||||
#include <io.h>
|
|
||||||
|
|
||||||
using musik::core::io::IDataStream;
|
using musik::core::io::IDataStream;
|
||||||
using musik::core::audio::IBuffer;
|
using musik::core::audio::IBuffer;
|
||||||
@ -85,16 +84,16 @@ bool AacDecoder::Open(musik::core::io::IDataStream *stream)
|
|||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
buffer_size = 0;
|
buffer_size = 0;
|
||||||
mp4ff_get_decoder_config(decoderFile, audioTrackId, &buffer, &buffer_size);
|
mp4ff_get_decoder_config(decoderFile, audioTrackId, &buffer, &buffer_size);
|
||||||
|
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NeAACDecInit2(
|
if (NeAACDecInit2(
|
||||||
decoder,
|
decoder,
|
||||||
buffer,
|
buffer,
|
||||||
buffer_size,
|
buffer_size,
|
||||||
&this->sampleRate,
|
&this->sampleRate,
|
||||||
&this->channelCount) < 0)
|
&this->channelCount) < 0)
|
||||||
{
|
{
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
@ -158,11 +157,11 @@ bool AacDecoder::GetBuffer(IBuffer* target) {
|
|||||||
|
|
||||||
/* read the raw data required */
|
/* read the raw data required */
|
||||||
|
|
||||||
int rc =
|
int rc =
|
||||||
mp4ff_read_sample(
|
mp4ff_read_sample(
|
||||||
decoderFile,
|
decoderFile,
|
||||||
audioTrackId,
|
audioTrackId,
|
||||||
decoderSampleId,
|
decoderSampleId,
|
||||||
&encodedData,
|
&encodedData,
|
||||||
&encodedDataLength);
|
&encodedDataLength);
|
||||||
|
|
||||||
@ -170,9 +169,9 @@ bool AacDecoder::GetBuffer(IBuffer* target) {
|
|||||||
|
|
||||||
if (rc == 0 || encodedData == NULL) {
|
if (rc == 0 || encodedData == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sampleBuffer =
|
sampleBuffer =
|
||||||
NeAACDecDecode(
|
NeAACDecDecode(
|
||||||
decoder,
|
decoder,
|
||||||
&frameInfo,
|
&frameInfo,
|
||||||
@ -192,7 +191,7 @@ bool AacDecoder::GetBuffer(IBuffer* target) {
|
|||||||
target->SetSampleRate(frameInfo.samplerate);
|
target->SetSampleRate(frameInfo.samplerate);
|
||||||
target->SetChannels(frameInfo.channels);
|
target->SetChannels(frameInfo.channels);
|
||||||
target->SetSamples(frameInfo.samples / frameInfo.channels);
|
target->SetSamples(frameInfo.samples / frameInfo.channels);
|
||||||
|
|
||||||
memcpy(
|
memcpy(
|
||||||
static_cast<void*>(target->BufferPointer()),
|
static_cast<void*>(target->BufferPointer()),
|
||||||
static_cast<void*>(sampleBuffer),
|
static_cast<void*>(sampleBuffer),
|
||||||
|
@ -1,33 +1,21 @@
|
|||||||
set ( aacdecoder_SOURCES
|
set (aacdecoder_SOURCES
|
||||||
aacdecoder_plugin.cpp
|
aacdecoder_plugin.cpp
|
||||||
AACSourceSupplier.cpp
|
AacDecoderFactory.cpp
|
||||||
stdafx.cpp
|
AacDecoder.cpp
|
||||||
drms.c
|
stdafx.cpp
|
||||||
m4aAudioSource.cpp
|
drms/drms.c
|
||||||
mp4atom.c
|
mp4ff/mp4atom.c
|
||||||
mp4ff.c
|
mp4ff/mp4ff.c
|
||||||
mp4meta.c
|
mp4ff/mp4meta.c
|
||||||
mp4sample.c
|
mp4ff/mp4sample.c
|
||||||
mp4tagupdate.c
|
mp4ff/mp4tagupdate.c
|
||||||
mp4util.c
|
mp4ff/mp4util.c
|
||||||
)
|
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
||||||
add_definitions(-DWIN32)
|
|
||||||
if(NOT DEFINED MINGW)
|
|
||||||
|
|
||||||
endif(NOT DEFINED MINGW)
|
|
||||||
else(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
||||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fpermissive)
|
|
||||||
endif(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
||||||
|
|
||||||
add_definitions(
|
|
||||||
-DXML_STATIC
|
|
||||||
-D_CRT_SECURE_NO_DEPRECATE
|
|
||||||
-D_DEBUG
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library( aacdecoder SHARED ${aacdecoder_SOURCES} )
|
include_directories(
|
||||||
target_link_libraries( aacdecoder ${musikCube_LINK_LIBS})
|
"${CMAKE_CURRENT_SOURCE_DIR}/drms"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/mp4ff"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(aacdecoder SHARED ${aacdecoder_SOURCES})
|
||||||
|
target_link_libraries(aacdecoder ${musikbox_LINK_LIBS} faad)
|
||||||
|
@ -606,7 +606,7 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\accdecoder_plugin.cpp"
|
RelativePath=".\aacdecoder_plugin.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
@ -155,7 +155,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="AacDecoderFactory.cpp" />
|
<ClCompile Include="AacDecoderFactory.cpp" />
|
||||||
<ClCompile Include="accdecoder_plugin.cpp" />
|
<ClCompile Include="aacdecoder_plugin.cpp" />
|
||||||
<ClCompile Include="libfaad\bits.c" />
|
<ClCompile Include="libfaad\bits.c" />
|
||||||
<ClCompile Include="libfaad\cfft.c" />
|
<ClCompile Include="libfaad\cfft.c" />
|
||||||
<ClCompile Include="libfaad\common.c" />
|
<ClCompile Include="libfaad\common.c" />
|
||||||
@ -206,4 +206,4 @@
|
|||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -219,7 +219,7 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="accdecoder_plugin.cpp">
|
<ClCompile Include="aacdecoder_plugin.cpp">
|
||||||
<Filter>plugin</Filter>
|
<Filter>plugin</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
@ -364,4 +364,4 @@
|
|||||||
<Filter>plugin</Filter>
|
<Filter>plugin</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,68 +1,68 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// License Agreement:
|
// License Agreement:
|
||||||
//
|
//
|
||||||
// The following are Copyright © 2008, Björn Olievier
|
// The following are Copyright © 2008, Björn Olievier
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
//
|
//
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
//
|
//
|
||||||
// * Redistributions in binary form must reproduce the above copyright
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
// notice, this list of conditions and the following disclaimer in the
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
// documentation and/or other materials provided with the distribution.
|
// documentation and/or other materials provided with the distribution.
|
||||||
//
|
//
|
||||||
// * Neither the name of the author nor the names of other contributors may
|
// * Neither the name of the author nor the names of other contributors may
|
||||||
// be used to endorse or promote products derived from this software
|
// be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include "AacDecoderFactory.h"
|
#include "AacDecoderFactory.h"
|
||||||
#include <core/sdk/IPlugin.h>
|
#include <core/sdk/IPlugin.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define DLLEXPORT __declspec(dllexport)
|
#define DLLEXPORT __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define DLLEXPORT
|
#define DLLEXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class AacDecoderPlugin : public musik::core::IPlugin {
|
class AacDecoderPlugin : public musik::core::IPlugin {
|
||||||
public:
|
public:
|
||||||
virtual void Destroy() { delete this; };
|
virtual void Destroy() { delete this; };
|
||||||
virtual const char* Name() { return "AAC IDecoder"; };
|
virtual const char* Name() { return "AAC IDecoder"; };
|
||||||
virtual const char* Version() { return "0.2"; };
|
virtual const char* Version() { return "0.2"; };
|
||||||
virtual const char* Author() { return "Björn Olievier, clangen"; };
|
virtual const char* Author() { return "Björn Olievier, clangen"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" DLLEXPORT musik::core::IPlugin* GetPlugin() {
|
extern "C" DLLEXPORT musik::core::IPlugin* GetPlugin() {
|
||||||
return new AacDecoderPlugin();
|
return new AacDecoderPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" DLLEXPORT musik::core::audio::IDecoderFactory* GetDecoderFactory() {
|
extern "C" DLLEXPORT musik::core::audio::IDecoderFactory* GetDecoderFactory() {
|
||||||
return new AacDecoderFactory();
|
return new AacDecoderFactory();
|
||||||
}
|
}
|
0
src/contrib/aacdecoder/drms/config.h
Normal file
0
src/contrib/aacdecoder/drms/config.h
Normal file
0
src/contrib/aacdecoder/mp4ff/config.h
Normal file
0
src/contrib/aacdecoder/mp4ff/config.h
Normal file
Loading…
Reference in New Issue
Block a user