44 lines
953 B
Go
44 lines
953 B
Go
package ffmpeg
|
|
|
|
/*
|
|
#cgo pkg-config: libavcodec libavformat libavutil libavfilter libswscale libswresample
|
|
#cgo LDFLAGS: -lavcodec -lavformat -lavutil -lavfilter -lswscale -lswresample
|
|
|
|
#include <libavcodec/avcodec.h>
|
|
#include <libavformat/avformat.h>
|
|
#include <libavutil/opt.h>
|
|
#include <stdlib.h>
|
|
*/
|
|
import "C"
|
|
|
|
// Duration returns the duration in microseconds
|
|
func (fc *FormatContext) Duration() int64 {
|
|
if fc.ptr == nil {
|
|
return 0
|
|
}
|
|
return int64(fc.ptr.duration)
|
|
}
|
|
|
|
// StartTime returns the start time in microseconds
|
|
func (fc *FormatContext) StartTime() int64 {
|
|
if fc.ptr == nil {
|
|
return 0
|
|
}
|
|
return int64(fc.ptr.start_time)
|
|
}
|
|
|
|
// BitRate returns the bit rate
|
|
func (fc *FormatContext) BitRate() int64 {
|
|
if fc.ptr == nil {
|
|
return 0
|
|
}
|
|
return int64(fc.ptr.bit_rate)
|
|
}
|
|
|
|
// ChannelLayout returns the channel layout
|
|
func (cp *CodecParameters) ChannelLayout() uint64 {
|
|
if cp.ptr == nil {
|
|
return 0
|
|
}
|
|
return uint64(cp.ptr.channel_layout)
|
|
} |