finish GstMessage constructors

This commit is contained in:
tinyzimmer
2020-09-30 10:26:06 +03:00
parent 7cd00ed46b
commit 14be850a16
5 changed files with 675 additions and 12 deletions

View File

@@ -1,10 +1,13 @@
package gst
// GError is a Go wrapper for a C GError. It implements the error interface
// GError is a Go wrapper for a C GError in the context of GStreamer. It implements the error interface
// and provides additional functions for retrieving debug strings and details.
type GError struct {
errMsg, debugStr string
structure *Structure
// used for message constructors
code int
}
// Message is an alias to `Error()`. It's for clarity when this object
@@ -19,3 +22,12 @@ func (e *GError) DebugString() string { return e.debugStr }
// Structure returns the structure of the error message which may contain additional metadata.
func (e *GError) Structure() *Structure { return e.structure }
// NewGError wraps the given error inside a GError (to be used with message constructors). The code
// is optional and allows for adding additional "types" to the error.
func NewGError(code int, err error) *GError {
return &GError{
errMsg: err.Error(),
code: code,
}
}