Skip to content

🎧 Your Personal Streaming Service

refactor(server): remove ffmpeg unused code

Deluanbbb3182bc976
diff --git a/core/ffmpeg/ffmpeg.go b/core/ffmpeg/ffmpeg.go
index 712e220af..4b782f01c 100644
--- a/core/ffmpeg/ffmpeg.go
+++ b/core/ffmpeg/ffmpeg.go
@@ -18,8 +18,6 @@ import (
type FFmpeg interface {
Transcode(ctx context.Context, command, path string, maxBitRate, offset int) (io.ReadCloser, error)
ExtractImage(ctx context.Context, path string) (io.ReadCloser, error)
- ConvertToWAV(ctx context.Context, path string) (io.ReadCloser, error)
- ConvertToFLAC(ctx context.Context, path string) (io.ReadCloser, error)
Probe(ctx context.Context, files []string) (string, error)
CmdPath() (string, error)
IsAvailable() bool
@@ -33,8 +31,6 @@ func New() FFmpeg {
const (
extractImageCmd = "ffmpeg -i %s -an -vcodec copy -f image2pipe -"
probeCmd = "ffmpeg %s -f ffmetadata"
- createWavCmd = "ffmpeg -i %s -c:a pcm_s16le -f wav -"
- createFLACCmd = "ffmpeg -i %s -f flac -"
)
type ffmpeg struct{}
@@ -55,16 +51,6 @@ func (e *ffmpeg) ExtractImage(ctx context.Context, path string) (io.ReadCloser,
return e.start(ctx, args)
}
-func (e *ffmpeg) ConvertToWAV(ctx context.Context, path string) (io.ReadCloser, error) {
- args := createFFmpegCommand(createWavCmd, path, 0, 0)
- return e.start(ctx, args)
-}
-
-func (e *ffmpeg) ConvertToFLAC(ctx context.Context, path string) (io.ReadCloser, error) {
- args := createFFmpegCommand(createFLACCmd, path, 0, 0)
- return e.start(ctx, args)
-}
-
func (e *ffmpeg) Probe(ctx context.Context, files []string) (string, error) {
if _, err := ffmpegCmd(); err != nil {
return "", err
@@ -167,7 +153,6 @@ func createFFmpegCommand(cmd, path string, maxBitRate, offset int) []string {
args = append(args, s)
}
}
-
return args
}
@@ -187,16 +172,13 @@ func createProbeCommand(cmd string, inputs []string) []string {
func fixCmd(cmd string) []string {
split := strings.Split(cmd, " ")
- var result []string
cmdPath, _ := ffmpegCmd()
- for _, s := range split {
+ for i, s := range split {
if s == "ffmpeg" || s == "ffmpeg.exe" {
- result = append(result, cmdPath)
- } else {
- result = append(result, s)
+ split[i] = cmdPath
}
}
- return result
+ return split
}
func ffmpegCmd() (string, error) {
diff --git a/tests/mock_ffmpeg.go b/tests/mock_ffmpeg.go
index 2d5ef8ac5..a792ae9d3 100644
--- a/tests/mock_ffmpeg.go
+++ b/tests/mock_ffmpeg.go
@@ -37,20 +37,6 @@ func (ff *MockFFmpeg) ExtractImage(context.Context, string) (io.ReadCloser, erro
return ff, nil
}
-func (ff *MockFFmpeg) ConvertToFLAC(context.Context, string) (io.ReadCloser, error) {
- if ff.Error != nil {
- return nil, ff.Error
- }
- return ff, nil
-}
-
-func (ff *MockFFmpeg) ConvertToWAV(context.Context, string) (io.ReadCloser, error) {
- if ff.Error != nil {
- return nil, ff.Error
- }
- return ff, nil
-}
-
func (ff *MockFFmpeg) Probe(context.Context, []string) (string, error) {
if ff.Error != nil {
return "", ff.Error