Commit Graph
74 Commits
Author SHA1 Message Date
Scott GarrettandClaude Code f457b4e89c Make chapter tracks deletable, insertable, and language-editable
Delete: the phase-1 gate against deleting the chapter pseudo-track on
Matroska documents is obsolete now that chapter changes ride the
stream-copy remuxer — a removed pseudo-track simply makes the model
report "no chapters", which removes the Chapters element on save (the
same path emptying the Chapters tab already took). The toolbar Delete
button's validation is corrected too; it still rejected chapter-only
selections after deleteSelection was opened up.

Insert: the Actions toolbar gets a single "Insert a chapter" item, and
"Insert a chapter every" (previously MP4-only) is enabled on Matroska.
Both create the chapter track when the document has none, doing the
tags-only bookkeeping the model needs (dense display trackId,
updateChangeCount). A single insert lands 1s after the latest start,
clamped to the track duration, so it can never tie with a stored
chapter — ties get clamped +1ms on write and would silently shift the
user's own chapter times.

Language: the chapter row's language popup stays editable on MKV
documents (the value rides the remuxer's chapter rebuild, not the tag
writer, since the pseudo-track has no TrackEntry), and the Matroska
chapters snapshot carries it so a language-only edit triggers the
remux. Pairs with the submodule's ChapterLanguage round trip.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-26 18:17:37 -05:00
Scott GarrettandClaude Code 8520d729c6 Edit and add chapters in Matroska documents
The chapters tab leaves read-only jail on MKV docs: didSelect exempts
ChapterViewController from the tags-only blanket, and chapter-less docs
can gain chapters through the same txt/csv dispatch MP4 documents use
(selectFile's MKV branch and drag-drop now allow .txt/.csv alongside
the subtitle extensions; addChapters/updateChapters assign the display
trackId and flag the document dirty on MKV).

Chapter edits ride the remuxer, never the tag writer: Chapters sits
before the Clusters, so any size change shifts every following byte.
Document.mkvChaptersSnapshot holds the baseline rows and drives a
chaptersChanged check against the model (model-vs-model, because the
reader itself drops duplicate zero-timestamp atoms and those must not
look like user edits); when changed, remuxMatroska passes mp4.chapters
(or an empty track to delete every chapter) as the remuxer's
replacementChapters, then refreshes the snapshot so an untouched save
goes back to the byte-stable tag-writer path.

Verified live: add a chapter row in the UI, File>Save — the file gains
the atom (ties clamped to 1ms), mkvmerge/ffmpeg both read it, a
forced no-op re-save is byte-identical, and reopening shows all rows.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-26 12:54:58 -05:00
Scott GarrettandClaude Code 330236735d Add subtitle tracks to open Matroska documents
MKV docs can now import .srt/.ssa/.ass subtitle files, written as
S_TEXT/UTF8 by MP42MkvRemuxer (submodule bump). Video/audio adds and
other subtitle formats stay refused by both sides.

- DocumentWindowController: split selectFile: validation so MKV docs
  get an Import panel restricted to matroskaSubtitleExtensions (kept
  in sync with the remuxer's gate); showImportSheet routes MKV docs
  to importSubtitleTracksForMatroska, which imports each file with a
  plain MP42FileImporter (no track-selection sheet), attaches the
  conversion-settings defaults addTrack: asserts on, and assigns the
  next display trackId. Drag-drop already funnels through
  showImportSheet. didSelect skips
  organizeAlternateGroups/inferMediaCharacteristics on MKV docs —
  same TrackEntry-pairing protection as delete.
- Document: the tagsChanged check already caught additions; the
  post-remux snapshot now appends the added tracks behind the kept
  ones, matching the TrackEntry order in the written file, so a
  later tags-only save pairs correctly instead of double-appending.
- ScriptCommand: the AppleScript "save as" command called
  mp4.write(to:) directly, which muxed a QuickTime MP4 over a
  Matroska document. Route isMatroska documents through
  Document.save(saveAsOperation) so writeMatroska picks the
  tag-writer/remux path and enforces the mkv destination.

Verified with the /tmp/subler-mkv-test harness (matrix PASS=276: add
srt/ass, add+drop mix, no-cues source, bad-file and drop-all
refusals, idempotent re-save, post-add tag edit) and against the
live app (scripted import + save on a fixture copy; output checked
with mkvmerge/mkvextract/ffmpeg and reopened cleanly).

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-26 11:53:50 -05:00
Scott GarrettandClaude Code eb386a52c3 Open and edit Matroska files in place, including track removal
.mkv/.mka/.mks now open directly into a tags-only document instead of
forcing the convert-import sheet:

- Metadata, cover art, and the four per-track fields Matroska stores
  (name, language, enabled, subtitle forced) save back into the same
  file via MP42MkvTagWriter; MP4-only properties stay read-only.
- Real tracks can be deleted and Save-As is enabled; both go through
  MP42MkvRemuxer's stream-copy rebuild (Document keeps an importer-order
  track snapshot and pairs TrackEntry elements by object identity).
  Destinations must stay .mkv/.mka/.mks.
- Info.plist: the Matroska document type becomes Editor so NSDocument
  offers .mkv Save-As instead of defaulting to the MP4 type.
- Delete on MKV docs skips organizeAlternateGroups/
  inferMediaCharacteristics because they reorder the model, which the
  TrackEntry pairing depends on; chapter rows stay undeletable.

Bumps MP42Foundation for the Matroska tagging/remux support.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-25 19:48:34 -05:00
Damiano Galassi d0cd519460 Improve track view selection after an import 2026-10-03 17:59:29 +02:00
Damiano Galassi 1040f0dab6 Switch to the appropriate view after an action 2026-10-03 17:52:22 +02:00
Damiano Galassi dfdffb9332 Better preserve the UI state after an undo 2026-10-03 17:20:42 +02:00
Damiano Galassi 23f683626d Improve tracks and chapters undo 2026-10-03 14:06:06 +02:00
Damiano Galassi 934ae63b95 Expand undo/redo to all the document UI 2026-10-03 11:49:04 +02:00
Damiano Galassi a65fcf9bf2 Set the document window to use fullSizeContentView to avoid AppKit bugs 2026-09-23 15:54:48 +02:00
Damiano Galassi e3f67451b0 Restore some code that might be useful in the future 2026-09-23 10:47:56 +02:00
Damiano Galassi d399af54b2 Increase the default document window size to workaround tableview wonky initial coloums size 2026-09-23 09:27:41 +02:00
Damiano Galassi 9896d96e87 Fix the first launch toolbar styles 2026-09-22 20:03:06 +02:00
Damiano Galassi 192de27e8d Fix even more deprecation warnings 2026-09-22 18:51:35 +02:00
Damiano Galassi 17c7d67b96 Use some modern APIs and fix warnings on the latest macOS SDK 2026-09-22 16:10:37 +02:00
Damiano Galassi beb7774761 Add a preference to overwrite or not existing metadata 2026-09-11 09:52:03 +02:00
Brett Pynn 68709ef2ec Small console fixes (#141) 2026-08-10 08:22:10 +02:00
Damiano Galassi a50ba3910e Update toolbars icons and default orders 2025-09-18 15:28:13 +02:00
Michael Mock d88285ece2 Subler Automation Support (#67)
Expand the AppleScript dictionary to support many additional commands.
2025-08-12 11:52:16 +02:00
Damiano Galassi 971adb6342 Fix the insert a chapter at the beginning action
Fix #74.
2025-07-25 17:36:46 +02:00
Damiano Galassi f0faeb066a Fix queue toolbar items validation 2025-03-13 09:50:35 +01:00
Damiano Galassi ae2addbac4 Set toolbar items target 2025-03-10 11:01:03 +01:00
Damiano Galassi 43d56d7851 Do not run the optimize pass if writing was cancelled 2024-11-29 12:53:12 +01:00
Damiano Galassi d59f73bcb0 Move toolbars to code, improve text mode and buttons size 2024-07-18 18:24:23 +02:00
Damiano Galassi 89ba80859e Preserve the tab selection after a reload 2024-07-06 16:58:35 +02:00
Damiano Galassi a6c51bb260 Use inferTracksLanguages() 2024-07-02 17:49:35 +02:00
Damiano galassi e45b608805 Set the minimum deplyoment target to 10.13. 2022-11-18 18:52:16 +01:00
Damiano Galassi 89002308ae Do not show the moview view for unknown tracks. 2021-12-18 14:26:35 +01:00
Damiano Galassi 4b2de03045 Remove chapter search. 2021-04-29 16:49:31 +02:00
Damiano Galassi ab52a8e0f6 Fix layout issues. 2020-08-06 09:31:25 +02:00
Damiano Galassi 1b92b76bad Improve UI on macOS 11. 2020-07-23 20:27:12 +02:00
Damiano Galassi a51c3a28ce Fixes a couple of issues on macOS 11 sdk. 2020-07-10 13:10:35 +02:00
Damiano Galassi ce4b084324 fix some toolbars and layout on macOS 11 sdk. 2020-07-01 19:49:40 +02:00
Damiano Galassi fbc464e643 Rework the preference to avoid stringly typed properties. 2020-02-07 15:31:10 +01:00
Damiano Galassi 2694bdee45 Improve MediaKind usage. 2020-02-04 17:54:08 +01:00
Damiano Galassi 7ed44d94d4 Improve keyboard arrow keys navigation. 2019-11-11 19:36:00 +01:00
Damiano Galassi 8cbbfc41d4 4k tag. 2019-10-25 09:08:11 +02:00
Damiano Galassi dbe5080541 Update send to feature to send to TV app on 10.15. 2019-10-15 08:34:35 +02:00
Damiano Galassi 90e15aedc3 Remember splitview position. 2019-09-05 11:25:45 +02:00
Damiano Galassi 106813d5e5 Refactor some windows to views. 2019-08-07 14:40:24 +02:00
Damiano Galassi 79c73c33f6 Avoid using a regex to get the channels count. 2019-04-22 10:01:31 +02:00
sidneys 1714bc6a42 fix(prettifyAudioTrackNames): only resolve to "Mono Audio" for audio tracks with 1 channel 2019-04-19 07:23:17 +02:00
sidneys 5a93cdc607 fix(document): consolidate rename logic 2019-04-19 05:21:05 +02:00
sidneys 0c40d977b5 feat(document): add prettifyAudioTrackNames: method, menu entry 2019-04-19 05:21:04 +02:00
Damiano Galassi a8c9590915 Minor code improvements. 2019-03-11 17:43:05 +01:00
Damiano Galassi 8075d9ea60 Rewrite SBMovieViewController to Swift. 2019-03-11 16:11:38 +01:00
Damiano Galassi f993d8dd81 Mark some classes as final. 2019-03-05 10:41:54 +01:00
Damiano Galassi a1933a752f Remove 10.10 compatibility workarounds. 2019-02-26 11:28:01 +01:00
Damiano Galassi 85494f3c57 Fix more queue regressions, use applescript to add files to iTunes. 2019-01-31 12:34:41 +01:00
Damiano Galassi 5725b0f830 Convert to Swift 5, convert QueueController to Swift. 2019-01-27 11:46:31 +01:00