Skip to content

Commit

Permalink
Bump OBS websocket protocol to 5.5.0 (#158)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
cathy-cloud[bot] and andreykaipov authored Jun 10, 2024
1 parent cafc0a3 commit 4133e0c
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 7 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
[![Build Status][build-img]][build-url]
[![Go Report][goreport-img]][goreport-url]

[protocol-img]: https://img.shields.io/badge/obs--websocket-v5.4.2-blue?logo=obs-studio&style=flat-square
[protocol-url]: https://github.com/obsproject/obs-websocket/blob/5.4.2/docs/generated/protocol.md
[protocol-img]: https://img.shields.io/badge/obs--websocket-v5.5.0-blue?logo=obs-studio&style=flat-square
[protocol-url]: https://github.com/obsproject/obs-websocket/blob/5.5.0/docs/generated/protocol.md
[doc-img]: https://img.shields.io/badge/pkg.go.dev-reference-blue?logo=go&logoColor=white&style=flat-square
[doc-url]: https://pkg.go.dev/github.com/andreykaipov/goobs
[build-img]: https://img.shields.io/github/actions/workflow/status/andreykaipov/goobs/ci.yml?logo=github&style=flat-square&branch=main
Expand Down Expand Up @@ -66,9 +66,9 @@ The corresponding output:
[//]: # (snippet-2-begin)
```console
go run _examples/basic/main.go
OBS Studio version: 30.1.0
Server protocol version: 5.4.2
Client protocol version: 5.4.2
Client library version: 1.2.2
OBS Studio version: 30.2.0
Server protocol version: 5.5.0
Client protocol version: 5.5.0
Client library version: 1.4.0
```
[//]: # (snippet-2-end)
13 changes: 13 additions & 0 deletions api/events/xx_generated.outputs.recordfilechanged.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This file has been automatically generated. Don't edit it.

package events

/*
Represents the event body for the RecordFileChanged event.
The record output has started writing to a new file. For example, when a file split happens.
*/
type RecordFileChanged struct {
// File name that the output has begun writing to
NewOutputPath string `json:"newOutputPath,omitempty"`
}
2 changes: 2 additions & 0 deletions api/events/zz_generated.events.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ func GetType(name string) any {
return &StreamStateChanged{}
case "RecordStateChanged":
return &RecordStateChanged{}
case "RecordFileChanged":
return &RecordFileChanged{}
case "ReplayBufferStateChanged":
return &ReplayBufferStateChanged{}
case "VirtualcamStateChanged":
Expand Down
41 changes: 41 additions & 0 deletions api/requests/record/xx_generated.createrecordchapter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// This file has been automatically generated. Don't edit it.

package record

// Represents the request body for the CreateRecordChapter request.
type CreateRecordChapterParams struct {
// Name of the new chapter
ChapterName *string `json:"chapterName,omitempty"`
}

func NewCreateRecordChapterParams() *CreateRecordChapterParams {
return &CreateRecordChapterParams{}
}
func (o *CreateRecordChapterParams) WithChapterName(x string) *CreateRecordChapterParams {
o.ChapterName = &x
return o
}

// Returns the associated request.
func (o *CreateRecordChapterParams) GetRequestName() string {
return "CreateRecordChapter"
}

// Represents the response body for the CreateRecordChapter request.
type CreateRecordChapterResponse struct {
_response
}

/*
Adds a new chapter marker to the file currently being recorded.
Note: As of OBS 30.2.0, the only file format supporting this feature is Hybrid MP4.
*/
func (c *Client) CreateRecordChapter(paramss ...*CreateRecordChapterParams) (*CreateRecordChapterResponse, error) {
if len(paramss) == 0 {
paramss = []*CreateRecordChapterParams{{}}
}
params := paramss[0]
data := &CreateRecordChapterResponse{}
return data, c.client.SendRequest(params, data)
}
26 changes: 26 additions & 0 deletions api/requests/record/xx_generated.splitrecordfile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This file has been automatically generated. Don't edit it.

package record

// Represents the request body for the SplitRecordFile request.
type SplitRecordFileParams struct{}

// Returns the associated request.
func (o *SplitRecordFileParams) GetRequestName() string {
return "SplitRecordFile"
}

// Represents the response body for the SplitRecordFile request.
type SplitRecordFileResponse struct {
_response
}

// Splits the current file being recorded into a new file.
func (c *Client) SplitRecordFile(paramss ...*SplitRecordFileParams) (*SplitRecordFileResponse, error) {
if len(paramss) == 0 {
paramss = []*SplitRecordFileParams{{}}
}
params := paramss[0]
data := &SplitRecordFileResponse{}
return data, c.client.SendRequest(params, data)
}
1 change: 1 addition & 0 deletions api/typedefs/typedefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ type SceneItemTransform struct {
BoundsHeight float64 `json:"boundsHeight"`
BoundsType string `json:"boundsType"`
BoundsWidth float64 `json:"boundsWidth"`
CropToBounds bool `json:"cropToBounds"`
CropBottom float64 `json:"cropBottom"`
CropLeft float64 `json:"cropLeft"`
CropRight float64 `json:"cropRight"`
Expand Down
2 changes: 2 additions & 0 deletions docs/request-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ The following tables show how to make the appropriate `goobs` request for any gi
## record
| obs-websocket | goobs |
| --- | --- |
| CreateRecordChapter | `client.Record.CreateRecordChapter(...)` |
| GetRecordStatus | `client.Record.GetRecordStatus(...)` |
| PauseRecord | `client.Record.PauseRecord(...)` |
| ResumeRecord | `client.Record.ResumeRecord(...)` |
| SplitRecordFile | `client.Record.SplitRecordFile(...)` |
| StartRecord | `client.Record.StartRecord(...)` |
| StopRecord | `client.Record.StopRecord(...)` |
| ToggleRecord | `client.Record.ToggleRecord(...)` |
Expand Down
2 changes: 2 additions & 0 deletions internal/generate/tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ var (
// run at the end of all others
"record.ResumeRecord",
"record.StopRecord",
"record.CreateRecordChapter",
"record.SplitRecordFile",
}
)

Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

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

var ProtocolVersion = "5.4.2"
var ProtocolVersion = "5.5.0"

var LibraryVersion = func() string {
bi, ok := debug.ReadBuildInfo()
Expand Down
10 changes: 10 additions & 0 deletions zz_generated._test.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,11 @@ func Test_record(t *testing.T) {
client.Disconnect()
})

_, err = client.Record.CreateRecordChapter(&record.CreateRecordChapterParams{ChapterName: &[]string{"test"}[0]})
if err != nil {
t.Logf("%s", err)
}
assert.Error(t, err)
_, err = client.Record.GetRecordStatus(&record.GetRecordStatusParams{})
if err != nil {
t.Logf("%s", err)
Expand All @@ -708,6 +713,11 @@ func Test_record(t *testing.T) {
t.Logf("%s", err)
}
assert.Error(t, err)
_, err = client.Record.SplitRecordFile(&record.SplitRecordFileParams{})
if err != nil {
t.Logf("%s", err)
}
assert.Error(t, err)
_, err = client.Record.StartRecord(&record.StartRecordParams{})
if err != nil {
t.Logf("%s", err)
Expand Down

0 comments on commit 4133e0c

Please sign in to comment.