-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from edgeware/version-nr
Introduced version number in cmd apps and mp4 package
- Loading branch information
Showing
13 changed files
with
155 additions
and
13 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,11 @@ | ||
all: mp4ff-info mp4ff-nallister mp4ff-pslister mp4ff-wvttlister | ||
|
||
mp4ff-info mp4ff-nallister mp4ff-pslister mp4ff-wvttlister: | ||
go build -ldflags "-X github.com/edgeware/mp4ff/mp4.commitVersion=$$(git describe --tags HEAD) -X github.com/edgeware/mp4ff/mp4.commitDate=$$(git log -1 --format=%ct)" -o out/$@ cmd/$@/main.go | ||
|
||
clean: | ||
rm -f out/* | ||
|
||
install: all | ||
cp out/* $(GOPATH)/bin/ | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"log" | ||
"os" | ||
|
||
"github.com/edgeware/mp4ff/mp4" | ||
) | ||
|
||
func main() { | ||
|
||
inFilePath := flag.String("i", "", "Required: Path to input mp4 file") | ||
outFilePath := flag.String("o", "", "Required: Output filepath (without extension)") | ||
flag.Parse() | ||
|
||
if *inFilePath == "" || *outFilePath == "" { | ||
flag.Usage() | ||
return | ||
} | ||
|
||
ifd, err := os.Open(*inFilePath) | ||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
defer ifd.Close() | ||
parsedMp4, err := mp4.DecodeFile(ifd) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
parsedMp4.Init.Moov.Mvex.Trex.TrackID = 3 | ||
|
||
ofd, err := os.Create(*outFilePath) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
defer ofd.Close() | ||
|
||
err = parsedMp4.Encode(ofd) | ||
if err != nil { | ||
log.Fatal(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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
build: | ||
go build -ldflags "-X github.com/edgeware/mp4ff/mp4.commitVersion=$$(git describe --tags HEAD) -X github.com/edgeware/mp4ff/mp4.commitDate=$$(git log -1 --format=%ct)" . | ||
|
||
install: | ||
go install -ldflags "-X github.com/edgeware/mp4ff/mp4.commitVersion=$$(git describe --tags HEAD) -X github.com/edgeware/mp4ff/mp4.commitDate=$$(git log -1 --format=%ct)" . | ||
|
||
linux-build: | ||
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.commitVersion=$$(git describe --tags HEAD) -X main.commitDate=$$(git log -1 --format=%ct)" | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package mp4 | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
"time" | ||
) | ||
|
||
var ( | ||
commitVersion string = "v0.21.0" // Updated when building using Makefile | ||
commitDate string // commitDate in Epoch seconds (inserted from Makefile) | ||
) | ||
|
||
// GetVersion - get version and also commitHash and commitDate if inserted via Makefile | ||
func GetVersion() string { | ||
seconds, _ := strconv.Atoi(commitDate) | ||
if commitDate != "" { | ||
t := time.Unix(int64(seconds), 0) | ||
return fmt.Sprintf("%s, date: %s", commitVersion, t.Format("2006-01-02")) | ||
} | ||
return commitVersion | ||
} |