Return to previous page Return to menu Go to next page

5. Stream access example

5.1 Basic program

(1) Read stream

Read streams A, B, and C into a_buf, b_buf, and c_buf.
(A_BUFSIZE, B_BUFSIZE, and C_BUFSIZE are buffer sizes in sectors)

Uint8 work [STM_WORK_SIZE (STMGRP_OPEN_MAX, STM_OPEN_MAX)]; / * Work area * /
Sint32 a_id, b_id, c_id; / * File identifier * /
StmGrpHn abc_grp; / * Stream group handle * /
StmHn a_stm, b_stm, c_stm; / * Stream handle * /
StmKey key; / * Stream key * /
Uint8 a_buf [A_BUFSIZE * STM_UNIT_FORM1]; / * Transfer area A * /
Uint8 b_buf [B_BUFSIZE * STM_UNIT_FORM2]; / * Transfer area B * /
Uint8 c_buf [C_BUFSIZE * STM_UNIT_FORM1]; / * Transfer area C * / 

GFS_Init (...); / * File system initialization * / STM_Init (STMGRP_OPEN_MAX, STM_OPEN_MAX, work); / * Stream system initialization * / a_id = GFS_NameToId (...); / * Get file identifier * / ・ ・ ・ abc_grp = STM_OpenGrp (); / * Open stream group * /                                                              / * Set stream key * / STM_KEY_CN (& key) = STM_KEY_NONE; / * Channel number * / STM_KEY_CIMSK (& key) = STM_KEY_CIVAL (& key) = STM_KEY_NONE; / * Coding information * / / * Open stream by file identifier * / STM_KEY_SMMSK (& key) = STM_KEY_SMVAL (& key) = STM_SM_VIDEO; / * Video stream * / a_stm = STM_OpenFid (abc_grp, a_id, & key, STM_LOOP_NOREAD); / * Stream A * / STM_KEY_SMMSK (& key) = STM_KEY_SMVAL (& key) = STM_SM_AUDIO; / * Audio stream * / b_stm = STM_OpenFid (abc_grp, b_id, & key, STM_LOOP_NOREAD); / * Stream B * / STM_KEY_SMMSK (& key) = STM_KEY_SMVAL (& key) = STM_SM_DATA; / * Data stream * / c_stm = STM_OpenFid (abc_grp, c_id, & key, STM_LOOP_NOREAD); / * Stream C * /

/ * Set transfer area * / STM_SetTrBuf(a_stm, a_buf, A_BUFSIZE, STM_UNIT_FORM1); STM_SetTrBuf(b_stm, b_buf, B_BUFSIZE, STM_UNIT_FORM2); STM_SetTrBuf(c_stm, c_buf, C_BUFSIZE, STM_UNIT_FORM1);

/ * Stream access * / STM_SetExecGrp (abc_grp); / * Execution group setting * / while (1) {     if (STM_ExecServer() == STM_EXEC_COMPLETED) {         break; / * End of stream access * /     }     user (); / * User processing * / } STM_CloseGrp (abc_grp); / * Close stream group * /



Return to previous page Return to menu Go to next page