feat: sync GIFv and saved GIF support
This commit is contained in:
parent
c0088f1160
commit
5f7c0b9804
21 changed files with 641 additions and 50 deletions
|
|
@ -52,6 +52,8 @@ type Service struct {
|
|||
log *zap.Logger
|
||||
thumbs VideoThumbnailer
|
||||
thumbsSet bool
|
||||
gifs GIFTranscoder
|
||||
gifsSet bool
|
||||
blobCache *blobMetaCache
|
||||
byteCache *blobBytesCache
|
||||
// blobMetaSF/blobBytesSF 合并对同一热 blob 的并发首次访问:否则每个并发 getFile 都各打
|
||||
|
|
@ -91,6 +93,14 @@ func WithVideoThumbnailer(thumbnailer VideoThumbnailer) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithGIFTranscoder 覆盖真实 GIF→MP4 规范化器。传 nil 可用于测试不可用路径。
|
||||
func WithGIFTranscoder(transcoder GIFTranscoder) Option {
|
||||
return func(s *Service) {
|
||||
s.gifs = transcoder
|
||||
s.gifsSet = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithUploadPartQuota 覆盖用户级 in-flight 上传分片配额;字段 <=0 表示该维度不限制。
|
||||
func WithUploadPartQuota(quota domain.UploadPartQuota) Option {
|
||||
return func(s *Service) {
|
||||
|
|
@ -135,6 +145,14 @@ func NewService(media store.MediaStore, blobs BlobBackend, dc int, opts ...Optio
|
|||
s.thumbs = thumbnailer
|
||||
}
|
||||
}
|
||||
if !s.gifsSet {
|
||||
transcoder, err := NewFFmpegGIFTranscoder()
|
||||
if err != nil {
|
||||
s.log.Warn("ffmpeg/ffprobe not found; GIF uploads will be rejected", zap.Error(err))
|
||||
} else {
|
||||
s.gifs = transcoder
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue