Fix leaks and read the webvtt magic cookie from mp4.

This commit is contained in:
Damiano Galassi committed 2016-02-18 13:25:40 +01:00
1 parent 5ba205be44
commit a33fcd02a0
5 files changed
+31 -5

No files matched your search

+1 -1
View File
@@ -926,7 +926,7 @@
int pos = 0;
for (int i = 0; i < samplesNum; i++) {
CMSampleTimingInfo sampleTimingInfo;
CMTime decodeTimeStamp;
__unused CMTime decodeTimeStamp;
CMTime presentationTimeStamp;
CMTime presentationOutputTimeStamp = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer);
+1 -1
View File
@@ -75,8 +75,8 @@ extern u_int8_t MP4AV_AacConfigGetChannels(u_int8_t* pConfig);
uint8_t *ppValue;
uint32_t pValueSize;
MP4GetTrackBytesProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.ec-3.dec3.content", &ppValue, &pValueSize);
readEAC3Config(ppValue, pValueSize, &_channels, &_channelLayoutTag);
free(ppValue);
}
else if (MP4HaveTrackAtom(fileHandle, _trackId, "mdia.minf.stbl.stsd.alac")) {
uint64_t channels_count = 0;
+11 -1
View File
@@ -649,6 +649,7 @@ int analyze_EAC3(void **context ,uint8_t *frame, uint32_t size)
if (!info->ec3_done) {
/* AC-3 substream must be the first one */
if (hdr->bitstream_id <= 10 && hdr->substreamid != 0) {
free(hdr);
return -1;
}
@@ -657,11 +658,13 @@ int analyze_EAC3(void **context ,uint8_t *frame, uint32_t size)
if (hdr->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) {
/* substream ids must be incremental */
if (hdr->substreamid > info->num_ind_sub + 1) {
free(hdr);
return -1;
}
if (hdr->substreamid == info->num_ind_sub + 1) {
//info->num_ind_sub++;
free(hdr);
return -1;
} else if (hdr->substreamid < info->num_ind_sub ||
(hdr->substreamid == 0 && info->substream[0].bsid)) {
@@ -720,6 +723,8 @@ int analyze_EAC3(void **context ,uint8_t *frame, uint32_t size)
concatenate:
free(hdr);
if (!info->num_blocks && num_blocks == 6) {
return size;
}
@@ -790,5 +795,10 @@ CFDataRef createCookie_EAC3(void *context)
free(info->frame);
return CFDataCreate(kCFAllocatorDefault, cookie.GetBuffer(), cookie.GetBitPosition() / 8);
uint8_t *buffer = cookie.GetBuffer();
size_t size = cookie.GetBitPosition() / 8;
CFDataRef cookieData = CFDataCreate(kCFAllocatorDefault, buffer, size);
free (buffer);
return cookieData;
}
+16
View File
@@ -112,6 +112,7 @@
uint32_t pValueSize;
MP4GetTrackBytesProperty(_fileHandle, srcTrackId, "mdia.minf.stbl.stsd.ec-3.dec3.content", &ppValue, &pValueSize);
magicCookie = [NSData dataWithBytes:ppValue length:pValueSize];
free(ppValue);
}
}
else if (!strcmp(media_data_name, "alac")) {
@@ -120,6 +121,7 @@
uint32_t pValueSize;
MP4GetTrackBytesProperty(_fileHandle, srcTrackId, "mdia.minf.stbl.stsd.alac.alac.AppleLosslessMagicCookie", &ppValue, &pValueSize);
magicCookie = [NSData dataWithBytes:ppValue length:pValueSize];
free(ppValue);
}
}
else {
@@ -233,6 +235,20 @@
}
}
else if ((!strcasecmp(trackType, MP4_TEXT_TRACK_TYPE))) {
if (!strcmp(media_data_name, "wvtt")) {
if (MP4HaveTrackAtom(_fileHandle, srcTrackId, "mdia.minf.stbl.stsd.wvtt.vttC")) {
uint8_t *ppValue;
uint32_t pValueSize;
MP4GetTrackBytesProperty(_fileHandle, srcTrackId, "mdia.minf.stbl.stsd.wvtt.vttC.config", &ppValue, &pValueSize);
magicCookie = [NSData dataWithBytes:ppValue length:pValueSize];
free(ppValue);
return magicCookie;
}
}
}
return nil;
}
+2 -2
View File
@@ -134,7 +134,7 @@
A9B9C27D1823923200416A4E /* MP42FileImporter.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2321823923100416A4E /* MP42FileImporter.h */; settings = {ATTRIBUTES = (Public, ); }; };
A9B9C27E1823923200416A4E /* MP42FileImporter.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2331823923100416A4E /* MP42FileImporter.m */; };
A9B9C27F1823923200416A4E /* MP42H264Importer.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2341823923100416A4E /* MP42H264Importer.h */; };
A9B9C2801823923200416A4E /* MP42H264Importer.mm in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2351823923100416A4E /* MP42H264Importer.mm */; settings = {COMPILER_FLAGS = "-w"; }; };
A9B9C2801823923200416A4E /* MP42H264Importer.mm in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2351823923100416A4E /* MP42H264Importer.mm */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; };
A9B9C2811823923200416A4E /* MP42HtmlParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2361823923100416A4E /* MP42HtmlParser.h */; };
A9B9C2821823923200416A4E /* MP42HtmlParser.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2371823923100416A4E /* MP42HtmlParser.m */; };
A9B9C2831823923200416A4E /* MP42Image.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2381823923100416A4E /* MP42Image.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -174,7 +174,7 @@
A9B9C2A61823923200416A4E /* downmix.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C25C1823923200416A4E /* downmix.h */; };
A9B9C2A71823923200416A4E /* MatroskaFile.c in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C25D1823923200416A4E /* MatroskaFile.c */; };
A9B9C2A81823923200416A4E /* MatroskaFile.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C25E1823923200416A4E /* MatroskaFile.h */; };
A9B9C2A91823923200416A4E /* MatroskaParser.c in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C25F1823923200416A4E /* MatroskaParser.c */; settings = {COMPILER_FLAGS = "-w"; }; };
A9B9C2A91823923200416A4E /* MatroskaParser.c in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C25F1823923200416A4E /* MatroskaParser.c */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; };
A9B9C2AA1823923200416A4E /* MatroskaParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2601823923200416A4E /* MatroskaParser.h */; };
A9B9C2AB1823923200416A4E /* mbs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2611823923200416A4E /* mbs.cpp */; };
A9B9C2AC1823923200416A4E /* mbs.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2621823923200416A4E /* mbs.h */; };