Commit Graph
770 Commits
Author SHA1 Message Date
Scott GarrettandClaude Code a287ea6404 Adopt Xcode 27.2 project migration
Purely settings: deployment target raised to the toolchain-recommended
value, string-catalog symbols enabled, c11/c++11 module-verification
standards, LastUpgradeCheck bumped, and Xcode's cosmetic re-sort of the
Matroska file entries in the pbxproj (same files, same targets).

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-28 13:53:01 -05:00
Scott GarrettandClaude Code 79c251c6dc Move the contrib submodule to Gitea
Mirror of SublerApp/contrib now lives at Scott-Files/contrib on
git.technomancer.com so every dependency builds from the fork's own
server over SSH.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-28 13:46:00 -05:00
Scott GarrettandClaude Code e7c7b80e8f Mux VobSub subpic tracks at the frame size declared by the idx
LoadVobSubSubtitles parsed the global `size:` line into locals and threw
it away, and the muxer hardcoded MP4AddSubpicTrack(640, 480), so the
saved display size always read back as 640x480 regardless of what the
subtitle declared. Store the declared size on SBVobSubTrack, carry it
into the model's width/height, and let the muxer pick the subpic display
size with a precedence chain: user-edited trackWidth/trackHeight first,
then the size declared by the subtitle file, then the old 640x480
default. The chosen size is mirrored back into the model, like the
3GText branch does, so the GUI matches what was muxed.

trackWidth/trackHeight are intentionally not set at import time: the
tx3g conversion path reads trackHeight as the default text box height
and then offsets the track by 0.85x, which would push full-frame values
off screen.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-27 02:40:58 -05:00
Scott GarrettandClaude Code e8231dea59 Mirror the file's chapter atoms verbatim in tagsOnly mode
The importer's MP4 normalizations (force the first chapter start to 0,
drop non-first zero-timestamp chapters) belong to the conversion path
only. In tagsOnly mode the model is the baseline a later Chapters
rewrite rebuilds from, so those quirks silently corrupted real files:
mkvmerge happily writes a first chapter starting after 0 and atoms tied
at 0, and the first chapter edit would then shift or delete them. The
remuxer's strictly-ascending clamp already shifts tied starts by +1 ms
at write time, so nothing is lost by keeping every atom at read time.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-26 19:14:44 -05:00
Scott GarrettandClaude Code 10dcee30a6 Round trip the chapter language between model and Matroska
ChapterDisplay/ChapterLanguage (0x437C) was read by the vendored parser
but never surfaced, and the remuxer's chapter builder never wrote it, so
any non-English chapter language silently degraded to the spec default
"eng" the first time Subler rewrote the Chapters element.

The importer now adopts the first ChapterDisplay language as the model
track's language (the model is one-language-per-track; MKV allows
per-atom but every common tool stamps one value). The remuxer stamps the
track language back into every atom as ISO-639-2/B, omitting it when nil
or eng so language-less files keep byte-identical rewrites. Unknown
extended tags map to "und" via MP42Languages and are written explicitly,
which is truthful rather than silently defaulting.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-26 18:17:22 -05:00
Scott GarrettandClaude Code 0cf79eca1c Rebuild Matroska chapters on remux and recompute Info Duration
MP42MkvRemuxer gains replacementChapters: when set, the Chapters element
is rebuilt from the model track instead of copied verbatim (chapterCount
0 removes the element and its SeekHead entry). Chapter timecodes are
written as absolute nanoseconds — libmatroska/mkvtoolnix/ffmpeg all
treat them as ns regardless of TimecodeScale, confirmed by hex-dumping
a mkvmerge-written file and reading it back with mkvinfo and ffprobe.
ChapterAtom is 0xB6 (0xB0 is PixelWidth), and mandatory EditionUID/
ChapterUID are derived deterministically from the content because
ffmpeg silently skips atoms without a ChapterUID. Starts are sorted
ascending with ties clamped to previous+1ms (mkvmerge rejects
non-ascending), empty titles get the importer's "Chapter N" fallback,
and the last atom's end rides the track duration only when known.

An existing Info Duration is recomputed as the greatest written block
start+1ms: the Info payload is rewritten with a fixed 8-byte double
slot patched after the clusters stream past, converted to TimecodeScale
units. Added blocks measure start+1 like source blocks so a second
no-op remux stays byte-identical (including BlockDuration broke
idempotence). Files without a source Duration keep having none.

The importer's chapter /1e6 needed no change (Start is already ns); a
comment now records that so it doesn't get "fixed" to scale-based math.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-26 12:54:43 -05:00
Scott GarrettandClaude Code 8ba3f25a2c Write added subtitle tracks during Matroska remux
MP42MkvRemuxer previously refused any track present in currentTracks
but not in sourceTracks; it now accepts added MP42SubtitleTracks whose
URL extension is srt/ssa/ass and muxes them into the rebuilt file as
S_TEXT/UTF8. The extension gate mirrors the app-side
DocumentWindowController.matroskaSubtitleExtensions list — the two
must stay in sync.

- Each added track gets an appended TrackEntry: TrackNumber = max of
  all entries + 1 (refuse past 0x3FFF, the 2-byte unmarked-vint
  limit), TrackType 17, FlagEnabled 1, FlagLacing 0, CodecID
  S_TEXT/UTF8, ISO 0x22B59C + IETF 0x22B59D language, Name only when
  it differs from the codec default.
- The model never holds subtitle text, so lines are re-parsed from
  track.URL at save time: SRT via LoadSRTFromURL + serializer drain,
  SSA/ASS via MP42SSAParser/MP42SSAConverter (styling stripped, same
  lossy path the tx3g muxer takes). Zero parsed lines refuses.
- Blocks are written as BlockGroup{Block(unmarked-vint track number,
  int16 BE relative timecode, UTF-8 text), BlockDuration(>=1 ms)}.
  The BlockGroup wrapper is mandatory: a bare Block as a direct
  Cluster child is silently ignored by libebml readers even though
  ffmpeg tolerates it.
- Lines are assigned to the last existing Cluster whose Timecode is
  <= the line's start time (inheriting missing cluster timecodes,
  negative relative timecodes are legal); lines whose relative
  timecode would exceed +32767 flush as synthesized Clusters right
  after that cluster. Original clusters are copied verbatim and
  never split.
- Added tracks join the existing per-track CueTrackPositions
  bookkeeping, and the drop-all-remaining guard still fires before
  additions, so drop-all-plus-add stays refused.

Adds TrackType/FlagLacing/CodecID/BlockDuration element ids to
MP42MatroskaTagMapping.h.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-26 11:53:17 -05:00
Scott GarrettandClaude Code e42855867d Fix SSA header parsing for files without a [V4+ Styles] section
Three latent bugs combined into a crash or silently-empty subtitle
import (surfaced by feeding conv.ass to the Matroska subtitle-add
path):

- parseHeader: used NSScanner scanUpToString: for the section
  markers; a failed scanUpToString: returns YES and advances the
  scan location to the end of the string, so a file lacking
  "[V4+ Styles]" left the scanner exhausted and the [Events]
  Format: line was never parsed. Locate the markers with
  rangeOfString: instead.
- The Format line is split on commas but names are separated with
  ", " in the wild; the leading spaces made every field name fail
  its isEqualToString: in MP42SSALine, so no line ever got
  text/timestamps. Split on comma and trim whitespace.
- MP42SSALine's value loop looped to `count - 1` on an NSUInteger;
  with an empty format array that underflows and appends forever
  until the array traps. Guard count == 0.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-26 11:53:01 -05:00
Scott GarrettandClaude Code 1040f47542 Add Matroska tagging and track-removal support
- MP42Ebml: EBML vint/ID primitives, flat Segment scanner, block track
  number decoding, and element builders shared by all Matroska writers.
- MP42MkvImporter / MP42FileImporter: tagsOnly mode that mirrors the
  file's own track flags instead of the MP4 conversion heuristics.
- MP42MatroskaTagMapping: read/write SimpleTag maps shared by importer
  and writer, including community names for MP4-only movie fields.
- MP42MkvTagWriter: mkvpropedit-style in-place rewrite of Tags, cover
  art, and per-track name/language/enabled/forced fields with a
  size+mtime staleness guard; an untouched save is a byte-for-byte
  no-op.
- MP42MkvRemuxer: stream-copy rebuild that drops the blocks of removed
  tracks (TrackNumbers keep their gaps; block bytes are never
  rewritten), regenerates SeekHead and Cues, carries metadata edits in
  the same pass, and writes via temp file + atomic rename.
- MP42MkvTagWriter+Internal.h exposes the tag writer's scanning and
  payload builders so the remuxer reuses them unchanged.

Verified with the external matrix harness: 241 assertions green across
layout fixtures (ffmpeg/mkvmerge/streamed), removal scenarios, cue
parity, and idempotency.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-25 19:48:09 -05:00
Damiano Galassi bfa477b799 Fix some undo issues 2026-10-03 11:46:29 +02:00
Damiano Galassi 37cd9b40b9 Add undo support to MP42Metadata 2026-10-03 10:26:27 +02:00
Damiano Galassi bb12164229 Additional work on undo support 2026-10-03 10:13:39 +02:00
Damiano Galassi f883d07809 Add newer ProRes format codes 2026-09-30 11:40:33 +02:00
Brett Pynn 0a3c902ce7 Updated saving mp4 where mismatched of language on tracks.
Specifically when either mdhd or elng is undefined and the other is set.
2026-09-30 11:14:23 +02:00
Damiano Galassi cf35350ad3 Additional undo/redo changes 2026-09-29 19:55:05 +02:00
Damiano Galassi 616cd9733b Update project 2026-09-29 16:19:03 +02:00
Damiano Galassi 993151da53 Initial work on using Apple's Vision framework to OCR subtitles 2026-09-29 11:35:08 +02:00
Damiano Galassi 0a8f6fe4ea Fix build on macOS 26 SDK 2026-09-22 20:33:17 +02:00
Damiano Galassi 2c6f987f5b Update localizations 2026-09-22 20:18:56 +02:00
Damiano Galassi 57236970a3 Add two methods two return the supported UTIs 2026-09-22 18:50:05 +02:00
Damiano Galassi 86dce73880 Fix warnings 2026-09-22 16:07:24 +02:00
Damiano Galassi 2b36c035de Add a metadata overwrite option 2026-09-11 09:51:30 +02:00
Damiano Galassi 740fd075b3 Improve MKV LanguageBCP47 conversion 2026-08-27 16:51:13 +02:00
Damiano Galassi 65acfeb7cd Clear the res string before using it
Fix some random timestamps being used as the subtitles text
when the subtitle has actually no text.
2026-08-19 16:32:44 +02:00
Damiano Galassi ab939411c3 Xcode project check 2026-08-19 10:19:28 +02:00
Damiano Galassi 9b34bb2ece Fix timescale conversion 2025-11-14 15:27:25 +01:00
Damiano Galassi 841a7d083e Some undo groundwork 2025-11-14 15:20:29 +01:00
Damiano Galassi c63253903d Another update check 2025-09-16 11:56:03 +02:00
Damiano Galassi 6b914137aa Run update check 2025-09-16 11:48:25 +02:00
Damiano Galassi de006c8704 Fix a constant name 2025-09-16 11:32:17 +02:00
Damiano Galassi 3b5e78211d Read Matroska LanguageBCP47 field 2025-09-15 14:24:56 +02:00
Damiano Galassi 72c09dab2d Xcode update check 2025-09-08 14:38:51 +02:00
Damiano Galassi 341f68b09d Read and write some unofficial metadata used for audiobooks 2025-08-12 16:14:11 +02:00
Damiano Galassi f104a7c69a Make a MP42Chapter method clearer 2025-07-25 17:35:42 +02:00
Damiano Galassi 47aadecfff Improve metadata conversion from MKV 2025-03-13 16:54:57 +01:00
Damiano Galassi f17dfb35d0 Fix typo 2025-03-11 11:57:17 +01:00
Damiano Galassi 84e5e5f898 Read and write the @dir tag 2025-03-11 11:56:30 +01:00
Damiano Galassi 8d0f691e3f Update submodule 2025-03-11 11:56:03 +01:00
Damiano Galassi 52b383e01b Fix a clang static analyzer warning 2025-03-10 10:18:40 +01:00
Damiano Galassi 531b5555b9 Xcode version check 2025-02-05 11:29:15 +01:00
Damiano Galassi c2c0d4a158 Read IPT_C2 matrix in AVFoundation demuxer 2024-11-30 10:42:27 +01:00
Damiano Galassi 8cad594f4d Xcode project version check 2024-11-29 15:59:20 +01:00
Damiano Galassi 818e568b89 Write color tag for Dolby Vision 2024-11-29 12:31:53 +01:00
Damiano Galassi b71f404a09 Fix a warning 2024-11-29 12:31:30 +01:00
Damiano Galassi ce670fe788 Check flac magic cookie length 2024-08-10 07:00:17 +02:00
Damiano Galassi b85f5d59e2 Fix flac magic cookie 2024-08-05 12:22:55 +02:00
arnnalddo aa541846bc Added Spanish (Latin America) translation 2024-07-18 12:06:08 +02:00
arnnalddo d5ddd8ff2e Added Spanish (Latin America) translation 2024-07-18 12:06:08 +02:00
Damiano Galassi a83c7e8e79 Move the image to data conversion to MP42Image 2024-07-18 11:26:52 +02:00
Damiano Galassi d2d3365d92 Update submodule 2024-07-18 10:32:30 +02:00