diff options
author | 2022-12-22 11:48:28 +0100 | |
---|---|---|
committer | 2022-12-22 11:48:28 +0100 | |
commit | 1659f75ae6e491355e1d32f0f5e8b956ef70a797 (patch) | |
tree | 0cc7aba9d8c98ee0163488121328e9cd0c6b32c2 /internal/media/image.go | |
parent | [bugfix] fix media create error not being checked (#1283) (diff) | |
download | gotosocial-1659f75ae6e491355e1d32f0f5e8b956ef70a797.tar.xz |
[feature] For video attachments, store + return fps, bitrate, duration (#1282)
* start messing about with different mp4 metadata extraction
* heyyooo it works
* add test cow
* move useful multierror to gtserror package
* error out if video doesn't seem to be a real mp4
* test parsing mkv in disguise as mp4
* tidy up error handling
* remove extraneous line
* update framerate formatting
* use float32 for aspect
* fixy mctesterson
Diffstat (limited to 'internal/media/image.go')
-rw-r--r-- | internal/media/image.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/media/image.go b/internal/media/image.go index aedac5707..a03098930 100644 --- a/internal/media/image.go +++ b/internal/media/image.go @@ -48,7 +48,7 @@ func decodeGif(r io.Reader) (*mediaMeta, error) { width := gif.Config.Width height := gif.Config.Height size := width * height - aspect := float64(width) / float64(height) + aspect := float32(width) / float32(height) return &mediaMeta{ width: width, @@ -85,7 +85,7 @@ func decodeImage(r io.Reader, contentType string) (*mediaMeta, error) { width := i.Bounds().Size().X height := i.Bounds().Size().Y size := width * height - aspect := float64(width) / float64(height) + aspect := float32(width) / float32(height) return &mediaMeta{ width: width, @@ -167,7 +167,7 @@ func deriveThumbnailFromImage(r io.Reader, contentType string, createBlurhash bo thumbX := thumb.Bounds().Size().X thumbY := thumb.Bounds().Size().Y size := thumbX * thumbY - aspect := float64(thumbX) / float64(thumbY) + aspect := float32(thumbX) / float32(thumbY) im := &mediaMeta{ width: thumbX, |