jpoet / HauppaugeUSB

MythTV wrapper around the Hauppauge HD-PVR2/Colossus2 driver
GNU General Public License v3.0
16 stars 5 forks source link

No HDMI audio -- ever! #30

Open Gribnif opened 1 year ago

Gribnif commented 1 year ago

I believe this is a separate issue from the other ticket with a similar title. In my case, I just acquired an HD-PVR2 Gaming Edition (not Plus) and cannot get HDMI audio to work at all. When I pass the output to ffprobe, it reports "0 channels" in the audio. I have tried every audio codec. I have tried multiple source devices. I have also tried the Transcode branch.

Here is some debug output for you to look at. log.txt

Gribnif commented 1 year ago

I have managed to get it working. I suspect the fix will benefit anyone who is using a device which has no AC-3 capture ability. In HauppaugeDev.cpp, function HauppaugeDev::set_audio_format contains this, around line 201:

                else
                {
#if 0               // Fred says this is wrong
                    m_fx2->setPortStateBits(FX2_PORT_E, 0, 0x18);
#else
                    m_fx2->setPortStateBits(FX2_PORT_E, 0x00, 0x00);
#endif
                    INFOLOG << "I2S audio from ADV7842";
                }
                INFOLOG << "Audio Input: HDMI";
                break;

All you have to do is change that #if 0 to #if 1. Looks like whoever "Fred" is, he's wrong about it being wrong. I can now capture audio (stereo only, it seems) from HDMI.

jpoet commented 1 year ago

I am glad you figured it out Gribnif. I no longer have one of these devices in use, so it is very difficult for me to investigate issues with it at this point since I have no way of testing. Probably the correct fix here is to detect the capabilities of that specific HD-PVR model and adjust the logic to match those capabilities. If you could sent me what it prints out as the identification of your HD-PVR, I could blindly change the code to do that, but then I would need you and other with different models to test it.

Gribnif commented 1 year ago

Hi John,

Here's the description for my device, taken from the log.txt I posted earlier:

1  Device Class: 0  VendorID: 8256  ProductID: 58660
Manufacturer: Hauppauge
Serial: E524-00-00AEBAF6
Interfaces: 1 ||| Number of alternate settings: 1 | Interface Number: 0 | Number of endpoints: 6 | Descriptor Type: 5 | EP Address: 129 | Descriptor Type: 5 | EP Address: 132 | Descriptor Type: 5 | EP Address: 136 | Descriptor Type: 5 | EP Address: 1 | Descriptor Type: 5 | EP Address: 2 | Descriptor Type: 5 | EP Address: 134 |

Rather than hard-coding for my specific device, it may be that would want to do something like this in the code:

            case HAPI_AUDIO_CAPTURE_SOURCE_HDMI:
            {
                if (set_digital_audio(false))
                {
                    // Device has a CS8416 chip
                    if (audioFormat == ENCAIF_AC3)
                    {
                        m_fx2->setPortStateBits(FX2_PORT_E, 0x10, 0x00);
                        INFOLOG << "'SPDIF' from HDMI via 8416";
                    }
                    else
                    {
                        m_fx2->setPortStateBits(FX2_PORT_E, 0x00, 0x00);
                        INFOLOG << "I2S audio from ADV7842";
                    }
                }
                else
                {
                    // Older device without CS8416
                    m_fx2->setPortStateBits(FX2_PORT_E, 0, 0x18);
                    INFOLOG << "I2S audio from ADV7842";
                }
                INFOLOG << "Audio Input: HDMI";
                break;
            }