commit 60477083f6a072f03697146e9e4db0ab30f21949
parent d1dd8e3025766be03521c488a2f65cdd1202e33b
Author: Oliver Lowe <o@olowe.co>
Date: Tue, 16 Jul 2024 16:24:41 +1000
sdp: document most important exported structures
Not all fields are documented. Includes documentation for the trickier
time description fields.
Diffstat:
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/sdp/parser.go b/sdp/parser.go
@@ -234,10 +234,12 @@ func parseTimes(s string) ([2]time.Time, error) {
return times, nil
}
+// Repeat represents a session's repetition cycle as described in
+// RFC 8866 section 5.10.
type Repeat struct {
- Interval time.Duration
- Active time.Duration
- Offsets []time.Duration
+ Interval time.Duration // duration between each repetition cycle
+ Active time.Duration // planned duration of each session
+ Offsets []time.Duration // duration(s) between each session
}
func parseRepeat(s string) (Repeat, error) {
diff --git a/sdp/sdp.go b/sdp/sdp.go
@@ -26,13 +26,19 @@ type Session struct {
Bandwidth *Bandwidth
// Time holds the start time and stop time of the Session, at
// the first and second index respectively.
- Time [2]time.Time
- Repeat *Repeat
+ Time [2]time.Time
+ // Repeat points to a repetition cycle describing for how long
+ // and when the session may reoccur.
+ Repeat *Repeat
+ // Adjustments holds any time adjustments that may occur, for
+ // example daylight savings, throughout the period a repetition
+ // cycle is active.
Adjustments []TimeAdjustment
Attributes []string
Media []Media
}
+// Origin represents the originator of the session as described in RFC 8866 section 5.2.
type Origin struct {
Username string
ID int
@@ -121,6 +127,7 @@ func parseBandwidth(s string) (Bandwidth, error) {
return Bandwidth{t, kbps * 1e3}, nil
}
+// Media represents a media description.
type Media struct {
Type string // TODO(otl): new type mediaType?
Port int
@@ -179,6 +186,7 @@ func parseMedia(s string) (Media, error) {
return m, nil
}
+// ConnInfo represents connection information.
type ConnInfo struct {
Type string // TODO(otl): only "IP4", "IP6" valid... new int type?
Address string // IPv4, IPv6 literal or a hostname