diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rhlibrary/player.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/rhlibrary/player.go b/src/rhlibrary/player.go index b6a6d93..983198f 100644 --- a/src/rhlibrary/player.go +++ b/src/rhlibrary/player.go @@ -47,11 +47,18 @@ func (p *Player) onMessage(bus *gst.Bus, msg *gst.Message) { p.pipe.SetState(gst.STATE_NULL) case gst.MESSAGE_WARNING: warn, _ := msg.ParseWarning() - rhdl.Printf("GStreamer Pipeline Warning: %s\n", warn) + rhdl.Printf("GStreamer Pipeline Warning: %s", warn) case gst.MESSAGE_ERROR: p.pipe.SetState(gst.STATE_NULL) err, _ := msg.ParseError() - rhdl.Printf("GStreamer Pipeline Error: %s\n", err) + rhdl.Printf("GStreamer Pipeline Error: %s", err) + case gst.MESSAGE_ASYNC_DONE: + len, ok := p.pipe.QueryDuration(gst.FORMAT_TIME) + if ok { + rhdl.Printf("GStreamer Pipeline: loaded file has length: %d.%d s", len/1000000000, len%1000000000) + } else { + rhdl.Printf("GStreamer Pipeline Error: unable to query duration of file") + } case gst.MESSAGE_STATE_CHANGED: default: rhdl.Printf("GStreamer Message: unknown type '%s'", msg.GetTypeName()) |