mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:07:46 +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
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);
|
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 {
|
m_current_frame = FlacFrameHeader {
|
||||||
sample_count,
|
.sample_rate = frame_sample_rate,
|
||||||
frame_sample_rate,
|
.sample_count = static_cast<u16>(sample_count),
|
||||||
channel_type,
|
.sample_or_frame_index = static_cast<u32>(m_current_sample_or_frame),
|
||||||
bit_depth,
|
.blocking_strategy = static_cast<BlockingStrategy>(blocking_strategy),
|
||||||
specified_checksum,
|
.channels = channel_type,
|
||||||
|
.bit_depth = bit_depth,
|
||||||
|
.checksum = specified_header_checksum,
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 subframe_count = frame_channel_type_to_channel_count(channel_type);
|
u8 subframe_count = frame_channel_type_to_channel_count(channel_type);
|
||||||
|
|
|
@ -86,10 +86,19 @@ struct FlacRawMetadataBlock {
|
||||||
ByteBuffer data;
|
ByteBuffer data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class BlockingStrategy : u8 {
|
||||||
|
Fixed = 0,
|
||||||
|
Variable = 1,
|
||||||
|
};
|
||||||
|
|
||||||
// 11.22. FRAME_HEADER
|
// 11.22. FRAME_HEADER
|
||||||
struct FlacFrameHeader {
|
struct FlacFrameHeader {
|
||||||
u32 sample_count;
|
|
||||||
u32 sample_rate;
|
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;
|
FlacFrameChannelType channels;
|
||||||
u8 bit_depth;
|
u8 bit_depth;
|
||||||
u8 checksum;
|
u8 checksum;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue