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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/// Errors produced by moqros.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// A pixel format moqros can't convert, e.g. a ROS image encoding it doesn't know.
#[error("unsupported image encoding: {0}")]
UnsupportedEncoding(String),
#[error("invalid image: {0}")]
/// An image whose dimensions, step or buffer size don't add up.
InvalidImage(String),
/// Settings a codec or track rejects, or an unknown codec, format or mode name.
#[error("invalid settings: {0}")]
InvalidSettings(String),
/// An encoder or decoder failed.
#[error("codec error: {0}")]
Codec(String),
/// The codec isn't compiled into this build or its library can't be loaded.
#[error("codec unavailable: {0}")]
CodecUnavailable(String),
/// A decoded picture is larger than [`Decoder::max_pixels`](crate::Decoder::max_pixels).
#[error("decoded picture {width}x{height} exceeds the limit of {max} pixels")]
TooLarge {
/// Picture width in pixels.
width: u32,
/// Picture height in pixels.
height: u32,
/// The configured limit.
max: u64,
},
/// A MoQ track, group or broadcast failed.
#[error("moq error: {0}")]
Moq(#[from] hang::moq_net::Error),
/// Connecting to the relay failed.
#[error("moq connection error: {0}")]
Connection(#[from] moq_tokio::Error),
/// Reading or writing the hang catalog or a container failed.
#[error("hang error: {0}")]
Hang(#[from] hang::Error),
/// A timestamp doesn't fit the wire format.
#[error("timestamp out of range")]
Timestamp,
/// The broadcast's catalog has no video track.
#[error("broadcast {0:?} has no video track in its catalog")]
NoVideo(String),
/// The broadcast's video renditions all use codecs this build can't decode.
#[error("no decodable video rendition; broadcast offers: {0}")]
UnsupportedCodec(String),
/// The broadcast's catalog has no data track in a format moqros reads.
#[error("broadcast {0:?} has no data track moqros can read in its catalog")]
NoData(String),
/// The broadcast's catalog has neither decodable video nor a data track.
#[error("broadcast {0:?} has neither decodable video nor a data track")]
NoTracks(String),
/// A data track bridged to ROS doesn't say which message type it carries.
#[error("data track of broadcast {0:?} doesn't name its ROS message type")]
MissingRosType(String),
/// A JSON payload or catalog entry is malformed.
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
/// The relay connection closed while waiting for the broadcast.
#[error("origin closed before broadcast {0:?} was announced")]
NotAnnounced(String),
/// An r2r call failed.
#[cfg(feature = "ros")]
#[cfg_attr(docsrs, doc(cfg(feature = "ros")))]
#[error("ros error: {0}")]
Ros(#[from] r2r::Error),
/// Publishers of a ROS topic disagree on its message type.
#[error("{topic} has several types: {}", types.join(", "))]
TopicTypes {
/// The fully qualified topic name.
topic: String,
/// Every type its publishers announce.
types: Vec<String>,
},
/// A resubscribed broadcast carries something its ROS topic can't take, e.g. data
/// instead of video, or another message type.
#[error("broadcast {broadcast} changed from {from} to {to}")]
BroadcastChanged {
/// Broadcast name.
broadcast: String,
/// What the broadcast carried before.
from: String,
/// What it carries now.
to: String,
},
}
/// [`std::result::Result`] defaulting to moqros's [`Error`].
pub type Result<T, E = Error> = std::result::Result<T, E>;