Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
119
Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.cpp
Normal file
119
Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.cpp
Normal file
|
@ -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);
|
||||
*/
|
||||
|
||||
}
|
25
Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.h
Normal file
25
Src/Plugins/Encoder/enc_fhgaac/ADTSAACEncoder.h
Normal file
|
@ -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;
|
||||
};
|
128
Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.cpp
Normal file
128
Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.cpp
Normal file
|
@ -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);
|
||||
}
|
29
Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.h
Normal file
29
Src/Plugins/Encoder/enc_fhgaac/FhGAACEncoder.h
Normal file
|
@ -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;
|
||||
};
|
64
Src/Plugins/Encoder/enc_fhgaac/MP4Writer.cpp
Normal file
64
Src/Plugins/Encoder/enc_fhgaac/MP4Writer.cpp
Normal file
|
@ -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);
|
||||
}
|
25
Src/Plugins/Encoder/enc_fhgaac/MP4Writer.h
Normal file
25
Src/Plugins/Encoder/enc_fhgaac/MP4Writer.h
Normal file
|
@ -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];
|
||||
};
|
||||
|
258
Src/Plugins/Encoder/enc_fhgaac/config.cpp
Normal file
258
Src/Plugins/Encoder/enc_fhgaac/config.cpp
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
64
Src/Plugins/Encoder/enc_fhgaac/config.h
Normal file
64
Src/Plugins/Encoder/enc_fhgaac/config.h
Normal file
|
@ -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);
|
150
Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.rc
Normal file
150
Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.rc
Normal file
|
@ -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
|
||||
|
26
Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.sln
Normal file
26
Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.sln
Normal file
|
@ -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
|
322
Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.vcproj
Normal file
322
Src/Plugins/Encoder/enc_fhgaac/enc_fhgaac.vcproj
Normal file
|
@ -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>
|
9
Src/Plugins/Encoder/enc_fhgaac/encoder_common.h
Normal file
9
Src/Plugins/Encoder/enc_fhgaac/encoder_common.h
Normal file
|
@ -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];
|
||||
};
|
BIN
Src/Plugins/Encoder/enc_fhgaac/fraunhofer_wa_prefs_noalpha.bmp
Normal file
BIN
Src/Plugins/Encoder/enc_fhgaac/fraunhofer_wa_prefs_noalpha.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
Src/Plugins/Encoder/enc_fhgaac/libirc.lib
Normal file
BIN
Src/Plugins/Encoder/enc_fhgaac/libirc.lib
Normal file
Binary file not shown.
63
Src/Plugins/Encoder/enc_fhgaac/link_control.cpp
Normal file
63
Src/Plugins/Encoder/enc_fhgaac/link_control.cpp
Normal file
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
7
Src/Plugins/Encoder/enc_fhgaac/link_control.h
Normal file
7
Src/Plugins/Encoder/enc_fhgaac/link_control.h
Normal file
|
@ -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);
|
||||
}
|
263
Src/Plugins/Encoder/enc_fhgaac/main.cpp
Normal file
263
Src/Plugins/Encoder/enc_fhgaac/main.cpp
Normal file
|
@ -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;
|
||||
|
||||
}
|
||||
}
|
978
Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.h
Normal file
978
Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.h
Normal file
|
@ -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_ */
|
BIN
Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.lib
Normal file
BIN
Src/Plugins/Encoder/enc_fhgaac/mp4FastAAClib.lib
Normal file
Binary file not shown.
122
Src/Plugins/Encoder/enc_fhgaac/preferences.cpp
Normal file
122
Src/Plugins/Encoder/enc_fhgaac/preferences.cpp
Normal file
|
@ -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;
|
||||
}
|
18
Src/Plugins/Encoder/enc_fhgaac/preferences.h
Normal file
18
Src/Plugins/Encoder/enc_fhgaac/preferences.h
Normal file
|
@ -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
|
124
Src/Plugins/Encoder/enc_fhgaac/preferences_adts.cpp
Normal file
124
Src/Plugins/Encoder/enc_fhgaac/preferences_adts.cpp
Normal file
|
@ -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;
|
||||
}
|
152
Src/Plugins/Encoder/enc_fhgaac/preferences_mp4.cpp
Normal file
152
Src/Plugins/Encoder/enc_fhgaac/preferences_mp4.cpp
Normal file
|
@ -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;
|
||||
}
|
46
Src/Plugins/Encoder/enc_fhgaac/resource.h
Normal file
46
Src/Plugins/Encoder/enc_fhgaac/resource.h
Normal file
|
@ -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
|
39
Src/Plugins/Encoder/enc_fhgaac/version.rc2
Normal file
39
Src/Plugins/Encoder/enc_fhgaac/version.rc2
Normal file
|
@ -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
|
203
Src/Plugins/Encoder/enc_flac/AudioCoderFlac.cpp
Normal file
203
Src/Plugins/Encoder/enc_flac/AudioCoderFlac.cpp
Normal file
|
@ -0,0 +1,203 @@
|
|||
#include "AudioCoderFlac.h"
|
||||
#include <bfc/platform/types.h>
|
||||
#include <FLAC/metadata.h>
|
||||
|
||||
AudioCoderFlac::AudioCoderFlac(unsigned int nch, unsigned int bps, unsigned int samplerate, unsigned int compression)
|
||||
{
|
||||
/* initialize stuff first so we can clean up safely if things go wrong */
|
||||
finished = false;
|
||||
finishedBytes = 0;
|
||||
padding = 0;
|
||||
encoder = 0;
|
||||
win32State.bytesWritten = 0;
|
||||
win32State.handle = INVALID_HANDLE_VALUE;
|
||||
tempFile[0]=0;
|
||||
|
||||
wchar_t tempPath[MAX_PATH-14] = {0};
|
||||
GetTempPath(MAX_PATH-14, tempPath);
|
||||
GetTempFileName(tempPath, L"wfl", 0, tempFile);
|
||||
win32State.handle = CreateFile(tempFile, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
|
||||
|
||||
if (win32State.handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
this->nch = nch;
|
||||
this->bps = bps;
|
||||
encoder = FLAC__stream_encoder_new();
|
||||
|
||||
if (!encoder)
|
||||
return;
|
||||
|
||||
// set stream info
|
||||
if (!FLAC__stream_encoder_set_channels(encoder, nch)
|
||||
|| !FLAC__stream_encoder_set_bits_per_sample(encoder, bps)
|
||||
|| !FLAC__stream_encoder_set_sample_rate(encoder, samplerate)
|
||||
|| !FLAC__stream_encoder_set_total_samples_estimate(encoder, 0)
|
||||
|| !FLAC__stream_encoder_set_compression_level(encoder, compression)
|
||||
|| !FLAC__stream_encoder_set_blocksize(encoder, 0))
|
||||
{
|
||||
FLAC__stream_encoder_delete(encoder);
|
||||
encoder=0;
|
||||
return;
|
||||
}
|
||||
// TODO: set any more config stuff
|
||||
|
||||
// TODO: seektable?
|
||||
//FLAC__StreamMetadata *seektable = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE);
|
||||
|
||||
padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING);
|
||||
if (padding)
|
||||
{
|
||||
padding->length = 16384; // TODO: configurable padding size
|
||||
if (!FLAC__stream_encoder_set_metadata(encoder, &padding, 1))
|
||||
{
|
||||
FLAC__stream_encoder_delete(encoder);
|
||||
encoder=0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (FLAC__stream_encoder_init_stream(encoder, Win32_Write, Win32_Seek, Win32_Tell, NULL, &win32State) != FLAC__STREAM_ENCODER_INIT_STATUS_OK)
|
||||
{
|
||||
FLAC__stream_encoder_delete(encoder);
|
||||
encoder=0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool AudioCoderFlac::OK()
|
||||
{
|
||||
if (!encoder)
|
||||
return false;
|
||||
|
||||
return FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK;
|
||||
}
|
||||
|
||||
AudioCoderFlac::~AudioCoderFlac()
|
||||
{
|
||||
if (encoder)
|
||||
FLAC__stream_encoder_delete(encoder);
|
||||
|
||||
if (padding)
|
||||
FLAC__metadata_object_delete(padding);
|
||||
|
||||
if (win32State.handle != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(win32State.handle);
|
||||
|
||||
}
|
||||
|
||||
static void Copy8(FLAC__int32 *buffer, void *inputData, int numSamples)
|
||||
{
|
||||
uint8_t *in = (uint8_t *)inputData;
|
||||
|
||||
for (int i=0;i<numSamples;i++)
|
||||
{
|
||||
buffer[i] = (FLAC__int32)in[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void Copy16(FLAC__int32 *buffer, void *inputData, int numSamples)
|
||||
{
|
||||
int16_t *in = (int16_t *)inputData;
|
||||
|
||||
for (int i=0;i<numSamples;i++)
|
||||
{
|
||||
buffer[i] = (FLAC__int32)in[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void Copy24(FLAC__int32 *buffer, void *inputData, int numSamples)
|
||||
{
|
||||
uint8_t *in = (uint8_t *)inputData;
|
||||
|
||||
for (int i=0;i<numSamples;i++)
|
||||
{
|
||||
FLAC__int32 val = (((FLAC__int32)in[0]) << 0);
|
||||
val = val | (((FLAC__int32)in[1]) << 8);
|
||||
val = val | (((FLAC__int32)in[2]) << 16);
|
||||
|
||||
buffer[i] = (FLAC__int32)val;
|
||||
in+=3;
|
||||
}
|
||||
}
|
||||
|
||||
static void Copy32(FLAC__int32 *buffer, void *inputData, int numSamples)
|
||||
{
|
||||
int32_t *in = (int32_t *)inputData;
|
||||
|
||||
for (int i=0;i<numSamples;i++)
|
||||
{
|
||||
buffer[i] = (FLAC__int32)in[i];
|
||||
}
|
||||
}
|
||||
|
||||
int AudioCoderFlac::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail)
|
||||
{
|
||||
FLAC__int32 buffer[65536];
|
||||
|
||||
|
||||
FLAC__uint64 startBytes = win32State.bytesWritten;
|
||||
|
||||
if (!in_avail)
|
||||
{
|
||||
if (finished)
|
||||
{
|
||||
int ret = (int)finishedBytes;
|
||||
finishedBytes = 0;
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int numSamples = in_avail/(bps/8);
|
||||
|
||||
if (numSamples>65536)
|
||||
numSamples = 65536;
|
||||
|
||||
switch (bps)
|
||||
{
|
||||
case 8:
|
||||
Copy8(buffer, in, numSamples);
|
||||
break;
|
||||
case 16:
|
||||
Copy16(buffer, in, numSamples);
|
||||
break;
|
||||
case 24:
|
||||
Copy24(buffer, in, numSamples);
|
||||
break;
|
||||
case 32:
|
||||
Copy32(buffer, in, numSamples);
|
||||
break;
|
||||
}
|
||||
|
||||
FLAC__bool result = FLAC__stream_encoder_process_interleaved(encoder, buffer, numSamples/nch);
|
||||
|
||||
if (result)
|
||||
{
|
||||
*in_used = numSamples*(bps/8);
|
||||
return (int)(win32State.bytesWritten - startBytes);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AudioCoderFlac::PrepareToFinish()
|
||||
{
|
||||
FLAC__uint64 startBytes = win32State.bytesWritten;
|
||||
FLAC__stream_encoder_finish(encoder);
|
||||
finishedBytes = win32State.bytesWritten - startBytes;
|
||||
}
|
||||
|
||||
void AudioCoderFlac::Finish(const wchar_t *destination)
|
||||
{
|
||||
if (win32State.handle != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(win32State.handle);
|
||||
|
||||
win32State.handle = INVALID_HANDLE_VALUE;
|
||||
if (!MoveFile(tempFile, destination))
|
||||
{
|
||||
if (CopyFile(tempFile, destination, FALSE))
|
||||
DeleteFile(tempFile);
|
||||
}
|
||||
}
|
29
Src/Plugins/Encoder/enc_flac/AudioCoderFlac.h
Normal file
29
Src/Plugins/Encoder/enc_flac/AudioCoderFlac.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
#include "../nsv/enc_if.h"
|
||||
#include <FLAC/stream_encoder.h>
|
||||
#include "StreamFileWin32.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned int compression; // 0-8
|
||||
} configtype;
|
||||
|
||||
class AudioCoderFlac : public AudioCoder
|
||||
{
|
||||
public:
|
||||
AudioCoderFlac(unsigned int nch, unsigned int bps, unsigned int samplerate, unsigned int compression);
|
||||
~AudioCoderFlac();
|
||||
int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail); //returns bytes in out
|
||||
void PrepareToFinish();
|
||||
void Finish(const wchar_t *destination);
|
||||
bool OK();
|
||||
|
||||
private:
|
||||
FLAC__StreamEncoder *encoder;
|
||||
FLAC__StreamMetadata *padding;
|
||||
Win32_State win32State;
|
||||
unsigned int nch;
|
||||
unsigned int bps;
|
||||
wchar_t tempFile[MAX_PATH];
|
||||
bool finished;
|
||||
FLAC__uint64 finishedBytes;
|
||||
};
|
69
Src/Plugins/Encoder/enc_flac/StreamFileWin32.cpp
Normal file
69
Src/Plugins/Encoder/enc_flac/StreamFileWin32.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
#include "StreamFileWin32.h"
|
||||
#include <assert.h>
|
||||
|
||||
static __int64 Seek64(HANDLE hf, __int64 distance, DWORD MoveMethod)
|
||||
{
|
||||
LARGE_INTEGER li;
|
||||
|
||||
li.QuadPart = distance;
|
||||
|
||||
li.LowPart = SetFilePointer (hf, li.LowPart, &li.HighPart, MoveMethod);
|
||||
|
||||
if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
|
||||
{
|
||||
li.QuadPart = -1;
|
||||
}
|
||||
|
||||
return li.QuadPart;
|
||||
}
|
||||
|
||||
|
||||
FLAC__StreamEncoderWriteStatus Win32_Write(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data)
|
||||
{
|
||||
assert(bytes <= 4294967295U);
|
||||
|
||||
HANDLE file = ((Win32_State *)client_data)->handle;
|
||||
if(bytes > 0)
|
||||
{
|
||||
assert(sizeof(FLAC__byte) == 1);
|
||||
DWORD bytesWritten = 0, bytesToWrite = (DWORD)bytes;
|
||||
BOOL result = WriteFile(file, buffer, bytesToWrite, &bytesWritten, NULL);
|
||||
((Win32_State *)client_data)->bytesWritten += bytesWritten;
|
||||
|
||||
if (!result)
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
|
||||
}
|
||||
else
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
}
|
||||
|
||||
FLAC__StreamEncoderSeekStatus Win32_Seek(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
|
||||
{
|
||||
HANDLE file = ((Win32_State *)client_data)->handle;
|
||||
|
||||
__int64 result = Seek64(file, absolute_byte_offset, FILE_BEGIN);
|
||||
|
||||
if (result == INVALID_SET_FILE_POINTER)
|
||||
return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
|
||||
else
|
||||
{
|
||||
return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__StreamEncoderTellStatus Win32_Tell(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
|
||||
{
|
||||
HANDLE file = ((Win32_State *)client_data)->handle;
|
||||
|
||||
__int64 position = Seek64(file, 0, FILE_CURRENT);
|
||||
|
||||
if (position == INVALID_SET_FILE_POINTER)
|
||||
return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
|
||||
else
|
||||
{
|
||||
*absolute_byte_offset=position;
|
||||
return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
|
||||
}
|
||||
}
|
||||
|
18
Src/Plugins/Encoder/enc_flac/StreamFileWin32.h
Normal file
18
Src/Plugins/Encoder/enc_flac/StreamFileWin32.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <FLAC/all.h>
|
||||
#include <windows.h>
|
||||
|
||||
struct Win32_State
|
||||
{
|
||||
public:
|
||||
HANDLE handle;
|
||||
FLAC__uint64 bytesWritten;
|
||||
};
|
||||
|
||||
FLAC__StreamEncoderWriteStatus Win32_Write(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
|
||||
FLAC__StreamEncoderSeekStatus Win32_Seek(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
|
||||
FLAC__StreamEncoderTellStatus Win32_Tell(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
|
||||
void Progress(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data);
|
||||
|
||||
|
10
Src/Plugins/Encoder/enc_flac/api__enc_flac.h
Normal file
10
Src/Plugins/Encoder/enc_flac/api__enc_flac.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef NULLSOFT_ENC_FLAC_API_H
|
||||
#define NULLSOFT_ENC_FLAC_API_H
|
||||
|
||||
#include "api/service/api_service.h"
|
||||
#include "../Agave/Language/api_language.h"
|
||||
|
||||
#include "api/application/api_application.h"
|
||||
#define WASABI_API_APP application
|
||||
|
||||
#endif // !NULLSOFT_ENC_FLAC_API_H
|
119
Src/Plugins/Encoder/enc_flac/enc_flac2.rc
Normal file
119
Src/Plugins/Encoder/enc_flac/enc_flac2.rc
Normal file
|
@ -0,0 +1,119 @@
|
|||
// 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_CONFIG DIALOGEX 0, 0, 256, 167
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "FLAC Encoder Options",IDC_STATIC,0,0,256,166
|
||||
LTEXT "Compression factor:",IDC_STATIC,7,13,66,8
|
||||
CONTROL "",IDC_COMPRESSIONSLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOOLTIPS | WS_TABSTOP,5,23,243,17
|
||||
LTEXT "Fast Encoding",IDC_STATIC,9,43,46,8
|
||||
LTEXT "Best Compression",IDC_STATIC,191,43,58,8
|
||||
LTEXT "FLAC is the Free Lossless Audio Codec, ",IDC_STATIC,5,143,128,8
|
||||
CONTROL "http://flac.sf.net/",IDC_URL,"Button",BS_OWNERDRAW | WS_TABSTOP,131,142,62,9
|
||||
LTEXT "",IDC_STATIC_FLAC_VER,5,151,242,8
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 83
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_LIBFLAC_DLL_MISSING "[libflac.dll missing]"
|
||||
IDS_ENC_FLAC_DESC "FLAC Encoder v%s (libFLAC v%s)"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
65535 "{73760073-560C-433b-BC59-3FCC94CDEA4A}"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#include "version.rc2"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
56
Src/Plugins/Encoder/enc_flac/enc_flac2.sln
Normal file
56
Src/Plugins/Encoder/enc_flac/enc_flac2.sln
Normal file
|
@ -0,0 +1,56 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29613.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enc_flac", "enc_flac2.vcxproj", "{922008CC-4A0E-4EA1-92F2-AA822965BDF6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9} = {4FC28B55-2A14-43D5-86F7-201054F338A9}
|
||||
{4CEFBC83-C215-11DB-8314-0800200C9A66} = {4CEFBC83-C215-11DB-8314-0800200C9A66}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC_dynamic", "..\libFLAC\libFLAC_dynamic.vcxproj", "{4CEFBC83-C215-11DB-8314-0800200C9A66}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9} = {4FC28B55-2A14-43D5-86F7-201054F338A9}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libogg", "..\libogg\libogg.vcxproj", "{4FC28B55-2A14-43D5-86F7-201054F338A9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{922008CC-4A0E-4EA1-92F2-AA822965BDF6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{922008CC-4A0E-4EA1-92F2-AA822965BDF6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{922008CC-4A0E-4EA1-92F2-AA822965BDF6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{922008CC-4A0E-4EA1-92F2-AA822965BDF6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{922008CC-4A0E-4EA1-92F2-AA822965BDF6}.Release|Win32.Build.0 = Release|Win32
|
||||
{922008CC-4A0E-4EA1-92F2-AA822965BDF6}.Release|x64.ActiveCfg = Release|x64
|
||||
{4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64
|
||||
{4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32
|
||||
{4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64
|
||||
{4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Debug|x64.Build.0 = Debug|x64
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Release|Win32.Build.0 = Release|Win32
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Release|x64.ActiveCfg = Release|x64
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A0F24E75-21BB-4DDF-A287-A481B554B4EB}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
277
Src/Plugins/Encoder/enc_flac/enc_flac2.vcxproj
Normal file
277
Src/Plugins/Encoder/enc_flac/enc_flac2.vcxproj
Normal file
|
@ -0,0 +1,277 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>enc_flac</ProjectName>
|
||||
<ProjectGuid>{922008CC-4A0E-4EA1-92F2-AA822965BDF6}</ProjectGuid>
|
||||
<RootNamespace>enc_flac</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg">
|
||||
<VcpkgEnableManifest>false</VcpkgEnableManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ENC_FLAC2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shlwapi.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<DelayLoadDLLs>uxtheme.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;ENC_FLAC2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shlwapi.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<DelayLoadDLLs>uxtheme.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ENC_FLAC2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shlwapi.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<DelayLoadDLLs>uxtheme.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;ENC_FLAC2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shlwapi.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<DelayLoadDLLs>uxtheme.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="api__enc_flac.h" />
|
||||
<ClInclude Include="AudioCoderFlac.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="StreamFileWin32.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AudioCoderFlac.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="StreamFileWin32.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_flac2.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj">
|
||||
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
44
Src/Plugins/Encoder/enc_flac/enc_flac2.vcxproj.filters
Normal file
44
Src/Plugins/Encoder/enc_flac/enc_flac2.vcxproj.filters
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AudioCoderFlac.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StreamFileWin32.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="StreamFileWin32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AudioCoderFlac.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="api__enc_flac.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{c641c9a9-b7d5-4744-bd44-2edc534f2425}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Ressource Files">
|
||||
<UniqueIdentifier>{63979e7c-4d4b-4fc2-89c6-3f476c40adfe}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{cc58b311-a8ed-4e0e-852b-cc82f0d2a83e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_flac2.rc">
|
||||
<Filter>Ressource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
320
Src/Plugins/Encoder/enc_flac/main.cpp
Normal file
320
Src/Plugins/Encoder/enc_flac/main.cpp
Normal file
|
@ -0,0 +1,320 @@
|
|||
#include "api__enc_flac.h"
|
||||
#include "../Winamp/wa_ipc.h"
|
||||
#include "../nsv/enc_if.h"
|
||||
#include "../nu/AutoWideFn.h"
|
||||
#include "AudioCoderFlac.h"
|
||||
#include "resource.h"
|
||||
#include <commctrl.h>
|
||||
#include <windows.h>
|
||||
#include <Uxtheme.h>
|
||||
#include <api/service/waservicefactory.h>
|
||||
#include <api/application/api_application.h>
|
||||
#include <mmsystem.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
#define ENC_VERSION "2.46"
|
||||
|
||||
HWND winampwnd = 0;
|
||||
int isthemethere = 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;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
configtype cfg;
|
||||
char configfile[MAX_PATH];
|
||||
}
|
||||
configwndrec;
|
||||
|
||||
void readconfig(const char *configfile, configtype *cfg)
|
||||
{
|
||||
if (configfile)
|
||||
{
|
||||
cfg->compression = GetPrivateProfileIntA("audio_flac", "compression", 5, configfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
cfg->compression = 5;
|
||||
}
|
||||
}
|
||||
|
||||
void writeconfig(const char *configfile, configtype *cfg)
|
||||
{
|
||||
if (configfile)
|
||||
{
|
||||
char str[64] = {0};
|
||||
StringCchPrintfA(str, 64, "%u", cfg->compression);
|
||||
WritePrivateProfileStringA("audio_flac", "compression", str, configfile);
|
||||
}
|
||||
}
|
||||
|
||||
static HINSTANCE GetMyInstance()
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi = {0};
|
||||
if(VirtualQuery(GetMyInstance, &mbi, sizeof(mbi)))
|
||||
return (HINSTANCE)mbi.AllocationBase;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GetLocalisationApiService(void)
|
||||
{
|
||||
if(!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_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(),EncFlacLangGUID);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *GetFLACVersion()
|
||||
{
|
||||
return "1.4.2";
|
||||
}
|
||||
|
||||
static HCURSOR link_hand_cursor;
|
||||
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_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, sizeof(wt)/sizeof(wt[0]));
|
||||
|
||||
// due to the fun of theming and owner drawing we have to get the background colour
|
||||
if(isthemethere){
|
||||
HTHEME hTheme = OpenThemeData(hwndDlg, L"Tab");
|
||||
if (hTheme) {
|
||||
DrawThemeParentBackground(di->hwndItem, di->hDC, &di->rcItem);
|
||||
CloseThemeData(hTheme);
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void link_startsubclass(HWND hwndDlg, UINT id)
|
||||
{
|
||||
HWND ctrl = GetDlgItem(hwndDlg, id);
|
||||
if(!GetPropW(ctrl, L"link_proc"))
|
||||
{
|
||||
SetPropW(ctrl, L"link_proc",
|
||||
(HANDLE)SetWindowLongPtrW(ctrl, GWLP_WNDPROC, (LONG_PTR)link_handlecursor));
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static configwndrec *wr;
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
wr = (configwndrec *)lParam;
|
||||
SendMessage(GetDlgItem(hwndDlg,IDC_COMPRESSIONSLIDER),TBM_SETRANGE,TRUE,MAKELONG(0,8));
|
||||
SendMessage(GetDlgItem(hwndDlg,IDC_COMPRESSIONSLIDER),TBM_SETPOS,TRUE,wr->cfg.compression);
|
||||
const char *libFlacVer = GetFLACVersion();
|
||||
if (libFlacVer && *libFlacVer)
|
||||
{
|
||||
char flac_string[1024] = {0};
|
||||
StringCchPrintfA(flac_string, 1024, "libFLAC v%s",libFlacVer);
|
||||
SetDlgItemTextA(hwndDlg, IDC_STATIC_FLAC_VER, flac_string);
|
||||
}
|
||||
link_startsubclass(hwndDlg, IDC_URL);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
if(LOWORD(wParam) == IDC_URL)
|
||||
{
|
||||
SendMessage(winampwnd, WM_WA_IPC, (WPARAM)"http://flac.sf.net/", IPC_OPEN_URL);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
if(wParam == IDC_COMPRESSIONSLIDER)
|
||||
{
|
||||
LPNMHDR l = (LPNMHDR)lParam;
|
||||
if(l->idFrom == IDC_COMPRESSIONSLIDER)
|
||||
wr->cfg.compression = (unsigned int)SendMessage(GetDlgItem(hwndDlg,IDC_COMPRESSIONSLIDER),TBM_GETPOS,0,0);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
writeconfig(wr->configfile,&wr->cfg);
|
||||
free(wr); wr=NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
const int controls[] =
|
||||
{
|
||||
IDC_COMPRESSIONSLIDER,
|
||||
};
|
||||
if (FALSE != WASABI_API_APP->DirectMouseWheel_ProcessDialogMessage(hwndDlg, uMsg, wParam, lParam, controls, ARRAYSIZE(controls)))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
link_handledraw(hwndDlg,uMsg,wParam,lParam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
unsigned int __declspec(dllexport) GetAudioTypes3(int idx, char *desc)
|
||||
{
|
||||
if (idx == 0)
|
||||
{
|
||||
GetLocalisationApiService();
|
||||
const char *libFlacVer = GetFLACVersion();
|
||||
StringCchPrintfA(desc, 1024, WASABI_API_LNGSTRING(IDS_ENC_FLAC_DESC), ENC_VERSION, libFlacVer);
|
||||
return mmioFOURCC('F', 'L', 'A', 'C');
|
||||
}
|
||||
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', ' ') && *outt == mmioFOURCC('F', 'L', 'A', 'C'))
|
||||
{
|
||||
configtype cfg;
|
||||
readconfig(configfile, &cfg);
|
||||
*outt = mmioFOURCC('F', 'L', 'A', 'C');
|
||||
AudioCoderFlac *t=new AudioCoderFlac(nch, bps, srate, cfg.compression);
|
||||
if (!t->OK())
|
||||
{
|
||||
delete t;
|
||||
return NULL;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) FinishAudio3(const char *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCoderFlac*)coder)->Finish(AutoWideFn(filename));
|
||||
}
|
||||
|
||||
void __declspec(dllexport) FinishAudio3W(const wchar_t *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCoderFlac*)coder)->Finish(filename);
|
||||
}
|
||||
|
||||
void __declspec(dllexport) PrepareToFinish(const char *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCoderFlac*)coder)->PrepareToFinish();
|
||||
}
|
||||
|
||||
void __declspec(dllexport) PrepareToFinishW(const wchar_t *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCoderFlac*)coder)->PrepareToFinish();
|
||||
}
|
||||
|
||||
|
||||
HWND __declspec(dllexport) ConfigAudio3(HWND hwndParent, HINSTANCE hinst, unsigned int outt, char *configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('F', 'L', 'A', 'C'))
|
||||
{
|
||||
configwndrec *wr = (configwndrec*)malloc(sizeof(configwndrec));
|
||||
if (configfile) StringCchCopyA(wr->configfile, MAX_PATH, configfile);
|
||||
else wr->configfile[0] = 0;
|
||||
readconfig(configfile, &wr->cfg);
|
||||
GetLocalisationApiService();
|
||||
return WASABI_API_CREATEDIALOGPARAMW(IDD_CONFIG, hwndParent, DlgProc, (LPARAM)wr);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) SetConfigItem(unsigned int outt, char *item, char *data, char *configfile)
|
||||
{
|
||||
// nothing yet
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) GetConfigItem(unsigned int outt, char *item, char *data, int len, char *configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('F', 'L', 'A', 'C'))
|
||||
{
|
||||
/*
|
||||
configtype cfg;
|
||||
readconfig(configfile, &cfg);
|
||||
*/
|
||||
if (!_stricmp(item, "bitrate")) StringCchCopyA(data, len, "755"); // FUCKO: this is ment to be an estimate for approximations of output filesize (used by ml_pmp). Improve this.
|
||||
else if (!_stricmp(item,"extension")) StringCchCopyA(data, len, "flac");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) SetWinampHWND(HWND hwnd)
|
||||
{
|
||||
winampwnd = hwnd;
|
||||
isthemethere = !SendMessage(hwnd,WM_WA_IPC,IPC_ISWINTHEMEPRESENT,IPC_USE_UXTHEME_FUNC);
|
||||
}
|
||||
};
|
24
Src/Plugins/Encoder/enc_flac/resource.h
Normal file
24
Src/Plugins/Encoder/enc_flac/resource.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by enc_flac2.rc
|
||||
//
|
||||
#define IDD_CONFIG 9
|
||||
#define IDS_LIBFLAC_DLL_MISSING 102
|
||||
#define IDS_STRING103 103
|
||||
#define IDS_ENC_FLAC_DESC 103
|
||||
#define IDC_SLIDER1 1001
|
||||
#define IDC_COMPRESSIONSLIDER 1001
|
||||
#define IDC_STATIC_FLAC_VER 1002
|
||||
#define IDC_BUTTON1 1003
|
||||
#define IDC_URL 1003
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 103
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1004
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
39
Src/Plugins/Encoder/enc_flac/version.rc2
Normal file
39
Src/Plugins/Encoder/enc_flac/version.rc2
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
#include "../../../Winamp/buildType.h"
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,46,0,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", "2,46,0,0"
|
||||
VALUE "InternalName", "Nullsoft FLAC Encoder"
|
||||
VALUE "LegalCopyright", "Copyright © 2006-2023 Winamp SA"
|
||||
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
|
||||
VALUE "OriginalFilename", "enc_flac.dll"
|
||||
VALUE "ProductName", "Winamp"
|
||||
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
147
Src/Plugins/Encoder/enc_lame/24bit.cpp
Normal file
147
Src/Plugins/Encoder/enc_lame/24bit.cpp
Normal file
|
@ -0,0 +1,147 @@
|
|||
#include "MP3Coder.h"
|
||||
#include <malloc.h>
|
||||
|
||||
static const float const_1_div_128_ = 32768.0 / 128.0; /* 8 bit multiplier */
|
||||
static const double const_1_div_2147483648_ = 32768.0 / 2147483648.0; /* 32 bit multiplier */
|
||||
|
||||
static void Int8_To_Float32(float *dest, void *sourceBuffer, signed int sourceStride, unsigned int count)
|
||||
{
|
||||
signed char *src = (signed char*)sourceBuffer;
|
||||
|
||||
while( count-- )
|
||||
{
|
||||
float samp = *src * const_1_div_128_;
|
||||
*dest = samp;
|
||||
|
||||
src += sourceStride;
|
||||
dest ++;
|
||||
}
|
||||
}
|
||||
|
||||
static void Int24_To_Float32(float *dest, void *sourceBuffer, signed int sourceStride, unsigned int count)
|
||||
{
|
||||
unsigned char *src = (unsigned char*)sourceBuffer;
|
||||
|
||||
while ( count-- )
|
||||
{
|
||||
signed long temp = (((long)src[0]) << 8);
|
||||
temp = temp | (((long)src[1]) << 16);
|
||||
temp = temp | (((long)src[2]) << 24);
|
||||
*dest = (float) ((double)temp * const_1_div_2147483648_);
|
||||
src += sourceStride * 3;
|
||||
dest ++;
|
||||
}
|
||||
}
|
||||
|
||||
int AudioCoderMP3_24::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail)
|
||||
{
|
||||
if (m_err) return -1;
|
||||
if (!hbeStream)
|
||||
{
|
||||
if (beInitStream(&beConfig, &ibuf_size_spls, &obuf_size, (PHBE_STREAM) &hbeStream) != BE_ERR_SUCCESSFUL)
|
||||
{
|
||||
m_err++;
|
||||
return -1;
|
||||
}
|
||||
ibuf_size = ibuf_size_spls * bytesPerSample;
|
||||
|
||||
if (is_downmix) ibuf_size *= 2;
|
||||
|
||||
bs = (char*)malloc(ibuf_size);
|
||||
bs_size = 0;
|
||||
}
|
||||
|
||||
*in_used = 0;
|
||||
|
||||
int needbytes = ibuf_size - bs_size;
|
||||
if (needbytes > 0 && in_avail > 0)
|
||||
{
|
||||
if (needbytes > in_avail)
|
||||
needbytes = in_avail;
|
||||
memcpy(bs + bs_size, in, needbytes);
|
||||
bs_size += needbytes;
|
||||
*in_used = needbytes;
|
||||
}
|
||||
|
||||
if (!done)
|
||||
{
|
||||
if (bs_size < (int)ibuf_size) return 0;
|
||||
}
|
||||
|
||||
if (out_avail < (int)obuf_size) return 0;
|
||||
|
||||
int feedBytes = min(bs_size, (int)ibuf_size);
|
||||
int feedSamples = feedBytes / bytesPerSample;
|
||||
bs_size -= feedBytes;
|
||||
/*
|
||||
if (is_downmix)
|
||||
{
|
||||
int x;
|
||||
int l = feedBytes / 4;
|
||||
short *b = (short*)bs;
|
||||
for (x = 0; x < l; x ++)
|
||||
{
|
||||
b[x] = b[x * 2] / 2 + b[x * 2 + 1] / 2;
|
||||
}
|
||||
}
|
||||
*/
|
||||
DWORD dwo = 0;
|
||||
|
||||
if (feedSamples)
|
||||
{
|
||||
if (mono_input)
|
||||
{
|
||||
float *float_l = (float *)alloca(sizeof(float) * feedSamples);
|
||||
switch(bytesPerSample)
|
||||
{
|
||||
case 8:
|
||||
Int8_To_Float32(float_l, bs, 1, feedSamples);
|
||||
break;
|
||||
case 24:
|
||||
Int24_To_Float32(float_l, bs, 1, feedSamples);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (beEncodeChunkFloatS16NI(hbeStream, feedSamples, float_l, float_l, (unsigned char *)out, &dwo) != BE_ERR_SUCCESSFUL)
|
||||
{
|
||||
m_err++;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float *float_l = (float *)alloca(sizeof(float) * feedSamples / 2);
|
||||
float *float_r = (float *)alloca(sizeof(float) * feedSamples / 2);
|
||||
switch(bytesPerSample)
|
||||
{
|
||||
case 1: // 8 bit
|
||||
Int8_To_Float32(float_l, bs, 2, feedSamples / 2);
|
||||
Int8_To_Float32(float_r, bs + 1, 2, feedSamples / 2);
|
||||
break;
|
||||
case 3: // 24 bit
|
||||
Int24_To_Float32(float_l, bs, 2, feedSamples / 2);
|
||||
Int24_To_Float32(float_r, bs + 3, 2, feedSamples / 2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (beEncodeChunkFloatS16NI(hbeStream, feedSamples / 2, float_l, float_r, (unsigned char *)out, &dwo) != BE_ERR_SUCCESSFUL)
|
||||
{
|
||||
m_err++;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!dwo && done == 1)
|
||||
{
|
||||
if (beDeinitStream(hbeStream, (unsigned char *)out, &dwo) != BE_ERR_SUCCESSFUL)
|
||||
{
|
||||
m_err++;
|
||||
return -1;
|
||||
}
|
||||
done++;
|
||||
}
|
||||
|
||||
return dwo;
|
||||
}
|
1028
Src/Plugins/Encoder/enc_lame/BladeMP3EncDLL.c
Normal file
1028
Src/Plugins/Encoder/enc_lame/BladeMP3EncDLL.c
Normal file
File diff suppressed because it is too large
Load diff
278
Src/Plugins/Encoder/enc_lame/BladeMP3EncDLL.h
Normal file
278
Src/Plugins/Encoder/enc_lame/BladeMP3EncDLL.h
Normal file
|
@ -0,0 +1,278 @@
|
|||
/*
|
||||
* Blade DLL Interface for LAME.
|
||||
*
|
||||
* Copyright (c) 1999 A.L. Faber
|
||||
* Based on bladedll.h version 1.0 written by Jukka Poikolainen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef ___BLADEDLL_H_INCLUDED___
|
||||
#define ___BLADEDLL_H_INCLUDED___
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* encoding formats */
|
||||
|
||||
#define BE_CONFIG_MP3 0
|
||||
#define BE_CONFIG_LAME 256
|
||||
|
||||
/* type definitions */
|
||||
|
||||
typedef unsigned long HBE_STREAM;
|
||||
typedef HBE_STREAM *PHBE_STREAM;
|
||||
typedef unsigned long BE_ERR;
|
||||
|
||||
/* error codes */
|
||||
|
||||
#define BE_ERR_SUCCESSFUL 0x00000000
|
||||
#define BE_ERR_INVALID_FORMAT 0x00000001
|
||||
#define BE_ERR_INVALID_FORMAT_PARAMETERS 0x00000002
|
||||
#define BE_ERR_NO_MORE_HANDLES 0x00000003
|
||||
#define BE_ERR_INVALID_HANDLE 0x00000004
|
||||
#define BE_ERR_BUFFER_TOO_SMALL 0x00000005
|
||||
|
||||
/* other constants */
|
||||
|
||||
#define BE_MAX_HOMEPAGE 128
|
||||
|
||||
/* format specific variables */
|
||||
|
||||
#define BE_MP3_MODE_STEREO 0
|
||||
#define BE_MP3_MODE_JSTEREO 1
|
||||
#define BE_MP3_MODE_DUALCHANNEL 2
|
||||
#define BE_MP3_MODE_MONO 3
|
||||
|
||||
|
||||
|
||||
#define MPEG1 1
|
||||
#define MPEG2 0
|
||||
|
||||
#ifdef _BLADEDLL
|
||||
#undef FLOAT
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#define CURRENT_STRUCT_VERSION 1
|
||||
#define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG) // is currently 331 bytes
|
||||
|
||||
/* OBSOLETE, VALUES STILL WORK
|
||||
typedef enum
|
||||
{
|
||||
NORMAL_QUALITY=0,
|
||||
LOW_QUALITY,
|
||||
HIGH_QUALITY,
|
||||
VOICE_QUALITY
|
||||
} LAME_QUALTIY_PRESET;
|
||||
|
||||
*/
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VBR_METHOD_NONE = -1,
|
||||
VBR_METHOD_DEFAULT = 0,
|
||||
VBR_METHOD_OLD = 1,
|
||||
VBR_METHOD_NEW = 2,
|
||||
VBR_METHOD_MTRH = 3,
|
||||
VBR_METHOD_ABR = 4
|
||||
} VBRMETHOD;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LQP_NOPRESET=-1,
|
||||
|
||||
// QUALITY PRESETS
|
||||
LQP_NORMAL_QUALITY = 0,
|
||||
LQP_LOW_QUALITY = 1,
|
||||
LQP_HIGH_QUALITY = 2,
|
||||
LQP_VOICE_QUALITY = 3,
|
||||
LQP_R3MIX = 4,
|
||||
LQP_VERYHIGH_QUALITY = 5,
|
||||
LQP_STANDARD = 6,
|
||||
LQP_FAST_STANDARD = 7,
|
||||
LQP_EXTREME = 8,
|
||||
LQP_FAST_EXTREME = 9,
|
||||
LQP_INSANE = 10,
|
||||
LQP_ABR = 11,
|
||||
LQP_CBR = 12,
|
||||
LQP_MEDIUM = 13,
|
||||
LQP_FAST_MEDIUM = 14,
|
||||
|
||||
// NEW PRESET VALUES
|
||||
LQP_PHONE =1000,
|
||||
LQP_SW =2000,
|
||||
LQP_AM =3000,
|
||||
LQP_FM =4000,
|
||||
LQP_VOICE =5000,
|
||||
LQP_RADIO =6000,
|
||||
LQP_TAPE =7000,
|
||||
LQP_HIFI =8000,
|
||||
LQP_CD =9000,
|
||||
LQP_STUDIO =10000
|
||||
|
||||
} LAME_QUALTIY_PRESET;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
DWORD dwConfig; // BE_CONFIG_XXXXX
|
||||
// Currently only BE_CONFIG_MP3 is supported
|
||||
union {
|
||||
|
||||
struct {
|
||||
|
||||
DWORD dwSampleRate; // 48000, 44100 and 32000 allowed. RG note: also seems to support 16000, 22050, 24000.
|
||||
BYTE byMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
|
||||
WORD wBitrate; // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed. RG note: also seems to support 8,16,24.
|
||||
BOOL bPrivate;
|
||||
BOOL bCRC;
|
||||
BOOL bCopyright;
|
||||
BOOL bOriginal;
|
||||
|
||||
} mp3; // BE_CONFIG_MP3
|
||||
|
||||
struct
|
||||
{
|
||||
// STRUCTURE INFORMATION
|
||||
DWORD dwStructVersion;
|
||||
DWORD dwStructSize;
|
||||
|
||||
// BASIC ENCODER SETTINGS
|
||||
DWORD dwSampleRate; // SAMPLERATE OF INPUT FILE
|
||||
DWORD dwReSampleRate; // DOWNSAMPLERATE, 0=ENCODER DECIDES
|
||||
LONG nMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
|
||||
DWORD dwBitrate; // CBR bitrate, VBR min bitrate
|
||||
DWORD dwMaxBitrate; // CBR ignored, VBR Max bitrate
|
||||
LONG nPreset; // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
|
||||
DWORD dwMpegVersion; // FUTURE USE, MPEG-1 OR MPEG-2
|
||||
DWORD dwPsyModel; // FUTURE USE, SET TO 0
|
||||
DWORD dwEmphasis; // FUTURE USE, SET TO 0
|
||||
|
||||
// BIT STREAM SETTINGS
|
||||
BOOL bPrivate; // Set Private Bit (TRUE/FALSE)
|
||||
BOOL bCRC; // Insert CRC (TRUE/FALSE)
|
||||
BOOL bCopyright; // Set Copyright Bit (TRUE/FALSE)
|
||||
BOOL bOriginal; // Set Original Bit (TRUE/FALSE)
|
||||
|
||||
// VBR STUFF
|
||||
BOOL bWriteVBRHeader; // WRITE XING VBR HEADER (TRUE/FALSE)
|
||||
BOOL bEnableVBR; // USE VBR ENCODING (TRUE/FALSE)
|
||||
INT nVBRQuality; // VBR QUALITY 0..9
|
||||
DWORD dwVbrAbr_bps; // Use ABR in stead of nVBRQuality
|
||||
VBRMETHOD nVbrMethod;
|
||||
BOOL bNoRes; // Disable Bit resorvoir
|
||||
|
||||
// MISC SETTINGS
|
||||
BOOL bStrictIso; // Use strict ISO encoding rules (TRUE/FALSE)
|
||||
WORD nQuality; // Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5
|
||||
|
||||
// FUTURE USE, SET TO 0, align strucutre to 331 bytes
|
||||
BYTE btReserved[255-4*sizeof(DWORD) - sizeof( WORD )];
|
||||
|
||||
} LHV1; // LAME header version 1
|
||||
|
||||
struct {
|
||||
|
||||
DWORD dwSampleRate;
|
||||
BYTE byMode;
|
||||
WORD wBitrate;
|
||||
BYTE byEncodingMethod;
|
||||
|
||||
} aac;
|
||||
|
||||
} format;
|
||||
|
||||
} BE_CONFIG, *PBE_CONFIG;
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
// BladeEnc DLL Version number
|
||||
|
||||
BYTE byDLLMajorVersion;
|
||||
BYTE byDLLMinorVersion;
|
||||
|
||||
// BladeEnc Engine Version Number
|
||||
|
||||
BYTE byMajorVersion;
|
||||
BYTE byMinorVersion;
|
||||
|
||||
// DLL Release date
|
||||
|
||||
BYTE byDay;
|
||||
BYTE byMonth;
|
||||
WORD wYear;
|
||||
|
||||
// BladeEnc Homepage URL
|
||||
|
||||
CHAR zHomepage[BE_MAX_HOMEPAGE + 1];
|
||||
|
||||
BYTE byAlphaLevel;
|
||||
BYTE byBetaLevel;
|
||||
BYTE byMMXEnabled;
|
||||
|
||||
BYTE btReserved[125];
|
||||
|
||||
|
||||
} BE_VERSION, *PBE_VERSION;
|
||||
|
||||
#ifndef _BLADEDLL
|
||||
|
||||
typedef BE_ERR (*BEINITSTREAM) (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM);
|
||||
typedef BE_ERR (*BEENCODECHUNK) (HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD);
|
||||
// added for floating point audio -- DSPguru, jd
|
||||
typedef BE_ERR (*BEENCODECHUNKFLOATS16NI) (HBE_STREAM, DWORD, PFLOAT, PFLOAT, PBYTE, PDWORD);
|
||||
typedef BE_ERR (*BEDEINITSTREAM) (HBE_STREAM, PBYTE, PDWORD);
|
||||
typedef BE_ERR (*BECLOSESTREAM) (HBE_STREAM);
|
||||
typedef VOID (*BEVERSION) (PBE_VERSION);
|
||||
typedef VOID (*BEWRITEVBRHEADER) (LPCSTR);
|
||||
|
||||
#define TEXT_BEINITSTREAM "beInitStream"
|
||||
#define TEXT_BEENCODECHUNK "beEncodeChunk"
|
||||
#define TEXT_BEENCODECHUNKFLOATS16NI "beEncodeChunkFloatS16NI"
|
||||
#define TEXT_BEDEINITSTREAM "beDeinitStream"
|
||||
#define TEXT_BECLOSESTREAM "beCloseStream"
|
||||
#define TEXT_BEVERSION "beVersion"
|
||||
#define TEXT_BEWRITEVBRHEADER "beWriteVBRHeader"
|
||||
|
||||
#else
|
||||
|
||||
__declspec(dllexport) BE_ERR beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
|
||||
__declspec(dllexport) BE_ERR beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
|
||||
// added for floating point audio -- DSPguru, jd
|
||||
__declspec(dllexport) BE_ERR beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput);
|
||||
__declspec(dllexport) BE_ERR beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
|
||||
__declspec(dllexport) BE_ERR beCloseStream(HBE_STREAM hbeStream);
|
||||
__declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion);
|
||||
__declspec(dllexport) BE_ERR beWriteVBRHeader(LPCSTR lpszFileName);
|
||||
__declspec(dllexport) BE_ERR beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
|
||||
__declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName);
|
||||
|
||||
#endif
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
196
Src/Plugins/Encoder/enc_lame/MP3Coder.cpp
Normal file
196
Src/Plugins/Encoder/enc_lame/MP3Coder.cpp
Normal file
|
@ -0,0 +1,196 @@
|
|||
#include "MP3Coder.h"
|
||||
|
||||
AudioCoderMP3::~AudioCoderMP3()
|
||||
{
|
||||
if (hbeStream) beCloseStream(hbeStream); hbeStream = 0;
|
||||
if (bs) free(bs); bs = 0;
|
||||
}
|
||||
|
||||
int AudioCoderMP3::GetLastError() { return m_err; };
|
||||
|
||||
void AudioCoderMP3::setVbrFilename(char *filename)
|
||||
{
|
||||
if (hbeStream) beCloseStream(hbeStream);
|
||||
hbeStream = 0;
|
||||
if (filename)
|
||||
{
|
||||
beWriteVBRHeader(filename);
|
||||
}
|
||||
}
|
||||
|
||||
int AudioCoderMP3::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail)
|
||||
{
|
||||
if (m_err) return -1;
|
||||
if (!hbeStream)
|
||||
{
|
||||
if (beInitStream(&beConfig, &ibuf_size_spls, &obuf_size, (PHBE_STREAM) &hbeStream) != BE_ERR_SUCCESSFUL)
|
||||
{
|
||||
m_err++;
|
||||
return -1;
|
||||
}
|
||||
ibuf_size = ibuf_size_spls * bytesPerSample;
|
||||
|
||||
if (is_downmix) ibuf_size *= 2;
|
||||
|
||||
bs = (char*)malloc(ibuf_size);
|
||||
bs_size = 0;
|
||||
}
|
||||
|
||||
|
||||
*in_used = 0;
|
||||
|
||||
int needbytes = ibuf_size - bs_size;
|
||||
if (needbytes > 0 && in_avail > 0)
|
||||
{
|
||||
if (needbytes > in_avail)
|
||||
needbytes = in_avail;
|
||||
memcpy(bs + bs_size, in, needbytes);
|
||||
bs_size += needbytes;
|
||||
*in_used = needbytes;
|
||||
}
|
||||
if (!done)
|
||||
{
|
||||
if (bs_size < (int)ibuf_size) return 0;
|
||||
|
||||
}
|
||||
|
||||
if (out_avail < (int)obuf_size) return 0;
|
||||
|
||||
int feedBytes = min(bs_size, (int)ibuf_size);
|
||||
int feedSamples = feedBytes / bytesPerSample;
|
||||
bs_size -= feedBytes;
|
||||
|
||||
if (is_downmix)
|
||||
{
|
||||
int x;
|
||||
int l = feedBytes / 4;
|
||||
short *b = (short*)bs;
|
||||
for (x = 0; x < l; x ++)
|
||||
{
|
||||
b[x] = b[x * 2] / 2 + b[x * 2 + 1] / 2;
|
||||
}
|
||||
feedSamples/=2;
|
||||
}
|
||||
DWORD dwo = 0;
|
||||
|
||||
if (feedSamples)
|
||||
{
|
||||
if (beEncodeChunk(hbeStream, feedSamples, (short*)bs, (unsigned char*)out, &dwo) != BE_ERR_SUCCESSFUL)
|
||||
{
|
||||
m_err++;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!dwo && done==1)
|
||||
{
|
||||
if (beDeinitStream(hbeStream, (unsigned char *)out, &dwo) != BE_ERR_SUCCESSFUL)
|
||||
{
|
||||
m_err++;
|
||||
return -1;
|
||||
}
|
||||
done++;
|
||||
}
|
||||
|
||||
return dwo;
|
||||
}
|
||||
|
||||
void AudioCoderMP3::PrepareToFinish()
|
||||
{
|
||||
done = 1;
|
||||
}
|
||||
|
||||
AudioCoderMP3::AudioCoderMP3(int nch, int srate, int bps, configtype *cfg)
|
||||
: obuf_size(0), ibuf_size(0), ibuf_size_spls(0), done(false), bs_size(0)
|
||||
{
|
||||
m_err = 0;
|
||||
hbeStream = 0;
|
||||
bs = 0;
|
||||
is_downmix = 0;
|
||||
mono_input=0;
|
||||
|
||||
memset(&beConfig, 0, sizeof(beConfig)); // clear all fields
|
||||
|
||||
if (srate != 32000
|
||||
&& srate != 44100
|
||||
&& srate != 48000
|
||||
&& srate != 16000 /* MPEG 2 sample rates */
|
||||
&& srate != 22050
|
||||
&& srate != 24000
|
||||
&& srate != 11025 /* MPEG 2.5 sample rates */
|
||||
&& srate != 12000
|
||||
&& srate != 8000)
|
||||
{
|
||||
//MessageBox(NULL, "The only valid audio sampling rates for the LAME mp3 encoder are:\r\t16000\r\t22050\r\t24000\r\t32000\r\t44100\r\t48000\r\rPlease modify the encoding profile to use one of these sampling rates, and then try again.", "Invalid sampling rate", MB_OK);
|
||||
m_err++;
|
||||
return ;
|
||||
}
|
||||
|
||||
// use the LAME config structure
|
||||
beConfig.dwConfig = BE_CONFIG_LAME;
|
||||
|
||||
// this are the default settings for testcase.wav
|
||||
beConfig.format.LHV1.dwStructVersion = 1;
|
||||
beConfig.format.LHV1.dwStructSize = sizeof(beConfig);
|
||||
beConfig.format.LHV1.dwSampleRate = srate; // INPUT FREQUENCY
|
||||
|
||||
beConfig.format.LHV1.nMode = cfg->stereo_mode;
|
||||
if (nch < 2)
|
||||
{
|
||||
beConfig.format.LHV1.nMode = BE_MP3_MODE_MONO;
|
||||
mono_input=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (beConfig.format.LHV1.nMode == BE_MP3_MODE_MONO)
|
||||
is_downmix = 1;
|
||||
// beConfig.format.LHV1.nMode = BE_MP3_MODE_STEREO;
|
||||
}
|
||||
|
||||
beConfig.format.LHV1.dwBitrate = cfg->bitrate;
|
||||
beConfig.format.LHV1.dwMaxBitrate = (cfg->vbr_method != -1 ? cfg->vbr_max_bitrate : cfg->bitrate);
|
||||
|
||||
beConfig.format.LHV1.dwReSampleRate = 0; // DOWNSAMPLERATE, 0=ENCODER DECIDES
|
||||
|
||||
if (beConfig.format.LHV1.dwMaxBitrate < 32) // less than 32, let's force mono
|
||||
{
|
||||
if (nch > 1)
|
||||
{
|
||||
beConfig.format.LHV1.nMode = BE_MP3_MODE_MONO;
|
||||
is_downmix = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*int effective_nch = (beConfig.format.LHV1.nMode == BE_MP3_MODE_MONO) ? 1 : 2;
|
||||
|
||||
if (beConfig.format.LHV1.dwReSampleRate >= 32000 &&
|
||||
beConfig.format.LHV1.dwMaxBitrate / effective_nch <= 32)
|
||||
{
|
||||
beConfig.format.LHV1.dwReSampleRate /= 2;
|
||||
}*/
|
||||
/*
|
||||
if (beConfig.format.LHV1.dwReSampleRate < 32000)
|
||||
beConfig.format.LHV1.dwMpegVersion = MPEG2; // MPEG VERSION (I or II)
|
||||
else
|
||||
beConfig.format.LHV1.dwMpegVersion = MPEG1; // MPEG VERSION (I or II)
|
||||
*/
|
||||
|
||||
beConfig.format.LHV1.nPreset = cfg->quality;
|
||||
|
||||
beConfig.format.LHV1.dwPsyModel = 0; // USE DEFAULT PSYCHOACOUSTIC MODEL
|
||||
beConfig.format.LHV1.dwEmphasis = 0; // NO EMPHASIS TURNED ON
|
||||
|
||||
beConfig.format.LHV1.bOriginal = 0; // SET ORIGINAL FLAG
|
||||
beConfig.format.LHV1.bCRC = 0; // INSERT CRC
|
||||
beConfig.format.LHV1.bCopyright = 0; // SET COPYRIGHT FLAG
|
||||
beConfig.format.LHV1.bPrivate = 0; // SET PRIVATE FLAG
|
||||
beConfig.format.LHV1.bNoRes = 0;
|
||||
beConfig.format.LHV1.bWriteVBRHeader = 1;
|
||||
|
||||
beConfig.format.LHV1.bEnableVBR = cfg->vbr_method != VBR_METHOD_NONE;
|
||||
beConfig.format.LHV1.nVBRQuality = cfg->vbr;
|
||||
//beConfig.format.LHV1.dwVbrAbr_bps = (cfg->vbr_method != VBR_METHOD_NONE ? 1000 * cfg->abr_bitrate : 0);
|
||||
beConfig.format.LHV1.dwVbrAbr_bps = (cfg->vbr_method == VBR_METHOD_ABR ? 1000 * cfg->abr_bitrate : 0);
|
||||
beConfig.format.LHV1.nVbrMethod = (VBRMETHOD)cfg->vbr_method;
|
||||
|
||||
bytesPerSample = bps / 8;
|
||||
}
|
62
Src/Plugins/Encoder/enc_lame/MP3Coder.h
Normal file
62
Src/Plugins/Encoder/enc_lame/MP3Coder.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
#ifndef NULLSOFT_MP3_CODER_H
|
||||
#define NULLSOFT_MP3_CODER_H
|
||||
|
||||
#include <windows.h>
|
||||
#include "../nsv/enc_if.h"
|
||||
#include "BladeMP3EncDLL.h"
|
||||
#ifndef _BLADEDLL
|
||||
extern BEINITSTREAM beInitStream;
|
||||
extern BECLOSESTREAM beCloseStream;
|
||||
extern BEENCODECHUNK beEncodeChunk;
|
||||
extern BEDEINITSTREAM beDeinitStream;
|
||||
extern BEWRITEVBRHEADER beWriteVBRHeader;
|
||||
extern BEVERSION beVersion;
|
||||
extern BEENCODECHUNKFLOATS16NI beEncodeChunkFloatS16NI;
|
||||
#endif // !_BLADEDLL
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int bitrate;
|
||||
int vbr_max_bitrate;
|
||||
int abr_bitrate;
|
||||
int stereo_mode; //0=stereo,1=jstereo,2=mchannel,3=mono
|
||||
int quality; //0=normal,1=low,2=high,3=voice,4=r3mix,5=vh
|
||||
|
||||
int vbr; // 0=high-9=low
|
||||
int vbr_method; // -1=none, 0=default, 1=old, 2=new, 3=mtrh, 4=abr
|
||||
|
||||
}
|
||||
configtype;
|
||||
class AudioCoderMP3 : public AudioCoder
|
||||
{
|
||||
public:
|
||||
AudioCoderMP3(int nch, int srate, int bps, configtype *cfg);
|
||||
int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail);
|
||||
virtual ~AudioCoderMP3();
|
||||
int GetLastError();
|
||||
void setVbrFilename(char *filename);
|
||||
void PrepareToFinish();
|
||||
protected:
|
||||
int m_err;
|
||||
DWORD obuf_size;
|
||||
DWORD ibuf_size, ibuf_size_spls;
|
||||
HBE_STREAM hbeStream;
|
||||
BE_CONFIG beConfig;
|
||||
int bytesPerSample;
|
||||
int done;
|
||||
char *bs;
|
||||
int bs_size;
|
||||
int is_downmix;
|
||||
int mono_input;
|
||||
};
|
||||
|
||||
class AudioCoderMP3_24 : public AudioCoderMP3
|
||||
{
|
||||
public:
|
||||
AudioCoderMP3_24(int nch, int srate, int bps, configtype *cfg) : AudioCoderMP3(nch, srate, bps, cfg) {}
|
||||
int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail);
|
||||
};
|
||||
|
||||
#endif
|
145
Src/Plugins/Encoder/enc_lame/enc_lame.rc
Normal file
145
Src/Plugins/Encoder/enc_lame/enc_lame.rc
Normal file
|
@ -0,0 +1,145 @@
|
|||
// 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_MP3 DIALOGEX 0, 0, 256, 167
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
GROUPBOX "MP3 Encoder Options",IDC_STATIC,0,0,256,166
|
||||
LTEXT "Mode:",IDC_STATIC,4,13,21,8
|
||||
COMBOBOX IDC_VBRMETHOD,28,11,52,155,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_STEREOMODE,87,11,66,184,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Bitrate:",IDC_BITRATE_TEXT1,6,28,80,8
|
||||
COMBOBOX IDC_BITRATE,87,25,38,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "kbps",IDC_BITRATE_TEXT2,129,28,16,8
|
||||
LTEXT "VBR Maximum Bitrate:",IDC_MAXBITRATE_TEXT1,6,42,77,8
|
||||
COMBOBOX IDC_MAXBITRATE,87,39,38,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "kbps",IDC_MAXBITRATE_TEXT2,129,42,16,8
|
||||
LTEXT "Average Bitrate:",IDC_AVGBITRATE_TEXT1,6,56,77,8
|
||||
COMBOBOX IDC_AVGBITRATE,87,53,38,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "kbps",IDC_AVGBITRATE_TEXT2,129,56,16,8
|
||||
LTEXT "Quality:",IDC_STATIC,7,74,24,8
|
||||
COMBOBOX IDC_QUALITY,33,72,98,110,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "VBR Q:",IDC_VBRQ_TEXT,136,74,25,8
|
||||
COMBOBOX IDC_VBRQ,161,72,40,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "MPEG Layer-3 audio coding technology licensed from Fraunhofer IIS and Thomson.",IDC_STATIC,5,92,148,18,NOT WS_VISIBLE
|
||||
LTEXT "MPEG Layer-3 encoding technology by Mp3dev.",IDC_STATIC,5,115,154,8
|
||||
LTEXT "",IDC_LAMEVERSION,136,153,114,8,0,WS_EX_RIGHT
|
||||
END
|
||||
|
||||
IDD_MP3_MISSING DIALOGEX 0, 0, 256, 167
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
GROUPBOX "MP3 Encoder Options",-1,0,0,256,166
|
||||
LTEXT "MP3 encoding support is not available as ""lame_enc.dll"" is not present.\n\nYou will need to manually download ""lame_enc.dll"" to the Winamp\Shared folder to enable MP3 encoding support.",-1,12,14,231,34
|
||||
LTEXT "Click here for information on where you can obtain ""lame_enc.dll"".",-1,12,54,231,10
|
||||
CONTROL "here",IDC_URL1,"Button",BS_OWNERDRAW | WS_TABSTOP,27,54,15,8
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
65535 "{F1534ECA-6E64-42c2-9781-812E61154515}"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_BITRATE "Bitrate:"
|
||||
IDS_ABR_MIN_BITRATE "ABR Minimum Bitrate"
|
||||
IDS_VBR_MIN_BITRATE "VBR Minimum Bitrate"
|
||||
IDS_N_A "N/A"
|
||||
IDS_ABR_MAX_BITRATE "ABR Maximum Bitrate"
|
||||
IDS_VBR_MAX_BITRATE "VBR Maximum Bitrate"
|
||||
IDS_AVERAGE_BITRATE "Average Bitrate"
|
||||
IDS_STEREO "Stereo"
|
||||
IDS_JOINT_STEREO "Joint Stereo"
|
||||
IDS_MULTI_CHANNEL "Multi-Channel"
|
||||
IDS_MONO "Mono"
|
||||
IDS_NORMAL "Normal"
|
||||
IDS_LOW "Low"
|
||||
IDS_HIGH "High"
|
||||
IDS_VOICE "Voice"
|
||||
IDS_R3MIX "R3mix"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_VERY_HIGH "Very High"
|
||||
IDS_HIGH_BRACKET "(High)"
|
||||
IDS_LOW_BRACKET "(Low)"
|
||||
IDS_ENC_LAME_DESC "MP3 Encoder %s"
|
||||
IDS_ENC_LAME_DESC_MISSING "MP3 Encoder %s [NOT LOADED]"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#include "version.rc2"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
30
Src/Plugins/Encoder/enc_lame/enc_lame.sln
Normal file
30
Src/Plugins/Encoder/enc_lame/enc_lame.sln
Normal file
|
@ -0,0 +1,30 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29509.3
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enc_lame", "enc_lame.vcxproj", "{861F24D8-9B22-42FA-B056-7A86D6B4500C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Debug|x64.Build.0 = Debug|x64
|
||||
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Release|Win32.Build.0 = Release|Win32
|
||||
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Release|x64.ActiveCfg = Release|x64
|
||||
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {CC41ED85-6766-472A-9C3A-5E89A14D82B6}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
293
Src/Plugins/Encoder/enc_lame/enc_lame.vcxproj
Normal file
293
Src/Plugins/Encoder/enc_lame/enc_lame.vcxproj
Normal file
|
@ -0,0 +1,293 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{861F24D8-9B22-42FA-B056-7A86D6B4500C}</ProjectGuid>
|
||||
<RootNamespace>enc_lame</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg">
|
||||
<VcpkgEnableManifest>false</VcpkgEnableManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\Wasabi;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include\lame</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WINDOWS;_USRDLL;_BLADEDLL;NSV_CODER_MP3_EXPORTS;WINDOWS_IGNORE_PACKING_MISMATCH;WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shlwapi.lib;libmp3lame-static.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\debug\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ and if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\Wasabi;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include\lame</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;_BLADEDLL;NSV_CODER_MP3_EXPORTS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shlwapi.lib;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\debug\lib\libmp3lame-static.lib</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\debug\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ and if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>..\..\..\Wasabi;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include\lame</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WINDOWS;_USRDLL;_BLADEDLL;NSV_CODER_MP3_EXPORTS;WINDOWS_IGNORE_PACKING_MISMATCH;NDEBUG;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shlwapi.lib;libmp3lame-static.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ and if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>..\..\..\Wasabi;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include\lame</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;NSV_CODER_MP3_EXPORTS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shlwapi.lib;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\lib\libmp3lame-static.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\debug\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
if exist ..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ and if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="24bit.cpp" />
|
||||
<ClCompile Include="BladeMP3EncDLL.c" />
|
||||
<ClCompile Include="main.cpp">
|
||||
<!--PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions-->
|
||||
</ClCompile>
|
||||
<ClCompile Include="MP3Coder.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_lame.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BladeMP3EncDLL.h" />
|
||||
<ClInclude Include="MP3Coder.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj">
|
||||
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
44
Src/Plugins/Encoder/enc_lame/enc_lame.vcxproj.filters
Normal file
44
Src/Plugins/Encoder/enc_lame/enc_lame.vcxproj.filters
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="24bit.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MP3Coder.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BladeMP3EncDLL.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MP3Coder.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BladeMP3EncDLL.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{dc9d6b9d-69d1-40a7-97c9-870cfa399631}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Ressource Files">
|
||||
<UniqueIdentifier>{3e0eac86-0886-4e85-a300-8b6cb497e2a7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{bf0f4053-1c32-4453-a394-6542b1301613}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_lame.rc">
|
||||
<Filter>Ressource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
503
Src/Plugins/Encoder/enc_lame/main.cpp
Normal file
503
Src/Plugins/Encoder/enc_lame/main.cpp
Normal file
|
@ -0,0 +1,503 @@
|
|||
/*
|
||||
** nsv_coder_lame: main.cpp - LAME mp3 encoder plug-in
|
||||
** (requires lame_enc.dll)
|
||||
**
|
||||
** Copyright (C) 2001-2006 Nullsoft, Inc.
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied warranty.
|
||||
** In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
**
|
||||
** Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
** applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the
|
||||
** original software. If you use this software in a product, an acknowledgment in the product
|
||||
** documentation would be appreciated but is not required.
|
||||
** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as
|
||||
** being the original software.
|
||||
** 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#define ENC_VERSION "v1.38"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "resource.h"
|
||||
#include "BladeMP3EncDLL.h"
|
||||
#include "MP3Coder.h"
|
||||
#include <strsafe.h>
|
||||
#include <shlwapi.h>
|
||||
#include <lame/lame.h>
|
||||
|
||||
// wasabi based services for localisation support
|
||||
#include <api/service/waServiceFactory.h>
|
||||
#include "../Agave/Language/api_language.h"
|
||||
#include "../winamp/wa_ipc.h"
|
||||
|
||||
HWND winampwnd = 0;
|
||||
api_service *WASABI_API_SVC = 0;
|
||||
api_language *WASABI_API_LNG = 0;
|
||||
HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
|
||||
|
||||
int g_valid_bitrates[] = { 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1 };
|
||||
|
||||
static wchar_t lamedll[MAX_PATH]=L"";
|
||||
HINSTANCE g_lamedll = 0;
|
||||
|
||||
//BEINITSTREAM beInitStream=0;
|
||||
//BECLOSESTREAM beCloseStream=0;
|
||||
//BEENCODECHUNK beEncodeChunk=0;
|
||||
//BEDEINITSTREAM beDeinitStream=0;
|
||||
//BEWRITEVBRHEADER beWriteVBRHeader=0;
|
||||
//BEVERSION beVersion=0;
|
||||
//BEENCODECHUNKFLOATS16NI beEncodeChunkFloatS16NI=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(!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_LNG)
|
||||
{
|
||||
waServiceFactory *sf;
|
||||
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(),EncLameLangGUID);
|
||||
}
|
||||
}
|
||||
/*
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
return TRUE;
|
||||
}*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
configtype cfg;
|
||||
char configfile[MAX_PATH];
|
||||
}
|
||||
configwndrec;
|
||||
|
||||
void BuildVersionString(wchar_t version[128])
|
||||
{
|
||||
BE_VERSION ver;
|
||||
beVersion(&ver);
|
||||
|
||||
if (ver.byBetaLevel)
|
||||
StringCchPrintf(version, 128, L"%u.%ub%u", (unsigned int)ver.byMajorVersion, (unsigned int)ver.byMinorVersion, (unsigned int)ver.byBetaLevel);
|
||||
else if (ver.byAlphaLevel)
|
||||
StringCchPrintf(version, 128, L"%u.%ua%u", (unsigned int)ver.byMajorVersion, (unsigned int)ver.byMinorVersion, (unsigned int)ver.byAlphaLevel);
|
||||
else
|
||||
StringCchPrintf(version, 128, L"%u.%u", (unsigned int)ver.byMajorVersion, (unsigned int)ver.byMinorVersion);
|
||||
}
|
||||
|
||||
void readconfig(char *configfile, configtype *cfg)
|
||||
{
|
||||
cfg->bitrate = 128;
|
||||
cfg->vbr_max_bitrate = 320;
|
||||
cfg->abr_bitrate = 128;
|
||||
|
||||
cfg->stereo_mode = 1;
|
||||
cfg->quality = LQP_FAST_STANDARD;
|
||||
|
||||
cfg->vbr = 2;
|
||||
cfg->vbr_method = VBR_METHOD_NEW;
|
||||
|
||||
if (configfile)
|
||||
GetPrivateProfileStructA("audio_mp3l", "conf", cfg, sizeof(configtype), configfile);
|
||||
}
|
||||
|
||||
void writeconfig(char* configfile, configtype *cfg)
|
||||
{
|
||||
if (configfile)
|
||||
WritePrivateProfileStructA("audio_mp3l", "conf", cfg, sizeof(configtype), configfile);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
unsigned int __declspec(dllexport) GetAudioTypes3(int idx, char *desc)
|
||||
{
|
||||
//if ((g_lamedll != NULL) && (beInitStream != NULL) && (beCloseStream != NULL) && (beEncodeChunk != NULL) && (beDeinitStream != NULL) && (beWriteVBRHeader != NULL) && (beVersion != NULL))
|
||||
if (idx == 0)
|
||||
{
|
||||
GetLocalisationApiService();
|
||||
StringCchPrintfA(desc, 1024, WASABI_API_LNGSTRING(IDS_ENC_LAME_DESC), ENC_VERSION);
|
||||
return mmioFOURCC('M', 'P', '3', 'l');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioCoder __declspec(dllexport) *CreateAudio3(int nch, int srate, int bps, unsigned int srct, unsigned int *outt, char *configfile)
|
||||
{
|
||||
if (nch > 2 || srate > 48000)
|
||||
return NULL;
|
||||
|
||||
if (srct == mmioFOURCC('P', 'C', 'M', ' ') && *outt == mmioFOURCC('M', 'P', '3', 'l'))
|
||||
{
|
||||
configtype cfg;
|
||||
readconfig(configfile, &cfg);
|
||||
*outt = mmioFOURCC('M', 'P', '3', ' ');
|
||||
AudioCoderMP3 *t=0;
|
||||
if (bps != 16)
|
||||
t = new AudioCoderMP3_24(nch, srate, bps, &cfg);
|
||||
else
|
||||
t = new AudioCoderMP3(nch, srate, bps, &cfg);
|
||||
if (t->GetLastError())
|
||||
{
|
||||
delete t;
|
||||
return NULL;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) FinishAudio3(const char *filename, AudioCoder *coder)
|
||||
{
|
||||
//beWriteVBRHeader(filename);
|
||||
((AudioCoderMP3*)coder)->setVbrFilename((char *)filename); //apparently this needs to be called after beCloseStream
|
||||
}
|
||||
|
||||
void __declspec(dllexport) PrepareToFinish(const char *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCoderMP3*)coder)->PrepareToFinish();
|
||||
}
|
||||
|
||||
static void setBitrates(HWND hwndDlg, int mi, int ma)
|
||||
{
|
||||
int i = 0;
|
||||
while (g_valid_bitrates[i] > 0)
|
||||
{
|
||||
if (g_valid_bitrates[i] == mi) SendDlgItemMessage(hwndDlg, IDC_BITRATE, CB_SETCURSEL, i, 0);
|
||||
if (g_valid_bitrates[i] == ma) SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_SETCURSEL, i, 0);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (uMsg == WM_USER + 666)
|
||||
{
|
||||
int vbr_meth = (int)SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_GETCURSEL, 0, 0);
|
||||
if (vbr_meth == CB_ERR) vbr_meth = 0;
|
||||
vbr_meth--;
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_VBRQ), vbr_meth != -1 && vbr_meth != 4);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_VBRQ_TEXT), vbr_meth != -1 && vbr_meth != 4);
|
||||
SetDlgItemTextW(hwndDlg, IDC_BITRATE_TEXT1, WASABI_API_LNGSTRINGW((vbr_meth == -1 ? IDS_BITRATE : vbr_meth == 4 ? IDS_ABR_MIN_BITRATE : IDS_VBR_MIN_BITRATE)));
|
||||
SetDlgItemTextW(hwndDlg, IDC_MAXBITRATE_TEXT1, WASABI_API_LNGSTRINGW((vbr_meth == -1 ? IDS_N_A : vbr_meth == 4 ? IDS_ABR_MAX_BITRATE : IDS_VBR_MAX_BITRATE)));
|
||||
SetDlgItemTextW(hwndDlg, IDC_AVGBITRATE_TEXT1, WASABI_API_LNGSTRINGW((vbr_meth != 4 ? IDS_N_A : IDS_AVERAGE_BITRATE)));
|
||||
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXBITRATE_TEXT1), vbr_meth != -1);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXBITRATE_TEXT2), vbr_meth != -1);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXBITRATE), vbr_meth != -1);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_AVGBITRATE_TEXT1), vbr_meth == 4);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_AVGBITRATE_TEXT2), vbr_meth == 4);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_AVGBITRATE), vbr_meth == 4);
|
||||
|
||||
int qual = (int)SendDlgItemMessage(hwndDlg, IDC_QUALITY, CB_GETCURSEL, 0, 0);
|
||||
if (qual == CB_ERR) qual = 0;
|
||||
switch (qual)
|
||||
{
|
||||
case LQP_R3MIX:
|
||||
case LQP_STANDARD:
|
||||
case LQP_FAST_STANDARD:
|
||||
case LQP_EXTREME:
|
||||
case LQP_FAST_EXTREME:
|
||||
case LQP_INSANE:
|
||||
case LQP_MEDIUM:
|
||||
case LQP_FAST_MEDIUM:
|
||||
case LQP_ABR:
|
||||
case LQP_CBR:
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_STEREOMODE), 0);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_VBRMETHOD), 0);
|
||||
break;
|
||||
default:
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_STEREOMODE), 1);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_VBRMETHOD), 1);
|
||||
break;
|
||||
}
|
||||
if (qual == 4) EnableWindow(GetDlgItem(hwndDlg, IDC_VBRQ), 0);
|
||||
}
|
||||
|
||||
if (uMsg == WM_USER + 667)
|
||||
{
|
||||
int qual = (int)SendDlgItemMessage(hwndDlg, IDC_QUALITY, CB_GETCURSEL, 0, 0);
|
||||
if (qual == CB_ERR) qual = 0;
|
||||
switch (qual)
|
||||
{
|
||||
case LQP_R3MIX:
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 3, 0);
|
||||
setBitrates(hwndDlg, 96, 224);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 1, 0);
|
||||
break;
|
||||
case LQP_STANDARD: /* check for alt-preset standard */
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 2, 0);
|
||||
setBitrates(hwndDlg, 32, 320);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
|
||||
break;
|
||||
case LQP_FAST_STANDARD: /* check for alt-preset fast standard */
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 3, 0);
|
||||
setBitrates(hwndDlg, 32, 320);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
|
||||
break;
|
||||
case LQP_MEDIUM: /* check for alt-preset medium */
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 2, 0);
|
||||
setBitrates(hwndDlg, 32, 320);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
|
||||
break;
|
||||
case LQP_FAST_MEDIUM: /* check for alt-preset fast medium */
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 3, 0);
|
||||
setBitrates(hwndDlg, 32, 320);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
|
||||
break;
|
||||
case LQP_EXTREME: /* check for alt-preset extreme */
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 2, 0);
|
||||
setBitrates(hwndDlg, 32, 320);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
|
||||
break;
|
||||
case LQP_FAST_EXTREME: /* check for alt-preset fast extreme */
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 3, 0);
|
||||
setBitrates(hwndDlg, 32, 320);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
|
||||
break;
|
||||
case LQP_INSANE: /* check for alt-preset fast insane */
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 0, 0);
|
||||
setBitrates(hwndDlg, 320, 320);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
break;
|
||||
case LQP_ABR: /* check for alt-preset fast insane */
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 5, 0);
|
||||
setBitrates(hwndDlg, 64, 320);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
|
||||
break;
|
||||
case LQP_CBR: /* check for alt-preset fast insane */
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 0, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
|
||||
break;
|
||||
}
|
||||
SendMessage(hwndDlg, WM_USER + 666, 0, 0);
|
||||
}
|
||||
|
||||
if (uMsg == WM_INITDIALOG)
|
||||
{
|
||||
#if defined (_WIN64)
|
||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
|
||||
#else
|
||||
SetWindowLong(hwndDlg, GWL_USERDATA, lParam);
|
||||
#endif
|
||||
wchar_t versionText[128] = {0};
|
||||
BuildVersionString(versionText);
|
||||
SetDlgItemText(hwndDlg, IDC_LAMEVERSION, versionText);
|
||||
if (lParam)
|
||||
{
|
||||
configwndrec *wc = (configwndrec*)lParam;
|
||||
|
||||
// -1=none, 0=default, 1=old, 2=new, 3=mtrh, 4=abr
|
||||
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"CBR");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"VBR default");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"VBR old");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"VBR new");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"VBR mtrh");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"ABR");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, wc->cfg.vbr_method + 1, 0);
|
||||
|
||||
//0=stereo,1=jstereo,2=mchannel,3=mono
|
||||
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_STEREO));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_JOINT_STEREO));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_MULTI_CHANNEL));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_MONO));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, wc->cfg.stereo_mode, 0);
|
||||
|
||||
{
|
||||
int i = 0;
|
||||
while (g_valid_bitrates[i] > 0)
|
||||
{
|
||||
wchar_t buf[64] = {0};
|
||||
StringCchPrintf(buf, 64, L"%d", g_valid_bitrates[i]);
|
||||
SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_ADDSTRING, 0, (LPARAM)buf);
|
||||
SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_ADDSTRING, 0, (LPARAM)buf);
|
||||
SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_ADDSTRING, 0, (LPARAM)buf);
|
||||
SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_SETITEMDATA, i, g_valid_bitrates[i]);
|
||||
SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_SETITEMDATA, i, g_valid_bitrates[i]);
|
||||
SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_SETITEMDATA, i, g_valid_bitrates[i]);
|
||||
i++;
|
||||
};
|
||||
|
||||
i = 0;
|
||||
while (g_valid_bitrates[i] > 0)
|
||||
{
|
||||
if (g_valid_bitrates[i] == wc->cfg.bitrate ) SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_SETCURSEL, i, 0);
|
||||
if (g_valid_bitrates[i] == wc->cfg.abr_bitrate ) SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_SETCURSEL, i, 0);
|
||||
if (g_valid_bitrates[i] == wc->cfg.vbr_max_bitrate) SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_SETCURSEL, i, 0);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_NORMAL));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_LOW));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_HIGH));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_VOICE));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_R3MIX));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_VERY_HIGH));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset standard");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset fast standard");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset extreme");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset fast extreme");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset insane");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset abr");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset cbr");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset medium");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset fast medium");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_SETCURSEL, wc->cfg.quality, 0);
|
||||
|
||||
int x;
|
||||
for (x = 0; x < 10; x ++)
|
||||
{
|
||||
wchar_t buf[123] = {0};
|
||||
StringCchPrintfW(buf, 123, L"%d%s", x, x == 0 ? WASABI_API_LNGSTRINGW(IDS_HIGH_BRACKET) : x == 9 ? WASABI_API_LNGSTRINGW(IDS_LOW_BRACKET) : L"");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_VBRQ, CB_ADDSTRING, 0, (LPARAM)buf);
|
||||
}
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, wc->cfg.vbr, 0);
|
||||
|
||||
SendMessage(hwndDlg, WM_USER + 666, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (uMsg == WM_COMMAND)
|
||||
{
|
||||
if (LOWORD(wParam) == IDC_VBRMETHOD && HIWORD(wParam) == CBN_SELCHANGE)
|
||||
SendMessage(hwndDlg, WM_USER + 666, 0, 0);
|
||||
if (LOWORD(wParam) == IDC_QUALITY && HIWORD(wParam) == CBN_SELCHANGE)
|
||||
SendMessage(hwndDlg, WM_USER + 667, 0, 0);
|
||||
}
|
||||
|
||||
if (uMsg == WM_DESTROY)
|
||||
{
|
||||
#if defined (_WIN64)
|
||||
configwndrec *wc = (configwndrec*)SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
|
||||
#else
|
||||
configwndrec* wc = (configwndrec*)SetWindowLong(hwndDlg, GWL_USERDATA, 0);
|
||||
#endif
|
||||
if (wc)
|
||||
{
|
||||
wc->cfg.bitrate = (int)SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_GETCURSEL, 0, 0), 0);
|
||||
wc->cfg.vbr_max_bitrate = (int)SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_GETCURSEL, 0, 0), 0);
|
||||
wc->cfg.abr_bitrate = (int)SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_GETCURSEL, 0, 0), 0);
|
||||
int vbr_meth = (int)SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_GETCURSEL, 0, 0);
|
||||
if (vbr_meth == CB_ERR) vbr_meth = 0;
|
||||
wc->cfg.vbr_method = vbr_meth - 1;
|
||||
wc->cfg.stereo_mode = (int)SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_GETCURSEL, 0, 0);
|
||||
wc->cfg.quality = (int)SendDlgItemMessage(hwndDlg, IDC_QUALITY, CB_GETCURSEL, 0, 0);
|
||||
wc->cfg.vbr = (int)SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_GETCURSEL, 0, 0);
|
||||
writeconfig(wc->configfile, &wc->cfg);
|
||||
free(wc);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
HWND __declspec(dllexport) ConfigAudio3(HWND hwndParent, HINSTANCE hinst, unsigned int outt, char*configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('M', 'P', '3', 'l'))
|
||||
{
|
||||
configwndrec *wr = (configwndrec*)malloc(sizeof(configwndrec));
|
||||
if (configfile) lstrcpynA(wr->configfile, configfile, MAX_PATH);
|
||||
else wr->configfile[0] = 0;
|
||||
|
||||
readconfig(configfile, &wr->cfg);
|
||||
GetLocalisationApiService();
|
||||
return WASABI_API_CREATEDIALOGPARAMW(IDD_MP3, hwndParent, DlgProc, (LPARAM)wr);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) SetConfigItem(unsigned int outt, wchar_t*item, char *data, char* configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('M', 'P', '3', 'l'))
|
||||
{
|
||||
configtype cfg;
|
||||
readconfig(configfile, &cfg);
|
||||
if (!lstrcmpi(item, L"bitrate")) // assume CBR bitrate
|
||||
{
|
||||
cfg.abr_bitrate = cfg.bitrate = atoi(data);
|
||||
cfg.vbr_method = -1;
|
||||
}
|
||||
writeconfig(configfile, &cfg);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) GetConfigItem(unsigned int outt, wchar_t *item, wchar_t *data, int len, char* configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('M', 'P', '3', 'l'))
|
||||
{
|
||||
configtype cfg;
|
||||
readconfig(configfile, &cfg);
|
||||
if (!lstrcmpi(item, L"bitrate"))
|
||||
{
|
||||
int bitrate;
|
||||
if(cfg.vbr_method == -1) bitrate = cfg.bitrate;
|
||||
else if(cfg.vbr_method == 4) bitrate = cfg.abr_bitrate;
|
||||
else bitrate = (cfg.bitrate + cfg.vbr_max_bitrate) / 2;
|
||||
StringCchPrintf(data,len,L"%d",bitrate);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) SetWinampHWND(HWND hwnd)
|
||||
{
|
||||
winampwnd = hwnd;
|
||||
|
||||
// this is called when the encoder is needed (and is slightly better than the dllmain loading from before)
|
||||
|
||||
/*if (!g_lamedll)
|
||||
{
|
||||
if (!lamedll[0])
|
||||
{
|
||||
PathCombineW(lamedll, (wchar_t*)SendMessage(hwnd, WM_WA_IPC, 0, IPC_GETSHAREDDLLDIRECTORYW),L"lame_enc.dll");
|
||||
}
|
||||
g_lamedll = LoadLibraryW(lamedll);
|
||||
}*/
|
||||
|
||||
/*if (g_lamedll)
|
||||
{
|
||||
beInitStream = (BEINITSTREAM) &beInitStream;
|
||||
beCloseStream = (BECLOSESTREAM) GetProcAddress(g_lamedll, TEXT_BECLOSESTREAM);
|
||||
beEncodeChunk = (BEENCODECHUNK) GetProcAddress(g_lamedll, TEXT_BEENCODECHUNK);
|
||||
beDeinitStream = (BEDEINITSTREAM) GetProcAddress(g_lamedll, TEXT_BEDEINITSTREAM);
|
||||
beWriteVBRHeader = (BEWRITEVBRHEADER) GetProcAddress(g_lamedll, TEXT_BEWRITEVBRHEADER);
|
||||
beVersion = (BEVERSION) GetProcAddress(g_lamedll, TEXT_BEVERSION);
|
||||
beEncodeChunkFloatS16NI = (BEENCODECHUNKFLOATS16NI)GetProcAddress(g_lamedll, TEXT_BEENCODECHUNKFLOATS16NI);
|
||||
}*/
|
||||
}
|
||||
};
|
57
Src/Plugins/Encoder/enc_lame/resource.h
Normal file
57
Src/Plugins/Encoder/enc_lame/resource.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by enc_lame.rc
|
||||
//
|
||||
#define IDS_BITRATE 0
|
||||
#define IDS_ABR_MIN_BITRATE 1
|
||||
#define IDS_VBR_MIN_BITRATE 2
|
||||
#define IDS_N_A 3
|
||||
#define IDS_ABR_MAX_BITRATE 4
|
||||
#define IDS_VBR_MAX_BITRATE 5
|
||||
#define IDS_AVERAGE_BITRATE 6
|
||||
#define IDS_STEREO 7
|
||||
#define IDS_JOINT_STEREO 8
|
||||
#define IDS_MULTI_CHANNEL 9
|
||||
#define IDS_MONO 10
|
||||
#define IDS_NORMAL 11
|
||||
#define IDS_LOW 12
|
||||
#define IDS_HIGH 13
|
||||
#define IDS_VOICE 14
|
||||
#define IDS_R3MIX 15
|
||||
#define IDS_VERY_HIGH 16
|
||||
#define IDS_HIGH_BRACKET 17
|
||||
#define IDS_LOW_BRACKET 18
|
||||
#define IDS_ENC_LAME_DESC 19
|
||||
#define IDS_ENC_LAME_DESC_MISSING 20
|
||||
#define IDD_MP3 102
|
||||
#define IDD_MP3_MISSING 105
|
||||
#define IDC_BITRATE 1000
|
||||
#define IDC_VBR 1001
|
||||
#define IDC_QUALITY 1002
|
||||
#define IDC_JSTEREO1 1003
|
||||
#define IDC_JSTEREO2 1004
|
||||
#define IDC_BITRATE_TEXT1 1004
|
||||
#define IDC_MAXBITRATE 1005
|
||||
#define IDC_BITRATE_TEXT2 1006
|
||||
#define IDC_MAXBITRATE_TEXT1 1007
|
||||
#define IDC_MAXBITRATE_TEXT2 1008
|
||||
#define IDC_VBRMETHOD 1009
|
||||
#define IDC_AVGBITRATE_TEXT1 1010
|
||||
#define IDC_AVGBITRATE 1011
|
||||
#define IDC_AVGBITRATE_TEXT2 1012
|
||||
#define IDC_STEREOMODE 1013
|
||||
#define IDC_VBRQ_TEXT 1014
|
||||
#define IDC_VBRQ 1015
|
||||
#define IDC_LAMEVERSION 1016
|
||||
#define IDC_URL1 1026
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 106
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1017
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
39
Src/Plugins/Encoder/enc_lame/version.rc2
Normal file
39
Src/Plugins/Encoder/enc_lame/version.rc2
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
#include "../../../Winamp/buildType.h"
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,38,0,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,38,0,0"
|
||||
VALUE "InternalName", "Nullsoft MP3 Encoder"
|
||||
VALUE "LegalCopyright", "Copyright © 2006-2023 Winamp SA"
|
||||
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
|
||||
VALUE "OriginalFilename", "enc_lame.dll"
|
||||
VALUE "ProductName", "Winamp"
|
||||
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
BIN
Src/Plugins/Encoder/enc_vorbis/Libs/libogg_static.lib
Normal file
BIN
Src/Plugins/Encoder/enc_vorbis/Libs/libogg_static.lib
Normal file
Binary file not shown.
BIN
Src/Plugins/Encoder/enc_vorbis/Libs/vorbis_static.lib
Normal file
BIN
Src/Plugins/Encoder/enc_vorbis/Libs/vorbis_static.lib
Normal file
Binary file not shown.
BIN
Src/Plugins/Encoder/enc_vorbis/Libs/vorbisenc_static.lib
Normal file
BIN
Src/Plugins/Encoder/enc_vorbis/Libs/vorbisenc_static.lib
Normal file
Binary file not shown.
100
Src/Plugins/Encoder/enc_vorbis/enc_vorbis.rc
Normal file
100
Src/Plugins/Encoder/enc_vorbis/enc_vorbis.rc
Normal file
|
@ -0,0 +1,100 @@
|
|||
// 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_CONFIG DIALOGEX 0, 0, 256, 167
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "Ogg Vorbis Encoder Options",IDC_STATIC,0,0,256,166
|
||||
LTEXT "Quality Factor: 0.0",IDC_VBRVAL,7,13,149,8
|
||||
CONTROL "",IDC_VBRQUALITY,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,5,23,243,17
|
||||
LTEXT "Low Quality\nSmall Files",IDC_VBR1,9,43,44,22
|
||||
LTEXT "High Quality\nLarge Files",IDC_VBR2,208,43,40,22
|
||||
LTEXT "Ogg Vorbis is an open, free audio format,\nThis encoder is based on aoTuV,",IDC_STATIC,5,143,242,19
|
||||
CONTROL "http://xiph.org/vorbis/",IDC_URL1,"Button",BS_OWNERDRAW | WS_TABSTOP,138,143,78,8
|
||||
CONTROL "https://ao-yumi.github.io/aotuv_web/index.html",IDC_URL2,"Button",BS_OWNERDRAW | WS_TABSTOP,109,151,138,8
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
65535 "{A23C2B70-C66B-475e-8A67-E0F33FD5BD12}"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_ENC_VORBIS_DESC "Ogg Vorbis Encoder"
|
||||
IDS_QUALITY_FACTOR_F_KBPS "Quality Factor: %.1lf (%d kbps)"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#include "version.rc2"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
60
Src/Plugins/Encoder/enc_vorbis/enc_vorbis.sln
Normal file
60
Src/Plugins/Encoder/enc_vorbis/enc_vorbis.sln
Normal file
|
@ -0,0 +1,60 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29519.181
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enc_vorbis", "enc_vorbis.vcxproj", "{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvorbis_static", "..\libvorbis\win32\vorbis_static.vcxproj", "{49238ED1-3146-49AB-9523-E9826EE4A0C8}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvorbisfile", "..\libvorbis\win32\vorbisfile_static.vcxproj", "{EC9475D2-FEE2-4F8C-9BB9-A11D5EB597C4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libogg", "..\libogg\libogg.vcxproj", "{4FC28B55-2A14-43D5-86F7-201054F338A9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}.Debug|x64.Build.0 = Debug|x64
|
||||
{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}.Release|Win32.Build.0 = Release|Win32
|
||||
{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}.Release|x64.ActiveCfg = Release|x64
|
||||
{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}.Release|x64.Build.0 = Release|x64
|
||||
{49238ED1-3146-49AB-9523-E9826EE4A0C8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{49238ED1-3146-49AB-9523-E9826EE4A0C8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{49238ED1-3146-49AB-9523-E9826EE4A0C8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{49238ED1-3146-49AB-9523-E9826EE4A0C8}.Debug|x64.Build.0 = Debug|x64
|
||||
{49238ED1-3146-49AB-9523-E9826EE4A0C8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{49238ED1-3146-49AB-9523-E9826EE4A0C8}.Release|Win32.Build.0 = Release|Win32
|
||||
{49238ED1-3146-49AB-9523-E9826EE4A0C8}.Release|x64.ActiveCfg = Release|x64
|
||||
{49238ED1-3146-49AB-9523-E9826EE4A0C8}.Release|x64.Build.0 = Release|x64
|
||||
{EC9475D2-FEE2-4F8C-9BB9-A11D5EB597C4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{EC9475D2-FEE2-4F8C-9BB9-A11D5EB597C4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{EC9475D2-FEE2-4F8C-9BB9-A11D5EB597C4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{EC9475D2-FEE2-4F8C-9BB9-A11D5EB597C4}.Debug|x64.Build.0 = Debug|x64
|
||||
{EC9475D2-FEE2-4F8C-9BB9-A11D5EB597C4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EC9475D2-FEE2-4F8C-9BB9-A11D5EB597C4}.Release|Win32.Build.0 = Release|Win32
|
||||
{EC9475D2-FEE2-4F8C-9BB9-A11D5EB597C4}.Release|x64.ActiveCfg = Release|x64
|
||||
{EC9475D2-FEE2-4F8C-9BB9-A11D5EB597C4}.Release|x64.Build.0 = Release|x64
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Debug|x64.Build.0 = Debug|x64
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Release|Win32.Build.0 = Release|Win32
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Release|x64.ActiveCfg = Release|x64
|
||||
{4FC28B55-2A14-43D5-86F7-201054F338A9}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3845173A-0CB9-4C0E-86B0-284CCE7B043A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
297
Src/Plugins/Encoder/enc_vorbis/enc_vorbis.vcxproj
Normal file
297
Src/Plugins/Encoder/enc_vorbis/enc_vorbis.vcxproj
Normal file
|
@ -0,0 +1,297 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{3AC18E6A-7C92-4156-8117-CAFC6A781DAD}</ProjectGuid>
|
||||
<RootNamespace>enc_vorbis</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg">
|
||||
<VcpkgEnableManifest>false</VcpkgEnableManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NSV_CODER_MP3_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/ignore:4204 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\openmpt-trunk\build\lib\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>uxtheme.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;NSV_CODER_MP3_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>4312;4701;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/ignore:4204 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\openmpt-trunk\build\lib\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>uxtheme.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NSV_CODER_MP3_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4701;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/ignore:4210 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\openmpt-trunk\build\lib\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>uxtheme.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;NSV_CODER_MP3_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4312;4701;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/ignore:4210 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\openmpt-trunk\build\lib\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>uxtheme.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj">
|
||||
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WIN64;_DEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_vorbis.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
29
Src/Plugins/Encoder/enc_vorbis/enc_vorbis.vcxproj.filters
Normal file
29
Src/Plugins/Encoder/enc_vorbis/enc_vorbis.vcxproj.filters
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{60891243-3702-45a9-8316-6dd4c4fe1657}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Ressource Files">
|
||||
<UniqueIdentifier>{0dcd9aec-855c-4009-8908-41d2d4c57e21}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{327bdd16-a664-4de5-9595-33490dffe0f7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_vorbis.rc">
|
||||
<Filter>Ressource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
595
Src/Plugins/Encoder/enc_vorbis/main.cpp
Normal file
595
Src/Plugins/Encoder/enc_vorbis/main.cpp
Normal file
|
@ -0,0 +1,595 @@
|
|||
/*
|
||||
** enc_vorbis: main.cpp - Ogg Vorbis encoder plug-in
|
||||
**
|
||||
** Copyright (C) 2001-2012 Nullsoft, Inc.
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied warranty.
|
||||
** In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
**
|
||||
** Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
** applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the
|
||||
** original software. If you use this software in a product, an acknowledgment in the product
|
||||
** documentation would be appreciated but is not required.
|
||||
** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as
|
||||
** being the original software.
|
||||
** 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#define ENC_VERSION "v1.58"
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <uxtheme.h>
|
||||
#include <strsafe.h>
|
||||
#include "resource.h"
|
||||
#include "../nsv/enc_if.h"
|
||||
#include <vorbis/vorbisenc.h>
|
||||
|
||||
// wasabi based services for localisation support
|
||||
#include <api/service/waServiceFactory.h>
|
||||
#include "../Agave/Language/api_language.h"
|
||||
#include <api/application/api_application.h>
|
||||
#include "../winamp/wa_ipc.h"
|
||||
|
||||
HWND winampwnd = 0;
|
||||
int isthemethere = 0;
|
||||
api_service *WASABI_API_SVC = 0;
|
||||
api_application *WASABI_API_APP = 0;
|
||||
api_language *WASABI_API_LNG = 0;
|
||||
HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool cfg_abr_use_max,cfg_abr_use_min;
|
||||
UINT cfg_mode;
|
||||
|
||||
float cfg_vbrquality;
|
||||
UINT cfg_abr_nominal;
|
||||
UINT cfg_abr_max;
|
||||
UINT cfg_abr_min;
|
||||
} configtype;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
configtype cfg;
|
||||
char *configfile;
|
||||
}
|
||||
configwndrec;
|
||||
|
||||
void readconfig(char *configfile, configtype *cfg)
|
||||
{
|
||||
cfg->cfg_abr_use_max=0;
|
||||
cfg->cfg_abr_use_min=0;
|
||||
cfg->cfg_mode=0; //VBR
|
||||
|
||||
cfg->cfg_vbrquality=0.4f;
|
||||
|
||||
cfg->cfg_abr_nominal=160;
|
||||
cfg->cfg_abr_max=352;
|
||||
cfg->cfg_abr_min=32;
|
||||
|
||||
if (configfile) GetPrivateProfileStructA("audio_ogg","conf",cfg,sizeof(configtype),configfile);
|
||||
cfg->cfg_mode=0; // VBR, fuckers.
|
||||
}
|
||||
|
||||
void writeconfig(char *configfile, configtype *cfg)
|
||||
{
|
||||
if (configfile) WritePrivateProfileStructA("audio_ogg","conf",cfg,sizeof(configtype),configfile);
|
||||
}
|
||||
|
||||
static HINSTANCE GetMyInstance()
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi = {0};
|
||||
if(VirtualQuery(GetMyInstance, &mbi, sizeof(mbi)))
|
||||
return (HINSTANCE)mbi.AllocationBase;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GetLocalisationApiService(void)
|
||||
{
|
||||
if(!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_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;
|
||||
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(),EncVorbisLangGUID);
|
||||
}
|
||||
}
|
||||
|
||||
class AudioCoderOgg : public AudioCoder
|
||||
{
|
||||
public:
|
||||
AudioCoderOgg(int nch, int srate, int bps, configtype *cfg);
|
||||
int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail);
|
||||
~AudioCoderOgg()
|
||||
{
|
||||
ogg_stream_clear(&os);
|
||||
vorbis_block_clear(&vb);
|
||||
vorbis_dsp_clear(&vd);
|
||||
vorbis_comment_clear(&vc);
|
||||
vorbis_info_clear(&vi);
|
||||
}
|
||||
int GetLastError() { return m_err; };
|
||||
private:
|
||||
int m_err;
|
||||
int m_bps, m_nch;
|
||||
|
||||
ogg_stream_state os; /* take physical pages, weld into a logical stream of packets */
|
||||
ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */
|
||||
ogg_packet op; /* one raw packet of data for decode */
|
||||
|
||||
vorbis_info vi; /* struct that stores all the static vorbis bitstream settings */
|
||||
vorbis_comment vc; /* struct that stores all the user comments */
|
||||
|
||||
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
||||
vorbis_block vb; /* local working space for packet->PCM decode */
|
||||
|
||||
int m_inbuf;
|
||||
};
|
||||
|
||||
int AudioCoderOgg::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail)
|
||||
{
|
||||
if (m_err) return -1;
|
||||
*in_used = 0; //only necessary for flawed impl that dont reset this to zero each time (BAD rOn)
|
||||
|
||||
int wrote=0;
|
||||
char *dest = (char*)out;
|
||||
|
||||
if (!in_avail && !framepos)
|
||||
{
|
||||
vorbis_analysis_wrote(&vd,0);
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* vorbis does some data preanalysis, then divvies up blocks for
|
||||
more involved (potentially parallel) processing. Get a single
|
||||
block for encoding now */
|
||||
|
||||
while (m_inbuf || vorbis_analysis_blockout(&vd,&vb)==1)
|
||||
{
|
||||
/* analysis */
|
||||
if (!m_inbuf)
|
||||
{
|
||||
vorbis_analysis(&vb,&op);
|
||||
vorbis_bitrate_addblock(&vb);
|
||||
}
|
||||
|
||||
while (m_inbuf || vorbis_bitrate_flushpacket(&vd, &op))
|
||||
{
|
||||
/* weld the packet into the bitstream */
|
||||
if (!m_inbuf) ogg_stream_packetin(&os,&op);
|
||||
|
||||
/* write out pages (if any) */
|
||||
while (m_inbuf || ogg_stream_pageout(&os,&og))
|
||||
{
|
||||
int l=og.header_len+og.body_len;
|
||||
if(out_avail<l)
|
||||
{
|
||||
m_inbuf=1;
|
||||
return wrote;
|
||||
}
|
||||
memcpy(dest,og.header,og.header_len);
|
||||
memcpy(dest+og.header_len,og.body,og.body_len);
|
||||
dest+=l;
|
||||
wrote+=l;
|
||||
out_avail-=l;
|
||||
m_inbuf=0;
|
||||
|
||||
if (ogg_page_eos(&og)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we used all our samples, or had output, flush it
|
||||
if (*in_used >= in_avail || wrote) return wrote;
|
||||
|
||||
// bring in more pcm samples
|
||||
if (in_avail > *in_used)
|
||||
{
|
||||
UINT i;
|
||||
int c;
|
||||
int bytes=in_avail-*in_used;
|
||||
void *buf=(char*)in + *in_used;
|
||||
|
||||
if (bytes > 1024) bytes=1024;
|
||||
|
||||
*in_used+=bytes;
|
||||
|
||||
UINT nsam=bytes/((m_bps>>3)*m_nch);
|
||||
float **buffer=vorbis_analysis_buffer(&vd,nsam);
|
||||
switch(m_bps)
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
BYTE* rbuf=(BYTE*)buf;
|
||||
for(i=0;i<nsam;i++)
|
||||
{
|
||||
for(c=0;c<m_nch;c++)
|
||||
{
|
||||
buffer[c][i]=((float)(UINT)*rbuf)/128.f-1.f;
|
||||
rbuf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
short* rbuf=(short*)buf;
|
||||
for(i=0;i<nsam;i++)
|
||||
{
|
||||
for(c=0;c<m_nch;c++)
|
||||
{
|
||||
buffer[c][i]=(float)*rbuf/32768.f;
|
||||
rbuf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
{
|
||||
char* rbuf=(char*)buf;
|
||||
for(i=0;i<nsam;i++)
|
||||
{
|
||||
for(c=0;c<m_nch;c++)
|
||||
{
|
||||
BYTE* b=(BYTE*)rbuf;
|
||||
long val = b[0] | (b[1]<<8) | (b[2]<<16);
|
||||
if (val&0x800000) val|=0xFF000000;
|
||||
buffer[c][i]=(float)((double)val/(double)0x800000);
|
||||
rbuf+=3;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
{
|
||||
long* rbuf=(long*)buf;
|
||||
for(i=0;i<nsam;i++)
|
||||
{
|
||||
for(c=0;c<m_nch;c++)
|
||||
{
|
||||
buffer[c][i]=(float)((double)rbuf[i*m_nch+c]/(double)0x80000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* tell the library how much we actually submitted */
|
||||
vorbis_analysis_wrote(&vd,nsam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AudioCoderOgg::AudioCoderOgg(int nch, int srate, int bps, configtype *cfg)
|
||||
{
|
||||
m_err=0;
|
||||
|
||||
m_bps=bps;
|
||||
m_nch=nch;
|
||||
m_inbuf=0;
|
||||
|
||||
int poo;
|
||||
|
||||
vorbis_info_init(&vi);
|
||||
if (cfg->cfg_mode==0) poo=vorbis_encode_init_vbr(&vi,nch,srate,cfg->cfg_vbrquality);
|
||||
else
|
||||
{
|
||||
UINT nominal,min,max;
|
||||
if (cfg->cfg_mode==1)
|
||||
{//abr
|
||||
nominal=cfg->cfg_abr_nominal * 1000;
|
||||
min=cfg->cfg_abr_use_min ? cfg->cfg_abr_min * 1000: -1;
|
||||
max=cfg->cfg_abr_use_max ? cfg->cfg_abr_max * 1000: -1;
|
||||
}
|
||||
else//cbr
|
||||
{
|
||||
nominal=min=max=cfg->cfg_abr_nominal*1000;
|
||||
}
|
||||
poo=vorbis_encode_init(&vi,nch,srate,max,nominal,min);
|
||||
}
|
||||
|
||||
if (poo)
|
||||
{
|
||||
vorbis_info_clear(&vi);
|
||||
m_err++;
|
||||
return;
|
||||
}
|
||||
|
||||
vorbis_comment_init(&vc);
|
||||
vorbis_comment_add(&vc, "ENCODEDBY=Winamp");
|
||||
|
||||
/* set up the analysis state and auxiliary encoding storage */
|
||||
vorbis_analysis_init(&vd,&vi);
|
||||
vorbis_block_init(&vd,&vb);
|
||||
|
||||
/* set up our packet->stream encoder */
|
||||
/* pick a random serial number; that way we can more likely build
|
||||
chained streams just by concatenation */
|
||||
|
||||
ogg_stream_init(&os,GetTickCount()^(GetTickCount()<<16));//fixme : rand
|
||||
|
||||
/* Vorbis streams begin with three headers; the initial header (with
|
||||
most of the codec setup parameters) which is mandated by the Ogg
|
||||
bitstream spec. The second header holds any comment fields. The
|
||||
third header holds the bitstream codebook. We merely need to
|
||||
make the headers, then pass them to libvorbis one at a time;
|
||||
libvorbis handles the additional Ogg bitstream constraints */
|
||||
|
||||
{
|
||||
ogg_packet header;
|
||||
ogg_packet header_comm;
|
||||
ogg_packet header_code;
|
||||
|
||||
vorbis_analysis_headerout(&vd,&vc,&header,&header_comm,&header_code);
|
||||
ogg_stream_packetin(&os,&header); /* automatically placed in its own page */
|
||||
ogg_stream_packetin(&os,&header_comm);
|
||||
ogg_stream_packetin(&os,&header_code);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
unsigned int __declspec(dllexport) GetAudioTypes3(int idx, char *desc)
|
||||
{
|
||||
if (idx==0)
|
||||
{
|
||||
GetLocalisationApiService();
|
||||
StringCchPrintfA(desc, 1024, "%s %s (aoTuV b6.03)", WASABI_API_LNGSTRING(IDS_ENC_VORBIS_DESC), ENC_VERSION);
|
||||
return mmioFOURCC('O','G','G',' ');
|
||||
}
|
||||
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',' ') && *outt == mmioFOURCC('O','G','G',' '))
|
||||
{
|
||||
configtype cfg;
|
||||
readconfig(configfile,&cfg);
|
||||
AudioCoderOgg *t = new AudioCoderOgg(nch,srate,bps,&cfg);
|
||||
if (t->GetLastError())
|
||||
{
|
||||
delete t;
|
||||
return NULL;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) FinishAudio3(const char *filename, AudioCoder *coder)
|
||||
{
|
||||
}
|
||||
|
||||
#define doshow(x,y) ShowWindow(x,(y)?SW_SHOWNA:SW_HIDE)
|
||||
|
||||
static HCURSOR link_hand_cursor;
|
||||
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_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, sizeof(wt)/sizeof(wt[0]));
|
||||
|
||||
// due to the fun of theming and owner drawing we have to get the background colour
|
||||
if(isthemethere){
|
||||
HTHEME hTheme = OpenThemeData(hwndDlg, L"Tab");
|
||||
if (hTheme) {
|
||||
DrawThemeParentBackground(di->hwndItem, di->hDC, &di->rcItem);
|
||||
CloseThemeData(hTheme);
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void link_startsubclass(HWND hwndDlg, UINT id)
|
||||
{
|
||||
HWND ctrl = GetDlgItem(hwndDlg, id);
|
||||
if(!GetPropW(ctrl, L"link_proc"))
|
||||
{
|
||||
SetPropW(ctrl, L"link_proc",
|
||||
(HANDLE)SetWindowLongPtrW(ctrl, GWLP_WNDPROC, (LONG_PTR)link_handlecursor));
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
if (uMsg == WM_USER+667)
|
||||
{
|
||||
int p=(int)SendDlgItemMessage(hwndDlg,IDC_VBRQUALITY,TBM_GETPOS,0,0)-10;
|
||||
char tmp[512] = {0};
|
||||
double dispVal = ((double)p)/10;
|
||||
vorbis_info vi = {0};
|
||||
int br = 128;
|
||||
|
||||
vorbis_info_init(&vi);
|
||||
if(vorbis_encode_init_vbr(&vi, 2, 44100, (float) (p / 100.0)))
|
||||
br=128; // Mode setup failed: go with a default.
|
||||
else
|
||||
{
|
||||
br = vi.bitrate_nominal / 1000;
|
||||
vorbis_info_clear(&vi);
|
||||
}
|
||||
|
||||
StringCchPrintfA(tmp, 512, WASABI_API_LNGSTRING(IDS_QUALITY_FACTOR_F_KBPS), dispVal, br);
|
||||
|
||||
SetDlgItemTextA(hwndDlg,IDC_VBRVAL,tmp);
|
||||
|
||||
link_startsubclass(hwndDlg, IDC_URL1);
|
||||
link_startsubclass(hwndDlg, IDC_URL2);
|
||||
}
|
||||
|
||||
else if (uMsg == WM_INITDIALOG)
|
||||
{
|
||||
#if defined (_WIN64)
|
||||
SetWindowLong(hwndDlg,GWLP_USERDATA,(LONG)lParam);
|
||||
#else
|
||||
SetWindowLong(hwndDlg, GWL_USERDATA, lParam);
|
||||
#endif
|
||||
if (lParam)
|
||||
{
|
||||
configwndrec *wc=(configwndrec*)lParam;
|
||||
SendDlgItemMessage(hwndDlg,IDC_VBRQUALITY,TBM_SETRANGE,0,MAKELONG(0,110));
|
||||
SendDlgItemMessage(hwndDlg,IDC_VBRQUALITY,TBM_SETTICFREQ,5,0);
|
||||
SendDlgItemMessage(hwndDlg,IDC_VBRQUALITY,TBM_SETPAGESIZE,0,10);
|
||||
SendDlgItemMessage(hwndDlg,IDC_VBRQUALITY,TBM_SETPOS,TRUE,(int)(wc->cfg.cfg_vbrquality*100.0f + (wc->cfg.cfg_vbrquality < 0.0 ? - 0.5f : 0.5f)) + 10);
|
||||
SendMessage(hwndDlg,WM_USER+667,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
else if (uMsg == WM_HSCROLL)
|
||||
{
|
||||
HWND swnd = (HWND) lParam;
|
||||
if (swnd == GetDlgItem(hwndDlg, IDC_VBRQUALITY))
|
||||
{
|
||||
int p=(int)SendDlgItemMessage(hwndDlg,IDC_VBRQUALITY,TBM_GETPOS,0,0)-10;
|
||||
|
||||
#if defined (_WIN64)
|
||||
configwndrec* wc = (configwndrec*)GetWindowLong(hwndDlg, GWLP_USERDATA);
|
||||
#else
|
||||
configwndrec* wc = (configwndrec*)GetWindowLong(hwndDlg, GWL_USERDATA);
|
||||
#endif
|
||||
if (wc)
|
||||
{
|
||||
wc->cfg.cfg_vbrquality=(float)p/100.0f;
|
||||
}
|
||||
SendMessage(hwndDlg,WM_USER+667,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
else if (uMsg == WM_COMMAND)
|
||||
{
|
||||
if(LOWORD(wParam) == IDC_URL1)
|
||||
{
|
||||
SendMessage(winampwnd, WM_WA_IPC, (WPARAM)"http://xiph.org/vorbis/", IPC_OPEN_URL);
|
||||
}
|
||||
else if(LOWORD(wParam) == IDC_URL2)
|
||||
{
|
||||
SendMessage(winampwnd, WM_WA_IPC, (WPARAM)"https://ao-yumi.github.io/aotuv_web/index.html", IPC_OPEN_URL);
|
||||
}
|
||||
}
|
||||
|
||||
else if (uMsg == WM_DESTROY)
|
||||
{
|
||||
#if defined (_WIN64)
|
||||
configwndrec* wc = (configwndrec*)SetWindowLong(hwndDlg, GWLP_USERDATA, 0);
|
||||
#else
|
||||
configwndrec* wc = (configwndrec*)SetWindowLong(hwndDlg, GWL_USERDATA, 0);
|
||||
#endif
|
||||
if (wc)
|
||||
{
|
||||
wc->cfg.cfg_mode=0;
|
||||
writeconfig(wc->configfile,&wc->cfg);
|
||||
free(wc->configfile);
|
||||
free(wc);
|
||||
}
|
||||
}
|
||||
|
||||
const int controls[] =
|
||||
{
|
||||
IDC_VBRQUALITY,
|
||||
};
|
||||
if (FALSE != WASABI_API_APP->DirectMouseWheel_ProcessDialogMessage(hwndDlg, uMsg, wParam, lParam, controls, ARRAYSIZE(controls)))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
link_handledraw(hwndDlg, uMsg, wParam, lParam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HWND __declspec(dllexport) ConfigAudio3(HWND hwndParent, HINSTANCE hinst, unsigned int outt, char *configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('O','G','G',' '))
|
||||
{
|
||||
configwndrec *wr=(configwndrec*)malloc(sizeof(configwndrec));
|
||||
if (configfile) wr->configfile=_strdup(configfile);
|
||||
else wr->configfile=0;
|
||||
|
||||
readconfig(configfile,&wr->cfg);
|
||||
GetLocalisationApiService();
|
||||
return WASABI_API_CREATEDIALOGPARAMW(IDD_CONFIG,hwndParent,DlgProc,(LPARAM)wr);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) SetWinampHWND(HWND hwnd)
|
||||
{
|
||||
winampwnd = hwnd;
|
||||
isthemethere = !SendMessage(hwnd,WM_WA_IPC,IPC_ISWINTHEMEPRESENT,IPC_USE_UXTHEME_FUNC);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef __CONFIG_TYPES_H__
|
||||
#define __CONFIG_TYPES_H__
|
||||
|
||||
/* these are filled in by configure */
|
||||
#define INCLUDE_INTTYPES_H @INCLUDE_INTTYPES_H@
|
||||
#define INCLUDE_STDINT_H @INCLUDE_STDINT_H@
|
||||
#define INCLUDE_SYS_TYPES_H @INCLUDE_SYS_TYPES_H@
|
||||
|
||||
#if INCLUDE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
#if INCLUDE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#if INCLUDE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
typedef @SIZE16@ ogg_int16_t;
|
||||
typedef @USIZE16@ ogg_uint16_t;
|
||||
typedef @SIZE32@ ogg_int32_t;
|
||||
typedef @USIZE32@ ogg_uint32_t;
|
||||
typedef @SIZE64@ ogg_int64_t;
|
||||
|
||||
#endif
|
210
Src/Plugins/Encoder/enc_vorbis/ogg/include/ogg/ogg.h
Normal file
210
Src/Plugins/Encoder/enc_vorbis/ogg/include/ogg/ogg.h
Normal file
|
@ -0,0 +1,210 @@
|
|||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: toplevel libogg include
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OGG_H
|
||||
#define _OGG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <ogg/os_types.h>
|
||||
|
||||
typedef struct {
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
} ogg_iovec_t;
|
||||
|
||||
typedef struct {
|
||||
long endbyte;
|
||||
int endbit;
|
||||
|
||||
unsigned char *buffer;
|
||||
unsigned char *ptr;
|
||||
long storage;
|
||||
} oggpack_buffer;
|
||||
|
||||
/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *header;
|
||||
long header_len;
|
||||
unsigned char *body;
|
||||
long body_len;
|
||||
} ogg_page;
|
||||
|
||||
/* ogg_stream_state contains the current encode/decode state of a logical
|
||||
Ogg bitstream **********************************************************/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *body_data; /* bytes from packet bodies */
|
||||
long body_storage; /* storage elements allocated */
|
||||
long body_fill; /* elements stored; fill mark */
|
||||
long body_returned; /* elements of fill returned */
|
||||
|
||||
|
||||
int *lacing_vals; /* The values that will go to the segment table */
|
||||
ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
|
||||
this way, but it is simple coupled to the
|
||||
lacing fifo */
|
||||
long lacing_storage;
|
||||
long lacing_fill;
|
||||
long lacing_packet;
|
||||
long lacing_returned;
|
||||
|
||||
unsigned char header[282]; /* working space for header encode */
|
||||
int header_fill;
|
||||
|
||||
int e_o_s; /* set when we have buffered the last packet in the
|
||||
logical bitstream */
|
||||
int b_o_s; /* set after we've written the initial page
|
||||
of a logical bitstream */
|
||||
long serialno;
|
||||
long pageno;
|
||||
ogg_int64_t packetno; /* sequence number for decode; the framing
|
||||
knows where there's a hole in the data,
|
||||
but we need coupling so that the codec
|
||||
(which is in a separate abstraction
|
||||
layer) also knows about the gap */
|
||||
ogg_int64_t granulepos;
|
||||
|
||||
} ogg_stream_state;
|
||||
|
||||
/* ogg_packet is used to encapsulate the data and metadata belonging
|
||||
to a single raw Ogg/Vorbis packet *************************************/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *packet;
|
||||
long bytes;
|
||||
long b_o_s;
|
||||
long e_o_s;
|
||||
|
||||
ogg_int64_t granulepos;
|
||||
|
||||
ogg_int64_t packetno; /* sequence number for decode; the framing
|
||||
knows where there's a hole in the data,
|
||||
but we need coupling so that the codec
|
||||
(which is in a separate abstraction
|
||||
layer) also knows about the gap */
|
||||
} ogg_packet;
|
||||
|
||||
typedef struct {
|
||||
unsigned char *data;
|
||||
int storage;
|
||||
int fill;
|
||||
int returned;
|
||||
|
||||
int unsynced;
|
||||
int headerbytes;
|
||||
int bodybytes;
|
||||
} ogg_sync_state;
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
|
||||
|
||||
extern void oggpack_writeinit(oggpack_buffer *b);
|
||||
extern int oggpack_writecheck(oggpack_buffer *b);
|
||||
extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
|
||||
extern void oggpack_writealign(oggpack_buffer *b);
|
||||
extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
|
||||
extern void oggpack_reset(oggpack_buffer *b);
|
||||
extern void oggpack_writeclear(oggpack_buffer *b);
|
||||
extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
|
||||
extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
|
||||
extern long oggpack_look(oggpack_buffer *b,int bits);
|
||||
extern long oggpack_look1(oggpack_buffer *b);
|
||||
extern void oggpack_adv(oggpack_buffer *b,int bits);
|
||||
extern void oggpack_adv1(oggpack_buffer *b);
|
||||
extern long oggpack_read(oggpack_buffer *b,int bits);
|
||||
extern long oggpack_read1(oggpack_buffer *b);
|
||||
extern long oggpack_bytes(oggpack_buffer *b);
|
||||
extern long oggpack_bits(oggpack_buffer *b);
|
||||
extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
|
||||
|
||||
extern void oggpackB_writeinit(oggpack_buffer *b);
|
||||
extern int oggpackB_writecheck(oggpack_buffer *b);
|
||||
extern void oggpackB_writetrunc(oggpack_buffer *b,long bits);
|
||||
extern void oggpackB_writealign(oggpack_buffer *b);
|
||||
extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
|
||||
extern void oggpackB_reset(oggpack_buffer *b);
|
||||
extern void oggpackB_writeclear(oggpack_buffer *b);
|
||||
extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
|
||||
extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits);
|
||||
extern long oggpackB_look(oggpack_buffer *b,int bits);
|
||||
extern long oggpackB_look1(oggpack_buffer *b);
|
||||
extern void oggpackB_adv(oggpack_buffer *b,int bits);
|
||||
extern void oggpackB_adv1(oggpack_buffer *b);
|
||||
extern long oggpackB_read(oggpack_buffer *b,int bits);
|
||||
extern long oggpackB_read1(oggpack_buffer *b);
|
||||
extern long oggpackB_bytes(oggpack_buffer *b);
|
||||
extern long oggpackB_bits(oggpack_buffer *b);
|
||||
extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: encoding **************************/
|
||||
|
||||
extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
|
||||
extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov,
|
||||
int count, long e_o_s, ogg_int64_t granulepos);
|
||||
extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
|
||||
extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill);
|
||||
extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
|
||||
extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
|
||||
|
||||
extern int ogg_sync_init(ogg_sync_state *oy);
|
||||
extern int ogg_sync_clear(ogg_sync_state *oy);
|
||||
extern int ogg_sync_reset(ogg_sync_state *oy);
|
||||
extern int ogg_sync_destroy(ogg_sync_state *oy);
|
||||
extern int ogg_sync_check(ogg_sync_state *oy);
|
||||
|
||||
extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
|
||||
extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
|
||||
extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
|
||||
extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
|
||||
extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
|
||||
extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
|
||||
extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: general ***************************/
|
||||
|
||||
extern int ogg_stream_init(ogg_stream_state *os,int serialno);
|
||||
extern int ogg_stream_clear(ogg_stream_state *os);
|
||||
extern int ogg_stream_reset(ogg_stream_state *os);
|
||||
extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
|
||||
extern int ogg_stream_destroy(ogg_stream_state *os);
|
||||
extern int ogg_stream_check(ogg_stream_state *os);
|
||||
extern int ogg_stream_eos(ogg_stream_state *os);
|
||||
|
||||
extern void ogg_page_checksum_set(ogg_page *og);
|
||||
|
||||
extern int ogg_page_version(const ogg_page *og);
|
||||
extern int ogg_page_continued(const ogg_page *og);
|
||||
extern int ogg_page_bos(const ogg_page *og);
|
||||
extern int ogg_page_eos(const ogg_page *og);
|
||||
extern ogg_int64_t ogg_page_granulepos(const ogg_page *og);
|
||||
extern int ogg_page_serialno(const ogg_page *og);
|
||||
extern long ogg_page_pageno(const ogg_page *og);
|
||||
extern int ogg_page_packets(const ogg_page *og);
|
||||
|
||||
extern void ogg_packet_clear(ogg_packet *op);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OGG_H */
|
148
Src/Plugins/Encoder/enc_vorbis/ogg/include/ogg/os_types.h
Normal file
148
Src/Plugins/Encoder/enc_vorbis/ogg/include/ogg/os_types.h
Normal file
|
@ -0,0 +1,148 @@
|
|||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OS_TYPES_H
|
||||
#define _OS_TYPES_H
|
||||
|
||||
/* make it easy on the folks that want to compile the libs with a
|
||||
different malloc than stdlib */
|
||||
#define _ogg_malloc malloc
|
||||
#define _ogg_calloc calloc
|
||||
#define _ogg_realloc realloc
|
||||
#define _ogg_free free
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
# if defined(__CYGWIN__)
|
||||
# include <stdint.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef uint16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef uint32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
typedef uint64_t ogg_uint64_t;
|
||||
# elif defined(__MINGW32__)
|
||||
# include <sys/types.h>
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
typedef unsigned long long ogg_uint64_t;
|
||||
# elif defined(__MWERKS__)
|
||||
typedef long long ogg_int64_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
# else
|
||||
# if defined(_MSC_VER) && (_MSC_VER >= 1800) /* MSVC 2013 and newer */
|
||||
# include <stdint.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef uint16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef uint32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
typedef uint64_t ogg_uint64_t;
|
||||
# else
|
||||
/* MSVC/Borland */
|
||||
typedef __int64 ogg_int64_t;
|
||||
typedef __int32 ogg_int32_t;
|
||||
typedef unsigned __int32 ogg_uint32_t;
|
||||
typedef __int16 ogg_int16_t;
|
||||
typedef unsigned __int16 ogg_uint16_t;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
|
||||
|
||||
# include <inttypes.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef uint16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef uint32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
|
||||
/* Haiku */
|
||||
# include <sys/types.h>
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
|
||||
#elif defined(__BEOS__)
|
||||
|
||||
/* Be */
|
||||
# include <inttypes.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef uint16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef uint32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
|
||||
#elif defined (__EMX__)
|
||||
|
||||
/* OS/2 GCC */
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
|
||||
#elif defined (DJGPP)
|
||||
|
||||
/* DJGPP */
|
||||
typedef short ogg_int16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
|
||||
#elif defined(R5900)
|
||||
|
||||
/* PS2 EE */
|
||||
typedef long ogg_int64_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned ogg_uint32_t;
|
||||
typedef short ogg_int16_t;
|
||||
|
||||
#elif defined(__SYMBIAN32__)
|
||||
|
||||
/* Symbian GCC */
|
||||
typedef signed short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef signed int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long int ogg_int64_t;
|
||||
|
||||
#elif defined(__TMS320C6X__)
|
||||
|
||||
/* TI C64x compiler */
|
||||
typedef signed short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef signed int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long int ogg_int64_t;
|
||||
|
||||
#else
|
||||
|
||||
# include <ogg/config_types.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _OS_TYPES_H */
|
51
Src/Plugins/Encoder/enc_vorbis/resource.h
Normal file
51
Src/Plugins/Encoder/enc_vorbis/resource.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by enc_vorbis.rc
|
||||
//
|
||||
#define IDS_QUALITY_FACTOR_F 0
|
||||
#define IDS_ENC_VORBIS_DESC 1
|
||||
#define IDS_QUALITY_FACTOR_F_KBPS 2
|
||||
#define IDD_CONFIG 103
|
||||
#define IDC_BITRATE 1000
|
||||
#define IDC_VBR 1001
|
||||
#define IDC_QUALITY 1002
|
||||
#define IDC_JSTEREO1 1003
|
||||
#define IDC_JSTEREO2 1004
|
||||
#define IDC_BITRATE_TEXT1 1004
|
||||
#define IDC_MAXBITRATE 1005
|
||||
#define IDC_MINBITRATE 1005
|
||||
#define IDC_BITRATE_TEXT2 1006
|
||||
#define IDC_MAXBITRATE_TEXT1 1007
|
||||
#define IDC_MINBITRATE_TEXT1 1007
|
||||
#define IDC_MAXBITRATE_TEXT2 1008
|
||||
#define IDC_MINBITRATE_TEXT2 1008
|
||||
#define IDC_VBRMETHOD 1009
|
||||
#define IDC_AVGBITRATE_TEXT1 1010
|
||||
#define IDC_MAXBITRATE2_TEXT1 1010
|
||||
#define IDC_AVGBITRATE 1011
|
||||
#define IDC_MAXBITRATE2 1011
|
||||
#define IDC_AVGBITRATE_TEXT2 1012
|
||||
#define IDC_MAXBITRATE2_TEXT2 1012
|
||||
#define IDC_STEREOMODE 1013
|
||||
#define IDC_VBRQ_TEXT 1014
|
||||
#define IDC_VBRQ 1015
|
||||
#define IDC_VBRVAL 1016
|
||||
#define IDC_VBRTEXT 1017
|
||||
#define IDC_VBRQUALITY 1018
|
||||
#define IDC_MINBITRATE_CHECK 1019
|
||||
#define IDC_MAXBITRATE_CHECK 1020
|
||||
#define IDC_VBR1 1023
|
||||
#define IDC_VBR2 1024
|
||||
#define IDC_URL1 1026
|
||||
#define IDC_URL2 1027
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 106
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1028
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
39
Src/Plugins/Encoder/enc_vorbis/version.rc2
Normal file
39
Src/Plugins/Encoder/enc_vorbis/version.rc2
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
#include "../../../Winamp/buildType.h"
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,58,0,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,58,0,0"
|
||||
VALUE "InternalName", "Nullsoft Ogg Vorbis Encoder"
|
||||
VALUE "LegalCopyright", "Copyright © 2006-2023 Winamp SA"
|
||||
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
|
||||
VALUE "OriginalFilename", "enc_vorbis.dll"
|
||||
VALUE "ProductName", "Winamp"
|
||||
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
243
Src/Plugins/Encoder/enc_vorbis/vorbis/include/vorbis/codec.h
Normal file
243
Src/Plugins/Encoder/enc_vorbis/vorbis/include/vorbis/codec.h
Normal file
|
@ -0,0 +1,243 @@
|
|||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
|
||||
********************************************************************
|
||||
|
||||
function: libvorbis codec headers
|
||||
last mod: $Id: codec.h,v 1.1 2010/11/09 22:53:50 dromagod Exp $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _vorbis_codec_h_
|
||||
#define _vorbis_codec_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
typedef struct vorbis_info{
|
||||
int version;
|
||||
int channels;
|
||||
long rate;
|
||||
|
||||
/* The below bitrate declarations are *hints*.
|
||||
Combinations of the three values carry the following implications:
|
||||
|
||||
all three set to the same value:
|
||||
implies a fixed rate bitstream
|
||||
only nominal set:
|
||||
implies a VBR stream that averages the nominal bitrate. No hard
|
||||
upper/lower limit
|
||||
upper and or lower set:
|
||||
implies a VBR bitstream that obeys the bitrate limits. nominal
|
||||
may also be set to give a nominal rate.
|
||||
none set:
|
||||
the coder does not care to speculate.
|
||||
*/
|
||||
|
||||
long bitrate_upper;
|
||||
long bitrate_nominal;
|
||||
long bitrate_lower;
|
||||
long bitrate_window;
|
||||
|
||||
void *codec_setup;
|
||||
} vorbis_info;
|
||||
|
||||
/* vorbis_dsp_state buffers the current vorbis audio
|
||||
analysis/synthesis state. The DSP state belongs to a specific
|
||||
logical bitstream ****************************************************/
|
||||
typedef struct vorbis_dsp_state{
|
||||
int analysisp;
|
||||
vorbis_info *vi;
|
||||
|
||||
float **pcm;
|
||||
float **pcmret;
|
||||
int pcm_storage;
|
||||
int pcm_current;
|
||||
int pcm_returned;
|
||||
|
||||
int preextrapolate;
|
||||
int eofflag;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
long centerW;
|
||||
|
||||
ogg_int64_t granulepos;
|
||||
ogg_int64_t sequence;
|
||||
|
||||
ogg_int64_t glue_bits;
|
||||
ogg_int64_t time_bits;
|
||||
ogg_int64_t floor_bits;
|
||||
ogg_int64_t res_bits;
|
||||
|
||||
void *backend_state;
|
||||
} vorbis_dsp_state;
|
||||
|
||||
typedef struct vorbis_block{
|
||||
/* necessary stream state for linking to the framing abstraction */
|
||||
float **pcm; /* this is a pointer into local storage */
|
||||
oggpack_buffer opb;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
int pcmend;
|
||||
int mode;
|
||||
|
||||
int eofflag;
|
||||
ogg_int64_t granulepos;
|
||||
ogg_int64_t sequence;
|
||||
vorbis_dsp_state *vd; /* For read-only access of configuration */
|
||||
|
||||
/* local storage to avoid remallocing; it's up to the mapping to
|
||||
structure it */
|
||||
void *localstore;
|
||||
long localtop;
|
||||
long localalloc;
|
||||
long totaluse;
|
||||
struct alloc_chain *reap;
|
||||
|
||||
/* bitmetrics for the frame */
|
||||
long glue_bits;
|
||||
long time_bits;
|
||||
long floor_bits;
|
||||
long res_bits;
|
||||
|
||||
void *internal;
|
||||
|
||||
} vorbis_block;
|
||||
|
||||
/* vorbis_block is a single block of data to be processed as part of
|
||||
the analysis/synthesis stream; it belongs to a specific logical
|
||||
bitstream, but is independant from other vorbis_blocks belonging to
|
||||
that logical bitstream. *************************************************/
|
||||
|
||||
struct alloc_chain{
|
||||
void *ptr;
|
||||
struct alloc_chain *next;
|
||||
};
|
||||
|
||||
/* vorbis_info contains all the setup information specific to the
|
||||
specific compression/decompression mode in progress (eg,
|
||||
psychoacoustic settings, channel setup, options, codebook
|
||||
etc). vorbis_info and substructures are in backends.h.
|
||||
*********************************************************************/
|
||||
|
||||
/* the comments are not part of vorbis_info so that vorbis_info can be
|
||||
static storage */
|
||||
typedef struct vorbis_comment{
|
||||
/* unlimited user comment fields. libvorbis writes 'libvorbis'
|
||||
whatever vendor is set to in encode */
|
||||
char **user_comments;
|
||||
int *comment_lengths;
|
||||
int comments;
|
||||
char *vendor;
|
||||
|
||||
} vorbis_comment;
|
||||
|
||||
|
||||
/* libvorbis encodes in two abstraction layers; first we perform DSP
|
||||
and produce a packet (see docs/analysis.txt). The packet is then
|
||||
coded into a framed OggSquish bitstream by the second layer (see
|
||||
docs/framing.txt). Decode is the reverse process; we sync/frame
|
||||
the bitstream and extract individual packets, then decode the
|
||||
packet back into PCM audio.
|
||||
|
||||
The extra framing/packetizing is used in streaming formats, such as
|
||||
files. Over the net (such as with UDP), the framing and
|
||||
packetization aren't necessary as they're provided by the transport
|
||||
and the streaming layer is not used */
|
||||
|
||||
/* Vorbis PRIMITIVES: general ***************************************/
|
||||
|
||||
extern void vorbis_info_init(vorbis_info *vi);
|
||||
extern void vorbis_info_clear(vorbis_info *vi);
|
||||
extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
|
||||
extern void vorbis_comment_init(vorbis_comment *vc);
|
||||
extern void vorbis_comment_add(vorbis_comment *vc, const char *comment);
|
||||
extern void vorbis_comment_add_tag(vorbis_comment *vc,
|
||||
const char *tag, const char *contents);
|
||||
extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
|
||||
extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
|
||||
extern void vorbis_comment_clear(vorbis_comment *vc);
|
||||
|
||||
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
|
||||
extern int vorbis_block_clear(vorbis_block *vb);
|
||||
extern void vorbis_dsp_clear(vorbis_dsp_state *v);
|
||||
extern double vorbis_granule_time(vorbis_dsp_state *v,
|
||||
ogg_int64_t granulepos);
|
||||
|
||||
extern const char *vorbis_version_string(void);
|
||||
|
||||
/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
|
||||
|
||||
extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
||||
extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
|
||||
extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
|
||||
vorbis_comment *vc,
|
||||
ogg_packet *op,
|
||||
ogg_packet *op_comm,
|
||||
ogg_packet *op_code);
|
||||
extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
|
||||
extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
|
||||
extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
|
||||
extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
|
||||
|
||||
extern int vorbis_bitrate_addblock(vorbis_block *vb);
|
||||
extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
|
||||
ogg_packet *op);
|
||||
|
||||
/* Vorbis PRIMITIVES: synthesis layer *******************************/
|
||||
extern int vorbis_synthesis_idheader(ogg_packet *op);
|
||||
extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
|
||||
ogg_packet *op);
|
||||
|
||||
extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
||||
extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
|
||||
extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
|
||||
extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
|
||||
extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
|
||||
extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
|
||||
extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm);
|
||||
extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
|
||||
extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
|
||||
|
||||
extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag);
|
||||
extern int vorbis_synthesis_halfrate_p(vorbis_info *v);
|
||||
|
||||
/* Vorbis ERRORS and return codes ***********************************/
|
||||
|
||||
#define OV_FALSE -1
|
||||
#define OV_EOF -2
|
||||
#define OV_HOLE -3
|
||||
|
||||
#define OV_EREAD -128
|
||||
#define OV_EFAULT -129
|
||||
#define OV_EIMPL -130
|
||||
#define OV_EINVAL -131
|
||||
#define OV_ENOTVORBIS -132
|
||||
#define OV_EBADHEADER -133
|
||||
#define OV_EVERSION -134
|
||||
#define OV_ENOTAUDIO -135
|
||||
#define OV_EBADPACKET -136
|
||||
#define OV_EBADLINK -137
|
||||
#define OV_ENOSEEK -138
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
112
Src/Plugins/Encoder/enc_vorbis/vorbis/include/vorbis/vorbisenc.h
Normal file
112
Src/Plugins/Encoder/enc_vorbis/vorbis/include/vorbis/vorbisenc.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: vorbis encode-engine setup
|
||||
last mod: $Id: vorbisenc.h,v 1.1 2010/11/09 22:53:50 dromagod Exp $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _OV_ENC_H_
|
||||
#define _OV_ENC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "codec.h"
|
||||
|
||||
extern int vorbis_encode_init(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
long max_bitrate,
|
||||
long nominal_bitrate,
|
||||
long min_bitrate);
|
||||
|
||||
extern int vorbis_encode_setup_managed(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
long max_bitrate,
|
||||
long nominal_bitrate,
|
||||
long min_bitrate);
|
||||
|
||||
extern int vorbis_encode_setup_vbr(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
float quality /* quality level from 0. (lo) to 1. (hi) */
|
||||
);
|
||||
|
||||
extern int vorbis_encode_init_vbr(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
float base_quality /* quality level from 0. (lo) to 1. (hi) */
|
||||
);
|
||||
|
||||
extern int vorbis_encode_setup_init(vorbis_info *vi);
|
||||
|
||||
extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
|
||||
|
||||
/* deprecated rate management supported only for compatability */
|
||||
#define OV_ECTL_RATEMANAGE_GET 0x10
|
||||
#define OV_ECTL_RATEMANAGE_SET 0x11
|
||||
#define OV_ECTL_RATEMANAGE_AVG 0x12
|
||||
#define OV_ECTL_RATEMANAGE_HARD 0x13
|
||||
|
||||
struct ovectl_ratemanage_arg {
|
||||
int management_active;
|
||||
|
||||
long bitrate_hard_min;
|
||||
long bitrate_hard_max;
|
||||
double bitrate_hard_window;
|
||||
|
||||
long bitrate_av_lo;
|
||||
long bitrate_av_hi;
|
||||
double bitrate_av_window;
|
||||
double bitrate_av_window_center;
|
||||
};
|
||||
|
||||
|
||||
/* new rate setup */
|
||||
#define OV_ECTL_RATEMANAGE2_GET 0x14
|
||||
#define OV_ECTL_RATEMANAGE2_SET 0x15
|
||||
|
||||
struct ovectl_ratemanage2_arg {
|
||||
int management_active;
|
||||
|
||||
long bitrate_limit_min_kbps;
|
||||
long bitrate_limit_max_kbps;
|
||||
long bitrate_limit_reservoir_bits;
|
||||
double bitrate_limit_reservoir_bias;
|
||||
|
||||
long bitrate_average_kbps;
|
||||
double bitrate_average_damping;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define OV_ECTL_LOWPASS_GET 0x20
|
||||
#define OV_ECTL_LOWPASS_SET 0x21
|
||||
|
||||
#define OV_ECTL_IBLOCK_GET 0x30
|
||||
#define OV_ECTL_IBLOCK_SET 0x31
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: stdio-based convenience library for opening/seeking/decoding
|
||||
last mod: $Id: vorbisfile.h,v 1.1 2010/11/09 22:53:50 dromagod Exp $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _OV_FILE_H_
|
||||
#define _OV_FILE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "codec.h"
|
||||
|
||||
/* The function prototypes for the callbacks are basically the same as for
|
||||
* the stdio functions fread, fseek, fclose, ftell.
|
||||
* The one difference is that the FILE * arguments have been replaced with
|
||||
* a void * - this is to be used as a pointer to whatever internal data these
|
||||
* functions might need. In the stdio case, it's just a FILE * cast to a void *
|
||||
*
|
||||
* If you use other functions, check the docs for these functions and return
|
||||
* the right values. For seek_func(), you *MUST* return -1 if the stream is
|
||||
* unseekable
|
||||
*/
|
||||
typedef struct {
|
||||
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
|
||||
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
|
||||
int (*close_func) (void *datasource);
|
||||
long (*tell_func) (void *datasource);
|
||||
} ov_callbacks;
|
||||
|
||||
/* a few sets of convenient callbacks, especially for use under
|
||||
* Windows where ov_open_callbacks() should always be used instead of
|
||||
* ov_open() to avoid problems with incompatable crt.o version linking
|
||||
* issues. */
|
||||
|
||||
static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
||||
if(f==NULL)return(-1);
|
||||
|
||||
#ifdef __MINGW32__
|
||||
return fseeko64(f,off,whence);
|
||||
#elif defined (_WIN32)
|
||||
return _fseeki64(f,off,whence);
|
||||
#else
|
||||
return fseek(f,off,whence);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
|
||||
* static data. That means that every file which includes this header
|
||||
* will get its own copy of these structs whether it uses them or
|
||||
* not. This is essential on platforms such as Windows on which
|
||||
* several different versions of stdio support may be linked to by
|
||||
* different DLLs, and we need to be certain we know which one we're
|
||||
* using (the same one as the main application).
|
||||
*/
|
||||
|
||||
static ov_callbacks OV_CALLBACKS_DEFAULT = {
|
||||
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
|
||||
(int (*)(void *)) fclose,
|
||||
(long (*)(void *)) ftell
|
||||
};
|
||||
|
||||
static ov_callbacks OV_CALLBACKS_NOCLOSE = {
|
||||
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
|
||||
(int (*)(void *)) NULL,
|
||||
(long (*)(void *)) ftell
|
||||
};
|
||||
|
||||
static ov_callbacks OV_CALLBACKS_STREAMONLY = {
|
||||
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||
(int (*)(void *, ogg_int64_t, int)) NULL,
|
||||
(int (*)(void *)) fclose,
|
||||
(long (*)(void *)) NULL
|
||||
};
|
||||
|
||||
static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
|
||||
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||
(int (*)(void *, ogg_int64_t, int)) NULL,
|
||||
(int (*)(void *)) NULL,
|
||||
(long (*)(void *)) NULL
|
||||
};
|
||||
|
||||
#define NOTOPEN 0
|
||||
#define PARTOPEN 1
|
||||
#define OPENED 2
|
||||
#define STREAMSET 3
|
||||
#define INITSET 4
|
||||
|
||||
typedef struct OggVorbis_File {
|
||||
void *datasource; /* Pointer to a FILE *, etc. */
|
||||
int seekable;
|
||||
ogg_int64_t offset;
|
||||
ogg_int64_t end;
|
||||
ogg_sync_state oy;
|
||||
|
||||
/* If the FILE handle isn't seekable (eg, a pipe), only the current
|
||||
stream appears */
|
||||
int links;
|
||||
ogg_int64_t *offsets;
|
||||
ogg_int64_t *dataoffsets;
|
||||
long *serialnos;
|
||||
ogg_int64_t *pcmlengths; /* overloaded to maintain binary
|
||||
compatability; x2 size, stores both
|
||||
beginning and end values */
|
||||
vorbis_info *vi;
|
||||
vorbis_comment *vc;
|
||||
|
||||
/* Decoding working state local storage */
|
||||
ogg_int64_t pcm_offset;
|
||||
int ready_state;
|
||||
long current_serialno;
|
||||
int current_link;
|
||||
|
||||
double bittrack;
|
||||
double samptrack;
|
||||
|
||||
ogg_stream_state os; /* take physical pages, weld into a logical
|
||||
stream of packets */
|
||||
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
||||
vorbis_block vb; /* local working space for packet->PCM decode */
|
||||
|
||||
ov_callbacks callbacks;
|
||||
|
||||
} OggVorbis_File;
|
||||
|
||||
|
||||
extern int ov_clear(OggVorbis_File *vf);
|
||||
extern int ov_fopen(char *path,OggVorbis_File *vf);
|
||||
extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
|
||||
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
|
||||
char *initial, long ibytes, ov_callbacks callbacks);
|
||||
|
||||
extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
|
||||
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
|
||||
char *initial, long ibytes, ov_callbacks callbacks);
|
||||
extern int ov_test_open(OggVorbis_File *vf);
|
||||
|
||||
extern long ov_bitrate(OggVorbis_File *vf,int i);
|
||||
extern long ov_bitrate_instant(OggVorbis_File *vf);
|
||||
extern long ov_streams(OggVorbis_File *vf);
|
||||
extern long ov_seekable(OggVorbis_File *vf);
|
||||
extern long ov_serialnumber(OggVorbis_File *vf,int i);
|
||||
|
||||
extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
|
||||
extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
|
||||
extern double ov_time_total(OggVorbis_File *vf,int i);
|
||||
|
||||
extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_time_seek(OggVorbis_File *vf,double pos);
|
||||
extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
|
||||
|
||||
extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_time_seek_lap(OggVorbis_File *vf,double pos);
|
||||
extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos);
|
||||
|
||||
extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
|
||||
extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
|
||||
extern double ov_time_tell(OggVorbis_File *vf);
|
||||
|
||||
extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
|
||||
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
|
||||
|
||||
extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
|
||||
int *bitstream);
|
||||
extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
|
||||
int bigendianp,int word,int sgned,int *bitstream,
|
||||
void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param);
|
||||
extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
|
||||
int bigendianp,int word,int sgned,int *bitstream);
|
||||
extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
|
||||
|
||||
extern int ov_halfrate(OggVorbis_File *vf,int flag);
|
||||
extern int ov_halfrate_p(OggVorbis_File *vf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
265
Src/Plugins/Encoder/enc_wav/ACMEncoder.cpp
Normal file
265
Src/Plugins/Encoder/enc_wav/ACMEncoder.cpp
Normal file
|
@ -0,0 +1,265 @@
|
|||
#include "ACMEncoder.h"
|
||||
|
||||
#define rev32(X) ((((DWORD)(X)&0xFF)<<24)|(((DWORD)(X)&0xFF00)<<8)|(((DWORD)(X)&0xFF0000)>>8)|(((DWORD)(X)&0xFF000000)>>24))
|
||||
|
||||
static DWORD FileTell(HANDLE hFile)
|
||||
{
|
||||
return SetFilePointer(hFile, 0, 0, FILE_CURRENT);
|
||||
}
|
||||
static void FileAlign(HANDLE hFile)
|
||||
{
|
||||
if (FileTell(hFile)&1) SetFilePointer(hFile, 1, 0, FILE_CURRENT);
|
||||
}
|
||||
|
||||
#define BUFSIZE 0x20000
|
||||
|
||||
ACMEncoder::ACMEncoder(int srate, int nch, int bps, ACMConfig *config)
|
||||
{
|
||||
m_did_header = 0;
|
||||
m_srate = srate;
|
||||
m_nch = nch;
|
||||
m_bps = bps;
|
||||
m_error = 0;
|
||||
hStream = 0;
|
||||
hStreamResample = 0;
|
||||
m_acm_resample_buf = NULL;
|
||||
m_acm_resample_outbuf = NULL;
|
||||
m_bytes_done = 0;
|
||||
m_hlen = 0;
|
||||
m_nsam = 0;
|
||||
|
||||
m_acm_buf = (unsigned char *)malloc(BUFSIZE);
|
||||
m_acm_outbuf = (unsigned char *)malloc(BUFSIZE);
|
||||
m_bytes_inbuf = 0;
|
||||
m_bytes_outbuf = 0;
|
||||
m_convert_wfx = config->convert_wfx;
|
||||
do_header = config->header;
|
||||
|
||||
m_wfx_src.wFormatTag = WAVE_FORMAT_PCM;
|
||||
m_wfx_src.nChannels = nch;
|
||||
m_wfx_src.nSamplesPerSec = srate;
|
||||
m_wfx_src.nAvgBytesPerSec = srate * nch * (bps >> 3);
|
||||
m_wfx_src.nBlockAlign = nch * (bps >> 3);
|
||||
m_wfx_src.wBitsPerSample = bps;
|
||||
m_wfx_src.cbSize = 0;
|
||||
MMRESULT rs = acmStreamOpen(&hStream, 0, &m_wfx_src, &m_convert_wfx.wfx, 0, 0, 0, ACM_STREAMOPENF_NONREALTIME);
|
||||
if (rs)
|
||||
{
|
||||
// need resampling
|
||||
WAVEFORMATEX wfx1;
|
||||
ZeroMemory(&wfx1, sizeof(wfx1));
|
||||
wfx1.wFormatTag = WAVE_FORMAT_PCM;
|
||||
if (acmFormatSuggest(0, &m_convert_wfx.wfx, &wfx1, sizeof(WAVEFORMATEX), ACM_FORMATSUGGESTF_WFORMATTAG)) m_error = 1;
|
||||
else if (acmStreamOpen(&hStream, 0, &wfx1, &m_convert_wfx.wfx, 0, 0, 0, ACM_STREAMOPENF_NONREALTIME)) m_error = 1;
|
||||
else if (acmStreamOpen(&hStreamResample, 0, &m_wfx_src, &wfx1, 0, 0, 0, ACM_STREAMOPENF_NONREALTIME)) m_error = 1;
|
||||
else
|
||||
{
|
||||
ZeroMemory(&ahdResample, sizeof(ahdResample));
|
||||
ahdResample.cbStruct = sizeof(ahdResample);
|
||||
ahdResample.pbSrc = m_acm_resample_buf = (unsigned char *)malloc(BUFSIZE);
|
||||
ahdResample.cbSrcLength = BUFSIZE;
|
||||
ahdResample.pbDst = m_acm_resample_outbuf = (unsigned char *)malloc(BUFSIZE);
|
||||
ahdResample.cbDstLength = BUFSIZE;
|
||||
if (acmStreamPrepareHeader(hStreamResample, &ahdResample, 0)) m_error = 1;
|
||||
m_bytes_inbuf_resample = 0;
|
||||
m_bytes_outbuf_resample = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hStream)
|
||||
{
|
||||
m_error = 1;
|
||||
return ;
|
||||
}
|
||||
|
||||
ZeroMemory(&ahd, sizeof(ahd));
|
||||
ahd.cbStruct = sizeof(ahd);
|
||||
ahd.pbSrc = m_acm_buf;
|
||||
ahd.cbSrcLength = BUFSIZE;
|
||||
ahd.pbDst = m_acm_outbuf;
|
||||
ahd.cbDstLength = BUFSIZE;
|
||||
if (acmStreamPrepareHeader(hStream, &ahd, 0)) m_error = 1;
|
||||
}
|
||||
|
||||
ACMEncoder::~ACMEncoder()
|
||||
{
|
||||
free(m_acm_buf);
|
||||
free(m_acm_outbuf);
|
||||
free(m_acm_resample_buf);
|
||||
free(m_acm_resample_outbuf);
|
||||
if (hStream)
|
||||
{
|
||||
if (ahd.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED) acmStreamUnprepareHeader(hStream, &ahd, 0);
|
||||
acmStreamClose(hStream, 0);
|
||||
}
|
||||
if (hStreamResample)
|
||||
{
|
||||
if (ahdResample.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED) acmStreamUnprepareHeader(hStreamResample, &ahdResample, 0);
|
||||
acmStreamClose(hStreamResample, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int ACMEncoder::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail)
|
||||
{
|
||||
char *pout = (char *)out;
|
||||
int retval = 0;
|
||||
|
||||
if (!m_did_header && do_header)
|
||||
{
|
||||
int s = 4 + 4 + 12 - 4;
|
||||
|
||||
int t;
|
||||
if (m_convert_wfx.wfx.wFormatTag == WAVE_FORMAT_PCM) t = 0x10;
|
||||
else t = sizeof(WAVEFORMATEX) + m_convert_wfx.wfx.cbSize;
|
||||
s += 4 + t;
|
||||
if (s&1) s++;
|
||||
|
||||
if (m_convert_wfx.wfx.wFormatTag != WAVE_FORMAT_PCM)
|
||||
s += 12;
|
||||
|
||||
s += 8;
|
||||
|
||||
if (out_avail < s) return 0;
|
||||
//xx bytes of randomness
|
||||
m_hlen = s;
|
||||
m_did_header = 1;
|
||||
out_avail -= s;
|
||||
pout += s;
|
||||
retval = s;
|
||||
}
|
||||
|
||||
if (!m_bytes_outbuf)
|
||||
{
|
||||
if (hStreamResample)
|
||||
{
|
||||
if (!m_bytes_outbuf_resample)
|
||||
{
|
||||
DWORD flags = ACM_STREAMCONVERTF_BLOCKALIGN;
|
||||
|
||||
int l = min(in_avail, BUFSIZE - m_bytes_inbuf_resample);
|
||||
if (l < 0) l = 0;
|
||||
if (l > 0) memcpy(m_acm_resample_buf + m_bytes_inbuf_resample, in, l);
|
||||
m_bytes_inbuf_resample += l;
|
||||
*in_used = l;
|
||||
m_nsam += l;
|
||||
|
||||
ahdResample.cbSrcLength = m_bytes_inbuf_resample;
|
||||
acmStreamConvert(hStreamResample, &ahdResample, flags);
|
||||
m_bytes_inbuf_resample -= ahdResample.cbSrcLengthUsed;
|
||||
memcpy(m_acm_resample_buf, m_acm_resample_buf + ahdResample.cbSrcLengthUsed, m_bytes_inbuf_resample); //memmove
|
||||
m_bytes_outbuf_resample = ahdResample.cbDstLengthUsed;
|
||||
}
|
||||
in = (void*)m_acm_resample_outbuf;
|
||||
in_avail = m_bytes_outbuf_resample;
|
||||
m_bytes_outbuf_resample = 0;
|
||||
in_used = NULL;
|
||||
}
|
||||
|
||||
DWORD flags = ACM_STREAMCONVERTF_BLOCKALIGN;
|
||||
|
||||
int l = min(in_avail, BUFSIZE - m_bytes_inbuf);
|
||||
if (l < 0) l = 0;
|
||||
if (l > 0) memcpy(m_acm_buf + m_bytes_inbuf, in, l);
|
||||
m_bytes_inbuf += l;
|
||||
if (in_used)
|
||||
{
|
||||
*in_used = l;
|
||||
m_nsam += l;
|
||||
}
|
||||
|
||||
if (m_bytes_inbuf)
|
||||
{
|
||||
ahd.cbSrcLength = m_bytes_inbuf;
|
||||
acmStreamConvert(hStream, &ahd, flags);
|
||||
m_bytes_inbuf -= ahd.cbSrcLengthUsed;
|
||||
memcpy(m_acm_buf, m_acm_buf + ahd.cbSrcLengthUsed, m_bytes_inbuf); //memmove
|
||||
m_bytes_outbuf = ahd.cbDstLengthUsed;
|
||||
m_bytes_done += l;
|
||||
}
|
||||
}
|
||||
if (m_bytes_outbuf)
|
||||
{
|
||||
int l = min(out_avail, m_bytes_outbuf);
|
||||
memcpy(pout, m_acm_outbuf, l);
|
||||
m_bytes_outbuf -= l;
|
||||
memcpy(m_acm_outbuf, m_acm_outbuf + l, m_bytes_outbuf);
|
||||
retval += l;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void ACMEncoder::FinishAudio(const wchar_t *filename)
|
||||
{
|
||||
if (!do_header) return ;
|
||||
|
||||
HANDLE fh = CreateFileW(filename, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
|
||||
if (fh == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
|
||||
int len, i;
|
||||
const unsigned char ispred1[4] =
|
||||
{
|
||||
0x52 , 0x49 , 0x46 , 0x46
|
||||
};
|
||||
const unsigned char ispred2[12] =
|
||||
{
|
||||
0x57, 0x41 , 0x56 , 0x45 , 0x66 , 0x6d , 0x74 , 0x20 , 0x10 , 0x0 , 0x0 , 0x0
|
||||
};
|
||||
|
||||
len = m_bytes_done;
|
||||
DWORD a = 0;
|
||||
|
||||
FileAlign(fh);
|
||||
|
||||
SetFilePointer(fh, 0, 0, FILE_BEGIN);
|
||||
|
||||
WriteFile(fh, ispred1, sizeof(ispred1), &a, NULL);
|
||||
i = len + (m_hlen) - 8;
|
||||
if (i&1) i++;
|
||||
a = 0; WriteFile(fh, &i, 4, &a, NULL);
|
||||
a = 0; WriteFile(fh, ispred2, sizeof(ispred2) - (hStream ? 4 : 0), &a, NULL);
|
||||
|
||||
int t;
|
||||
if (m_convert_wfx.wfx.wFormatTag == WAVE_FORMAT_PCM) t = 0x10;
|
||||
else t = sizeof(WAVEFORMATEX) + m_convert_wfx.wfx.cbSize;
|
||||
a = 0; WriteFile(fh, &t, 4, &a, 0);
|
||||
a = 0; WriteFile(fh, &m_convert_wfx.wfx, t, &a, 0);
|
||||
|
||||
FileAlign(fh);
|
||||
|
||||
DWORD fact_ofs = 0;
|
||||
if (m_convert_wfx.wfx.wFormatTag != WAVE_FORMAT_PCM)
|
||||
{
|
||||
t = rev32('fact');
|
||||
a = 0; WriteFile(fh, &t, 4, &a, 0);
|
||||
t = 4;
|
||||
a = 0; WriteFile(fh, &t, 4, &a, 0);
|
||||
fact_ofs = FileTell(fh);
|
||||
SetFilePointer(fh, 4, 0, FILE_CURRENT);
|
||||
}
|
||||
|
||||
t = rev32('data');
|
||||
WriteFile(fh, &t, 4, &a, 0);
|
||||
DWORD data_ofs = FileTell(fh);
|
||||
|
||||
{
|
||||
DWORD t, bw = 0;
|
||||
SetFilePointer(fh, 4, 0, FILE_BEGIN);
|
||||
t = GetFileSize(fh, 0) - 8;
|
||||
WriteFile(fh, &t, 4, &bw, 0);
|
||||
DWORD data_size = GetFileSize(fh, 0) - (data_ofs + 4);
|
||||
SetFilePointer(fh, data_ofs, 0, FILE_BEGIN);
|
||||
bw = 0; WriteFile(fh, &data_size, 4, &bw, 0);
|
||||
if (fact_ofs)
|
||||
{
|
||||
SetFilePointer(fh, fact_ofs, 0, FILE_BEGIN);
|
||||
t = m_nsam / ((m_bps >> 3) * m_nch);
|
||||
WriteFile(fh, &t, 4, &bw, 0);
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle(fh);
|
||||
}
|
||||
|
||||
int ACMEncoder::GetLastError() { return m_error; }
|
47
Src/Plugins/Encoder/enc_wav/ACMEncoder.h
Normal file
47
Src/Plugins/Encoder/enc_wav/ACMEncoder.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
#ifndef NULLSOFT_ENC_ACM_ACMENCODER_H
|
||||
#define NULLSOFT_ENC_ACM_ACMENCODER_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmreg.h>
|
||||
#include <msacm.h>
|
||||
#include "../nsv/enc_if.h"
|
||||
#include "Config.h"
|
||||
#include "Finisher.h"
|
||||
|
||||
class ACMEncoder : public AudioCommon
|
||||
{
|
||||
public:
|
||||
ACMEncoder(int srate, int nch, int bps, ACMConfig *config);
|
||||
virtual ~ACMEncoder();
|
||||
|
||||
virtual int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail);
|
||||
void FinishAudio(const wchar_t *filename);
|
||||
|
||||
int GetLastError();
|
||||
|
||||
int m_did_header;
|
||||
int m_nch, m_srate, m_bps;
|
||||
int m_bytes_done;
|
||||
int m_error;
|
||||
int m_hlen;
|
||||
int m_nsam;
|
||||
|
||||
EXT_WFX m_convert_wfx;
|
||||
|
||||
WAVEFORMATEX m_wfx_src;
|
||||
HACMSTREAM hStream, hStreamResample;
|
||||
|
||||
ACMSTREAMHEADER ahd, ahdResample;
|
||||
|
||||
unsigned char *m_acm_buf, *m_acm_outbuf;
|
||||
int m_bytes_inbuf, m_bytes_outbuf;
|
||||
unsigned char *m_acm_resample_buf, *m_acm_resample_outbuf;
|
||||
int m_bytes_inbuf_resample, m_bytes_outbuf_resample;
|
||||
|
||||
bool do_header;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
110
Src/Plugins/Encoder/enc_wav/Config.cpp
Normal file
110
Src/Plugins/Encoder/enc_wav/Config.cpp
Normal file
|
@ -0,0 +1,110 @@
|
|||
#include <windows.h>
|
||||
#include <mmreg.h>
|
||||
#include <msacm.h>
|
||||
#include "Config.h"
|
||||
#include "resource.h"
|
||||
#include <strsafe.h>
|
||||
|
||||
static void ACM_gettext(HWND hwndDlg, char* tx)
|
||||
{
|
||||
ConfigWnd *wc = (ConfigWnd *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
|
||||
ACMFORMATTAGDETAILSA aftd;
|
||||
ZeroMemory(&aftd, sizeof(aftd));
|
||||
aftd.cbStruct = sizeof(aftd);
|
||||
aftd.dwFormatTag = wc->cfg.convert_wfx.wfx.wFormatTag;
|
||||
if (!acmFormatTagDetailsA(0, &aftd, ACM_FORMATTAGDETAILSF_FORMATTAG))
|
||||
{
|
||||
char* p = aftd.szFormatTag;
|
||||
while (p && *p) *(tx++) = *(p++);
|
||||
*(tx++) = 13;
|
||||
*(tx++) = 10;
|
||||
}
|
||||
ACMFORMATDETAILSA afd;
|
||||
ZeroMemory(&afd, sizeof(afd));
|
||||
afd.cbStruct = sizeof(afd);
|
||||
afd.dwFormatTag = wc->cfg.convert_wfx.wfx.wFormatTag;
|
||||
afd.pwfx = &wc->cfg.convert_wfx.wfx;
|
||||
afd.cbwfx = sizeof(wc->cfg.convert_wfx);
|
||||
if (!acmFormatDetailsA(0, &afd, ACM_FORMATDETAILSF_FORMAT))
|
||||
{
|
||||
char* p = afd.szFormat;
|
||||
while (p && *p) *(tx++) = *(p++);
|
||||
}
|
||||
*tx = 0;
|
||||
}
|
||||
|
||||
static void ACM_choose(HWND hwndDlg, bool pcm)
|
||||
{
|
||||
ConfigWnd *wc = (ConfigWnd *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
|
||||
ACMFORMATCHOOSE afc;
|
||||
memset(&afc, 0, sizeof(afc));
|
||||
afc.cbStruct = sizeof(afc);
|
||||
afc.fdwStyle = ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT;
|
||||
afc.pwfx = &wc->cfg.convert_wfx.wfx;
|
||||
afc.cbwfx = sizeof(wc->cfg.convert_wfx);
|
||||
|
||||
afc.hwndOwner = hwndDlg;
|
||||
|
||||
if (!acmFormatChoose(&afc))
|
||||
{
|
||||
{
|
||||
char tmp[512];
|
||||
StringCchPrintfA(tmp, 512,"%s\x0d\x0a%s", afc.szFormatTag, afc.szFormat);
|
||||
SetDlgItemTextA(hwndDlg, IDC_FORMAT_DESCRIPTION, tmp);
|
||||
|
||||
StringCchPrintfA(tmp, 512,"%d", wc->cfg.convert_wfx.wfx.cbSize);
|
||||
WritePrivateProfileStringA("enc_wav","fmtsize", tmp, wc->configfile);
|
||||
WritePrivateProfileStructA("enc_wav", "fmt", &wc->cfg.convert_wfx, sizeof(wc->cfg.convert_wfx.wfx) + wc->cfg.convert_wfx.wfx.cbSize, wc->configfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INT_PTR WINAPI DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
ConfigWnd *wc = (ConfigWnd *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
if (!lParam) // this should NEVER happen
|
||||
return 0;
|
||||
|
||||
SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG)lParam);
|
||||
wc=(ConfigWnd*)lParam;
|
||||
|
||||
char tmp[256];
|
||||
ACM_gettext(hwndDlg, tmp);
|
||||
SetDlgItemTextA(hwndDlg, IDC_FORMAT_DESCRIPTION, tmp);
|
||||
CheckDlgButton(hwndDlg, IDC_HEADER, wc->cfg.header);
|
||||
CheckDlgButton(hwndDlg, IDC_DO_CONVERT, wc->cfg.convert);
|
||||
SetDlgItemTextA(hwndDlg, IDC_EXTENSION, wc->cfg.wav_ext);
|
||||
SendDlgItemMessage(hwndDlg, IDC_EXTENSION, EM_SETLIMITTEXT, 4, 0);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_CHOOSE_FORMAT:
|
||||
ACM_choose(hwndDlg, 0);
|
||||
break;
|
||||
case IDC_HEADER:
|
||||
wc->cfg.header = !!IsDlgButtonChecked(hwndDlg, IDC_HEADER);
|
||||
WritePrivateProfileStringA("enc_wav", "header", wc->cfg.header?"1":"0", wc->configfile);
|
||||
break;
|
||||
case IDC_DO_CONVERT:
|
||||
wc->cfg.convert = !!IsDlgButtonChecked(hwndDlg, IDC_DO_CONVERT);
|
||||
WritePrivateProfileStringA("enc_wav", "convert", wc->cfg.convert?"1":"0", wc->configfile);
|
||||
break;
|
||||
case IDC_EXTENSION:
|
||||
if (HIWORD(wParam) == EN_CHANGE)
|
||||
{
|
||||
GetDlgItemTextA(hwndDlg, IDC_EXTENSION, wc->cfg.wav_ext, sizeof(wc->cfg.wav_ext));
|
||||
WritePrivateProfileStringA("enc_wav", "ext", wc->cfg.wav_ext, wc->configfile);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
31
Src/Plugins/Encoder/enc_wav/Config.h
Normal file
31
Src/Plugins/Encoder/enc_wav/Config.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#ifndef NULLSOFT_ENC_ACM_CONFIG_H
|
||||
#define NULLSOFT_ENC_ACM_CONFIG_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmreg.h>
|
||||
#include <msacm.h>
|
||||
|
||||
#define WFSIZ 0x800
|
||||
struct EXT_WFX
|
||||
{
|
||||
WAVEFORMATEX wfx;
|
||||
BYTE crap[WFSIZ];
|
||||
};
|
||||
|
||||
struct ACMConfig
|
||||
{
|
||||
EXT_WFX convert_wfx;
|
||||
char wav_ext[32];
|
||||
bool header;
|
||||
bool convert;
|
||||
};
|
||||
|
||||
struct ConfigWnd
|
||||
{
|
||||
ACMConfig cfg;
|
||||
char *configfile;
|
||||
};
|
||||
|
||||
INT_PTR WINAPI DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#endif
|
10
Src/Plugins/Encoder/enc_wav/Finisher.h
Normal file
10
Src/Plugins/Encoder/enc_wav/Finisher.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef NULLSOFT_ENC_WAV_FINISHER_H
|
||||
#define NULLSOFT_ENC_WAV_FINISHER_H
|
||||
|
||||
class AudioCommon : public AudioCoder
|
||||
{
|
||||
public:
|
||||
virtual void FinishAudio(const wchar_t *filename)=0;
|
||||
};
|
||||
|
||||
#endif
|
72
Src/Plugins/Encoder/enc_wav/WAVEncoder.cpp
Normal file
72
Src/Plugins/Encoder/enc_wav/WAVEncoder.cpp
Normal file
|
@ -0,0 +1,72 @@
|
|||
#include "WAVEncoder.h"
|
||||
|
||||
#define rev32(X) ((((DWORD)(X)&0xFF)<<24)|(((DWORD)(X)&0xFF00)<<8)|(((DWORD)(X)&0xFF0000)>>8)|(((DWORD)(X)&0xFF000000)>>24))
|
||||
|
||||
WAVEncoder::WAVEncoder(int nch, int srate, int bps, ACMConfig *config)
|
||||
{
|
||||
numBytes = 0;
|
||||
|
||||
inputFormat.wFormatTag = WAVE_FORMAT_PCM;
|
||||
inputFormat.nChannels = nch;
|
||||
inputFormat.nSamplesPerSec = srate;
|
||||
inputFormat.nAvgBytesPerSec = srate * nch * (bps >> 3);
|
||||
inputFormat.nBlockAlign = nch * (bps >> 3);
|
||||
inputFormat.wBitsPerSample = bps;
|
||||
inputFormat.cbSize = 0;
|
||||
|
||||
do_header = config->header;
|
||||
if (do_header)
|
||||
first = 44;
|
||||
}
|
||||
|
||||
int WAVEncoder::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
int valid = min(first, out_avail);
|
||||
first -= valid;
|
||||
*in_used = 0;
|
||||
return valid;
|
||||
}
|
||||
|
||||
int valid = min(in_avail, out_avail);
|
||||
|
||||
memcpy(out, in, valid);
|
||||
*in_used = valid;
|
||||
numBytes += valid;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
void WAVEncoder::PrepareToFinish()
|
||||
{}
|
||||
|
||||
void WAVEncoder::FinishAudio(const wchar_t *filename)
|
||||
{
|
||||
if (!do_header) return;
|
||||
// open old file
|
||||
HANDLE tempfile = CreateFileW(filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
|
||||
|
||||
if (tempfile)
|
||||
{
|
||||
// rewrite initial 44 bytes
|
||||
DWORD bw = 0;
|
||||
unsigned __int32 t;
|
||||
t = rev32('RIFF');
|
||||
WriteFile(tempfile, &t, 4, &bw, 0); // RIFF (4 bytes)
|
||||
t = (unsigned __int32)numBytes + 36;
|
||||
bw = 0;WriteFile(tempfile, &t, 4, &bw, 0); // size of chunk (4 bytes)
|
||||
t = rev32('WAVE');
|
||||
bw = 0;WriteFile(tempfile, &t, 4, &bw, 0); // WAVE (4 bytes)
|
||||
t = rev32('fmt ');
|
||||
bw = 0;WriteFile(tempfile, &t, 4, &bw, 0);// fmt (4 bytes)
|
||||
t = 16;
|
||||
bw = 0;WriteFile(tempfile, &t, 4, &bw, 0);// size of chunk (4 bytes)
|
||||
bw = 0;WriteFile(tempfile, &inputFormat, 16, &bw, 0); // write WAVEFORMAT out (16 bytes)
|
||||
t = rev32('data');
|
||||
bw = 0;WriteFile(tempfile, &t, 4, &bw, 0);// data (4 bytes)
|
||||
bw = 0;WriteFile(tempfile, &numBytes, 4, &bw, 0);// size of chunk (4 bytes)
|
||||
|
||||
CloseHandle(tempfile);
|
||||
}
|
||||
}
|
25
Src/Plugins/Encoder/enc_wav/WAVEncoder.h
Normal file
25
Src/Plugins/Encoder/enc_wav/WAVEncoder.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef NULLSOFT_ENC_WAV_WAVENCODER_H
|
||||
#define NULLSOFT_ENC_WAV_WAVENCODER_H
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmreg.h>
|
||||
#include <msacm.h>
|
||||
#include "../nsv/enc_if.h"
|
||||
#include "Config.h"
|
||||
#include "Finisher.h"
|
||||
class WAVEncoder : public AudioCommon
|
||||
{
|
||||
public:
|
||||
WAVEncoder(int nch, int srate, int bps, ACMConfig *config);
|
||||
int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail); //returns bytes in out
|
||||
void FinishAudio(const wchar_t *filename);
|
||||
void PrepareToFinish();
|
||||
|
||||
WAVEFORMATEX inputFormat;
|
||||
size_t numBytes;
|
||||
int first;
|
||||
bool do_header;
|
||||
};
|
||||
|
||||
#endif
|
111
Src/Plugins/Encoder/enc_wav/enc_wav.rc
Normal file
111
Src/Plugins/Encoder/enc_wav/enc_wav.rc
Normal file
|
@ -0,0 +1,111 @@
|
|||
// 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_CONFIG DIALOGEX 0, 0, 256, 105
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "Write RIFF Header (otherwise write RAW data)",IDC_HEADER,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,13,248,10
|
||||
CONTROL "Convert to format:",IDC_DO_CONVERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,26,77,10
|
||||
PUSHBUTTON "Choose Format",IDC_CHOOSE_FORMAT,7,40,63,14
|
||||
EDITTEXT IDC_FORMAT_DESCRIPTION,7,59,240,22,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "Extension:",IDC_STATIC,8,86,35,13,SS_CENTERIMAGE
|
||||
EDITTEXT IDC_EXTENSION,48,86,40,13,ES_AUTOHSCROLL
|
||||
GROUPBOX "Wav Encoder Options",IDC_STATIC,0,0,256,105
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.K.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
65535 "{34DF1A2D-7EAD-41ab-B1A7-9AFA6DE2AFF1}"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_ENC_WAV_DESC "WAV Encoder %s"
|
||||
END
|
||||
|
||||
#endif // English (U.K.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#include "version.rc2"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
30
Src/Plugins/Encoder/enc_wav/enc_wav.sln
Normal file
30
Src/Plugins/Encoder/enc_wav/enc_wav.sln
Normal file
|
@ -0,0 +1,30 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29519.181
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enc_wav", "enc_wav.vcxproj", "{7B43D768-8CD3-4929-B91E-DEB97F121656}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7B43D768-8CD3-4929-B91E-DEB97F121656}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7B43D768-8CD3-4929-B91E-DEB97F121656}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7B43D768-8CD3-4929-B91E-DEB97F121656}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7B43D768-8CD3-4929-B91E-DEB97F121656}.Debug|x64.Build.0 = Debug|x64
|
||||
{7B43D768-8CD3-4929-B91E-DEB97F121656}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7B43D768-8CD3-4929-B91E-DEB97F121656}.Release|Win32.Build.0 = Release|Win32
|
||||
{7B43D768-8CD3-4929-B91E-DEB97F121656}.Release|x64.ActiveCfg = Release|x64
|
||||
{7B43D768-8CD3-4929-B91E-DEB97F121656}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {ECC95181-336A-4B52-8743-F687749093EA}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
252
Src/Plugins/Encoder/enc_wav/enc_wav.vcxproj
Normal file
252
Src/Plugins/Encoder/enc_wav/enc_wav.vcxproj
Normal file
|
@ -0,0 +1,252 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7B43D768-8CD3-4929-B91E-DEB97F121656}</ProjectGuid>
|
||||
<RootNamespace>enc_wav</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg">
|
||||
<VcpkgEnabled>false</VcpkgEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
<VcpkgTriplet>
|
||||
</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<VcpkgTriplet>
|
||||
</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ENC_WAV_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>msacm32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;ENC_WAV_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>msacm32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ENC_WAV_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>msacm32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;ENC_WAV_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>msacm32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ACMEncoder.cpp" />
|
||||
<ClCompile Include="Config.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="WAVEncoder.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ACMEncoder.h" />
|
||||
<ClInclude Include="Config.h" />
|
||||
<ClInclude Include="Finisher.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="WAVEncoder.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_wav.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj">
|
||||
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
50
Src/Plugins/Encoder/enc_wav/enc_wav.vcxproj.filters
Normal file
50
Src/Plugins/Encoder/enc_wav/enc_wav.vcxproj.filters
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ACMEncoder.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WAVEncoder.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ACMEncoder.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Finisher.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WAVEncoder.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{ee875982-d629-49cc-a8ae-2ba63dc64a78}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Ressource Files">
|
||||
<UniqueIdentifier>{2e191036-3949-43a0-9fce-044245ce82aa}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{df114c96-e301-4277-8849-778ec6cf693a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_wav.rc">
|
||||
<Filter>Ressource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
176
Src/Plugins/Encoder/enc_wav/main.cpp
Normal file
176
Src/Plugins/Encoder/enc_wav/main.cpp
Normal file
|
@ -0,0 +1,176 @@
|
|||
#define ENC_VERSION "v1.02a"
|
||||
|
||||
#include "Config.h"
|
||||
#include "resource.h"
|
||||
#include "../nsv/enc_if.h"
|
||||
#include "ACMEncoder.h"
|
||||
#include "WAVEncoder.h"
|
||||
#include "../nu/AutoWideFn.h"
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// wasabi based services for localisation support
|
||||
#include <api/service/waServiceFactory.h>
|
||||
#include "../Agave/Language/api_language.h"
|
||||
#include "../winamp/wa_ipc.h"
|
||||
|
||||
#include <strsafe.h>
|
||||
HWND winampwnd = 0;
|
||||
api_service *WASABI_API_SVC = 0;
|
||||
api_language *WASABI_API_LNG = 0;
|
||||
HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
|
||||
|
||||
static const WAVEFORMATEX wfx_default =
|
||||
{
|
||||
WAVE_FORMAT_PCM,
|
||||
2,
|
||||
44100,
|
||||
44100 * 4,
|
||||
4,
|
||||
16,
|
||||
0
|
||||
};
|
||||
|
||||
static void ReadConfig(ACMConfig *config, char *INI_FILE)
|
||||
{
|
||||
int l = GetPrivateProfileIntA("enc_wav", "fmtsize", 0, INI_FILE);
|
||||
|
||||
EXT_WFX convert_wfx_temp;
|
||||
if (GetPrivateProfileStructA("enc_wav", "fmt", &convert_wfx_temp, sizeof(WAVEFORMATEX) + l, INI_FILE))
|
||||
memcpy(&config->convert_wfx, &convert_wfx_temp, sizeof(config->convert_wfx));
|
||||
else
|
||||
config->convert_wfx.wfx = wfx_default;
|
||||
|
||||
GetPrivateProfileStringA("enc_wav", "ext", "WAV", config->wav_ext, sizeof(config->wav_ext), INI_FILE);
|
||||
config->header = !!GetPrivateProfileIntA("enc_wav", "header", 1, INI_FILE);
|
||||
config->convert = !!GetPrivateProfileIntA("enc_wav", "convert", 0, INI_FILE);
|
||||
}
|
||||
|
||||
static HINSTANCE GetMyInstance()
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi = {0};
|
||||
if(VirtualQuery(GetMyInstance, &mbi, sizeof(mbi)))
|
||||
return (HINSTANCE)mbi.AllocationBase;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GetLocalisationApiService(void)
|
||||
{
|
||||
if(!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_LNG)
|
||||
{
|
||||
waServiceFactory *sf;
|
||||
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(),EncWavLangGUID);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
AudioCoder __declspec(dllexport) *CreateAudio3(int nch, int srate, int bps, unsigned int srct, unsigned int *outt, char *configfile)
|
||||
{
|
||||
if (srct == mmioFOURCC('P','C','M',' '))
|
||||
{
|
||||
if (*outt == mmioFOURCC('A','C','M',' '))
|
||||
{
|
||||
ACMConfig config;
|
||||
ReadConfig(&config, configfile);
|
||||
if (config.convert)
|
||||
{
|
||||
ACMEncoder *encoder = new ACMEncoder(srate, nch, bps, &config);
|
||||
if (encoder->GetLastError())
|
||||
{
|
||||
delete encoder;
|
||||
encoder=0;
|
||||
}
|
||||
return encoder;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new WAVEncoder(nch, srate, bps, &config);
|
||||
}
|
||||
}
|
||||
else if (*outt == mmioFOURCC('W','A','V',' '))
|
||||
{
|
||||
ACMConfig config;
|
||||
ReadConfig(&config, configfile);
|
||||
return new WAVEncoder(nch, srate, bps, &config);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int __declspec(dllexport) GetAudioTypes3(int idx, char *desc)
|
||||
{
|
||||
switch(idx)
|
||||
{
|
||||
case 0:
|
||||
GetLocalisationApiService();
|
||||
StringCchPrintfA(desc, 1024, WASABI_API_LNGSTRING(IDS_ENC_WAV_DESC), ENC_VERSION);
|
||||
return mmioFOURCC('A','C','M',' ');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
HWND __declspec(dllexport) ConfigAudio3(HWND hwndParent, HINSTANCE hinst, unsigned int outt, char *configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('A', 'C','M',' '))
|
||||
{
|
||||
ConfigWnd configwnd;
|
||||
ReadConfig(&configwnd.cfg, configfile);
|
||||
configwnd.configfile = configfile;
|
||||
GetLocalisationApiService();
|
||||
return WASABI_API_CREATEDIALOGPARAMW(IDD_CONFIG, hwndParent, DlgProc, (LPARAM)&configwnd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) FinishAudio3(const char *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCommon*)coder)->FinishAudio(AutoWideFn(filename));
|
||||
}
|
||||
|
||||
void __declspec(dllexport) FinishAudio3W(const wchar_t *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCommon*)coder)->FinishAudio(filename);
|
||||
}
|
||||
|
||||
int __declspec(dllexport) GetConfigItem(unsigned int outt, char *item, char *data, int len, char *configfile)
|
||||
{
|
||||
if (outt==mmioFOURCC('A','C','M',' '))
|
||||
{
|
||||
ACMConfig config;
|
||||
ReadConfig(&config, configfile);
|
||||
if (!_stricmp(item, "extension"))
|
||||
{
|
||||
lstrcpynA(data, config.wav_ext, len);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) SetWinampHWND(HWND hwnd)
|
||||
{
|
||||
winampwnd = hwnd;
|
||||
}
|
||||
};
|
1
Src/Plugins/Encoder/enc_wav/preferences.cpp
Normal file
1
Src/Plugins/Encoder/enc_wav/preferences.cpp
Normal file
|
@ -0,0 +1 @@
|
|||
// TODO: acmFormatChoose
|
23
Src/Plugins/Encoder/enc_wav/resource.h
Normal file
23
Src/Plugins/Encoder/enc_wav/resource.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by enc_acm.rc
|
||||
//
|
||||
#define IDD_CONFIG 101
|
||||
#define IDS_ENC_WAV_DESC 104
|
||||
#define IDC_FORMAT_DESCRIPTION 1001
|
||||
#define IDC_CHOOSE_FORMAT 1002
|
||||
#define IDC_EXTENSION 1003
|
||||
#define IDC_HEADER 1004
|
||||
#define IDC_CHECK1 1005
|
||||
#define IDC_DO_CONVERT 1005
|
||||
|
||||
// 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 1006
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
39
Src/Plugins/Encoder/enc_wav/version.rc2
Normal file
39
Src/Plugins/Encoder/enc_wav/version.rc2
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
#include "../../../Winamp/buildType.h"
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,2,1
|
||||
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,2,1"
|
||||
VALUE "InternalName", "Nullsoft WAV Encoder"
|
||||
VALUE "LegalCopyright", "Copyright © 2006-2023 Winamp SA"
|
||||
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
|
||||
VALUE "OriginalFilename", "enc_wav.dll"
|
||||
VALUE "ProductName", "Winamp"
|
||||
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
256
Src/Plugins/Encoder/enc_wma/ASFErr.h
Normal file
256
Src/Plugins/Encoder/enc_wma/ASFErr.h
Normal file
|
@ -0,0 +1,256 @@
|
|||
//=========================================================================
|
||||
//
|
||||
// THIS SOFTWARE HAS BEEN LICENSED FROM MICROSOFT CORPORATION PURSUANT
|
||||
// TO THE TERMS OF AN END USER LICENSE AGREEMENT ("EULA").
|
||||
// PLEASE REFER TO THE TEXT OF THE EULA TO DETERMINE THE RIGHTS TO USE THE SOFTWARE.
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation, 1996 - 1998 All Rights Reserved.
|
||||
//
|
||||
//=========================================================================
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ASFErr.h - definition of ASF HRESULT codes
|
||||
//
|
||||
// Copyright (C) Microsoft Corporation, 1997 - 1998
|
||||
//
|
||||
// This file is generated by the MC tool from ASFErr.mc
|
||||
//
|
||||
|
||||
#ifndef _ASFERR_H
|
||||
#define _ASFERR_H
|
||||
|
||||
|
||||
#define STATUS_SEVERITY(hr) (((hr) >> 30) & 0x3)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Advanced Streaming Format (ASF) Errors (2000 - 2999)
|
||||
//
|
||||
//
|
||||
// Values are 32 bit values layed out as follows:
|
||||
//
|
||||
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
||||
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
// +---+-+-+-----------------------+-------------------------------+
|
||||
// |Sev|C|R| Facility | Code |
|
||||
// +---+-+-+-----------------------+-------------------------------+
|
||||
//
|
||||
// where
|
||||
//
|
||||
// Sev - is the severity code
|
||||
//
|
||||
// 00 - Success
|
||||
// 01 - Informational
|
||||
// 10 - Warning
|
||||
// 11 - Error
|
||||
//
|
||||
// C - is the Customer code flag
|
||||
//
|
||||
// R - is a reserved bit
|
||||
//
|
||||
// Facility - is the facility code
|
||||
//
|
||||
// Code - is the facility's status code
|
||||
//
|
||||
//
|
||||
// Define the facility codes
|
||||
//
|
||||
#define FACILITY_NS 0xD
|
||||
|
||||
|
||||
//
|
||||
// Define the severity codes
|
||||
//
|
||||
#define STATUS_SEVERITY_WARNING 0x2
|
||||
#define STATUS_SEVERITY_SUCCESS 0x0
|
||||
#define STATUS_SEVERITY_INFORMATIONAL 0x1
|
||||
#define STATUS_SEVERITY_ERROR 0x3
|
||||
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_BUFFEROVERRUN
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// An attempt was made to seek or position past the end of a buffer.%0
|
||||
//
|
||||
#define ASF_E_BUFFEROVERRUN 0xC00D07D0L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_BUFFERTOOSMALL
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// The supplied input or output buffer was too small.%0
|
||||
//
|
||||
#define ASF_E_BUFFERTOOSMALL 0xC00D07D1L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_BADLANGUAGEID
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// The language ID was not found.%0
|
||||
//
|
||||
#define ASF_E_BADLANGUAGEID 0xC00D07D2L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_NOPAYLOADLENGTH
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// The multiple payload packet is missing the payload length.%0
|
||||
//
|
||||
#define ASF_E_NOPAYLOADLENGTH 0xC00D07DBL
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_TOOMANYPAYLOADS
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// The packet contains too many payloads.%0
|
||||
//
|
||||
#define ASF_E_TOOMANYPAYLOADS 0xC00D07DCL
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_PACKETCONTENTTOOLARGE
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// ASF_E_PACKETCONTENTTOOLARGE
|
||||
//
|
||||
#define ASF_E_PACKETCONTENTTOOLARGE 0xC00D07DEL
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_UNKNOWNPACKETSIZE
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// Expecting a fixed packet size but min. and max. are not equal.%0
|
||||
//
|
||||
#define ASF_E_UNKNOWNPACKETSIZE 0xC00D07E0L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_INVALIDHEADER
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// ASF_E_INVALIDHEADER
|
||||
//
|
||||
#define ASF_E_INVALIDHEADER 0xC00D07E2L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_NOCLOCKOBJECT
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// The object does not have a valid clock object.%0
|
||||
//
|
||||
#define ASF_E_NOCLOCKOBJECT 0xC00D07E6L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_UNKNOWNCLOCKTYPE
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// ASF_E_UNKNOWNCLOCKTYPE
|
||||
//
|
||||
#define ASF_E_UNKNOWNCLOCKTYPE 0xC00D07EBL
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_OPAQUEPACKET
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// An attempt was made to restore or access an opaque packet.%0
|
||||
//
|
||||
#define ASF_E_OPAQUEPACKET 0xC00D07EDL
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_WRONGVERSION
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// ASF_E_WRONGVERSION
|
||||
//
|
||||
#define ASF_E_WRONGVERSION 0xC00D07EEL
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_OVERFLOW
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// An attempt was made to store a value which was larger than then destination's maximum value.%0
|
||||
//
|
||||
#define ASF_E_OVERFLOW 0xC00D07EFL
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_NOTFOUND
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// The object was not found.%0
|
||||
//
|
||||
#define ASF_E_NOTFOUND 0xC00D07F0L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_OBJECTTOOBIG
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// The object is too large to be processed in the requested manner.%0
|
||||
//
|
||||
#define ASF_E_OBJECTTOOBIG 0xC00D07F1L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_UNEXPECTEDVALUE
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// A value was not set as expected.%0
|
||||
//
|
||||
#define ASF_E_UNEXPECTEDVALUE 0xC00D07F2L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_INVALIDSTATE
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// The request is not valid in the object's current state.%0
|
||||
//
|
||||
#define ASF_E_INVALIDSTATE 0xC00D07F3L
|
||||
|
||||
//
|
||||
// MessageId: ASF_E_NOLIBRARY
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// This object does not have a valid library pointer; it has not been Init()'ed or it has been Shutdown().%0
|
||||
//
|
||||
#define ASF_E_NOLIBRARY 0xC00D07F4L
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Advanced Streaming Format (ASF) Success Codes (2000 - 2999)
|
||||
//
|
||||
|
||||
//
|
||||
// MessageId: ASF_S_OPAQUEPACKET
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// ASF_S_OPAQUEPACKET
|
||||
//
|
||||
#define ASF_S_OPAQUEPACKET 0x000D07F0L
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Advanced Streaming Format (ASF) Warnings (2000 - 2999)
|
||||
//
|
||||
|
||||
|
||||
#endif // _ASFERR_H
|
||||
|
468
Src/Plugins/Encoder/enc_wma/AudioCoderWMA.cpp
Normal file
468
Src/Plugins/Encoder/enc_wma/AudioCoderWMA.cpp
Normal file
|
@ -0,0 +1,468 @@
|
|||
#include <windows.h>
|
||||
#include <mmreg.h>
|
||||
#include <msacm.h>
|
||||
#include "../nu/ns_wc.h"
|
||||
#include "resource.h"
|
||||
#include "wmsdk.h" // for IWMWriterSink
|
||||
|
||||
#include "AudioCoderWMA.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <exception>
|
||||
|
||||
#include "../nu/AutoLock.h"
|
||||
#include "../nu/AutoWide.h"
|
||||
#include "../Winamp/strutil.h"
|
||||
#include "../Agave/Language/api_language.h"
|
||||
|
||||
/* TODO: implement 2-pass encoding via IWMWriterPreprocess */
|
||||
|
||||
int config_bitrate, config_samplerate, config_nch;
|
||||
// New globals for encoder query
|
||||
|
||||
class CustomIndexStatus : public IWMStatusCallback
|
||||
{
|
||||
public:
|
||||
CustomIndexStatus( HANDLE _done ) : done(_done), IWMStatusCallback(), refcount(1)
|
||||
{}
|
||||
|
||||
// IUnknown methods
|
||||
public:
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return ++refcount;
|
||||
}
|
||||
|
||||
|
||||
virtual ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
// If we go to zero, who cares?
|
||||
return --refcount;
|
||||
}
|
||||
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
|
||||
{
|
||||
HRESULT hRetval = E_NOINTERFACE;
|
||||
if (IID_IWMStatusCallback == iid)
|
||||
{
|
||||
*ppvObject = static_cast<IWMStatusCallback *>(this);
|
||||
hRetval = S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppvObject = NULL;
|
||||
}
|
||||
return hRetval;
|
||||
}
|
||||
|
||||
// IWMStatusCallback methods
|
||||
public:
|
||||
HRESULT STDMETHODCALLTYPE OnStatus( WMT_STATUS Status, HRESULT hr, WMT_ATTR_DATATYPE dwType, BYTE* pValue, void* pvContext )
|
||||
{
|
||||
switch ( Status )
|
||||
{
|
||||
case WMT_CLOSED:
|
||||
// You may want to deal with the HRESULT value passed with the status.
|
||||
// If you do, you should do it here.
|
||||
|
||||
// Signal the event.
|
||||
SetEvent(done);
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
ULONG refcount;
|
||||
HANDLE done;
|
||||
};
|
||||
|
||||
|
||||
// Our custom buffer object, used by the writer sink.
|
||||
|
||||
AudioCoderWMA::AudioCoderWMA(int numchannels, int samplerate, int bitspersamp, configtype *cfg, char *configfile) : AudioCoder()
|
||||
{
|
||||
lastByteCount=0;
|
||||
writerAdvanced=0;
|
||||
begin_writing = false;
|
||||
error = WMA_NO_ERROR;
|
||||
sink = NULL;
|
||||
|
||||
// Get globals from Winamp.ini config file
|
||||
config_bitrate = cfg->config_bitrate;
|
||||
config_samplerate = cfg->config_samplesSec;
|
||||
config_nch = cfg->config_nch;
|
||||
|
||||
timeunits_per_byte = ( ( (10000000.0) / (double)samplerate ) / (double)numchannels ) / ( (double)bitspersamp / 8.0 );
|
||||
//char t[100] = {0};
|
||||
//wsprintf(t,"%d", timeunits_per_byte);
|
||||
//::MessageBox(NULL, t, t, MB_OK);
|
||||
input_bytecount = 0;
|
||||
|
||||
HRESULT hr = CreateAndConfigureWriter(numchannels, samplerate, bitspersamp, configfile);
|
||||
|
||||
if ( FAILED(hr) )
|
||||
{
|
||||
error = WMA_CANT_CREATE_WRITER;
|
||||
}
|
||||
}
|
||||
|
||||
AudioCoderWMA::~AudioCoderWMA()
|
||||
{
|
||||
if (writer)
|
||||
{
|
||||
if ( begin_writing )
|
||||
{
|
||||
begin_writing = false;
|
||||
writer->EndWriting();
|
||||
}
|
||||
writer->Release();
|
||||
writer = NULL;
|
||||
}
|
||||
if (writerAdvanced)
|
||||
{
|
||||
writerAdvanced->Release();
|
||||
writerAdvanced=0;
|
||||
}
|
||||
if (sink)
|
||||
{
|
||||
sink->Release();
|
||||
sink=0;
|
||||
}
|
||||
}
|
||||
|
||||
int AudioCoderWMA::GetLastError()
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
void AudioCoderWMA::PrepareToFinish()
|
||||
{
|
||||
// We don't want to kill the objects here, because there might still be data in the pipeline.
|
||||
if (writer && begin_writing)
|
||||
{
|
||||
begin_writing = false;
|
||||
// Tell WM that we're done giving it input data.
|
||||
|
||||
writer->EndWriting();
|
||||
// TODO: do we have to wait for this to finish?
|
||||
}
|
||||
}
|
||||
|
||||
void AudioCoderWMA::OnFinished(const wchar_t *wfname)
|
||||
{
|
||||
//
|
||||
// Okay, here we need to go back and index the file we just wrote so it's seekable.
|
||||
//
|
||||
|
||||
// From: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmform/htm/toconfiguretheindexer.asp
|
||||
// And: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmform/htm/toindexanasffile.asp
|
||||
IWMIndexer* pBaseIndexer = NULL;
|
||||
IWMIndexer2* pMyIndexer = NULL;
|
||||
|
||||
// Create an indexer.
|
||||
WMCreateIndexer(&pBaseIndexer);
|
||||
|
||||
// Retrieve an IWMIndexer2 interface pointer for the indexer just created.
|
||||
pBaseIndexer->QueryInterface(IID_IWMIndexer2, (void **) & pMyIndexer);
|
||||
|
||||
// Release the base indexer.
|
||||
pBaseIndexer->Release();
|
||||
pBaseIndexer = NULL;
|
||||
|
||||
// Configure the indexer to create a timecode-based index.
|
||||
pMyIndexer->Configure(0, // Stream Number, use all.
|
||||
WMT_IT_PRESENTATION_TIME, // Indexer type.
|
||||
NULL, // Index interval, use default.
|
||||
NULL); // Index type, use default.
|
||||
|
||||
// Create an event for asynchronous calls.
|
||||
HANDLE done = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
// Give that to the status object
|
||||
CustomIndexStatus status( done );
|
||||
|
||||
// Start the indexer.
|
||||
pMyIndexer->StartIndexing(tempFilename, &status, NULL);
|
||||
|
||||
// Wait for the indexer to finish.
|
||||
WaitForSingleObject(done, INFINITE);
|
||||
|
||||
// Release the remaining interface.
|
||||
pMyIndexer->Release();
|
||||
pMyIndexer = NULL;
|
||||
|
||||
// Cleanup
|
||||
CloseHandle( done );
|
||||
DeleteFileW(wfname);
|
||||
MoveFileW(tempFilename, wfname);
|
||||
|
||||
}
|
||||
|
||||
int AudioCoderWMA::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
int retval = 0; // number of bytes written into "out"
|
||||
*in_used = 0; // number of bytes read from "in"
|
||||
if ( !framepos && !in_avail )
|
||||
{
|
||||
int x = 0;
|
||||
x++;
|
||||
}
|
||||
assert(writer);
|
||||
|
||||
// Hopefully, at the end of the stream, we still get called with "Encode" until we return 0?
|
||||
if (in_avail)
|
||||
{
|
||||
// Allocate an INSSBuffer of the proper size to hold all the data.
|
||||
INSSBuffer* pSample = NULL;
|
||||
if (FAILED(writer->AllocateSample(in_avail, &pSample))) return -1;
|
||||
|
||||
// Get its internal memory buffer
|
||||
DWORD newBufferLength;
|
||||
pSample->GetLength(&newBufferLength);
|
||||
assert(newBufferLength == in_avail);
|
||||
|
||||
BYTE *pdwBuffer = NULL;
|
||||
if (FAILED(pSample->GetBuffer(&pdwBuffer))) return -1;
|
||||
|
||||
memcpy(pdwBuffer, in, in_avail); // Send all the available bytes in the input buffer into the IWMWriter,
|
||||
|
||||
pSample->SetLength(in_avail); // Tell the buffer object how much we used
|
||||
|
||||
QWORD timeunits = (QWORD)( (double)input_bytecount * timeunits_per_byte ); // Compute the current timecode
|
||||
// And stuff it into the writer
|
||||
hr = writer->WriteSample(0, timeunits, 0, pSample);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
// Increment the bytecount to be able to calculate the next timecode
|
||||
input_bytecount += in_avail;
|
||||
// And tell the host we used up all the available input data.
|
||||
*in_used = in_avail;
|
||||
}
|
||||
// Release immediately
|
||||
pSample->Release();
|
||||
}
|
||||
|
||||
WM_WRITER_STATISTICS stats;
|
||||
writerAdvanced->GetStatistics(0, &stats);
|
||||
retval = (int)(stats.qwByteCount - lastByteCount);
|
||||
retval = min(retval, out_avail);
|
||||
lastByteCount+=retval;
|
||||
memset(out, 0, retval); // so we don't write random memory to disk
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
HRESULT AudioCoderWMA::SelectAndLoadResampler(int numchannels, int samplerate, int bitspersamp)
|
||||
{
|
||||
DWORD inCount = 0;
|
||||
BOOL success = false;
|
||||
|
||||
//wsprintf(junk,"IN Chan=%d, SRate=%d, BPS=%d", numchannels, samplerate,bitspersamp);
|
||||
//MessageBox(NULL, junk, "INPUT FMT", MB_OK);
|
||||
// First get the number of input streams
|
||||
HRESULT hr = writer->GetInputCount(&inCount);
|
||||
if(!FAILED(hr)){
|
||||
//wsprintf(junk, "Input Count = %d", inCount);
|
||||
//MessageBox(NULL, junk, "DEBUG", MB_OK);
|
||||
// Now get the number of input formats we can resample for
|
||||
DWORD fmtCount = 0;
|
||||
hr = writer->GetInputFormatCount(0, &fmtCount);
|
||||
if(!FAILED(hr)){
|
||||
//wsprintf(junk, "Format Count = %d", fmtCount);
|
||||
//MessageBox(NULL, junk, "DEBUG", MB_OK);
|
||||
// Now cycle through and find the one that matches our input fmt
|
||||
for(size_t i = 0;i < fmtCount;i++){
|
||||
IWMInputMediaProps* pProps = NULL;
|
||||
hr = writer->GetInputFormat(0, (DWORD)i, &pProps);
|
||||
if(!FAILED(hr)){
|
||||
DWORD cbSize = 0;
|
||||
// Get the size of the media type structure.
|
||||
pProps->GetMediaType(NULL, &cbSize);
|
||||
// Allocate memory for the media type structure.
|
||||
WM_MEDIA_TYPE* pType = (WM_MEDIA_TYPE*) new BYTE[cbSize];
|
||||
if(pType != NULL){
|
||||
WAVEFORMATEX* pwave = NULL;
|
||||
// Get the media type structure.
|
||||
hr = pProps->GetMediaType(pType, &cbSize);
|
||||
// Check that the format data is present.
|
||||
if (pType->cbFormat >= sizeof(WAVEFORMATEX)){
|
||||
pwave = (WAVEFORMATEX*)pType->pbFormat;
|
||||
//wsprintf(junk, "Cnannels = %d, SPerSec = %d, AvgBPS = %d, BPS = %d BALIGN = %d",
|
||||
// pwave->nChannels,
|
||||
// pwave->nSamplesPerSec,
|
||||
// pwave->nAvgBytesPerSec,
|
||||
// pwave->wBitsPerSample,
|
||||
// pwave->nBlockAlign);
|
||||
//MessageBox(NULL, junk, "DEBUG", MB_OK);
|
||||
}
|
||||
else{
|
||||
break;
|
||||
}
|
||||
// Try to match the channels/samplerate/and bits/samp
|
||||
if((pwave->nChannels == numchannels) && (pwave->nSamplesPerSec == samplerate) && (pwave->wBitsPerSample == bitspersamp)){
|
||||
writer->SetInputProps(0, pProps);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(success != 1){
|
||||
wchar_t junk[FILETITLE_SIZE] = {0};
|
||||
wsprintfW(junk,WASABI_API_LNGSTRINGW(IDS_CANNOT_FIND_INPUT_FORMATTER),
|
||||
numchannels, samplerate,bitspersamp);
|
||||
MessageBoxW(NULL, junk, WASABI_API_LNGSTRINGW(IDS_WARNING), MB_OK);
|
||||
}
|
||||
if (success)
|
||||
return S_OK;
|
||||
else if (FAILED(hr)) // if we have an error code, return it
|
||||
return hr;
|
||||
else
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT AudioCoderWMA::CreateAndConfigureWriter(WORD numchannels, WORD samplerate, WORD bitspersamp, char *configfile)
|
||||
{
|
||||
// First, create the writer.
|
||||
HRESULT hr = WMCreateWriter( NULL, &writer );
|
||||
if ( !FAILED(hr) )
|
||||
{
|
||||
// Create and Configure a stream profile with the given wave limits.
|
||||
WAVEFORMATEX WaveLimits =
|
||||
{
|
||||
WAVE_FORMAT_PCM,
|
||||
numchannels,
|
||||
samplerate,
|
||||
samplerate * numchannels * bitspersamp / (DWORD)8,
|
||||
numchannels * bitspersamp / (DWORD)8,
|
||||
bitspersamp,
|
||||
0
|
||||
};
|
||||
IWMProfile* pProfile = NULL;
|
||||
hr = CreateAndConfigureProfile(&WaveLimits, &pProfile, configfile);
|
||||
if ( !FAILED(hr) )
|
||||
{
|
||||
// Set the profile into the writer
|
||||
hr = writer->SetProfile( pProfile );
|
||||
if ( !FAILED(hr) )
|
||||
{
|
||||
// Go get the input resampler and load it to the profile
|
||||
hr = SelectAndLoadResampler(numchannels, samplerate, bitspersamp);
|
||||
if (!FAILED(hr))
|
||||
{
|
||||
wchar_t tempPath[MAX_PATH] = {0};
|
||||
GetTempPathW(MAX_PATH,tempPath);
|
||||
GetTempFileNameW(tempPath, L"wma", 0, tempFilename);
|
||||
|
||||
// Make the custom data sink object
|
||||
WMCreateWriterFileSink(&sink);
|
||||
//sink = new CustomWMWriterSink;
|
||||
if ( sink )
|
||||
{
|
||||
sink->Open(tempFilename);
|
||||
HRESULT hr;
|
||||
// From MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmform/htm/addingsinkstothewriter.asp
|
||||
IWMWriterSink* pSinkBase = NULL;
|
||||
hr = writer->QueryInterface( IID_IWMWriterAdvanced, (void **) & writerAdvanced );
|
||||
if ( !FAILED(hr) )
|
||||
{
|
||||
hr = sink->QueryInterface( IID_IWMWriterSink, (void**) & pSinkBase );
|
||||
if ( !FAILED(hr) )
|
||||
{
|
||||
// Stuff the custom data sink into the writer.
|
||||
hr = writerAdvanced->AddSink(pSinkBase);
|
||||
if ( !FAILED(hr) )
|
||||
{
|
||||
// And let the writer initialize itself for output.
|
||||
hr = writer->BeginWriting();
|
||||
if ( !FAILED(hr) )
|
||||
{
|
||||
begin_writing = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = WMA_CANT_ADD_SINK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = WMA_CANT_QUERY_SINK_INTERFACE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = WMA_CANT_QUERY_WRITER_INTERFACE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = WMA_CANT_MAKE_CUSTOM_SINK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT AudioCoderWMA::CreateAndConfigureProfile(WAVEFORMATEX* pWaveLimits, IWMProfile** ppProfile, char *configfile)
|
||||
{
|
||||
IWMProfileManager* pProfileMgr = NULL;
|
||||
|
||||
// Instantiate a profile manager object.
|
||||
HRESULT hr = WMCreateProfileManager(&pProfileMgr);
|
||||
if ( !FAILED(hr) )
|
||||
{
|
||||
/* SAVE
|
||||
// Create the empty profile.
|
||||
//hr = pProfileMgr->CreateEmptyProfile(WMT_VER_9_0, ppProfile);
|
||||
if ( !FAILED(hr) ){
|
||||
IWMCodecInfo3 *codecInfo = NULL;
|
||||
hr = pProfileMgr->QueryInterface(&codecInfo);
|
||||
if(!FAILED(hr)){
|
||||
// Find the proper IWMStreamConfig that matches the WAVEFORMATEX data.
|
||||
IWMStreamConfig* pStreamConfig = NULL;
|
||||
//hr = FindAudioFormat(WMMEDIASUBTYPE_WMAudioV2, pProfileMgr, pWaveLimits, config_bitrate * 1000, FALSE, &pStreamConfig);
|
||||
hr = codecInfo->GetCodecFormat(WMMEDIATYPE_Audio, config_encOffset, config_formatOffset, &pStreamConfig);
|
||||
if ( !FAILED(hr) ){
|
||||
// Config the stream.
|
||||
// hr = pStreamConfig->SetBitrate( config_bitrate );
|
||||
hr = pStreamConfig->SetConnectionName( L"enc_wma" );
|
||||
hr = pStreamConfig->SetStreamName( L"enc_wma" );
|
||||
hr = pStreamConfig->SetStreamNumber( 1 );
|
||||
|
||||
// Stuff it into the profile
|
||||
hr = (*ppProfile)->AddStream( pStreamConfig );
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
if ( !FAILED(hr) ){
|
||||
// Load the .prx file into the writer
|
||||
if(configfile == NULL){
|
||||
hr = E_FAIL;
|
||||
}
|
||||
else{
|
||||
wchar_t cstring[4000] = {0};
|
||||
GetPrivateProfileStructW(L"audio_wma", L"profile", cstring, sizeof(cstring)/sizeof(*cstring), AutoWide(configfile));
|
||||
hr = pProfileMgr->LoadProfileByData(cstring, ppProfile);
|
||||
if(hr != S_OK){
|
||||
hr = E_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
pProfileMgr->Release();
|
||||
}
|
||||
return hr;
|
||||
}
|
50
Src/Plugins/Encoder/enc_wma/AudioCoderWMA.h
Normal file
50
Src/Plugins/Encoder/enc_wma/AudioCoderWMA.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef AUDIOCODERWMA_H
|
||||
#define AUDIOCODERWMA_H
|
||||
|
||||
#include "../nsv/enc_if.h"
|
||||
#include "main.h"
|
||||
|
||||
class CustomWMWriterSink;
|
||||
|
||||
class AudioCoderWMA : public AudioCoder
|
||||
{
|
||||
public:
|
||||
AudioCoderWMA(int nch, int srate, int bps, configtype *cfg, char *configfile);
|
||||
virtual int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail); //returns bytes in out
|
||||
virtual ~AudioCoderWMA();
|
||||
int GetLastError();
|
||||
void PrepareToFinish();
|
||||
void OnFinished(const wchar_t *filename);
|
||||
HRESULT SelectAndLoadResampler(int numchannels, int samplerate, int bitpersamp);
|
||||
|
||||
HRESULT CreateAndConfigureWriter(WORD nch, WORD srate, WORD bps, char *configfile);
|
||||
HRESULT CreateAndConfigureProfile(WAVEFORMATEX* pWaveLimits, IWMProfile** ppProfile, char *configfile);
|
||||
|
||||
private:
|
||||
bool begin_writing;
|
||||
int error;
|
||||
IWMWriterFileSink *sink;
|
||||
IWMWriter *writer;
|
||||
IWMWriterAdvanced *writerAdvanced;
|
||||
double timeunits_per_byte; // "100 nanosecond units" -- ie: ( ( (10000000.0) / (double)samplerate ) / (double)numchannels ) / ( (double)bitspersamp/ 8.0 )
|
||||
int input_bytecount;
|
||||
QWORD lastByteCount;
|
||||
wchar_t tempFilename[MAX_PATH];
|
||||
|
||||
};
|
||||
|
||||
enum AudioCoderWMAErrors
|
||||
{
|
||||
WMA_NO_ERROR = 0,
|
||||
WMA_CANT_FIND_WMSDK = -1,
|
||||
WMA_CANT_LOAD_CREATOR = -2,
|
||||
WMA_CANT_CREATE_WRITER = -3,
|
||||
WMA_CANT_SET_INPUT_FORMAT = -4,
|
||||
WMA_CANT_SET_OUTPUT_FORMAT = -5,
|
||||
WMA_CANT_MAKE_CUSTOM_SINK = -6,
|
||||
WMA_CANT_QUERY_WRITER_INTERFACE = -7,
|
||||
WMA_CANT_QUERY_SINK_INTERFACE = -8,
|
||||
WMA_CANT_ADD_SINK = -9,
|
||||
};
|
||||
|
||||
#endif//AUDIOCODERWMA_H
|
648
Src/Plugins/Encoder/enc_wma/config.cpp
Normal file
648
Src/Plugins/Encoder/enc_wma/config.cpp
Normal file
|
@ -0,0 +1,648 @@
|
|||
#include <windows.h>
|
||||
|
||||
// LGIVEN Mods 4-10-05
|
||||
#include "main.h"
|
||||
#include <wmsdk.h>
|
||||
#include "../nu/AutoWide.h"
|
||||
#include "../nu/ns_wc.h"
|
||||
#include "../Agave/Language/api_language.h"
|
||||
#include <MMSystem.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define MAX_PASSES 1 // limited to 1pass encoding until we work out some code for 2pass encoding
|
||||
|
||||
// LGIVEN Mods 4-10-05
|
||||
void readconfig(char *configfile, configtype *cfg)
|
||||
{
|
||||
cfg->config_bitrate = 0;
|
||||
cfg->config_bitsSample = 0;
|
||||
cfg->config_nch = 0;
|
||||
cfg->config_samplesSec = 0;
|
||||
cfg->config_encoder = 0;
|
||||
cfg->config_vbr = 0;
|
||||
cfg->config_passes = 1;
|
||||
if (configfile)
|
||||
{
|
||||
GetPrivateProfileStructA("audio_wma", "conf", cfg, sizeof(configtype), configfile);
|
||||
}
|
||||
}
|
||||
|
||||
void writeconfig(char *configfile, configtype *cfg)
|
||||
{
|
||||
if (configfile)
|
||||
{
|
||||
WritePrivateProfileStructA("audio_wma", "conf", cfg, sizeof(configtype), configfile);
|
||||
}
|
||||
}
|
||||
|
||||
// New global table for channels,samplerates and bitrates
|
||||
static EncoderType* encs = NULL; // Pointer to the TABLE with all config data
|
||||
// Globals store current selections from Config Dialog
|
||||
// Number of encoders
|
||||
static int encNumbs = 0; // Total number of encoders installed WMA
|
||||
|
||||
// New routine to read all config info from WMA encoder and load tables
|
||||
|
||||
static BOOL loadWMATables()
|
||||
{
|
||||
IWMProfileManager *profileManager;
|
||||
IWMProfileManager2 *profileManager2;
|
||||
IWMCodecInfo3 *codecInfo;
|
||||
WAVEFORMATEX *pwave;
|
||||
HRESULT hr;
|
||||
int legalFormats = 0;
|
||||
|
||||
WMCreateProfileManager(&profileManager);
|
||||
profileManager->QueryInterface(&profileManager2);
|
||||
profileManager2->SetSystemProfileVersion(WMT_VER_9_0);
|
||||
|
||||
profileManager->QueryInterface(&codecInfo);
|
||||
// Get the number of AUDIO Codecs
|
||||
DWORD numCodecs = 0;
|
||||
codecInfo->GetCodecInfoCount(WMMEDIATYPE_Audio, &numCodecs);
|
||||
// If there are no encoders, just return
|
||||
if (numCodecs == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Allocate structs for codecs and zero them all
|
||||
encs = (EncoderType *) calloc(numCodecs * 4, sizeof(struct EncoderType));
|
||||
if (encs != NULL)
|
||||
{
|
||||
encNumbs = numCodecs * 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t titleStr[32] = {0};
|
||||
MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_CANNOT_ALLOCATE_MEM),
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_WMA_ENCODER_ERROR,titleStr,32), MB_OK);
|
||||
return false;
|
||||
}
|
||||
// Now cycle through the codecs
|
||||
EncoderType* encp = encs;
|
||||
for (BOOL isVBR = 0;isVBR != 2;isVBR++)
|
||||
for (DWORD numPasses = 1;numPasses <= MAX_PASSES;numPasses++)
|
||||
for (DWORD i = 0;i != numCodecs;i++)
|
||||
{
|
||||
wchar_t codecName[5000] = {0};
|
||||
DWORD codecNameSize = 5000;
|
||||
|
||||
codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, i, g_wszVBREnabled, WMT_TYPE_BOOL, (BYTE *)&isVBR, sizeof(BOOL));
|
||||
codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, i, g_wszNumPasses, WMT_TYPE_DWORD, (BYTE *)&numPasses, sizeof(DWORD));
|
||||
codecInfo->GetCodecName(WMMEDIATYPE_Audio, i, codecName, &codecNameSize);
|
||||
// Get the number of formats for this codec
|
||||
DWORD formatCount = 0;
|
||||
hr = codecInfo->GetCodecFormatCount( WMMEDIATYPE_Audio, i, &formatCount );
|
||||
if (FAILED(hr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (formatCount == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fill the EncoderType struct and allocate structs for format info
|
||||
// First allocate the space for all the formatType structs
|
||||
encp->formats = (formatType *) malloc(formatCount * sizeof(struct formatType));
|
||||
if (encp->formats == NULL)
|
||||
{
|
||||
wchar_t titleStr[32] = {0};
|
||||
MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_CANNOT_ALLOCATE_MEM),
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_WMA_ENCODER_ERROR,titleStr,32), MB_OK);
|
||||
return false;
|
||||
}
|
||||
// Now fill the EncoderType struct with name and info
|
||||
encp->encoderName = _wcsdup(codecName);
|
||||
encp->numFormats = formatCount;
|
||||
encp->offset = i;
|
||||
encp->vbr = isVBR;
|
||||
encp->numPasses = numPasses;
|
||||
}
|
||||
// Now cycle through the formats for this codec
|
||||
legalFormats = 0;
|
||||
formatType *fmts = encp->formats;
|
||||
for (DWORD f = 0;f != formatCount;f++)
|
||||
{
|
||||
wchar_t fDesc[5000] = {0};
|
||||
DWORD size = 5000;
|
||||
// Get the config info for this encoding format in string format
|
||||
IWMStreamConfig *streamConfig;
|
||||
codecInfo->GetCodecFormatDesc(WMMEDIATYPE_Audio, i, f, &streamConfig, fDesc, &size);
|
||||
// Now get the config info
|
||||
IWMMediaProps *props;
|
||||
streamConfig->QueryInterface(&props);
|
||||
// Get the bitrate
|
||||
//DWORD bitRate;
|
||||
//streamConfig->GetBitrate(&bitRate);
|
||||
// Get the Media Encoder type
|
||||
DWORD mediaTypeSize;
|
||||
props->GetMediaType(0, &mediaTypeSize);
|
||||
WM_MEDIA_TYPE *mediaType = (WM_MEDIA_TYPE *)new char[mediaTypeSize];
|
||||
props->GetMediaType(mediaType, &mediaTypeSize);
|
||||
// Go get the WAVEFORMATEX Struct from the
|
||||
if (mediaType->cbFormat >= sizeof(WAVEFORMATEX))
|
||||
{
|
||||
pwave = (WAVEFORMATEX*)mediaType->pbFormat;
|
||||
if (pwave != NULL)
|
||||
{
|
||||
// Check to see if this is an A/V codec format
|
||||
// If so, do not save it
|
||||
|
||||
/*
|
||||
if ((pwave->nAvgBytesPerSec / pwave->nBlockAlign) ==
|
||||
((pwave->nAvgBytesPerSec >= 3995) ? 5 : 3))
|
||||
{
|
||||
delete(mediaType);
|
||||
props->Release();
|
||||
streamConfig->Release();
|
||||
continue;
|
||||
}*/
|
||||
|
||||
// old way of checking
|
||||
if ((wcsstr(fDesc, L"A/V")) != NULL)
|
||||
{
|
||||
delete[] (mediaType);
|
||||
props->Release();
|
||||
streamConfig->Release();
|
||||
continue;
|
||||
}
|
||||
// Load the format name
|
||||
fmts->formatName = _wcsdup(fDesc);
|
||||
// Load all the format values and the offset
|
||||
if ((pwave->nAvgBytesPerSec & 0x7FFFFF00) == 0x7FFFFF00)
|
||||
{
|
||||
fmts->bitrate = (pwave->nAvgBytesPerSec & 0x000000FF);
|
||||
fmts->vbr = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fmts->bitrate = (pwave->nAvgBytesPerSec * 8);
|
||||
fmts->vbr = 0;
|
||||
}
|
||||
fmts->bitsSample = pwave->wBitsPerSample;
|
||||
fmts->nChannels = pwave->nChannels;
|
||||
fmts->samplesSec = pwave->nSamplesPerSec;
|
||||
fmts->offset = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t titleStr[32] = {0};
|
||||
MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_CANNOT_GET_STRUCTURE),
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_WMA_ENCODER_ERROR,titleStr,32), MB_OK);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t titleStr[32] = {0};
|
||||
MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_CANNOT_GET_ENCODER4_INFO),
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_WMA_ENCODER_ERROR,titleStr,32), MB_OK);
|
||||
return false;
|
||||
}
|
||||
// Set the media type value in the EncoderType struct on first legal format
|
||||
if (f == 0)
|
||||
{
|
||||
encp->mediaType = mediaType->subtype;
|
||||
}
|
||||
// Now point to the next table block and inc the legal formats count
|
||||
fmts++;
|
||||
legalFormats++;
|
||||
// And release the props and streams structs
|
||||
delete[] (mediaType);
|
||||
props->Release();
|
||||
streamConfig->Release();
|
||||
|
||||
}
|
||||
// If there are no legal formats for this codec then skip it
|
||||
if (legalFormats == 0)
|
||||
{
|
||||
delete[] encp->encoderName;
|
||||
encp->encoderName = NULL;
|
||||
encp->numFormats = legalFormats;
|
||||
encp->offset = 0;
|
||||
}
|
||||
// Else load number of legal formats and save it
|
||||
else
|
||||
{
|
||||
encp->numFormats = legalFormats;
|
||||
encp++;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static int FindFormatNumber(formatType *formats, int numFormats, configtype *cfg)
|
||||
{
|
||||
for (int i = 0;i < numFormats;i++, formats++)
|
||||
{
|
||||
if (formats->bitrate == cfg->config_bitrate
|
||||
&& formats->bitsSample == cfg->config_bitsSample
|
||||
&& formats->nChannels == cfg->config_nch
|
||||
&& formats->samplesSec == cfg->config_samplesSec)
|
||||
return formats->offset;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static VOID dumpProfile(char *configfile, BOOL isVBR, DWORD numPasses, int encNumb, int fmtNumb)
|
||||
{
|
||||
// Create a Profile and dump it
|
||||
IWMProfileManager *pmgr = NULL;
|
||||
IWMProfile *prof = NULL;
|
||||
IWMStreamConfig *sconf = NULL;
|
||||
IWMCodecInfo3 *cinfo = NULL;
|
||||
DWORD ssize;
|
||||
wchar_t errorTitle[128] = {0};
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_WMA_CONFIG_FILE_ERROR,errorTitle,128);
|
||||
|
||||
HRESULT hr = WMCreateProfileManager(&pmgr);
|
||||
if (!FAILED(hr))
|
||||
{
|
||||
hr = pmgr->CreateEmptyProfile(WMT_VER_9_0, &prof);
|
||||
if (!FAILED(hr))
|
||||
{
|
||||
hr = pmgr->QueryInterface(&cinfo);
|
||||
if (!FAILED(hr))
|
||||
{
|
||||
cinfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, encNumb, g_wszVBREnabled, WMT_TYPE_BOOL, (BYTE *)&isVBR, sizeof(BOOL));
|
||||
cinfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, encNumb, g_wszNumPasses, WMT_TYPE_DWORD, (BYTE *)&numPasses, sizeof(DWORD));
|
||||
cinfo->GetCodecFormat(WMMEDIATYPE_Audio, encNumb, fmtNumb, &sconf);
|
||||
sconf->SetConnectionName(L"enc_wma");
|
||||
sconf->SetStreamName(L"enc_wma");
|
||||
sconf->SetStreamNumber(1);
|
||||
hr = prof->AddStream(sconf);
|
||||
if (!FAILED(hr))
|
||||
{
|
||||
hr = pmgr->SaveProfile(prof, NULL, &ssize);
|
||||
if (!FAILED(hr))
|
||||
{
|
||||
WCHAR* pstring = new WCHAR[ssize];
|
||||
if (pstring != NULL)
|
||||
{
|
||||
hr = pmgr->SaveProfile(prof, pstring, &ssize);
|
||||
if (!FAILED(hr))
|
||||
{
|
||||
wchar_t cstring[4000] = {0};
|
||||
wcsncpy(cstring, pstring, 4000 - 1);
|
||||
WritePrivateProfileStructW(L"audio_wma", L"profile", cstring, sizeof(cstring) / sizeof(*cstring), AutoWide(configfile));
|
||||
}
|
||||
else{ MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_SAVE_PROFILE_READ_ERROR), errorTitle, MB_OK); }
|
||||
}
|
||||
else{ MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_MEM_ALLOCATION_ERROR), errorTitle, MB_OK); }
|
||||
}
|
||||
else{ MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_PROFILE_SAVE_SIZE_ERROR), errorTitle, MB_OK); }
|
||||
}
|
||||
else{ MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_CANNOT_READ_AUDIO_STREAM), errorTitle, MB_OK); }
|
||||
}
|
||||
else{ MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_CANNOT_GET_CODEC_INFO), errorTitle, MB_OK); }
|
||||
}
|
||||
else{ MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_CANNOT_CREATE_A_PROFILE), errorTitle, MB_OK); }
|
||||
}
|
||||
else{ MessageBoxW(NULL, WASABI_API_LNGSTRINGW(IDS_CANNOT_CREATE_PROFILE_MANAGER), errorTitle, MB_OK); }
|
||||
pmgr->Release();
|
||||
prof->Release();
|
||||
sconf->Release();
|
||||
cinfo->Release();
|
||||
}
|
||||
|
||||
static bool Has(HWND hwndDlg, int item, int data)
|
||||
{
|
||||
int numChoices = SendDlgItemMessage(hwndDlg, item, CB_GETCOUNT, 0, 0);
|
||||
for (int i = 0;i < numChoices;i++)
|
||||
{
|
||||
if (SendDlgItemMessage(hwndDlg, item, CB_GETITEMDATA, i, 0) == data)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static int EncodeSampleFormat(int bps, int numChannels, int sampleRate)
|
||||
{
|
||||
// 20 bits sampleRate
|
||||
assert((sampleRate & 0xFFFFF) == sampleRate);
|
||||
// 6 bits numChannels
|
||||
assert((numChannels & 0x3F) == numChannels);
|
||||
// 6 bits bps
|
||||
assert((bps & 0x3F) == bps);
|
||||
|
||||
return (sampleRate << 12) | (numChannels << 6) | (bps);
|
||||
}
|
||||
|
||||
static void DecodeSampleFormat(int data, int &bps, int &numChannels, int &sampleRate)
|
||||
{
|
||||
bps = data & 0x3F;
|
||||
data >>= 6;
|
||||
numChannels = data & 0x3F;
|
||||
data >>= 6;
|
||||
sampleRate = data;
|
||||
}
|
||||
|
||||
static int EncodeVBR(BOOL isVBR, DWORD numPasses)
|
||||
{
|
||||
// 1 bits VBR
|
||||
assert((isVBR & 0x1) == isVBR);
|
||||
// 15 bits numPasses
|
||||
assert((numPasses & 0x7FFF) == numPasses);
|
||||
|
||||
return (isVBR << 15) | (numPasses);
|
||||
}
|
||||
|
||||
static void DecodeVBR(int data, BOOL &isVBR, DWORD &numPasses)
|
||||
{
|
||||
numPasses = data & 0x7FFF;
|
||||
data >>= 15;
|
||||
isVBR = data & 0x1;
|
||||
}
|
||||
|
||||
static void AutoSelect(HWND hwndDlg, int dlgItem)
|
||||
{
|
||||
if (SendDlgItemMessage(hwndDlg, dlgItem, CB_GETCURSEL, 0, 0) == CB_ERR)
|
||||
SendDlgItemMessage(hwndDlg, dlgItem, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
|
||||
static EncoderType *FindEncoder(int encoderNumber, BOOL isVBR, DWORD numPasses)
|
||||
{
|
||||
EncoderType* enc = encs;
|
||||
for (int i = 0;i < encNumbs;i++, enc++)
|
||||
{
|
||||
if (enc->encoderName == NULL)
|
||||
return 0; //WTF?
|
||||
if (enc->offset == encoderNumber && enc->vbr == isVBR && enc->numPasses == numPasses)
|
||||
return enc;
|
||||
}
|
||||
return 0; //WTF?
|
||||
}
|
||||
|
||||
#define MASK_ENCODER 0x1
|
||||
#define MASK_VBR 0x2
|
||||
#define MASK_SAMPLE_FORMAT 0x4
|
||||
#define MASK_BITRATE 0x8
|
||||
#define MASK_ALL 0xF
|
||||
|
||||
static void ResetConfig(HWND hwndDlg, EncoderType *encs, configtype *cfg, int mask)
|
||||
{
|
||||
wchar_t buf1[100] = {0};
|
||||
EncoderType* enc = encs;
|
||||
|
||||
if (mask & MASK_ENCODER) SendDlgItemMessage(hwndDlg, IDC_ENCODER, CB_RESETCONTENT, 0, 0);
|
||||
if (mask & MASK_SAMPLE_FORMAT) SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_RESETCONTENT, 0, 0);
|
||||
if (mask & MASK_BITRATE) SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_RESETCONTENT, 0, 0);
|
||||
if (mask & MASK_VBR) SendDlgItemMessage(hwndDlg, IDC_VBR, CB_RESETCONTENT, 0, 0);
|
||||
|
||||
// reset encoders
|
||||
int thisVBR = EncodeVBR(cfg->config_vbr, cfg->config_passes);
|
||||
for (int i = 0;i < encNumbs;i++, enc++)
|
||||
{
|
||||
if (enc->encoderName == NULL)
|
||||
break;
|
||||
else if ((mask & MASK_ENCODER) && !Has(hwndDlg, IDC_ENCODER, enc->offset))
|
||||
{
|
||||
int newpos = SendDlgItemMessage(hwndDlg, IDC_ENCODER, CB_ADDSTRING, 0, (LPARAM)enc->encoderName);
|
||||
SendDlgItemMessage(hwndDlg, IDC_ENCODER, CB_SETITEMDATA, newpos, enc->offset);
|
||||
|
||||
if (cfg->config_encoder == enc->offset)
|
||||
{
|
||||
SendDlgItemMessage(hwndDlg, IDC_ENCODER, CB_SETCURSEL, newpos, 0);
|
||||
}
|
||||
}
|
||||
int data = EncodeVBR(enc->vbr, enc->numPasses);
|
||||
if ((mask & MASK_VBR) && cfg->config_encoder == enc->offset && !Has(hwndDlg, IDC_VBR, data))
|
||||
{
|
||||
int newpos = CB_ERR;
|
||||
if (enc->vbr == FALSE && enc->numPasses == 1)
|
||||
newpos = SendDlgItemMessageW(hwndDlg, IDC_VBR, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_CBR));
|
||||
else if (enc->vbr == FALSE && enc->numPasses == 2)
|
||||
newpos = SendDlgItemMessageW(hwndDlg, IDC_VBR, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_2_PASS_CBR));
|
||||
else if (enc->vbr == TRUE && enc->numPasses == 1)
|
||||
newpos = SendDlgItemMessageW(hwndDlg, IDC_VBR, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_VBR));
|
||||
else if (enc->vbr == TRUE && enc->numPasses == 2)
|
||||
newpos = SendDlgItemMessageW(hwndDlg, IDC_VBR, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_ABR));
|
||||
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBR, CB_SETITEMDATA, newpos, data);
|
||||
|
||||
if (thisVBR == data)
|
||||
SendDlgItemMessage(hwndDlg, IDC_VBR, CB_SETCURSEL, newpos, 0);
|
||||
}
|
||||
}
|
||||
|
||||
AutoSelect(hwndDlg, IDC_ENCODER);
|
||||
AutoSelect(hwndDlg, IDC_VBR);
|
||||
int pos = SendDlgItemMessage(hwndDlg, IDC_VBR, CB_GETCURSEL, 0, 0);
|
||||
int data = SendDlgItemMessage(hwndDlg, IDC_VBR, CB_GETITEMDATA, pos, 0);
|
||||
DecodeVBR(data, cfg->config_vbr, cfg->config_passes);
|
||||
|
||||
pos = SendDlgItemMessage(hwndDlg, IDC_ENCODER, CB_GETCURSEL, 0, 0);
|
||||
data = SendDlgItemMessage(hwndDlg, IDC_ENCODER, CB_GETITEMDATA, pos, 0);
|
||||
cfg->config_encoder = data;
|
||||
|
||||
// Now set up for dialog fill
|
||||
enc = FindEncoder(cfg->config_encoder, cfg->config_vbr, cfg->config_passes);
|
||||
|
||||
// Fill the current values
|
||||
formatType *fmt = enc->formats;
|
||||
|
||||
int thisSampleFormat = EncodeSampleFormat(cfg->config_bitsSample, cfg->config_nch, cfg->config_samplesSec);
|
||||
for (int i = 0;i < enc->numFormats;i++, fmt++)
|
||||
{
|
||||
int data = EncodeSampleFormat(fmt->bitsSample, fmt->nChannels, fmt->samplesSec);
|
||||
// Add channels to list
|
||||
if ((mask & MASK_SAMPLE_FORMAT) && !Has(hwndDlg, IDC_SAMPLE_FORMAT, data))
|
||||
{
|
||||
if (fmt->nChannels == 1)
|
||||
wsprintfW(buf1, WASABI_API_LNGSTRINGW(IDS_MONO_INFO), fmt->bitsSample, fmt->samplesSec);
|
||||
else if (fmt->nChannels == 2)
|
||||
wsprintfW(buf1, WASABI_API_LNGSTRINGW(IDS_STEREO_INFO), fmt->bitsSample, fmt->samplesSec);
|
||||
else
|
||||
wsprintfW(buf1, WASABI_API_LNGSTRINGW(IDS_CHANNELS_INFO), fmt->bitsSample, fmt->nChannels, fmt->samplesSec);
|
||||
|
||||
int newpos;
|
||||
if (fmt->bitsSample)
|
||||
newpos = SendDlgItemMessageW(hwndDlg, IDC_SAMPLE_FORMAT, CB_ADDSTRING, 0, (LPARAM)buf1);
|
||||
else
|
||||
newpos = SendDlgItemMessageW(hwndDlg, IDC_SAMPLE_FORMAT, CB_ADDSTRING, 0, (LPARAM)buf1 + 8); // skip "0 bits, "
|
||||
|
||||
SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_SETITEMDATA, newpos, data);
|
||||
// Now set current select for number of channels sample
|
||||
if (thisSampleFormat == data)
|
||||
SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_SETCURSEL, newpos, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_GETCURSEL, 0, 0) == CB_ERR)
|
||||
{
|
||||
int num = SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_GETCOUNT, 0, 0);
|
||||
int defaultSampleFormat = EncodeSampleFormat(16, 2, 44100);
|
||||
for (int i = 0;i < num;i++)
|
||||
{
|
||||
int data = SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_GETITEMDATA, i, 0);
|
||||
if (data == defaultSampleFormat)
|
||||
SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_SETCURSEL, i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
AutoSelect(hwndDlg, IDC_SAMPLE_FORMAT);
|
||||
pos = SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_GETCURSEL, 0, 0);
|
||||
data = SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_GETITEMDATA, pos, 0);
|
||||
DecodeSampleFormat(data, cfg->config_bitsSample, cfg->config_nch, cfg->config_samplesSec);
|
||||
|
||||
thisSampleFormat = EncodeSampleFormat(cfg->config_bitsSample, cfg->config_nch, cfg->config_samplesSec);
|
||||
|
||||
// Next Show the Bitrates
|
||||
fmt = enc->formats;
|
||||
for (int i = 0;i < enc->numFormats;i++, fmt++)
|
||||
{
|
||||
int data = EncodeSampleFormat(fmt->bitsSample, fmt->nChannels, fmt->samplesSec);
|
||||
if (thisSampleFormat == data)
|
||||
{
|
||||
if ((mask & MASK_BITRATE) && !Has(hwndDlg, IDC_BRATE, fmt->bitrate))
|
||||
{
|
||||
if (fmt->vbr)
|
||||
SetDlgItemTextW(hwndDlg, IDC_STATIC_BITRATE, WASABI_API_LNGSTRINGW(IDS_QUALITY));
|
||||
else
|
||||
SetDlgItemTextW(hwndDlg, IDC_STATIC_BITRATE, WASABI_API_LNGSTRINGW(IDS_BITRATE));
|
||||
|
||||
wsprintfW(buf1, L"%d", fmt->bitrate);
|
||||
int newpos = SendDlgItemMessageW(hwndDlg, IDC_BRATE, CB_ADDSTRING, 0, (LPARAM)buf1);
|
||||
SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_SETITEMDATA, newpos, fmt->bitrate);
|
||||
// Set the current bit rate
|
||||
if (cfg->config_bitrate == fmt->bitrate)
|
||||
{
|
||||
SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_SETCURSEL, newpos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_GETCURSEL, 0, 0) == CB_ERR)
|
||||
{
|
||||
int num = SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_GETCOUNT, 0, 0);
|
||||
|
||||
for (int i = 0;i < num;i++)
|
||||
{
|
||||
int data = SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_GETITEMDATA, i, 0);
|
||||
if (data == 50 || (data / 1000 == 128))
|
||||
SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_SETCURSEL, i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
AutoSelect(hwndDlg, IDC_BRATE);
|
||||
|
||||
pos = SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_GETCURSEL, 0, 0);
|
||||
data = SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_GETITEMDATA, pos, 0);
|
||||
cfg->config_bitrate = data;
|
||||
}
|
||||
|
||||
BOOL CALLBACK ConfigProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
configwndrec *wc = NULL;
|
||||
if (uMsg == WM_INITDIALOG)
|
||||
{
|
||||
// LGIVEN Mod 4-10-05
|
||||
#if defined(_WIN64)
|
||||
SetWindowLong(hwndDlg, GWLP_USERDATA, lParam);
|
||||
#else
|
||||
SetWindowLong(hwndDlg, GWL_USERDATA, lParam);
|
||||
#endif
|
||||
if (lParam)
|
||||
{
|
||||
// Get the saved params
|
||||
wc = (configwndrec*)lParam;
|
||||
|
||||
loadWMATables();
|
||||
ResetConfig(hwndDlg, encs , &wc->cfg, MASK_ALL);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (uMsg == WM_DESTROY)
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
wc = (configwndrec*)SetWindowLong(hwndDlg, GWLP_USERDATA, 0);
|
||||
#else
|
||||
wc = (configwndrec*)SetWindowLong(hwndDlg, GWL_USERDATA, 0);
|
||||
#endif
|
||||
if (wc)
|
||||
{
|
||||
EncoderType *encoder=FindEncoder(wc->cfg.config_encoder,wc->cfg.config_vbr, wc->cfg.config_passes);
|
||||
int formatNumber = FindFormatNumber(encoder->formats, encoder->numFormats, &wc->cfg);
|
||||
// Dump the profile in WMA format
|
||||
dumpProfile(wc->configfile, wc->cfg.config_vbr, wc->cfg.config_passes, wc->cfg.config_encoder, formatNumber);
|
||||
// Write it to config file
|
||||
writeconfig(wc->configfile, &wc->cfg);
|
||||
free(wc->configfile);
|
||||
free(wc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (uMsg == WM_COMMAND)
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_VBR:
|
||||
if ((HIWORD(wParam) == CBN_SELCHANGE))
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
wc = (configwndrec*)GetWindowLong(hwndDlg, GWLP_USERDATA);
|
||||
#else
|
||||
wc = (configwndrec*)GetWindowLong(hwndDlg, GWL_USERDATA);
|
||||
#endif
|
||||
int pos = SendDlgItemMessage(hwndDlg, IDC_VBR, CB_GETCURSEL, 0, 0);
|
||||
int data = SendDlgItemMessage(hwndDlg, IDC_VBR, CB_GETITEMDATA, pos, 0);
|
||||
DecodeVBR(data, wc->cfg.config_vbr, wc->cfg.config_passes);
|
||||
ResetConfig(hwndDlg, encs, &wc->cfg, MASK_BITRATE | MASK_SAMPLE_FORMAT);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_SAMPLE_FORMAT:
|
||||
if ((HIWORD(wParam) == CBN_SELCHANGE))
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
wc = (configwndrec*)GetWindowLong(hwndDlg, GWLP_USERDATA);
|
||||
#else
|
||||
wc = (configwndrec*)GetWindowLong(hwndDlg, GWL_USERDATA);
|
||||
#endif
|
||||
int pos = SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_GETCURSEL, 0, 0);
|
||||
int data = SendDlgItemMessage(hwndDlg, IDC_SAMPLE_FORMAT, CB_GETITEMDATA, pos, 0);
|
||||
DecodeSampleFormat(data, wc->cfg.config_bitsSample, wc->cfg.config_nch, wc->cfg.config_samplesSec);
|
||||
ResetConfig(hwndDlg, encs, &wc->cfg, MASK_BITRATE);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_BRATE:
|
||||
if ((HIWORD(wParam) == CBN_SELCHANGE))
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
wc = (configwndrec*)GetWindowLong(hwndDlg, GWLP_USERDATA);
|
||||
#else
|
||||
wc = (configwndrec*)GetWindowLong(hwndDlg, GWL_USERDATA);
|
||||
#endif
|
||||
int pos = SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_GETCURSEL, 0, 0);
|
||||
int data = SendDlgItemMessage(hwndDlg, IDC_BRATE, CB_GETITEMDATA, pos, 0);
|
||||
wc->cfg.config_bitrate = data;
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_ENCODER:
|
||||
if ((HIWORD(wParam) == CBN_SELCHANGE))
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
wc = (configwndrec*)GetWindowLong(hwndDlg, GWLP_USERDATA);
|
||||
#else
|
||||
wc = (configwndrec*)GetWindowLong(hwndDlg, GWL_USERDATA);
|
||||
#endif
|
||||
if (wc)
|
||||
{
|
||||
int pos = SendDlgItemMessage(hwndDlg, IDC_ENCODER, CB_GETCURSEL, 0, 0);
|
||||
int data = SendDlgItemMessage(hwndDlg, IDC_ENCODER, CB_GETITEMDATA, pos, 0);
|
||||
wc->cfg.config_encoder = data;
|
||||
ResetConfig(hwndDlg, encs, &wc->cfg, MASK_VBR | MASK_SAMPLE_FORMAT | MASK_BITRATE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
128
Src/Plugins/Encoder/enc_wma/enc_wma.rc
Normal file
128
Src/Plugins/Encoder/enc_wma/enc_wma.rc
Normal file
|
@ -0,0 +1,128 @@
|
|||
// 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
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG1 DIALOGEX 0, 0, 256, 167
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
GROUPBOX "Windows Media Audio",IDC_STATIC,0,0,256,167
|
||||
COMBOBOX IDC_ENCODER,18,13,145,148,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Encoder Format",IDC_STATIC,166,13,60,12,SS_CENTERIMAGE
|
||||
COMBOBOX IDC_SAMPLE_FORMAT,17,30,145,133,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Sample Format",IDC_STATIC,166,30,71,12,SS_CENTERIMAGE
|
||||
COMBOBOX IDC_VBR,18,48,59,67,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_BRATE,86,48,77,116,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Bitrate (Bits/Sec)",IDC_STATIC_BITRATE,165,48,54,12,SS_CENTERIMAGE
|
||||
CTEXT "Portions utilize Microsoft Windows Media Technologies.\nCopyright © 1992-2019 Microsoft Corporation. All Rights Reserved.",IDC_STATIC,14,144,227,18
|
||||
END
|
||||
|
||||
|
||||
#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
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
65535 "{33BC12FD-E7F7-42ec-8FE3-2D8BD3A977C2}"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_CANNOT_FIND_INPUT_FORMATTER
|
||||
"Cannot find input formatter for:\n\nChannels = %d, Sample Rate = %d, Bits/Sample = %d\n\nNo resampler available for this input format"
|
||||
IDS_WARNING "WARNING"
|
||||
IDS_CANNOT_ALLOCATE_MEM "Cannot allocate memory for WMA encoder format info"
|
||||
IDS_WMA_ENCODER_ERROR "WMA Encoder Error"
|
||||
IDS_CANNOT_GET_STRUCTURE "Cannot get structure with format details"
|
||||
IDS_CANNOT_GET_ENCODER4_INFO "Cannot get detail info for Encoder4 format"
|
||||
IDS_SAVE_PROFILE_READ_ERROR "Save profile read error"
|
||||
IDS_MEM_ALLOCATION_ERROR "Memory allocation error"
|
||||
IDS_PROFILE_SAVE_SIZE_ERROR "Profile save size get error"
|
||||
IDS_CANNOT_READ_AUDIO_STREAM "Cannot create audio stream"
|
||||
IDS_CANNOT_GET_CODEC_INFO "Cannot get codec interface"
|
||||
IDS_CANNOT_CREATE_A_PROFILE "Cannot create a profile"
|
||||
IDS_CANNOT_CREATE_PROFILE_MANAGER "Cannot create a profile manager"
|
||||
IDS_WMA_CONFIG_FILE_ERROR "WMA Config File Error"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_CBR "CBR"
|
||||
IDS_2_PASS_CBR "2-pass CBR"
|
||||
IDS_VBR "VBR"
|
||||
IDS_ABR "ABR"
|
||||
IDS_MONO_INFO "%d bits, mono, %d Hz"
|
||||
IDS_STEREO_INFO "%d bits, stereo, %d Hz"
|
||||
IDS_CHANNELS_INFO "%d bits, %d channels, %d Hz"
|
||||
IDS_QUALITY "Quality (0-100)"
|
||||
IDS_BITRATE "Bitrate (Bits/Sec)"
|
||||
IDS_ENC_WMA_DESC "WMA Encoder %s"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#include "version.rc2"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
30
Src/Plugins/Encoder/enc_wma/enc_wma.sln
Normal file
30
Src/Plugins/Encoder/enc_wma/enc_wma.sln
Normal file
|
@ -0,0 +1,30 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29613.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enc_wma", "enc_wma.vcxproj", "{5F4B0989-B35B-40C0-BAA1-E7058377B398}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5F4B0989-B35B-40C0-BAA1-E7058377B398}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5F4B0989-B35B-40C0-BAA1-E7058377B398}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5F4B0989-B35B-40C0-BAA1-E7058377B398}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5F4B0989-B35B-40C0-BAA1-E7058377B398}.Debug|x64.Build.0 = Debug|x64
|
||||
{5F4B0989-B35B-40C0-BAA1-E7058377B398}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5F4B0989-B35B-40C0-BAA1-E7058377B398}.Release|Win32.Build.0 = Release|Win32
|
||||
{5F4B0989-B35B-40C0-BAA1-E7058377B398}.Release|x64.ActiveCfg = Release|x64
|
||||
{5F4B0989-B35B-40C0-BAA1-E7058377B398}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {424261B8-8392-4100-A876-CD8560D5D1AC}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
276
Src/Plugins/Encoder/enc_wma/enc_wma.vcxproj
Normal file
276
Src/Plugins/Encoder/enc_wma/enc_wma.vcxproj
Normal file
|
@ -0,0 +1,276 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{5F4B0989-B35B-40C0-BAA1-E7058377B398}</ProjectGuid>
|
||||
<RootNamespace>enc_wma</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg">
|
||||
<VcpkgEnabled>false</VcpkgEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
<VcpkgTriplet>
|
||||
</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<VcpkgTriplet>
|
||||
</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NSV_CODER_WMA_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>wmvcore.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;NSV_CODER_WMA_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>4244;4312;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>wmvcore.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NSV_CODER_WMA_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/ignore:4210 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>wmvcore.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>.;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;NSV_CODER_WMA_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>4244;4312;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/ignore:4210 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>wmvcore.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command>
|
||||
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AudioCoderWMA.cpp" />
|
||||
<ClCompile Include="config.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AudioCoderWMA.h" />
|
||||
<ClInclude Include="CustomWMWriterSink.h" />
|
||||
<ClInclude Include="main.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_wma.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj">
|
||||
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
44
Src/Plugins/Encoder/enc_wma/enc_wma.vcxproj.filters
Normal file
44
Src/Plugins/Encoder/enc_wma/enc_wma.vcxproj.filters
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AudioCoderWMA.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AudioCoderWMA.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CustomWMWriterSink.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="main.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{497dbf34-c784-481d-bc15-343f4d25c508}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Ressource Files">
|
||||
<UniqueIdentifier>{a60f8eac-325c-466b-8a17-69b1064e57fb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{33266828-89ee-4119-b784-03c8edaad9a1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="enc_wma.rc">
|
||||
<Filter>Ressource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
212
Src/Plugins/Encoder/enc_wma/main.cpp
Normal file
212
Src/Plugins/Encoder/enc_wma/main.cpp
Normal file
|
@ -0,0 +1,212 @@
|
|||
/*
|
||||
** nsv_coder_lame: main.cpp - LAME mp3 encoder plug-in
|
||||
** (requires lame_enc.dll)
|
||||
**
|
||||
** Copyright (C) 2001-2006 Nullsoft, Inc.
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied warranty.
|
||||
** In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
**
|
||||
** Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
** applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the
|
||||
** original software. If you use this software in a product, an acknowledgment in the product
|
||||
** documentation would be appreciated but is not required.
|
||||
** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as
|
||||
** being the original software.
|
||||
** 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#define ENC_VERSION "v1.23"
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <wmsdk.h>
|
||||
|
||||
#include <mmreg.h>
|
||||
#include <msacm.h>
|
||||
|
||||
#include "AudioCoderWMA.h"
|
||||
#include "../nu/AutoWideFn.h"
|
||||
|
||||
// wasabi based services for localisation support
|
||||
#include <api/service/waServiceFactory.h>
|
||||
#include "../Agave/Language/api_language.h"
|
||||
#include "../winamp/wa_ipc.h"
|
||||
|
||||
#include <strsafe.h>
|
||||
|
||||
HWND winampwnd = 0;
|
||||
api_service *WASABI_API_SVC = 0;
|
||||
api_language *WASABI_API_LNG = 0;
|
||||
HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int getwrittentime();
|
||||
|
||||
HINSTANCE g_hinst;
|
||||
|
||||
int g_srate, g_numchan, g_bps;
|
||||
volatile int writtentime, w_offset;
|
||||
|
||||
// LGIVEN Mod 4-10-05
|
||||
void readconfig(char *configfile, configtype *cfg);
|
||||
void writeconfig(char *configfile, configtype *cfg);
|
||||
|
||||
static HINSTANCE GetMyInstance()
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi = {0};
|
||||
if(VirtualQuery(GetMyInstance, &mbi, sizeof(mbi)))
|
||||
return (HINSTANCE)mbi.AllocationBase;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GetLocalisationApiService(void)
|
||||
{
|
||||
if(!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_LNG)
|
||||
{
|
||||
waServiceFactory *sf;
|
||||
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(),EncWMALangGUID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ==================================================================
|
||||
//
|
||||
// Published enc_wma methods.
|
||||
//
|
||||
// ==================================================================
|
||||
#include <cassert>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
unsigned int __declspec(dllexport) GetAudioTypes3(int idx, char *desc)
|
||||
{
|
||||
if ( idx == 0 )
|
||||
{
|
||||
GetLocalisationApiService();
|
||||
StringCchPrintfA(desc, 1024, WASABI_API_LNGSTRING(IDS_ENC_WMA_DESC), ENC_VERSION);
|
||||
return mmioFOURCC('W', 'M', 'A', ' ');
|
||||
}
|
||||
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', ' ') && *outt == mmioFOURCC('W', 'M', 'A', ' '))
|
||||
{
|
||||
GetLocalisationApiService();
|
||||
configtype cfg;
|
||||
readconfig(configfile, &cfg);
|
||||
|
||||
AudioCoderWMA *t = new AudioCoderWMA(nch, srate, bps, &cfg, configfile);
|
||||
|
||||
if ( t && t->GetLastError())
|
||||
{
|
||||
delete t;
|
||||
return NULL;
|
||||
}
|
||||
else return t;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) FinishAudio3(const char *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCoderWMA*)coder)->OnFinished(AutoWideFn(filename));
|
||||
}
|
||||
|
||||
void __declspec(dllexport) FinishAudio3W(const wchar_t *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCoderWMA*)coder)->OnFinished(filename);
|
||||
}
|
||||
|
||||
void __declspec(dllexport) PrepareToFinish(const char *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCoderWMA*)coder)->PrepareToFinish();
|
||||
}
|
||||
|
||||
void __declspec(dllexport) PrepareToFinishW(const wchar_t *filename, AudioCoder *coder)
|
||||
{
|
||||
((AudioCoderWMA*)coder)->PrepareToFinish();
|
||||
}
|
||||
|
||||
HWND __declspec(dllexport) ConfigAudio3(HWND hwndParent, HINSTANCE hinst, unsigned int outt, char *configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('W', 'M', 'A', ' '))
|
||||
{
|
||||
configwndrec *wr = (configwndrec*)malloc(sizeof(configwndrec));
|
||||
if (configfile)
|
||||
{
|
||||
wr->configfile = _strdup(configfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
wr->configfile = 0;
|
||||
}
|
||||
readconfig(configfile, &wr->cfg);
|
||||
GetLocalisationApiService();
|
||||
return WASABI_API_CREATEDIALOGPARAMW(IDD_DIALOG1, hwndParent, ConfigProc, (LPARAM)wr);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) SetConfigItem(unsigned int outt, char *item, char *data, char *configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('W', 'M', 'A', ' '))
|
||||
{
|
||||
configtype cfg;
|
||||
readconfig(configfile, &cfg);
|
||||
if (!lstrcmpiA(item, "bitrate"))
|
||||
{
|
||||
//cfg.config_bitrate = atoi(data) * 1000;
|
||||
}
|
||||
writeconfig(configfile, &cfg);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __declspec(dllexport) GetConfigItem(unsigned int outt, char *item, char *data, int len, char *configfile)
|
||||
{
|
||||
if (outt == mmioFOURCC('W', 'M', 'A', ' '))
|
||||
{
|
||||
configtype cfg;
|
||||
readconfig(configfile, &cfg);
|
||||
if (!lstrcmpiA(item, "bitrate"))
|
||||
{
|
||||
StringCchPrintfA(data, len, "%d", cfg.config_bitrate / 1000);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __declspec(dllexport) SetWinampHWND(HWND hwnd)
|
||||
{
|
||||
winampwnd = hwnd;
|
||||
}
|
||||
};
|
55
Src/Plugins/Encoder/enc_wma/main.h
Normal file
55
Src/Plugins/Encoder/enc_wma/main.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../nsv/enc_if.h"
|
||||
#include "resource.h"
|
||||
|
||||
// LGIVEN Mods 4-25-05
|
||||
// Config info saved in Winamp.ini [enc_wma]---conf=xxxxxxxxxxx
|
||||
typedef struct
|
||||
{
|
||||
int config_nch; // Number of channels of encoder/fmt selected
|
||||
int config_bitrate; // Bitrate of encoder/fmt selected
|
||||
int config_bitsSample; // Bits/Sample of encoder/fmt selected
|
||||
int config_samplesSec; // Sample rate of encoder/fmt selected
|
||||
int config_encoder; // Encoder offset in table in Config Dialog
|
||||
BOOL config_vbr; // VBR or not
|
||||
DWORD config_passes; // number of passes (1 or 2)
|
||||
}
|
||||
configtype;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
configtype cfg; // config type struct
|
||||
char *configfile; // Name of config file (...\Winamp.ini)
|
||||
}
|
||||
configwndrec;
|
||||
|
||||
// Data table values in Config Dialog
|
||||
// One of these for each format
|
||||
|
||||
struct formatType
|
||||
{
|
||||
wchar_t *formatName; // Format Name (for display)
|
||||
int offset; // offset in WMEncoder for this Encoder
|
||||
int nChannels; // number of channels
|
||||
int bitsSample; // Bits per sample
|
||||
int samplesSec; // Samples per sec
|
||||
int bitrate; // Bitrate value
|
||||
int vbr;
|
||||
};
|
||||
|
||||
// One of these for each encoder
|
||||
struct EncoderType
|
||||
{
|
||||
wchar_t *encoderName; // Encoder name (for display)
|
||||
int offset; // Offset in WMEncoder
|
||||
int numFormats; // Number of formats in WMEncoder for this encoder
|
||||
struct _GUID mediaType; // Media type GUID
|
||||
BOOL vbr;
|
||||
DWORD numPasses;
|
||||
formatType* formats;
|
||||
};
|
||||
|
||||
|
||||
BOOL CALLBACK ConfigProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
1631
Src/Plugins/Encoder/enc_wma/nserror.h
Normal file
1631
Src/Plugins/Encoder/enc_wma/nserror.h
Normal file
File diff suppressed because it is too large
Load diff
57
Src/Plugins/Encoder/enc_wma/resource.h
Normal file
57
Src/Plugins/Encoder/enc_wma/resource.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by Script1.rc
|
||||
//
|
||||
#define IDS_CANNOT_FIND_INPUT_FORMATTER 0
|
||||
#define IDS_WARNING 1
|
||||
#define IDOK2 2
|
||||
#define IDS_CANNOT_ALLOCATE_MEM 2
|
||||
#define IDS_WMA_ENCODER_ERROR 3
|
||||
#define IDS_CANNOT_GET_STRUCTURE 4
|
||||
#define IDS_CANNOT_GET_ENCODER4_INFO 5
|
||||
#define IDS_SAVE_PROFILE_READ_ERROR 6
|
||||
#define IDS_MEM_ALLOCATION_ERROR 7
|
||||
#define IDS_PROFILE_SAVE_SIZE_ERROR 8
|
||||
#define IDS_CANNOT_READ_AUDIO_STREAM 9
|
||||
#define IDS_CANNOT_GET_CODEC_INFO 10
|
||||
#define IDS_CANNOT_CREATE_A_PROFILE 11
|
||||
#define IDS_CANNOT_CREATE_PROFILE_MANAGER 12
|
||||
#define IDS_WMA_CONFIG_FILE_ERROR 13
|
||||
#define IDS_CBR 16
|
||||
#define IDS_2_PASS_CBR 17
|
||||
#define IDS_VBR 18
|
||||
#define IDS_ABR 19
|
||||
#define IDS_MONO_INFO 20
|
||||
#define IDS_STEREO_INFO 21
|
||||
#define IDS_CHANNELS_INFO 22
|
||||
#define IDS_QUALITY 23
|
||||
#define IDS_BITRATE 24
|
||||
#define IDS_ENC_WMA_DESC 25
|
||||
#define IDD_DIALOG1 101
|
||||
#define IDC_DIR 1000
|
||||
#define IDC_SRATE 1001
|
||||
#define IDC_BRATE 1002
|
||||
#define IDC_NCH 1003
|
||||
#define IDC_PROFILE 1004
|
||||
#define IDC_ABRATE 1005
|
||||
#define IDC_CBR 1005
|
||||
#define IDC_ENCODER 1006
|
||||
#define IDC_BPSAMPLE 1007
|
||||
#define IDC_VBR 1008
|
||||
#define IDC_1PASS 1009
|
||||
#define IDC_RADIO4 1010
|
||||
#define IDC_2PASS 1010
|
||||
#define IDC_STATIC_BITRATE 1011
|
||||
#define IDC_SAMPLE_FORMAT 1012
|
||||
#define IDC_COMBO1 1013
|
||||
|
||||
// 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 1014
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
39
Src/Plugins/Encoder/enc_wma/version.rc2
Normal file
39
Src/Plugins/Encoder/enc_wma/version.rc2
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
#include "../../../Winamp/buildType.h"
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,23,0,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,23,0,0"
|
||||
VALUE "InternalName", "Nullsoft WMA Encoder"
|
||||
VALUE "LegalCopyright", "Copyright © 2006-2023 Winamp SA"
|
||||
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
|
||||
VALUE "OriginalFilename", "enc_wma.dll"
|
||||
VALUE "ProductName", "Winamp"
|
||||
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
1009
Src/Plugins/Encoder/enc_wma/wmaudiosdk.h
Normal file
1009
Src/Plugins/Encoder/enc_wma/wmaudiosdk.h
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue