Cinepak library is a library that allows you to easily play QuickTime (Cinepak compressed) movies on SEGASATURN.
Figure 4.1 Cinepak library configuration diagram
Figure 4.2 Movie playback procedure during memory playback
#define WORK_BUF_SIZE 200*1024L #define PCM_ADDR ((void*)0x25a20000) #define PCM_SIZE (4096L*16)/* work buffer */ Uint32 movie_work[CPK_24WORK_DSIZE]; /* ring buffer */ Uint32 movie_buf[WORK_BUF_SIZE/sizeof(Uint32)]; StmHn stm; CpkHn cpk; Sint32 movie_x = 320;
/* Initialization */ CPK_Init();
/* Screen display settings */ Set the V blank IN interrupt using INT_???. Call CPK_VblIn(); within the V blank IN interrupt. Configure sprite commands, etc.
/* File initialization */ GFS_Init(‥); STM_Init(‥); STM_OpenGrp(); STM_SetExecGrp(‥); /* Open stream */ stm = STM_OpenFid(‥);
/* Generate movie handle */ CPK_PARA_WORK_ADDR(¶) = movie_work; CPK_PARA_WORK_SIZE(¶) = CPK_24WORK_BSIZE; CPK_PARA_BUF_ADDR(¶) = movie_buf; CPK_PARA_BUF_SIZE(¶) = WORK_BUF_SIZE; CPK_PARA_PCM_ADDR(¶) = PCM_ADDR; CPK_PARA_PCM_SIZE(¶) = PCM_SIZE; cpk = CPK_CreateStmMovie(¶, stm);
/* Setting the number of display colors */ CPK_SetColor(cpk, CPK_COLOR_15BIT); /* Setting destination address */ CPK_SetDecodeAddr(cpk, ADDR_VRAM, 2 * movie_x); /* Start playing the movie */ CPK_Start(cpk); while(TRUE) { /* Movie playback process */ CPK_Task(cpk); if (CPK_IsDispTime(cpk) == TRUE) { /* Waiting for frame buffer switching */ SCL_DisplayFrame(); CPK_CompleteDisp(cpk); } /* Movie end determination */ if (CPK_GetPlayStatus(cpk)==CPK_STAT_PLAY_END) break; } /* Movie abandonment */ CPK_DestroyStmMovie(cpk); /* Close stream */ STM_Close(stm);