Initiates multimedia recording to a memory-resident buffer of a specified size and returns to the application. The ADI service records data into the buffer until one of the terminating conditions described in the ADIEVN_RECORDING_DONE event occurs.
Parameters to control silence detection are provided and apply if silence detection is configured.
DWORD adiRecordMMToMemory ( CTAHD ctahd, unsigned encoding, void *buffer, unsigned bufsize, MSPHD *video_ephd, MSPHD *audio_ephd, ADI_MM_RECORD_PARMS *parms)
Argument |
Description |
ctahd |
Context handle returned by ctaCreateContext or ctaAttachContext. |
encoding |
Encoding type. See the adidef.h header file for a complete list of ADI_ENCODING_xxx values. See Multimedia encoding types for the RTP compressed format encoding types. |
buffer |
Pointer to the media data buffer. |
bufsize |
Number of bytes pointed to by buffer. |
video_ephd |
Pointer to the CG board video filter endpoint handle obtained with mspGetFilterHandle. The application uses this endpoint handle to connect the ADI channel on the board to the RTP endpoint and to synchronize the beginning and ending of the audio and video record. |
audio_ephd |
Pointer to the CG board audio filter endpoint handle obtained with mspGetFilterHandle. The application uses this endpoint handle to connect the ADI channel on the board to the RTP endpoint and to synchronize the beginning and ending of the audio and video record. |
parms |
Pointer to the ADI_MM_RECORD_PARMS structure that contains record parameters. |
Return value |
Description |
SUCCESS |
|
ADIERR_INVALID_CALL_STATE |
Function not valid in the current call state. |
CTAERR_BAD_ARGUMENT |
Invalid encoding or NULL buffer. |
CTAERR_FUNCTION_ACTIVE |
Function already started. |
CTAERR_INVALID_CTAHD |
Context handle is invalid. |
CTAERR_INVALID_STATE |
Function not valid in the current port state. |
CTAERR_OUTPUT_ACTIVE |
Record failed because there is another active output function. |
CTAERR_RESOURCE_CONFLICT |
Silence detector is in use by adiStartEnergyDetector. |
CTAERR_SVR_COMM |
Play or record communication error. |
The ADIEVN_RECORDING_DONE event is generated when the recording operation terminates. The event size field contains the total number of bytes written to the buffer. The value field contains one of the following termination reasons or error codes:
Reason |
Description |
CTA_REASON_FINISHED |
Buffer is filled. |
CTA_REASON_MAXTIME_AUDIO |
Maximum recording time reached. Applicable for pass-through audio encoding types only. |
CTA_REASON_MAXTIME_VIDEO |
Maximum recording time reached. Applicable for pass-through video encoding types only. |
CTA_REASON_NATIVE_COMPANION_RECORD_STOPPED |
Companion pass-through record channel stopped. For example, there is a pass-through audio channel and a pass-through video channel that are companion channels because they have matching video_ephd and audio_ephd input parameters. If one of the two channels stops recording for any reason, the companion pass-through channel is also stopped with this reason code. |
CTA_REASON_NO_VIDEO |
No video detected. |
CTA_REASON_NO_VOICE |
No voice detected. |
CTA_REASON_RELEASED |
Call terminated. |
CTA_REASON_STOPPED |
Stopped by application request. |
CTA_REASON_VIDEO_END |
Video packets not detected for specified timeout period. Applicable for pass-through video encoding types only. |
CTA_REASON_VOICE_END |
User stopped speaking. |
CTAERR_FUNCTION_NOT_AVAIL |
Required DSP file not loaded on the board. |
CTAERR_xxx or ADIERR_xxx |
Record failed. |
if ((ret = SetRecordParms(VideoCtx[i].ctahd, &recParms)) != SUCCESS)
{
printf("Failed to setup Record Parameters\n");
exit(1);
}
ret = adiRecordMMToMemory(VideoCtx[i].ctahd,
mmParm.ADIvidEncoder, // Encoding
VideoCtx[i].data_buffer, // Buffer to receive recorded video
mmParm.video_buffer_size, // Buffer size
videoEP_filterhd, // Video EndPoint Filter Handle
audioEP_filterhd, // Audio EndPoint Filter Handle
&recParms); // Record parameters
if (ret != SUCCESS)
{
printf("Failed to Record to memory, %x\n", ret);
exit(1);
}