Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / December 2005



Tip: Looking for answers? Try searching our database.

QUICKTIME: writing audio tracks on Windows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Miller - 26 Dec 2005 20:03 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.