![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#1
|
|||
|
|||
|
Есть dll'ка (исходники насколько понял в папке libfaac) написанная на C мне нужно использовать ее в Delphi. Люди, знающие и то и то, помогите! Нужно написать pas-файлик в котором импортируются следующие фунции:
Код:
faacEncClose faacEncEncode faacEncGetCurrentConfiguration faacEncGetDecoderSpecificInfo faacEncGetVersion faacEncOpen faacEncSetConfiguration Последний раз редактировалось Proger10, 18.05.2010 в 15:47. |
|
#2
|
||||
|
||||
|
А зачем переводить??? dll для того был и создан чтоб процедуры написанные на одном языке легко использовались в программах написаных на другом.
|
|
#3
|
|||
|
|||
|
Это понятно! Но какие параметры нужны процедурам? Там вроде есть записи, значит их надо описать. Для этого нужны хоть какие-то знания языка на котором написана dll, которых у меня к сожалению пока нет..
|
|
#4
|
||||
|
||||
|
Если ты знаешь язык турбо паскаль то чтоб выучить с++ много времени не нужно. За 10 мин я думаю ты поймешь как в си записываются записи процедуры и функции.
Если умеешь ездить на лигковом автомобиле то на грузовик пересесть не сложно))) |
|
#5
|
|||
|
|||
|
Я вообще ни чего не понимаю! Начал попорядку - с фунцкции faacEncGetVersion. char **faac_id_string по идеи должен быть в Delphi faac_id_string: array of string, *faac_id_string = libfaacName по идеи - запись в первый элемент массива, но ничего не работает, чисто интуитивно догадался, что надо писать так:
Код:
function faacEncGetVersion(var faac_id_string, faac_copyright_string: string):integer; stdcall; external 'libfaac.dll'; Код:
procedure TForm1.Button1Click(Sender: TObject); var s1, s2: string; i1: integer; begin i1:=faacEncGetVersion(s1, s2); ShowMessage(IntToStr(i1)); ShowMessage(s1); ShowMessage(s2); end; Последний раз редактировалось Proger10, 16.05.2010 в 07:44. |
|
#6
|
|||
|
|||
|
upupupupup
|
|
#7
|
||||
|
||||
|
Какие заголовки функций на сях? какие там типы указаны?...
|
|
#8
|
|||
|
|||
|
Заголовки:
Код:
int __stdcall faacEncGetVersion(char **faac_id_string, char **faac_copyright_string); int __stdcall faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder, unsigned char** ppBuffer, unsigned long* pSizeOfDecoderSpecificInfo); int __stdcall faacEncSetConfiguration (faacEncHandle hEncoder, faacEncConfigurationPtr config); int __stdcall faacEncEncode(faacEncHandle hEncoder, int32_t *inputBuffer, unsigned int samplesInput, unsigned char *outputBuffer, unsigned int bufferSize); int __stdcall faacEncClose(faacEncHandle hEncoder); faacEncHandle __stdcall faacEncOpen(unsigned long sampleRate, unsigned int numChannels, unsigned long *inputSamples, unsigned long *maxOutputBytes); faacEncConfigurationPtr __stdcall faacEncGetCurrentConfiguration(faacEncHandle hEncoder) Код:
typedef struct {
/* number of channels in AAC file */
unsigned int numChannels;
/* samplerate of AAC file */
unsigned long sampleRate;
unsigned int sampleRateIdx;
unsigned int usedBytes;
/* frame number */
unsigned int frameNum;
unsigned int flushFrame;
/* Scalefactorband data */
SR_INFO *srInfo;
/* sample buffers of current next and next next frame*/
double *sampleBuff[MAX_CHANNELS];
double *nextSampleBuff[MAX_CHANNELS];
double *next2SampleBuff[MAX_CHANNELS];
double *next3SampleBuff[MAX_CHANNELS];
double *ltpTimeBuff[MAX_CHANNELS];
/* Filterbank buffers */
double *sin_window_long;
double *sin_window_short;
double *kbd_window_long;
double *kbd_window_short;
double *freqBuff[MAX_CHANNELS];
double *overlapBuff[MAX_CHANNELS];
double *msSpectrum[MAX_CHANNELS];
/* Channel and Coder data for all channels */
CoderInfo coderInfo[MAX_CHANNELS];
ChannelInfo channelInfo[MAX_CHANNELS];
/* Psychoacoustics data */
PsyInfo psyInfo[MAX_CHANNELS];
GlobalPsyInfo gpsyInfo;
/* Configuration data */
faacEncConfiguration config;
psymodel_t *psymodel;
/* quantizer specific config */
AACQuantCfg aacquantCfg;
/* FFT Tables */
FFT_Tables fft_tables;
/* output bits difference in average bitrate mode */
int bitDiff;
} faacEncStruct, *faacEncHandle;
typedef struct faacEncConfiguration
{
/* config version */
int version;
/* library version */
char *name;
/* copyright string */
char *copyright;
/* MPEG version, 2 or 4 */
unsigned int mpegVersion;
/* AAC object type */
unsigned int aacObjectType;
/* Allow mid/side coding */
unsigned int allowMidside;
/* Use one of the channels as LFE channel */
unsigned int useLfe;
/* Use Temporal Noise Shaping */
unsigned int useTns;
/* bitrate / channel of AAC file */
unsigned long bitRate;
/* AAC file frequency bandwidth */
unsigned int bandWidth;
/* Quantizer quality */
unsigned long quantqual;
/* Bitstream output format (0 = Raw; 1 = ADTS) */
unsigned int outputFormat;
/* psychoacoustic model list */
psymodellist_t *psymodellist;
/* selected index in psymodellist */
unsigned int psymodelidx;
/*
PCM Sample Input Format
0 FAAC_INPUT_NULL invalid, signifies a misconfigured config
1 FAAC_INPUT_16BIT native endian 16bit
2 FAAC_INPUT_24BIT native endian 24bit in 24 bits (not implemented)
3 FAAC_INPUT_32BIT native endian 24bit in 32 bits (DEFAULT)
4 FAAC_INPUT_FLOAT 32bit floating point
*/
unsigned int inputFormat;
/* block type enforcing (SHORTCTL_NORMAL/SHORTCTL_NOSHORT/SHORTCTL_NOLONG) */
int shortctl;
/*
Channel Remapping
Default 0, 1, 2, 3 ... 63 (64 is MAX_CHANNELS in coder.h)
WAVE 4.0 2, 0, 1, 3
WAVE 5.0 2, 0, 1, 3, 4
WAVE 5.1 2, 0, 1, 4, 5, 3
AIFF 5.1 2, 0, 3, 1, 4, 5
*/
int channel_map[64];
} faacEncConfiguration, *faacEncConfigurationPtr;
static SR_INFO srInfo[12+1] =
{
{ 96000, 41, 12,
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 16, 16, 24, 28,
36, 44, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
},{
4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 36
}
}, { 88200, 41, 12,
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 16, 16, 24, 28,
36, 44, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
},{
4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 36
}
}, { 64000, 47, 12,
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
8, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 24, 24, 28,
36, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40
},{
4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 32
}
}, { 48000, 49, 14,
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 96
}, {
4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16
}
}, { 44100, 49, 14,
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 96
}, {
4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16
}
}, { 32000, 51, 14,
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8,
8, 8, 8, 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28,
28, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32
},{
4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16
}
}, { 24000, 47, 15,
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 12, 12, 12, 12, 16, 16, 16, 20, 20, 24, 24, 28, 28, 32,
36, 36, 40, 44, 48, 52, 52, 64, 64, 64, 64, 64
}, {
4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 20
}
}, { 22050, 47, 15,
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 12, 12, 12, 12, 16, 16, 16, 20, 20, 24, 24, 28, 28, 32,
36, 36, 40, 44, 48, 52, 52, 64, 64, 64, 64, 64
}, {
4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 20
}
}, { 16000, 43, 15,
{
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12,
12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24,
24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64
}, {
4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20
}
}, { 12000, 43, 15,
{
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12,
12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24,
24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64
}, {
4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20
}
}, { 11025, 43, 15,
{
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12,
12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24,
24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64
}, {
4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20
}
}, { 8000, 40, 15,
{
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16,
16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 24, 24, 24, 28,
28, 32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80
}, {
4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 20
}
},
{ -1 }
};Последний раз редактировалось Proger10, 18.05.2010 в 19:41. |
|
#9
|
|||
|
|||
|
...последовало.
Код:
typedef struct {
int window_shape;
int prev_window_shape;
int block_type;
int desired_block_type;
int global_gain;
int scale_factor[MAX_SCFAC_BANDS];
int num_window_groups;
int window_group_length[8];
int max_sfb;
int nr_of_sfb;
int sfb_offset[250];
int lastx;
double avgenrg;
int spectral_count;
/* Huffman codebook selected for each sf band */
int book_vector[MAX_SCFAC_BANDS];
/* Data of spectral bitstream elements, for each spectral pair,
5 elements are required: 1*(esc)+2*(sign)+2*(esc value)=5 */
int *data;
/* Lengths of spectral bitstream elements */
int *len;
/* Holds the requantized spectrum */
double *requantFreq;
TnsInfo tnsInfo;
LtpInfo ltpInfo;
BwpInfo bwpInfo;
int max_pred_sfb;
int pred_global_flag;
int pred_sfb_flag[MAX_SCFAC_BANDS];
int reset_group_number;
} CoderInfo;
typedef struct {
int tag;
int present;
int ch_is_left;
int paired_ch;
int common_window;
int cpe;
int sce;
int lfe;
MSInfo msInfo;
} ChannelInfo;
typedef struct {
int size;
int sizeS;
/* Previous input samples */
double *prevSamples;
double *prevSamplesS;
int block_type;
void *data;
} PsyInfo;
typedef struct {
double sampleRate;
/* Hann window */
double *hannWindow;
double *hannWindowS;
void *data;
} GlobalPsyInfo;
typedef struct
{
void (*PsyInit) (GlobalPsyInfo *gpsyInfo, PsyInfo *psyInfo,
unsigned int numChannels, unsigned int sampleRate,
int *cb_width_long, int num_cb_long,
int *cb_width_short, int num_cb_short);
void (*PsyEnd) (GlobalPsyInfo *gpsyInfo, PsyInfo *psyInfo,
unsigned int numChannels);
void (*PsyCalculate) (ChannelInfo *channelInfo, GlobalPsyInfo *gpsyInfo,
PsyInfo *psyInfo, int *cb_width_long, int num_cb_long,
int *cb_width_short, int num_cb_short,
unsigned int numChannels);
void (*PsyBufferUpdate) ( FFT_Tables *fft_tables, GlobalPsyInfo * gpsyInfo, PsyInfo * psyInfo,
double *newSamples, unsigned int bandwidth,
int *cb_width_short, int num_cb_short);
void (*BlockSwitch) (CoderInfo *coderInfo, PsyInfo *psyInfo,
unsigned int numChannels);
} psymodel_t;
typedef struct
{
double *pow43;
double *adj43;
double quality;
} AACQuantCfg;
typedef struct
{
fftfloat **costbl;
fftfloat **negsintbl;
unsigned short **reordertbl;
} FFT_Tables;
typedef struct {
int order; /* Filter order */
int direction; /* Filtering direction */
int coefCompress; /* Are coeffs compressed? */
int length; /* Length, in bands */
double aCoeffs[TNS_MAX_ORDER+1]; /* AR Coefficients */
double kCoeffs[TNS_MAX_ORDER+1]; /* Reflection Coefficients */
int index[TNS_MAX_ORDER+1]; /* Coefficient indices */
} TnsFilterData;
typedef struct {
int numFilters; /* Number of filters */
int coefResolution; /* Coefficient resolution */
TnsFilterData tnsFilter[1<<LEN_TNS_NFILTL]; /* TNS filters */
} TnsWindowData;
typedef struct {
int tnsDataPresent;
int tnsMinBandNumberLong;
int tnsMinBandNumberShort;
int tnsMaxBandsLong;
int tnsMaxBandsShort;
int tnsMaxOrderLong;
int tnsMaxOrderShort;
TnsWindowData windowData[MAX_SHORT_WINDOWS]; /* TNS data per window */
} TnsInfo;
typedef struct
{
int weight_idx;
double weight;
int sbk_prediction_used[MAX_SHORT_WINDOWS];
int sfb_prediction_used[MAX_SCFAC_BANDS];
int delay[MAX_SHORT_WINDOWS];
int global_pred_flag;
int side_info;
double *buffer;
double *mdct_predicted;
double *time_buffer;
double *ltp_overlap_buffer;
} LtpInfo;
typedef struct
{
int psy_init_mc;
double dr_mc[LPC][BLOCK_LEN_LONG],e_mc[LPC+1+1][BLOCK_LEN_LONG];
double K_mc[LPC+1][BLOCK_LEN_LONG], R_mc[LPC+1][BLOCK_LEN_LONG];
double VAR_mc[LPC+1][BLOCK_LEN_LONG], KOR_mc[LPC+1][BLOCK_LEN_LONG];
double sb_samples_pred_mc[BLOCK_LEN_LONG];
int thisLineNeedsResetting_mc[BLOCK_LEN_LONG];
int reset_count_mc;
} BwpInfo;
typedef struct {
int is_present;
int ms_used[MAX_SCFAC_BANDS];
} MSInfo;
typedef float fftfloat; |