Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Receiving Streamed Audio
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Receiving Streamed Audio



I have a Windows application that uses the QT API to connect to an RTSP stream
containing video and audio. I receive, process and display the video with no
problems.

The audio requirements for my app are a little different. The audio is just an
"alert" signal that indicates when there is something interesting in the video. I
don't actually want to hear the audio, but I need to know when the signal is
there. I tried using the code shown below (adapted from QA1459), but the returned
data is always zeros.

The other odd part about this is that I hear the "alert" audio through my
speakers, but my app doesn't have any code to play it. It's like QT is
automatically playing the audio through the default device. This is actually sort
of useful right now, since it allows me to confirm my "alert" signal is in the
stream, but eventually I'd like to make QT not render it.

Any ideas how I can get the frequency levels?

Thanks.
Michael


UInt32 numChans = 2;
UInt32 numBands = 7;
SetMovieAudioFrequencyMeteringNumBands(
  movie, kQTAudioMeter_StereoMix, &numBands);

freqResults = (QTAudioFrequencyLevels*)malloc(
  offsetof(QTAudioFrequencyLevels, level[numChans*numBands]));
freqResults->numChannels = numChans;
freqResults->numFrequencyBands = numBands;

...

GetMovieAudioFrequencyLevels(
  movie, kQTAudioMeter_StereoMix, freqResults);
float sampleAmplitude = 0.0f;
for(int i=0; i numChannels; i++)
{
  for(int j=0; j numFrequencyBands; j++)
  {
    sampleAmplitude +=
      freqResults[(i * freqResults->numFrequencyBands) + j];
  }
}
if(sampleAmplitude != 0.0f)
{
  // There is an audio signal - do something
}

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

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.