mirror of https://bitbucket.org/ausocean/av.git
using go fmt
This commit is contained in:
parent
4ae6919cae
commit
e3f5c14562
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Give the platform some time to set itself up
|
// Give the platform some time to set itself up
|
||||||
time.Sleep(30 * time.Second)
|
time.Sleep(30 * time.Second)
|
||||||
config := revid.Config{
|
config := revid.Config{
|
||||||
Input: revid.Raspivid,
|
Input: revid.Raspivid,
|
||||||
|
@ -23,8 +23,8 @@ func main() {
|
||||||
fmt.Println("Should not have got error!")
|
fmt.Println("Should not have got error!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Run this instance for 2 days! Power to the pi will surely turn itself
|
// Run this instance for 2 days! Power to the pi will surely turn itself
|
||||||
// off before this time is up.
|
// off before this time is up.
|
||||||
revidInst.Start()
|
revidInst.Start()
|
||||||
time.Sleep(2 * 43200 * time.Second)
|
time.Sleep(2 * 43200 * time.Second)
|
||||||
revidInst.Stop()
|
revidInst.Stop()
|
||||||
|
|
|
@ -51,15 +51,15 @@ var dummyAudioTag2Data = []byte{0x01, 0xdc, 0x00, 0x4c, 0x61, 0x76, 0x63, 0x35,
|
||||||
// flvGenerator provides properties required for the generation of flv video
|
// flvGenerator provides properties required for the generation of flv video
|
||||||
// from raw video data
|
// from raw video data
|
||||||
type flvGenerator struct {
|
type flvGenerator struct {
|
||||||
fps uint
|
fps uint
|
||||||
inputChan chan []byte
|
inputChan chan []byte
|
||||||
outputChan chan []byte
|
outputChan chan []byte
|
||||||
audioFlag bool
|
audioFlag bool
|
||||||
videoFlag bool
|
videoFlag bool
|
||||||
lastTagSize int
|
lastTagSize int
|
||||||
header flv.Header
|
header flv.Header
|
||||||
startTime time.Time
|
startTime time.Time
|
||||||
firstTag bool
|
firstTag bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetInputChan returns the input channel to the generator. This is where the
|
// GetInputChan returns the input channel to the generator. This is where the
|
||||||
|
@ -215,7 +215,7 @@ func (g *flvGenerator) generate() {
|
||||||
// Do we even have some audio to send off ?
|
// Do we even have some audio to send off ?
|
||||||
if g.audioFlag {
|
if g.audioFlag {
|
||||||
// Not sure why but we need two audio tags for dummy silent audio
|
// Not sure why but we need two audio tags for dummy silent audio
|
||||||
// TODO: create constants or SoundSize and SoundType parameters
|
// TODO: create constants or SoundSize and SoundType parameters
|
||||||
tag := flv.AudioTag{
|
tag := flv.AudioTag{
|
||||||
TagType: uint8(flv.AudioTagType),
|
TagType: uint8(flv.AudioTagType),
|
||||||
DataSize: 7,
|
DataSize: 7,
|
||||||
|
|
|
@ -177,7 +177,7 @@ func (g *tsGenerator) generate() {
|
||||||
}
|
}
|
||||||
pkt.FillPayload(g.payloadByteChan)
|
pkt.FillPayload(g.payloadByteChan)
|
||||||
|
|
||||||
// TODO: create consts for AFC parameters
|
// TODO: create consts for AFC parameters
|
||||||
if pusi {
|
if pusi {
|
||||||
// Create pat table
|
// Create pat table
|
||||||
patPkt := mpegts.MpegTsPacket{
|
patPkt := mpegts.MpegTsPacket{
|
||||||
|
|
|
@ -30,4 +30,4 @@ package itut
|
||||||
|
|
||||||
func StartCode1() []byte { return []byte{0x00, 0x00, 0x01} }
|
func StartCode1() []byte { return []byte{0x00, 0x00, 0x01} }
|
||||||
func StartCode2() []byte { return []byte{0x00, 0x00, 0x00, 0x01} }
|
func StartCode2() []byte { return []byte{0x00, 0x00, 0x00, 0x01} }
|
||||||
func AUD() []byte { return []byte{0x09, 0xF0} }
|
func AUD() []byte { return []byte{0x09, 0xF0} }
|
||||||
|
|
|
@ -28,20 +28,20 @@ LICENSE
|
||||||
package psi
|
package psi
|
||||||
|
|
||||||
type PMT struct {
|
type PMT struct {
|
||||||
PF byte // POint field
|
PF byte // POint field
|
||||||
PFB []byte // pointer filler bytes
|
PFB []byte // pointer filler bytes
|
||||||
TableID byte // Table ID
|
TableID byte // Table ID
|
||||||
SSI bool // Sectiopn syntax indicator (1 for PAT, PMT, CAT)
|
SSI bool // Sectiopn syntax indicator (1 for PAT, PMT, CAT)
|
||||||
PB bool // Private bit (0 for PAT, PMT, CAT)
|
PB bool // Private bit (0 for PAT, PMT, CAT)
|
||||||
SL uint16 // Section length
|
SL uint16 // Section length
|
||||||
TIE uint16 // Table ID extension
|
TIE uint16 // Table ID extension
|
||||||
Version byte // Version number
|
Version byte // Version number
|
||||||
CNI bool // Current/next indicator
|
CNI bool // Current/next indicator
|
||||||
Section byte // Section number
|
Section byte // Section number
|
||||||
LSN byte // Last section number
|
LSN byte // Last section number
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p* PMT)ToByteSlice()(output []byte){
|
func (p *PMT) ToByteSlice() (output []byte) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ type Config struct {
|
||||||
RtmpMethod uint8
|
RtmpMethod uint8
|
||||||
Packetization uint8
|
Packetization uint8
|
||||||
QuantizationMode uint8
|
QuantizationMode uint8
|
||||||
Verbosity uint8
|
Verbosity uint8
|
||||||
FramesPerClip int
|
FramesPerClip int
|
||||||
RtmpUrl string
|
RtmpUrl string
|
||||||
Bitrate string
|
Bitrate string
|
||||||
|
@ -94,7 +94,7 @@ const (
|
||||||
defaultQuantization = "40"
|
defaultQuantization = "40"
|
||||||
defaultBitrate = "0"
|
defaultBitrate = "0"
|
||||||
defaultQuantizationMode = QuantizationOff
|
defaultQuantizationMode = QuantizationOff
|
||||||
defaultFramesPerClip = 1
|
defaultFramesPerClip = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
// Validate checks for any errors in the config fields and defaults settings
|
// Validate checks for any errors in the config fields and defaults settings
|
||||||
|
|
Loading…
Reference in New Issue