This commit is contained in:
alex
2018-06-25 22:09:27 +02:00
parent 3090633225
commit 8879054f49
3 changed files with 9 additions and 7 deletions

View File

@@ -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 {

View File

@@ -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

View File

@@ -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