summaryrefslogtreecommitdiff
path: root/internal/media/image.go
AgeCommit message (Collapse)AuthorFiles
2024-07-12[feature] support processing of (many) more media types (#3090)Libravatar kim1
* initial work replacing our media decoding / encoding pipeline with ffprobe + ffmpeg * specify the video codec to use when generating static image from emoji * update go-storage library (fixes incompatibility after updating go-iotools) * maintain image aspect ratio when generating a thumbnail for it * update readme to show go-ffmpreg * fix a bunch of media tests, move filesize checking to callers of media manager for more flexibility * remove extra debug from error message * fix up incorrect function signatures * update PutFile to just use regular file copy, as changes are file is on separate partition * fix remaining tests, remove some unneeded tests now we're working with ffmpeg/ffprobe * update more tests, add more code comments * add utilities to generate processed emoji / media outputs * fix remaining tests * add test for opus media file, add license header to utility cmds * limit the number of concurrently available ffmpeg / ffprobe instances * reduce number of instances * further reduce number of instances * fix envparsing test with configuration variables * update docs and configuration with new media-{local,remote}-max-size variables
2024-06-26[chore] media and emoji refactoring (#3000)Libravatar kim1
* start updating media manager interface ready for storing attachments / emoji right away * store emoji and media as uncached immediately, then (re-)cache on Processing{}.Load() * remove now unused media workers * fix tests and issues * fix another test! * fix emoji activitypub uri setting behaviour, fix remainder of test compilation issues * fix more tests * fix (most of) remaining tests, add debouncing to repeatedly failing media / emojis * whoops, rebase issue * remove kim's whacky experiments * do some reshuffling, ensure emoji uri gets set * ensure marked as not cached on cleanup * tweaks to media / emoji processing to handle context canceled better * ensure newly fetched emojis actually get set in returned slice * use different varnames to be a bit more obvious * move emoji refresh rate limiting to dereferencer * add exported dereferencer functions for remote media, use these for recaching in processor * add check for nil attachment in updateAttachment() * remove unused emoji and media fields + columns * see previous commit * fix old migrations expecting image_updated_at to exists (from copies of old models) * remove freshness checking code (seems to be broken...) * fix error arg causing nil ptr exception * finish documentating functions with comments, slight tweaks to media / emoji deref error logic * remove some extra unneeded boolean checking * finish writing documentation (code comments) for exported media manager methods * undo changes to migration snapshot gtsmodels, updated failing migration to have its own snapshot * move doesColumnExist() to util.go in migrations package
2023-03-12[chore] Improve copyright header handling (#1608)Libravatar Daenney1
* [chore] Remove years from all license headers Years or year ranges aren't required in license headers. Many projects have removed them in recent years and it avoids a bit of yearly toil. In many cases our copyright claim was also a bit dodgy since we added the 2021-2023 header to files created after 2021 but you can't claim copyright into the past that way. * [chore] Add license header check This ensures a license header is always added to any new file. This avoids maintainers/reviewers needing to remember to check for and ask for it in case a contribution doesn't include it. * [chore] Add missing license headers * [chore] Further updates to license header * Use the more common // indentend comment format * Remove the hack we had for the linter now that we use the // format * Add SPDX license identifier
2023-01-11[performance] media processing improvements (#1288)Libravatar kim1
* media processor consolidation and reformatting, reduce amount of required syscalls Signed-off-by: kim <grufwub@gmail.com> * update go-store library, stream jpeg/png encoding + use buffer pools, improved media processing AlreadyExists error handling Signed-off-by: kim <grufwub@gmail.com> * fix duration not being set, fix mp4 test expecting error Signed-off-by: kim <grufwub@gmail.com> * fix test expecting media files with different extension Signed-off-by: kim <grufwub@gmail.com> * remove unused code Signed-off-by: kim <grufwub@gmail.com> * fix expected storage paths in tests, update expected test thumbnails Signed-off-by: kim <grufwub@gmail.com> * remove dead code Signed-off-by: kim <grufwub@gmail.com> * fix cached presigned s3 url fetching Signed-off-by: kim <grufwub@gmail.com> * fix tests Signed-off-by: kim <grufwub@gmail.com> * fix test models Signed-off-by: kim <grufwub@gmail.com> * update media processing to use sync.Once{} for concurrency protection Signed-off-by: kim <grufwub@gmail.com> * shutup linter Signed-off-by: kim <grufwub@gmail.com> * fix passing in KVStore GetStream() as stream to PutStream() Signed-off-by: kim <grufwub@gmail.com> * fix unlocks of storage keys Signed-off-by: kim <grufwub@gmail.com> * whoops, return the error... Signed-off-by: kim <grufwub@gmail.com> * pour one out for tobi's code <3 Signed-off-by: kim <grufwub@gmail.com> * add back the byte slurping code Signed-off-by: kim <grufwub@gmail.com> * check for both ErrUnexpectedEOF and EOF Signed-off-by: kim <grufwub@gmail.com> * add back links to file format header information Signed-off-by: kim <grufwub@gmail.com> Signed-off-by: kim <grufwub@gmail.com>
2023-01-05[chore] Update/add license headers for 2023 (#1304)Libravatar tobi1
2022-12-22[feature] For video attachments, store + return fps, bitrate, duration (#1282)Libravatar tobi1
* 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
2022-12-17[feature] Enable basic video support (mp4 only) (#1274)Libravatar tobi1
* [feature] basic video support * fix missing semicolon * replace text shadow with stacked icons Co-authored-by: f0x <f0x@cthu.lu>
2022-12-06[feature] media: add webp support (#1155)Libravatar Sigrid Solveig Haflínudóttir1
* media: add webp support Signed-off-by: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> * bump exif-terminator to v0.5.0 Signed-off-by: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> Signed-off-by: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
2022-08-10[bugfix] Check orientation when reading width/height of images (#749)Libravatar tobi1
2022-08-10[bugfix] Fix thumbnails not taking exif rotation into account (#746)Libravatar tobi1
* use disintegration/imaging instead of nfnt/resize * update tests * use disintegration lib for thumbing (if necessary)
2022-04-25[bugfix] Allow processing of .png files where checksum is not correct (#487)Libravatar tobi1
* add png stripping code from google/wuffs * experiment with stripping data from pngs * add test images * use StrippedPngDecode for pngs * add StrippedPngDecode func * update tests for (no)alphachannel pngs * nolint on copied function
2022-03-21[bugfix] Fix images not being processed correctly sometimes (#437)Libravatar tobi1
* bump exif-terminator to latest version * add and test giant turnip from turnip.farm * don't error if content property is nil
2022-01-23rework data function to provide filesizeLibravatar tsmethurst1
2022-01-16pass reader around instead of []byteLibravatar tsmethurst1
2022-01-15start fixing up emoji processing codeLibravatar tsmethurst1
2022-01-11pass a function into the manager, start work on emojiLibravatar tsmethurst1
2022-01-10test the media manager a bit, add shutdown logicLibravatar tsmethurst1
2022-01-09tests are passing, but there's still much to be doneLibravatar tsmethurst1
2022-01-08further refinementsLibravatar tsmethurst1
2022-01-04start working on thumb + full funcsLibravatar tsmethurst1
2022-01-03return very partial image on first uploadLibravatar tsmethurst1
2022-01-02fiddle around with workersLibravatar tsmethurst1
2021-12-28more refactoring, media handler => managerLibravatar tsmethurst1
2021-12-27start refactor of media packageLibravatar tsmethurst1