UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
binkacd.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#ifndef __BINKACDH__
4#define __BINKACDH__
5
6#ifndef __RADRR_COREH__
7 #include "rrCore.h"
8#endif
9
10//===========================================
11// decoding API
12//===========================================
13
14#ifdef WRAP_PUBLICS
15#define bamerge(name) RR_STRING_JOIN(name,WRAP_PUBLICS)
16#define BinkAudioDecompressMemory bamerge(BinkAudioDecompressMemory)
17#define BinkAudioDecompressOpen bamerge(BinkAudioDecompressOpen)
18#define BinkAudioDecompress bamerge(BinkAudioDecompress)
19#define BinkAudioDecompressResetStartFrame bamerge(BinkAudioDecompressResetStartFrame)
20#define BinkAudioDecompressOutputSize bamerge(BinkAudioDecompressOutputSize)
21#endif
22
24
25#define BINKACNODEINTERLACE 2
26#define BINKAC20 4
27
28#define BINKACD_EXTRA_INPUT_SPACE 72 // extra padding after inpend, that, given random data, Bink might read past (very unlikely, but possible)
29
30// with _normal_ data, we can read past the InputBuffer by 16 bytes
31// due to vector bit decoding. It's highly unlikely that it reads that far,
32// however _some_ amount of reading is all but certain.
33#define BINK_UE_DECODER_END_INPUT_SPACE 16
34
35// how much memory should be allocated for the BinkAudioDecompressOpen mem ptr?
37
38// open and initialize a decompression stream
40
41typedef struct BINKAC_OUT_RINGBUF
42{
43 void * outptr; // pointer within outstart and outend to write to (after return, contains the new end output ptr)
44 void * outstart;
45 void * outend;
46
47 U32 outlen; // unused available (starting at outptr, possibly wrapping) - (after return, how many bytes copied)
48 // outlen should always be a multiple of 16
49
50 U32 eatfirst; // remove this many bytes from the start of the decompressed data (after return, how many bytes left)
51 // eatfirst should always be a multple of 16
52
53 U32 decoded_bytes; // from the input stream, how many bytes decoded (usually outlen, unless outlen was smaller than a frame - that is, when not enough room in the ringbuffer)
55
56typedef struct BINKAC_IN
57{
58 void const * inptr; // pointer to input data (after return, contains new end input ptr)
59 void const * inend; // end of input buffer (there should be at least BINKACD_EXTRA_INPUT_SPACE bytes after this ptr)
61
62//do the decompression - supports linear or ringbuffers (outptr==outstart on non-ring), will clamp, if no room
64
65// resets the start flag to prevent blending in the last decoded frame.
67
68// how much memory will decompress touch of the output (not how much was output - that's decoded_bytes)
70
71// what is the maximum data that can be touched of the output for ANY Bink file
72#define BinkAudioDecompressOutputMaxSize() ( 2048 * sizeof(S16) * 2 ) // 2 is channels
73
74#endif
RAD_U32 U32
Definition egttypes.h:501
#define RADLINK
Definition egttypes.h:289
#define RADDEFFUNC
Definition egttypes.h:66
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
RADDEFFUNC U32 RADLINK BinkAudioDecompressOutputSize(void *mem)
Definition binkacd.cpp:1705
RADDEFFUNC U32 RADLINK BinkAudioDecompressOpen(void *mem, U32 rate, U32 chans, U32 flags)
Definition binkacd.cpp:1564
RADDEFFUNC U32 RADLINK BinkAudioDecompressMemory(U32 rate, U32 chans, U32 flags)
Definition binkacd.cpp:1524
RADDEFFUNC void RADLINK BinkAudioDecompressResetStartFrame(void *mem)
Definition binkacd.cpp:1549
RADDEFFUNC void RADLINK BinkAudioDecompress(void *mem, BINKAC_OUT_RINGBUF *output, BINKAC_IN *compress_input)
Definition binkacd.cpp:1679
struct BINKAUDIODECOMP * HBINKAUDIODECOMP
Definition binkacd.h:23
Definition binkacd.h:57
void const * inptr
Definition binkacd.h:58
void const * inend
Definition binkacd.h:59
Definition binkacd.h:42
U32 outlen
Definition binkacd.h:47
U32 decoded_bytes
Definition binkacd.h:53
U32 eatfirst
Definition binkacd.h:50
void * outstart
Definition binkacd.h:44
void * outptr
Definition binkacd.h:43
void * outend
Definition binkacd.h:45
Definition binkacd.cpp:98
U32 flags
Definition binkacd.cpp:114
U32 chans
Definition binkacd.cpp:108