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