[FIX]: Add HEVC/H.265 stream type recognition to prevent crashes on ATSC 3.0 streams #1769
+22
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Summary
This PR adds recognition for HEVC/H.265 video streams (stream type
0x24) in MPEG-TS files, fixing crashes when processing ATSC 3.0 broadcasts. This is a partial fix for issue #1639.Problem
When CCExtractor encounters HEVC-encoded streams (commonly used in ATSC 3.0 broadcasts), it crashes with:
This occurs because the codebase did not recognize stream type
0x24(HEVC/H.265), causing it to be treated as an unknown stream type.Changes Made
1. Added HEVC enum constant (
ccx_common_constants.h)CCX_STREAM_TYPE_VIDEO_HEVC = 0x24to the stream type enumeration2. Updated stream type handling (
ts_functions.c)get_buffer_type_str(): Returns"HEVC"for HEVC streams (for logging/display)get_buffer_type(): Maps HEVC toCCX_H264buffer type (HEVC uses similar NAL unit structure)init_ts(): Added"HEVC video"description to the stream type lookup table3. Updated PMT parsing (
ts_tables.c)get_printable_stream_type(): Converts raw0x24stream type toCCX_STREAM_TYPE_VIDEO_HEVCparse_PMT(): Extended video stream detection to include HEVC alongside H.264 and MPEG2"Detected HEVC video stream (0x24) - enabling ATSC CC parsing."Testing
Tested with ATSC 3.0 TS file from issue #1639. Results:
Before:
After:
The crash is fixed and HEVC streams are properly recognized.
Limitations
Important: While this PR fixes the crash and enables HEVC stream recognition, it does not extract captions from HEVC streams. Users will see:
This is because:
codec_tag=0x50505453per ffprobe), which requires a separate parserThis PR is foundational work - as currently CCextractor cannot extract captions from HEVC if the system doesn't even recognize HEVC streams. This prevents crashes and enables future caption extraction work.
Files Changed
src/lib_ccx/ccx_common_constants.h- Added HEVC enum valuesrc/lib_ccx/ts_functions.c- Added HEVC handling in 3 functionssrc/lib_ccx/ts_tables.c- Added HEVC detection and PMT parsing supportNote to maintainers: This is a stepping-stone PR. It doesn't solve the full caption extraction problem, but it's a necessary prerequisite. ATSC 3.0 adoption is growing in the US, and at minimum, CCExtractor should not crash when encountering these streams. I'm happy to address any feedback or make adjustments as needed.