Skip to content

Conversation

@x15sr71
Copy link
Contributor

@x15sr71 x15sr71 commented Nov 22, 2025

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

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:

Error: In process_data: datanode->buffer is of unknown data type!

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)

  • Added CCX_STREAM_TYPE_VIDEO_HEVC = 0x24 to the stream type enumeration

2. Updated stream type handling (ts_functions.c)

  • get_buffer_type_str(): Returns "HEVC" for HEVC streams (for logging/display)
  • get_buffer_type(): Maps HEVC to CCX_H264 buffer type (HEVC uses similar NAL unit structure)
  • init_ts(): Added "HEVC video" description to the stream type lookup table

3. Updated PMT parsing (ts_tables.c)

  • get_printable_stream_type(): Converts raw 0x24 stream type to CCX_STREAM_TYPE_VIDEO_HEVC
  • parse_PMT(): Extended video stream detection to include HEVC alongside H.264 and MPEG2
  • Added informative message: "Detected HEVC video stream (0x24) - enabling ATSC CC parsing."
  • Removed commented-out dead code for cleaner maintenance

Testing

Tested with ATSC 3.0 TS file from issue #1639. Results:

Before:

Error: In process_data: datanode->buffer is of unknown data type!

After:

Detected HEVC video stream (0x24) - enabling ATSC CC parsing.
HEVC video stream [0x24]  -  PID: 49
...
No captions were found in input.

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:

No captions were found in input.

This is because:

  1. HEVC captions may be embedded in SEI (Supplemental Enhancement Information) messages with different structure than H.264
  2. The sample file contains STPP (Subtitling and Timed Text) format data (codec_tag=0x50505453 per ffprobe), which requires a separate parser
  3. Caption extraction from HEVC requires additional development.
    This 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 value
  • src/lib_ccx/ts_functions.c - Added HEVC handling in 3 functions
  • src/lib_ccx/ts_tables.c - Added HEVC detection and PMT parsing support

Note 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.

@x15sr71 x15sr71 changed the title [FIX] Add HEVC/H.265 stream type recognition to prevent crashes on ATSC 3.0 streams [FIX]: Add HEVC/H.265 stream type recognition to prevent crashes on ATSC 3.0 streams Nov 22, 2025
@x15sr71
Copy link
Contributor Author

x15sr71 commented Nov 22, 2025

The CI failures are infrastructure issues:

Mac build: hashFiles('**/Cargo.lock') — workflow references Rust files that don’t exist.

Windows builds: libxml2 hash mismatch — vcpkg download issue.

My changes only modify:
ccx_common_constants.h, ts_functions.c, and ts_tables.c — none affect Cargo or libxml2.

Local testing:
Fix correctly detects HEVC (0x24) and enables ATSC CC parsing.

Requesting a maintainer review or CI re-run once the infra issues are resolved, since these failures are not caused by this PR.

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 42d7509...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 86/86
Teletext 21/21
WTV 13/13
XDS 34/34

Congratulations: Merging this PR would fix the following tests:


All tests passing on the master branch were passed completely.

Check the result page for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants