1

.ac3 オーディオ ファイルの AudioStreamBasicDescription オブジェクトのプロパティを設定するために AudioFileGetProperty メソッドを呼び出していますが、その結果、すべてのプロパティが 0 になります。コードは次のとおりです。

NSString *soundFile= [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"sample1AC3.ac3"];
            CFURLRef soundURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (__bridge void*)soundFile, kCFURLPOSIXPathStyle, false);
            int err;
            err = AudioFileOpenURL(soundURL, kAudioFileReadPermission, 0, &mAudioFile);
            //  
            AudioStreamBasicDescription audioFormat;
            UInt32 size1 = sizeof(audioFormat);
            //    
            err = AudioFileGetProperty(mAudioFile, kAudioFilePropertyDataFormat, &size1, &audioFormat);

マイログです

audioFormat AudioStreamBasicDescription {...}

mSampleRate Float64 0

mFormatID UInt32 0

mFormatFlags UInt32 0

mBytesPerPacket UInt32 0

mFramesPerPacket UInt32 0

mBytesPerFrame UInt32 0

mChannelsPerFrame UInt32 0

mBitsPerChannel UInt32 0

mReserved UInt32 0

コードは .mp3 で問題なく動作しますが、.ac3 形式で動作しない理由がわかりません。

4

0 に答える 0