Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: ff_private.c
- ===================================================================
- --- ff_private.c (revision 1388)
- +++ ff_private.c (working copy)
- @@ -219,11 +219,19 @@
- /* ask the toolbox about more information */
- ioSize = sizeof(AudioStreamBasicDescription);
- err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, cookieSize, cookie, &ioSize, &asbd);
- - if (err || !asbd.mFormatID) {
- - fprintf(stderr, "AudioFormatGetProperty dislikes the magic cookie (error %ld / format id %lx)\n", err, asbd.mFormatID);
- +
- + // We can't recover from this (FormatInfo resets mFormatID for bad MPEG-4 AOTs)
- + if (!asbd.mFormatID || !asbd.mChannelsPerFrame) {
- + Codecprintf(NULL, "Audio channels or format not set\n");
- goto bail;
- }
- + // We might be able to recover from this (at least try to import the packets)
- + if (err) {
- + Codecprintf(NULL, "AudioFormatGetProperty failed (error %ld / format id %lx)\n", err, asbd.mFormatID);
- + err = noErr;
- + }
- +
- // This needs to be set for playback to work, but 10.4 (+ AppleTV) didn't set it in FormatInfo.
- // FIXME anything non-zero (like 1) might work here
- if (!asbd.mFramesPerPacket && asbd.mFormatID == kAudioFormatMPEGLayer3)
- @@ -302,7 +310,7 @@
- if(cookie)
- av_free(cookie);
- - return noErr;
- + return err;
- } /* initialize_audio_map() */
- OSType map_video_codec_to_mov_tag(enum CodecID codec_id)
- Index: MatroskaImportPrivate.cpp
- ===================================================================
- --- MatroskaImportPrivate.cpp (revision 1388)
- +++ MatroskaImportPrivate.cpp (working copy)
- @@ -557,7 +557,7 @@
- ByteCount cookieSize = 0;
- Handle cookieH = NULL;
- Ptr cookie = NULL;
- - OSErr err = noErr;
- + OSStatus err = noErr;
- mkvTrack.theTrack = NewMovieTrack(theMovie, 0, 0, kFullVolume);
- if (mkvTrack.theTrack == NULL)
- @@ -588,11 +588,15 @@
- // get more info about the codec
- err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, cookieSize, cookie, &ioSize, &asbd);
- - if (err) goto err;
- - if(asbd.mChannelsPerFrame == 0) {
- - Codecprintf(NULL, "Audio channels not set in MKV\n");
- + if(asbd.mChannelsPerFrame == 0 || asbd.mFormatID == 0) {
- + Codecprintf(NULL, "Audio channels or format not set in MKV\n");
- goto err; // better to fail than import with the wrong number of channels...
- }
- +
- + if (err) {
- + Codecprintf(NULL, "AudioFormatGetProperty failed (error %lx / format %lx)\n", err, asbd.mFormatID);
- + err = noErr;
- + }
- // see ff_private.c initialize_audio_map
- if (!asbd.mFramesPerPacket && asbd.mFormatID == kAudioFormatMPEGLayer3)
- Index: FFissionCodec/FFissionDecoder.cpp
- ===================================================================
- --- FFissionCodec/FFissionDecoder.cpp (revision 1388)
- +++ FFissionCodec/FFissionDecoder.cpp (working copy)
- @@ -314,7 +314,7 @@
- // We need to fake an output format, doesn't matter what it says as long as it inits
- static const AudioStreamBasicDescription DefaultOutputASBD =
- - { 44100, kAudioFormatLinearPCM, kIntPCMOutFormatFlag, 4, 1, 4, 2, 16 };
- + { info->mASBD.mSampleRate, kAudioFormatLinearPCM, kIntPCMOutFormatFlag, 4, 1, 4, info->mASBD.mChannelsPerFrame, 16 };
- try {
- dec->Initialize(&info->mASBD, &DefaultOutputASBD, info->mMagicCookie, info->mMagicCookieSize);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement