Skip to content

Commit

Permalink
Cleanups, test workflow for Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
zaf committed Jan 3, 2024
1 parent 4090c85 commit 9fe8301
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 15 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/tests.yml
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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016-2017, Eleftherios (Lefteris) Zafiris
Copyright (c) 2016-2024, Eleftherios (Lefteris) Zafiris
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
1 change: 0 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# g711
--
import "github.com/zaf/g711"

Package g711 implements encoding and decoding of G711 PCM sound data. G.711 is
Expand Down
2 changes: 1 addition & 1 deletion alaw.go
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
Expand Down
2 changes: 1 addition & 1 deletion alaw_test.go
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
Expand Down
2 changes: 1 addition & 1 deletion cmd/g711dec/g711dec.go
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
Expand Down
12 changes: 7 additions & 5 deletions cmd/g711enc/g711enc.go
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
Expand All @@ -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])
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion g711.go
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
Expand Down
2 changes: 1 addition & 1 deletion g711_test.go
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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
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
2 changes: 1 addition & 1 deletion ulaw.go
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
Expand Down
2 changes: 1 addition & 1 deletion ulaw_test.go
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
Expand Down

0 comments on commit 9fe8301

Please sign in to comment.