mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Restructure ffmpeg (#2392)
* Refactor transcode generation * Move phash generation into separate package * Refactor image thumbnail generation * Move JSONTime to separate package * Ffmpeg refactoring * Refactor live transcoding * Refactor scene marker preview generation * Refactor preview generation * Refactor screenshot generation * Refactor sprite generation * Change ffmpeg.IsStreamable to return error * Move frame rate calculation into ffmpeg * Refactor file locking * Refactor title set during scan * Add missing lockmanager instance * Return error instead of logging in MatchContainer
This commit is contained in:
43
pkg/ffmpeg/format.go
Normal file
43
pkg/ffmpeg/format.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package ffmpeg
|
||||
|
||||
// Format represents the input/output format for ffmpeg.
|
||||
type Format string
|
||||
|
||||
// Args converts the Format to a slice of arguments to be passed to ffmpeg.
|
||||
func (f Format) Args() []string {
|
||||
if f == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
return []string{"-f", string(f)}
|
||||
}
|
||||
|
||||
var (
|
||||
FormatConcat Format = "concat"
|
||||
FormatImage2 Format = "image2"
|
||||
FormatRawVideo Format = "rawvideo"
|
||||
FormatMpegTS Format = "mpegts"
|
||||
FormatMP4 Format = "mp4"
|
||||
FormatWebm Format = "webm"
|
||||
FormatMatroska Format = "matroska"
|
||||
)
|
||||
|
||||
// ImageFormat represents the input format for an image for ffmpeg.
|
||||
type ImageFormat string
|
||||
|
||||
// Args converts the ImageFormat to a slice of arguments to be passed to ffmpeg.
|
||||
func (f ImageFormat) Args() []string {
|
||||
if f == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
return []string{"-f", string(f)}
|
||||
}
|
||||
|
||||
var (
|
||||
ImageFormatJpeg ImageFormat = "mjpeg"
|
||||
ImageFormatPng ImageFormat = "png_pipe"
|
||||
ImageFormatWebp ImageFormat = "webp_pipe"
|
||||
|
||||
ImageFormatImage2Pipe ImageFormat = "image2pipe"
|
||||
)
|
||||
Reference in New Issue
Block a user