示例#1
0
文件: player.go 项目: sergey789/gst
func (p *Player) onMessage(bus *gst.Bus, msg *gst.Message) {
	switch msg.GetType() {
	case gst.MESSAGE_EOS:
		p.pipe.SetState(gst.STATE_NULL)
	case gst.MESSAGE_ERROR:
		p.pipe.SetState(gst.STATE_NULL)
		err, debug := msg.ParseError()
		fmt.Printf("Error: %s (debug: %s)\n", err, debug)
	}
}
示例#2
0
文件: player.go 项目: sergey789/gst
func (p *Player) onSyncMessage(bus *gst.Bus, msg *gst.Message) {
	name, _ := msg.GetStructure()
	if name != "prepare-xwindow-id" {
		return
	}
	img_sink := msg.GetSrc()
	xov := gst.XOverlayCast(img_sink)
	if p.xid != 0 && xov != nil {
		img_sink.SetProperty("force-aspect-ratio", true)
		xov.SetXwindowId(p.xid)
	} else {
		fmt.Println("Error: xid =", p.xid, "xov =", xov)
	}
}
示例#3
0
func (db *DoubanFM) onMessage(bus *gst.Bus, msg *gst.Message) {
	switch msg.GetType() {
	case gst.MESSAGE_EOS:
		if db.Loop {
			db.gst.NewSource(db.Song.Url)
		} else {
			db.GetSongs(doubanfm.End)
			if db.Empty() {
				db.GetSongs(doubanfm.Last)
			}
			db.gst.NewSource(db.Next().Url)
		}
	case gst.MESSAGE_ERROR:
		s, param := msg.GetStructure()
		log.Println("gst error", msg.GetType(), s, param)
		db.gst.Stop()
	}
}