Skip to content

Commit 4133e0c

Browse files
Bump OBS websocket protocol to 5.5.0 (#158)
* Bump OBS websocket protocol to 5.5.0 * add undocumented croptobounds field on sceneitemtransform obsproject/obs-websocket#1224 * assert errors for new record requests --------- Co-authored-by: cathy-cloud[bot] <154095190+cathy-cloud[bot]@users.noreply.github.com> Co-authored-by: Andrey Kaipov <[email protected]>
1 parent cafc0a3 commit 4133e0c

10 files changed

+104
-7
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
[![Build Status][build-img]][build-url]
66
[![Go Report][goreport-img]][goreport-url]
77

8-
[protocol-img]: https://img.shields.io/badge/obs--websocket-v5.4.2-blue?logo=obs-studio&style=flat-square
9-
[protocol-url]: https://github.com/obsproject/obs-websocket/blob/5.4.2/docs/generated/protocol.md
8+
[protocol-img]: https://img.shields.io/badge/obs--websocket-v5.5.0-blue?logo=obs-studio&style=flat-square
9+
[protocol-url]: https://github.com/obsproject/obs-websocket/blob/5.5.0/docs/generated/protocol.md
1010
[doc-img]: https://img.shields.io/badge/pkg.go.dev-reference-blue?logo=go&logoColor=white&style=flat-square
1111
[doc-url]: https://pkg.go.dev/github.com/andreykaipov/goobs
1212
[build-img]: https://img.shields.io/github/actions/workflow/status/andreykaipov/goobs/ci.yml?logo=github&style=flat-square&branch=main
@@ -66,9 +66,9 @@ The corresponding output:
6666
[//]: # (snippet-2-begin)
6767
```console
6868
go run _examples/basic/main.go
69-
OBS Studio version: 30.1.0
70-
Server protocol version: 5.4.2
71-
Client protocol version: 5.4.2
72-
Client library version: 1.2.2
69+
OBS Studio version: 30.2.0
70+
Server protocol version: 5.5.0
71+
Client protocol version: 5.5.0
72+
Client library version: 1.4.0
7373
```
7474
[//]: # (snippet-2-end)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This file has been automatically generated. Don't edit it.
2+
3+
package events
4+
5+
/*
6+
Represents the event body for the RecordFileChanged event.
7+
8+
The record output has started writing to a new file. For example, when a file split happens.
9+
*/
10+
type RecordFileChanged struct {
11+
// File name that the output has begun writing to
12+
NewOutputPath string `json:"newOutputPath,omitempty"`
13+
}

api/events/zz_generated.events.go

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ func GetType(name string) any {
6666
return &StreamStateChanged{}
6767
case "RecordStateChanged":
6868
return &RecordStateChanged{}
69+
case "RecordFileChanged":
70+
return &RecordFileChanged{}
6971
case "ReplayBufferStateChanged":
7072
return &ReplayBufferStateChanged{}
7173
case "VirtualcamStateChanged":
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// This file has been automatically generated. Don't edit it.
2+
3+
package record
4+
5+
// Represents the request body for the CreateRecordChapter request.
6+
type CreateRecordChapterParams struct {
7+
// Name of the new chapter
8+
ChapterName *string `json:"chapterName,omitempty"`
9+
}
10+
11+
func NewCreateRecordChapterParams() *CreateRecordChapterParams {
12+
return &CreateRecordChapterParams{}
13+
}
14+
func (o *CreateRecordChapterParams) WithChapterName(x string) *CreateRecordChapterParams {
15+
o.ChapterName = &x
16+
return o
17+
}
18+
19+
// Returns the associated request.
20+
func (o *CreateRecordChapterParams) GetRequestName() string {
21+
return "CreateRecordChapter"
22+
}
23+
24+
// Represents the response body for the CreateRecordChapter request.
25+
type CreateRecordChapterResponse struct {
26+
_response
27+
}
28+
29+
/*
30+
Adds a new chapter marker to the file currently being recorded.
31+
32+
Note: As of OBS 30.2.0, the only file format supporting this feature is Hybrid MP4.
33+
*/
34+
func (c *Client) CreateRecordChapter(paramss ...*CreateRecordChapterParams) (*CreateRecordChapterResponse, error) {
35+
if len(paramss) == 0 {
36+
paramss = []*CreateRecordChapterParams{{}}
37+
}
38+
params := paramss[0]
39+
data := &CreateRecordChapterResponse{}
40+
return data, c.client.SendRequest(params, data)
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// This file has been automatically generated. Don't edit it.
2+
3+
package record
4+
5+
// Represents the request body for the SplitRecordFile request.
6+
type SplitRecordFileParams struct{}
7+
8+
// Returns the associated request.
9+
func (o *SplitRecordFileParams) GetRequestName() string {
10+
return "SplitRecordFile"
11+
}
12+
13+
// Represents the response body for the SplitRecordFile request.
14+
type SplitRecordFileResponse struct {
15+
_response
16+
}
17+
18+
// Splits the current file being recorded into a new file.
19+
func (c *Client) SplitRecordFile(paramss ...*SplitRecordFileParams) (*SplitRecordFileResponse, error) {
20+
if len(paramss) == 0 {
21+
paramss = []*SplitRecordFileParams{{}}
22+
}
23+
params := paramss[0]
24+
data := &SplitRecordFileResponse{}
25+
return data, c.client.SendRequest(params, data)
26+
}

api/typedefs/typedefs.go

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ type SceneItemTransform struct {
104104
BoundsHeight float64 `json:"boundsHeight"`
105105
BoundsType string `json:"boundsType"`
106106
BoundsWidth float64 `json:"boundsWidth"`
107+
CropToBounds bool `json:"cropToBounds"`
107108
CropBottom float64 `json:"cropBottom"`
108109
CropLeft float64 `json:"cropLeft"`
109110
CropRight float64 `json:"cropRight"`

docs/request-mapping.md

+2
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ The following tables show how to make the appropriate `goobs` request for any gi
115115
## record
116116
| obs-websocket | goobs |
117117
| --- | --- |
118+
| CreateRecordChapter | `client.Record.CreateRecordChapter(...)` |
118119
| GetRecordStatus | `client.Record.GetRecordStatus(...)` |
119120
| PauseRecord | `client.Record.PauseRecord(...)` |
120121
| ResumeRecord | `client.Record.ResumeRecord(...)` |
122+
| SplitRecordFile | `client.Record.SplitRecordFile(...)` |
121123
| StartRecord | `client.Record.StartRecord(...)` |
122124
| StopRecord | `client.Record.StopRecord(...)` |
123125
| ToggleRecord | `client.Record.ToggleRecord(...)` |

internal/generate/tests/main.go

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ var (
4848
// run at the end of all others
4949
"record.ResumeRecord",
5050
"record.StopRecord",
51+
"record.CreateRecordChapter",
52+
"record.SplitRecordFile",
5153
}
5254
)
5355

version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
const lib = "github.com/andreykaipov/goobs"
99

10-
var ProtocolVersion = "5.4.2"
10+
var ProtocolVersion = "5.5.0"
1111

1212
var LibraryVersion = func() string {
1313
bi, ok := debug.ReadBuildInfo()

zz_generated._test.go

+10
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,11 @@ func Test_record(t *testing.T) {
693693
client.Disconnect()
694694
})
695695

696+
_, err = client.Record.CreateRecordChapter(&record.CreateRecordChapterParams{ChapterName: &[]string{"test"}[0]})
697+
if err != nil {
698+
t.Logf("%s", err)
699+
}
700+
assert.Error(t, err)
696701
_, err = client.Record.GetRecordStatus(&record.GetRecordStatusParams{})
697702
if err != nil {
698703
t.Logf("%s", err)
@@ -708,6 +713,11 @@ func Test_record(t *testing.T) {
708713
t.Logf("%s", err)
709714
}
710715
assert.Error(t, err)
716+
_, err = client.Record.SplitRecordFile(&record.SplitRecordFileParams{})
717+
if err != nil {
718+
t.Logf("%s", err)
719+
}
720+
assert.Error(t, err)
711721
_, err = client.Record.StartRecord(&record.StartRecordParams{})
712722
if err != nil {
713723
t.Logf("%s", err)

0 commit comments

Comments
 (0)