fix examples with new casing of EOS and others

This commit is contained in:
RSWilli
2025-09-16 22:36:09 +02:00
parent d9cb6ec607
commit e9ec22b95a
5 changed files with 10 additions and 10 deletions

View File

@@ -37,7 +37,7 @@ func createPipeline() (gst.Pipeline, error) {
// Pull the sample that triggered this callback
sample := sink.PullSample()
if sample == nil {
return gst.FlowEos
return gst.FlowEOS
}
// Retrieve the buffer from the sample
@@ -101,7 +101,7 @@ func runPipeline(pipeline gst.Pipeline) error {
signal.Notify(c, os.Interrupt)
go func() {
<-c
pipeline.SendEvent(gst.NewEventEos())
pipeline.SendEvent(gst.NewEventEOS())
}()
// Loop over messsages from the pipeline

View File

@@ -37,7 +37,7 @@ func createPipeline() (gst.Pipeline, error) {
// by creating a video info with the given format and creating caps from it for the appsrc element.
videoInfo := gstvideo.NewVideoInfo()
ok := videoInfo.SetFormat(gstvideo.VideoFormatRGBA, width, height)
ok := videoInfo.SetFormat(gstvideo.VideoFormatRgba, width, height)
if !ok {
return nil, fmt.Errorf("failed to set video format")
@@ -56,7 +56,7 @@ func createPipeline() (gst.Pipeline, error) {
var i int
// Get all 256 colors in the RGB8P palette.
palette := gstvideo.VideoFormatGetPalette(gstvideo.VideoFormatRGB8P)
palette := gstvideo.VideoFormatGetPalette(gstvideo.VideoFormatRgb8p)
// Since our appsrc element operates in pull mode (it asks us to provide data),
// we add a handler for the need-data callback and provide new data from there.

View File

@@ -71,7 +71,7 @@ func createPipeline() (gst.Pipeline, error) {
// however displayed this way for demonstration purposes.
sink.CallAsync(func(el gst.Element) {
fmt.Println("Send EOS is true, sending eos")
if !pipeline.SendEvent(gst.NewEventEos()) {
if !pipeline.SendEvent(gst.NewEventEOS()) {
fmt.Println("WARNING: Failed to send EOS to pipeline")
}
fmt.Println("Sent EOS")

View File

@@ -64,7 +64,7 @@ func main() {
// Once all sinks are done handling the EOS event (and all buffers that were before the
// EOS event in the pipeline already), the pipeline would post an EOS message on the bus,
// essentially telling the application that the pipeline is completely drained.
pipeline.SendEvent(gst.NewEventEos())
pipeline.SendEvent(gst.NewEventEOS())
return
}
}()

View File

@@ -90,7 +90,7 @@ func encodeGif() error {
pipeline.Add(appSink)
jpegenc.Link(appSink)
appSink.SyncStateWithParent()
appSink.SetWaitOnEos(false)
appSink.SetWaitOnEOS(false)
// We can query the decodebin for the duration of the video it received. We can then
// use this value to calculate the total number of frames we expect to produce.
@@ -111,7 +111,7 @@ func encodeGif() error {
// will be a new jpeg image from the pipeline.
var frameNum int
appSink.ConnectEos(func(self gstapp.AppSink) {
appSink.ConnectEOS(func(self gstapp.AppSink) {
fmt.Println("\nWriting the results of the gif to", outFile)
file, err := os.Create(outFile)
if err != nil {
@@ -136,7 +136,7 @@ func encodeGif() error {
// signal the main loop to quit.
// This needs to be done from a goroutine to not block the app sink
// callback.
return gst.FlowEos
return gst.FlowEOS
}
// Pull the sample from the sink
@@ -164,7 +164,7 @@ func encodeGif() error {
}
// Create a new paletted image with the same bounds as the pulled one
frame := image.NewPaletted(img.Bounds(), gstvideo.VideoFormatGetPalette(gstvideo.VideoFormatRGB8P))
frame := image.NewPaletted(img.Bounds(), gstvideo.VideoFormatGetPalette(gstvideo.VideoFormatRgb8p))
// Iterate the bounds of the image and set the pixels in their correct place.
for x := 1; x <= img.Bounds().Dx(); x++ {