Codec Engine Application Programming Interface (API)  ce-w08
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Functions
SPHENC - Speech Encoder Interface

Macros

#define SPHENC_EOK   ISPHENC_EOK
 
#define SPHENC_EFAIL   ISPHENC_EFAIL
 
#define SPHENC_ERUNTIME   ISPHENC_ERUNTIME
 
#define SPHENC_ETIMEOUT   VISA_ETIMEOUT
 Timeout occurred.
#define SPHENC_FOREVER   VISA_FOREVER
 Special value for timeout parameter indicating never timeout.
#define SPHENC_VISATYPE   "ti.sdo.ce.speech.ISPHENC"
 The VISA type.
#define SPHENC_STUBSNAME   "SPHENC_STUBS"
 Name of stub functions. Use this name when registering the SPHENC_STUBS functions with Engine_addStubFxns.

Typedefs

typedef ISPHENC_Status SPHENC_Status
 Defines instance status parameters (read-only).
typedef VISA_Handle SPHENC_Handle
 Opaque handle to a SPHENC codec.
typedef struct ISPHENC_Params SPHENC_Params
 This structure defines the parameters necessary to create an instance of a Speech/Voice Encoder object.
typedef ISPHENC_InArgs SPHENC_InArgs
 Defines the input arguments for all ISPHENC instance process function.
typedef ISPHENC_OutArgs SPHENC_OutArgs
 Defines the run time output arguments for all ISPHENC instance objects.
typedef ISPHENC_Cmd SPHENC_Cmd
 Defines the control commands for the ISPHENC module.
typedef ISPHENC_DynamicParams SPHENC_DynamicParams
 This structure defines the codec parameters that can be modified after creation via control() calls.

Functions

SPHENC_Handle SPHENC_create (Engine_Handle e, String name, SPHENC_Params *params)
 Create an instance of a speech encoder algorithm.
Int32 SPHENC_process (SPHENC_Handle handle, XDM_BufDesc *inBufs, XDM_BufDesc *outBufs, SPHENC_InArgs *inArgs, SPHENC_OutArgs *outArgs)
 Execute the process() method in this instance of a speech encoder algorithm.
Int32 SPHENC_control (SPHENC_Handle handle, SPHENC_Cmd id, SPHENC_DynamicParams *params, SPHENC_Status *status)
 Execute the control method in this instance of a speech encoder algorithm.
Void SPHENC_delete (SPHENC_Handle handle)
 Delete the instance of a speech/voice encoder algorithm.
XDAS_Int32 SPHENC_processAsync (SPHENC_Handle handle, XDM_BufDesc *inBufs, XDM_BufDesc *outBufs, ISPHENC_InArgs *inArgs, ISPHENC_OutArgs *outArgs)
 Perform asynchronous submission to this instance of a speech decoder algorithm.
XDAS_Int32 SPHENC_processWait (SPHENC_Handle handle, XDM_BufDesc *inBufs, XDM_BufDesc *outBufs, ISPHENC_InArgs *inArgs, ISPHENC_OutArgs *outArgs, UInt timeout)
 Wait for a return message from a previous invocation of SPHENC_processAsync() in this instance of an speech decoder algorithm.

Detailed Description

This is the SPHENC speech encoder codec interface. Several of the data types in this API are specified by the XDM interface; please see the XDM documentation for those details.


Macro Definition Documentation

#define SPHENC_EOK   ISPHENC_EOK

Success.

#define SPHENC_EFAIL   ISPHENC_EFAIL

General failure.

#define SPHENC_ERUNTIME   ISPHENC_ERUNTIME

General runtime failure.

#define SPHENC_ETIMEOUT   VISA_ETIMEOUT

Timeout occurred.

#define SPHENC_FOREVER   VISA_FOREVER

Special value for timeout parameter indicating never timeout.

#define SPHENC_VISATYPE   "ti.sdo.ce.speech.ISPHENC"

The VISA type.

#define SPHENC_STUBSNAME   "SPHENC_STUBS"

Name of stub functions. Use this name when registering the SPHENC_STUBS functions with Engine_addStubFxns.

See also:
Engine_addStubFxns

Typedef Documentation

Defines instance status parameters (read-only).

@remarks This structure may be extended by individual codec implementations allowing customization with vendor specific parameters.  The presence of vendor specific extensions will be detected by the value of the @c size parameter.
Remarks:
The size field must be correctly set by the caller. See https://processors.wiki.ti.com/index.php/Extending_data_structures_in_XDM for more details.
@sa         ISPHENC_Fxns::control()

Opaque handle to a SPHENC codec.

typedef struct ISPHENC_Params SPHENC_Params

This structure defines the parameters necessary to create an instance of a Speech/Voice Encoder object.

Defines the input arguments for all ISPHENC instance process function.

@remarks This structure may be extended by individual codec implementations allowing customization with vendor specific parameters.  The presence of vendor specific extensions will be detected by the value of the @c size parameter.
Remarks:
The size field must be correctly set by the caller. See https://processors.wiki.ti.com/index.php/Extending_data_structures_in_XDM for more details.
@sa         ISPHENC_Fxns::process()

Defines the run time output arguments for all ISPHENC instance objects.

@remarks This structure may be extended by individual codec implementations allowing customization with vendor specific parameters.  The presence of vendor specific extensions will be detected by the value of the @c size parameter.
Remarks:
The size field must be correctly set by the caller. See https://processors.wiki.ti.com/index.php/Extending_data_structures_in_XDM for more details.
@sa         ISPHENC_Fxns::process()

Defines the control commands for the ISPHENC module.

Remarks:
This ID can be extended in IMOD interface for additional controls.
See also:
XDM_CmdId
ISPHENC_Fxns::control()

This structure defines the codec parameters that can be modified after creation via control() calls.

@remarks    It is not necessary that given implementation support all
            dynamic parameters to be configurable at run time.  If a
            particular algorithm does not support run-time updates to
            a parameter that the application is attempting to change
            at runtime, it may indicate this as an error.

@remarks This structure may be extended by individual codec implementations allowing customization with vendor specific parameters.  The presence of vendor specific extensions will be detected by the value of the @c size parameter.
Remarks:
The size field must be correctly set by the caller. See https://processors.wiki.ti.com/index.php/Extending_data_structures_in_XDM for more details.
@sa         ISPHENC_Fxns::control()


Function Documentation

SPHENC_Handle SPHENC_create ( Engine_Handle  e,
String  name,
SPHENC_Params params 
)

Create an instance of a speech encoder algorithm.

Instance handles must not be concurrently accessed by multiple threads;
each thread must either obtain its own handle (via SPHENC_create()) or
explicitly serialize access to a shared handle.

@param[in]  e       Handle to an opened engine.
@param[in]  name    String identifier of the type of speech encoder
                    to create.
@param[in]  params  Creation parameters.

@retval     NULL            An error has occurred.
@retval     non-NULL        The handle to the newly created speech encoder
                            instance.

@remark     Depending on the configuration of the engine opened, this
            call may create a local or remote instance of the speech
            encoder.
@remarks In general, @c name is the name of the codec configured by the system integrator. However, an optional "argument string" may be appended to the codec name, to allow the codec's configured priority and/or the heaps where its memory will be allocated, to be overridden.  This optional argument string is of the form <b>":priority"</b>, <b>":priority:flag"</b>, or <b>"::flag"</b>.
Remarks:
priority is the new priority to create the codec with.
The flag must be either 0 or 1, and if 1, all memory allocated for the codec will be in the heap that corresponds to IALG_EXTERNAL. If flag is 0, the memory for the codec will be allocated from the heaps it has requested. For example, if a codec named "mp3" has been configured into the system, setting name to "mp3:4" would cause the codec to be created at priority 4, instead of whatever priority was configured. This feature is useful if more than one instance of the codec are to be created at different priorities.
The flag can be used to prevent the codec from using any internal memory, for example, if it is to be run at the same time as another codec that must use internal memory, and there is insufficient internal memory for both.
@sa         Engine_open()
@sa         SPHENC_delete()
Int32 SPHENC_process ( SPHENC_Handle  handle,
XDM_BufDesc inBufs,
XDM_BufDesc outBufs,
SPHENC_InArgs inArgs,
SPHENC_OutArgs outArgs 
)

Execute the process() method in this instance of a speech encoder algorithm.

Parameters:
[in]handleHandle to a created speech encoder instance.
[in]inBufsA buffer descriptor containing input buffers.
[out]outBufsA buffer descriptor containing output buffers.
[in]inArgsInput Arguments.
[out]outArgsOutput Arguments.
Precondition:
handle is a valid (non-NULL) speech encoder handle and the speech encoder is in the created state.
Return values:
SPHENC_EOKSuccess.
SPHENC_EFAILFailure.
SPHENC_ERUNTIMEInternal Runtime Error.
Remarks:
Since the SPHENC decoder contains support for asynchronous buffer submission and retrieval, this API becomes known as synchronous in nature.
This is a blocking call, and will return after the data has been encoded.
The buffers supplied to SPHENC_process() may have constraints put on them. For example, in dual-processor, shared memory architectures, where the codec is running on a remote processor, the buffers may need to be physically contiguous. Additionally, the remote processor may place restrictions on buffer alignment.
See also:
SPHENC_create()
SPHENC_delete()
SPHENC_control()
SPHENC_processAsync()
SPHENC_processWait()
ISPHENC_Fxns::process()
Int32 SPHENC_control ( SPHENC_Handle  handle,
SPHENC_Cmd  id,
SPHENC_DynamicParams params,
SPHENC_Status status 
)

Execute the control method in this instance of a speech encoder algorithm.

Parameters:
[in]handleHandle to a created speech encoder instance.
[in]idCommand id for XDM control operation.
[in]paramsRuntime control parameters used for encoding.
[out]statusStatus info upon completion of encode operation.
Precondition:
handle is a valid (non-NULL) speech encoder handle and the speech encoder is in the created state.
Return values:
SPHENC_EOKSuccess.
SPHENC_EFAILFailure.
SPHENC_ERUNTIMEInternal Runtime Error.
Remarks:
This is a blocking call, and will return after the control command has been executed.
See also:
SPHENC_create()
SPHENC_delete()
ISPHENC_Fxns::control()
Void SPHENC_delete ( SPHENC_Handle  handle)

Delete the instance of a speech/voice encoder algorithm.

Parameters:
[in]handleHandle to a created speech encoder instance.
Remarks:
Depending on the configuration of the engine opened, this call may delete a local or remote instance of the speech encoder.
Precondition:
handle is a valid (non-NULL) handle which is in the created state.
Postcondition:
All resources allocated as part of the SPHENC_create() operation (memory, DMA channels, etc.) are freed.
See also:
SPHENC_create()
XDAS_Int32 SPHENC_processAsync ( SPHENC_Handle  handle,
XDM_BufDesc inBufs,
XDM_BufDesc outBufs,
ISPHENC_InArgs inArgs,
ISPHENC_OutArgs outArgs 
)

Perform asynchronous submission to this instance of a speech decoder algorithm.

Parameters:
[in]handleHandle to a created speech decoder instance.
[in]inBufsA buffer descriptor containing input buffers.
[out]outBufsA buffer descriptor containing output buffers.
[in]inArgsInput Arguments.
[out]outArgsOutput Arguments.
Precondition:
handle is a valid (non-NULL) speech decoder handle and the speech decoder is in the created state.
Return values:
SPHENC_EOKSuccess.
SPHENC_EFAILFailure.
SPHENC_ERUNTIMEInternal Runtime Error.
Remarks:
This API is the asynchronous counterpart to the process() method. It allows for buffer and argument submission without waiting for retrieval. A response is retrieved using the SPHENC_processWait() API.
The buffers supplied to SPHENC_processAsync() may have constraints put on them. For example, in dual-processor, shared memory architectures, where the codec is running on a remote processor, the buffers may need to be physically contiguous. Additionally, the remote processor may place restrictions on buffer alignment.
See also:
SPHENC_create()
SPHENC_delete()
SPHENC_control()
SPHENC_process()
SPHENC_processWait()
ISPHENC_Fxns::process()
XDAS_Int32 SPHENC_processWait ( SPHENC_Handle  handle,
XDM_BufDesc inBufs,
XDM_BufDesc outBufs,
ISPHENC_InArgs inArgs,
ISPHENC_OutArgs outArgs,
UInt  timeout 
)

Wait for a return message from a previous invocation of SPHENC_processAsync() in this instance of an speech decoder algorithm.

Parameters:
[in]handleHandle to a created speech decoder instance.
[in]inBufsA buffer descriptor containing input buffers.
[out]outBufsA buffer descriptor containing output buffers.
[in]inArgsInput Arguments.
[out]outArgsOutput Arguments.
[in]timeoutAmount of "time" to wait (from 0 -> SPHENC_FOREVER)
Precondition:
handle is a valid (non-NULL) speech decoder handle and the speech decoder is in the created state.
Return values:
SPHENC_EOKSuccess.
SPHENC_EFAILFailure.
SPHENC_ERUNTIMEInternal Runtime Error.
SPHENC_ETIMEOUTOperation timed out.
Remarks:
This is a blocking call, and will return after the data has been decoded.
"Polling" is supported by using a timeout of 0. Waiting forever is supported by using a timeout of SPHENC_EFOREVER.
There must have previously been an invocation of the SPHENC_processAsync() API.
The buffers supplied to SPHENC_processAsync() may have constraints put on them. For example, in dual-processor, shared memory architectures, where the codec is running on a remote processor, the buffers may need to be physically contiguous. Additionally, the remote processor may place restrictions on buffer alignment.
See also:
SPHENC_create()
SPHENC_delete()
SPHENC_control()
SPHENC_process()
SPHENC_processAsync()
Copyright 2013, Texas Instruments Incorporated