mirror of
https://github.com/asticode/go-astiav.git
synced 2024-05-28 13:53:18 +08:00
e5d0d37991
* Add avdevice support * Format Adjustment: DeviceRegisterAll renamed to RegisterAllDevices Move FindInputFormat position Add Name(), LongName(), String() methods to InputFormat Adjust TestInputFormat test
42 lines
915 B
Go
42 lines
915 B
Go
package astiav
|
|
|
|
//#cgo pkg-config: libavformat
|
|
//#include <libavformat/avformat.h>
|
|
import "C"
|
|
import "unsafe"
|
|
|
|
// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavformat/avformat.h#L650
|
|
type InputFormat struct {
|
|
c *C.struct_AVInputFormat
|
|
}
|
|
|
|
func newInputFormatFromC(c *C.struct_AVInputFormat) *InputFormat {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return &InputFormat{c: c}
|
|
}
|
|
|
|
func FindInputFormat(name string) *InputFormat {
|
|
cname := C.CString(name)
|
|
defer C.free(unsafe.Pointer(cname))
|
|
return newInputFormatFromC(C.av_find_input_format(cname))
|
|
}
|
|
|
|
func (f *InputFormat) Flags() IOFormatFlags {
|
|
return IOFormatFlags(f.c.flags)
|
|
}
|
|
|
|
func (f *InputFormat) Name() string {
|
|
return C.GoString(f.c.name)
|
|
}
|
|
|
|
// LongName Description of the format, meant to be more human-readable than Name.
|
|
func (f *InputFormat) LongName() string {
|
|
return C.GoString(f.c.long_name)
|
|
}
|
|
|
|
func (f *InputFormat) String() string {
|
|
return f.Name()
|
|
}
|