diff options
Diffstat (limited to 'player')
-rw-r--r-- | player/player.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/player/player.go b/player/player.go index facf291..60a19fa 100644 --- a/player/player.go +++ b/player/player.go @@ -83,7 +83,7 @@ const ( type Player struct { pipe *gst.Pipeline src *gst.Element - volume *gst.Element + level *gst.Element bus *gst.Bus basepath string stdlog *log.Logger @@ -116,6 +116,8 @@ func (p *Player) onMessage(bus *gst.Bus, msg *gst.Message) { } else { p.stdlog.Printf("GStreamer Pipeline Error: unable to query duration of file\n") } + case gst.MESSAGE_ELEMENT: + p.stdlog.Printf("GStreamer Message: from element '%s'\n", msg.GetSourceName()) case gst.MESSAGE_STATE_CHANGED: default: p.stdlog.Printf("GStreamer Message: unknown type '%s'\n", msg.GetTypeName()) @@ -216,9 +218,12 @@ func (p *Player) createPipeline() (err error) { if conv1, err = gst.ElementFactoryMake("audioconvert", "conv1"); err != nil { return } - if p.volume, err = gst.ElementFactoryMake("volume", "meter"); err != nil { + if p.level, err = gst.ElementFactoryMake("level", "meter"); err != nil { return } + p.level.SetProperty("message", true) + p.level.SetProperty("peak-ttl", 300000000) + p.level.SetProperty("peak-falloff", 25) if conv2, err = gst.ElementFactoryMake("audioconvert", "conv2"); err != nil { return } @@ -228,7 +233,7 @@ func (p *Player) createPipeline() (err error) { p.pipe.Add(p.src) p.pipe.Add(conv1) - p.pipe.Add(p.volume) + p.pipe.Add(p.level) p.pipe.Add(conv2) p.pipe.Add(sink) @@ -242,8 +247,8 @@ func (p *Player) createPipeline() (err error) { } p.dbglog.Println("player succesfully linked src with conv1") }) - conv1.Link(p.volume) - p.volume.Link(conv2) + conv1.Link(p.level) + p.level.Link(conv2) conv2.Link(sink) if p.bus, err = p.pipe.GetBus(); err != nil { |