Skip to content

Merge native codec stack into develop - #509

Merged
Onat-Inak merged 12 commits into
developfrom
integration/native-codec-stack
Jul 3, 2026
Merged

Merge native codec stack into develop#509
Onat-Inak merged 12 commits into
developfrom
integration/native-codec-stack

Conversation

@Onat-Inak

@Onat-Inak Onat-Inak commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Why

This promotes the native JPEG/MJPEG codec stack from integration/native-codec-stack into develop.

Before this work, users had to assemble JPEG/MJPEG source, framing, depacketize, parse, and decode paths themselves. That pushed codec-specific GStreamer details into Apps and made standard RTSP/HTTP camera topologies harder to reuse and test.

After this PR, Core owns reusable public codec graph APIs for native H.264, JPEG, and MJPEG decode in C++ and PyNeat.

User Benefits

  • Users get one native decoder API for H.264, JPEG, and MJPEG through SimaDecode.
  • Apps can use reusable Core RTSP and HTTP MJPEG graph groups instead of manually assembling source/framing/decode paths.
  • Existing RTSP H.264 users stay source-compatible because H.264 remains the default RtspDecodedInput codec.
  • MJPEG support is explicit and codec-aware, so RTSP MJPEG and HTTP MJPEG do not reuse H.264 assumptions.
  • CPU JPEG decode remains available through JpegDecode when users explicitly want the software jpegdec path.
  • RTSP MJPEG decoded input can use stream SDP FPS instead of requiring users to hardcode dec_fps when the stream advertises a usable framerate.
  • Local HTTPS MJPEG sources can disable strict TLS validation through an explicit option while strict validation remains the default.

What Changed

  • Added nodes::SimaDecode(...) / pyneat.nodes.sima_decode(...).
  • Added SimaDecodeOptions and SimaDecodeType::{H264,JPEG,MJPEG}.
  • Deprecated nodes::H264Decode(...) / pyneat.nodes.h264_decode(...) for new code while preserving existing H.264 source compatibility.
  • Kept nodes::JpegDecode() / pyneat.nodes.jpeg_decode() as the explicit CPU/GStreamer jpegdec path.
  • Added JPEG/MJPEG framing APIs:
    • nodes::HttpSource(...) / pyneat.nodes.http_source(...)
    • nodes::MultipartJpegDemux(...) / pyneat.nodes.multipart_jpeg_demux(...)
    • nodes::JpegParse(...) / pyneat.nodes.jpeg_parse(...)
    • nodes::RTPJpegDepacketize(...) / pyneat.nodes.rtp_jpeg_depacketize(...)
  • Added HTTP MJPEG decoded input:
    • nodes::groups::HttpMjpegDecodedInput(...)
    • pyneat.groups.http_mjpeg_decoded_input(...)
    • HttpMjpegDecodedInputOptions
    • HttpMjpegDecodedInputOutputSpec(...)
  • Added RTSP encoded input:
    • nodes::groups::RtspEncodedInput(...)
    • pyneat.groups.rtsp_encoded_input(...)
    • RtspEncodedInputOptions
    • RtspEncodedInputOutputSpec(...)
    • RtspCodec::{H264,MJPEG}
  • Extended RTSP decoded input:
    • nodes::groups::RtspDecodedInput(...)
    • pyneat.groups.rtsp_decoded_input(...)
    • RtspDecodedInputOptions::codec
    • RtspDecodedInputOutputSpec(...)
  • Added MJPEG caps repair before native decode when upstream JPEG caps report missing or invalid FPS.
  • Added RTSP MJPEG auto-FPS derivation from SDP, including payload-aware JPEG media selection.
  • Added ssl_strict options for local HTTPS MJPEG sources while keeping strict TLS validation enabled by default.
  • Updated public node documentation and API-surface coverage.

Topologies

HTTP MJPEG decoded input:

HttpSource -> MultipartJpegDemux -> JpegParse -> SimaDecode(MJPEG)

RTSP H.264 encoded input:

RTSPInput -> H264Depacketize -> H264Parse

RTSP MJPEG encoded input:

RTSPInput -> RTPJpegDepacketize -> JpegParse

RTSP decoded input:

RtspEncodedInput(codec) -> SimaDecode(codec)

H.264 remains the default RtspDecodedInput codec.

Included PRs

Issue Coverage

Validation

Validation was performed in the staged PRs before promotion into develop.

Covered validation includes:

  • C++ unit coverage for SimaDecode.
  • C++ unit coverage for JPEG framing nodes.
  • C++ unit coverage for HTTP MJPEG decoded input.
  • C++ unit coverage for RTSP encoded and decoded input.
  • Python API-surface coverage for exposed public APIs.
  • Documentation generation for updated public node guidance.
  • H.264 compatibility coverage for the existing decode path.
  • Focused SDK/board validation for RTSP MJPEG SDP FPS repair.
  • Modalix Apps sandbox smoke coverage in Fix MJPEG decoded source caps #516 for RTSP H.264, RTSP MJPEG, and HTTP MJPEG paths.

Current PR CI was still running when this body was drafted.

Risk

This PR adds public codec APIs and extends RTSP decoded input behavior.

H.264 remains the default RTSP decoded codec, so existing H.264 users should remain source-compatible. H.265 is intentionally not part of this stack.

Follow-up

Live codec runtime coverage remains tracked under #507 for broader RTSP H.264, RTSP MJPEG, HTTP MJPEG, performance, determinism, and accuracy validation.

Refs #197
Refs #437
Refs #436
Refs #448
Refs #495
Refs #449
Refs #438
Refs #515
Refs #527

Onat-Inak added 5 commits July 1, 2026 20:35
* feat(codec): add native decode node

* feat(codec): deprecate h264 decode API

* refactor(codec): use simadecode for h264 paths

* fix(codec): warn on h264 decode class use

* docs(codec): fix simadecode graph snippet

* test(graph): fix legacy input policy test
* feat(core): add HTTP MJPEG decoded input

* test(groups): cover HTTP MJPEG topology
* feat(rtsp): add encoded input group

Add a reusable encoded RTSP source group for H.264 and MJPEG so decoded RTSP inputs and custom app topologies can share the same source/depacketize/parse contract.

Refs #495

* fix(rtsp): preserve decoded options source API

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e34933303

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/nodes/rtp/RTPJpegDepacketize.cpp Outdated
* fix(codec): normalize MJPEG source caps

Use the configured MJPEG decode framerate to repair missing or invalid JPEG input caps before native decode. This lets RTSP and HTTP MJPEG decoded inputs accept streams that report framerate=0/1 while preserving strict defaults for other paths.

Expose HTTP TLS strictness as an explicit source option so local HTTPS MJPEG streams with non-public certificates can be consumed without hardcoded behavior.

Refs #515

* fix(api): preserve HTTP MJPEG option layout
* fix(codec): derive RTSP MJPEG caps fps

RTSP MJPEG decoded inputs should not require callers to pass dec_fps when the stream already exposes a usable framerate through SDP. Use the existing encoded caps fixup path to apply the RTSP-derived FPS when no explicit fallback is provided, while keeping explicit dec_fps behavior intact.

Refs #527

* fix(codec): match MJPEG SDP payload fps

MJPEG auto-caps should derive framerate from the RTP media section selected by the JPEG payload filter, not from the first video media advertised in a mixed SDP.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab9c0405b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pipeline/graph/GraphBuildPipeline.cpp Outdated
* fix(codec): match unfiltered MJPEG SDP fps

MJPEG payload filtering can be disabled while the RTP caps still require JPEG encoding. Keep SDP framerate derivation on the JPEG media in that mode instead of falling back to the first video framerate.

* fix(codec): preserve static JPEG SDP fps

Unfiltered MJPEG RTP caps still select JPEG media. Treat static RTP payload 26 as JPEG when SDP omits rtpmap so auto-caps can use that media framerate instead of falling back to no FPS.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd4b84914d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pipeline/graph/GraphBuildSource.cpp
MJPEG auto-caps should use stream-derived SDP framerate before the configured fallback when both are available. Also attach encoded caps fixup probes in pushed-input builds so the public node behaves consistently outside source-owned graphs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a3b7ae7c0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/nodes/groups/RtspDecodedInput.cpp Outdated
Respect auto_caps_from_stream for MJPEG caps repair by using RTSP SDP FPS only when the source group explicitly enables stream-derived caps. Fallback-only fixups continue to use the configured dec_fps.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da9c1a61b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/src/module.cpp
@Onat-Inak
Onat-Inak merged commit 561ad51 into develop Jul 3, 2026
9 checks passed
@Onat-Inak
Onat-Inak deleted the integration/native-codec-stack branch July 7, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add generic native-IP JPEG/MJPEG decode support

2 participants