mirror of
https://github.com/qrtc/ffmpeg-dev-go.git
synced 2025-10-04 15:23:13 +08:00
2023-10-31 09:16:44 CST W44D2
This commit is contained in:
1725
avcodec.go
1725
avcodec.go
File diff suppressed because it is too large
Load Diff
@@ -48,34 +48,6 @@ func AvFftEnd(s *FFTContext) {
|
||||
C.av_fft_end((*C.struct_FFTContext)(s))
|
||||
}
|
||||
|
||||
// AvMdctInit
|
||||
func AvMdctInit(nbits, inverse int32, scale float64) *FFTContext {
|
||||
return (*FFTContext)(C.av_mdct_init((C.int)(nbits), (C.int)(inverse), (C.double)(scale)))
|
||||
}
|
||||
|
||||
// AvImdctCalc
|
||||
func AvImdctCalc(s *FFTContext, output, input *FFTSample) {
|
||||
C.av_imdct_calc((*C.struct_FFTContext)(s),
|
||||
(*C.FFTSample)(output), (*C.FFTSample)(input))
|
||||
}
|
||||
|
||||
// AvImdctHalf
|
||||
func AvImdctHalf(s *FFTContext, output, input *FFTSample) {
|
||||
C.av_imdct_half((*C.struct_FFTContext)(s),
|
||||
(*C.FFTSample)(output), (*C.FFTSample)(input))
|
||||
}
|
||||
|
||||
// AvMdctCalc
|
||||
func AvMdctCalc(s *FFTContext, output, input *FFTSample) {
|
||||
C.av_mdct_calc((*C.struct_FFTContext)(s),
|
||||
(*C.FFTSample)(output), (*C.FFTSample)(input))
|
||||
}
|
||||
|
||||
// AvMdctEnd
|
||||
func AvMdctEnd(s *FFTContext) {
|
||||
C.av_mdct_end((*C.struct_FFTContext)(s))
|
||||
}
|
||||
|
||||
// RDFTransformType
|
||||
type RDFTransformType = C.enum_RDFTransformType
|
||||
|
||||
|
@@ -46,21 +46,6 @@ func (bsfc *AVBSFContext) GetFilterAddr() **AVBitStreamFilter {
|
||||
return (**AVBitStreamFilter)(unsafe.Pointer(&bsfc.filter))
|
||||
}
|
||||
|
||||
// GetInternal gets `AVBSFContext.internal` value.
|
||||
func (bsfc *AVBSFContext) GetInternal() *AVBSFInternal {
|
||||
return (*AVBSFInternal)(bsfc.internal)
|
||||
}
|
||||
|
||||
// SetInternal sets `AVBSFContext.internal` value.
|
||||
func (bsfc *AVBSFContext) SetInternal(v *AVBSFInternal) {
|
||||
bsfc.internal = (*C.struct_AVBSFInternal)(v)
|
||||
}
|
||||
|
||||
// GetInternalAddr gets `AVBSFContext.internal` address.
|
||||
func (bsfc *AVBSFContext) GetInternalAddr() **AVBSFInternal {
|
||||
return (**AVBSFInternal)(unsafe.Pointer(&bsfc.internal))
|
||||
}
|
||||
|
||||
// GetPrivData gets `AVBSFContext.priv_data` value.
|
||||
func (bsfc *AVBSFContext) GetPrivData() unsafe.Pointer {
|
||||
return bsfc.priv_data
|
||||
|
@@ -10,27 +10,28 @@ package ffmpeg
|
||||
import "C"
|
||||
|
||||
const (
|
||||
AV_CODEC_CAP_DRAW_HORIZ_BAND = C.AV_CODEC_CAP_DRAW_HORIZ_BAND
|
||||
AV_CODEC_CAP_DR1 = C.AV_CODEC_CAP_DR1
|
||||
AV_CODEC_CAP_TRUNCATED = C.AV_CODEC_CAP_TRUNCATED
|
||||
AV_CODEC_CAP_DELAY = C.AV_CODEC_CAP_DELAY
|
||||
AV_CODEC_CAP_SMALL_LAST_FRAME = C.AV_CODEC_CAP_SMALL_LAST_FRAME
|
||||
AV_CODEC_CAP_SUBFRAMES = C.AV_CODEC_CAP_SUBFRAMES
|
||||
AV_CODEC_CAP_EXPERIMENTAL = C.AV_CODEC_CAP_EXPERIMENTAL
|
||||
AV_CODEC_CAP_CHANNEL_CONF = C.AV_CODEC_CAP_CHANNEL_CONF
|
||||
AV_CODEC_CAP_FRAME_THREADS = C.AV_CODEC_CAP_FRAME_THREADS
|
||||
AV_CODEC_CAP_SLICE_THREADS = C.AV_CODEC_CAP_SLICE_THREADS
|
||||
AV_CODEC_CAP_PARAM_CHANGE = C.AV_CODEC_CAP_PARAM_CHANGE
|
||||
AV_CODEC_CAP_OTHER_THREADS = C.AV_CODEC_CAP_OTHER_THREADS
|
||||
AV_CODEC_CAP_AUTO_THREADS = C.AV_CODEC_CAP_AUTO_THREADS
|
||||
AV_CODEC_CAP_VARIABLE_FRAME_SIZE = C.AV_CODEC_CAP_VARIABLE_FRAME_SIZE
|
||||
AV_CODEC_CAP_AVOID_PROBING = C.AV_CODEC_CAP_AVOID_PROBING
|
||||
AV_CODEC_CAP_INTRA_ONLY = C.AV_CODEC_CAP_INTRA_ONLY
|
||||
AV_CODEC_CAP_LOSSLESS = C.AV_CODEC_CAP_LOSSLESS
|
||||
AV_CODEC_CAP_DRAW_HORIZ_BAND = C.AV_CODEC_CAP_DRAW_HORIZ_BAND
|
||||
AV_CODEC_CAP_DR1 = C.AV_CODEC_CAP_DR1
|
||||
|
||||
AV_CODEC_CAP_DELAY = C.AV_CODEC_CAP_DELAY
|
||||
AV_CODEC_CAP_SMALL_LAST_FRAME = C.AV_CODEC_CAP_SMALL_LAST_FRAME
|
||||
AV_CODEC_CAP_SUBFRAMES = C.AV_CODEC_CAP_SUBFRAMES
|
||||
AV_CODEC_CAP_EXPERIMENTAL = C.AV_CODEC_CAP_EXPERIMENTAL
|
||||
AV_CODEC_CAP_CHANNEL_CONF = C.AV_CODEC_CAP_CHANNEL_CONF
|
||||
AV_CODEC_CAP_FRAME_THREADS = C.AV_CODEC_CAP_FRAME_THREADS
|
||||
AV_CODEC_CAP_SLICE_THREADS = C.AV_CODEC_CAP_SLICE_THREADS
|
||||
AV_CODEC_CAP_PARAM_CHANGE = C.AV_CODEC_CAP_PARAM_CHANGE
|
||||
AV_CODEC_CAP_OTHER_THREADS = C.AV_CODEC_CAP_OTHER_THREADS
|
||||
|
||||
AV_CODEC_CAP_VARIABLE_FRAME_SIZE = C.AV_CODEC_CAP_VARIABLE_FRAME_SIZE
|
||||
AV_CODEC_CAP_AVOID_PROBING = C.AV_CODEC_CAP_AVOID_PROBING
|
||||
|
||||
AV_CODEC_CAP_HARDWARE = C.AV_CODEC_CAP_HARDWARE
|
||||
AV_CODEC_CAP_HYBRID = C.AV_CODEC_CAP_HYBRID
|
||||
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE = C.AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
|
||||
AV_CODEC_CAP_ENCODER_FLUSH = C.AV_CODEC_CAP_ENCODER_FLUSH
|
||||
|
||||
AV_CODEC_CAP_ENCODER_RECON_FRAME = C.AV_CODEC_CAP_ENCODER_RECON_FRAME
|
||||
)
|
||||
|
||||
// AVProfile
|
||||
@@ -102,6 +103,8 @@ func (codec *AVCodec) GetSampleFmts() []AVSampleFormat {
|
||||
})
|
||||
}
|
||||
|
||||
// Deprecated: Use ChLayouts instead.
|
||||
//
|
||||
// GetChannelLayouts gets `AVCodec.channel_layouts` value.
|
||||
func (codec *AVCodec) GetChannelLayouts() []uint64 {
|
||||
return SliceTrunc((*uint64)(codec.channel_layouts), func(u uint64) bool {
|
||||
@@ -126,6 +129,13 @@ func (codec *AVCodec) GetWrapperName() string {
|
||||
return C.GoString(codec.wrapper_name)
|
||||
}
|
||||
|
||||
// GetChLayouts gets `AVCodec.ch_layouts` value.
|
||||
func (codec *AVCodec) GetChLayouts() []AVChannelLayout {
|
||||
return SliceTrunc((*AVChannelLayout)(codec.ch_layouts), func(chl AVChannelLayout) bool {
|
||||
return chl.GetNbChannels() == 0
|
||||
})
|
||||
}
|
||||
|
||||
// AvCodecIterate iterates over all registered codecs.
|
||||
func AvCodecIterate(opaque CVoidPointerPointer) *AVCodec {
|
||||
return (*AVCodec)(C.av_codec_iterate(VoidPointerPointer(opaque)))
|
||||
@@ -155,16 +165,21 @@ func AvCodecFindEncoderByName(name string) *AVCodec {
|
||||
return (*AVCodec)(C.avcodec_find_encoder_by_name((*C.char)(namePtr)))
|
||||
}
|
||||
|
||||
// AvCodecIsEncoder returns a non-zero number if codec is an encoder, zero otherwise
|
||||
// AvCodecIsEncoder returns a non-zero number if codec is an encoder, zero otherwise.
|
||||
func AvCodecIsEncoder(codec *AVCodec) int32 {
|
||||
return (int32)(C.av_codec_is_encoder((*C.struct_AVCodec)(codec)))
|
||||
}
|
||||
|
||||
// AvCodecIsDecoder returns a non-zero number if codec is an decoder, zero otherwise
|
||||
// AvCodecIsDecoder returns a non-zero number if codec is an decoder, zero otherwise.
|
||||
func AvCodecIsDecoder(codec *AVCodec) int32 {
|
||||
return (int32)(C.av_codec_is_decoder((*C.struct_AVCodec)(codec)))
|
||||
}
|
||||
|
||||
// AvGetProfileName returns a name for the specified profile, if available.
|
||||
func AvGetProfileName(c *AVCodec, profile int32) string {
|
||||
return C.GoString(C.av_get_profile_name((*C.struct_AVCodec)(c), (C.int)(profile)))
|
||||
}
|
||||
|
||||
const (
|
||||
AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = int32(C.AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX)
|
||||
AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = int32(C.AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX)
|
||||
|
@@ -553,3 +553,23 @@ func AvCodecGetType(codecID AVCodecID) AVMediaType {
|
||||
func AvCodecGetName(codecID AVCodecID) string {
|
||||
return C.GoString(C.avcodec_get_name((C.enum_AVCodecID)(codecID)))
|
||||
}
|
||||
|
||||
// AvGetBitsPerSample returns codec bits per sample.
|
||||
func AvGetBitsPerSample(codecID AVCodecID) int32 {
|
||||
return (int32)(C.av_get_bits_per_sample((C.enum_AVCodecID)(codecID)))
|
||||
}
|
||||
|
||||
// AvGetExactBitsPerSample returns codec bits per sample.
|
||||
func AvGetExactBitsPerSample(codecID AVCodecID) int32 {
|
||||
return (int32)(C.av_get_exact_bits_per_sample((C.enum_AVCodecID)(codecID)))
|
||||
}
|
||||
|
||||
// AvCodecProfileName returns a name for the specified profile, if available.
|
||||
func AvCodecProfileName(codecID AVCodecID, profile int32) string {
|
||||
return C.GoString(C.avcodec_profile_name((C.enum_AVCodecID)(codecID), (C.int)(profile)))
|
||||
}
|
||||
|
||||
// AvGetPcmCodec returns the PCM codec associated with a sample format.
|
||||
func AvGetPcmCodec(fmt AVSampleFormat, be int32) AVCodecID {
|
||||
return (AVCodecID)(C.av_get_pcm_codec((C.enum_AVSampleFormat)(fmt), (C.int)(be)))
|
||||
}
|
||||
|
@@ -460,6 +460,21 @@ func (par *AVCodecParameters) GetSeekPrerollAddr() *int32 {
|
||||
return (*int32)(&par.seek_preroll)
|
||||
}
|
||||
|
||||
// GetChLayout gets `AVCodecContext.ch_layouts` value.
|
||||
func (par *AVCodecParameters) GetChLayout() AVChannelLayout {
|
||||
return (AVChannelLayout)(par.ch_layout)
|
||||
}
|
||||
|
||||
// SetChLayout sets `AVCodecContext.ch_layout` value.
|
||||
func (par *AVCodecParameters) SetChLayout(v AVChannelLayout) {
|
||||
par.ch_layout = (C.struct_AVChannelLayout)(v)
|
||||
}
|
||||
|
||||
// GetChLayoutAddr gets `AVCodecContext.ch_layouts` address.
|
||||
func (par *AVCodecParameters) GetChLayoutAddr() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&par.ch_layout)
|
||||
}
|
||||
|
||||
// AvCodecParametersAlloc allocates a new AVCodecParameters and set its fields to default values
|
||||
// (unknown/invalid/0). The returned struct must be freed with AVCodecParametersFree().
|
||||
func AvCodecParametersAlloc() *AVCodecParameters {
|
||||
@@ -477,3 +492,8 @@ func AvCodecParametersCopy(dst, src *AVCodecParameters) int32 {
|
||||
return (int32)(C.avcodec_parameters_copy((*C.struct_AVCodecParameters)(dst),
|
||||
(*C.struct_AVCodecParameters)(src)))
|
||||
}
|
||||
|
||||
// AvGetAudioFrameDuration2 returns audio frame duration.
|
||||
func AvGetAudioFrameDuration2(par *AVCodecParameters, frameBytes int32) int32 {
|
||||
return (int32)(C.av_get_audio_frame_duration2((*C.struct_AVCodecParameters)(par), (C.int)(frameBytes)))
|
||||
}
|
||||
|
262
avcodec_defs.go
Normal file
262
avcodec_defs.go
Normal file
@@ -0,0 +1,262 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavcodec/defs.h>
|
||||
*/
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
const (
|
||||
// Required number of additionally allocated bytes at the end of the input bitstream for decoding.
|
||||
AV_INPUT_BUFFER_PADDING_SIZE = C.AV_INPUT_BUFFER_PADDING_SIZE
|
||||
)
|
||||
|
||||
const (
|
||||
AV_EF_CRCCHECK = int32(C.AV_EF_CRCCHECK)
|
||||
AV_EF_BITSTREAM = int32(C.AV_EF_BITSTREAM)
|
||||
AV_EF_BUFFER = int32(C.AV_EF_BUFFER)
|
||||
AV_EF_EXPLODE = int32(C.AV_EF_EXPLODE)
|
||||
AV_EF_IGNORE_ERR = int32(C.AV_EF_IGNORE_ERR)
|
||||
AV_EF_CAREFUL = int32(C.AV_EF_CAREFUL)
|
||||
AV_EF_COMPLIANT = int32(C.AV_EF_COMPLIANT)
|
||||
AV_EF_AGGRESSIVE = int32(C.AV_EF_AGGRESSIVE)
|
||||
)
|
||||
|
||||
const (
|
||||
FF_COMPLIANCE_VERY_STRICT = int32(C.FF_COMPLIANCE_VERY_STRICT)
|
||||
FF_COMPLIANCE_STRICT = int32(C.FF_COMPLIANCE_STRICT)
|
||||
FF_COMPLIANCE_NORMAL = int32(C.FF_COMPLIANCE_NORMAL)
|
||||
FF_COMPLIANCE_UNOFFICIAL = int32(C.FF_COMPLIANCE_UNOFFICIAL)
|
||||
FF_COMPLIANCE_EXPERIMENTAL = int32(C.FF_COMPLIANCE_EXPERIMENTAL)
|
||||
)
|
||||
|
||||
// AVDiscard
|
||||
type AVDiscard = C.enum_AVDiscard
|
||||
|
||||
const (
|
||||
AVDISCARD_NONE = AVDiscard(C.AVDISCARD_NONE)
|
||||
AVDISCARD_DEFAULT = AVDiscard(C.AVDISCARD_DEFAULT)
|
||||
AVDISCARD_NONREF = AVDiscard(C.AVDISCARD_NONREF)
|
||||
AVDISCARD_BIDIR = AVDiscard(C.AVDISCARD_BIDIR)
|
||||
AVDISCARD_NONINTRA = AVDiscard(C.AVDISCARD_NONINTRA)
|
||||
AVDISCARD_NONKEY = AVDiscard(C.AVDISCARD_NONKEY)
|
||||
AVDISCARD_ALL = AVDiscard(C.AVDISCARD_ALL)
|
||||
)
|
||||
|
||||
// AVAudioServiceType
|
||||
type AVAudioServiceType = C.enum_AVAudioServiceType
|
||||
|
||||
const (
|
||||
AV_AUDIO_SERVICE_TYPE_MAIN = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_MAIN)
|
||||
AV_AUDIO_SERVICE_TYPE_EFFECTS = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_EFFECTS)
|
||||
AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED)
|
||||
AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED)
|
||||
AV_AUDIO_SERVICE_TYPE_DIALOGUE = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_DIALOGUE)
|
||||
AV_AUDIO_SERVICE_TYPE_COMMENTARY = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_COMMENTARY)
|
||||
AV_AUDIO_SERVICE_TYPE_EMERGENCY = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_EMERGENCY)
|
||||
AV_AUDIO_SERVICE_TYPE_VOICE_OVER = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_VOICE_OVER)
|
||||
AV_AUDIO_SERVICE_TYPE_KARAOKE = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_KARAOKE)
|
||||
AV_AUDIO_SERVICE_TYPE_NB = AVAudioServiceType(C.AV_AUDIO_SERVICE_TYPE_NB)
|
||||
)
|
||||
|
||||
// Pan Scan area.
|
||||
// This specifies the area which should be displayed.
|
||||
// Note there may be multiple such areas for one frame.
|
||||
type AVPanScan C.struct_AVPanScan
|
||||
|
||||
// GetId gets `AVPanScan.id` value.
|
||||
func (psn *AVPanScan) GetId() int32 {
|
||||
return (int32)(psn.id)
|
||||
}
|
||||
|
||||
// SetId sets `AVPanScan.id` value.
|
||||
func (psn *AVPanScan) SetId(v int32) {
|
||||
psn.id = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetIdAddr gets `AVPanScan.id` address.
|
||||
func (psn *AVPanScan) GetIdAddr() *int32 {
|
||||
return (*int32)(&psn.id)
|
||||
}
|
||||
|
||||
// GetWidth gets `AVPanScan.width` value.
|
||||
func (psn *AVPanScan) GetWidth() int32 {
|
||||
return (int32)(psn.width)
|
||||
}
|
||||
|
||||
// SetWidth sets `AVPanScan.width` value.
|
||||
func (psn *AVPanScan) SetWidth(v int32) {
|
||||
psn.width = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetWidthAddr gets `AVPanScan.width` address.
|
||||
func (psn *AVPanScan) GetWidthAddr() *int32 {
|
||||
return (*int32)(&psn.width)
|
||||
}
|
||||
|
||||
// GetHeight gets `AVPanScan.height` value.
|
||||
func (psn *AVPanScan) GetHeight() int32 {
|
||||
return (int32)(psn.height)
|
||||
}
|
||||
|
||||
// SetHeight sets `AVPanScan.height` value.
|
||||
func (psn *AVPanScan) SetHeight(v int32) {
|
||||
psn.height = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetHeightAddr gets `AVPanScan.height` address.
|
||||
func (psn *AVPanScan) GetHeightAddr() *int32 {
|
||||
return (*int32)(&psn.height)
|
||||
}
|
||||
|
||||
// GetPosition gets `AVPanScan.position` value.
|
||||
func (psn *AVPanScan) GetPosition() (v [][]int16) {
|
||||
for i := 0; i < 3; i++ {
|
||||
v = append(v, unsafe.Slice((*int16)(&psn.position[i][0]), 2))
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// SetPosition sets `AVPanScan.position` value.
|
||||
func (psn *AVPanScan) SetPosition(v [][]int16) {
|
||||
for i := 0; i < FFMIN(len(v), 3); i++ {
|
||||
for j := 0; j < FFMIN(len(v[i]), 2); j++ {
|
||||
psn.position[i][j] = (C.int16_t)(v[i][j])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GetPositionAddr gets `AVPanScan.position` address.
|
||||
func (psn *AVPanScan) GetPositionAddr() **int16 {
|
||||
return (**int16)(unsafe.Pointer(&psn.position))
|
||||
}
|
||||
|
||||
// This structure describes the bitrate properties of an encoded bitstream. It
|
||||
// roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
|
||||
// parameters for H.264/HEVC.
|
||||
type AVCPBProperties C.struct_AVCPBProperties
|
||||
|
||||
// GetMaxBitrate gets `AVCPBProperties.max_bitrate` value.
|
||||
func (cpbp *AVCPBProperties) GetMaxBitrate() int64 {
|
||||
return (int64)(cpbp.max_bitrate)
|
||||
}
|
||||
|
||||
// SetMaxBitrate sets `AVCPBProperties.max_bitrate` value.
|
||||
func (cpbp *AVCPBProperties) SetMaxBitrate(v int64) {
|
||||
cpbp.max_bitrate = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetMaxBitrateAddr gets `AVCPBProperties.max_bitrate` address.
|
||||
func (cpbp *AVCPBProperties) GetMaxBitrateAddr() *int64 {
|
||||
return (*int64)(&cpbp.max_bitrate)
|
||||
}
|
||||
|
||||
// GetMinBitrate gets `AVCPBProperties.min_bitrate` value.
|
||||
func (cpbp *AVCPBProperties) GetMinBitrate() int64 {
|
||||
return (int64)(cpbp.min_bitrate)
|
||||
}
|
||||
|
||||
// SetMinBitrate sets `AVCPBProperties.min_bitrate` value.
|
||||
func (cpbp *AVCPBProperties) SetMinBitrate(v int64) {
|
||||
cpbp.min_bitrate = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetMinBitrateAddr gets `AVCPBProperties.min_bitrate` address.
|
||||
func (cpbp *AVCPBProperties) GetMinBitrateAddr() *int64 {
|
||||
return (*int64)(&cpbp.min_bitrate)
|
||||
}
|
||||
|
||||
// GetAvgBitrate gets `AVCPBProperties.avg_bitrate` value.
|
||||
func (cpbp *AVCPBProperties) GetAvgBitrate() int64 {
|
||||
return (int64)(cpbp.avg_bitrate)
|
||||
}
|
||||
|
||||
// SetAvgBitrate sets `AVCPBProperties.avg_bitrate` value.
|
||||
func (cpbp *AVCPBProperties) SetAvgBitrate(v int64) {
|
||||
cpbp.avg_bitrate = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetAvgBitrateAddr gets `AVCPBProperties.avg_bitrate` address.
|
||||
func (cpbp *AVCPBProperties) GetAvgBitrateAddr() *int64 {
|
||||
return (*int64)(&cpbp.avg_bitrate)
|
||||
}
|
||||
|
||||
// GetBufferSize gets `AVCPBProperties.buffer_size` value.
|
||||
func (cpbp *AVCPBProperties) GetBufferSize() int64 {
|
||||
return (int64)(cpbp.buffer_size)
|
||||
}
|
||||
|
||||
// SetBufferSize sets `AVCPBProperties.buffer_size` value.
|
||||
func (cpbp *AVCPBProperties) SetBufferSize(v int64) {
|
||||
cpbp.buffer_size = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetBufferSizeAddr gets `AVCPBProperties.buffer_size` address.
|
||||
func (cpbp *AVCPBProperties) GetBufferSizeAddr() *int64 {
|
||||
return (*int64)(&cpbp.buffer_size)
|
||||
}
|
||||
|
||||
// GetVbvDelay gets `AVCPBProperties.vbv_delay` value.
|
||||
func (cpbp *AVCPBProperties) GetVbvDelay() uint64 {
|
||||
return (uint64)(cpbp.vbv_delay)
|
||||
}
|
||||
|
||||
// SetVbvDelay sets `AVCPBProperties.vbv_delay` value.
|
||||
func (cpbp *AVCPBProperties) SetVbvDelay(v uint64) {
|
||||
cpbp.vbv_delay = (C.uint64_t)(v)
|
||||
}
|
||||
|
||||
// GetVbvDelayAddr gets `AVCPBProperties.vbv_delay` address.
|
||||
func (cpbp *AVCPBProperties) GetVbvDelayAddr() *uint64 {
|
||||
return (*uint64)(&cpbp.vbv_delay)
|
||||
}
|
||||
|
||||
// AvCpbPropertiesAlloc allocates a CPB properties structure and initialize its fields to default
|
||||
// values.
|
||||
func AvCpbPropertiesAlloc(size *uintptr) *AVCPBProperties {
|
||||
return (*AVCPBProperties)(C.av_cpb_properties_alloc((*C.size_t)(unsafe.Pointer(size))))
|
||||
}
|
||||
|
||||
// This structure supplies correlation between a packet timestamp and a wall clock
|
||||
// production time. The definition follows the Producer Reference Time ('prft')
|
||||
// as defined in ISO/IEC 14496-12
|
||||
type AVProducerReferenceTime C.struct_AVProducerReferenceTime
|
||||
|
||||
// GetWallclock gets `AVProducerReferenceTime.wallclock` value.
|
||||
func (prt *AVProducerReferenceTime) GetWallclock() int64 {
|
||||
return (int64)(prt.wallclock)
|
||||
}
|
||||
|
||||
// SetWallclock sets `AVProducerReferenceTime.wallclock` value.
|
||||
func (prt *AVProducerReferenceTime) SetWallclock(v int64) {
|
||||
prt.wallclock = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetWallclockAddr gets `AVProducerReferenceTime.wallclock` address.
|
||||
func (prt *AVProducerReferenceTime) GetWallclockAddr() *int64 {
|
||||
return (*int64)(&prt.wallclock)
|
||||
}
|
||||
|
||||
// GetFlags gets `AVProducerReferenceTime.flags` value.
|
||||
func (prt *AVProducerReferenceTime) GetFlags() int32 {
|
||||
return (int32)(prt.flags)
|
||||
}
|
||||
|
||||
// SetFlags sets `AVProducerReferenceTime.flags` value.
|
||||
func (prt *AVProducerReferenceTime) SetFlags(v int32) {
|
||||
prt.flags = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetFlagsAddr gets `AVProducerReferenceTime.flags` address.
|
||||
func (prt *AVProducerReferenceTime) GetFlagsAddr() *int32 {
|
||||
return (*int32)(&prt.flags)
|
||||
}
|
||||
|
||||
// AvXiphlacing encodes extradata length to a buffer. Used by xiph codecs.
|
||||
func AvXiphlacing(s *uint8, v int32) int32 {
|
||||
return (int32)(C.av_xiphlacing((*C.uchar)(s), (C.uint)(v)))
|
||||
}
|
@@ -25,7 +25,7 @@ func AvMediacodecDefaultInit(avctx *AVCodecContext, ctx *AVMediaCodecContext, su
|
||||
(*C.struct_AVMediaCodecContext)(ctx), VoidPointer(surface)))
|
||||
}
|
||||
|
||||
// AvMediacodecDefaultFree frees the MediaCodec context
|
||||
// AvMediacodecDefaultFree frees the MediaCodec context.
|
||||
func AvMediacodecDefaultFree(avctx *AVCodecContext) {
|
||||
C.av_mediacodec_default_free((*C.struct_AVCodecContext)(avctx))
|
||||
}
|
||||
|
@@ -45,6 +45,7 @@ const (
|
||||
AV_PKT_DATA_ICC_PROFILE = AVPacketSideDataType(C.AV_PKT_DATA_ICC_PROFILE)
|
||||
AV_PKT_DATA_DOVI_CONF = AVPacketSideDataType(C.AV_PKT_DATA_DOVI_CONF)
|
||||
AV_PKT_DATA_S12M_TIMECODE = AVPacketSideDataType(C.AV_PKT_DATA_S12M_TIMECODE)
|
||||
AV_PKT_DATA_DYNAMIC_HDR10_PLUS = AVPacketSideDataType(C.AV_PKT_DATA_DYNAMIC_HDR10_PLUS)
|
||||
AV_PKT_DATA_NB = AVPacketSideDataType(C.AV_PKT_DATA_NB)
|
||||
)
|
||||
|
||||
@@ -72,18 +73,18 @@ func (psd *AVPacketSideData) GetDataAddr() **uint8 {
|
||||
}
|
||||
|
||||
// GetSize gets `AVPacketSideData.size` value.
|
||||
func (psd *AVPacketSideData) GetSize() int32 {
|
||||
return (int32)(psd.size)
|
||||
func (psd *AVPacketSideData) GetSize() uintptr {
|
||||
return (uintptr)(psd.size)
|
||||
}
|
||||
|
||||
// SetSize sets `AVPacketSideData.size` value.
|
||||
func (psd *AVPacketSideData) SetSize(v int32) {
|
||||
psd.size = (C.int)(v)
|
||||
func (psd *AVPacketSideData) SetSize(v uintptr) {
|
||||
psd.size = (C.size_t)(v)
|
||||
}
|
||||
|
||||
// GetSizeAddr gets `AVPacketSideData.size` address.
|
||||
func (psd *AVPacketSideData) GetSizeAddr() *int32 {
|
||||
return (*int32)(&psd.size)
|
||||
func (psd *AVPacketSideData) GetSizeAddr() *uintptr {
|
||||
return (*uintptr)(unsafe.Pointer(&psd.size))
|
||||
}
|
||||
|
||||
// GetType gets `AVPacketSideData.type` value.
|
||||
@@ -269,25 +270,49 @@ func (pkt *AVPacket) GetPosAddr() *int64 {
|
||||
return (*int64)(&pkt.pos)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetConvergenceDuration gets `AVPacket.convergence_duration` value.
|
||||
func (pkt *AVPacket) GetConvergenceDuration() int64 {
|
||||
return (int64)(pkt.convergence_duration)
|
||||
// GetOpaque gets `AVPacket.opaque` value.
|
||||
func (pkt *AVPacket) GetOpaque() unsafe.Pointer {
|
||||
return pkt.opaque
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SetConvergenceDuration sets `AVPacket.convergence_duration` value.
|
||||
func (pkt *AVPacket) SetConvergenceDuration(v int64) {
|
||||
pkt.convergence_duration = (C.int64_t)(v)
|
||||
// SetOpaque sets `AVPacket.opaque` value.
|
||||
func (pkt *AVPacket) SetOpaque(v CVoidPointer) {
|
||||
pkt.opaque = VoidPointer(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetConvergenceDurationAddr gets `AVPacket.convergence_duration` address.
|
||||
func (pkt *AVPacket) GetConvergenceDurationAddr() *int64 {
|
||||
return (*int64)(&pkt.convergence_duration)
|
||||
// GetOpaqueAddr gets `AVPacket.opaque` address.
|
||||
func (pkt *AVPacket) GetOpaqueAddr() *unsafe.Pointer {
|
||||
return &pkt.opaque
|
||||
}
|
||||
|
||||
// GetOpaqueRef gets `AVPacket.opaque_ref` value.
|
||||
func (pkt *AVPacket) GetOpaqueRef() *AVBufferRef {
|
||||
return (*AVBufferRef)(pkt.opaque_ref)
|
||||
}
|
||||
|
||||
// SetOpaqueRef sets `AVPacket.opaque_ref` value.
|
||||
func (pkt *AVPacket) SetOpaqueRef(v *AVBufferRef) {
|
||||
pkt.opaque_ref = (*C.struct_AVBufferRef)(v)
|
||||
}
|
||||
|
||||
// GetOpaqueRefAddr gets `AVPacket.opaque_ref` address.
|
||||
func (pkt *AVPacket) GetOpaqueRefAddr() **AVBufferRef {
|
||||
return (**AVBufferRef)(unsafe.Pointer(&pkt.opaque_ref))
|
||||
}
|
||||
|
||||
// GetTimeBase gets `AVPacket.time_base` value.
|
||||
func (pkt *AVPacket) GetTimeBase() AVRational {
|
||||
return (AVRational)(pkt.time_base)
|
||||
}
|
||||
|
||||
// SetTimeBase sets `AVPacket.time_base` value.
|
||||
func (pkt *AVPacket) SetTimeBase(v AVRational) {
|
||||
pkt.time_base = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetTimeBaseAddr gets `AVPacket.time_base` address.
|
||||
func (pkt *AVPacket) GetTimeBaseAddr() *AVRational {
|
||||
return (*AVRational)(&pkt.time_base)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
@@ -328,7 +353,7 @@ const (
|
||||
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = AVSideDataParamChangeFlags(C.AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
|
||||
)
|
||||
|
||||
// AvPacketAlloc allocates an AVPacket and set its fields to default values. The resulting
|
||||
// AvPacketAlloc allocates an AVPacket and set its fields to default values. The resulting
|
||||
// struct must be freed using AVPacketFree().
|
||||
func AvPacketAlloc() *AVPacket {
|
||||
return (*AVPacket)(C.av_packet_alloc())
|
||||
@@ -358,12 +383,12 @@ func AvNewPacket(pkt *AVPacket, size int32) int32 {
|
||||
return (int32)(C.av_new_packet((*C.struct_AVPacket)(pkt), (C.int)(size)))
|
||||
}
|
||||
|
||||
// AvShrinkPacket reduces packet size, correctly zeroing padding
|
||||
// AvShrinkPacket reduces packet size, correctly zeroing padding.
|
||||
func AvShrinkPacket(pkt *AVPacket, size int32) {
|
||||
C.av_shrink_packet((*C.struct_AVPacket)(pkt), (C.int)(size))
|
||||
}
|
||||
|
||||
// AvGrowPacket increases packet size, correctly zeroing padding
|
||||
// AvGrowPacket increases packet size, correctly zeroing padding.
|
||||
func AvGrowPacket(pkt *AVPacket, growBy int32) int32 {
|
||||
return (int32)(C.av_grow_packet((*C.struct_AVPacket)(pkt), (C.int)(growBy)))
|
||||
}
|
||||
@@ -374,38 +399,10 @@ func AvPacketFromData(pkt *AVPacket, data *uint8, size int32) int32 {
|
||||
(*C.uint8_t)(data), (C.int)(size)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AVPacketRef() or AVPacketMakeRefcounted() instead.
|
||||
//
|
||||
// AvDupPacket
|
||||
func AvDupPacket(pkt *AVPacket) {
|
||||
C.av_dup_packet((*C.struct_AVPacket)(pkt))
|
||||
}
|
||||
|
||||
// Deprecated: Use AVPacketRef instead.
|
||||
//
|
||||
// AvCopyPacket copies packet, including contents
|
||||
func AvCopyPacket(dst, src *AVPacket) int32 {
|
||||
return (int32)(C.av_copy_packet((*C.struct_AVPacket)(dst), (*C.struct_AVPacket)(src)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AVPacketCopyProps instead.
|
||||
//
|
||||
// AvCopyPacketSideData copies packet side data
|
||||
func AvCopyPacketSideData(dst, src *AVPacket) int32 {
|
||||
return (int32)(C.av_copy_packet_side_data((*C.struct_AVPacket)(dst), (*C.struct_AVPacket)(src)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AVPacketUnref() instead.
|
||||
//
|
||||
// AvFreePacket frees a packet.
|
||||
func AvFreePacket(pkt *AVPacket) {
|
||||
C.av_free_packet((*C.struct_AVPacket)(pkt))
|
||||
}
|
||||
|
||||
// AvPacketNewSideData allocates new information of a packet.
|
||||
func AvPacketNewSideData(pkt *AVPacket, _type AVPacketSideDataType, size int32) *uint8 {
|
||||
func AvPacketNewSideData(pkt *AVPacket, _type AVPacketSideDataType, size uintptr) *uint8 {
|
||||
return (*uint8)(C.av_packet_new_side_data((*C.struct_AVPacket)(pkt),
|
||||
(C.enum_AVPacketSideDataType)(_type), (C.int)(size)))
|
||||
(C.enum_AVPacketSideDataType)(_type), (C.size_t)(size)))
|
||||
}
|
||||
|
||||
// AvPacketAddSideData wraps an existing array as a packet side data.
|
||||
@@ -415,40 +412,26 @@ func AvPacketAddSideData(pkt *AVPacket, _type AVPacketSideDataType, data *uint8,
|
||||
}
|
||||
|
||||
// AvPacketShrinkSideData shrinks the already allocated side data buffer.
|
||||
func AvPacketShrinkSideData(pkt *AVPacket, _type AVPacketSideDataType, size int32) int32 {
|
||||
func AvPacketShrinkSideData(pkt *AVPacket, _type AVPacketSideDataType, size uintptr) int32 {
|
||||
return (int32)(C.av_packet_shrink_side_data((*C.struct_AVPacket)(pkt),
|
||||
(C.enum_AVPacketSideDataType)(_type), (C.int)(size)))
|
||||
(C.enum_AVPacketSideDataType)(_type), (C.size_t)(size)))
|
||||
}
|
||||
|
||||
// AvPacketGetSideData gets side information from packet.
|
||||
func AvPacketGetSideData(pkt *AVPacket, _type AVPacketSideDataType, size *int32) *uint8 {
|
||||
func AvPacketGetSideData(pkt *AVPacket, _type AVPacketSideDataType, size *uintptr) *uint8 {
|
||||
return (*uint8)(C.av_packet_get_side_data((*C.struct_AVPacket)(pkt),
|
||||
(C.enum_AVPacketSideDataType)(_type), (*C.int)(size)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvPacketMergeSideData
|
||||
func AvPacketMergeSideData(pkt *AVPacket) int32 {
|
||||
return (int32)(C.av_packet_merge_side_data((*C.struct_AVPacket)(pkt)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvPacketSplitSideData
|
||||
func AvPacketSplitSideData(pkt *AVPacket) int32 {
|
||||
return (int32)(C.av_packet_split_side_data((*C.struct_AVPacket)(pkt)))
|
||||
(C.enum_AVPacketSideDataType)(_type), (*C.size_t)(unsafe.Pointer(size))))
|
||||
}
|
||||
|
||||
// AvPacketPackDictionary packs a dictionary for use in side_data.
|
||||
func AvPacketPackDictionary(dict *AVDictionary, size *int32) *uint8 {
|
||||
func AvPacketPackDictionary(dict *AVDictionary, size *uintptr) *uint8 {
|
||||
return (*uint8)(C.av_packet_pack_dictionary((*C.struct_AVDictionary)(dict),
|
||||
(*C.int)(size)))
|
||||
(*C.size_t)(unsafe.Pointer(size))))
|
||||
}
|
||||
|
||||
// AvPacketUnpackDictionary unpacks a dictionary from side_data.
|
||||
func AvPacketUnpackDictionary(data *uint8, size int32, dict **AVDictionary) int32 {
|
||||
return (int32)(C.av_packet_unpack_dictionary((*C.uint8_t)(data), (C.int)(size),
|
||||
func AvPacketUnpackDictionary(data *uint8, size uintptr, dict **AVDictionary) int32 {
|
||||
return (int32)(C.av_packet_unpack_dictionary((*C.uint8_t)(data), (C.size_t)(size),
|
||||
(**C.struct_AVDictionary)(unsafe.Pointer(dict))))
|
||||
}
|
||||
|
||||
@@ -457,7 +440,7 @@ func AvPacketFreeSideData(pkt *AVPacket) {
|
||||
C.av_packet_free_side_data((*C.struct_AVPacket)(pkt))
|
||||
}
|
||||
|
||||
// AvPacketRef setups a new reference to the data described by a given packet
|
||||
// AvPacketRef setups a new reference to the data described by a given packet.
|
||||
func AvPacketRef(dst, src *AVPacket) int32 {
|
||||
return (int32)(C.av_packet_ref((*C.struct_AVPacket)(dst), (*C.struct_AVPacket)(src)))
|
||||
}
|
||||
@@ -483,7 +466,7 @@ func AvPacketMakeRefcounted(pkt *AVPacket) {
|
||||
C.av_packet_make_refcounted((*C.struct_AVPacket)(pkt))
|
||||
}
|
||||
|
||||
// AvPacketMakeWritable creates a writable reference for the data described by a given packet,
|
||||
// AvPacketMakeWritable creates a writable reference for the data described by a given packet,
|
||||
// avoiding data copy if possible.
|
||||
func AvPacketMakeWritable(pkt *AVPacket) {
|
||||
C.av_packet_make_writable((*C.struct_AVPacket)(pkt))
|
||||
|
@@ -10,7 +10,6 @@ package ffmpeg
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBAVCODEC_VERSION_MAJOR = C.LIBAVCODEC_VERSION_MAJOR
|
||||
LIBAVCODEC_VERSION_MINOR = C.LIBAVCODEC_VERSION_MINOR
|
||||
LIBAVCODEC_VERSION_MICRO = C.LIBAVCODEC_VERSION_MICRO
|
||||
)
|
||||
|
14
avcodec_version_major.go
Normal file
14
avcodec_version_major.go
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavcodec/version_major.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBAVCODEC_VERSION_MAJOR = C.LIBAVCODEC_VERSION_MAJOR
|
||||
)
|
@@ -11,6 +11,7 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVVideotoolboxContext
|
||||
type AVVideotoolboxContext C.struct_AVVideotoolboxContext
|
||||
|
||||
// AvVideotoolboxAllocContext allocates and initializes a Videotoolbox context.
|
||||
|
212
avdevice.go
212
avdevice.go
@@ -165,220 +165,8 @@ func AvDeviceDevToAppControlMessage(s *AVFormatContext,
|
||||
// AVDeviceCapabilitiesQuery
|
||||
type AVDeviceCapabilitiesQuery C.struct_AVDeviceCapabilitiesQuery
|
||||
|
||||
// GetAvClass gets `AVDeviceCapabilitiesQuery.av_class` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetAvClass() *AVClass {
|
||||
return (*AVClass)(dc.av_class)
|
||||
}
|
||||
|
||||
// SetAvClass sets `AVDeviceCapabilitiesQuery.av_class` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetAvClass(v *AVClass) {
|
||||
dc.av_class = (*C.struct_AVClass)(v)
|
||||
}
|
||||
|
||||
// GetAvClassAddr gets `AVDeviceCapabilitiesQuery.av_class` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetAvClassAddr() **AVClass {
|
||||
return (**AVClass)(unsafe.Pointer(&dc.av_class))
|
||||
}
|
||||
|
||||
// GetDeviceContext gets `AVDeviceCapabilitiesQuery.device_context` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetDeviceContext() *AVFormatContext {
|
||||
return (*AVFormatContext)(dc.device_context)
|
||||
}
|
||||
|
||||
// SetDeviceContext sets `AVDeviceCapabilitiesQuery.device_context` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetDeviceContext(v *AVFormatContext) {
|
||||
dc.device_context = (*C.struct_AVFormatContext)(v)
|
||||
}
|
||||
|
||||
// GetDeviceContextAddr gets `AVDeviceCapabilitiesQuery.device_context` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetDeviceContextAddr() **AVFormatContext {
|
||||
return (**AVFormatContext)(unsafe.Pointer(&dc.device_context))
|
||||
}
|
||||
|
||||
// GetCodec gets `AVDeviceCapabilitiesQuery.codec` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetCodec() AVCodecID {
|
||||
return (AVCodecID)(dc.codec)
|
||||
}
|
||||
|
||||
// SetCodec sets `AVDeviceCapabilitiesQuery.codec` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetCodec(v AVCodecID) {
|
||||
dc.codec = (C.enum_AVCodecID)(v)
|
||||
}
|
||||
|
||||
// GetCodecAddr gets `AVDeviceCapabilitiesQuery.codec` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetCodecAddr() *AVCodecID {
|
||||
return (*AVCodecID)(&dc.codec)
|
||||
}
|
||||
|
||||
// GetSampleFormat gets `AVDeviceCapabilitiesQuery.sample_format` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetSampleFormat() AVSampleFormat {
|
||||
return (AVSampleFormat)(dc.sample_format)
|
||||
}
|
||||
|
||||
// SetSampleFormat sets `AVDeviceCapabilitiesQuery.sample_format` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetSampleFormat(v AVSampleFormat) {
|
||||
dc.sample_format = (C.enum_AVSampleFormat)(v)
|
||||
}
|
||||
|
||||
// GetSampleFormatAddr gets `AVDeviceCapabilitiesQuery.sample_format` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetSampleFormatAddr() *AVSampleFormat {
|
||||
return (*AVSampleFormat)(&dc.sample_format)
|
||||
}
|
||||
|
||||
// GetPixelFormat gets `AVDeviceCapabilitiesQuery.pixel_format` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetPixelFormat() AVPixelFormat {
|
||||
return (AVPixelFormat)(dc.pixel_format)
|
||||
}
|
||||
|
||||
// SetPixelFormat sets `AVDeviceCapabilitiesQuery.pixel_format` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetPixelFormat(v AVPixelFormat) {
|
||||
dc.pixel_format = (C.enum_AVPixelFormat)(v)
|
||||
}
|
||||
|
||||
// GetPixelFormatAddr gets `AVDeviceCapabilitiesQuery.pixel_format` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetPixelFormatAddr() *AVPixelFormat {
|
||||
return (*AVPixelFormat)(&dc.pixel_format)
|
||||
}
|
||||
|
||||
// GetSampleRate gets `AVDeviceCapabilitiesQuery.sample_rate` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetSampleRate() int32 {
|
||||
return (int32)(dc.sample_rate)
|
||||
}
|
||||
|
||||
// SetSampleRate sets `AVDeviceCapabilitiesQuery.sample_rate` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetSampleRate(v int32) {
|
||||
dc.sample_rate = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetSampleRateAddr gets `AVDeviceCapabilitiesQuery.sample_rate` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetSampleRateAddr() *int32 {
|
||||
return (*int32)(&dc.sample_rate)
|
||||
}
|
||||
|
||||
// GetChannels gets `AVDeviceCapabilitiesQuery.channels` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetChannels() int32 {
|
||||
return (int32)(dc.channels)
|
||||
}
|
||||
|
||||
// SetChannels sets `AVDeviceCapabilitiesQuery.channels` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetChannels(v int32) {
|
||||
dc.channels = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetChannelsAddr gets `AVDeviceCapabilitiesQuery.channels` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetChannelsAddr() *int32 {
|
||||
return (*int32)(&dc.channels)
|
||||
}
|
||||
|
||||
// GetChannelLayout gets `AVDeviceCapabilitiesQuery.channel_layout` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetChannelLayout() int64 {
|
||||
return (int64)(dc.channel_layout)
|
||||
}
|
||||
|
||||
// SetChannelLayout sets `AVDeviceCapabilitiesQuery.channel_layout` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetChannelLayout(v int64) {
|
||||
dc.channel_layout = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetChannelLayoutAddr gets `AVDeviceCapabilitiesQuery.channel_layout` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetChannelLayoutAddr() *int64 {
|
||||
return (*int64)(&dc.channel_layout)
|
||||
}
|
||||
|
||||
// GetWindowWidth gets `AVDeviceCapabilitiesQuery.window_width` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetWindowWidth() int32 {
|
||||
return (int32)(dc.window_width)
|
||||
}
|
||||
|
||||
// SetWindowWidth sets `AVDeviceCapabilitiesQuery.window_width` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetWindowWidth(v int32) {
|
||||
dc.window_width = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetWindowWidthAddr gets `AVDeviceCapabilitiesQuery.window_width` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetWindowWidthAddr() *int32 {
|
||||
return (*int32)(&dc.window_width)
|
||||
}
|
||||
|
||||
// GetWindowHeight gets `AVDeviceCapabilitiesQuery.window_height` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetWindowHeight() int32 {
|
||||
return (int32)(dc.window_height)
|
||||
}
|
||||
|
||||
// SetWindowHeight sets `AVDeviceCapabilitiesQuery.window_height` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetWindowHeight(v int32) {
|
||||
dc.window_height = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetWindowHeightAddr gets `AVDeviceCapabilitiesQuery.window_height` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetWindowHeightAddr() *int32 {
|
||||
return (*int32)(&dc.window_height)
|
||||
}
|
||||
|
||||
// GetFrameWidth gets `AVDeviceCapabilitiesQuery.frame_width` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetFrameWidth() int32 {
|
||||
return (int32)(dc.frame_width)
|
||||
}
|
||||
|
||||
// SetFrameWidth sets `AVDeviceCapabilitiesQuery.frame_width` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetFrameWidth(v int32) {
|
||||
dc.frame_width = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetFrameWidthAddr gets `AVDeviceCapabilitiesQuery.frame_width` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetFrameWidthAddr() *int32 {
|
||||
return (*int32)(&dc.frame_width)
|
||||
}
|
||||
|
||||
// GetFrameHeight gets `AVDeviceCapabilitiesQuery.frame_height` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetFrameHeight() int32 {
|
||||
return (int32)(dc.frame_height)
|
||||
}
|
||||
|
||||
// SetFrameHeight sets `AVDeviceCapabilitiesQuery.frame_height` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetFrameHeight(v int32) {
|
||||
dc.frame_height = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetFrameHeightAddr gets `AVDeviceCapabilitiesQuery.frame_height` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetFrameHeightAddr() *int32 {
|
||||
return (*int32)(&dc.frame_height)
|
||||
}
|
||||
|
||||
// GetFps gets `AVDeviceCapabilitiesQuery.fps` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetFps() AVRational {
|
||||
return (AVRational)(dc.fps)
|
||||
}
|
||||
|
||||
// SetFps sets `AVDeviceCapabilitiesQuery.fps` value.
|
||||
func (dc *AVDeviceCapabilitiesQuery) SetFps(v AVRational) {
|
||||
dc.fps = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetFpsAddr gets `AVDeviceCapabilitiesQuery.fps` address.
|
||||
func (dc *AVDeviceCapabilitiesQuery) GetFpsAddr() *AVRational {
|
||||
return (*AVRational)(&dc.fps)
|
||||
}
|
||||
|
||||
// NONEED: av_device_capabilities
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvDeviceCapabilitiesCreate initializes capabilities probing API based on AVOption API.
|
||||
func AvDeviceCapabilitiesCreate(caps **AVDeviceCapabilitiesQuery,
|
||||
s *AVFormatContext, deviceOptions **AVDictionary) int32 {
|
||||
return (int32)(C.avdevice_capabilities_create((**C.struct_AVDeviceCapabilitiesQuery)(unsafe.Pointer(caps)),
|
||||
(*C.struct_AVFormatContext)(s), (**C.struct_AVDictionary)(unsafe.Pointer(deviceOptions))))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvDeviceCapabilitiesFree frees resources created by AvDeviceCapabilitiesCreate()
|
||||
func AvDeviceCapabilitiesFree(caps **AVDeviceCapabilitiesQuery, s *AVFormatContext) {
|
||||
C.avdevice_capabilities_free((**C.struct_AVDeviceCapabilitiesQuery)(unsafe.Pointer(caps)),
|
||||
(*C.struct_AVFormatContext)(s))
|
||||
}
|
||||
|
||||
// AVDeviceInfo
|
||||
type AVDeviceInfo C.struct_AVDeviceInfo
|
||||
|
||||
|
@@ -10,7 +10,6 @@ package ffmpeg
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBAVDEVICE_VERSION_MAJOR = C.LIBAVDEVICE_VERSION_MAJOR
|
||||
LIBAVDEVICE_VERSION_MINOR = C.LIBAVDEVICE_VERSION_MINOR
|
||||
LIBAVDEVICE_VERSION_MICRO = C.LIBAVDEVICE_VERSION_MICRO
|
||||
)
|
||||
|
14
avdevice_version_major.go
Normal file
14
avdevice_version_major.go
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavdevice/version_major.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBAVDEVICE_VERSION_MAJOR = C.LIBAVDEVICE_VERSION_MAJOR
|
||||
)
|
355
avfilter.go
355
avfilter.go
@@ -34,12 +34,6 @@ type AVFilterFormats C.struct_AVFilterFormats
|
||||
// AVFilterChannelLayouts
|
||||
type AVFilterChannelLayouts C.struct_AVFilterChannelLayouts
|
||||
|
||||
// AvFilterPadCount gets the number of elements in a NULL-terminated array of AVFilterPads (e.g.
|
||||
// AvFilter.inputs/outputs).
|
||||
func AvFilterPadCount(pads *AVFilterPad) int32 {
|
||||
return (int32)(C.avfilter_pad_count((*C.struct_AVFilterPad)(pads)))
|
||||
}
|
||||
|
||||
// AvFilterPadGetName gets the name of an AVFilterPad.
|
||||
func AvFilterPadGetName(pads *AVFilterPad, padIdx int32) string {
|
||||
return C.GoString(C.avfilter_pad_get_name((*C.struct_AVFilterPad)(pads), (C.int)(padIdx)))
|
||||
@@ -54,6 +48,7 @@ const (
|
||||
AVFILTER_FLAG_DYNAMIC_INPUTS = C.AVFILTER_FLAG_DYNAMIC_INPUTS
|
||||
AVFILTER_FLAG_DYNAMIC_OUTPUTS = C.AVFILTER_FLAG_DYNAMIC_OUTPUTS
|
||||
AVFILTER_FLAG_SLICE_THREADS = C.AVFILTER_FLAG_SLICE_THREADS
|
||||
AVFILTER_FLAG_METADATA_ONLY = C.AVFILTER_FLAG_METADATA_ONLY
|
||||
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC = C.AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
|
||||
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL = C.AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
|
||||
AVFILTER_FLAG_SUPPORT_TIMELINE = C.AVFILTER_FLAG_SUPPORT_TIMELINE
|
||||
@@ -133,6 +128,11 @@ func (flt *AVFilter) GetFlagsAddr() *int32 {
|
||||
return (*int32)(&flt.flags)
|
||||
}
|
||||
|
||||
// AvfilterFilterPadCount
|
||||
func AvfilterFilterPadCount(filter *AVFilter, isOutput int32) uint32 {
|
||||
return (uint32)(C.avfilter_filter_pad_count((*C.struct_AVFilter)(filter), (C.int)(isOutput)))
|
||||
}
|
||||
|
||||
const (
|
||||
AVFILTER_THREAD_SLICE = C.AVFILTER_THREAD_SLICE
|
||||
)
|
||||
@@ -180,7 +180,7 @@ func (fltc *AVFilterContext) GetName() string {
|
||||
|
||||
// SetName sets `AVFilterContext.name` value.
|
||||
func (fltc *AVFilterContext) SetName(v string) {
|
||||
C.free(unsafe.Pointer(fltc.name))
|
||||
FreePointer(fltc.name)
|
||||
fltc.name, _ = StringCasting(v)
|
||||
}
|
||||
|
||||
@@ -639,16 +639,22 @@ func (fltl *AVFilterLink) GetSampleAspectRatioAddr() *AVRational {
|
||||
return (*AVRational)(&fltl.sample_aspect_ratio)
|
||||
}
|
||||
|
||||
// Deprecated: Use ChLayout instead.
|
||||
//
|
||||
// GetChannelLayout gets `AVFilterLink.channel_layout` value.
|
||||
func (fltl *AVFilterLink) GetChannelLayout() uint64 {
|
||||
return (uint64)(fltl.channel_layout)
|
||||
}
|
||||
|
||||
// Deprecated: Use ChLayout instead.
|
||||
//
|
||||
// SetChannelLayout sets `AVFilterLink.channel_layout` value.
|
||||
func (fltl *AVFilterLink) SetChannelLayout(v uint64) {
|
||||
fltl.channel_layout = (C.uint64_t)(v)
|
||||
}
|
||||
|
||||
// Deprecated: Use ChLayout instead.
|
||||
//
|
||||
// GetChannelLayoutAddr gets `AVFilterLink.channel_layout` address.
|
||||
func (fltl *AVFilterLink) GetChannelLayoutAddr() *uint64 {
|
||||
return (*uint64)(&fltl.channel_layout)
|
||||
@@ -699,6 +705,21 @@ func (fltl *AVFilterLink) GetTimeBaseAddr() *AVRational {
|
||||
return (*AVRational)(&fltl.time_base)
|
||||
}
|
||||
|
||||
// GetChLayout gets `AVFilterLink.ch_layout` value.
|
||||
func (fltl *AVFilterLink) GetChLayout() AVChannelLayout {
|
||||
return (AVChannelLayout)(fltl.ch_layout)
|
||||
}
|
||||
|
||||
// SetChLayout sets `AVFilterLink.ch_layout` value.
|
||||
func (fltl *AVFilterLink) SetChLayout(v AVChannelLayout) {
|
||||
fltl.ch_layout = (C.struct_AVChannelLayout)(v)
|
||||
}
|
||||
|
||||
// GetChLayoutAddr gets `AVFilterLink.ch_layout` address.
|
||||
func (fltl *AVFilterLink) GetChLayoutAddr() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&fltl.ch_layout)
|
||||
}
|
||||
|
||||
// AvFilterLink links two filters together.
|
||||
func AvFilterLink(src *AVFilterContext, srcpad uint32,
|
||||
dst *AVFilterContext, dstpad uint32) int32 {
|
||||
@@ -711,20 +732,6 @@ func AvFilterLinkFree(link **AVFilterLink) {
|
||||
C.avfilter_link_free((**C.struct_AVFilterLink)(unsafe.Pointer(link)))
|
||||
}
|
||||
|
||||
// Deprecated: Use av_buffersink_get_channels() instead.
|
||||
//
|
||||
// AvFilterLinkGetChannels gets the number of channels of a link.
|
||||
func AvFilterLinkGetChannels(link *AVFilterLink) int32 {
|
||||
return (int32)(C.avfilter_link_get_channels((*C.struct_AVFilterLink)(link)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFilterLinkSetClosed sets the closed field of a link.
|
||||
func AvFilterLinkSetClosed(link *AVFilterLink, closed int32) {
|
||||
C.avfilter_link_set_closed((*C.struct_AVFilterLink)(link), (C.int)(closed))
|
||||
}
|
||||
|
||||
// AvFilterConfigLinks negotiates the media format, dimensions, etc of all inputs to a filter.
|
||||
func AvFilterConfigLinks(filter *AVFilterContext) int32 {
|
||||
return (int32)(C.avfilter_config_links((*C.struct_AVFilterContext)(filter)))
|
||||
@@ -735,7 +742,7 @@ const (
|
||||
AVFILTER_CMD_FLAG_FAST = C.AVFILTER_CMD_FLAG_FAST
|
||||
)
|
||||
|
||||
// AvFilterProcessCommand makes the filter instance process a command.
|
||||
// AvFilterProcessCommand makes the filter instance process a command.
|
||||
// It is recommended to use AVFilterGraphSendCommand().
|
||||
func AvFilterProcessCommand(filter *AVFilterContext, cmd, arg string, resLen, flags int32) (res string, ret int32) {
|
||||
cmdPtr, cmdFunc := StringCasting(cmd)
|
||||
@@ -753,27 +760,6 @@ func AvFilterIterate(opaque CVoidPointerPointer) *AVFilter {
|
||||
return (*AVFilter)(C.av_filter_iterate(VoidPointerPointer(opaque)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFilterRegisterAll initializes the filter system. Register all builtin filters.
|
||||
func AvFilterRegisterAll() {
|
||||
C.avfilter_register_all()
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFilterRegister registers a filter.
|
||||
func AvFilterRegister(filter *AVFilter) {
|
||||
C.avfilter_register((*C.struct_AVFilter)(filter))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFilterNext iterates over all registered filters.
|
||||
func AvFilterNext(filter *AVFilter) *AVFilter {
|
||||
return (*AVFilter)(C.avfilter_next((*C.struct_AVFilter)(filter)))
|
||||
}
|
||||
|
||||
// AvFilterGetByName gets a filter definition matching the given name.
|
||||
func AvFilterGetByName(name string) *AVFilter {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
@@ -881,13 +867,6 @@ func (fltg *AVFilterGraph) GetScaleSwsOpts() string {
|
||||
return C.GoString(fltg.scale_sws_opts)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetResampleLavrOpts gets `AVFilterGraph.resample_lavr_opts` value.
|
||||
func (fltg *AVFilterGraph) GetResampleLavrOpts() string {
|
||||
return C.GoString(fltg.resample_lavr_opts)
|
||||
}
|
||||
|
||||
// GetThreadType gets `AVFilterGraph.threadtype` value.
|
||||
func (fltg *AVFilterGraph) GetThreadType() int32 {
|
||||
return (int32)(fltg.thread_type)
|
||||
@@ -1032,7 +1011,7 @@ func (fltio *AVFilterInOut) GetName() string {
|
||||
|
||||
// SetName sets `AVFilterInOut.name` value.
|
||||
func (fltio *AVFilterInOut) SetName(v string) {
|
||||
C.free(unsafe.Pointer(fltio.name))
|
||||
FreePointer(fltio.name)
|
||||
fltio.name, _ = StringCasting(v)
|
||||
}
|
||||
|
||||
@@ -1124,6 +1103,280 @@ func AvFilterGraphParse2(graph *AVFilterGraph, filters string,
|
||||
(**C.struct_AVFilterInOut)(unsafe.Pointer(outputs))))
|
||||
}
|
||||
|
||||
// AVFilterPadParams
|
||||
type AVFilterPadParams C.struct_AVFilterPadParams
|
||||
|
||||
// GetLabel gets `AVFilterPadParams.label` value.
|
||||
func (fpp *AVFilterPadParams) GetLabel() string {
|
||||
return C.GoString(fpp.label)
|
||||
}
|
||||
|
||||
// SetLabel sets `AVFilterPadParams.label` value.
|
||||
func (fpp *AVFilterPadParams) SetLabel(v string) {
|
||||
FreePointer(fpp.label)
|
||||
fpp.label, _ = StringCasting(v)
|
||||
}
|
||||
|
||||
// AVFilterParams
|
||||
type AVFilterParams C.struct_AVFilterParams
|
||||
|
||||
// GetFilter gets `AVFilterParams.filter` value.
|
||||
func (fp *AVFilterParams) GetFilter() *AVFilterContext {
|
||||
return (*AVFilterContext)(fp.filter)
|
||||
}
|
||||
|
||||
// SetFilter sets `AVFilterParams.filter` value.
|
||||
func (fp *AVFilterParams) SetFilter(v *AVFilterContext) {
|
||||
fp.filter = (*C.struct_AVFilterContext)(v)
|
||||
}
|
||||
|
||||
// GetFilterAddr gets `AVFilterParams.` address.
|
||||
func (fp *AVFilterParams) GetFilterAddr() **AVFilterContext {
|
||||
return (**AVFilterContext)(unsafe.Pointer(&fp.filter))
|
||||
}
|
||||
|
||||
// GetFilterName gets `AVFilterParams.filter_name` value.
|
||||
func (fp *AVFilterParams) GetFilterName() string {
|
||||
return C.GoString(fp.filter_name)
|
||||
}
|
||||
|
||||
// SetFilterName sets `AVFilterParams.filter_name` value.
|
||||
func (fp *AVFilterParams) SetFilterName(v string) {
|
||||
FreePointer(fp.filter_name)
|
||||
fp.filter_name, _ = StringCasting(v)
|
||||
}
|
||||
|
||||
// GetInstanceName gets `AVFilterParams.instance_name` value.
|
||||
func (fp *AVFilterParams) GetInstanceName() string {
|
||||
return C.GoString(fp.instance_name)
|
||||
|
||||
}
|
||||
|
||||
// SetInstanceName sets `AVFilterParams.instance_name` value.
|
||||
func (fp *AVFilterParams) SetInstanceName(v string) {
|
||||
FreePointer(fp.instance_name)
|
||||
fp.instance_name, _ = StringCasting(v)
|
||||
}
|
||||
|
||||
// GetOpts gets `AVFilterParams.opts` value.
|
||||
func (fp *AVFilterParams) GetOpts() *AVDictionary {
|
||||
return (*AVDictionary)(fp.opts)
|
||||
}
|
||||
|
||||
// SetOpts sets `AVFilterParams.opts` value.
|
||||
func (fp *AVFilterParams) SetOpts(v *AVDictionary) {
|
||||
fp.opts = (*C.struct_AVDictionary)(v)
|
||||
}
|
||||
|
||||
// GetOptsAddr gets `AVFilterParams.` address.
|
||||
func (fp *AVFilterParams) GetOptsAddr() **AVDictionary {
|
||||
return (**AVDictionary)(unsafe.Pointer(&fp.opts))
|
||||
}
|
||||
|
||||
// GetInputs gets `AVFilterParams.inputs` value.
|
||||
func (fp *AVFilterParams) GetInputs() []*AVFilterPadParams {
|
||||
return unsafe.Slice((**AVFilterPadParams)(unsafe.Pointer(fp.inputs)), fp.nb_inputs)
|
||||
}
|
||||
|
||||
// SetInputs sets `AVFilterParams.inputs` value.
|
||||
func (fp *AVFilterParams) SetInputs(v **AVFilterPadParams) {
|
||||
fp.inputs = (**C.struct_AVFilterPadParams)(unsafe.Pointer(v))
|
||||
}
|
||||
|
||||
// GetInputsAddr gets `AVFilterParams.` address.
|
||||
func (fp *AVFilterParams) GetInputsAddr() ***AVFilterPadParams {
|
||||
return (***AVFilterPadParams)(unsafe.Pointer(&fp.inputs))
|
||||
}
|
||||
|
||||
// GetNbInputs gets `AVFilterParams.nb_inputs` value.
|
||||
func (fp *AVFilterParams) GetNbInputs() uint32 {
|
||||
return (uint32)(fp.nb_inputs)
|
||||
}
|
||||
|
||||
// SetNbInputs sets `AVFilterParams.nb_inputs` value.
|
||||
func (fp *AVFilterParams) SetNbInputs(v uint32) {
|
||||
fp.nb_inputs = (C.uint)(v)
|
||||
}
|
||||
|
||||
// GetNbInputsAddr gets `AVFilterParams.` address.
|
||||
func (fp *AVFilterParams) GetNbInputsAddr() *uint32 {
|
||||
return (*uint32)(&fp.nb_inputs)
|
||||
}
|
||||
|
||||
// GetOutputs gets `AVFilterParams.outputs` value.
|
||||
func (fp *AVFilterParams) GetOutputs() []*AVFilterPadParams {
|
||||
return unsafe.Slice((**AVFilterPadParams)(unsafe.Pointer(fp.outputs)), fp.nb_outputs)
|
||||
}
|
||||
|
||||
// SetOutputs sets `AVFilterParams.outputs` value.
|
||||
func (fp *AVFilterParams) SetOutputs(v **AVFilterPadParams) {
|
||||
fp.outputs = (**C.struct_AVFilterPadParams)(unsafe.Pointer(v))
|
||||
}
|
||||
|
||||
// GetOutputsAddr gets `AVFilterParams.` address.
|
||||
func (fp *AVFilterParams) GetOutputsAddr() ***AVFilterPadParams {
|
||||
return (***AVFilterPadParams)(unsafe.Pointer(&fp.outputs))
|
||||
}
|
||||
|
||||
// GetNbOutputs gets `AVFilterParams.nb_outputs` value.
|
||||
func (fp *AVFilterParams) GetNbOutputs() uint32 {
|
||||
return (uint32)(fp.nb_outputs)
|
||||
}
|
||||
|
||||
// SetNbOutputs sets `AVFilterParams.nb_outputs` value.
|
||||
func (fp *AVFilterParams) SetNbOutputs(v uint32) {
|
||||
fp.nb_outputs = (C.uint)(v)
|
||||
}
|
||||
|
||||
// GetNbOutputsAddr gets `AVFilterParams.` address.
|
||||
func (fp *AVFilterParams) GetNbOutputsAddr() *uint32 {
|
||||
return (*uint32)(&fp.nb_outputs)
|
||||
}
|
||||
|
||||
// AVFilterChain
|
||||
type AVFilterChain C.struct_AVFilterChain
|
||||
|
||||
// GetFilters gets `AVFilterChain.filters` value.
|
||||
func (fc *AVFilterChain) GetFilters() []*AVFilterParams {
|
||||
return unsafe.Slice((**AVFilterParams)(unsafe.Pointer(fc.filters)), fc.nb_filters)
|
||||
}
|
||||
|
||||
// SetFilters sets `AVFilterChain.filters` value.
|
||||
func (fc *AVFilterChain) SetFilters(v **AVFilterParams) {
|
||||
fc.filters = (**C.struct_AVFilterParams)(unsafe.Pointer(v))
|
||||
}
|
||||
|
||||
// GetFiltersAddr gets `AVFilterChain.filters` address.
|
||||
func (fc *AVFilterChain) GetFiltersAddr() ***AVFilterParams {
|
||||
return (***AVFilterParams)(unsafe.Pointer(&fc.filters))
|
||||
}
|
||||
|
||||
// GetNbFilters gets `AVFilterChain.nb_filters` value.
|
||||
func (fc *AVFilterChain) GetNbFilters() uintptr {
|
||||
return (uintptr)(fc.nb_filters)
|
||||
}
|
||||
|
||||
// SetNbFilters sets `AVFilterChain.nb_filters` value.
|
||||
func (fc *AVFilterChain) SetNbFilters(v uintptr) {
|
||||
fc.nb_filters = (C.size_t)(v)
|
||||
}
|
||||
|
||||
// GetNbFiltersAddr gets `AVFilterChain.nb_filters` address.
|
||||
func (fc *AVFilterChain) GetNbFiltersAddr() *uintptr {
|
||||
return (*uintptr)(unsafe.Pointer(&fc.nb_filters))
|
||||
}
|
||||
|
||||
// AVFilterGraphSegment
|
||||
type AVFilterGraphSegment C.struct_AVFilterGraphSegment
|
||||
|
||||
// GetGraph gets `AVFilterGraphSegment.graph` value.
|
||||
func (fgs *AVFilterGraphSegment) GetGraph() *AVFilterGraph {
|
||||
return (*AVFilterGraph)(fgs.graph)
|
||||
}
|
||||
|
||||
// SetGraph sets `AVFilterGraphSegment.graph` value.
|
||||
func (fgs *AVFilterGraphSegment) SetGraph(v *AVFilterGraph) {
|
||||
fgs.graph = (*C.struct_AVFilterGraph)(v)
|
||||
}
|
||||
|
||||
// GetGraphAddr gets `AVFilterGraphSegment.graph` address.
|
||||
func (fgs *AVFilterGraphSegment) GetGraphAddr() **AVFilterGraph {
|
||||
return (**AVFilterGraph)(unsafe.Pointer(&fgs.graph))
|
||||
}
|
||||
|
||||
// GetChains gets `AVFilterGraphSegment.chains` value.
|
||||
func (fgs *AVFilterGraphSegment) GetChains() []*AVFilterChain {
|
||||
return unsafe.Slice((**AVFilterChain)(unsafe.Pointer(fgs.chains)), fgs.nb_chains)
|
||||
}
|
||||
|
||||
// SetChains sets `AVFilterGraphSegment.chains` value.
|
||||
func (fgs *AVFilterGraphSegment) SetChains(v **AVFilterChain) {
|
||||
fgs.chains = (**C.struct_AVFilterChain)(unsafe.Pointer(v))
|
||||
}
|
||||
|
||||
// GetChainsAddr gets `AVFilterGraphSegment.chains` address.
|
||||
func (fgs *AVFilterGraphSegment) GetChainsAddr() ***AVFilterChain {
|
||||
return (***AVFilterChain)(unsafe.Pointer(&fgs.chains))
|
||||
}
|
||||
|
||||
// GetNb_Chains gets `AVFilterGraphSegment.nb_chains` value.
|
||||
func (fgs *AVFilterGraphSegment) GetNb_Chains() uintptr {
|
||||
return (uintptr)(fgs.nb_chains)
|
||||
}
|
||||
|
||||
// SetNb_Chains sets `AVFilterGraphSegment.nb_chains` value.
|
||||
func (fgs *AVFilterGraphSegment) SetNb_Chains(v uintptr) {
|
||||
fgs.nb_chains = (C.size_t)(v)
|
||||
}
|
||||
|
||||
// GetNb_ChainsAddr gets `AVFilterGraphSegment.nb_chains` address.
|
||||
func (fgs *AVFilterGraphSegment) GetNb_ChainsAddr() *uintptr {
|
||||
return (*uintptr)(unsafe.Pointer(&fgs.nb_chains))
|
||||
}
|
||||
|
||||
// GetScale_Sws_Opts gets `AVFilterGraphSegment.scale_sws_opts` value.
|
||||
func (fgs *AVFilterGraphSegment) GetScale_Sws_Opts() string {
|
||||
return C.GoString(fgs.scale_sws_opts)
|
||||
}
|
||||
|
||||
// SetScale_Sws_Opts sets `AVFilterGraphSegment.scale_sws_opts` value.
|
||||
func (fgs *AVFilterGraphSegment) SetScale_Sws_Opts(v string) {
|
||||
FreePointer(fgs.scale_sws_opts)
|
||||
fgs.scale_sws_opts, _ = StringCasting(v)
|
||||
}
|
||||
|
||||
// AvfilterGraphSegmentParse parses a textual filtergraph description into an intermediate form.
|
||||
func AvfilterGraphSegmentParse(graph *AVFilterGraph, graphStr string,
|
||||
flags int32, seg **AVFilterGraphSegment) int32 {
|
||||
graphStrPtr, graphStrFunc := StringCasting(graphStr)
|
||||
defer graphStrFunc()
|
||||
return (int32)(C.avfilter_graph_segment_parse((*C.struct_AVFilterGraph)(graph),
|
||||
(*C.char)(graphStrPtr), (C.int)(flags),
|
||||
(**C.struct_AVFilterGraphSegment)(unsafe.Pointer(seg))))
|
||||
}
|
||||
|
||||
// AvfilterGraphSegmentCreateFilters creates filters specified in a graph segment.
|
||||
func AvfilterGraphSegmentCreateFilters(seg *AVFilterGraphSegment, flags int32) int32 {
|
||||
return (int32)(C.avfilter_graph_segment_create_filters(
|
||||
(*C.struct_AVFilterGraphSegment)(seg), (C.int)(flags)))
|
||||
}
|
||||
|
||||
// AvfilterGraphSegmentApplyOpts applies parsed options to filter instances in a graph segment.
|
||||
func AvfilterGraphSegmentApplyOpts(seg *AVFilterGraphSegment, flags int32) int32 {
|
||||
return (int32)(C.avfilter_graph_segment_apply_opts(
|
||||
(*C.struct_AVFilterGraphSegment)(seg), (C.int)(flags)))
|
||||
}
|
||||
|
||||
// AvfilterGraphSegmentInit initializes all filter instances in a graph segment.
|
||||
func AvfilterGraphSegmentInit(seg *AVFilterGraphSegment, flags int32) int32 {
|
||||
return (int32)(C.avfilter_graph_segment_init(
|
||||
(*C.struct_AVFilterGraphSegment)(seg), (C.int)(flags)))
|
||||
}
|
||||
|
||||
// AvfilterGraphSegmentLink links filters in a graph segment.
|
||||
func AvfilterGraphSegmentLink(seg *AVFilterGraphSegment, flags int32,
|
||||
intputs, outputs **AVFilterInOut) int32 {
|
||||
return (int32)(C.avfilter_graph_segment_link(
|
||||
(*C.struct_AVFilterGraphSegment)(seg), (C.int)(flags),
|
||||
(**C.struct_AVFilterInOut)(unsafe.Pointer(intputs)),
|
||||
(**C.struct_AVFilterInOut)(unsafe.Pointer(outputs))))
|
||||
}
|
||||
|
||||
// AvfilterGraphSegmentApply applies all filter/link descriptions from a graph segment
|
||||
// to the associated filtergraph.
|
||||
func AvfilterGraphSegmentApply(seg *AVFilterGraphSegment, flags int32,
|
||||
intputs, outputs **AVFilterInOut) int32 {
|
||||
return (int32)(C.avfilter_graph_segment_apply(
|
||||
(*C.struct_AVFilterGraphSegment)(seg), (C.int)(flags),
|
||||
(**C.struct_AVFilterInOut)(unsafe.Pointer(intputs)),
|
||||
(**C.struct_AVFilterInOut)(unsafe.Pointer(outputs))))
|
||||
}
|
||||
|
||||
// AvfilterGraphSegmentFree frees the provided AVFilterGraphSegment and everything associated with it.
|
||||
func AvfilterGraphSegmentFree(seg **AVFilterGraphSegment) {
|
||||
C.avfilter_graph_segment_free((**C.struct_AVFilterGraphSegment)(unsafe.Pointer(seg)))
|
||||
}
|
||||
|
||||
// AvFilterGraphSendCommand sends a command to one or more filter instances.
|
||||
func AvFilterGraphSendCommand(graph *AVFilterGraph, target, cmd, arg string,
|
||||
resLen, flags int32) (res string, ret int32) {
|
||||
|
@@ -23,63 +23,9 @@ const (
|
||||
// AVBufferSinkParams
|
||||
type AVBufferSinkParams C.struct_AVBufferSinkParams
|
||||
|
||||
// GetPixelFmts gets `AVBufferSinkParams.pixel_fmts` value.
|
||||
func (bsp *AVBufferSinkParams) GetPixelFmts() []AVPixelFormat {
|
||||
return SliceTrunc((*AVPixelFormat)(bsp.pixel_fmts), func(pf AVPixelFormat) bool {
|
||||
return pf == AV_PIX_FMT_NONE
|
||||
})
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvBuffersinkParamsAlloc creates an AVBufferSinkParams structure.
|
||||
func AvBuffersinkParamsAlloc() *AVBufferSinkParams {
|
||||
return (*AVBufferSinkParams)(C.av_buffersink_params_alloc())
|
||||
}
|
||||
|
||||
// AVABufferSinkParams
|
||||
type AVABufferSinkParams C.struct_AVABufferSinkParams
|
||||
|
||||
// GetSampleFmts gets `AVABufferSinkParams.sample_fmts` value.
|
||||
func (absp *AVABufferSinkParams) GetSampleFmts() []AVSampleFormat {
|
||||
return SliceTrunc((*AVSampleFormat)(absp.sample_fmts), func(sf AVSampleFormat) bool {
|
||||
return sf == AV_SAMPLE_FMT_NONE
|
||||
})
|
||||
}
|
||||
|
||||
// GetChannelLayouts gets `AVABufferSinkParams.channel_layouts` value.
|
||||
func (absp *AVABufferSinkParams) GetChannelLayouts() []int64 {
|
||||
return SliceTrunc((*int64)(absp.channel_layouts), func(i int64) bool {
|
||||
return i == -1
|
||||
})
|
||||
}
|
||||
|
||||
// GetChannelCounts gets `AVABufferSinkParams.channel_counts` value.
|
||||
func (absp *AVABufferSinkParams) GetChannelCounts() []int32 {
|
||||
return SliceTrunc((*int32)(absp.channel_counts), func(i int32) bool {
|
||||
return i == -1
|
||||
})
|
||||
}
|
||||
|
||||
// GetAllChannelCounts gets `AVABufferSinkParams.all_channel_counts` value.
|
||||
func (absp *AVABufferSinkParams) GetAllChannelCounts() int32 {
|
||||
return (int32)(absp.all_channel_counts)
|
||||
}
|
||||
|
||||
// GetSampleRates gets `AVABufferSinkParams.sample_rates` value.
|
||||
func (absp *AVABufferSinkParams) GetSampleRates() []int32 {
|
||||
return SliceTrunc((*int32)(absp.sample_rates), func(i int32) bool {
|
||||
return i == -1
|
||||
})
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvAbuffersinkParamsAlloc creates an AVABufferSinkParams structure.
|
||||
func AvAbuffersinkParamsAlloc() *AVABufferSinkParams {
|
||||
return (*AVABufferSinkParams)(C.av_abuffersink_params_alloc())
|
||||
}
|
||||
|
||||
// AvBuffersinkSetFrameSize sets the frame size for an audio buffer sink.
|
||||
func AvBuffersinkSetFrameSize(ctx *AVFilterContext, frameSize uint32) {
|
||||
C.av_buffersink_set_frame_size((*C.struct_AVFilterContext)(ctx), (C.uint)(frameSize))
|
||||
@@ -125,11 +71,19 @@ func AvBuffersinkGetChannels(ctx *AVFilterContext) int32 {
|
||||
return (int32)(C.av_buffersink_get_channels((*C.struct_AVFilterContext)(ctx)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvBuffersinkGetChannelLayout
|
||||
func AvBuffersinkGetChannelLayout(ctx *AVFilterContext) uint64 {
|
||||
return (uint64)(C.av_buffersink_get_channel_layout((*C.struct_AVFilterContext)(ctx)))
|
||||
}
|
||||
|
||||
// AvBuffersinkGetChLayout
|
||||
func AvBuffersinkGetChLayout(ctx *AVFilterContext, chLayout *AVChannelLayout) int32 {
|
||||
return (int32)(C.av_buffersink_get_ch_layout((*C.struct_AVFilterContext)(ctx),
|
||||
(*C.struct_AVChannelLayout)(chLayout)))
|
||||
}
|
||||
|
||||
// AvBuffersinkGetSampleRate
|
||||
func AvBuffersinkGetSampleRate(ctx *AVFilterContext) int32 {
|
||||
return (int32)(C.av_buffersink_get_sample_rate((*C.struct_AVFilterContext)(ctx)))
|
||||
|
@@ -144,21 +144,42 @@ func (bsrc *AVBufferSrcParameters) GetSampleRateAddr() *int32 {
|
||||
return (*int32)(&bsrc.sample_rate)
|
||||
}
|
||||
|
||||
// Deprecated: use ChLayout instead.
|
||||
//
|
||||
// GetChannelLayout gets `AVBufferSrcParameters.channel_layout` value.
|
||||
func (bsrc *AVBufferSrcParameters) GetChannelLayout() uint64 {
|
||||
return (uint64)(bsrc.channel_layout)
|
||||
}
|
||||
|
||||
// Deprecated: use ChLayout instead.
|
||||
//
|
||||
// SetChannelLayout sets `AVBufferSrcParameters.channel_layout` value.
|
||||
func (bsrc *AVBufferSrcParameters) SetChannelLayout(v uint64) {
|
||||
bsrc.channel_layout = (C.uint64_t)(v)
|
||||
}
|
||||
|
||||
// Deprecated: use ChLayout instead.
|
||||
//
|
||||
// GetChannelLayoutAddr gets `AVBufferSrcParameters.channel_layout` address.
|
||||
func (bsrc *AVBufferSrcParameters) GetChannelLayoutAddr() *uint64 {
|
||||
return (*uint64)(&bsrc.channel_layout)
|
||||
}
|
||||
|
||||
// GetChLayout gets `AVBufferSrcParameters.ch_layout` value.
|
||||
func (bsrc *AVBufferSrcParameters) GetChLayout() AVChannelLayout {
|
||||
return (AVChannelLayout)(bsrc.ch_layout)
|
||||
}
|
||||
|
||||
// SetChLayout sets `AVBufferSrcParameters.ch_layout` value.
|
||||
func (bsrc *AVBufferSrcParameters) SetChLayout(v AVChannelLayout) {
|
||||
bsrc.ch_layout = (C.struct_AVChannelLayout)(v)
|
||||
}
|
||||
|
||||
// GetChLayoutAddr gets `AVBufferSrcParameters.ch_layout` address.
|
||||
func (bsrc *AVBufferSrcParameters) GetChLayoutAddr() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&bsrc.ch_layout)
|
||||
}
|
||||
|
||||
// AvBuffersrcParametersAlloc allocates a new AVBufferSrcParameters instance. It should be freed by the
|
||||
// caller with AvFree().
|
||||
func AvBuffersrcParametersAlloc() *AVBufferSrcParameters {
|
||||
|
@@ -10,7 +10,6 @@ package ffmpeg
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBAVFILTER_VERSION_MAJOR = C.LIBAVFILTER_VERSION_MAJOR
|
||||
LIBAVFILTER_VERSION_MINOR = C.LIBAVFILTER_VERSION_MINOR
|
||||
LIBAVFILTER_VERSION_MICRO = C.LIBAVFILTER_VERSION_MICRO
|
||||
)
|
||||
|
14
avfilter_version_major.go
Normal file
14
avfilter_version_major.go
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavfilter/version_major.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBAVFILTER_VERSION_MAJOR = C.LIBAVFILTER_VERSION_MAJOR
|
||||
)
|
386
avformat.go
386
avformat.go
@@ -7,14 +7,13 @@ package ffmpeg
|
||||
/*
|
||||
#include <libavformat/avformat.h>
|
||||
|
||||
typedef int (*av_format_context_open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags,
|
||||
const AVIOInterruptCB *int_cb, AVDictionary **options);
|
||||
|
||||
typedef int (*av_format_context_io_open_func)(struct AVFormatContext *s, AVIOContext **pb, const char *url,
|
||||
int flags, AVDictionary **options);
|
||||
|
||||
typedef void (*av_format_context_io_close_func)(struct AVFormatContext *s, AVIOContext *pb);
|
||||
|
||||
typedef int (*av_format_context_io_close2_func)(struct AVFormatContext *s, AVIOContext *pb);
|
||||
|
||||
int get_av_index_entry_flags(AVIndexEntry *ie) {
|
||||
return ie->flags;
|
||||
}
|
||||
@@ -105,8 +104,10 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
AVFMT_NOFILE = C.AVFMT_NOFILE
|
||||
AVFMT_NEEDNUMBER = C.AVFMT_NEEDNUMBER
|
||||
AVFMT_NOFILE = C.AVFMT_NOFILE
|
||||
AVFMT_NEEDNUMBER = C.AVFMT_NEEDNUMBER
|
||||
|
||||
AVFMT_EXPERIMENTAL = C.AVFMT_EXPERIMENTAL
|
||||
AVFMT_SHOW_IDS = C.AVFMT_SHOW_IDS
|
||||
AVFMT_GLOBALHEADER = C.AVFMT_GLOBALHEADER
|
||||
AVFMT_NOTIMESTAMPS = C.AVFMT_NOTIMESTAMPS
|
||||
@@ -373,12 +374,9 @@ const (
|
||||
AV_DISPOSITION_CLEAN_EFFECTS = C.AV_DISPOSITION_CLEAN_EFFECTS
|
||||
AV_DISPOSITION_ATTACHED_PIC = C.AV_DISPOSITION_ATTACHED_PIC
|
||||
AV_DISPOSITION_TIMED_THUMBNAILS = C.AV_DISPOSITION_TIMED_THUMBNAILS
|
||||
)
|
||||
|
||||
// AVStreamInternal
|
||||
type AVStreamInternal C.struct_AVStreamInternal
|
||||
AV_DISPOSITION_NON_DIEGETIC = C.AV_DISPOSITION_NON_DIEGETIC
|
||||
|
||||
const (
|
||||
AV_DISPOSITION_CAPTIONS = C.AV_DISPOSITION_CAPTIONS
|
||||
AV_DISPOSITION_DESCRIPTIONS = C.AV_DISPOSITION_DESCRIPTIONS
|
||||
AV_DISPOSITION_METADATA = C.AV_DISPOSITION_METADATA
|
||||
@@ -386,6 +384,19 @@ const (
|
||||
AV_DISPOSITION_STILL_IMAGE = C.AV_DISPOSITION_STILL_IMAGE
|
||||
)
|
||||
|
||||
// AvDispositionFromString returns disposition flag.
|
||||
func AvDispositionFromString(disp string) int32 {
|
||||
dispPtr, dispFunc := StringCasting(disp)
|
||||
defer dispFunc()
|
||||
return (int32)(C.av_disposition_from_string((*C.char)(dispPtr)))
|
||||
}
|
||||
|
||||
// AvDispositionToString returns description corresponding to the lowest set bit in
|
||||
// disposition.
|
||||
func AvDispositionToString(disposition int32) string {
|
||||
return C.GoString(C.av_disposition_to_string((C.int)(disposition)))
|
||||
}
|
||||
|
||||
const (
|
||||
AV_PTS_WRAP_IGNORE = C.AV_PTS_WRAP_IGNORE
|
||||
AV_PTS_WRAP_ADD_OFFSET = C.AV_PTS_WRAP_ADD_OFFSET
|
||||
@@ -425,27 +436,6 @@ func (stm *AVStream) GetIdAddr() *int32 {
|
||||
return (*int32)(&stm.id)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetCodec gets `AVStream.codec` value.
|
||||
func (stm *AVStream) GetCodec() *AVCodecContext {
|
||||
return (*AVCodecContext)(stm.codec)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SetCodec sets `AVStream.codec` value.
|
||||
func (stm *AVStream) SetCodec(v *AVCodecContext) {
|
||||
stm.codec = (*C.struct_AVCodecContext)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetCodecAddr gets `AVStream.codec` address.
|
||||
func (stm *AVStream) GetCodecAddr() **AVCodecContext {
|
||||
return (**AVCodecContext)(unsafe.Pointer(&stm.codec))
|
||||
}
|
||||
|
||||
// GetPrivData gets `AVStream.priv_data` value.
|
||||
func (stm *AVStream) GetPrivData() unsafe.Pointer {
|
||||
return stm.priv_data
|
||||
@@ -676,13 +666,6 @@ func (stm *AVStream) GetRFrameRateAddr() *AVRational {
|
||||
return (*AVRational)(&stm.r_frame_rate)
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// GetRecommendedEncoderConfiguration gets `AVStream.recommended_encoder_configuration` value.
|
||||
func (stm *AVStream) GetRecommendedEncoderConfiguration() string {
|
||||
return C.GoString(stm.recommended_encoder_configuration)
|
||||
}
|
||||
|
||||
// GetCodecpar gets `AVStream.codecpar` value.
|
||||
func (stm *AVStream) GetCodecpar() *AVCodecParameters {
|
||||
return (*AVCodecParameters)(stm.codecpar)
|
||||
@@ -698,34 +681,19 @@ func (stm *AVStream) GetCodecparAddr() **AVCodecParameters {
|
||||
return (**AVCodecParameters)(unsafe.Pointer(&stm.codecpar))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvStreamGetRFrameRate
|
||||
func AvStreamGetRFrameRate(s *AVStream) AVRational {
|
||||
return (AVRational)(C.av_stream_get_r_frame_rate((*C.struct_AVStream)(s)))
|
||||
// GetPtsWrapBits gets `AVStream.pts_wrap_bits` value.
|
||||
func (stm *AVStream) GetPtsWrapBits() int32 {
|
||||
return (int32)(stm.pts_wrap_bits)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvStreamSetRFrameRate
|
||||
func AvStreamSetRFrameRate(s *AVStream, r AVRational) {
|
||||
C.av_stream_set_r_frame_rate((*C.struct_AVStream)(s), (C.struct_AVRational)(r))
|
||||
// SetPtsWrapBits sets `AVStream.pts_wrap_bits` value.
|
||||
func (stm *AVStream) SetPtsWrapBits(v int32) {
|
||||
stm.pts_wrap_bits = (C.int)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvStreamGetRecommendedEncoderConfiguration
|
||||
func AvStreamGetRecommendedEncoderConfiguration(s *AVStream) string {
|
||||
return C.GoString(C.av_stream_get_recommended_encoder_configuration((*C.struct_AVStream)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvStreamSetRecommendedEncoderConfiguration
|
||||
func AvStreamSetRecommendedEncoderConfiguration(s *AVStream, configuration string) {
|
||||
configurationPtr, configurationFunc := StringCasting(configuration)
|
||||
defer configurationFunc()
|
||||
C.av_stream_set_recommended_encoder_configuration((*C.struct_AVStream)(s), (*C.char)(configurationPtr))
|
||||
// GetPtsWrapBitsAddr gets `AVStream.pts_wrap_bits` address.
|
||||
func (stm *AVStream) GetPtsWrapBitsAddr() *int32 {
|
||||
return (*int32)(&stm.pts_wrap_bits)
|
||||
}
|
||||
|
||||
// AvStreamGetParser
|
||||
@@ -733,6 +701,8 @@ func AvStreamGetParser(s *AVStream) *AVCodecParserContext {
|
||||
return (*AVCodecParserContext)(C.av_stream_get_parser((*C.struct_AVStream)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvStreamGetEndPts returns the pts of the last muxed packet + its duration.
|
||||
// the retuned value is undefined when used with a demuxer.
|
||||
func AvStreamGetEndPts(s *AVStream) int64 {
|
||||
@@ -908,18 +878,18 @@ const (
|
||||
type AVChapter = C.struct_AVChapter
|
||||
|
||||
// GetId gets `AVChapter.id` value.
|
||||
func (cpt *AVChapter) GetId() int32 {
|
||||
return (int32)(cpt.id)
|
||||
func (cpt *AVChapter) GetId() int64 {
|
||||
return (int64)(cpt.id)
|
||||
}
|
||||
|
||||
// SetId sets `AVChapter.id` value.
|
||||
func (cpt *AVChapter) SetId(v int32) {
|
||||
cpt.id = (C.int)(v)
|
||||
func (cpt *AVChapter) SetId(v int64) {
|
||||
cpt.id = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetIdAddr gets `AVChapter.id` address.
|
||||
func (cpt *AVChapter) GetIdAddr() *int32 {
|
||||
return (*int32)(&cpt.id)
|
||||
func (cpt *AVChapter) GetIdAddr() *int64 {
|
||||
return (*int64)(&cpt.id)
|
||||
}
|
||||
|
||||
// GetTimeBase gets `AVChapter.time_base` value.
|
||||
@@ -982,8 +952,13 @@ func (cpt *AVChapter) GetMetadataAddr() **AVDictionary {
|
||||
return (**AVDictionary)(unsafe.Pointer(&cpt.metadata))
|
||||
}
|
||||
|
||||
// typedef int (*av_format_control_message)(struct AVFormatContext *s, int type,
|
||||
// void *data, size_t data_size);
|
||||
type AVFormatControlMessageFunc C.av_format_control_message
|
||||
|
||||
// typedef int (*AVOpenCallback)(struct AVFormatContext *s,
|
||||
// AVIOContext **pb, const char *url, int flags,
|
||||
// const AVIOInterruptCB *int_cb, AVDictionary **options);
|
||||
type AVOpenCallbackFunc C.AVOpenCallback
|
||||
|
||||
// AVDurationEstimationMethod
|
||||
@@ -1124,13 +1099,6 @@ func (s *AVFormatContext) GetStreamsAddr() ***AVStream {
|
||||
return (***AVStream)(unsafe.Pointer(&s.streams))
|
||||
}
|
||||
|
||||
// Deprecated: Use url instead.
|
||||
//
|
||||
// GetFilename gets `AVFormatContext.filename` value.
|
||||
func (s *AVFormatContext) GetFilename() string {
|
||||
return C.GoString((*C.char)(&s.filename[0]))
|
||||
}
|
||||
|
||||
// GetUrl gets `AVFormatContext.url` value.
|
||||
func (s *AVFormatContext) GetUrl() string {
|
||||
return C.GoString(s.url)
|
||||
@@ -1140,7 +1108,7 @@ func (s *AVFormatContext) GetUrl() string {
|
||||
func (s *AVFormatContext) SetUrl(v string) {
|
||||
vPtr, _ := StringCasting(v)
|
||||
if s.url != nil {
|
||||
C.free(unsafe.Pointer(s.url))
|
||||
FreePointer(s.url)
|
||||
}
|
||||
s.url = (*C.char)(vPtr)
|
||||
}
|
||||
@@ -1806,21 +1774,6 @@ func (s *AVFormatContext) GetFormatWhitelist() string {
|
||||
return C.GoString(s.format_whitelist)
|
||||
}
|
||||
|
||||
// GetInternal gets `AVFormatContext.internal` value.
|
||||
func (s *AVFormatContext) GetInternal() *AVFormatInternal {
|
||||
return (*AVFormatInternal)(s.internal)
|
||||
}
|
||||
|
||||
// SetInternal sets `AVFormatContext.internal` value.
|
||||
func (s *AVFormatContext) SetInternal(v *AVFormatInternal) {
|
||||
s.internal = (*C.struct_AVFormatInternal)(v)
|
||||
}
|
||||
|
||||
// GetInternalAddr gets `AVFormatContext.internal` address.
|
||||
func (s *AVFormatContext) GetInternalAddr() **AVFormatInternal {
|
||||
return (**AVFormatInternal)(unsafe.Pointer(&s.internal))
|
||||
}
|
||||
|
||||
// GetIoRepositioned gets `AVFormatContext.io_repositioned` value.
|
||||
func (s *AVFormatContext) GetIoRepositioned() int32 {
|
||||
return (int32)(s.io_repositioned)
|
||||
@@ -1971,31 +1924,6 @@ func (s *AVFormatContext) GetDataCodecIdAddr() *AVCodecID {
|
||||
return (*AVCodecID)(unsafe.Pointer(&s.data_codec_id))
|
||||
}
|
||||
|
||||
// typedef int (*av_format_context_open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags,
|
||||
// const AVIOInterruptCB *int_cb, AVDictionary **options);
|
||||
type AvFormatContextOpenCb = C.av_format_context_open_cb
|
||||
|
||||
// Deprecated: Use io_open and io_close.
|
||||
//
|
||||
// GetOpenCb gets `AVFormatContext.open_cb` value.
|
||||
func (s *AVFormatContext) GetOpenCb() AvFormatContextOpenCb {
|
||||
return (AvFormatContextOpenCb)(s.open_cb)
|
||||
}
|
||||
|
||||
// Deprecated: Use io_open and io_close.
|
||||
//
|
||||
// SetOpenCb sets `AVFormatContext.open_cb` value.
|
||||
func (s *AVFormatContext) SetOpenCb(v AvFormatContextOpenCb) {
|
||||
s.open_cb = (C.av_format_context_open_cb)(v)
|
||||
}
|
||||
|
||||
// Deprecated: Use io_open and io_close.
|
||||
//
|
||||
// GetOpenCbAddr gets `AVFormatContext.open_cb` address.
|
||||
func (s *AVFormatContext) GetOpenCbAddr() *AvFormatContextOpenCb {
|
||||
return (*AvFormatContextOpenCb)(&s.open_cb)
|
||||
}
|
||||
|
||||
// GetProtocolWhitelist gets `AVFormatContext.protocol_whitelist` value.
|
||||
func (s *AVFormatContext) GetProtocolWhitelist() string {
|
||||
return C.GoString(s.protocol_whitelist)
|
||||
@@ -2023,16 +1951,22 @@ func (s *AVFormatContext) GetIoOpenAddr() *AvFormatContextIoOpenFunc {
|
||||
return (*AvFormatContextIoOpenFunc)(&s.io_open)
|
||||
}
|
||||
|
||||
// Deprecated: use io_close2 intead.
|
||||
//
|
||||
// GetIoClose gets `AVFormatContext.io_close` value.
|
||||
func (s *AVFormatContext) GetIoClose() AvFormatContextIoCloseFunc {
|
||||
return (AvFormatContextIoCloseFunc)(s.io_close)
|
||||
}
|
||||
|
||||
// Deprecated: use io_close2 intead.
|
||||
//
|
||||
// SetIoClose sets `AVFormatContext.io_close` value.
|
||||
func (s *AVFormatContext) SetIoClose(v AvFormatContextIoCloseFunc) {
|
||||
s.io_close = (C.av_format_context_io_close_func)(v)
|
||||
}
|
||||
|
||||
// Deprecated: use io_close2 intead.
|
||||
//
|
||||
// GetIoCloseAddr gets `AVFormatContext.io_close` address.
|
||||
func (s *AVFormatContext) GetIoCloseAddr() *AvFormatContextIoCloseFunc {
|
||||
return (*AvFormatContextIoCloseFunc)(&s.io_close)
|
||||
@@ -2088,6 +2022,24 @@ func (s *AVFormatContext) GetMaxProbePacketsAddr() *int32 {
|
||||
return (*int32)(&s.max_probe_packets)
|
||||
}
|
||||
|
||||
// typedef int (*av_format_context_io_close2_func)(struct AVFormatContext *s, AVIOContext *pb);
|
||||
type AvFormatContextIoClose2Func = C.av_format_context_io_close2_func
|
||||
|
||||
// GetIoClose2 gets `AVFormatContext.io_close2` value.
|
||||
func (s *AVFormatContext) GetIoClose2() AvFormatContextIoClose2Func {
|
||||
return (AvFormatContextIoClose2Func)(s.io_close2)
|
||||
}
|
||||
|
||||
// SetIoClose2 sets `AVFormatContext.io_close2` value.
|
||||
func (s *AVFormatContext) SetIoClose2(v AvFormatContextIoClose2Func) {
|
||||
s.io_close2 = (C.av_format_context_io_close2_func)(v)
|
||||
}
|
||||
|
||||
// GetIoClose2Addr gets `AVFormatContext.io_close2` address.
|
||||
func (s *AVFormatContext) GetIoClose2Addr() *AvFormatContextIoClose2Func {
|
||||
return (*AvFormatContextIoClose2Func)(&s.io_close2)
|
||||
}
|
||||
|
||||
const (
|
||||
AVFMT_FLAG_GENPTS = C.AVFMT_FLAG_GENPTS
|
||||
AVFMT_FLAG_IGNIDX = C.AVFMT_FLAG_IGNIDX
|
||||
@@ -2100,124 +2052,18 @@ const (
|
||||
AVFMT_FLAG_DISCARD_CORRUPT = C.AVFMT_FLAG_DISCARD_CORRUPT
|
||||
AVFMT_FLAG_FLUSH_PACKETS = C.AVFMT_FLAG_FLUSH_PACKETS
|
||||
AVFMT_FLAG_BITEXACT = C.AVFMT_FLAG_BITEXACT
|
||||
AVFMT_FLAG_MP4A_LATM = C.AVFMT_FLAG_MP4A_LATM
|
||||
AVFMT_FLAG_SORT_DTS = C.AVFMT_FLAG_SORT_DTS
|
||||
AVFMT_FLAG_PRIV_OPT = C.AVFMT_FLAG_PRIV_OPT
|
||||
AVFMT_FLAG_KEEP_SIDE_DATA = C.AVFMT_FLAG_KEEP_SIDE_DATA
|
||||
AVFMT_FLAG_FAST_SEEK = C.AVFMT_FLAG_FAST_SEEK
|
||||
AVFMT_FLAG_SHORTEST = C.AVFMT_FLAG_SHORTEST
|
||||
AVFMT_FLAG_AUTO_BSF = C.AVFMT_FLAG_AUTO_BSF
|
||||
|
||||
AVFMT_FLAG_SORT_DTS = C.AVFMT_FLAG_SORT_DTS
|
||||
|
||||
AVFMT_FLAG_FAST_SEEK = C.AVFMT_FLAG_FAST_SEEK
|
||||
AVFMT_FLAG_SHORTEST = C.AVFMT_FLAG_SHORTEST
|
||||
AVFMT_FLAG_AUTO_BSF = C.AVFMT_FLAG_AUTO_BSF
|
||||
)
|
||||
|
||||
const (
|
||||
AVFMT_EVENT_FLAG_METADATA_UPDATED = C.AVFMT_EVENT_FLAG_METADATA_UPDATED
|
||||
)
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatGetProbeScore
|
||||
func AvFormatGetProbeScore(s *AVFormatContext) int32 {
|
||||
return (int32)(C.av_format_get_probe_score((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatGetVideoCodec
|
||||
func AvFormatGetVideoCodec(s *AVFormatContext) *AVCodec {
|
||||
return (*AVCodec)(C.av_format_get_video_codec((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatSetVideoCodec
|
||||
func AvFormatSetVideoCodec(s *AVFormatContext, c *AVCodec) {
|
||||
C.av_format_set_video_codec((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatGetAudioCodec
|
||||
func AvFormatGetAudioCodec(s *AVFormatContext) *AVCodec {
|
||||
return (*AVCodec)(C.av_format_get_audio_codec((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatSetAudioCodec
|
||||
func AvFormatSetAudioCodec(s *AVFormatContext, c *AVCodec) {
|
||||
C.av_format_set_audio_codec((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatGetSubtitleCodec
|
||||
func AvFormatGetSubtitleCodec(s *AVFormatContext) *AVCodec {
|
||||
return (*AVCodec)(C.av_format_get_subtitle_codec((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatSetSubtitleCodec
|
||||
func AvFormatSetSubtitleCodec(s *AVFormatContext, c *AVCodec) {
|
||||
C.av_format_set_subtitle_codec((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatGetDataCodec
|
||||
func AvFormatGetDataCodec(s *AVFormatContext) *AVCodec {
|
||||
return (*AVCodec)(C.av_format_get_data_codec((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatSetDataCodec
|
||||
func AvFormatSetDataCodec(s *AVFormatContext, c *AVCodec) {
|
||||
C.av_format_set_data_codec((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatGetOpaque
|
||||
func AvFormatGetOpaque(s *AVFormatContext) unsafe.Pointer {
|
||||
return C.av_format_get_opaque((*C.struct_AVFormatContext)(s))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatSetOpaque
|
||||
func AvFormatSetOpaque(s *AVFormatContext, opaque CVoidPointer) {
|
||||
C.av_format_set_opaque((*C.struct_AVFormatContext)(s), VoidPointer(opaque))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatGetControlMessageCb
|
||||
func AvFormatGetControlMessageCb(s *AVFormatContext) AVFormatControlMessageFunc {
|
||||
return (AVFormatControlMessageFunc)(C.av_format_get_control_message_cb((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatSetControlMessageCb
|
||||
func AvFormatSetControlMessageCb(s *AVFormatContext, callback AVFormatControlMessageFunc) {
|
||||
C.av_format_set_control_message_cb((*C.struct_AVFormatContext)(s), (C.av_format_control_message)(callback))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatGetOpenCb
|
||||
func AvFormatGetOpenCb(s *AVFormatContext) AVOpenCallbackFunc {
|
||||
return (AVOpenCallbackFunc)(C.av_format_get_open_cb((*C.struct_AVFormatContext)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFormatSetOpenCb
|
||||
func AvFormatSetOpenCb(s *AVFormatContext, callback AVOpenCallbackFunc) {
|
||||
C.av_format_set_open_cb((*C.struct_AVFormatContext)(s), (C.AVOpenCallback)(callback))
|
||||
}
|
||||
|
||||
// AvFormatInjectGlobalSideData will cause global side data to be injected in the next packet
|
||||
// of each stream as well as after any subsequent seek.
|
||||
func AvFormatInjectGlobalSideData(s *AVFormatContext) {
|
||||
@@ -2244,27 +2090,6 @@ func AvFormatLicense() string {
|
||||
return C.GoString(C.avformat_license())
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvRegisterAll
|
||||
func AvRegisterAll() {
|
||||
C.av_register_all()
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvRegisterInputFormat
|
||||
func AvRegisterInputFormat(format *AVInputFormat) {
|
||||
C.av_register_input_format((*C.struct_AVInputFormat)(format))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvRegisterOutputFormat
|
||||
func AvRegisterOutputFormat(format *AVOutputFormat) {
|
||||
C.av_register_output_format((*C.struct_AVOutputFormat)(format))
|
||||
}
|
||||
|
||||
// AvFormatNetworkInit does global initialization of network libraries. This is optional,
|
||||
// and not recommended anymore.
|
||||
func AvFormatNetworkInit() int32 {
|
||||
@@ -2277,24 +2102,6 @@ func AvFormatNetworkDeinit() int32 {
|
||||
return (int32)(C.avformat_network_deinit())
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvIformatNext returns the first registered input format if f is NULL,
|
||||
// returns the next registered input format after f if f is non-NULL,
|
||||
// or NULL if f is the last one.
|
||||
func AvIformatNext(f *AVInputFormat) *AVInputFormat {
|
||||
return (*AVInputFormat)(C.av_iformat_next((*C.struct_AVInputFormat)(f)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvOformatNext returns the first registered output format if f is NULL,
|
||||
// returns the next registered output format after f if f is non-NULL,
|
||||
// or NULL if f is the last one.
|
||||
func AvOformatNext(f *AVOutputFormat) *AVOutputFormat {
|
||||
return (*AVOutputFormat)(C.av_oformat_next((*C.struct_AVOutputFormat)(f)))
|
||||
}
|
||||
|
||||
// AvMuxerIterate iterates over all registered muxers.
|
||||
func AvMuxerIterate(opaque CVoidPointerPointer) *AVOutputFormat {
|
||||
return (*AVOutputFormat)(C.av_muxer_iterate(VoidPointerPointer(opaque)))
|
||||
@@ -2321,6 +2128,11 @@ func AvFormatGetClass() *AVClass {
|
||||
return (*AVClass)(C.avformat_get_class())
|
||||
}
|
||||
|
||||
// AvStreamGetClass gets the AVClass for AVStream.
|
||||
func AvStreamGetClass() *AVClass {
|
||||
return (*AVClass)(C.av_stream_get_class())
|
||||
}
|
||||
|
||||
// AvFormatNewStream adds a new stream to a media file.
|
||||
func AvFormatNewStream(s *AVFormatContext, c *AVCodec) *AVStream {
|
||||
return (*AVStream)(C.avformat_new_stream((*C.struct_AVFormatContext)(s), (*C.struct_AVCodec)(c)))
|
||||
@@ -2333,15 +2145,15 @@ func AvStreamAddSideData(st *AVStream, _type AVPacketSideDataType, data *uint8,
|
||||
}
|
||||
|
||||
// AvStreamNewSideData allocates new information from stream.
|
||||
func AvStreamNewSideData(st *AVStream, _type AVPacketSideDataType, size int32) *uint8 {
|
||||
func AvStreamNewSideData(st *AVStream, _type AVPacketSideDataType, size uintptr) *uint8 {
|
||||
return (*uint8)(C.av_stream_new_side_data((*C.struct_AVStream)(st),
|
||||
(C.enum_AVPacketSideDataType)(_type), (C.int)(size)))
|
||||
(C.enum_AVPacketSideDataType)(_type), (C.size_t)(size)))
|
||||
}
|
||||
|
||||
// AvStreamGetSideData gets side information from stream.
|
||||
func AvStreamGetSideData(st *AVStream, _type AVPacketSideDataType, size *int32) *uint8 {
|
||||
func AvStreamGetSideData(st *AVStream, _type AVPacketSideDataType, size *uintptr) *uint8 {
|
||||
return (*uint8)(C.av_stream_get_side_data((*C.struct_AVStream)(st),
|
||||
(C.enum_AVPacketSideDataType)(_type), (*C.int)(size)))
|
||||
(C.enum_AVPacketSideDataType)(_type), (*C.size_t)(unsafe.Pointer(size))))
|
||||
}
|
||||
|
||||
// AvNewProgram
|
||||
@@ -2396,7 +2208,7 @@ func AvProbeInputBuffer2(pb *AVIOContext, fmt **AVInputFormat,
|
||||
(*C.char)(urlPtr), VoidPointer(logctx), (C.uint)(offset), (C.uint)(maxProbeSize)))
|
||||
}
|
||||
|
||||
// AvProbeInputBuffer likes AvProbeInputBuffer2() but returns 0 on success
|
||||
// AvProbeInputBuffer likes AvProbeInputBuffer2() but returns 0 on success.
|
||||
func AvProbeInputBuffer(pb *AVIOContext, fmt **AVInputFormat,
|
||||
url string, logctx CVoidPointer, offset, maxProbeSize uint32) int32 {
|
||||
urlPtr, urlFunc := StringCasting(url)
|
||||
@@ -2414,13 +2226,6 @@ func AvFormatOpenInput(ps **AVFormatContext, url string, fmt *AVInputFormat, opt
|
||||
(*C.char)(urlPtr), (*C.struct_AVInputFormat)(fmt), (**C.struct_AVDictionary)(unsafe.Pointer(options))))
|
||||
}
|
||||
|
||||
// Deprecated: Use an AVDictionary to pass options to a demuxer.
|
||||
//
|
||||
// AvDemuxerOpen
|
||||
func AvDemuxerOpen(ic *AVFormatContext) int32 {
|
||||
return (int32)(C.av_demuxer_open((*C.struct_AVFormatContext)(ic)))
|
||||
}
|
||||
|
||||
// AvFormatFindStreamInfo reads packets of a media file to get stream information.
|
||||
func AvFormatFindStreamInfo(ic *AVFormatContext, options **AVDictionary) int32 {
|
||||
return (int32)(C.avformat_find_stream_info((*C.struct_AVFormatContext)(ic),
|
||||
@@ -2634,6 +2439,23 @@ func AvIndexSearchTimestamp(st *AVStream, timestamp int64, flags int32) int32 {
|
||||
(C.int64_t)(timestamp), (C.int)(flags)))
|
||||
}
|
||||
|
||||
// AvFormatIndexGetEntriesCount gets the index entry count for the given AVStream.
|
||||
func AvFormatIndexGetEntriesCount(st *AVStream) int32 {
|
||||
return (int32)(C.avformat_index_get_entries_count((*C.struct_AVStream)(st)))
|
||||
}
|
||||
|
||||
// AvFormatIndexGetEntry gets the AVIndexEntry corresponding to the given index.
|
||||
func AvFormatIndexGetEntry(st *AVStream, idx int32) *AVIndexEntry {
|
||||
return (*AVIndexEntry)(C.avformat_index_get_entry((*C.struct_AVStream)(st), (C.int)(idx)))
|
||||
}
|
||||
|
||||
// AvFormatIndexGetEntryFromTimestamp gets the AVIndexEntry corresponding to the given timestamp.
|
||||
func AvFormatIndexGetEntryFromTimestamp(st *AVStream,
|
||||
wantedTimestamp int64, flags int32) *AVIndexEntry {
|
||||
return (*AVIndexEntry)(C.avformat_index_get_entry_from_timestamp((*C.struct_AVStream)(st),
|
||||
(C.int64_t)(wantedTimestamp), (C.int)(flags)))
|
||||
}
|
||||
|
||||
// AvAddIndexEntry add an index entry into a sorted list. Update the entry if the list
|
||||
// already contains it.
|
||||
func AvAddIndexEntry(st *AVStream, pos, timestamp int64, size, distance, flags int32) int32 {
|
||||
@@ -2774,14 +2596,6 @@ func AvFormatQueueAttachedPictures(ic *AVFormatContext) int32 {
|
||||
return (int32)(C.avformat_queue_attached_pictures((*C.struct_AVFormatContext)(ic)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvApplyBitstreamFilters applies a list of bitstream filters to a packet.
|
||||
func AvApplyBitstreamFilters(codec *AVCodecContext, pkt *AVPacket, bsfc *AVBitStreamFilterContext) int32 {
|
||||
return (int32)(C.av_apply_bitstream_filters((*C.struct_AVCodecContext)(codec),
|
||||
(*C.struct_AVPacket)(pkt), (*C.struct_AVBitStreamFilterContext)(bsfc)))
|
||||
}
|
||||
|
||||
// AVTimebaseSource
|
||||
type AVTimebaseSource = C.enum_AVTimebaseSource
|
||||
|
||||
|
147
avformat_avio.go
147
avformat_avio.go
@@ -229,16 +229,22 @@ type AVIODirContext C.struct_AVIODirContext
|
||||
// URLContext
|
||||
type URLContext C.struct_URLContext
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetURLContext gets `AVIODirContext.url_context` value.
|
||||
func (dc *AVIODirContext) GetURLContext() *URLContext {
|
||||
return (*URLContext)(dc.url_context)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SetURLContext sets `AVIODirContext.url_context` value.
|
||||
func (dc *AVIODirContext) SetURLContext(v *URLContext) {
|
||||
dc.url_context = (*C.struct_URLContext)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetURLContextAddr gets `AVIODirContext.url_context` address.
|
||||
func (dc *AVIODirContext) GetURLContextAddr() **URLContext {
|
||||
return (**URLContext)(unsafe.Pointer(&dc.url_context))
|
||||
@@ -469,21 +475,6 @@ func (ctx *AVIOContext) GetSeekableAddr() *int32 {
|
||||
return (*int32)(&ctx.seekable)
|
||||
}
|
||||
|
||||
// GetMaxsize gets `AVIOContext.maxsize` value.
|
||||
func (ctx *AVIOContext) GetMaxsize() int64 {
|
||||
return (int64)(ctx.maxsize)
|
||||
}
|
||||
|
||||
// SetMaxsize sets `AVIOContext.maxsize` value.
|
||||
func (ctx *AVIOContext) SetMaxsize(v int64) {
|
||||
ctx.maxsize = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetMaxsizeAddr gets `AVIOContext.maxsize` address.
|
||||
func (ctx *AVIOContext) GetMaxsizeAddr() *int64 {
|
||||
return (*int64)(&ctx.maxsize)
|
||||
}
|
||||
|
||||
// GetDirect gets `AVIOContext.direct` value.
|
||||
func (ctx *AVIOContext) GetDirect() int32 {
|
||||
return (int32)(ctx.direct)
|
||||
@@ -514,64 +505,19 @@ func (ctx *AVIOContext) GetBytesReadAddr() *int64 {
|
||||
return (*int64)(&ctx.bytes_read)
|
||||
}
|
||||
|
||||
// GetSeekCount gets `AVIOContext.seek_count` value.
|
||||
func (ctx *AVIOContext) GetSeekCount() int32 {
|
||||
return (int32)(ctx.seek_count)
|
||||
// GetBytesWritten gets `AVIOContext.bytes_written` value.
|
||||
func (ctx *AVIOContext) GetBytesWritten() int64 {
|
||||
return (int64)(ctx.bytes_written)
|
||||
}
|
||||
|
||||
// SetSeekCount sets `AVIOContext.seek_count` value.
|
||||
func (ctx *AVIOContext) SetSeekCount(v int32) {
|
||||
ctx.seek_count = (C.int)(v)
|
||||
// SetBytesWritten sets `AVIOContext.bytes_written` value.
|
||||
func (ctx *AVIOContext) SetBytesWritten(v int64) {
|
||||
ctx.bytes_written = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetSeekCountAddr gets `AVIOContext.seek_count` address.
|
||||
func (ctx *AVIOContext) GetSeekCountAddr() *int32 {
|
||||
return (*int32)(&ctx.seek_count)
|
||||
}
|
||||
|
||||
// GetWriteoutCount gets `AVIOContext.writeout_count` value.
|
||||
func (ctx *AVIOContext) GetWriteoutCount() int32 {
|
||||
return (int32)(ctx.writeout_count)
|
||||
}
|
||||
|
||||
// SetWriteoutCount sets `AVIOContext.writeout_count` value.
|
||||
func (ctx *AVIOContext) SetWriteoutCount(v int32) {
|
||||
ctx.writeout_count = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetWriteoutCountAddr gets `AVIOContext.writeout_count` address.
|
||||
func (ctx *AVIOContext) GetWriteoutCountAddr() *int32 {
|
||||
return (*int32)(&ctx.writeout_count)
|
||||
}
|
||||
|
||||
// GetOrigBufferSize gets `AVIOContext.orig_buffer_size` value.
|
||||
func (ctx *AVIOContext) GetOrigBufferSize() int32 {
|
||||
return (int32)(ctx.orig_buffer_size)
|
||||
}
|
||||
|
||||
// SetOrigBufferSize sets `AVIOContext.orig_buffer_size` value.
|
||||
func (ctx *AVIOContext) SetOrigBufferSize(v int32) {
|
||||
ctx.orig_buffer_size = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetOrigBufferSizeAddr gets `AVIOContext.orig_buffer_size` address.
|
||||
func (ctx *AVIOContext) GetOrigBufferSizeAddr() *int32 {
|
||||
return (*int32)(&ctx.orig_buffer_size)
|
||||
}
|
||||
|
||||
// GetShortSeekThreshold gets `AVIOContext.short_seek_threshold` value.
|
||||
func (ctx *AVIOContext) GetShortSeekThreshold() int32 {
|
||||
return (int32)(ctx.short_seek_threshold)
|
||||
}
|
||||
|
||||
// SetShortSeekThreshold sets `AVIOContext.short_seek_threshold` value.
|
||||
func (ctx *AVIOContext) SetShortSeekThreshold(v int32) {
|
||||
ctx.short_seek_threshold = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetShortSeekThresholdAddr gets `AVIOContext.short_seek_threshold` address.
|
||||
func (ctx *AVIOContext) GetShortSeekThresholdAddr() *int32 {
|
||||
return (*int32)(&ctx.short_seek_threshold)
|
||||
// GetBytesWrittenAddr gets `AVIOContext.bytes_written` address.
|
||||
func (ctx *AVIOContext) GetBytesWrittenAddr() *int64 {
|
||||
return (*int64)(&ctx.bytes_written)
|
||||
}
|
||||
|
||||
// GetProtocolWhitelist gets `AVIOContext.protocol_whitelist` value.
|
||||
@@ -599,51 +545,6 @@ func (ctx *AVIOContext) GetIgnoreBoundaryPointAddr() *int32 {
|
||||
return (*int32)(&ctx.ignore_boundary_point)
|
||||
}
|
||||
|
||||
// GetCurrentType gets `AVIOContext.currenttype` value.
|
||||
func (ctx *AVIOContext) GetCurrentType() AVIODataMarkerType {
|
||||
return (AVIODataMarkerType)(ctx.current_type)
|
||||
}
|
||||
|
||||
// SetCurrentType sets `AVIOContext.currenttype` value.
|
||||
func (ctx *AVIOContext) SetCurrentType(v AVIODataMarkerType) {
|
||||
ctx.current_type = (C.enum_AVIODataMarkerType)(v)
|
||||
}
|
||||
|
||||
// GetCurrentTypeAddr gets `AVIOContext.currenttype` address.
|
||||
func (ctx *AVIOContext) GetCurrentTypeAddr() *AVIODataMarkerType {
|
||||
return (*AVIODataMarkerType)(&ctx.current_type)
|
||||
}
|
||||
|
||||
// GetLastTime gets `AVIOContext.last_time` value.
|
||||
func (ctx *AVIOContext) GetLastTime() int64 {
|
||||
return (int64)(ctx.last_time)
|
||||
}
|
||||
|
||||
// SetLastTime sets `AVIOContext.last_time` value.
|
||||
func (ctx *AVIOContext) SetLastTime(v int64) {
|
||||
ctx.last_time = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetLastTimeAddr gets `AVIOContext.last_time` address.
|
||||
func (ctx *AVIOContext) GetLastTimeAddr() *int64 {
|
||||
return (*int64)(&ctx.last_time)
|
||||
}
|
||||
|
||||
// GetWritten gets `AVIOContext.written` value.
|
||||
func (ctx *AVIOContext) GetWritten() int64 {
|
||||
return (int64)(ctx.written)
|
||||
}
|
||||
|
||||
// SetWritten sets `AVIOContext.written` value.
|
||||
func (ctx *AVIOContext) SetWritten(v int64) {
|
||||
ctx.written = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// GetWrittenAddr gets `AVIOContext.written` address.
|
||||
func (ctx *AVIOContext) GetWrittenAddr() *int64 {
|
||||
return (*int64)(&ctx.written)
|
||||
}
|
||||
|
||||
// GetBufPtrMax gets `AVIOContext.buf_ptr_max` value.
|
||||
func (ctx *AVIOContext) GetBufPtrMax() *uint8 {
|
||||
return (*uint8)(ctx.buf_ptr_max)
|
||||
@@ -691,22 +592,6 @@ func AvIOCheck(url string, flags int32) int32 {
|
||||
return (int32)(C.avio_check((*C.char)(urlPtr), (C.int)(flags)))
|
||||
}
|
||||
|
||||
// AvPrivIoMove moves or renames a resource.
|
||||
func AvPrivIoMove(urlSrc, urlDst string) int32 {
|
||||
urlSrcPtr, urlSrcFunc := StringCasting(urlSrc)
|
||||
defer urlSrcFunc()
|
||||
urlDstPtr, urlDstFunc := StringCasting(urlDst)
|
||||
defer urlDstFunc()
|
||||
return (int32)(C.avpriv_io_move((*C.char)(urlSrcPtr), (*C.char)(urlDstPtr)))
|
||||
}
|
||||
|
||||
// AvPrivIoDelete deletes a resource.
|
||||
func AvPrivIoDelete(url string) int32 {
|
||||
urlPtr, urlFunc := StringCasting(url)
|
||||
defer urlFunc()
|
||||
return (int32)(C.avpriv_io_delete((*C.char)(urlPtr)))
|
||||
}
|
||||
|
||||
// AvIOOpenDir opens directory for reading.
|
||||
func AvIOOpenDir(s **AVIODirContext, url string, options **AVDictionary) int32 {
|
||||
urlPtr, urlFunc := StringCasting(url)
|
||||
@@ -865,6 +750,8 @@ func AvIOFeof(s *AVIOContext) int32 {
|
||||
return (int32)(C.avio_feof((*C.struct_AVIOContext)(s)))
|
||||
}
|
||||
|
||||
// NONEED: avio_vprintf
|
||||
|
||||
// AvIOPrintf Writes a formatted string to the context.
|
||||
func AvIOPrintf(s *AVIOContext, _fmt string, va ...any) int32 {
|
||||
fmtPtr, fmtFunc := StringCasting(fmt.Sprintf(_fmt, va...))
|
||||
|
@@ -10,7 +10,6 @@ package ffmpeg
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBAVFORMAT_VERSION_MAJOR = C.LIBAVFORMAT_VERSION_MAJOR
|
||||
LIBAVFORMAT_VERSION_MINOR = C.LIBAVFORMAT_VERSION_MINOR
|
||||
LIBAVFORMAT_VERSION_MICRO = C.LIBAVFORMAT_VERSION_MICRO
|
||||
)
|
||||
|
14
avformat_version_major.go
Normal file
14
avformat_version_major.go
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavformat/version_major.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBAVFORMAT_VERSION_MAJOR = C.LIBAVFORMAT_VERSION_MAJOR
|
||||
)
|
@@ -34,7 +34,7 @@ func AvutilLicense() string {
|
||||
return C.GoString(C.avutil_license())
|
||||
}
|
||||
|
||||
// Media Type
|
||||
// Media Type.
|
||||
type AVMediaType = C.enum_AVMediaType
|
||||
|
||||
const (
|
||||
@@ -99,6 +99,7 @@ func AvXIfNull[T any](p, x *T) *T {
|
||||
return x
|
||||
}
|
||||
|
||||
// AvStringIfNull
|
||||
func AvStringIfNull(p, x string) string {
|
||||
if len(p) != 0 {
|
||||
return p
|
||||
@@ -117,6 +118,8 @@ func AvIntListLength[U, V Integer](list *U, term V) uint32 {
|
||||
return (uint32)(C.av_int_list_length_for_size((C.uint)(elsize), (unsafe.Pointer)(list), (C.uint64_t)(term)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFopenUtf8
|
||||
func AvFopenUtf8(path, mode string) *FILE {
|
||||
pathPtr, pathFunc := StringCasting(path)
|
||||
|
@@ -9,9 +9,10 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVAdler
|
||||
type AVAdler = C.AVAdler
|
||||
|
||||
// AvAdler32Update calculates the Adler32 checksum of a buffer.
|
||||
func AvAdler32Update(adler AVAdler, buf *uint8, len uint32) AVAdler {
|
||||
return (AVAdler)(C.av_adler32_update((C.AVAdler)(adler), (*C.uint8_t)(buf), (C.uint)(len)))
|
||||
func AvAdler32Update(adler AVAdler, buf *uint8, len uintptr) AVAdler {
|
||||
return (AVAdler)(C.av_adler32_update((C.AVAdler)(adler), (*C.uint8_t)(buf), (C.size_t)(len)))
|
||||
}
|
||||
|
70
avutil_ambient_viewing_environment.go
Normal file
70
avutil_ambient_viewing_environment.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavutil/ambient_viewing_environment.h>
|
||||
*/
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
type AVAmbientViewingEnvironment C.struct_AVAmbientViewingEnvironment
|
||||
|
||||
// GetAmbientIlluminance gets `AVAmbientViewingEnvironment.ambient_illuminance` value.
|
||||
func (ave *AVAmbientViewingEnvironment) GetAmbientIlluminance() AVRational {
|
||||
return (AVRational)(ave.ambient_illuminance)
|
||||
}
|
||||
|
||||
// SetAmbientIlluminance sets `AVAmbientViewingEnvironment.ambient_illuminance` value.
|
||||
func (ave *AVAmbientViewingEnvironment) SetAmbientIlluminance(v AVRational) {
|
||||
ave.ambient_illuminance = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetAmbientIlluminanceAddr gets `AVAmbientViewingEnvironment.ambient_illuminance` address.
|
||||
func (ave *AVAmbientViewingEnvironment) GetAmbientIlluminanceAddr() *AVRational {
|
||||
return (*AVRational)(&ave.ambient_illuminance)
|
||||
}
|
||||
|
||||
// GetAmbientLightX gets `AVAmbientViewingEnvironment.ambient_light_x` value.
|
||||
func (ave *AVAmbientViewingEnvironment) GetAmbientLightX() AVRational {
|
||||
return (AVRational)(ave.ambient_light_x)
|
||||
}
|
||||
|
||||
// SetAmbientLightX sets `AVAmbientViewingEnvironment.ambient_light_x` value.
|
||||
func (ave *AVAmbientViewingEnvironment) SetAmbientLightX(v AVRational) {
|
||||
ave.ambient_light_x = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetAmbientLightXAddr gets `AVAmbientViewingEnvironment.ambient_light_x` address.
|
||||
func (ave *AVAmbientViewingEnvironment) GetAmbientLightXAddr() *AVRational {
|
||||
return (*AVRational)(&ave.ambient_light_x)
|
||||
}
|
||||
|
||||
// GetAmbientLightY gets `AVAmbientViewingEnvironment.ambient_light_y` value.
|
||||
func (ave *AVAmbientViewingEnvironment) GetAmbientLightY() AVRational {
|
||||
return (AVRational)(ave.ambient_light_y)
|
||||
}
|
||||
|
||||
// SetAmbientLightY sets `AVAmbientViewingEnvironment.ambient_light_y` value.
|
||||
func (ave *AVAmbientViewingEnvironment) SetAmbientLightY(v AVRational) {
|
||||
ave.ambient_light_y = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetAmbientLightYAddr gets `AVAmbientViewingEnvironment.ambient_light_y` address.
|
||||
func (ave *AVAmbientViewingEnvironment) GetAmbientLightYAddr() *AVRational {
|
||||
return (*AVRational)(&ave.ambient_light_y)
|
||||
}
|
||||
|
||||
// AvAmbientViewingEnvironmentAlloc allocates an AVAmbientViewingEnvironment structure.
|
||||
func AvAmbientViewingEnvironmentAlloc(size *uintptr) *AVAmbientViewingEnvironment {
|
||||
return (*AVAmbientViewingEnvironment)(C.av_ambient_viewing_environment_alloc(
|
||||
(*C.size_t)(unsafe.Pointer(size))))
|
||||
}
|
||||
|
||||
// AvAmbientViewingEnvironmentCreateSideData
|
||||
func AvAmbientViewingEnvironmentCreateSideData(frame *AVFrame) *AVAmbientViewingEnvironment {
|
||||
return (*AVAmbientViewingEnvironment)(C.av_ambient_viewing_environment_create_side_data(
|
||||
(*C.struct_AVFrame)(frame)))
|
||||
}
|
@@ -9,6 +9,7 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVAudioFifo
|
||||
type AVAudioFifo C.struct_AVAudioFifo
|
||||
|
||||
// AvAudioFifoFree frees an AVAudioFifo.
|
||||
|
@@ -57,6 +57,7 @@ import "C"
|
||||
|
||||
// NONEED: av_append_path_component
|
||||
|
||||
// AVEscapeMode
|
||||
type AVEscapeMode = C.enum_AVEscapeMode
|
||||
|
||||
const (
|
||||
|
@@ -14,6 +14,7 @@ const (
|
||||
AV_BF_ROUNDS = C.AV_BF_ROUNDS
|
||||
)
|
||||
|
||||
// AVBlowfish
|
||||
type AVBlowfish C.struct_AVBlowfish
|
||||
|
||||
// GetP gets `AVBlowfish.p` value.
|
||||
|
@@ -17,6 +17,7 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// AVBPrint
|
||||
type AVBPrint C.struct_AVBPrint
|
||||
|
||||
const (
|
||||
|
@@ -37,24 +37,26 @@ func (bf *AVBufferRef) GetSize() int32 {
|
||||
}
|
||||
|
||||
// AvBufferAlloc allocates an AVBuffer of the given size using AvMalloc().
|
||||
func AvBufferAlloc(size int32) *AVBufferRef {
|
||||
return (*AVBufferRef)(C.av_buffer_alloc((C.int)(size)))
|
||||
func AvBufferAlloc(size uintptr) *AVBufferRef {
|
||||
return (*AVBufferRef)(C.av_buffer_alloc((C.size_t)(size)))
|
||||
}
|
||||
|
||||
// AvBufferAllocz same as AVBufferAlloc(), except the returned buffer will be initialized
|
||||
// to zero.
|
||||
func AvBufferAllocz(size int32) *AVBufferRef {
|
||||
return (*AVBufferRef)(C.av_buffer_allocz((C.int)(size)))
|
||||
func AvBufferAllocz(size uintptr) *AVBufferRef {
|
||||
return (*AVBufferRef)(C.av_buffer_allocz((C.size_t)(size)))
|
||||
}
|
||||
|
||||
const AV_BUFFER_FLAG_READONLY = C.AV_BUFFER_FLAG_READONLY
|
||||
const (
|
||||
AV_BUFFER_FLAG_READONLY = C.AV_BUFFER_FLAG_READONLY
|
||||
)
|
||||
|
||||
// typedef void (*av_buffer_free_func)(void *opaque, uint8_t *data)
|
||||
// typedef void (*av_buffer_free_func)(void *opaque, uint8_t *data);
|
||||
type AVBufferFreeFunc = C.av_buffer_free_func
|
||||
|
||||
// AvBufferCreate Create an AVBuffer from an existing array.
|
||||
func AvBufferCreate(data *uint8, size int32, free AVBufferFreeFunc, opaque CVoidPointer, flags int32) *AVBufferRef {
|
||||
return (*AVBufferRef)(C.av_buffer_create((*C.uint8_t)(data), (C.int)(size),
|
||||
func AvBufferCreate(data *uint8, size uintptr, free AVBufferFreeFunc, opaque CVoidPointer, flags int32) *AVBufferRef {
|
||||
return (*AVBufferRef)(C.av_buffer_create((*C.uint8_t)(data), (C.size_t)(size),
|
||||
(C.av_buffer_free_func)(free), VoidPointer(opaque), (C.int)(flags)))
|
||||
}
|
||||
|
||||
@@ -98,8 +100,8 @@ func AvBufferMakeWritable(buf **AVBufferRef) int32 {
|
||||
}
|
||||
|
||||
// AvBufferRealloc reallocates a given buffer.
|
||||
func AvBufferRealloc(buf **AVBufferRef, size int32) int32 {
|
||||
return (int32)(C.av_buffer_realloc((**C.struct_AVBufferRef)(unsafe.Pointer(buf)), (C.int)(size)))
|
||||
func AvBufferRealloc(buf **AVBufferRef, size uintptr) int32 {
|
||||
return (int32)(C.av_buffer_realloc((**C.struct_AVBufferRef)(unsafe.Pointer(buf)), (C.size_t)(size)))
|
||||
}
|
||||
|
||||
// AvBufferReplace ensures dst refers to the same data as src.
|
||||
@@ -108,26 +110,27 @@ func AvBufferReplace(dst **AVBufferRef, src *AVBufferRef) int32 {
|
||||
(*C.struct_AVBufferRef)(src)))
|
||||
}
|
||||
|
||||
// AVBufferPool
|
||||
type AVBufferPool C.struct_AVBufferPool
|
||||
|
||||
// typedef AVBufferRef* (*av_buffer_pool_alloc_func)(int size)
|
||||
// typedef AVBufferRef* (*av_buffer_pool_alloc_func)(int size);
|
||||
type AVBufferPoolAllocFunc = C.av_buffer_pool_alloc_func
|
||||
|
||||
// typedef AVBufferRef* (*av_buffer_pool_alloc2_func)(void* opaque, int size)
|
||||
// typedef AVBufferRef* (*av_buffer_pool_alloc2_func)(void* opaque, int size);
|
||||
type AVBufferPoolAlloc2Func = C.av_buffer_pool_alloc2_func
|
||||
|
||||
// typedef void (*av_buffer_pool_free_func)(void* opaque)
|
||||
// typedef void (*av_buffer_pool_free_func)(void* opaque);
|
||||
type AVBufferPoolFreeFunc = C.av_buffer_pool_free_func
|
||||
|
||||
// AvBufferPoolInit allocates and initializes a buffer pool.
|
||||
func AvBufferPoolInit(size int32, alloc AVBufferPoolAllocFunc) *AVBufferPool {
|
||||
return (*AVBufferPool)(C.av_buffer_pool_init((C.int)(size), (C.av_buffer_pool_alloc_func)(alloc)))
|
||||
func AvBufferPoolInit(size uintptr, alloc AVBufferPoolAllocFunc) *AVBufferPool {
|
||||
return (*AVBufferPool)(C.av_buffer_pool_init((C.size_t)(size), (C.av_buffer_pool_alloc_func)(alloc)))
|
||||
}
|
||||
|
||||
// AvBufferPoolInit2 allocates and initialize a buffer pool with a more complex allocator.
|
||||
func AvBufferPoolInit2(size int32, opaque CVoidPointer,
|
||||
func AvBufferPoolInit2(size uintptr, opaque CVoidPointer,
|
||||
alloc AVBufferPoolAllocFunc, free AVBufferPoolFreeFunc) *AVBufferPool {
|
||||
return (*AVBufferPool)(C.av_buffer_pool_init2((C.int)(size), VoidPointer(opaque),
|
||||
return (*AVBufferPool)(C.av_buffer_pool_init2((C.size_t)(size), VoidPointer(opaque),
|
||||
(C.av_buffer_pool_alloc_func)(alloc),
|
||||
(C.av_buffer_pool_free_func)(free)))
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVCAMELLIA
|
||||
type AVCAMELLIA C.struct_AVCAMELLIA
|
||||
|
||||
// AvCamelliaAlloc allocates an AVCAMELLIA context.
|
||||
|
@@ -9,6 +9,7 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVCAST5
|
||||
type AVCAST5 C.struct_AVCAST5
|
||||
|
||||
// AvCast5Alloc allocates an AVCAST5 context.
|
||||
|
@@ -6,10 +6,123 @@ package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavutil/channel_layout.h>
|
||||
|
||||
uint64_t get_av_channel_layout_u_mask(AVChannelLayout *cl) {
|
||||
return cl->u.mask;
|
||||
}
|
||||
|
||||
void set_av_channel_layout_u_mask(AVChannelLayout *cl, uint64_t v) {
|
||||
cl->u.mask = v;
|
||||
}
|
||||
|
||||
uint64_t* get_av_channel_layout_u_mask_addr(AVChannelLayout *cl) {
|
||||
return &cl->u.mask;
|
||||
}
|
||||
|
||||
AVChannelCustom* get_av_channel_layout_u_map(AVChannelLayout *cl) {
|
||||
return cl->u.map;
|
||||
}
|
||||
|
||||
void set_av_channel_layout_u_map(AVChannelLayout *cl, AVChannelCustom* v) {
|
||||
cl->u.map = v;
|
||||
}
|
||||
|
||||
AVChannelCustom** get_av_channel_layout_u_map_addr(AVChannelLayout *cl) {
|
||||
return &cl->u.map;
|
||||
}
|
||||
|
||||
const struct AVChannelLayout av_channel_layout_mono = AV_CHANNEL_LAYOUT_MONO;
|
||||
const struct AVChannelLayout av_channel_layout_stereo = AV_CHANNEL_LAYOUT_STEREO;
|
||||
const struct AVChannelLayout av_channel_layout_2point1 = AV_CHANNEL_LAYOUT_2POINT1;
|
||||
const struct AVChannelLayout av_channel_layout_2_1 = AV_CHANNEL_LAYOUT_2_1;
|
||||
const struct AVChannelLayout av_channel_layout_surround = AV_CHANNEL_LAYOUT_SURROUND;
|
||||
const struct AVChannelLayout av_channel_layout_3point1 = AV_CHANNEL_LAYOUT_3POINT1;
|
||||
const struct AVChannelLayout av_channel_layout_4point0 = AV_CHANNEL_LAYOUT_4POINT0;
|
||||
const struct AVChannelLayout av_channel_layout_4point1 = AV_CHANNEL_LAYOUT_4POINT1;
|
||||
const struct AVChannelLayout av_channel_layout_2_2 = AV_CHANNEL_LAYOUT_2_2;
|
||||
const struct AVChannelLayout av_channel_layout_quad = AV_CHANNEL_LAYOUT_QUAD;
|
||||
const struct AVChannelLayout av_channel_layout_5point0 = AV_CHANNEL_LAYOUT_5POINT0;
|
||||
const struct AVChannelLayout av_channel_layout_5point1 = AV_CHANNEL_LAYOUT_5POINT1;
|
||||
const struct AVChannelLayout av_channel_layout_5point0_back = AV_CHANNEL_LAYOUT_5POINT0_BACK;
|
||||
const struct AVChannelLayout av_channel_layout_5point1_back = AV_CHANNEL_LAYOUT_5POINT1_BACK;
|
||||
const struct AVChannelLayout av_channel_layout_6point0 = AV_CHANNEL_LAYOUT_6POINT0;
|
||||
const struct AVChannelLayout av_channel_layout_6point0_front = AV_CHANNEL_LAYOUT_6POINT0_FRONT;
|
||||
const struct AVChannelLayout av_channel_layout_hexagonal = AV_CHANNEL_LAYOUT_HEXAGONAL;
|
||||
const struct AVChannelLayout av_channel_layout_6point1 = AV_CHANNEL_LAYOUT_6POINT1;
|
||||
const struct AVChannelLayout av_channel_layout_6point1_back = AV_CHANNEL_LAYOUT_6POINT1_BACK;
|
||||
const struct AVChannelLayout av_channel_layout_6point1_front = AV_CHANNEL_LAYOUT_6POINT1_FRONT;
|
||||
const struct AVChannelLayout av_channel_layout_7point0 = AV_CHANNEL_LAYOUT_7POINT0;
|
||||
const struct AVChannelLayout av_channel_layout_7point0_front = AV_CHANNEL_LAYOUT_7POINT0_FRONT;
|
||||
const struct AVChannelLayout av_channel_layout_7point1 = AV_CHANNEL_LAYOUT_7POINT1;
|
||||
const struct AVChannelLayout av_channel_layout_7point1_wide = AV_CHANNEL_LAYOUT_7POINT1_WIDE;
|
||||
const struct AVChannelLayout av_channel_layout_7point1_wide_back = AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK;
|
||||
const struct AVChannelLayout av_channel_layout_7point1_top_back = AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK;
|
||||
const struct AVChannelLayout av_channel_layout_octagonal = AV_CHANNEL_LAYOUT_OCTAGONAL;
|
||||
const struct AVChannelLayout av_channel_layout_cube = AV_CHANNEL_LAYOUT_CUBE;
|
||||
const struct AVChannelLayout av_channel_layout_hexadecagonal = AV_CHANNEL_LAYOUT_HEXADECAGONAL;
|
||||
const struct AVChannelLayout av_channel_layout_stereo_downmix = AV_CHANNEL_LAYOUT_STEREO_DOWNMIX;
|
||||
const struct AVChannelLayout av_channel_layout_22point2 = AV_CHANNEL_LAYOUT_22POINT2;
|
||||
const struct AVChannelLayout av_channel_layout_ambisonic_first_order = AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER;
|
||||
|
||||
*/
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
const (
|
||||
AV_CH_LAYOUT_MAX_STRING_SIZE = 256
|
||||
)
|
||||
|
||||
// AVChannel
|
||||
type AVChannel = C.enum_AVChannel
|
||||
|
||||
const (
|
||||
AV_CHAN_NONE = AVChannel(C.AV_CHAN_NONE)
|
||||
AV_CHAN_FRONT_LEFT = AVChannel(C.AV_CHAN_FRONT_LEFT)
|
||||
AV_CHAN_FRONT_RIGHT = AVChannel(C.AV_CHAN_FRONT_RIGHT)
|
||||
AV_CHAN_FRONT_CENTER = AVChannel(C.AV_CHAN_FRONT_CENTER)
|
||||
AV_CHAN_LOW_FREQUENCY = AVChannel(C.AV_CHAN_LOW_FREQUENCY)
|
||||
AV_CHAN_BACK_LEFT = AVChannel(C.AV_CHAN_BACK_LEFT)
|
||||
AV_CHAN_BACK_RIGHT = AVChannel(C.AV_CHAN_BACK_RIGHT)
|
||||
AV_CHAN_FRONT_LEFT_OF_CENTER = AVChannel(C.AV_CHAN_FRONT_LEFT_OF_CENTER)
|
||||
AV_CHAN_FRONT_RIGHT_OF_CENTER = AVChannel(C.AV_CHAN_FRONT_RIGHT_OF_CENTER)
|
||||
AV_CHAN_BACK_CENTER = AVChannel(C.AV_CHAN_BACK_CENTER)
|
||||
AV_CHAN_SIDE_LEFT = AVChannel(C.AV_CHAN_SIDE_LEFT)
|
||||
AV_CHAN_SIDE_RIGHT = AVChannel(C.AV_CHAN_SIDE_RIGHT)
|
||||
AV_CHAN_TOP_CENTER = AVChannel(C.AV_CHAN_TOP_CENTER)
|
||||
AV_CHAN_TOP_FRONT_LEFT = AVChannel(C.AV_CHAN_TOP_FRONT_LEFT)
|
||||
AV_CHAN_TOP_FRONT_CENTER = AVChannel(C.AV_CHAN_TOP_FRONT_CENTER)
|
||||
AV_CHAN_TOP_FRONT_RIGHT = AVChannel(C.AV_CHAN_TOP_FRONT_RIGHT)
|
||||
AV_CHAN_TOP_BACK_LEFT = AVChannel(C.AV_CHAN_TOP_BACK_LEFT)
|
||||
AV_CHAN_TOP_BACK_CENTER = AVChannel(C.AV_CHAN_TOP_BACK_CENTER)
|
||||
AV_CHAN_TOP_BACK_RIGHT = AVChannel(C.AV_CHAN_TOP_BACK_RIGHT)
|
||||
AV_CHAN_STEREO_LEFT = AVChannel(C.AV_CHAN_STEREO_LEFT)
|
||||
AV_CHAN_STEREO_RIGHT = AVChannel(C.AV_CHAN_STEREO_RIGHT)
|
||||
AV_CHAN_WIDE_LEFT = AVChannel(C.AV_CHAN_WIDE_LEFT)
|
||||
AV_CHAN_WIDE_RIGHT = AVChannel(C.AV_CHAN_WIDE_RIGHT)
|
||||
AV_CHAN_SURROUND_DIRECT_LEFT = AVChannel(C.AV_CHAN_SURROUND_DIRECT_LEFT)
|
||||
AV_CHAN_SURROUND_DIRECT_RIGHT = AVChannel(C.AV_CHAN_SURROUND_DIRECT_RIGHT)
|
||||
AV_CHAN_LOW_FREQUENCY_2 = AVChannel(C.AV_CHAN_LOW_FREQUENCY_2)
|
||||
AV_CHAN_TOP_SIDE_LEFT = AVChannel(C.AV_CHAN_TOP_SIDE_LEFT)
|
||||
AV_CHAN_TOP_SIDE_RIGHT = AVChannel(C.AV_CHAN_TOP_SIDE_RIGHT)
|
||||
AV_CHAN_BOTTOM_FRONT_CENTER = AVChannel(C.AV_CHAN_BOTTOM_FRONT_CENTER)
|
||||
AV_CHAN_BOTTOM_FRONT_LEFT = AVChannel(C.AV_CHAN_BOTTOM_FRONT_LEFT)
|
||||
AV_CHAN_BOTTOM_FRONT_RIGHT = AVChannel(C.AV_CHAN_BOTTOM_FRONT_RIGHT)
|
||||
AV_CHAN_UNUSED = AVChannel(C.AV_CHAN_UNUSED)
|
||||
AV_CHAN_UNKNOWN = AVChannel(C.AV_CHAN_UNKNOWN)
|
||||
AV_CHAN_AMBISONIC_BASE = AVChannel(C.AV_CHAN_AMBISONIC_BASE)
|
||||
AV_CHAN_AMBISONIC_END = AVChannel(C.AV_CHAN_AMBISONIC_END)
|
||||
)
|
||||
|
||||
// AVChannelOrder
|
||||
type AVChannelOrder = C.enum_AVChannelOrder
|
||||
|
||||
const (
|
||||
AV_CHANNEL_ORDER_UNSPEC = AVChannelOrder(C.AV_CHANNEL_ORDER_UNSPEC)
|
||||
AV_CHANNEL_ORDER_NATIVE = AVChannelOrder(C.AV_CHANNEL_ORDER_NATIVE)
|
||||
AV_CHANNEL_ORDER_CUSTOM = AVChannelOrder(C.AV_CHANNEL_ORDER_CUSTOM)
|
||||
AV_CHANNEL_ORDER_AMBISONIC = AVChannelOrder(C.AV_CHANNEL_ORDER_AMBISONIC)
|
||||
)
|
||||
|
||||
const (
|
||||
AV_CH_FRONT_LEFT = uint64(C.AV_CH_FRONT_LEFT)
|
||||
AV_CH_FRONT_RIGHT = uint64(C.AV_CH_FRONT_RIGHT)
|
||||
@@ -71,12 +184,15 @@ const (
|
||||
AV_CH_LAYOUT_7POINT1 = uint64(C.AV_CH_LAYOUT_7POINT1)
|
||||
AV_CH_LAYOUT_7POINT1_WIDE = uint64(C.AV_CH_LAYOUT_7POINT1_WIDE)
|
||||
AV_CH_LAYOUT_7POINT1_WIDE_BACK = uint64(C.AV_CH_LAYOUT_7POINT1_WIDE_BACK)
|
||||
AV_CH_LAYOUT_7POINT1_TOP_BACK = uint64(C.AV_CH_LAYOUT_7POINT1_TOP_BACK)
|
||||
AV_CH_LAYOUT_OCTAGONAL = uint64(C.AV_CH_LAYOUT_OCTAGONAL)
|
||||
AV_CH_LAYOUT_CUBE = uint64(C.AV_CH_LAYOUT_CUBE)
|
||||
AV_CH_LAYOUT_HEXADECAGONAL = uint64(C.AV_CH_LAYOUT_HEXADECAGONAL)
|
||||
AV_CH_LAYOUT_STEREO_DOWNMIX = uint64(C.AV_CH_LAYOUT_STEREO_DOWNMIX)
|
||||
AV_CH_LAYOUT_22POINT2 = uint64(C.AV_CH_LAYOUT_22POINT2)
|
||||
)
|
||||
|
||||
// AVMatrixEncoding
|
||||
type AVMatrixEncoding = C.enum_AVMatrixEncoding
|
||||
|
||||
const (
|
||||
@@ -90,6 +206,224 @@ const (
|
||||
AV_MATRIX_ENCODING_NB = AVMatrixEncoding(C.AV_MATRIX_ENCODING_NB)
|
||||
)
|
||||
|
||||
// AVChannelCustom
|
||||
type AVChannelCustom C.struct_AVChannelCustom
|
||||
|
||||
// GetId gets `AVChannelCustom.id` value.
|
||||
func (cc *AVChannelCustom) GetId() AVChannel {
|
||||
return (AVChannel)(cc.id)
|
||||
}
|
||||
|
||||
// SetId sets `AVChannelCustom.id` value.
|
||||
func (cc *AVChannelCustom) SetId(v AVChannel) {
|
||||
cc.id = (C.enum_AVChannel)(v)
|
||||
}
|
||||
|
||||
// GetIdAddr gets `AVChannelCustom.id` address.
|
||||
func (cc *AVChannelCustom) GetIdAddr() *AVChannel {
|
||||
return (*AVChannel)(&cc.id)
|
||||
}
|
||||
|
||||
// GetName gets `AVChannelCustom.name` value.
|
||||
func (cc *AVChannelCustom) GetName() string {
|
||||
return C.GoString(&cc.name[0])
|
||||
}
|
||||
|
||||
// GetOpaque gets `AVChannelCustom.opaque` value.
|
||||
func (cc *AVChannelCustom) GetOpaque() unsafe.Pointer {
|
||||
return cc.opaque
|
||||
}
|
||||
|
||||
// SetOpaque sets `AVChannelCustom.opaque` value.
|
||||
func (cc *AVChannelCustom) SetOpaque(v CVoidPointer) {
|
||||
cc.opaque = VoidPointer(v)
|
||||
}
|
||||
|
||||
// GetOpaqueAddr gets `AVChannelCustom.opaque` address.
|
||||
func (cc *AVChannelCustom) GetOpaqueAddr() *unsafe.Pointer {
|
||||
return &cc.opaque
|
||||
}
|
||||
|
||||
// AVChannelLayout
|
||||
type AVChannelLayout C.struct_AVChannelLayout
|
||||
|
||||
// GetOrder gets `AVChannelLayout.order` value.
|
||||
func (cl *AVChannelLayout) GetOrder() AVChannelOrder {
|
||||
return (AVChannelOrder)(cl.order)
|
||||
}
|
||||
|
||||
// SetOrder sets `AVChannelLayout.order` value.
|
||||
func (cl *AVChannelLayout) SetOrder(v AVChannelOrder) {
|
||||
cl.order = (C.enum_AVChannelOrder)(v)
|
||||
}
|
||||
|
||||
// GetOrderAddr gets `AVChannelLayout.order` address.
|
||||
func (cl *AVChannelLayout) GetOrderAddr() *AVChannelOrder {
|
||||
return (*AVChannelOrder)(&cl.order)
|
||||
}
|
||||
|
||||
// GetNbChannels gets `AVChannelLayout.nb_channels` value.
|
||||
func (cl *AVChannelLayout) GetNbChannels() int32 {
|
||||
return (int32)(cl.nb_channels)
|
||||
}
|
||||
|
||||
// SetNbChannels sets `AVChannelLayout.nb_channels` value.
|
||||
func (cl *AVChannelLayout) SetNbChannels(v int32) {
|
||||
cl.nb_channels = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetNbChannelsAddr gets `AVChannelLayout.nb_channels` address.
|
||||
func (cl *AVChannelLayout) GetNbChannelsAddr() *int32 {
|
||||
return (*int32)(&cl.nb_channels)
|
||||
}
|
||||
|
||||
// GetUMask gets `AVChannelLayout.u.mask` value.
|
||||
func (cl *AVChannelLayout) GetUMask() uint64 {
|
||||
return (uint64)(C.get_av_channel_layout_u_mask((*C.struct_AVChannelLayout)(cl)))
|
||||
}
|
||||
|
||||
// SetUMask sets `AVChannelLayout.u.mask` value.
|
||||
func (cl *AVChannelLayout) SetUMask(v uint64) {
|
||||
C.set_av_channel_layout_u_mask((*C.struct_AVChannelLayout)(cl), (C.uint64_t)(v))
|
||||
}
|
||||
|
||||
// GetUMaskAddr gets `AVChannelLayout.u.mask` address.
|
||||
func (cl *AVChannelLayout) GetUMaskAddr() *uint64 {
|
||||
return (*uint64)(C.get_av_channel_layout_u_mask_addr((*C.struct_AVChannelLayout)(cl)))
|
||||
}
|
||||
|
||||
// GetUMap gets `AVChannelLayout.u.map` value.
|
||||
func (cl *AVChannelLayout) GetUMap() *AVChannelCustom {
|
||||
|
||||
return (*AVChannelCustom)(C.get_av_channel_layout_u_map((*C.struct_AVChannelLayout)(cl)))
|
||||
}
|
||||
|
||||
// SetUMap sets `AVChannelLayout.u.map` value.
|
||||
func (cl *AVChannelLayout) SetUMap(v *AVChannelCustom) {
|
||||
C.set_av_channel_layout_u_map((*C.struct_AVChannelLayout)(cl), (*C.struct_AVChannelCustom)(v))
|
||||
|
||||
}
|
||||
|
||||
// GetUMapAddr gets `AVChannelLayout.u.map` address.
|
||||
func (cl *AVChannelLayout) GetUMapAddr() **AVChannelCustom {
|
||||
return (**AVChannelCustom)(
|
||||
unsafe.Pointer(C.get_av_channel_layout_u_map_addr((*C.struct_AVChannelLayout)(cl))))
|
||||
}
|
||||
|
||||
// GetOpaque gets `AVChannelLayout.opaque` value.
|
||||
func (cl *AVChannelLayout) GetOpaque() CVoidPointer {
|
||||
return VoidPointer(cl.opaque)
|
||||
}
|
||||
|
||||
// SetOpaque sets `AVChannelLayout.opaque` value.
|
||||
func (cl *AVChannelLayout) SetOpaque(v unsafe.Pointer) {
|
||||
cl.opaque = v
|
||||
}
|
||||
|
||||
// GetOpaqueAddr gets `AVChannelLayout.opaque` address.
|
||||
func (cl *AVChannelLayout) GetOpaqueAddr() *unsafe.Pointer {
|
||||
return &cl.opaque
|
||||
}
|
||||
|
||||
func AV_CHANNEL_LAYOUT_MONO() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_mono)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_STEREO() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_stereo)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_2POINT1() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_2point1)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_2_1() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_2_1)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_SURROUND() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_surround)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_3POINT1() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_3point1)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_4POINT0() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_4point0)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_4POINT1() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_4point1)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_2_2() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_2_2)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_QUAD() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_quad)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_5POINT0() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_5point0)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_5POINT1() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_5point1)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_5POINT0_BACK() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_5point0_back)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_5POINT1_BACK() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_5point1_back)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_6POINT0() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_6point0)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_6POINT0_FRONT() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_6point0_front)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_HEXAGONAL() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_hexagonal)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_6POINT1() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_6point1)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_6POINT1_BACK() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_6point1_back)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_6POINT1_FRONT() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_6point1_front)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_7POINT0() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_7point0)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_7POINT0_FRONT() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_7point0_front)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_7POINT1() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_7point1)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_7POINT1_WIDE() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_7point1_wide)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_7point1_wide_back)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_7point1_top_back)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_OCTAGONAL() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_octagonal)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_CUBE() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_cube)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_HEXADECAGONAL() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_hexadecagonal)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_STEREO_DOWNMIX() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_stereo_downmix)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_22POINT2() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_22point2)
|
||||
}
|
||||
func AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&C.av_channel_layout_ambisonic_first_order)
|
||||
}
|
||||
|
||||
// Deprecated: Use AvChannelLayoutFromString() instead.
|
||||
//
|
||||
// AvGetChannelLayout returns a channel layout id that matches name, or 0 if no match is found.
|
||||
func AvGetChannelLayout(name string) uint64 {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
@@ -97,6 +431,8 @@ func AvGetChannelLayout(name string) uint64 {
|
||||
return (uint64)(C.av_get_channel_layout((*C.char)(namePtr)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvChannelLayoutFromString() instead.
|
||||
//
|
||||
// AvGetExtendedChannelLayout returns a channel layout and the number of channels based on the specified name.
|
||||
func AvGetExtendedChannelLayout(name string, channelLayout *uint64, nbChannels *int32) int32 {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
@@ -105,8 +441,8 @@ func AvGetExtendedChannelLayout(name string, channelLayout *uint64, nbChannels *
|
||||
(*C.uint64_t)(channelLayout), (*C.int32_t)(nbChannels)))
|
||||
}
|
||||
|
||||
const AV_CH_LAYOUT_MAX_STRING_SIZE = 256
|
||||
|
||||
// Deprecated: Use AvChannelLayoutDescribe() instead.
|
||||
//
|
||||
// AvGetChannelLayoutString returns a description of a channel layout.
|
||||
func AvGetChannelLayoutString(nbChannels int32, channelLayout uint64) string {
|
||||
buf := make([]C.char, AV_CH_LAYOUT_MAX_STRING_SIZE)
|
||||
@@ -115,46 +451,202 @@ func AvGetChannelLayoutString(nbChannels int32, channelLayout uint64) string {
|
||||
return C.GoString((*C.char)(&buf[0]))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvChannelLayoutDescribe() instead.
|
||||
//
|
||||
// AvBPrintChannelLayout appends a description of a channel layout to a bprint buffer.
|
||||
func AvBPrintChannelLayout(bp *AVBPrint, nbChannels int32, channelLayout uint64) {
|
||||
C.av_bprint_channel_layout((*C.struct_AVBPrint)(bp),
|
||||
(C.int)(nbChannels), (C.uint64_t)(channelLayout))
|
||||
}
|
||||
|
||||
// Deprecated: Use AVChannelLayout.GetNbChannels() instead.
|
||||
//
|
||||
// AvGetChannelLayoutNbChannels returns the number of channels in the channel layout.
|
||||
func AvGetChannelLayoutNbChannels(channelLayout uint64) int32 {
|
||||
return (int32)(C.av_get_channel_layout_nb_channels((C.uint64_t)(channelLayout)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvChannelLayoutDefault() instead.
|
||||
//
|
||||
// AvGetDefaultChannelLayout returns default channel layout for a given number of channels.
|
||||
func AvGetDefaultChannelLayout(nbChannels int32) int64 {
|
||||
return (int64)(C.av_get_default_channel_layout((C.int)(nbChannels)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvChannelLayoutIndexFromChannel() instead.
|
||||
//
|
||||
// AvGetChannelLayoutChannelIndex gets the index of a channel in channel_layout.
|
||||
func AvGetChannelLayoutChannelIndex(channelLayout, channel uint64) int32 {
|
||||
return (int32)(C.av_get_channel_layout_channel_index((C.uint64_t)(channelLayout),
|
||||
(C.uint64_t)(channel)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvChannelLayoutChannelFromIndex() instead.
|
||||
//
|
||||
// AvChannelLayoutExtractChannel gets the channel with the given index in channel_layout.
|
||||
func AvChannelLayoutExtractChannel(channelLayout uint64, index int32) uint64 {
|
||||
return (uint64)(C.av_channel_layout_extract_channel((C.uint64_t)(channelLayout),
|
||||
(C.int)(index)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvChannelName() instead.
|
||||
//
|
||||
// AvGetChannelName gets the name of a given channel.
|
||||
func AvGetChannelName(channel uint64) string {
|
||||
return C.GoString(C.av_get_channel_name((C.uint64_t)(channel)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvChannelDescription() instead.
|
||||
//
|
||||
// AvGetChannelDescription gets the value and name of a standard channel layout.
|
||||
func AvGetChannelDescription(channel uint64) string {
|
||||
return C.GoString(C.av_get_channel_description((C.uint64_t)(channel)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvChannelLayoutStandard() instead.
|
||||
//
|
||||
// AvGetStandardChannelLayout Get the value and name of a standard channel layout.
|
||||
func AvGetStandardChannelLayout(index uint32, layout *uint64, name **int8) int32 {
|
||||
return (int32)(C.av_get_standard_channel_layout((C.uint)(index),
|
||||
(*C.uint64_t)(layout), (**C.char)(unsafe.Pointer(name))))
|
||||
}
|
||||
|
||||
// AvChannelName gets a human readable string in an abbreviated form describing a given channel.
|
||||
func AvChannelName(channel AVChannel) string {
|
||||
buf := make([]C.char, AV_CH_LAYOUT_MAX_STRING_SIZE)
|
||||
if ret := C.av_channel_name((*C.char)(&buf[0]), (C.size_t)(AV_CH_LAYOUT_MAX_STRING_SIZE),
|
||||
(C.enum_AVChannel)(channel)); ret < 0 {
|
||||
return ""
|
||||
}
|
||||
return C.GoString(&buf[0])
|
||||
}
|
||||
|
||||
// AvChannelNameBprint is bprint variant of AvChannelName().
|
||||
func AvChannelNameBprint(bp *AVBPrint, channelId AVChannel) {
|
||||
C.av_channel_name_bprint((*C.struct_AVBPrint)(bp), (C.enum_AVChannel)(channelId))
|
||||
}
|
||||
|
||||
// AvChannelDescription gets a human readable string describing a given channel.
|
||||
func AvChannelDescription(channel AVChannel) string {
|
||||
buf := make([]C.char, AV_CH_LAYOUT_MAX_STRING_SIZE)
|
||||
if ret := C.av_channel_description((*C.char)(&buf[0]), (C.size_t)(AV_CH_LAYOUT_MAX_STRING_SIZE),
|
||||
(C.enum_AVChannel)(channel)); ret < 0 {
|
||||
return ""
|
||||
}
|
||||
return C.GoString(&buf[0])
|
||||
}
|
||||
|
||||
// AvChannelDescriptionBprint is bprint variant of AvChannelDescription().
|
||||
func AvChannelDescriptionBprint(bp *AVBPrint, channelId AVChannel) {
|
||||
C.av_channel_description_bprint((*C.struct_AVBPrint)(bp), (C.enum_AVChannel)(channelId))
|
||||
}
|
||||
|
||||
// AvChannelFromString is the inverse function of AvChannelName().
|
||||
func AvChannelFromString(name string) AVChannel {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
defer nameFunc()
|
||||
return (AVChannel)(C.av_channel_from_string((*C.char)(namePtr)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutFromMask initializes a native channel layout from a bitmask indicating which channels
|
||||
// are present.
|
||||
func AvChannelLayoutFromMask(channelLayout *AVChannelLayout, mask uint64) int32 {
|
||||
return (int32)(C.av_channel_layout_from_mask((*C.struct_AVChannelLayout)(channelLayout),
|
||||
(C.uint64_t)(mask)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutFromString initializes a channel layout from a given string description.
|
||||
func AvChannelLayoutFromString(channelLayout *AVChannelLayout, str string) int32 {
|
||||
strPtr, strFunc := StringCasting(str)
|
||||
defer strFunc()
|
||||
return (int32)(C.av_channel_layout_from_string((*C.struct_AVChannelLayout)(channelLayout),
|
||||
(*C.char)(strPtr)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutDefault gets the default channel layout for a given number of channels.
|
||||
func AvChannelLayoutDefault(chLayout *AVChannelLayout, nbChannels int32) {
|
||||
C.av_channel_layout_default((*C.struct_AVChannelLayout)(chLayout),
|
||||
(C.int)(nbChannels))
|
||||
}
|
||||
|
||||
// AvChannelLayoutStandard iterates over all standard channel layouts.
|
||||
func AvChannelLayoutStandard(opaque CVoidPointerPointer) *AVChannelLayout {
|
||||
return (*AVChannelLayout)(C.av_channel_layout_standard(VoidPointerPointer(opaque)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutUninit frees any allocated data in the channel layout and reset the channel
|
||||
// count to 0.
|
||||
func AvChannelLayoutUninit(channelLayout *AVChannelLayout) {
|
||||
C.av_channel_layout_uninit((*C.struct_AVChannelLayout)(channelLayout))
|
||||
}
|
||||
|
||||
// AvChannelLayoutCopy makes a copy of a channel layout.
|
||||
func AvChannelLayoutCopy(dst, src *AVChannelLayout) int32 {
|
||||
return (int32)(C.av_channel_layout_copy((*C.struct_AVChannelLayout)(dst),
|
||||
(*C.struct_AVChannelLayout)(src)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutDescribe gets a human-readable string describing the channel layout properties.
|
||||
func AvChannelLayoutDescribe(channelLayout *AVChannelLayout) string {
|
||||
buf := make([]C.char, AV_CH_LAYOUT_MAX_STRING_SIZE)
|
||||
if ret := C.av_channel_layout_describe((*C.struct_AVChannelLayout)(channelLayout),
|
||||
(*C.char)(&buf[0]), (C.size_t)(AV_CH_LAYOUT_MAX_STRING_SIZE)); ret < 0 {
|
||||
return ""
|
||||
}
|
||||
return C.GoString(&buf[0])
|
||||
}
|
||||
|
||||
// AvChannelLayoutDescribeBprint is bprint variant of AvChannelLayoutDescribe().
|
||||
func AvChannelLayoutDescribeBprint(channelLayout *AVChannelLayout, bp *AVBPrint) int32 {
|
||||
return (int32)(C.av_channel_layout_describe_bprint(
|
||||
(*C.struct_AVChannelLayout)(channelLayout), (*C.struct_AVBPrint)(bp)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutChannelFromIndex gets the channel with the given index in a channel layout.
|
||||
func AvChannelLayoutChannelFromIndex(channelLayout *AVChannelLayout, idx uint32) AVChannel {
|
||||
return (AVChannel)(C.av_channel_layout_channel_from_index(
|
||||
(*C.struct_AVChannelLayout)(channelLayout), (C.uint)(idx)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutIndexFromChannel gets the index of a given channel in a channel layout.
|
||||
func AvChannelLayoutIndexFromChannel(channelLayout *AVChannelLayout, channel AVChannel) int32 {
|
||||
return (int32)(C.av_channel_layout_index_from_channel(
|
||||
(*C.struct_AVChannelLayout)(channelLayout), (C.enum_AVChannel)(channel)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutIndexFromString gets the index in a channel layout of a channel described by the given string.
|
||||
func AvChannelLayoutIndexFromString(channelLayout *AVChannelLayout, name string) int32 {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
defer nameFunc()
|
||||
return (int32)(C.av_channel_layout_index_from_string(
|
||||
(*C.struct_AVChannelLayout)(channelLayout), (*C.char)(namePtr)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutChannelFromString gets a channel described by the given string.
|
||||
func AvChannelLayoutChannelFromString(channelLayout *AVChannelLayout, name string) AVChannel {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
defer nameFunc()
|
||||
return (AVChannel)(C.av_channel_layout_channel_from_string(
|
||||
(*C.struct_AVChannelLayout)(channelLayout), (*C.char)(namePtr)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutSubset finds out what channels from a given set are present in a channel layout,
|
||||
// without regard for their positions.
|
||||
func AvChannelLayoutSubset(channelLayout *AVChannelLayout, mask uint64) uint64 {
|
||||
return (uint64)(C.av_channel_layout_subset(
|
||||
(*C.struct_AVChannelLayout)(channelLayout), (C.uint64_t)(mask)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutCheck checks whether a channel layout is valid, i.e. can possibly describe audio
|
||||
// data.
|
||||
func AvChannelLayoutCheck(channelLayout *AVChannelLayout) int32 {
|
||||
return (int32)(C.av_channel_layout_check(
|
||||
(*C.struct_AVChannelLayout)(channelLayout)))
|
||||
}
|
||||
|
||||
// AvChannelLayoutCompare check whether two channel layouts are semantically the same, i.e. the same
|
||||
// channels are present on the same positions in both.
|
||||
func AvChannelLayoutCompare(chl, chl1 *AVChannelLayout) int32 {
|
||||
return (int32)(C.av_channel_layout_compare((*C.struct_AVChannelLayout)(chl),
|
||||
(*C.struct_AVChannelLayout)(chl1)))
|
||||
}
|
||||
|
@@ -9,14 +9,6 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AV_NE
|
||||
func AV_NE[T any](be, le T) T {
|
||||
if C.AV_HAVE_BIGENDIAN > 0 {
|
||||
return be
|
||||
}
|
||||
return le
|
||||
}
|
||||
|
||||
// RSHIFT
|
||||
func RSHIFT[U, V Integer](a U, b V) U {
|
||||
if a > 0 {
|
||||
@@ -56,6 +48,7 @@ func FFUMOD[T Integer](a, b T) T {
|
||||
return a - b*FFUDIV(a, b)
|
||||
}
|
||||
|
||||
// FFABS
|
||||
func FFABS[T SingedInteger](a T) T {
|
||||
if a >= 0 {
|
||||
return a
|
||||
@@ -63,6 +56,7 @@ func FFABS[T SingedInteger](a T) T {
|
||||
return -a
|
||||
}
|
||||
|
||||
// FFSIGNT
|
||||
func FFSIGNT[T SingedInteger](a T) T {
|
||||
if a > 0 {
|
||||
return 1
|
||||
@@ -94,48 +88,6 @@ func FFABS64U[T SingedInteger](a T) uint64 {
|
||||
return (uint64)(a)
|
||||
}
|
||||
|
||||
// FFDIFFSIGN
|
||||
func FFDIFFSIGN[T Integer](x, y T) int {
|
||||
if x > y {
|
||||
return 1
|
||||
} else if x < y {
|
||||
return -1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
func FFMAX[T Integer](a, b T) T {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func FFMAX3[T Integer](a, b, c T) T {
|
||||
return FFMAX(FFMAX(a, b), c)
|
||||
}
|
||||
|
||||
func FFMIN[T Integer](a, b T) T {
|
||||
if a > b {
|
||||
return b
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
func FFMIN3[T Integer](a, b, c T) T {
|
||||
return FFMIN(FFMIN(a, b), c)
|
||||
}
|
||||
|
||||
// FFSWAP
|
||||
func FFSWAP[T any](a, b *T) {
|
||||
swapTmp := *b
|
||||
*b = *a
|
||||
*a = swapTmp
|
||||
}
|
||||
|
||||
// NONEED: FF_ARRAY_ELEMS
|
||||
|
||||
// AvLog2
|
||||
func AvLog2(v uint32) int32 {
|
||||
return (int32)(C.av_log2((C.uint)(v)))
|
||||
@@ -241,12 +193,12 @@ func AvCeilLog2C(x int32) int32 {
|
||||
return (int32)(C.av_ceil_log2_c((C.int)(x)))
|
||||
}
|
||||
|
||||
// AvPopcountC counts number of bits set to one in x
|
||||
// AvPopcountC counts number of bits set to one in x.
|
||||
func AvPopcountC(x uint32) int32 {
|
||||
return (int32)(C.av_popcount_c((C.uint)(x)))
|
||||
}
|
||||
|
||||
// AvPopcount64C counts number of bits set to one in x
|
||||
// AvPopcount64C counts number of bits set to one in x.
|
||||
func AvPopcount64C(x uint64) int32 {
|
||||
return (int32)(C.av_popcount64_c((C.uint64_t)(x)))
|
||||
}
|
||||
@@ -256,16 +208,6 @@ func AvParityC(x uint32) int32 {
|
||||
return (int32)(C.av_parity_c((C.uint32_t)(x)))
|
||||
}
|
||||
|
||||
// MKTAG
|
||||
func MKTAG(a, b, c, d uint32) uint32 {
|
||||
return (a) | ((b) << 8) | ((c) << 16) | ((uint32)(d) << 24)
|
||||
}
|
||||
|
||||
// MKBETAG
|
||||
func MKBETAG(a, b, c, d uint32) uint32 {
|
||||
return (d) | ((c) << 8) | ((b) << 16) | ((uint32)(a) << 24)
|
||||
}
|
||||
|
||||
// See https://pkg.go.dev/unicode/utf8
|
||||
|
||||
// NONEED: GET_UTF8
|
||||
|
@@ -23,22 +23,24 @@ const (
|
||||
AV_CPU_FLAG_SSE3 = C.AV_CPU_FLAG_SSE3
|
||||
AV_CPU_FLAG_SSE3SLOW = C.AV_CPU_FLAG_SSE3SLOW
|
||||
|
||||
AV_CPU_FLAG_SSSE3 = C.AV_CPU_FLAG_SSSE3
|
||||
AV_CPU_FLAG_SSSE3SLOW = C.AV_CPU_FLAG_SSSE3SLOW
|
||||
AV_CPU_FLAG_ATOM = C.AV_CPU_FLAG_ATOM
|
||||
AV_CPU_FLAG_SSE4 = C.AV_CPU_FLAG_SSE4
|
||||
AV_CPU_FLAG_SSE42 = C.AV_CPU_FLAG_SSE42
|
||||
AV_CPU_FLAG_AESNI = C.AV_CPU_FLAG_AESNI
|
||||
AV_CPU_FLAG_AVX = C.AV_CPU_FLAG_AVX
|
||||
AV_CPU_FLAG_AVXSLOW = C.AV_CPU_FLAG_AVXSLOW
|
||||
AV_CPU_FLAG_XOP = C.AV_CPU_FLAG_XOP
|
||||
AV_CPU_FLAG_FMA4 = C.AV_CPU_FLAG_FMA4
|
||||
AV_CPU_FLAG_CMOV = C.AV_CPU_FLAG_CMOV
|
||||
AV_CPU_FLAG_AVX2 = C.AV_CPU_FLAG_AVX2
|
||||
AV_CPU_FLAG_FMA3 = C.AV_CPU_FLAG_FMA3
|
||||
AV_CPU_FLAG_BMI1 = C.AV_CPU_FLAG_BMI1
|
||||
AV_CPU_FLAG_BMI2 = C.AV_CPU_FLAG_BMI2
|
||||
AV_CPU_FLAG_AVX512 = C.AV_CPU_FLAG_AVX512
|
||||
AV_CPU_FLAG_SSSE3 = C.AV_CPU_FLAG_SSSE3
|
||||
AV_CPU_FLAG_SSSE3SLOW = C.AV_CPU_FLAG_SSSE3SLOW
|
||||
AV_CPU_FLAG_ATOM = C.AV_CPU_FLAG_ATOM
|
||||
AV_CPU_FLAG_SSE4 = C.AV_CPU_FLAG_SSE4
|
||||
AV_CPU_FLAG_SSE42 = C.AV_CPU_FLAG_SSE42
|
||||
AV_CPU_FLAG_AESNI = C.AV_CPU_FLAG_AESNI
|
||||
AV_CPU_FLAG_AVX = C.AV_CPU_FLAG_AVX
|
||||
AV_CPU_FLAG_AVXSLOW = C.AV_CPU_FLAG_AVXSLOW
|
||||
AV_CPU_FLAG_XOP = C.AV_CPU_FLAG_XOP
|
||||
AV_CPU_FLAG_FMA4 = C.AV_CPU_FLAG_FMA4
|
||||
AV_CPU_FLAG_CMOV = C.AV_CPU_FLAG_CMOV
|
||||
AV_CPU_FLAG_AVX2 = C.AV_CPU_FLAG_AVX2
|
||||
AV_CPU_FLAG_FMA3 = C.AV_CPU_FLAG_FMA3
|
||||
AV_CPU_FLAG_BMI1 = C.AV_CPU_FLAG_BMI1
|
||||
AV_CPU_FLAG_BMI2 = C.AV_CPU_FLAG_BMI2
|
||||
AV_CPU_FLAG_AVX512 = C.AV_CPU_FLAG_AVX512
|
||||
AV_CPU_FLAG_AVX512ICL = C.AV_CPU_FLAG_AVX512ICL
|
||||
AV_CPU_FLAG_SLOW_GATHER = C.AV_CPU_FLAG_SLOW_GATHER
|
||||
|
||||
AV_CPU_FLAG_ALTIVEC = C.AV_CPU_FLAG_ALTIVEC
|
||||
AV_CPU_FLAG_VSX = C.AV_CPU_FLAG_VSX
|
||||
@@ -56,6 +58,17 @@ const (
|
||||
|
||||
AV_CPU_FLAG_MMI = C.AV_CPU_FLAG_MMI
|
||||
AV_CPU_FLAG_MSA = C.AV_CPU_FLAG_MSA
|
||||
|
||||
AV_CPU_FLAG_LSX = C.AV_CPU_FLAG_LSX
|
||||
AV_CPU_FLAG_LASX = C.AV_CPU_FLAG_LASX
|
||||
AV_CPU_FLAG_RVI = C.AV_CPU_FLAG_RVI
|
||||
AV_CPU_FLAG_RVF = C.AV_CPU_FLAG_RVF
|
||||
AV_CPU_FLAG_RVD = C.AV_CPU_FLAG_RVD
|
||||
AV_CPU_FLAG_RVV_I32 = C.AV_CPU_FLAG_RVV_I32
|
||||
AV_CPU_FLAG_RVV_F32 = C.AV_CPU_FLAG_RVV_F32
|
||||
AV_CPU_FLAG_RVV_I64 = C.AV_CPU_FLAG_RVV_I64
|
||||
AV_CPU_FLAG_RVV_F64 = C.AV_CPU_FLAG_RVV_F64
|
||||
AV_CPU_FLAG_RVB_BASIC = C.AV_CPU_FLAG_RVB_BASIC
|
||||
)
|
||||
|
||||
// AvGetCpuFlags returns the flags which specify extensions supported by the CPU.
|
||||
@@ -68,22 +81,6 @@ func AvForceCpuFlags(flags int32) {
|
||||
C.av_force_cpu_flags((C.int)(flags))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvForceCpuFlags() and AvGetCpuFlags() instead
|
||||
//
|
||||
// AvSetCpuFlagsMask set a mask on flags returned by AvGetCpuFlags().
|
||||
func AvSetCpuFlagsMask(mask int32) {
|
||||
C.av_set_cpu_flags_mask((C.int)(mask))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvParseCpuCaps() when possible.
|
||||
//
|
||||
// AvParseCpuFlags parses CPU flags from a string.
|
||||
func AvParseCpuFlags(str string) int32 {
|
||||
strPtr, strFunc := StringCasting(str)
|
||||
defer strFunc()
|
||||
return (int32)(C.av_parse_cpu_flags((*C.char)(strPtr)))
|
||||
}
|
||||
|
||||
// AvParseCpuCaps parses CPU caps from a string and update the given AV_CPU_* flags based on that.
|
||||
func AvParseCpuCaps(flags *uint32, str string) int32 {
|
||||
strPtr, strFunc := StringCasting(str)
|
||||
@@ -96,6 +93,11 @@ func AvCpuCount() int32 {
|
||||
return (int32)(C.av_cpu_count())
|
||||
}
|
||||
|
||||
// AvCpuForceCount overrides cpu count detection and forces the specified count.
|
||||
func AvCpuForceCount(count int32) {
|
||||
C.av_cpu_force_count((C.int)(count))
|
||||
}
|
||||
|
||||
// AvCpuMaxAlign gets the maximum data alignment that may be required by FFmpeg.
|
||||
func AvCpuMaxAlign() int32 {
|
||||
return (int32)(C.av_cpu_max_align())
|
||||
|
208
avutil_csp.go
Normal file
208
avutil_csp.go
Normal file
@@ -0,0 +1,208 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavutil/csp.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVLumaCoefficients
|
||||
type AVLumaCoefficients C.struct_AVLumaCoefficients
|
||||
|
||||
// GetCr gets `AVLumaCoefficients.cr` value.
|
||||
func (lc *AVLumaCoefficients) GetCr() AVRational {
|
||||
return (AVRational)(lc.cr)
|
||||
}
|
||||
|
||||
// SetCr sets `AVLumaCoefficients.cr` value.
|
||||
func (lc *AVLumaCoefficients) SetCr(v AVRational) {
|
||||
lc.cr = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetCrAddr gets `AVLumaCoefficients.cr` address.
|
||||
func (lc *AVLumaCoefficients) GetCrAddr() *AVRational {
|
||||
return (*AVRational)(&lc.cr)
|
||||
}
|
||||
|
||||
// GetCg gets `AVLumaCoefficients.cg` value.
|
||||
func (lc *AVLumaCoefficients) GetCg() AVRational {
|
||||
return (AVRational)(lc.cg)
|
||||
}
|
||||
|
||||
// SetCg sets `AVLumaCoefficients.cg` value.
|
||||
func (lc *AVLumaCoefficients) SetCg(v AVRational) {
|
||||
lc.cg = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetCgAddr gets `AVLumaCoefficients.cg` address.
|
||||
func (lc *AVLumaCoefficients) GetCgAddr() *AVRational {
|
||||
return (*AVRational)(&lc.cg)
|
||||
}
|
||||
|
||||
// GetCb gets `AVLumaCoefficients.cb` value.
|
||||
func (lc *AVLumaCoefficients) GetCb() AVRational {
|
||||
return (AVRational)(lc.cb)
|
||||
}
|
||||
|
||||
// SetCb sets `AVLumaCoefficients.cb` value.
|
||||
func (lc *AVLumaCoefficients) SetCb(v AVRational) {
|
||||
lc.cb = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetCbAddr gets `AVLumaCoefficients.cb` address.
|
||||
func (lc *AVLumaCoefficients) GetCbAddr() *AVRational {
|
||||
return (*AVRational)(&lc.cb)
|
||||
}
|
||||
|
||||
// AVCIExy
|
||||
type AVCIExy C.struct_AVCIExy
|
||||
|
||||
// GetX gets `AVCIExy.x` value.
|
||||
func (cxy *AVCIExy) GetX() AVRational {
|
||||
return (AVRational)(cxy.x)
|
||||
}
|
||||
|
||||
// SetX sets `AVCIExy.x` value.
|
||||
func (cxy *AVCIExy) SetX(v AVRational) {
|
||||
cxy.x = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetXAddr gets `AVCIExy.x` address.
|
||||
func (cxy *AVCIExy) GetXAddr() *AVRational {
|
||||
return (*AVRational)(&cxy.x)
|
||||
}
|
||||
|
||||
// GetY gets `AVCIExy.y` value.
|
||||
func (cxy *AVCIExy) GetY() AVRational {
|
||||
return (AVRational)(cxy.y)
|
||||
}
|
||||
|
||||
// SetY sets `AVCIExy.y` value.
|
||||
func (cxy *AVCIExy) SetY(v AVRational) {
|
||||
cxy.y = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetYAddr gets `AVCIExy.y` address.
|
||||
func (cxy *AVCIExy) GetYAddr() *AVRational {
|
||||
return (*AVRational)(&cxy.y)
|
||||
}
|
||||
|
||||
// AVPrimaryCoefficients
|
||||
type AVPrimaryCoefficients C.struct_AVPrimaryCoefficients
|
||||
|
||||
// GetR gets `AVPrimaryCoefficients.r` value.
|
||||
func (pc *AVPrimaryCoefficients) GetR() AVCIExy {
|
||||
return (AVCIExy)(pc.r)
|
||||
}
|
||||
|
||||
// SetR sets `AVPrimaryCoefficients.r` value.
|
||||
func (pc *AVPrimaryCoefficients) SetR(v AVCIExy) {
|
||||
pc.r = (C.struct_AVCIExy)(v)
|
||||
}
|
||||
|
||||
// GetRAddr gets `AVPrimaryCoefficients.r` address.
|
||||
func (pc *AVPrimaryCoefficients) GetRAddr() *AVCIExy {
|
||||
return (*AVCIExy)(&pc.r)
|
||||
}
|
||||
|
||||
// GetG gets `AVPrimaryCoefficients.g` value.
|
||||
func (pc *AVPrimaryCoefficients) GetG() AVCIExy {
|
||||
return (AVCIExy)(pc.g)
|
||||
}
|
||||
|
||||
// SetG sets `AVPrimaryCoefficients.g` value.
|
||||
func (pc *AVPrimaryCoefficients) SetG(v AVCIExy) {
|
||||
pc.g = (C.struct_AVCIExy)(v)
|
||||
}
|
||||
|
||||
// GetGAddr gets `AVPrimaryCoefficients.g` address.
|
||||
func (pc *AVPrimaryCoefficients) GetGAddr() *AVCIExy {
|
||||
return (*AVCIExy)(&pc.g)
|
||||
}
|
||||
|
||||
// GetB gets `AVPrimaryCoefficients.b` value.
|
||||
func (pc *AVPrimaryCoefficients) GetB() AVCIExy {
|
||||
return (AVCIExy)(pc.b)
|
||||
}
|
||||
|
||||
// SetB sets `AVPrimaryCoefficients.b` value.
|
||||
func (pc *AVPrimaryCoefficients) SetB(v AVCIExy) {
|
||||
pc.b = (C.struct_AVCIExy)(v)
|
||||
}
|
||||
|
||||
// GetBAddr gets `AVPrimaryCoefficients.b` address.
|
||||
func (pc *AVPrimaryCoefficients) GetBAddr() *AVCIExy {
|
||||
return (*AVCIExy)(&pc.b)
|
||||
}
|
||||
|
||||
// AVWhitepointCoefficients
|
||||
type AVWhitepointCoefficients = AVCIExy
|
||||
|
||||
// AVColorPrimariesDesc
|
||||
type AVColorPrimariesDesc C.struct_AVColorPrimariesDesc
|
||||
|
||||
// GetWp gets `AVColorPrimariesDesc.wp` value.
|
||||
func (cpd *AVColorPrimariesDesc) GetWp() AVWhitepointCoefficients {
|
||||
return (AVWhitepointCoefficients)(cpd.wp)
|
||||
}
|
||||
|
||||
// SetWp sets `AVColorPrimariesDesc.wp` value.
|
||||
func (cpd *AVColorPrimariesDesc) SetWp(v AVWhitepointCoefficients) {
|
||||
cpd.wp = (C.AVWhitepointCoefficients)(v)
|
||||
}
|
||||
|
||||
// GetWpAddr gets `AVColorPrimariesDesc.wp` address.
|
||||
func (cpd *AVColorPrimariesDesc) GetWpAddr() *AVWhitepointCoefficients {
|
||||
return (*AVWhitepointCoefficients)(&cpd.wp)
|
||||
}
|
||||
|
||||
// GetPrim gets `AVColorPrimariesDesc.prim` value.
|
||||
func (cpd *AVColorPrimariesDesc) GetPrim() AVPrimaryCoefficients {
|
||||
return (AVPrimaryCoefficients)(cpd.prim)
|
||||
}
|
||||
|
||||
// SetPrim sets `AVColorPrimariesDesc.prim` value.
|
||||
func (cpd *AVColorPrimariesDesc) SetPrim(v AVPrimaryCoefficients) {
|
||||
cpd.prim = (C.struct_AVPrimaryCoefficients)(v)
|
||||
}
|
||||
|
||||
// typedef double (*av_csp_trc_function)(double);
|
||||
type AvCspTrcFunction = C.av_csp_trc_function
|
||||
|
||||
// GetPrimAddr gets `AVColorPrimariesDesc.prim` address.
|
||||
func (cpd *AVColorPrimariesDesc) GetPrimAddr() *AVPrimaryCoefficients {
|
||||
return (*AVPrimaryCoefficients)(&cpd.prim)
|
||||
}
|
||||
|
||||
// AvCspLumaCoeffsFromAvcsp retrieves the Luma coefficients necessary to construct a conversion matrix
|
||||
// from an enum constant describing the colorspace.
|
||||
func AvCspLumaCoeffsFromAvcsp(csp AVColorSpace) *AVLumaCoefficients {
|
||||
return (*AVLumaCoefficients)(C.av_csp_luma_coeffs_from_avcsp((C.enum_AVColorSpace)(csp)))
|
||||
}
|
||||
|
||||
// AvCspPrimariesDescFromId retrieves a complete gamut description from an enum constant describing the
|
||||
// color primaries.
|
||||
func AvCspPrimariesDescFromId(prm AVColorPrimaries) *AVColorPrimariesDesc {
|
||||
return (*AVColorPrimariesDesc)(C.av_csp_primaries_desc_from_id((C.enum_AVColorPrimaries)(prm)))
|
||||
}
|
||||
|
||||
// AvCspPrimariesIdFromDesc detects which enum AVColorPrimaries constant corresponds to the given complete
|
||||
// gamut description.
|
||||
func AvCspPrimariesIdFromDesc(prm *AVColorPrimariesDesc) AVColorPrimaries {
|
||||
return (AVColorPrimaries)(C.av_csp_primaries_id_from_desc((*C.struct_AVColorPrimariesDesc)(prm)))
|
||||
}
|
||||
|
||||
// AvCspApproximateTrcGamma determines a suitable 'gamma' value to match the supplied
|
||||
// AVColorTransferCharacteristic.
|
||||
func AvCspApproximateTrcGamma(trc AVColorTransferCharacteristic) float64 {
|
||||
return (float64)(C.av_csp_approximate_trc_gamma((C.enum_AVColorTransferCharacteristic)(trc)))
|
||||
}
|
||||
|
||||
// AvCspTrcFuncFromId determines the function needed to apply the given
|
||||
// AVColorTransferCharacteristic to linear input.
|
||||
func AvCspTrcFuncFromId(trc AVColorTransferCharacteristic) AvCspTrcFunction {
|
||||
return (AvCspTrcFunction)(C.av_csp_trc_func_from_id((C.enum_AVColorTransferCharacteristic)(trc)))
|
||||
}
|
@@ -20,6 +20,7 @@ const (
|
||||
AV_DICT_MULTIKEY = C.AV_DICT_MULTIKEY
|
||||
)
|
||||
|
||||
// AVDictionaryEntry
|
||||
type AVDictionaryEntry C.struct_AVDictionaryEntry
|
||||
|
||||
// GetKey gets `AVDictionaryEntry.key` value.
|
||||
@@ -43,6 +44,12 @@ func AvDictGet(m *AVDictionary, key string, prev *AVDictionaryEntry, flags int32
|
||||
(*C.char)(keyPtr), (*C.struct_AVDictionaryEntry)(prev), (C.int)(flags)))
|
||||
}
|
||||
|
||||
// AvDictIterate iterates over a dictionary.
|
||||
func AvDictIterate(m *AVDictionary, prev *AVDictionaryEntry) *AVDictionaryEntry {
|
||||
return (*AVDictionaryEntry)(C.av_dict_iterate((*C.struct_AVDictionary)(m),
|
||||
(*C.struct_AVDictionaryEntry)(prev)))
|
||||
}
|
||||
|
||||
// AvDictCount gets number of entries in dictionary.
|
||||
func AvDictCount(m *AVDictionary) int32 {
|
||||
return (int32)(C.av_dict_count((*C.struct_AVDictionary)(m)))
|
||||
|
@@ -20,10 +20,16 @@ func AvDisplayRotationGet(matrix []int32) float64 {
|
||||
// AvDisplayRotationSet initializes a transformation matrix describing a pure counterclockwise
|
||||
// rotation by the specified angle (in degrees).
|
||||
func AvDisplayRotationSet(matrix []int32, angle float64) {
|
||||
if len(matrix) < 9 {
|
||||
panic("matrix len < 9")
|
||||
}
|
||||
C.av_display_rotation_set((*C.int32_t)(&matrix[0]), (C.double)(angle))
|
||||
}
|
||||
|
||||
// AvDisplayMatrixFlip flips the input matrix horizontally and/or vertically.
|
||||
func AvDisplayMatrixFlip(matrix []int32, hflip, vflip int32) {
|
||||
if len(matrix) < 9 {
|
||||
panic("matrix len < 9")
|
||||
}
|
||||
C.av_display_matrix_flip((*C.int32_t)(&matrix[0]), (C.int)(hflip), (C.int)(vflip))
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ func AVUNERROR(e int32) int32 {
|
||||
return e
|
||||
}
|
||||
|
||||
// Error handling
|
||||
// Error handling.
|
||||
const (
|
||||
AVERROR_BSF_NOT_FOUND = int32(C.AVERROR_BSF_NOT_FOUND)
|
||||
AVERROR_BUG = int32(C.AVERROR_BUG)
|
||||
|
124
avutil_fifo.go
124
avutil_fifo.go
@@ -15,49 +15,159 @@ typedef int (*av_fifo_write_func)(void*, void*, int);
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
// AVFifo
|
||||
type AVFifo C.struct_AVFifo
|
||||
|
||||
// typedef int AVFifoCB(void *opaque, void *buf, size_t *nb_elems);
|
||||
type AVFifoCB = C.AVFifoCB
|
||||
|
||||
const (
|
||||
AV_FIFO_FLAG_AUTO_GROW = C.AV_FIFO_FLAG_AUTO_GROW
|
||||
)
|
||||
|
||||
// AvFifoAlloc2 allocates and initializes an AVFifo with a given element size.
|
||||
func AvFifoAlloc2[U, V Integer](elems U, elemSize V, flags uint32) *AVFifo {
|
||||
return (*AVFifo)(C.av_fifo_alloc2((C.size_t)(elems), (C.size_t)(elemSize), (C.uint)(flags)))
|
||||
}
|
||||
|
||||
// AvFifoElemSize returns Element size for FIFO operations.
|
||||
func AvFifoElemSize(f *AVFifo) uintptr {
|
||||
return (uintptr)(C.av_fifo_elem_size((*C.struct_AVFifo)(f)))
|
||||
}
|
||||
|
||||
// AvFifoAutoGrowLimit sets the maximum size (in elements) to which the FIFO can be resized
|
||||
// automatically.
|
||||
func AvFifoAutoGrowLimit[T Integer](f *AVFifo, maxElems T) {
|
||||
C.av_fifo_auto_grow_limit((*C.struct_AVFifo)(f), (C.size_t)(maxElems))
|
||||
}
|
||||
|
||||
// AvFifoCanRead returns number of elements available for reading from the given FIFO.
|
||||
func AvFifoCanRead(f *AVFifo) uintptr {
|
||||
return (uintptr)(C.av_fifo_can_read((*C.struct_AVFifo)(f)))
|
||||
}
|
||||
|
||||
// AvFifoCanWrite returns number of elements that can be written into the given FIFO.
|
||||
func AvFifoCanWrite(f *AVFifo) uintptr {
|
||||
return (uintptr)(C.av_fifo_can_write((*C.struct_AVFifo)(f)))
|
||||
}
|
||||
|
||||
// AvFifoGrow2 enlarges an AVFifo.
|
||||
func AvFifoGrow2[T Integer](f *AVFifo, inc T) int32 {
|
||||
return (int32)(C.av_fifo_grow2((*C.struct_AVFifo)(f), (C.size_t)(inc)))
|
||||
}
|
||||
|
||||
// AvFifoWrite writes data into a FIFO.
|
||||
func AvFifoWrite[T Integer](f *AVFifo, buf CVoidPointer, nbElems T) int32 {
|
||||
return (int32)(C.av_fifo_write((*C.struct_AVFifo)(f), VoidPointer(buf), (C.size_t)(nbElems)))
|
||||
}
|
||||
|
||||
// AvFifoWriteFromCb writes data from a user-provided callback into a FIFO.
|
||||
func AvFifoWriteFromCb(f *AVFifo, readCb *AVFifoCB, opaque CVoidPointer, nbElems *uintptr) int32 {
|
||||
return (int32)(C.av_fifo_write_from_cb((*C.struct_AVFifo)(f),
|
||||
(*C.AVFifoCB)(readCb), VoidPointer(opaque), (*C.size_t)(unsafe.Pointer(nbElems))))
|
||||
}
|
||||
|
||||
// AvFifoRead reads data from a FIFO.
|
||||
func AvFifoRead[T Integer](f *AVFifo, buf CVoidPointer, nbElems T) int32 {
|
||||
return (int32)(C.av_fifo_read((*C.struct_AVFifo)(f), VoidPointer(buf), (C.size_t)(nbElems)))
|
||||
}
|
||||
|
||||
// AvFifoReadToCb feeds data from a FIFO into a user-provided callback.
|
||||
func AvFifoReadToCb(f *AVFifo, writeCb *AVFifoCB, opaque CVoidPointer, nbElems *uintptr) int32 {
|
||||
return (int32)(C.av_fifo_read_to_cb((*C.struct_AVFifo)(f),
|
||||
(*C.AVFifoCB)(writeCb), VoidPointer(opaque), (*C.size_t)(unsafe.Pointer(nbElems))))
|
||||
}
|
||||
|
||||
// AvFifoPeek reads data from a FIFO without modifying FIFO state.
|
||||
func AvFifoPeek[U, V Integer](f *AVFifo, buf CVoidPointer, nbElems U, offset V) int32 {
|
||||
return (int32)(C.av_fifo_peek((*C.struct_AVFifo)(f), VoidPointer(buf),
|
||||
(C.size_t)(nbElems), (C.size_t)(offset)))
|
||||
}
|
||||
|
||||
// AvFifoPeekToCb feeds data from a FIFO into a user-provided callback.
|
||||
func AvFifoPeekToCb[T Integer](f *AVFifo, writeCb *AVFifoCB, opaque CVoidPointer,
|
||||
nbElems *uintptr, offset T) int32 {
|
||||
return (int32)(C.av_fifo_peek_to_cb((*C.struct_AVFifo)(f),
|
||||
(*C.AVFifoCB)(writeCb), VoidPointer(opaque),
|
||||
(*C.size_t)(unsafe.Pointer(nbElems)), (C.size_t)(offset)))
|
||||
}
|
||||
|
||||
// AvFifoDrain2 discards the specified amount of data from an AVFifo.
|
||||
func AvFifoDrain2[T Integer](f *AVFifo, size T) {
|
||||
C.av_fifo_drain2((*C.struct_AVFifo)(f), (C.size_t)(size))
|
||||
}
|
||||
|
||||
// AvFifoReset2 empties the AVFifo.
|
||||
func AvFifoReset2(f *AVFifo) {
|
||||
C.av_fifo_reset2((*C.struct_AVFifo)(f))
|
||||
}
|
||||
|
||||
// AvFifoFreep2 frees an AVFifo and reset pointer to NULL.
|
||||
func AvFifoFreep2(f **AVFifo) {
|
||||
C.av_fifo_freep2((**C.struct_AVFifo)(unsafe.Pointer(f)))
|
||||
}
|
||||
|
||||
// AVFifoBuffer
|
||||
type AVFifoBuffer C.struct_AVFifoBuffer
|
||||
|
||||
// Deprecated: Use AvFifoAlloc2() instread.
|
||||
//
|
||||
// AvFifoAlloc initializes an AVFifoBuffer.
|
||||
func AvFifoAlloc[T Integer](size T) *AVFifoBuffer {
|
||||
return (*AVFifoBuffer)(C.av_fifo_alloc((C.uint)(size)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvFifoAlloc2() instread.
|
||||
//
|
||||
// AvFifoAllocArray initializes an AVFifoBuffer.
|
||||
func AvFifoAllocArray[U, V Integer](nmemb U, size V) *AVFifoBuffer {
|
||||
return (*AVFifoBuffer)(C.av_fifo_alloc_array((C.size_t)(nmemb), (C.size_t)(size)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvFifoFreep2() instread.
|
||||
//
|
||||
// AvFifoFree frees an AVFifoBuffer.
|
||||
func AvFifoFree(f *AVFifoBuffer) {
|
||||
C.av_fifo_free((*C.struct_AVFifoBuffer)(f))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvFifoFreep2() instread.
|
||||
//
|
||||
// AvFifoFreep frees an AVFifoBuffer and reset pointer to NULL.
|
||||
func AvFifoFreep(f **AVFifoBuffer) {
|
||||
C.av_fifo_freep((**C.struct_AVFifoBuffer)(unsafe.Pointer(f)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvFifoReset2() instread.
|
||||
//
|
||||
// AvFifoReset resets the AVFifoBuffer to the state right after AvFifoAlloc, in particular it is emptied.
|
||||
func AvFifoReset(f *AVFifoBuffer) {
|
||||
C.av_fifo_reset((*C.struct_AVFifoBuffer)(f))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvFifoCanRead() instread.
|
||||
//
|
||||
// AvFifoSize returns the amount of data in bytes in the AVFifoBuffer, that is the
|
||||
// amount of data you can read from it.
|
||||
func AvFifoSize(f *AVFifoBuffer) int32 {
|
||||
return (int32)(C.av_fifo_size((*C.struct_AVFifoBuffer)(f)))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvFifoCanWrite() instread.
|
||||
//
|
||||
// AvFifoSpace returns the amount of space in bytes in the AVFifoBuffer, that is the
|
||||
// amount of data you can write into it.
|
||||
func AvFifoSpace(f *AVFifoBuffer) int32 {
|
||||
return (int32)(C.av_fifo_space((*C.struct_AVFifoBuffer)(f)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// typedef void (*av_fifo_peek_func)(void*, void*, int);
|
||||
type AvFifoPeekFunc = C.av_fifo_peek_func
|
||||
|
||||
// Deprecated: Use the new AVFifo-API with AvFifoPeek() or AvFifoPeekToCb() instread.
|
||||
//
|
||||
// AvFifoGenericPeekAt feeds data at specific position from an AVFifoBuffer to a user-supplied callback.
|
||||
func AvFifoGenericPeekAt(f *AVFifoBuffer, dest CVoidPointer,
|
||||
offset, bufSize int32, fn AvFifoPeekFunc) int32 {
|
||||
@@ -65,6 +175,8 @@ func AvFifoGenericPeekAt(f *AVFifoBuffer, dest CVoidPointer,
|
||||
VoidPointer(dest), (C.int)(offset), (C.int)(bufSize), (C.av_fifo_peek_func)(fn)))
|
||||
}
|
||||
|
||||
// Deprecated: Use the new AVFifo-API with AvFifoPeek() or AvFifoPeekToCb() instread.
|
||||
//
|
||||
// AvFifoGenericPeek feeds data from an AVFifoBuffer to a user-supplied callback.
|
||||
func AvFifoGenericPeek(f *AVFifoBuffer, dest CVoidPointer,
|
||||
bufSize int32, fn AvFifoPeekFunc) int32 {
|
||||
@@ -75,6 +187,8 @@ func AvFifoGenericPeek(f *AVFifoBuffer, dest CVoidPointer,
|
||||
// typedef void (*av_fifo_read_func)(void*, void*, int);
|
||||
type AvFifoReadFunc = C.av_fifo_read_func
|
||||
|
||||
// Deprecated: Use the new AVFifo-API with AvFifoRead() or AvFifoReadToCb() instread.
|
||||
//
|
||||
// AvFifoGenericRead feeds data from an AVFifoBuffer to a user-supplied callback.
|
||||
func AvFifoGenericRead(f *AVFifoBuffer, dest CVoidPointer,
|
||||
bufSize int32, fn AvFifoReadFunc) int32 {
|
||||
@@ -85,6 +199,8 @@ func AvFifoGenericRead(f *AVFifoBuffer, dest CVoidPointer,
|
||||
// typedef int (*av_fifo_write_func)(void*, void*, int);
|
||||
type AvFifoWriteFunc = C.av_fifo_write_func
|
||||
|
||||
// Deprecated: Use the new AVFifo-API with AvFifoWrite() or AvFifoWriteFromCb() instread.
|
||||
//
|
||||
// AvFifoGenericWrite feeds data from a user-supplied callback to an AVFifoBuffer.
|
||||
func AvFifoGenericWrite(f *AVFifoBuffer, src CVoidPointer,
|
||||
size int32, fn AvFifoWriteFunc) int32 {
|
||||
@@ -92,21 +208,29 @@ func AvFifoGenericWrite(f *AVFifoBuffer, src CVoidPointer,
|
||||
VoidPointer(src), (C.int)(size), (C.av_fifo_write_func)(fn)))
|
||||
}
|
||||
|
||||
// Deprecated: Use the new AVFifo-API with AvFifoGrow2() instread.
|
||||
//
|
||||
// AvFifoRealloc2 resizes an AVFifoBuffer.
|
||||
func AvFifoRealloc2[T Integer](f *AVFifoBuffer, size T) int32 {
|
||||
return (int32)(C.av_fifo_realloc2((*C.struct_AVFifoBuffer)(f), (C.uint)(size)))
|
||||
}
|
||||
|
||||
// Deprecated: Use the new AVFifo-API with av_fifo_grow2() instread.
|
||||
//
|
||||
// AvFifoGrow enlarges an AVFifoBuffer.
|
||||
func AvFifoGrow[T Integer](f *AVFifoBuffer, additionalSpace T) int32 {
|
||||
return (int32)(C.av_fifo_grow((*C.struct_AVFifoBuffer)(f), (C.uint)(additionalSpace)))
|
||||
}
|
||||
|
||||
// Deprecated: Use the new AVFifo-API with AvFifoDrain2() instread.
|
||||
//
|
||||
// AvFifoDrain reads and discards the specified amount of data from an AVFifoBuffer.
|
||||
func AvFifoDrain[T Integer](f *AVFifoBuffer, size T) {
|
||||
C.av_fifo_drain((*C.struct_AVFifoBuffer)(f), (C.int)(size))
|
||||
}
|
||||
|
||||
// Deprecated: Use the new AVFifo-API with AvFifoPeek() or AvFifoPeekToCb() instread.
|
||||
//
|
||||
// AvFifoPeek2 returns a pointer to the data stored in a FIFO buffer at a certain offset.
|
||||
// The FIFO buffer is not modified.
|
||||
func AvFifoPeek2[T Integer](f *AVFifoBuffer, offs T) *uint8 {
|
||||
|
@@ -24,12 +24,14 @@ func AvFileUnmap(bufptr *uint8, size uintptr) {
|
||||
C.av_file_unmap((*C.uint8_t)(bufptr), (C.size_t)(size))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvTempfile tries to create file in /tmp first, if possible.
|
||||
func AvTempfile(prefix string, logOffset int32, logCtx CVoidPointer) (filename string, ret int32) {
|
||||
prefixPtr, prefixFunc := StringCasting(prefix)
|
||||
defer prefixFunc()
|
||||
var filenamePtr *C.char
|
||||
defer C.free(unsafe.Pointer(filenamePtr))
|
||||
defer FreePointer(filenamePtr)
|
||||
ret = (int32)(C.av_tempfile((*C.char)(prefixPtr),
|
||||
(**C.char)(unsafe.Pointer(&filenamePtr)),
|
||||
(C.int)(logOffset),
|
||||
|
@@ -28,6 +28,7 @@ type AVFilmGrainParamsType = C.enum_AVFilmGrainParamsType
|
||||
const (
|
||||
AV_FILM_GRAIN_PARAMS_NONE = AVFilmGrainParamsType(C.AV_FILM_GRAIN_PARAMS_NONE)
|
||||
AV_FILM_GRAIN_PARAMS_AV1 = AVFilmGrainParamsType(C.AV_FILM_GRAIN_PARAMS_AV1)
|
||||
AV_FILM_GRAIN_PARAMS_H274 = AVFilmGrainParamsType(C.AV_FILM_GRAIN_PARAMS_H274)
|
||||
)
|
||||
|
||||
// AVFilmGrainAOMParams
|
||||
@@ -310,6 +311,267 @@ func (aomp *AVFilmGrainAOMParams) GetLimitOutputRangeAddr() *int32 {
|
||||
return (*int32)(&aomp.limit_output_range)
|
||||
}
|
||||
|
||||
// AVFilmGrainH274Params
|
||||
type AVFilmGrainH274Params C.struct_AVFilmGrainH274Params
|
||||
|
||||
// GetModelId gets `AVFilmGrainH274Params.model_id` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetModelId() int32 {
|
||||
return (int32)(h274p.model_id)
|
||||
}
|
||||
|
||||
// SetModelId sets `AVFilmGrainH274Params.model_id` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetModelId(v int32) {
|
||||
h274p.model_id = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetModelIdAddr gets `AVFilmGrainH274Params.model_id` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetModelIdAddr() *int32 {
|
||||
return (*int32)(&h274p.model_id)
|
||||
}
|
||||
|
||||
// GetBitDepthLuma gets `AVFilmGrainH274Params.bit_depth_luma` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetBitDepthLuma() int32 {
|
||||
return (int32)(h274p.bit_depth_luma)
|
||||
}
|
||||
|
||||
// SetBitDepthLuma sets `AVFilmGrainH274Params.bit_depth_luma` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetBitDepthLuma(v int32) {
|
||||
h274p.bit_depth_luma = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetBitDepthLumaAddr gets `AVFilmGrainH274Params.bit_depth_luma` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetBitDepthLumaAddr() *int32 {
|
||||
return (*int32)(&h274p.bit_depth_luma)
|
||||
}
|
||||
|
||||
// GetBitDepthChroma gets `AVFilmGrainH274Params.bit_depth_chroma` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetBitDepthChroma() int32 {
|
||||
return (int32)(h274p.bit_depth_chroma)
|
||||
}
|
||||
|
||||
// SetBitDepthChroma sets `AVFilmGrainH274Params.bit_depth_chroma` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetBitDepthChroma(v int32) {
|
||||
h274p.bit_depth_chroma = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetBitDepthChromaAddr gets `AVFilmGrainH274Params.bit_depth_chroma` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetBitDepthChromaAddr() *int32 {
|
||||
return (*int32)(&h274p.bit_depth_chroma)
|
||||
}
|
||||
|
||||
// GetColorRange gets `AVFilmGrainH274Params.color_range` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetColorRange() AVColorRange {
|
||||
return (AVColorRange)(h274p.color_range)
|
||||
}
|
||||
|
||||
// SetColorRange sets `AVFilmGrainH274Params.color_range` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetColorRange(v AVColorRange) {
|
||||
h274p.color_range = (C.enum_AVColorRange)(v)
|
||||
}
|
||||
|
||||
// GetColorRangeAddr gets `AVFilmGrainH274Params.color_range` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetColorRangeAddr() *AVColorRange {
|
||||
return (*AVColorRange)(&h274p.color_range)
|
||||
}
|
||||
|
||||
// GetColorPrimaries gets `AVFilmGrainH274Params.color_primaries` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetColorPrimaries() AVColorPrimaries {
|
||||
return (AVColorPrimaries)(h274p.color_primaries)
|
||||
}
|
||||
|
||||
// SetColorPrimaries sets `AVFilmGrainH274Params.color_primaries` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetColorPrimaries(v AVColorPrimaries) {
|
||||
h274p.color_primaries = (C.enum_AVColorPrimaries)(v)
|
||||
}
|
||||
|
||||
// GetColorPrimariesAddr gets `AVFilmGrainH274Params.color_primaries` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetColorPrimariesAddr() *AVColorPrimaries {
|
||||
return (*AVColorPrimaries)(&h274p.color_primaries)
|
||||
}
|
||||
|
||||
// GetColorTrc gets `AVFilmGrainH274Params.color_trc` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetColorTrc() AVColorTransferCharacteristic {
|
||||
return (AVColorTransferCharacteristic)(h274p.color_trc)
|
||||
}
|
||||
|
||||
// SetColorTrc sets `AVFilmGrainH274Params.color_trc` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetColorTrc(v AVColorTransferCharacteristic) {
|
||||
h274p.color_trc = (C.enum_AVColorTransferCharacteristic)(v)
|
||||
}
|
||||
|
||||
// GetColorTrcAddr gets `AVFilmGrainH274Params.color_trc` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetColorTrcAddr() *AVColorTransferCharacteristic {
|
||||
return (*AVColorTransferCharacteristic)(&h274p.color_trc)
|
||||
}
|
||||
|
||||
// GetColorSpace gets `AVFilmGrainH274Params.color_space` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetColorSpace() AVColorSpace {
|
||||
return (AVColorSpace)(h274p.color_space)
|
||||
}
|
||||
|
||||
// SetColorSpace sets `AVFilmGrainH274Params.color_space` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetColorSpace(v AVColorSpace) {
|
||||
h274p.color_space = (C.enum_AVColorSpace)(v)
|
||||
}
|
||||
|
||||
// GetColorSpaceAddr gets `AVFilmGrainH274Params.color_space` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetColorSpaceAddr() *AVColorSpace {
|
||||
return (*AVColorSpace)(&h274p.color_space)
|
||||
}
|
||||
|
||||
// GetBlendingModeId gets `AVFilmGrainH274Params.blending_mode_id` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetBlendingModeId() int32 {
|
||||
return (int32)(h274p.blending_mode_id)
|
||||
}
|
||||
|
||||
// SetBlendingModeId sets `AVFilmGrainH274Params.blending_mode_id` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetBlendingModeId(v int32) {
|
||||
h274p.blending_mode_id = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetBlendingModeIdAddr gets `AVFilmGrainH274Params.blending_mode_id` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetBlendingModeIdAddr() *int32 {
|
||||
return (*int32)(&h274p.blending_mode_id)
|
||||
}
|
||||
|
||||
// GetLog2ScaleFactor gets `AVFilmGrainH274Params.log2_scale_factor` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetLog2ScaleFactor() int32 {
|
||||
return (int32)(h274p.log2_scale_factor)
|
||||
}
|
||||
|
||||
// SetLog2ScaleFactor sets `AVFilmGrainH274Params.log2_scale_factor` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetLog2ScaleFactor(v int32) {
|
||||
h274p.log2_scale_factor = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetLog2ScaleFactorAddr gets `AVFilmGrainH274Params.log2_scale_factor` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetLog2ScaleFactorAddr() *int32 {
|
||||
return (*int32)(&h274p.log2_scale_factor)
|
||||
}
|
||||
|
||||
// GetComponentModelPresent gets `AVFilmGrainH274Params.component_model_present` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetComponentModelPresent() []int32 {
|
||||
return unsafe.Slice((*int32)(&h274p.component_model_present[0]), 3)
|
||||
}
|
||||
|
||||
// SetComponentModelPresent sets `AVFilmGrainH274Params.component_model_present` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetComponentModelPresent(v []int32) {
|
||||
for i := 0; i < FFMIN(len(v), 3); i++ {
|
||||
h274p.component_model_present[i] = (C.int)(v[i])
|
||||
}
|
||||
}
|
||||
|
||||
// GetComponentModelPresentAddr gets `AVFilmGrainH274Params.component_model_present` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetComponentModelPresentAddr() **int32 {
|
||||
return (**int32)(unsafe.Pointer(&h274p.component_model_present))
|
||||
}
|
||||
|
||||
// GetNumIntensityIntervals gets `AVFilmGrainH274Params.num_intensity_intervals` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetNumIntensityIntervals() []uint16 {
|
||||
return unsafe.Slice((*uint16)(&h274p.num_intensity_intervals[0]), 3)
|
||||
}
|
||||
|
||||
// SetNumIntensityIntervals sets `AVFilmGrainH274Params.num_intensity_intervals` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetNumIntensityIntervals(v []uint16) {
|
||||
for i := 0; i < FFMIN(len(v), 3); i++ {
|
||||
h274p.num_intensity_intervals[i] = (C.uint16_t)(v[i])
|
||||
}
|
||||
}
|
||||
|
||||
// GetNumIntensityIntervalsAddr gets `AVFilmGrainH274Params.num_intensity_intervals` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetNumIntensityIntervalsAddr() **uint16 {
|
||||
return (**uint16)(unsafe.Pointer(&h274p.num_intensity_intervals))
|
||||
}
|
||||
|
||||
// GetNumModelValues gets `AVFilmGrainH274Params.num_model_values` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetNumModelValues() []uint8 {
|
||||
return unsafe.Slice((*uint8)(&h274p.num_model_values[0]), 3)
|
||||
}
|
||||
|
||||
// SetNumModelValues sets `AVFilmGrainH274Params.num_model_values` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetNumModelValues(v []uint8) {
|
||||
for i := 0; i < FFMIN(len(v), 3); i++ {
|
||||
h274p.num_model_values[i] = (C.uint8_t)(v[i])
|
||||
}
|
||||
}
|
||||
|
||||
// GetNumModelValuesAddr gets `AVFilmGrainH274Params.num_model_values` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetNumModelValuesAddr() **uint8 {
|
||||
return (**uint8)(unsafe.Pointer(&h274p.num_model_values))
|
||||
}
|
||||
|
||||
// GetIntensityIntervalLowerBound gets `AVFilmGrainH274Params.intensity_interval_lower_bound` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetIntensityIntervalLowerBound() (v [][]uint8) {
|
||||
for i := 0; i < 3; i++ {
|
||||
v = append(v, unsafe.Slice((*uint8)(&h274p.intensity_interval_lower_bound[i][0]), 256))
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// SetIntensityIntervalLowerBound sets `AVFilmGrainH274Params.intensity_interval_lower_bound` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetIntensityIntervalLowerBound(v [][]uint8) {
|
||||
for i := 0; i < FFMIN(len(v), 3); i++ {
|
||||
for j := 0; j < FFMIN(len(v[i]), 256); j++ {
|
||||
h274p.intensity_interval_lower_bound[i][j] = (C.uint8_t)(v[i][j])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GetIntensityIntervalLowerBoundAddr gets `AVFilmGrainH274Params.intensity_interval_lower_bound` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetIntensityIntervalLowerBoundAddr() **uint8 {
|
||||
return (**uint8)(unsafe.Pointer(&h274p.intensity_interval_lower_bound))
|
||||
}
|
||||
|
||||
// GetIntensityIntervalUpperBound gets `AVFilmGrainH274Params.intensity_interval_upper_bound` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetIntensityIntervalUpperBound() (v [][]uint8) {
|
||||
for i := 0; i < 3; i++ {
|
||||
v = append(v, unsafe.Slice((*uint8)(&h274p.intensity_interval_upper_bound[i][0]), 256))
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// SetIntensityIntervalUpperBound sets `AVFilmGrainH274Params.intensity_interval_upper_bound` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetIntensityIntervalUpperBound(v [][]uint8) {
|
||||
for i := 0; i < FFMIN(len(v), 3); i++ {
|
||||
for j := 0; j < FFMIN(len(v[i]), 256); j++ {
|
||||
h274p.intensity_interval_upper_bound[i][j] = (C.uint8_t)(v[i][j])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GetIntensityIntervalUpperBoundAddr gets `AVFilmGrainH274Params.intensity_interval_upper_bound` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetIntensityIntervalUpperBoundAddr() **uint8 {
|
||||
return (**uint8)(unsafe.Pointer(&h274p.intensity_interval_upper_bound))
|
||||
}
|
||||
|
||||
// GetCompModelValue gets `AVFilmGrainH274Params.comp_model_value` value.
|
||||
func (h274p *AVFilmGrainH274Params) GetCompModelValue() (v [][][]int16) {
|
||||
for i := 0; i < 3; i++ {
|
||||
tmp := [][]int16{}
|
||||
for j := 0; j < 256; j++ {
|
||||
tmp = append(tmp, unsafe.Slice((*int16)(&h274p.comp_model_value[i][j][0]), 6))
|
||||
}
|
||||
v = append(v, tmp)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// SetCompModelValue sets `AVFilmGrainH274Params.comp_model_value` value.
|
||||
func (h274p *AVFilmGrainH274Params) SetCompModelValue(v [][][]int16) {
|
||||
for i := 0; i < FFMIN(len(v), 3); i++ {
|
||||
for j := 0; j < FFMIN(len(v[i]), 256); j++ {
|
||||
for k := 0; k < FFMIN(len(v[i][j]), 6); k++ {
|
||||
h274p.comp_model_value[i][j][k] = (C.int16_t)(v[i][j][k])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GetCompModelValueAddr gets `AVFilmGrainH274Params.comp_model_value` address.
|
||||
func (h274p *AVFilmGrainH274Params) GetCompModelValueAddr() **int16 {
|
||||
return (**int16)(unsafe.Pointer(&h274p.comp_model_value))
|
||||
}
|
||||
|
||||
// AVFilmGrainParams
|
||||
type AVFilmGrainParams C.struct_AVFilmGrainParams
|
||||
|
||||
|
393
avutil_frame.go
393
avutil_frame.go
@@ -30,14 +30,19 @@ const (
|
||||
AV_FRAME_DATA_SPHERICAL = AVFrameSideDataType(C.AV_FRAME_DATA_SPHERICAL)
|
||||
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL = AVFrameSideDataType(C.AV_FRAME_DATA_CONTENT_LIGHT_LEVEL)
|
||||
AV_FRAME_DATA_ICC_PROFILE = AVFrameSideDataType(C.AV_FRAME_DATA_ICC_PROFILE)
|
||||
AV_FRAME_DATA_QP_TABLE_PROPERTIES = AVFrameSideDataType(C.AV_FRAME_DATA_QP_TABLE_PROPERTIES)
|
||||
AV_FRAME_DATA_QP_TABLE_DATA = AVFrameSideDataType(C.AV_FRAME_DATA_QP_TABLE_DATA)
|
||||
AV_FRAME_DATA_S12M_TIMECODE = AVFrameSideDataType(C.AV_FRAME_DATA_S12M_TIMECODE)
|
||||
AV_FRAME_DATA_DYNAMIC_HDR_PLUS = AVFrameSideDataType(C.AV_FRAME_DATA_DYNAMIC_HDR_PLUS)
|
||||
AV_FRAME_DATA_REGIONS_OF_INTEREST = AVFrameSideDataType(C.AV_FRAME_DATA_REGIONS_OF_INTEREST)
|
||||
AV_FRAME_DATA_VIDEO_ENC_PARAMS = AVFrameSideDataType(C.AV_FRAME_DATA_VIDEO_ENC_PARAMS)
|
||||
AV_FRAME_DATA_SEI_UNREGISTERED = AVFrameSideDataType(C.AV_FRAME_DATA_SEI_UNREGISTERED)
|
||||
AV_FRAME_DATA_FILM_GRAIN_PARAMS = AVFrameSideDataType(C.AV_FRAME_DATA_FILM_GRAIN_PARAMS)
|
||||
|
||||
AV_FRAME_DATA_S12M_TIMECODE = AVFrameSideDataType(C.AV_FRAME_DATA_S12M_TIMECODE)
|
||||
AV_FRAME_DATA_DYNAMIC_HDR_PLUS = AVFrameSideDataType(C.AV_FRAME_DATA_DYNAMIC_HDR_PLUS)
|
||||
AV_FRAME_DATA_REGIONS_OF_INTEREST = AVFrameSideDataType(C.AV_FRAME_DATA_REGIONS_OF_INTEREST)
|
||||
AV_FRAME_DATA_VIDEO_ENC_PARAMS = AVFrameSideDataType(C.AV_FRAME_DATA_VIDEO_ENC_PARAMS)
|
||||
AV_FRAME_DATA_SEI_UNREGISTERED = AVFrameSideDataType(C.AV_FRAME_DATA_SEI_UNREGISTERED)
|
||||
AV_FRAME_DATA_FILM_GRAIN_PARAMS = AVFrameSideDataType(C.AV_FRAME_DATA_FILM_GRAIN_PARAMS)
|
||||
AV_FRAME_DATA_DETECTION_BBOXES = AVFrameSideDataType(C.AV_FRAME_DATA_DETECTION_BBOXES)
|
||||
AV_FRAME_DATA_DOVI_RPU_BUFFER = AVFrameSideDataType(C.AV_FRAME_DATA_DOVI_RPU_BUFFER)
|
||||
AV_FRAME_DATA_DOVI_METADATA = AVFrameSideDataType(C.AV_FRAME_DATA_DOVI_METADATA)
|
||||
|
||||
AV_FRAME_DATA_DYNAMIC_HDR_VIVID = AVFrameSideDataType(C.AV_FRAME_DATA_DYNAMIC_HDR_VIVID)
|
||||
AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT = AVFrameSideDataType(C.AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT)
|
||||
)
|
||||
|
||||
// AVActiveFormatDescription
|
||||
@@ -87,18 +92,18 @@ func (sd *AVFrameSideData) GetDataAddr() **uint8 {
|
||||
}
|
||||
|
||||
// GetSize gets `AVFrameSideData.size` value.
|
||||
func (sd *AVFrameSideData) GetSize() int32 {
|
||||
return (int32)(sd.size)
|
||||
func (sd *AVFrameSideData) GetSize() uintptr {
|
||||
return (uintptr)(sd.size)
|
||||
}
|
||||
|
||||
// SetSize sets `AVFrameSideData.size` value.
|
||||
func (sd *AVFrameSideData) SetSize(v int32) {
|
||||
sd.size = (C.int)(v)
|
||||
func (sd *AVFrameSideData) SetSize(v uintptr) {
|
||||
sd.size = (C.size_t)(v)
|
||||
}
|
||||
|
||||
// GetSizeAddr gets `AVFrameSideData.size` address.
|
||||
func (sd *AVFrameSideData) GetSizeAddr() *int32 {
|
||||
return (*int32)(&sd.size)
|
||||
func (sd *AVFrameSideData) GetSizeAddr() *uintptr {
|
||||
return (*uintptr)(unsafe.Pointer(&sd.size))
|
||||
}
|
||||
|
||||
// GetMetadata gets `AVFrameSideData.metadata` value.
|
||||
@@ -400,27 +405,6 @@ func (frame *AVFrame) GetPtsAddr() *int64 {
|
||||
return (*int64)(&frame.pts)
|
||||
}
|
||||
|
||||
// Deprecated: Use the pts field instead.
|
||||
//
|
||||
// GetPktPts gets `AVFrame.pkt_pts` value.
|
||||
func (frame *AVFrame) GetPktPts() int64 {
|
||||
return (int64)(frame.pkt_pts)
|
||||
}
|
||||
|
||||
// Deprecated: Use the pts field instead.
|
||||
//
|
||||
// SetPktPts sets `AVFrame.pkt_pts` value.
|
||||
func (frame *AVFrame) SetPktPts(v int64) {
|
||||
frame.pkt_pts = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// Deprecated: Use the pts field instead.
|
||||
//
|
||||
// GetPktPtsAddr gets `AVFrame.pkt_pts` address.
|
||||
func (frame *AVFrame) GetPktPtsAddr() *int64 {
|
||||
return (*int64)(&frame.pkt_pts)
|
||||
}
|
||||
|
||||
// GetPktDts gets `AVFrame.pkt_dts` value.
|
||||
func (frame *AVFrame) GetPktDts() int64 {
|
||||
return (int64)(frame.pkt_dts)
|
||||
@@ -436,31 +420,58 @@ func (frame *AVFrame) GetPktDtsAddr() *int64 {
|
||||
return (*int64)(&frame.pkt_dts)
|
||||
}
|
||||
|
||||
// GetTimeBase gets `AVFrame.time_base` value.
|
||||
func (frame *AVFrame) GetTimeBase() AVRational {
|
||||
return (AVRational)(frame.time_base)
|
||||
}
|
||||
|
||||
// SetTimeBase sets `AVFrame.time_base` value.
|
||||
func (frame *AVFrame) SetTimeBase(v AVRational) {
|
||||
frame.time_base = (C.struct_AVRational)(v)
|
||||
}
|
||||
|
||||
// GetTimeBaseAddr gets `AVFrame.time_base` address.
|
||||
func (frame *AVFrame) GetTimeBaseAddr() *AVRational {
|
||||
return (*AVRational)(&frame.time_base)
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// GetCodedPictureNumber gets `AVFrame.coded_picture_number` value.
|
||||
func (frame *AVFrame) GetCodedPictureNumber() int32 {
|
||||
return (int32)(frame.coded_picture_number)
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// SetCodedPictureNumber sets `AVFrame.coded_picture_number` value.
|
||||
func (frame *AVFrame) SetCodedPictureNumber(v int32) {
|
||||
frame.coded_picture_number = (C.int)(v)
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// GetCodedPictureNumberAddr gets `AVFrame.coded_picture_number` address.
|
||||
func (frame *AVFrame) GetCodedPictureNumberAddr() *int32 {
|
||||
return (*int32)(&frame.coded_picture_number)
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// GetDisplayPictureNumber gets `AVFrame.display_picture_number` value.
|
||||
func (frame *AVFrame) GetDisplayPictureNumber() int32 {
|
||||
return (int32)(frame.display_picture_number)
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// SetDisplayPictureNumber sets `AVFrame.display_picture_number` value.
|
||||
func (frame *AVFrame) SetDisplayPictureNumber(v int32) {
|
||||
frame.display_picture_number = (C.int)(v)
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// GetDisplayPictureNumberAddr gets `AVFrame.display_picture_number` address.
|
||||
func (frame *AVFrame) GetDisplayPictureNumberAddr() *int32 {
|
||||
return (*int32)(&frame.display_picture_number)
|
||||
@@ -481,29 +492,6 @@ func (frame *AVFrame) GetQualityAddr() *int32 {
|
||||
return (*int32)(&frame.quality)
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// GetError gets `AVFrame.error` value.
|
||||
func (frame *AVFrame) GetError() []uint64 {
|
||||
return unsafe.Slice((*uint64)(&frame.error[0]), AV_NUM_DATA_POINTERS)
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// SetError sets `AVFrame.error` value.
|
||||
func (frame *AVFrame) SetError(v []uint64) {
|
||||
for i := 0; i < FFMIN(len(v), AV_NUM_DATA_POINTERS); i++ {
|
||||
frame.error[i] = (C.uint64_t)(v[i])
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated: Unused.
|
||||
//
|
||||
// GetErrorAddr gets `AVFrame.error` address.
|
||||
func (frame *AVFrame) GetErrorAddr() **uint64 {
|
||||
return (**uint64)(unsafe.Pointer(&frame.error))
|
||||
}
|
||||
|
||||
// GetRepeatPict gets `AVFrame.repeat_pict` value.
|
||||
func (frame *AVFrame) GetRepeatPict() int32 {
|
||||
return (int32)(frame.repeat_pict)
|
||||
@@ -594,16 +582,22 @@ func (frame *AVFrame) GetSampleRateAddr() *int32 {
|
||||
return (*int32)(&frame.sample_rate)
|
||||
}
|
||||
|
||||
// Deprecated: use ChLayout instead
|
||||
//
|
||||
// GetChannelLayout gets `AVFrame.channel_layout` value.
|
||||
func (frame *AVFrame) GetChannelLayout() uint64 {
|
||||
return (uint64)(frame.channel_layout)
|
||||
}
|
||||
|
||||
// Deprecated: use ChLayout instead
|
||||
//
|
||||
// SetChannelLayout sets `AVFrame.channel_layout` value.
|
||||
func (frame *AVFrame) SetChannelLayout(v uint64) {
|
||||
frame.channel_layout = (C.uint64_t)(v)
|
||||
}
|
||||
|
||||
// Deprecated: use ChLayout instead
|
||||
//
|
||||
// GetChannelLayoutAddr gets `AVFrame.channel_layout` address.
|
||||
func (frame *AVFrame) GetChannelLayoutAddr() *uint64 {
|
||||
return (*uint64)(&frame.channel_layout)
|
||||
@@ -818,16 +812,22 @@ func (frame *AVFrame) GetPktPosAddr() *int64 {
|
||||
return (*int64)(&frame.pkt_pos)
|
||||
}
|
||||
|
||||
// Deprecated: Use duration instead.
|
||||
//
|
||||
// GetPktDuration gets `AVFrame.pkt_duration` value.
|
||||
func (frame *AVFrame) GetPktDuration() int64 {
|
||||
return (int64)(frame.pkt_duration)
|
||||
}
|
||||
|
||||
// Deprecated: Use duration instead.
|
||||
//
|
||||
// SetPktDuration sets `AVFrame.pkt_duration` value.
|
||||
func (frame *AVFrame) SetPktDuration(v int64) {
|
||||
frame.pkt_duration = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// Deprecated: Use duration instead.
|
||||
//
|
||||
// GetPktDurationAddr gets `AVFrame.pkt_duration` address.
|
||||
func (frame *AVFrame) GetPktDurationAddr() *int64 {
|
||||
return (*int64)(&frame.pkt_duration)
|
||||
@@ -870,16 +870,22 @@ const (
|
||||
FF_DECODE_ERROR_DECODE_SLICES = int32(C.FF_DECODE_ERROR_DECODE_SLICES)
|
||||
)
|
||||
|
||||
// Deprecated: use ChLayout instead
|
||||
//
|
||||
// GetChannels gets `AVFrame.channels` value.
|
||||
func (frame *AVFrame) GetChannels() int32 {
|
||||
return (int32)(frame.channels)
|
||||
}
|
||||
|
||||
// Deprecated: use ChLayout instead
|
||||
//
|
||||
// SetChannels sets `AVFrame.channels` value.
|
||||
func (frame *AVFrame) SetChannels(v int32) {
|
||||
frame.channels = (C.int)(v)
|
||||
}
|
||||
|
||||
// Deprecated: use ChLayout instead
|
||||
//
|
||||
// GetChannelsAddr gets `AVFrame.channels` address.
|
||||
func (frame *AVFrame) GetChannelsAddr() *int32 {
|
||||
return (*int32)(&frame.channels)
|
||||
@@ -900,90 +906,6 @@ func (frame *AVFrame) GetPktSizeAddr() *int32 {
|
||||
return (*int32)(&frame.pkt_size)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetQscaleTable gets `AVFrame.qscale_table` value.
|
||||
func (frame *AVFrame) GetQscaleTable() *int8 {
|
||||
return (*int8)(frame.qscale_table)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SetQscaleTable sets `AVFrame.qscale_table` value.
|
||||
func (frame *AVFrame) SetQscaleTable(v *int8) {
|
||||
frame.qscale_table = (*C.int8_t)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetQscaleTableAddr gets `AVFrame.qscale_table` address.
|
||||
func (frame *AVFrame) GetQscaleTableAddr() **int8 {
|
||||
return (**int8)(unsafe.Pointer(&frame.qscale_table))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetQstride gets `AVFrame.qstride` value.
|
||||
func (frame *AVFrame) GetQstride() int32 {
|
||||
return (int32)(frame.qstride)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SetQstride sets `AVFrame.qstride` value.
|
||||
func (frame *AVFrame) SetQstride(v int32) {
|
||||
frame.qstride = (C.int)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetQstrideAddr gets `AVFrame.qstride` address.
|
||||
func (frame *AVFrame) GetQstrideAddr() *int32 {
|
||||
return (*int32)(&frame.qstride)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetQscaleType gets `AVFrame.qscaletype` value.
|
||||
func (frame *AVFrame) GetQscaleType() int32 {
|
||||
return (int32)(frame.qscale_type)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SetQscaleType sets `AVFrame.qscaletype` value.
|
||||
func (frame *AVFrame) SetQscaleType(v int32) {
|
||||
frame.qscale_type = (C.int)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetQscaleTypeAddr gets `AVFrame.qscaletype` address.
|
||||
func (frame *AVFrame) GetQscaleTypeAddr() *int32 {
|
||||
return (*int32)(&frame.qscale_type)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetQpTableBuf gets `AVFrame.qp_table_buf` value.
|
||||
func (frame *AVFrame) GetQpTableBuf() *AVBufferRef {
|
||||
return (*AVBufferRef)(frame.qp_table_buf)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SetQpTableBuf sets `AVFrame.qp_table_buf` value.
|
||||
func (frame *AVFrame) SetQpTableBuf(v *AVBufferRef) {
|
||||
frame.qp_table_buf = (*C.struct_AVBufferRef)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetQpTableBufAddr gets `AVFrame.qp_table_buf` address.
|
||||
func (frame *AVFrame) GetQpTableBufAddr() **AVBufferRef {
|
||||
return (**AVBufferRef)(unsafe.Pointer(&frame.qp_table_buf))
|
||||
}
|
||||
|
||||
// GetHwFramesCtx gets `AVFrame.hw_frames_ctx` value.
|
||||
func (frame *AVFrame) GetHwFramesCtx() *AVBufferRef {
|
||||
return (*AVBufferRef)(frame.hw_frames_ctx)
|
||||
@@ -1089,179 +1011,34 @@ func (frame *AVFrame) GetPrivateRefAddr() **AVBufferRef {
|
||||
return (**AVBufferRef)(unsafe.Pointer(&frame.private_ref))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetBestEffortTimestamp
|
||||
func AvFrameGetBestEffortTimestamp(frame *AVFrame) int64 {
|
||||
return (int64)(C.av_frame_get_best_effort_timestamp((*C.struct_AVFrame)(frame)))
|
||||
// GetChLayout gets `AVFrame.ch_layout` value.
|
||||
func (frame *AVFrame) GetChLayout() AVChannelLayout {
|
||||
return (AVChannelLayout)(frame.ch_layout)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetBestEffortTimestamp
|
||||
func AvFrameSetBestEffortTimestamp(frame *AVFrame, val int64) {
|
||||
C.av_frame_set_best_effort_timestamp((*C.struct_AVFrame)(frame), (C.int64_t)(val))
|
||||
// SetChLayout sets `AVFrame.ch_layout` value.
|
||||
func (frame *AVFrame) SetChLayout(v AVChannelLayout) {
|
||||
frame.ch_layout = (C.struct_AVChannelLayout)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetPktDuration
|
||||
func AvFrameGetPktDuration(frame *AVFrame) int64 {
|
||||
return (int64)(C.av_frame_get_pkt_duration((*C.struct_AVFrame)(frame)))
|
||||
// GetChLayoutAddr gets `AVFrame.ch_layout` address.
|
||||
func (frame *AVFrame) GetChLayoutAddr() *AVChannelLayout {
|
||||
return (*AVChannelLayout)(&frame.ch_layout)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetPktDuration
|
||||
func AvFrameSetPktDuration(frame *AVFrame, val int64) {
|
||||
C.av_frame_set_pkt_duration((*C.struct_AVFrame)(frame), (C.int64_t)(val))
|
||||
// GetDuration gets `AVFrame.duration` value.
|
||||
func (frame *AVFrame) GetDuration() int64 {
|
||||
return (int64)(frame.duration)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetPktPos
|
||||
func AvFrameGetPktPos(frame *AVFrame) int64 {
|
||||
return (int64)(C.av_frame_get_pkt_pos((*C.struct_AVFrame)(frame)))
|
||||
// SetDuration sets `AVFrame.duration` value.
|
||||
func (frame *AVFrame) SetDuration(v int64) {
|
||||
frame.duration = (C.int64_t)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetPktPos
|
||||
func AvFrameSetPktPos(frame *AVFrame, val int64) {
|
||||
C.av_frame_set_pkt_pos((*C.struct_AVFrame)(frame), (C.int64_t)(val))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetChannelLayout
|
||||
func AvFrameGetChannelLayout(frame *AVFrame) int64 {
|
||||
return (int64)(C.av_frame_get_channel_layout((*C.struct_AVFrame)(frame)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetChannelLayout
|
||||
func AvFrameSetChannelLayout(frame *AVFrame, val int64) {
|
||||
C.av_frame_set_channel_layout((*C.struct_AVFrame)(frame), (C.int64_t)(val))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetChannels
|
||||
func AvFrameGetChannels(frame *AVFrame) int32 {
|
||||
return (int32)(C.av_frame_get_channels((*C.struct_AVFrame)(frame)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetChannels
|
||||
func AvFrameSetChannels(frame *AVFrame, val int32) {
|
||||
C.av_frame_set_channels((*C.struct_AVFrame)(frame), (C.int)(val))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetSampleRate
|
||||
func AvFrameGetSampleRate(frame *AVFrame) int32 {
|
||||
return (int32)(C.av_frame_get_sample_rate((*C.struct_AVFrame)(frame)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetSampleRate
|
||||
func AvFrameSetSampleRate(frame *AVFrame, val int32) {
|
||||
C.av_frame_set_sample_rate((*C.struct_AVFrame)(frame), (C.int)(val))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetMetadata
|
||||
func AvFrameGetMetadata(frame *AVFrame) *AVDictionary {
|
||||
return (*AVDictionary)(C.av_frame_get_metadata((*C.struct_AVFrame)(frame)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetMetadata
|
||||
func AvFrameSetMetadata(frame *AVFrame, val *AVDictionary) {
|
||||
C.av_frame_set_metadata((*C.struct_AVFrame)(frame), (*C.struct_AVDictionary)(val))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetDecodeErrorFlags
|
||||
func AvFrameGetDecodeErrorFlags(frame *AVFrame) int32 {
|
||||
return (int32)(C.av_frame_get_decode_error_flags((*C.struct_AVFrame)(frame)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetDecodeErrorFlags
|
||||
func AvFrameSetDecodeErrorFlags(frame *AVFrame, val int32) {
|
||||
C.av_frame_set_decode_error_flags((*C.struct_AVFrame)(frame), (C.int)(val))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetPktSize
|
||||
func AvFrameGetPktSize(frame *AVFrame) int32 {
|
||||
return (int32)(C.av_frame_get_pkt_size((*C.struct_AVFrame)(frame)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetPktSize
|
||||
func AvFrameSetPktSize(frame *AVFrame, val int32) {
|
||||
C.av_frame_set_pkt_size((*C.struct_AVFrame)(frame), (C.int)(val))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetQpTable
|
||||
func AvFrameGetQpTable(frame *AVFrame, stride, _type *int32) *int8 {
|
||||
return (*int8)(C.av_frame_get_qp_table((*C.struct_AVFrame)(frame),
|
||||
(*C.int)(stride), (*C.int)(_type)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetQpTable
|
||||
func AvFrameSetQpTable(frame *AVFrame, buf *AVBufferRef, stride, _type int32) int32 {
|
||||
return (int32)(C.av_frame_set_qp_table((*C.struct_AVFrame)(frame),
|
||||
(*C.struct_AVBufferRef)(buf), (C.int)(stride), (C.int)(_type)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetColorspace
|
||||
func AvFrameGetColorspace(frame *AVFrame) AVColorSpace {
|
||||
return (AVColorSpace)(C.av_frame_get_colorspace((*C.struct_AVFrame)(frame)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetColorspace
|
||||
func AvFrameSetColorspace(frame *AVFrame, val AVColorSpace) {
|
||||
C.av_frame_set_colorspace((*C.struct_AVFrame)(frame), (C.enum_AVColorSpace)(val))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameGetColorRange
|
||||
func AvFrameGetColorRange(frame *AVFrame) AVColorRange {
|
||||
return (AVColorRange)(C.av_frame_get_color_range((*C.struct_AVFrame)(frame)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvFrameSetColorRange
|
||||
func AvFrameSetColorRange(frame *AVFrame, val AVColorRange) {
|
||||
C.av_frame_set_color_range((*C.struct_AVFrame)(frame), (C.enum_AVColorRange)(val))
|
||||
}
|
||||
|
||||
// AvGetColorspaceName gets the name of a colorspace.
|
||||
func AvGetColorspaceName(val AVColorSpace) string {
|
||||
return C.GoString(C.av_get_colorspace_name((C.enum_AVColorSpace)(val)))
|
||||
// GetDurationAddr gets `AVFrame.duration` address.
|
||||
func (frame *AVFrame) GetDurationAddr() *int64 {
|
||||
return (*int64)(&frame.duration)
|
||||
}
|
||||
|
||||
// AvFrameAlloc allocates an AVFrame and set its fields to default values.
|
||||
@@ -1328,9 +1105,9 @@ func AvFrameGetPlaneBuffer(frame *AVFrame, plane int32) *AVBufferRef {
|
||||
}
|
||||
|
||||
// AvFrameNewSideData adds a new side data to a frame.
|
||||
func AvFrameNewSideData(frame *AVFrame, _type AVFrameSideDataType, size int32) *AVFrameSideData {
|
||||
func AvFrameNewSideData(frame *AVFrame, _type AVFrameSideDataType, size uintptr) *AVFrameSideData {
|
||||
return (*AVFrameSideData)(C.av_frame_new_side_data((*C.struct_AVFrame)(frame),
|
||||
(C.enum_AVFrameSideDataType)(_type), (C.int)(size)))
|
||||
(C.enum_AVFrameSideDataType)(_type), (C.size_t)(size)))
|
||||
}
|
||||
|
||||
// AvFrameNewSideDataFromBuf adds a new side data to a frame from an existing AVBufferRef.
|
||||
@@ -1363,7 +1140,7 @@ func AvFrameApplyCropping(frame *AVFrame, flags int32) int32 {
|
||||
return (int32)(C.av_frame_apply_cropping((*C.struct_AVFrame)(frame), (C.int)(flags)))
|
||||
}
|
||||
|
||||
// AvFrameSideDataName returns a string identifying the side data type
|
||||
// AvFrameSideDataName returns a string identifying the side data type.
|
||||
func AvFrameSideDataName(_type AVFrameSideDataType) string {
|
||||
return C.GoString(C.av_frame_side_data_name((C.enum_AVFrameSideDataType)(_type)))
|
||||
}
|
||||
|
@@ -46,8 +46,8 @@ func AvHashInit(ctx *AVHashContext) {
|
||||
}
|
||||
|
||||
// AvHashUpdate updates a hash context with additional data.
|
||||
func AvHashUpdate(ctx *AVHashContext, src *uint8, len int32) {
|
||||
C.av_hash_update((*C.struct_AVHashContext)(ctx), (*C.uint8_t)(src), (C.int)(len))
|
||||
func AvHashUpdate(ctx *AVHashContext, src *uint8, len uintptr) {
|
||||
C.av_hash_update((*C.struct_AVHashContext)(ctx), (*C.uint8_t)(src), (C.size_t)(len))
|
||||
}
|
||||
|
||||
// AvHashFinal finalizes a hash context and compute the actual hash value.
|
||||
|
@@ -31,10 +31,13 @@ const (
|
||||
AV_HWDEVICE_TYPE_VULKAN = AVHWDeviceType(C.AV_HWDEVICE_TYPE_VULKAN)
|
||||
)
|
||||
|
||||
// AVHWDeviceInternal
|
||||
type AVHWDeviceInternal C.struct_AVHWDeviceInternal
|
||||
|
||||
// AVHWDeviceContext
|
||||
type AVHWDeviceContext C.struct_AVHWDeviceContext
|
||||
|
||||
// typedef void (*av_hw_device_context_free_func)(struct AVHWDeviceContext *ctx);
|
||||
type AVHWDeviceContextFreeFunc = C.av_hw_device_context_free_func
|
||||
|
||||
// GetAvClass gets `AVHWDeviceContext.av_class` value.
|
||||
@@ -117,10 +120,13 @@ func (dc *AVHWDeviceContext) GetUserOpaqueAddr() *unsafe.Pointer {
|
||||
return &dc.user_opaque
|
||||
}
|
||||
|
||||
// AVHWFramesInternal
|
||||
type AVHWFramesInternal C.struct_AVHWFramesInternal
|
||||
|
||||
// AVHWFramesContext
|
||||
type AVHWFramesContext C.struct_AVHWFramesContext
|
||||
|
||||
// typedef void (*av_hw_frames_context_free_func)(struct AVHWFramesContext *ctx);
|
||||
type AVHWFramesContextFreeFunc = C.av_hw_frames_context_free_func
|
||||
|
||||
// GetAvClass gets `AVHWFramesContext.av_class` value.
|
||||
@@ -393,6 +399,7 @@ func AvHWFrameTransferData(dst, src *AVFrame, flags int32) int32 {
|
||||
(C.int)(flags)))
|
||||
}
|
||||
|
||||
// AVHWFrameTransferDirection
|
||||
type AVHWFrameTransferDirection = C.enum_AVHWFrameTransferDirection
|
||||
|
||||
const (
|
||||
@@ -410,6 +417,7 @@ func AvHWFrameTransferGetFormats(hwframeCtx *AVBufferRef, dir AVHWFrameTransferD
|
||||
(C.int)(flags)))
|
||||
}
|
||||
|
||||
// AVHWFramesConstraints
|
||||
type AVHWFramesConstraints C.struct_AVHWFramesConstraints
|
||||
|
||||
// GetValidHwFormats gets `AVHWFramesConstraints.valid_hw_formats` value.
|
||||
|
@@ -16,3 +16,18 @@ type AVQSVDeviceContext C.struct_AVQSVDeviceContext
|
||||
|
||||
// AVQSVFramesContext
|
||||
type AVQSVFramesContext C.struct_AVQSVFramesContext
|
||||
|
||||
// GetFrameType gets `AVQSVFramesContext.frame_type` value.
|
||||
func (ctx *AVQSVFramesContext) GetFrameType() int32 {
|
||||
return (int32)(ctx.frame_type)
|
||||
}
|
||||
|
||||
// SetFrameType sets `AVQSVFramesContext.frame_type` value.
|
||||
func (ctx *AVQSVFramesContext) SetFrameType(v int32) {
|
||||
ctx.frame_type = (C.int)(v)
|
||||
}
|
||||
|
||||
// GetFrameTypeAddr gets `AVQSVFramesContext.frame_type` address.
|
||||
func (ctx *AVQSVFramesContext) GetFrameTypeAddr() *int32 {
|
||||
return (*int32)(&ctx.frame_type)
|
||||
}
|
||||
|
@@ -26,3 +26,13 @@ func AvMapVideotoolboxFormatFromPixfmt(pixFmt AVPixelFormat) uint32 {
|
||||
func AvMapVideotoolboxFormatFromPixfmt2(pixFmt AVPixelFormat, fullRange bool) uint32 {
|
||||
return (uint32)(C.av_map_videotoolbox_format_from_pixfmt2((C.enum_AVPixelFormat)(pixFmt), C.bool(fullRange)))
|
||||
}
|
||||
|
||||
// NONEED: av_map_videotoolbox_chroma_loc_from_av
|
||||
|
||||
// NONEED: av_map_videotoolbox_color_matrix_from_av
|
||||
|
||||
// NONEED: av_map_videotoolbox_color_primaries_from_av
|
||||
|
||||
// NONEED: av_map_videotoolbox_color_trc_from_av
|
||||
|
||||
// NONEED: av_vt_pixbuf_set_attachments
|
||||
|
@@ -90,6 +90,15 @@ func AvImageCopyPlane(dst *uint8, dstLinesize int32, src *uint8,
|
||||
(C.int)(bytewidth), (C.int)(height))
|
||||
}
|
||||
|
||||
// AvImageCopyPlaneUcFrom copies image data located in uncacheable (e.g. GPU mapped) memory.
|
||||
func AvImageCopyPlaneUcFrom(dst *uint8, dstLinesize int,
|
||||
src *uint8, srcLinesize int,
|
||||
bytewidth int, height int32) {
|
||||
C.av_image_copy_plane_uc_from((*C.uint8_t)(dst), (C.ptrdiff_t)(dstLinesize),
|
||||
(*C.uint8_t)(src), (C.ptrdiff_t)(srcLinesize),
|
||||
(C.ptrdiff_t)(bytewidth), (C.int)(height))
|
||||
}
|
||||
|
||||
// AvImageCopy copies image in src_data to dst_data.
|
||||
func AvImageCopy(dstData []*uint8, dstLinesizes []int32, srcData []*uint8, srcLinesizes []int32,
|
||||
pixFmt AVPixelFormat, width, height int32) {
|
||||
|
@@ -132,27 +132,6 @@ func (cls *AVClass) GetChildNextAddr() *AvClassChildNextFunc {
|
||||
return (*AvClassChildNextFunc)(&cls.child_next)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetChildClassNext gets `AVClass.child_class_next` value.
|
||||
func (cls *AVClass) GetChildClassNext() AvClassChildClassNextFunc {
|
||||
return (AvClassChildClassNextFunc)(cls.child_class_next)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SetChildClassNext sets `AVClass.child_class_next` value.
|
||||
func (cls *AVClass) SetChildClassNext(v AvClassChildClassNextFunc) {
|
||||
cls.child_class_next = (C.av_class_child_class_next_func)(v)
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// GetChildClassNextAddr gets `AVClass.child_class_next` address.
|
||||
func (cls *AVClass) GetChildClassNextAddr() *AvClassChildClassNextFunc {
|
||||
return (*AvClassChildClassNextFunc)(&cls.child_class_next)
|
||||
}
|
||||
|
||||
// GetCategory gets `AVClass.category` value.
|
||||
func (cls *AVClass) GetCategory() AVClassCategory {
|
||||
return (AVClassCategory)(cls.category)
|
||||
@@ -199,27 +178,27 @@ func AvLogOnce(avcl CVoidPointer, initialLevel, subsequentLevel int32, state *in
|
||||
|
||||
// NONEED: av_vlog
|
||||
|
||||
// AvLogGetLevel gets the current log level
|
||||
// AvLogGetLevel gets the current log level.
|
||||
func AvLogGetLevel() int32 {
|
||||
return (int32)(C.av_log_get_level())
|
||||
}
|
||||
|
||||
// AvLogSetLevel sets the log level
|
||||
// AvLogSetLevel sets the log level.
|
||||
func AvLogSetLevel(level int32) {
|
||||
C.av_log_set_level(C.int(level))
|
||||
C.av_log_set_level((C.int)(level))
|
||||
}
|
||||
|
||||
// typedef void (*av_log_callback_func)(void*, int, const char*, va_list);
|
||||
type AVLogCallbackFunc = C.av_log_callback_func
|
||||
|
||||
// AvLogSetCallback sets the logging callback
|
||||
// AvLogSetCallback sets the logging callback.
|
||||
func AvLogSetCallback(f AVLogCallbackFunc) {
|
||||
C.av_log_set_callback(f)
|
||||
}
|
||||
|
||||
// NONEED: av_log_default_callback
|
||||
|
||||
// AvDefaultItemName returns the context name
|
||||
// AvDefaultItemName returns the context name.
|
||||
func AvDefaultItemName(ctx CVoidPointer) string {
|
||||
return C.GoString(C.av_default_item_name(VoidPointer(ctx)))
|
||||
}
|
||||
|
@@ -9,6 +9,71 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AV_NE
|
||||
func AV_NE[T any](be, le T) T {
|
||||
if C.AV_HAVE_BIGENDIAN > 0 {
|
||||
return be
|
||||
}
|
||||
return le
|
||||
}
|
||||
|
||||
// FFDIFFSIGN
|
||||
func FFDIFFSIGN[T Integer](x, y T) int {
|
||||
if x > y {
|
||||
return 1
|
||||
} else if x < y {
|
||||
return -1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
// FFMAX
|
||||
func FFMAX[T Integer](a, b T) T {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// FFMAX3
|
||||
func FFMAX3[T Integer](a, b, c T) T {
|
||||
return FFMAX(FFMAX(a, b), c)
|
||||
}
|
||||
|
||||
// FFMIN
|
||||
func FFMIN[T Integer](a, b T) T {
|
||||
if a > b {
|
||||
return b
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
// FFMIN3
|
||||
func FFMIN3[T Integer](a, b, c T) T {
|
||||
return FFMIN(FFMIN(a, b), c)
|
||||
}
|
||||
|
||||
// FFSWAP
|
||||
func FFSWAP[T any](a, b *T) {
|
||||
swapTmp := *b
|
||||
*b = *a
|
||||
*a = swapTmp
|
||||
}
|
||||
|
||||
// NONEED: FF_ARRAY_ELEMS
|
||||
|
||||
// MKTAG
|
||||
func MKTAG(a, b, c, d uint32) uint32 {
|
||||
return (a) | ((b) << 8) | ((c) << 16) | ((uint32)(d) << 24)
|
||||
}
|
||||
|
||||
// MKBETAG
|
||||
func MKBETAG(a, b, c, d uint32) uint32 {
|
||||
return (d) | ((c) << 8) | ((b) << 16) | ((uint32)(a) << 24)
|
||||
}
|
||||
|
||||
// FFALIGN
|
||||
func FFALIGN[T Integer](x, a T) T {
|
||||
return ((x) + (a) - 1) & ^((a) - 1)
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVRounding
|
||||
type AVRounding = C.enum_AVRounding
|
||||
|
||||
const (
|
||||
|
@@ -27,8 +27,8 @@ func AvMd5Init(ctx *AVMD5) {
|
||||
}
|
||||
|
||||
// AvMd5Update updates hash value.
|
||||
func AvMd5Update(ctx *AVMD5, src *uint8, len int32) {
|
||||
C.av_md5_update((*C.struct_AVMD5)(ctx), (*C.uint8_t)(src), (C.int)(len))
|
||||
func AvMd5Update(ctx *AVMD5, src *uint8, len uintptr) {
|
||||
C.av_md5_update((*C.struct_AVMD5)(ctx), (*C.uint8_t)(src), (C.size_t)(len))
|
||||
}
|
||||
|
||||
// AvMd5Final finishs hashing and output digest value.
|
||||
@@ -37,6 +37,6 @@ func AvMd5Final(ctx *AVMD5, dst *uint8) {
|
||||
}
|
||||
|
||||
// AvMd5Sum hashes an array of data.
|
||||
func AvMd5Sum(dst, src *uint8, len int32) {
|
||||
C.av_md5_sum((*C.uint8_t)(dst), (*C.uint8_t)(src), (C.int)(len))
|
||||
func AvMd5Sum(dst, src *uint8, len uintptr) {
|
||||
C.av_md5_sum((*C.uint8_t)(dst), (*C.uint8_t)(src), (C.size_t)(len))
|
||||
}
|
||||
|
@@ -28,11 +28,6 @@ func AvMallocArray[U, V Integer](nmemb U, size V) unsafe.Pointer {
|
||||
return C.av_malloc_array((C.size_t)(nmemb), (C.size_t)(size))
|
||||
}
|
||||
|
||||
// AvMalloczArray allocates a memory block for an array with AvMallocz().
|
||||
func AvMalloczArray[U, V Integer](nmemb U, size V) unsafe.Pointer {
|
||||
return C.av_mallocz_array((C.size_t)(nmemb), (C.size_t)(size))
|
||||
}
|
||||
|
||||
// AvCalloc is non-inlined equivalent of AvMalloczArray().
|
||||
func AvCalloc[U, V Integer](nmemb U, size V) unsafe.Pointer {
|
||||
return C.av_calloc((C.size_t)(nmemb), (C.size_t)(size))
|
||||
|
@@ -9,6 +9,7 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVMotionVector
|
||||
type AVMotionVector C.struct_AVMotionVector
|
||||
|
||||
// GetSource gets `AVMotionVector.source` value.
|
||||
|
@@ -9,6 +9,7 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVMurMur3
|
||||
type AVMurMur3 C.struct_AVMurMur3
|
||||
|
||||
// AvMurmur3Alloc allocates an AVMurMur3 hash context.
|
||||
@@ -27,8 +28,8 @@ func AvMurmur3Init(c *AVMurMur3) {
|
||||
}
|
||||
|
||||
// AvMurmur3Update updates hash context with new data.
|
||||
func AvMurmur3Update(c *AVMurMur3, src *uint8, len int32) {
|
||||
C.av_murmur3_update((*C.struct_AVMurMur3)(c), (*C.uint8_t)(src), (C.int)(len))
|
||||
func AvMurmur3Update(c *AVMurMur3, src *uint8, len uintptr) {
|
||||
C.av_murmur3_update((*C.struct_AVMurMur3)(c), (*C.uint8_t)(src), (C.size_t)(len))
|
||||
}
|
||||
|
||||
// AvMurmur3Final finishes hashing and output digest value.
|
||||
|
@@ -86,6 +86,7 @@ const (
|
||||
AV_OPT_TYPE_COLOR = AVOptionType(C.AV_OPT_TYPE_COLOR)
|
||||
AV_OPT_TYPE_CHANNEL_LAYOUT = AVOptionType(C.AV_OPT_TYPE_CHANNEL_LAYOUT)
|
||||
AV_OPT_TYPE_BOOL = AVOptionType(C.AV_OPT_TYPE_BOOL)
|
||||
AV_OPT_TYPE_CHLAYOUT = AVOptionType(C.AV_OPT_TYPE_CHLAYOUT)
|
||||
)
|
||||
|
||||
// AVOption
|
||||
@@ -507,14 +508,6 @@ func AvOptChildNext(obj, prev CVoidPointer) unsafe.Pointer {
|
||||
return C.av_opt_child_next(VoidPointer(obj), VoidPointer(prev))
|
||||
}
|
||||
|
||||
// Deprecated: Use AvOptChildClassIterate instead.
|
||||
//
|
||||
// AvOptChildClassNext
|
||||
func AvOptChildClassNext(parent, prev *AVClass) *AVClass {
|
||||
return (*AVClass)(C.av_opt_child_class_next((*C.struct_AVClass)(parent),
|
||||
(*C.struct_AVClass)(prev)))
|
||||
}
|
||||
|
||||
// AvOptChildClassIterate iterates over potential AVOptions-enabled children of parent.
|
||||
func AvOptChildClassIterate(parent *AVClass, iter CVoidPointerPointer) *AVClass {
|
||||
return (*AVClass)(C.av_opt_child_class_iterate((*C.struct_AVClass)(parent), VoidPointerPointer(iter)))
|
||||
@@ -594,6 +587,8 @@ func AvOptSetVideoRate(obj CVoidPointer, name string, val AVRational, searchFlag
|
||||
(C.struct_AVRational)(val), (C.int)(searchFlags)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvOptSetChannelLayout
|
||||
func AvOptSetChannelLayout(obj CVoidPointer, name string, chLayout int64, searchFlags int32) int32 {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
@@ -602,6 +597,14 @@ func AvOptSetChannelLayout(obj CVoidPointer, name string, chLayout int64, search
|
||||
(C.int64_t)(chLayout), (C.int)(searchFlags)))
|
||||
}
|
||||
|
||||
// AvOptSetChlayout
|
||||
func AvOptSetChlayout(obj CVoidPointer, name string, layout *AVChannelLayout, searchFlags int32) int32 {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
defer nameFunc()
|
||||
return (int32)(C.av_opt_set_chlayout(VoidPointer(obj), (*C.char)(namePtr),
|
||||
(*C.struct_AVChannelLayout)(layout), (C.int)(searchFlags)))
|
||||
}
|
||||
|
||||
// AvOptSetDictVal
|
||||
func AvOptSetDictVal(obj CVoidPointer, name string, val *AVDictionary, searchFlags int32) int32 {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
@@ -688,6 +691,8 @@ func AvOptGetVideoRate(obj CVoidPointer, name string, searchFlags int32, outVal
|
||||
(C.int)(searchFlags), (*C.struct_AVRational)(outVal)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// AvOptGetChannelLayout
|
||||
func AvOptGetChannelLayout(obj CVoidPointer, name string, searchFlags int32, outVal *int64) int32 {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
@@ -696,6 +701,14 @@ func AvOptGetChannelLayout(obj CVoidPointer, name string, searchFlags int32, out
|
||||
(C.int)(searchFlags), (*C.int64_t)(outVal)))
|
||||
}
|
||||
|
||||
// AvOptGetChlayout
|
||||
func AvOptGetChlayout(obj CVoidPointer, name string, searchFlags int32, layout *AVChannelLayout) int32 {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
defer nameFunc()
|
||||
return (int32)(C.av_opt_get_chlayout(VoidPointer(obj), (*C.char)(namePtr),
|
||||
(C.int)(searchFlags), (*C.struct_AVChannelLayout)(layout)))
|
||||
}
|
||||
|
||||
// AvOptGetDictVal
|
||||
func AvOptGetDictVal(obj CVoidPointer, name string, searchFlags int32, outVal **AVDictionary) int32 {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
|
@@ -10,6 +10,7 @@ package ffmpeg
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
// AVComponentDescriptor
|
||||
type AVComponentDescriptor C.struct_AVComponentDescriptor
|
||||
|
||||
// GetPlane gets `AVComponentDescriptor.plane` value.
|
||||
@@ -87,69 +88,6 @@ func (cd *AVComponentDescriptor) GetDepthAddr() *int32 {
|
||||
return (*int32)(&cd.depth)
|
||||
}
|
||||
|
||||
// Deprecated: Use step instead.
|
||||
//
|
||||
// GetStepMinus1 gets `AVComponentDescriptor.step_minus1` value.
|
||||
func (cd *AVComponentDescriptor) GetStepMinus1() int32 {
|
||||
return (int32)(cd.step_minus1)
|
||||
}
|
||||
|
||||
// Deprecated: Use step instead.
|
||||
//
|
||||
// SetStepMinus1 sets `AVComponentDescriptor.step_minus1` value.
|
||||
func (cd *AVComponentDescriptor) SetStepMinus1(v int32) {
|
||||
cd.step_minus1 = (C.int)(v)
|
||||
}
|
||||
|
||||
// Deprecated: Use step instead.
|
||||
//
|
||||
// GetStepMinus1Addr gets `AVComponentDescriptor.step_minus1` address.
|
||||
func (cd *AVComponentDescriptor) GetStepMinus1Addr() *int32 {
|
||||
return (*int32)(&cd.step_minus1)
|
||||
}
|
||||
|
||||
// Deprecated: Use depth instead.
|
||||
//
|
||||
// GetDepthMinus1 gets `AVComponentDescriptor.depth_minus1` value.
|
||||
func (cd *AVComponentDescriptor) GetDepthMinus1() int32 {
|
||||
return (int32)(cd.depth_minus1)
|
||||
}
|
||||
|
||||
// Deprecated: Use depth instead.
|
||||
//
|
||||
// SetDepthMinus1 sets `AVComponentDescriptor.depth_minus1` value.
|
||||
func (cd *AVComponentDescriptor) SetDepthMinus1(v int32) {
|
||||
cd.depth_minus1 = (C.int)(v)
|
||||
}
|
||||
|
||||
// Deprecated: Use depth instead.
|
||||
//
|
||||
// GetDepthMinus1Addr gets `AVComponentDescriptor.depth_minus1` address.
|
||||
func (cd *AVComponentDescriptor) GetDepthMinus1Addr() *int32 {
|
||||
return (*int32)(&cd.depth_minus1)
|
||||
}
|
||||
|
||||
// Deprecated: Use offset instead.
|
||||
//
|
||||
// GetOffsetPlus1 gets `AVComponentDescriptor.offset_plus1` value.
|
||||
func (cd *AVComponentDescriptor) GetOffsetPlus1() int32 {
|
||||
return (int32)(cd.offset_plus1)
|
||||
}
|
||||
|
||||
// Deprecated: Use offset instead.
|
||||
//
|
||||
// SetOffsetPlus1 sets `AVComponentDescriptor.offset_plus1` value.
|
||||
func (cd *AVComponentDescriptor) SetOffsetPlus1(v int32) {
|
||||
cd.offset_plus1 = (C.int)(v)
|
||||
}
|
||||
|
||||
// Deprecated: Use offset instead.
|
||||
//
|
||||
// GetOffsetPlus1Addr gets `AVComponentDescriptor.offset_plus1` address.
|
||||
func (cd *AVComponentDescriptor) GetOffsetPlus1Addr() *int32 {
|
||||
return (*int32)(&cd.offset_plus1)
|
||||
}
|
||||
|
||||
// AVPixFmtDescriptor
|
||||
type AVPixFmtDescriptor C.struct_AVPixFmtDescriptor
|
||||
|
||||
@@ -247,10 +185,10 @@ const (
|
||||
AV_PIX_FMT_FLAG_HWACCEL = C.AV_PIX_FMT_FLAG_HWACCEL
|
||||
AV_PIX_FMT_FLAG_PLANAR = C.AV_PIX_FMT_FLAG_PLANAR
|
||||
AV_PIX_FMT_FLAG_RGB = C.AV_PIX_FMT_FLAG_RGB
|
||||
AV_PIX_FMT_FLAG_PSEUDOPAL = C.AV_PIX_FMT_FLAG_PSEUDOPAL
|
||||
AV_PIX_FMT_FLAG_ALPHA = C.AV_PIX_FMT_FLAG_ALPHA
|
||||
AV_PIX_FMT_FLAG_BAYER = C.AV_PIX_FMT_FLAG_BAYER
|
||||
AV_PIX_FMT_FLAG_FLOAT = C.AV_PIX_FMT_FLAG_FLOAT
|
||||
|
||||
AV_PIX_FMT_FLAG_ALPHA = C.AV_PIX_FMT_FLAG_ALPHA
|
||||
AV_PIX_FMT_FLAG_BAYER = C.AV_PIX_FMT_FLAG_BAYER
|
||||
AV_PIX_FMT_FLAG_FLOAT = C.AV_PIX_FMT_FLAG_FLOAT
|
||||
)
|
||||
|
||||
// AvGetBitsPerPixel returns the number of bits per pixel used by the pixel format
|
||||
@@ -354,6 +292,17 @@ func AvChromaLocationFromName(name string) int32 {
|
||||
return (int32)(C.av_chroma_location_from_name((*C.char)(namePtr)))
|
||||
}
|
||||
|
||||
// AvChromaLocationEnumToPos converts AVChromaLocation to swscale x/y chroma position.
|
||||
func AvChromaLocationEnumToPos(xpos, ypos *int32, pos AVChromaLocation) int32 {
|
||||
return (int32)(C.av_chroma_location_enum_to_pos((*C.int)(xpos), (*C.int)(ypos),
|
||||
(C.enum_AVChromaLocation)(pos)))
|
||||
}
|
||||
|
||||
// AvChromaLocationPosToEnum converts swscale x/y chroma position to AVChromaLocation.
|
||||
func AvChromaLocationPosToEnum(xpos, ypos int32) AVChromaLocation {
|
||||
return (AVChromaLocation)(C.av_chroma_location_pos_to_enum((C.int)(xpos), (C.int)(ypos)))
|
||||
}
|
||||
|
||||
// AvGetPixFmt returns the pixel format corresponding to name.
|
||||
func AvGetPixFmt(name string) AVPixelFormat {
|
||||
namePtr, nameFunc := StringCasting(name)
|
||||
|
@@ -10,6 +10,7 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVPixelutilsSadFn
|
||||
type AVPixelutilsSadFn C.av_pixelutils_sad_fn
|
||||
|
||||
// AvPixelutilsGetSadFn gets a potentially optimized pointer to a Sum-of-absolute-differences
|
||||
|
@@ -63,10 +63,7 @@ const (
|
||||
AV_PIX_FMT_BGR555BE = AVPixelFormat(C.AV_PIX_FMT_BGR555BE)
|
||||
AV_PIX_FMT_BGR555LE = AVPixelFormat(C.AV_PIX_FMT_BGR555LE)
|
||||
|
||||
AV_PIX_FMT_VAAPI_MOCO = AVPixelFormat(C.AV_PIX_FMT_VAAPI_MOCO)
|
||||
AV_PIX_FMT_VAAPI_IDCT = AVPixelFormat(C.AV_PIX_FMT_VAAPI_IDCT)
|
||||
AV_PIX_FMT_VAAPI_VLD = AVPixelFormat(C.AV_PIX_FMT_VAAPI_VLD)
|
||||
AV_PIX_FMT_VAAPI = AVPixelFormat(C.AV_PIX_FMT_VAAPI)
|
||||
AV_PIX_FMT_VAAPI = AVPixelFormat(C.AV_PIX_FMT_VAAPI)
|
||||
|
||||
AV_PIX_FMT_YUV420P16LE = AVPixelFormat(C.AV_PIX_FMT_YUV420P16LE)
|
||||
AV_PIX_FMT_YUV420P16BE = AVPixelFormat(C.AV_PIX_FMT_YUV420P16BE)
|
||||
@@ -259,7 +256,47 @@ const (
|
||||
|
||||
AV_PIX_FMT_X2RGB10LE = AVPixelFormat(C.AV_PIX_FMT_X2RGB10LE)
|
||||
AV_PIX_FMT_X2RGB10BE = AVPixelFormat(C.AV_PIX_FMT_X2RGB10BE)
|
||||
AV_PIX_FMT_NB = AVPixelFormat(C.AV_PIX_FMT_NB)
|
||||
AV_PIX_FMT_X2BGR10LE = AVPixelFormat(C.AV_PIX_FMT_X2BGR10LE)
|
||||
AV_PIX_FMT_X2BGR10BE = AVPixelFormat(C.AV_PIX_FMT_X2BGR10BE)
|
||||
|
||||
AV_PIX_FMT_P210BE = AVPixelFormat(C.AV_PIX_FMT_P210BE)
|
||||
AV_PIX_FMT_P210LE = AVPixelFormat(C.AV_PIX_FMT_P210LE)
|
||||
|
||||
AV_PIX_FMT_P410BE = AVPixelFormat(C.AV_PIX_FMT_P410BE)
|
||||
AV_PIX_FMT_P410LE = AVPixelFormat(C.AV_PIX_FMT_P410LE)
|
||||
|
||||
AV_PIX_FMT_P216BE = AVPixelFormat(C.AV_PIX_FMT_P216BE)
|
||||
AV_PIX_FMT_P216LE = AVPixelFormat(C.AV_PIX_FMT_P216LE)
|
||||
|
||||
AV_PIX_FMT_P416BE = AVPixelFormat(C.AV_PIX_FMT_P416BE)
|
||||
AV_PIX_FMT_P416LE = AVPixelFormat(C.AV_PIX_FMT_P416LE)
|
||||
|
||||
AV_PIX_FMT_VUYA = AVPixelFormat(C.AV_PIX_FMT_VUYA)
|
||||
|
||||
AV_PIX_FMT_RGBAF16BE = AVPixelFormat(C.AV_PIX_FMT_RGBAF16BE)
|
||||
AV_PIX_FMT_RGBAF16LE = AVPixelFormat(C.AV_PIX_FMT_RGBAF16LE)
|
||||
|
||||
AV_PIX_FMT_VUYX = AVPixelFormat(C.AV_PIX_FMT_VUYX)
|
||||
|
||||
AV_PIX_FMT_P012LE = AVPixelFormat(C.AV_PIX_FMT_P012LE)
|
||||
AV_PIX_FMT_P012BE = AVPixelFormat(C.AV_PIX_FMT_P012BE)
|
||||
|
||||
AV_PIX_FMT_Y212BE = AVPixelFormat(C.AV_PIX_FMT_Y212BE)
|
||||
AV_PIX_FMT_Y212LE = AVPixelFormat(C.AV_PIX_FMT_Y212LE)
|
||||
|
||||
AV_PIX_FMT_XV30BE = AVPixelFormat(C.AV_PIX_FMT_XV30BE)
|
||||
AV_PIX_FMT_XV30LE = AVPixelFormat(C.AV_PIX_FMT_XV30LE)
|
||||
|
||||
AV_PIX_FMT_XV36BE = AVPixelFormat(C.AV_PIX_FMT_XV36BE)
|
||||
AV_PIX_FMT_XV36LE = AVPixelFormat(C.AV_PIX_FMT_XV36LE)
|
||||
|
||||
AV_PIX_FMT_RGBF32BE = AVPixelFormat(C.AV_PIX_FMT_RGBF32BE)
|
||||
AV_PIX_FMT_RGBF32LE = AVPixelFormat(C.AV_PIX_FMT_RGBF32LE)
|
||||
|
||||
AV_PIX_FMT_RGBAF32BE = AVPixelFormat(C.AV_PIX_FMT_RGBAF32BE)
|
||||
AV_PIX_FMT_RGBAF32LE = AVPixelFormat(C.AV_PIX_FMT_RGBAF32LE)
|
||||
|
||||
AV_PIX_FMT_NB = AVPixelFormat(C.AV_PIX_FMT_NB)
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -344,6 +381,12 @@ const (
|
||||
|
||||
AV_PIX_FMT_Y210 = AVPixelFormat(C.AV_PIX_FMT_Y210)
|
||||
AV_PIX_FMT_X2RGB10 = AVPixelFormat(C.AV_PIX_FMT_X2RGB10)
|
||||
AV_PIX_FMT_X2BGR10 = AVPixelFormat(C.AV_PIX_FMT_X2BGR10)
|
||||
|
||||
AV_PIX_FMT_P210 = AVPixelFormat(C.AV_PIX_FMT_P210)
|
||||
AV_PIX_FMT_P410 = AVPixelFormat(C.AV_PIX_FMT_P410)
|
||||
AV_PIX_FMT_P216 = AVPixelFormat(C.AV_PIX_FMT_P216)
|
||||
AV_PIX_FMT_P416 = AVPixelFormat(C.AV_PIX_FMT_P416)
|
||||
)
|
||||
|
||||
// Chromaticity coordinates of the source primaries.
|
||||
|
@@ -87,7 +87,7 @@ func AvD2Q(d float64, max int32) AVRational {
|
||||
// return One of the following values:
|
||||
// 1 if `q1` is nearer to `q` than `q2`
|
||||
// -1 if `q2` is nearer to `q` than `q1`
|
||||
// 0 if they have the same distance
|
||||
// 0 if they have the same distance.
|
||||
func AvNearerQ(q, q1, q2 AVRational) int32 {
|
||||
return (int32)(C.av_nearer_q((C.struct_AVRational)(q),
|
||||
(C.struct_AVRational)(q1), (C.struct_AVRational)(q2)))
|
||||
|
@@ -23,8 +23,8 @@ func AvRipemdInit(context *AVRIPEMD, bits int32) int32 {
|
||||
}
|
||||
|
||||
// AvRipemdUpdate updates hash value.
|
||||
func AvRipemdUpdate(context *AVRIPEMD, data *uint8, len uint32) {
|
||||
C.av_ripemd_update((*C.struct_AVRIPEMD)(context), (*C.uint8_t)(data), (C.uint)(len))
|
||||
func AvRipemdUpdate(context *AVRIPEMD, data *uint8, len uintptr) {
|
||||
C.av_ripemd_update((*C.struct_AVRIPEMD)(context), (*C.uint8_t)(data), (C.size_t)(len))
|
||||
}
|
||||
|
||||
// AvRipemdFinal finishes hashing and output digest value.
|
||||
|
@@ -49,7 +49,7 @@ func AvGetSampleFmt(name string) AVSampleFormat {
|
||||
// requested planar/packed format, the format returned is the same as the
|
||||
// input.
|
||||
func AvGetAltSampleFmt(sampleFmt AVSampleFormat, planar int32) AVSampleFormat {
|
||||
return (AVSampleFormat)(C.av_get_alt_sample_fmt((C.enum_AVSampleFormat)(sampleFmt), C.int(planar)))
|
||||
return (AVSampleFormat)(C.av_get_alt_sample_fmt((C.enum_AVSampleFormat)(sampleFmt), (C.int)(planar)))
|
||||
}
|
||||
|
||||
// AvGetPackedSampleFmt gets the packed alternative form of the given sample format.
|
||||
|
@@ -23,8 +23,8 @@ func AvShaInit(context *AVSHA, bits int32) int32 {
|
||||
}
|
||||
|
||||
// AvShaUpdate updates hash value.
|
||||
func AvShaUpdate(ctx *AVSHA, data *uint8, len uint32) {
|
||||
C.av_sha_update((*C.struct_AVSHA)(ctx), (*C.uint8_t)(data), (C.uint)(len))
|
||||
func AvShaUpdate(ctx *AVSHA, data *uint8, len uintptr) {
|
||||
C.av_sha_update((*C.struct_AVSHA)(ctx), (*C.uint8_t)(data), (C.size_t)(len))
|
||||
}
|
||||
|
||||
// AvShaFinal finishes hashing and output digest value.
|
||||
|
@@ -23,8 +23,8 @@ func AvSha512Init(context *AVSHA512, bits int32) int32 {
|
||||
}
|
||||
|
||||
// AvSha512Update updates hash value.
|
||||
func AvSha512Update(ctx *AVSHA512, data *uint8, len uint32) {
|
||||
C.av_sha512_update((*C.struct_AVSHA512)(ctx), (*C.uint8_t)(data), (C.uint)(len))
|
||||
func AvSha512Update(ctx *AVSHA512, data *uint8, len uintptr) {
|
||||
C.av_sha512_update((*C.struct_AVSHA512)(ctx), (*C.uint8_t)(data), (C.size_t)(len))
|
||||
}
|
||||
|
||||
// AvSha512Final finishes hashing and output digest value.
|
||||
|
@@ -10,6 +10,7 @@ package ffmpeg
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
// AVSphericalProjection
|
||||
type AVSphericalProjection = C.enum_AVSphericalProjection
|
||||
|
||||
const (
|
||||
@@ -18,6 +19,7 @@ const (
|
||||
AV_SPHERICAL_EQUIRECTANGULAR_TILE = AVSphericalProjection(C.AV_SPHERICAL_EQUIRECTANGULAR_TILE)
|
||||
)
|
||||
|
||||
// AVSphericalMapping
|
||||
type AVSphericalMapping C.struct_AVSphericalMapping
|
||||
|
||||
// GetProjection gets `AVSphericalMapping.projection` value.
|
||||
|
@@ -36,6 +36,7 @@ const (
|
||||
AV_STEREO3D_FLAG_INVERT = C.AV_STEREO3D_FLAG_INVERT
|
||||
)
|
||||
|
||||
// AVStereo3D
|
||||
type AVStereo3D C.struct_AVStereo3D
|
||||
|
||||
// GetType gets `AVStereo3D.type` value.
|
||||
|
@@ -12,6 +12,7 @@ typedef void (*av_thread_message_free_func)(void *msg);
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
// AVThreadMessageQueue
|
||||
type AVThreadMessageQueue C.struct_AVThreadMessageQueue
|
||||
|
||||
// AVThreadMessageFlags
|
||||
|
@@ -13,6 +13,7 @@ const (
|
||||
AV_TIMECODE_STR_SIZE = C.AV_TIMECODE_STR_SIZE
|
||||
)
|
||||
|
||||
// AVTimecodeFlag
|
||||
type AVTimecodeFlag = C.enum_AVTimecodeFlag
|
||||
|
||||
const (
|
||||
@@ -21,6 +22,7 @@ const (
|
||||
AV_TIMECODE_FLAG_ALLOWNEGATIVE = AVTimecodeFlag(C.AV_TIMECODE_FLAG_ALLOWNEGATIVE)
|
||||
)
|
||||
|
||||
// AVTimecode
|
||||
type AVTimecode C.AVTimecode
|
||||
|
||||
// GetStart gets `AVTimecode.start` value.
|
||||
@@ -151,7 +153,7 @@ func AvTimecodeInitFromString(tc *AVTimecode, rate AVRational, str string, logCt
|
||||
(*C.char)(strPtr), VoidPointer(logCtx)))
|
||||
}
|
||||
|
||||
// AvTimecodeCheckFrameRate checks if the timecode feature is available for the given frame rate
|
||||
// AvTimecodeCheckFrameRate checks if the timecode feature is available for the given frame rate.
|
||||
func AvTimecodeCheckFrameRate(rate AVRational) int32 {
|
||||
return (int32)(C.av_timecode_check_frame_rate((C.struct_AVRational)(rate)))
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ typedef int (*av_tree_enu_func)(void *opaque, void *elem);
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
// AVTreeNode
|
||||
type AVTreeNode C.struct_AVTreeNode
|
||||
|
||||
// typedef int (*av_tree_cmp_func)(void *opaque, void *elem);
|
||||
|
@@ -23,7 +23,7 @@ func AvTwofishInit(d *AVTWOFISH, key *uint8, keyBits int32) int32 {
|
||||
(*C.uint8_t)(key), (C.int)(keyBits)))
|
||||
}
|
||||
|
||||
// AvTwofishCrypt encrypts or decrypts a buffer using a previously initialized context
|
||||
// AvTwofishCrypt encrypts or decrypts a buffer using a previously initialized context.
|
||||
func AvTwofishCrypt(d *AVTWOFISH, dst, src *uint8, count int32, iv *uint8, decrypt int32) {
|
||||
C.av_twofish_crypt((*C.struct_AVTWOFISH)(d),
|
||||
(*C.uint8_t)(dst), (*C.uint8_t)(src),
|
||||
|
16
avutil_tx.go
16
avutil_tx.go
@@ -143,6 +143,16 @@ const (
|
||||
AV_TX_DOUBLE_MDCT = AVTXType(C.AV_TX_DOUBLE_MDCT)
|
||||
AV_TX_INT32_FFT = AVTXType(C.AV_TX_INT32_FFT)
|
||||
AV_TX_INT32_MDCT = AVTXType(C.AV_TX_INT32_MDCT)
|
||||
|
||||
AV_TX_FLOAT_RDFT = AVTXType(C.AV_TX_FLOAT_RDFT)
|
||||
AV_TX_DOUBLE_RDFT = AVTXType(C.AV_TX_DOUBLE_RDFT)
|
||||
AV_TX_INT32_RDFT = AVTXType(C.AV_TX_INT32_RDFT)
|
||||
|
||||
AV_TX_FLOAT_DCT = AVTXType(C.AV_TX_FLOAT_DCT)
|
||||
AV_TX_DOUBLE_DCT = AVTXType(C.AV_TX_DOUBLE_DCT)
|
||||
AV_TX_INT32_DCT = AVTXType(C.AV_TX_INT32_DCT)
|
||||
|
||||
AV_TX_NB = AVTXType(C.AV_TX_NB)
|
||||
)
|
||||
|
||||
// typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride);
|
||||
@@ -152,7 +162,9 @@ type AvTxFn = C.av_tx_fn
|
||||
type AVTXFlags = C.enum_AVTXFlags
|
||||
|
||||
const (
|
||||
AV_TX_INPLACE = AVTXFlags(C.AV_TX_INPLACE)
|
||||
AV_TX_INPLACE = AVTXFlags(C.AV_TX_INPLACE)
|
||||
AV_TX_UNALIGNED = AVTXFlags(C.AV_TX_UNALIGNED)
|
||||
AV_TX_FULL_IMDCT = AVTXFlags(C.AV_TX_FULL_IMDCT)
|
||||
)
|
||||
|
||||
// AvTxInit initializes a transform context with the given configuration
|
||||
@@ -164,7 +176,7 @@ func AvTxInit(ctx **AVTXContext, tx *AvTxFn, _type AVTXType,
|
||||
(C.int)(inv), (C.int)(len), VoidPointer(scale), (C.uint64_t)(flags)))
|
||||
}
|
||||
|
||||
// AvTxUninit frees a context and sets ctx to NULL, does nothing when ctx == NULL
|
||||
// AvTxUninit frees a context and sets ctx to NULL, does nothing when ctx == NULL.
|
||||
func AvTxUninit(ctx **AVTXContext) {
|
||||
C.av_tx_uninit((**C.struct_AVTXContext)(unsafe.Pointer(ctx)))
|
||||
}
|
||||
|
62
avutil_uuid.go
Normal file
62
avutil_uuid.go
Normal file
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavutil/uuid.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
AV_UUID_LEN = C.AV_UUID_LEN
|
||||
AV_UUID_STR_SIZE = 37
|
||||
)
|
||||
|
||||
type AVUUID = []uint8
|
||||
|
||||
// AvMakeUUID makes a new AVUUID.
|
||||
func AvMakeUUID() AVUUID {
|
||||
return make([]uint8, AV_UUID_LEN)
|
||||
}
|
||||
|
||||
// AvUuidParse parses a string representation of a UUID formatted according to IETF RFC 4122
|
||||
// into an AVUUID.
|
||||
func AvUuidParse(in string, uu AVUUID) int32 {
|
||||
inPtr, inFunc := StringCasting(in)
|
||||
defer inFunc()
|
||||
return (int32)(C.av_uuid_parse((*C.char)(inPtr), (*C.uint8_t)(&uu[0])))
|
||||
}
|
||||
|
||||
// AvUuidUrnParse parses a URN representation of a UUID, as specified at IETF RFC 4122,
|
||||
// into an AVUUID.
|
||||
func AvUuidUrnParse(in string, uu AVUUID) int32 {
|
||||
inPtr, inFunc := StringCasting(in)
|
||||
defer inFunc()
|
||||
return (int32)(C.av_uuid_urn_parse((*C.char)(inPtr), (*C.uint8_t)(&uu[0])))
|
||||
}
|
||||
|
||||
// NONEED: av_uuid_parse_range
|
||||
|
||||
// AvUuidUnparse serializes a AVUUID into a string representation according to IETF RFC 4122.
|
||||
func AvUuidUnparse(uu AVUUID) string {
|
||||
buf := make([]C.char, AV_UUID_STR_SIZE)
|
||||
C.av_uuid_unparse((*C.uint8_t)(&uu[0]), (*C.char)(&buf[0]))
|
||||
return C.GoString(&buf[0])
|
||||
}
|
||||
|
||||
// AvUuidEqual compares two UUIDs for equality.
|
||||
func AvUuidEqual(uu1, uu2 AVUUID) int32 {
|
||||
return (int32)(C.av_uuid_equal((*C.uint8_t)(&uu1[0]), (*C.uint8_t)(&uu2[0])))
|
||||
}
|
||||
|
||||
// AvUuidCopy copies the bytes of src into dest.
|
||||
func AvUuidCopy(dest, src AVUUID) {
|
||||
C.av_uuid_copy((*C.uint8_t)(&dest[0]), (*C.uint8_t)(&src[0]))
|
||||
}
|
||||
|
||||
// AvUuidNil sets a UUID to the nil UUID.
|
||||
func AvUuidNil(uu AVUUID) {
|
||||
C.av_uuid_nil((*C.uint8_t)(&uu[0]))
|
||||
}
|
@@ -10,6 +10,7 @@ package ffmpeg
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
// AVXTEA
|
||||
type AVXTEA C.struct_AVXTEA
|
||||
|
||||
// GetKey gets `AVXTEA.key` value.
|
||||
|
@@ -74,12 +74,12 @@ func initFilters(decCtx *ffmpeg.AVCodecContext, fmtCtx *ffmpeg.AVFormatContext,
|
||||
}
|
||||
|
||||
// buffer audio source: the decoded frames from the decoder will be inserted here.
|
||||
if decCtx.GetChannelLayout() == 0 {
|
||||
decCtx.SetChannelLayout(uint64(ffmpeg.AvGetDefaultChannelLayout(decCtx.GetChannels())))
|
||||
if decCtx.GetChLayoutAddr().GetOrder() == ffmpeg.AV_CHANNEL_ORDER_UNSPEC {
|
||||
ffmpeg.AvChannelLayoutDefault(decCtx.GetChLayoutAddr(), decCtx.GetChLayoutAddr().GetNbChannels())
|
||||
}
|
||||
args = fmt.Sprintf("time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%d",
|
||||
timeBase.GetNum(), timeBase.GetDen(), decCtx.GetSampleRate(),
|
||||
ffmpeg.AvGetSampleFmtName(decCtx.GetSampleFmt()), decCtx.GetChannelLayout())
|
||||
ffmpeg.AvGetSampleFmtName(decCtx.GetSampleFmt()), decCtx.GetChLayoutAddr().GetNbChannels())
|
||||
|
||||
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_INFO, "audio source args: %s\n", args)
|
||||
|
||||
@@ -148,7 +148,7 @@ func initFilters(decCtx *ffmpeg.AVCodecContext, fmtCtx *ffmpeg.AVFormatContext,
|
||||
// Print summary of the sink buffer
|
||||
// Note: args buffer is reused to store channel layout string
|
||||
outlink = buffersinkCtx.GetInputs()[0]
|
||||
args = ffmpeg.AvGetChannelLayoutString(-1, outlink.GetChannelLayout())
|
||||
args = ffmpeg.AvChannelLayoutDescribe(outlink.GetChLayoutAddr())
|
||||
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_INFO, "Output: srate:%dHz fmt:%s chlayout:%s\n",
|
||||
outlink.GetSampleRate(),
|
||||
ffmpeg.AvStringIfNull(ffmpeg.AvGetSampleFmtName(outlink.GetFormat()), "?"),
|
||||
@@ -161,7 +161,7 @@ end:
|
||||
}
|
||||
|
||||
func printFrame(frame *ffmpeg.AVFrame) {
|
||||
n := frame.GetNbSamples() * ffmpeg.AvGetChannelLayoutNbChannels(frame.GetChannelLayout())
|
||||
n := frame.GetNbSamples() * frame.GetChLayoutAddr().GetNbChannels()
|
||||
p := (*uint16)(unsafe.Pointer(frame.GetData()[0]))
|
||||
data := unsafe.Slice(p, n)
|
||||
for i := int32(0); i < n; i++ {
|
@@ -302,7 +302,7 @@ func main() {
|
||||
|
||||
if videoStream != nil {
|
||||
fmt.Fprintf(os.Stdout, "Play the output video file with the command:\n"+
|
||||
"ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
|
||||
"ffplay -f rawvideo -pixel_format %s -video_size %dx%d %s\n",
|
||||
ffmpeg.AvGetPixFmtName(videoDecCtx.GetPixFmt()),
|
||||
videoDecCtx.GetWidth(), videoDecCtx.GetHeight(), videoDstFilename)
|
||||
}
|
@@ -10,7 +10,7 @@ import (
|
||||
ffmpeg "github.com/qrtc/ffmpeg-dev-go"
|
||||
)
|
||||
|
||||
// check that a given sample format is supported by the encoder
|
||||
// check that a given sample format is supported by the encoder.
|
||||
func checkSampleFmt(codec *ffmpeg.AVCodec, sampleFmt ffmpeg.AVSampleFormat) int32 {
|
||||
for _, f := range codec.GetSampleFmts() {
|
||||
if f == sampleFmt {
|
||||
@@ -34,25 +34,28 @@ func selectSampleRate(codec *ffmpeg.AVCodec) int32 {
|
||||
return bestSamplerate
|
||||
}
|
||||
|
||||
// select layout with the highest channel count
|
||||
func selectChannelLayout(codec *ffmpeg.AVCodec) uint64 {
|
||||
var bestChLayout uint64
|
||||
var bestNbChannels int32
|
||||
ls := codec.GetChannelLayouts()
|
||||
if len(ls) == 0 {
|
||||
return ffmpeg.AV_CH_LAYOUT_STEREO
|
||||
// select layout with the highest channel count.
|
||||
func selectChannelLayout(codec *ffmpeg.AVCodec, dst *ffmpeg.AVChannelLayout) int32 {
|
||||
var (
|
||||
bestChLayout *ffmpeg.AVChannelLayout
|
||||
bestNbChannels int32
|
||||
)
|
||||
|
||||
chls := codec.GetChLayouts()
|
||||
if len(chls) == 0 {
|
||||
return ffmpeg.AvChannelLayoutCopy(dst, ffmpeg.AV_CHANNEL_LAYOUT_STEREO())
|
||||
}
|
||||
|
||||
for _, l := range ls {
|
||||
nbChannels := ffmpeg.AvGetChannelLayoutNbChannels(l)
|
||||
for i := range chls {
|
||||
nbChannels := chls[i].GetNbChannels()
|
||||
|
||||
if nbChannels > bestNbChannels {
|
||||
bestChLayout = l
|
||||
bestChLayout = &chls[i]
|
||||
bestNbChannels = nbChannels
|
||||
}
|
||||
}
|
||||
|
||||
return bestChLayout
|
||||
return ffmpeg.AvChannelLayoutCopy(dst, bestChLayout)
|
||||
}
|
||||
|
||||
func encode(ctx *ffmpeg.AVCodecContext, frame *ffmpeg.AVFrame, pkt *ffmpeg.AVPacket, output *os.File) {
|
||||
@@ -111,8 +114,10 @@ func main() {
|
||||
|
||||
// select other audio parameters supported by the encoder
|
||||
avctx.SetSampleRate(selectSampleRate(codec))
|
||||
avctx.SetChannelLayout(selectChannelLayout(codec))
|
||||
avctx.SetChannels(ffmpeg.AvGetChannelLayoutNbChannels(avctx.GetChannelLayout()))
|
||||
if selectChannelLayout(codec, avctx.GetChLayoutAddr()) < 0 {
|
||||
fmt.Fprintf(os.Stderr, "codec context select channel layout failed\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// open it
|
||||
if ffmpeg.AvCodecOpen2(avctx, codec, nil) < 0 {
|
||||
@@ -141,7 +146,10 @@ func main() {
|
||||
|
||||
frame.SetNbSamples(avctx.GetFrameSize())
|
||||
frame.SetFormat(avctx.GetSampleFmt())
|
||||
frame.SetChannelLayout(avctx.GetChannelLayout())
|
||||
if ffmpeg.AvChannelLayoutCopy(frame.GetChLayoutAddr(), avctx.GetChLayoutAddr()) < 0 {
|
||||
fmt.Fprintf(os.Stderr, "frame copy channel layout failed\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// allocate the data buffers
|
||||
if ret := ffmpeg.AvFrameGetBuffer(frame, 0); ret < 0 {
|
||||
|
@@ -16,11 +16,14 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
INPUT_SAMPLERATE = 48000
|
||||
INPUT_FORMAT = ffmpeg.AV_SAMPLE_FMT_FLTP
|
||||
INPUT_CHANNEL_LAYOUT = ffmpeg.AV_CH_LAYOUT_5POINT0
|
||||
VOLUME_VAL = 0.90
|
||||
FRAME_SIZE = 1024
|
||||
INPUT_SAMPLERATE = 48000
|
||||
INPUT_FORMAT = ffmpeg.AV_SAMPLE_FMT_FLTP
|
||||
VOLUME_VAL = 0.90
|
||||
FRAME_SIZE = 1024
|
||||
)
|
||||
|
||||
var (
|
||||
INPUT_CHANNEL_LAYOUT = ffmpeg.AV_CHANNEL_LAYOUT_5POINT0()
|
||||
)
|
||||
|
||||
func initFilterGraph() (graph *ffmpeg.AVFilterGraph, src *ffmpeg.AVFilterContext, sink *ffmpeg.AVFilterContext, ret int32) {
|
||||
@@ -53,8 +56,10 @@ func initFilterGraph() (graph *ffmpeg.AVFilterGraph, src *ffmpeg.AVFilterContext
|
||||
return nil, nil, nil, ffmpeg.AVERROR(syscall.ENOMEM)
|
||||
}
|
||||
|
||||
// Set the filter options through the AVOptions API.
|
||||
ffmpeg.AvOptSet(abufferCtx, "channel_layout",
|
||||
ffmpeg.AvGetChannelLayoutString(0, INPUT_CHANNEL_LAYOUT), ffmpeg.AV_OPT_SEARCH_CHILDREN)
|
||||
ffmpeg.AvChannelLayoutDescribe(INPUT_CHANNEL_LAYOUT),
|
||||
ffmpeg.AV_OPT_SEARCH_CHILDREN)
|
||||
ffmpeg.AvOptSet(abufferCtx, "sample_fmt",
|
||||
ffmpeg.AvGetSampleFmtName(INPUT_FORMAT), ffmpeg.AV_OPT_SEARCH_CHILDREN)
|
||||
ffmpeg.AvOptSetQ(abufferCtx, "time_base",
|
||||
@@ -155,7 +160,7 @@ func initFilterGraph() (graph *ffmpeg.AVFilterGraph, src *ffmpeg.AVFilterContext
|
||||
// example just prints the MD5 checksum of each plane to stdout.
|
||||
func processOutput(md5 *ffmpeg.AVMD5, frame *ffmpeg.AVFrame) int32 {
|
||||
planar := ffmpeg.AvSampleFmtIsPlanar(frame.GetFormat())
|
||||
channels := ffmpeg.AvGetChannelLayoutNbChannels(frame.GetChannelLayout())
|
||||
channels := frame.GetChLayoutAddr().GetNbChannels()
|
||||
planes := channels
|
||||
if planar == 0 {
|
||||
planes = 1
|
||||
@@ -171,7 +176,7 @@ func processOutput(md5 *ffmpeg.AVMD5, frame *ffmpeg.AVFrame) int32 {
|
||||
var checksum [16]uint8
|
||||
|
||||
ffmpeg.AvMd5Init(md5)
|
||||
ffmpeg.AvMd5Sum(&checksum[0], &data[i][0], planeSize)
|
||||
ffmpeg.AvMd5Sum(&checksum[0], &data[i][0], uintptr(planeSize))
|
||||
|
||||
fmt.Fprintf(os.Stdout, "plane %d: 0x", i)
|
||||
for j := 0; j < len(checksum); j++ {
|
||||
@@ -190,7 +195,7 @@ func getInput(frame *ffmpeg.AVFrame, frameNum int32) int32 {
|
||||
// Set up the frame properties and allocate the buffer for the data.
|
||||
frame.SetSampleRate(INPUT_SAMPLERATE)
|
||||
frame.SetFormat(INPUT_FORMAT)
|
||||
frame.SetChannelLayout(INPUT_CHANNEL_LAYOUT)
|
||||
ffmpeg.AvChannelLayoutCopy(frame.GetChLayoutAddr(), INPUT_CHANNEL_LAYOUT)
|
||||
frame.SetNbSamples(FRAME_SIZE)
|
||||
frame.SetPts(int64(frameNum) * FRAME_SIZE)
|
||||
|
||||
|
@@ -116,17 +116,7 @@ func addStream(ost *outputStream, oc *ffmpeg.AVFormatContext, codecId ffmpeg.AVC
|
||||
}
|
||||
}
|
||||
}
|
||||
c.SetChannels(ffmpeg.AvGetChannelLayoutNbChannels(c.GetChannelLayout()))
|
||||
c.SetChannelLayout(ffmpeg.AV_CH_LAYOUT_STEREO)
|
||||
if len(codec.GetChannelLayouts()) > 0 {
|
||||
c.SetChannelLayout(codec.GetChannelLayouts()[0])
|
||||
for _, cl := range codec.GetChannelLayouts() {
|
||||
if cl == ffmpeg.AV_CH_LAYOUT_STEREO {
|
||||
c.SetChannelLayout(ffmpeg.AV_CH_LAYOUT_STEREO)
|
||||
}
|
||||
}
|
||||
}
|
||||
c.SetChannels(ffmpeg.AvGetChannelLayoutNbChannels(c.GetChannelLayout()))
|
||||
ffmpeg.AvChannelLayoutCopy(c.GetChLayoutAddr(), ffmpeg.AV_CHANNEL_LAYOUT_STEREO())
|
||||
ost.st.SetTimeBase(ffmpeg.AvMakeQ(1, c.GetSampleRate()))
|
||||
|
||||
case ffmpeg.AVMEDIA_TYPE_VIDEO:
|
||||
@@ -170,14 +160,14 @@ func addStream(ost *outputStream, oc *ffmpeg.AVFormatContext, codecId ffmpeg.AVC
|
||||
// **************************************************************
|
||||
// audio output
|
||||
|
||||
func allocAudioFrame(sampleFmt ffmpeg.AVSampleFormat, channelLayout uint64, sampleRate int32, nbSamples int32) (
|
||||
func allocAudioFrame(sampleFmt ffmpeg.AVSampleFormat, channelLayout *ffmpeg.AVChannelLayout, sampleRate int32, nbSamples int32) (
|
||||
frame *ffmpeg.AVFrame) {
|
||||
if frame = ffmpeg.AvFrameAlloc(); frame == nil {
|
||||
panic("Error allocating an audio frame")
|
||||
}
|
||||
|
||||
frame.SetFormat(sampleFmt)
|
||||
frame.SetChannelLayout(channelLayout)
|
||||
ffmpeg.AvChannelLayoutCopy(frame.GetChLayoutAddr(), channelLayout)
|
||||
frame.SetSampleRate(sampleRate)
|
||||
frame.SetNbSamples(nbSamples)
|
||||
|
||||
@@ -216,9 +206,9 @@ func openAudio(oc *ffmpeg.AVFormatContext, codec *ffmpeg.AVCodec, ost *outputStr
|
||||
} else {
|
||||
nbSamples = c.GetFrameSize()
|
||||
}
|
||||
ost.frame = allocAudioFrame(c.GetSampleFmt(), c.GetChannelLayout(),
|
||||
ost.frame = allocAudioFrame(c.GetSampleFmt(), c.GetChLayoutAddr(),
|
||||
c.GetSampleRate(), nbSamples)
|
||||
ost.tmpFrame = allocAudioFrame(ffmpeg.AV_SAMPLE_FMT_S16, c.GetChannelLayout(),
|
||||
ost.tmpFrame = allocAudioFrame(ffmpeg.AV_SAMPLE_FMT_S16, c.GetChLayoutAddr(),
|
||||
c.GetSampleRate(), nbSamples)
|
||||
|
||||
// copy the stream parameters to the muxer
|
||||
@@ -232,10 +222,10 @@ func openAudio(oc *ffmpeg.AVFormatContext, codec *ffmpeg.AVCodec, ost *outputStr
|
||||
}
|
||||
|
||||
// set options
|
||||
ffmpeg.AvOptSetInt(ost.swrCtx, "in_channel_count", c.GetChannels(), 0)
|
||||
ffmpeg.AvOptSetChlayout(ost.swrCtx, "in_chlayout", c.GetChLayoutAddr(), 0)
|
||||
ffmpeg.AvOptSetInt(ost.swrCtx, "in_sample_rate", c.GetSampleRate(), 0)
|
||||
ffmpeg.AvOptSetSampleFmt(ost.swrCtx, "in_sample_fmt", ffmpeg.AV_SAMPLE_FMT_S16, 0)
|
||||
ffmpeg.AvOptSetInt(ost.swrCtx, "out_channel_count", c.GetChannels(), 0)
|
||||
ffmpeg.AvOptSetChlayout(ost.swrCtx, "out_chlayout", c.GetChLayoutAddr(), 0)
|
||||
ffmpeg.AvOptSetInt(ost.swrCtx, "out_sample_rate", c.GetSampleRate(), 0)
|
||||
ffmpeg.AvOptSetSampleFmt(ost.swrCtx, "out_sample_fmt", c.GetSampleFmt(), 0)
|
||||
|
||||
@@ -272,7 +262,7 @@ func getAudioFrame(ost *outputStream) (frame *ffmpeg.AVFrame) {
|
||||
}
|
||||
|
||||
// encode one audio frame and send it to the muxer
|
||||
// return 1 when encoding is finished, 0 otherwise
|
||||
// return 1 when encoding is finished, 0 otherwise.
|
||||
func writeAudioFrame(oc *ffmpeg.AVFormatContext, ost *outputStream) bool {
|
||||
var (
|
||||
c *ffmpeg.AVCodecContext
|
||||
@@ -401,7 +391,7 @@ func getVideoFrame(ost *outputStream) *ffmpeg.AVFrame {
|
||||
return nil
|
||||
}
|
||||
|
||||
// when we pass a frame to the encoder, it may keep a reference to it
|
||||
// when we pass a frame to the encoder, it may keep a reference to it
|
||||
// internally; make sure we do not overwrite it here
|
||||
if ffmpeg.AvFrameMakeWritable(ost.frame) < 0 {
|
||||
panic("Make video frame writable failed")
|
||||
@@ -433,8 +423,8 @@ func getVideoFrame(ost *outputStream) *ffmpeg.AVFrame {
|
||||
return ost.frame
|
||||
}
|
||||
|
||||
// encode one video frame and send it to the muxer
|
||||
// return 1 when encoding is finished, 0 otherwise
|
||||
// encode one video frame and send it to the muxer,
|
||||
// return 1 when encoding is finished, 0 otherwise.
|
||||
func writeVideoFrame(oc *ffmpeg.AVFormatContext, ost *outputStream) bool {
|
||||
return writeFrame(oc, ost.enc, ost.st, getVideoFrame(ost))
|
||||
}
|
@@ -1,5 +1,192 @@
|
||||
//go:build ffmpeg_hw_qsv
|
||||
|
||||
package main
|
||||
|
||||
func main() {
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
|
||||
struct AVCodecContext;
|
||||
|
||||
int get_format(struct AVCodecContext *avctx, int *pix_fmts) {
|
||||
// TODO.
|
||||
return -1;
|
||||
}
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
ffmpeg "github.com/qrtc/ffmpeg-dev-go"
|
||||
)
|
||||
|
||||
type decodeContext struct {
|
||||
hwDeviceRef *ffmpeg.AVBufferRef
|
||||
}
|
||||
|
||||
func decodePacket(decode *decodeContext, decoderCtx *ffmpeg.AVCodecContext,
|
||||
frame *ffmpeg.AVFrame, swFrame *ffmpeg.AVFrame,
|
||||
pkt *ffmpeg.AVPacket, outputCtx *ffmpeg.AVIOContext) (ret int32) {
|
||||
var (
|
||||
data [][]uint8
|
||||
)
|
||||
if ret = ffmpeg.AvCodecSendPacket(decoderCtx, pkt); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error during decoding\n")
|
||||
return ret
|
||||
}
|
||||
|
||||
for ret >= 0 {
|
||||
ret = ffmpeg.AvCodecReceiveFrame(decoderCtx, frame)
|
||||
if ret == ffmpeg.AVERROR(syscall.EAGAIN) || ret == ffmpeg.AVERROR_EOF {
|
||||
break
|
||||
} else if ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error while decoding.\n")
|
||||
return ret
|
||||
}
|
||||
|
||||
// A real program would do something useful with the decoded frame here.
|
||||
// We just retrieve the raw data and write it to a file, which is rather
|
||||
// useless but pedagogic.
|
||||
if ret = ffmpeg.AvHWFrameTransferData(swFrame, frame, 0); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error transferring the data to system memory\n")
|
||||
goto fail
|
||||
}
|
||||
|
||||
data = ffmpeg.SliceSlice(&swFrame.GetData()[0], len(swFrame.GetData()),
|
||||
swFrame.GetWidth()*swFrame.GetHeight())
|
||||
for i := 0; i < len(swFrame.GetData()) && data[i] != nil; i++ {
|
||||
for j := 0; j < int(swFrame.GetHeight()>>ffmpeg.CondExpr(i > 0, 1, 0)); j++ {
|
||||
ffmpeg.AvIOWrite(outputCtx, &data[i][j*int(swFrame.GetLinesize()[i])], swFrame.GetWidth())
|
||||
}
|
||||
}
|
||||
fail:
|
||||
ffmpeg.AvFrameUnref(swFrame)
|
||||
ffmpeg.AvFrameUnref(frame)
|
||||
|
||||
if ret < 0 {
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func main() {
|
||||
var (
|
||||
intputCtx *ffmpeg.AVFormatContext
|
||||
videoSt *ffmpeg.AVStream
|
||||
decoderCtx *ffmpeg.AVCodecContext
|
||||
decoder *ffmpeg.AVCodec
|
||||
pkt ffmpeg.AVPacket
|
||||
frame, swFrame *ffmpeg.AVFrame
|
||||
decode = &decodeContext{}
|
||||
outputCtx *ffmpeg.AVIOContext
|
||||
ret int32
|
||||
)
|
||||
|
||||
if len(os.Args) < 3 {
|
||||
fmt.Fprintf(os.Stderr, "Usage: %s <input file> <output file>\n", os.Args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// open the input file
|
||||
if ret = ffmpeg.AvFormatOpenInput(&intputCtx, os.Args[1], nil, nil); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Cannot open input file '%s': ", os.Args[1])
|
||||
goto finish
|
||||
}
|
||||
|
||||
// find the first H.264 video stream
|
||||
for i := 0; i < int(intputCtx.GetNbStreams()); i++ {
|
||||
st := intputCtx.GetStreams()[i]
|
||||
if st.GetCodecpar().GetCodecId() == ffmpeg.AV_CODEC_ID_H264 && videoSt == nil {
|
||||
videoSt = st
|
||||
} else {
|
||||
st.SetDiscard(ffmpeg.AVDISCARD_ALL)
|
||||
}
|
||||
}
|
||||
if videoSt == nil {
|
||||
fmt.Fprintf(os.Stderr, "No H.264 video stream in the input file\n")
|
||||
goto finish
|
||||
}
|
||||
|
||||
// open the hardware device
|
||||
if ret = ffmpeg.AvHWDeviceCtxCreate(&decode.hwDeviceRef, ffmpeg.AV_HWDEVICE_TYPE_QSV,
|
||||
"auto", nil, 0); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Cannot open the hardware device\n")
|
||||
goto finish
|
||||
}
|
||||
|
||||
// initialize the decoder
|
||||
if decoder = ffmpeg.AvCodecFindDecoderByName("h264_qsv"); decoder == nil {
|
||||
fmt.Fprintf(os.Stderr, "The QSV decoder is not present in libavcodec\n")
|
||||
goto finish
|
||||
}
|
||||
|
||||
decoderCtx.SetCodecId(ffmpeg.AV_CODEC_ID_H264)
|
||||
if videoSt.GetCodecpar().GetExtradataSize() != 0 {
|
||||
decoderCtx.SetExtradata((*uint8)(ffmpeg.AvMallocz(videoSt.GetCodecpar().GetExtradataSize() +
|
||||
ffmpeg.AV_INPUT_BUFFER_PADDING_SIZE)))
|
||||
if decoderCtx.GetExtradata() == nil {
|
||||
ret = ffmpeg.AVERROR(syscall.ENOMEM)
|
||||
goto finish
|
||||
}
|
||||
copy(unsafe.Slice(decoderCtx.GetExtradata(), videoSt.GetCodecpar().GetExtradataSize()),
|
||||
unsafe.Slice(videoSt.GetCodecpar().GetExtradata(), videoSt.GetCodecpar().GetExtradataSize()))
|
||||
}
|
||||
|
||||
decoderCtx.SetOpaque(decode.hwDeviceRef)
|
||||
decoderCtx.SetGetFormat((ffmpeg.AVCodecContextGetFormatFunc)(C.get_format))
|
||||
|
||||
if ret = ffmpeg.AvCodecOpen2(decoderCtx, nil, nil); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error opening the decoder: ")
|
||||
goto finish
|
||||
}
|
||||
|
||||
// open the output stream
|
||||
if ret = ffmpeg.AvIOOpen(&outputCtx, os.Args[2], ffmpeg.AVIO_FLAG_WRITE); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error opening the output context: ")
|
||||
goto finish
|
||||
}
|
||||
|
||||
frame = ffmpeg.AvFrameAlloc()
|
||||
swFrame = ffmpeg.AvFrameAlloc()
|
||||
if frame == nil || swFrame == nil {
|
||||
ret = ffmpeg.AVERROR(syscall.ENOMEM)
|
||||
goto finish
|
||||
}
|
||||
|
||||
// actual decoding
|
||||
for ret >= 0 {
|
||||
if ret = ffmpeg.AvReadFrame(intputCtx, &pkt); ret < 0 {
|
||||
break
|
||||
}
|
||||
|
||||
if pkt.GetStreamIndex() == videoSt.GetIndex() {
|
||||
ret = decodePacket(decode, decoderCtx, frame, swFrame, &pkt, outputCtx)
|
||||
}
|
||||
|
||||
ffmpeg.AvPacketUnref(&pkt)
|
||||
}
|
||||
|
||||
finish:
|
||||
if ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", ffmpeg.AvErr2str(ret))
|
||||
}
|
||||
|
||||
ffmpeg.AvFormatCloseInput(&intputCtx)
|
||||
|
||||
ffmpeg.AvFrameFree(&frame)
|
||||
ffmpeg.AvFrameFree(&swFrame)
|
||||
|
||||
ffmpeg.AvCodecFreeContext(&decoderCtx)
|
||||
|
||||
ffmpeg.AvBufferUnref(&decode.hwDeviceRef)
|
||||
|
||||
ffmpeg.AvIOClose(outputCtx)
|
||||
|
||||
os.Exit(int(ret))
|
||||
}
|
||||
|
@@ -59,7 +59,8 @@ func main() {
|
||||
srcLinesize, dstLinesize int32
|
||||
srcNbSamples, dstNbSamples int32 = 1024, 0
|
||||
maxDstNbSamples int32
|
||||
srcChLayout, dstChLayout = ffmpeg.AV_CH_LAYOUT_STEREO, ffmpeg.AV_CH_LAYOUT_SURROUND
|
||||
srcChLayout = ffmpeg.AV_CHANNEL_LAYOUT_STEREO()
|
||||
dstChLayout = ffmpeg.AV_CHANNEL_LAYOUT_SURROUND()
|
||||
srcSampleFmt, dstSampleFmt = ffmpeg.AV_SAMPLE_FMT_DBL, ffmpeg.AV_SAMPLE_FMT_S16
|
||||
swrCtx *ffmpeg.SwrContext
|
||||
ret int32
|
||||
@@ -92,11 +93,11 @@ func main() {
|
||||
}
|
||||
|
||||
// set options
|
||||
ffmpeg.AvOptSetInt(swrCtx, "in_channel_layout", srcChLayout, 0)
|
||||
ffmpeg.AvOptSetChlayout(swrCtx, "in_chlayout", srcChLayout, 0)
|
||||
ffmpeg.AvOptSetInt(swrCtx, "in_sample_rate", srcRate, 0)
|
||||
ffmpeg.AvOptSetSampleFmt(swrCtx, "in_sample_fmt", srcSampleFmt, 0)
|
||||
|
||||
ffmpeg.AvOptSetInt(swrCtx, "out_channel_layout", dstChLayout, 0)
|
||||
ffmpeg.AvOptSetChlayout(swrCtx, "out_chlayout", dstChLayout, 0)
|
||||
ffmpeg.AvOptSetInt(swrCtx, "out_sample_rate", dstRate, 0)
|
||||
ffmpeg.AvOptSetSampleFmt(swrCtx, "out_sample_fmt", dstSampleFmt, 0)
|
||||
|
||||
@@ -107,7 +108,7 @@ func main() {
|
||||
}
|
||||
|
||||
// allocate source and destination samples buffers
|
||||
srcNbChannels = ffmpeg.AvGetChannelLayoutNbChannels(srcChLayout)
|
||||
srcNbChannels = srcChLayout.GetNbChannels()
|
||||
if ret = ffmpeg.AvSamplesAllocArrayAndSamples(&srcData, &srcLinesize, srcNbChannels,
|
||||
srcNbSamples, srcSampleFmt, 0); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Could not allocate source samples\n")
|
||||
@@ -121,7 +122,7 @@ func main() {
|
||||
maxDstNbSamples = dstNbSamples
|
||||
|
||||
// buffer is going to be directly written to a rawaudio file, no alignment
|
||||
dstNbChannels = ffmpeg.AvGetChannelLayoutNbChannels(dstChLayout)
|
||||
dstNbChannels = dstChLayout.GetNbChannels()
|
||||
if ret = ffmpeg.AvSamplesAllocArrayAndSamples(&dstData, &dstLinesize, dstNbChannels,
|
||||
dstNbSamples, dstSampleFmt, 0); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Could not allocate destination samples\n")
|
||||
@@ -163,8 +164,8 @@ func main() {
|
||||
goto end
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "Resampling succeeded. Play the output file with the command:\n"+
|
||||
"ffplay -f %s -channel_layout %d -channels %d -ar %d %s\n",
|
||||
_fmt, dstChLayout, dstNbChannels, dstRate, dstFilename)
|
||||
"ffplay -f %s -channel_layout %s -channels %d -ar %d %s\n",
|
||||
_fmt, ffmpeg.AvChannelLayoutDescribe(dstChLayout), dstNbChannels, dstRate, dstFilename)
|
||||
|
||||
end:
|
||||
dstFile.Close()
|
@@ -101,7 +101,7 @@ func main() {
|
||||
}
|
||||
|
||||
fmt.Fprintf(os.Stderr, "Scaling succeeded. Play the output file with the command:\n"+
|
||||
"ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
|
||||
"ffplay -f rawvideo -pixel_format %s -video_size %dx%d %s\n",
|
||||
ffmpeg.AvGetPixFmtName(dstPixFmt), dstW, dstH, dstFilename)
|
||||
|
||||
end:
|
@@ -134,8 +134,7 @@ func openOutputFile(filename string, inputCodecContext *ffmpeg.AVCodecContext) (
|
||||
|
||||
// Set the basic encoder parameters.
|
||||
// The input file's sample rate is used to avoid a sample rate conversion.
|
||||
avctx.SetChannels(OUTPUT_CHANNELS)
|
||||
avctx.SetChannelLayout(uint64(ffmpeg.AvGetDefaultChannelLayout(OUTPUT_CHANNELS)))
|
||||
ffmpeg.AvChannelLayoutDefault(avctx.GetChLayoutAddr(), OUTPUT_CHANNELS)
|
||||
avctx.SetSampleRate(inputCodecContext.GetSampleRate())
|
||||
avctx.SetSampleFmt(outputCodec.GetSampleFmts()[0])
|
||||
avctx.SetBitRate(OUTPUT_BIT_RATE)
|
||||
@@ -207,14 +206,14 @@ func initResampler(inputCodecContext, outputCodecContext *ffmpeg.AVCodecContext)
|
||||
// Default channel layouts based on the number of channels
|
||||
// are assumed for simplicity (they are sometimes not detected
|
||||
// properly by the demuxer and/or decoder).
|
||||
if resampleContext = ffmpeg.SwrAllocSetOpts(nil,
|
||||
ffmpeg.AvGetDefaultChannelLayout(outputCodecContext.GetChannels()),
|
||||
if ret = ffmpeg.SwrAllocSetOpts2(&resampleContext,
|
||||
outputCodecContext.GetChLayoutAddr(),
|
||||
outputCodecContext.GetSampleFmt(),
|
||||
outputCodecContext.GetSampleRate(),
|
||||
ffmpeg.AvGetDefaultChannelLayout(inputCodecContext.GetChannels()),
|
||||
inputCodecContext.GetChLayoutAddr(),
|
||||
inputCodecContext.GetSampleFmt(),
|
||||
inputCodecContext.GetSampleRate(),
|
||||
0, nil); resampleContext == nil {
|
||||
0, nil); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Could not allocate resample context\n")
|
||||
return nil, ffmpeg.AVERROR(syscall.ENOMEM)
|
||||
}
|
||||
@@ -349,7 +348,7 @@ func convertSamples(inputData, convertedData **uint8,
|
||||
|
||||
// Add converted input audio samples to the FIFO buffer for later processing.
|
||||
func addSamplesToFifo(fifo *ffmpeg.AVAudioFifo, convertedInputSamples **uint8, frameSize int32) int32 {
|
||||
// Make the FIFO as large as it needs to be to hold both,
|
||||
// Make the FIFO as large as it needs to be to hold both,
|
||||
// the old and the new samples.
|
||||
if ret := ffmpeg.AvAudioFifoRealloc(fifo, ffmpeg.AvAudioFifoSize(fifo)+frameSize); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Could not reallocate FIFO\n")
|
||||
@@ -443,7 +442,7 @@ func initOutputFrame(outputcodecContext *ffmpeg.AVCodecContext,
|
||||
// Default channel layouts based on the number of channels
|
||||
// are assumed for simplicity.
|
||||
frame.SetNbSamples(frameSize)
|
||||
frame.SetChannelLayout(outputcodecContext.GetChannelLayout())
|
||||
ffmpeg.AvChannelLayoutCopy(frame.GetChLayoutAddr(), outputcodecContext.GetChLayoutAddr())
|
||||
frame.SetFormat(outputcodecContext.GetSampleFmt())
|
||||
frame.SetSampleRate(outputcodecContext.GetSampleRate())
|
||||
|
||||
|
@@ -124,8 +124,10 @@ func openOutputFile(ifmtCtx *ffmpeg.AVFormatContext, streamCtx []streamContext,
|
||||
encCtx.SetTimeBase(ffmpeg.AvInvQ(decCtx.GetFramerate()))
|
||||
} else {
|
||||
encCtx.SetSampleRate(decCtx.GetSampleRate())
|
||||
encCtx.SetChannelLayout(decCtx.GetChannelLayout())
|
||||
encCtx.SetChannels(ffmpeg.AvGetChannelLayoutNbChannels(encCtx.GetChannelLayout()))
|
||||
if ret = ffmpeg.AvChannelLayoutCopy(encCtx.GetChLayoutAddr(),
|
||||
decCtx.GetChLayoutAddr()); ret < 0 {
|
||||
return nil, ret
|
||||
}
|
||||
// take first format from list of supported formats
|
||||
encCtx.SetSampleFmt(encoder.GetSampleFmts()[0])
|
||||
encCtx.SetTimeBase(ffmpeg.AvMakeQ(1, encCtx.GetSampleRate()))
|
||||
@@ -234,13 +236,14 @@ func initFilter(fctx *filteringContext, decCtx, encCtx *ffmpeg.AVCodecContext, f
|
||||
goto end
|
||||
}
|
||||
|
||||
if decCtx.GetChannelLayout() == 0 {
|
||||
decCtx.SetChannelLayout(uint64(ffmpeg.AvGetDefaultChannelLayout(decCtx.GetChannels())))
|
||||
if decCtx.GetChLayoutAddr().GetOrder() == ffmpeg.AV_CHANNEL_ORDER_UNSPEC {
|
||||
ffmpeg.AvChannelLayoutDefault(decCtx.GetChLayoutAddr(), decCtx.GetChLayoutAddr().GetNbChannels())
|
||||
}
|
||||
|
||||
args = fmt.Sprintf("time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%d",
|
||||
args = fmt.Sprintf("time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=%s",
|
||||
decCtx.GetTimeBaseAddr().GetNum(), decCtx.GetTimeBaseAddr().GetDen(), decCtx.GetSampleRate(),
|
||||
ffmpeg.AvGetSampleFmtName(decCtx.GetSampleFmt()), decCtx.GetChannelLayout())
|
||||
ffmpeg.AvGetSampleFmtName(decCtx.GetSampleFmt()),
|
||||
ffmpeg.AvChannelLayoutDescribe(decCtx.GetChLayoutAddr()))
|
||||
|
||||
if ret = ffmpeg.AvFilterGraphCreateFilter(&buffersrcCtx, buffersrc, "in",
|
||||
args, nil, filterGraph); ret < 0 {
|
||||
@@ -260,8 +263,8 @@ func initFilter(fctx *filteringContext, decCtx, encCtx *ffmpeg.AVCodecContext, f
|
||||
goto end
|
||||
}
|
||||
|
||||
if ret = ffmpeg.AvOptSetBin(buffersinkCtx, "channel_layouts",
|
||||
encCtx.GetChannelLayoutAddr(), unsafe.Sizeof(encCtx.GetChannelLayout()), ffmpeg.AV_OPT_SEARCH_CHILDREN); ret < 0 {
|
||||
if ret = ffmpeg.AvOptSet(buffersinkCtx, "ch_layouts",
|
||||
ffmpeg.AvChannelLayoutDescribe(encCtx.GetChLayoutAddr()), ffmpeg.AV_OPT_SEARCH_CHILDREN); ret < 0 {
|
||||
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_ERROR, "Cannot set output channel layout\n")
|
||||
goto end
|
||||
}
|
||||
@@ -395,7 +398,7 @@ func filterEncodeWriteFrame(ofmtCtx *ffmpeg.AVFormatContext, streamCtx []streamC
|
||||
)
|
||||
|
||||
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_INFO, "Pushing decoded frame to filters\n")
|
||||
// push the decoded frame into the filtergraph
|
||||
// push the decoded frame into the filtergraph
|
||||
if ret = ffmpeg.AvBuffersrcAddFrameFlags(filter.buffersrcCtx, frame, 0); ret < 0 {
|
||||
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_ERROR, "Error while feeding the filtergraph\n")
|
||||
return ret
|
@@ -1,5 +1,302 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct AVCodecContext;
|
||||
|
||||
static int av_pix_fmt_none;
|
||||
static int av_pix_fmt_vaapi;
|
||||
|
||||
static inline void initial_pix_fmt(int x, int y)
|
||||
{
|
||||
av_pix_fmt_none = x;
|
||||
av_pix_fmt_vaapi = y;
|
||||
}
|
||||
|
||||
int get_vaapi_format(struct AVCodecContext *ctx, int *pix_fmts)
|
||||
{
|
||||
const int *p;
|
||||
|
||||
for (p = pix_fmts; *p != av_pix_fmt_none; p++) {
|
||||
if (*p == av_pix_fmt_vaapi)
|
||||
return *p;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Unable to decode this file using VA-API.\n");
|
||||
return av_pix_fmt_none;
|
||||
}
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
ffmpeg "github.com/qrtc/ffmpeg-dev-go"
|
||||
)
|
||||
|
||||
type streamContext struct {
|
||||
ifmtCtx *ffmpeg.AVFormatContext
|
||||
ofmtCtx *ffmpeg.AVFormatContext
|
||||
|
||||
hwDeviceCtx *ffmpeg.AVBufferRef
|
||||
|
||||
decoderCtx *ffmpeg.AVCodecContext
|
||||
encoderCtx *ffmpeg.AVCodecContext
|
||||
|
||||
videoStream int32
|
||||
ost *ffmpeg.AVStream
|
||||
initialized bool
|
||||
}
|
||||
|
||||
func openInputFile(filename string, sc *streamContext) (ret int32) {
|
||||
var (
|
||||
decoder *ffmpeg.AVCodec
|
||||
video *ffmpeg.AVStream
|
||||
)
|
||||
|
||||
if ret = ffmpeg.AvFormatOpenInput(&sc.ifmtCtx, filename, nil, nil); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Cannot open input file '%s', Error code: %s\n",
|
||||
filename, ffmpeg.AvErr2str(ret))
|
||||
return ret
|
||||
}
|
||||
|
||||
if ret = ffmpeg.AvFormatFindStreamInfo(sc.ifmtCtx, nil); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Cannot find input stream information. Error code: %s\n",
|
||||
ffmpeg.AvErr2str(ret))
|
||||
return ret
|
||||
}
|
||||
|
||||
if ret = ffmpeg.AvFindBestStream(sc.ifmtCtx, ffmpeg.AVMEDIA_TYPE_VIDEO, -1, -1, &decoder, 0); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Cannot find a video stream in the input file."+
|
||||
" Error code: %s\n", ffmpeg.AvErr2str(ret))
|
||||
return ret
|
||||
}
|
||||
sc.videoStream = ret
|
||||
|
||||
if sc.decoderCtx = ffmpeg.AvCodecAllocContext3(decoder); sc.decoderCtx == nil {
|
||||
return ffmpeg.AVERROR(syscall.ENOMEM)
|
||||
}
|
||||
|
||||
video = sc.ifmtCtx.GetStreams()[sc.videoStream]
|
||||
if ret = ffmpeg.AvCodecParametersToContext(sc.decoderCtx, video.GetCodecpar()); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "avcodec_parameters_to_context error. Error code: %s\n",
|
||||
ffmpeg.AvErr2str(ret))
|
||||
return ret
|
||||
}
|
||||
|
||||
sc.decoderCtx.SetHwDeviceCtx(ffmpeg.AvBufferRef(sc.hwDeviceCtx))
|
||||
if sc.decoderCtx.GetHwDeviceCtx() == nil {
|
||||
fmt.Fprintf(os.Stderr, "A hardware device reference create failed.\n")
|
||||
return ffmpeg.AVERROR(syscall.ENOMEM)
|
||||
}
|
||||
C.initial_pix_fmt((C.int)(ffmpeg.AV_PIX_FMT_NONE), (C.int)(ffmpeg.AV_PIX_FMT_VAAPI))
|
||||
sc.decoderCtx.SetGetFormat((ffmpeg.AVCodecContextGetFormatFunc)(C.get_vaapi_format))
|
||||
|
||||
if ret = ffmpeg.AvCodecOpen2(sc.decoderCtx, decoder, nil); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Failed to open codec for decoding. Error code: %s\n",
|
||||
ffmpeg.AvErr2str(ret))
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func encodeWrite(encPkt *ffmpeg.AVPacket, frame *ffmpeg.AVFrame, sc *streamContext) (ret int32) {
|
||||
|
||||
ffmpeg.AvPacketUnref(encPkt)
|
||||
|
||||
if ret = ffmpeg.AvCodecSendFrame(sc.encoderCtx, frame); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error during encoding. Error code: %s\n", ffmpeg.AvErr2str(ret))
|
||||
goto end
|
||||
}
|
||||
for {
|
||||
if ret = ffmpeg.AvCodecReceivePacket(sc.encoderCtx, encPkt); ret != 0 {
|
||||
break
|
||||
}
|
||||
|
||||
encPkt.SetStreamIndex(0)
|
||||
ffmpeg.AvPacketRescaleTs(encPkt, sc.ifmtCtx.GetStreams()[sc.videoStream].GetTimeBase(),
|
||||
sc.ofmtCtx.GetStreams()[0].GetTimeBase())
|
||||
if ret = ffmpeg.AvInterleavedWriteFrame(sc.ofmtCtx, encPkt); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error during writing data to output file. "+
|
||||
"Error code: %s\n", ffmpeg.AvErr2str(ret))
|
||||
return -1
|
||||
}
|
||||
}
|
||||
end:
|
||||
if ret == ffmpeg.AVERROR_EOF {
|
||||
return 0
|
||||
}
|
||||
return ffmpeg.CondExpr(ret == ffmpeg.AVERROR(syscall.EAGAIN), 0, int32(-1))
|
||||
}
|
||||
|
||||
func initialEncCodecCtx(encCodec *ffmpeg.AVCodec, sc *streamContext) (ret int32) {
|
||||
|
||||
// we need to ref hw_frames_ctx of decoder to initialize encoder's codec.
|
||||
// Only after we get a decoded frame, can we obtain its hw_frames_ctx
|
||||
sc.encoderCtx.SetHwFramesCtx(ffmpeg.AvBufferRef(sc.decoderCtx.GetHwFramesCtx()))
|
||||
if sc.encoderCtx.GetHwFramesCtx() == nil {
|
||||
return ffmpeg.AVERROR(syscall.ENOMEM)
|
||||
}
|
||||
// set AVCodecContext Parameters for encoder, here we keep them stay
|
||||
// the same as decoder.
|
||||
// xxx: now the sample can't handle resolution change case.
|
||||
sc.encoderCtx.SetTimeBase(ffmpeg.AvInvQ(sc.decoderCtx.GetFramerate()))
|
||||
sc.encoderCtx.SetPixFmt(ffmpeg.AV_PIX_FMT_VAAPI)
|
||||
sc.encoderCtx.SetWidth(sc.decoderCtx.GetWidth())
|
||||
sc.encoderCtx.SetHeight(sc.decoderCtx.GetHeight())
|
||||
|
||||
if ret = ffmpeg.AvCodecOpen2(sc.encoderCtx, encCodec, nil); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Failed to open encode codec. Error code: %s\n",
|
||||
ffmpeg.AvErr2str(ret))
|
||||
return ret
|
||||
}
|
||||
sc.ost.SetTimeBase(sc.encoderCtx.GetTimeBase())
|
||||
if ret = ffmpeg.AvCodecParametersFromContext(sc.ost.GetCodecpar(), sc.encoderCtx); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Failed to copy the stream parameters. "+
|
||||
"Error code: %s\n", ffmpeg.AvErr2str(ret))
|
||||
return ret
|
||||
}
|
||||
|
||||
// write the stream header
|
||||
if ret = ffmpeg.AvFormatWriteHeader(sc.ofmtCtx, nil); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error while writing stream header. "+
|
||||
"Error code: %s\n", ffmpeg.AvErr2str(ret))
|
||||
return ret
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func decEnc(pkt *ffmpeg.AVPacket, encCodec *ffmpeg.AVCodec, sc *streamContext) (ret int32) {
|
||||
var (
|
||||
frame *ffmpeg.AVFrame
|
||||
)
|
||||
|
||||
if ret = ffmpeg.AvCodecSendPacket(sc.decoderCtx, pkt); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error during decoding. Error code: %s\n", ffmpeg.AvErr2str(ret))
|
||||
return ret
|
||||
}
|
||||
|
||||
for ret >= 0 {
|
||||
if frame = ffmpeg.AvFrameAlloc(); frame == nil {
|
||||
return ffmpeg.AVERROR(syscall.ENOMEM)
|
||||
}
|
||||
|
||||
ret = ffmpeg.AvCodecReceiveFrame(sc.decoderCtx, frame)
|
||||
if ret == ffmpeg.AVERROR(syscall.EAGAIN) || ret == ffmpeg.AVERROR_EOF {
|
||||
ffmpeg.AvFrameFree(&frame)
|
||||
} else if ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error while decoding. Error code: %s\n", ffmpeg.AvErr2str(ret))
|
||||
goto fail
|
||||
}
|
||||
|
||||
if !sc.initialized {
|
||||
if ret = initialEncCodecCtx(encCodec, sc); ret != 0 {
|
||||
fmt.Fprintf(os.Stderr, "Initial EncodeCtx failed.\n")
|
||||
goto fail
|
||||
}
|
||||
sc.initialized = true
|
||||
}
|
||||
|
||||
if ret = encodeWrite(pkt, frame, sc); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Error during encoding and writing.\n")
|
||||
}
|
||||
fail:
|
||||
ffmpeg.AvFrameFree(&frame)
|
||||
if ret < 0 {
|
||||
return ret
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func main() {
|
||||
var (
|
||||
ret int32
|
||||
decPkt *ffmpeg.AVPacket
|
||||
encCodec *ffmpeg.AVCodec
|
||||
sc = &streamContext{}
|
||||
)
|
||||
|
||||
if len(os.Args) != 4 {
|
||||
fmt.Fprintf(os.Stderr, "Usage: %s <input file> <encode codec> <output file>\n"+
|
||||
"The output format is guessed according to the file extension.\n"+
|
||||
"\n", os.Args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if ret = ffmpeg.AvHWDeviceCtxCreate(&sc.hwDeviceCtx, ffmpeg.AV_HWDEVICE_TYPE_VAAPI,
|
||||
ffmpeg.NIL, nil, 0); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Failed to create a VAAPI device. Error code: %s\n", ffmpeg.AvErr2str(ret))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if decPkt = ffmpeg.AvPacketAlloc(); decPkt == nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to allocate decode packet\n")
|
||||
goto end
|
||||
}
|
||||
|
||||
if ret = openInputFile(os.Args[1], sc); ret < 0 {
|
||||
goto end
|
||||
}
|
||||
|
||||
if encCodec = ffmpeg.AvCodecFindEncoderByName(os.Args[2]); encCodec == nil {
|
||||
fmt.Fprintf(os.Stderr, "Could not find encoder '%s'\n", os.Args[2])
|
||||
ret = -1
|
||||
goto end
|
||||
}
|
||||
|
||||
if ret = ffmpeg.AvFormatAllocOutputContext2(&sc.ofmtCtx, nil, ffmpeg.NIL, os.Args[3]); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Failed to deduce output format from file extension. Error code: "+
|
||||
"%s\n", ffmpeg.AvErr2str(ret))
|
||||
goto end
|
||||
}
|
||||
|
||||
if sc.encoderCtx = ffmpeg.AvCodecAllocContext3(encCodec); sc.encoderCtx == nil {
|
||||
ret = ffmpeg.AVERROR(syscall.ENOMEM)
|
||||
goto end
|
||||
}
|
||||
|
||||
if ret = ffmpeg.AvIOOpen(sc.ofmtCtx.GetPbAddr(), os.Args[3], ffmpeg.AVIO_FLAG_WRITE); ret < 0 {
|
||||
fmt.Fprintf(os.Stderr, "Cannot open output file. "+
|
||||
"Error code: %s\n", ffmpeg.AvErr2str(ret))
|
||||
goto end
|
||||
}
|
||||
|
||||
// read all packets and only transcoding video
|
||||
for ret >= 0 {
|
||||
if ret = ffmpeg.AvReadFrame(sc.ifmtCtx, decPkt); ret < 0 {
|
||||
break
|
||||
}
|
||||
|
||||
if sc.videoStream == decPkt.GetStreamIndex() {
|
||||
ret = decEnc(decPkt, encCodec, sc)
|
||||
}
|
||||
|
||||
ffmpeg.AvPacketUnref(decPkt)
|
||||
}
|
||||
|
||||
// flush decoder
|
||||
ffmpeg.AvPacketUnref(decPkt)
|
||||
decEnc(decPkt, encCodec, sc)
|
||||
|
||||
// flush encoder
|
||||
encodeWrite(decPkt, nil, sc)
|
||||
|
||||
// write the trailer for output stream
|
||||
ffmpeg.AvWriteTrailer(sc.ofmtCtx)
|
||||
|
||||
end:
|
||||
ffmpeg.AvFormatCloseInput(&sc.ifmtCtx)
|
||||
ffmpeg.AvFormatCloseInput(&sc.ofmtCtx)
|
||||
ffmpeg.AvCodecFreeContext(&sc.decoderCtx)
|
||||
ffmpeg.AvCodecFreeContext(&sc.encoderCtx)
|
||||
ffmpeg.AvBufferUnref(&sc.hwDeviceCtx)
|
||||
ffmpeg.AvPacketFree(&decPkt)
|
||||
os.Exit(int(ret))
|
||||
}
|
||||
|
@@ -25,6 +25,33 @@ type UnsingedInteger interface {
|
||||
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
|
||||
}
|
||||
|
||||
// CVoidPointer represents a (void*) type pointer in the C world.
|
||||
type CVoidPointer any
|
||||
|
||||
// VoidPointer returns a unsafe.Pointer from CVoidPointer.
|
||||
func VoidPointer(a CVoidPointer) unsafe.Pointer {
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
return unsafe.Pointer(reflect.ValueOf(a).Pointer())
|
||||
}
|
||||
|
||||
// CVoidPointer represents a (void**) type pointer in the C world.
|
||||
type CVoidPointerPointer any
|
||||
|
||||
// VoidPointerPointer returns a *unsafe.Pointer from CVoidPointerPointer.
|
||||
func VoidPointerPointer(a CVoidPointerPointer) *unsafe.Pointer {
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
return (*unsafe.Pointer)(unsafe.Pointer(reflect.ValueOf(a).Pointer()))
|
||||
}
|
||||
|
||||
// FreePointer frees memory allocated in the C world.
|
||||
func FreePointer(ptr CVoidPointer) {
|
||||
C.free(VoidPointer(ptr))
|
||||
}
|
||||
|
||||
const NIL = "\\'<nil>'\\"
|
||||
|
||||
// StringCasting casts go string to c world char* with free function.
|
||||
@@ -34,7 +61,7 @@ func StringCasting(s string) (allocPtr *C.char, freeFunc func()) {
|
||||
return nil, func() {}
|
||||
}
|
||||
allocPtr = C.CString(s)
|
||||
freeFunc = func() { C.free(unsafe.Pointer(allocPtr)) }
|
||||
freeFunc = func() { FreePointer(allocPtr) }
|
||||
return allocPtr, freeFunc
|
||||
}
|
||||
|
||||
@@ -96,28 +123,6 @@ func PointerOffset[U any, V Integer](ptr *U, offset V) *U {
|
||||
uintptr(unsafe.Sizeof(*ptr))*(uintptr(offset))))
|
||||
}
|
||||
|
||||
// CVoidPointer represents a (void*) type pointer in the C world.
|
||||
type CVoidPointer any
|
||||
|
||||
// VoidPointer returns a unsafe.Pointer from CVoidPointer.
|
||||
func VoidPointer(a CVoidPointer) unsafe.Pointer {
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
return unsafe.Pointer(reflect.ValueOf(a).Pointer())
|
||||
}
|
||||
|
||||
// CVoidPointer represents a (void**) type pointer in the C world.
|
||||
type CVoidPointerPointer any
|
||||
|
||||
// VoidPointerPointer returns a *unsafe.Pointer from CVoidPointerPointer.
|
||||
func VoidPointerPointer(a CVoidPointerPointer) *unsafe.Pointer {
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
return (*unsafe.Pointer)(unsafe.Pointer(reflect.ValueOf(a).Pointer()))
|
||||
}
|
||||
|
||||
// CondExpr is Conditional Operator like Ternary Operator in the C world.
|
||||
func CondExpr[T any](cond bool, x, y T) T {
|
||||
if cond {
|
||||
@@ -126,6 +131,7 @@ func CondExpr[T any](cond bool, x, y T) T {
|
||||
return y
|
||||
}
|
||||
|
||||
// PlusPlus is ++ like operator.
|
||||
func PlusPlus[T Integer](x *T) T {
|
||||
defer func() { *x++ }()
|
||||
return *x
|
||||
|
@@ -10,7 +10,6 @@ package ffmpeg
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBPOSTPROC_VERSION_MAJOR = C.LIBPOSTPROC_VERSION_MAJOR
|
||||
LIBPOSTPROC_VERSION_MINOR = C.LIBPOSTPROC_VERSION_MINOR
|
||||
LIBPOSTPROC_VERSION_MICRO = C.LIBPOSTPROC_VERSION_MICRO
|
||||
)
|
||||
|
14
postproc_version_major.go
Normal file
14
postproc_version_major.go
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libpostproc/version_major.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBPOSTPROC_VERSION_MAJOR = C.LIBPOSTPROC_VERSION_MAJOR
|
||||
)
|
@@ -14,7 +14,7 @@ const (
|
||||
SWR_FLAG_RESAMPLE = C.SWR_FLAG_RESAMPLE
|
||||
)
|
||||
|
||||
// Dithering algorithms
|
||||
// Dithering algorithms.
|
||||
type SwrDitherType = C.enum_SwrDitherType
|
||||
|
||||
const (
|
||||
@@ -33,7 +33,7 @@ const (
|
||||
SWR_DITHER_NB = SwrDitherType(C.SWR_DITHER_NB)
|
||||
)
|
||||
|
||||
// Resampling Engines
|
||||
// Resampling Engines.
|
||||
type SwrEngine = C.enum_SwrEngine
|
||||
|
||||
const (
|
||||
@@ -42,7 +42,7 @@ const (
|
||||
SWR_ENGINE_NB = SwrEngine(C.SWR_ENGINE_NB)
|
||||
)
|
||||
|
||||
// Resampling Filter Types
|
||||
// Resampling Filter Types.
|
||||
type SwrFilterType = C.enum_SwrFilterType
|
||||
|
||||
const (
|
||||
@@ -75,6 +75,8 @@ func SwrIsInitialized(s *SwrContext) int32 {
|
||||
return (int32)(C.swr_is_initialized((*C.struct_SwrContext)(s)))
|
||||
}
|
||||
|
||||
// Deprecated: Use SwrAllocSetOpts2() instead.
|
||||
//
|
||||
// SwrAllocSetOpts allocates SwrContext if needed and set/reset common parameters.
|
||||
func SwrAllocSetOpts(s *SwrContext,
|
||||
outChLayout int64, outSampleFmt AVSampleFormat, outSampleRate int32,
|
||||
@@ -86,6 +88,17 @@ func SwrAllocSetOpts(s *SwrContext,
|
||||
(C.int)(logOffset), VoidPointer(logCtx)))
|
||||
}
|
||||
|
||||
// SwrAllocSetOpts2 allocates SwrContext if needed and set/reset common parameters.
|
||||
func SwrAllocSetOpts2(s **SwrContext,
|
||||
outChLayout *AVChannelLayout, outSampleFmt AVSampleFormat, outSampleRate int32,
|
||||
inChLayout *AVChannelLayout, inSampleFmt AVSampleFormat, inSampleRate int32,
|
||||
logOffset int32, logCtx CVoidPointer) int32 {
|
||||
return (int32)(C.swr_alloc_set_opts2((**C.struct_SwrContext)(unsafe.Pointer(s)),
|
||||
(*C.struct_AVChannelLayout)(outChLayout), (C.enum_AVSampleFormat)(outSampleFmt), (C.int)(outSampleRate),
|
||||
(*C.struct_AVChannelLayout)(inChLayout), (C.enum_AVSampleFormat)(inSampleFmt), (C.int)(inSampleRate),
|
||||
(C.int)(logOffset), VoidPointer(logCtx)))
|
||||
}
|
||||
|
||||
// SwrFree frees the given SwrContext and set the pointer to NULL.
|
||||
func SwrFree(s **SwrContext) {
|
||||
C.swr_free((**C.struct_SwrContext)(unsafe.Pointer(s)))
|
||||
@@ -109,7 +122,7 @@ func SwrNextPts(s *SwrContext, pts int64) int64 {
|
||||
return (int64)(C.swr_next_pts((*C.struct_SwrContext)(s), (C.int64_t)(pts)))
|
||||
}
|
||||
|
||||
// SwrSetCompensation activates resampling compensation ("soft" compensation).
|
||||
// SwrSetCompensation activates resampling compensation ("soft" compensation).
|
||||
// This function is internally called when needed in SwrNextPts().
|
||||
func SwrSetCompensation(s *SwrContext, sampleDelta, compensationDistance int32) int32 {
|
||||
return (int32)(C.swr_set_compensation((*C.struct_SwrContext)(s),
|
||||
@@ -121,6 +134,8 @@ func SwrSetChannelMapping(s *SwrContext, channelMap *int32) int32 {
|
||||
return (int32)(C.swr_set_channel_mapping((*C.struct_SwrContext)(s), (*C.int)(channelMap)))
|
||||
}
|
||||
|
||||
// Deprecated: Use SwrBuildMatrix2() instead.
|
||||
//
|
||||
// SwrBuildMatrix generates a channel mixing matrix.
|
||||
func SwrBuildMatrix(inLayout, outLayout uint64,
|
||||
centerMixLevel, surroundMixLevel, lfeMixLevel float64,
|
||||
@@ -132,6 +147,17 @@ func SwrBuildMatrix(inLayout, outLayout uint64,
|
||||
(*C.double)(matrix), (C.int)(stride), (C.enum_AVMatrixEncoding)(matrixEncoding), VoidPointer(logCtx)))
|
||||
}
|
||||
|
||||
// SwrBuildMatrix2 generates a channel mixing matrix.
|
||||
func SwrBuildMatrix2(inLayout, outLayout *AVChannelLayout,
|
||||
centerMixLevel, surroundMixLevel, lfeMixLevel float64,
|
||||
rematrixMaxval, rematrixVolume float64,
|
||||
matrix *float64, stride int, matrixEncoding AVMatrixEncoding, logCtx CVoidPointer) int32 {
|
||||
return (int32)(C.swr_build_matrix2((*C.struct_AVChannelLayout)(inLayout), (*C.struct_AVChannelLayout)(outLayout),
|
||||
(C.double)(centerMixLevel), (C.double)(surroundMixLevel), (C.double)(lfeMixLevel),
|
||||
(C.double)(rematrixMaxval), (C.double)(rematrixVolume),
|
||||
(*C.double)(matrix), (C.ptrdiff_t)(stride), (C.enum_AVMatrixEncoding)(matrixEncoding), VoidPointer(logCtx)))
|
||||
}
|
||||
|
||||
// SwrSetMatrix sets a customized remix matrix.
|
||||
func SwrSetMatrix(s *SwrContext, matrix *float64, stride int32) int32 {
|
||||
return (int32)(C.swr_set_matrix((*C.struct_SwrContext)(s), (*C.double)(matrix), (C.int)(stride)))
|
||||
|
@@ -10,7 +10,6 @@ package ffmpeg
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBSWRESAMPLE_VERSION_MAJOR = C.LIBSWRESAMPLE_VERSION_MAJOR
|
||||
LIBSWRESAMPLE_VERSION_MINOR = C.LIBSWRESAMPLE_VERSION_MINOR
|
||||
LIBSWRESAMPLE_VERSION_MICRO = C.LIBSWRESAMPLE_VERSION_MICRO
|
||||
)
|
||||
|
14
swresample_version_major.go
Normal file
14
swresample_version_major.go
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libswresample/version_major.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBSWRESAMPLE_VERSION_MAJOR = C.LIBSWRESAMPLE_VERSION_MAJOR
|
||||
)
|
93
swscale.go
93
swscale.go
@@ -228,6 +228,42 @@ func SwsScale(sctx *SwsContext, srcSlice []*uint8, srcStride []int32,
|
||||
(**C.uint8_t)(unsafe.Pointer(&dst[0])), (*C.int)(unsafe.Pointer(&dstStride[0]))))
|
||||
}
|
||||
|
||||
// SwsScaleFrame scales source data from src and write the output to dst.
|
||||
func SwsScaleFrame(sctx *SwsContext, dst, src *AVFrame) int32 {
|
||||
return (int32)(C.sws_scale_frame((*C.struct_SwsContext)(sctx),
|
||||
(*C.struct_AVFrame)(dst), (*C.struct_AVFrame)(src)))
|
||||
}
|
||||
|
||||
// SwsFrameStart initializes the scaling process for a given pair of source/destination frames.
|
||||
func SwsFrameStart(sctx *SwsContext, dst, src *AVFrame) int32 {
|
||||
return (int32)(C.sws_frame_start((*C.struct_SwsContext)(sctx),
|
||||
(*C.struct_AVFrame)(dst), (*C.struct_AVFrame)(src)))
|
||||
}
|
||||
|
||||
// SwsFrameEnd finishes the scaling process for a pair of source/destination frames.
|
||||
func SwsFrameEnd(sctx *SwsContext) {
|
||||
C.sws_frame_end((*C.struct_SwsContext)(sctx))
|
||||
}
|
||||
|
||||
// SwsSendSlice indicates that a horizontal slice of input data is available in the source
|
||||
// frame previously provided to SwsFrameStart().
|
||||
func SwsSendSlice(sctx *SwsContext, sliceStart, sliceHeight uint32) int32 {
|
||||
return (int32)(C.sws_send_slice((*C.struct_SwsContext)(sctx),
|
||||
(C.uint)(sliceStart), (C.uint)(sliceHeight)))
|
||||
}
|
||||
|
||||
// SwsReceiveSlice requests a horizontal slice of the output data to be written into the frame
|
||||
// previously provided to SwsFrameStart().
|
||||
func SwsReceiveSlice(sctx *SwsContext, sliceStart, sliceHeight uint32) int32 {
|
||||
return (int32)(C.sws_receive_slice((*C.struct_SwsContext)(sctx),
|
||||
(C.uint)(sliceStart), (C.uint)(sliceHeight)))
|
||||
}
|
||||
|
||||
// SwsReceiveSliceAlignment alignments required for output slices requested with SwsReceiveSlice().
|
||||
func SwsReceiveSliceAlignment(sctx *SwsContext) int32 {
|
||||
return (int32)(C.sws_receive_slice_alignment((*C.struct_SwsContext)(sctx)))
|
||||
}
|
||||
|
||||
// SwsSetColorspaceDetails
|
||||
func SwsSetColorSpaceDetails(sctx *SwsContext, invTable []int32, srcRange int32,
|
||||
table []int32, dstRange int32, brightness, contrast, saturation int32) int32 {
|
||||
@@ -280,63 +316,6 @@ func SwsNormalizeVec(a *SwsVector, height float64) {
|
||||
C.sws_normalizeVec((*C.struct_SwsVector)(a), (C.double)(height))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SwsGetConstVec
|
||||
func SwsGetConstVec(c float64, length int32) *SwsVector {
|
||||
return (*SwsVector)(C.sws_getConstVec((C.double)(c), (C.int)(length)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SwsGetIdentityVec
|
||||
func SwsGetIdentityVec() *SwsVector {
|
||||
return (*SwsVector)(C.sws_getIdentityVec())
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SwsConvVec
|
||||
func SwsConvVec(a, b *SwsVector) {
|
||||
C.sws_convVec((*C.struct_SwsVector)(a), (*C.struct_SwsVector)(b))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SwsAddVec
|
||||
func SwsAddVec(a, b *SwsVector) {
|
||||
C.sws_addVec((*C.struct_SwsVector)(a), (*C.struct_SwsVector)(b))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SwsSubVec
|
||||
func SwsSubVec(a, b *SwsVector) {
|
||||
C.sws_subVec((*C.struct_SwsVector)(a), (*C.struct_SwsVector)(b))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SwsShiftVec
|
||||
func SwsShiftVec(a *SwsVector, shift int32) {
|
||||
C.sws_shiftVec((*C.struct_SwsVector)(a), (C.int)(shift))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SwsCloneVec
|
||||
func SwsCloneVec(a *SwsVector) *SwsVector {
|
||||
return (*SwsVector)(C.sws_cloneVec((*C.struct_SwsVector)(a)))
|
||||
}
|
||||
|
||||
// Deprecated: No use.
|
||||
//
|
||||
// SwsPrintVec2
|
||||
func SwsPrintVec2(a *SwsVector, logCtx *AVClass, logLevel int32) {
|
||||
C.sws_printVec2((*C.struct_SwsVector)(a),
|
||||
(*C.struct_AVClass)(logCtx), (C.int)(logLevel))
|
||||
}
|
||||
|
||||
// SwsFreeVec
|
||||
func SwsFreeVec(a *SwsVector) {
|
||||
C.sws_freeVec((*C.struct_SwsVector)(a))
|
||||
|
@@ -10,7 +10,6 @@ package ffmpeg
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBSWSCALE_VERSION_MAJOR = C.LIBSWSCALE_VERSION_MAJOR
|
||||
LIBSWSCALE_VERSION_MINOR = C.LIBSWSCALE_VERSION_MINOR
|
||||
LIBSWSCALE_VERSION_MICRO = C.LIBSWSCALE_VERSION_MICRO
|
||||
)
|
||||
|
14
swscale_version_major.go
Normal file
14
swscale_version_major.go
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libswscale/version_major.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
LIBSWSCALE_VERSION_MAJOR = C.LIBSWSCALE_VERSION_MAJOR
|
||||
)
|
Reference in New Issue
Block a user