-
Notifications
You must be signed in to change notification settings - Fork 6
/
framesource.go
41 lines (30 loc) · 1 KB
/
framesource.go
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
package player
// FrameType is a type of Frame.
type FrameType string
const (
// InputFrame contains data sent from stdin of recorded shell.
InputFrame FrameType = "i"
// OutputFrame contains data written to stdout of recorded shell.
OutputFrame FrameType = "o"
)
const FormatVersion = 2
// Header represents asciinema-v2 header (first line). It doesn't include unneeded fields.
type Header struct {
// Version is a format version. Must be 2.
Version int `json:"version"`
// With is a captured terminal width.
Width int `json:"width"`
// Height is a captured terminal height.
Height int `json:"height"`
}
// FrameSource describes frames source.
type FrameSource interface {
// Header returns asciinema-v2 header.
Header() Header
// Next advances to next available frame. It must return false if error occurs or there is no more frames.
Next() bool
// Frame returns current frame. It becomes unusable after Next call.
Frame() Frame
// Err returns error if it happens during iteration.
Err() error
}