mirror of
https://github.com/3d0c/gmf
synced 2025-12-24 10:40:59 +08:00
go vet
This commit is contained in:
@@ -43,7 +43,7 @@ func TestCodecCtx(t *testing.T) {
|
||||
}
|
||||
|
||||
if cc.TimeBase().AVR().Num != td.timebase.Num || cc.TimeBase().AVR().Den != td.timebase.Den {
|
||||
t.Fatal("Expected AVR = %v, %v got", cc.TimeBase().AVR())
|
||||
t.Fatalf("Expected AVR = %v, %v got", cc.TimeBase().AVR(), td.timebase)
|
||||
}
|
||||
|
||||
if cc.PixFmt() != td.pixfmt {
|
||||
|
||||
8
dict.go
8
dict.go
@@ -4,6 +4,7 @@ package gmf
|
||||
|
||||
#cgo pkg-config: libavutil
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "libavutil/dict.h"
|
||||
|
||||
*/
|
||||
@@ -11,6 +12,7 @@ import "C"
|
||||
|
||||
import (
|
||||
"log"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type Pair struct {
|
||||
@@ -30,11 +32,11 @@ func NewDict(pairs []Pair) *Dict {
|
||||
cval := C.CString(pair.Val)
|
||||
|
||||
if ret := C.av_dict_set(&this.avDict, ckey, cval, 0); int(ret) < 0 {
|
||||
log.Printf("unable to set key '%s' value '%d', error: %s\n", pair.Key, pair.Val, AvError(int(ret)))
|
||||
log.Printf("unable to set key '%v' value '%v', error: %s\n", pair.Key, pair.Val, AvError(int(ret)))
|
||||
}
|
||||
|
||||
// C.free(unsafe.Pointer(ckey))
|
||||
// C.free(unsafe.Pointer(cval))
|
||||
C.free(unsafe.Pointer(ckey))
|
||||
C.free(unsafe.Pointer(cval))
|
||||
}
|
||||
|
||||
return this
|
||||
|
||||
@@ -213,20 +213,20 @@ func TestAVIOContext(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func ExampleNewAVIOContext(t *testing.T) {
|
||||
func ExampleNewAVIOContext() {
|
||||
ctx := NewCtx()
|
||||
defer Release(ctx)
|
||||
|
||||
// In this example, we're using custom reader implementation,
|
||||
// so we should specify format manually.
|
||||
if err := ctx.SetInputFormat("mov"); err != nil {
|
||||
t.Fatal(err)
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
avioCtx, err := NewAVIOContext(ctx, &AVIOHandlers{ReadPacket: customReader})
|
||||
defer Release(avioCtx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Setting up AVFormatContext.pb
|
||||
|
||||
Reference in New Issue
Block a user