Japanese
MOVIE TOOLS GUIDECinepak for SEGA Saturn
BackForward
Cinepak for SEGASaturn


4.6 Function details

 Title
function specification
 Data
Initialization
 Data Name
CPK_Init
 No
1.1

 
Format Bool CPK_Init(void)
Input None 
Output None 
Function value TRUE if initialized successfully
   FALSE if unable to initialize successfully
Function Immediately after starting the program, initialization is performed to use this library.
Remarks When using this library, be sure to call this function at the beginning of the program.
 Title
function specification
 Data
End processing
 Data Name
CPK_Finish
 No
1.2

 
Format void CPK_Finish(void)
Input None 
Output None 
Function value None 
Function Call this function if you do not want to play the movie again.
 Title
function specification
 Data
Creating a handle (memory)
 Data Name
CPK_CreateMemMovie
 No
2.1

 
Format CpkHn CPK_CreateMemMovie(CpkCreatePara *para)
Input para: Creation parameter 
output None 
function value Movie handle (NULL if creation is not possible)
Function Creates a movie handle to play a movie file in memory.
remarks
    • Up to 32 movies can be created at the same time.
    • Load the movie file into memory using an application program.
    • For the movie handle generated with CPK_CreateMemMovie, be sure to notify the size of the movie file with CPK_NotifyWriteSize.
 Title
function specification
 Data
Erasing handles (memory)
 Data Name
CPK_DestroyMemMovi
 No
2.2

 
Format void CPK_DestroyMemMovie(CpkHn cpk)
Input cpk: Movie handle 
output None 
Function value None 
Function Clears the movie handle.

  Once you clear a handle, you can no longer use the movie handle.
 Title
function specification
 Data
Creating a handle (file system)
 Data Name
CPK_CreateGfsMovie
 No
2.3

 
Format CpkHn CPK_CreateGfsMovie(CpkCreatePara *para, GfsHn gfs)
Input para: creation parameter
  gfs: File handle 
output None 
function value Movie handle (NULL if it cannot be created)
Function Creates a movie handle to play a movie file on the file system.
remarks
    • Up to 32 movies can be created at the same time.
    • Obtain the file handle in advance using the application program.
 Title
function specification
 Data
Clearing a handle (file system)
 Data Name
CPK_DestroyGfsMovi
 No
2.4

 
Format void CPK_DestroyGfsMovie(CpkHn cpk)
Input cpk: Movie handle 
output None function 
value None 
function
    • Erase the movie handle.
    • Once you clear a handle, you can no longer use the movie handle.
    • Clear the movie handle before closing the file handle.
 Title
function specification
 Data
Creating a handle (stream system)
 Data Name
CPK_CreateStmMovie
 No
2.5

 
Format CpkHn CPK_CreateStmMovie(CpkCreatePara *para, StmHn stm)
Input para: creation parameter
  stm: File handle 
output None 
function value Movie handle (NULL if it cannot be created)
Function Creates a movie handle to play a movie file on a stream system.
remarks
    • Up to 32 movies can be created at the same time.
    • Obtain the stream handle in advance using the application program.
 Title
function specification
 Data
Clearing handles (stream system)
 Data Name
CPK_DestroyStmMovi
 No
2.6

 
Format void CPK_DestroyStmMovie(CpkHn cpk)
Input cpk: Movie handle 
output None function 
value None 
function
    • Erase the movie handle.
    • Once you clear a handle, you can no longer use the movie handle.
    • Clear the movie handle before closing the stream handle.
 Title
function specification
 Data
replay task
 Data Name
CPK_Task
 No
2.7

 
Format void CPK_Task(CpkHn cpk)
Input cpk: Movie 
handle output None 
Function value None 
Function Reads files from CD and expands images.
Remarks : Please call this function periodically while the movie is playing. Please set the calling interval
          to be greater than the number of playback frames. If the number of frames is less than that, smooth
          playback will not be possible. After reading this function, be sure to check whether the display
          timing is set using CPK_IsDispTime. If CPK_IsDispTime returns TRUE, it is time to display the image,
          so if it has been expanded to sprite VRAM, change the frame. If it was expanded to memory, please
          transfer it to VRAM. Be sure to call CPK_CompleteDisp afterwards. Please note that if you specify
          the expansion destination address in VRAM, it will be expanded before the display timing.
 Title
function specification
 Data
Determining display timing
 Data Name
CPK_IsDispTime
 No
2.8

 
Format Bool CPK_IsDispTime(CpkHn cpk)
Input cpk: Movie handle 
output None 
Function value TRUE when the movie frame image has been expanded and it is time to display it.
   FALSE if it is not yet time to display
Function If this function returns TRUE, it is time to display one frame of image, so if it was expanded to
          sprite VRAM, change the frame. If it was expanded to memory, transfer the expanded contents to VRAM. Be
          sure to call CPK_CompleteDisp afterward.
 Title
function specification
 Data
Display completion notification
 Data Name
CPK_CompleteDisp
 No
2.9

 
Format void CPK_CompleteDisp(CpkHn cpk)
Input cpk: Movie handle 
output None 
Function value None 
Function Notifies the library that image display has finished.
Remarks Please call this function when CPK_IsDispFrame becomes TRUE.

  If you don't call it, the movie won't play.
 Title
function specification
 Data
V blank IN processing function
 Data Name
CPK_VblIn
 No
2.10

 
Format void CPK_VblIn(void)
Input None 
Output None 
Function value None 
Function Manages the movie playback time.
Remarks When using this library, be sure to call this function with a V blank IN interrupt.
 Title
function specification
 Data
Start playing
 Data Name
CPK_Start
 No
3.1

 
Format void CPK_Start(CpkHn cpk)
Input cpk: Movie handle 
output None 
Function value None 
Function Starts playing the movie.
remarks
    • A movie can only be played once for a generated movie handle. If you want to play the same movie over and over again, generate a movie handle each time.
 Title
function specification
 Data
Stop playing
 Data Name
CPK_Stop
 No
3.2

 
Format void CPK_Stop(CpkHn cpk)
Input cpk: Movie handle 
output None 
Function value None 
Function Stops playing the movie.
 Title
function specification
 Data
Pause
 Data Name
CPK_Pause
 No
3.3

 
Format void CPK_Pause(CpkHn cpk, CpkPauseCmd cmd)
Input cpk: movie handle
  cmd: Pause control command 
output None 
Function value None 
Function Pauses or cancels movie playback.
 Title
function specification
 Data
Registering the next movie to play
 Data Name
CPK_EntryNext
 No
3.4

 
Format void CPK_EntryNext(CpkHn cpk)
Input cpk: Movie handle 
output None 
Function value None 
Function Next, register the movie handle to be played. If you register a movie with this function,
          it will automatically switch to the next movie when the currently playing movie ends. Specifying
          NULL will cancel the registration. Even when forced switching is performed using CPK_Change,
          the movie registered using this function will be played next.
 Title
function specification
 Data
Forced movie switching
 Data Name
CPK_Change
 No
3.5

 
Format void CPK_Change(void)
Input None 
Output None 
Function value None 
Function Interrupts the currently playing movie and starts playing the movie registered in CPK_EntryNext.
 Title
function specification
 Data
Obtaining movie switching status
 Data Name
CPK_CheckChange
 No
3.6

 
Format CpkChangeStatus CPK_CheckChange(void)
Input None 
Output None 
Function value Forced switching possibility check value 
function Returns the switching possibility when forced switching is performed with CPK_Change.
 Title
function specification
 Data
Expand specified frame
 Data Name
CPK_DecodeFrame
 No
3.7

 
Format void CPK_DecodeFrame(CpkHn cpk, Sint32 frame_no)
Input cpk: movie handle
  frame_no: Number 
output of the frame to be expanded None 
Function value None 
Function Expands the image of the specified frame.
Remarks This function can only be used for movies loaded into memory. In the application program,
          read the movie file, create a movie handle with CPK_CreateMemMovie, and then call this function.
          This function cannot be used with movie handles created with CPK_CreateGfsMovie and
          CPK_CreateStmMovie. Please use a movie file with only keyframes and no sound.
 Title
function specification
 Data
Setting the destination address
 Data Name
CPK_SetDecodeAddr
 No
4.1

 
Format void CPK_SetDecodeAddr(CpkHn cpk, void *dec_addr, Sint32 dec_line_size)
Input cpk: movie handle
  dec_addr: Address of image expansion destination
  dec_line_size: The number of bytes in one line of the image expansion destination buffer
Outputs None 
Function value None 
Function Specify the address to which the expanded image will be transferred. If the image expansion
          destination address is NULL, image expansion will not be performed. Default is NULL. Please call
          this function before playing the movie.
 Title
function specification
 Data
Setting the number of display colors
 Data Name
CPK_SetColor
 No
4.2

 
Format void CPK_SetColor(CpkHn cpk, CpkColorType color)
Input cpk: movie handle
  color: Number of display colors 
output None 
Function value None 
Function Specify the number of colors displayed in the image. Default is 16 million colors. Please
          call this function before playing the movie.
 Title
function specification
 Data
Setting the maximum number of transferred sectors
 Data Name
CPK_SetLoadNum
 No
4.3

 
Format void CPK_SetLoadNum(CpkHn cpk, Sint32 load_sct)
Input cpk: movie handle
  load_sct: Maximum number of transferred sectors 
output None 
Function value None 
Function Set the maximum number of transfer sectors when transferring from the CD buffer to the
          library's internal buffer. Default is 20 sectors. Please call this function before playing
          the movie.
 Title
function specification
 Data
Playback PAN settings
 Data Name
CPK_SetPan
 No
4.4

 
Format void CPK_SetPan(CpkHn cpk, Sint32 pan)
Input cpk: movie handle
  pan: PAN value (0 to 31)
Output None 
Function Value None 
Function Specifies the PAN of the sound.

  Default is 0.

 Title
function specification
 Data
Setting playback volume
 Data Name
CPK_SetVolume
 No
4.5

 
Format void CPK_SetVolume(CpkHn cpk, Sint32 volume)
Input cpk: movie handle
  volume: Volume (0 to 7)
Output None 
Function Value None 
Function Specify the volume. (0 means no output, 7 means maximum volume) Default is 7.
 Title
function specification
 Data
Setting PCM command block number
 Data Name
CPK_SetPcmCmdBlock
 No
4.6

 
Format voidC PK_SetPcmCmdBlockNo(CpkHn cpk, Sint32 blk_no)
Input cpk: movie handle
  blk_no: PCM command block number (0 to 7)
Output None 
Function Value None 
Function Set the PCM command block number to be set in the sound driver. Default is 0. For more
          information on PCM command block numbers, see SEGASATURN Sound Driver System Interface.
          Please call this function before playing the movie.
 Title
function specification
 Data
Setting the PCM stream playback number
 Data Name
CPK_SetPcmStreamNo
 No
4.7

 
Format void CPK_SetPcmStreamNo(CpkHn cpk, Sint32 stream_no)
Input cpk: movie handle
  stream_no: PCM stream playback number (0 to 7)
Output None 
Function Value None 
Function Set the PCM stream playback number to be set in the sound driver. Default is 0. For more
          information on PCM stream playback numbers, see SEGASATURN Sound Driver System Interface.
Note: When playing multi-movies, use different stream playback numbers for each movie. Please call
          this function before playing the movie.
 Title
function specification
 Data
Setting the key out range
 Data Name
CPK_SetKeyOutRange
 No
4.8

 
Format void CPK_SetKeyOutRange(CpkHn cpk, Sint32 range)
Input cpk: movie handle
  range: Key out (transparent color) range 
output None 
Function value None 
Function Sets the range of transparent colors in chromakey processing.
remarks
    • In chroma key processing, the RGB value of the expanded point and the RGB value specified by the chroma key are compared using the following formula, and if the value is smaller than the key out range, it becomes transparent. ABS(ckey.b - decode.b) + ABS(ckey.g - decode.g) + ABS(ckey.r - decode.r) ckey is the RGB value specified by the chroma key decode is the RGB value of the expanded point
    • For 32000 colors, you can specify a range from 0 to 96.
    • For 16 million colors, you can specify a range from 0 to 768.
    • Default is 21.
 Title
function specification
 Data
Get timescale
 Data Name
CPK_GetTimeScale
 No
5.1

 
Format Sint32 CPK_GetTimeScale(CpkHn cpk)
Input cpk: Movie handle 
output None 
Function value Time scale 
function Get the timescale value. The time scale value is invalid until the film header data
          has been supplied to the ring buffer.
 Title
function specification
 Data
Get playback time
 Data Name
CPK_GetTime
 No
5.2

 
Format Sint32 CPK_GetTime(CpkHn cpk)
Input cpk: Movie handle 
output None 
function value Current time 
function Get the current time of the movie. The current time is a count value in timescale units.
 Title
function specification
 Data
Get playback status
 Data Name
CPK_GetPlayStatus
 No
5.3

 
Format CpkPlayStatus CPK_GetPlayStatus(CpkHn cpk)
Input cpk: Movie handle 
Output None 
Function value Playback status 
function Returns the current playback status of the movie.
 Title
function specification
 Data
Get film header
 Data Name
CPK_GetHeader
 No
5.4

 
Format CpkHeader *CPK_GetHeader(CpkHn cpk)
Input cpk: Movie handle 
output None 
Function value Film header 
function Returns the address of the film header part of the movie file. The contents of the
          structure are invalid until the film header data has been supplied to the buffer.
 Title
function specification
 Data
Get write buffer
 Data Name
CPK_GetWriteBuf
 No
6.1

 
Format Uint32 *CPK_GetWriteBuf(CpkHn cpk, Sint32 *free_size, Sint32 *free_total)
Input cpk: Movie handle 
output free_size: Number of bytes of continuous writable area
  free_total: 
Function value of the total number of bytes in the writable area including discontinuous areas Start address of the continuous writable area (NULL if writable is not possible)
Function Gets the write destination buffer address and the number of writable bytes.
Remarks Use this when you want to independently supply data to the ring buffer.
 Title
function specification
 Data
Write size notification
 Data Name
CPK_NotifyWriteBuf
 No
6.2

 
Format void CPK_NotifyWriteSize(CpkHn cpk, Sint32 write_size)
Input cpk: movie handle
  write_size: Number of bytes written 
Output None 
Function value None 
Function Notifies the library of the number of bytes actually written to the buffer.
Remarks Use this when you want to independently supply data to the ring buffer.

  Used when playing movie files in memory.
 Title
function specification
 Data
Load movie into buffer
 Data Name
CPK_PreloadMovie
 No
7.1

 
Format void CPK_PreloadMovie(CpkHn cpk, Uint32 size)
Input cpk: movie handle
  size: Number of bytes to read 
Output None 
Function value None 
Function Reads the movie file into memory.
Remarks If the number of read bytes is smaller than the buffer managed by the library, read up to the buffer size.
 Title
function specification
 Data
Load film header into buffer
 Data Name
CPK_PreloadHeader
 No
7.2

 
Format void CPK_PreloadHeader(CpkHn cpk)
Input cpk: Movie handle 
output None 
Function value None 
Function Reads the film header part of the movie file into memory.
Remarks Before calling this function, move the pickup position to the beginning of the movie file.
 Title
function specification
 Data
Get error information
 Data Name
CPK_GetErr
 No
8.1

 
Format CpkErrCode CPK_GetErr(void)
Input None 
Output None 
Function value Error code 
function Returns the most recent error code.
 Title
function specification
 Data
Registering an error function
 Data Name
CPK_SetErrFunc
 No
8.2

 
Format void CPK_SetErrFunc(CpkErrFunc func, void *obj)
Input func: Function to call when an error occurs
  obj: Registered object 
output None 
Function value None 
Function Set the function to be called when an error occurs. The registration object is passed as the
          first argument of the registration function.

BackForward
MOVIE TOOLS GUIDECinepak for SEGA Saturn
Copyright SEGA ENTERPRISES, LTD. 1997