summaryrefslogtreecommitdiff
path: root/vendor/github.com/abema/go-mp4/util/io.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-12-17 05:38:56 +0100
committerLibravatar GitHub <noreply@github.com>2022-12-17 04:38:56 +0000
commit2bbc64be4317166d3abb7aa177d4913f166a53e8 (patch)
tree88c3d613eb986b18894f311afa4291987a0e26c4 /vendor/github.com/abema/go-mp4/util/io.go
parent[chore] fix some little config whoopsies (#1272) (diff)
downloadgotosocial-2bbc64be4317166d3abb7aa177d4913f166a53e8.tar.xz
[feature] Enable basic video support (mp4 only) (#1274)
* [feature] basic video support * fix missing semicolon * replace text shadow with stacked icons Co-authored-by: f0x <f0x@cthu.lu>
Diffstat (limited to 'vendor/github.com/abema/go-mp4/util/io.go')
-rw-r--r--vendor/github.com/abema/go-mp4/util/io.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/abema/go-mp4/util/io.go b/vendor/github.com/abema/go-mp4/util/io.go
new file mode 100644
index 000000000..1e4681186
--- /dev/null
+++ b/vendor/github.com/abema/go-mp4/util/io.go
@@ -0,0 +1,30 @@
+package util
+
+import (
+ "bytes"
+ "io"
+)
+
+func ReadString(r io.Reader) (string, error) {
+ b := make([]byte, 1)
+ buf := bytes.NewBuffer(nil)
+ for {
+ if _, err := r.Read(b); err != nil {
+ return "", err
+ }
+ if b[0] == 0 {
+ return buf.String(), nil
+ }
+ buf.Write(b)
+ }
+}
+
+func WriteString(w io.Writer, s string) error {
+ if _, err := w.Write([]byte(s)); err != nil {
+ return err
+ }
+ if _, err := w.Write([]byte{0}); err != nil {
+ return err
+ }
+ return nil
+}