• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MP3 Packet Description Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MP3 Packet Description Problem


  • Subject: Re: MP3 Packet Description Problem
  • From: "Lukhnos D. Liu" <email@hidden>
  • Date: Wed, 27 Aug 2008 05:31:11 +0800

On Aug 27, 2008, at 5:20 AM, Mike Simmons wrote:
A year or more ago I wrote an app that captures Shoutcast MP3 streams, decodes the audio into linear PCM using AudioConverterFillComplexBuffer(), and writes the audio to disk. It was working fine on Mac OS X 10.4. On 10.5, however, AudioConverterFillComplexBuffer() returns a "pkd!" error indicating that I need to include an AudioStreamPacketDescription argument in the AudioConverterFillComplexBuffer() call, rather than passing a NULL pointer as I had been doing successfully on 10.4.
I've modified my input proc to set the AudioStreamPacketDescription with an mDataByteSize of 417 (the size of the MP3 packets), an mStartOffset of 0, and an mVariableFramesInPacket set to 0. The input proc is called repeatedly the first time AudioConverterFillComplexBuffer() is invoked, and it eventually causes an EXC_BAD_ACCESS error.

Do you have a real instance of AudioStreamPacketDescription struct? I ran into similar problem just a while ago, then I solved this (I hope this is the correct solution) with this snippet:


OSStatus StudyComplexBufferFiller (AudioConverterRef inAudioConverter, UInt32* ioNumberDataPackets, AudioBufferList* ioData, AudioStreamPacketDescription** outDataPacketDescription, void* inUserData)
{
// or use a previously dynamically-allocated memory block
static AudioStreamPacketDescription aspdesc;


        // ... get some data and error processing
        NSData *data = ...;

    	*ioNumberDataPackets = 1;
    	ioData->mNumberBuffers = 1;
        ioData->mBuffers[0].mDataByteSize = [data length];
        ioData->mBuffers[0].mData = (void *)[data bytes];

        // use the static instance
    	*outDataPacketDescription = &aspdesc;
    	aspdesc.mDataByteSize = [data length];
    	aspdesc.mStartOffset = 0;
    	aspdesc.mVariableFramesInPacket = 1;
        return noErr;
    }

On ther calling side, however, I still pass NULL as the last parameter (AudioStreamPacketDescription* outPacketDescription) to AudioConverterFillComplexBuffer.

d.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: MP3 Packet Description Problem
      • From: Mike Simmons <email@hidden>
References: 
 >MP3 Packet Description Problem (From: Mike Simmons <email@hidden>)

  • Prev by Date: Re: Strange silience after connecting to AUGraphicEQ
  • Next by Date: Re: Test report MBP built-in audio device
  • Previous by thread: MP3 Packet Description Problem
  • Next by thread: Re: MP3 Packet Description Problem
  • Index(es):
    • Date
    • Thread