diff options
Diffstat (limited to 'Src/Plugins/Encoder/enc_fhgaac')
25 files changed, 3031 insertions, 0 deletions
diff --git a/Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.cpp b/Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.cpp new file mode 100644 index 00000000..08ddb0a3 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.cpp @@ -0,0 +1,119 @@ +#include "ADTSAACEncoder.h" +#include "mp4FastAAClib.h" +#include <malloc.h> +#include "config.h" +#include "../nsutil/pcm.h" + +ADTSAACEncoder *ADTSAACEncoder::CreateDecoder(const AACConfiguration *cfg, int nch, int srate, int bps) +{ + MPEG4ENC_ERROR err; + + MPEG4ENC_SETUP setup; + setup.aot = AACConfig_GetAOT(cfg); + setup.nBitRate = AACConfig_GetBitrate(cfg, nch); + setup.bitrateMode = AACConfig_GetBitrateMode(cfg); + setup.quality = MP4_QUAL_HIGH; + setup.chMode = AACConfig_GetChannelMode(cfg, nch); + setup.sbrSignaling = MP4_SBRSIG_IMPLICIT; + setup.nSampleRateIn = srate; + setup.transportFormat = MP4_TT_ADTS; + setup.nGranuleLength = MP4_GRANULE_1024; + setup.metadataMode = MP4_METADATA_NONE; + + HANDLE_MPEG4ENC_ENCODER encoder=0; + err = MPEG4ENC_Configure(&encoder, &setup); + if (err != MPEG4ENC_NO_ERROR) + { + return 0; + } + + unsigned int first_samples; + err = MPEG4ENC_Open(&encoder, &first_samples); + if (err != MPEG4ENC_NO_ERROR) + { + + MPEG4ENC_Close(&encoder); + return 0; + } + float *sample_buffer = (float *)malloc(first_samples * sizeof(float)); + if (!sample_buffer) + { + MPEG4ENC_Close(&encoder); + return 0; + } + + ADTSAACEncoder *fhg_enc = new ADTSAACEncoder(encoder, &setup, nch, srate, bps, sample_buffer, first_samples); + if (!fhg_enc) + { + free(sample_buffer); + MPEG4ENC_Close(&encoder); + } + + AACConfig_GetToolString(&setup, fhg_enc->tool, sizeof(fhg_enc->tool)); + + return fhg_enc; +} + +ADTSAACEncoder::ADTSAACEncoder(HANDLE_MPEG4ENC_ENCODER encoder, const MPEG4ENC_SETUP *setup, int nch, int srate, int bps, float *sample_buffer, unsigned int next_samples) +: encoder(encoder), channels(nch), sample_rate(srate), bits_per_sample(bps), sample_buffer(sample_buffer), next_samples(next_samples) +{ + MPEG4ENC_INFO info; + MPEG4ENC_GetInfo(encoder, &info); + samples_per_frame = info.nSamplesFrame[0]; + + finishing=false; +} + +ADTSAACEncoder::~ADTSAACEncoder() +{ + free(sample_buffer); + MPEG4ENC_Close(&encoder); +} + +int ADTSAACEncoder::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail) +{ + if (!in_avail && !finishing) + return 0; + + size_t num_samples = in_avail / (bits_per_sample/8); + num_samples = min(num_samples, next_samples); + + nsutil_pcm_IntToFloat_Interleaved(sample_buffer, in, bits_per_sample, num_samples); + + int samples_consumed=0; + int out_used = 0; + MPEG4ENC_AUINFO *info; + MPEG4ENC_ERROR err = MPEG4ENC_Encode(encoder, sample_buffer, num_samples, &samples_consumed, &next_samples, (unsigned char * const)out, out_avail, &out_used, &info); + if (err != MPEG4ENC_NO_ERROR) + { + out_used = 0; /* in case it didn't get set */ + } + else if (err != MPEG4ENC_NO_ERROR) + { + return 0; + } + if (!finishing) + { + *in_used = samples_consumed * (bits_per_sample/8); + } + + return out_used; +} + +void ADTSAACEncoder::PrepareToFinish() +{ + finishing=true; +} + +void ADTSAACEncoder::Finish(const wchar_t *filename) +{ + /* TODO: + MPEG4ENC_INFO info; + MPEG4ENC_GetInfo(encoder, &info); + if (!resampling) + mp4_writer.WriteGaps(info.nDelay, decodable_samples-total_samples-info.nDelay, total_samples); + + mp4_writer.WriteTool(tool); + */ + +} diff --git a/Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.h b/Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.h new file mode 100644 index 00000000..b96bd863 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.h @@ -0,0 +1,25 @@ +#pragma once +#include "mp4FastAAClib.h" +#include "config.h" +#include "encoder_common.h" + + +class ADTSAACEncoder : public EncoderCommon +{ +public: + static ADTSAACEncoder *CreateDecoder(const AACConfiguration *cfg, int nch, int srate, int bps); + ADTSAACEncoder(HANDLE_MPEG4ENC_ENCODER encoder, const MPEG4ENC_SETUP *setup, int nch, int srate, int bps, float *sample_buffer, unsigned int next_samples); + ~ADTSAACEncoder(); + int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail); + void PrepareToFinish(); + void Finish(const wchar_t *filename); +private: + HANDLE_MPEG4ENC_ENCODER encoder; + unsigned int channels; + unsigned int sample_rate; + unsigned int bits_per_sample; + unsigned int next_samples; + unsigned int samples_per_frame; + float *sample_buffer; + bool finishing; +};
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.cpp b/Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.cpp new file mode 100644 index 00000000..6d2b31b3 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.cpp @@ -0,0 +1,128 @@ +#include "FhGAACEncoder.h" +#include "mp4FastAAClib.h" +#include <malloc.h> +#include "config.h" +#include "../nsutil/pcm.h" + +FhGAACEncoder *FhGAACEncoder::CreateDecoder(const AACConfiguration *cfg, int nch, int srate, int bps) +{ + MPEG4ENC_ERROR err; + + MPEG4ENC_SETUP setup; + setup.aot = AACConfig_GetAOT(cfg); + setup.nBitRate = AACConfig_GetBitrate(cfg, nch); + setup.bitrateMode = AACConfig_GetBitrateMode(cfg); + setup.quality = MP4_QUAL_HIGH; + setup.chMode = AACConfig_GetChannelMode(cfg, nch); + setup.sbrSignaling = MP4_SBRSIG_EXPL_BC; + setup.nSampleRateIn = srate; + setup.transportFormat = MP4_TT_RAW; + setup.nGranuleLength = MP4_GRANULE_1024; + setup.metadataMode = MP4_METADATA_NONE; + + HANDLE_MPEG4ENC_ENCODER encoder=0; + err = MPEG4ENC_Configure(&encoder, &setup); + if (err != MPEG4ENC_NO_ERROR) + { + return 0; + } + + unsigned int first_samples; + err = MPEG4ENC_Open(&encoder, &first_samples); + if (err != MPEG4ENC_NO_ERROR) + { + + MPEG4ENC_Close(&encoder); + return 0; + } + float *sample_buffer = (float *)malloc(first_samples * sizeof(float)); + if (!sample_buffer) + { + MPEG4ENC_Close(&encoder); + return 0; + } + + FhGAACEncoder *fhg_enc = new FhGAACEncoder(encoder, &setup, nch, srate, bps, sample_buffer, first_samples); + if (!fhg_enc) + { + free(sample_buffer); + MPEG4ENC_Close(&encoder); + } + + AACConfig_GetToolString(&setup, fhg_enc->tool, sizeof(fhg_enc->tool)); + return fhg_enc; +} + +FhGAACEncoder::FhGAACEncoder(HANDLE_MPEG4ENC_ENCODER encoder, const MPEG4ENC_SETUP *setup, int nch, int srate, int bps, float *sample_buffer, unsigned int next_samples) +: encoder(encoder), channels(nch), sample_rate(srate), bits_per_sample(bps), sample_buffer(sample_buffer), next_samples(next_samples) +{ + MPEG4ENC_INFO info; + MPEG4ENC_GetInfo(encoder, &info); + samples_per_frame = info.nSamplesFrame[0]; + + if (info.nSamplingRate[0] != srate) + resampling = true; + else + resampling = false; + finishing=false; + total_samples=0; + decodable_samples=0; + // TODO: move this somewhere where we can error-check + mp4_writer.AddAudioTrack(encoder, setup); +} + +FhGAACEncoder::~FhGAACEncoder() +{ + free(sample_buffer); + MPEG4ENC_Close(&encoder); +} + +int FhGAACEncoder::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail) +{ + if (!in_avail && !finishing) + return 0; + + size_t num_samples = in_avail / (bits_per_sample/8); + num_samples = min(num_samples, next_samples); + + nsutil_pcm_IntToFloat_Interleaved(sample_buffer, in, bits_per_sample, num_samples); + + int samples_consumed=0; + int out_used = 0; + MPEG4ENC_AUINFO *info; + MPEG4ENC_ERROR err = MPEG4ENC_Encode(encoder, sample_buffer, num_samples, &samples_consumed, &next_samples, (unsigned char * const)out, out_avail, &out_used, &info); + if (err == MPEG4ENC_NO_ERROR && out_used) + { + decodable_samples += samples_per_frame; + mp4_writer.Write(out, out_used, samples_per_frame); + } + else if (err != MPEG4ENC_NO_ERROR) + { + return 0; + } + + if (!finishing) + { + *in_used = samples_consumed * (bits_per_sample/8); + total_samples += samples_consumed / channels; + } + + return out_used; +} + +void FhGAACEncoder::PrepareToFinish() +{ + finishing=true; +} + +void FhGAACEncoder::Finish(const wchar_t *filename) +{ + MPEG4ENC_INFO info; + MPEG4ENC_GetInfo(encoder, &info); + if (!resampling) + mp4_writer.WriteGaps(info.nDelay, decodable_samples-total_samples-info.nDelay, total_samples); + + mp4_writer.WriteTool(tool); + + mp4_writer.CloseTo(filename); +} diff --git a/Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.h b/Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.h new file mode 100644 index 00000000..6bd8fec7 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.h @@ -0,0 +1,29 @@ +#pragma once +#include "MP4Writer.h" +#include "mp4FastAAClib.h" +#include "config.h" +#include "encoder_common.h" + +class FhGAACEncoder : public EncoderCommon +{ +public: + static FhGAACEncoder *CreateDecoder(const AACConfiguration *cfg, int nch, int srate, int bps); + FhGAACEncoder(HANDLE_MPEG4ENC_ENCODER encoder, const MPEG4ENC_SETUP *setup, int nch, int srate, int bps, float *sample_buffer, unsigned int next_samples); + ~FhGAACEncoder(); + int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail); + void PrepareToFinish(); + void Finish(const wchar_t *filename); +private: + HANDLE_MPEG4ENC_ENCODER encoder; + unsigned int channels; + unsigned int sample_rate; + unsigned int bits_per_sample; + unsigned int next_samples; + unsigned int samples_per_frame; + float *sample_buffer; + MP4Writer mp4_writer; + uint64_t total_samples; + uint64_t decodable_samples; + bool finishing; + bool resampling; +};
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/MP4Writer.cpp b/Src/Plugins/Encoder/enc_fhgaac/MP4Writer.cpp new file mode 100644 index 00000000..00f6d811 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/MP4Writer.cpp @@ -0,0 +1,64 @@ +#include "MP4Writer.h" + +#include <strsafe.h> + +MP4Writer::MP4Writer() +{ + wchar_t tmppath[MAX_PATH-14] = {0}; + GetTempPathW(MAX_PATH-14,tmppath); + GetTempFileNameW(tmppath, L"mp4", 0, tempfile); + mp4File = MP4Create(tempfile); + if(!mp4File) + { + return; + } +} + +MP4Writer::~MP4Writer() +{ + /* in case it's lingering open */ + if (mp4File) + MP4Close(mp4File); +} + +void MP4Writer::CloseTo(const wchar_t *filename) +{ + MP4Close(mp4File); + mp4File=0; + MP4MakeIsmaCompliant(tempfile, 0, true); + DeleteFileW(filename); + if (MoveFileW(tempfile,filename) == 0) // if the function fails + { + CopyFileW(tempfile,filename, FALSE); + DeleteFileW(tempfile); + } +} + +void MP4Writer::WriteGaps(uint32_t pregap, uint32_t postgap, uint64_t totalSamples) +{ + char data[128] = {0}; + StringCchPrintfA(data, 128, " %08X %08X %08X %016X %08X %08X %08X %08X %08X %08X %08X %08X", 0, pregap, postgap, totalSamples, 0, 0,0, 0,0, 0,0, 0); + MP4SetMetadataFreeForm(mp4File, "iTunSMPB", (u_int8_t *)data, lstrlenA(data)); +} + +void MP4Writer::Write(const void *buf, size_t size, MP4Duration duration) +{ + MP4WriteSample(mp4File, mp4Track, (const uint8_t *)buf, size, duration); +} + +void MP4Writer::AddAudioTrack(const HANDLE_MPEG4ENC_ENCODER encoder, const MPEG4ENC_SETUP *setup) +{ + MPEG4ENC_INFO info; + MPEG4ENC_GetInfo(encoder, &info); + + MP4SetTimeScale(mp4File, info.nSamplingRate[0]); + + mp4Track = MP4AddAudioTrack(mp4File, info.nSamplingRate[0], info.nSamplesFrame[0], MP4_MPEG4_AUDIO_TYPE); + MP4SetAudioProfileLevel(mp4File, info.nProfLev); + MP4SetTrackESConfiguration(mp4File, mp4Track, info.ascBuf[0].ascBuffer, (info.ascBuf[0].nAscSizeBits+7)/8); +} + +void MP4Writer::WriteTool(const char *tool) +{ + MP4SetMetadataTool(mp4File, tool); +}
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/MP4Writer.h b/Src/Plugins/Encoder/enc_fhgaac/MP4Writer.h new file mode 100644 index 00000000..5ae6ea06 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/MP4Writer.h @@ -0,0 +1,25 @@ +#pragma once + +#include <mp4.h> +#include "mp4FastAAClib.h" +#include "config.h" + +class MP4Writer +{ +public: + MP4Writer(); + ~MP4Writer(); + + void AddAudioTrack(const HANDLE_MPEG4ENC_ENCODER encoder, const MPEG4ENC_SETUP *setup); + void WriteGaps(uint32_t pregap, uint32_t postgap, uint64_t totalSamples); + void WriteTool(const char *tool); + void Write(const void *buf, size_t size, MP4Duration duration); + void CloseTo(const wchar_t *filename); + + bool OK() { return true; } + + MP4TrackId mp4Track; + MP4FileHandle mp4File; + wchar_t tempfile[MAX_PATH]; +}; + diff --git a/Src/Plugins/Encoder/enc_fhgaac/config.cpp b/Src/Plugins/Encoder/enc_fhgaac/config.cpp new file mode 100644 index 00000000..e899b052 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/config.cpp @@ -0,0 +1,258 @@ +#include "config.h" +#include <windows.h> +#include <strsafe.h> +#include <assert.h> +#include "mp4FastAAClib.h" +#include "preferences.h" + +AACConfigurationFile *AACConfig_Create(unsigned int type, const char *filename) +{ + AACConfigurationFile *cfg = (AACConfigurationFile*)calloc(1, sizeof(AACConfigurationFile)); + if (cfg) + { + cfg->type = type; + + if (filename) + lstrcpynA(cfg->config_file, filename, MAX_PATH); + else + cfg->config_file[0] = 0; + + AACConfig_Load(cfg); + } + return cfg; +} + +void AACConfig_Load(AACConfigurationFile *cfg) +{ + if (cfg->type == ENCODER_TYPE_MPEG4) + { + cfg->config.mode = GetPrivateProfileIntA("audio_fhgaac", "mode", AAC_DEFAULT_MODE, cfg->config_file); + cfg->config.profile = GetPrivateProfileIntA("audio_fhgaac", "profile", AAC_DEFAULT_PROFILE, cfg->config_file); + cfg->config.bitrate = GetPrivateProfileIntA("audio_fhgaac", "bitrate", AAC_DEFAULT_BITRATE, cfg->config_file); + cfg->config.preset = GetPrivateProfileIntA("audio_fhgaac", "preset", AAC_DEFAULT_PRESET, cfg->config_file); + cfg->config.surround = GetPrivateProfileIntA("audio_fhgaac", "surround", AAC_DEFAULT_SURROUND, cfg->config_file); + cfg->shoutcast = 0; + } + else + { + cfg->config.mode = AAC_MODE_CBR; + cfg->config.profile = GetPrivateProfileIntA("audio_adtsaac", "profile", AAC_PROFILE_HE, cfg->config_file); + cfg->config.bitrate = GetPrivateProfileIntA("audio_adtsaac", "bitrate", 64, cfg->config_file); + cfg->config.surround = GetPrivateProfileIntA("audio_adtsaac", "surround", AAC_DEFAULT_SURROUND, cfg->config_file); + cfg->shoutcast = GetPrivateProfileIntA("audio_adtsaac", "shoutcast", 0, cfg->config_file); + } +} + +void AACConfig_Save(const AACConfigurationFile *cfg) +{ + char temp[128] = {0}; + + if (cfg->type == ENCODER_TYPE_MPEG4) + { + StringCbPrintfA(temp, sizeof(temp), "%u", cfg->config.mode); + WritePrivateProfileStringA("audio_fhgaac", "mode", temp, cfg->config_file); + + StringCbPrintfA(temp, sizeof(temp), "%u", cfg->config.profile); + WritePrivateProfileStringA("audio_fhgaac", "profile", temp, cfg->config_file); + + StringCbPrintfA(temp, sizeof(temp), "%u", cfg->config.bitrate); + WritePrivateProfileStringA("audio_fhgaac", "bitrate", temp, cfg->config_file); + + StringCbPrintfA(temp, sizeof(temp), "%u", cfg->config.preset); + WritePrivateProfileStringA("audio_fhgaac", "preset", temp, cfg->config_file); + + StringCbPrintfA(temp, sizeof(temp), "%u", cfg->config.surround); + WritePrivateProfileStringA("audio_fhgaac", "surround", temp, cfg->config_file); + } + else + { + StringCbPrintfA(temp, sizeof(temp), "%u", cfg->config.profile); + WritePrivateProfileStringA("audio_adtsaac", "profile", temp, cfg->config_file); + + StringCbPrintfA(temp, sizeof(temp), "%u", cfg->config.bitrate); + WritePrivateProfileStringA("audio_adtsaac", "bitrate", temp, cfg->config_file); + + StringCbPrintfA(temp, sizeof(temp), "%u", cfg->config.surround); + WritePrivateProfileStringA("audio_adtsaac", "surround", temp, cfg->config_file); + } +} + +void AACConfig_GetBitrateRange(const AACConfiguration *cfg, int *low, int *high) +{ + switch(cfg->profile) + { + case AAC_PROFILE_AUTOMATIC: + *low = 12000; + *high = 448000; + break; + + case AAC_PROFILE_LC: + *low = 16000; + *high = 448000; + break; + + case AAC_PROFILE_HE: + *low = 16000; + *high = 128000; + break; + + case AAC_PROFILE_HE_V2: + *low = 12000; + *high = 56000; + break; + } +} + +AUD_OBJ_TYP AACConfig_GetAOT(const AACConfiguration *cfg) +{ + if (cfg->mode == AAC_MODE_VBR) + { + switch(cfg->preset) + { + case 1: + return AUD_OBJ_TYP_PS; + case 2: + return AUD_OBJ_TYP_HEAAC; + default: + return AUD_OBJ_TYP_LC; + } + } + else switch (cfg->profile) /* CBR */ + { + case AAC_PROFILE_AUTOMATIC: + if (cfg->bitrate <= 40) + return AUD_OBJ_TYP_PS; + else if (cfg->bitrate <= 80) + return AUD_OBJ_TYP_HEAAC; + else + return AUD_OBJ_TYP_LC; + case AAC_PROFILE_LC: + return AUD_OBJ_TYP_LC; + case AAC_PROFILE_HE: + return AUD_OBJ_TYP_HEAAC; + case AAC_PROFILE_HE_V2: + + return AUD_OBJ_TYP_PS; + + } + return AUD_OBJ_TYP_LC; +} + +int AACConfig_GetBitrate(const AACConfiguration *cfg, unsigned int channels) +{ + if (cfg->mode == AAC_MODE_VBR) + { + switch(cfg->preset) + { + case 1: + return 16000*channels; + case 2: + return 32000*channels; + case 3: + return 48000*channels; + case 4: + return 64000*channels; + case 5: + return 96000*channels; + case 6: + return 128000*channels; + default: + return 0; + } + } + else + return cfg->bitrate * 1000; +} + +MPEG4ENC_BITRATE_MODE AACConfig_GetBitrateMode(const AACConfiguration *cfg) +{ + if (cfg->mode == AAC_MODE_VBR) + { + /* by coincidence, these match + to help future maintainers, let's assert this fact */ + assert(MP4_BR_MODE_VBR_1 == (MPEG4ENC_BITRATE_MODE)1); + assert(MP4_BR_MODE_VBR_2 == (MPEG4ENC_BITRATE_MODE)2); + assert(MP4_BR_MODE_VBR_3 == (MPEG4ENC_BITRATE_MODE)3); + assert(MP4_BR_MODE_VBR_4 == (MPEG4ENC_BITRATE_MODE)4); + assert(MP4_BR_MODE_VBR_5 == (MPEG4ENC_BITRATE_MODE)5); + assert(MP4_BR_MODE_VBR_6 == (MPEG4ENC_BITRATE_MODE)6); + return (MPEG4ENC_BITRATE_MODE)cfg->preset; + } + else /* CBR */ + { + return MP4_BR_MODE_CBR; + } +} + +MPEG4ENC_CH_MODE AACConfig_GetChannelMode(const AACConfiguration *cfg, unsigned int channels) +{ + switch(channels) + { + case 1: + return MP4_CH_MODE_MONO; + case 2: + if (cfg->mode == AAC_MODE_VBR) + { + if (cfg->preset == 1) + return MP4_CH_MODE_PARAMETRIC_STEREO; + else + return MP4_CH_MODE_STEREO; + } + else /* CBR */ + { + if (AACConfig_GetAOT(cfg) == AUD_OBJ_TYP_PS) + return MP4_CH_MODE_PARAMETRIC_STEREO; + else + return MP4_CH_MODE_STEREO; + } + case 3: return MP4_CH_MODE_3; + case 4: return MP4_CH_MODE_4; + case 5: return MP4_CH_MODE_5; + case 6: return MP4_CH_MODE_5_1; + case 8: return MP4_CH_MODE_7_1; + default: + return MP4_CH_MODE_INVALID; + } +} + +void AACConfig_GetToolString(const MPEG4ENC_SETUP *setup, char tool[], size_t cch) +{ + char version[128] = {0}; + MPEG4ENC_GetVersionInfo(version, sizeof(version)/sizeof(*version)); + char *p = version; + while (p && *p) + { + if (*p != '.' && (*p < '0' || *p > '9')) + { + *p = 0; + break; + } + p++; + } + + + switch(setup->bitrateMode) + { + case MP4_BR_MODE_CBR: + StringCchPrintfA(tool, cch, "fhgaac v%s;CBR=%d", version, setup->nBitRate); + break; + case MP4_BR_MODE_VBR_1: + StringCchPrintfA(tool, cch, "fhgaac v%s;VBR=1", version); + break; + case MP4_BR_MODE_VBR_2: + StringCchPrintfA(tool, cch, "fhgaac v%s;VBR=2", version); + break; + case MP4_BR_MODE_VBR_3: + StringCchPrintfA(tool, cch, "fhgaac v%s;VBR=3", version); + break; + case MP4_BR_MODE_VBR_4: + StringCchPrintfA(tool, cch, "fhgaac v%s;VBR=4", version); + break; + case MP4_BR_MODE_VBR_5: + StringCchPrintfA(tool, cch, "fhgaac v%s;VBR=5", version); + break; + case MP4_BR_MODE_VBR_6: + StringCchPrintfA(tool, cch, "fhgaac v%s;VBR=6", version); + break; + } +}
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/config.h b/Src/Plugins/Encoder/enc_fhgaac/config.h new file mode 100644 index 00000000..5a7dc009 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/config.h @@ -0,0 +1,64 @@ +#pragma once + +#include "mp4FastAAClib.h" +#include <windows.h> // or MAX_PATH + + +#define ENCODER_TYPE_MPEG4 (mmioFOURCC('A','A','C','f')) +#define ENCODER_TYPE_ADTS (mmioFOURCC('A','D','T','S')) + +enum +{ + AAC_MODE_VBR=0, + AAC_MODE_CBR=1, + + /* these are the profile options when CBR is selected */ + AAC_PROFILE_AUTOMATIC=0, + AAC_PROFILE_LC=1, + AAC_PROFILE_HE=2, + AAC_PROFILE_HE_V2=3, + + /* Surround options */ + AAC_SURROUND_BCC = 0, /* Binaural Cue Coding, stereo + surround layer, aka MPEG-Surround */ + AAC_SURROUND_DISCRETE = 1, /* Discrete surround (traditional AAC surround sound with separate SCE per channel pair) */ + + /* defaults */ + AAC_DEFAULT_MODE = AAC_MODE_VBR, + AAC_DEFAULT_PROFILE = AAC_PROFILE_AUTOMATIC, + AAC_DEFAULT_BITRATE = 128, + AAC_DEFAULT_PRESET = 4, + AAC_DEFAULT_SURROUND = AAC_SURROUND_BCC, +}; + +struct AACConfiguration +{ + unsigned int mode; /* CBR or VBR */ + unsigned int profile; /* what flavor of AAC, e.g. LC, or automatic */ + unsigned int bitrate; /* bitrate for CBR */ + unsigned int preset; /* preset for VBR */ + unsigned int surround; /* 0 = discrete, 1 = MPEG Surround */ +}; + +struct AACConfigurationFile +{ + AACConfiguration config; + unsigned int channels; + unsigned int sample_rate; + unsigned int type; /* either ENCODER_TYPE_MPEG4 or ENCODER_TYPE_ADTS */ + unsigned int shoutcast; /* 0 by default, 1 if we're being invoked from dsp_sc */ + bool changing; /* used internally by preferences */ + char config_file[MAX_PATH]; +}; + +AACConfigurationFile *AACConfig_Create(unsigned int type, const char *filename); /* de-allocate with free() */ +void AACConfig_Load(AACConfigurationFile *cfg); +void AACConfig_Save(const AACConfigurationFile *cfg); +/* bitrates are in bits/sec (not kbps), divide by 1000 if you need to +TODO: ASSUMES 44.1kHz Stereo. We need to make the encoder API accept samplerate/channels input better! +*/ +void AACConfig_GetBitrateRange(const AACConfiguration *cfg, int *low, int *high); +AUD_OBJ_TYP AACConfig_GetAOT(const AACConfiguration *cfg); +int AACConfig_GetBitrate(const AACConfiguration *cfg, unsigned int channels); +MPEG4ENC_BITRATE_MODE AACConfig_GetBitrateMode(const AACConfiguration *cfg); +MPEG4ENC_CH_MODE AACConfig_GetChannelMode(const AACConfiguration *cfg, unsigned int channels); +void AACConfig_GetToolString(const MPEG4ENC_SETUP *setup, char tool[], size_t cch);
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.rc b/Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.rc new file mode 100644 index 00000000..f1911026 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.rc @@ -0,0 +1,150 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_PREFERENCES_MP4 DIALOGEX 0, 0, 256, 167 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "MPEG-4 AAC Encoder Options",IDC_STATIC,0,0,255,130 + LTEXT "Mode:",IDC_STATIC,57,14,27,12,SS_CENTERIMAGE + COMBOBOX IDC_MODE,87,14,110,106,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Profile:",IDC_STATIC_PROFILE,57,32,27,12,SS_CENTERIMAGE + COMBOBOX IDC_PROFILE,87,32,110,103,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Preset:",IDC_STATIC_PRESET,9,43,24,15,SS_CENTERIMAGE + CONTROL "",IDC_SLIDER_PRESET,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,28,57,170,15 + EDITTEXT IDC_EDIT_PRESET,203,58,25,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "kbps",IDC_KBPS,231,60,16,8,SS_CENTERIMAGE + LTEXT "Smallest Size",IDC_STATIC,16,76,42,8 + LTEXT "Highest Quality",IDC_STATIC,168,76,50,8 + GROUPBOX "Output Information",IDC_STATIC,0,91,255,39 + LTEXT "",IDC_INFO_MODE,12,103,208,8 + LTEXT "",IDC_INFO_BITRATE,12,113,185,8 + CONTROL "Help",IDC_HELPLINK,"Button",BS_OWNERDRAW | WS_TABSTOP,223,108,19,10 + LTEXT "HE-AAC encoding licensed by ",IDC_STATIC,12,135,115,8,SS_CENTERIMAGE + CONTROL "Fraunhofer IIS",IDC_URL,"Button",BS_OWNERDRAW | WS_TABSTOP,12,146,50,8 + CONTROL 104,IDC_LOGO,"Static",SS_BITMAP | SS_NOTIFY,161,134,75,25 + LTEXT "",IDC_VERSION,12,157,115,8 +END + +IDD_PREFERENCES_ADTS DIALOGEX 0, 0, 256, 167 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "ADTS-AAC Encoder Options",IDC_STATIC,0,0,255,130 + LTEXT "Files created with this encoder will not play on most devices, including the iPod and Android! Use the MPEG-4 AAC encoder instead, unless your device specifically requires ADTS files.",IDC_WARNING,9,10,232,24 + LTEXT "Profile:",IDC_STATIC_PROFILE,57,37,27,12,SS_CENTERIMAGE + COMBOBOX IDC_PROFILE,87,37,110,103,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Preset:",IDC_STATIC_PRESET,9,43,24,15,SS_CENTERIMAGE + CONTROL "",IDC_SLIDER_PRESET,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,28,57,170,15 + EDITTEXT IDC_EDIT_PRESET,203,58,25,12,ES_AUTOHSCROLL + LTEXT "kbps",IDC_KBPS,231,60,16,8,SS_CENTERIMAGE + LTEXT "Smallest Size",IDC_STATIC,16,76,42,8 + LTEXT "Highest Quality",IDC_STATIC,168,76,50,8 + GROUPBOX "Output Information",IDC_STATIC,0,91,255,39 + LTEXT "",IDC_INFO_MODE,12,103,208,8 + LTEXT "",IDC_INFO_BITRATE,12,113,185,8 + CONTROL "Help",IDC_HELPLINK,"Button",BS_OWNERDRAW | WS_TABSTOP,223,108,19,10 + LTEXT "HE-AAC encoding licensed by ",IDC_STATIC,12,135,115,8,SS_CENTERIMAGE + CONTROL "Fraunhofer IIS",IDC_URL,"Button",BS_OWNERDRAW | WS_TABSTOP,12,146,50,8 + CONTROL 104,IDC_LOGO,"Static",SS_BITMAP | SS_NOTIFY,161,134,75,25 + LTEXT "",IDC_VERSION,12,157,115,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_FHGLOGO BITMAP "fraunhofer_wa_prefs_noalpha.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + 65535 "{E1763EF4-08AD-44a3-914A-8302748AB975}" +END + +STRINGTABLE +BEGIN + IDS_ENC_FHGAAC_DESC "MPEG-4 AAC Encoder v%s" + IDS_VBR_PRESET "Variable Bitrate, Preset %u, typical bitrate: %u kbps" + IDS_CBR_PRESET "Constant Bitrate, target bitrate: %u kbps" + IDS_VBR "Variable Bitrate (VBR)" + IDS_CBR "Constant Bitrate (CBR)" + IDS_AUTOMATIC "Automatic" + IDS_BITRATE "Bitrate:" + IDS_PRESET "Preset:" + IDS_VERSION "Version %s" + IDC_ENC_ADTS_DESC "SHOUTcast MPEG-2 ADTS-AAC Encoder v%s" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.sln b/Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.sln new file mode 100644 index 00000000..7228e38b --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enc_fhgaac", "enc_fhgaac.vcproj", "{1EB5ECD6-A4E1-4AEE-99D3-3280F60433F2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp4v2", "..\libmp4v2\libmp4v2.vcproj", "{EFB9B882-6A8B-463D-A8E3-A2807AFC5D9F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1EB5ECD6-A4E1-4AEE-99D3-3280F60433F2}.Debug|Win32.ActiveCfg = Debug|Win32 + {1EB5ECD6-A4E1-4AEE-99D3-3280F60433F2}.Debug|Win32.Build.0 = Debug|Win32 + {1EB5ECD6-A4E1-4AEE-99D3-3280F60433F2}.Release|Win32.ActiveCfg = Release|Win32 + {1EB5ECD6-A4E1-4AEE-99D3-3280F60433F2}.Release|Win32.Build.0 = Release|Win32 + {EFB9B882-6A8B-463D-A8E3-A2807AFC5D9F}.Debug|Win32.ActiveCfg = Debug|Win32 + {EFB9B882-6A8B-463D-A8E3-A2807AFC5D9F}.Debug|Win32.Build.0 = Debug|Win32 + {EFB9B882-6A8B-463D-A8E3-A2807AFC5D9F}.Release|Win32.ActiveCfg = Release|Win32 + {EFB9B882-6A8B-463D-A8E3-A2807AFC5D9F}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.vcproj b/Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.vcproj new file mode 100644 index 00000000..cfb24d94 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.vcproj @@ -0,0 +1,322 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="enc_fhgaac" + ProjectGUID="{1EB5ECD6-A4E1-4AEE-99D3-3280F60433F2}" + RootNamespace="enc_fhgaac" + Keyword="Win32Proj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="../Wasabi;../libmp4v2" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ENC_FHGAAC_EXPORTS;_WIN32_WINNT=0x500" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + TreatWChar_tAsBuiltInType="true" + ForceConformanceInForLoopScope="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="shlwapi.lib" + OutputFile="$(ProgramFiles)/Winamp/Plugins/enc_fhgaac.dll" + LinkIncremental="2" + IgnoreDefaultLibraryNames="" + GenerateDebugInformation="true" + ProgramDatabaseFile="$(OutDir)/enc_fhgaac.pdb" + SubSystem="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + ImportLibrary="$(OutDir)/enc_fhgaac.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="1" + FavorSizeOrSpeed="2" + AdditionalIncludeDirectories="../Wasabi;../libmp4v2" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ENC_FHGAAC_EXPORTS;_WIN32_WINNT=0x500" + StringPooling="true" + RuntimeLibrary="2" + BufferSecurityCheck="false" + TreatWChar_tAsBuiltInType="true" + ForceConformanceInForLoopScope="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + DisableSpecificWarnings="4244" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="shlwapi.lib msvcrt.lib" + OutputFile="$(ProgramFiles)/Winamp/Plugins/enc_fhgaac.dll" + LinkIncremental="1" + GenerateManifest="false" + IgnoreAllDefaultLibraries="true" + IgnoreDefaultLibraryNames="msvcprt.lib" + GenerateDebugInformation="true" + ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + RandomizedBaseAddress="1" + ImportLibrary="$(OutDir)/enc_fhgaac.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + <ProjectReference + ReferencedProjectIdentifier="{EFB9B882-6A8B-463D-A8E3-A2807AFC5D9F}" + RelativePathToProject="..\libmp4v2\libmp4v2.vcproj" + /> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\ADTSAACEncoder.cpp" + > + </File> + <File + RelativePath=".\ADTSAACEncoder.h" + > + </File> + <File + RelativePath="..\nu\AutoWideFn.h" + > + </File> + <File + RelativePath=".\config.cpp" + > + </File> + <File + RelativePath=".\encoder_common.h" + > + </File> + <File + RelativePath=".\FhGAACEncoder.cpp" + > + </File> + <File + RelativePath=".\FhGAACEncoder.h" + > + </File> + <File + RelativePath=".\libirc.lib" + > + </File> + <File + RelativePath=".\main.cpp" + > + </File> + <File + RelativePath=".\mp4FastAAClib.lib" + > + </File> + <File + RelativePath=".\MP4Writer.cpp" + > + </File> + <File + RelativePath=".\MP4Writer.h" + > + </File> + <File + RelativePath=".\preferences.cpp" + > + </File> + <File + RelativePath=".\preferences_adts.cpp" + > + </File> + <File + RelativePath=".\preferences_mp4.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\config.h" + > + </File> + <File + RelativePath=".\preferences.h" + > + </File> + <File + RelativePath=".\resource.h" + > + </File> + <File + RelativePath="..\nu\Slider.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + <File + RelativePath=".\enc_fhgaac.rc" + > + </File> + <File + RelativePath=".\fraunhofer_wa_prefs_noalpha.bmp" + > + </File> + </Filter> + <Filter + Name="UI Helpers" + > + <File + RelativePath="..\nu\ComboBox.h" + > + </File> + <File + RelativePath=".\link_control.cpp" + > + </File> + <File + RelativePath=".\link_control.h" + > + </File> + </Filter> + <File + RelativePath="..\nsutil\nsutil.lib" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Src/Plugins/Encoder/enc_fhgaac/encoder_common.h b/Src/Plugins/Encoder/enc_fhgaac/encoder_common.h new file mode 100644 index 00000000..4b8882bd --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/encoder_common.h @@ -0,0 +1,9 @@ +#pragma once +#include "../nsv/enc_if.h" +class EncoderCommon : public AudioCoder +{ +public: + virtual void PrepareToFinish()=0; + virtual void Finish(const wchar_t *filename){} + char tool[256]; +};
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/fraunhofer_wa_prefs_noalpha.bmp b/Src/Plugins/Encoder/enc_fhgaac/fraunhofer_wa_prefs_noalpha.bmp Binary files differnew file mode 100644 index 00000000..f3edc518 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/fraunhofer_wa_prefs_noalpha.bmp diff --git a/Src/Plugins/Encoder/enc_fhgaac/libirc.lib b/Src/Plugins/Encoder/enc_fhgaac/libirc.lib Binary files differnew file mode 100644 index 00000000..c91176b7 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/libirc.lib diff --git a/Src/Plugins/Encoder/enc_fhgaac/link_control.cpp b/Src/Plugins/Encoder/enc_fhgaac/link_control.cpp new file mode 100644 index 00000000..5f34f40b --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/link_control.cpp @@ -0,0 +1,63 @@ +#include <windows.h> +#include "link_control.h" + +static HCURSOR link_hand_cursor; +static LRESULT link_handlecursor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + LRESULT ret = CallWindowProcW((WNDPROC)GetPropW(hwndDlg, L"link_proc"), hwndDlg, uMsg, wParam, lParam); + // override the normal cursor behaviour so we have a hand to show it is a link + if(uMsg == WM_SETCURSOR) + { + if((HWND)wParam == hwndDlg) + { + if(!link_hand_cursor) + { + link_hand_cursor = LoadCursor(NULL, IDC_HAND); + } + SetCursor(link_hand_cursor); + return TRUE; + } + } + return ret; +} + +void link_startsubclass(HWND hwndDlg, UINT id){ +HWND ctrl = GetDlgItem(hwndDlg, id); + SetPropW(ctrl, L"link_proc", + (HANDLE)(LONG_PTR)SetWindowLongPtrW(ctrl, GWLP_WNDPROC, (LONG_PTR)link_handlecursor)); +} + +void link_handledraw(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (uMsg == WM_DRAWITEM) + { + DRAWITEMSTRUCT *di = (DRAWITEMSTRUCT *)lParam; + if (di->CtlType == ODT_BUTTON) + { + wchar_t wt[123] = {0}; + int y; + RECT r; + HPEN hPen, hOldPen; + GetDlgItemTextW(hwndDlg, (INT)wParam, wt, 123); + + // draw text + SetTextColor(di->hDC, (di->itemState & ODS_SELECTED) ? RGB(220, 0, 0) : RGB(0, 0, 220)); + r = di->rcItem; + r.left += 2; + DrawTextW(di->hDC, wt, -1, &r, DT_VCENTER | DT_SINGLELINE); + + memset(&r, 0, sizeof(r)); + DrawTextW(di->hDC, wt, -1, &r, DT_SINGLELINE | DT_CALCRECT); + + // draw underline + y = di->rcItem.bottom - ((di->rcItem.bottom - di->rcItem.top) - (r.bottom - r.top)) / 2 - 1; + hPen = CreatePen(PS_SOLID, 0, (di->itemState & ODS_SELECTED) ? RGB(220, 0, 0) : RGB(0, 0, 220)); + hOldPen = (HPEN) SelectObject(di->hDC, hPen); + MoveToEx(di->hDC, di->rcItem.left + 2, y, NULL); + LineTo(di->hDC, di->rcItem.right + 2 - ((di->rcItem.right - di->rcItem.left) - (r.right - r.left)), y); + SelectObject(di->hDC, hOldPen); + DeleteObject(hPen); + + } + } +} diff --git a/Src/Plugins/Encoder/enc_fhgaac/link_control.h b/Src/Plugins/Encoder/enc_fhgaac/link_control.h new file mode 100644 index 00000000..a9008d48 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/link_control.h @@ -0,0 +1,7 @@ +#pragma once +#include <windows.h> + +extern "C" { +void link_startsubclass(HWND hwndDlg, UINT id); +void link_handledraw(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +}
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/main.cpp b/Src/Plugins/Encoder/enc_fhgaac/main.cpp new file mode 100644 index 00000000..90fefb2a --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/main.cpp @@ -0,0 +1,263 @@ +#pragma comment(linker, "-nodefaultlib:libmmd.lib") +#pragma message(__FILE__": telling linker to ignore libmmd.lib") + +#include "FhGAACEncoder.h" +#include <windows.h> +#include <mmsystem.h> +#include <stdio.h> +#include "../nsv/enc_if.h" +#include "config.h" +#include "preferences.h" +#include "resource.h" +#include <api/service/waservicefactory.h> +#include "../Agave/Language/api_language.h" +#include "../winamp/wa_ipc.h" +#include "../nu/AutoWideFn.h" +#include <strsafe.h> +#include "../nu/AutoWideFn.h" +#include "encoder_common.h" +#include "ADTSAACEncoder.h" + +#define ENC_VERSION "1.08" + +HWND winampwnd = 0; +api_service *WASABI_API_SVC = 0; +api_language *WASABI_API_LNG = 0; +api_application *WASABI_API_APP = 0; +HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0; +HINSTANCE enc_fhg_HINST = 0; + +static HINSTANCE GetMyInstance() +{ + MEMORY_BASIC_INFORMATION mbi = {0}; + if(VirtualQuery(GetMyInstance, &mbi, sizeof(mbi))) + return (HINSTANCE)mbi.AllocationBase; + return NULL; +} + +void GetLocalisationApiService(void) +{ + if (!enc_fhg_HINST) + enc_fhg_HINST = GetMyInstance(); + + if(winampwnd && !WASABI_API_LNG) + { + // loader so that we can get the localisation service api for use + if(!WASABI_API_SVC) + { + WASABI_API_SVC = (api_service*)SendMessage(winampwnd, WM_WA_IPC, 0, IPC_GET_API_SERVICE); + if (WASABI_API_SVC == (api_service*)1) + { + WASABI_API_SVC = NULL; + return; + } + } + + if (!WASABI_API_SVC) + return; + + if(!WASABI_API_APP) + { + waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(applicationApiServiceGuid); + if (sf) WASABI_API_APP = reinterpret_cast<api_application*>(sf->getInterface()); + } + + if(!WASABI_API_LNG) + { + waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(languageApiGUID); + if (sf) WASABI_API_LNG = reinterpret_cast<api_language*>(sf->getInterface()); + } + + // need to have this initialised before we try to do anything with localisation features + WASABI_API_START_LANG(GetMyInstance(),EncFhgAacLangGUID); + } +} + +extern "C" +{ + + unsigned int __declspec(dllexport) GetAudioTypes3(int idx, char *desc) + { + switch(idx) + { + case 0: + GetLocalisationApiService(); + StringCchPrintfA(desc, 1024, WASABI_API_LNGSTRING(IDS_ENC_FHGAAC_DESC), ENC_VERSION); + return ENCODER_TYPE_MPEG4; + case 1: + GetLocalisationApiService(); + StringCchPrintfA(desc, 1024, WASABI_API_LNGSTRING(IDC_ENC_ADTS_DESC), ENC_VERSION); + return ENCODER_TYPE_ADTS; + default: + return 0; + } + } + + AudioCoder __declspec(dllexport) *CreateAudio3(int nch, int srate, int bps, unsigned int srct, unsigned int *outt, char *configfile) + { + if (srct == mmioFOURCC('P','C','M',' ')) + { + switch(*outt) + { + case ENCODER_TYPE_MPEG4: + { + FhGAACEncoder *t=0; + AACConfigurationFile *wr = AACConfig_Create(ENCODER_TYPE_MPEG4, configfile); + if (!wr) + return 0; + + t = FhGAACEncoder::CreateDecoder(&wr->config, nch, srate, bps); + free(wr); + return t; + } + + case ENCODER_TYPE_ADTS: + { + ADTSAACEncoder *t=0; + AACConfigurationFile *wr = AACConfig_Create(ENCODER_TYPE_ADTS, configfile); + if (!wr) + return 0; + + t = ADTSAACEncoder::CreateDecoder(&wr->config, nch, srate, bps); + free(wr); + return t; + } + } + } + return NULL; + } + + HWND __declspec(dllexport) ConfigAudio3(HWND hwndParent, HINSTANCE hinst, unsigned int outt, const char *configfile) + { + switch(outt) + { + case ENCODER_TYPE_MPEG4: + { + AACConfigurationFile *wr = AACConfig_Create(ENCODER_TYPE_MPEG4, configfile); + if (!wr) + return 0; + + wr->channels = 2; /* dummy defaults */ + wr->sample_rate = 44100; /* dummy defaults */ + GetLocalisationApiService(); + return WASABI_API_CREATEDIALOGPARAMW(IDD_PREFERENCES_MP4, hwndParent, Preferences_MP4_DlgProc, (LPARAM)wr); + } + case ENCODER_TYPE_ADTS: + { + AACConfigurationFile *wr = AACConfig_Create(ENCODER_TYPE_ADTS, configfile); + if (!wr) + return 0; + + wr->channels = 2; /* dummy defaults */ + wr->sample_rate = 44100; /* dummy defaults */ + GetLocalisationApiService(); + return WASABI_API_CREATEDIALOGPARAMW(IDD_PREFERENCES_ADTS, hwndParent, Preferences_ADTS_DlgProc, (LPARAM)wr); + } + + } + return NULL; + } + +#if 0 // TODO + HWND __declspec(dllexport) ConfigAudio4(HWND hwndParent, HINSTANCE hinst, unsigned int outt, const char *configfile, unsigned int channels, unsigned int sample_rate) + { + switch(outt) + { + case ENCODER_TYPE_MPEG4: + { + AACConfigurationFile *wr = (AACConfigurationFile*)calloc(1, sizeof(AACConfigurationFile)); + if (!wr) + return 0; + + if (configfile) + lstrcpynA(wr->config_file, configfile, MAX_PATH); + else + wr->config_file[0] = 0; + + wr->channels = channels; + wr->sample_rate = sample_rate; + AACConfig_Load(wr); + GetLocalisationApiService(); + return WASABI_API_CREATEDIALOGPARAMW(IDD_PREFERENCES_MP4, hwndParent, Preferences_MP4_DlgProc, (LPARAM)wr); + } + case ENCODER_TYPE_ADTS: + { + AACConfigurationFile *wr = (AACConfigurationFile*)calloc(1, sizeof(AACConfigurationFile)); + if (!wr) + return 0; + + if (configfile) + lstrcpynA(wr->config_file, configfile, MAX_PATH); + else + wr->config_file[0] = 0; + + wr->channels = channels; + wr->sample_rate = sample_rate; + AACConfig_Load(wr); + GetLocalisationApiService(); + return WASABI_API_CREATEDIALOGPARAMW(IDD_PREFERENCES_ADTS, hwndParent, Preferences_ADTS_DlgProc, (LPARAM)wr); + } + + } + return NULL; + } +#endif + + void __declspec(dllexport) PrepareToFinish(const char *filename, AudioCoder *coder) + { + ((EncoderCommon*)coder)->PrepareToFinish(); + } + + void __declspec(dllexport) PrepareToFinishW(const wchar_t *filename, AudioCoder *coder) + { + ((EncoderCommon*)coder)->PrepareToFinish(); + } + + void __declspec(dllexport) FinishAudio3(const char *filename, AudioCoder *coder) + { + ((EncoderCommon*)coder)->Finish(AutoWideFn(filename)); + } + + void __declspec(dllexport) FinishAudio3W(const wchar_t *filename, AudioCoder *coder) + { + ((EncoderCommon*)coder)->Finish(filename); + } + + int __declspec(dllexport) GetConfigItem(unsigned int outt, const char *item, char *data, int len, char *configfile) + { + if (outt == mmioFOURCC('A','A','C','f')) + { + if (!lstrcmpiA(item,"extension")) + lstrcpynA(data,"m4a",len); + return 1; + } + else if (outt == mmioFOURCC('A','D','T','S')) + { + if (!lstrcmpiA(item,"extension")) + { + lstrcpynA(data,"aac",len); + } + else if (!lstrcmpiA(item,"aot")) + { + AACConfigurationFile *wr = AACConfig_Create(ENCODER_TYPE_ADTS, configfile); + if (wr) + { + StringCbPrintfA(data, len, "%u", AACConfig_GetAOT(&wr->config)); + } + else + { + StringCbPrintfA(data, len, "%u", AUD_OBJ_TYP_LC); + } + free(wr); + } + return 1; + } + return 0; + } + + void __declspec(dllexport) SetWinampHWND(HWND hwnd) + { + winampwnd = hwnd; + + } +}
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.h b/Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.h new file mode 100644 index 00000000..e7350669 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.h @@ -0,0 +1,978 @@ +/************************* Fast MPEG AAC Audio Encoder ********************** + + (C) Copyright Fraunhofer IIS (2004-2010) + All Rights Reserved + + $Id: mp4FastAAClib.h,v 1.8 2013/10/29 00:56:15 dromagod Exp $ + Initial author: M. Schug / A. Groeschel + contents/description: Fast MPEG AAC Encoder Interface Library Functions + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef _mp4FastAAClib_h_ +#define _mp4FastAAClib_h_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* ------------------------ structure alignment ---------------------------*/ + +#if defined(WIN32) || defined(WIN64) +#pragma pack(push, 1) +#endif + +/*-------------------------- defines --------------------------------------*/ + +/* + * calling convention + */ + +#ifndef MPEG4ENCAPI +#if defined(WIN32) || defined(WIN64) +#define MPEG4ENCAPI __stdcall +#else +#define MPEG4ENCAPI +#endif +#endif + +/*-------------------- enum definitions -----------------------------------*/ + +typedef enum +{ + AUD_OBJ_TYP_LC = 2, /* AAC LC */ + AUD_OBJ_TYP_LTP = 4, /* AAC LTP */ + AUD_OBJ_TYP_HEAAC = 5, /* AAC LC + SBR */ + AUD_OBJ_TYP_ER_LC = 17, /* ER AAC LC */ + AUD_OBJ_TYP_ER_LTP = 19, /* ER AAC LTP */ + AUD_OBJ_TYP_ER_SCAL = 20, /* ER AAC LC scalable */ + AUD_OBJ_TYP_PS = 29, /* AAC LC + SBR + PS */ + AUD_OBJ_TYP_MP2_LC = 129, /* virtual AOT MP2 Low Complexity Profile */ + AUD_OBJ_TYP_MP2_SBR = 132, /* virtual AOT MP2 Low Complexity Profile with SBR */ + AUD_OBJ_TYP_SBR_DS = 133, /* virtual AOT for downsampled SBR */ + AUD_OBJ_TYP_ER_SCAL_SBR = 148, /* ER AAC LC scalable + SBR */ + AUD_OBJ_TYP_ER_SCAL_SBR_PS = 157, /* ER AAC LC scalable + SBR + PS */ + AUD_OBJ_TYP_MPS = 30 +} AUD_OBJ_TYP; + +typedef enum { + MP4_QUAL_FAST=0, + MP4_QUAL_MEDIUM, + MP4_QUAL_HIGH, + MP4_QUAL_HIGHEST /* Always resample to preferred sample rate */ +} MPEG4ENC_QUALITY; + +typedef enum { + MP4_TT_RAW = 0, + MP4_TT_ADIF = 1, + MP4_TT_ADTS = 2, + MP4_TT_ADTSCRC = 3, + MP4_TT_LOAS = 4, + MP4_TT_LOAS_NOSMC = 5, + MP4_TT_LATM = 6, + MP4_TT_LATM_NOSMC = 7, + /* MP4_TT_LOAS_CRC = 8, */ + /* MP4_TT_LATM_CRC = 9, */ + ___mp4_tt_dummy +} MPEG4ENC_TRANSPORT_TYPE; + +typedef enum { + /* These are the standard MPEG Channel mappings */ + MP4_CH_MODE_INVALID = 0, + MP4_CH_MODE_MONO, /* 1 channel mono */ + MP4_CH_MODE_STEREO, /* 2 channel stereo */ + MP4_CH_MODE_3, /* 3 channel audio ( center + left/right front speaker ) */ + MP4_CH_MODE_4, /* 4 channel audio ( center + left/right front + rear surround speaker ) */ + MP4_CH_MODE_5, /* 5 channel audio ( center + left/right front + left/right surround speaker ) */ + MP4_CH_MODE_5_1, /* 5.1 channel audio ( center + left/right front + left/right surround speaker + LFE ) */ + MP4_CH_MODE_7_1, /* 7.1 channel audio ( center + left/right front + + left/right outside front + left/right surround speaker + LFE ) */ + /* Channel mappings 8 to 15 are reserved */ + MP4_CH_MODE_6_1 = 11, /* 6.1 channel audio ( center + front left/right + surround left/right + rear surround center + LFE ) */ + MP4_CH_MODE_7_1_REAR_SURROUND = 12, /* 7.1 channel audio ( center + front left/right + surround left/right + rear surround left/right + LFE ) */ + MP4_CH_MODE_7_1_TOP_FRONT = 14, /* 7.1 channel audio ( center + front left/right + surround left/right + LFE + + TOP front left/right ) */ + + /* Some non standard channel mappings */ + MP4_CH_MODE_DUAL_MONO = 16, /* 2 independent channels */ + MP4_CH_MODE_4TIMES1, /* 4 independent channels */ + MP4_CH_MODE_6TIMES1, /* 6 independent channels */ + MP4_CH_MODE_8TIMES1, /* 8 independent channels */ + MP4_CH_MODE_12TIMES1, /* 12 independent channels */ + MP4_CH_MODE_16TIMES1, + MP4_CH_MODE_2TIMES2, /* 2 stereo channel pairs */ + MP4_CH_MODE_3TIMES2, /* 3 stereo channel pairs */ + MP4_CH_MODE_4TIMES2, /* 4 stereo channel pairs */ + MP4_CH_MODE_6TIMES2, /* 6 stereo channel pairs */ + + MP4_CH_MODE_7_1_SIDE_CHANNEL = 32, /* 7.1 channel audio ( center + left/right front + + left/right side channels + left/right surround speakers + LFE ) */ + MP4_CH_MODE_7_1_FRONT_CENTER, /* 7.1 channel audio ( center + left/right front + + left/right frontal center speakers + left/right surround speakers + LFE ) */ + + /* Channel mapping for parametric stereo + (only works with AUD_OBJ_TYP_HEAAC, AUD_OBJ_TYP_PS) */ + MP4_CH_MODE_PARAMETRIC_STEREO = 64, /* 2 channel stereo input, transmit 1 channel mono + SBR + PS */ + MP4_CH_MODE_MPEGS_5x5 = 128, /* 6 channel input, transmit 1/2 channel(s) (+ SBR) + MPEGS Payload */ +#ifdef SUPPORT_UPMIX + MP4_CH_MODE_MPEGS_SXPRO_UPMIX, /* 2 channel input, sxPro Upmix, transmit 2 channel(s) (+ SBR) + MPEGS Payload */ +#endif +#ifdef SUPPORT_MPS_7_X_7 + MP4_CH_MODE_MPEGS_7x7_REAR_SURROUND, /* 8 channel input (5.1 + left/right side speakers), transmit 2 channel(s) (+ SBR) + MPEGS Payload */ + /* 7.1 front center channel mapping is not yet supported! */ + MP4_CH_MODE_MPEGS_7x7_FRONT_CENTER, /* 8 channel input (5.1 + left/right frontal center speakers), transmit 2 channel(s) (+ SBR) + MPEGS Payload */ +#ifdef SUPPORT_MPS_7_5_7 + MP4_CH_MODE_MPEGS_757_FRONT_CENTER, /* 8 channel input (5.1 + left/right frontal center speakers), transmit 5 channel(s) (+ SBR) + MPEGS Payload */ + MP4_CH_MODE_MPEGS_757_REAR_SURROUND, /* 8 channel input (5.1 + left/right side speakers), transmit 5 channel(s) (+ SBR) + MPEGS Payload */ +#endif /* SUPPORT_MPS_7_5_7 */ +#endif /* SUPPORT_MPS_7_X_7 */ + + /* The following channel mappings are not yet supported! */ + MP4_CH_MODE_MPEGS_5x5_BLIND, + MP4_CH_MODE_MPEGS_ARBITRARY_DOWNMIX_MONO, /* 7 channel input, transmit 1 channel (+ SBR) + MPEGS Payload */ + MP4_CH_MODE_MPEGS_ARBITRARY_DOWNMIX_STEREO /* 8 channel input, transmit 2 channel(s) (+ SBR) + MPEGS Payload */ + +} MPEG4ENC_CH_MODE; + +typedef enum { + + MP4_MPEGS_DOWNMIX_DEFAULT = 0, + /* The following config (FORCE_STEREO) is not yet supported! */ + MP4_MPEGS_DOWNMIX_FORCE_STEREO, + MP4_MPEGS_DOWNMIX_MATRIX_COMPAT, + /* The following configs are not yet supported! */ + MP4_MPEGS_DOWNMIX_ARBITRARY_MONO, + MP4_MPEGS_DOWNMIX_ARBITRARY_STEREO +#ifdef SUPPORT_MPS_7_5_7 + , MP4_MPEGS_DOWNMIX_51 +#endif /* SUPPORT_MPS_7_5_7 */ + +} MPEG4ENC_MPEGS_DOWNMIX_CONFIG; + + +typedef enum { + MPEG4ENC_NO_ERROR = 0, + MPEG4ENC_UNKNOWN_ERROR, + MPEG4ENC_PARAM_ERROR, + MPEG4ENC_NOTIMPLEMENTED_ERROR, + MPEG4ENC_MEMORY_ERROR, + MPEG4ENC_INIT_ERROR, + MPEG4ENC_FATAL_ERROR, + MPEG4ENC_STACK_ALIGNMENT_ERROR, + MPEG4ENC_METADATA_ERROR, + MPEG4ENC_AOT_NOT_SUPPORTED = 64, + MPEG4ENC_CHMODE_NOT_SUPPORTED, + MPEG4ENC_BRMODE_NOT_SUPPORTED, + MPEG4ENC_WARNING_MIN = 128, + MPEG4ENC_WARNING_STACK_ALIGNMENT = MPEG4ENC_WARNING_MIN, + MPEG4ENC_WARNING_METADATA, + MPEG4ENC_WARNING_NOSYNC_TRIGGERED +} MPEG4ENC_ERROR; + +typedef enum { + MP4_SBRSIG_IMPLICIT = 0, /* implicit signaling (signaling 1) */ + MP4_SBRSIG_EXPL_BC = 1, /* explicit backward compatible signaling (signaling 2.B.) */ + MP4_SBRSIG_EXPL_HIER = 2 /* explicit hierarchical signaling (signaling 2.A.) */ +} MPEG4ENC_SIGNALING_MODE; + +typedef enum { + MP4_MPEGS_PAYLOAD_EMBED = 0, /* in case of MPEG-4 transportation, embed payload into AAC payload */ + MP4_MPEGS_NO_PAYLOAD_EMBED = 1, /* in case of MPEG-4 transportation, do *not* embed payload into AAC payload, but transport payload in extra stream */ + MP4_MPEGS_PAYLOAD_EMBED_ASCEXT = 2 /* M16117 */ +} MPEG4ENC_MPEGS_PAYLOAD_MODE; + +typedef enum { + MP4_BR_MODE_CBR = 0, + MP4_BR_MODE_VBR_1 = 1, + MP4_BR_MODE_VBR_2 = 2, + MP4_BR_MODE_VBR_3 = 3, + MP4_BR_MODE_VBR_4 = 4, + MP4_BR_MODE_VBR_5 = 5, + MP4_BR_MODE_VBR_6 = 6, + MP4_BR_MODE_SFR = 7, /* Superframing */ + MP4_BR_MODE_DABPLUS = 8, /* Superframing + DAB+ constraints */ + MP4_BR_MODE_DRMPLUS = 9, /* Superframing + DRM+ constraints */ + MP4_BR_MODE_DMB = 10 +} MPEG4ENC_BITRATE_MODE; + +typedef enum{ + MP4_GRANULE_960 = 960, + MP4_GRANULE_1024 = 1024 +} MPEG4ENC_GRANULE_LEN; + +typedef enum { + MP4_METADATA_NONE = 0, /* do not embed any metadata */ + MP4_METADATA_MPEG, /* embed MPEG defined metadata only */ + MP4_METADATA_MPEG_ETSI /* embed all metadata */ +} MPEG4ENC_METADATA_MODE; + +typedef enum { + MP4_METADATA_DRC_NONE = 0, + MP4_METADATA_DRC_FILMSTANDARD, + MP4_METADATA_DRC_FILMLIGHT, + MP4_METADATA_DRC_MUSICSTANDARD, + MP4_METADATA_DRC_MUSICLIGHT, + MP4_METADATA_DRC_SPEECH, +#ifdef SUPPORT_METADATA_DRC_MOBILE + MP4_METADATA_DRC_MOBILE, +#endif + MP4_METADATA_DRC_EMBED_EXTERN = -1, + MP4_METADATA_DRC_NOT_PRESENT = -2 +} MPEG4ENC_METADATA_DRC_PROFILE; + +typedef enum { + MPEG4ENC_METADATA_DMX_GAIN_0_dB = 0, + MPEG4ENC_METADATA_DMX_GAIN_1_5_dB = 1, + MPEG4ENC_METADATA_DMX_GAIN_3_dB = 2, + MPEG4ENC_METADATA_DMX_GAIN_4_5_dB = 3, + MPEG4ENC_METADATA_DMX_GAIN_6_dB = 4, + MPEG4ENC_METADATA_DMX_GAIN_7_5_dB = 5, + MPEG4ENC_METADATA_DMX_GAIN_9_dB = 6, + MPEG4ENC_METADATA_DMX_GAIN_INF = 7, +} MPEG4ENC_METADATA_DMX_GAIN; + +typedef enum { + MP4_METADATA_DSUR_NOT_INDICATED = 0, /* Dolby Surround mode not indicated */ + MP4_METADATA_DSUR_NOT_USED = 1, /* 2-ch audio part is not Dolby surround encoded */ + MP4_METADATA_DSUR_IS_USED = 2 /* 2-ch audio part is Dolby surround encoded */ +} MPEG4ENC_METADATA_DSUR_IND; + +typedef enum { /* see ETSI TS 101 154 V1.11.1, section C.5.2.2.3 and C.5.3 */ + MP4_METADATA_DRCPRESENTATION_NOT_INDICATED = 0, + MP4_METADATA_DRCPRESENTATION_MODE_1 = 1, + MP4_METADATA_DRCPRESENTATION_MODE_2 = 2 +} MPEG4ENC_METADATA_DRCPRESENTATION; + +typedef enum { + MP4_MAX_ASC_SIZE = 64, + MP4_MAX_SMC_SIZE = 256, + MAX_DRC_BANDS = (1<<4), + MP4_MAX_NUM_STREAMS = 2 +} MPEG4ENC_DEFINES; + + +typedef enum { + MPEG4ENC_SYNCFRAME_STARTUP = 0, + MPEG4ENC_SYNCFRAME_SWITCH, + MPEG4ENC_SYNCFRAME_DASH +} MPEG4ENC_SYNCFRAME_TYPES; + +typedef enum { + MP4_MPSDMXGAIN_INVALID = -1, + MP4_MPSDMXGAIN_0_dB = 0, + MP4_MPSDMXGAIN_1_5_dB = 1, + MP4_MPSDMXGAIN_3_dB = 2, + MP4_MPSDMXGAIN_4_5_dB = 3, + MP4_MPSDMXGAIN_6_dB = 4, + MP4_MPSDMXGAIN_7_5_dB = 5, + MP4_MPSDMXGAIN_9_dB = 6, + MP4_MPSDMXGAIN_12_dB = 7 +} MPEG4ENC_MPS_DMX_GAIN; + +#ifdef SUPPORT_UPMIX +typedef enum { + MP4_SXPRO_DEFAULT = 0, + MP4_SXPRO_DRY, + MP4_SXPRO_VIBRANT +} MP4_SXPRO_UPMIX_WORKMODE; + +typedef enum { + MP4_SXPRO_LFE_OFF = 0, + MP4_SXPRO_LFE_ON +} MP4_SXPRO_UPMIX_LFE; +#endif + +/*-------------------- structure definitions ------------------------------*/ + +typedef struct { + AUD_OBJ_TYP aot; + int nBitRate; + MPEG4ENC_BITRATE_MODE bitrateMode; + MPEG4ENC_QUALITY quality; + MPEG4ENC_CH_MODE chMode; + int nSampleRateIn; + MPEG4ENC_TRANSPORT_TYPE transportFormat; + MPEG4ENC_SIGNALING_MODE sbrSignaling; + MPEG4ENC_GRANULE_LEN nGranuleLength; + MPEG4ENC_METADATA_MODE metadataMode; +} MPEG4ENC_SETUP; + +typedef enum{ + MP4_THREADING_MODE_SINGLE = 1, + MP4_THREADING_MODE_MULTIPLE_BLOCKING, + MP4_THREADING_MODE_MULTIPLE_NOBLOCKING +} MPEG4ENC_THREADING_MODE; + + +typedef MPEG4ENC_SETUP *HANDLE_MPEG4ENC_SETUP; + +struct MPEG4ENC_ENCODER; +typedef struct MPEG4ENC_ENCODER * HANDLE_MPEG4ENC_ENCODER; + +typedef struct +{ + int nOutputStreams; /* number of output streams */ + int nAccessUnitsPerStream[MP4_MAX_NUM_STREAMS]; /* number of AUs in bitstream buffer */ + int *pnAccessUnitOffset[MP4_MAX_NUM_STREAMS]; /* offset of AUs per stream, i.e. pnAccessUnitOffset[stream][numberAuPerStream] */ + int *pByteCnt[MP4_MAX_NUM_STREAMS]; /* lenght of each single AU in bitstream buffer */ + int *pIsSync[MP4_MAX_NUM_STREAMS]; /* flag, signaling if AU is self contained i.e. does not contain backward dependencies */ +} MPEG4ENC_AUINFO; + +typedef struct { + int nAscSizeBits; + unsigned char ascBuffer[MP4_MAX_ASC_SIZE]; +} MPEG4ENC_ASCBUF; + +typedef struct { + int nSmcSizeBits; + unsigned char smcBuffer[MP4_MAX_ASC_SIZE]; +} MPEG4ENC_SMCBUF; + +typedef struct +{ + float fBandWidth; /* audio bandwidth in Hz */ + int nDelay; /* encoder delay in units of sample frames */ + int nDelayCore; /* encoder delay in units of sample frames */ + int nCbBufSizeMin; /* minimum size of output buffer (bytes) */ + int nSyncFrameDelay; + + int nBitRate[MP4_MAX_NUM_STREAMS]; + int nMaxBitRate[MP4_MAX_NUM_STREAMS]; + int nBitResMax[MP4_MAX_NUM_STREAMS]; + int nSamplingRate[MP4_MAX_NUM_STREAMS]; + int nSamplesFrame[MP4_MAX_NUM_STREAMS]; + + unsigned int nAncBytesPerFrame; + int aot; + int nValidAsc; + MPEG4ENC_ASCBUF ascBuf[MP4_MAX_NUM_STREAMS]; + MPEG4ENC_SMCBUF smcBuf; + int nProfLev; + + char pVersion[50]; + char pBuildDate[50]; + +} MPEG4ENC_INFO; + +typedef struct MPEG4ENC_METADATA +{ + MPEG4ENC_METADATA_DRC_PROFILE drc_profile; /* MPEG DRC compression profile */ + MPEG4ENC_METADATA_DRC_PROFILE comp_profile; /* ETSI heavy compression profile */ + + float drc_TargetRefLevel; /* used to define expected level to */ + float comp_TargetRefLevel; /* adjust limiter to avoid overload */ + + float drc_ext; /* external feed DRC compression value */ + float comp_ext; /* external feed heavy compression value */ + + int prog_ref_level_present; /* flag, if prog_ref_level is present */ + float prog_ref_level; /* Programme Reference Level = Dialogue Level: */ + /* -31.75dB .. 0 dB ; stepsize: 0.25dB */ + + int PCE_mixdown_idx_present; /* flag, if dmx-idx should be written in programme config element */ + int ETSI_DmxLvl_present; /* flag, if dmx-lvl should be written in ETSI-ancData */ + MPEG4ENC_METADATA_DMX_GAIN centerMixLevel; /* center downmix level */ + MPEG4ENC_METADATA_DMX_GAIN surroundMixLevel; /* surround downmix level */ + + MPEG4ENC_METADATA_DSUR_IND dolbySurroundMode; /* Indication for Dolby Surround Encoding Mode */ + + MPEG4ENC_METADATA_DRCPRESENTATION drcPresentationMode; /* DRC presentation mode (ETSI) */ + + /* preprocessing */ + int dcFilter; /* flag specifying if DC filtering is applied to input */ + int lfeLowpassFilter; /* flag specifying if 120 Hz low-pass filter is applied to LFE channel */ + int surPhase90; /* flag specifying if 90 degree phase shift is applied to surround channels */ + int surAtt3dB; /* flag specifying if 3 dB attenuation is applied to surround channels */ + +} MPEG4ENC_METADATA; + +typedef struct MPEG4ENC_EXTMETADATA +{ +#if 1 /* ENABLE_ISO14496_3_2009_AMD4 */ + /* not fully supported yet */ + /* extended ancillary data */ + int pseudoSurroundEnable; /* flag */ + int extAncDataEnable; /* flag */ + int extDownmixLevelEnable; /* flag */ + int extDownmixLevel_A; /* downmix level index A (0...7, according to table) */ + int extDownmixLevel_B; /* downmix level index B (0...7, according to table) */ + int dmxGainEnable; /* flag */ + float dmxGain5; /* gain factor for downmix to 5 channels */ + float dmxGain2; /* gain factor for downmix to 2 channels */ + int lfeDmxEnable; /* flag */ + int lfeDmxLevel; /* downmix level index for LFE (0..15, according to table) */ +#endif +} MPEG4ENC_EXTMETADATA; + +typedef struct MPEG4ENC_METADATA *HANDLE_MPEG4ENC_METADATA; +typedef struct MPEG4ENC_EXTMETADATA *HANDLE_MPEG4ENC_EXTMETADATA; + + +/*-------------------- function prototypes --------------------------------*/ + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_Configure + description : fills encoder handle structure with default values + to be called before MPEG4ENC_Open + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_Configure ( + HANDLE_MPEG4ENC_ENCODER *phMp4Enc, /* adress of encoder handle */ + const HANDLE_MPEG4ENC_SETUP hSetup /* handle to filled setup stucture */ + ); + +/*--------------------------------------------------------------------------- + + functionname:MPEG4ENC_GetVersionInfo + description: get Version Number information about the encoding process + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_GetVersionInfo(char *const pVersionInfo, + const int bufSize); + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_Open + description: allocate and initialize a new encoder instance + samplesFirst holds the desired number of input + samples (of all channels) for the first frame + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ---------------------------------------------------------------------------*/ + +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_Open( + HANDLE_MPEG4ENC_ENCODER *phMp4Enc, /* pointer to encoder handle, initialized on return */ + unsigned int* const pSamplesFirst /* number of samples needed to encode the first frame */ + ); + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_Close + description: deallocate an encoder instance + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ---------------------------------------------------------------------------*/ + +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_Close ( + HANDLE_MPEG4ENC_ENCODER* phMp4Enc /* pointer to an encoder handle */ + ); + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_Encode + description: encode the passed samples + modifies: pSamplesConsumed: number of used samples + pSamplesNext: number of samples needed to encode + the next frame + pOutputBytes: number of valid bytes in pOutput + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ---------------------------------------------------------------------------*/ + +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_Encode( + HANDLE_MPEG4ENC_ENCODER const hMp4Enc, /* an encoder handle */ + const float* const pSamples, /* pointer to audio samples, interleaved*/ + const int nSamples, /* number of samples + must be a multiple of number of input channels */ + int* pSamplesConsumed, /* number of used input samples, + will be a multiple of number of input channels */ + unsigned int* const pSamplesNext, /* number of desired samples for a complete frame */ + unsigned char* const pOutput, /* pointer to bitstream buffer */ + const int nOutputBufSize, /* the size of the output buffer; + must be large enough to receive all data */ + int* const pOutputBytes, /* number of bytes in bitstream buffer */ + MPEG4ENC_AUINFO **ppAuInfo /* */ + ); + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_SRInfo + description : returns the sample rate range and + to be called before MPEG4ENC_Open + returns: MPEG4ENC_NO_ERROR on success, + MPEG4ENC_INIT_ERROR if the bitrate, channel, aot configuration + is not supported + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SRInfo ( + + const int bitRate, /* the targeted bit rate */ + const MPEG4ENC_BITRATE_MODE bitrateMode, /* the bitrateMode */ + const MPEG4ENC_CH_MODE chMode, /* the number of channels to encode */ + const AUD_OBJ_TYP aot, /* the audio object type */ + const MPEG4ENC_QUALITY quality, /* encoder quality */ + int *const sampleRateMin, /* lowest supported */ + int *const sampleRateMax, /* highest supported */ + int *const sampleRatePref /* preferred + sampling frequency for the given + bitrate, channel, aot configuration */ + ); + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_GetInfo + description: get information about the encoding process + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_GetInfo(const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + MPEG4ENC_INFO * const pInfo); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetAncDataRate + description: Sets bitrate for ancillary data + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetAncDataRate( + HANDLE_MPEG4ENC_ENCODER hMp4Enc, + int nAncDataRate + ); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetAncData + description: Passes ancillary data to encoder + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetAncData( + HANDLE_MPEG4ENC_ENCODER const hMp4Enc, /* an encoder handle */ + unsigned char* pAncBytes, /* ancillary data buffer */ + unsigned int* pNumAncBytes /* ancillary data bytes left */ + ); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetOffsets + description: changes mapping of input audio channels to AAC channels + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetOffsets( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const unsigned int nChannels, + const unsigned int *const channelOffset + ); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetSbrTransmissionConfig + description: changes signaling interval of SBR header, additional CRC bits + for SBR data + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetSbrTransmissionConfig( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const int bUseCRC, + const float sendHeaderTimeInterval + ); + + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetInbandPceTimeInterval + description: set update interval for explicit in band PCE transmission + sendPceTimeInterval > 0 -> regular time interval in seconds + sendPceTimeInterval == 0 -> send no PCE (MPEG-2 only) + sendPceTimeInterval < 0 -> send PCE only the 1st frame + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetInbandPceTimeInterval(const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const float sendPceTimeInterval); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetAdtsPceTimeInterval + description: set update interval for explicit channel signaling via PCE in + case of ADTS transport stream, MPEG-2/4 AAC and + channel_configuration == 0 + sendPceTimeInterval > 0 -> regular time interval in seconds + sendPceTimeInterval == 0 -> send no PCE (MPEG-2 only) + sendPceTimeInterval < 0 -> send PCE only the 1st frame + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetAdtsPceTimeInterval( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const float sendPceTimeInterval + ); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_MpsSetSscTimeInterval + description: set update interval for transmission of SpatialSpecificConfig + (SSC) in case of encoding using MPEG Surround + sendSscTimeInterval > 0 -> regular time interval in seconds + sendSscTimeInterval == 0 -> send SSC every (MPEGS) frame + sendSscTimeInterval < 0 -> send SSC only the 1st frame + - in combination with MPEGS only + - MPEGS payload mode has to be MP4_MPEGS_PAYLOAD_EMBED, because + otherwise the SSC is transmitted in a seperate ESD, which has + to be handled by the user + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_MpsSetSscTimeInterval( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const float sendSscTimeInterval + ); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_MpsSetDownmixConfig + description: set MPEG Surround Downmix Configuration + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_MpsSetDownmixConfig( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const MPEG4ENC_MPEGS_DOWNMIX_CONFIG mpegsDownmixCfg + ); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_MpsSetPayloadMode + description: set MPEG Surround Payload Transmission Mode + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_MpsSetPayloadMode( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const MPEG4ENC_MPEGS_PAYLOAD_MODE mpegsPayloadMode + ); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetThreadingMode (deprecated) + description: sets threading mode to single threaded, multiple threaded + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + Please note that this function is deprecated and should not be used any more. + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetThreadingMode(const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const MPEG4ENC_THREADING_MODE threadingMode); + + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_GetError + description: get error text + returns: pointer to an error text + + ------------------------------------------------------------------------------*/ +char* MPEG4ENCAPI +MPEG4ENC_GetError(MPEG4ENC_ERROR error); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetBandwidth + description: set bandwidth by user, returns with actual used bandwidth + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetBandwidth(const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const float proposedBandwidth, + float* usedBandwidth); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetStereoPrePro + description: set bandwidth by user, returns with actual used bandwidth + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetStereoPrePro(const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const int enableStereoPrePro); + + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetLatmSmcTimeInterval + description: set update interval for appearance of stream mux config in + case of LOAS/LATM transport stream + sendSmcTimeInterval > 0 -> regular time interval (every n-th frame, default: 8) + sendSmcTimeInterval == 0 -> send no inband StreamMuxConfig + sendSmcTimeInterval < 0 -> send StreamMuxConfig only the 1st frame + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetLatmSmcTimeInterval( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const int sendSmcTimeInterval + ); + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetLatmNrOfSubframes + description: set the nr of subframes per latm frame in + case of LOAS/LATM transport stream + nrOfSubframes < 1 -> reserved + nrOfSubframes >= 1 -> use 'nrOfSubframes' + + optional, default is 1 + + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetLatmNrOfSubframes( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const int nrOfSubframes + ); + + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_GetLatmSmc + description: returns pointer to and size of LATM stream mux config + + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_GetLatmSmc( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + unsigned char** buffer, + int* nBits + ); + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_Submit_Metadata + description: submit metadata + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_Submit_Metadata( + const HANDLE_MPEG4ENC_ENCODER hMpeg4Enc, /* an encoder handle */ + const HANDLE_MPEG4ENC_METADATA pMetadata /* pointer to metadata */ + ); + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_Submit_ExtMetadata + description: submit metadata + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_Submit_ExtMetadata( + const HANDLE_MPEG4ENC_ENCODER hMpeg4Enc, /* an encoder handle */ + const HANDLE_MPEG4ENC_EXTMETADATA pExtMetadata /* pointer to extended metadata */ + ); + + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_BRInfo + description : Provides the compatible bitrate range + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_BRInfo ( + const AUD_OBJ_TYP aot, + const MPEG4ENC_CH_MODE chMode, + const int samplingRate, + int* brMin, + int* brMax); + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetSbrSpeechConfig + description : Sets SBR Speech config flag + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetSbrSpeechConfig( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + unsigned int flag + ); + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetSbrTimeDiffCoding + description : Sets SBR time differential coding (TDC); + flag==0: Do not use TDC + flag==1: Use TDC + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetSbrTimeDiffCoding( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + unsigned int flag + ); + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetUseIntensityStereo + description : Sets intensity stereo coding (IS); + flag==1: Use IS (default) + flag==0: Do not use IS + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetUseIntensityStereo( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + unsigned int flag + ); + + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SendChCfgZero + description: will always use channel config zero + pce although a standard + channel config could be signalled + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SendChCfgZero( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc + ); + + + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetSyncFrame + description: will generate a synchaable frame + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetSyncFrame( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc + ); + + +/*----------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetSyncFrameWithType + description: will generate a synchaable frame + returns: MPEG4ENC_NO_ERROR on success, an appropriate error code else + + ------------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetSyncFrameWithType( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const MPEG4ENC_SYNCFRAME_TYPES syncType + ); + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_InitDASH + description : Configure encoder for DASH mode + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_InitDASH( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc + ); + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetTransportType + description : Reconfigure Transport Format + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetTransportType( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const MPEG4ENC_TRANSPORT_TYPE transportType + ); + + +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetMPEG4Flag + description : Reconfigure MPEG-2/4 compliance + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetMPEG4Flag( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const int mpeg4Flag + ); + + +#ifdef SUPPORT_UPMIX +/*--------------------------------------------------------------------------- + + functionname: MPEG4ENC_SetSXProUpmixParameter + description : Sets SXPro parameters; + umxMode: Upmix workmode + umxLFE: Upmix LFE on/off + returns: MPEG4ENC_ERROR (error code) + + ---------------------------------------------------------------------------*/ +MPEG4ENC_ERROR MPEG4ENCAPI +MPEG4ENC_SetSXProUpmixParameter( + const HANDLE_MPEG4ENC_ENCODER hMp4Enc, + const MP4_SXPRO_UPMIX_WORKMODE umxMode, + const MP4_SXPRO_UPMIX_LFE umxLFE + ); +#endif + + +/*---------------------------------------------------------------------------*/ +#if defined(WIN32) || defined(WIN64) +#pragma pack(pop) +#endif + +/*-------------------------------------------------------------------------*/ + +#ifdef __cplusplus +} +#endif + +#endif /* _mp4FastAAClib_h_ */ diff --git a/Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.lib b/Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.lib Binary files differnew file mode 100644 index 00000000..842651eb --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.lib diff --git a/Src/Plugins/Encoder/enc_fhgaac/preferences.cpp b/Src/Plugins/Encoder/enc_fhgaac/preferences.cpp new file mode 100644 index 00000000..2c853b1e --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/preferences.cpp @@ -0,0 +1,122 @@ +#include "preferences.h" +#include "resource.h" +#include "../nu/ComboBox.h" +#include "../nu/Slider.h" +#include "../Agave/Language/api_language.h" +#include <strsafe.h> +/* note to maintainers: +the combobox code assumes that the options are in numerical order starting from 0 +if this assumption ever changes, you'll need to map AAC_MODE_* and AAC_PROFILE_* to/from indices +there are some asserts to test this (which will only test in debug mode of course) +*/ +const int bitrate_slider_precision = 4; + +static void SetSliderBitrate(HWND hwnd, unsigned int bitrate) +{ + Slider preset_slider(hwnd, IDC_SLIDER_PRESET); + int low = (unsigned int)SendMessage(GetDlgItem(hwnd,IDC_SLIDER_PRESET), TBM_GETRANGEMIN, 0, 0); + int position = (bitrate - low)/bitrate_slider_precision + low; + preset_slider.SetPosition(position, Slider::REDRAW); +} + +unsigned int GetSliderBitrate(HWND hwnd) +{ + int low = (unsigned int)SendMessage(GetDlgItem(hwnd,IDC_SLIDER_PRESET), TBM_GETRANGEMIN, 0, 0); + int position = SendMessage(GetDlgItem(hwnd,IDC_SLIDER_PRESET),TBM_GETPOS,0,0); + unsigned int bitrate = (position - low)*bitrate_slider_precision + low; + return bitrate; +} + +void UpdateInfo(HWND hwnd, const AACConfiguration *config) +{ + wchar_t temp[128] = {0}; + + switch(AACConfig_GetAOT(config)) + { + case AUD_OBJ_TYP_LC: + SetDlgItemText(hwnd, IDC_INFO_MODE, L"MPEG-4 AAC LC"); + break; + case AUD_OBJ_TYP_HEAAC: + SetDlgItemText(hwnd, IDC_INFO_MODE, L"MPEG-4 HE-AAC"); + break; + case AUD_OBJ_TYP_PS: + SetDlgItemText(hwnd, IDC_INFO_MODE, L"MPEG-4 HE-AACv2"); + break; + } + if (config->mode == AAC_MODE_VBR) + { + StringCbPrintfW(temp, sizeof(temp), WASABI_API_LNGSTRINGW(IDS_VBR_PRESET), config->preset, AACConfig_GetBitrate(config, 2 /* TODO! */)/1000); + SetDlgItemText(hwnd, IDC_INFO_BITRATE, temp); + } + else + { + StringCbPrintfW(temp, sizeof(temp), WASABI_API_LNGSTRINGW(IDS_CBR_PRESET), AACConfig_GetBitrate(config, 2 /* TODO! */)/1000); + SetDlgItemText(hwnd, IDC_INFO_BITRATE, temp); + } +} + +/* call this to update the UI according to the configuration values */ +void UpdateUI(HWND hwnd, AACConfigurationFile *config) +{ + wchar_t temp[128] = {0}; + ComboBox mode_list(hwnd, IDC_MODE); + ComboBox profile_list(hwnd, IDC_PROFILE); + + config->changing = true; + Slider preset_slider(hwnd, IDC_SLIDER_PRESET); + if (config->config.mode == AAC_MODE_VBR) + { + preset_slider.SetRange(1, 6, Slider::REDRAW); + preset_slider.SetTickFrequency(1); + preset_slider.SetPosition(config->config.preset, Slider::REDRAW); + SetDlgItemText(hwnd, IDC_STATIC_PRESET, WASABI_API_LNGSTRINGW(IDS_PRESET)); + StringCbPrintf(temp, sizeof(temp), L"%u", config->config.preset); + SetDlgItemText(hwnd, IDC_EDIT_PRESET, temp); + profile_list.SelectItem(AAC_PROFILE_AUTOMATIC); + EnableWindow(profile_list, FALSE); + ShowWindow(GetDlgItem(hwnd, IDC_KBPS), SW_HIDE); + } + else /* implied: if (config->config.mode == AAC_MODE_CBR) */ + { + int low, high; + AACConfig_GetBitrateRange(&config->config, &low, &high); + low = ((low/1000+3)&~3); /* convert to kbps round up to nearest multiple of 4 */ + high = ((high/1000)&~3); /* convert to kbps round down to nearest multiple of 4 */ + + int slider_high = low + (high - low)/bitrate_slider_precision; + preset_slider.SetRange(low, slider_high, Slider::REDRAW); + if (config->config.profile >= AAC_PROFILE_HE) + preset_slider.SetTickFrequency(1); + else + preset_slider.SetTickFrequency(4); + SetSliderBitrate(hwnd, config->config.bitrate); + config->config.bitrate = GetSliderBitrate(hwnd); + SetDlgItemText(hwnd, IDC_STATIC_PRESET, WASABI_API_LNGSTRINGW(IDS_BITRATE)); + StringCbPrintf(temp, sizeof(temp), L"%u", config->config.bitrate); + SetDlgItemText(hwnd, IDC_EDIT_PRESET, temp); + profile_list.SelectItem(config->config.profile); + EnableWindow(profile_list, TRUE); + ShowWindow(GetDlgItem(hwnd, IDC_KBPS), SW_SHOWNA); + } + config->changing = false; +} + +int Preferences_GetEncoderVersion(char *version_string, size_t cch) +{ + char version[128] = {0}; + MPEG4ENC_GetVersionInfo(version, sizeof(version)/sizeof(*version)); + char *p = version; + while (p && *p) + { + if (*p != '.' && (*p < '0' || *p > '9')) + { + *p = 0; + break; + } + p++; + } + + StringCchPrintfA(version_string, cch, WASABI_API_LNGSTRING(IDS_VERSION), version); + + return 0; +}
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/preferences.h b/Src/Plugins/Encoder/enc_fhgaac/preferences.h new file mode 100644 index 00000000..0ed9cabc --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/preferences.h @@ -0,0 +1,18 @@ +#pragma once +#include <windows.h> +#include "config.h" + +extern HINSTANCE enc_fhg_HINST; +INT_PTR CALLBACK Preferences_MP4_DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK Preferences_ADTS_DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + +/* common to both */ +extern const int bitrate_slider_precision; +void UpdateInfo(HWND hwnd, const AACConfiguration *config); +void UpdateUI(HWND hwnd, AACConfigurationFile *config); +int Preferences_GetEncoderVersion(char *version_string, size_t cch); +unsigned int GetSliderBitrate(HWND hwnd); + +#include <api/application/api_application.h> +extern api_application *applicationApi; +#define WASABI_API_APP applicationApi
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/preferences_adts.cpp b/Src/Plugins/Encoder/enc_fhgaac/preferences_adts.cpp new file mode 100644 index 00000000..88231e5a --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/preferences_adts.cpp @@ -0,0 +1,124 @@ +#include "../Agave/Language/api_language.h" +#include "config.h" +#include "preferences.h" +#include "../Winamp/wa_ipc.h" +#include <windows.h> +#include <assert.h> +#include "resource.h" +#include "link_control.h" +#include "../nu/ComboBox.h" +#include "../nu/Slider.h" +#include <strsafe.h> + +extern HWND winampwnd; + +INT_PTR CALLBACK Preferences_ADTS_DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + AACConfigurationFile *cfg = (AACConfigurationFile *)lParam; + cfg->changing = false; + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cfg); + + + if (cfg->shoutcast == 1) + { + ShowWindow(GetDlgItem(hwnd, IDC_WARNING), SW_HIDE); + } + + ComboBox profile_list(hwnd, IDC_PROFILE); + profile_list.AddString(WASABI_API_LNGSTRINGW(IDS_AUTOMATIC), AAC_PROFILE_AUTOMATIC); assert(AAC_PROFILE_AUTOMATIC == 0); + profile_list.AddString(L"AAC LC", AAC_PROFILE_LC); assert(AAC_PROFILE_LC == 1); + profile_list.AddString(L"HE-AAC", AAC_PROFILE_HE); assert(AAC_PROFILE_HE == 2); + profile_list.AddString(L"HE-AAC v2", AAC_PROFILE_HE_V2); assert(AAC_PROFILE_HE_V2 == 3); + + UpdateUI(hwnd, cfg); + UpdateInfo(hwnd, &cfg->config); + link_startsubclass(hwnd, IDC_URL); + link_startsubclass(hwnd, IDC_LOGO); + link_startsubclass(hwnd, IDC_HELPLINK); + + char temp[128] = {0}; + if (Preferences_GetEncoderVersion(temp, sizeof(temp)/sizeof(*temp)) == 0) + { + SetDlgItemTextA(hwnd, IDC_VERSION, temp); + } + + // this will make sure that we've got the aacplus logo shown even when using a localised version + SendDlgItemMessage(hwnd,IDC_LOGO,STM_SETIMAGE,IMAGE_BITMAP, (LPARAM)LoadImage(WASABI_API_ORIG_HINST?WASABI_API_ORIG_HINST:enc_fhg_HINST,MAKEINTRESOURCE(IDB_FHGLOGO),IMAGE_BITMAP,0,0,LR_SHARED)); + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_HELPLINK: + SendMessage(winampwnd, WM_WA_IPC, (WPARAM)"http://help.winamp.com/", IPC_OPEN_URL); + break; + case IDC_LOGO: + case IDC_URL: + SendMessage(winampwnd, WM_WA_IPC, (WPARAM)"http://www.iis.fraunhofer.de/en/bf/amm", IPC_OPEN_URL); + break; + + case IDC_EDIT_PRESET: + if (HIWORD(wParam) == EN_CHANGE) + { + AACConfigurationFile *cfg = (AACConfigurationFile *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + if (!cfg->changing) + { + BOOL s=0; + unsigned int t=GetDlgItemInt(hwnd,IDC_EDIT_PRESET,&s,0); + if (s) + { + cfg->config.bitrate = t; + UpdateUI(hwnd, cfg); + UpdateInfo(hwnd, &cfg->config); + AACConfig_Save(cfg); + } + } + } + break; + + case IDC_PROFILE: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + AACConfigurationFile *cfg = (AACConfigurationFile *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + cfg->config.profile = (unsigned int)ComboBox(hwnd, IDC_PROFILE).GetSelection(); + UpdateUI(hwnd, cfg); + UpdateInfo(hwnd, &cfg->config); + AACConfig_Save(cfg); + } + break; + } + break; + + case WM_HSCROLL: + if (GetDlgItem(hwnd, IDC_SLIDER_PRESET) == (HWND)lParam) + { + wchar_t temp[128] = {0}; + AACConfigurationFile *cfg = (AACConfigurationFile *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + + cfg->config.bitrate = GetSliderBitrate(hwnd); + StringCbPrintf(temp, sizeof(temp), L"%u", cfg->config.bitrate); + SetDlgItemText(hwnd, IDC_EDIT_PRESET, temp); + UpdateInfo(hwnd, &cfg->config); + AACConfig_Save(cfg); + } + break; + } + + link_handledraw(hwnd,msg,wParam,lParam); + + const int controls[] = + { + IDC_SLIDER_PRESET, + }; + if (FALSE != WASABI_API_APP->DirectMouseWheel_ProcessDialogMessage(hwnd, msg, wParam, lParam, controls, ARRAYSIZE(controls))) + { + return 1; + } + + return 0; +}
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/preferences_mp4.cpp b/Src/Plugins/Encoder/enc_fhgaac/preferences_mp4.cpp new file mode 100644 index 00000000..7f06dfb0 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/preferences_mp4.cpp @@ -0,0 +1,152 @@ +#include "../Agave/Language/api_language.h" +#include "config.h" +#include "preferences.h" +#include "../Winamp/wa_ipc.h" +#include <windows.h> +#include <assert.h> +#include "resource.h" +#include "link_control.h" +#include "../nu/ComboBox.h" +#include "../nu/Slider.h" +#include <strsafe.h> + +extern HWND winampwnd; + +INT_PTR CALLBACK Preferences_MP4_DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + AACConfigurationFile *cfg = (AACConfigurationFile *)lParam; + cfg->changing = false; + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cfg); + + ComboBox mode_list(hwnd, IDC_MODE); + mode_list.AddString(WASABI_API_LNGSTRINGW(IDS_VBR), AAC_MODE_VBR); assert(AAC_MODE_VBR == 0); + mode_list.AddString(WASABI_API_LNGSTRINGW(IDS_CBR), AAC_MODE_CBR); assert(AAC_MODE_CBR == 1); + mode_list.SelectItem(cfg->config.mode); + + ComboBox profile_list(hwnd, IDC_PROFILE); + profile_list.AddString(WASABI_API_LNGSTRINGW(IDS_AUTOMATIC), AAC_PROFILE_AUTOMATIC); assert(AAC_PROFILE_AUTOMATIC == 0); + profile_list.AddString(L"AAC LC", AAC_PROFILE_LC); assert(AAC_PROFILE_LC == 1); + profile_list.AddString(L"HE-AAC", AAC_PROFILE_HE); assert(AAC_PROFILE_HE == 2); + profile_list.AddString(L"HE-AAC v2", AAC_PROFILE_HE_V2); assert(AAC_PROFILE_HE_V2 == 3); + + UpdateUI(hwnd, cfg); + UpdateInfo(hwnd, &cfg->config); + link_startsubclass(hwnd, IDC_URL); + link_startsubclass(hwnd, IDC_LOGO); + link_startsubclass(hwnd, IDC_HELPLINK); + + char temp[128] = {0}; + if (Preferences_GetEncoderVersion(temp, sizeof(temp)/sizeof(*temp)) == 0) + { + SetDlgItemTextA(hwnd, IDC_VERSION, temp); + } + + // this will make sure that we've got the aacplus logo shown even when using a localised version + SendDlgItemMessage(hwnd,IDC_LOGO,STM_SETIMAGE,IMAGE_BITMAP, (LPARAM)LoadImage(WASABI_API_ORIG_HINST?WASABI_API_ORIG_HINST:enc_fhg_HINST,MAKEINTRESOURCE(IDB_FHGLOGO),IMAGE_BITMAP,0,0,LR_SHARED)); + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_HELPLINK: + SendMessage(winampwnd, WM_WA_IPC, (WPARAM)"http://help.winamp.com/", IPC_OPEN_URL); + break; + case IDC_LOGO: + case IDC_URL: + SendMessage(winampwnd, WM_WA_IPC, (WPARAM)"http://www.iis.fraunhofer.de/en/bf/amm", IPC_OPEN_URL); + break; + + + case IDC_MODE: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + AACConfigurationFile *cfg = (AACConfigurationFile *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + cfg->config.mode = (unsigned int)ComboBox(hwnd, IDC_MODE).GetSelection(); + UpdateUI(hwnd, cfg); + UpdateInfo(hwnd, &cfg->config); + AACConfig_Save(cfg); + } + break; + + case IDC_EDIT_PRESET: + if (HIWORD(wParam) == EN_CHANGE) + { + AACConfigurationFile *cfg = (AACConfigurationFile *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + if (!cfg->changing) + { + BOOL s=0; + unsigned int t=GetDlgItemInt(hwnd,IDC_EDIT_PRESET,&s,0); + if (s) + { + if (cfg->config.mode == AAC_MODE_VBR) + { + cfg->config.preset= t; + } + else + { + cfg->config.bitrate = t; + } + UpdateUI(hwnd, cfg); + UpdateInfo(hwnd, &cfg->config); + AACConfig_Save(cfg); + } + } + } + break; + + case IDC_PROFILE: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + AACConfigurationFile *cfg = (AACConfigurationFile *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + cfg->config.profile = (unsigned int)ComboBox(hwnd, IDC_PROFILE).GetSelection(); + UpdateUI(hwnd, cfg); + UpdateInfo(hwnd, &cfg->config); + AACConfig_Save(cfg); + } + break; + } + break; + + case WM_HSCROLL: + if (GetDlgItem(hwnd, IDC_SLIDER_PRESET) == (HWND)lParam) + { + wchar_t temp[128] = {0}; + AACConfigurationFile *cfg = (AACConfigurationFile *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + if (cfg->config.mode == AAC_MODE_VBR) + { + cfg->config.preset = (unsigned int)SendMessage(GetDlgItem(hwnd,IDC_SLIDER_PRESET),TBM_GETPOS,0,0); + StringCbPrintf(temp, sizeof(temp), L"%u", cfg->config.preset); + SetDlgItemText(hwnd, IDC_EDIT_PRESET, temp); + UpdateInfo(hwnd, &cfg->config); + AACConfig_Save(cfg); + } + else + { + cfg->config.bitrate = GetSliderBitrate(hwnd); + StringCbPrintf(temp, sizeof(temp), L"%u", cfg->config.bitrate); + SetDlgItemText(hwnd, IDC_EDIT_PRESET, temp); + UpdateInfo(hwnd, &cfg->config); + AACConfig_Save(cfg); + } + } + break; + } + + link_handledraw(hwnd,msg,wParam,lParam); + + const int controls[] = + { + IDC_SLIDER_PRESET, + }; + if (FALSE != WASABI_API_APP->DirectMouseWheel_ProcessDialogMessage(hwnd, msg, wParam, lParam, controls, ARRAYSIZE(controls))) + { + return 1; + } + + return 0; +}
\ No newline at end of file diff --git a/Src/Plugins/Encoder/enc_fhgaac/resource.h b/Src/Plugins/Encoder/enc_fhgaac/resource.h new file mode 100644 index 00000000..9904233d --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/resource.h @@ -0,0 +1,46 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by enc_fhgaac.rc +// +#define IDS_ENC_FHGAAC_DESC 1 +#define VS_VERSION_INFO 1 +#define IDS_ENC_FHGAAC_VER 2 +#define IDS_VBR_PRESET 2 +#define IDS_CBR_PRESET 3 +#define IDS_VBR 4 +#define IDS_CBR 5 +#define IDS_AUTOMATIC 6 +#define IDS_BITRATE 7 +#define IDS_PRESET 8 +#define IDD_PREFERENCES_MP4 9 +#define IDS_VERSION 9 +#define IDD_PREFERENCES_ADTS 10 +#define IDC_ENC_ADTS_DESC 10 +#define IDB_FHGLOGO 104 +#define IDC_MODE 1002 +#define IDC_PROFILE 1003 +#define IDC_STATIC_PROFILE 1004 +#define IDC_STATIC_PRESET 1006 +#define IDC_SLIDER_PRESET 1007 +#define IDC_EDIT_PRESET 1008 +#define IDC_INFO_MODE 1009 +#define IDC_INFO_BITRATE 1010 +#define IDC_INFO_WARNING 1011 +#define IDC_KBPS 1014 +#define IDB_LOGO 1015 +#define IDC_LOGO 1015 +#define IDC_URL 1017 +#define IDC_HELPLINK 1018 +#define IDC_VERSION 1019 +#define IDC_WARNING 1020 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 105 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1021 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/Plugins/Encoder/enc_fhgaac/version.rc2 b/Src/Plugins/Encoder/enc_fhgaac/version.rc2 new file mode 100644 index 00000000..f94ece26 --- /dev/null +++ b/Src/Plugins/Encoder/enc_fhgaac/version.rc2 @@ -0,0 +1,39 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "../../../Winamp/buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,8,0 + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp Encoder Plug-in" + VALUE "FileVersion", "1,0,8,0" + VALUE "InternalName", "Nullsoft AAC Encoder" + VALUE "LegalCopyright", "Copyright © 2011-2019 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "enc_fhgaac.dll" + VALUE "ProductName", "Winamp" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END |