BIG rewrite stream info

This commit is contained in:
Alex X
2024-06-15 16:46:03 +03:00
parent ecfe802065
commit 96504e2fb0
88 changed files with 1043 additions and 854 deletions
+10 -10
View File
@@ -14,7 +14,7 @@ import (
)
type Consumer struct {
core.SuperConsumer
core.Connection
wr *core.WriteBuffer
muxer *Muxer
mu sync.Mutex
@@ -47,12 +47,17 @@ func NewConsumer(medias []*core.Media) *Consumer {
}
}
cons := &Consumer{
wr := core.NewWriteBuffer(nil)
return &Consumer{
Connection: core.Connection{
ID: core.NewID(),
FormatName: "mp4",
Medias: medias,
Transport: wr,
},
muxer: &Muxer{},
wr: core.NewWriteBuffer(nil),
wr: wr,
}
cons.Medias = medias
return cons
}
func (c *Consumer) AddTrack(media *core.Media, _ *core.Codec, track *core.Receiver) error {
@@ -182,8 +187,3 @@ func (c *Consumer) WriteTo(wr io.Writer) (int64, error) {
return c.wr.WriteTo(wr)
}
func (c *Consumer) Stop() error {
_ = c.SuperConsumer.Close()
return c.wr.Close()
}
+9 -7
View File
@@ -10,11 +10,12 @@ import (
)
type Keyframe struct {
core.SuperConsumer
core.Connection
wr *core.WriteBuffer
muxer *Muxer
}
// Deprecated: should be rewritten
func NewKeyframe(medias []*core.Media) *Keyframe {
if medias == nil {
medias = []*core.Media{
@@ -29,9 +30,15 @@ func NewKeyframe(medias []*core.Media) *Keyframe {
}
}
wr := core.NewWriteBuffer(nil)
cons := &Keyframe{
Connection: core.Connection{
ID: core.NewID(),
FormatName: "mp4",
Transport: wr,
},
muxer: &Muxer{},
wr: core.NewWriteBuffer(nil),
wr: wr,
}
cons.Medias = medias
return cons
@@ -95,8 +102,3 @@ func (c *Keyframe) AddTrack(media *core.Media, _ *core.Codec, track *core.Receiv
func (c *Keyframe) WriteTo(wr io.Writer) (int64, error) {
return c.wr.WriteTo(wr)
}
func (c *Keyframe) Stop() error {
_ = c.SuperConsumer.Close()
return c.wr.Close()
}