Re: Realtime AC3 mixer plugin for Core Audio
Re: Realtime AC3 mixer plugin for Core Audio
- Subject: Re: Realtime AC3 mixer plugin for Core Audio
- From: Jeff Moore <email@hidden>
- Date: Tue, 04 Aug 2009 09:12:23 -0700
On Aug 4, 2009, at 5:28 AM, Ryan Walklin wrote:
I contribute to the open-source media player Plex (www.plexapp.com),
and recently rewrote the audio output portion to use Core Audio. I
implemented AC3 passthrough at the time, and took the opportunity to
implement an AC3 encoder which converts multichannel PCM (ie from
AAC or FLAC sources) to AC3 packets (within the render callback),
and then passes them through in the same manner as pre-encoded AC3
tracks.
This works well within Plex, however I am keen to extend this
functionality to the rest of the system via a Core Audio plugin.
I've been reviewing the documentation in the various APIs in the
last couple of weeks, but am struggling to identify the best solution.
My options as I see them are:
- An effect/conversion Audio Unit. This would work for apps which
are able to connect AUs via an Audio Graph, but would be unavailable
to Quicktime and the rest of the system.
This is not really a viable choice since Audio Units explicitly do not
work with encoded data formats. So having an AU that took in linear
PCM and spat out AC-3 would be out of spec and likely wouldn't work
with any actual applications.
-An audio codec which accepts multichannel PCM and produces an AC3
stream. Presumably QT etc would automatically select this if playing
multichannel PCM to an optical device set to encoded output, but
there doesn't seem to be a way to override the default 2 channel
downmixing that usually occurs.
Generally speaking, an audio codec is how the software stack
encapsulates things that translate linear PCM into an encoded format.
To make your encoder available via the AudioConverter, this is the
only way to do it.
As you say though, this approach won't magically make apps user your
encoder to send data to the optical output. So if this is truly your
only goal, it also isn't the right path.
-An AUHAL/Hardware plugin which performs the encoding on the fly, or
a virtual device which presents 6 channels.
I'd prefer to avoid device drivers if I can, as neither C++ or IOKit
are my forte, but essentially I would like to present a 6 channel
mixable device to the system, then perform real-time AC3 encoding
(which is straightforward given buffer access in a callback or
similar with my existing code) and play the output via SPDIF.
I'd appreciate any feedback on the best approach, and if that turns
out to be a hardware plugin or virtual device, so be it.
If your goal is solely to fake out an application so that it renders
5.1 audio to your encoder for the express purpose of sending it out
the SPDIF connector, the only way to do it is going to be via the
virtual audio device route.
The proper place to do this is going to be a HAL user-land driver that
acts to the rest of the system as a 5.1 device but internally does the
encoding and handles sending the data to the real audio device.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden