-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanups, test workflow for Github actions
- Loading branch information
Showing
12 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Run tests | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '>=1.20.0' | ||
- name: Run tests | ||
run: go test -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (C) 2016 - 2017, Lefteris Zafiris <[email protected]> | ||
Copyright (C) 2016 - 2024, Lefteris Zafiris <[email protected]> | ||
This program is free software, distributed under the terms of | ||
the BSD 3-Clause License. See the LICENSE file | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (C) 2016 - 2017, Lefteris Zafiris <[email protected]> | ||
Copyright (C) 2016 - 2024, Lefteris Zafiris <[email protected]> | ||
This program is free software, distributed under the terms of | ||
the BSD 3-Clause License. See the LICENSE file | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (C) 2016 - 2017, Lefteris Zafiris <[email protected]> | ||
Copyright (C) 2016 - 2024, Lefteris Zafiris <[email protected]> | ||
This program is free software, distributed under the terms of | ||
the BSD 3-Clause License. See the LICENSE file | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (C) 2016 - 2017, Lefteris Zafiris <[email protected]> | ||
Copyright (C) 2016 - 2024, Lefteris Zafiris <[email protected]> | ||
This program is free software, distributed under the terms of | ||
the BSD 3-Clause License. See the LICENSE file | ||
|
@@ -14,13 +14,16 @@ package main | |
|
||
import ( | ||
"fmt" | ||
"io" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
|
||
"github.com/zaf/g711" | ||
) | ||
|
||
const wavHeader = 44 | ||
|
||
func main() { | ||
if len(os.Args) < 3 || os.Args[1] == "help" || os.Args[1] == "--help" || (os.Args[1] != "ulaw" && os.Args[1] != "alaw") { | ||
fmt.Printf("%s Encodes 16bit 8kHz LPCM data to 8bit G711 PCM\n", os.Args[0]) | ||
|
@@ -43,7 +46,7 @@ func main() { | |
} | ||
|
||
func encodeG711(file, format string) error { | ||
input, err := os.ReadFile(file) | ||
input, err := os.Open(file) | ||
if err != nil { | ||
return err | ||
} | ||
|
@@ -72,9 +75,8 @@ func encodeG711(file, format string) error { | |
} | ||
} | ||
if extension == ".wav" { | ||
_, err = encoder.Write(input[44:]) // Skip WAV header | ||
return err | ||
input.Seek(wavHeader, 0) // Skip wav header | ||
} | ||
_, err = encoder.Write(input) | ||
_, err = io.Copy(encoder, input) | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (C) 2016 - 2017, Lefteris Zafiris <[email protected]> | ||
Copyright (C) 2016 - 2024, Lefteris Zafiris <[email protected]> | ||
This program is free software, distributed under the terms of | ||
the BSD 3-Clause License. See the LICENSE file | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (C) 2016 - 2017, Lefteris Zafiris <[email protected]> | ||
Copyright (C) 2016 - 2024, Lefteris Zafiris <[email protected]> | ||
This program is free software, distributed under the terms of | ||
the BSD 3-Clause License. See the LICENSE file | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module github.com/zaf/g711 | ||
|
||
go 1.17 | ||
go 1.20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (C) 2016 - 2017, Lefteris Zafiris <[email protected]> | ||
Copyright (C) 2016 - 2024, Lefteris Zafiris <[email protected]> | ||
This program is free software, distributed under the terms of | ||
the BSD 3-Clause License. See the LICENSE file | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright (C) 2016 - 2017, Lefteris Zafiris <[email protected]> | ||
Copyright (C) 2016 - 2024, Lefteris Zafiris <[email protected]> | ||
This program is free software, distributed under the terms of | ||
the BSD 3-Clause License. See the LICENSE file | ||
|