summaryrefslogtreecommitdiff
path: root/player
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-01-28 17:55:14 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-01-28 17:55:14 (GMT)
commit9458e4371d6d3deccd6c9f2e9e29fc21509913ce (patch)
tree0e0119c9e3cbeacb2eb1387558bd241f532173a8 /player
parentdc694dc5bf0f7aa9c050ff481a5dd2d8fca15588 (diff)
length vs. duration
Diffstat (limited to 'player')
-rw-r--r--player/player.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/player/player.go b/player/player.go
index 8e6db21..0717983 100644
--- a/player/player.go
+++ b/player/player.go
@@ -98,11 +98,11 @@ type MeterChannel struct {
}
type Meter []MeterChannel
type updateData struct {
- len time.Duration
- pos time.Duration
- meter Meter
+ duration time.Duration
+ pos time.Duration
+ meter Meter
}
-type UpdateCB func(len time.Duration, pos time.Duration, meter Meter, userdata interface{}) bool
+type UpdateCB func(duration time.Duration, pos time.Duration, meter Meter, userdata interface{}) bool
type pUpdateCB struct {
cb UpdateCB
userdata interface{}
@@ -142,7 +142,7 @@ func (p *Player) onMessage(bus *gst.Bus, msg *gst.Message) {
p.pipe.SetState(gst.STATE_NULL)
p.state = IDLE
p.duration = 0
- p.updateChan <- updateData{len: p.duration}
+ p.updateChan <- updateData{duration: p.duration}
case gst.MESSAGE_WARNING:
warn, _ := msg.ParseWarning()
p.stdlog.Printf("GStreamer Pipeline Warning: %s", warn)
@@ -150,14 +150,14 @@ func (p *Player) onMessage(bus *gst.Bus, msg *gst.Message) {
p.pipe.SetState(gst.STATE_NULL)
p.state = IDLE
p.duration = 0
- p.updateChan <- updateData{len: p.duration}
+ p.updateChan <- updateData{duration: p.duration}
err, _ := msg.ParseError()
p.stdlog.Printf("GStreamer Pipeline Error: %s", err)
case gst.MESSAGE_ASYNC_DONE:
- len, ok := p.pipe.QueryDuration(gst.FORMAT_TIME)
+ duration, ok := p.pipe.QueryDuration(gst.FORMAT_TIME)
if ok {
- p.duration = time.Duration(len)
- p.updateChan <- updateData{len: p.duration}
+ p.duration = time.Duration(duration)
+ p.updateChan <- updateData{duration: p.duration}
} else {
p.stdlog.Printf("GStreamer Pipeline Error: unable to query duration of file")
}
@@ -171,7 +171,7 @@ func (p *Player) onMessage(bus *gst.Bus, msg *gst.Message) {
meter[i] = MeterChannel{Peak: peak[i].(float64), Decay: decay[i].(float64)}
}
pos := time.Duration(s.Data["stream-time"].(uint64))
- p.updateChan <- updateData{len: p.duration, pos: pos, meter: meter}
+ p.updateChan <- updateData{duration: p.duration, pos: pos, meter: meter}
case gst.MESSAGE_STATE_CHANGED:
default:
p.dbglog.Printf("GStreamer Message: unknown type '%s'", msg.GetTypeName())
@@ -258,10 +258,10 @@ func (p *Player) addUpdateHandler(callback UpdateCB, userdata interface{}) (resp
return
}
-func (p *Player) sendUpdate(len time.Duration, pos time.Duration, meter Meter) {
+func (p *Player) sendUpdate(duration time.Duration, pos time.Duration, meter Meter) {
for _, cb := range p.updateCBs {
if cb.cb != nil {
- if keep := cb.cb(len, pos, meter, cb.userdata); !keep {
+ if keep := cb.cb(duration, pos, meter, cb.userdata); !keep {
cb.cb = nil
}
}
@@ -288,7 +288,7 @@ func (p *Player) dispatchRequests() {
case req := <-p.addUpdateHandlerChan:
req.response <- p.addUpdateHandler(req.callback, req.userdata)
case u := <-p.updateChan:
- p.sendUpdate(u.len, u.pos, u.meter)
+ p.sendUpdate(u.duration, u.pos, u.meter)
}
}
}