mirror of
				https://github.com/aler9/rtsp-simple-server
				synced 2025-10-31 02:56:29 +08:00 
			
		
		
		
	support publishing AV1/H265 with OBS 30 (#2217) (#2234)
	
		
			
	
		
	
	
		
	
		
			Some checks reported warnings
		
		
	
	
		
			
				
	
				lint / code (push) Has been cancelled
				
					
					
				
			
		
			
				
	
				lint / mod-tidy (push) Has been cancelled
				
					
					
				
			
		
			
				
	
				lint / apidocs (push) Has been cancelled
				
					
					
				
			
		
			
				
	
				test / test64 (push) Has been cancelled
				
					
					
				
			
		
			
				
	
				test / test32 (push) Has been cancelled
				
					
					
				
			
		
			
				
	
				test / test_highlevel (push) Has been cancelled
				
					
					
				
			
		
		
	
	
				
					
				
			
		
			Some checks reported warnings
		
		
	
	lint / code (push) Has been cancelled
				lint / mod-tidy (push) Has been cancelled
				lint / apidocs (push) Has been cancelled
				test / test64 (push) Has been cancelled
				test / test32 (push) Has been cancelled
				test / test_highlevel (push) Has been cancelled
				This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| package message | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/bluenviron/mediamtx/internal/rtmp/rawmessage" | ||||
| @@ -11,27 +12,38 @@ type ExtendedFramesX struct { | ||||
| 	ChunkStreamID   byte | ||||
| 	DTS             time.Duration | ||||
| 	MessageStreamID uint32 | ||||
| 	FourCC          [4]byte | ||||
| 	FourCC          FourCC | ||||
| 	Payload         []byte | ||||
| } | ||||
|  | ||||
| // Unmarshal implements Message. | ||||
| func (m *ExtendedFramesX) Unmarshal(raw *rawmessage.Message) error { | ||||
| 	if len(raw.Body) < 6 { | ||||
| 		return fmt.Errorf("not enough bytes") | ||||
| 	} | ||||
|  | ||||
| 	m.ChunkStreamID = raw.ChunkStreamID | ||||
| 	m.DTS = raw.Timestamp | ||||
| 	m.MessageStreamID = raw.MessageStreamID | ||||
| 	copy(m.FourCC[:], raw.Body[1:5]) | ||||
| 	m.FourCC = FourCC(raw.Body[1])<<24 | FourCC(raw.Body[2])<<16 | FourCC(raw.Body[3])<<8 | FourCC(raw.Body[4]) | ||||
| 	m.Payload = raw.Body[5:] | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (m ExtendedFramesX) marshalBodySize() int { | ||||
| 	return 5 + len(m.Payload) | ||||
| } | ||||
|  | ||||
| // Marshal implements Message. | ||||
| func (m ExtendedFramesX) Marshal() (*rawmessage.Message, error) { | ||||
| 	body := make([]byte, 5+len(m.Payload)) | ||||
| 	body := make([]byte, m.marshalBodySize()) | ||||
|  | ||||
| 	body[0] = 0b10000000 | byte(ExtendedTypeFramesX) | ||||
| 	copy(body[1:5], m.FourCC[:]) | ||||
| 	body[1] = uint8(m.FourCC >> 24) | ||||
| 	body[2] = uint8(m.FourCC >> 16) | ||||
| 	body[3] = uint8(m.FourCC >> 8) | ||||
| 	body[4] = uint8(m.FourCC) | ||||
| 	copy(body[5:], m.Payload) | ||||
|  | ||||
| 	return &rawmessage.Message{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user