mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-04 15:12:25 -06:00
[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>
This commit is contained in:
parent
0f38e7c9b0
commit
2bbc64be43
39 changed files with 6276 additions and 93 deletions
30
vendor/github.com/abema/go-mp4/util/io.go
generated
vendored
Normal file
30
vendor/github.com/abema/go-mp4/util/io.go
generated
vendored
Normal file
|
|
@ -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
|
||||
}
|
||||
42
vendor/github.com/abema/go-mp4/util/string.go
generated
vendored
Normal file
42
vendor/github.com/abema/go-mp4/util/string.go
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
func FormatSignedFixedFloat1616(val int32) string {
|
||||
if val&0xffff == 0 {
|
||||
return strconv.Itoa(int(val >> 16))
|
||||
} else {
|
||||
return strconv.FormatFloat(float64(val)/(1<<16), 'f', 5, 64)
|
||||
}
|
||||
}
|
||||
|
||||
func FormatUnsignedFixedFloat1616(val uint32) string {
|
||||
if val&0xffff == 0 {
|
||||
return strconv.Itoa(int(val >> 16))
|
||||
} else {
|
||||
return strconv.FormatFloat(float64(val)/(1<<16), 'f', 5, 64)
|
||||
}
|
||||
}
|
||||
|
||||
func FormatSignedFixedFloat88(val int16) string {
|
||||
if val&0xff == 0 {
|
||||
return strconv.Itoa(int(val >> 8))
|
||||
} else {
|
||||
return strconv.FormatFloat(float64(val)/(1<<8), 'f', 3, 32)
|
||||
}
|
||||
}
|
||||
|
||||
func EscapeUnprintable(r rune) rune {
|
||||
if unicode.IsGraphic(r) {
|
||||
return r
|
||||
}
|
||||
return rune('.')
|
||||
}
|
||||
|
||||
func EscapeUnprintables(src string) string {
|
||||
return strings.Map(EscapeUnprintable, src)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue