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>
This commit is contained in:
1 parent
e8231dea59
commit
e7c7b80e8f
2 files changed
+41
-1
No files matched your search
+21
-1
@@ -576,7 +576,27 @@ MP42_OBJC_DIRECT_MEMBERS
|
||||
continue;
|
||||
}
|
||||
|
||||
dstTrackId = MP4AddSubpicTrack(_fileHandle, timeScale, 640, 480);
|
||||
MP42SubtitleTrack *subTrack = (MP42SubtitleTrack *)track;
|
||||
// Prefer the user-editable scaled size (tkhd), fall back to the size
|
||||
// declared by the source subtitle itself (e.g. the vobsub idx `size:`
|
||||
// line), then to the historical 640x480 default.
|
||||
uint16_t subpicWidth = 640, subpicHeight = 480;
|
||||
if (subTrack.trackWidth >= 1 && subTrack.trackWidth <= UINT16_MAX &&
|
||||
subTrack.trackHeight >= 1 && subTrack.trackHeight <= UINT16_MAX) {
|
||||
subpicWidth = (uint16_t)subTrack.trackWidth;
|
||||
subpicHeight = (uint16_t)subTrack.trackHeight;
|
||||
} else if (subTrack.width >= 1 && subTrack.width <= UINT16_MAX &&
|
||||
subTrack.height >= 1 && subTrack.height <= UINT16_MAX) {
|
||||
subpicWidth = (uint16_t)subTrack.width;
|
||||
subpicHeight = (uint16_t)subTrack.height;
|
||||
}
|
||||
|
||||
dstTrackId = MP4AddSubpicTrack(_fileHandle, timeScale, subpicWidth, subpicHeight);
|
||||
|
||||
// Mirror the written display size back into the model, like the
|
||||
// 3GText branch does, so the GUI shows what was actually muxed.
|
||||
subTrack.trackWidth = subpicWidth;
|
||||
subTrack.trackHeight = subpicHeight;
|
||||
|
||||
uint32_t *subPalette = (uint32_t *) magicCookie.bytes;
|
||||
for (int ii = 0; ii < 16; ii++) {
|
||||
|
||||
Reference in new issue
Block a user