Support JOC downmix configurations 0..4 and update the vendored kernel
build / windows (push) Has been cancelled
build / release (push) Has been cancelled

This commit is contained in:
TheM14 committed 2026-10-16 19:56:00 +08:00
1 parent cb840af52f
commit 2cfebe914d
32 files changed
+2055 -300

No files matched your search

+25 -1
View File
@@ -20,6 +20,11 @@ struct Payload {
std::uint16_t sample_offset = 0;
std::size_t bit_offset = 0; // MSB-first bit position of the payload bytes
std::size_t size = 0; // payload byte count
// Payload configuration data (ETSI TS 102 366 H.2.2.3). Spec section 8.2 and
// its Table 56 associate the OAMD and JOC payloads of one frame by an equal
// group id, which is how several containers in one syncframe are told apart.
std::uint8_t group_id = 0;
std::uint8_t has_group_id = 0;
};
struct Container {
@@ -43,7 +48,26 @@ Status parse_at(const std::uint8_t* data, std::size_t size, std::size_t start_bi
// All candidate 0x5838 bit offsets over the eight alignments, ascending.
void marker_offsets(const std::uint8_t* data, std::size_t size, std::vector<std::size_t>* out);
Status find_joc_emdf(const std::uint8_t* data, std::size_t size, Container* out);
// Scores how well a candidate container can serve as the frame's metadata when a
// syncframe carries more than one: 0 = not at all, higher = more credible. A null
// predicate keeps the strict behaviour: several top-level candidates are an error,
// never a choice.
using ContainerPredicate = int (*)(const std::uint8_t* data, std::size_t size,
const Container& container);
// When a syncframe holds several top-level candidates and `usable` leaves exactly
// one with the highest non-zero score, that one is returned and `ignored_extra` is
// set; otherwise the frame stays an ambiguity error.
Status find_joc_emdf(const std::uint8_t* data, std::size_t size, Container* out,
ContainerPredicate usable = nullptr, bool* ignored_extra = nullptr);
// Like find_joc_emdf(), but a syncframe that carries no EMDF marker at all is a
// normal "absent" result rather than an error. A syncframe that does carry
// markers but no usable JOC container still fails, so a real transport problem
// is never mistaken for a core substream.
Status find_joc_emdf_optional(const std::uint8_t* data, std::size_t size, bool* present,
Container* out, ContainerPredicate usable = nullptr,
bool* ignored_extra = nullptr);
// Extract the container's bytes exactly as the bit reader sees them (identical
// to a memcpy for byte-aligned containers).