fix old import path

master
Baik S. Hyun 4 years ago
parent 3894723f67
commit 3d915d3a69

@ -8,10 +8,10 @@ JOY4 is powerful library written in golang, well-designed interface makes a few
Well-designed and easy-to-use interfaces: Well-designed and easy-to-use interfaces:
- Muxer / Demuxer ([doc](https://pkg.go.dev/github.com/Danile71/joy4/av#Demuxer) [example](https://github.com/Danile71/joy4/blob/master/examples/open_probe_file/main.go)) - Muxer / Demuxer ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/av#Demuxer) [example](https://gitlab.com/ics_cinnamon/joy4/blob/master/examples/open_probe_file/main.go))
- Audio Decoder ([doc](https://pkg.go.dev/github.com/Danile71/joy4/av#AudioDecoder) [example](https://github.com/Danile71/joy4/blob/master/examples/audio_decode/main.go)) - Audio Decoder ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/av#AudioDecoder) [example](https://gitlab.com/ics_cinnamon/joy4/blob/master/examples/audio_decode/main.go))
- Transcoding ([doc](https://pkg.go.dev/github.com/Danile71/joy4/av/transcode) [example](https://github.com/Danile71/joy4/blob/master/examples/transcode/main.go)) - Transcoding ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/av/transcode) [example](https://gitlab.com/ics_cinnamon/joy4/blob/master/examples/transcode/main.go))
- Streaming server ([example](https://github.com/Danile71/joy4/blob/master/examples/http_flv_and_rtmp_server/main.go)) - Streaming server ([example](https://gitlab.com/ics_cinnamon/joy4/blob/master/examples/http_flv_and_rtmp_server/main.go))
Support container formats: Support container formats:
@ -34,31 +34,31 @@ RTMP / HTTP-FLV Server
- High performance - High performance
Publisher-subscriber packet buffer queue ([doc](https://pkg.go.dev/github.com/Danile71/joy4/av/pubsub)) Publisher-subscriber packet buffer queue ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/av/pubsub))
- Customize publisher buffer time and subscriber read position - Customize publisher buffer time and subscriber read position
- Multiple channels live streaming ([example](https://github.com/Danile71/joy4/blob/master/examples/rtmp_server_channels/main.go)) - Multiple channels live streaming ([example](https://gitlab.com/ics_cinnamon/joy4/blob/master/examples/rtmp_server_channels/main.go))
Packet filters ([doc](https://pkg.go.dev/github.com/Danile71/joy4/av/pktque)) Packet filters ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/av/pktque))
- Wait first keyframe - Wait first keyframe
- Fix timestamp - Fix timestamp
- Make A/V sync - Make A/V sync
- Customize ([example](https://github.com/Danile71/joy4/blob/master/examples/rtmp_server_channels/main.go#L19)) - Customize ([example](https://gitlab.com/ics_cinnamon/joy4/blob/master/examples/rtmp_server_channels/main.go#L19))
FFMPEG Golang-style binding ([doc](https://pkg.go.dev/github.com/Danile71/joy4/cgo/ffmpeg)) FFMPEG Golang-style binding ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/cgo/ffmpeg))
- Audio Encoder / Decoder - Audio Encoder / Decoder
- Video Decoder - Video Decoder
- Audio Resampler - Audio Resampler
Support codec and container parsers: Support codec and container parsers:
- H264 SPS/PPS/AVCDecoderConfigure parser ([doc](https://pkg.go.dev/github.com/Danile71/joy4/codec/h264parser)) - H264 SPS/PPS/AVCDecoderConfigure parser ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/codec/h264parser))
- AAC ADTSHeader/MPEG4AudioConfig parser ([doc](https://pkg.go.dev/github.com/Danile71/joy4/codec/aacparser)) - AAC ADTSHeader/MPEG4AudioConfig parser ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/codec/aacparser))
- MP4 Atoms parser ([doc](https://pkg.go.dev/github.com/Danile71/joy4/format/mp4/mp4io)) - MP4 Atoms parser ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/format/mp4/mp4io))
- FLV AMF0 object parser ([doc](https://pkg.go.dev/github.com/Danile71/joy4/format/flv/flvio)) - FLV AMF0 object parser ([doc](https://pkg.go.dev/gitlab.com/ics_cinnamon/joy4/format/flv/flvio))
# Requirements # Requirements

@ -121,6 +121,7 @@ var (
PCM_ALAW = MakeAudioCodecType(avCodecTypeMagic + 3) PCM_ALAW = MakeAudioCodecType(avCodecTypeMagic + 3)
SPEEX = MakeAudioCodecType(avCodecTypeMagic + 4) SPEEX = MakeAudioCodecType(avCodecTypeMagic + 4)
NELLYMOSER = MakeAudioCodecType(avCodecTypeMagic + 5) NELLYMOSER = MakeAudioCodecType(avCodecTypeMagic + 5)
G729= MakeAudioCodecType(avCodecTypeMagic + 6)
) )
const codecTypeAudioBit = 0x1 const codecTypeAudioBit = 0x1
@ -136,6 +137,8 @@ func (self CodecType) String() string {
return "PCM_MULAW" return "PCM_MULAW"
case PCM_ALAW: case PCM_ALAW:
return "PCM_ALAW" return "PCM_ALAW"
case G729:
return "G729"
case SPEEX: case SPEEX:
return "SPEEX" return "SPEEX"
case NELLYMOSER: case NELLYMOSER:

@ -4,10 +4,11 @@ import (
"fmt" "fmt"
"io" "io"
"time" "time"
"github.com/Danile71/joy4/av/avutil"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/pktque" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/av/transcode" "gitlab.com/ics_cinnamon/joy4/av/pktque"
"gitlab.com/ics_cinnamon/joy4/av/transcode"
) )
var Debug bool var Debug bool
@ -83,7 +84,7 @@ func (self *Demuxer) prepare() (err error) {
ok = true ok = true
var enctype av.CodecType var enctype av.CodecType
for _, typ:= range supports { for _, typ := range supports {
if typ.IsAudio() { if typ.IsAudio() {
if enc, _ = avutil.DefaultHandlers.NewAudioEncoder(typ); enc != nil { if enc, _ = avutil.DefaultHandlers.NewAudioEncoder(typ); enc != nil {
enctype = typ enctype = typ
@ -152,7 +153,7 @@ func ConvertCmdline(args []string) (err error) {
flagt = false flagt = false
var f float64 var f float64
fmt.Sscanf(arg, "%f", &f) fmt.Sscanf(arg, "%f", &f)
duration = time.Duration(f*float64(time.Second)) duration = time.Duration(f * float64(time.Second))
default: default:
output = arg output = arg
@ -252,4 +253,3 @@ func ConvertCmdline(args []string) (err error) {
return return
} }

@ -9,7 +9,7 @@ import (
"path" "path"
"strings" "strings"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
) )
type HandlerDemuxer struct { type HandlerDemuxer struct {

@ -1,7 +1,7 @@
package pktque package pktque
import ( import (
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
) )
type Buf struct { type Buf struct {

@ -1,10 +1,10 @@
// Package pktque provides packet Filter interface and structures used by other components. // Package pktque provides packet Filter interface and structures used by other components.
package pktque package pktque
import ( import (
"time" "time"
"github.com/Danile71/joy4/av"
"gitlab.com/ics_cinnamon/joy4/av"
) )
type Filter interface { type Filter interface {
@ -121,7 +121,7 @@ func (self *AVSync) ModifyPacket(pkt *av.Packet, streams []av.CodecData, videoid
if self.time == nil { if self.time == nil {
self.time = make([]time.Duration, len(streams)) self.time = make([]time.Duration, len(streams))
if self.MaxTimeDiff == 0 { if self.MaxTimeDiff == 0 {
self.MaxTimeDiff = time.Millisecond*500 self.MaxTimeDiff = time.Millisecond * 500
} }
} }
@ -188,4 +188,3 @@ func (self *Walltime) ModifyPacket(pkt *av.Packet, streams []av.CodecData, video
} }
return return
} }

@ -2,11 +2,12 @@
package pubsub package pubsub
import ( import (
"github.com/Danile71/joy4/av"
"github.com/Danile71/joy4/av/pktque"
"io" "io"
"sync" "sync"
"time" "time"
"gitlab.com/ics_cinnamon/joy4/av"
"gitlab.com/ics_cinnamon/joy4/av/pktque"
) )
// time // time

@ -1,12 +1,12 @@
// Package transcoder implements Transcoder based on Muxer/Demuxer and AudioEncoder/AudioDecoder interface. // Package transcoder implements Transcoder based on Muxer/Demuxer and AudioEncoder/AudioDecoder interface.
package transcode package transcode
import ( import (
"fmt" "fmt"
"time" "time"
"github.com/Danile71/joy4/av"
"github.com/Danile71/joy4/av/pktque" "gitlab.com/ics_cinnamon/joy4/av"
"gitlab.com/ics_cinnamon/joy4/av/pktque"
) )
var Debug bool var Debug bool

@ -12,9 +12,9 @@ import (
"time" "time"
"unsafe" "unsafe"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
) )
const debug = false const debug = false
@ -673,6 +673,8 @@ func NewAudioDecoder(codec av.AudioCodecData) (dec *AudioDecoder, err error) {
case av.PCM_ALAW: case av.PCM_ALAW:
id = C.AV_CODEC_ID_PCM_ALAW id = C.AV_CODEC_ID_PCM_ALAW
case av.G729:
id = C.AV_CODEC_ID_G729
default: default:
if ffcodec, ok := codec.(audioCodecData); ok { if ffcodec, ok := codec.(audioCodecData); ok {

@ -10,8 +10,8 @@ import (
"runtime" "runtime"
"unsafe" "unsafe"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
) )
type VideoDecoder struct { type VideoDecoder struct {

@ -6,8 +6,8 @@ import (
"io" "io"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/utils/bits" "gitlab.com/ics_cinnamon/joy4/utils/bits"
) )
// copied from libavcodec/mpeg4audio.h // copied from libavcodec/mpeg4audio.h

@ -3,8 +3,8 @@ package codec
import ( import (
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/codec/fake" "gitlab.com/ics_cinnamon/joy4/codec/fake"
) )
type PCMUCodecData struct { type PCMUCodecData struct {
@ -43,6 +43,12 @@ func NewPCMAlawCodecData() av.AudioCodecData {
} }
} }
func NewG729CodecData() av.AudioCodecData {
return PCMUCodecData{
typ: av.G729,
}
}
type SpeexCodecData struct { type SpeexCodecData struct {
fake.CodecData fake.CodecData
} }

@ -1,7 +1,7 @@
package fake package fake
import ( import (
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
) )
type CodecData struct { type CodecData struct {

@ -4,9 +4,9 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/utils/bits" "gitlab.com/ics_cinnamon/joy4/utils/bits"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
const ( const (

@ -1,11 +1,10 @@
package main package main
import ( import (
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/format" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/cgo/ffmpeg"
"github.com/Danile71/joy4/cgo/ffmpeg" "gitlab.com/ics_cinnamon/joy4/format"
) )
// need ffmpeg installed // need ffmpeg installed
@ -37,4 +36,3 @@ func main() {
file.Close() file.Close()
} }

@ -1,14 +1,15 @@
package main package main
import ( import (
"sync"
"io" "io"
"net/http" "net/http"
"github.com/Danile71/joy4/format" "sync"
"github.com/Danile71/joy4/av/avutil"
"github.com/Danile71/joy4/av/pubsub" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/format/rtmp" "gitlab.com/ics_cinnamon/joy4/av/pubsub"
"github.com/Danile71/joy4/format/flv" "gitlab.com/ics_cinnamon/joy4/format"
"gitlab.com/ics_cinnamon/joy4/format/flv"
"gitlab.com/ics_cinnamon/joy4/format/rtmp"
) )
func init() { func init() {

@ -2,9 +2,10 @@ package main
import ( import (
"fmt" "fmt"
"github.com/Danile71/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/format" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"gitlab.com/ics_cinnamon/joy4/format"
) )
func init() { func init() {
@ -36,4 +37,3 @@ func main() {
file.Close() file.Close()
} }

@ -1,10 +1,10 @@
package main package main
import ( import (
"github.com/Danile71/joy4/av/pktque" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/format" "gitlab.com/ics_cinnamon/joy4/av/pktque"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/format"
"github.com/Danile71/joy4/format/rtmp" "gitlab.com/ics_cinnamon/joy4/format/rtmp"
) )
func init() { func init() {
@ -24,4 +24,3 @@ func main() {
file.Close() file.Close()
conn.Close() conn.Close()
} }

@ -2,14 +2,15 @@ package main
import ( import (
"fmt" "fmt"
"github.com/Danile71/joy4/av"
"github.com/Danile71/joy4/av/avutil"
"github.com/Danile71/joy4/av/pktque"
"github.com/Danile71/joy4/av/pubsub"
"github.com/Danile71/joy4/format"
"github.com/Danile71/joy4/format/rtmp"
"sync" "sync"
"time" "time"
"gitlab.com/ics_cinnamon/joy4/av"
"gitlab.com/ics_cinnamon/joy4/av/avutil"
"gitlab.com/ics_cinnamon/joy4/av/pktque"
"gitlab.com/ics_cinnamon/joy4/av/pubsub"
"gitlab.com/ics_cinnamon/joy4/format"
"gitlab.com/ics_cinnamon/joy4/format/rtmp"
) )
func init() { func init() {

@ -3,9 +3,10 @@ package main
import ( import (
"fmt" "fmt"
"strings" "strings"
"github.com/Danile71/joy4/format"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/format/rtmp" "gitlab.com/ics_cinnamon/joy4/format"
"gitlab.com/ics_cinnamon/joy4/format/rtmp"
) )
func init() { func init() {

@ -1,12 +1,12 @@
package main package main
import ( import (
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/transcode" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/format" "gitlab.com/ics_cinnamon/joy4/av/transcode"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/cgo/ffmpeg"
"github.com/Danile71/joy4/format/rtmp" "gitlab.com/ics_cinnamon/joy4/format"
"github.com/Danile71/joy4/cgo/ffmpeg" "gitlab.com/ics_cinnamon/joy4/format/rtmp"
) )
// need ffmpeg with libspeex and libfdkaac installed // need ffmpeg with libspeex and libfdkaac installed

@ -1,11 +1,11 @@
package main package main
import ( import (
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/transcode" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/format" "gitlab.com/ics_cinnamon/joy4/av/transcode"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/cgo/ffmpeg"
"github.com/Danile71/joy4/cgo/ffmpeg" "gitlab.com/ics_cinnamon/joy4/format"
) )
// need ffmpeg with libfdkaac installed // need ffmpeg with libfdkaac installed
@ -42,4 +42,3 @@ func main() {
infile.Close() infile.Close()
trans.Close() trans.Close()
} }

@ -6,9 +6,9 @@ import (
"io" "io"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
) )
type Muxer struct { type Muxer struct {

@ -5,14 +5,14 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/codec" "gitlab.com/ics_cinnamon/joy4/codec"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
"github.com/Danile71/joy4/codec/fake" "gitlab.com/ics_cinnamon/joy4/codec/fake"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/format/flv/flvio" "gitlab.com/ics_cinnamon/joy4/format/flv/flvio"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
var MaxProbePacketCount = 20 var MaxProbePacketCount = 20

@ -6,7 +6,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
type AMF0ParseError struct { type AMF0ParseError struct {

@ -5,8 +5,8 @@ import (
"io" "io"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
func TsToTime(ts int32) time.Duration { func TsToTime(ts int32) time.Duration {

@ -1,13 +1,13 @@
package format package format
import ( import (
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/format/aac" "gitlab.com/ics_cinnamon/joy4/format/aac"
"github.com/Danile71/joy4/format/flv" "gitlab.com/ics_cinnamon/joy4/format/flv"
"github.com/Danile71/joy4/format/mp4" "gitlab.com/ics_cinnamon/joy4/format/mp4"
"github.com/Danile71/joy4/format/rtmp" "gitlab.com/ics_cinnamon/joy4/format/rtmp"
"github.com/Danile71/joy4/format/rtsp" "gitlab.com/ics_cinnamon/joy4/format/rtsp"
"github.com/Danile71/joy4/format/ts" "gitlab.com/ics_cinnamon/joy4/format/ts"
) )
func RegisterAll() { func RegisterAll() {

@ -16,13 +16,13 @@ import (
"strings" "strings"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/codec" "gitlab.com/ics_cinnamon/joy4/codec"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/format/rtsp/sdp" "gitlab.com/ics_cinnamon/joy4/format/rtsp/sdp"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
var ErrCodecDataChange = fmt.Errorf("rtsp: codec data change, please call HandleCodecDataChange()") var ErrCodecDataChange = fmt.Errorf("rtsp: codec data change, please call HandleCodecDataChange()")

@ -6,10 +6,10 @@ import (
"io" "io"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/format/mp4/mp4io" "gitlab.com/ics_cinnamon/joy4/format/mp4/mp4io"
) )
type Demuxer struct { type Demuxer struct {

@ -3,8 +3,8 @@ package mp4
import ( import (
"io" "io"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
) )
var CodecTypes = []av.CodecType{av.H264, av.AAC} var CodecTypes = []av.CodecType{av.H264, av.AAC}

@ -1,7 +1,10 @@
package mp4io package mp4io
import "github.com/Danile71/joy4/utils/bits/pio" import (
import "time" "time"
"gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
)
const MOOF = Tag(0x6d6f6f66) const MOOF = Tag(0x6d6f6f66)

@ -1,14 +1,13 @@
package main package main
import ( import (
"strings"
"fmt" "fmt"
"os"
"go/ast" "go/ast"
"go/parser" "go/parser"
"go/token"
"go/printer" "go/printer"
"go/token"
"os"
"strings"
) )
func getexprs(e ast.Expr) string { func getexprs(e ast.Expr) string {
@ -67,19 +66,19 @@ func genatomdecl(origfn *ast.FuncDecl, origname, origtag string) (decls []ast.De
case "bytesleft": case "bytesleft":
typ = "[]byte" typ = "[]byte"
case "bytes": case "bytes":
typ = "["+name2+"]byte" typ = "[" + name2 + "]byte"
case "uint24": case "uint24":
typ = "uint32" typ = "uint32"
case "time64", "time32": case "time64", "time32":
typ = "time.Time" typ = "time.Time"
case "atom": case "atom":
typ = "*"+name2 typ = "*" + name2
case "atoms": case "atoms":
typ = "[]*"+name2 typ = "[]*" + name2
case "slice": case "slice":
typ = "[]"+name2 typ = "[]" + name2
case "array": case "array":
typ = "["+len3+"]"+name2 typ = "[" + len3 + "]" + name2
} }
fieldslist.List = append(fieldslist.List, &ast.Field{ fieldslist.List = append(fieldslist.List, &ast.Field{
@ -135,7 +134,7 @@ func typegetlen(typ string) (n int) {
func typegetlens(typ string) string { func typegetlens(typ string) string {
n := typegetlen(typ) n := typegetlen(typ)
if n == 0 { if n == 0 {
return "Len"+typ return "Len" + typ
} else { } else {
return fmt.Sprint(n) return fmt.Sprint(n)
} }
@ -187,7 +186,7 @@ func typegetputfn(typ string) (fn string) {
case "fixed16": case "fixed16":
fn = "PutFixed16" fn = "PutFixed16"
default: default:
fn = "Put"+typ fn = "Put" + typ
} }
return return
} }
@ -218,7 +217,7 @@ func typegetgetfn(typ string) (fn string) {
case "fixed16": case "fixed16":
fn = "GetFixed16" fn = "GetFixed16"
default: default:
fn = "Get"+typ fn = "Get" + typ
} }
return return
} }
@ -237,7 +236,7 @@ func addn(n int) (stmts []ast.Stmt) {
return addns(fmt.Sprint(n)) return addns(fmt.Sprint(n))
} }
func simplecall(fun string, args... string) *ast.ExprStmt { func simplecall(fun string, args ...string) *ast.ExprStmt {
_args := []ast.Expr{} _args := []ast.Expr{}
for _, s := range args { for _, s := range args {
_args = append(_args, ast.NewIdent(s)) _args = append(_args, ast.NewIdent(s))
@ -319,7 +318,7 @@ func getstructputgetlenfn(origfn *ast.FuncDecl, origname string) (decls []ast.De
getstmts = append(getstmts, &ast.ReturnStmt{}) getstmts = append(getstmts, &ast.ReturnStmt{})
decls = append(decls, &ast.FuncDecl{ decls = append(decls, &ast.FuncDecl{
Name: ast.NewIdent("Get"+origname), Name: ast.NewIdent("Get" + origname),
Type: &ast.FuncType{ Type: &ast.FuncType{
Params: &ast.FieldList{ Params: &ast.FieldList{
List: []*ast.Field{ List: []*ast.Field{
@ -336,7 +335,7 @@ func getstructputgetlenfn(origfn *ast.FuncDecl, origname string) (decls []ast.De
}) })
decls = append(decls, &ast.FuncDecl{ decls = append(decls, &ast.FuncDecl{
Name: ast.NewIdent("Put"+origname), Name: ast.NewIdent("Put" + origname),
Type: &ast.FuncType{ Type: &ast.FuncType{
Params: &ast.FieldList{ Params: &ast.FieldList{
List: []*ast.Field{ List: []*ast.Field{
@ -352,7 +351,7 @@ func getstructputgetlenfn(origfn *ast.FuncDecl, origname string) (decls []ast.De
Tok: token.CONST, Tok: token.CONST,
Specs: []ast.Spec{ Specs: []ast.Spec{
&ast.ValueSpec{ &ast.ValueSpec{
Names: []*ast.Ident{ast.NewIdent("Len"+origname)}, Names: []*ast.Ident{ast.NewIdent("Len" + origname)},
Values: []ast.Expr{ast.NewIdent(fmt.Sprint(totlen))}, Values: []ast.Expr{ast.NewIdent(fmt.Sprint(totlen))},
}, },
}, },
@ -431,7 +430,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
callmarshal := func(name string) (stmts []ast.Stmt) { callmarshal := func(name string) (stmts []ast.Stmt) {
callexpr := &ast.CallExpr{ callexpr := &ast.CallExpr{
Fun: ast.NewIdent(name+".Marshal"), Fun: ast.NewIdent(name + ".Marshal"),
Args: []ast.Expr{ast.NewIdent("b[n:]")}, Args: []ast.Expr{ast.NewIdent("b[n:]")},
} }
assign := &ast.AssignStmt{ assign := &ast.AssignStmt{
@ -459,7 +458,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
} }
calllenstruct := func(typ, name string) (stmts []ast.Stmt) { calllenstruct := func(typ, name string) (stmts []ast.Stmt) {
inc := typegetlens(typ)+"*len("+name+")" inc := typegetlens(typ) + "*len(" + name + ")"
stmts = append(stmts, &ast.AssignStmt{ stmts = append(stmts, &ast.AssignStmt{
Tok: token.ADD_ASSIGN, Tok: token.ADD_ASSIGN,
Lhs: []ast.Expr{ast.NewIdent("n")}, Lhs: []ast.Expr{ast.NewIdent("n")},
@ -470,7 +469,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
calllen := func(name string) (stmts []ast.Stmt) { calllen := func(name string) (stmts []ast.Stmt) {
callexpr := &ast.CallExpr{ callexpr := &ast.CallExpr{
Fun: ast.NewIdent(name+".Len"), Fun: ast.NewIdent(name + ".Len"),
Args: []ast.Expr{}, Args: []ast.Expr{},
} }
assign := &ast.AssignStmt{ assign := &ast.AssignStmt{
@ -574,7 +573,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
unmarshalatom := func(typ, init string) (stmts []ast.Stmt) { unmarshalatom := func(typ, init string) (stmts []ast.Stmt) {
return []ast.Stmt{ return []ast.Stmt{
&ast.AssignStmt{Tok: token.DEFINE, &ast.AssignStmt{Tok: token.DEFINE,
Lhs: []ast.Expr{ast.NewIdent("atom")}, Rhs: []ast.Expr{ast.NewIdent("&"+typ+"{"+init+"}")}, Lhs: []ast.Expr{ast.NewIdent("atom")}, Rhs: []ast.Expr{ast.NewIdent("&" + typ + "{" + init + "}")},
}, },
&ast.IfStmt{ &ast.IfStmt{
Init: &ast.AssignStmt{ Init: &ast.AssignStmt{
@ -591,10 +590,10 @@ func getatommarshalfn(origfn *ast.FuncDecl,
unmrashalatoms := func() (stmts []ast.Stmt) { unmrashalatoms := func() (stmts []ast.Stmt) {
blocks := []ast.Stmt{} blocks := []ast.Stmt{}
blocks = append(blocks, &ast.AssignStmt{ Tok: token.DEFINE, Lhs: []ast.Expr{ast.NewIdent("tag")}, blocks = append(blocks, &ast.AssignStmt{Tok: token.DEFINE, Lhs: []ast.Expr{ast.NewIdent("tag")},
Rhs: []ast.Expr{ast.NewIdent("Tag(pio.U32BE(b[n+4:]))")}, Rhs: []ast.Expr{ast.NewIdent("Tag(pio.U32BE(b[n+4:]))")},
}) })
blocks = append(blocks, &ast.AssignStmt{ Tok: token.DEFINE, Lhs: []ast.Expr{ast.NewIdent("size")}, blocks = append(blocks, &ast.AssignStmt{Tok: token.DEFINE, Lhs: []ast.Expr{ast.NewIdent("size")},
Rhs: []ast.Expr{ast.NewIdent("int(pio.U32BE(b[n:]))")}, Rhs: []ast.Expr{ast.NewIdent("int(pio.U32BE(b[n:]))")},
}) })
blocks = append(blocks, &ast.IfStmt{ blocks = append(blocks, &ast.IfStmt{
@ -614,7 +613,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
} }
for i, atom := range atomarrnames { for i, atom := range atomarrnames {
selfatom := "self."+atom selfatom := "self." + atom
cases = append(cases, &ast.CaseClause{ cases = append(cases, &ast.CaseClause{
List: []ast.Expr{ast.NewIdent(strings.ToUpper(struct2tag(atomarrtypes[i])))}, List: []ast.Expr{ast.NewIdent(strings.ToUpper(struct2tag(atomarrtypes[i])))},
Body: []ast.Stmt{&ast.BlockStmt{ Body: []ast.Stmt{&ast.BlockStmt{
@ -695,7 +694,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
Cond: &ast.BinaryExpr{ Cond: &ast.BinaryExpr{
X: ast.NewIdent("len(b)"), X: ast.NewIdent("len(b)"),
Op: token.LSS, Op: token.LSS,
Y: ast.NewIdent("n+"+inc), Y: ast.NewIdent("n+" + inc),
}, },
Body: &ast.BlockStmt{List: parseerrreturn(debug)}, Body: &ast.BlockStmt{List: parseerrreturn(debug)},
}) })
@ -710,16 +709,16 @@ func getatommarshalfn(origfn *ast.FuncDecl,
} }
checkstructlendo := func(typ, name, debug string, checkstructlendo := func(typ, name, debug string,
foreach func(string,[]ast.Stmt)[]ast.Stmt, foreach func(string, []ast.Stmt) []ast.Stmt,
) (stmts []ast.Stmt) { ) (stmts []ast.Stmt) {
inc := typegetlens(typ)+"*len("+name+")" inc := typegetlens(typ) + "*len(" + name + ")"
stmts = append(stmts, checkcurlen(inc, debug)...) stmts = append(stmts, checkcurlen(inc, debug)...)
stmts = append(stmts, foreach(name, append( stmts = append(stmts, foreach(name, append(
[]ast.Stmt{ []ast.Stmt{
&ast.AssignStmt{ &ast.AssignStmt{
Tok: token.ASSIGN, Tok: token.ASSIGN,
Lhs: []ast.Expr{ Lhs: []ast.Expr{
ast.NewIdent(name+"[i]"), ast.NewIdent(name + "[i]"),
}, },
Rhs: []ast.Expr{ Rhs: []ast.Expr{
&ast.CallExpr{ &ast.CallExpr{
@ -967,7 +966,7 @@ func genatoms(filename, outfilename string) {
&ast.GenDecl{ &ast.GenDecl{
Tok: token.IMPORT, Tok: token.IMPORT,
Specs: []ast.Spec{ Specs: []ast.Spec{
&ast.ImportSpec{Path: &ast.BasicLit{Kind: token.STRING, Value: `"github.com/Danile71/joy4/utils/bits/pio"`}}, &ast.ImportSpec{Path: &ast.BasicLit{Kind: token.STRING, Value: `"gitlab.com/ics_cinnamon/joy4/utils/bits/pio"`}},
}, },
}, },
&ast.GenDecl{ &ast.GenDecl{
@ -1054,4 +1053,3 @@ func main() {
genatoms(os.Args[2], os.Args[3]) genatoms(os.Args[2], os.Args[3])
} }
} }

@ -8,7 +8,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
type ParseError struct { type ParseError struct {

@ -6,11 +6,11 @@ import (
"io" "io"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/format/mp4/mp4io" "gitlab.com/ics_cinnamon/joy4/format/mp4/mp4io"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
type Muxer struct { type Muxer struct {

@ -3,8 +3,8 @@ package mp4
import ( import (
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/format/mp4/mp4io" "gitlab.com/ics_cinnamon/joy4/format/mp4/mp4io"
) )
type Stream struct { type Stream struct {

@ -1,6 +1,6 @@
package mp4f package mp4f
import "github.com/Danile71/joy4/format/mp4/mp4io" import "gitlab.com/ics_cinnamon/joy4/format/mp4/mp4io"
type FDummy struct { type FDummy struct {
Data []byte Data []byte

@ -1,8 +1,8 @@
package mp4fio package mp4fio
import ( import (
"github.com/Danile71/joy4/format/mp4/mp4io" "gitlab.com/ics_cinnamon/joy4/format/mp4/mp4io"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
func (self MovieFrag) Tag() mp4io.Tag { func (self MovieFrag) Tag() mp4io.Tag {

@ -1,8 +1,8 @@
package mp4fio package mp4fio
import ( import (
"github.com/Danile71/joy4/format/mp4/mp4io" "gitlab.com/ics_cinnamon/joy4/format/mp4/mp4io"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
type ElemStreamDesc struct { type ElemStreamDesc struct {

@ -6,12 +6,12 @@ import (
"os" "os"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/format/mp4/mp4io" "gitlab.com/ics_cinnamon/joy4/format/mp4/mp4io"
"github.com/Danile71/joy4/format/mp4f/mp4fio" "gitlab.com/ics_cinnamon/joy4/format/mp4f/mp4fio"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
type Muxer struct { type Muxer struct {

@ -3,10 +3,10 @@ package mp4f
import ( import (
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/format/mp4" "gitlab.com/ics_cinnamon/joy4/format/mp4"
"github.com/Danile71/joy4/format/mp4/mp4io" "gitlab.com/ics_cinnamon/joy4/format/mp4/mp4io"
"github.com/Danile71/joy4/format/mp4f/mp4fio" "gitlab.com/ics_cinnamon/joy4/format/mp4f/mp4fio"
) )
type Stream struct { type Stream struct {

@ -5,9 +5,9 @@ import (
"io" "io"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
type Demuxer struct { type Demuxer struct {

@ -3,8 +3,8 @@ package raw
import ( import (
"io" "io"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
) )
var CodecTypes = []av.CodecType{av.H264, av.AAC} var CodecTypes = []av.CodecType{av.H264, av.AAC}

@ -5,9 +5,9 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
type Muxer struct { type Muxer struct {

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
) )
type Stream struct { type Stream struct {

@ -14,11 +14,11 @@ import (
"strings" "strings"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/format/flv" "gitlab.com/ics_cinnamon/joy4/format/flv"
"github.com/Danile71/joy4/format/flv/flvio" "gitlab.com/ics_cinnamon/joy4/format/flv/flvio"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
var Debug bool var Debug bool

@ -18,13 +18,13 @@ import (
"strings" "strings"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
"github.com/Danile71/joy4/codec" "gitlab.com/ics_cinnamon/joy4/codec"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/format/rtsp/sdp" "gitlab.com/ics_cinnamon/joy4/format/rtsp/sdp"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
var ErrCodecDataChange = fmt.Errorf("rtsp: codec data change, please call HandleCodecDataChange()") var ErrCodecDataChange = fmt.Errorf("rtsp: codec data change, please call HandleCodecDataChange()")

@ -7,7 +7,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
) )
type Session struct { type Session struct {

@ -3,8 +3,8 @@ package rtsp
import ( import (
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/format/rtsp/sdp" "gitlab.com/ics_cinnamon/joy4/format/rtsp/sdp"
) )
type Stream struct { type Stream struct {

@ -6,11 +6,11 @@ import (
"io" "io"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/format/ts/tsio" "gitlab.com/ics_cinnamon/joy4/format/ts/tsio"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
type Demuxer struct { type Demuxer struct {

@ -3,8 +3,8 @@ package ts
import ( import (
"io" "io"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/av/avutil" "gitlab.com/ics_cinnamon/joy4/av/avutil"
) )
func Handler(h *avutil.RegisterHandler) { func Handler(h *avutil.RegisterHandler) {

@ -5,10 +5,10 @@ import (
"io" "io"
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/codec/aacparser" "gitlab.com/ics_cinnamon/joy4/codec/aacparser"
"github.com/Danile71/joy4/codec/h264parser" "gitlab.com/ics_cinnamon/joy4/codec/h264parser"
"github.com/Danile71/joy4/format/ts/tsio" "gitlab.com/ics_cinnamon/joy4/format/ts/tsio"
) )
var CodecTypes = []av.CodecType{av.H264, av.AAC} var CodecTypes = []av.CodecType{av.H264, av.AAC}

@ -3,8 +3,8 @@ package ts
import ( import (
"time" "time"
"github.com/Danile71/joy4/av" "gitlab.com/ics_cinnamon/joy4/av"
"github.com/Danile71/joy4/format/ts/tsio" "gitlab.com/ics_cinnamon/joy4/format/ts/tsio"
) )
type Stream struct { type Stream struct {

@ -5,7 +5,7 @@ import (
"io" "io"
"time" "time"
"github.com/Danile71/joy4/utils/bits/pio" "gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
) )
const ( const (

@ -0,0 +1,5 @@
module gitlab.com/ics_cinnamon/joy4
go 1.16
require gocv.io/x/gocv v0.27.0

@ -0,0 +1,3 @@
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
gocv.io/x/gocv v0.27.0 h1:3X8I74ULsWHd4m7DQRv2Nqx5VkKscfUFnKgLNodiboI=
gocv.io/x/gocv v0.27.0/go.mod h1:n4LnYjykU6y9gn48yZf4eLCdtuSb77XxSkW6g0wGf/A=
Loading…
Cancel
Save