Add MimeCodecs to mp4 Muxer
This commit is contained in:
+5
-1
@@ -171,8 +171,12 @@ func (c *Consumer) AddTrack(media *streamer.Media, track *streamer.Track) *strea
|
|||||||
panic("unsupported codec")
|
panic("unsupported codec")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Consumer) MimeCodecs() string {
|
||||||
|
return c.muxer.MimeCodecs(c.codecs)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Consumer) MimeType() string {
|
func (c *Consumer) MimeType() string {
|
||||||
return c.muxer.MimeType(c.codecs)
|
return `video/mp4; codecs="` + c.MimeCodecs() + `"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Consumer) Init() ([]byte, error) {
|
func (c *Consumer) Init() ([]byte, error) {
|
||||||
|
|||||||
+3
-3
@@ -24,8 +24,8 @@ const (
|
|||||||
MimeOpus = "opus"
|
MimeOpus = "opus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *Muxer) MimeType(codecs []*streamer.Codec) string {
|
func (m *Muxer) MimeCodecs(codecs []*streamer.Codec) string {
|
||||||
s := `video/mp4; codecs="`
|
var s string
|
||||||
|
|
||||||
for i, codec := range codecs {
|
for i, codec := range codecs {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
@@ -46,7 +46,7 @@ func (m *Muxer) MimeType(codecs []*streamer.Codec) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return s + `"`
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Muxer) GetInit(codecs []*streamer.Codec) ([]byte, error) {
|
func (m *Muxer) GetInit(codecs []*streamer.Codec) ([]byte, error) {
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ func (c *Segment) AddTrack(media *streamer.Media, track *streamer.Track) *stream
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
c.MimeType = muxer.MimeType(codecs)
|
c.MimeType = `video/mp4; codecs="` + muxer.MimeCodecs(codecs) + `"`
|
||||||
|
|
||||||
switch track.Codec.Name {
|
switch track.Codec.Name {
|
||||||
case streamer.CodecH264:
|
case streamer.CodecH264:
|
||||||
|
|||||||
Reference in New Issue
Block a user