Update the kernel headers to 1.3.0

Both copies of the three public headers follow the main repository:
third_party/joc/include for the cplugin and fork/files/audio/decode for the
ad_joc patch now carry joc_core.h, joc_stream.h and joc_version.h from
JustOneCacophonyCXX abce846 (version 1.3.0).  The fix behind them turns an
ID14 payload that ends inside joc_data into a frame status (7) instead of a
stream error, so the renderer holds the previous matrices and playback
continues; joc_stream_status_info gains an appended truncated_joc_frames
field while JOC_ABI_VERSION stays at 6, so neither integration needs a code
change.

tools/verify_kernel.ps1 reports all three headers byte-identical to the
checkout.  tools/build.ps1 -JocCoreSource compiles joc_mpv.dll against the
synced headers and builds joc_core.dll from the fixed source; with that core
next to the portable mpv build, --ad=joc plays the reported M4A to the end
instead of stopping at 2:12.672.
This commit is contained in:
TheM14 committed 2026-11-10 00:18:07 +08:00
1 parent 0d8ccbf5cd
commit 27aa8881f4
6 files changed
+54 -22

No files matched your search

+19 -7
View File
@@ -190,9 +190,10 @@ typedef struct joc_object_params {
/* Per-frame JOC parse status (joc_frame_params.status). A non-zero status makes /* Per-frame JOC parse status (joc_frame_params.status). A non-zero status makes
* the frame invalid for rendering: the renderer holds the previous matrices or * the frame invalid for rendering: the renderer holds the previous matrices or
* passes the core PCM through instead of decoding the matrix. Only status 3 * passes the core PCM through instead of decoding the matrix. Statuses 3 and 7
* still carries a complete object list (object count clamped to 15) for * still carry the complete header and object list for diagnostics; statuses 2
* diagnostics; statuses 2 and 4 stop the parse after the failing header field. */ * and 4 stop the parse after the failing header field, and 7 stops inside
* joc_data, so only the per-object matrices are missing there. */
enum { enum {
JOC_FRAME_STATUS_OK = 0, JOC_FRAME_STATUS_OK = 0,
JOC_FRAME_STATUS_UNSUPPORTED_DMX = 2, /* joc_dmx_config_idx outside 0..4 */ JOC_FRAME_STATUS_UNSUPPORTED_DMX = 2, /* joc_dmx_config_idx outside 0..4 */
@@ -200,7 +201,11 @@ enum {
JOC_FRAME_STATUS_BAD_PARAMETER_BAND = 4, /* unknown num_bands index */ JOC_FRAME_STATUS_BAD_PARAMETER_BAND = 4, /* unknown num_bands index */
JOC_FRAME_STATUS_BAD_OFFSET_TS = 5, /* offset_ts outside 0..23 or not */ JOC_FRAME_STATUS_BAD_OFFSET_TS = 5, /* offset_ts outside 0..23 or not */
/* strictly increasing */ /* strictly increasing */
JOC_FRAME_STATUS_TRAILING_DATA = 6 /* bytes after joc_data alignment */ JOC_FRAME_STATUS_TRAILING_DATA = 6, /* bytes after joc_data alignment */
/* The ID14 payload ends before its joc_data is complete. The header,
* clipgain, sequence counter and object parameters are intact, so the frame
* stays classified and is concealed by holding the previous matrices. */
JOC_FRAME_STATUS_TRUNCATED = 7
}; };
typedef struct joc_frame_params { typedef struct joc_frame_params {
@@ -225,12 +230,18 @@ typedef struct joc_frame_params {
joc_object_params objects[JOC_MAX_OBJECTS]; joc_object_params objects[JOC_MAX_OBJECTS];
} joc_frame_params; } joc_frame_params;
/* Parse an EMDF ID14 (JOC) payload. */ /* Parse an EMDF ID14 (JOC) payload. A payload that ends inside joc_data is a
* damaged frame rather than a transport error: the call succeeds, the header and
* object parameters are filled in, and out_params->status is
* JOC_FRAME_STATUS_TRUNCATED. A payload too short for the 12-bit joc_header is
* unclassifiable and stays JOC_ERR_BITSTREAM_TRUNCATED. */
JOC_API joc_error JOC_CALL joc_parse_id14(const uint8_t* payload, size_t payload_size, JOC_API joc_error JOC_CALL joc_parse_id14(const uint8_t* payload, size_t payload_size,
joc_frame_params* out_params); joc_frame_params* out_params);
/* Locate the contiguous JOC EMDF container inside one E-AC-3 syncframe and /* Locate the contiguous JOC EMDF container inside one E-AC-3 syncframe and
* parse its ID14 payload. out_emdf may be NULL. */ * parse its ID14 payload. out_emdf may be NULL. A damaged ID14 payload is
* reported through out_params->status like joc_parse_id14(); an incomplete
* container stays a transport error. */
JOC_API joc_error JOC_CALL joc_parse_eac3_frame(const uint8_t* frame, size_t frame_size, JOC_API joc_error JOC_CALL joc_parse_eac3_frame(const uint8_t* frame, size_t frame_size,
joc_frame_params* out_params, joc_frame_params* out_params,
joc_emdf_info* out_emdf); joc_emdf_info* out_emdf);
@@ -251,7 +262,8 @@ JOC_API joc_error JOC_CALL joc_eac3_frame_bytes(const uint8_t* data, size_t size
/* Strict trailing-bit check for the JOC payload (A/B robustness corpus). /* Strict trailing-bit check for the JOC payload (A/B robustness corpus).
* Returns JOC_ERR_BITSTREAM_PADDING when more than 7 bits are left over or the * Returns JOC_ERR_BITSTREAM_PADDING when more than 7 bits are left over or the
* leftover bits are not zero. */ * leftover bits are not zero, and JOC_ERR_BITSTREAM_TRUNCATED when the payload
* ends inside joc_data. */
JOC_API joc_error JOC_CALL joc_check_id14_padding(const uint8_t* payload, size_t payload_size, JOC_API joc_error JOC_CALL joc_check_id14_padding(const uint8_t* payload, size_t payload_size,
uint32_t* out_trailing_bits); uint32_t* out_trailing_bits);
+6 -2
View File
@@ -97,8 +97,9 @@ typedef struct joc_stream_status_info {
uint64_t oamd_payloads; uint64_t oamd_payloads;
uint64_t oamd_transitions; uint64_t oamd_transitions;
/* Metadata the renderer had to work around, per audio frame: no JOC payload at /* Metadata the renderer had to work around, per audio frame: no JOC payload at
* all, a declared object count clamped to 15, and a syncframe carrying a second * all, an ID14 payload that ends inside joc_data (that frame holds the previous
* EMDF container that is not this frame's JOC metadata. */ * matrices), a declared object count clamped to 15, and a syncframe carrying a
* second EMDF container that is not this frame's JOC metadata. */
uint64_t missing_joc_frames; uint64_t missing_joc_frames;
uint64_t objects_clamped_frames; uint64_t objects_clamped_frames;
uint64_t extra_container_frames; uint64_t extra_container_frames;
@@ -108,6 +109,9 @@ typedef struct joc_stream_status_info {
uint64_t bed_mask_mismatch_frames; uint64_t bed_mask_mismatch_frames;
uint32_t output_channels; uint32_t output_channels;
uint32_t ended; /* 1 after flush() */ uint32_t ended; /* 1 after flush() */
/* Appended field: joc_stream_status() accepts the size that ends at `ended`
* as well, so a caller built against the previous header keeps working. */
uint64_t truncated_joc_frames;
} joc_stream_status_info; } joc_stream_status_info;
JOC_API joc_error JOC_CALL joc_stream_create(const joc_stream_config* config, joc_stream** out); JOC_API joc_error JOC_CALL joc_stream_create(const joc_stream_config* config, joc_stream** out);
+2 -2
View File
@@ -9,8 +9,8 @@
#define JOC_VERSION_H #define JOC_VERSION_H
#define JOC_VERSION_MAJOR 1 #define JOC_VERSION_MAJOR 1
#define JOC_VERSION_MINOR 2 #define JOC_VERSION_MINOR 3
#define JOC_VERSION_PATCH 0 #define JOC_VERSION_PATCH 0
#define JOC_VERSION_STRING "1.2.0" #define JOC_VERSION_STRING "1.3.0"
#endif /* JOC_VERSION_H */ #endif /* JOC_VERSION_H */
+19 -7
View File
@@ -190,9 +190,10 @@ typedef struct joc_object_params {
/* Per-frame JOC parse status (joc_frame_params.status). A non-zero status makes /* Per-frame JOC parse status (joc_frame_params.status). A non-zero status makes
* the frame invalid for rendering: the renderer holds the previous matrices or * the frame invalid for rendering: the renderer holds the previous matrices or
* passes the core PCM through instead of decoding the matrix. Only status 3 * passes the core PCM through instead of decoding the matrix. Statuses 3 and 7
* still carries a complete object list (object count clamped to 15) for * still carry the complete header and object list for diagnostics; statuses 2
* diagnostics; statuses 2 and 4 stop the parse after the failing header field. */ * and 4 stop the parse after the failing header field, and 7 stops inside
* joc_data, so only the per-object matrices are missing there. */
enum { enum {
JOC_FRAME_STATUS_OK = 0, JOC_FRAME_STATUS_OK = 0,
JOC_FRAME_STATUS_UNSUPPORTED_DMX = 2, /* joc_dmx_config_idx outside 0..4 */ JOC_FRAME_STATUS_UNSUPPORTED_DMX = 2, /* joc_dmx_config_idx outside 0..4 */
@@ -200,7 +201,11 @@ enum {
JOC_FRAME_STATUS_BAD_PARAMETER_BAND = 4, /* unknown num_bands index */ JOC_FRAME_STATUS_BAD_PARAMETER_BAND = 4, /* unknown num_bands index */
JOC_FRAME_STATUS_BAD_OFFSET_TS = 5, /* offset_ts outside 0..23 or not */ JOC_FRAME_STATUS_BAD_OFFSET_TS = 5, /* offset_ts outside 0..23 or not */
/* strictly increasing */ /* strictly increasing */
JOC_FRAME_STATUS_TRAILING_DATA = 6 /* bytes after joc_data alignment */ JOC_FRAME_STATUS_TRAILING_DATA = 6, /* bytes after joc_data alignment */
/* The ID14 payload ends before its joc_data is complete. The header,
* clipgain, sequence counter and object parameters are intact, so the frame
* stays classified and is concealed by holding the previous matrices. */
JOC_FRAME_STATUS_TRUNCATED = 7
}; };
typedef struct joc_frame_params { typedef struct joc_frame_params {
@@ -225,12 +230,18 @@ typedef struct joc_frame_params {
joc_object_params objects[JOC_MAX_OBJECTS]; joc_object_params objects[JOC_MAX_OBJECTS];
} joc_frame_params; } joc_frame_params;
/* Parse an EMDF ID14 (JOC) payload. */ /* Parse an EMDF ID14 (JOC) payload. A payload that ends inside joc_data is a
* damaged frame rather than a transport error: the call succeeds, the header and
* object parameters are filled in, and out_params->status is
* JOC_FRAME_STATUS_TRUNCATED. A payload too short for the 12-bit joc_header is
* unclassifiable and stays JOC_ERR_BITSTREAM_TRUNCATED. */
JOC_API joc_error JOC_CALL joc_parse_id14(const uint8_t* payload, size_t payload_size, JOC_API joc_error JOC_CALL joc_parse_id14(const uint8_t* payload, size_t payload_size,
joc_frame_params* out_params); joc_frame_params* out_params);
/* Locate the contiguous JOC EMDF container inside one E-AC-3 syncframe and /* Locate the contiguous JOC EMDF container inside one E-AC-3 syncframe and
* parse its ID14 payload. out_emdf may be NULL. */ * parse its ID14 payload. out_emdf may be NULL. A damaged ID14 payload is
* reported through out_params->status like joc_parse_id14(); an incomplete
* container stays a transport error. */
JOC_API joc_error JOC_CALL joc_parse_eac3_frame(const uint8_t* frame, size_t frame_size, JOC_API joc_error JOC_CALL joc_parse_eac3_frame(const uint8_t* frame, size_t frame_size,
joc_frame_params* out_params, joc_frame_params* out_params,
joc_emdf_info* out_emdf); joc_emdf_info* out_emdf);
@@ -251,7 +262,8 @@ JOC_API joc_error JOC_CALL joc_eac3_frame_bytes(const uint8_t* data, size_t size
/* Strict trailing-bit check for the JOC payload (A/B robustness corpus). /* Strict trailing-bit check for the JOC payload (A/B robustness corpus).
* Returns JOC_ERR_BITSTREAM_PADDING when more than 7 bits are left over or the * Returns JOC_ERR_BITSTREAM_PADDING when more than 7 bits are left over or the
* leftover bits are not zero. */ * leftover bits are not zero, and JOC_ERR_BITSTREAM_TRUNCATED when the payload
* ends inside joc_data. */
JOC_API joc_error JOC_CALL joc_check_id14_padding(const uint8_t* payload, size_t payload_size, JOC_API joc_error JOC_CALL joc_check_id14_padding(const uint8_t* payload, size_t payload_size,
uint32_t* out_trailing_bits); uint32_t* out_trailing_bits);
+6 -2
View File
@@ -97,8 +97,9 @@ typedef struct joc_stream_status_info {
uint64_t oamd_payloads; uint64_t oamd_payloads;
uint64_t oamd_transitions; uint64_t oamd_transitions;
/* Metadata the renderer had to work around, per audio frame: no JOC payload at /* Metadata the renderer had to work around, per audio frame: no JOC payload at
* all, a declared object count clamped to 15, and a syncframe carrying a second * all, an ID14 payload that ends inside joc_data (that frame holds the previous
* EMDF container that is not this frame's JOC metadata. */ * matrices), a declared object count clamped to 15, and a syncframe carrying a
* second EMDF container that is not this frame's JOC metadata. */
uint64_t missing_joc_frames; uint64_t missing_joc_frames;
uint64_t objects_clamped_frames; uint64_t objects_clamped_frames;
uint64_t extra_container_frames; uint64_t extra_container_frames;
@@ -108,6 +109,9 @@ typedef struct joc_stream_status_info {
uint64_t bed_mask_mismatch_frames; uint64_t bed_mask_mismatch_frames;
uint32_t output_channels; uint32_t output_channels;
uint32_t ended; /* 1 after flush() */ uint32_t ended; /* 1 after flush() */
/* Appended field: joc_stream_status() accepts the size that ends at `ended`
* as well, so a caller built against the previous header keeps working. */
uint64_t truncated_joc_frames;
} joc_stream_status_info; } joc_stream_status_info;
JOC_API joc_error JOC_CALL joc_stream_create(const joc_stream_config* config, joc_stream** out); JOC_API joc_error JOC_CALL joc_stream_create(const joc_stream_config* config, joc_stream** out);
+2 -2
View File
@@ -9,8 +9,8 @@
#define JOC_VERSION_H #define JOC_VERSION_H
#define JOC_VERSION_MAJOR 1 #define JOC_VERSION_MAJOR 1
#define JOC_VERSION_MINOR 2 #define JOC_VERSION_MINOR 3
#define JOC_VERSION_PATCH 0 #define JOC_VERSION_PATCH 0
#define JOC_VERSION_STRING "1.2.0" #define JOC_VERSION_STRING "1.3.0"
#endif /* JOC_VERSION_H */ #endif /* JOC_VERSION_H */