fix(ffmpeg): no codec handling
This commit is contained in:
parent
17b50dea3c
commit
66b74a271f
5 changed files with 6 additions and 0 deletions
|
|
@ -85,6 +85,9 @@ func LoadAVContext(ctx context.Context, reader io.Reader, size int64) (*AVContex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (av *AVContext) ProcessFrames(maxFrames int) (err error) {
|
func (av *AVContext) ProcessFrames(maxFrames int) (err error) {
|
||||||
|
if av.formatContext == nil || av.codecContext == nil {
|
||||||
|
return ErrDecoderNotFound
|
||||||
|
}
|
||||||
if av.thumbContext == nil {
|
if av.thumbContext == nil {
|
||||||
return createThumbContext(av, C.int(maxFrames))
|
return createThumbContext(av, C.int(maxFrames))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ func TestProcessor(t *testing.T) {
|
||||||
{name: "image", path: "fit-in/100x100/demo.png"},
|
{name: "image", path: "fit-in/100x100/demo.png"},
|
||||||
{name: "alpha", path: "fit-in/filters:format(png)/alpha-webm.webm"},
|
{name: "alpha", path: "fit-in/filters:format(png)/alpha-webm.webm"},
|
||||||
{name: "corrupted", path: "fit-in/100x100/corrupt/everybody-betray-me.mkv", expectCode: 406},
|
{name: "corrupted", path: "fit-in/100x100/corrupt/everybody-betray-me.mkv", expectCode: 406},
|
||||||
|
{name: "no cover meta", path: "meta/no_cover.mp3"},
|
||||||
|
{name: "no cover 406", path: "fit-in/100x100/no_cover.mp3", expectCode: 406},
|
||||||
}, WithDebug(true), WithLogger(zap.NewExample()))
|
}, WithDebug(true), WithLogger(zap.NewExample()))
|
||||||
doGoldenTests(t, filepath.Join(testDataDir, "golden/result-fallback-image"), []test{
|
doGoldenTests(t, filepath.Join(testDataDir, "golden/result-fallback-image"), []test{
|
||||||
{name: "corrupted with fallback image", path: "fit-in/100x100/corrupt/everybody-betray-me.mkv", expectCode: 406},
|
{name: "corrupted with fallback image", path: "fit-in/100x100/corrupt/everybody-betray-me.mkv", expectCode: 406},
|
||||||
|
|
|
||||||
BIN
testdata/golden/result/fit-in/100x100/no_cover.mp3
vendored
Normal file
BIN
testdata/golden/result/fit-in/100x100/no_cover.mp3
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 B |
1
testdata/golden/result/meta/no_cover.mp3
vendored
Normal file
1
testdata/golden/result/meta/no_cover.mp3
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"format":"mp3","content_type":"audio/mpeg","orientation":0,"duration":13536,"has_video":false,"has_audio":true}
|
||||||
BIN
testdata/no_cover.mp3
vendored
Normal file
BIN
testdata/no_cover.mp3
vendored
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue