mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibAudio: Store all available data in the FLAC frame header
This will make it possible to write the header back out.
This commit is contained in:
parent
7bb128e1ed
commit
60f1472902
Notes:
sideshowbarker
2024-07-18 05:01:22 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/60f1472902 Pull-request: https://github.com/SerenityOS/serenity/pull/19790 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/alimpfard
2 changed files with 17 additions and 6 deletions
|
@ -440,11 +440,13 @@ LoaderSamples FlacLoaderPlugin::next_frame()
|
|||
dbgln_if(AFLACLOADER_DEBUG, "Frame: {} samples, {}bit {}Hz, channeltype {:x}, {} number {}, header checksum {:02x}{}", sample_count, bit_depth, frame_sample_rate, channel_type_num, blocking_strategy ? "sample" : "frame", m_current_sample_or_frame, specified_header_checksum, specified_header_checksum != calculated_header_checksum ? " (checksum error)"sv : ""sv);
|
||||
|
||||
m_current_frame = FlacFrameHeader {
|
||||
sample_count,
|
||||
frame_sample_rate,
|
||||
channel_type,
|
||||
bit_depth,
|
||||
specified_checksum,
|
||||
.sample_rate = frame_sample_rate,
|
||||
.sample_count = static_cast<u16>(sample_count),
|
||||
.sample_or_frame_index = static_cast<u32>(m_current_sample_or_frame),
|
||||
.blocking_strategy = static_cast<BlockingStrategy>(blocking_strategy),
|
||||
.channels = channel_type,
|
||||
.bit_depth = bit_depth,
|
||||
.checksum = specified_header_checksum,
|
||||
};
|
||||
|
||||
u8 subframe_count = frame_channel_type_to_channel_count(channel_type);
|
||||
|
|
|
@ -86,10 +86,19 @@ struct FlacRawMetadataBlock {
|
|||
ByteBuffer data;
|
||||
};
|
||||
|
||||
enum class BlockingStrategy : u8 {
|
||||
Fixed = 0,
|
||||
Variable = 1,
|
||||
};
|
||||
|
||||
// 11.22. FRAME_HEADER
|
||||
struct FlacFrameHeader {
|
||||
u32 sample_count;
|
||||
u32 sample_rate;
|
||||
// Referred to as “block size” in the specification.
|
||||
u16 sample_count;
|
||||
// If blocking strategy is fixed, this encodes the frame index instead of the sample index.
|
||||
u32 sample_or_frame_index;
|
||||
BlockingStrategy blocking_strategy;
|
||||
FlacFrameChannelType channels;
|
||||
u8 bit_depth;
|
||||
u8 checksum;
|
||||
|
|
Loading…
Reference in a new issue