mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-12-24 13:48:04 +08:00
- Refactor frame converter implementation - Update mp4 track to use ICodex - General refactoring and code improvements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
612 B
Go
32 lines
612 B
Go
package rtmp
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"m7s.live/v5/pkg"
|
|
)
|
|
|
|
const (
|
|
PacketTypeSequenceStart byte = iota
|
|
PacketTypeCodedFrames
|
|
PacketTypeSequenceEnd
|
|
PacketTypeCodedFramesX
|
|
PacketTypeMetadata
|
|
PacketTypeMPEG2TSSequenceStart
|
|
)
|
|
|
|
type RTMPData struct {
|
|
pkg.Sample
|
|
}
|
|
|
|
func (avcc *RTMPData) MarshalJSON() ([]byte, error) {
|
|
return []byte(fmt.Sprintf(`{"Timestamp":%d,"Size":%d,"Data":"%s"}`, avcc.Timestamp, avcc.Size, avcc.String())), nil
|
|
}
|
|
|
|
func (avcc *RTMPData) String() string {
|
|
reader := avcc.NewReader()
|
|
var bytes10 [10]byte
|
|
reader.Read(bytes10[:])
|
|
return fmt.Sprintf("%d % 02X", avcc.Timestamp, bytes10[:])
|
|
}
|