m3u8_parser/m3u8/validation.rs
1/// Represents different types of validation errors that can occur when processing an M3U8 playlist.
2///
3/// This enum captures specific validation issues that may arise when checking the conformity
4/// of a playlist to the M3U8 specification. Each variant represents a distinct error, providing
5/// context for what went wrong during validation.
6#[derive(Debug, PartialEq)]
7pub enum ValidationError {
8 /// Error indicating that the #EXTM3U tag is missing from the playlist.
9 MissingExtM3U,
10
11 /// Error indicating that the specified version is invalid.
12 ///
13 /// # Arguments
14 ///
15 /// * `u8` - The invalid version number that was encountered.
16 InvalidVersion(u8),
17
18 /// Error indicating that the duration specified is invalid.
19 ///
20 /// # Arguments
21 ///
22 /// * `f32` - The invalid duration value that was encountered.
23 InvalidDuration(f32),
24
25 /// Error indicating that the target duration specified is invalid.
26 ///
27 /// # Arguments
28 ///
29 /// * `u32` - The invalid target duration value that was encountered.
30 InvalidTargetDuration(u64),
31
32 /// Error indicating that an invalid key method was specified.
33 ///
34 /// # Arguments
35 ///
36 /// * `String` - The invalid key method that was encountered.
37 InvalidKeyMethod(String),
38
39 /// Error indicating that the URI specified in a map tag is invalid.
40 InvalidMapUri,
41
42 /// Error indicating that the program date and time specified is invalid.
43 InvalidProgramDateTime,
44
45 /// Error indicating that the ID specified in a date range is invalid.
46 InvalidDateRangeId,
47
48 /// Error indicating that the start date specified in a date range is invalid.
49 InvalidDateRangeStartDate,
50
51 /// Error indicating that the end date specified in a date range is invalid.
52 InvalidDateRangeEndDate,
53
54 /// Error indicating that the planned duration specified in a date range is invalid.
55 ///
56 /// # Arguments
57 ///
58 /// * `f32` - The invalid planned duration value that was encountered in the date range.
59 InvalidDateRangePlannedDuration(f32),
60
61 /// Error indicating that the specified byte range is invalid.
62 ///
63 /// # Arguments
64 ///
65 /// * `String` - The invalid byte range that was encountered.
66 InvalidByteRange(String),
67
68 /// Error indicating that a media tag is missing required fields.
69 MissingMediaFields,
70
71 /// Error indicating that a stream information tag is invalid.
72 ///
73 /// # Arguments
74 ///
75 /// * `String` - The invalid stream information encountered.
76 InvalidStreamInf(String),
77
78 /// Error indicating that an I-frame stream information tag is invalid.
79 ///
80 /// # Arguments
81 ///
82 /// * `String` - The invalid I-frame stream information encountered.
83 InvalidIFrameStreamInf(String),
84
85 /// Error indicating that a part tag is invalid.
86 ///
87 /// # Arguments
88 ///
89 /// * `String` - The invalid part information encountered.
90 InvalidPartInfo(String),
91
92 /// Error indicating that a preload hint URI is invalid.
93 InvalidPreloadHintUri,
94
95 /// Error indicating that a rendition report URI is invalid.
96 InvalidRenditionReportUri,
97
98 /// Error indicating that the server control information is invalid.
99 InvalidServerControl,
100
101 /// Error indicating that the specified start time offset is invalid.
102 InvalidStartTimeOffset,
103
104 /// Error indicating that a skip tag is invalid.
105 ///
106 /// # Arguments
107 ///
108 /// * `String` - The invalid skip tag information encountered.
109 InvalidSkipTag(String),
110
111 /// Error indicating that the specified bitrate is invalid.
112 ///
113 /// # Arguments
114 ///
115 /// * `u32` - The invalid bitrate value that was encountered.
116 InvalidBitrate(u32),
117
118 /// Error indicating that the specified start offset is invalid.
119 InvalidStartOffset,
120}