Clean up headers and MP42SampleBuffer.

This commit is contained in:
Damiano Galassi committed 2016-07-27 17:37:27 +02:00
1 parent e2adc70d63
commit 7b1c7d0384
22 files changed
+122 -109

No files matched your search

+1 -2
View File
@@ -864,8 +864,7 @@ static bool GetFirstHeader(FILE* inFile)
sample->size = sampleSize;
sample->duration = MP4_INVALID_DURATION;
sample->offset = 0;
sample->timestamp = 0;
sample->isSync = 1;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = trackId;
[self enqueue:sample];
+1 -2
View File
@@ -374,8 +374,7 @@ static bool GetFirstHeader(FILE* inFile)
sample->size = sampleSize;
sample->duration = MP4_INVALID_DURATION;
sample->offset = 0;
sample->timestamp = 0;
sample->isSync = 1;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = trackId;
[self enqueue:sample];
+10 -10
View File
@@ -418,14 +418,14 @@
@"Encoding Tool", AVMetadataCommonKeySoftware,
nil];
_metadata = [[MP42Metadata alloc] init];
self.metadata = [[[MP42Metadata alloc] init] autorelease];
for (NSString *commonKey in commonItemsDict.allKeys) {
NSArray<AVMetadataItem *> *items = [AVMetadataItem metadataItemsFromArray:_localAsset.commonMetadata
withKey:commonKey
keySpace:AVMetadataKeySpaceCommon];
if (items.count) {
[_metadata setTag:items.lastObject.value forKey:commonItemsDict[commonKey]];
[self.metadata setTag:items.lastObject.value forKey:commonItemsDict[commonKey]];
}
}
@@ -439,7 +439,7 @@
if ([artworkData isKindOfClass:[NSData class]]) {
NSImage *image = [[NSImage alloc] initWithData:artworkData];
[_metadata.artworks addObject:[[[MP42Image alloc] initWithImage:image] autorelease]];
[self.metadata.artworks addObject:[[[MP42Image alloc] initWithImage:image] autorelease]];
[image release];
}
}
@@ -523,7 +523,7 @@
for (NSString *itunesKey in itunesMetadataDict.allKeys) {
items = [AVMetadataItem metadataItemsFromArray:itunesMetadata withKey:itunesKey keySpace:AVMetadataKeySpaceiTunes];
if (items.count) {
[_metadata setTag:items.lastObject.value forKey:itunesMetadataDict[itunesKey]];
[self.metadata setTag:items.lastObject.value forKey:itunesMetadataDict[itunesKey]];
}
}
@@ -569,7 +569,7 @@
for (NSString *qtKey in quicktimeMetadataDict.allKeys) {
items = [AVMetadataItem metadataItemsFromArray:quicktimeMetadata withKey:qtKey keySpace:AVMetadataKeySpaceQuickTimeUserData];
if (items.count) {
[_metadata setTag:items.lastObject.value forKey:quicktimeMetadataDict[qtKey]];
[self.metadata setTag:items.lastObject.value forKey:quicktimeMetadataDict[qtKey]];
}
}
}
@@ -602,7 +602,7 @@
for (NSString *qtUserDataKey in quicktimeUserDataMetadataDict.allKeys) {
items = [AVMetadataItem metadataItemsFromArray:quicktimeUserDataMetadata withKey:qtUserDataKey keySpace:AVMetadataKeySpaceQuickTimeUserData];
if (items.count) {
[_metadata setTag:items.lastObject.value forKey:quicktimeUserDataMetadataDict[qtUserDataKey]];
[self.metadata setTag:items.lastObject.value forKey:quicktimeUserDataMetadataDict[qtUserDataKey]];
}
}
}
@@ -862,10 +862,10 @@
sample->presentationTimestamp = presentationTimeStamp.value;
sample->presentationOutputTimestamp = currentOutputTimeStamp.value;
sample->timescale = duration.timescale;
sample->isSync = sync;
sample->flags |= sync ? MP42SampleBufferFlagIsSync : 0;
sample->flags |= doNotDisplay ? MP42SampleBufferFlagDoNotDisplay : 0;
sample->trackId = track.sourceId;
sample->attachments = (void *)attachments;
sample->doNotDisplay = doNotDisplay;
if (sample->offset < demuxHelper->minDisplayOffset) {
demuxHelper->minDisplayOffset = sample->offset;
@@ -995,9 +995,9 @@
sample->presentationTimestamp = presentationTimeStamp.value;
sample->presentationOutputTimestamp = presentationTimeStamp.value;
sample->timescale = sampleTimingInfo.duration.timescale;
sample->isSync = sync;
sample->flags |= sync ? MP42SampleBufferFlagIsSync : 0;
sample->flags |= doNotDisplay ? MP42SampleBufferFlagDoNotDisplay : 0;
sample->trackId = track.sourceId;
sample->doNotDisplay = doNotDisplay;
if (attachmentsSent == NO) {
sample->attachments = (void *)attachments;
+1 -1
View File
@@ -255,7 +255,7 @@ static AVPacket * packetFromSampleBuffer(MP42SampleBuffer *sample)
AVPacket *pkt = av_packet_alloc();
pkt->data = sample->data;
pkt->size = sample->size;
pkt->pts = sample->timestamp;
pkt->pts = sample->decodeTimestamp;
pkt->dts = AV_NOPTS_VALUE;
return pkt;
+4 -2
View File
@@ -403,8 +403,10 @@ static MP42SampleBuffer *encode(AudioConverterRef encoder, AudioFileIO *afio)
sample->size = fillBufList.mBuffers[0].mDataByteSize;
sample->duration = 1024;
sample->timestamp = afio->outputPos * 1024;
sample->isSync = YES;
sample->decodeTimestamp = afio->outputPos * 1024;
sample->presentationTimestamp = sample->decodeTimestamp;
sample->presentationOutputTimestamp = sample->decodeTimestamp;
sample->flags |= MP42SampleBufferFlagIsSync;
afio->outputPos += ioOutputDataPackets;
+4 -4
View File
@@ -194,8 +194,8 @@ static int ParseByte(const char *string, UInt8 *byte, Boolean hex)
sample->size = 8;
sample->duration = ccSample.timestamp *= 1001;
sample->offset = 0;
sample->timestamp = 0;
sample->isSync = 1;
sample->decodeTimestamp = 0;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = trackId;
[self enqueue:sample];
@@ -228,8 +228,8 @@ static int ParseByte(const char *string, UInt8 *byte, Boolean hex)
sample->size = byteCount + 8;
sample->duration = sampleDuration * 1001;
sample->offset = 0;
sample->timestamp = 0;
sample->isSync = 1;
sample->decodeTimestamp = 0;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = trackId;
[self enqueue:sample];
+2 -2
View File
@@ -132,7 +132,7 @@
[self endEditListAtTime:editEnd empty:YES];
}
BOOL shouldStartNewEdit = trimStart || (sample->doNotDisplay == NO && _editOpen == NO);
BOOL shouldStartNewEdit = trimStart || ((sample->flags & MP42SampleBufferFlagDoNotDisplay) == NO && _editOpen == NO);
if (shouldStartNewEdit) {
// Close the current edit list
@@ -166,7 +166,7 @@
_currentTime += sample->duration;
BOOL shouldEndEdit = trimEnd || (sample->doNotDisplay == YES && _editOpen == YES);
BOOL shouldEndEdit = trimEnd || ((sample->flags & MP42SampleBufferFlagDoNotDisplay) == YES && _editOpen == YES);
if (shouldEndEdit) {
CMTime editEnd = CMTimeMake(_currentTime, _timescale);
+4
View File
@@ -13,10 +13,14 @@
NS_ASSUME_NONNULL_BEGIN
@class MP42SampleBuffer;
@interface MP42FileImporter (Private)
- (instancetype)initWithURL:(NSURL *)fileURL;
@property(nonatomic, readwrite) MP42Metadata *metadata;
- (void)addTrack:(MP42Track *)track;
- (void)addTracks:(NSArray<MP42Track *> *)tracks;
-4
View File
@@ -10,15 +10,11 @@
NS_ASSUME_NONNULL_BEGIN
@class MP42SampleBuffer;
@class MP42Metadata;
@class MP42Track;
@interface MP42FileImporter : NSObject {
@protected
NSInteger _chapterId;
MP42Metadata *_metadata;
double _progress;
int32_t _cancelled;
}
+6 -2
View File
@@ -122,7 +122,7 @@ static NSArray<NSString *> *_supportedFileFormats;
[track.muxer_helper->converter release];
}
[_metadata release], _metadata = nil;
[_metadata release];
[_tracksArray release], _tracksArray = nil;
[_inputTracks release], _inputTracks = nil;
[_outputsTracks release], _outputsTracks = nil;
@@ -162,7 +162,11 @@ static NSArray<NSString *> *_supportedFileFormats;
return [[_outputsTracks copy] autorelease];
}
@synthesize metadata = _metadata;
- (void)setMetadata:(MP42Metadata * _Nonnull)metadata
{
_metadata = [metadata retain];
}
@synthesize tracks = _tracksArray;
- (NSUInteger)timescaleForTrack:(MP42Track *)track
+2 -6
View File
@@ -1499,9 +1499,7 @@ NSData* H264Info(const char *filePath, uint32_t *pic_width, uint32_t *pic_height
sample->data = sampleData;
sample->size = nal_buffer_size;
sample->duration = mp4FrameDuration;
sample->offset = 0;
sample->timestamp = 0;
sample->isSync = nal_is_sync;
sample->flags = nal_is_sync ? MP42SampleBufferFlagIsSync : 0;
sample->trackId = trackId;
[self enqueue:sample];
@@ -1588,9 +1586,7 @@ NSData* H264Info(const char *filePath, uint32_t *pic_width, uint32_t *pic_height
sample->data = sampleData;
sample->size = nal_buffer_size;
sample->duration = mp4FrameDuration;
sample->offset = 0;
sample->timestamp = 0;
sample->isSync = nal_is_sync;
sample->flags = nal_is_sync ? MP42SampleBufferFlagIsSync : 0;
sample->trackId = trackId;
[self enqueue:sample];
+17 -17
View File
@@ -298,7 +298,7 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
free(trackSizes);
_metadata = [[self readMatroskaMetadata] retain];
self.metadata = [self readMatroskaMetadata];
}
return self;
@@ -677,15 +677,15 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
sample->size = FrameSize;
sample->duration = MP4_INVALID_DURATION;
sample->offset = 0;
sample->timestamp = StartTime;
sample->isSync = YES;
sample->decodeTimestamp = StartTime;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = track.sourceId;
#define VARIABLE_AUDIO_RATE 1
#ifdef VARIABLE_AUDIO_RATE
if (demuxHelper->previousSample) {
uint64_t sampleDuration = (sample->timestamp * (double)mkv_TruncFloat(trackInfo->AV.Audio.SamplingFreq) / 1000000000.f) - demuxHelper->currentTime;
uint64_t sampleDuration = (sample->decodeTimestamp * (double)mkv_TruncFloat(trackInfo->AV.Audio.SamplingFreq) / 1000000000.f) - demuxHelper->currentTime;
// MKV timestamps are a bit random, try to round them
// to make the sample table in the mp4 smaller.
@@ -710,7 +710,7 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
demuxHelper->currentTime += sampleDuration;
} else {
demuxHelper->currentTime = sample->timestamp * (double)mkv_TruncFloat(trackInfo->AV.Audio.SamplingFreq) / 1000000000.f;
demuxHelper->currentTime = sample->decodeTimestamp * (double)mkv_TruncFloat(trackInfo->AV.Audio.SamplingFreq) / 1000000000.f;
}
[demuxHelper->previousSample release];
@@ -748,10 +748,10 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
nextSample->duration = 0;
nextSample->offset = 0;
nextSample->timestamp = StartTime;
nextSample->decodeTimestamp = StartTime;
nextSample->data = frame;
nextSample->size = FrameSize;
nextSample->isSync = YES;
nextSample->flags |= MP42SampleBufferFlagIsSync;
nextSample->trackId = track.sourceId;
// PGS are usually stored with just the start time, and blank samples to fill the gaps
@@ -760,18 +760,18 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
demuxHelper->previousSample = [[MP42SampleBuffer alloc] init];
demuxHelper->previousSample->duration = StartTime / SCALE_FACTOR;
demuxHelper->previousSample->offset = 0;
demuxHelper->previousSample->timestamp = StartTime;
demuxHelper->previousSample->isSync = YES;
demuxHelper->previousSample->decodeTimestamp = StartTime;
demuxHelper->previousSample->flags |= MP42SampleBufferFlagIsSync;
demuxHelper->previousSample->trackId = track.sourceId;
} else {
if (nextSample->timestamp < demuxHelper->previousSample->timestamp) {
if (nextSample->decodeTimestamp < demuxHelper->previousSample->decodeTimestamp) {
// Out of order samples? swap the next with the previous
MP42SampleBuffer *temp = nextSample;
nextSample = demuxHelper->previousSample;
demuxHelper->previousSample = temp;
}
demuxHelper->previousSample->duration = (nextSample->timestamp - demuxHelper->previousSample->timestamp) / SCALE_FACTOR;
demuxHelper->previousSample->duration = (nextSample->decodeTimestamp - demuxHelper->previousSample->decodeTimestamp) / SCALE_FACTOR;
}
[self enqueue:demuxHelper->previousSample];
@@ -786,7 +786,7 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
sample->duration = (StartTime - demuxHelper->currentTime) / SCALE_FACTOR;
sample->size = 2;
sample->data = calloc(1, 2);
sample->isSync = YES;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = track.sourceId;
[self enqueue:sample];
@@ -845,8 +845,8 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
sample->size = currentSample->frameSize;
sample->duration = duration / 10000.0f;
sample->offset = offset / 10000.0f;
sample->timestamp = StartTime;
sample->isSync = currentSample->frameFlags & FRAME_KF;
sample->decodeTimestamp = StartTime;
sample->flags |= (currentSample->frameFlags & FRAME_KF) ? MP42SampleBufferFlagIsSync : 0;
sample->trackId = track.sourceId;
demuxHelper->samplesWritten++;
@@ -919,8 +919,8 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
sample->size = currentSample->frameSize;
sample->duration = duration / 10000.0f;
sample->offset = offset / 10000.0f;
sample->timestamp = StartTime;
sample->isSync = currentSample->frameFlags & FRAME_KF;
sample->decodeTimestamp = StartTime;
sample->flags |= (currentSample->frameFlags & FRAME_KF) ? MP42SampleBufferFlagIsSync : 0;
sample->trackId = track.sourceId;
demuxHelper->samplesWritten++;
@@ -970,7 +970,7 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t
}
demuxHelper->currentTime += sample->duration;
sample->timestamp = demuxHelper->currentTime;
sample->decodeTimestamp = demuxHelper->currentTime;
[self enqueue:sample];
[sample release];
+3 -3
View File
@@ -51,7 +51,7 @@
}
[self addTracks:sourceFile.tracks];
_metadata = [sourceFile.metadata retain];
self.metadata = sourceFile.metadata;
[sourceFile release];
}
@@ -326,8 +326,8 @@
sample->size = numBytes;
sample->duration = duration;
sample->offset = renderingOffset;
sample->timestamp = pStartTime;
sample->isSync = isSyncSample;
sample->decodeTimestamp = pStartTime;
sample->flags |= isSyncSample ? MP42SampleBufferFlagIsSync : 0;
sample->trackId = track.sourceId;
[self enqueue:sample];
+3 -2
View File
@@ -503,6 +503,7 @@
// Iterate the tracks array and mux the samples
for (MP42Track *track in _workingTracks) {
MP42SampleBuffer *sampleBuffer = nil;
MP42TrackId trackId = track.trackId;
for (int i = 0; i < 100 && (sampleBuffer = [track copyNextSample]) != nil; i++) {
@@ -511,10 +512,10 @@
track.muxer_helper->done = 1;
}
else if (!MP4WriteSample(_fileHandle, track.trackId,
else if (!MP4WriteSample(_fileHandle, trackId,
sampleBuffer->data, sampleBuffer->size,
sampleBuffer->duration, sampleBuffer->offset,
sampleBuffer->isSync)) {
sampleBuffer->flags & MP42SampleBufferFlagIsSync)) {
_cancelled = YES;
}
+6 -7
View File
@@ -9,7 +9,10 @@
#import <Foundation/Foundation.h>
typedef NS_OPTIONS(NSUInteger, MP42SampleBufferFlag) {
MP42SampleBufferFlagEndOfFile = 1 << 0,
MP42SampleBufferFlagEndOfFile = 1 << 0,
MP42SampleBufferFlagIsSync = 1 << 1,
MP42SampleBufferFlagIsForced = 1 << 2,
MP42SampleBufferFlagDoNotDisplay = 1 << 3
};
@interface MP42SampleBuffer : NSObject {
@@ -23,16 +26,12 @@ typedef NS_OPTIONS(NSUInteger, MP42SampleBufferFlag) {
int64_t presentationTimestamp;
int64_t presentationOutputTimestamp;
uint64_t timestamp;
uint64_t decodeTimestamp;
uint32_t trackId;
BOOL isSync;
BOOL isForced;
BOOL doNotDisplay;
void *attachments;
uint16_t flags;
void *attachments;
}
@end
+4 -4
View File
@@ -1063,8 +1063,8 @@ MP42SampleBuffer * copySubtitleSample(MP4TrackId subtitleTrackId, NSString *stri
sample->size = sampleSize;
sample->duration = duration;
sample->offset = 0;
sample->timestamp = duration;
sample->isSync = true;
sample->decodeTimestamp = duration;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = subtitleTrackId;
return sample;
@@ -1083,8 +1083,8 @@ MP42SampleBuffer* copyEmptySubtitleSample(MP4TrackId subtitleTrackId, MP4Duratio
sample->size = 2;
sample->duration = duration;
sample->offset = 0;
sample->timestamp = duration;
sample->isSync = true;
sample->decodeTimestamp = duration;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = subtitleTrackId;
return sample;
+13 -5
View File
@@ -31,9 +31,13 @@
_mediaType = MP42MediaTypeSubtitle;
if (![_format isEqualToString:MP42SubtitleFormatVobSub]) {
uint64_t width, height;
MP4GetTrackIntegerProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxBottom", &height);
MP4GetTrackIntegerProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxRight", &width);
MP4GetTrackIntegerProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxBottom", &height);
self.width = width;
self.height = height;
uint64_t displayFlags = 0;
MP4GetTrackIntegerProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.tx3g.displayFlags", &displayFlags);
@@ -104,9 +108,13 @@
}
if (_isEdited && !_muxed) {
float trackWidth, trackHeight;
MP4GetTrackFloatProperty(fileHandle, _trackId, "tkhd.width", &trackWidth);
MP4GetTrackFloatProperty(fileHandle, _trackId, "tkhd.height", &trackHeight);
self.trackWidth = trackWidth;
self.trackHeight = trackHeight;
uint8_t *val;
uint8_t nval[36];
uint32_t *ptr32 = (uint32_t*) nval;
@@ -114,8 +122,8 @@
MP4GetTrackBytesProperty(fileHandle ,_trackId, "tkhd.matrix", &val, &size);
memcpy(nval, val, size);
offsetX = CFSwapInt32BigToHost(ptr32[6]) / 0x10000;
offsetY = CFSwapInt32BigToHost(ptr32[7]) / 0x10000;
self.offsetX = CFSwapInt32BigToHost(ptr32[6]) / 0x10000;
self.offsetY = CFSwapInt32BigToHost(ptr32[7]) / 0x10000;
free(val);
[super writeToFile:fileHandle error:outError];
@@ -127,8 +135,8 @@
}
if (![_format isEqualToString:MP42SubtitleFormatVobSub]) {
MP4SetTrackIntegerProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxBottom", trackHeight);
MP4SetTrackIntegerProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxRight", trackWidth);
MP4SetTrackIntegerProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxBottom", self.trackHeight);
MP4SetTrackIntegerProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.tx3g.defTextBoxRight", self.trackWidth);
uint32_t displayFlags = 0;
if (_verticalPlacement)
-10
View File
@@ -17,7 +17,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface MP42Track : NSObject <NSCoding, NSCopying> {
@protected
MP42TrackId _trackId;
MP42TrackId _sourceId;
NSURL *_sourceURL;
NSString *_format;
@@ -34,19 +33,10 @@ NS_ASSUME_NONNULL_BEGIN
BOOL _muxed;
BOOL _needConversion;
uint64_t _size;
uint32_t _timescale;
uint32_t _bitrate;
MP42Duration _duration;
NSMutableDictionary<NSString *, NSNumber *> *_updatedProperty;
@private
NSSet<NSString *> *_mediaCharacteristicTags;
uint64_t _alternate_group;
int64_t _startOffset;
void *_helper;
}
+11
View File
@@ -17,6 +17,17 @@
#import "MP42Track+Muxer.h"
@implementation MP42Track
{
MP42TrackId _sourceId;
uint64_t _size;
uint32_t _bitrate;
NSSet<NSString *> *_mediaCharacteristicTags;
uint64_t _alternate_group;
int64_t _startOffset;
}
- (instancetype)init
{
+1 -21
View File
@@ -9,27 +9,7 @@
#import <Foundation/Foundation.h>
#import "MP42Track.h"
@interface MP42VideoTrack : MP42Track <NSCoding> {
@protected
uint64_t width, height;
float trackWidth, trackHeight;
// Pixel Aspect Ratio
uint64_t hSpacing, vSpacing;
// Clean Aperture
uint64_t cleanApertureWidthN, cleanApertureWidthD;
uint64_t cleanApertureHeightN, cleanApertureHeightD;
uint64_t horizOffN, horizOffD;
uint64_t vertOffN, vertOffD;
// Matrix
uint32_t offsetX, offsetY;
// H.264 profile
uint8_t _origProfile, _origLevel;
uint8_t _newProfile, _newLevel;
}
@interface MP42VideoTrack : MP42Track <NSCoding>
@property(nonatomic, readwrite) uint64_t width;
@property(nonatomic, readwrite) uint64_t height;
+21 -1
View File
@@ -13,6 +13,27 @@
#import <mp4v2.h>
@implementation MP42VideoTrack
{
uint64_t width, height;
float trackWidth, trackHeight;
// Pixel Aspect Ratio
uint64_t hSpacing, vSpacing;
// Clean Aperture
uint64_t cleanApertureWidthN, cleanApertureWidthD;
uint64_t cleanApertureHeightN, cleanApertureHeightD;
uint64_t horizOffN, horizOffD;
uint64_t vertOffN, vertOffD;
// Matrix
uint32_t offsetX, offsetY;
// H.264 profile
uint8_t _origProfile, _origLevel;
uint8_t _newProfile, _newLevel;
}
- (instancetype)initWithSourceURL:(NSURL *)URL trackID:(NSInteger)trackID fileHandle:(MP42FileHandle)fileHandle
{
@@ -93,7 +114,6 @@
if (trackWidth > 0 && trackHeight > 0) {
MP4SetTrackFloatProperty(fileHandle, _trackId, "tkhd.width", trackWidth);
MP4SetTrackFloatProperty(fileHandle, _trackId, "tkhd.height", trackHeight);
uint8_t *val;
+8 -4
View File
@@ -364,8 +364,10 @@ static NSArray<SBVobSubTrack *> * LoadVobSubSubtitles(NSURL *theDirectory, NSStr
sample->data = calloc(1, 2);
sample->duration = startTime - lastTime;
sample->offset = 0;
sample->timestamp = startTime;
sample->isSync = YES;
sample->presentationTimestamp = startTime;
sample->presentationOutputTimestamp = startTime;
sample->decodeTimestamp = startTime;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = track.sourceId;
[self enqueue:sample];
@@ -377,8 +379,10 @@ static NSArray<SBVobSubTrack *> * LoadVobSubSubtitles(NSURL *theDirectory, NSStr
sample->size = size;
sample->duration = duration;
sample->offset = 0;
sample->timestamp = startTime;
sample->isSync = YES;
sample->presentationTimestamp = startTime;
sample->presentationOutputTimestamp = startTime;
sample->decodeTimestamp = startTime;
sample->flags |= MP42SampleBufferFlagIsSync;
sample->trackId = track.sourceId;
[self enqueue:sample];