fix old import path

master
Baik S. Hyun 3 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:
- 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))
- 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))
- Transcoding ([doc](https://pkg.go.dev/github.com/Danile71/joy4/av/transcode) [example](https://github.com/Danile71/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))
- 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/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/gitlab.com/ics_cinnamon/joy4/av/transcode) [example](https://gitlab.com/ics_cinnamon/joy4/blob/master/examples/transcode/main.go))
- Streaming server ([example](https://gitlab.com/ics_cinnamon/joy4/blob/master/examples/http_flv_and_rtmp_server/main.go))
Support container formats:
@ -34,31 +34,31 @@ RTMP / HTTP-FLV Server
- 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
- 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
- Fix timestamp
- 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
- Video Decoder
- Audio Resampler
Support codec and container parsers:
- H264 SPS/PPS/AVCDecoderConfigure parser ([doc](https://pkg.go.dev/github.com/Danile71/joy4/codec/h264parser))
- AAC ADTSHeader/MPEG4AudioConfig parser ([doc](https://pkg.go.dev/github.com/Danile71/joy4/codec/aacparser))
- MP4 Atoms parser ([doc](https://pkg.go.dev/github.com/Danile71/joy4/format/mp4/mp4io))
- FLV AMF0 object parser ([doc](https://pkg.go.dev/github.com/Danile71/joy4/format/flv/flvio))
- 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/gitlab.com/ics_cinnamon/joy4/codec/aacparser))
- 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/gitlab.com/ics_cinnamon/joy4/format/flv/flvio))
# Requirements

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

@ -4,17 +4,18 @@ import (
"fmt"
"io"
"time"
"github.com/Danile71/joy4/av/avutil"
"github.com/Danile71/joy4/av"
"github.com/Danile71/joy4/av/pktque"
"github.com/Danile71/joy4/av/transcode"
"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/transcode"
)
var Debug bool
type Option struct {
Transcode bool
Args []string
Args []string
}
type Options struct {
@ -23,7 +24,7 @@ type Options struct {
type Demuxer struct {
transdemux *transcode.Demuxer
streams []av.CodecData
streams []av.CodecData
Options
Demuxer av.Demuxer
}
@ -56,10 +57,10 @@ func (self *Demuxer) prepare() (err error) {
}
/*
var streams []av.CodecData
if streams, err = self.Demuxer.Streams(); err != nil {
return
}
var streams []av.CodecData
if streams, err = self.Demuxer.Streams(); err != nil {
return
}
*/
supports := self.Options.OutputCodecTypes
@ -83,7 +84,7 @@ func (self *Demuxer) prepare() (err error) {
ok = true
var enctype av.CodecType
for _, typ:= range supports {
for _, typ := range supports {
if typ.IsAudio() {
if enc, _ = avutil.DefaultHandlers.NewAudioEncoder(typ); enc != nil {
enctype = typ
@ -152,7 +153,7 @@ func ConvertCmdline(args []string) (err error) {
flagt = false
var f float64
fmt.Sscanf(arg, "%f", &f)
duration = time.Duration(f*float64(time.Second))
duration = time.Duration(f * float64(time.Second))
default:
output = arg
@ -223,7 +224,7 @@ func ConvertCmdline(args []string) (err error) {
}
filterdemux := &pktque.FilterDemuxer{
Demuxer: convdemux,
Filter: filters,
Filter: filters,
}
for {
@ -252,4 +253,3 @@ func ConvertCmdline(args []string) (err error) {
return
}

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

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

@ -1,10 +1,10 @@
// Package pktque provides packet Filter interface and structures used by other components.
package pktque
import (
"time"
"github.com/Danile71/joy4/av"
"gitlab.com/ics_cinnamon/joy4/av"
)
type Filter interface {
@ -30,8 +30,8 @@ func (self Filters) ModifyPacket(pkt *av.Packet, streams []av.CodecData, videoid
// Wrap origin Demuxer and Filter into a new Demuxer, when read this Demuxer filters will be called.
type FilterDemuxer struct {
av.Demuxer
Filter Filter
streams []av.CodecData
Filter Filter
streams []av.CodecData
videoidx int
audioidx int
}
@ -81,9 +81,9 @@ func (self *WaitKeyFrame) ModifyPacket(pkt *av.Packet, streams []av.CodecData, v
// Fix incorrect packet timestamps.
type FixTime struct {
zerobase time.Duration
incrbase time.Duration
lasttime time.Duration
zerobase time.Duration
incrbase time.Duration
lasttime time.Duration
StartFromZero bool // make timestamp start from zero
MakeIncrement bool // force timestamp increment
}
@ -114,14 +114,14 @@ func (self *FixTime) ModifyPacket(pkt *av.Packet, streams []av.CodecData, videoi
// Drop incorrect packets to make A/V sync.
type AVSync struct {
MaxTimeDiff time.Duration
time []time.Duration
time []time.Duration
}
func (self *AVSync) ModifyPacket(pkt *av.Packet, streams []av.CodecData, videoidx int, audioidx int) (drop bool, err error) {
if self.time == nil {
self.time = make([]time.Duration, len(streams))
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
}

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

@ -1,22 +1,22 @@
// Package transcoder implements Transcoder based on Muxer/Demuxer and AudioEncoder/AudioDecoder interface.
package transcode
import (
"fmt"
"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
type tStream struct {
codec av.CodecData
timeline *pktque.Timeline
codec av.CodecData
timeline *pktque.Timeline
aencodec, adecodec av.AudioCodecData
aenc av.AudioEncoder
adec av.AudioDecoder
aenc av.AudioEncoder
adec av.AudioDecoder
}
type Options struct {
@ -27,7 +27,7 @@ type Options struct {
}
type Transcoder struct {
streams []*tStream
streams []*tStream
}
func NewTranscoder(streams []av.CodecData, options Options) (_self *Transcoder, err error) {
@ -108,7 +108,7 @@ func (self *tStream) audioDecodeAndEncode(inpkt av.Packet) (outpkts []av.Packet,
}
// Do the transcode.
//
//
// In audio transcoding one Packet may transcode into many Packets
// packet time will be adjusted automatically.
func (self *Transcoder) Do(pkt av.Packet) (out []av.Packet, err error) {
@ -150,8 +150,8 @@ func (self *Transcoder) Close() (err error) {
// Wrap transcoder and origin Muxer into new Muxer.
// Write to new Muxer will do transcoding automatically.
type Muxer struct {
av.Muxer // origin Muxer
Options // transcode options
av.Muxer // origin Muxer
Options // transcode options
transcoder *Transcoder
}
@ -195,7 +195,7 @@ type Demuxer struct {
av.Demuxer
Options
transcoder *Transcoder
outpkts []av.Packet
outpkts []av.Packet
}
func (self *Demuxer) prepare() (err error) {

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

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

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

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

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

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

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

@ -1,14 +1,15 @@
package main
import (
"sync"
"io"
"net/http"
"github.com/Danile71/joy4/format"
"github.com/Danile71/joy4/av/avutil"
"github.com/Danile71/joy4/av/pubsub"
"github.com/Danile71/joy4/format/rtmp"
"github.com/Danile71/joy4/format/flv"
"sync"
"gitlab.com/ics_cinnamon/joy4/av/avutil"
"gitlab.com/ics_cinnamon/joy4/av/pubsub"
"gitlab.com/ics_cinnamon/joy4/format"
"gitlab.com/ics_cinnamon/joy4/format/flv"
"gitlab.com/ics_cinnamon/joy4/format/rtmp"
)
func init() {
@ -78,7 +79,7 @@ func main() {
if ch != nil {
w.Header().Set("Content-Type", "video/x-flv")
w.Header().Set("Transfer-Encoding", "chunked")
w.Header().Set("Transfer-Encoding", "chunked")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.WriteHeader(200)
flusher := w.(http.Flusher)

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

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

@ -2,14 +2,15 @@ package main
import (
"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"
"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() {

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

@ -1,16 +1,16 @@
package main
import (
"github.com/Danile71/joy4/av"
"github.com/Danile71/joy4/av/transcode"
"github.com/Danile71/joy4/format"
"github.com/Danile71/joy4/av/avutil"
"github.com/Danile71/joy4/format/rtmp"
"github.com/Danile71/joy4/cgo/ffmpeg"
"gitlab.com/ics_cinnamon/joy4/av"
"gitlab.com/ics_cinnamon/joy4/av/avutil"
"gitlab.com/ics_cinnamon/joy4/av/transcode"
"gitlab.com/ics_cinnamon/joy4/cgo/ffmpeg"
"gitlab.com/ics_cinnamon/joy4/format"
"gitlab.com/ics_cinnamon/joy4/format/rtmp"
)
// need ffmpeg with libspeex and libfdkaac installed
//
//
// open http://www.wowza.com/resources/4.4.1/examples/WebcamRecording/FlashRTMPPlayer11/player.html
// click connect and recored
// input camera H264/SPEEX will converted H264/AAC and saved in out.ts

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

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

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

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

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

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

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

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

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

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

@ -1,14 +1,13 @@
package main
import (
"strings"
"fmt"
"os"
"go/ast"
"go/parser"
"go/token"
"go/printer"
"go/token"
"os"
"strings"
)
func getexprs(e ast.Expr) string {
@ -37,7 +36,7 @@ func genatomdecl(origfn *ast.FuncDecl, origname, origtag string) (decls []ast.De
if typ == "_unknowns" {
fieldslist.List = append(fieldslist.List, &ast.Field{
Names: []*ast.Ident{ast.NewIdent("Unknowns")},
Type: ast.NewIdent("[]Atom"),
Type: ast.NewIdent("[]Atom"),
})
}
continue
@ -67,24 +66,24 @@ func genatomdecl(origfn *ast.FuncDecl, origname, origtag string) (decls []ast.De
case "bytesleft":
typ = "[]byte"
case "bytes":
typ = "["+name2+"]byte"
typ = "[" + name2 + "]byte"
case "uint24":
typ = "uint32"
case "time64", "time32":
typ = "time.Time"
case "atom":
typ = "*"+name2
typ = "*" + name2
case "atoms":
typ = "[]*"+name2
typ = "[]*" + name2
case "slice":
typ = "[]"+name2
typ = "[]" + name2
case "array":
typ = "["+len3+"]"+name2
typ = "[" + len3 + "]" + name2
}
fieldslist.List = append(fieldslist.List, &ast.Field{
Names: []*ast.Ident{ast.NewIdent(name)},
Type: ast.NewIdent(typ),
Type: ast.NewIdent(typ),
})
}
@ -135,7 +134,7 @@ func typegetlen(typ string) (n int) {
func typegetlens(typ string) string {
n := typegetlen(typ)
if n == 0 {
return "Len"+typ
return "Len" + typ
} else {
return fmt.Sprint(n)
}
@ -187,7 +186,7 @@ func typegetputfn(typ string) (fn string) {
case "fixed16":
fn = "PutFixed16"
default:
fn = "Put"+typ
fn = "Put" + typ
}
return
}
@ -218,7 +217,7 @@ func typegetgetfn(typ string) (fn string) {
case "fixed16":
fn = "GetFixed16"
default:
fn = "Get"+typ
fn = "Get" + typ
}
return
}
@ -237,14 +236,14 @@ func addn(n int) (stmts []ast.Stmt) {
return addns(fmt.Sprint(n))
}
func simplecall(fun string, args... string) *ast.ExprStmt {
func simplecall(fun string, args ...string) *ast.ExprStmt {
_args := []ast.Expr{}
for _, s := range args {
_args = append(_args, ast.NewIdent(s))
}
return &ast.ExprStmt{
X: &ast.CallExpr{
Fun: ast.NewIdent(fun),
Fun: ast.NewIdent(fun),
Args: _args,
},
}
@ -283,7 +282,7 @@ func newdecl(origname, name string, params, res []*ast.Field, stmts []ast.Stmt)
List: []*ast.Field{
&ast.Field{
Names: []*ast.Ident{ast.NewIdent("self")},
Type: ast.NewIdent(origname),
Type: ast.NewIdent(origname),
},
},
},
@ -319,7 +318,7 @@ func getstructputgetlenfn(origfn *ast.FuncDecl, origname string) (decls []ast.De
getstmts = append(getstmts, &ast.ReturnStmt{})
decls = append(decls, &ast.FuncDecl{
Name: ast.NewIdent("Get"+origname),
Name: ast.NewIdent("Get" + origname),
Type: &ast.FuncType{
Params: &ast.FieldList{
List: []*ast.Field{
@ -336,7 +335,7 @@ func getstructputgetlenfn(origfn *ast.FuncDecl, origname string) (decls []ast.De
})
decls = append(decls, &ast.FuncDecl{
Name: ast.NewIdent("Put"+origname),
Name: ast.NewIdent("Put" + origname),
Type: &ast.FuncType{
Params: &ast.FieldList{
List: []*ast.Field{
@ -352,7 +351,7 @@ func getstructputgetlenfn(origfn *ast.FuncDecl, origname string) (decls []ast.De
Tok: token.CONST,
Specs: []ast.Spec{
&ast.ValueSpec{
Names: []*ast.Ident{ast.NewIdent("Len"+origname)},
Names: []*ast.Ident{ast.NewIdent("Len" + origname)},
Values: []ast.Expr{ast.NewIdent(fmt.Sprint(totlen))},
},
},
@ -371,7 +370,7 @@ func cc4decls(name string) (decls []ast.Decl) {
},
Values: []ast.Expr{
&ast.CallExpr{
Fun: ast.NewIdent("Tag"),
Fun: ast.NewIdent("Tag"),
Args: []ast.Expr{&ast.BasicLit{Kind: token.INT, Value: fmt.Sprintf("0x%x", []byte(name))}},
},
},
@ -431,7 +430,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
callmarshal := func(name string) (stmts []ast.Stmt) {
callexpr := &ast.CallExpr{
Fun: ast.NewIdent(name+".Marshal"),
Fun: ast.NewIdent(name + ".Marshal"),
Args: []ast.Expr{ast.NewIdent("b[n:]")},
}
assign := &ast.AssignStmt{
@ -446,7 +445,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
callputstruct := func(typ, name string) (stmts []ast.Stmt) {
stmts = append(stmts, &ast.ExprStmt{
X: &ast.CallExpr{
Fun: ast.NewIdent(typegetputfn(typ)),
Fun: ast.NewIdent(typegetputfn(typ)),
Args: []ast.Expr{ast.NewIdent("b[n:]"), ast.NewIdent(name)},
},
})
@ -459,7 +458,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
}
calllenstruct := func(typ, name string) (stmts []ast.Stmt) {
inc := typegetlens(typ)+"*len("+name+")"
inc := typegetlens(typ) + "*len(" + name + ")"
stmts = append(stmts, &ast.AssignStmt{
Tok: token.ADD_ASSIGN,
Lhs: []ast.Expr{ast.NewIdent("n")},
@ -470,7 +469,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
calllen := func(name string) (stmts []ast.Stmt) {
callexpr := &ast.CallExpr{
Fun: ast.NewIdent(name+".Len"),
Fun: ast.NewIdent(name + ".Len"),
Args: []ast.Expr{},
}
assign := &ast.AssignStmt{
@ -484,13 +483,13 @@ func getatommarshalfn(origfn *ast.FuncDecl,
foreach := func(name, field string, block []ast.Stmt) (stmts []ast.Stmt) {
rangestmt := &ast.RangeStmt{
Key: ast.NewIdent("_"),
Key: ast.NewIdent("_"),
Value: ast.NewIdent(name),
Body: &ast.BlockStmt{
List: block,
},
Tok: token.DEFINE,
X: ast.NewIdent(field),
X: ast.NewIdent(field),
}
stmts = append(stmts, rangestmt)
return
@ -511,7 +510,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
List: block,
},
Tok: token.DEFINE,
X: ast.NewIdent(field),
X: ast.NewIdent(field),
}
stmts = append(stmts, rangestmt)
return
@ -574,7 +573,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
unmarshalatom := func(typ, init string) (stmts []ast.Stmt) {
return []ast.Stmt{
&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{
Init: &ast.AssignStmt{
@ -591,10 +590,10 @@ func getatommarshalfn(origfn *ast.FuncDecl,
unmrashalatoms := func() (stmts []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:]))")},
})
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:]))")},
})
blocks = append(blocks, &ast.IfStmt{
@ -614,7 +613,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
}
for i, atom := range atomarrnames {
selfatom := "self."+atom
selfatom := "self." + atom
cases = append(cases, &ast.CaseClause{
List: []ast.Expr{ast.NewIdent(strings.ToUpper(struct2tag(atomarrtypes[i])))},
Body: []ast.Stmt{&ast.BlockStmt{
@ -635,7 +634,7 @@ func getatommarshalfn(origfn *ast.FuncDecl,
}
blocks = append(blocks, &ast.SwitchStmt{
Tag: ast.NewIdent("tag"),
Tag: ast.NewIdent("tag"),
Body: &ast.BlockStmt{List: cases},
})
@ -659,9 +658,9 @@ func getatommarshalfn(origfn *ast.FuncDecl,
ifnotnil := func(name string, block []ast.Stmt) (stmts []ast.Stmt) {
stmts = append(stmts, &ast.IfStmt{
Cond: &ast.BinaryExpr{
X: ast.NewIdent(name),
X: ast.NewIdent(name),
Op: token.NEQ,
Y: ast.NewIdent("nil"),
Y: ast.NewIdent("nil"),
},
Body: &ast.BlockStmt{List: block},
})
@ -693,9 +692,9 @@ func getatommarshalfn(origfn *ast.FuncDecl,
checkcurlen := func(inc, debug string) (stmts []ast.Stmt) {
stmts = append(stmts, &ast.IfStmt{
Cond: &ast.BinaryExpr{
X: ast.NewIdent("len(b)"),
X: ast.NewIdent("len(b)"),
Op: token.LSS,
Y: ast.NewIdent("n+"+inc),
Y: ast.NewIdent("n+" + inc),
},
Body: &ast.BlockStmt{List: parseerrreturn(debug)},
})
@ -710,20 +709,20 @@ func getatommarshalfn(origfn *ast.FuncDecl,
}
checkstructlendo := func(typ, name, debug string,
foreach func(string,[]ast.Stmt)[]ast.Stmt,
foreach func(string, []ast.Stmt) []ast.Stmt,
) (stmts []ast.Stmt) {
inc := typegetlens(typ)+"*len("+name+")"
inc := typegetlens(typ) + "*len(" + name + ")"
stmts = append(stmts, checkcurlen(inc, debug)...)
stmts = append(stmts, foreach(name, append(
[]ast.Stmt{
&ast.AssignStmt{
Tok: token.ASSIGN,
Lhs: []ast.Expr{
ast.NewIdent(name+"[i]"),
ast.NewIdent(name + "[i]"),
},
Rhs: []ast.Expr{
&ast.CallExpr{
Fun: ast.NewIdent(typegetgetfn(typ)),
Fun: ast.NewIdent(typegetgetfn(typ)),
Args: []ast.Expr{ast.NewIdent("b[n:]")},
},
},
@ -967,7 +966,7 @@ func genatoms(filename, outfilename string) {
&ast.GenDecl{
Tok: token.IMPORT,
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{
@ -1054,4 +1053,3 @@ func main() {
genatoms(os.Args[2], os.Args[3])
}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -5,7 +5,7 @@ import (
"io"
"time"
"github.com/Danile71/joy4/utils/bits/pio"
"gitlab.com/ics_cinnamon/joy4/utils/bits/pio"
)
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