diff --git a/http/api/avstream.go b/http/api/avstream.go index 5af4e90d..5948d220 100644 --- a/http/api/avstream.go +++ b/http/api/avstream.go @@ -46,6 +46,18 @@ type AVstream struct { Duplicating bool `json:"duplicating"` GOP string `json:"gop"` Mode string `json:"mode"` + + // Codec parameter + Codec string `json:"codec"` + Profile int `json:"profile"` + Level int `json:"level"` + Pixfmt string `json:"pix_fmt"` + Width uint64 `json:"width" format:"uint64"` + Height uint64 `json:"height" format:"uint64"` + Samplefmt string `json:"sample_fmt"` + Sampling uint64 `json:"sampling_hz" format:"uint64"` + Layout string `json:"layout"` + Channels uint64 `json:"channels" format:"uint64"` } func (a *AVstream) Unmarshal(av *app.AVstream) { @@ -53,6 +65,9 @@ func (a *AVstream) Unmarshal(av *app.AVstream) { return } + a.Input.Unmarshal(&av.Input) + a.Output.Unmarshal(&av.Output) + a.Aqueue = av.Aqueue a.Queue = av.Queue a.Dup = av.Dup @@ -64,8 +79,16 @@ func (a *AVstream) Unmarshal(av *app.AVstream) { a.GOP = av.GOP a.Mode = av.Mode - a.Input.Unmarshal(&av.Input) - a.Output.Unmarshal(&av.Output) + a.Codec = av.Codec + a.Profile = av.Profile + a.Level = av.Level + a.Pixfmt = av.Pixfmt + a.Width = av.Width + a.Height = av.Height + a.Samplefmt = av.Samplefmt + a.Sampling = av.Sampling + a.Layout = av.Layout + a.Channels = av.Channels } func (a *AVstream) Marshal() *app.AVstream { @@ -82,6 +105,16 @@ func (a *AVstream) Marshal() *app.AVstream { Duplicating: a.Duplicating, GOP: a.GOP, Mode: a.Mode, + Codec: a.Codec, + Profile: a.Profile, + Level: a.Level, + Pixfmt: a.Pixfmt, + Width: a.Width, + Height: a.Height, + Samplefmt: a.Samplefmt, + Sampling: a.Sampling, + Layout: a.Layout, + Channels: a.Channels, } return av diff --git a/http/api/avstream_test.go b/http/api/avstream_test.go index f8bb4d73..198a9153 100644 --- a/http/api/avstream_test.go +++ b/http/api/avstream_test.go @@ -47,6 +47,16 @@ func TestAVStream(t *testing.T) { Duplicating: true, GOP: "gop", Mode: "mode", + Codec: "h264", + Profile: 858, + Level: 64, + Pixfmt: "yuv420p", + Width: 1920, + Height: 1080, + Samplefmt: "fltp", + Sampling: 44100, + Layout: "stereo", + Channels: 42, } p := AVstream{} diff --git a/restream/app/avstream.go b/restream/app/avstream.go index 2a5deb5e..9ff088ff 100644 --- a/restream/app/avstream.go +++ b/restream/app/avstream.go @@ -67,6 +67,18 @@ type AVstream struct { Mode string // "file" or "live" Debug interface{} Swap AVStreamSwap + + // Codec parameter + Codec string + Profile int + Level int + Pixfmt string + Width uint64 + Height uint64 + Samplefmt string + Sampling uint64 + Layout string + Channels uint64 } func (a *AVstream) UnmarshalParser(p *parse.AVstream) { @@ -74,6 +86,9 @@ func (a *AVstream) UnmarshalParser(p *parse.AVstream) { return } + a.Input.UnmarshalParser(&p.Input) + a.Output.UnmarshalParser(&p.Output) + a.Aqueue = p.Aqueue a.Queue = p.Queue a.Dup = p.Dup @@ -85,8 +100,17 @@ func (a *AVstream) UnmarshalParser(p *parse.AVstream) { a.GOP = p.GOP a.Mode = p.Mode a.Swap.UnmarshalParser(&p.Swap) - a.Input.UnmarshalParser(&p.Input) - a.Output.UnmarshalParser(&p.Output) + + a.Codec = p.Codec + a.Profile = p.Profile + a.Level = p.Level + a.Pixfmt = p.Pixfmt + a.Width = p.Width + a.Height = p.Height + a.Samplefmt = p.Samplefmt + a.Sampling = p.Sampling + a.Layout = p.Layout + a.Channels = p.Channels } func (a *AVstream) MarshalParser() *parse.AVstream { @@ -105,6 +129,16 @@ func (a *AVstream) MarshalParser() *parse.AVstream { Mode: a.Mode, Debug: a.Debug, Swap: a.Swap.MarshalParser(), + Codec: a.Codec, + Profile: a.Profile, + Level: a.Level, + Pixfmt: a.Pixfmt, + Width: a.Width, + Height: a.Height, + Samplefmt: a.Samplefmt, + Sampling: a.Sampling, + Layout: a.Layout, + Channels: a.Channels, } return p diff --git a/restream/app/avstream_test.go b/restream/app/avstream_test.go index 834aad0a..ea6a229d 100644 --- a/restream/app/avstream_test.go +++ b/restream/app/avstream_test.go @@ -68,6 +68,16 @@ func TestAVstream(t *testing.T) { LastURL: "fjfd", LastError: "none", }, + Codec: "h264", + Profile: 858, + Level: 64, + Pixfmt: "yuv420p", + Width: 1920, + Height: 1080, + Samplefmt: "fltp", + Sampling: 44100, + Layout: "stereo", + Channels: 42, } p := AVstream{}