mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-26 17:20:23 +08:00
* allow RTMP streaming with codecid=av01 or hvc1 Prior to this change, when trying to stream AV1 over enhanced RTMP using XSplit Broadcaster, the server was refusing the content with "unsupported video codec: av01" message. * add tests --------- Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
40 lines
977 B
Go
40 lines
977 B
Go
package message
|
|
|
|
import (
|
|
"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage"
|
|
)
|
|
|
|
// ExtendedSequenceStart is a sequence start extended message.
|
|
type ExtendedSequenceStart struct {
|
|
ChunkStreamID byte
|
|
MessageStreamID uint32
|
|
FourCC [4]byte
|
|
Config []byte
|
|
}
|
|
|
|
// Unmarshal implements Message.
|
|
func (m *ExtendedSequenceStart) Unmarshal(raw *rawmessage.Message) error {
|
|
m.ChunkStreamID = raw.ChunkStreamID
|
|
m.MessageStreamID = raw.MessageStreamID
|
|
copy(m.FourCC[:], raw.Body[1:5])
|
|
m.Config = raw.Body[5:]
|
|
|
|
return nil
|
|
}
|
|
|
|
// Marshal implements Message.
|
|
func (m ExtendedSequenceStart) Marshal() (*rawmessage.Message, error) {
|
|
body := make([]byte, 5+len(m.Config))
|
|
|
|
body[0] = 0b10000000 | byte(ExtendedTypeSequenceStart)
|
|
copy(body[1:5], m.FourCC[:])
|
|
copy(body[5:], m.Config)
|
|
|
|
return &rawmessage.Message{
|
|
ChunkStreamID: m.ChunkStreamID,
|
|
Type: uint8(TypeVideo),
|
|
MessageStreamID: m.MessageStreamID,
|
|
Body: body,
|
|
}, nil
|
|
}
|