Skip to content

CI: canonical codec enum + normalization + placeholder-sentinel lint (#180) - #182

Open
ch-bas wants to merge 1 commit into
mainfrom
feat/codec-lint-180
Open

CI: canonical codec enum + normalization + placeholder-sentinel lint (#180)#182
ch-bas wants to merge 1 commit into
mainfrom
feat/codec-lint-180

Conversation

@ch-bas

@ch-bas ch-bas commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Closes #180.

Makes codec a validated, canonical field and adds a guard against semantically-invalid placeholder values.

Schema

  • Added a codec enum to both video.codecs[] and video.streams[].codec:
    H.264, H.264+, H.265, H.265+, MJPEG, JPEG, AV1, Ultra265, MPEG-4.
  • Ajv now rejects any out-of-enum codec on new cameras automatically (no extra code path).

Data normalization (114 files, one-time)

The codecs[] list had drifted across brands. Folded to the enum:

Was Now
h264, H264, H.264H, H.264B, Smart H.264 H.264
Smart H.264+ H.264+
Smart H.265, Smart 265 H.265
Smart H.265+ H.265+
M-JPEG MJPEG
per-stream H.264/H.265 H.265 (primary)

codecs[] is de-duplicated after folding. Kept as genuinely-distinct real codecs: AV1, Ultra265 (Uniview), MPEG-4, JPEG.

Placeholder-sentinel lint (build.js)

Fails validation on known bad-data sentinels — extendable list, currently:

  • night_vision.min_lux === 0 / min_lux_color === 0 — the "0 lux, IR on" figure, which is not the ambient sensitivity the field represents (this once required stripping 15 entries by hand).
  • weight_g === 0

Verification

  • node scripts/build.js → builds 2,618 cameras clean.
  • Negative-tested: the enum rejects h264/Smart 265 on both fields; the sentinel lint fails the build on min_lux: 0.

#180)

Schema:
- add a codec `enum` to both `video.codecs[]` and `video.streams[].codec`:
  H.264, H.264+, H.265, H.265+, MJPEG, JPEG, AV1, Ultra265, MPEG-4.
  Ajv now rejects any drift on new cameras automatically.

Data (one-time normalization, 114 files):
- h264 / H264 / H.264H / H.264B / "Smart H.264" -> H.264
- "Smart H.264+" -> H.264+; "Smart H.265"/"Smart 265" -> H.265; "Smart H.265+" -> H.265+
- M-JPEG -> MJPEG; per-stream "H.264/H.265" -> H.265 (primary)
- dedupe codecs[] after folding

build.js:
- placeholder/sentinel guard: fail validation on min_lux/min_lux_color/weight_g === 0
  (the "0 lux, IR on" trap that once required stripping 15 entries by hand).
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.

CI: normalize + validate stream codec (enum) + placeholder-sentinel lint

1 participant