From 439f19cefcdfe3c13e19e153cf6628e4f67d7b0a Mon Sep 17 00:00:00 2001 From: Stephan Lukits Date: Mon, 13 Mar 2023 09:16:46 +0200 Subject: [PATCH 1/4] fix: pipeline with one element is ok --- gst/gst_pipeline.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gst/gst_pipeline.go b/gst/gst_pipeline.go index 9e5b6187..717ea83b 100644 --- a/gst/gst_pipeline.go +++ b/gst/gst_pipeline.go @@ -45,7 +45,7 @@ func NewPipeline(name string) (*Pipeline, error) { // NewPipelineFromString creates a new gstreamer pipeline from the given launch string. func NewPipelineFromString(launchv string) (*Pipeline, error) { - if len(strings.Split(launchv, "!")) < 2 { + if len(strings.Split(launchv, "!")) < 1 { return nil, fmt.Errorf("Given string is too short for a pipeline: %s", launchv) } cLaunchv := C.CString(launchv) From 56682b3025dedc731177f18ad833a56ad889d1a6 Mon Sep 17 00:00:00 2001 From: Stephan Lukits Date: Mon, 13 Mar 2023 10:44:40 +0200 Subject: [PATCH 2/4] Revert "fix: pipeline with one element is ok" This reverts commit 439f19cefcdfe3c13e19e153cf6628e4f67d7b0a. --- gst/gst_pipeline.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gst/gst_pipeline.go b/gst/gst_pipeline.go index 717ea83b..9e5b6187 100644 --- a/gst/gst_pipeline.go +++ b/gst/gst_pipeline.go @@ -45,7 +45,7 @@ func NewPipeline(name string) (*Pipeline, error) { // NewPipelineFromString creates a new gstreamer pipeline from the given launch string. func NewPipelineFromString(launchv string) (*Pipeline, error) { - if len(strings.Split(launchv, "!")) < 1 { + if len(strings.Split(launchv, "!")) < 2 { return nil, fmt.Errorf("Given string is too short for a pipeline: %s", launchv) } cLaunchv := C.CString(launchv) From 20352fd5b910a6a4f6b3abac46932a4ecb49f466 Mon Sep 17 00:00:00 2001 From: Stephan Lukits Date: Mon, 13 Mar 2023 10:45:23 +0200 Subject: [PATCH 3/4] fix: pipeline with one element is ok --- gst/gst_pipeline.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/gst/gst_pipeline.go b/gst/gst_pipeline.go index 9e5b6187..13ec6a0f 100644 --- a/gst/gst_pipeline.go +++ b/gst/gst_pipeline.go @@ -45,9 +45,6 @@ func NewPipeline(name string) (*Pipeline, error) { // NewPipelineFromString creates a new gstreamer pipeline from the given launch string. func NewPipelineFromString(launchv string) (*Pipeline, error) { - if len(strings.Split(launchv, "!")) < 2 { - return nil, fmt.Errorf("Given string is too short for a pipeline: %s", launchv) - } cLaunchv := C.CString(launchv) defer C.free(unsafe.Pointer(cLaunchv)) var gerr *C.GError From 822ccfad68452a92bed2ac3f137477c64309545d Mon Sep 17 00:00:00 2001 From: Stephan Lukits Date: Mon, 13 Mar 2023 11:08:51 +0200 Subject: [PATCH 4/4] fix: imports, go.sum Didn't made a go build before the last commit but trusted vs-code not showing any errors. Well, I shouldn't have ... --- go.sum | 2 ++ gst/gst_pipeline.go | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.sum b/go.sum index ad14e8f9..a638f0db 100644 --- a/go.sum +++ b/go.sum @@ -2,3 +2,5 @@ github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= github.com/tinyzimmer/go-glib v0.0.24 h1:ktZZC22/9t88kGRgNEFV/SESgIWhGHE+q7Z7Qj++luw= github.com/tinyzimmer/go-glib v0.0.24/go.mod h1:ltV0gO6xNFzZhsIRbFXv8RTq9NGoNT2dmAER4YmZfaM= +github.com/tinyzimmer/go-glib v0.0.25 h1:2GpumtkxA0wpXhCXP6D3ksb5pGMfo9WbhgLvEw8njK4= +github.com/tinyzimmer/go-glib v0.0.25/go.mod h1:ltV0gO6xNFzZhsIRbFXv8RTq9NGoNT2dmAER4YmZfaM= diff --git a/gst/gst_pipeline.go b/gst/gst_pipeline.go index 13ec6a0f..d87299f5 100644 --- a/gst/gst_pipeline.go +++ b/gst/gst_pipeline.go @@ -5,8 +5,6 @@ import "C" import ( "errors" - "fmt" - "strings" "unsafe" "github.com/tinyzimmer/go-glib/glib"