Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.25 KB | None | 0 0
  1. Index: ff_private.c
  2. ===================================================================
  3. --- ff_private.c    (revision 1388)
  4. +++ ff_private.c    (working copy)
  5. @@ -219,11 +219,19 @@
  6.     /* ask the toolbox about more information */
  7.     ioSize = sizeof(AudioStreamBasicDescription);
  8.     err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, cookieSize, cookie, &ioSize, &asbd);
  9. -   if (err || !asbd.mFormatID) {
  10. -       fprintf(stderr, "AudioFormatGetProperty dislikes the magic cookie (error %ld / format id %lx)\n", err, asbd.mFormatID);
  11. +  
  12. +   // We can't recover from this (FormatInfo resets mFormatID for bad MPEG-4 AOTs)
  13. +   if (!asbd.mFormatID || !asbd.mChannelsPerFrame) {
  14. +       Codecprintf(NULL, "Audio channels or format not set\n");
  15.         goto bail;
  16.     }
  17.    
  18. +   // We might be able to recover from this (at least try to import the packets)
  19. +   if (err) {
  20. +       Codecprintf(NULL, "AudioFormatGetProperty failed (error %ld / format id %lx)\n", err, asbd.mFormatID);
  21. +       err = noErr;
  22. +   }
  23. +  
  24.     // This needs to be set for playback to work, but 10.4 (+ AppleTV) didn't set it in FormatInfo.
  25.     // FIXME anything non-zero (like 1) might work here
  26.     if (!asbd.mFramesPerPacket && asbd.mFormatID == kAudioFormatMPEGLayer3)
  27. @@ -302,7 +310,7 @@
  28.     if(cookie)
  29.         av_free(cookie);
  30.    
  31. -   return noErr;
  32. +   return err;
  33.  } /* initialize_audio_map() */
  34.  
  35.  OSType map_video_codec_to_mov_tag(enum CodecID codec_id)
  36. Index: MatroskaImportPrivate.cpp
  37. ===================================================================
  38. --- MatroskaImportPrivate.cpp   (revision 1388)
  39. +++ MatroskaImportPrivate.cpp   (working copy)
  40. @@ -557,7 +557,7 @@
  41.     ByteCount cookieSize = 0;
  42.     Handle cookieH = NULL;
  43.     Ptr cookie = NULL;
  44. -   OSErr err = noErr;
  45. +   OSStatus err = noErr;
  46.    
  47.     mkvTrack.theTrack = NewMovieTrack(theMovie, 0, 0, kFullVolume);
  48.     if (mkvTrack.theTrack == NULL)
  49. @@ -588,11 +588,15 @@
  50.     // get more info about the codec
  51.     err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, cookieSize, cookie, &ioSize, &asbd);
  52.    
  53. -   if (err) goto err;
  54. -   if(asbd.mChannelsPerFrame == 0) {
  55. -       Codecprintf(NULL, "Audio channels not set in MKV\n");
  56. +   if(asbd.mChannelsPerFrame == 0 || asbd.mFormatID == 0) {
  57. +       Codecprintf(NULL, "Audio channels or format not set in MKV\n");
  58.         goto err; // better to fail than import with the wrong number of channels...
  59.     }
  60. +  
  61. +   if (err) {
  62. +       Codecprintf(NULL, "AudioFormatGetProperty failed (error %lx / format %lx)\n", err, asbd.mFormatID);
  63. +       err = noErr;
  64. +   }
  65.  
  66.     // see ff_private.c initialize_audio_map
  67.     if (!asbd.mFramesPerPacket && asbd.mFormatID == kAudioFormatMPEGLayer3)
  68. Index: FFissionCodec/FFissionDecoder.cpp
  69. ===================================================================
  70. --- FFissionCodec/FFissionDecoder.cpp   (revision 1388)
  71. +++ FFissionCodec/FFissionDecoder.cpp   (working copy)
  72. @@ -314,7 +314,7 @@
  73.            
  74.             // We need to fake an output format, doesn't matter what it says as long as it inits
  75.             static const AudioStreamBasicDescription DefaultOutputASBD =
  76. -           { 44100, kAudioFormatLinearPCM, kIntPCMOutFormatFlag, 4, 1, 4, 2, 16 };
  77. +           { info->mASBD.mSampleRate, kAudioFormatLinearPCM, kIntPCMOutFormatFlag, 4, 1, 4, info->mASBD.mChannelsPerFrame, 16 };
  78.            
  79.             try {
  80.                 dec->Initialize(&info->mASBD, &DefaultOutputASBD, info->mMagicCookie, info->mMagicCookieSize);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement