Writing a file
The following commands are good for writing to a file.
Immediately after opening the file, set up the tracks to write with
these commands:
quicktime_set_audio(quicktime_t *file, int channels, long sample_rate, int bits, char *compressor);
quicktime_set_video(quicktime_t *file, int tracks, int frame_w, int frame_h, float frame_rate, char *compressor);
Notice the channels argument for audio channels but there is no
argument for total audio tracks. For sanity reasons, the library only
supports writing one audio track of any number of channels.
The compressor string can be one of the compressor #defines in
quicktime.h or your own 4 byte array and applies to all tracks of the
media type, for simplicity reasons. Choose an audio compressor for the
audio command and a video compressor for the video command. The
library doesn't check for conflicting media types or whether a
compressor you make up is legitimate.
The IMA4 compressor is preferred for audio and YUV2 is preferred for
video. IMA4 was really a great idea designed into sucking because of 8
bits, another example of credentials over brain power.
Now you'll want to seek to any point in the file. Seeking works
exactly as in reading, using the same commands, except if you seek to
the middle of a file and write out data, you're going to cause a glitch
in the playback data. It's virtually impossible to line up new frame
boundaries with old frames since some codecs aren't linear and hardly
anyone uses this library anyway.