summaryrefslogtreecommitdiff
path: root/rhimport/converter.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-13 14:40:50 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-13 14:40:50 (GMT)
commitcb911c337f3570972f293dae0ec4a71f9935e79e (patch)
tree004cfc00854b02c02251a4f34c9543551429833f /rhimport/converter.go
parent092da9dfacbcb5afcd2d3f281f664543ee956f4e (diff)
very basic support for loudness correction
Diffstat (limited to 'rhimport/converter.go')
-rw-r--r--rhimport/converter.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/rhimport/converter.go b/rhimport/converter.go
index e8e693f..d375ad0 100644
--- a/rhimport/converter.go
+++ b/rhimport/converter.go
@@ -36,12 +36,13 @@ import (
type FetchConverter interface {
io.WriteCloser
- GetResult() (result string, err error)
+ GetResult() (result string, err error, loudnessCorr float64)
}
type ConverterResult struct {
- output string
- err error
+ output string
+ err error
+ loudnessCorr float64
}
func NewFetchConverter(convType, filename string, metadata map[string]string) (FetchConverter, string, error) {
@@ -78,8 +79,8 @@ func (c *NullFetchConverter) Close() (err error) {
return c.file.Close()
}
-func (c *NullFetchConverter) GetResult() (result string, err error) {
- return "", nil
+func (c *NullFetchConverter) GetResult() (result string, err error, loudnessCorr float64) {
+ return "", nil, 0.0
}
//
@@ -111,7 +112,7 @@ func NewFFMpegFetchConverter(filename string, metadata map[string]string) (ff *F
ff.result = make(chan ConverterResult, 1)
go func() {
output, err := ff.cmd.CombinedOutput()
- ff.result <- ConverterResult{strings.TrimSpace(string(output)), err}
+ ff.result <- ConverterResult{strings.TrimSpace(string(output)), err, 0.0}
}()
return
}
@@ -124,10 +125,10 @@ func (ff *FFMpegFetchConverter) Close() (err error) {
return ff.pipe.Close()
}
-func (ff *FFMpegFetchConverter) GetResult() (result string, err error) {
+func (ff *FFMpegFetchConverter) GetResult() (result string, err error, loudnessCorr float64) {
if ff.result != nil {
r := <-ff.result
- return r.output, r.err
+ return r.output, r.err, r.loudnessCorr
}
- return "", nil
+ return "", nil, 0.0
}