1use alpha2_diagnose::{Code, Severity};
4
5use crate::{LintIssue, ModelError};
6
7macro_rules! codes {
8 ($table:ident, $severity:expr, $level:literal, $($constant:ident = $name:literal, $summary:literal;)*) => {
9 $(
10 #[doc = concat!("`", $name, "`.")]
11 pub static $constant: Code = Code {
12 name: $name,
13 severity: $severity,
14 level: $level,
15 summary: $summary,
16 };
17 )*
18 pub static $table: &[&Code] = &[$(&$constant),*];
20 };
21}
22
23macro_rules! variant_codes {
24 (
25 $enum:ident, $code_of:ident, $table:ident, $variants:ident, $severity:expr,
26 $level:literal, $($variant:ident: $constant:ident = $name:literal, $summary:literal;)*
27 ) => {
28 $(
29 #[doc = concat!("`", $name, "`.")]
30 pub static $constant: Code = Code {
31 name: $name,
32 severity: $severity,
33 level: $level,
34 summary: $summary,
35 };
36 )*
37 pub static $table: &[&Code] = &[$(&$constant),*];
39
40 pub(crate) const fn $code_of(value: &$enum) -> &'static Code {
41 match value {
42 $($enum::$variant { .. } => &$constant,)*
43 }
44 }
45
46 #[cfg(test)]
47 pub(crate) static $variants: &[(&str, &Code)] =
48 &[$((stringify!($variant), &$constant)),*];
49 };
50}
51
52codes! {
53 LOAD, Severity::Error, 1,
54 LOAD_TOO_LARGE = "load.too_large", "The document is larger than the engine reads.";
55 LOAD_UNSUPPORTED_VERSION = "load.unsupported_version",
56 "The document is of a schema version this build does not read.";
57 LOAD_REFUSED = "load.refused", "The engine's parser refuses the document at this place.";
58}
59
60variant_codes! {
61 ModelError, model_error_code, MODEL, MODEL_VARIANTS, Severity::Error, 1,
62 UnsupportedSchemaVersion: MODEL_UNSUPPORTED_SCHEMA_VERSION = "model.unsupported_schema_version",
63 "This build cannot interpret the document version.";
64 TooManyDataSets: MODEL_TOO_MANY_DATA_SETS = "model.too_many_data_sets",
65 "The project has more than `MAX_DATA_SETS` data sets.";
66 DuplicateDataSetId: MODEL_DUPLICATE_DATA_SET_ID = "model.duplicate_data_set_id",
67 "Two data sets share one ID.";
68 InvalidDataSet: MODEL_INVALID_DATA_SET = "model.invalid_data_set",
69 "A data set breaks a rule of its kind.";
70 InvalidDataBinding: MODEL_INVALID_DATA_BINDING = "model.invalid_data_binding",
71 "A data binding, correction or caption words reference is unusable where it sits.";
72 EmptyIdentifier: MODEL_EMPTY_IDENTIFIER = "model.empty_identifier",
73 "At least one ID was empty.";
74 DuplicateSourceId: MODEL_DUPLICATE_SOURCE_ID = "model.duplicate_source_id",
75 "Two sources share one ID.";
76 DuplicateEffectResourceId: MODEL_DUPLICATE_EFFECT_RESOURCE_ID = "model.duplicate_effect_resource_id",
77 "Two effect resources share one ID.";
78 DuplicateTrackId: MODEL_DUPLICATE_TRACK_ID = "model.duplicate_track_id",
79 "Two tracks share one ID.";
80 DuplicateClipId: MODEL_DUPLICATE_CLIP_ID = "model.duplicate_clip_id",
81 "Two clips share one ID.";
82 EmptyLocator: MODEL_EMPTY_LOCATOR = "model.empty_locator",
83 "A source locator was empty.";
84 AudioOnImage: MODEL_AUDIO_ON_IMAGE = "model.audio_on_image",
85 "A still image source says it has audio, which no image holds.";
86 InvalidProvider: MODEL_INVALID_PROVIDER = "model.invalid_provider",
87 "A source's provider does not fit it (wrong source kind, audio, or incoherent settings), or a generated source has one.";
88 InvalidFingerprint: MODEL_INVALID_FINGERPRINT = "model.invalid_fingerprint",
89 "A source's fingerprint is malformed, or a generated source has one.";
90 ContradictoryColor: MODEL_CONTRADICTORY_COLOR = "model.contradictory_color",
91 "A source declares a color whose dynamic range contradicts its transfer (HDR is exactly a PQ or HLG transfer).";
92 InvalidGenerator: MODEL_INVALID_GENERATOR = "model.invalid_generator",
93 "A generated source has no valid generator, or has a locator, color metadata or audio; or another source has a generator.";
94 InvalidShape: MODEL_INVALID_SHAPE = "model.invalid_shape",
95 "A shapes content tree or mask outline breaks a limit, has a value out of range, or has keyframes that cannot interpolate.";
96 InvalidLayout: MODEL_INVALID_LAYOUT = "model.invalid_layout",
97 "A layout tree breaks a limit or structure rule, has a value out of range, or has keyframes that cannot interpolate.";
98 InvalidTextRunStyle: MODEL_INVALID_TEXT_RUN_STYLE = "model.invalid_text_run_style",
99 "A text generator's run has a style out of range once applied, or the runs draw in more than `MAX_TEXT_FONT_SELECTIONS` font selections from this run on.";
100 EmptyEffectResourceLocator: MODEL_EMPTY_EFFECT_RESOURCE_LOCATOR = "model.empty_effect_resource_locator",
101 "An effect resource locator was empty.";
102 UnknownEffectResource: MODEL_UNKNOWN_EFFECT_RESOURCE = "model.unknown_effect_resource",
103 "A clip effect references an absent effect resource.";
104 EmptyClipRange: MODEL_EMPTY_CLIP_RANGE = "model.empty_clip_range",
105 "A clip has an empty source or timeline range.";
106 NegativeClipRange: MODEL_NEGATIVE_CLIP_RANGE = "model.negative_clip_range",
107 "A clip starts before the project or source timeline origin.";
108 OverlappingClips: MODEL_OVERLAPPING_CLIPS = "model.overlapping_clips",
109 "Two clips overlap without one transition covering their intersection.";
110 UnknownClipSource: MODEL_UNKNOWN_CLIP_SOURCE = "model.unknown_clip_source",
111 "A clip refers to an absent source.";
112 IncompatibleClipSource: MODEL_INCOMPATIBLE_CLIP_SOURCE = "model.incompatible_clip_source",
113 "A source cannot be placed on the selected track kind.";
114 InvalidVisualProperties: MODEL_INVALID_VISUAL_PROPERTIES = "model.invalid_visual_properties",
115 "A visual clip has non-finite values, invalid opacity, or unordered keyframes.";
116 InvalidAudioProperties: MODEL_INVALID_AUDIO_PROPERTIES = "model.invalid_audio_properties",
117 "A clip has an invalid gain, pan, fade, or audio effect parameter.";
118 InvalidTrackAudio: MODEL_INVALID_TRACK_AUDIO = "model.invalid_track_audio",
119 "A track bus has an invalid gain, pan or effect parameter, or too many sends.";
120 InvalidMasterAudio: MODEL_INVALID_MASTER_AUDIO = "model.invalid_master_audio",
121 "The project master bus has an invalid gain, effect, or limiter parameter.";
122 InvalidAudioBus: MODEL_INVALID_AUDIO_BUS = "model.invalid_audio_bus",
123 "A bus has an invalid gain, pan or effect parameter, or too many sends.";
124 InvalidAudioSend: MODEL_INVALID_AUDIO_SEND = "model.invalid_audio_send",
125 "A send has an invalid gain.";
126 UnknownAudioBus: MODEL_UNKNOWN_AUDIO_BUS = "model.unknown_audio_bus",
127 "An output or send names a bus the project does not have.";
128 DuplicateAudioBus: MODEL_DUPLICATE_AUDIO_BUS = "model.duplicate_audio_bus",
129 "Two buses share an id.";
130 AudioRoutingCycle: MODEL_AUDIO_ROUTING_CYCLE = "model.audio_routing_cycle",
131 "Outputs, sends and effect keys lead from a track or bus back to itself.";
132 TooManyAudioBuses: MODEL_TOO_MANY_AUDIO_BUSES = "model.too_many_audio_buses",
133 "The project holds more buses than `MAX_AUDIO_BUSES`.";
134 UnknownAudioSidechain: MODEL_UNKNOWN_AUDIO_SIDECHAIN = "model.unknown_audio_sidechain",
135 "An effect's `sidechain` names a track or bus the project does not have.";
136 UnknownComposition: MODEL_UNKNOWN_COMPOSITION = "model.unknown_composition",
137 "A clip names an absent composition.";
138 InvalidClipComposition: MODEL_INVALID_CLIP_COMPOSITION = "model.invalid_clip_composition",
139 "A clip's composition has a non-positive scale, reaches a composition time past `MAX_SERIALIZED_TICKS` before the clip ends, or is on an audio clip.";
140 DuplicateCompositionId: MODEL_DUPLICATE_COMPOSITION_ID = "model.duplicate_composition_id",
141 "Two compositions share one ID.";
142 InvalidNodeId: MODEL_INVALID_NODE_ID = "model.invalid_node_id",
143 "A node ID contains `/`, which is reserved for joining the IDs of inlined group and media nodes.";
144 DuplicateNodeId: MODEL_DUPLICATE_NODE_ID = "model.duplicate_node_id",
145 "Two nodes of one composition share an ID.";
146 TooManyCompositionNodes: MODEL_TOO_MANY_COMPOSITION_NODES = "model.too_many_composition_nodes",
147 "A composition has more nodes than the renderer will schedule.";
148 InvalidNode: MODEL_INVALID_NODE = "model.invalid_node",
149 "A node has an invalid setting: effect identity, version, parameter or value; transform, progress, opacity or mask out of range; too many merge layers or masks; or a bypass on a node without inputs.";
150 UnknownNodeInput: MODEL_UNKNOWN_NODE_INPUT = "model.unknown_node_input",
151 "A node input names a node its composition does not have.";
152 CompositionCycle: MODEL_COMPOSITION_CYCLE = "model.composition_cycle",
153 "A node depends on its own output.";
154 UnknownCompositionOutput: MODEL_UNKNOWN_COMPOSITION_OUTPUT = "model.unknown_composition_output",
155 "A composition's output names a node it does not have.";
156 InvalidNodeSource: MODEL_INVALID_NODE_SOURCE = "model.invalid_node_source",
157 "A media node names an absent source or one that is not visual.";
158 InvalidCompositionPorts: MODEL_INVALID_COMPOSITION_PORTS = "model.invalid_composition_ports",
159 "A composition's group inputs are unnamed, repeated or too many, or a control names no effect setting of its nodes or repeats one.";
160 UnknownGroupComposition: MODEL_UNKNOWN_GROUP_COMPOSITION = "model.unknown_group_composition",
161 "A group node names an absent composition.";
162 InvalidTimeOffset: MODEL_INVALID_TIME_OFFSET = "model.invalid_time_offset",
163 "A time offset node reads what has no other time.";
164 CompositionUsesItself: MODEL_COMPOSITION_USES_ITSELF = "model.composition_uses_itself",
165 "A composition uses itself through group nodes or composition sources.";
166 CompositionNestedTooDeep: MODEL_COMPOSITION_NESTED_TOO_DEEP = "model.composition_nested_too_deep",
167 "Compositions nest, through group nodes, composition sources or time offset nodes, more than `MAX_COMPOSITION_DEPTH` deep.";
168 TooManyInlinedNodes: MODEL_TOO_MANY_INLINED_NODES = "model.too_many_inlined_nodes",
169 "The compositions draw more than `MAX_INLINED_NODES` nodes, counting each group node and composition-source media node as the nodes it draws and each time offset node as the nodes it draws again.";
170 FrameDrawsTooManyNodes: MODEL_FRAME_DRAWS_TOO_MANY_NODES = "model.frame_draws_too_many_nodes",
171 "The clips at one instant draw more than `MAX_FRAME_INLINED_NODES` composition nodes together.";
172 InvalidCompositionSource: MODEL_INVALID_COMPOSITION_SOURCE = "model.invalid_composition_source",
173 "A composition source names an absent composition, or has what only a host-supplied source has.";
174 InvalidAdjustmentSource: MODEL_INVALID_ADJUSTMENT_SOURCE = "model.invalid_adjustment_source",
175 "An adjustment source has more than an ID and its kind: a locator, generator, composition, color, fingerprint, provider or audio.";
176 InvalidAdjustmentTransition: MODEL_INVALID_ADJUSTMENT_TRANSITION = "model.invalid_adjustment_transition",
177 "A transition from or to an adjustment clip is not `alpha2.transition.fade`.";
178 InvalidEffect: MODEL_INVALID_EFFECT = "model.invalid_effect",
179 "An effect, transition or generator under `BUILTIN_EFFECT_PREFIX` that does not match its built-in definition.";
180 UnknownNodeResource: MODEL_UNKNOWN_NODE_RESOURCE = "model.unknown_node_resource",
181 "A node's effect references an absent effect resource.";
182 UnknownSourceResource: MODEL_UNKNOWN_SOURCE_RESOURCE = "model.unknown_source_resource",
183 "A generated source's effect generator references an absent effect resource.";
184 InvalidClipMask: MODEL_INVALID_CLIP_MASK = "model.invalid_clip_mask",
185 "A clip has more than `MAX_CLIP_MASKS` masks, a mask with a negative or non-finite value, or masks on an audio track.";
186 InvalidCaptions: MODEL_INVALID_CAPTIONS = "model.invalid_captions",
187 "A caption track has no captions, has clips or transitions, or has invalid cues or style; or another track has captions.";
188 UnknownCaptionStyle: MODEL_UNKNOWN_CAPTION_STYLE = "model.unknown_caption_style",
189 "A caption cue names a style its track does not have.";
190 InvalidCaptionCueStyle: MODEL_INVALID_CAPTION_CUE_STYLE = "model.invalid_caption_cue_style",
191 "A caption cue's style (its track's with the cue's patch applied), or the style of one of its runs over it, is out of range, or its runs draw in more than `MAX_TEXT_FONT_SELECTIONS` font selections.";
192 InvalidTimeMap: MODEL_INVALID_TIME_MAP = "model.invalid_time_map",
193 "A clip's time map cannot be played: a freeze outside the source range, or a curve with unusable keyframes.";
194 TooManyLoopPasses: MODEL_TOO_MANY_LOOP_PASSES = "model.too_many_loop_passes",
195 "A looping clip makes more than `MAX_LOOP_PASSES` passes.";
196 InvalidMatte: MODEL_INVALID_MATTE = "model.invalid_matte",
197 "A clip's matte names no visual clip, itself, a clip with its own matte, an adjustment clip, or a clip in a transition; or an audio or adjustment clip has a matte.";
198 InvalidFrameInterpolation: MODEL_INVALID_FRAME_INTERPOLATION = "model.invalid_frame_interpolation",
199 "A clip outside a video track sets a frame interpolation.";
200 InvalidClipTransition: MODEL_INVALID_CLIP_TRANSITION = "model.invalid_clip_transition",
201 "A transition is not contained in two distinct visual clips on its track.";
202 TransitionCycle: MODEL_TRANSITION_CYCLE = "model.transition_cycle",
203 "Transitions active at one instant lead from clip to clip in a circle, leaving no clip to show.";
204 DuplicateTransition: MODEL_DUPLICATE_TRANSITION = "model.duplicate_transition",
205 "Two clips have more than one transition between them, in either direction.";
206 TooManyDerivedCues: MODEL_TOO_MANY_DERIVED_CUES = "model.too_many_derived_cues",
207 "A caption track derives more than `MAX_DERIVED_CUES` cues from its words, or maps more than `MAX_DATA_WORDS` words through its clips.";
208 UnwritableTime: MODEL_UNWRITABLE_TIME = "model.unwritable_time",
209 "A time lies past `MAX_SERIALIZED_TICKS` either way, which no document holds.";
210 TooManyEffectResources: MODEL_TOO_MANY_EFFECT_RESOURCES = "model.too_many_effect_resources",
211 "The project has more than `MAX_EFFECT_RESOURCES` effect resources.";
212 TooManyCompositions: MODEL_TOO_MANY_COMPOSITIONS = "model.too_many_compositions",
213 "The project contains too many compositions.";
214 TooManySources: MODEL_TOO_MANY_SOURCES = "model.too_many_sources",
215 "The source table exceeds the bounded project resource budget.";
216 TooManyTracks: MODEL_TOO_MANY_TRACKS = "model.too_many_tracks",
217 "The timeline contains too many tracks.";
218 TooManyClips: MODEL_TOO_MANY_CLIPS = "model.too_many_clips",
219 "The timeline contains too many clips in total.";
220 TooManyAudioEffects: MODEL_TOO_MANY_AUDIO_EFFECTS = "model.too_many_audio_effects",
221 "More audio effects hold state at once than `MAX_AUDIO_EFFECTS`.";
222 TooMuchAudioDelay: MODEL_TOO_MUCH_AUDIO_DELAY = "model.too_much_audio_delay",
223 "The audio effects hold more than `MAX_AUDIO_DELAY_MS` of delay at once.";
224 TooManyClipsOnTrack: MODEL_TOO_MANY_CLIPS_ON_TRACK = "model.too_many_clips_on_track",
225 "One track contains too many clips.";
226 TooManyCaptionCues: MODEL_TOO_MANY_CAPTION_CUES = "model.too_many_caption_cues",
227 "A caption track holds more than `MAX_CLIPS_PER_TRACK` cues.";
228 TooManyTransitions: MODEL_TOO_MANY_TRANSITIONS = "model.too_many_transitions",
229 "One track contains too many transitions.";
230 ZeroCanvasDimension: MODEL_ZERO_CANVAS_DIMENSION = "model.zero_canvas_dimension",
231 "Width or height was zero.";
232 CanvasDimensionTooLarge: MODEL_CANVAS_DIMENSION_TOO_LARGE = "model.canvas_dimension_too_large",
233 "A canvas edge exceeds the portable GPU-independent limit.";
234 CanvasPixelBudgetExceeded: MODEL_CANVAS_PIXEL_BUDGET_EXCEEDED = "model.canvas_pixel_budget_exceeded",
235 "The canvas area exceeds the bounded pixel budget.";
236 InvalidBackground: MODEL_INVALID_BACKGROUND = "model.invalid_background",
237 "A background component is non-finite or outside `0..=1`.";
238 InvalidColorPipeline: MODEL_INVALID_COLOR_PIPELINE = "model.invalid_color_pipeline",
239 "The color pipeline's HDR peak is outside `HDR_PEAK_NITS_RANGE`.";
240 InvalidShutter: MODEL_INVALID_SHUTTER = "model.invalid_shutter",
241 "A field of the project's shutter is out of range.";
242 UnsupportedSampleRate: MODEL_UNSUPPORTED_SAMPLE_RATE = "model.unsupported_sample_rate",
243 "The project sample rate is outside the supported DSP interval.";
244}
245
246variant_codes! {
247 LintIssue, lint_issue_code, LINT, LINT_VARIANTS, Severity::Warning, 2,
248 UnreachedKeyframe: LINT_UNREACHED_KEYFRAME = "lint.unreached_keyframe",
249 "A keyframe that no shown time depends on.";
250 HiddenClip: LINT_HIDDEN_CLIP = "lint.hidden_clip",
251 "A clip wholly covered for its whole time by an opaque full-frame clip on a later track.";
252 ShortTransition: LINT_SHORT_TRANSITION = "lint.short_transition",
253 "A transition no project frame shows as a mix.";
254 OffFrameBoundary: LINT_OFF_FRAME_BOUNDARY = "lint.off_frame_boundary",
255 "A boundary that is not where a project frame starts, so the change shows at the next frame.";
256 UnusedSource: LINT_UNUSED_SOURCE = "lint.unused_source",
257 "A source no render reads.";
258 HdrSource: LINT_HDR_SOURCE = "lint.hdr_source",
259 "A high-dynamic-range source in a project whose color pipeline refuses HDR, so rendering it fails.";
260 EmptySubpath: LINT_EMPTY_SUBPATH = "lint.empty_subpath",
261 "A path's subpath without vertices, which draws nothing.";
262 PaintWithoutGeometry: LINT_PAINT_WITHOUT_GEOMETRY = "lint.paint_without_geometry",
263 "A fill or stroke with no geometry before it in its group, which paints nothing.";
264 UnusedCaptionStyle: LINT_UNUSED_CAPTION_STYLE = "lint.unused_caption_style",
265 "A caption style no cue names and no cue's speaker matches.";
266 StaleData: LINT_STALE_DATA = "lint.stale_data",
267 "A source-anchored data set made from other media than its source holds now.";
268 ManyShiftedReads: LINT_MANY_SHIFTED_READS = "lint.many_shifted_reads",
269 "A clip whose composition reads one host-supplied video at more than four other times.";
270 EmptyTextAnimator: LINT_EMPTY_TEXT_ANIMATOR = "lint.empty_text_animator",
271 "A text animator that sets no property, which changes nothing.";
272 MotionBlurWithoutMotion: LINT_MOTION_BLUR_WITHOUT_MOTION = "lint.motion_blur_without_motion",
273 "A clip or transform node marked for motion blur that does not move.";
274 SubFrameClip: LINT_SUB_FRAME_CLIP = "lint.sub_frame_clip",
275 "A clip on the timeline for less than one project frame.";
276 HighlightWithoutTimedRuns: LINT_HIGHLIGHT_WITHOUT_TIMED_RUNS = "lint.highlight_without_timed_runs",
277 "A highlight over a text with no timed run, which draws nothing.";
278}