add a bit more to examples

This commit is contained in:
tinyzimmer
2020-10-03 17:19:16 +03:00
parent fa165ecf85
commit 2ffdae9e9e
2 changed files with 43 additions and 0 deletions

View File

@@ -23,6 +23,8 @@ func createPipeline() (*gst.Pipeline, error) {
return nil, err
}
// Should this actually be a *gst.Element that produces an Appsink interface like the
// rust examples?
sink, err := app.NewAppSink()
if err != nil {
return nil, err

41
examples/appsrc/main.go Normal file
View File

@@ -0,0 +1,41 @@
package main
import (
"github.com/tinyzimmer/go-gst/gst"
"github.com/tinyzimmer/go-gst/gst/app"
)
func createPipeline() (*gst.Pipeline, error) {
gst.Init(nil)
pipeline, err := gst.NewPipeline("")
if err != nil {
return nil, err
}
// Should this actually be a *gst.Element that produces an Appsrc interface like the
// rust examples?
src, err := app.NewAppSrc()
if err != nil {
return nil, err
}
elems, err := gst.NewElementMany("videoconvert", "autovideosink")
if err != nil {
return nil, err
}
// Place the app source at the top of the element list for linking
elems = append([]*gst.Element{src.Element}, elems...)
pipeline.AddMany(elems...)
gst.ElementLinkMany(elems...)
// TODO: need to implement video
return pipeline, nil
}
func main() {
}