Skip to content

Adding codec support

vit9696 edited this page Mar 10, 2016 · 13 revisions

How to add a new codec to AppleALC

This task is fairly simple and requires no programming skills. In short you are meant to edit a few plists, copy the necessary files, and rebuild the kernel extension using Xcode.

File structure

All the data to be possibly edited exists in Resources folder, and each supported codec is meant to lie in its subfolder with an arbitrary suitable name.

  • Vendors.plist file is meant to contain all the necessary hardware manufacturers and their ids as an associative array. You will unlikely need to edit this.
  • Kexts.plist file is meant to contain all the necessary kext information possibly used for patching. It also is an associative array with kext dictionaries containing:
  • Id — CFBundleIdentifier from the kext's Info.plist;
  • Paths — Possible kext locations in an array.
  • CodecLookup.plist file is meant to let AppleALC detect your codecs by providing the IORegistry lookup paths. All the paths are prefixed, therefore PCI will match PCI0, for example.
  • Tree — array containing the IORegistry path starting from IOService:/PCI/AppleACPIPlatformExpert, its last key is meant to contain IOHDACodecVendorID and IOHDACodecRevisionID properties;
  • layoutNum — Tree path index containing layout-id property starting from 0.

Codec folder structure

Each codec must contain an Info.plist file describing the necessary changes AppleALC is to make. The other files in the folder may include layout/platform data mentioned in Info.plist. Info.plist should include:

  • Vendor — Vendor name string from Vendors.plist;
  • CodecID — Codec identifier (lower 2 bytes of IOHDACodecVendorID);
  • CodecName — Human readable codec name for logging;
  • Revisions — Supported codec revisions (IOHDACodecRevisionID values) in an array (optional, omit for no revision check)
  • Author — Human readable modification author (optional);
  • Files — All the files possibly needed for injection:
    • Platforms — platform variants (optional):
      • Id — matching layout-id number;
      • Device - matching device-id number (optional);
      • Path — file path in the codec directory;
      • MinKernel — minimal suitable major kernel version (optional, see uname -r shell command);
      • MaxKernel — maximum suitable major kernel version (optional).
    • Layouts — layout variants (optional):
      • Id — matching layout-id number;
      • Device - matching device-id number (optional);
      • Path — file path in the codec directory;
      • MinKernel — minimal suitable major kernel version (optional);
      • MaxKernel — maximum suitable major kernel version (optional).
  • Patches — all the binary patches possibly needed for applying in an array (optional):
  • Count — number of required replacements;
  • Find — what to look for;
  • Replace — what to replace with;
  • Name — kext name from Kexts.plist;
  • Device - matching device-id number (optional);
  • MinKernel — minimal suitable major kernel version (optional);
  • MaxKernel — maximum suitable major kernel version (optional).

Step by step algorithm (Xcode is necessary)

  1. Check if your codec vendor is present in Vendors.plist and add it if necessary.
  2. Check if the kexts you plan to patch are present in Kexts.plist and add them if necessary.
  3. Check the paths of IOHDACodecVendorID/IOHDACodecRevisionID/layout-id for your codec in the IORegistry and add them to CodecLookup.plist if necessary.
  4. Create a codec folder in Resources and copy the necessary layouts and platforms inside.
  5. Create an Info.plist file filled with the necessary information structured accordingly to the previous section
  6. Rebuild the kext