vceGetEncodingInfo

Returns information about a voice encoding.

Prototype

DWORD vceGetEncodingInfo ( CTAHD ctahd, unsigned encoding, unsigned *framesize, unsigned *frametime)

Argument

Description

ctahd

Handle returned by ctaCreateContext or ctaAttachContext.

encoding

Encoding ID (for example, VCE_ENCODE_NMS_24).

framesize

Pointer to the returned size (in bytes) of one frame. Can be NULL.

frametime

Pointer to the returned time (in milliseconds) represented by one frame. Can be NULL.


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

Invalid encoding.

CTAERR_INVALID_CTAHD

Context handle is invalid.

CTAERR_SVR_COMM

Server communication error.


Details

vceGetEncodingInfo returns information about all encoding that the play or record service (for example, the ADI service) associated with the context supports.

framesize is the minimum data block size. Data at the specified encoding is always a multiple of this size. frametime is the duration to play or record one frame. The data rate in bytes per second is framesize * 1000 / frametime.

Use the following formulas to convert between milliseconds and bytes. These translations truncate the results to frame multiples.

bytes = ( milliseconds / frametime ) * framesize

milliseconds = ( bytes / framesize ) * frametime

If vceGetEncodingInfo is called for a file containing an EDTX encoding type, the maximum frame size for the encoding type is returned in framesize and the uncompressed frame duration is returned in frametime.

Use vceGetOpenInfo to return the encoding used in an open voice object.

Example

/* Return message size in bytes */

unsigned myMsgSize (VCEHD vh, unsigned message)
{
    VCE_OPEN_INFO openinfo;
    unsigned      framesize;
    unsigned      frametime;
    unsigned      msgsize;

    vceGetOpenInfo (vh, &openinfo, sizeof openinfo) ;
    vceGetEncodingInfo (openinfo.ctahd, openinfo.encoding, &framesize,
                      &frametime) ;
    vceGetMessageSize (vh, message, &msgsize) ;
    return  (msgsize / frametime * framesize);
}