mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-05 07:56:51 +08:00
add a bit more to examples
This commit is contained in:
@@ -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
41
examples/appsrc/main.go
Normal 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() {
|
||||
|
||||
}
|
Reference in New Issue
Block a user