Japanese
PROGRAMMER'S GUIDEMPEG library
BackForward
MPEG library/12.Function details-1

12.1 MPEG System Control



 one
View
table
 Title

function specification

 Function

Initializing the MPEG system

 Function name

MPG_Init

 No

1.1

Format
Sint32 MPG_Init(Sint32 dscn)
input
dscn: display scanning method
output
none
function value
Error code
function
Initialize the MPEG system. Once this initialization is done, MPEG audio will always be playable.
When using the MPEG library, this function must be called only once at the beginning.
(1) Display scanning method
・MPG_DSCN_NITL
 :NTSC non-interlace mode
・MPG_DSCN_ITL
 :NTSC interlace mode
・MPG_DSCN_PLNITL
 :PAL non-interlace mode
・MPG_DSCN_PLITL
 :PAL interlace mode
remarks
(a) Execute the following steps within 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,
Return MPG_ERR_CDINIT
 2
 Check whether an MPEG cartridge is installed using the CDC_GetHwInfo function.
To check.
 If not installed,
Returns MPG_ERR_NOMC.
 3
 If MPEG is not available, the service routine in BOOT ROM
Run MPEG check (SYS_CHKMPEG).
 If the check fails,
Returns MPG_ERR_MPNG.
 4
 Executes MPEG decoder initialization (CDC_MpInit function).
 If an error occurs,
Returns MPG_ERR_MPINIT.
 5
 Execute the MPEG interrupt mask setting (CDC_MpSetIntMsk function),
Enable picture start detection and sequence end detection interrupts.
 If an error occurs,
Returns MPG_ERR_NG.
 6
 If a constant for PAL is specified for the display scanning method,
Display window offset using CDC_MpSetWinDofs function
Set to (150,45).
 If an error occurs,
Returns MPG_ERR_NG.
(b) Please call the GFS_Init function and STM_Init function after executing this function.

(c) After executing the GFS_Init function, executing this function will clear the ECC/retry count.
Please reset the settings after executing this function as shown below.

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


 one
View
table
 Title

function specification

 Function

Capture MPEG system state

 Function name

MPG_CaptStat

 No

1.2

Format
void MPG_CaptStat(void)
input
none
output
none
function value
none
function
Captures the current state within the CD block. Each function in the MPEG library operates based on the information obtained by this function. The user must call this function at the beginning of the display interval.

 one
View
table
 Title

function specification

 Function

Setting MPEG video operation mode

 Function name

MPG_SetVideoMode

 No

1.3

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

 one
View
table
 Title

function specification

 Function

Obtaining MPEG video operating mode

 Function name

MPG_GetVideoMode

 No

1.4

Format
Sint32 MPG_GetVideoMode(void)
input
none
output
none
function value
MPEG video operation mode
function
Returns the current MPEG video operating mode.

 one
View
table
 Title

function specification

 Function

Confirmation of completion of decoding preparation

 Function name

MPG_IsDecReady

 No

1.5

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

(1) Parameters waiting for decoding to start
・MPG_HDEC_PRE
 : Processing before starting decoding
・MPG_HDEC_EXE
 :Waiting to start decoding

remarks
(a) The decode timing must be MPG_DECTMG_HOST.

In principle, this function can only be used when decoding the first picture.
Decoding after that can be used in streams with picture period M≦3 (excluding the last 3 frames of the stream), but is generally prohibited .

 one
View
table
 Title

function specification

 Function

Hang-up reset

 Function name

MPG_ResetHng

 No

1.6

Format
void MPG_ResetHng(void)
input
none
output
none
function value
none
function
Resets the hang-up detection function. Before starting hang-up detection, the internal state must be reset by this function.

 one
View
table
 Title

function specification

 Function

Hang Detection

 Function name

MPG_CheckHng

 No

1.7

Format
Bool MPG_CheckHng(void)
input
none
output
none
function value
 TRUE
 : hung up
 FALSE
 : Not hung up
function
Check whether the MPEG video hangs up. Returns TRUE if a hangup is detected. Returns FALSE if working properly.

 one
View
table
 Title

function specification

 Function

Get MPEG report

 Function name

MPG_GetReport

 No

1.8

Format
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 period (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
Issues an information acquisition command to the MPEG system and acquires an 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.

 one
View
table
 Title

function specification

 Function

Obtaining MPEG interrupt factor

 Function name

MPG_GetInt

 No

1.9

Format
Sint32 MPG_GetInt(Sint32 *mpint)
input
none
output
mpint: MPEG interrupt factor (lower 3 bytes are valid)
function value
Error code
function
Get 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 MPEG interrupt factors in the CD communication interface manual.

 one
View
table
 Title

function specification

 Function

MPEG reset

 Function name

MPG_ResetMp

 No

1.10

Format
Sint32 MPG_ResetMp(Bool mpsw)
input
mpsw: MPEG switch (ON/OFF)
output
none
function value
Error code
function
Initialize the MPEG decoder. You can turn MPEG ON/OFF using the MPEG switch.

 one
View
table
 Title

function specification

 Function

Get error status

 Function name

MPG_GetErrStat

 No

1.11

Format
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.

 one
View
table
 Title

function specification

 Function

Registering an error function

 Function name

MPG_SetErrFunc

 No

1.12

Format
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 to the first argument of the error function.

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