func newCAVDictionaryArrayFromDictionarySlice(dicts []*avutil.Dictionary) **C.AVDictionary { arr := C.go_av_alloc_dicts(C.int(len(dicts))) for i := range dicts { if dicts[i] == nil { dicts[i] = avutil.NewDictionary() } C.go_av_dicts_set(arr, C.int(i), (*C.AVDictionary)(dicts[i].CAVDictionary)) } return nil }
func TestContextOpenInputWithOptions(t *testing.T) { ctx, _ := NewContextForInput() defer ctx.Free() fixture := fixturePath("sample_mpeg4.mp4") options := avutil.NewDictionary() defer options.Free() options.Set("foo", "1") options.Set("export_all", "1") options.Set("bar", "1") err := ctx.OpenInput(fixture, nil, options) if err != nil { t.Fatal(err) } defer ctx.CloseInput() // consumed options disappear from the dictionary m := options.Map() if !reflect.DeepEqual(m, map[string]string{"foo": "1", "bar": "1"}) { t.Fatalf("Expecting map but got %v", m) } }
func (ctx *Context) Init() error { dict := avutil.NewDictionary() return ctx.InitWithDictionary(dict) }