Files
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

72 lines
2.2 KiB
Objective-C

//
// MP42Track.h
// Subler
//
// Created by Damiano Galassi on 31/01/09.
// Copyright 2022 Damiano Galassi. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MP42Foundation/MP42Utilities.h>
#import <MP42Foundation/MP42ConversionSettings.h>
#import <MP42Foundation/MP42SecurityAccessToken.h>
@class MP42SampleBuffer;
@class MP42SampleDescription;
NS_ASSUME_NONNULL_BEGIN
/**
* MP42Track
*/
@interface MP42Track : NSObject <NSSecureCoding, NSCopying, MP42SecurityScope>
// The muxer assigns the final id while writing (-[MP42File addTrack:]
// zeroes it to mark the track as pending); hosts that build a model which
// is never muxed (e.g. Matroska tags-only documents) can restore display
// ids directly.
@property(nonatomic, readwrite) MP42TrackId trackId;
@property(nonatomic, readonly, copy, nullable) NSURL *URL;
@property(nonatomic, readonly) NSArray<MP42SampleDescription *> *sampleDescriptions;
@property(nonatomic, readonly) MP42MediaType mediaType;
@property(nonatomic, readonly) MP42CodecType format;
@property(nonatomic, readonly) uint32_t timescale;
@property(nonatomic, readonly) MP42Duration duration;
@property(nonatomic, readonly) uint32_t bitrate;
@property(nonatomic, readonly) uint64_t dataLength;
@property(nonatomic, readonly, getter=isMuxed) BOOL muxed;
@property(nonatomic, readwrite, getter=isEnabled) BOOL enabled;
@property(nonatomic, readwrite, copy) NSString *name;
@property(nonatomic, readwrite, copy) NSString *language;
@property(nonatomic, readwrite, copy) NSSet<NSString *> *mediaCharacteristicTags;
@property(nonatomic, readwrite) uint64_t alternateGroup;
@property(nonatomic, readwrite) NSTimeInterval startOffset;
@property(nonatomic, readwrite, copy, nullable) MP42ConversionSettings *conversionSettings;
@property (nonatomic, readonly) NSString *timeString;
@property (nonatomic, readonly) NSString *formatSummary;
@property (nonatomic, readonly) BOOL canExport;
- (BOOL)exportToURL:(NSURL *)url error:(NSError * __autoreleasing *)error;
@property (nonatomic, readwrite, nullable) NSUndoManager *undo;
#pragma mark - Private
- (void)enqueue:(MP42SampleBuffer *)sample MP42_OBJC_DIRECT;
- (nullable MP42SampleBuffer *)copyNextSample MP42_OBJC_DIRECT;
@end
NS_ASSUME_NONNULL_END