1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! Map [`CodecKind`] / SPS `profile_idc` to VA-API profile candidates for decode.
use crateDecodeError;
use CodecKind;
/// VA-API profile candidates for a parsed SPS `profile_idc`, best match first.
///
/// This crate's [`super::sps::Sps::parse`] already rejects any `profile_idc` outside
/// `{66, 77}` (baseline / main — this session's scope, see
/// `adr/0001-vaapi-h264-cpu-out.md`), so the `_` arm here is unreachable in practice but kept
/// exhaustive and honest rather than assuming the caller always validates first.
///
/// # Errors
///
/// Returns [`DecodeError::Unsupported`] for any `profile_idc` this crate does not decode.
pub
/// VA-API profile candidates for a parsed HEVC SPS `general_profile_idc`, best match first
/// (ADR-0003, `adr/linux/0003-vaapi-hevc-p-slice-dpb.md`).
///
/// This crate's own [`super::hevc_sps::HevcSps::parse`] does not itself restrict
/// `general_profile_idc` (unlike H.264's [`super::sps::Sps::parse`], which already rejects
/// anything outside `{66, 77}`) — this function is the single point that narrows to Main
/// profile only (this ADR's scope), returning [`DecodeError::Unsupported`] for anything else.
///
/// # Errors
///
/// Returns [`DecodeError::Unsupported`] for any `general_profile_idc` this crate does not
/// decode.
pub
/// VA-API profile candidates for AV1 decode — this crate's AV1 `SequenceHeader::parse` already
/// rejects any `seq_profile` other than `0` (Main — see
/// `adr/linux/0005-vaapi-av1-key-frame-decode.md` § Scope), so this always returns the single
/// Main-profile candidate.
pub
/// VA-API profile candidates for VP9 decode — this crate's VP9 `Header::parse` already rejects
/// any `Profile` other than `0` (8-bit 4:2:0 — see
/// `adr/linux/0004-vaapi-vp9-key-frame-and-inter-decode.md` § Scope), so this always returns the
/// single Profile-0 candidate.
pub
/// Whether this crate's `linux::vaapi` backend decodes `codec` at all — used by `mod.rs`'s
/// dispatcher to route a config to one of its per-codec concrete decoder types
/// ([`super::h264::VaapiH264Decoder`], [`super::hevc::VaapiHevcDecoder`],
/// [`super::av1::VaapiAv1Decoder`], [`super::vp9::VaapiVp9Decoder`]). Each of those types checks
/// its own codec equality directly in its own `validate()` rather than delegating to this
/// predicate — widening this function is therefore safe (it only gates *routing*, never a
/// per-codec accept/reject decision on its own).
pub const