test: ffmpeg meta and export golden tests

This commit is contained in:
Adrian Shum 2022-09-16 01:37:55 +08:00 committed by GitHub
parent feb4a1f3db
commit bb48a1e717
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 34 deletions

View file

@ -2,10 +2,6 @@ package ffmpeg
// #include "ffmpeg.h"
import "C"
import (
"strconv"
"unsafe"
)
type avError int
@ -19,19 +15,20 @@ const (
)
func (e avError) errorString() string {
if e == ErrNoMem {
switch e {
case ErrNoMem:
return "cannot allocate memory"
}
if e == ErrTooBig {
case ErrTooBig:
return "video or cover art size exceeds maximum allowed dimensions"
case ErrEOF:
return "end of file"
case ErrDecoderNotFound:
return "decoder not found"
case ErrInvalidData:
return "invalid data found when processing input"
default:
return "unknown error occurred"
}
errString := (*C.char)(C.av_malloc(C.AV_ERROR_MAX_STRING_SIZE))
if errString == nil {
return "cannot allocate memory for error string, error code: " + strconv.Itoa(int(e))
}
defer C.av_free(unsafe.Pointer(errString))
C.av_make_error_string(errString, C.AV_ERROR_MAX_STRING_SIZE, C.int(e))
return C.GoString(errString)
}
func (e avError) Error() string {