mirror of
https://github.com/datarhei/core.git
synced 2025-10-11 10:50:09 +08:00
Add avstream codec parameter
This commit is contained in:
@@ -46,6 +46,18 @@ type AVstream struct {
|
|||||||
Duplicating bool `json:"duplicating"`
|
Duplicating bool `json:"duplicating"`
|
||||||
GOP string `json:"gop"`
|
GOP string `json:"gop"`
|
||||||
Mode string `json:"mode"`
|
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) {
|
func (a *AVstream) Unmarshal(av *app.AVstream) {
|
||||||
@@ -53,6 +65,9 @@ func (a *AVstream) Unmarshal(av *app.AVstream) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.Input.Unmarshal(&av.Input)
|
||||||
|
a.Output.Unmarshal(&av.Output)
|
||||||
|
|
||||||
a.Aqueue = av.Aqueue
|
a.Aqueue = av.Aqueue
|
||||||
a.Queue = av.Queue
|
a.Queue = av.Queue
|
||||||
a.Dup = av.Dup
|
a.Dup = av.Dup
|
||||||
@@ -64,8 +79,16 @@ func (a *AVstream) Unmarshal(av *app.AVstream) {
|
|||||||
a.GOP = av.GOP
|
a.GOP = av.GOP
|
||||||
a.Mode = av.Mode
|
a.Mode = av.Mode
|
||||||
|
|
||||||
a.Input.Unmarshal(&av.Input)
|
a.Codec = av.Codec
|
||||||
a.Output.Unmarshal(&av.Output)
|
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 {
|
func (a *AVstream) Marshal() *app.AVstream {
|
||||||
@@ -82,6 +105,16 @@ func (a *AVstream) Marshal() *app.AVstream {
|
|||||||
Duplicating: a.Duplicating,
|
Duplicating: a.Duplicating,
|
||||||
GOP: a.GOP,
|
GOP: a.GOP,
|
||||||
Mode: a.Mode,
|
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
|
return av
|
||||||
|
@@ -47,6 +47,16 @@ func TestAVStream(t *testing.T) {
|
|||||||
Duplicating: true,
|
Duplicating: true,
|
||||||
GOP: "gop",
|
GOP: "gop",
|
||||||
Mode: "mode",
|
Mode: "mode",
|
||||||
|
Codec: "h264",
|
||||||
|
Profile: 858,
|
||||||
|
Level: 64,
|
||||||
|
Pixfmt: "yuv420p",
|
||||||
|
Width: 1920,
|
||||||
|
Height: 1080,
|
||||||
|
Samplefmt: "fltp",
|
||||||
|
Sampling: 44100,
|
||||||
|
Layout: "stereo",
|
||||||
|
Channels: 42,
|
||||||
}
|
}
|
||||||
|
|
||||||
p := AVstream{}
|
p := AVstream{}
|
||||||
|
@@ -67,6 +67,18 @@ type AVstream struct {
|
|||||||
Mode string // "file" or "live"
|
Mode string // "file" or "live"
|
||||||
Debug interface{}
|
Debug interface{}
|
||||||
Swap AVStreamSwap
|
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) {
|
func (a *AVstream) UnmarshalParser(p *parse.AVstream) {
|
||||||
@@ -74,6 +86,9 @@ func (a *AVstream) UnmarshalParser(p *parse.AVstream) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.Input.UnmarshalParser(&p.Input)
|
||||||
|
a.Output.UnmarshalParser(&p.Output)
|
||||||
|
|
||||||
a.Aqueue = p.Aqueue
|
a.Aqueue = p.Aqueue
|
||||||
a.Queue = p.Queue
|
a.Queue = p.Queue
|
||||||
a.Dup = p.Dup
|
a.Dup = p.Dup
|
||||||
@@ -85,8 +100,17 @@ func (a *AVstream) UnmarshalParser(p *parse.AVstream) {
|
|||||||
a.GOP = p.GOP
|
a.GOP = p.GOP
|
||||||
a.Mode = p.Mode
|
a.Mode = p.Mode
|
||||||
a.Swap.UnmarshalParser(&p.Swap)
|
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 {
|
func (a *AVstream) MarshalParser() *parse.AVstream {
|
||||||
@@ -105,6 +129,16 @@ func (a *AVstream) MarshalParser() *parse.AVstream {
|
|||||||
Mode: a.Mode,
|
Mode: a.Mode,
|
||||||
Debug: a.Debug,
|
Debug: a.Debug,
|
||||||
Swap: a.Swap.MarshalParser(),
|
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
|
return p
|
||||||
|
@@ -68,6 +68,16 @@ func TestAVstream(t *testing.T) {
|
|||||||
LastURL: "fjfd",
|
LastURL: "fjfd",
|
||||||
LastError: "none",
|
LastError: "none",
|
||||||
},
|
},
|
||||||
|
Codec: "h264",
|
||||||
|
Profile: 858,
|
||||||
|
Level: 64,
|
||||||
|
Pixfmt: "yuv420p",
|
||||||
|
Width: 1920,
|
||||||
|
Height: 1080,
|
||||||
|
Samplefmt: "fltp",
|
||||||
|
Sampling: 44100,
|
||||||
|
Layout: "stereo",
|
||||||
|
Channels: 42,
|
||||||
}
|
}
|
||||||
|
|
||||||
p := AVstream{}
|
p := AVstream{}
|
||||||
|
Reference in New Issue
Block a user