From 71ea7afd6753f801d58a5e501569a59202b3505c Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Wed, 10 Aug 2016 09:14:28 +0200 Subject: [PATCH] Preliminary HEVC support. --- MP42/MP42AVFImporter.m | 3 +++ MP42/MP42Mp4Importer.m | 8 ++++++++ MP42/MP42Utilities.m | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/MP42/MP42AVFImporter.m b/MP42/MP42AVFImporter.m index 35eb320..07e6df0 100644 --- a/MP42/MP42AVFImporter.m +++ b/MP42/MP42AVFImporter.m @@ -640,6 +640,9 @@ if (code == kCMVideoCodecType_H264) { magicCookie = CFDictionaryGetValue(atoms, @"avcC"); } + else if (code == kCMVideoCodecType_HEVC || code == 'hev1') { + magicCookie = CFDictionaryGetValue(atoms, @"hvcC"); + } else if (code == kCMVideoCodecType_MPEG4Video) { magicCookie = CFDictionaryGetValue(atoms, @"esds"); } diff --git a/MP42/MP42Mp4Importer.m b/MP42/MP42Mp4Importer.m index eeea18e..28f3225 100644 --- a/MP42/MP42Mp4Importer.m +++ b/MP42/MP42Mp4Importer.m @@ -229,6 +229,14 @@ return [magicCookie autorelease]; } + else if (!strcmp(media_data_name, "hev1")) { + uint8_t *ppValue; + uint32_t pValueSize; + MP4GetTrackBytesProperty(_fileHandle, srcTrackId, "mdia.minf.stbl.stsd.hev1.hvcC.content", &ppValue, &pValueSize); + magicCookie = [NSData dataWithBytes:ppValue length:pValueSize]; + free(ppValue); + return magicCookie; + } else if (!strcmp(media_data_name, "mp4v")) { uint8_t *ppConfig; uint32_t pConfigSize; MP4GetTrackESConfiguration(_fileHandle, srcTrackId, &ppConfig, &pConfigSize); diff --git a/MP42/MP42Utilities.m b/MP42/MP42Utilities.m index 36fbe36..877c69f 100644 --- a/MP42/MP42Utilities.m +++ b/MP42/MP42Utilities.m @@ -38,7 +38,7 @@ MP42Duration TimeFromString(NSString *time_string, MP42Duration timeScale) BOOL isTrackMuxable(NSString *formatName) { - NSArray *supportedFormats = @[MP42VideoFormatH264, MP42VideoFormatMPEG4Visual, MP42AudioFormatAAC, MP42AudioFormatHEAAC, MP42AudioFormatALAC, + NSArray *supportedFormats = @[MP42VideoFormatH265, MP42VideoFormatH264, MP42VideoFormatMPEG4Visual, MP42AudioFormatAAC, MP42AudioFormatHEAAC, MP42AudioFormatALAC, MP42AudioFormatAC3, MP42AudioFormatEAC3, MP42AudioFormatDTS, MP42SubtitleFormatTx3g, MP42SubtitleFormatText, MP42ClosedCaptionFormatCEA608, MP42VideoFormatJPEG, MP42SubtitleFormatVobSub, MP42SubtitleFormatWebVTT];