mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-05 07:56:51 +08:00
cleanup decodebin example
This commit is contained in:
@@ -135,8 +135,11 @@ func handleMessage(msg *gst.Message) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func runPipeline(pipeline *gst.Pipeline) error {
|
||||
func runPipeline(loop *gst.MainLoop, pipeline *gst.Pipeline) error {
|
||||
defer loop.Quit()
|
||||
|
||||
pipeline.SetState(gst.StatePlaying)
|
||||
defer pipeline.Destroy()
|
||||
|
||||
bus := pipeline.GetPipelineBus()
|
||||
|
||||
@@ -165,6 +168,6 @@ func main() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return runPipeline(pipeline)
|
||||
return runPipeline(loop, pipeline)
|
||||
})
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ import "C"
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"sync"
|
||||
"unsafe"
|
||||
@@ -67,7 +68,9 @@ func MarshalStructure(data interface{}) *Structure {
|
||||
for i := 0; i < valsOf.NumField(); i++ {
|
||||
gval := valsOf.Field(i).Interface()
|
||||
fieldName := typeOf.Field(i).Name
|
||||
st.SetValue(fieldName, gval)
|
||||
if err := st.SetValue(fieldName, gval); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to set %v for %s", gval, fieldName)
|
||||
}
|
||||
}
|
||||
return st
|
||||
}
|
||||
|
Reference in New Issue
Block a user