Opened 12 years ago

Closed 11 years ago

Last modified 9 years ago

#2539 closed patch (fixed)

Mac OS X doesn't correctly handle AC3 Passthru

Reported by: awk@… Owned by: Nigel
Priority: minor Milestone: unknown
Component: mythtv Version: 0.20
Severity: medium Keywords:
Cc: Ticket locked: no

Description

The attached patch to audiooutputca.h and new audiooutputca.cpp implements AC3/SPDIF passthru on those Macintoshes with appropriate hardware (e.g. Intel & PPC Minis, iMac's, G5's and Mac Pro's). It may well also work on other audio devices that support a co-axial or fibre-optic SPDIF connector, make the device your default output device in the Audio MIDI Settings utility app and try.

Note that if you enable AC3/SPDIF Passthru in the settings but do NOT have a SPDIF connection to an external decoder you're quite likely to hear potentially damaging to your hearing (depending on level) amounts of 'noise' (undecoded AC3 data) through either your headphones, built-in audio or analog external speakers.

Attachments (3)

audiooutputca.h.diff (1.6 KB) - added by awk@… 12 years ago.
Patches to audioutputca.h
audiooutputca.cpp (30.8 KB) - added by awk@… 12 years ago.
Revised Implementation of AudioOutputCA
audiooutputca.2.cpp (35.0 KB) - added by awk@… 12 years ago.
Updated audiooutputca.cpp to reset devices with AC3 streams

Download all attachments as: .zip

Change History (11)

Changed 12 years ago by awk@…

Attachment: audiooutputca.h.diff added

Patches to audioutputca.h

Changed 12 years ago by awk@…

Attachment: audiooutputca.cpp added

Revised Implementation of AudioOutputCA

comment:1 Changed 12 years ago by danielk

Owner: changed from Isaac Richards to Nigel
Type: defectpatch

Changed 12 years ago by awk@…

Attachment: audiooutputca.2.cpp added

Updated audiooutputca.cpp to reset devices with AC3 streams

comment:2 Changed 12 years ago by awk@…

The previous version of audiooutputca had a bug in it where the streams could potentially not be restored to their non-AC3 output. Also if you quit mythfrontend unexpectedly (or get a crash) the device can be left in AC3 mode, I've added a new method called during AudioOutputCA initialization which will reset any output device with an AC3 stream to a LinearPCM format so that the rest of startup (getting the OS to tell us the default output device) will succeed.

As a resut AC-3 output is much more robut now.

comment:3 Changed 12 years ago by Nigel

(In [12285]) Rename an instance and member variable, some formatting changes. One step toward the AC3 audio passthru patch from Andrew Kimpton (see #2539).

comment:4 Changed 12 years ago by Nigel

(In [12351]) Digital audio support for OS X (two months late). See #2539

comment:5 Changed 12 years ago by Nigel

Status: newassigned

Finally committed. I made big changes to the code, but functionally it should be the same, except for two things; 1) it will now fall back to silence if the user requests digital passthru but the Mac or cabling isn't capable, and 2) it will now compile on 10.3!
The latter required a slight change to the output resetting code (to use a deprecated constant), but it seems to work the same in my testing.
It would still be good to fall back from digital to analog if something goes wrong, but the AFD/NVP logic is too convoluted to make this easy. For now, silence is golden (um, easier)

comment:6 Changed 11 years ago by Nigel

Resolution: fixed
Status: acceptedclosed

I haven't worked out a tidy way to do this analogue fall-back. #3028 is in the right ball-park, but I haven't had time to test or adapt that. Will close this OS X specific ticket for now - digital passthru seems to have been working without complaint for ages

comment:7 Changed 9 years ago by Cory

I'm observing this I'm getting no Dolby Digital sound from a Mar'09 Mac Mini using a recently built 21-fixes branch.

When I tune into HD channels with surround I get silence with my speakers when with DVD's I get surround sound.

This is pretty much what I get in my logs: 2009-03-29 18:41:51.535 TV: Attempting to change from None to WatchingRecording? 2009-03-29 18:41:51.546 Using protocol version 40 2009-03-29 18:41:51.666 AFD: Opened codec 0x949400, id(MPEG2VIDEO) type(Video) 2009-03-29 18:41:51.666 AFD: codec MP2 has 2 channels 2009-03-29 18:41:51.677 AFD: Opened codec 0x949800, id(MP2) type(Audio) 2009-03-29 18:41:51.680 AFD: Opened codec 0x949c00, id(MPEG1VIDEO) type(Video) 2009-03-29 18:41:51.680 NVP: Disabling Audio, params(16,2,0)

comment:8 Changed 9 years ago by Cory

Sorry, I should have formatted that log properly:

Oh and when playing DVD's I do get full glorious Dolby Surround, but I did have to change the sound output on the "DVV Player" application to be "Digital Out - build-in..." while a DVD was not in the drive.

Log showing sound being disabled with some "params(16,2,0)". {{{2009-03-29 18:41:51.535 TV: Attempting to change from None to WatchingRecording? 2009-03-29 18:41:51.546 Using protocol version 40 2009-03-29 18:41:51.666 AFD: Opened codec 0x949400, id(MPEG2VIDEO) type(Video) 2009-03-29 18:41:51.666 AFD: codec MP2 has 2 channels 2009-03-29 18:41:51.677 AFD: Opened codec 0x949800, id(MP2) type(Audio) 2009-03-29 18:41:51.680 AFD: Opened codec 0x949c00, id(MPEG1VIDEO) type(Video) 2009-03-29 18:41:51.680 NVP: Disabling Audio, params(16,2,0)}}}

Note: See TracTickets for help on using tickets.