Skip to main content

Crate piaf

Crate piaf 

Source
Expand description

PIAF — a Rust library for reading and interpreting EDID display capability data.

The core pipeline is:

  1. parse_edid — validate and decode raw bytes into ParsedEdidRef (zero-copy).
  2. capabilities_from_edid — run extension handlers to produce DisplayCapabilities.

§Decoding philosophy

PIAF decodes everything a specification defines. No field is omitted because it appears obscure or unlikely to be needed — that judgement belongs to the consumer. Option fields communicate presence or absence in the source data, not relative importance.

§Quick start

use piaf::{parse_edid, capabilities_from_edid, ExtensionLibrary};

let bytes = std::fs::read("/sys/class/drm/card0-HDMI-A-1/edid").unwrap();
let library = ExtensionLibrary::with_standard_handlers();
let parsed = parse_edid(&bytes, &library).unwrap();
let caps = capabilities_from_edid(&parsed, &library);
println!("{:?}", caps.display_name);

Re-exports§

pub use model::ExtensionHandler;
pub use model::EdidError;
pub use model::EdidSource;
pub use model::EdidWarning;
pub use model::ExtensionLibrary;
pub use model::ExtensionMetadata;
pub use model::ExtensionTagRegistry;
pub use model::KnownExtensions;
pub use model::ModeSink;
pub use model::ParsedEdid;
pub use model::ParsedEdidRef;
pub use model::StaticContext;
pub use model::StaticDisplayCapabilities;
pub use model::StaticExtensionHandler;
pub use parser::parse_edid;
pub use parser::parse_edid_owned;
pub use capabilities::capabilities_from_edid;
pub use capabilities::capabilities_from_edid_static;
pub use capabilities::CEA861_HANDLER;
pub use capabilities::Cea861Handler;
pub use capabilities::DISPLAYID_HANDLER;
pub use capabilities::DisplayIdHandler;
pub use capabilities::STANDARD_HANDLERS;

Modules§

capabilities
Capability extraction from a ParsedEdid.
infoframe_type
Well-known InfoFrame type codes from the InfoFrame Data Block (extended tag 0x20).
model
Types for the EDID data model. Data model types for parsed EDID data and display capabilities.
parser
EDID byte-level parser.

Structs§

AudioSampleRates
Sample-rate support mask from byte 2 of a Short Audio Descriptor.
Cea861Capabilities
Decoded capabilities from a CEA-861 extension block.
Cea861Flags
Capability flags from byte 3 of a CEA-861 extension block.
Chromaticity
CIE xy chromaticity coordinates for a display’s color primaries and white point, decoded from EDID base block bytes 0x190x22.
ChromaticityPoint
A single CIE xy chromaticity coordinate pair, decoded from the EDID base block.
ColorManagementData
Color Management Data decoded from a 0xF9 descriptor.
ColorimetryBlock
Decoded Colorimetry Data Block (extended tag 0x05).
ColorimetryFlags
Colorimetry standards supported by the display, from the Colorimetry Data Block (extended tag 0x05).
CvtAspectRatios
Aspect ratios supported for CVT-generated timings (byte 14 of a 0xFD descriptor).
CvtScaling
Display scaling capabilities reported in byte 16 of a 0xFD CVT descriptor.
CvtSupportParams
CVT support parameters decoded from a display range limits descriptor (0xFD).
DcmChannel
DCM polynomial coefficients for a single primary colour, decoded from a 0xF9 descriptor.
DisplayCapabilities
Consumer-facing display capability model produced by a display data parser.
DisplayFeatureFlags
Boolean capability flags from EDID base block byte 0x18 (Display Feature Support).
DisplayGamma
Display gamma, decoded from EDID base block byte 0x17.
DisplayIdCapabilities
Rich capabilities extracted from a DisplayID 1.x extension section.
DisplayIdInterface
Display interface capabilities, decoded from the Display Interface Data Block (DisplayID 1.x 0x0F).
DisplayIdStereoInterface
Stereo display interface parameters, decoded from the Stereo Display Interface Data Block (DisplayID 1.x 0x10).
DisplayIdTiledTopology
Tiled display topology, decoded from the Tiled Display Topology Data Block (DisplayID 1.x 0x12).
DisplayIdTransferCharacteristic
Decoded Transfer Characteristics Block (DisplayID 1.x 0x0E).
EdidVersion
EDID specification version and revision, decoded from base block bytes 18–19.
GtfSecondaryParams
GTF secondary curve parameters decoded from a display range limits descriptor (0xFD).
HdmiAudioBlock
Decoded HDMI Audio Data Block (extended tag 0x12).
HdmiForumDsc
Display Stream Compression (DSC) capabilities from the HF-SCDB.
HdmiForumSinkCap
Decoded HDMI Forum Sink Capability Data Block (HF-SCDB, extended tag 0x79).
HdmiVsdb
Decoded HDMI 1.x Vendor-Specific Data Block (OUI 0x000C03).
HdmiVsdbFlags
Capability flags from byte 5 of the HDMI VSDB payload (byte 8 of the CEA block, after the 3-byte header and 3-byte OUI).
HdrDynamicMetadataDescriptor
One entry from an HDR Dynamic Metadata Data Block (extended tag 0x07).
HdrEotf
Electro-Optical Transfer Functions (EOTFs) supported by the display, from the HDR Static Metadata Data Block (extended tag 0x06).
HdrStaticMetadata
Decoded HDR Static Metadata Data Block (extended tag 0x06).
InfoFrameDescriptor
One entry from an InfoFrame Data Block (extended tag 0x20).
ManufacturerId
A three-character PNP manufacturer identifier, decoded from EDID base block bytes 0x080x09.
MonitorString
A monitor descriptor string, decoded from one of the 18-byte descriptor slots in the EDID base block (0xFC monitor name, 0xFF serial number, 0xFE unspecified text).
PowerSequencing
Panel interface power sequencing timing parameters, decoded from the Interface Power Sequencing Block (DisplayID 1.x 0x0D).
RoomConfigurationBlock
Decoded Room Configuration Data Block (extended tag 0x13).
ShortAudioDescriptor
A decoded Short Audio Descriptor (3 bytes) from a CEA Audio Data Block (tag 0x01).
SpeakerAllocation
Decoded Speaker Allocation Data Block (standard tag 0x04).
SpeakerAllocationFlags
Speaker channel presence flags, byte 1 of the Speaker Allocation Data Block.
SpeakerAllocationFlags2
Speaker channel presence flags, byte 2 of the Speaker Allocation Data Block.
SpeakerAllocationFlags3
Speaker channel presence flags, byte 3 of the Speaker Allocation Data Block.
SpeakerLocationEntry
A single speaker location entry from the Speaker Location Data Block (extended tag 0x14).
T7VtdbBlock
A decoded DisplayID Type VII Video Timing Data Block (T7VTDB, extended tag 0x22).
T8VtdbBlock
A decoded DisplayID Type VIII Video Timing Data Block (T8VTDB, extended tag 0x23).
T10VtdbBlock
A decoded DisplayID Type X Video Timing Data Block (T10VTDB, extended tag 0x2A).
T10VtdbEntry
A single timing entry from a T10VTDB block.
TileBezelInfo
Bezel sizes around a single tile, decoded from the optional bezel bytes of the Tiled Display Topology Data Block (0x12) when the has_bezel_info flag is set.
VendorSpecificBlock
A decoded Vendor-Specific Video Data Block (VSVDB, extended tag 0x01) or Vendor-Specific Audio Data Block (VSADB, extended tag 0x11).
VesaDisplayDeviceBlock
Decoded VESA Display Device Data Block (extended tag 0x02).
VesaTransferCharacteristic
Decoded VESA Display Transfer Characteristic Data Block (standard tag 0x05).
VideoCapability
Decoded Video Capability Data Block (extended tag 0x00).
VideoCapabilityFlags
Flags from the Video Capability Data Block (extended tag 0x00).
VideoInputFlags
Boolean flags from EDID byte 0x14 (Video Input Definition).
VideoMode
A display video mode expressed as resolution, refresh rate, and scan type.
VtbExtBlock
Decoded VESA Video Timing Block Extension (extended tag 0x03).
WhitePoint
An additional white point entry from a 0xFB descriptor.

Enums§

AnalogColorType
Display color type for an analog display, decoded from EDID base block byte 0x18 bits 4–3.
AnalogSyncLevel
Video white and sync levels for an analog display, decoded from EDID base block byte 0x14 bits 6–5.
AudioFormat
Audio format code from bits 6–3 of the first SAD byte.
AudioFormatInfo
Format-specific information from byte 3 of a Short Audio Descriptor.
BacklightType
Backlight type, decoded from Display Device Data Block (0x0C) byte 1 bits 5:4.
ColorBitDepth
Color bit depth per primary color channel, decoded from EDID base block byte 0x14 bits 6–4.
CvtAspectRatio
Preferred aspect ratio for CVT-generated timings, decoded from byte 15 bits 7–5.
DigitalColorEncoding
Supported color encoding formats for a digital display, decoded from EDID base block byte 0x18 bits 4–3.
DisplayInterfaceType
Physical interface standard type, decoded from Display Interface Data Block (0x0F) byte 0 bits 3:0.
DisplayTechnology
Display technology type, decoded from Display Device Data Block (0x0C) byte 0 bits 7:4.
DtcPointEncoding
Bit-depth encoding for transfer characteristic sample points, decoded from the Transfer Characteristics Block (DisplayID 1.x 0x0E) byte 0 bits 7:6.
HdmiDscMaxSlices
Maximum number of horizontal DSC slices supported by a HDMI 2.1 sink.
HdmiForumFrl
Maximum Fixed Rate Link (FRL) bandwidth supported by a HDMI 2.1 sink.
InterfaceContentProtection
Content protection mechanism supported on the display interface, decoded from Display Interface Data Block (0x0F) byte 6 bits 1:0.
ManufactureDate
Manufacture date or model year, decoded from EDID base block bytes 16–17.
OperatingMode
Panel operating mode, decoded from Display Device Data Block (0x0C) byte 1 bits 3:0.
PhysicalOrientation
Physical mounting orientation of the panel, decoded from Display Device Data Block (0x0C) byte 7 bits 1:0.
RotationCapability
Rotation capability, decoded from Display Device Data Block (0x0C) byte 7 bits 3:2.
ScanDirection
Scan direction of the fast (horizontal) scan relative to H-sync, decoded from Display Device Data Block (0x0C) byte 7 bits 7:6.
ScreenSize
Physical screen dimensions or aspect ratio, decoded from EDID base block bytes 0x150x16.
StereoMode
Stereo viewing support decoded from DTD byte 17 bits 6, 5, and 0.
StereoSyncInterface
Physical interface used to deliver stereo synchronization to the glasses, decoded from Stereo Display Interface Data Block (0x10) byte 1.
StereoViewingMode
Stereo content format, decoded from Stereo Display Interface Data Block (0x10) byte 0 bits 3:0.
SubpixelLayout
Sub-pixel layout, decoded from Display Device Data Block (0x0C) byte 8.
SyncDefinition
Sync signal definition decoded from DTD byte 17 bits 4–1.
TileTopologyBehavior
Behavior when one or more tiles are missing from a tiled display, decoded from Tiled Display Topology Data Block (0x12) byte 0 bits 5:4.
TimingFormula
Video timing support reported in the display range limits descriptor (0xFD), byte 10.
TransferCurve
Transfer curve sample data decoded from the DisplayID Transfer Characteristics Block (0x0E).
TransferPointEncoding
Bit-depth encoding for transfer characteristic sample points, decoded from the Transfer Characteristics Block (DisplayID 1.x 0x0E) byte 0 bits 7:6.
VideoInterface
Video interface type, decoded from EDID base block byte 0x14 bits 3–0.
ZeroPixelLocation
Location of the zero pixel (the upper-left pixel in the framebuffer), decoded from Display Device Data Block (0x0C) byte 7 bits 5:4.

Traits§

ExtensionData
Trait for typed data stored in DisplayCapabilities::extension_data by custom handlers.

Type Aliases§

ParseWarning
A reference-counted, type-erased warning value.