mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-06 00:17:00 +08:00
more cleanup
This commit is contained in:
@@ -71,9 +71,10 @@ func buildPipeline() (*gst.Pipeline, error) {
|
|||||||
// play it on the default audio playback device (using autoaudiosink).
|
// play it on the default audio playback device (using autoaudiosink).
|
||||||
elements, err := gst.NewElementMany("queue", "audioconvert", "audioresample", "autoaudiosink")
|
elements, err := gst.NewElementMany("queue", "audioconvert", "audioresample", "autoaudiosink")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg := gst.NewErrorMessage(self, gst.NewGError(2, err), "", nil)
|
// We can create custom errors (with optional structures) and send them to the pipeline bus.
|
||||||
|
// The first argument reflects the source of the error, th second is the error itself, followed by a debug string.
|
||||||
|
msg := gst.NewErrorMessage(self, gst.NewGError(2, err), "Could not create elements for audio pipeline", nil)
|
||||||
pipeline.GetPipelineBus().Post(msg)
|
pipeline.GetPipelineBus().Post(msg)
|
||||||
fmt.Println("ERROR: Could not create elements for audio pipeline")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pipeline.AddMany(elements...)
|
pipeline.AddMany(elements...)
|
||||||
@@ -99,9 +100,8 @@ func buildPipeline() (*gst.Pipeline, error) {
|
|||||||
// display it using the autovideosink.
|
// display it using the autovideosink.
|
||||||
elements, err := gst.NewElementMany("queue", "videoconvert", "videoscale", "autovideosink")
|
elements, err := gst.NewElementMany("queue", "videoconvert", "videoscale", "autovideosink")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg := gst.NewErrorMessage(self, gst.NewGError(2, err), "", nil)
|
msg := gst.NewErrorMessage(self, gst.NewGError(2, err), "Could not create elements for video pipeline", nil)
|
||||||
pipeline.GetPipelineBus().Post(msg)
|
pipeline.GetPipelineBus().Post(msg)
|
||||||
fmt.Println("ERROR: Could not create elements for audio pipeline")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pipeline.AddMany(elements...)
|
pipeline.AddMany(elements...)
|
||||||
|
Reference in New Issue
Block a user