Remove some duplicated code.
This commit is contained in:
2 files changed
+12
-33
No files matched your search
@@ -370,19 +370,6 @@
|
|||||||
MP4SetTrackDurationPerChunk(_fileHandle, dstTrackId, timeScale / 8);
|
MP4SetTrackDurationPerChunk(_fileHandle, dstTrackId, timeScale / 8);
|
||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "tkhd.layer", -1);
|
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "tkhd.layer", -1);
|
||||||
|
|
||||||
int32_t displayFlags = 0;
|
|
||||||
if (vPlacement) {
|
|
||||||
displayFlags = 0x20000000;
|
|
||||||
}
|
|
||||||
if (subTrack.someSamplesAreForced) {
|
|
||||||
displayFlags |= 0x40000000;
|
|
||||||
}
|
|
||||||
if (subTrack.allSamplesAreForced) {
|
|
||||||
displayFlags |= 0xC0000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.displayFlags", displayFlags);
|
|
||||||
|
|
||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.horizontalJustification", 1);
|
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.horizontalJustification", 1);
|
||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.verticalJustification", -1);
|
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.verticalJustification", -1);
|
||||||
|
|
||||||
@@ -391,9 +378,6 @@
|
|||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.bgColorBlue", 0);
|
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.bgColorBlue", 0);
|
||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.bgColorAlpha", 0);
|
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.bgColorAlpha", 0);
|
||||||
|
|
||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxBottom", subSize.height);
|
|
||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxRight", videoSize.width);
|
|
||||||
|
|
||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.fontSize", videoSize.height * 0.05);
|
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.fontSize", videoSize.height * 0.05);
|
||||||
|
|
||||||
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.fontColorRed", textColor[0]);
|
MP4SetTrackIntegerProperty(_fileHandle, dstTrackId, "mdia.minf.stbl.stsd.tx3g.fontColorRed", textColor[0]);
|
||||||
|
|||||||
+12
-17
@@ -19,8 +19,7 @@
|
|||||||
self = [super initWithSourceURL:URL trackID:trackID fileHandle:fileHandle];
|
self = [super initWithSourceURL:URL trackID:trackID fileHandle:fileHandle];
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
|
if (self.format == kMP42SubtitleCodecType_3GText) {
|
||||||
if (self.format != kMP42SubtitleCodecType_VobSub) {
|
|
||||||
uint64_t width, height;
|
uint64_t width, height;
|
||||||
|
|
||||||
MP4GetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxRight", &width);
|
MP4GetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxRight", &width);
|
||||||
@@ -45,6 +44,7 @@
|
|||||||
_allSamplesAreForced = YES;
|
_allSamplesAreForced = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (MP4HaveTrackAtom(fileHandle, self.trackId, "tref.forc")) {
|
if (MP4HaveTrackAtom(fileHandle, self.trackId, "tref.forc")) {
|
||||||
uint64_t forcedId = 0;
|
uint64_t forcedId = 0;
|
||||||
@@ -52,7 +52,6 @@
|
|||||||
_forcedTrackId = (MP4TrackId) forcedId;
|
_forcedTrackId = (MP4TrackId) forcedId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -75,7 +74,6 @@
|
|||||||
nil,
|
nil,
|
||||||
120);
|
120);
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,30 +94,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.edited && !self.muxed) {
|
if (self.format == kMP42SubtitleCodecType_3GText) {
|
||||||
[super writeToFile:fileHandle error:outError];
|
|
||||||
return self.trackId;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
[super writeToFile:fileHandle error:outError];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.format != kMP42SubtitleCodecType_VobSub) {
|
|
||||||
MP4SetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxBottom", self.trackHeight);
|
MP4SetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxBottom", self.trackHeight);
|
||||||
MP4SetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxRight", self.trackWidth);
|
MP4SetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxRight", self.trackWidth);
|
||||||
|
|
||||||
uint32_t displayFlags = 0;
|
uint32_t displayFlags = 0;
|
||||||
if (_verticalPlacement)
|
if (_verticalPlacement) {
|
||||||
displayFlags = 0x20000000;
|
displayFlags = 0x20000000;
|
||||||
if (_someSamplesAreForced)
|
}
|
||||||
|
if (_someSamplesAreForced) {
|
||||||
displayFlags |= 0x40000000;
|
displayFlags |= 0x40000000;
|
||||||
if (_allSamplesAreForced)
|
}
|
||||||
|
if (_allSamplesAreForced) {
|
||||||
displayFlags |= 0x80000000;
|
displayFlags |= 0x80000000;
|
||||||
|
}
|
||||||
|
|
||||||
MP4SetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.tx3g.displayFlags", displayFlags);
|
MP4SetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.tx3g.displayFlags", displayFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
[super writeToFile:fileHandle error:outError];
|
||||||
|
|
||||||
|
return self.trackId > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setSomeSamplesAreForced:(BOOL)value
|
- (void)setSomeSamplesAreForced:(BOOL)value
|
||||||
|
|||||||
Reference in new issue
Block a user