Skip to content

Commit de242ed

Browse files
rilliankinetiknz
authored andcommitted
flac: Expose STREAMINFO in the codec_specific_config.
Make this first metadata block available since it's the minimum necessary metadata, and the complete list of blocks could be quite large.
1 parent e1f6359 commit de242ed

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mp4parse_capi/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,14 @@ pub unsafe extern fn mp4parse_get_track_audio_info(parser: *mut mp4parse_parser,
448448
(*info).sample_rate = rate;
449449
}
450450
}
451-
AudioCodecSpecific::FLACSpecificBox(_) => {
452-
return MP4PARSE_ERROR_UNSUPPORTED;
451+
AudioCodecSpecific::FLACSpecificBox(ref flac) => {
452+
// Return the STREAMINFO metadata block in the codec_specific.
453+
let streaminfo = &flac.blocks[0].data;
454+
if streaminfo.len() > std::u32::MAX as usize {
455+
return MP4PARSE_ERROR_INVALID;
456+
}
457+
(*info).codec_specific_config.length = streaminfo.len() as u32;
458+
(*info).codec_specific_config.data = streaminfo.as_ptr();
453459
}
454460
AudioCodecSpecific::OpusSpecificBox(ref opus) => {
455461
let mut v = Vec::new();

0 commit comments

Comments
 (0)