diff --git a/MP42/FFmpegUtils.m b/MP42/FFmpegUtils.m index bc693b1..d644d7f 100644 --- a/MP42/FFmpegUtils.m +++ b/MP42/FFmpegUtils.m @@ -104,9 +104,9 @@ static const struct { { kAudioFormatMPEGLayer3, AV_CODEC_ID_MP3 }, { kAudioFormatAC3, AV_CODEC_ID_AC3 }, { kAudioFormatEnhancedAC3, AV_CODEC_ID_EAC3 }, - { 'XiFL', AV_CODEC_ID_FLAC }, + { kAudioFormatFLAC, AV_CODEC_ID_FLAC }, { 'XiVs', AV_CODEC_ID_VORBIS }, - { 'opus', AV_CODEC_ID_OPUS }, + { kAudioFormatOpus, AV_CODEC_ID_OPUS }, { kAudioFormatAppleLossless, AV_CODEC_ID_ALAC }, { 'DTS ', AV_CODEC_ID_DTS }, { 'trhd', AV_CODEC_ID_TRUEHD }, diff --git a/MP42/MP42AVFImporter.m b/MP42/MP42AVFImporter.m index 2a0cabd..296b4dd 100644 --- a/MP42/MP42AVFImporter.m +++ b/MP42/MP42AVFImporter.m @@ -70,7 +70,7 @@ case 'ms \0': result = kMP42AudioCodecType_AC3; break; - case 'flac': + case 'XiFL': result = kMP42AudioCodecType_FLAC; break; case 'SRT ': @@ -103,8 +103,8 @@ chapters = [[MP42ChapterTrack alloc] init]; NSArray *chapterList = [_localAsset chapterMetadataGroupsWithTitleLocale:locale containingItemsWithCommonKeys:nil]; for (AVTimedMetadataGroup *chapterData in chapterList) { - for (AVMetadataItem *item in [chapterData items]) { - CMTime time = [item time]; + for (AVMetadataItem *item in chapterData.items) { + CMTime time = item.time; [chapters addChapter:[item stringValue] duration:time.value * time.timescale / 1000]; } } @@ -771,31 +771,14 @@ return [NSData dataWithBytes:cookieBuffer length:cookieSizeOut]; } - else if (code == 'opus') { - // dec3 atom - // remove the atom header - //cookieBuffer += 9; - //cookieSizeOut = cookieSizeOut - 9; - - UInt32 *cookie = (UInt32 *)cookieBuffer; - - for (size_t i = 0; i < cookieSizeOut / 8; i++) { - cookie[i] = EndianS32_BtoN(cookie[i]); - } - + else if (code == kAudioFormatOpus) { + // TODO return [NSData dataWithBytes:cookieBuffer length:cookieSizeOut]; } - else if (code == 'flac') { - - UInt32 *cookie = (UInt32 *)cookieBuffer; - - for (size_t i = 0; i < cookieSizeOut / 8; i++) { - cookie[i] = EndianS32_BtoN(cookie[i]); - } - + else if (code == kAudioFormatFLAC) { + // TODO return [NSData dataWithBytes:cookieBuffer length:cookieSizeOut]; - } else if (code == kAudioFormatEnhancedAC3) { @@ -879,9 +862,7 @@ CFDictionaryRef extentions = CMFormatDescriptionGetExtensions(formatDescription); CFDictionaryRef atoms = CFDictionaryGetValue(extentions, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms); - CFDataRef magicCookie = NULL; - - magicCookie = CFDictionaryGetValue(atoms, @"vttC"); + CFDataRef magicCookie = CFDictionaryGetValue(atoms, @"vttC"); return (NSData *)magicCookie; } diff --git a/MP42/MP42MediaFormat.h b/MP42/MP42MediaFormat.h index 6fae0aa..4a82ea0 100644 --- a/MP42/MP42MediaFormat.h +++ b/MP42/MP42MediaFormat.h @@ -145,7 +145,7 @@ enum : MP42AudioCodecType kMP42AudioCodecType_MicrosoftGSM = 0x6D730031, kMP42AudioCodecType_AES3 = 'aes3', kMP42AudioCodecType_EnhancedAC3 = 'ec-3', - kMP42AudioCodecType_FLAC = 'XiFL', + kMP42AudioCodecType_FLAC = 'flac', kMP42AudioCodecType_Vorbis = 'XiVs', kMP42AudioCodecType_DTS = 'DTS ', kMP42AudioCodecType_TrueHD = 'trhd',