Documentation ¶
Index ¶
- Constants
- func CovertFlvAudioCodecId2MpegCodecId(cid FLV_SOUND_FORMAT) codec.CodecID
- func CovertFlvVideoCodecId2MpegCodecId(cid FLV_VIDEO_CODEC_ID) codec.CodecID
- func GetTagLenByAudioCodec(cid FLV_SOUND_FORMAT) int
- func GetTagLenByVideoCodec(cid FLV_VIDEO_CODEC_ID) int
- func GetUint24(b []byte) (v uint32)
- func PutUint24(b []byte, v uint32)
- func WriteAudioTag(data []byte, cid FLV_SOUND_FORMAT, sampleRate int, channelCount int, ...) []byte
- func WriteVideoTag(data []byte, isKey bool, cid FLV_VIDEO_CODEC_ID, cts int32, ...) []byte
- type AACMuxer
- type AACTagDemuxer
- type AVCMuxer
- type AVCTagDemuxer
- type AVTagMuxer
- type AudioTag
- type AudioTagDemuxer
- type FLVSAMPLEINDEX
- type FLV_PARSER_STATE
- type FLV_SOUND_FORMAT
- type FLV_VIDEO_CODEC_ID
- type FLV_VIDEO_FRAME_TYPE
- type FlvMuxer
- func (muxer *FlvMuxer) SetAudioCodeId(cid FLV_SOUND_FORMAT)
- func (muxer *FlvMuxer) SetVideoCodeId(cid FLV_VIDEO_CODEC_ID)
- func (muxer *FlvMuxer) WriteAudio(frames []byte, pts uint32, dts uint32) ([][]byte, error)
- func (muxer *FlvMuxer) WriteFrames(frameType TagType, frames []byte, pts uint32, dts uint32) ([][]byte, error)
- func (muxer *FlvMuxer) WriteVideo(frames []byte, pts uint32, dts uint32) ([][]byte, error)
- type FlvReader
- type FlvTag
- type FlvWriter
- func (f *FlvWriter) WriteAAC(data []byte, pts uint32, dts uint32) error
- func (f *FlvWriter) WriteFlvHeader() (err error)
- func (f *FlvWriter) WriteG711A(data []byte, pts uint32, dts uint32) error
- func (f *FlvWriter) WriteG711U(data []byte, pts uint32, dts uint32) error
- func (f *FlvWriter) WriteH264(data []byte, pts uint32, dts uint32) error
- func (f *FlvWriter) WriteH265(data []byte, pts uint32, dts uint32) error
- func (f *FlvWriter) WriteMp3(data []byte, pts uint32, dts uint32) error
- type G711AMuxer
- type G711Demuxer
- type G711UMuxer
- type HevcMuxer
- type HevcTagDemuxer
- type Mp3Muxer
- type OnAudioFrameCallBack
- type OnVideoFrameCallBack
- type TagType
- type VideoTag
- type VideoTagDemuxer
Constants ¶
View Source
const ( AVC_SEQUENCE_HEADER = 0 AVC_NALU = 1 )
View Source
const ( AAC_SEQUENCE_HEADER = 0 AAC_RAW = 1 )
View Source
const FLVTAG_SIZE uint32 = 11
Variables ¶
This section is empty.
Functions ¶
func CovertFlvAudioCodecId2MpegCodecId ¶
func CovertFlvAudioCodecId2MpegCodecId(cid FLV_SOUND_FORMAT) codec.CodecID
func CovertFlvVideoCodecId2MpegCodecId ¶
func CovertFlvVideoCodecId2MpegCodecId(cid FLV_VIDEO_CODEC_ID) codec.CodecID
func GetTagLenByAudioCodec ¶
func GetTagLenByAudioCodec(cid FLV_SOUND_FORMAT) int
func GetTagLenByVideoCodec ¶
func GetTagLenByVideoCodec(cid FLV_VIDEO_CODEC_ID) int
func WriteAudioTag ¶
func WriteVideoTag ¶
Types ¶
type AACMuxer ¶
type AACMuxer struct {
// contains filtered or unexported fields
}
func NewAACMuxer ¶
func NewAACMuxer() *AACMuxer
type AACTagDemuxer ¶
type AACTagDemuxer struct {
// contains filtered or unexported fields
}
func NewAACTagDemuxer ¶
func NewAACTagDemuxer() *AACTagDemuxer
func (*AACTagDemuxer) Decode ¶
func (demuxer *AACTagDemuxer) Decode(data []byte) error
func (*AACTagDemuxer) OnFrame ¶
func (demuxer *AACTagDemuxer) OnFrame(onframe OnAudioFrameCallBack)
type AVCMuxer ¶
type AVCMuxer struct {
// contains filtered or unexported fields
}
func NewAVCMuxer ¶
func NewAVCMuxer() *AVCMuxer
type AVCTagDemuxer ¶
type AVCTagDemuxer struct {
// contains filtered or unexported fields
}
func NewAVCTagDemuxer ¶
func NewAVCTagDemuxer() *AVCTagDemuxer
func (*AVCTagDemuxer) Decode ¶
func (demuxer *AVCTagDemuxer) Decode(data []byte) error
func (*AVCTagDemuxer) OnFrame ¶
func (demuxer *AVCTagDemuxer) OnFrame(onframe OnVideoFrameCallBack)
type AVTagMuxer ¶
func CreateAudioMuxer ¶
func CreateAudioMuxer(cid FLV_SOUND_FORMAT) AVTagMuxer
func CreateVideoMuxer ¶
func CreateVideoMuxer(cid FLV_VIDEO_CODEC_ID) AVTagMuxer
type AudioTag ¶
type AudioTagDemuxer ¶
type AudioTagDemuxer interface { Decode(data []byte) error OnFrame(onframe OnAudioFrameCallBack) }
func CreateAudioTagDemuxer ¶
func CreateAudioTagDemuxer(formats FLV_SOUND_FORMAT) (demuxer AudioTagDemuxer)
type FLVSAMPLEINDEX ¶
type FLVSAMPLEINDEX int
const ( FLV_SAMPLE_5500 FLVSAMPLEINDEX = iota FLV_SAMPLE_11000 FLV_SAMPLE_22000 FLV_SAMPLE_44000 )
type FLV_PARSER_STATE ¶
type FLV_PARSER_STATE int
const ( FLV_PARSER_INIT FLV_PARSER_STATE = iota + 1 FLV_PARSER_FILE_HEAD FLV_PARSER_TAG_SIZE FLV_PARSER_FLV_TAG FLV_PARSER_DETECT_VIDEO FLV_PARSER_DETECT_AUDIO FLV_PARSER_VIDEO_TAG FLV_PARSER_AUDIO_TAG FLV_PARSER_SCRIPT_TAG )
type FLV_SOUND_FORMAT ¶
type FLV_SOUND_FORMAT int
const ( FLV_MP3 FLV_SOUND_FORMAT = 2 FLV_G711A FLV_SOUND_FORMAT = 7 FLV_G711U FLV_SOUND_FORMAT = 8 FLV_AAC FLV_SOUND_FORMAT = 10 )
func CovertCodecId2SoundFromat ¶
func CovertCodecId2SoundFromat(cid codec.CodecID) FLV_SOUND_FORMAT
func (FLV_SOUND_FORMAT) ToMpegCodecId ¶
func (format FLV_SOUND_FORMAT) ToMpegCodecId() codec.CodecID
type FLV_VIDEO_CODEC_ID ¶
type FLV_VIDEO_CODEC_ID int
const ( FLV_AVC FLV_VIDEO_CODEC_ID = 7 FLV_HEVC FLV_VIDEO_CODEC_ID = 12 )
func CovertCodecId2FlvVideoCodecId ¶
func CovertCodecId2FlvVideoCodecId(cid codec.CodecID) FLV_VIDEO_CODEC_ID
type FLV_VIDEO_FRAME_TYPE ¶
type FLV_VIDEO_FRAME_TYPE int
const ( KEY_FRAME FLV_VIDEO_FRAME_TYPE = 1 INTER_FRAME FLV_VIDEO_FRAME_TYPE = 2 )
type FlvMuxer ¶
type FlvMuxer struct {
// contains filtered or unexported fields
}
func NewFlvMuxer ¶
func NewFlvMuxer(vid FLV_VIDEO_CODEC_ID, aid FLV_SOUND_FORMAT) *FlvMuxer
func (*FlvMuxer) SetAudioCodeId ¶
func (muxer *FlvMuxer) SetAudioCodeId(cid FLV_SOUND_FORMAT)
func (*FlvMuxer) SetVideoCodeId ¶
func (muxer *FlvMuxer) SetVideoCodeId(cid FLV_VIDEO_CODEC_ID)
func (*FlvMuxer) WriteAudio ¶
func (*FlvMuxer) WriteFrames ¶
type FlvReader ¶
type FlvReader struct { OnFrame func(cid codec.CodecID, frame []byte, pts uint32, dts uint32) // contains filtered or unexported fields }
func CreateFlvReader ¶
func CreateFlvReader() *FlvReader
type FlvTag ¶
type FlvWriter ¶
type FlvWriter struct {
// contains filtered or unexported fields
}
func CreateFlvWriter ¶
func (*FlvWriter) WriteFlvHeader ¶
func (*FlvWriter) WriteG711A ¶
func (*FlvWriter) WriteG711U ¶
type G711Demuxer ¶
type G711Demuxer struct {
// contains filtered or unexported fields
}
func NewG711Demuxer ¶
func NewG711Demuxer(format FLV_SOUND_FORMAT) *G711Demuxer
func (*G711Demuxer) Decode ¶
func (demuxer *G711Demuxer) Decode(data []byte) error
func (*G711Demuxer) OnFrame ¶
func (demuxer *G711Demuxer) OnFrame(onframe OnAudioFrameCallBack)
type HevcMuxer ¶
type HevcMuxer struct {
// contains filtered or unexported fields
}
func NewHevcMuxer ¶
func NewHevcMuxer() *HevcMuxer
type HevcTagDemuxer ¶
type HevcTagDemuxer struct { SpsPpsVps []byte // contains filtered or unexported fields }
func NewHevcTagDemuxer ¶
func NewHevcTagDemuxer() *HevcTagDemuxer
func (*HevcTagDemuxer) Decode ¶
func (demuxer *HevcTagDemuxer) Decode(data []byte) error
func (*HevcTagDemuxer) OnFrame ¶
func (demuxer *HevcTagDemuxer) OnFrame(onframe OnVideoFrameCallBack)
type OnAudioFrameCallBack ¶
type OnAudioFrameCallBack func(codecid codec.CodecID, frame []byte)
type OnVideoFrameCallBack ¶
type VideoTag ¶
Video Tag VideoTagHeader ------------------------------------------------------------------------ Field type Comment ------------------------------------------------------------------------ Frame Type UB[4] Type of video frame. The following values are defined:
1 = key frame (for AVC, a seekable frame) 2 = inter frame (for AVC, a non-seekable frame) 3 = disposable inter frame (H.263 only) 4 = generated key frame (reserved for server use only) 5 = video info/command frame
CodecID UB[4] Codec Identifier. The following values are defined:
2 = Sorenson H.263 3 = Screen video 4 = On2 VP6 5 = On2 VP6 with alpha channel 6 = Screen video version 2 7 = AVC
AVCPacketType IF CodecID == 7 The following values are defined:
UI8 0 = AVC sequence header 1 = AVC NALU 2 = AVC end of sequence (lower level NALU sequence ender is not required or supported)
CompositionTime IF CodecID == 7 IF AVCPacketType == 1
SI24 Composition time offset ELSE 0
------------------------------------------------------------------------
type VideoTagDemuxer ¶
type VideoTagDemuxer interface { Decode(data []byte) error OnFrame(onframe OnVideoFrameCallBack) }
func CreateFlvVideoTagHandle ¶
func CreateFlvVideoTagHandle(cid FLV_VIDEO_CODEC_ID) (demuxer VideoTagDemuxer)
Click to show internal directories.
Click to hide internal directories.