Remove io interrupter interface

This commit is contained in:
Quentin Renard
2024-03-01 16:15:03 +01:00
parent 66486624e0
commit d3d2df833b
2 changed files with 5 additions and 11 deletions

View File

@@ -84,7 +84,7 @@ func (fc *FormatContext) Flags() FormatContextFlags {
return FormatContextFlags(fc.c.flags) return FormatContextFlags(fc.c.flags)
} }
func (fc *FormatContext) SetInterruptCallback() IOInterrupter { func (fc *FormatContext) SetInterruptCallback() *IOInterrupter {
i := newIOInterrupter() i := newIOInterrupter()
fc.c.interrupt_callback = i.c fc.c.interrupt_callback = i.c
return i return i

View File

@@ -15,23 +15,17 @@ AVIOInterruptCB astiavNewInterruptCallback(int *ret)
*/ */
import "C" import "C"
type IOInterrupter interface { type IOInterrupter struct {
Interrupt()
}
var _ IOInterrupter = (*ioInterrupter)(nil)
type ioInterrupter struct {
c C.struct_AVIOInterruptCB c C.struct_AVIOInterruptCB
i C.int i C.int
} }
func newIOInterrupter() *ioInterrupter { func newIOInterrupter() *IOInterrupter {
cb := &ioInterrupter{} cb := &IOInterrupter{}
cb.c = C.astiavNewInterruptCallback(&cb.i) cb.c = C.astiavNewInterruptCallback(&cb.i)
return cb return cb
} }
func (cb *ioInterrupter) Interrupt() { func (cb *IOInterrupter) Interrupt() {
cb.i = 1 cb.i = 1
} }