This commit is contained in:
tinyzimmer
2020-10-05 11:57:10 +03:00
parent 3029b991e9
commit 9335dddc6e
2 changed files with 3 additions and 4 deletions

View File

@@ -93,8 +93,6 @@ func encodeGif(mainLoop *gst.MainLoop) error {
appSink, _ := app.NewAppSink() appSink, _ := app.NewAppSink()
pipeline.Add(appSink.Element) pipeline.Add(appSink.Element)
jpegenc.Link(appSink.Element) jpegenc.Link(appSink.Element)
appSink.SyncStateWithParent()
appSink.SetWaitOnEOS(false) appSink.SetWaitOnEOS(false)
// We can query the decodebin for the duration of the video it received. We can then // We can query the decodebin for the duration of the video it received. We can then
@@ -130,8 +128,9 @@ func encodeGif(mainLoop *gst.MainLoop) error {
if err := gif.EncodeAll(file, outGif); err != nil { if err := gif.EncodeAll(file, outGif); err != nil {
fmt.Println("Could not encode images to gif format!", err) fmt.Println("Could not encode images to gif format!", err)
} }
// Signal the pipeline that we've completed EOS // Signal the pipeline that we've completed EOS.
// pipeline.GetPipelineBus().Post(gst.NewEOSMessage(appSink)) // (this should not be required, need to investigate)
pipeline.GetPipelineBus().Post(gst.NewEOSMessage(appSink))
}, },
NewSampleFunc: func(sink *app.Sink) gst.FlowReturn { NewSampleFunc: func(sink *app.Sink) gst.FlowReturn {
// Increment the frame number counter // Increment the frame number counter

Binary file not shown.