Skip to content

Commit 80a8738

Browse files
- Added getUserData for Decoder
Since Decoder and Encoder is similar, if the custom onWrite and onSeek function requires user_data, the Decoder.create() function might also need the user_data because it also have its own callback for decoding files.
1 parent f90774c commit 80a8738

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/zaudio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,11 @@ void zaudioDecoderDestroy(
808808
s_mem.onFree(handle, s_mem.pUserData);
809809
}
810810

811+
void* zaudioDecoderGetUserData(ma_decoder* handle) {
812+
assert(handle != NULL);
813+
return handle->pUserData;
814+
}
815+
811816
//--------------------------------------------------------------------------------------------------
812817
void zaudioEncoderConfigInit(
813818
ma_encoding_format encoding_format,

src/zaudio.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,9 @@ pub const Decoder = opaque {
10471047
) callconv(.c) void,
10481048
};
10491049

1050+
pub const getUserData = zaudioDecoderGetUserData;
1051+
extern fn zaudioDecoderGetUserData(device: *const Encoder) ?*anyopaque;
1052+
10501053
pub const Config = extern struct {
10511054
format: Format,
10521055
channels: u32,

0 commit comments

Comments
 (0)