diff --git a/MP42/FFmpegUtils.m b/MP42/FFmpegUtils.m index 54e1adc..eeff13f 100644 --- a/MP42/FFmpegUtils.m +++ b/MP42/FFmpegUtils.m @@ -79,7 +79,6 @@ static const struct { { kAudioFormatMPEGLayer1, AV_CODEC_ID_MP1 }, { kAudioFormatMPEGLayer2, AV_CODEC_ID_MP2 }, { kAudioFormatMPEGLayer3, AV_CODEC_ID_MP3 }, - { 'ms\0\0' + 0x50, AV_CODEC_ID_MP2 }, { kAudioFormatAC3, AV_CODEC_ID_AC3 }, { kAudioFormatEnhancedAC3, AV_CODEC_ID_EAC3 }, { 'XiFL', AV_CODEC_ID_FLAC }, diff --git a/MP42/MP42AudioConverter.m b/MP42/MP42AudioConverter.m index 5a5d6db..1c50638 100644 --- a/MP42/MP42AudioConverter.m +++ b/MP42/MP42AudioConverter.m @@ -92,6 +92,14 @@ else if ([format isEqualToString:MP42AudioFormatDTS]) { asbd.mFormatID = 'DTS '; } + else if ([format isEqualToString:MP42AudioFormatMP1]) { + asbd.mFormatID = kAudioFormatMPEGLayer1; + asbd.mFramesPerPacket = 1152; + } + else if ([format isEqualToString:MP42AudioFormatMP2]) { + asbd.mFormatID = kAudioFormatMPEGLayer2; + asbd.mFramesPerPacket = 1152; + } else if ([format isEqualToString:MP42AudioFormatMP3]) { asbd.mFormatID = kAudioFormatMPEGLayer3; asbd.mFramesPerPacket = 1152; @@ -99,6 +107,9 @@ else if ([format isEqualToString:MP42AudioFormatTrueHD]) { asbd.mFormatID = 'trhd'; } + else if ([format isEqualToString:MP42AudioFormatOpus]) { + asbd.mFormatID = 'Opus'; + } else if ([format isEqualToString:MP42AudioFormatPCM]) { AudioStreamBasicDescription temp = [track.muxer_helper->importer audioDescriptionForTrack:track]; if (temp.mFormatID) { diff --git a/MP42/MP42MediaFormat.h b/MP42/MP42MediaFormat.h index aa463e3..e251149 100644 --- a/MP42/MP42MediaFormat.h +++ b/MP42/MP42MediaFormat.h @@ -51,6 +51,8 @@ extern NSString *const MP42VideoFormatFairPlay; // Audio Format extern NSString *const MP42AudioFormatAAC; extern NSString *const MP42AudioFormatHEAAC; +extern NSString *const MP42AudioFormatMP1; +extern NSString *const MP42AudioFormatMP2; extern NSString *const MP42AudioFormatMP3; extern NSString *const MP42AudioFormatVorbis; extern NSString *const MP42AudioFormatFLAC; @@ -59,6 +61,7 @@ extern NSString *const MP42AudioFormatAC3; extern NSString *const MP42AudioFormatEAC3; extern NSString *const MP42AudioFormatDTS; extern NSString *const MP42AudioFormatTrueHD; +extern NSString *const MP42AudioFormatOpus; extern NSString *const MP42AudioFormatAMR; extern NSString *const MP42AudioFormatPCM; extern NSString *const MP42AudioFormatFairPlay; diff --git a/MP42/MP42MediaFormat.m b/MP42/MP42MediaFormat.m index 094d115..0c03ca4 100644 --- a/MP42/MP42MediaFormat.m +++ b/MP42/MP42MediaFormat.m @@ -45,6 +45,8 @@ NSString *const MP42VideoFormatFairPlay = @"FairPlay Video"; // Audio Format NSString *const MP42AudioFormatAAC = @"AAC"; NSString *const MP42AudioFormatHEAAC = @"HE-AAC"; +NSString *const MP42AudioFormatMP1 = @"MP1"; +NSString *const MP42AudioFormatMP2 = @"MP2"; NSString *const MP42AudioFormatMP3 = @"MP3"; NSString *const MP42AudioFormatVorbis = @"Vorbis"; NSString *const MP42AudioFormatFLAC = @"FLAC"; @@ -53,6 +55,7 @@ NSString *const MP42AudioFormatAC3 = @"AC-3"; NSString *const MP42AudioFormatEAC3 = @"E-AC-3"; NSString *const MP42AudioFormatDTS = @"DTS"; NSString *const MP42AudioFormatTrueHD = @"True HD"; +NSString *const MP42AudioFormatOpus = @"Opus"; NSString *const MP42AudioFormatAMR = @"AMR Narrow Band"; NSString *const MP42AudioFormatPCM = @"PCM"; NSString *const MP42AudioFormatFairPlay = @"FairPlay Sound"; diff --git a/MP42/MP42MkvImporter.m b/MP42/MP42MkvImporter.m index 12affcd..dd2a80e 100644 --- a/MP42/MP42MkvImporter.m +++ b/MP42/MP42MkvImporter.m @@ -414,10 +414,16 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t return MP42VideoFormatMPEG2; else if (!strcmp(track->CodecID, "A_DTS")) return MP42AudioFormatDTS; + else if (!strcmp(track->CodecID, "A_OPUS")) + return MP42AudioFormatOpus; else if (!strcmp(track->CodecID, "A_VORBIS")) return MP42AudioFormatVorbis; else if (!strcmp(track->CodecID, "A_FLAC")) return MP42AudioFormatFLAC; + else if (!strcmp(track->CodecID, "A_MPEG/L1")) + return MP42AudioFormatMP1; + else if (!strcmp(track->CodecID, "A_MPEG/L2")) + return MP42AudioFormatMP2; else if (!strcmp(track->CodecID, "A_MPEG/L3")) return MP42AudioFormatMP3; else if (!strcmp(track->CodecID, "A_TRUEHD")) diff --git a/MP42/MP42Utilities.m b/MP42/MP42Utilities.m index d8bb6af..36fbe36 100644 --- a/MP42/MP42Utilities.m +++ b/MP42/MP42Utilities.m @@ -46,7 +46,7 @@ BOOL isTrackMuxable(NSString *formatName) } BOOL trackNeedConversion(NSString *formatName) { - NSArray *supportedConversionFormats = @[MP42AudioFormatVorbis, MP42AudioFormatFLAC, MP42AudioFormatMP3, + NSArray *supportedConversionFormats = @[MP42AudioFormatVorbis, MP42AudioFormatFLAC, MP42AudioFormatMP1, MP42AudioFormatMP2, MP42AudioFormatMP3, MP42AudioFormatOpus, MP42AudioFormatTrueHD, MP42SubtitleFormatSSA, MP42SubtitleFormatText, MP42SubtitleFormatPGS]; return [supportedConversionFormats containsObject:formatName];