PROGRAMMER'S GUIDEMPEG library
BackForward
MPEG Library / 12. Function Details-1

12.1 MPEG system control



 List
 Title

Function specifications

 Function

MPEG system initialization

 Function Name

MPG_Init

 No

1.1

Form
Sint32 MPG_Init (Sint32 dscn)
input
dscn: Display scanning method
output
none
Function value
Error code
function
Initialize the MPEG system. MPEG audio will always be playable once this initialization is done.
When using the MPEG library, this function must be called only once at the beginning.
(1) Display scanning method
・ MPG_DSCN_NITL
 : NTSC non-interlaced mode
・ MPG_DSCN_ITL
 : NTSC interlaced mode
・ MPG_DSCN_PLNITL
 : PAL non-interlaced mode
・ MPG_DSCN_PLITL
 : PAL interlaced mode
remarks
(a) Execute the following procedure in this function and return an error code.
 procedure
 Error code
 1
 Perform a soft reset of the CD block (CDC_CdInit function).
 If an error occurs
Returns MPG_ERR_CDINIT
 2
 Use the CDC_GetHwInfo function to check if the MPEG cartridge is installed.
 If not installed
Returns MPG_ERR_NOMC.
 3
 If MPEG is not available, the service routine in the BOOT ROM
Perform an MPEG check (SYS_CHKMPEG).
 If the check fails
Returns MPG_ERR_MPNG.
 4
 Executes the initialization of the MPEG decoder (CDC_MpInit function).
 If an error occurs
Returns MPG_ERR_MPINIT.
 5
 Execute the MPEG interrupt mask setting (CDC_MpSetIntMsk function) and execute it.
Allows picture start detection and sequence end detection interrupts.
 If an error occurs
Returns MPG_ERR_NG.
 6
 When a constant for PAL is specified for the display scanning method,
Set the display window offset to (150,45) using the CDC_MpSetWinDofs function.
 If an error occurs
Returns MPG_ERR_NG.
(b) Call the GFS_Init function and STM_Init function after executing this function.

(c) If you execute this function after executing the GFS_Init function, the ECC / retry count will be cleared.
Please reset after executing this function as follows.

CDC_CdInit (0,0,0x05,0x0f);


 List
 Title

Function specifications

 Function

Capture the state of the MPEG system

 Function Name

MPG_CaptStat

 No

1.2

Form
void MPG_CaptStat (void)
input
none
output
none
Function value
none
function
Captures the current state in the CD block. Each function in the MPEG library works with the information obtained by this function. The user must call this function at the beginning of the display interval.

 List
 Title

Function specifications

 Function

Setting the operating mode of MPEG video

 Function Name

MPG_SetVideoMode

 No

1.3 1.3

Form
Sint32 MPG_SetVideoMode (Sint32 vmode)
input
vmode: MPEG video operating mode
output
none
Function value
Error code
function
Sets the operating mode of MPEG video.
(1) MPEG video operation mode
・ MPG_VMODE_MOVIE
 :movie
・ MPG_VMODE_SPIC
 :Still image
・ MPG_VMODE_SPIC_H
 : High-definition still image 

 List
 Title

Function specifications

 Function

Get MPEG video operating mode

 Function Name

MPG_GetVideoMode

 No

1.4

Form
Sint32 MPG_GetVideoMode (void)
input
none
output
none
Function value
MPEG video operating mode
function
Returns the operating mode of the current MPEG video.

 List
 Title

Function specifications

 Function

Confirmation of completion of decoding preparation

 Function Name

MPG_IsDecReady

 No

1.5

Form
Bool MPG_IsDecReady (Sint32 decpic)
input
decpic: Parameter waiting to start decoding
output
none
Function value
 TRUE
 : Ready to decode
 FALSE
 : Not ready for decoding
function
Check that the image data is ready to be decoded. Before calling the MPG_MvDecNext function or MPG_SpDecNext function, make sure that decoding is completed with this function.
The parameters waiting to start decoding are as follows. Please specify MPG_HDEC_PRE and call it once before starting playback.

(1) Decoding start waiting parameter
・ MPG_HDEC_PRE
 : Pre-decoding start processing
・ MPG_HDEC_EXE
 : Waiting to start decoding

remarks
(a) The decoding timing must be MPG_DECTMG_HOST.

As a general rule, this function can only be used when decoding the first picture.
Subsequent decoding can be used in streams with a picture period of M ≤ 3 (excluding the last 3 frames of the stream), but it is generally prohibited .

 List
 Title

Function specifications

 Function

Hang reset

 Function Name

MPG_ResetHng

 No

1.6

Form
void MPG_ResetHng (void)
input
none
output
none
Function value
none
function
Reset the hang detection function. This function must reset the internal state before starting hang detection.

 List
 Title

Function specifications

 Function

Hang detection

 Function Name

MPG_CheckHng

 No

1.7 1.7

Form
Bool MPG_CheckHng (void)
input
none
output
none
Function value
 TRUE
 : Hang up
 FALSE
 : Not hung
function
Checks if the MPEG video hangs. If it detects a hang, it returns TRUE. Returns FALSE if it is working properly.

 List
 Title

Function specifications

 Function

Get MPEG report

 Function Name

MPG_GetReport

 No

1.8 1.8

Form
Sint32 MPG_GetReport (Sint32 * actst, Sint32 * vcnt, Sint32 * pict, Sint32 * stat_a, Sint32 * stat_v)
input
none
output
 actst
 : MPEG operation status (lower 1 byte is valid)
 vcnt
 : Operating interval (VSYNC) counter (lower 2 bytes are valid)
 pict
 : Picture information (lower 1 byte is valid)
 stat_a
 : MPEG / Audio status (lower 1 byte is valid)
 stat_v
 : MPEG / Video status (lower 2 bytes are valid)
Function value
Error code
function
Issue an information acquisition command to the MPEG system to acquire the MPEG report.
The output value in case of failure is undefined.
remarks
(a) For details on the output value, refer to the explanation of MPEG status information in the CD communication interface manual.

 List
 Title

Function specifications

 Function

Get MPEG interrupt factor

 Function Name

MPG_GetInt

 No

1.9

Form
Sint32 MPG_GetInt (Sint32 * mpint)
input
none
output
mpint: MPEG interrupt factor (lower 3 bytes are valid)
Function value
Error code
function
Acquires the MPEG interrupt factor. The output value in case of failure is undefined.
remarks
(a) For details on the output value, refer to the explanation of the MPEG interrupt factor in the CD communication interface manual.

 List
 Title

Function specifications

 Function

MPEG reset

 Function Name

MPG_ResetMp

 No

1.10

Form
Sint32 MPG_ResetMp (Bool mpsw)
input
mpsw: MPEG switch (ON / OFF)
output
none
Function value
Error code
function
Initialize the MPEG decoder. The MPEG switch allows you to specify whether MPEG is ON / OFF.

 List
 Title

Function specifications

 Function

Getting error status

 Function Name

MPG_GetErrStat

 No

1.11

Form
Sint32 MPG_GetErrStat (MpgErrStat * stat)
input
none
output
stat: Error status
Function value
Error code
function
Gets the error status of the last executed library function.

 List
 Title

Function specifications

 Function

Error function registration

 Function Name

MPG_SetErrFunc

 No

1.12

Form
void MPG_SetErrFunc (MpgErrFunc func, void * obj)
input
func: Function to call when an error occurs
output
obj: Registered object
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 error function.

BackForward
PROGRAMMER'S GUIDEMPEG library
Copyright SEGA ENTERPRISES, LTD., 1997