-
Notifications
You must be signed in to change notification settings - Fork 48
/
simple.go
43 lines (36 loc) · 828 Bytes
/
simple.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"os"
"github.com/ziutek/glib"
"github.com/ziutek/gst"
)
func checkElem(e *gst.Element, name string) {
if e == nil {
fmt.Fprintln(os.Stderr, "can't make element: ", name)
os.Exit(1)
}
}
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()
}