Some preliminary changes to support multiple sample descriptions.

This commit is contained in:
Damiano Galassi committed 2021-12-18 14:03:54 +01:00
1 parent 24d14b0f0f
commit 33c5d84f51
6 files changed
+312 -3

No files matched your search

+11
View File
@@ -10,6 +10,7 @@
#import "MP42Track+Private.h"
#import "MP42MediaFormat.h"
#import "MP42PrivateUtilities.h"
#import "MP42-Shared-Swift.h"
#import <mp4v2.h>
MP42_OBJC_DIRECT_MEMBERS
@@ -46,6 +47,16 @@ MP42_OBJC_DIRECT_MEMBERS
_transform.ty = CFSwapInt32BigToHost(ptr32[7]) / 0x10000;
free(val);
// Sample descriptions
uint32_t count = MP4GetTrackNumberOfSampleDescriptions(fileHandle, self.trackId);
NSMutableArray<MP42SampleDescription *> *descriptions = [NSMutableArray array];
for (uint32_t index = 0; index < count; index++) {
MP42VideoSampleDescription *description = [[MP42VideoSampleDescription alloc] initWithFileHandle:fileHandle trackId:self.trackId index:index];
[descriptions addObject:description];
}
self.sampleDescriptions = [descriptions copy];
if (MP4HaveTrackAtom(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.pasp")) {
MP4GetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.pasp.hSpacing", &_hSpacing);
MP4GetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.pasp.vSpacing", &_vSpacing);