mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Renamed "aacdecoder" to "m4adecoder", because that's what it actually
ised. Updated makefiles accordingly.
This commit is contained in:
parent
4193eeb308
commit
d9bab19393
@ -51,7 +51,7 @@ include_directories (
|
||||
add_subdirectory(src/core)
|
||||
add_subdirectory(src/musikbox)
|
||||
add_subdirectory(src/contrib/taglib_plugin)
|
||||
add_subdirectory(src/contrib/aacdecoder)
|
||||
add_subdirectory(src/contrib/m4adecoder)
|
||||
add_subdirectory(src/contrib/oggdecoder)
|
||||
add_subdirectory(src/contrib/mpg123decoder)
|
||||
add_subdirectory(src/contrib/flacdecoder)
|
||||
|
@ -20,7 +20,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flacdecoder", "src\contrib\
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpg123decoder", "src\contrib\mpg123decoder\mpg123decoder.vcxproj", "{04118CC2-DE10-4627-A695-2219428C7D59}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aacdecoder", "src\contrib\aacdecoder\aacdecoder.vcxproj", "{4993E68D-E97A-4CD2-AC8E-168AE315BAC5}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "m4adecoder", "src\contrib\m4adecoder\m4adecoder.vcxproj", "{4993E68D-E97A-4CD2-AC8E-168AE315BAC5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -1,253 +0,0 @@
|
||||
/*
|
||||
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
|
||||
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
**
|
||||
** Any non-GPL usage of this software or parts of this software is strictly
|
||||
** forbidden.
|
||||
**
|
||||
** Commercial non-GPL licensing of this software is possible.
|
||||
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
|
||||
**
|
||||
** $Id: neaacdec.h,v 1.2 2005/11/27 00:52:36 tonymillion Exp $
|
||||
**/
|
||||
|
||||
#ifndef __NEAACDEC_H__
|
||||
#define __NEAACDEC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#if 0
|
||||
/* MACROS FOR BACKWARDS COMPATIBILITY */
|
||||
/* structs */
|
||||
#define NeAACDecHandle faacDecHandle
|
||||
#define NeAACDecConfiguration faacDecConfiguration
|
||||
#define NeAACDecConfigurationPtr faacDecConfigurationPtr
|
||||
#define NeAACDecFrameInfo faacDecFrameInfo
|
||||
#define NeAACDecGetErrorMessage faacDecGetErrorMessage
|
||||
#define NeAACDecSetConfiguration faacDecSetConfiguration
|
||||
#define NeAACDecGetCurrentConfiguration faacDecGetCurrentConfiguration
|
||||
#define NeAACDecInit faacDecInit
|
||||
#define NeAACDecInit2 faacDecInit2
|
||||
#define NeAACDecInitDRM faacDecInitDRM
|
||||
#define NeAACDecPostSeekReset faacDecPostSeekReset
|
||||
#define NeAACDecOpen faacDecOpen
|
||||
#define NeAACDecClose faacDecClose
|
||||
#define NeAACDecDecode faacDecDecode
|
||||
#define NeAACDecAudioSpecificConfig AudioSpecificConfig
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma pack(push, 8)
|
||||
#ifndef NEAACDECAPI
|
||||
#define NEAACDECAPI __cdecl
|
||||
#endif
|
||||
#else
|
||||
#ifndef NEAACDECAPI
|
||||
#define NEAACDECAPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FAAD2_VERSION "2.1 beta"
|
||||
|
||||
/* object types for AAC */
|
||||
#define MAIN 1
|
||||
#define LC 2
|
||||
#define SSR 3
|
||||
#define LTP 4
|
||||
#define HE_AAC 5
|
||||
#define ER_LC 17
|
||||
#define ER_LTP 19
|
||||
#define LD 23
|
||||
#define DRM_ER_LC 27 /* special object type for DRM */
|
||||
|
||||
/* header types */
|
||||
#define RAW 0
|
||||
#define ADIF 1
|
||||
#define ADTS 2
|
||||
|
||||
/* SBR signalling */
|
||||
#define NO_SBR 0
|
||||
#define SBR_UPSAMPLED 1
|
||||
#define SBR_DOWNSAMPLED 2
|
||||
#define NO_SBR_UPSAMPLED 3
|
||||
|
||||
/* library output formats */
|
||||
#define FAAD_FMT_16BIT 1
|
||||
#define FAAD_FMT_24BIT 2
|
||||
#define FAAD_FMT_32BIT 3
|
||||
#define FAAD_FMT_FLOAT 4
|
||||
#define FAAD_FMT_FIXED FAAD_FMT_FLOAT
|
||||
#define FAAD_FMT_DOUBLE 5
|
||||
|
||||
/* Capabilities */
|
||||
#define LC_DEC_CAP (1<<0) /* Can decode LC */
|
||||
#define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */
|
||||
#define LTP_DEC_CAP (1<<2) /* Can decode LTP */
|
||||
#define LD_DEC_CAP (1<<3) /* Can decode LD */
|
||||
#define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
|
||||
#define FIXED_POINT_CAP (1<<5) /* Fixed point */
|
||||
|
||||
/* Channel definitions */
|
||||
#define FRONT_CHANNEL_CENTER (1)
|
||||
#define FRONT_CHANNEL_LEFT (2)
|
||||
#define FRONT_CHANNEL_RIGHT (3)
|
||||
#define SIDE_CHANNEL_LEFT (4)
|
||||
#define SIDE_CHANNEL_RIGHT (5)
|
||||
#define BACK_CHANNEL_LEFT (6)
|
||||
#define BACK_CHANNEL_RIGHT (7)
|
||||
#define BACK_CHANNEL_CENTER (8)
|
||||
#define LFE_CHANNEL (9)
|
||||
#define UNKNOWN_CHANNEL (0)
|
||||
|
||||
/* DRM channel definitions */
|
||||
#define DRMCH_MONO 1
|
||||
#define DRMCH_STEREO 2
|
||||
#define DRMCH_SBR_MONO 3
|
||||
#define DRMCH_SBR_STEREO 4
|
||||
#define DRMCH_SBR_PS_STEREO 5
|
||||
|
||||
|
||||
/* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
|
||||
so at least so much bytes per channel should be available in this stream */
|
||||
#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
|
||||
|
||||
|
||||
typedef void *NeAACDecHandle;
|
||||
|
||||
typedef struct mp4AudioSpecificConfig
|
||||
{
|
||||
/* Audio Specific Info */
|
||||
unsigned char objectTypeIndex;
|
||||
unsigned char samplingFrequencyIndex;
|
||||
unsigned long samplingFrequency;
|
||||
unsigned char channelsConfiguration;
|
||||
|
||||
/* GA Specific Info */
|
||||
unsigned char frameLengthFlag;
|
||||
unsigned char dependsOnCoreCoder;
|
||||
unsigned short coreCoderDelay;
|
||||
unsigned char extensionFlag;
|
||||
unsigned char aacSectionDataResilienceFlag;
|
||||
unsigned char aacScalefactorDataResilienceFlag;
|
||||
unsigned char aacSpectralDataResilienceFlag;
|
||||
unsigned char epConfig;
|
||||
|
||||
char sbr_present_flag;
|
||||
char forceUpSampling;
|
||||
char downSampledSBR;
|
||||
} mp4AudioSpecificConfig;
|
||||
|
||||
typedef struct NeAACDecConfiguration
|
||||
{
|
||||
unsigned char defObjectType;
|
||||
unsigned long defSampleRate;
|
||||
unsigned char outputFormat;
|
||||
unsigned char downMatrix;
|
||||
unsigned char useOldADTSFormat;
|
||||
unsigned char dontUpSampleImplicitSBR;
|
||||
} NeAACDecConfiguration, *NeAACDecConfigurationPtr;
|
||||
|
||||
typedef struct NeAACDecFrameInfo
|
||||
{
|
||||
unsigned long bytesconsumed;
|
||||
unsigned long samples;
|
||||
unsigned char channels;
|
||||
unsigned char error;
|
||||
unsigned long samplerate;
|
||||
|
||||
/* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
|
||||
unsigned char sbr;
|
||||
|
||||
/* MPEG-4 ObjectType */
|
||||
unsigned char object_type;
|
||||
|
||||
/* AAC header type; MP4 will be signalled as RAW also */
|
||||
unsigned char header_type;
|
||||
|
||||
/* multichannel configuration */
|
||||
unsigned char num_front_channels;
|
||||
unsigned char num_side_channels;
|
||||
unsigned char num_back_channels;
|
||||
unsigned char num_lfe_channels;
|
||||
unsigned char channel_position[64];
|
||||
|
||||
/* PS: 0: off, 1: on */
|
||||
unsigned char ps;
|
||||
} NeAACDecFrameInfo;
|
||||
|
||||
char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
|
||||
|
||||
unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
|
||||
|
||||
NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
|
||||
|
||||
NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
|
||||
|
||||
unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
|
||||
NeAACDecConfigurationPtr config);
|
||||
|
||||
/* Init the library based on info from the AAC file (ADTS/ADIF) */
|
||||
long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
|
||||
unsigned char *buffer,
|
||||
unsigned long buffer_size,
|
||||
unsigned long *samplerate,
|
||||
unsigned char *channels);
|
||||
|
||||
/* Init the library using a DecoderSpecificInfo */
|
||||
char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer,
|
||||
unsigned long SizeOfDecoderSpecificInfo,
|
||||
unsigned long *samplerate, unsigned char *channels);
|
||||
|
||||
/* Init the library for DRM */
|
||||
char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
|
||||
unsigned char channels);
|
||||
|
||||
void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
|
||||
|
||||
void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
|
||||
|
||||
void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
|
||||
NeAACDecFrameInfo *hInfo,
|
||||
unsigned char *buffer,
|
||||
unsigned long buffer_size);
|
||||
|
||||
void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
|
||||
NeAACDecFrameInfo *hInfo,
|
||||
unsigned char *buffer,
|
||||
unsigned long buffer_size,
|
||||
void **sample_buffer,
|
||||
unsigned long sample_buffer_size);
|
||||
|
||||
char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
|
||||
unsigned long buffer_size,
|
||||
mp4AudioSpecificConfig *mp4ASC);
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
@ -1,9 +1,8 @@
|
||||
set (aacdecoder_SOURCES
|
||||
aacdecoder_plugin.cpp
|
||||
AacDecoderFactory.cpp
|
||||
AacDecoder.cpp
|
||||
set (m4adecoder_SOURCES
|
||||
m4adecoder_plugin.cpp
|
||||
M4aDecoderFactory.cpp
|
||||
M4aDecoder.cpp
|
||||
stdafx.cpp
|
||||
drms/drms.c
|
||||
mp4ff/mp4atom.c
|
||||
mp4ff/mp4ff.c
|
||||
mp4ff/mp4meta.c
|
||||
@ -17,5 +16,5 @@ include_directories(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mp4ff"
|
||||
)
|
||||
|
||||
add_library(aacdecoder SHARED ${aacdecoder_SOURCES})
|
||||
target_link_libraries(aacdecoder ${musikbox_LINK_LIBS} faad)
|
||||
add_library(m4adecoder SHARED ${m4adecoder_SOURCES})
|
||||
target_link_libraries(m4adecoder ${musikbox_LINK_LIBS} faad)
|
@ -1,5 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "AacDecoder.h"
|
||||
#include "M4aDecoder.h"
|
||||
|
||||
using musik::core::io::IDataStream;
|
||||
using musik::core::audio::IBuffer;
|
||||
@ -41,26 +41,23 @@ static int FindAacTrack(mp4ff_t *infile) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
AacDecoder::AacDecoder() {
|
||||
M4aDecoder::M4aDecoder() {
|
||||
this->decoder = NULL;
|
||||
this->decoderFile = NULL;
|
||||
memset(&decoderCallbacks, 0, sizeof(this->decoderCallbacks));
|
||||
}
|
||||
|
||||
AacDecoder::~AacDecoder() {
|
||||
M4aDecoder::~M4aDecoder() {
|
||||
}
|
||||
|
||||
bool AacDecoder::Open(musik::core::io::IDataStream *stream)
|
||||
bool M4aDecoder::Open(musik::core::io::IDataStream *stream)
|
||||
{
|
||||
unsigned char* buffer;
|
||||
unsigned int buffer_size;
|
||||
NeAACDecConfigurationPtr config;
|
||||
|
||||
decoder = NeAACDecOpen();
|
||||
if (!decoder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NeAACDecConfigurationPtr config;
|
||||
config = NeAACDecGetCurrentConfiguration(decoder);
|
||||
|
||||
config->outputFormat = FAAD_FMT_FLOAT;
|
||||
@ -73,45 +70,38 @@ bool AacDecoder::Open(musik::core::io::IDataStream *stream)
|
||||
decoderCallbacks.user_data = stream;
|
||||
|
||||
decoderFile = mp4ff_open_read(&decoderCallbacks);
|
||||
if (!decoderFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((audioTrackId = FindAacTrack(decoderFile)) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (decoderFile) {
|
||||
if ((audioTrackId = FindAacTrack(decoderFile)) >= 0) {
|
||||
unsigned char* buffer = NULL;
|
||||
unsigned int bufferSize = 0;
|
||||
|
||||
buffer = NULL;
|
||||
buffer_size = 0;
|
||||
mp4ff_get_decoder_config(decoderFile, audioTrackId, &buffer, &buffer_size);
|
||||
mp4ff_get_decoder_config(
|
||||
decoderFile, audioTrackId, &buffer, &bufferSize);
|
||||
|
||||
if (!buffer) {
|
||||
return false;
|
||||
}
|
||||
if (buffer) {
|
||||
if (NeAACDecInit2(
|
||||
decoder,
|
||||
buffer,
|
||||
bufferSize,
|
||||
&this->sampleRate,
|
||||
&this->channelCount) >= 0)
|
||||
{
|
||||
this->totalSamples = mp4ff_num_samples(decoderFile, audioTrackId);
|
||||
this->decoderSampleId = 0;
|
||||
free(buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NeAACDecInit2(
|
||||
decoder,
|
||||
buffer,
|
||||
buffer_size,
|
||||
&this->sampleRate,
|
||||
&this->channelCount) < 0)
|
||||
{
|
||||
if (buffer) {
|
||||
free(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
this->totalSamples = mp4ff_num_samples(decoderFile, audioTrackId);
|
||||
decoderSampleId = 0;
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void AacDecoder::Destroy(void)
|
||||
void M4aDecoder::Destroy(void)
|
||||
{
|
||||
mp4ff_close(decoderFile);
|
||||
|
||||
@ -123,7 +113,7 @@ void AacDecoder::Destroy(void)
|
||||
delete this;
|
||||
}
|
||||
|
||||
double AacDecoder::SetPosition(double seconds) {
|
||||
double M4aDecoder::SetPosition(double seconds) {
|
||||
int64_t duration;
|
||||
float fms = (float) seconds * 1000;
|
||||
int32_t skip_samples = 0;
|
||||
@ -136,7 +126,7 @@ double AacDecoder::SetPosition(double seconds) {
|
||||
return seconds;
|
||||
}
|
||||
|
||||
bool AacDecoder::GetBuffer(IBuffer* target) {
|
||||
bool M4aDecoder::GetBuffer(IBuffer* target) {
|
||||
if (this->decoderSampleId < 0) {
|
||||
return false;
|
||||
}
|
||||
@ -146,8 +136,6 @@ bool AacDecoder::GetBuffer(IBuffer* target) {
|
||||
unsigned int encodedDataLength = 0;
|
||||
NeAACDecFrameInfo frameInfo;
|
||||
|
||||
/* get acces unit from MP4 file */
|
||||
|
||||
long duration = mp4ff_get_sample_duration(
|
||||
decoderFile, audioTrackId, decoderSampleId);
|
||||
|
@ -1,14 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/sdk/IDecoder.h>
|
||||
|
||||
#include <neaacdec.h>
|
||||
#include <mp4ff.h>
|
||||
|
||||
class AacDecoder : public musik::core::audio::IDecoder {
|
||||
class M4aDecoder : public musik::core::audio::IDecoder {
|
||||
public:
|
||||
AacDecoder();
|
||||
~AacDecoder();
|
||||
M4aDecoder();
|
||||
~M4aDecoder();
|
||||
|
||||
virtual void Destroy();
|
||||
virtual double SetPosition(double seconds);
|
@ -33,34 +33,32 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "AacDecoderFactory.h"
|
||||
#include "AacDecoder.h"
|
||||
#include "M4aDecoderFactory.h"
|
||||
#include "M4aDecoder.h"
|
||||
#include <algorithm>
|
||||
|
||||
using musik::core::audio::IDecoder;
|
||||
|
||||
AacDecoderFactory::AacDecoderFactory() {
|
||||
M4aDecoderFactory::M4aDecoderFactory() {
|
||||
}
|
||||
|
||||
AacDecoderFactory::~AacDecoderFactory() {
|
||||
M4aDecoderFactory::~M4aDecoderFactory() {
|
||||
}
|
||||
|
||||
void AacDecoderFactory::Destroy() {
|
||||
void M4aDecoderFactory::Destroy() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
IDecoder* AacDecoderFactory::CreateDecoder() {
|
||||
return new AacDecoder();
|
||||
IDecoder* M4aDecoderFactory::CreateDecoder() {
|
||||
return new M4aDecoder();
|
||||
}
|
||||
|
||||
bool AacDecoderFactory::CanHandle(const char* type) const {
|
||||
bool M4aDecoderFactory::CanHandle(const char* type) const {
|
||||
std::string str(type);
|
||||
std::transform(str.begin(), str.end(), str.begin(), tolower);
|
||||
|
||||
return
|
||||
musik::sdk::endsWith(str, ".aac") ||
|
||||
musik::sdk::endsWith(str, ".m4a") ||
|
||||
str.find("audio/aac") != std::string::npos ||
|
||||
str.find("audio/mp4") != std::string::npos;
|
||||
}
|
||||
|
@ -35,10 +35,10 @@
|
||||
|
||||
#include <core/sdk/IDecoderFactory.h>
|
||||
|
||||
class AacDecoderFactory : public musik::core::audio::IDecoderFactory {
|
||||
class M4aDecoderFactory : public musik::core::audio::IDecoderFactory {
|
||||
public:
|
||||
AacDecoderFactory();
|
||||
virtual ~AacDecoderFactory();
|
||||
M4aDecoderFactory();
|
||||
virtual ~M4aDecoderFactory();
|
||||
|
||||
musik::core::audio::IDecoder* CreateDecoder();
|
||||
void Destroy();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user