Esempio n. 1
0
func main() {
	src := gst.ElementFactoryMake("videotestsrc", "VideoSrc")
	checkElem(src, "videotestsrc")
	//vsink := "autovideosink"
	vsink := "xvimagesink"
	sink := gst.ElementFactoryMake(vsink, "VideoSink")
	checkElem(sink, vsink)

	pl := gst.NewPipeline("MyPipeline")

	pl.Add(src, sink)
	filter := gst.NewCapsSimple(
		"video/x-raw,format=yuv",
		glib.Params{
			"width":     int32(192),
			"height":    int32(108),
			"framerate": &gst.Fraction{25, 1},
		},
	)
	fmt.Println(filter)
	//src.LinkFiltered(sink, filter)
	src.Link(sink)
	pl.SetState(gst.STATE_PLAYING)

	glib.NewMainLoop(nil).Run()
}
Esempio n. 2
0
func main() {
	src := gst.ElementFactoryMake("videotestsrc", "Test source")
	src.SetProperty("do-timestamp", true)
	src.SetProperty("pattern", 18) // ball

	//enc := gst.ElementFactoryMake("vp8enc", "VP8 encoder")
	enc := gst.ElementFactoryMake("x264enc", "H.264 encoder")

	//mux := gst.ElementFactoryMake("webmmux", "WebM muxer")
	mux := gst.ElementFactoryMake("matroskamux", "matroskamux muxer")
	mux.SetProperty("streamable", true)

	demux := gst.ElementFactoryMake("matroskademux", "Matroska demuxer")

	//dec := gst.ElementFactoryMake("vp8dec", "VP8 dcoder")
	dec := gst.ElementFactoryMake("ffdec_h264", "H.264 dcoder")

	sink := gst.ElementFactoryMake("autovideosink", "Video display element")

	pl := gst.NewPipeline("MyPipeline")

	pl.Add(src, enc, mux, demux, dec, sink)

	src.Link(enc, mux, demux)
	demux.ConnectNoi("pad-added", cbPadAdded, dec.GetStaticPad("sink"))
	dec.Link(sink)
	pl.SetState(gst.STATE_PLAYING)

	glib.NewMainLoop(nil).Run()
}
Esempio n. 3
0
func newPlayer() (*Player, error) {
	pipe := gst.ElementFactoryMake("playbin", "mp3_pipe")
	if pipe == nil {
		return nil, errors.New("gstreamer error")
	}

	return &Player{
		mainloop: glib.NewMainLoop(nil),
		pipe:     pipe,
	}, nil
}
Esempio n. 4
0
func main() {
	src := gst.ElementFactoryMake("videotestsrc", "VideoSrc")
	sink := gst.ElementFactoryMake("autovideosink", "VideoSink")
	pl := gst.NewPipeline("MyPipeline")

	pl.Add(src, sink)
	filter := gst.NewCapsSimple(
		"video/x-raw-yuv",
		glib.Params{
			"width":     192,
			"height":    108,
			"framerate": &gst.Fraction{25, 1},
		},
	)
	fmt.Println(filter)
	src.LinkFiltered(sink, filter)
	pl.SetState(gst.STATE_PLAYING)

	glib.NewMainLoop(nil).Run()
}
Esempio n. 5
0
func newGstreamer() *gstreamer {
	return &gstreamer{
		mainloop: glib.NewMainLoop(nil),
		pipe:     gst.ElementFactoryMake("playbin", "mp3_pipe"),
	}
}