mjpeg
This commit is contained in:
		
							
								
								
									
										1
									
								
								av/av.go
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								av/av.go
									
									
									
									
									
								
							| @@ -121,6 +121,7 @@ var ( | ||||
| 	VP8        = MakeVideoCodecType(avCodecTypeMagic + 4) | ||||
| 	VP9        = MakeVideoCodecType(avCodecTypeMagic + 5) | ||||
| 	AV1        = MakeVideoCodecType(avCodecTypeMagic + 6) | ||||
| 	MJPEG      = MakeVideoCodecType(avCodecTypeMagic + 7) | ||||
| 	AAC        = MakeAudioCodecType(avCodecTypeMagic + 1) | ||||
| 	PCM_MULAW  = MakeAudioCodecType(avCodecTypeMagic + 2) | ||||
| 	PCM_ALAW   = MakeAudioCodecType(avCodecTypeMagic + 3) | ||||
|   | ||||
							
								
								
									
										10
									
								
								codec/mjpeg/parser.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								codec/mjpeg/parser.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| package mjpeg | ||||
|  | ||||
| import "github.com/deepch/vdk/av" | ||||
|  | ||||
| type CodecData struct { | ||||
| } | ||||
|  | ||||
| func (d CodecData) Type() av.CodecType { | ||||
| 	return av.MJPEG | ||||
| } | ||||
| @@ -3,13 +3,15 @@ package ts | ||||
| import ( | ||||
| 	"bufio" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/deepch/vdk/av" | ||||
| 	"github.com/deepch/vdk/codec/aacparser" | ||||
| 	"github.com/deepch/vdk/codec/h264parser" | ||||
| 	"github.com/deepch/vdk/codec/mjpeg" | ||||
| 	"github.com/deepch/vdk/format/ts/tsio" | ||||
| 	"github.com/deepch/vdk/utils/bits/pio" | ||||
| 	"io" | ||||
| 	"time" | ||||
| ) | ||||
|  | ||||
| type Demuxer struct { | ||||
| @@ -117,6 +119,8 @@ func (self *Demuxer) initPMT(payload []byte) (err error) { | ||||
| 			self.streams = append(self.streams, stream) | ||||
| 		case tsio.ElementaryStreamTypeAdtsAAC: | ||||
| 			self.streams = append(self.streams, stream) | ||||
| 		case tsio.ElementaryStreamTypeAlignmentDescriptor: | ||||
| 			self.streams = append(self.streams, stream) | ||||
| 		} | ||||
| 	} | ||||
| 	return | ||||
| @@ -228,8 +232,16 @@ func (self *Stream) payloadEnd() (n int, err error) { | ||||
| 		return | ||||
| 	} | ||||
| 	self.data = nil | ||||
|  | ||||
| 	switch self.streamType { | ||||
| 	case tsio.ElementaryStreamTypeAlignmentDescriptor: | ||||
| 		if self.CodecData == nil { | ||||
| 			self.CodecData = mjpeg.CodecData{} | ||||
| 		} | ||||
| 		b := make([]byte, 4+len(payload)) | ||||
| 		pio.PutU32BE(b[0:4], uint32(len(payload))) | ||||
| 		copy(b[4:], payload) | ||||
| 		self.addPacket(b, time.Duration(0), 0) | ||||
| 		n++ | ||||
| 	case tsio.ElementaryStreamTypeAdtsAAC: | ||||
| 		var config aacparser.MPEG4AudioConfig | ||||
|  | ||||
|   | ||||
| @@ -35,6 +35,7 @@ var ErrParsePAT = fmt.Errorf("invalid PAT") | ||||
| const ( | ||||
| 	ElementaryStreamTypeH264                = 0x1B | ||||
| 	ElementaryStreamTypeAdtsAAC             = 0x0F | ||||
| 	ElementaryStreamTypeAlignmentDescriptor = 0x06 | ||||
| ) | ||||
|  | ||||
| type PATEntry struct { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 deepch
					deepch