[libavg-devel] More audio thoughts

Ulrich von Zadow uzadow at libavg.de
Sun Mar 30 22:10:34 CEST 2008


Hi,

I've done some more work on the audio branch today:

- Some files have moved to a new src/audio/ directory. This removes a
   circular dependency that would have prevented stand-alone audio tests
   in the src/video directory.
- Made AudioSource into a pure interface IAudioSource because otherwise
   offsetof() will probably break at some point in the video node
   (multiple inheritance and offsetof() don't play well together).

Then: I'd propose to split FFMpegDecoder into two classes, 
FFMpegVideoDecoder and FFMpegAudioDecoder. Right now, audio decoding is 
happening in the SDL audio thread, if I read the code correctly. This 
change would make it possible to have audio and video decoding in two 
completely separate threads. It would also allow the creation of an 
FFMpegAudioDecoder without an FFMpegVideoDecoder.

Actually (thinking aloud here), the two would have to share the same 
AVFormatContext, so there needs to be something like a generic 
FFMpegDecoder in addition to the Video and Audio decoders that is 
responsible for the generic parts of open() and close() and for the 
creation of the audio and video decoders...

Also, there are several conflicting naming conventions around with 
regards to audio samples, so I'd like to propose a clear libavg-specific 
convention:

   Audio Sample: The smallest unit of sound. Only one channel.
   Audio Frame: Several samples, all meant to be played back at the same
       time. (A stereo frame contains two samples).
   Audio Buffer: A collection of audio frames.

This isn't the mpeg convention, but it's what DirectSound uses. 
Alternatively, what would a good name for a collection of samples with 
the same timestamp be?

Cheers,

   Uli

-- 
Any technology distinguishable from magic is insufficiently advanced.

Ulrich von Zadow | +49-172-7872715
Jabber: cocacoder at jabber.berlin.ccc.de
Skype: uzadow



More information about the libavg-devel mailing list