libdcaenc.so shared library
The library may be useful if you want to create DTS streams in your own application. To do so, you have to call the following functions declared in the <dcaenc.h> header:
This function creates a library context according to its parameters. The resulting context is an opaque value that should be passed to the other library functions as the first parameter.
The sample rate must be one of the following values: 32000, 44100, 48000 or those divided by 2 or 4.
The channel configuration is one of the DCAENC_CHANNELS_* defines listed in the dcaenc.h header. Note that values greater than DCAENC_CHANNELS_3FRONT_2REAR always return an error now because their encoding requires the Xch extension that is undocumented and thus not implemented. Only non-LFE channels have to be specified here.
The approximate bitrate is specified in bits per second and may be rounded up by the library.
The flags parameter should be a logical OR of zero or more of the DCAENC_FLAG_* defines. Their meanings:
On any error, dcaenc_create() returns NULL. There is no way to find out the reason for the error.
int dcaenc_bitrate(dcaenc_context c);
Returns the actual bitrate that is used by the library.
int dcaenc_input_size(dcaenc_context c);
Returns the size of the input buffer that your application has to submit, in samples. Now this value is always equal to 512.
int dcaenc_output_size(dcaenc_context c);
Returns the size of the output buffer that the application should provide, in bytes.
Performs the conversion of PCM samples stored in the input buffer to the DTS bitstream, stores one frame of the encoded bitstream in the output buffer. The input buffer should contain interleaved signed 32-bit samples. The channel order is as follows:
If the LFE channel is used, it should be added as the last one.
dcaenc_convert_s32() returns the number of bytes written to the output buffer. Right now, it is always the same as returned by dcaenc_output_size(), but this will change if variable bitrate encoding is added to the library.
int dcaenc_destroy(dcaenc_context c, uint8_t *output);
Destroys the library context. If a non-NULL value is provided in the output parameter, the library encodes the final frame and puts it there. This may be useful because there is a 512-sample latency inherent in the DTS filterbank, so the output frame gets the last portion of the PCM input submitted earlier. The returned value indicates the number of bytes written to the output buffer.
© Alexander E. Patrakov