I have an uncompressed MONO stream of 16 bit samples in this Windows app
I am writing, and I am trying to write it to a QuickTime movie using the
Windows QT SDK.
When I open my movie in the QT player, I don't hear my audio, though it
adequately describes the audio stream in the "Show Movie Info" dialog.
I suspect I am adding the samples to my track wrong. Can anyone examine
my code snippet below and tell me what I might be doing wrong?
bool Movie_QT::putAudio(const void *data, size_t bytes)
{
// wrap data in a Handle and copy the data there
Handle handle = ::NewHandle(bytes);
::HLock(handle);
::memcpy(*handle, data, bytes);
::HUnlock(handle);
// m_audioFormat is a Windows WAVEFORMATEX struct
// nBlockAlign is 2 (size of a single 16-bit mono sample)
long sample_length = m_audioFormat.nBlockAlign;
long n_samples = bytes / m_audioFormat.nBlockAlign;
OSErr err = ::AddMediaSample(m_audioMedia, handle, 0, bytes,
sample_length, (SampleDescriptionHandle)m_audioDesc, n_samples, 0, NULL);
::DisposeHandle(handle);
return err == noErr;
}
Paul Miller - 26 Dec 2005 20:22 GMT
> When I open my movie in the QT player, I don't hear my audio, though it
> adequately describes the audio stream in the "Show Movie Info" dialog.
A little more information.
Even though I I'm getting a useful looking duration (from
GetMediaDuration) when I insert the audio track into the movie, in QT
player it shows the Audio track as having zero duration.
Not sure why that is the case.