From d3d2df833bcd11f9f862ee4a0cd42f02afc314cd Mon Sep 17 00:00:00 2001 From: Quentin Renard Date: Fri, 1 Mar 2024 16:15:03 +0100 Subject: [PATCH] Remove io interrupter interface --- format_context.go | 2 +- io_interrupter.go | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/format_context.go b/format_context.go index e736130..b3d7581 100644 --- a/format_context.go +++ b/format_context.go @@ -84,7 +84,7 @@ func (fc *FormatContext) Flags() FormatContextFlags { return FormatContextFlags(fc.c.flags) } -func (fc *FormatContext) SetInterruptCallback() IOInterrupter { +func (fc *FormatContext) SetInterruptCallback() *IOInterrupter { i := newIOInterrupter() fc.c.interrupt_callback = i.c return i diff --git a/io_interrupter.go b/io_interrupter.go index e60ded5..59b250c 100644 --- a/io_interrupter.go +++ b/io_interrupter.go @@ -15,23 +15,17 @@ AVIOInterruptCB astiavNewInterruptCallback(int *ret) */ import "C" -type IOInterrupter interface { - Interrupt() -} - -var _ IOInterrupter = (*ioInterrupter)(nil) - -type ioInterrupter struct { +type IOInterrupter struct { c C.struct_AVIOInterruptCB i C.int } -func newIOInterrupter() *ioInterrupter { - cb := &ioInterrupter{} +func newIOInterrupter() *IOInterrupter { + cb := &IOInterrupter{} cb.c = C.astiavNewInterruptCallback(&cb.i) return cb } -func (cb *ioInterrupter) Interrupt() { +func (cb *IOInterrupter) Interrupt() { cb.i = 1 }