Skip to content

Commit

Permalink
Streaming in MPEG1/MPEG2/MPEG2.5 Layer I/II/III format added. Many ot…
Browse files Browse the repository at this point in the history
…her fixes.
  • Loading branch information
stunndard committed Jul 11, 2016
1 parent 5019ae5 commit 31c5366
Show file tree
Hide file tree
Showing 9 changed files with 683 additions and 59 deletions.
17 changes: 8 additions & 9 deletions aac/aac.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,22 @@ func isValidFrameHeader(header []byte) (int, bool) {
return frame_length, true
}

func GetSPF(header []byte) int {
return 1024
}

func SeekTo1StFrame(f os.File) int {
var (
buf []byte
aac_header []byte
j int64
)

buf = make([]byte, 5000)
buf := make([]byte, 5000)
f.ReadAt(buf, 0)

j = -1
j := int64(-1)
for i := 0; i < len(buf); i++ {
if (buf[i] == 0xFF) && ((buf[i+1] & 0xF0) == 0xF0) {
if len(buf)-i < 10 {
break
}
aac_header = buf[i : i+7]
aac_header := buf[i : i+7]

if n, ok := isValidFrameHeader(aac_header); ok {
if i+n+7 >= len(buf) {
Expand Down Expand Up @@ -229,7 +228,7 @@ func GetFileInfo(filename string, br *float64, spf, sr, frames, ch *int) error {
16000, 12000, 11025, 8000,
7350, 0, 0, 0}

if !util.FileExists(filename) {
if ok := util.FileExists(filename); !ok {
err := new(util.FileError)
err.Msg = "File doesn't exist"
return err
Expand Down
6 changes: 0 additions & 6 deletions aac/aacx.go

This file was deleted.

2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Config struct {
FFMPEGPath string
}

const Version = "0.2"
const Version = "0.3"

var Cfg Config

Expand Down
6 changes: 3 additions & 3 deletions goicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func main() {
}
inifile := string(os.Args[1])

//inifile := "d:\\work\\src\\Go\\src\\goicy\\tests\\hz.ini"
//inifile := "d:\\work\\src\\Go\\src\\github.com\\stunndard\\goicy\\tests\\goicy.ini"

logger.TermLn("Loading config...", logger.LOG_DEBUG)
err := config.LoadConfig(inifile)
Expand Down Expand Up @@ -92,9 +92,9 @@ func main() {
for {
var err error
if config.Cfg.StreamType == "file" {
err = stream.StreamAACFile(filename)
err = stream.StreamFile(filename)
} else {
err = stream.StreamAACFFMPEG(filename)
err = stream.StreamFFMPEG(filename)
}

if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions goicy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ samplerate = 44100
; 1 = mono, 2 stereo
channels = 2

; ffmpeg settings for aac
; ffmpeg bitrate for MPEG or AAC
bitrate = 192000

; aac profile
; AAC profile
; must be 'lc', 'he', 'hev2'
; valid only for stream format AAC
aacprofile = lc

;------
Expand Down
Loading

0 comments on commit 31c5366

Please sign in to comment.