⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 radbink.h

📁 RadGameTools_Bink_SDK.rar and older version
💻 H
字号:
/*
	Using the Bink DLL to decode a Bink file operates using the following 
	steps:

	1) Set up the sound system using BinkSetSoundSystem. The Bink DLL provides 
	the BinkOpenDirectSound for audio playback and handles the audio itself.

	2) Call BinkOpen with a handle to the file. The function will allocate and
	return a BinkStruct data structure. This structure contains parameters
	regarding the file's video properties, such as width and height. There are
	pointers to two different planes. The Bink DLL uses a double-buffering
	scheme when decoding video, and decodes to YUV 4:2:0 data (alias YV12,
	YUV420P). After decoding a frame of video, one of the two planes will
	contain a pointer to a buffer that contains all of the Y data, all of the
	U data, and all of the V data, all back to back. The current plane is
	indicated in the BinkStruct. The BinkStruct also provides the dimensions
	of the Y plane and the U&V planes so that the data can be properly sorted
	out. The data in the buffer is ordered YUV unless bits 15 and 16 in the 
	BinkStruct's flags are set to 1 (BinkStruct.flags & 0x00018000), in which 
	case, the data is ordered YVU.

	3) Call BinkDoFrame to decode the next frame of video. Fetch the video 
	from the BinkStruct and display, convert, manipulate as an application 
	sees fit.

	4) Call BinkNextFrame to advance to the next frame in the file.

	5) Repeat from step 3 while there are frames remaining in the file (the 
	number of frames is specified in the BinkStruct).

	6) Call BinkClose to deallocate the resources used for decoding the Bink 
	file.

	7) Also, BinkGoto can be called to reposition the file during playback.
*/


#ifndef RADSDK_RADBINK_H
#define RADSDK_RADBINK_H

#include <windows.h>
#include <dsound.h>
#include "rad.h"

/*
typedef signed char		s8;
typedef unsigned char	u8;
typedef signed int		s32;
typedef unsigned int	u32;
typedef signed short	s16;
typedef unsigned short	u16;
*/

typedef struct
{
	s32 Width;			// frame height
	s32 Height;			// frame width
	s32 Frames;			// total number of frames in movie
	s32 FrameNum;		// current frame
	s32 LastFrame;
	s32 FpsMul;			// frames/second multiplier
	s32 FpsDiv;			// frames/second divisor
	s32 Unknown0;		// Unknown
	u32 Flags;
	u8 Unknown1[260];
	s32 CurPlane;		// current plane
	void *Plane0;		// pointer to plane 0
	void *Plane1;		// pointer to plane 1
	u8 Unknown2[8];
	s32 yWidth;			// Y plane width
	s32 yHeight;		// Y plane height
	s32 uvWidth;		// U&V plane width
	s32 uvHeight;		// U&V plane height
} BINK_STRUCT, *HBINK;


typedef s32 (*BINK_SOUND_FUNC)(s32 );

// These are default output functions provided by binkw32.dll
s32 BinkOpenDirectSound(s32 unknown);
s32 BinkOpenMiles(s32 unknown);
s32 BinkOpenWaveOut(s32 unknown);


/*
s32 BinkSetSoundSystem(SOUND_FUNC SoundFunction, IDirectSound *pDS);

	BinkSetSoundSystem initializes the audio playback subsystem.

	SoundFunction: This appears to be the function that will be invoked in 
	order to playback the audio. MPC passes in BinkOpenDirectSound as the 
	parameter. BinkOpenDirectSound must meet the qualifications to be a 
	BINK_SOUND_FUNC (contrived for this description).

	pDS: A pointer to an IDirectSound structure.

	Returns: non-zero on success.
*/
s32 BinkSetSoundSystem(BINK_SOUND_FUNC SoundFunction, IDirectSound *pDS);


/*
HBINK BinkOpen(HANDLE, u32):

	BinkOpen opens and initializes a Bink file for playback.

	hBinkFile: A Windows file HANDLE that refers to the Bink file to be read.

	dwFlags: The meaning of all the flags is unclear, but MPC calls BinkOpen 
	with 0x00800000.

	Returns: On success returns a pointer to a BINK_STRUCT that will be used for playing the Bink 
	file, else return is zero
*/
HBINK BinkOpen(HANDLE hBinkFile, u32 dwFlags);


/*
void BinkGoto(HBINK hBink, s32 FrameNumber, s32 unknown):

	BinkGoto signals the playback engine to reposition the Bink file to a
	requested frame.

	hBink: A pointer to the BINK_STRUCT returned by BinkOpen.

	FrameNumber: The frame number where the stream should be positioned to.

	unknown: MPC sets this parameter to 0.

	Returns: No known return value as MPC does not check for one.
*/
void BinkGoto(HBINK hBink, s32 FrameNumber, s32 unknown);


/*
s32 BinkDoFrame(HBINK hBink):

	BinkDoFrame processes the next frame in the Bink file.

	hBink: A pointer to the BINK_STRUCT returned by BinkOpen.

	Returns: MPC's code comments indicate that this function does return a 
	value, but the meaning is not specified.
*/
s32 BinkDoFrame(HBINK hBink);


/*
void BinkNextFrame(HBINK hBink):

	BinkNextFrame signals the playback engine to advance the Bink file to the 
	next frame.

	hBink: A pointer to the BINK_STRUCT returned by BinkOpen.

	Returns: No known return value as MPC does not check for one.
*/
void BinkNextFrame(HBINK hBink);


/*
void BinkClose(HBINK hBink):

	BinkClose gracefully closes a Bink file and releases any allocated
	resources.

	hBink: A pointer to the BINK_STRUCT returned by BinkOpen.

	Returns: No known return value as MPC does not check for one.
*/
void BinkClose(HBINK hBink);

/*
s4 BinkWait(HBINK hBink):

	BinkWait probably used for synchronization in frame decoding loop 

	hBink: A pointer to the BINK_STRUCT returned by BinkOpen.

	Returns: zero after frame is decoded
*/
s32 BinkWait(HBINK hBink);


/*
Bink Functions:
This is the primary Bink API. This API controls the decompression and playback of
a Bink Video movie.

BinkOpen / Bink MacOpen 
BinkClose 
BinkDoFrame 
BinkCopyToBuffer 
BinkCopyToBufferRect 
BinkWait 
BinkNextFrame 
BinkPause 
BinkGetRects 
BinkGoto 
BinkGetKeyFrame 
BinkSoundUseMiles 
BinkSoundUseDirectSound 
BinkSoundUseSoundManager 
BinkSoundUseAX 
BinkSoundUseMusyX 
BinkGetError 
BinkSetIO 
BinkSetSoundSystem 
BinkSetVolume 
BinkSetPan 
BinkSetMixBins 
BinkSetMixBinVolumes 
BinkSetVideoOnOff 
BinkSetSoundOnOff 
BinkGetSummary 
BinkGetRealtime 
BinkSetFrameRate 
BinkSetSoundTrack 
BinkSetSimulate 
BinkSetIOSize 
BinkService 
BinkGetLogoAddress 
BinkSetMemory


EXPORTS TABLE:
	Name: 	binkw32.dll
	Characteristics: 	00000000h
	TimeDateStamp: 	3BE9BB70h -> 08/11/2001  01:53:36  
	Version:	0.00
	Ordinal base: 	00000001h
	# of functions: 	00000054h
	# of Names: 	00000054h

	Entry Pt  	Ordn     Name
	00003170h     	   1     _BinkBufferBlit@12
	000018A0h     	   2     _BinkBufferCheckWinPos@12
	00003830h     	   3     _BinkBufferClear@8
	00002E30h     	   4     _BinkBufferClose@4
	000036A0h     	   5     _BinkBufferGetDescription@4
	00003820h     	   6     _BinkBufferGetError@0
	00002F30h     	   7     _BinkBufferLock@4
	00001B40h     	   8     _BinkBufferOpen@16
	000011A0h     	   9     _BinkBufferSetDirectDraw@8
	00003690h     	  10     _BinkBufferSetHWND@8
	00001950h     	  11     _BinkBufferSetOffset@12
	00001880h     	  12     _BinkBufferSetResolution@12
	00003580h     	  13     _BinkBufferSetScale@12
	000030F0h     	  14     _BinkBufferUnlock@4
	000017A0h     	  15     _BinkCheckCursor@20
	00006AA0h     	  16     _BinkClose@4
	00007D90h     	  17     _BinkCloseTrack@4
	00005510h     	  18     _BinkCopyToBuffer@28
	000038E0h     	  19     _BinkDDSurfaceType@4
	00003AB0h     	  20     _BinkDX8SurfaceType@4
	00005F60h     	  21     _BinkDoFrame@4
	00003BB0h     	  22     _BinkGetError@0
	00006750h     	  23     _BinkGetKeyFrame@12
	00007220h     	  24     _BinkGetRealtime@12
	000073B0h     	  25     _BinkGetRects@8
	00007010h     	  26     _BinkGetSummary@8
	00007DC0h     	  27     _BinkGetTrackData@8
	00007C90h     	  28     _BinkGetTrackID@8
	00007C70h     	  29     _BinkGetTrackMaxSize@8
	00007C50h     	  30     _BinkGetTrackType@8
	00006830h     	  31     _BinkGoto@12
	00001480h     	  32     _BinkIsSoftwareCursor@8
	00007C40h     	  33     _BinkLogoAddress@0
	00006500h     	  34     _BinkNextFrame@4
	00003CA0h     	  35     _BinkOpen@8
	00008890h     	  36     _BinkOpenDirectSound@4
	00009770h     	  37     _BinkOpenMiles@4
	00007CB0h     	  38     _BinkOpenTrack@8
	000080B0h     	  39     _BinkOpenWaveOut@4
	00006F10h     	  40     _BinkPause@8
	00001860h     	  41     _BinkRestoreCursor@4
	00007A40h     	  42     _BinkService@4
	00003B90h     	  43     _BinkSetError@4
	00003C10h     	  44     _BinkSetFrameRate@8
	00003C40h     	  45     _BinkSetIO@4
	00003C30h     	  46     _BinkSetIOSize@4
	00007B50h     	  47     _BinkSetMixBinVolumes@20
	00007AD0h     	  48     _BinkSetMixBins@16
	00007BD0h     	  49     _BinkSetPan@12
	00003C50h     	  50     _BinkSetSimulate@4
	00007F00h     	  51     _BinkSetSoundOnOff@8
	00003BC0h     	  52     _BinkSetSoundSystem@8
	00003C60h     	  53     _BinkSetSoundTrack@8
	00007EE0h     	  54     _BinkSetVideoOnOff@8
	00007A60h     	  55     _BinkSetVolume@12
	00006C90h     	  56     _BinkWait@4
	00001000h     	  57     _RADSetMemory@8
	0000CBA0h     	  58     _RADTimerRead@0
	00028B20h     	  59     _YUV_blit_16a1bpp@52
	00028B80h     	  60     _YUV_blit_16a1bpp_mask@52
	00026FB0h     	  61     _YUV_blit_16a4bpp@52
	00027010h     	  62     _YUV_blit_16a4bpp_mask@52
	00024D20h     	  63     _YUV_blit_16bpp@48
	00024D70h     	  64     _YUV_blit_16bpp_mask@48
	000210B0h     	  65     _YUV_blit_24bpp@48
	00021100h     	  66     _YUV_blit_24bpp_mask@48
	00022C40h     	  67     _YUV_blit_24rbpp@48
	00022C90h     	  68     _YUV_blit_24rbpp_mask@48
	0001CEF0h     	  69     _YUV_blit_32abpp@52
	0001CF50h     	  70     _YUV_blit_32abpp_mask@52
	00018C60h     	  71     _YUV_blit_32bpp@48
	00018CB0h     	  72     _YUV_blit_32bpp_mask@48
	0001E870h     	  73     _YUV_blit_32rabpp@52
	0001E8D0h     	  74     _YUV_blit_32rabpp_mask@52
	0001A880h     	  75     _YUV_blit_32rbpp@48
	0001A8D0h     	  76     _YUV_blit_32rbpp_mask@48
	0002BB60h     	  77     _YUV_blit_UYVY@48
	0002BBE0h     	  78     _YUV_blit_UYVY_mask@48
	0002AAF0h     	  79     _YUV_blit_YUY2@48
	0002AB70h     	  80     _YUV_blit_YUY2_mask@48
	0002C000h     	  81     _YUV_blit_YV12@52
	0000D440h     	  82     _YUV_init@4
	00001090h     	  83     _radfree@4
	00001020h     	  84     _radmalloc@4

BinkBuffer Functions for Win32 and MacOS:
The BinkBuffer API for Win32 and MacOS was written to make it extremely
easy to add true-color blitting to your applications. The BinkBuffer API
supports 4 basic DirectDraw buffer styles (primary, overlay, YUV off-screen
and RGB off-screen) and allows you to switch easily between them. The
BinkBuffer API will get your applications up and running almost immediately,
but it is optional. If you already have DirectDraw up and running, you can
skip the whole BinkBuffer API completely, and just have the Bink API copy
right into your surface pointers. BinkBuffers don't necessarily use any extra
system memory - overlays and most of the off-screen surfaces exist in video
memory, and primary surface BinkBuffers don't require any extra memory at all! 

BinkBufferOpen 
BinkBufferClose 
BinkBufferLock 
BinkBufferUnlock 
BinkBufferBlit 
BinkBufferCheckWinPos 
BinkBufferGetError 
BinkBufferSetScale 
BinkBufferSetResolution 
BinkBufferGetDescription 
BinkBufferSetDDPrimary 
BinkBufferSetGDPrimary 
BinkDDSurfaceType 
BinkIsSoftwareCursor 
BinkCheckCursor 
BinkRestoreCursor 
BinkBufferSetOffset 

*/

#endif //RADSDK_RADBINK_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -