mirror of
https://github.com/giorgisio/goav.git
synced 2024-04-21 12:31:56 +00:00
Go like naming; Readme updates
This commit is contained in:
@@ -3,6 +3,8 @@ Golang binding for FFmpeg
|
||||
|
||||
A comprehensive binding to the ffmpeg video/audio manipulation library.
|
||||
|
||||
[](https://godoc.org/github.com/giorgisio/goav)
|
||||
|
||||
## Usage
|
||||
|
||||
`````go
|
||||
|
||||
+13
-13
@@ -30,62 +30,62 @@ type (
|
||||
)
|
||||
|
||||
//unsigned avdevice_version (void)
|
||||
func Avdevice_version() uint {
|
||||
func AvdeviceVersion() uint {
|
||||
return uint(C.avdevice_version())
|
||||
}
|
||||
|
||||
//Return the libavdevice build-time configuration.
|
||||
func Avdevice_configuration() string {
|
||||
func AvdeviceConfiguration() string {
|
||||
return C.GoString(C.avdevice_configuration())
|
||||
}
|
||||
|
||||
//Return the libavdevice license.
|
||||
func Avdevice_license() string {
|
||||
func AvdeviceLicense() string {
|
||||
return C.GoString(C.avdevice_license())
|
||||
}
|
||||
|
||||
//Initialize libavdevice and register all the input and output devices.
|
||||
func Avdevice_register_all() {
|
||||
func AvdeviceRegisterAll() {
|
||||
C.avdevice_register_all()
|
||||
}
|
||||
|
||||
//Send control message from application to device.
|
||||
func Avdevice_app_to_dev_control_message(s *AvFormatContext, m AvAppToDevMessageType, da int, d uintptr) int {
|
||||
func AvdeviceAppToDevControlMessage(s *AvFormatContext, m AvAppToDevMessageType, da int, d uintptr) int {
|
||||
return int(C.avdevice_app_to_dev_control_message((*C.struct_AVFormatContext)(s), (C.enum_AVAppToDevMessageType)(m), unsafe.Pointer(&da), C.size_t(d)))
|
||||
}
|
||||
|
||||
//Send control message from device to application.
|
||||
func Avdevice_dev_to_app_control_message(fcxt *AvFormatContext, m AvDevToAppMessageType, da int, d uintptr) int {
|
||||
func AvdeviceDevToAppControlMessage(fcxt *AvFormatContext, m AvDevToAppMessageType, da int, d uintptr) int {
|
||||
return int(C.avdevice_dev_to_app_control_message((*C.struct_AVFormatContext)(fcxt), (C.enum_AVDevToAppMessageType)(m), unsafe.Pointer(&da), C.size_t(d)))
|
||||
}
|
||||
|
||||
//Initialize capabilities probing API based on AvOption API.
|
||||
func Avdevice_capabilities_create(c **AvDeviceCapabilitiesQuery, s *AvFormatContext, d **Dictionary) int {
|
||||
func AvdeviceCapabilitiesCreate(c **AvDeviceCapabilitiesQuery, s *AvFormatContext, d **Dictionary) int {
|
||||
return int(C.avdevice_capabilities_create((**C.struct_AVDeviceCapabilitiesQuery)(unsafe.Pointer(c)), (*C.struct_AVFormatContext)(s), (**C.struct_AVDictionary)(unsafe.Pointer(d))))
|
||||
}
|
||||
|
||||
//Free resources created by avdevice_capabilities_create()
|
||||
func Avdevice_capabilities_free(c **AvDeviceCapabilitiesQuery, s *AvFormatContext) {
|
||||
func AvdeviceCapabilitiesFree(c **AvDeviceCapabilitiesQuery, s *AvFormatContext) {
|
||||
C.avdevice_capabilities_free((**C.struct_AVDeviceCapabilitiesQuery)(unsafe.Pointer(c)), (*C.struct_AVFormatContext)(s))
|
||||
}
|
||||
|
||||
//List devices.
|
||||
func Avdevice_list_devices(s *AvFormatContext, d **AvDeviceInfoList) int {
|
||||
func AvdeviceListDevices(s *AvFormatContext, d **AvDeviceInfoList) int {
|
||||
return int(C.avdevice_list_devices((*C.struct_AVFormatContext)(s), (**C.struct_AVDeviceInfoList)(unsafe.Pointer(d))))
|
||||
}
|
||||
|
||||
//Convenient function to free result of avdevice_list_devices().
|
||||
func Avdevice_free_list_devices(d **AvDeviceInfoList) {
|
||||
//Convenient function to free result of avdeviceListDevices().
|
||||
func AvdeviceFreeListDevices(d **AvDeviceInfoList) {
|
||||
C.avdevice_free_list_devices((**C.struct_AVDeviceInfoList)(unsafe.Pointer(d)))
|
||||
}
|
||||
|
||||
// //int avdevice_list_input_sources (struct InputFormat *device, const char *device_name, Dictionary *device_options, AvDeviceInfoList **device_list)
|
||||
// //List devices.
|
||||
// func Avdevice_list_input_sources(d *InputFormat, dv string, do *Dictionary, dl **AvDeviceInfoList) int {
|
||||
// func AvdeviceListInputSources(d *InputFormat, dv string, do *Dictionary, dl **AvDeviceInfoList) int {
|
||||
// return int(C.avdevice_list_input_sources((*C.struct_AVInputFormat)(d), C.CString(dv), (*C.struct_AVDictionary)(do), (**C.struct_AVDeviceInfoList)(unsafe.Pointer(dl))))
|
||||
// }
|
||||
|
||||
// //int avdevice_list_output_sinks (struct OutputFormat *device, const char *device_name, Dictionary *device_options, AvDeviceInfoList **device_list)
|
||||
// func Avdevice_list_output_sinks(d *OutputFormat, dn string, di *Dictionary, dl **AvDeviceInfoList) int {
|
||||
// func AvdeviceListOutputSinks(d *OutputFormat, dn string, di *Dictionary, dl **AvDeviceInfoList) int {
|
||||
// return int(C.avdevice_list_output_sinks((*C.struct_AVOutputFormat)(d), C.CString(dn), (*C.struct_AVDictionary)(di), (**C.struct_AVDeviceInfoList)(unsafe.Pointer(dl))))
|
||||
// }
|
||||
|
||||
+34
-71
@@ -26,224 +26,187 @@ type (
|
||||
MediaType C.enum_AVMediaType
|
||||
)
|
||||
|
||||
//unsigned avfilter_version (void)
|
||||
//Return the LIBAvFILTER_VERSION_INT constant.
|
||||
func Avfilter_version() uint {
|
||||
func AvfilterVersion() uint {
|
||||
return uint(C.avfilter_version())
|
||||
}
|
||||
|
||||
//const char * avfilter_configuration (void)
|
||||
//Return the libavfilter build-time configuration.
|
||||
func Avfilter_configuration() string {
|
||||
func AvfilterConfiguration() string {
|
||||
return C.GoString(C.avfilter_configuration())
|
||||
}
|
||||
|
||||
//const char * avfilter_license (void)
|
||||
//Return the libavfilter license.
|
||||
func Avfilter_license() string {
|
||||
func AvfilterLicense() string {
|
||||
return C.GoString(C.avfilter_license())
|
||||
}
|
||||
|
||||
//int avfilter_pad_count (const Pad *pads)
|
||||
//Get the number of elements in a NULL-terminated array of Pads (e.g.
|
||||
func Avfilter_pad_count(p *Pad) int {
|
||||
func AvfilterPadCount(p *Pad) int {
|
||||
return int(C.avfilter_pad_count((*C.struct_AVFilterPad)(p)))
|
||||
}
|
||||
|
||||
//const char * avfilter_pad_get_name (const Pad *pads, int pad_idx)
|
||||
//Get the name of an Pad.
|
||||
func Avfilter_pad_get_name(p *Pad, pi int) string {
|
||||
func AvfilterPadGetName(p *Pad, pi int) string {
|
||||
return C.GoString(C.avfilter_pad_get_name((*C.struct_AVFilterPad)(p), C.int(pi)))
|
||||
}
|
||||
|
||||
//enum MediaType avfilter_pad_get_type (const Pad *pads, int pad_idx)
|
||||
//Get the type of an Pad.
|
||||
func Avfilter_pad_get_type(p *Pad, pi int) MediaType {
|
||||
func AvfilterPadGetType(p *Pad, pi int) MediaType {
|
||||
return (MediaType)(C.avfilter_pad_get_type((*C.struct_AVFilterPad)(p), C.int(pi)))
|
||||
}
|
||||
|
||||
//int avfilter_link (Context *src, unsigned srcpad, Context *dst, unsigned dstpad)
|
||||
//Link two filters together.
|
||||
func Avfilter_link(s *Context, sp uint, d *Context, dp uint) int {
|
||||
func AvfilterLink(s *Context, sp uint, d *Context, dp uint) int {
|
||||
return int(C.avfilter_link((*C.struct_AVFilterContext)(s), C.uint(sp), (*C.struct_AVFilterContext)(d), C.uint(dp)))
|
||||
}
|
||||
|
||||
//void avfilter_link_free (Link **link)
|
||||
//Free the link in *link, and set its pointer to NULL.
|
||||
func Avfilter_link_free(l **Link) {
|
||||
func AvfilterLinkFree(l **Link) {
|
||||
C.avfilter_link_free((**C.struct_AVFilterLink)(unsafe.Pointer(l)))
|
||||
}
|
||||
|
||||
//int avfilter_link_get_channels (Link *link)
|
||||
//Get the number of channels of a link.
|
||||
func Avfilter_link_get_channels(l *Link) int {
|
||||
func AvfilterLinkGetChannels(l *Link) int {
|
||||
return int(C.avfilter_link_get_channels((*C.struct_AVFilterLink)(l)))
|
||||
}
|
||||
|
||||
//void avfilter_link_set_closed (Link *link, int closed)
|
||||
//Set the closed field of a link.
|
||||
func Avfilter_link_set_closed(l *Link, c int) {
|
||||
func AvfilterLinkSetClosed(l *Link, c int) {
|
||||
C.avfilter_link_set_closed((*C.struct_AVFilterLink)(l), C.int(c))
|
||||
}
|
||||
|
||||
//int avfilter_config_links (Context *filter)
|
||||
//Negotiate the media format, dimensions, etc of all inputs to a filter.
|
||||
func Avfilter_config_links(f *Context) int {
|
||||
func AvfilterConfigLinks(f *Context) int {
|
||||
return int(C.avfilter_config_links((*C.struct_AVFilterContext)(f)))
|
||||
}
|
||||
|
||||
//int avfilter_process_command (Context *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
|
||||
//Make the filter instance process a command.
|
||||
func Avfilter_process_command(f *Context, cmd, arg, res string, l, fl int) int {
|
||||
func AvfilterProcessCommand(f *Context, cmd, arg, res string, l, fl int) int {
|
||||
return int(C.avfilter_process_command((*C.struct_AVFilterContext)(f), C.CString(cmd), C.CString(arg), C.CString(res), C.int(l), C.int(fl)))
|
||||
}
|
||||
|
||||
//void avfilter_register_all (void)
|
||||
//Initialize the filter system.
|
||||
func Avfilter_register_all() {
|
||||
func AvfilterRegisterAll() {
|
||||
C.avfilter_register_all()
|
||||
}
|
||||
|
||||
//int avfilter_register (Filter *filter)
|
||||
//Register a filter.
|
||||
func Avfilter_register(f *Filter) int {
|
||||
func AvfilterRegister(f *Filter) int {
|
||||
return int(C.avfilter_register((*C.struct_AVFilter)(f)))
|
||||
}
|
||||
|
||||
//const Filter * avfilter_get_by_name (const char *name)
|
||||
//Get a filter definition matching the given name.
|
||||
func Avfilter_get_by_name(n string) *Filter {
|
||||
func AvfilterGetByName(n string) *Filter {
|
||||
return (*Filter)(C.avfilter_get_by_name(C.CString(n)))
|
||||
}
|
||||
|
||||
//const Filter * avfilter_next (const Filter *prev)
|
||||
//Iterate over all registered filters.
|
||||
func Avfilter_next(f *Filter) *Filter {
|
||||
func AvfilterNext(f *Filter) *Filter {
|
||||
return (*Filter)(C.avfilter_next((*C.struct_AVFilter)(f)))
|
||||
}
|
||||
|
||||
//int avfilter_init_str (Context *ctx, const char *args)
|
||||
//Initialize a filter with the supplied parameters.
|
||||
func (ctx *Context) AvfilterInitStr(args string) int {
|
||||
return int(C.avfilter_init_str((*C.struct_AVFilterContext)(ctx), C.CString(args)))
|
||||
}
|
||||
|
||||
//int avfilter_init_dict (Context *ctx, Dictionary **options)
|
||||
//Initialize a filter with the supplied dictionary of options.
|
||||
func (ctx *Context) AvfilterInitDict(o **Dictionary) int {
|
||||
return int(C.avfilter_init_dict((*C.struct_AVFilterContext)(ctx), (**C.struct_AVDictionary)(unsafe.Pointer(o))))
|
||||
}
|
||||
|
||||
//void avfilter_free (Context *filter)
|
||||
//Free a filter context.
|
||||
func (ctx *Context) AvfilterFree() {
|
||||
C.avfilter_free((*C.struct_AVFilterContext)(ctx))
|
||||
}
|
||||
|
||||
//int avfilter_insert_filter (Link *link, Context *filt, unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
|
||||
//Insert a filter in the middle of an existing link.
|
||||
func Avfilter_insert_filter(l *Link, f *Context, fsi, fdi uint) int {
|
||||
func AvfilterInsertFilter(l *Link, f *Context, fsi, fdi uint) int {
|
||||
return int(C.avfilter_insert_filter((*C.struct_AVFilterLink)(l), (*C.struct_AVFilterContext)(f), C.uint(fsi), C.uint(fdi)))
|
||||
}
|
||||
|
||||
//const Class * avfilter_get_class (void)
|
||||
//avfilter_get_class
|
||||
func Avfilter_get_class() *Class {
|
||||
func AvfilterGetClass() *Class {
|
||||
return (*Class)(C.avfilter_get_class())
|
||||
}
|
||||
|
||||
//Allocate a filter graph.
|
||||
//Graph * avfilter_graph_alloc (void)
|
||||
func Avfilter_graph_alloc() *Graph {
|
||||
func AvfilterGraphAlloc() *Graph {
|
||||
return (*Graph)(C.avfilter_graph_alloc())
|
||||
}
|
||||
|
||||
//Context * avfilter_graph_alloc_filter (Graph *graph, const Filter *filter, const char *name)
|
||||
//Create a new filter instance in a filter graph.
|
||||
func Avfilter_graph_alloc_filter(g *Graph, f *Filter, n string) *Context {
|
||||
func AvfilterGraphAllocFilter(g *Graph, f *Filter, n string) *Context {
|
||||
return (*Context)(C.avfilter_graph_alloc_filter((*C.struct_AVFilterGraph)(g), (*C.struct_AVFilter)(f), C.CString(n)))
|
||||
}
|
||||
|
||||
//Context * avfilter_graph_get_filter (Graph *graph, const char *name)
|
||||
//Get a filter instance identified by instance name from graph.
|
||||
func Avfilter_graph_get_filter(g *Graph, n string) *Context {
|
||||
func AvfilterGraphGetFilter(g *Graph, n string) *Context {
|
||||
return (*Context)(C.avfilter_graph_get_filter((*C.struct_AVFilterGraph)(g), C.CString(n)))
|
||||
}
|
||||
|
||||
//int avfilter_graph_create_filter (Context **filt_ctx, const Filter *filt, const char *name, const char *args, void *opaque, Graph *graph_ctx)
|
||||
//Create and add a filter instance into an existing graph.
|
||||
func Avfilter_graph_create_filter(cx **Context, f *Filter, n, a string, o int, g *Graph) int {
|
||||
func AvfilterGraphCreateFilter(cx **Context, f *Filter, n, a string, o int, g *Graph) int {
|
||||
return int(C.avfilter_graph_create_filter((**C.struct_AVFilterContext)(unsafe.Pointer(cx)), (*C.struct_AVFilter)(f), C.CString(n), C.CString(a), unsafe.Pointer(&o), (*C.struct_AVFilterGraph)(g)))
|
||||
}
|
||||
|
||||
//void avfilter_graph_set_auto_convert (Graph *graph, unsigned flags)
|
||||
//Enable or disable automatic format conversion inside the graph.
|
||||
func Avfilter_graph_set_auto_convert(g *Graph, f uint) {
|
||||
func AvfilterGraphSetAutoConvert(g *Graph, f uint) {
|
||||
C.avfilter_graph_set_auto_convert((*C.struct_AVFilterGraph)(g), C.uint(f))
|
||||
}
|
||||
|
||||
//int avfilter_graph_config (Graph *graphctx, void *log_ctx)
|
||||
//Check validity and configure all the links and formats in the graph.
|
||||
func Avfilter_graph_config(g *Graph, l int) int {
|
||||
func AvfilterGraphConfig(g *Graph, l int) int {
|
||||
return int(C.avfilter_graph_config((*C.struct_AVFilterGraph)(g), unsafe.Pointer(&l)))
|
||||
}
|
||||
|
||||
//void avfilter_graph_free (Graph **graph)
|
||||
//Free a graph, destroy its links, and set *graph to NULL.
|
||||
func Avfilter_graph_free(g **Graph) {
|
||||
func AvfilterGraphFree(g **Graph) {
|
||||
C.avfilter_graph_free((**C.struct_AVFilterGraph)(unsafe.Pointer(g)))
|
||||
}
|
||||
|
||||
//Input * avfilter_inout_alloc (void)
|
||||
//Allocate a single Input entry.
|
||||
func Avfilter_inout_alloc() *Input {
|
||||
func AvfilterInoutAlloc() *Input {
|
||||
return (*Input)(C.avfilter_inout_alloc())
|
||||
}
|
||||
|
||||
//void avfilter_inout_free (Input **inout)
|
||||
//Free the supplied list of Input and set *inout to NULL.
|
||||
func Avfilter_inout_free(i **Input) {
|
||||
func AvfilterInoutFree(i **Input) {
|
||||
C.avfilter_inout_free((**C.struct_AVFilterInOut)(unsafe.Pointer(i)))
|
||||
}
|
||||
|
||||
//int avfilter_graph_parse (Graph *graph, const char *filters, Input *inputs, Input *outputs, void *log_ctx)
|
||||
//Add a graph described by a string to a graph.
|
||||
func Avfilter_graph_parse(g *Graph, f string, i, o *Input, l int) int {
|
||||
func AvfilterGraphParse(g *Graph, f string, i, o *Input, l int) int {
|
||||
return int(C.avfilter_graph_parse((*C.struct_AVFilterGraph)(g), C.CString(f), (*C.struct_AVFilterInOut)(i), (*C.struct_AVFilterInOut)(o), unsafe.Pointer(&l)))
|
||||
}
|
||||
|
||||
//int avfilter_graph_parse_ptr (Graph *graph, const char *filters, Input **inputs, Input **outputs, void *log_ctx)
|
||||
//Add a graph described by a string to a graph.
|
||||
func Avfilter_graph_parse_ptr(g *Graph, f string, i, o **Input, l int) int {
|
||||
func AvfilterGraphParsePtr(g *Graph, f string, i, o **Input, l int) int {
|
||||
return int(C.avfilter_graph_parse_ptr((*C.struct_AVFilterGraph)(g), C.CString(f), (**C.struct_AVFilterInOut)(unsafe.Pointer(i)), (**C.struct_AVFilterInOut)(unsafe.Pointer(o)), unsafe.Pointer(&l)))
|
||||
}
|
||||
|
||||
//int avfilter_graph_parse2 (Graph *graph, const char *filters, Input **inputs, Input **outputs)
|
||||
//Add a graph described by a string to a graph.
|
||||
func Avfilter_graph_parse2(g *Graph, f string, i, o **Input) int {
|
||||
func AvfilterGraphParse2(g *Graph, f string, i, o **Input) int {
|
||||
return int(C.avfilter_graph_parse2((*C.struct_AVFilterGraph)(g), C.CString(f), (**C.struct_AVFilterInOut)(unsafe.Pointer(i)), (**C.struct_AVFilterInOut)(unsafe.Pointer(o))))
|
||||
}
|
||||
|
||||
//int avfilter_graph_send_command (Graph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags)
|
||||
//Send a command to one or more filter instances.
|
||||
func Avfilter_graph_send_command(g *Graph, t, cmd, arg, res string, resl, f int) int {
|
||||
func AvfilterGraphSendCommand(g *Graph, t, cmd, arg, res string, resl, f int) int {
|
||||
return int(C.avfilter_graph_send_command((*C.struct_AVFilterGraph)(g), C.CString(t), C.CString(cmd), C.CString(arg), C.CString(res), C.int(resl), C.int(f)))
|
||||
}
|
||||
|
||||
//int avfilter_graph_queue_command (Graph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts)
|
||||
//Queue a command for one or more filter instances.
|
||||
func Avfilter_graph_queue_command(g *Graph, t, cmd, arg string, f int, ts C.double) int {
|
||||
func AvfilterGraphQueueCommand(g *Graph, t, cmd, arg string, f int, ts C.double) int {
|
||||
return int(C.avfilter_graph_queue_command((*C.struct_AVFilterGraph)(g), C.CString(t), C.CString(cmd), C.CString(arg), C.int(f), ts))
|
||||
}
|
||||
|
||||
//char * avfilter_graph_dump (Graph *graph, const char *options)
|
||||
//Dump a graph into a human-readable string representation.
|
||||
func Avfilter_graph_dump(g *Graph, o string) string {
|
||||
func AvfilterGraphDump(g *Graph, o string) string {
|
||||
return C.GoString(C.avfilter_graph_dump((*C.struct_AVFilterGraph)(g), C.CString(o)))
|
||||
}
|
||||
|
||||
//int avfilter_graph_request_oldest (Graph *graph)
|
||||
//Request a frame on the oldest sink
|
||||
func Avfilter_graph_request_oldestlink(g *Graph) int {
|
||||
func AvfilterGraphRequestOldestlink(g *Graph) int {
|
||||
return int(C.avfilter_graph_request_oldest((*C.struct_AVFilterGraph)(g)))
|
||||
}
|
||||
|
||||
+145
-184
@@ -12,71 +12,187 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
//int av_format_get_probe_score (const Context *s)
|
||||
func (s *Context) AvFormatGetProbeScore() int {
|
||||
return int(C.av_format_get_probe_score((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//AvCodec * av_format_get_video_codec (const Context *s)
|
||||
func (s *Context) AvFormatGetVideoCodec() *AvCodec {
|
||||
return (*AvCodec)(C.av_format_get_video_codec((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//void av_format_set_video_codec (Context *s, AvCodec *c)
|
||||
func (s *Context) AvFormatSetVideoCodec(c *AvCodec) {
|
||||
C.av_format_set_video_codec((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c))
|
||||
}
|
||||
|
||||
//AvCodec * av_format_get_audio_codec (const Context *s)
|
||||
func (s *Context) AvFormatGetAudioCodec() *AvCodec {
|
||||
return (*AvCodec)(C.av_format_get_audio_codec((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//void av_format_set_audio_codec (Context *s, AvCodec *c)
|
||||
func (s *Context) AvFormatSetAudioCodec(c *AvCodec) {
|
||||
C.av_format_set_audio_codec((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c))
|
||||
}
|
||||
|
||||
//AvCodec * av_format_get_subtitle_codec (const Context *s)
|
||||
func (s *Context) AvFormatGetSubtitleCodec() *AvCodec {
|
||||
return (*AvCodec)(C.av_format_get_subtitle_codec((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//void av_format_set_subtitle_codec (Context *s, AvCodec *c)
|
||||
func (s *Context) AvFormatSetSubtitleCodec(c *AvCodec) {
|
||||
C.av_format_set_subtitle_codec((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c))
|
||||
}
|
||||
|
||||
// //AvCodec * av_format_get_data_codec (const Context *s)
|
||||
// func (s *Context)AvFormatGetDataCodec() *AvCodec {
|
||||
// return (*AvCodec)(C.av_format_get_data_codec((*C.struct_AVFormatContext)(s)))
|
||||
// }
|
||||
|
||||
// //void av_format_set_data_codec (Context *s, AvCodec *c)
|
||||
// func (s *Context)AvFormatSetDataCodec( c *AvCodec) {
|
||||
// C.av_format_set_data_codec((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c))
|
||||
// }
|
||||
|
||||
//int av_format_get_metadata_header_padding (const Context *s)
|
||||
func (s *Context) AvFormatGetMetadataHeaderPadding() int {
|
||||
return int(C.av_format_get_metadata_header_padding((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//void av_format_set_metadata_header_padding (Context *s, int c)
|
||||
func (s *Context) AvFormatSetMetadataHeaderPadding(c int) {
|
||||
C.av_format_set_metadata_header_padding((*C.struct_AVFormatContext)(s), C.int(c))
|
||||
}
|
||||
|
||||
//void * av_format_get_opaque (const Context *s)
|
||||
func (s *Context) AvFormatGetOpaque() {
|
||||
C.av_format_get_opaque((*C.struct_AVFormatContext)(s))
|
||||
}
|
||||
|
||||
//void av_format_set_opaque (Context *s, void *opaque)
|
||||
func (s *Context) AvFormatSetOpaque(o int) {
|
||||
C.av_format_set_opaque((*C.struct_AVFormatContext)(s), unsafe.Pointer(&o))
|
||||
}
|
||||
|
||||
//This function will cause global side data to be injected in the next packet of each stream as well as after any subsequent seek.
|
||||
func (s *Context) AvFormatInjectGlobalSideData() {
|
||||
C.av_format_inject_global_side_data((*C.struct_AVFormatContext)(s))
|
||||
}
|
||||
|
||||
//Returns the method used to set ctx->duration.
|
||||
func (s *Context) AvFmtCtxGetDurationEstimationMethod() AvDurationEstimationMethod {
|
||||
return (AvDurationEstimationMethod)(C.av_fmt_ctx_get_duration_estimation_method((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//Free an Context and all its streams.
|
||||
func (s *Context) AvformatFreeContext() {
|
||||
C.avformat_free_context((*C.struct_AVFormatContext)(s))
|
||||
}
|
||||
|
||||
//Add a new stream to a media file.
|
||||
func (s *Context) AvformatNewStream(c *AvCodec) *Stream {
|
||||
return (*Stream)(C.avformat_new_stream((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c)))
|
||||
}
|
||||
|
||||
func (s *Context) AvNewProgram(id int) *AvProgram {
|
||||
return (*AvProgram)(C.av_new_program((*C.struct_AVFormatContext)(s), C.int(id)))
|
||||
}
|
||||
|
||||
//Read packets of a media file to get stream information.
|
||||
func (s *Context) AvformatFindStreamInfo(d **Dictionary) int {
|
||||
return int(C.avformat_find_stream_info((*C.struct_AVFormatContext)(s), (**C.struct_AVDictionary)(unsafe.Pointer(d))))
|
||||
}
|
||||
|
||||
//Find the programs which belong to a given stream.
|
||||
func (s *Context) AvFindProgramFromStream(l *AvProgram, su int) *AvProgram {
|
||||
return (*AvProgram)(C.av_find_program_from_stream((*C.struct_AVFormatContext)(s), (*C.struct_AVProgram)(l), C.int(su)))
|
||||
}
|
||||
|
||||
//Find the "best" stream in the file.
|
||||
func AvFindBestStream(ic *Context, t MediaType, ws, rs int, c **AvCodec, f int) int {
|
||||
return int(C.av_find_best_stream((*C.struct_AVFormatContext)(ic), (C.enum_AVMediaType)(t), C.int(ws), C.int(rs), (**C.struct_AVCodec)(unsafe.Pointer(c)), C.int(f)))
|
||||
}
|
||||
|
||||
//Return the next frame of a stream.
|
||||
func (s *Context) AvReadFrame(pkt *avcodec.Packet) int {
|
||||
return int(C.av_read_frame((*C.struct_AVFormatContext)(unsafe.Pointer(s)), (*C.struct_AVPacket)(unsafe.Pointer(pkt))))
|
||||
}
|
||||
|
||||
//Seek to the keyframe at timestamp.
|
||||
func (s *Context) AvSeekFrame(st int, t int64, f int) int {
|
||||
return int(C.av_seek_frame((*C.struct_AVFormatContext)(s), C.int(st), C.int64_t(t), C.int(f)))
|
||||
}
|
||||
|
||||
//Seek to timestamp ts.
|
||||
func (s *Context) AvformatSeekFile(si int, mit, ts, mat int64, f int) int {
|
||||
return int(C.avformat_seek_file((*C.struct_AVFormatContext)(s), C.int(si), C.int64_t(mit), C.int64_t(ts), C.int64_t(mat), C.int(f)))
|
||||
}
|
||||
|
||||
//Start playing a network-based stream (e.g.
|
||||
func (s *Context) AvReadPlay() int {
|
||||
return int(C.av_read_play((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//Pause a network-based stream (e.g.
|
||||
func (s *Context) AvReadPause() int {
|
||||
return int(C.av_read_pause((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//Close an opened input Context.
|
||||
func (s *Context) AvformatCloseInput() {
|
||||
C.avformat_close_input((**C.struct_AVFormatContext)(unsafe.Pointer(s)))
|
||||
}
|
||||
|
||||
//Allocate the stream private data and write the stream header to an output media file.
|
||||
func (s *Context) AvformatWriteHeader(o **Dictionary) int {
|
||||
return int(C.avformat_write_header((*C.struct_AVFormatContext)(s), (**C.struct_AVDictionary)(unsafe.Pointer(o))))
|
||||
}
|
||||
|
||||
//Write a packet to an output media file.
|
||||
func (s *Context) AvWriteFrame(pkt *Packet) int {
|
||||
return int(C.av_write_frame((*C.struct_AVFormatContext)(s), (*C.struct_AVPacket)(pkt)))
|
||||
}
|
||||
|
||||
//Write a packet to an output media file ensuring correct interleaving.
|
||||
func (s *Context) AvInterleavedWriteFrame(pkt *Packet) int {
|
||||
return int(C.av_interleaved_write_frame((*C.struct_AVFormatContext)(s), (*C.struct_AVPacket)(pkt)))
|
||||
}
|
||||
|
||||
//Write a uncoded frame to an output media file.
|
||||
func (s *Context) AvWriteUncodedFrame(si int, f *Frame) int {
|
||||
return int(C.av_write_uncoded_frame((*C.struct_AVFormatContext)(s), C.int(si), (*C.struct_AVFrame)(f)))
|
||||
}
|
||||
|
||||
//Write a uncoded frame to an output media file.
|
||||
func (s *Context) AvInterleavedWriteUncodedFrame(si int, f *Frame) int {
|
||||
return int(C.av_interleaved_write_uncoded_frame((*C.struct_AVFormatContext)(s), C.int(si), (*C.struct_AVFrame)(f)))
|
||||
}
|
||||
|
||||
//Test whether a muxer supports uncoded frame.
|
||||
func (s *Context) AvWriteUncodedFrameQuery(si int) int {
|
||||
return int(C.av_write_uncoded_frame_query((*C.struct_AVFormatContext)(s), C.int(si)))
|
||||
}
|
||||
|
||||
//Write the stream trailer to an output media file and free the file private data.
|
||||
func (s *Context) AvWriteTrailer() int {
|
||||
return int(C.av_write_trailer((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//Get timing information for the data currently output.
|
||||
func (s *Context) AvGetOutputTimestamp(st int, dts, wall *int) int {
|
||||
return int(C.av_get_output_timestamp((*C.struct_AVFormatContext)(s), C.int(st), (*C.int64_t)(unsafe.Pointer(&dts)), (*C.int64_t)(unsafe.Pointer(&wall))))
|
||||
}
|
||||
|
||||
func (s *Context) AvFindDefaultStreamIndex() int {
|
||||
return int(C.av_find_default_stream_index((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.
|
||||
func (s *Context) AvDumpFormat(i int, url string, io int) {
|
||||
C.av_dump_format((*C.struct_AVFormatContext)(unsafe.Pointer(s)), C.int(i), C.CString(url), C.int(io))
|
||||
}
|
||||
|
||||
//Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio.
|
||||
func (s *Context) AvGuessSampleAspectRatio(st *Stream, fr *Frame) Rational {
|
||||
return (Rational)(C.av_guess_sample_aspect_ratio((*C.struct_AVFormatContext)(s), (*C.struct_AVStream)(st), (*C.struct_AVFrame)(fr)))
|
||||
}
|
||||
|
||||
//Guess the frame rate, based on both the container and codec information.
|
||||
func (s *Context) AvGuessFrameRate(st *Stream, fr *Frame) Rational {
|
||||
return (Rational)(C.av_guess_frame_rate((*C.struct_AVFormatContext)(s), (*C.struct_AVStream)(st), (*C.struct_AVFrame)(fr)))
|
||||
}
|
||||
|
||||
//Check if the stream st contained in s is matched by the stream specifier spec.
|
||||
func (s *Context) AvformatMatchStreamSpecifier(st *Stream, spec string) int {
|
||||
return int(C.avformat_match_stream_specifier((*C.struct_AVFormatContext)(s), (*C.struct_AVStream)(st), C.CString(spec)))
|
||||
}
|
||||
|
||||
func (s *Context) AvformatQueueAttachedPictures() int {
|
||||
return int(C.avformat_queue_attached_pictures((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
// //av_format_control_message av_format_get_control_message_cb (const Context *s)
|
||||
// func (s *Context) AvFormatControlMessage() C.av_format_get_control_message_cb {
|
||||
// return C.av_format_get_control_message_cb((*C.struct_AVFormatContext)(s))
|
||||
@@ -87,167 +203,12 @@ func (s *Context) AvFormatSetOpaque(o int) {
|
||||
// C.av_format_set_control_message_cb((*C.struct_AVFormatContext)(s), (C.struct_AVFormatControlMessage)(c))
|
||||
// }
|
||||
|
||||
//void av_format_inject_global_side_data (Context *s)
|
||||
//This function will cause global side data to be injected in the next packet of each stream as well as after any subsequent seek.
|
||||
func (s *Context) AvFormatInjectGlobalSideData() {
|
||||
C.av_format_inject_global_side_data((*C.struct_AVFormatContext)(s))
|
||||
}
|
||||
// //AvCodec * av_format_get_data_codec (const Context *s)
|
||||
// func (s *Context)AvFormatGetDataCodec() *AvCodec {
|
||||
// return (*AvCodec)(C.av_format_get_data_codec((*C.struct_AVFormatContext)(s)))
|
||||
// }
|
||||
|
||||
//enum AvDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method (const Context *ctx)
|
||||
//Returns the method used to set ctx->duration.
|
||||
func (s *Context) AvFmtCtxGetDurationEstimationMethod() AvDurationEstimationMethod {
|
||||
return (AvDurationEstimationMethod)(C.av_fmt_ctx_get_duration_estimation_method((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//void avformat_free_context (Context *s)
|
||||
//Free an Context and all its streams.
|
||||
func (s *Context) AvformatFreeContext() {
|
||||
C.avformat_free_context((*C.struct_AVFormatContext)(s))
|
||||
}
|
||||
|
||||
//Stream * avformat_new_stream (Context *s, const AvCodec *c)
|
||||
//Add a new stream to a media file.
|
||||
func (s *Context) AvformatNewStream(c *AvCodec) *Stream {
|
||||
return (*Stream)(C.avformat_new_stream((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c)))
|
||||
}
|
||||
|
||||
//AvProgram * av_new_program (Context *s, int id)
|
||||
func (s *Context) AvNewProgram(id int) *AvProgram {
|
||||
return (*AvProgram)(C.av_new_program((*C.struct_AVFormatContext)(s), C.int(id)))
|
||||
}
|
||||
|
||||
//int avformat_find_stream_info (Context *ic, Dictionary **options)
|
||||
//Read packets of a media file to get stream information.
|
||||
func (s *Context) AvformatFindStreamInfo(d **Dictionary) int {
|
||||
return int(C.avformat_find_stream_info((*C.struct_AVFormatContext)(s), (**C.struct_AVDictionary)(unsafe.Pointer(d))))
|
||||
}
|
||||
|
||||
//AvProgram * av_find_program_from_stream (Context *ic, AvProgram *last, int s)
|
||||
//Find the programs which belong to a given stream.
|
||||
func (s *Context) AvFindProgramFromStream(l *AvProgram, su int) *AvProgram {
|
||||
return (*AvProgram)(C.av_find_program_from_stream((*C.struct_AVFormatContext)(s), (*C.struct_AVProgram)(l), C.int(su)))
|
||||
}
|
||||
|
||||
//int av_find_best_stream (Context *ic, enum MediaType type, int wanted_stream_nb, int related_stream, AvCodec **decoder_ret, int flags)
|
||||
//Find the "best" stream in the file.
|
||||
func AvFindBestStream(ic *Context, t MediaType, ws, rs int, c **AvCodec, f int) int {
|
||||
return int(C.av_find_best_stream((*C.struct_AVFormatContext)(ic), (C.enum_AVMediaType)(t), C.int(ws), C.int(rs), (**C.struct_AVCodec)(unsafe.Pointer(c)), C.int(f)))
|
||||
}
|
||||
|
||||
//int av_read_frame (Context *s, Packet *pkt)
|
||||
//Return the next frame of a stream.
|
||||
func (s *Context) AvReadFrame(pkt *avcodec.Packet) int {
|
||||
return int(C.av_read_frame((*C.struct_AVFormatContext)(unsafe.Pointer(s)), (*C.struct_AVPacket)(unsafe.Pointer(pkt))))
|
||||
}
|
||||
|
||||
//int av_seek_frame (Context *s, int stream_index, int64_t timestamp, int flags)
|
||||
//Seek to the keyframe at timestamp.
|
||||
func (s *Context) AvSeekFrame(st int, t int64, f int) int {
|
||||
return int(C.av_seek_frame((*C.struct_AVFormatContext)(s), C.int(st), C.int64_t(t), C.int(f)))
|
||||
}
|
||||
|
||||
//int avformat_seek_file (Context *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
|
||||
//Seek to timestamp ts.
|
||||
func (s *Context) AvformatSeekFile(si int, mit, ts, mat int64, f int) int {
|
||||
return int(C.avformat_seek_file((*C.struct_AVFormatContext)(s), C.int(si), C.int64_t(mit), C.int64_t(ts), C.int64_t(mat), C.int(f)))
|
||||
}
|
||||
|
||||
//int av_read_play (Context *s)
|
||||
//Start playing a network-based stream (e.g.
|
||||
func (s *Context) AvReadPlay() int {
|
||||
return int(C.av_read_play((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//int av_read_pause (Context *s)
|
||||
//Pause a network-based stream (e.g.
|
||||
func (s *Context) AvReadPause() int {
|
||||
return int(C.av_read_pause((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//void avformat_close_input (Context **s)
|
||||
//Close an opened input Context.
|
||||
func (s *Context) AvformatCloseInput() {
|
||||
C.avformat_close_input((**C.struct_AVFormatContext)(unsafe.Pointer(s)))
|
||||
}
|
||||
|
||||
//int avformat_write_header (Context *s, Dictionary **options)
|
||||
//Allocate the stream private data and write the stream header to an output media file.
|
||||
func (s *Context) AvformatWriteHeader(o **Dictionary) int {
|
||||
return int(C.avformat_write_header((*C.struct_AVFormatContext)(s), (**C.struct_AVDictionary)(unsafe.Pointer(o))))
|
||||
}
|
||||
|
||||
//int av_write_frame (Context *s, Packet *pkt)
|
||||
//Write a packet to an output media file.
|
||||
func (s *Context) AvWriteFrame(pkt *Packet) int {
|
||||
return int(C.av_write_frame((*C.struct_AVFormatContext)(s), (*C.struct_AVPacket)(pkt)))
|
||||
}
|
||||
|
||||
//int av_interleaved_write_frame (Context *s, Packet *pkt)
|
||||
//Write a packet to an output media file ensuring correct interleaving.
|
||||
func (s *Context) AvInterleavedWriteFrame(pkt *Packet) int {
|
||||
return int(C.av_interleaved_write_frame((*C.struct_AVFormatContext)(s), (*C.struct_AVPacket)(pkt)))
|
||||
}
|
||||
|
||||
//int av_write_uncoded_frame (Context *s, int stream_index, Frame *frame)
|
||||
//Write a uncoded frame to an output media file.
|
||||
func (s *Context) AvWriteUncodedFrame(si int, f *Frame) int {
|
||||
return int(C.av_write_uncoded_frame((*C.struct_AVFormatContext)(s), C.int(si), (*C.struct_AVFrame)(f)))
|
||||
}
|
||||
|
||||
//int av_interleaved_write_uncoded_frame (Context *s, int stream_index, Frame *frame)
|
||||
//Write a uncoded frame to an output media file.
|
||||
func (s *Context) AvInterleavedWriteUncodedFrame(si int, f *Frame) int {
|
||||
return int(C.av_interleaved_write_uncoded_frame((*C.struct_AVFormatContext)(s), C.int(si), (*C.struct_AVFrame)(f)))
|
||||
}
|
||||
|
||||
//int av_write_uncoded_frame_query (Context *s, int stream_index)
|
||||
//Test whether a muxer supports uncoded frame.
|
||||
func (s *Context) AvWriteUncodedFrameQuery(si int) int {
|
||||
return int(C.av_write_uncoded_frame_query((*C.struct_AVFormatContext)(s), C.int(si)))
|
||||
}
|
||||
|
||||
//int av_write_trailer (Context *s)
|
||||
//Write the stream trailer to an output media file and free the file private data.
|
||||
func (s *Context) AvWriteTrailer() int {
|
||||
return int(C.av_write_trailer((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//int av_get_output_timestamp (struct Context *s, int stream, int64_t *dts, int64_t *wall)
|
||||
//Get timing information for the data currently output.
|
||||
func (s *Context) AvGetOutputTimestamp(st int, dts, wall *int) int {
|
||||
return int(C.av_get_output_timestamp((*C.struct_AVFormatContext)(s), C.int(st), (*C.int64_t)(unsafe.Pointer(&dts)), (*C.int64_t)(unsafe.Pointer(&wall))))
|
||||
}
|
||||
|
||||
//int av_find_default_stream_index (Context *s)
|
||||
func (s *Context) AvFindDefaultStreamIndex() int {
|
||||
return int(C.av_find_default_stream_index((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
//void av_dump_format (Context *ic, int index, const char *url, int is_output)
|
||||
//Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.
|
||||
func (s *Context) AvDumpFormat(i int, url string, io int) {
|
||||
C.av_dump_format((*C.struct_AVFormatContext)(unsafe.Pointer(s)), C.int(i), C.CString(url), C.int(io))
|
||||
}
|
||||
|
||||
//Rational av_guess_sample_aspect_ratio (Context *format, Stream *stream, Frame *frame)
|
||||
//Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio.
|
||||
func (s *Context) AvGuessSampleAspectRatio(st *Stream, fr *Frame) Rational {
|
||||
return (Rational)(C.av_guess_sample_aspect_ratio((*C.struct_AVFormatContext)(s), (*C.struct_AVStream)(st), (*C.struct_AVFrame)(fr)))
|
||||
}
|
||||
|
||||
//Rational av_guess_frame_rate (Context *ctx, Stream *stream, Frame *frame)
|
||||
//Guess the frame rate, based on both the container and codec information.
|
||||
func (s *Context) AvGuessFrameRate(st *Stream, fr *Frame) Rational {
|
||||
return (Rational)(C.av_guess_frame_rate((*C.struct_AVFormatContext)(s), (*C.struct_AVStream)(st), (*C.struct_AVFrame)(fr)))
|
||||
}
|
||||
|
||||
//int avformat_match_stream_specifier (Context *s, Stream *st, const char *spec)
|
||||
//Check if the stream st contained in s is matched by the stream specifier spec.
|
||||
func (s *Context) AvformatMatchStreamSpecifier(st *Stream, spec string) int {
|
||||
return int(C.avformat_match_stream_specifier((*C.struct_AVFormatContext)(s), (*C.struct_AVStream)(st), C.CString(spec)))
|
||||
}
|
||||
|
||||
//int avformat_queue_attached_pictures (Context *s)
|
||||
func (s *Context) AvformatQueueAttachedPictures() int {
|
||||
return int(C.avformat_queue_attached_pictures((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
// //void av_format_set_data_codec (Context *s, AvCodec *c)
|
||||
// func (s *Context)AvFormatSetDataCodec( c *AvCodec) {
|
||||
// C.av_format_set_data_codec((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c))
|
||||
// }
|
||||
|
||||
+8
-17
@@ -25,57 +25,48 @@ type (
|
||||
File C.FILE
|
||||
)
|
||||
|
||||
//unsigned avutil_version (void)
|
||||
//Return the LIBAvUTIL_VERSION_INT constant.
|
||||
func AvutilVersion() uint {
|
||||
return uint(C.avutil_version())
|
||||
}
|
||||
|
||||
//const char * avutil_configuration (void)
|
||||
//Return the libavutil build-time configuration.
|
||||
func Avutil_configuration() string {
|
||||
func AvutilConfiguration() string {
|
||||
return C.GoString(C.avutil_configuration())
|
||||
}
|
||||
|
||||
//const char * avutil_license (void)
|
||||
//Return the libavutil license.
|
||||
func Avutil_license() string {
|
||||
func AvutilLicense() string {
|
||||
return C.GoString(C.avutil_license())
|
||||
}
|
||||
|
||||
//const char * av_get_media_type_string (enum MediaType media_type)
|
||||
//Return a string describing the media_type enum, NULL if media_type is unknown.
|
||||
func Av_get_media_type_string(mt MediaType) string {
|
||||
func AvGetMediaTypeString(mt MediaType) string {
|
||||
return C.GoString(C.av_get_media_type_string((C.enum_AVMediaType)(mt)))
|
||||
}
|
||||
|
||||
//char av_get_picture_type_char (enum AvPictureType pict_type)
|
||||
//Return a single letter to describe the given picture type pict_type.
|
||||
func Av_get_picture_type_char(pt AvPictureType) string {
|
||||
func AvGetPictureTypeChar(pt AvPictureType) string {
|
||||
return string(C.av_get_picture_type_char((C.enum_AVPictureType)(pt)))
|
||||
}
|
||||
|
||||
//static void * av_x_if_null (const void *p, const void *x)
|
||||
//Return x default pointer in case p is NULL.
|
||||
func Av_x_if_null(p, x int) {
|
||||
func AvXIfNull(p, x int) {
|
||||
C.av_x_if_null(unsafe.Pointer(&p), unsafe.Pointer(&x))
|
||||
}
|
||||
|
||||
//unsigned av_int_list_length_for_size (unsigned elsize, const void *list, uint64_t term) av_pure
|
||||
//Compute the length of an integer list.
|
||||
func Av_int_list_length_for_size(e uint, l int, t uint64) uint {
|
||||
func AvIntListLengthForSize(e uint, l int, t uint64) uint {
|
||||
return uint(C.av_int_list_length_for_size(C.uint(e), unsafe.Pointer(&l), (C.uint64_t)(t)))
|
||||
}
|
||||
|
||||
//FILE * av_fopen_utf8 (const char *path, const char *mode)
|
||||
//Open a file using a UTF-8 filename.
|
||||
func Av_fopen_utf8(p, m string) *File {
|
||||
func AvFopenUtf8(p, m string) *File {
|
||||
f := C.av_fopen_utf8(C.CString(p), C.CString(m))
|
||||
return (*File)(f)
|
||||
}
|
||||
|
||||
//Rational av_get_time_base_q (void)
|
||||
//Return the fractional representation of the internal time base.
|
||||
func Av_get_time_base_q() Rational {
|
||||
func AvGetTimeBaseQ() Rational {
|
||||
return (Rational)(C.av_get_time_base_q())
|
||||
}
|
||||
|
||||
+31
-47
@@ -23,111 +23,80 @@ type (
|
||||
AvFrameSideDataType C.enum_AVFrameSideDataType
|
||||
)
|
||||
|
||||
//Dictionary ** avpriv_frame_get_metadatap (Frame *frame)
|
||||
func Avpriv_frame_get_metadatap(f *Frame) **Dictionary {
|
||||
func AvprivFrameGetMetadatap(f *Frame) **Dictionary {
|
||||
return (**Dictionary)(unsafe.Pointer(C.avpriv_frame_get_metadatap((*C.struct_AVFrame)(unsafe.Pointer(f)))))
|
||||
}
|
||||
|
||||
//int av_frame_set_qp_table (Frame *f, AvBufferRef *buf, int stride, int qp_type)
|
||||
func Av_frame_set_qp_table(f *Frame, b *AvBufferRef, s, q int) int {
|
||||
func AvFrameSetQpTable(f *Frame, b *AvBufferRef, s, q int) int {
|
||||
return int(C.av_frame_set_qp_table((*C.struct_AVFrame)(unsafe.Pointer(f)), (*C.struct_AVBufferRef)(unsafe.Pointer(b)), C.int(s), C.int(q)))
|
||||
}
|
||||
|
||||
//int8_t * av_frame_get_qp_table (Frame *f, int *stride, int *type)
|
||||
func Av_frame_get_qp_table(f *Frame, s, t *int) int8 {
|
||||
func AvFrameGetQpTable(f *Frame, s, t *int) int8 {
|
||||
return int8(*C.av_frame_get_qp_table((*C.struct_AVFrame)(unsafe.Pointer(f)), (*C.int)(unsafe.Pointer(s)), (*C.int)(unsafe.Pointer(t))))
|
||||
}
|
||||
|
||||
// //static void get_frame_defaults (Frame *frame)
|
||||
// func Get_frame_defaults(f *Frame) {
|
||||
// C.get_frame_defaults(*C.struct_AVFrame(f))
|
||||
// }
|
||||
|
||||
//Frame * av_frame_alloc (void)
|
||||
//Allocate an Frame and set its fields to default values.
|
||||
func Av_frame_alloc() *Frame {
|
||||
func AvFrameAlloc() *Frame {
|
||||
return (*Frame)(unsafe.Pointer(C.av_frame_alloc()))
|
||||
}
|
||||
|
||||
//void av_frame_free (Frame **frame)
|
||||
//Free the frame and any dynamically allocated objects in it, e.g.
|
||||
func Av_frame_free(f *Frame) {
|
||||
func AvFrameFree(f *Frame) {
|
||||
C.av_frame_free((**C.struct_AVFrame)(unsafe.Pointer(f)))
|
||||
}
|
||||
|
||||
// //static int get_video_buffer (Frame *frame, int align)
|
||||
// func Get_video_buffer(f *Frame, a int) int {
|
||||
// return int(C.get_video_buffer(f, C.int(a)))
|
||||
// }
|
||||
|
||||
// //static int get_audio_buffer (Frame *frame, int align)
|
||||
// func Get_audio_buffer(f *Frame, a int) int {
|
||||
// return C.get_audio_buffer(f, C.int(a))
|
||||
// }
|
||||
|
||||
//int av_frame_get_buffer (Frame *frame, int align)
|
||||
//Allocate new buffer(s) for audio or video data.
|
||||
func Av_frame_get_buffer(f *Frame, a int) int {
|
||||
func AvFrameGetBuffer(f *Frame, a int) int {
|
||||
return int(C.av_frame_get_buffer((*C.struct_AVFrame)(unsafe.Pointer(f)), C.int(a)))
|
||||
}
|
||||
|
||||
//int av_frame_ref (Frame *dst, Frame *src)
|
||||
//Setup a new reference to the data described by an given frame.
|
||||
func Av_frame_ref(d, s *Frame) int {
|
||||
func AvFrameRef(d, s *Frame) int {
|
||||
return int(C.av_frame_ref((*C.struct_AVFrame)(unsafe.Pointer(d)), (*C.struct_AVFrame)(unsafe.Pointer(s))))
|
||||
}
|
||||
|
||||
//Frame * av_frame_clone (Frame *src)
|
||||
//Create a new frame that references the same data as src.
|
||||
func Av_frame_clone(f *Frame) *Frame {
|
||||
func AvFrameClone(f *Frame) *Frame {
|
||||
return (*Frame)(C.av_frame_clone((*C.struct_AVFrame)(unsafe.Pointer(f))))
|
||||
}
|
||||
|
||||
//void av_frame_unref (Frame *frame)
|
||||
//Unreference all the buffers referenced by frame and reset the frame fields.
|
||||
func Av_frame_unref(f *Frame) {
|
||||
func AvFrameUnref(f *Frame) {
|
||||
cf := (*C.struct_AVFrame)(unsafe.Pointer(f))
|
||||
C.av_frame_unref(cf)
|
||||
}
|
||||
|
||||
//void av_frame_move_ref (Frame *dst, Frame *src)
|
||||
//Move everythnig contained in src to dst and reset src.
|
||||
func Av_frame_move_ref(d, s *Frame) {
|
||||
func AvFrameMoveRef(d, s *Frame) {
|
||||
C.av_frame_move_ref((*C.struct_AVFrame)(unsafe.Pointer(d)), (*C.struct_AVFrame)(unsafe.Pointer(s)))
|
||||
}
|
||||
|
||||
//int av_frame_is_writable (Frame *frame)
|
||||
//Check if the frame data is writable.
|
||||
func Av_frame_is_writable(f *Frame) int {
|
||||
func AvFrameIsWritable(f *Frame) int {
|
||||
return int(C.av_frame_is_writable((*C.struct_AVFrame)(unsafe.Pointer(f))))
|
||||
}
|
||||
|
||||
//int av_frame_make_writable (Frame *frame)
|
||||
//Ensure that the frame data is writable, avoiding data copy if possible.
|
||||
func Av_frame_make_writable(f *Frame) int {
|
||||
func AvFrameMakeWritable(f *Frame) int {
|
||||
return int(C.av_frame_make_writable((*C.struct_AVFrame)(unsafe.Pointer(f))))
|
||||
}
|
||||
|
||||
//int av_frame_copy_props (Frame *dst, const Frame *src)
|
||||
//Copy only "metadata" fields from src to dst.
|
||||
func Av_frame_copy_props(d, s *Frame) int {
|
||||
func AvFrameCopyProps(d, s *Frame) int {
|
||||
return int(C.av_frame_copy_props((*C.struct_AVFrame)(unsafe.Pointer(d)), (*C.struct_AVFrame)(unsafe.Pointer(s))))
|
||||
}
|
||||
|
||||
//AvBufferRef * av_frame_get_plane_buffer (Frame *frame, int plane)
|
||||
//Get the buffer reference a given data plane is stored in.
|
||||
func Av_frame_get_plane_buffer(f *Frame, p int) *AvBufferRef {
|
||||
func AvFrameGetPlaneBuffer(f *Frame, p int) *AvBufferRef {
|
||||
return (*AvBufferRef)(C.av_frame_get_plane_buffer((*C.struct_AVFrame)(unsafe.Pointer(f)), C.int(p)))
|
||||
}
|
||||
|
||||
//AvFrameSideData * av_frame_new_side_data (Frame *frame, enum AvFrameSideDataType type, int size)
|
||||
//Add a new side data to a frame.
|
||||
func Av_frame_new_side_data(f *Frame, d AvFrameSideDataType, s int) *AvFrameSideData {
|
||||
func AvFrameNewSideData(f *Frame, d AvFrameSideDataType, s int) *AvFrameSideData {
|
||||
return (*AvFrameSideData)(C.av_frame_new_side_data((*C.struct_AVFrame)(unsafe.Pointer(f)), (C.enum_AVFrameSideDataType)(d), C.int(s)))
|
||||
}
|
||||
|
||||
//AvFrameSideData * av_frame_get_side_data (Frame *frame, enum AvFrameSideDataType type)
|
||||
func Av_frame_get_side_data(f *Frame, t AvFrameSideDataType) *AvFrameSideData {
|
||||
func AvFrameGetSideData(f *Frame, t AvFrameSideDataType) *AvFrameSideData {
|
||||
return (*AvFrameSideData)(C.av_frame_get_side_data((*C.struct_AVFrame)(unsafe.Pointer(f)), (C.enum_AVFrameSideDataType)(t)))
|
||||
}
|
||||
|
||||
@@ -137,3 +106,18 @@ func Data(f *Frame) *uint8 {
|
||||
func Linesize(f *Frame) int {
|
||||
return int(*(*C.int)(unsafe.Pointer(&f.linesize)))
|
||||
}
|
||||
|
||||
// //static int get_video_buffer (Frame *frame, int align)
|
||||
// func GetVideoBuffer(f *Frame, a int) int {
|
||||
// return int(C.get_video_buffer(f, C.int(a)))
|
||||
// }
|
||||
|
||||
// //static int get_audio_buffer (Frame *frame, int align)
|
||||
// func GetAudioBuffer(f *Frame, a int) int {
|
||||
// return C.get_audio_buffer(f, C.int(a))
|
||||
// }
|
||||
|
||||
// //static void get_frame_defaults (Frame *frame)
|
||||
// func GetFrameDefaults(f *Frame) {
|
||||
// C.get_frame_defaults(*C.struct_AVFrame(f))
|
||||
// }
|
||||
|
||||
+23
-45
@@ -15,136 +15,114 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
//void * av_malloc (size_t size) av_malloc_attrib 1(1)
|
||||
//Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU).
|
||||
func Av_malloc(s uintptr) unsafe.Pointer {
|
||||
func AvMalloc(s uintptr) unsafe.Pointer {
|
||||
return unsafe.Pointer(C.av_malloc(C.size_t(s)))
|
||||
}
|
||||
|
||||
//static void * av_malloc_array (size_t nmemb, size_t size)
|
||||
func Av_malloc_array(n, s uintptr) unsafe.Pointer {
|
||||
func AvMallocArray(n, s uintptr) unsafe.Pointer {
|
||||
return C.av_malloc_array(C.size_t(n), C.size_t(s))
|
||||
}
|
||||
|
||||
//void * av_realloc (void *ptr, size_t size) 1(2)
|
||||
//Allocate or reallocate a block of memory.
|
||||
func Av_realloc(p *int, s uintptr) unsafe.Pointer {
|
||||
func AvRealloc(p *int, s uintptr) unsafe.Pointer {
|
||||
return C.av_realloc(unsafe.Pointer(&p), C.size_t(s))
|
||||
}
|
||||
|
||||
//void * av_realloc_f (void *ptr, size_t nelem, size_t elsize)
|
||||
//Allocate or reallocate a block of memory.
|
||||
func Av_realloc_f(p int, n, e uintptr) unsafe.Pointer {
|
||||
func AvReallocF(p int, n, e uintptr) unsafe.Pointer {
|
||||
return C.av_realloc_f(unsafe.Pointer(&p), C.size_t(n), C.size_t(e))
|
||||
}
|
||||
|
||||
//int av_reallocp (void *ptr, size_t size)
|
||||
//Allocate or reallocate a block of memory.
|
||||
func Av_reallocp(p int, s uintptr) int {
|
||||
func AvReallocp(p int, s uintptr) int {
|
||||
return int(C.av_reallocp(unsafe.Pointer(&p), C.size_t(s)))
|
||||
}
|
||||
|
||||
//void * av_realloc_array (void *ptr, size_t nmemb, size_t size)
|
||||
func Av_realloc_array(p int, n, s uintptr) unsafe.Pointer {
|
||||
func AvReallocArray(p int, n, s uintptr) unsafe.Pointer {
|
||||
return C.av_realloc_array(unsafe.Pointer(&p), C.size_t(n), C.size_t(s))
|
||||
}
|
||||
|
||||
//int av_reallocp_array (void *ptr, size_t nmemb, size_t size)
|
||||
func Av_reallocp_array(p int, n, s uintptr) int {
|
||||
func AvReallocpArray(p int, n, s uintptr) int {
|
||||
return int(C.av_reallocp_array(unsafe.Pointer(&p), C.size_t(n), C.size_t(s)))
|
||||
}
|
||||
|
||||
//void av_free (void *ptr)
|
||||
//Free a memory block which has been allocated with av_malloc(z)() or av_realloc().
|
||||
func Av_free(p unsafe.Pointer) {
|
||||
func AvFree(p unsafe.Pointer) {
|
||||
C.av_free(p)
|
||||
}
|
||||
|
||||
//void * av_mallocz (size_t size) av_malloc_attrib 1(1)
|
||||
//Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block.
|
||||
func Av_mallocz(s uintptr) unsafe.Pointer {
|
||||
func AvMallocz(s uintptr) unsafe.Pointer {
|
||||
return C.av_mallocz(C.size_t(s))
|
||||
}
|
||||
|
||||
//void * av_calloc (size_t nmemb, size_t size) av_malloc_attrib
|
||||
//Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block.
|
||||
func Av_calloc(n, s uintptr) unsafe.Pointer {
|
||||
func AvCalloc(n, s uintptr) unsafe.Pointer {
|
||||
return C.av_calloc(C.size_t(n), C.size_t(s))
|
||||
}
|
||||
|
||||
//static void * av_mallocz_array (size_t nmemb, size_t size)
|
||||
func Av_mallocz_array(n, s uintptr) unsafe.Pointer {
|
||||
func AvMalloczArray(n, s uintptr) unsafe.Pointer {
|
||||
return C.av_mallocz_array(C.size_t(n), C.size_t(s))
|
||||
}
|
||||
|
||||
//char * av_strdup (const char *s) av_malloc_attrib
|
||||
//Duplicate the string s.
|
||||
func Av_strdup(s string) string {
|
||||
func AvStrdup(s string) string {
|
||||
return C.GoString(C.av_strdup(C.CString(s)))
|
||||
}
|
||||
|
||||
//char * av_strndup (const char *s, size_t len) av_malloc_attrib
|
||||
//Duplicate a substring of the string s.
|
||||
func Av_strndup(s string, l uintptr) string {
|
||||
func AvStrndup(s string, l uintptr) string {
|
||||
return C.GoString(C.av_strndup(C.CString(s), C.size_t(l)))
|
||||
}
|
||||
|
||||
//void * av_memdup (const void *p, size_t size)
|
||||
//Duplicate the buffer p.
|
||||
func Av_memdup(p *int, s uintptr) unsafe.Pointer {
|
||||
func AvMemdup(p *int, s uintptr) unsafe.Pointer {
|
||||
return C.av_memdup(unsafe.Pointer(p), C.size_t(s))
|
||||
}
|
||||
|
||||
//void av_freep (void *ptr)
|
||||
//Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer pointing to it to NULL.
|
||||
func Av_freep(p unsafe.Pointer) {
|
||||
func AvFreep(p unsafe.Pointer) {
|
||||
C.av_freep(p)
|
||||
}
|
||||
|
||||
//void av_dynarray_add (void *tab_ptr, int *nb_ptr, void *elem)
|
||||
//Add an element to a dynamic array.
|
||||
func Av_dynarray_add(t unsafe.Pointer, n *int, e unsafe.Pointer) {
|
||||
func AvDynarrayAdd(t unsafe.Pointer, n *int, e unsafe.Pointer) {
|
||||
C.av_dynarray_add(t, (*C.int)(unsafe.Pointer(n)), e)
|
||||
}
|
||||
|
||||
//int av_dynarray_add_nofree (void *tab_ptr, int *nb_ptr, void *elem)
|
||||
//Add an element to a dynamic array.
|
||||
func Av_dynarray_add_nofree(p unsafe.Pointer, n *int, e unsafe.Pointer) int {
|
||||
func AvDynarrayAddNofree(p unsafe.Pointer, n *int, e unsafe.Pointer) int {
|
||||
return int(C.av_dynarray_add_nofree(p, (*C.int)(unsafe.Pointer(&n)), e))
|
||||
}
|
||||
|
||||
//void * av_dynarray2_add (void **tab_ptr, int *nb_ptr, size_t elem_size, const uint8_t *elem_data)
|
||||
//Add an element of size elem_size to a dynamic array.
|
||||
func Av_dynarray2_add(t *unsafe.Pointer, n *int, e uintptr, d uint8) unsafe.Pointer {
|
||||
func AvDynarray2Add(t *unsafe.Pointer, n *int, e uintptr, d uint8) unsafe.Pointer {
|
||||
return C.av_dynarray2_add(t, (*C.int)(unsafe.Pointer(&n)), (C.size_t)(e), (*C.uint8_t)(unsafe.Pointer(&d)))
|
||||
}
|
||||
|
||||
//static int av_size_mult (size_t a, size_t b, size_t *r)
|
||||
//Multiply two size_t values checking for overflow.
|
||||
func Av_size_mult(a, b uintptr, r *uintptr) int {
|
||||
func AvSizeMult(a, b uintptr, r *uintptr) int {
|
||||
return int(C.av_size_mult((C.size_t)(a), (C.size_t)(b), (*C.size_t)(unsafe.Pointer(r))))
|
||||
}
|
||||
|
||||
//void av_max_alloc (size_t max)
|
||||
//Set the maximum size that may me allocated in one block.
|
||||
func Av_max_alloc(m uintptr) {
|
||||
func AvMaxAlloc(m uintptr) {
|
||||
C.av_max_alloc(C.size_t(m))
|
||||
}
|
||||
|
||||
//void av_memcpy_backptr (uint8_t *dst, int back, int cnt)
|
||||
//deliberately overlapping memcpy implementation
|
||||
func Av_memcpy_backptr(d *uintptr, b, c int) {
|
||||
func AvMemcpyBackptr(d *uintptr, b, c int) {
|
||||
C.av_memcpy_backptr((*C.uint8_t)(unsafe.Pointer(d)), C.int(b), C.int(c))
|
||||
}
|
||||
|
||||
//void * av_fast_realloc (void *ptr, unsigned int *size, size_t min_size)
|
||||
//Reallocate the given block if it is not large enough, otherwise do nothing.
|
||||
func Av_fast_realloc(p unsafe.Pointer, s *uint, m uintptr) unsafe.Pointer {
|
||||
func AvFastRealloc(p unsafe.Pointer, s *uint, m uintptr) unsafe.Pointer {
|
||||
return C.av_fast_realloc(p, (*C.uint)(unsafe.Pointer(s)), (C.size_t)(m))
|
||||
}
|
||||
|
||||
//void av_fast_malloc (void *ptr, unsigned int *size, size_t min_size)
|
||||
//Allocate a buffer, reusing the given one if large enough.
|
||||
func Av_fast_malloc(p unsafe.Pointer, s *uint, m uintptr) {
|
||||
func AvFastMalloc(p unsafe.Pointer, s *uint, m uintptr) {
|
||||
C.av_fast_malloc(p, (*C.uint)(unsafe.Pointer(s)), (C.size_t)(m))
|
||||
}
|
||||
|
||||
@@ -117,10 +117,10 @@ func main() {
|
||||
}
|
||||
|
||||
// Allocate video frame
|
||||
videoFrame = avutil.Av_frame_alloc()
|
||||
videoFrame = avutil.AvFrameAlloc()
|
||||
|
||||
// Allocate an Frame structure
|
||||
if videoFrameRGB = avutil.Av_frame_alloc(); videoFrameRGB == nil {
|
||||
if videoFrameRGB = avutil.AvFrameAlloc(); videoFrameRGB == nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ func main() {
|
||||
// Determine required buffer size and allocate buffer
|
||||
numBytes = avcodec.AvpictureGetSize((avcodec.PixelFormat)(a), w, h)
|
||||
|
||||
buffer := avutil.Av_malloc(uintptr(numBytes))
|
||||
buffer := avutil.AvMalloc(uintptr(numBytes))
|
||||
|
||||
// Assign appropriate parts of buffer to image planes in videoFrameRGB
|
||||
// Note that videoFrameRGB is an Frame, but Frame is a superset
|
||||
@@ -147,7 +147,7 @@ func main() {
|
||||
avp.AvpictureFill((*uint8)(buffer), (avcodec.PixelFormat)(a), w, h)
|
||||
|
||||
// initialize SWS context for software scaling
|
||||
ctxtSws = swscale.Sws_getContext(w,
|
||||
ctxtSws = swscale.SwsGetcontext(w,
|
||||
h,
|
||||
(swscale.PixelFormat)(pix_fmt),
|
||||
w,
|
||||
@@ -176,7 +176,7 @@ func main() {
|
||||
l := avutil.Linesize(videoFrame)
|
||||
dr := avutil.Data(videoFrameRGB)
|
||||
lr := avutil.Linesize(videoFrameRGB)
|
||||
swscale.Sws_scale(ctxtSws,
|
||||
swscale.SwsScale(ctxtSws,
|
||||
d,
|
||||
l,
|
||||
0,
|
||||
@@ -198,11 +198,11 @@ func main() {
|
||||
}
|
||||
|
||||
// Free the RGB image
|
||||
avutil.Av_free(buffer)
|
||||
avutil.Av_frame_free(videoFrameRGB)
|
||||
avutil.AvFree(buffer)
|
||||
avutil.AvFrameFree(videoFrameRGB)
|
||||
|
||||
// Free the YUV frame
|
||||
avutil.Av_frame_free(videoFrame)
|
||||
avutil.AvFrameFree(videoFrame)
|
||||
|
||||
// Close the codecs
|
||||
ctxtDest.AvcodecClose()
|
||||
|
||||
+4
-4
@@ -17,11 +17,11 @@ func main() {
|
||||
avformat.AvRegisterAll()
|
||||
avcodec.AvcodecRegisterAll()
|
||||
|
||||
log.Printf("AvFilter Version:\t%v", avfilter.Avfilter_version())
|
||||
log.Printf("AvDevice Version:\t%v", avdevice.Avdevice_version())
|
||||
log.Printf("SWScale Version:\t%v", swscale.Swscale_version())
|
||||
log.Printf("AvFilter Version:\t%v", avfilter.AvfilterVersion())
|
||||
log.Printf("AvDevice Version:\t%v", avdevice.AvdeviceVersion())
|
||||
log.Printf("SWScale Version:\t%v", swscale.SwscaleVersion())
|
||||
log.Printf("AvUtil Version:\t%v", avutil.AvutilVersion())
|
||||
log.Printf("AvCodec Version:\t%v", avcodec.AvcodecVersion())
|
||||
log.Printf("Resample Version:\t%v", swresample.Swresample_license())
|
||||
log.Printf("Resample Version:\t%v", swresample.SwresampleLicense())
|
||||
|
||||
}
|
||||
|
||||
@@ -19,24 +19,24 @@ type (
|
||||
)
|
||||
|
||||
//Get the Class for Context.
|
||||
func Swr_get_class() *Class {
|
||||
func SwrGetClass() *Class {
|
||||
return (*Class)(C.swr_get_class())
|
||||
}
|
||||
|
||||
//Context constructor functions.Allocate Context.
|
||||
func Swr_alloc() *Context {
|
||||
func SwrAlloc() *Context {
|
||||
return (*Context)(C.swr_alloc())
|
||||
}
|
||||
|
||||
//Configuration accessors
|
||||
func Swresample_version() uint {
|
||||
func SwresampleVersion() uint {
|
||||
return uint(C.swresample_version())
|
||||
}
|
||||
|
||||
func Swresample_configuration() string {
|
||||
func SwresampleConfiguration() string {
|
||||
return C.GoString(C.swresample_configuration())
|
||||
}
|
||||
|
||||
func Swresample_license() string {
|
||||
func SwresampleLicense() string {
|
||||
return C.GoString(C.swresample_license())
|
||||
}
|
||||
|
||||
+34
-34
@@ -27,61 +27,61 @@ type (
|
||||
)
|
||||
|
||||
//Return the LIBSWSCALE_VERSION_INT constant.
|
||||
func Swscale_version() uint {
|
||||
func SwscaleVersion() uint {
|
||||
return uint(C.swscale_version())
|
||||
}
|
||||
|
||||
//Return the libswscale build-time configuration.
|
||||
func Swscale_configuration() string {
|
||||
func SwscaleConfiguration() string {
|
||||
return C.GoString(C.swscale_configuration())
|
||||
}
|
||||
|
||||
//Return the libswscale license.
|
||||
func Swscale_license() string {
|
||||
func SwscaleLicense() string {
|
||||
return C.GoString(C.swscale_license())
|
||||
}
|
||||
|
||||
//Return a pointer to yuv<->rgb coefficients for the given colorspace suitable for sws_setColorspaceDetails().
|
||||
func Sws_getCoefficients(c int) *int {
|
||||
func SwsGetcoefficients(c int) *int {
|
||||
return (*int)(unsafe.Pointer(C.sws_getCoefficients(C.int(c))))
|
||||
}
|
||||
|
||||
//Return a positive value if pix_fmt is a supported input format, 0 otherwise.
|
||||
func Sws_isSupportedInput(p PixelFormat) int {
|
||||
func SwsIssupportedinput(p PixelFormat) int {
|
||||
return int(C.sws_isSupportedInput((C.enum_AVPixelFormat)(p)))
|
||||
}
|
||||
|
||||
//Return a positive value if pix_fmt is a supported output format, 0 otherwise.
|
||||
func Sws_isSupportedOutput(p PixelFormat) int {
|
||||
func SwsIssupportedoutput(p PixelFormat) int {
|
||||
return int(C.sws_isSupportedOutput((C.enum_AVPixelFormat)(p)))
|
||||
}
|
||||
|
||||
func Sws_isSupportedEndiannessConversion(p PixelFormat) int {
|
||||
func SwsIssupportedendiannessconversion(p PixelFormat) int {
|
||||
return int(C.sws_isSupportedEndiannessConversion((C.enum_AVPixelFormat)(p)))
|
||||
}
|
||||
|
||||
//Allocate an empty Context.
|
||||
func Sws_alloc_context() *Context {
|
||||
func SwsAllocContext() *Context {
|
||||
return (*Context)(C.sws_alloc_context())
|
||||
}
|
||||
|
||||
//Initialize the swscaler context sws_context.
|
||||
func Sws_init_context(ctxt *Context, sf, df *Filter) int {
|
||||
func SwsInitContext(ctxt *Context, sf, df *Filter) int {
|
||||
return int(C.sws_init_context((*C.struct_SwsContext)(ctxt), (*C.struct_SwsFilter)(sf), (*C.struct_SwsFilter)(df)))
|
||||
}
|
||||
|
||||
//Free the swscaler context swsContext.
|
||||
func Sws_freeContext(ctxt *Context) {
|
||||
func SwsFreecontext(ctxt *Context) {
|
||||
C.sws_freeContext((*C.struct_SwsContext)(ctxt))
|
||||
}
|
||||
|
||||
//Allocate and return an Context.
|
||||
func Sws_getContext(sw, sh int, sf PixelFormat, dw, dh int, df PixelFormat, f int, sfl, dfl *Filter, p *int) *Context {
|
||||
func SwsGetcontext(sw, sh int, sf PixelFormat, dw, dh int, df PixelFormat, f int, sfl, dfl *Filter, p *int) *Context {
|
||||
return (*Context)(C.sws_getContext(C.int(sw), C.int(sh), (C.enum_AVPixelFormat)(sf), C.int(dw), C.int(dh), (C.enum_AVPixelFormat)(df), C.int(f), (*C.struct_SwsFilter)(sfl), (*C.struct_SwsFilter)(dfl), (*C.double)(unsafe.Pointer(p))))
|
||||
}
|
||||
|
||||
////Scale the image slice in srcSlice and put the resulting scaled slice in the image in dst.
|
||||
func Sws_scale(ctxt *Context, src *uint8, str int, y, h int, d *uint8, ds int) int {
|
||||
func SwsScale(ctxt *Context, src *uint8, str int, y, h int, d *uint8, ds int) int {
|
||||
cctxt := (*C.struct_SwsContext)(unsafe.Pointer(ctxt))
|
||||
csrc := (*C.uint8_t)(unsafe.Pointer(src))
|
||||
cstr := (*C.int)(unsafe.Pointer(&str))
|
||||
@@ -90,13 +90,13 @@ func Sws_scale(ctxt *Context, src *uint8, str int, y, h int, d *uint8, ds int) i
|
||||
return int(C.sws_scale(cctxt, &csrc, cstr, C.int(y), C.int(h), &cd, cds))
|
||||
}
|
||||
|
||||
func Sws_setColorspaceDetails(ctxt *Context, it *int, sr int, t *int, dr, b, c, s int) int {
|
||||
func SwsSetcolorspacedetails(ctxt *Context, it *int, sr int, t *int, dr, b, c, s int) int {
|
||||
cit := (*C.int)(unsafe.Pointer(it))
|
||||
ct := (*C.int)(unsafe.Pointer(t))
|
||||
return int(C.sws_setColorspaceDetails((*C.struct_SwsContext)(ctxt), cit, C.int(sr), ct, C.int(dr), C.int(b), C.int(c), C.int(s)))
|
||||
}
|
||||
|
||||
func Sws_getColorspaceDetails(ctxt *Context, it, sr, t, dr, b, c, s *int) int {
|
||||
func SwsGetcolorspacedetails(ctxt *Context, it, sr, t, dr, b, c, s *int) int {
|
||||
cit := (**C.int)(unsafe.Pointer(it))
|
||||
csr := (*C.int)(unsafe.Pointer(sr))
|
||||
ct := (**C.int)(unsafe.Pointer(t))
|
||||
@@ -108,89 +108,89 @@ func Sws_getColorspaceDetails(ctxt *Context, it, sr, t, dr, b, c, s *int) int {
|
||||
}
|
||||
|
||||
//Allocate and return an uninitialized vector with length coefficients.
|
||||
func Sws_allocVec(l int) *C.struct_SwsVector {
|
||||
return C.sws_allocVec(C.int(l))
|
||||
func SwsAllocvec(l int) *Vector {
|
||||
return (*Vector)(C.sws_allocVec(C.int(l)))
|
||||
}
|
||||
|
||||
//Return a normalized Gaussian curve used to filter stuff quality = 3 is high quality, lower is lower quality.
|
||||
func Sws_getGaussianVec(v, q float64) *Vector {
|
||||
func SwsGetgaussianvec(v, q float64) *Vector {
|
||||
return (*Vector)(unsafe.Pointer(C.sws_getGaussianVec(C.double(v), C.double(q))))
|
||||
}
|
||||
|
||||
//Allocate and return a vector with length coefficients, all with the same value c.
|
||||
func Sws_getConstVec(c float64, l int) *Vector {
|
||||
func SwsGetconstvec(c float64, l int) *Vector {
|
||||
return (*Vector)(unsafe.Pointer(C.sws_getConstVec(C.double(c), C.int(l))))
|
||||
}
|
||||
|
||||
//Allocate and return a vector with just one coefficient, with value 1.0.
|
||||
func Sws_getIdentityVec() *Vector {
|
||||
func SwsGetidentityvec() *Vector {
|
||||
return (*Vector)(unsafe.Pointer(C.sws_getIdentityVec()))
|
||||
}
|
||||
|
||||
//Scale all the coefficients of a by the scalar value.
|
||||
func Sws_scaleVec(a *Vector, s float64) {
|
||||
func SwsScalevec(a *Vector, s float64) {
|
||||
C.sws_scaleVec((*C.struct_SwsVector)(unsafe.Pointer(a)), C.double(s))
|
||||
}
|
||||
|
||||
//Scale all the coefficients of a so that their sum equals height.
|
||||
func Sws_normalizeVec(a *Vector, h float64) {
|
||||
func SwsNormalizevec(a *Vector, h float64) {
|
||||
C.sws_normalizeVec((*C.struct_SwsVector)(a), C.double(h))
|
||||
}
|
||||
|
||||
func Sws_convVec(a, b *Vector) {
|
||||
func SwsConvvec(a, b *Vector) {
|
||||
C.sws_convVec((*C.struct_SwsVector)(a), (*C.struct_SwsVector)(b))
|
||||
}
|
||||
|
||||
func Sws_addVec(a, b *Vector) {
|
||||
func SwsAddvec(a, b *Vector) {
|
||||
C.sws_addVec((*C.struct_SwsVector)(a), (*C.struct_SwsVector)(b))
|
||||
}
|
||||
|
||||
func Sws_subVec(a, b *Vector) {
|
||||
func SwsSubvec(a, b *Vector) {
|
||||
C.sws_subVec((*C.struct_SwsVector)(a), (*C.struct_SwsVector)(b))
|
||||
}
|
||||
|
||||
func Sws_shiftVec(a *Vector, s int) {
|
||||
func SwsShiftvec(a *Vector, s int) {
|
||||
C.sws_shiftVec((*C.struct_SwsVector)(a), C.int(s))
|
||||
}
|
||||
|
||||
//Allocate and return a clone of the vector a, that is a vector with the same coefficients as a.
|
||||
func Sws_cloneVec(a *Vector) *Vector {
|
||||
func SwsClonevec(a *Vector) *Vector {
|
||||
return (*Vector)(unsafe.Pointer(C.sws_cloneVec((*C.struct_SwsVector)(a))))
|
||||
}
|
||||
|
||||
//Print with av_log() a textual representation of the vector a if log_level <= av_log_level.
|
||||
func Sws_printVec2(a *Vector, lctx *Class, l int) {
|
||||
func SwsPrintvec2(a *Vector, lctx *Class, l int) {
|
||||
C.sws_printVec2((*C.struct_SwsVector)(a), (*C.struct_AVClass)(lctx), C.int(l))
|
||||
}
|
||||
|
||||
func Sws_freeVec(a *Vector) {
|
||||
func SwsFreevec(a *Vector) {
|
||||
C.sws_freeVec((*C.struct_SwsVector)(a))
|
||||
}
|
||||
|
||||
func Sws_getDefaultFilter(lb, cb, ls, cs, chs, cvs float32, v int) *Filter {
|
||||
func SwsGetdefaultfilter(lb, cb, ls, cs, chs, cvs float32, v int) *Filter {
|
||||
return (*Filter)(unsafe.Pointer(C.sws_getDefaultFilter(C.float(lb), C.float(cb), C.float(ls), C.float(cs), C.float(chs), C.float(cvs), C.int(v))))
|
||||
}
|
||||
|
||||
func Sws_freeFilter(f *Filter) {
|
||||
func SwsFreefilter(f *Filter) {
|
||||
C.sws_freeFilter((*C.struct_SwsFilter)(f))
|
||||
}
|
||||
|
||||
//Check if context can be reused, otherwise reallocate a new one.
|
||||
func Sws_getCachedContext(ctxt *Context, sw, sh int, sf PixelFormat, dw, dh int, df PixelFormat, f int, sfl, dfl *Filter, p *float64) *Context {
|
||||
func SwsGetcachedcontext(ctxt *Context, sw, sh int, sf PixelFormat, dw, dh int, df PixelFormat, f int, sfl, dfl *Filter, p *float64) *Context {
|
||||
return (*Context)(C.sws_getCachedContext((*C.struct_SwsContext)(ctxt), C.int(sw), C.int(sh), (C.enum_AVPixelFormat)(sf), C.int(dw), C.int(dh), (C.enum_AVPixelFormat)(df), C.int(f), (*C.struct_SwsFilter)(sfl), (*C.struct_SwsFilter)(dfl), (*C.double)(p)))
|
||||
}
|
||||
|
||||
//Convert an 8-bit paletted frame into a frame with a color depth of 32 bits.
|
||||
func Sws_convertPalette8ToPacked32(s, d *uint8, px int, p *uint8) {
|
||||
func SwsConvertpalette8topacked32(s, d *uint8, px int, p *uint8) {
|
||||
C.sws_convertPalette8ToPacked32((*C.uint8_t)(s), (*C.uint8_t)(d), C.int(px), (*C.uint8_t)(p))
|
||||
}
|
||||
|
||||
//Convert an 8-bit paletted frame into a frame with a color depth of 24 bits.
|
||||
func Sws_convertPalette8ToPacked24(s, d *uint8, px int, p *uint8) {
|
||||
func SwsConvertpalette8topacked24(s, d *uint8, px int, p *uint8) {
|
||||
C.sws_convertPalette8ToPacked24((*C.uint8_t)(s), (*C.uint8_t)(d), C.int(px), (*C.uint8_t)(p))
|
||||
}
|
||||
|
||||
//Get the Class for swsContext.
|
||||
func Sws_get_class() *Class {
|
||||
func SwsGetClass() *Class {
|
||||
return (*Class)(C.sws_get_class())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user