github.com/cnotch/ipchub@v1.1.0/media/placehold.go (about) 1 // Copyright (c) 2019,CAOHONGJU All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE file. 4 5 package media 6 7 import ( 8 "io" 9 10 "github.com/cnotch/ipchub/av/codec" 11 "github.com/cnotch/ipchub/av/format" 12 "github.com/cnotch/ipchub/av/format/rtp" 13 "github.com/cnotch/queue" 14 ) 15 16 // Pack . 17 type Pack = format.Packet 18 19 type packCache interface { 20 CachePack(pack Pack) (keyframe bool) // 返回是否是关键帧 21 PushTo(q *queue.SyncQueue) int 22 Reset() 23 } 24 25 var _ packCache = emptyCache{} 26 27 type emptyCache struct { 28 } 29 30 func (emptyCache) CachePack(Pack) bool { return false } 31 func (emptyCache) PushTo(q *queue.SyncQueue) int { return 0 } 32 func (emptyCache) Reset() {} 33 34 type flvMuxer interface { 35 TypeFlags() byte 36 codec.FrameWriter 37 io.Closer 38 } 39 40 var _ flvMuxer = emptyFlvMuxer{} 41 42 type emptyFlvMuxer struct{} 43 44 func (emptyFlvMuxer) TypeFlags() byte { return 0 } 45 func (emptyFlvMuxer) WriteFrame(frame *codec.Frame) error { return nil } 46 func (emptyFlvMuxer) Close() error { return nil } 47 48 type rtpDemuxer interface { 49 rtp.PacketWriter 50 io.Closer 51 } 52 53 var _ rtpDemuxer = emptyRtpDemuxer{} 54 55 type emptyRtpDemuxer struct{} 56 57 func (emptyRtpDemuxer) TypeFlags() byte { return 0 } 58 func (emptyRtpDemuxer) WriteRtpPacket(*rtp.Packet) error { return nil } 59 func (emptyRtpDemuxer) Close() error { return nil }