-
Notifications
You must be signed in to change notification settings - Fork 2
/
upload_request.go
53 lines (46 loc) · 1.39 KB
/
upload_request.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
42
43
44
45
46
47
48
49
50
51
52
53
package steps
import (
"encoding/json"
"github.com/livepeer/catalyst-api/video"
)
type Output struct {
HLS string `json:"hls,omitempty"`
MP4 string `json:"mp4,omitempty"`
FMP4 string `json:"fragmented_mp4,omitempty"`
SourceMp4 bool `json:"source_mp4"`
Thumbnails string `json:"thumbnails"`
}
type OutputLocation struct {
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
Outputs Output `json:"outputs,omitempty"`
}
type UploadRequest struct {
URL string `json:"url,omitempty"`
CallbackURL string `json:"callback_url,omitempty"`
TargetSegmentSizeSecs int64 `json:"target_segment_size_secs,omitempty"`
OutputLocations []OutputLocation `json:"output_locations,omitempty"`
PipelineStrategy string `json:"pipeline_strategy,omitempty"`
Profiles []video.EncodedProfile `json:"profiles,omitempty"`
}
func DefaultUploadRequest(dest string) UploadRequest {
return UploadRequest{
CallbackURL: "http://localhost:3333/callback/123",
OutputLocations: []OutputLocation{
{
Type: "object_store",
URL: "file://" + dest,
Outputs: Output{
HLS: "enabled",
},
},
},
}
}
func (u UploadRequest) ToJSON() (string, error) {
b, err := json.Marshal(u)
if err != nil {
return "", err
}
return string(b), nil
}