summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--player/player.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/player/player.go b/player/player.go
index 0717983..5d4e1d4 100644
--- a/player/player.go
+++ b/player/player.go
@@ -153,14 +153,21 @@ func (p *Player) onMessage(bus *gst.Bus, msg *gst.Message) {
p.updateChan <- updateData{duration: p.duration}
err, _ := msg.ParseError()
p.stdlog.Printf("GStreamer Pipeline Error: %s", err)
+ case gst.MESSAGE_DURATION_CHANGED:
+ fallthrough
case gst.MESSAGE_ASYNC_DONE:
duration, ok := p.pipe.QueryDuration(gst.FORMAT_TIME)
if ok {
p.duration = time.Duration(duration)
- p.updateChan <- updateData{duration: p.duration}
+ pos, ok := p.pipe.QueryPosition(gst.FORMAT_TIME)
+ if !ok {
+ p.stdlog.Printf("GStreamer Pipeline Error: unable to query playback position")
+ }
+ p.updateChan <- updateData{duration: p.duration, pos: time.Duration(pos)}
} else {
p.stdlog.Printf("GStreamer Pipeline Error: unable to query duration of file")
}
+
case gst.MESSAGE_ELEMENT:
s := msg.GetStructure()
peak := s.Data["peak"].(gst.GValueArray)
@@ -173,6 +180,11 @@ func (p *Player) onMessage(bus *gst.Bus, msg *gst.Message) {
pos := time.Duration(s.Data["stream-time"].(uint64))
p.updateChan <- updateData{duration: p.duration, pos: pos, meter: meter}
case gst.MESSAGE_STATE_CHANGED:
+ case gst.MESSAGE_STREAM_STATUS:
+ case gst.MESSAGE_STREAM_START:
+ case gst.MESSAGE_TAG:
+ case gst.MESSAGE_NEW_CLOCK:
+ case gst.MESSAGE_RESET_TIME:
default:
p.dbglog.Printf("GStreamer Message: unknown type '%s'", msg.GetTypeName())
}