mirror of
https://github.com/qrtc/ffmpeg-dev-go.git
synced 2025-10-04 15:23:13 +08:00
2023-10-22 11:46:19 CST W43D0
This commit is contained in:
246
avcodec.go
246
avcodec.go
@@ -20,7 +20,9 @@ typedef int (*avcodec_context_get_encode_buffer_func)(struct AVCodecContext *s,
|
|||||||
typedef int (*av_lockmgr_cb)(void **mutex, enum AVLockOp op);
|
typedef int (*av_lockmgr_cb)(void **mutex, enum AVLockOp op);
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
import "unsafe"
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Required number of additionally allocated bytes at the end of the input bitstream for decoding.
|
// Required number of additionally allocated bytes at the end of the input bitstream for decoding.
|
||||||
@@ -159,6 +161,18 @@ func (psn *AVPanScan) GetPosition() []int16 {
|
|||||||
return unsafe.Slice((*int16)(&psn.position[0][0]), 3*2)
|
return unsafe.Slice((*int16)(&psn.position[0][0]), 3*2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom: SetPosition sets `AVPanScan.position` value.
|
||||||
|
func (psn *AVPanScan) SetPosition(v []int16) {
|
||||||
|
for i := 0; i < FFMIN(len(v), 3*2); i++ {
|
||||||
|
psn.position[i/2][i%2] = (C.int16_t)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetPositionAddr gets `AVPanScan.position` address.
|
||||||
|
func (psn *AVPanScan) GetPositionAddr() **int16 {
|
||||||
|
return (**int16)(unsafe.Pointer(&psn.position))
|
||||||
|
}
|
||||||
|
|
||||||
// Custom: GetPositionIdx gets `AVPanScan.position` index value.
|
// Custom: GetPositionIdx gets `AVPanScan.position` index value.
|
||||||
func (psn *AVPanScan) GetPositionIdx(x, y int) int16 {
|
func (psn *AVPanScan) GetPositionIdx(x, y int) int16 {
|
||||||
return (int16)(psn.position[x][y])
|
return (int16)(psn.position[x][y])
|
||||||
@@ -2395,19 +2409,16 @@ func (avctx *AVCodecContext) GetError() []uint64 {
|
|||||||
return unsafe.Slice((*uint64)(&avctx.error[0]), AV_NUM_DATA_POINTERS)
|
return unsafe.Slice((*uint64)(&avctx.error[0]), AV_NUM_DATA_POINTERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetErrorIdx gets `AVCodecContext.error` value.
|
// Custom: SetError sets `AVCodecContext.error` value.
|
||||||
func (avctx *AVCodecContext) GetErrorIdx(idx int) uint64 {
|
func (avctx *AVCodecContext) SetError(v []uint64) {
|
||||||
return (uint64)(avctx.error[idx])
|
for i := 0; i < FFMIN(len(v), AV_NUM_DATA_POINTERS); i++ {
|
||||||
|
avctx.error[i] = (C.uint64_t)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetErrorIdx sets `AVCodecContext.error` value.
|
// Custom: GetErrorAddr gets `AVCodecContext.error` address.
|
||||||
func (avctx *AVCodecContext) SetErrorIdx(idx int, v uint64) {
|
func (avctx *AVCodecContext) GetErrorAddr() **uint64 {
|
||||||
avctx.error[idx] = (C.uint64_t)(v)
|
return (**uint64)(unsafe.Pointer(&avctx.error))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetErrorIdxAddr gets `AVCodecContext.error` address.
|
|
||||||
func (avctx *AVCodecContext) GetErrorIdxAddr(idx int) *uint64 {
|
|
||||||
return (*uint64)(&avctx.error[idx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetDctAlgo gets `AVCodecContext.dct_algo` value.
|
// Custom: GetDctAlgo gets `AVCodecContext.dct_algo` value.
|
||||||
@@ -3472,23 +3483,20 @@ const (
|
|||||||
type AVPicture C.struct_AVPicture
|
type AVPicture C.struct_AVPicture
|
||||||
|
|
||||||
// Custom: GetData gets `AVPicture.data` value.
|
// Custom: GetData gets `AVPicture.data` value.
|
||||||
func (pct *AVPicture) GetData(idx int) []*uint8 {
|
func (pct *AVPicture) GetData() []*uint8 {
|
||||||
return unsafe.Slice((**uint8)(unsafe.Pointer(&pct.data[0])), AV_NUM_DATA_POINTERS)
|
return unsafe.Slice((**uint8)(unsafe.Pointer(&pct.data[0])), AV_NUM_DATA_POINTERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetDataIdx gets `AVPicture.data` index value.
|
// Custom: SetData sets `AVPicture.data` value.
|
||||||
func (pct *AVPicture) GetDataIdx(idx int) *uint8 {
|
func (pct *AVPicture) SetData(v []*uint8) {
|
||||||
return (*uint8)(pct.data[idx])
|
for i := 0; i < FFMIN(len(v), AV_NUM_DATA_POINTERS); i++ {
|
||||||
|
pct.data[i] = (*C.uint8_t)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetDataIdx sets `AVPicture.data` index value.
|
// Custom: GetDataAddr gets `AVPicture.data` address.
|
||||||
func (pct *AVPicture) SetDataIdx(idx int, v *uint8) {
|
func (pct *AVPicture) GetDataAddr() ***uint8 {
|
||||||
pct.data[idx] = (*C.uint8_t)(v)
|
return (***uint8)(unsafe.Pointer(&pct.data))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetDataIdxAddr gets `AVPicture.data` index address.
|
|
||||||
func (pct *AVPicture) GetDataIdxAddr(idx int) **uint8 {
|
|
||||||
return (**uint8)(unsafe.Pointer(&pct.data[idx]))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetLinesize gets `AVPicture.linesize` value.
|
// Custom: GetLinesize gets `AVPicture.linesize` value.
|
||||||
@@ -3496,19 +3504,16 @@ func (pct *AVPicture) GetLinesize() []int32 {
|
|||||||
return unsafe.Slice((*int32)(&pct.linesize[0]), AV_NUM_DATA_POINTERS)
|
return unsafe.Slice((*int32)(&pct.linesize[0]), AV_NUM_DATA_POINTERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetLinesizeIdx gets `AVPicture.linesize` index value.
|
// Custom: SetLinesize sets `AVPicture.linesize` value.
|
||||||
func (pct *AVPicture) GetLinesizeIdx(idx int) int32 {
|
func (pct *AVPicture) SetLinesize(v []int32) {
|
||||||
return (int32)(pct.linesize[idx])
|
for i := 0; i < FFMIN(len(v), AV_NUM_DATA_POINTERS); i++ {
|
||||||
|
pct.linesize[i] = (C.int)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetLinesizeIdx sets `AVPicture.linesize` index value.
|
// Custom: GetLinesizeAddr gets `AVPicture.linesize` address.
|
||||||
func (pct *AVPicture) SetLinesizeIdx(idx int, v int32) {
|
func (pct *AVPicture) GetLinesizeAddr() **int32 {
|
||||||
pct.linesize[idx] = (C.int)(v)
|
return (**int32)(unsafe.Pointer(&pct.linesize))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetLinesizeIdxAddr gets `AVPicture.linesize` index address.
|
|
||||||
func (pct *AVPicture) GetLinesizeIdxAddr(idx int) *int32 {
|
|
||||||
return (*int32)(&pct.linesize[idx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AVSubtitleType
|
// AVSubtitleType
|
||||||
@@ -3621,19 +3626,16 @@ func (sbtr *AVSubtitleRect) GetData() []*uint8 {
|
|||||||
return unsafe.Slice((**uint8)(unsafe.Pointer(&sbtr.data[0])), 4)
|
return unsafe.Slice((**uint8)(unsafe.Pointer(&sbtr.data[0])), 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetDataIdx gets `AVSubtitleRect.data` index value.
|
// Custom: SetData sets `AVSubtitleRect.data` value.
|
||||||
func (sbtr *AVSubtitleRect) GetDataIdx(idx int) *uint8 {
|
func (sbtr *AVSubtitleRect) SetData(v []*uint8) {
|
||||||
return (*uint8)(sbtr.data[idx])
|
for i := 0; i < FFMIN(len(v), 4); i++ {
|
||||||
|
sbtr.data[i] = (*C.uint8_t)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetDataIdx sets `AVSubtitleRect.data` index value.
|
// Custom: GetDataAddr gets `AVSubtitleRect.data` address.
|
||||||
func (sbtr *AVSubtitleRect) SetDataIdx(idx int, v *uint8) {
|
func (sbtr *AVSubtitleRect) GetDataAddr() ***uint8 {
|
||||||
sbtr.data[idx] = (*C.uint8_t)(v)
|
return (***uint8)(unsafe.Pointer(&sbtr.data))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetDataIdxAddr gets `AVSubtitleRect.data` index address.
|
|
||||||
func (sbtr *AVSubtitleRect) GetDataIdxAddr(idx int) **uint8 {
|
|
||||||
return (**uint8)(unsafe.Pointer(&sbtr.data[idx]))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetLinesize gets `AVSubtitleRect.linesize` value.
|
// Custom: GetLinesize gets `AVSubtitleRect.linesize` value.
|
||||||
@@ -3641,19 +3643,16 @@ func (sbtr *AVSubtitleRect) GetLinesize() []int32 {
|
|||||||
return unsafe.Slice((*int32)(&sbtr.linesize[0]), 4)
|
return unsafe.Slice((*int32)(&sbtr.linesize[0]), 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetLinesizeIdx gets `AVSubtitleRect.linesize` index value.
|
// Custom: SetLinesize sets `AVSubtitleRect.linesize` value.
|
||||||
func (sbtr *AVSubtitleRect) GetLinesizeIdx(idx int) int32 {
|
func (sbtr *AVSubtitleRect) SetLinesize(v []int32) {
|
||||||
return (int32)(sbtr.linesize[idx])
|
for i := 0; i < FFMIN(len(v), 4); i++ {
|
||||||
|
sbtr.linesize[i] = (C.int)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetLinesizeIdx sets `AVSubtitleRect.linesize` index value.
|
// Custom: GetLinesize gets `AVSubtitleRect.linesize` address.
|
||||||
func (sbtr *AVSubtitleRect) SetLinesizeIdx(idx int, v int32) {
|
func (sbtr *AVSubtitleRect) GetLinesizeAddr() **int32 {
|
||||||
sbtr.linesize[idx] = (C.int)(v)
|
return (**int32)(unsafe.Pointer(&sbtr.linesize))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetLinesizeIdxAddr gets `AVSubtitleRect.linesize` index address.
|
|
||||||
func (sbtr *AVSubtitleRect) GetLinesizeIdxAddr(idx int) *int32 {
|
|
||||||
return (*int32)(&sbtr.linesize[idx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetType gets `AVSubtitleRect._type` value.
|
// Custom: GetType gets `AVSubtitleRect._type` value.
|
||||||
@@ -3777,14 +3776,6 @@ func (sbt *AVSubtitle) GetRectsAddr() ***AVSubtitleRect {
|
|||||||
return (***AVSubtitleRect)(unsafe.Pointer(&sbt.rects))
|
return (***AVSubtitleRect)(unsafe.Pointer(&sbt.rects))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetRectsIdx gets `AVSubtitle.rects` index value.
|
|
||||||
func (sbt *AVSubtitle) GetRectsIdx(idx int) *AVSubtitleRect {
|
|
||||||
if idx >= int(sbt.num_rects) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVSubtitleRect)(*sbt.rects), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetPts gets `AVSubtitle.pts` value.
|
// Custom: GetPts gets `AVSubtitle.pts` value.
|
||||||
func (sbt *AVSubtitle) GetPts() int64 {
|
func (sbt *AVSubtitle) GetPts() int64 {
|
||||||
return (int64)(sbt.pts)
|
return (int64)(sbt.pts)
|
||||||
@@ -4189,23 +4180,20 @@ func (cpc *AVCodecParserContext) GetCurFrameStartIndexAddr() *int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCurFrameOffset gets `AVCodecParserContext.cur_frame_offset` value.
|
// Custom: GetCurFrameOffset gets `AVCodecParserContext.cur_frame_offset` value.
|
||||||
func (cpc *AVCodecParserContext) GetCurFrameOffset(idx int) []int64 {
|
func (cpc *AVCodecParserContext) GetCurFrameOffset() []int64 {
|
||||||
return unsafe.Slice((*int64)(&cpc.cur_frame_offset[0]), AV_PARSER_PTS_NB)
|
return unsafe.Slice((*int64)(&cpc.cur_frame_offset[0]), AV_PARSER_PTS_NB)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCurFrameOffsetIdx gets `AVCodecParserContext.cur_frame_offset` index value.
|
// Custom: SetCurFrameOffset sets `AVCodecParserContext.cur_frame_offset` value.
|
||||||
func (cpc *AVCodecParserContext) GetCurFrameOffsetIdx(idx int) int64 {
|
func (cpc *AVCodecParserContext) SetCurFrameOffset(v []int64) {
|
||||||
return (int64)(cpc.cur_frame_offset[idx])
|
for i := 0; i < FFMIN(len(v), AV_PARSER_PTS_NB); i++ {
|
||||||
|
cpc.cur_frame_offset[i] = (C.int64_t)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCurFrameOffsetIdx sets `AVCodecParserContext.cur_frame_offset` index value.
|
// Custom: GetCurFrameOffsetAddr gets `AVCodecParserContext.cur_frame_offset` address.
|
||||||
func (cpc *AVCodecParserContext) SetCurFrameOffsetIdx(idx int, v int64) {
|
func (cpc *AVCodecParserContext) GetCurFrameOffsetAddr() **int64 {
|
||||||
cpc.cur_frame_offset[idx] = (C.int64_t)(v)
|
return (**int64)(unsafe.Pointer(&cpc.cur_frame_offset))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetCurFrameOffsetIdxAddr gets `AVCodecParserContext.cur_frame_offset` index address.
|
|
||||||
func (cpc *AVCodecParserContext) GetCurFrameOffsetIdxAddr(idx int) *int64 {
|
|
||||||
return (*int64)(&cpc.cur_frame_offset[idx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCurFramePts gets `AVCodecParserContext.cur_frame_pts` value.
|
// Custom: GetCurFramePts gets `AVCodecParserContext.cur_frame_pts` value.
|
||||||
@@ -4213,19 +4201,16 @@ func (cpc *AVCodecParserContext) GetCurFramePts() []int64 {
|
|||||||
return unsafe.Slice((*int64)(&cpc.cur_frame_pts[0]), AV_PARSER_PTS_NB)
|
return unsafe.Slice((*int64)(&cpc.cur_frame_pts[0]), AV_PARSER_PTS_NB)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCurFramePtsIdx gets `AVCodecParserContext.cur_frame_pts` index value.
|
// Custom: SetCurFramePts sets `AVCodecParserContext.cur_frame_pts` value.
|
||||||
func (cpc *AVCodecParserContext) GetCurFramePtsIdx(idx int) int64 {
|
func (cpc *AVCodecParserContext) SetCurFramePts(v []int64) {
|
||||||
return (int64)(cpc.cur_frame_pts[idx])
|
for i := 0; i < FFMIN(len(v), AV_PARSER_PTS_NB); i++ {
|
||||||
|
cpc.cur_frame_pts[i] = (C.int64_t)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCurFramePtsIdx sets `AVCodecParserContext.cur_frame_pts` index value.
|
// Custom: GetCurFramePtsAddr gets `AVCodecParserContext.cur_frame_pts` address.
|
||||||
func (cpc *AVCodecParserContext) SetCurFramePtsIdx(idx int, v int64) {
|
func (cpc *AVCodecParserContext) GetCurFramePtsAddr() **int64 {
|
||||||
cpc.cur_frame_pts[idx] = (C.int64_t)(v)
|
return (**int64)(unsafe.Pointer(&cpc.cur_frame_pts))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetCurFramePtsIdxAddr gets `AVCodecParserContext.cur_frame_pts` index address.
|
|
||||||
func (cpc *AVCodecParserContext) GetCurFramePtsIdxAddr(idx int) *int64 {
|
|
||||||
return (*int64)(&cpc.cur_frame_pts[idx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCurFrameDts gets `AVCodecParserContext.cur_frame_dts` value.
|
// Custom: GetCurFrameDts gets `AVCodecParserContext.cur_frame_dts` value.
|
||||||
@@ -4233,19 +4218,16 @@ func (cpc *AVCodecParserContext) GetCurFrameDts() []int64 {
|
|||||||
return unsafe.Slice((*int64)(&cpc.cur_frame_dts[0]), AV_PARSER_PTS_NB)
|
return unsafe.Slice((*int64)(&cpc.cur_frame_dts[0]), AV_PARSER_PTS_NB)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCurFrameDtsIdx gets `AVCodecParserContext.cur_frame_dts` index value.
|
// Custom: SetCurFrameDts sets `AVCodecParserContext.cur_frame_dts` value.
|
||||||
func (cpc *AVCodecParserContext) GetCurFrameDtsIdx(idx int) int64 {
|
func (cpc *AVCodecParserContext) SetCurFrameDts(v []int64) {
|
||||||
return (int64)(cpc.cur_frame_dts[idx])
|
for i := 0; i < FFMIN(len(v), AV_PARSER_PTS_NB); i++ {
|
||||||
|
cpc.cur_frame_dts[i] = (C.int64_t)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCurFrameDtsIdx sets `AVCodecParserContext.cur_frame_dts` index value.
|
// Custom: GetCurFrameDtsAddr gets `AVCodecParserContext.cur_frame_dts` address.
|
||||||
func (cpc *AVCodecParserContext) SetCurFrameDtsIdx(idx int, v int64) {
|
func (cpc *AVCodecParserContext) GetCurFrameDtsAddr() **int64 {
|
||||||
cpc.cur_frame_dts[idx] = (C.int64_t)(v)
|
return (**int64)(unsafe.Pointer(&cpc.cur_frame_dts))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetCurFrameDtsIdxAddr gets `AVCodecParserContext.cur_frame_dts` index address.
|
|
||||||
func (cpc *AVCodecParserContext) GetCurFrameDtsIdxAddr(idx int) *int64 {
|
|
||||||
return (*int64)(&cpc.cur_frame_dts[idx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetOffset gets `AVCodecParserContext.offset` value.
|
// Custom: GetOffset gets `AVCodecParserContext.offset` value.
|
||||||
@@ -4268,19 +4250,16 @@ func (cpc *AVCodecParserContext) GetCurFrameEnd() []int64 {
|
|||||||
return unsafe.Slice((*int64)(&cpc.cur_frame_end[0]), AV_PARSER_PTS_NB)
|
return unsafe.Slice((*int64)(&cpc.cur_frame_end[0]), AV_PARSER_PTS_NB)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCurFrameEndIdx gets `AVCodecParserContext.cur_frame_end` index value.
|
// Custom: SetCurFrameEnd sets `AVCodecParserContext.cur_frame_end` value.
|
||||||
func (cpc *AVCodecParserContext) GetCurFrameEndIdx(idx int) int64 {
|
func (cpc *AVCodecParserContext) SetCurFrameEnd(v []int64) {
|
||||||
return (int64)(cpc.cur_frame_end[idx])
|
for i := 0; i < FFMIN(len(v), AV_PARSER_PTS_NB); i++ {
|
||||||
|
cpc.cur_frame_end[i] = (C.int64_t)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCurFrameEndIdx sets `AVCodecParserContext.cur_frame_end` index value.
|
// Custom: GetCurFrameEndAddr gets `AVCodecParserContext.cur_frame_end` address.
|
||||||
func (cpc *AVCodecParserContext) SetCurFrameEndIdx(idx int, v int64) {
|
func (cpc *AVCodecParserContext) GetCurFrameEndAddr() **int64 {
|
||||||
cpc.cur_frame_end[idx] = (C.int64_t)(v)
|
return (**int64)(unsafe.Pointer(&cpc.cur_frame_end))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetCurFrameEndIdxAddr gets `AVCodecParserContext.cur_frame_end` index address.
|
|
||||||
func (cpc *AVCodecParserContext) GetCurFrameEndIdxAddr(idx int) *int64 {
|
|
||||||
return (*int64)(&cpc.cur_frame_end[idx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetKeyFrame gets `AVCodecParserContext.key_frame` value.
|
// Custom: GetKeyFrame gets `AVCodecParserContext.key_frame` value.
|
||||||
@@ -4358,19 +4337,21 @@ func (cpc *AVCodecParserContext) GetPtsDtsDeltaAddr() *int32 {
|
|||||||
return (*int32)(&cpc.pts_dts_delta)
|
return (*int32)(&cpc.pts_dts_delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCurFramePosIdx gets `AVCodecParserContext.cur_frame_pos` value.
|
// Custom: GetCurFramePos gets `AVCodecParserContext.cur_frame_pos` value.
|
||||||
func (cpc *AVCodecParserContext) GetCurFramePosIdx(idx int) int64 {
|
func (cpc *AVCodecParserContext) GetCurFramePos() []int64 {
|
||||||
return (int64)(cpc.cur_frame_pos[idx])
|
return unsafe.Slice((*int64)(&cpc.cur_frame_pos[0]), AV_PARSER_PTS_NB)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCurFramePosIdx sets `AVCodecParserContext.cur_frame_pos` value.
|
// Custom: SetCurFramePos sets `AVCodecParserContext.cur_frame_pos` value.
|
||||||
func (cpc *AVCodecParserContext) SetCurFramePosIdx(idx int, v int64) {
|
func (cpc *AVCodecParserContext) SetCurFramePos(v []int64) {
|
||||||
cpc.cur_frame_pos[idx] = (C.int64_t)(v)
|
for i := 0; i < FFMIN(len(v), AV_PARSER_PTS_NB); i++ {
|
||||||
|
cpc.cur_frame_pos[i] = (C.int64_t)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCurFramePosIdxAddr gets `AVCodecParserContext.cur_frame_pos` address.
|
// Custom: GetCurFramePosAddr gets `AVCodecParserContext.cur_frame_pos` address.
|
||||||
func (cpc *AVCodecParserContext) GetCurFramePosIdxAddr(idx int) *int64 {
|
func (cpc *AVCodecParserContext) GetCurFramePosAddr() **int64 {
|
||||||
return (*int64)(&cpc.cur_frame_pos[idx])
|
return (**int64)(unsafe.Pointer(&cpc.cur_frame_pos))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetPos gets `AVCodecParserContext.pos` value.
|
// Custom: GetPos gets `AVCodecParserContext.pos` value.
|
||||||
@@ -4546,19 +4527,16 @@ func (cp *AVCodecParser) GetCodecIds() []int32 {
|
|||||||
return unsafe.Slice((*int32)(&cp.codec_ids[0]), 5)
|
return unsafe.Slice((*int32)(&cp.codec_ids[0]), 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCodecIdsIdx gets `AVCodecParser.codec_ids` index value.
|
// Custom: SetCodecIds sets `AVCodecParser.codec_ids` value.
|
||||||
func (cp *AVCodecParser) GetCodecIdsIdx(idx int) int32 {
|
func (cp *AVCodecParser) SetCodecIds(v []int32) {
|
||||||
return (int32)(cp.codec_ids[idx])
|
for i := 0; i < FFMIN(len(v), 5); i++ {
|
||||||
|
cp.codec_ids[i] = (C.int)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCodecIdsIdx sets `AVCodecParser.codec_ids` index value.
|
// Custom: GetCodecIdsAddr gets `AVCodecParser.codec_ids` address.
|
||||||
func (cp *AVCodecParser) SetCodecIdsIdx(idx int, v int32) {
|
func (cp *AVCodecParser) GetCodecIdsAddr() *int32 {
|
||||||
cp.codec_ids[idx] = (C.int)(v)
|
return (*int32)(unsafe.Pointer(&cp.codec_ids))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetCodecIdsIdxAddr gets `AVCodecParser.codec_ids` index address.
|
|
||||||
func (cp *AVCodecParser) GetCodecIdsIdxAddr(idx int) *int32 {
|
|
||||||
return (*int32)(&cp.codec_ids[idx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetPrivDataSize gets `AVCodecParser.priv_data_size` value.
|
// Custom: GetPrivDataSize gets `AVCodecParser.priv_data_size` value.
|
||||||
@@ -4745,7 +4723,7 @@ func AvCodecDefaultGetFormat(avctx *AVCodecContext, fmt *AVPixelFormat) AVPixelF
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use AvFourccMakeString() or AvFourcc2str() instead.
|
// Deprecated: Use AvFourccMakeString() or AvFourcc2str() instead.
|
||||||
func AvGetCodecTagString(buf *int8, bufSize uint, codecTag uint32) int32 {
|
func AvGetCodecTagString(buf *int8, bufSize uintptr, codecTag uint32) int32 {
|
||||||
return (int32)(C.av_get_codec_tag_string((*C.char)(buf),
|
return (int32)(C.av_get_codec_tag_string((*C.char)(buf),
|
||||||
(C.size_t)(bufSize), (C.uint)(codecTag)))
|
(C.size_t)(bufSize), (C.uint)(codecTag)))
|
||||||
}
|
}
|
||||||
@@ -4891,12 +4869,12 @@ func AvBsfNext(opaque CVoidPointerPointer) *AVBitStreamFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AvFastPaddedMalloc
|
// AvFastPaddedMalloc
|
||||||
func AvFastPaddedMalloc(ptr CVoidPointer, size *uint32, minSize uint) {
|
func AvFastPaddedMalloc(ptr CVoidPointer, size *uint32, minSize uintptr) {
|
||||||
C.av_fast_padded_malloc(VoidPointer(ptr), (*C.uint)(size), (C.size_t)(minSize))
|
C.av_fast_padded_malloc(VoidPointer(ptr), (*C.uint)(size), (C.size_t)(minSize))
|
||||||
}
|
}
|
||||||
|
|
||||||
// AvFastPaddedMallocz
|
// AvFastPaddedMallocz
|
||||||
func AvFastPaddedMallocz(ptr CVoidPointer, size *uint32, minSize uint) {
|
func AvFastPaddedMallocz(ptr CVoidPointer, size *uint32, minSize uintptr) {
|
||||||
C.av_fast_padded_mallocz(VoidPointer(ptr), (*C.uint)(size), (C.size_t)(minSize))
|
C.av_fast_padded_mallocz(VoidPointer(ptr), (*C.uint)(size), (C.size_t)(minSize))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4941,6 +4919,6 @@ func AvCodecIsOpen(avctx *AVCodecContext) int32 {
|
|||||||
|
|
||||||
// AvCpbPropertiesAlloc allocates a CPB properties structure and initialize its fields to default
|
// AvCpbPropertiesAlloc allocates a CPB properties structure and initialize its fields to default
|
||||||
// values.
|
// values.
|
||||||
func AvCpbPropertiesAlloc(size *uint) *AVCPBProperties {
|
func AvCpbPropertiesAlloc(size *uintptr) *AVCPBProperties {
|
||||||
return (*AVCPBProperties)(C.av_cpb_properties_alloc((*C.size_t)(unsafe.Pointer(size))))
|
return (*AVCPBProperties)(C.av_cpb_properties_alloc((*C.size_t)(unsafe.Pointer(size))))
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ package ffmpeg
|
|||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// AvAc3ParseHeader extracts the bitstream ID and the frame size from AC-3 data.
|
// AvAc3ParseHeader extracts the bitstream ID and the frame size from AC-3 data.
|
||||||
func AvAc3ParseHeader(buf *uint8, size uint, bitstreamID *uint8, frameSize *uint16) int32 {
|
func AvAc3ParseHeader(buf *uint8, size uintptr, bitstreamID *uint8, frameSize *uint16) int32 {
|
||||||
return (int32)(C.av_ac3_parse_header((*C.uint8_t)(buf), (C.size_t)(size),
|
return (int32)(C.av_ac3_parse_header((*C.uint8_t)(buf), (C.size_t)(size),
|
||||||
(*C.uint8_t)(bitstreamID), (*C.uint16_t)(frameSize)))
|
(*C.uint8_t)(bitstreamID), (*C.uint16_t)(frameSize)))
|
||||||
}
|
}
|
||||||
|
155
avcodec_avdct.go
155
avcodec_avdct.go
@@ -2,12 +2,167 @@ package ffmpeg
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
#include <libavcodec/avdct.h>
|
#include <libavcodec/avdct.h>
|
||||||
|
|
||||||
|
typedef void (*avdct_idct_func)(int16_t *block);
|
||||||
|
typedef void (*avdct_fdct_func)(int16_t *block);
|
||||||
|
typedef void (*avdct_get_pixels_func)(int16_t *block, const uint8_t *pixels, ptrdiff_t line_size);
|
||||||
|
typedef void (*avdct_get_pixels_unaligned_func)(int16_t *block, const uint8_t *pixels, ptrdiff_t line_size);
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
// AVDCT
|
// AVDCT
|
||||||
type AVDCT C.struct_AVDCT
|
type AVDCT C.struct_AVDCT
|
||||||
|
|
||||||
|
// typedef void (*avdct_idct_func)(int16_t *block);
|
||||||
|
type AVDCTIdctFunc = C.avdct_idct_func
|
||||||
|
|
||||||
|
// typedef void (*avdct_fdct_func)(int16_t *block);
|
||||||
|
type AVDCTFdctFunc = C.avdct_fdct_func
|
||||||
|
|
||||||
|
// typedef void (*avdct_get_pixels_func)(int16_t *block, const uint8_t *pixels, ptrdiff_t line_size);
|
||||||
|
type AVDCTGetPixelsFunc = C.avdct_get_pixels_func
|
||||||
|
|
||||||
|
// typedef void (*avdct_get_pixels_unaligned_func)(int16_t *block, const uint8_t *pixels, ptrdiff_t line_size);
|
||||||
|
type AVDCTGetPixelsUnalignedFunc = C.avdct_get_pixels_unaligned_func
|
||||||
|
|
||||||
|
// Custom: GetAvClass gets `AVDCT.av_class` value.
|
||||||
|
func (dct *AVDCT) GetAvClass() *AVClass {
|
||||||
|
return (*AVClass)(dct.av_class)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetAvClass sets `AVDCT.av_class` value.
|
||||||
|
func (dct *AVDCT) SetAvClass(v *AVClass) {
|
||||||
|
dct.av_class = (*C.struct_AVClass)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAvClassAddr gets `AVDCT.av_class` address.
|
||||||
|
func (dct *AVDCT) GetAvClassAddr() **AVClass {
|
||||||
|
return (**AVClass)(unsafe.Pointer(&dct.av_class))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetIdct gets `AVDCT.idct` value.
|
||||||
|
func (dct *AVDCT) GetIdct() AVDCTIdctFunc {
|
||||||
|
return (AVDCTIdctFunc)(dct.idct)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetIdct sets `AVDCT.idct` value.
|
||||||
|
func (dct *AVDCT) SetIdct(v AVDCTIdctFunc) {
|
||||||
|
dct.idct = (C.avdct_idct_func)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetIdctAddr gets `AVDCT.idct` address.
|
||||||
|
func (dct *AVDCT) GetIdctAddr() *AVDCTIdctFunc {
|
||||||
|
return (*AVDCTIdctFunc)(&dct.idct)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetIdctPermutation gets `AVDCT.idct_permutation` value.
|
||||||
|
func (dct *AVDCT) GetIdctPermutation() []uint8 {
|
||||||
|
return unsafe.Slice((*uint8)(&dct.idct_permutation[0]), 64)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetIdctPermutation sets `AVDCT.idct_permutation` value.
|
||||||
|
func (dct *AVDCT) SetIdctPermutation(v []uint8) {
|
||||||
|
for i := 0; i < FFMIN(len(v), 64); i++ {
|
||||||
|
dct.idct_permutation[i] = (C.uint8_t)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetIdctPermutationAddr gets `AVDCT.idct_permutation` address.
|
||||||
|
func (dct *AVDCT) GetIdctPermutationAddr() **uint8 {
|
||||||
|
return (**uint8)(unsafe.Pointer(&dct.idct_permutation))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetFdct gets `AVDCT.fdct` value.
|
||||||
|
func (dct *AVDCT) GetFdct() AVDCTFdctFunc {
|
||||||
|
return (AVDCTFdctFunc)(dct.fdct)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetFdct sets `AVDCT.fdct` value.
|
||||||
|
func (dct *AVDCT) SetFdct(v AVDCTFdctFunc) {
|
||||||
|
dct.fdct = (C.avdct_fdct_func)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetFdctAddr gets `AVDCT.fdct` address.
|
||||||
|
func (dct *AVDCT) GetFdctAddr() *AVDCTFdctFunc {
|
||||||
|
return (*AVDCTFdctFunc)(&dct.fdct)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetDctAlgo gets `AVDCT.dct_algo` value.
|
||||||
|
func (dct *AVDCT) GetDctAlgo() int32 {
|
||||||
|
return (int32)(dct.dct_algo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetDctAlgo sets `AVDCT.dct_algo` value.
|
||||||
|
func (dct *AVDCT) SetDctAlgo(v int32) {
|
||||||
|
dct.dct_algo = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetDctAlgoAddr gets `AVDCT.dct_algo` address.
|
||||||
|
func (dct *AVDCT) GetDctAlgoAddr() *int32 {
|
||||||
|
return (*int32)(&dct.dct_algo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetIdctAlgo gets `AVDCT.idct_algo` value.
|
||||||
|
func (dct *AVDCT) GetIdctAlgo() int32 {
|
||||||
|
return (int32)(dct.idct_algo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetIdctAlgo sets `AVDCT.idct_algo` value.
|
||||||
|
func (dct *AVDCT) SetIdctAlgo(v int32) {
|
||||||
|
dct.idct_algo = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetIdctAlgoAddr gets `AVDCT.idct_algo` address.
|
||||||
|
func (dct *AVDCT) GetIdctAlgoAddr() *int32 {
|
||||||
|
return (*int32)(&dct.idct_algo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetGetPixels gets `AVDCT.get_pixels` value.
|
||||||
|
func (dct *AVDCT) GetGetPixels() AVDCTGetPixelsFunc {
|
||||||
|
return (AVDCTGetPixelsFunc)(dct.get_pixels)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetGetPixels sets `AVDCT.get_pixels` value.
|
||||||
|
func (dct *AVDCT) SetGetPixels(v AVDCTGetPixelsFunc) {
|
||||||
|
dct.get_pixels = (C.avdct_get_pixels_func)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetGetPixelsAddr gets `AVDCT.get_pixels` address.
|
||||||
|
func (dct *AVDCT) GetGetPixelsAddr() *AVDCTGetPixelsFunc {
|
||||||
|
return (*AVDCTGetPixelsFunc)(&dct.get_pixels)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetBitsPerSample gets `AVDCT.bits_per_sample` value.
|
||||||
|
func (dct *AVDCT) GetBitsPerSample() int32 {
|
||||||
|
return (int32)(dct.bits_per_sample)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetBitsPerSample sets `AVDCT.bits_per_sample` value.
|
||||||
|
func (dct *AVDCT) SetBitsPerSample(v int32) {
|
||||||
|
dct.bits_per_sample = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetBitsPerSampleAddr gets `AVDCT.bits_per_sample` address.
|
||||||
|
func (dct *AVDCT) GetBitsPerSampleAddr() *int32 {
|
||||||
|
return (*int32)(&dct.bits_per_sample)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetGetPixelsUnaligned gets `AVDCT.get_pixels_unaligned` value.
|
||||||
|
func (dct *AVDCT) GetGetPixelsUnaligned() AVDCTGetPixelsUnalignedFunc {
|
||||||
|
return (AVDCTGetPixelsUnalignedFunc)(dct.get_pixels_unaligned)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetGetPixelsUnaligned sets `AVDCT.get_pixels_unaligned` value.
|
||||||
|
func (dct *AVDCT) SetGetPixelsUnaligned(v AVDCTGetPixelsUnalignedFunc) {
|
||||||
|
dct.get_pixels_unaligned = (C.avdct_get_pixels_unaligned_func)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetGetPixelsUnalignedAddr gets `AVDCT.get_pixels_unaligned` address.
|
||||||
|
func (dct *AVDCT) GetGetPixelsUnalignedAddr() *AVDCTGetPixelsUnalignedFunc {
|
||||||
|
return (*AVDCTGetPixelsUnalignedFunc)(&dct.get_pixels_unaligned)
|
||||||
|
}
|
||||||
|
|
||||||
// AvCodecDctAlloc allocates a AVDCT context.
|
// AvCodecDctAlloc allocates a AVDCT context.
|
||||||
func AvCodecDctAlloc() *AVDCT {
|
func AvCodecDctAlloc() *AVDCT {
|
||||||
return (*AVDCT)(C.avcodec_dct_alloc())
|
return (*AVDCT)(C.avcodec_dct_alloc())
|
||||||
|
@@ -6,11 +6,21 @@ package ffmpeg
|
|||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// FFTSample
|
// FFTSample
|
||||||
type FFTSample C.FFTSample
|
type FFTSample = C.FFTSample
|
||||||
|
|
||||||
// FFTComplex
|
// FFTComplex
|
||||||
type FFTComplex C.struct_FFTComplex
|
type FFTComplex C.struct_FFTComplex
|
||||||
|
|
||||||
|
// Custom: GetRe gets `FFTComplex.re` value.
|
||||||
|
func (fc *FFTComplex) GetRe() FFTSample {
|
||||||
|
return (FFTSample)(fc.re)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetIm gets `FFTComplex.im` value.
|
||||||
|
func (fc *FFTComplex) GetIm() FFTSample {
|
||||||
|
return (FFTSample)(fc.im)
|
||||||
|
}
|
||||||
|
|
||||||
// FFTContext
|
// FFTContext
|
||||||
type FFTContext C.struct_FFTContext
|
type FFTContext C.struct_FFTContext
|
||||||
|
|
||||||
|
@@ -6,3 +6,16 @@ package ffmpeg
|
|||||||
#include <libavcodec/d3d11va.h>
|
#include <libavcodec/d3d11va.h>
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
const (
|
||||||
|
FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG = C.FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG
|
||||||
|
FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO = C.FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO
|
||||||
|
)
|
||||||
|
|
||||||
|
// AVD3D11VAContext
|
||||||
|
type AVD3D11VAContext C.struct_AVD3D11VAContext
|
||||||
|
|
||||||
|
// AvD3d11vaAllocContext allocates an AVD3D11VAContext.
|
||||||
|
func AvD3d11vaAllocContext() *AVD3D11VAContext {
|
||||||
|
return (*AVD3D11VAContext)(C.av_d3d11va_alloc_context())
|
||||||
|
}
|
||||||
|
434
avcodec_dirac.go
Normal file
434
avcodec_dirac.go
Normal file
@@ -0,0 +1,434 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/dirac.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
const (
|
||||||
|
MAX_DWT_LEVELS = C.MAX_DWT_LEVELS
|
||||||
|
)
|
||||||
|
|
||||||
|
type DiracParseCodes = C.enum_DiracParseCodes
|
||||||
|
|
||||||
|
const (
|
||||||
|
DIRAC_PCODE_SEQ_HEADER = DiracParseCodes(C.DIRAC_PCODE_SEQ_HEADER)
|
||||||
|
DIRAC_PCODE_END_SEQ = DiracParseCodes(C.DIRAC_PCODE_END_SEQ)
|
||||||
|
DIRAC_PCODE_AUX = DiracParseCodes(C.DIRAC_PCODE_AUX)
|
||||||
|
DIRAC_PCODE_PAD = DiracParseCodes(C.DIRAC_PCODE_PAD)
|
||||||
|
DIRAC_PCODE_PICTURE_CODED = DiracParseCodes(C.DIRAC_PCODE_PICTURE_CODED)
|
||||||
|
DIRAC_PCODE_PICTURE_RAW = DiracParseCodes(C.DIRAC_PCODE_PICTURE_RAW)
|
||||||
|
DIRAC_PCODE_PICTURE_LOW_DEL = DiracParseCodes(C.DIRAC_PCODE_PICTURE_LOW_DEL)
|
||||||
|
DIRAC_PCODE_PICTURE_HQ = DiracParseCodes(C.DIRAC_PCODE_PICTURE_HQ)
|
||||||
|
DIRAC_PCODE_INTER_NOREF_CO1 = DiracParseCodes(C.DIRAC_PCODE_INTER_NOREF_CO1)
|
||||||
|
DIRAC_PCODE_INTER_NOREF_CO2 = DiracParseCodes(C.DIRAC_PCODE_INTER_NOREF_CO2)
|
||||||
|
DIRAC_PCODE_INTER_REF_CO1 = DiracParseCodes(C.DIRAC_PCODE_INTER_REF_CO1)
|
||||||
|
DIRAC_PCODE_INTER_REF_CO2 = DiracParseCodes(C.DIRAC_PCODE_INTER_REF_CO2)
|
||||||
|
DIRAC_PCODE_INTRA_REF_CO = DiracParseCodes(C.DIRAC_PCODE_INTRA_REF_CO)
|
||||||
|
DIRAC_PCODE_INTRA_REF_RAW = DiracParseCodes(C.DIRAC_PCODE_INTRA_REF_RAW)
|
||||||
|
DIRAC_PCODE_INTRA_REF_PICT = DiracParseCodes(C.DIRAC_PCODE_INTRA_REF_PICT)
|
||||||
|
DIRAC_PCODE_MAGIC = DiracParseCodes(C.DIRAC_PCODE_MAGIC)
|
||||||
|
)
|
||||||
|
|
||||||
|
// DiracVersionInfo
|
||||||
|
type DiracVersionInfo C.struct_DiracVersionInfo
|
||||||
|
|
||||||
|
// Custom: GetMajor gets `DiracVersionInfo.major` value.
|
||||||
|
func (dvi *DiracVersionInfo) GetMajor() int32 {
|
||||||
|
return (int32)(dvi.major)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetMajor sets `DiracVersionInfo.major` value.
|
||||||
|
func (dvi *DiracVersionInfo) SetMajor(v int32) {
|
||||||
|
dvi.major = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetMajorAddr gets `DiracVersionInfo.major` address.
|
||||||
|
func (dvi *DiracVersionInfo) GetMajorAddr() *int32 {
|
||||||
|
return (*int32)(&dvi.major)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetMinor gets `DiracVersionInfo.minor` value.
|
||||||
|
func (dvi *DiracVersionInfo) GetMinor() int32 {
|
||||||
|
return (int32)(dvi.minor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetMinor sets `DiracVersionInfo.minor` value.
|
||||||
|
func (dvi *DiracVersionInfo) SetMinor(v int32) {
|
||||||
|
dvi.minor = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetMinorAddr gets `DiracVersionInfo.minor` address.
|
||||||
|
func (dvi *DiracVersionInfo) GetMinorAddr() *int32 {
|
||||||
|
return (*int32)(&dvi.minor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AVDiracSeqHeader
|
||||||
|
type AVDiracSeqHeader C.struct_AVDiracSeqHeader
|
||||||
|
|
||||||
|
// Custom: GetWidth gets `AVDiracSeqHeader.width` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetWidth() uint32 {
|
||||||
|
return (uint32)(dsh.width)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetWidth sets `AVDiracSeqHeader.width` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetWidth(v uint32) {
|
||||||
|
dsh.width = (C.uint)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetWidthAddr gets `AVDiracSeqHeader.width` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetWidthAddr() *uint32 {
|
||||||
|
return (*uint32)(&dsh.width)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetHeight gets `AVDiracSeqHeader.height` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetHeight() uint32 {
|
||||||
|
return (uint32)(dsh.height)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetHeight sets `AVDiracSeqHeader.height` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetHeight(v uint32) {
|
||||||
|
dsh.height = (C.uint)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetHeightAddr gets `AVDiracSeqHeader.height` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetHeightAddr() *uint32 {
|
||||||
|
return (*uint32)(&dsh.height)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetChromaFormat gets `AVDiracSeqHeader.chroma_format` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetChromaFormat() uint8 {
|
||||||
|
return (uint8)(dsh.chroma_format)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetChromaFormat sets `AVDiracSeqHeader.chroma_format` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetChromaFormat(v uint8) {
|
||||||
|
dsh.chroma_format = (C.uint8_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetChromaFormatAddr gets `AVDiracSeqHeader.chroma_format` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetChromaFormatAddr() *uint8 {
|
||||||
|
return (*uint8)(&dsh.chroma_format)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetInterlaced gets `AVDiracSeqHeader.interlaced` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetInterlaced() uint8 {
|
||||||
|
return (uint8)(dsh.interlaced)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetInterlaced sets `AVDiracSeqHeader.interlaced` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetInterlaced(v uint8) {
|
||||||
|
dsh.interlaced = (C.uint8_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetInterlacedAddr gets `AVDiracSeqHeader.interlaced` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetInterlacedAddr() *uint8 {
|
||||||
|
return (*uint8)(&dsh.interlaced)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetTopFieldFirst gets `AVDiracSeqHeader.top_field_first` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetTopFieldFirst() uint8 {
|
||||||
|
return (uint8)(dsh.top_field_first)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetTopFieldFirst sets `AVDiracSeqHeader.top_field_first` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetTopFieldFirst(v uint8) {
|
||||||
|
dsh.top_field_first = (C.uint8_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetTopFieldFirstAddr gets `AVDiracSeqHeader.top_field_first` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetTopFieldFirstAddr() *uint8 {
|
||||||
|
return (*uint8)(&dsh.top_field_first)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetFrameRateIndex gets `AVDiracSeqHeader.frame_rate_index` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetFrameRateIndex() uint8 {
|
||||||
|
return (uint8)(dsh.frame_rate_index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetFrameRateIndex sets `AVDiracSeqHeader.frame_rate_index` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetFrameRateIndex(v uint8) {
|
||||||
|
dsh.frame_rate_index = (C.uint8_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetFrameRateIndexAddr gets `AVDiracSeqHeader.frame_rate_index` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetFrameRateIndexAddr() *uint8 {
|
||||||
|
return (*uint8)(&dsh.frame_rate_index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAspectRatioIndex gets `AVDiracSeqHeader.aspect_ratio_index` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetAspectRatioIndex() uint8 {
|
||||||
|
return (uint8)(dsh.aspect_ratio_index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetAspectRatioIndex sets `AVDiracSeqHeader.aspect_ratio_index` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetAspectRatioIndex(v uint8) {
|
||||||
|
dsh.aspect_ratio_index = (C.uint8_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAspectRatioIndexAddr gets `AVDiracSeqHeader.aspect_ratio_index` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetAspectRatioIndexAddr() *uint8 {
|
||||||
|
return (*uint8)(&dsh.aspect_ratio_index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetCleanWidth gets `AVDiracSeqHeader.clean_width` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetCleanWidth() uint16 {
|
||||||
|
return (uint16)(dsh.clean_width)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetCleanWidth sets `AVDiracSeqHeader.clean_width` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetCleanWidth(v uint16) {
|
||||||
|
dsh.clean_width = (C.uint16_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetCleanWidthAddr gets `AVDiracSeqHeader.clean_width` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetCleanWidthAddr() *uint16 {
|
||||||
|
return (*uint16)(&dsh.clean_width)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetCleanHeight gets `AVDiracSeqHeader.clean_height` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetCleanHeight() uint16 {
|
||||||
|
return (uint16)(dsh.clean_height)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetCleanHeight sets `AVDiracSeqHeader.clean_height` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetCleanHeight(v uint16) {
|
||||||
|
dsh.clean_height = (C.uint16_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetCleanHeightAddr gets `AVDiracSeqHeader.clean_height` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetCleanHeightAddr() *uint16 {
|
||||||
|
return (*uint16)(&dsh.clean_height)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetCleanLeftOffset gets `AVDiracSeqHeader.clean_left_offset` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetCleanLeftOffset() uint16 {
|
||||||
|
return (uint16)(dsh.clean_left_offset)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetCleanLeftOffset sets `AVDiracSeqHeader.clean_left_offset` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetCleanLeftOffset(v uint16) {
|
||||||
|
dsh.clean_left_offset = (C.uint16_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetCleanLeftOffsetAddr gets `AVDiracSeqHeader.clean_left_offset` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetCleanLeftOffsetAddr() *uint16 {
|
||||||
|
return (*uint16)(&dsh.clean_left_offset)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetCleanRightOffset gets `AVDiracSeqHeader.clean_right_offset` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetCleanRightOffset() uint16 {
|
||||||
|
return (uint16)(dsh.clean_right_offset)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetCleanRightOffset sets `AVDiracSeqHeader.clean_right_offset` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetCleanRightOffset(v uint16) {
|
||||||
|
dsh.clean_right_offset = (C.uint16_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetCleanRightOffsetAddr gets `AVDiracSeqHeader.clean_right_offset` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetCleanRightOffsetAddr() *uint16 {
|
||||||
|
return (*uint16)(&dsh.clean_right_offset)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetPixelRangeIndex gets `AVDiracSeqHeader.pixel_range_index` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetPixelRangeIndex() uint8 {
|
||||||
|
return (uint8)(dsh.pixel_range_index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetPixelRangeIndex sets `AVDiracSeqHeader.pixel_range_index` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetPixelRangeIndex(v uint8) {
|
||||||
|
dsh.pixel_range_index = (C.uint8_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetPixelRangeIndexAddr gets `AVDiracSeqHeader.pixel_range_index` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetPixelRangeIndexAddr() *uint8 {
|
||||||
|
return (*uint8)(&dsh.pixel_range_index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorSpecIndex gets `AVDiracSeqHeader.color_spec_index` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorSpecIndex() uint8 {
|
||||||
|
return (uint8)(dsh.color_spec_index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetColorSpecIndex sets `AVDiracSeqHeader.color_spec_index` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetColorSpecIndex(v uint8) {
|
||||||
|
dsh.color_spec_index = (C.uint8_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorSpecIndexAddr gets `AVDiracSeqHeader.color_spec_index` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorSpecIndexAddr() *uint8 {
|
||||||
|
return (*uint8)(&dsh.color_spec_index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetProfile gets `AVDiracSeqHeader.profile` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetProfile() int32 {
|
||||||
|
return (int32)(dsh.profile)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetProfile sets `AVDiracSeqHeader.profile` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetProfile(v int32) {
|
||||||
|
dsh.profile = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetProfileAddr gets `AVDiracSeqHeader.profile` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetProfileAddr() *int32 {
|
||||||
|
return (*int32)(&dsh.profile)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetLevel gets `AVDiracSeqHeader.level` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetLevel() int32 {
|
||||||
|
return (int32)(dsh.level)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetLevel sets `AVDiracSeqHeader.level` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetLevel(v int32) {
|
||||||
|
dsh.level = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetLevelAddr gets `AVDiracSeqHeader.level` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetLevelAddr() *int32 {
|
||||||
|
return (*int32)(&dsh.level)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetFramerate gets `AVDiracSeqHeader.framerate` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetFramerate() AVRational {
|
||||||
|
return (AVRational)(dsh.framerate)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetFramerate sets `AVDiracSeqHeader.framerate` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetFramerate(v AVRational) {
|
||||||
|
dsh.framerate = (C.struct_AVRational)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetFramerateAddr gets `AVDiracSeqHeader.framerate` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetFramerateAddr() *AVRational {
|
||||||
|
return (*AVRational)(&dsh.framerate)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetSampleAspectRatio gets `AVDiracSeqHeader.sample_aspect_ratio` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetSampleAspectRatio() AVRational {
|
||||||
|
return (AVRational)(dsh.sample_aspect_ratio)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetSampleAspectRatio sets `AVDiracSeqHeader.sample_aspect_ratio` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetSampleAspectRatio(v AVRational) {
|
||||||
|
dsh.sample_aspect_ratio = (C.struct_AVRational)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetSampleAspectRatioAddr gets `AVDiracSeqHeader.sample_aspect_ratio` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetSampleAspectRatioAddr() *AVRational {
|
||||||
|
return (*AVRational)(&dsh.sample_aspect_ratio)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetPixFmt gets `AVDiracSeqHeader.pix_fmt` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetPixFmt() AVPixelFormat {
|
||||||
|
return (AVPixelFormat)(dsh.pix_fmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetPixFmt sets `AVDiracSeqHeader.pix_fmt` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetPixFmt(v AVPixelFormat) {
|
||||||
|
dsh.pix_fmt = (C.enum_AVPixelFormat)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetPixFmtAddr gets `AVDiracSeqHeader.pix_fmt` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetPixFmtAddr() *AVPixelFormat {
|
||||||
|
return (*AVPixelFormat)(&dsh.pix_fmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorRange gets `AVDiracSeqHeader.color_range` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorRange() AVColorRange {
|
||||||
|
return (AVColorRange)(dsh.color_range)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetColorRange sets `AVDiracSeqHeader.color_range` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetColorRange(v AVColorRange) {
|
||||||
|
dsh.color_range = (C.enum_AVColorRange)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorRangeAddr gets `AVDiracSeqHeader.color_range` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorRangeAddr() *AVColorRange {
|
||||||
|
return (*AVColorRange)(&dsh.color_range)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorPrimaries gets `AVDiracSeqHeader.color_primaries` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorPrimaries() AVColorPrimaries {
|
||||||
|
return (AVColorPrimaries)(dsh.color_primaries)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetColorPrimaries sets `AVDiracSeqHeader.color_primaries` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetColorPrimaries(v AVColorPrimaries) {
|
||||||
|
dsh.color_primaries = (C.enum_AVColorPrimaries)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorPrimariesAddr gets `AVDiracSeqHeader.color_primaries` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorPrimariesAddr() *AVColorPrimaries {
|
||||||
|
return (*AVColorPrimaries)(&dsh.color_primaries)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorTrc gets `AVDiracSeqHeader.color_trc` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorTrc() AVColorTransferCharacteristic {
|
||||||
|
return (AVColorTransferCharacteristic)(dsh.color_trc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetColorTrc sets `AVDiracSeqHeader.color_trc` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetColorTrc(v AVColorTransferCharacteristic) {
|
||||||
|
dsh.color_trc = (C.enum_AVColorTransferCharacteristic)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorTrcAddr gets `AVDiracSeqHeader.color_trc` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorTrcAddr() *AVColorTransferCharacteristic {
|
||||||
|
return (*AVColorTransferCharacteristic)(&dsh.color_trc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorspace gets `AVDiracSeqHeader.colorspace` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorspace() AVColorSpace {
|
||||||
|
return (AVColorSpace)(dsh.colorspace)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetColorspace sets `AVDiracSeqHeader.colorspace` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetColorspace(v AVColorSpace) {
|
||||||
|
dsh.colorspace = (C.enum_AVColorSpace)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetColorspaceAddr gets `AVDiracSeqHeader.colorspace` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetColorspaceAddr() *AVColorSpace {
|
||||||
|
return (*AVColorSpace)(&dsh.colorspace)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetVersion gets `AVDiracSeqHeader.version` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetVersion() DiracVersionInfo {
|
||||||
|
return (DiracVersionInfo)(dsh.version)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetVersion sets `AVDiracSeqHeader.version` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetVersion(v DiracVersionInfo) {
|
||||||
|
dsh.version = (C.struct_DiracVersionInfo)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetVersionAddr gets `AVDiracSeqHeader.version` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetVersionAddr() *DiracVersionInfo {
|
||||||
|
return (*DiracVersionInfo)(&dsh.version)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetBitDepth gets `AVDiracSeqHeader.bit_depth` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetBitDepth() int32 {
|
||||||
|
return (int32)(dsh.bit_depth)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetBitDepth sets `AVDiracSeqHeader.bit_depth` value.
|
||||||
|
func (dsh *AVDiracSeqHeader) SetBitDepth(v int32) {
|
||||||
|
dsh.bit_depth = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetBitDepthAddr gets `AVDiracSeqHeader.bit_depth` address.
|
||||||
|
func (dsh *AVDiracSeqHeader) GetBitDepthAddr() *int32 {
|
||||||
|
return (*int32)(&dsh.bit_depth)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvDiracParseSequenceHeader parses a Dirac sequence header.
|
||||||
|
func AvDiracParseSequenceHeader(dsh **AVDiracSeqHeader, buf *uint8, bufSize uintptr, logCtx CVoidPointer) int32 {
|
||||||
|
return (int32)(C.av_dirac_parse_sequence_header((**C.struct_AVDiracSeqHeader)(unsafe.Pointer(dsh)),
|
||||||
|
(*C.uint8_t)(buf), (C.size_t)(bufSize), VoidPointer(logCtx)))
|
||||||
|
}
|
296
avcodec_dv_profile.go
Normal file
296
avcodec_dv_profile.go
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/dv_profile.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
const (
|
||||||
|
DV_PROFILE_BYTES = C.DV_PROFILE_BYTES
|
||||||
|
)
|
||||||
|
|
||||||
|
// AVDVProfile
|
||||||
|
type AVDVProfile C.struct_AVDVProfile
|
||||||
|
|
||||||
|
// Custom: GetDsf gets `AVDVProfile.dsf` value.
|
||||||
|
func (dvp *AVDVProfile) GetDsf() int32 {
|
||||||
|
return (int32)(dvp.dsf)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetDsf sets `AVDVProfile.dsf` value.
|
||||||
|
func (dvp *AVDVProfile) SetDsf(v int32) {
|
||||||
|
dvp.dsf = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetDsfAddr gets `AVDVProfile.dsf` address.
|
||||||
|
func (dvp *AVDVProfile) GetDsfAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.dsf)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetVideoStype gets `AVDVProfile.video_stype` value.
|
||||||
|
func (dvp *AVDVProfile) GetVideoStype() int32 {
|
||||||
|
return (int32)(dvp.video_stype)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetVideoStype sets `AVDVProfile.video_stype` value.
|
||||||
|
func (dvp *AVDVProfile) SetVideoStype(v int32) {
|
||||||
|
dvp.video_stype = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetVideoStypeAddr gets `AVDVProfile.video_stype` address.
|
||||||
|
func (dvp *AVDVProfile) GetVideoStypeAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.video_stype)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetFrameSize gets `AVDVProfile.frame_size` value.
|
||||||
|
func (dvp *AVDVProfile) GetFrameSize() int32 {
|
||||||
|
return (int32)(dvp.frame_size)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetFrameSize sets `AVDVProfile.frame_size` value.
|
||||||
|
func (dvp *AVDVProfile) SetFrameSize(v int32) {
|
||||||
|
dvp.frame_size = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetFrameSizeAddr gets `AVDVProfile.frame_size` address.
|
||||||
|
func (dvp *AVDVProfile) GetFrameSizeAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.frame_size)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetDifsegSize gets `AVDVProfile.difseg_size` value.
|
||||||
|
func (dvp *AVDVProfile) GetDifsegSize() int32 {
|
||||||
|
return (int32)(dvp.difseg_size)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetDifsegSize sets `AVDVProfile.difseg_size` value.
|
||||||
|
func (dvp *AVDVProfile) SetDifsegSize(v int32) {
|
||||||
|
dvp.difseg_size = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetDifsegSizeAddr gets `AVDVProfile.difseg_size` address.
|
||||||
|
func (dvp *AVDVProfile) GetDifsegSizeAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.difseg_size)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetNDifchan gets `AVDVProfile.n_difchan` value.
|
||||||
|
func (dvp *AVDVProfile) GetNDifchan() int32 {
|
||||||
|
return (int32)(dvp.n_difchan)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetNDifchan sets `AVDVProfile.n_difchan` value.
|
||||||
|
func (dvp *AVDVProfile) SetNDifchan(v int32) {
|
||||||
|
dvp.n_difchan = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetNDifchanAddr gets `AVDVProfile.n_difchan` address.
|
||||||
|
func (dvp *AVDVProfile) GetNDifchanAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.n_difchan)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetTimeBase gets `AVDVProfile.time_base` value.
|
||||||
|
func (dvp *AVDVProfile) GetTimeBase() AVRational {
|
||||||
|
return (AVRational)(dvp.time_base)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetTimeBase sets `AVDVProfile.time_base` value.
|
||||||
|
func (dvp *AVDVProfile) SetTimeBase(v AVRational) {
|
||||||
|
dvp.time_base = (C.struct_AVRational)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetTimeBaseAddr gets `AVDVProfile.time_base` address.
|
||||||
|
func (dvp *AVDVProfile) GetTimeBaseAddr() *AVRational {
|
||||||
|
return (*AVRational)(&dvp.time_base)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetLtcDivisor gets `AVDVProfile.ltc_divisor` value.
|
||||||
|
func (dvp *AVDVProfile) GetLtcDivisor() int32 {
|
||||||
|
return (int32)(dvp.ltc_divisor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetLtcDivisor sets `AVDVProfile.ltc_divisor` value.
|
||||||
|
func (dvp *AVDVProfile) SetLtcDivisor(v int32) {
|
||||||
|
dvp.ltc_divisor = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetLtcDivisorAddr gets `AVDVProfile.ltc_divisor` address.
|
||||||
|
func (dvp *AVDVProfile) GetLtcDivisorAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.ltc_divisor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetHeight gets `AVDVProfile.height` value.
|
||||||
|
func (dvp *AVDVProfile) GetHeight() int32 {
|
||||||
|
return (int32)(dvp.height)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetHeight sets `AVDVProfile.height` value.
|
||||||
|
func (dvp *AVDVProfile) SetHeight(v int32) {
|
||||||
|
dvp.height = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetHeightAddr gets `AVDVProfile.height` address.
|
||||||
|
func (dvp *AVDVProfile) GetHeightAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.height)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetWidth gets `AVDVProfile.width` value.
|
||||||
|
func (dvp *AVDVProfile) GetWidth() int32 {
|
||||||
|
return (int32)(dvp.width)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetWidth sets `AVDVProfile.width` value.
|
||||||
|
func (dvp *AVDVProfile) SetWidth(v int32) {
|
||||||
|
dvp.width = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetWidthAddr gets `AVDVProfile.width` address.
|
||||||
|
func (dvp *AVDVProfile) GetWidthAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.width)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetSar gets `AVDVProfile.sar` value.
|
||||||
|
func (dvp *AVDVProfile) GetSar() []AVRational {
|
||||||
|
return unsafe.Slice((*AVRational)(&dvp.sar[0]), 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetSar sets `AVDVProfile.sar` value.
|
||||||
|
func (dvp *AVDVProfile) SetSar(v []AVRational) {
|
||||||
|
for i := 0; i < FFMIN(len(v), 2); i++ {
|
||||||
|
dvp.sar[i] = (C.struct_AVRational)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetSarAddr gets `AVDVProfile.sar` address.
|
||||||
|
func (dvp *AVDVProfile) GetSarAddr() **AVRational {
|
||||||
|
return (**AVRational)(unsafe.Pointer(&dvp.sar))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetPixFmt gets `AVDVProfile.pix_fmt` value.
|
||||||
|
func (dvp *AVDVProfile) GetPixFmt() AVPixelFormat {
|
||||||
|
return (AVPixelFormat)(dvp.pix_fmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetPixFmt sets `AVDVProfile.pix_fmt` value.
|
||||||
|
func (dvp *AVDVProfile) SetPixFmt(v AVPixelFormat) {
|
||||||
|
dvp.pix_fmt = (C.enum_AVPixelFormat)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetPixFmtAddr gets `AVDVProfile.pix_fmt` address.
|
||||||
|
func (dvp *AVDVProfile) GetPixFmtAddr() *AVPixelFormat {
|
||||||
|
return (*AVPixelFormat)(&dvp.pix_fmt)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetBpm gets `AVDVProfile.bpm` value.
|
||||||
|
func (dvp *AVDVProfile) GetBpm() int32 {
|
||||||
|
return (int32)(dvp.bpm)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetBpm sets `AVDVProfile.bpm` value.
|
||||||
|
func (dvp *AVDVProfile) SetBpm(v int32) {
|
||||||
|
dvp.bpm = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetBpmAddr gets `AVDVProfile.bpm` address.
|
||||||
|
func (dvp *AVDVProfile) GetBpmAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.bpm)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetBlockSizes gets `AVDVProfile.block_sizes` value.
|
||||||
|
func (dvp *AVDVProfile) GetBlockSizes() *uint8 {
|
||||||
|
return (*uint8)(dvp.block_sizes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetBlockSizes sets `AVDVProfile.block_sizes` value.
|
||||||
|
func (dvp *AVDVProfile) SetBlockSizes(v *uint8) {
|
||||||
|
dvp.block_sizes = (*C.uint8_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetBlockSizesAddr gets `AVDVProfile.block_sizes` address.
|
||||||
|
func (dvp *AVDVProfile) GetBlockSizesAddr() **uint8 {
|
||||||
|
return (**uint8)(unsafe.Pointer(&dvp.block_sizes))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAudioStride gets `AVDVProfile.audio_stride` value.
|
||||||
|
func (dvp *AVDVProfile) GetAudioStride() int32 {
|
||||||
|
return (int32)(dvp.audio_stride)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetAudioStride sets `AVDVProfile.audio_stride` value.
|
||||||
|
func (dvp *AVDVProfile) SetAudioStride(v int32) {
|
||||||
|
dvp.audio_stride = (C.int)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAudioStrideAddr gets `AVDVProfile.audio_stride` address.
|
||||||
|
func (dvp *AVDVProfile) GetAudioStrideAddr() *int32 {
|
||||||
|
return (*int32)(&dvp.audio_stride)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAudioMinSamples gets `AVDVProfile.audio_min_samples` value.
|
||||||
|
func (dvp *AVDVProfile) GetAudioMinSamples() []int32 {
|
||||||
|
return unsafe.Slice((*int32)(&dvp.audio_min_samples[0]), 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetAudioMinSamples sets `AVDVProfile.audio_min_samples` value.
|
||||||
|
func (dvp *AVDVProfile) SetAudioMinSamples(v []int32) {
|
||||||
|
for i := 0; i < FFMIN(len(v), 3); i++ {
|
||||||
|
dvp.audio_min_samples[i] = (C.int)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAudioMinSamplesAddr gets `AVDVProfile.audio_min_samples` address.
|
||||||
|
func (dvp *AVDVProfile) GetAudioMinSamplesAddr() **int32 {
|
||||||
|
return (**int32)(unsafe.Pointer(&dvp.audio_min_samples))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAudioSamplesDist gets `AVDVProfile.audio_samples_dist` value.
|
||||||
|
func (dvp *AVDVProfile) GetAudioSamplesDist() []int32 {
|
||||||
|
return unsafe.Slice((*int32)(&dvp.audio_samples_dist[0]), 5)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetAudioSamplesDist sets `AVDVProfile.audio_samples_dist` value.
|
||||||
|
func (dvp *AVDVProfile) SetAudioSamplesDist(v []int32) {
|
||||||
|
for i := 0; i < FFMIN(len(v), 5); i++ {
|
||||||
|
dvp.audio_samples_dist[i] = (C.int)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAudioSamplesDistAddr gets `AVDVProfile.audio_samples_dist` address.
|
||||||
|
func (dvp *AVDVProfile) GetAudioSamplesDistAddr() **int32 {
|
||||||
|
return (**int32)(unsafe.Pointer(&dvp.audio_samples_dist))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAudioShuffle gets `AVDVProfile.audio_shuffle` value.
|
||||||
|
func (dvp *AVDVProfile) GetAudioShuffle() []uint8 {
|
||||||
|
return unsafe.Slice((*uint8)(&dvp.audio_shuffle[0]), 9)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetAudioShuffle sets `AVDVProfile.audio_shuffle` value.
|
||||||
|
func (dvp *AVDVProfile) SetAudioShuffle(v []uint8) {
|
||||||
|
for i := 0; i < FFMIN(len(v), 9); i++ {
|
||||||
|
dvp.audio_shuffle[i] = (C.uint8_t)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetAudioShuffleAddr gets `AVDVProfile.audio_shuffle` address.
|
||||||
|
func (dvp *AVDVProfile) GetAudioShuffleAddr() **uint8 {
|
||||||
|
return (**uint8)(unsafe.Pointer(&dvp.audio_shuffle))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvDvFrameProfile gets a DV profile for the provided compressed frame.
|
||||||
|
func AvDvFrameProfile(sys *AVDVProfile, frame *uint8, bufSize uint32) *AVDVProfile {
|
||||||
|
return (*AVDVProfile)(C.av_dv_frame_profile((*C.struct_AVDVProfile)(sys),
|
||||||
|
(*C.uint8_t)(frame), (C.uint)(bufSize)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvDvCodecProfile gets a DV profile for the provided stream parameters.
|
||||||
|
func AvDvCodecProfile(width, height int32, pixFmt AVPixelFormat) *AVDVProfile {
|
||||||
|
return (*AVDVProfile)(C.av_dv_codec_profile((C.int)(width), (C.int)(height),
|
||||||
|
(C.enum_AVPixelFormat)(pixFmt)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvDvCodecProfile2 gets a DV profile for the provided stream parameters.
|
||||||
|
func AvDvCodecProfile2(width, height int32, pixFmt AVPixelFormat,
|
||||||
|
frameRate AVRational) *AVDVProfile {
|
||||||
|
return (*AVDVProfile)(C.av_dv_codec_profile2((C.int)(width), (C.int)(height),
|
||||||
|
(C.enum_AVPixelFormat)(pixFmt), (C.struct_AVRational)(frameRate)))
|
||||||
|
}
|
17
avcodec_dvxa2.go
Normal file
17
avcodec_dvxa2.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
//go:build ffmpeg_hw_dvxa2
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/dvxa2.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
const {
|
||||||
|
FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG = C.FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG
|
||||||
|
FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO = C.FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO
|
||||||
|
}
|
||||||
|
|
||||||
|
// DxvaContext
|
||||||
|
type DxvaContext C.struct_dxva_context
|
||||||
|
|
16
avcodec_jni.go
Normal file
16
avcodec_jni.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/jni.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AvJniSetJavaVm sets a Java virtual machine which will be used to retrieve the JNI environment.
|
||||||
|
func AvJniSetJavaVm(vm, logCtx CVoidPointer) int32 {
|
||||||
|
return (int32)(C.av_jni_set_java_vm(VoidPointer(vm), VoidPointer(logCtx)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvJniGetJavaVm gets the Java virtual machine which has been set with AvJniSetJavaVm.
|
||||||
|
func AvJniGetJavaVm(logCtx CVoidPointer) {
|
||||||
|
C.av_jni_get_java_vm(VoidPointer(logCtx))
|
||||||
|
}
|
45
avcodec_mediacodec.go
Normal file
45
avcodec_mediacodec.go
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
//go:build ffmpeg_hw_mediacodec
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/mediacodec.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVMediaCodecContext
|
||||||
|
type AVMediaCodecContext C.struct_AVMediaCodecContext
|
||||||
|
|
||||||
|
// AvMediacodecAllocContext allocates and initializes a MediaCodec context.
|
||||||
|
func AvMediacodecAllocContext() *AVMediaCodecContext {
|
||||||
|
return (*AVMediaCodecContext)(C.av_mediacodec_alloc_context())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvMediacodecDefaultInit sets up the MediaCodec context.
|
||||||
|
func AvMediacodecDefaultInit(avctx *AVCodecContext, ctx *AVMediaCodecContext, surface CVoidPointer) int32 {
|
||||||
|
return (int32)(C.av_mediacodec_default_init((*C.struct_AVCodecContext)(avctx),
|
||||||
|
(*C.struct_AVMediaCodecContext)(ctx), VoidPointer(surface)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvMediacodecDefaultFree frees the MediaCodec context
|
||||||
|
func AvMediacodecDefaultFree(avctx *AVCodecContext) {
|
||||||
|
C.av_mediacodec_default_free((*C.struct_AVCodecContext)(avctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// MediaCodecBuffer
|
||||||
|
type MediaCodecBuffer C.struct_MediaCodecBuffer
|
||||||
|
|
||||||
|
// AVMediaCodecBuffer
|
||||||
|
type AVMediaCodecBuffer = MediaCodecBuffer
|
||||||
|
|
||||||
|
// AvMediacodecReleaseBuffer releases a MediaCodec buffer and render it to the surface that is associated
|
||||||
|
// with the decoder.
|
||||||
|
func AvMediacodecReleaseBuffer(buffer *AVMediaCodecBuffer, render int32) int32 {
|
||||||
|
return (int32)(C.av_mediacodec_release_buffer((*C.struct_MediaCodecBuffer)(buffer), (C.int)(render)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvMediacodecRenderBufferAtTime release a MediaCodec buffer and render it at the given time to the surface
|
||||||
|
// that is associated with the decoder.
|
||||||
|
func AvMediacodecRenderBufferAtTime(buffer *AVMediaCodecBuffer, time int64) int32 {
|
||||||
|
return (int32)(C.av_mediacodec_render_buffer_at_time((*C.struct_MediaCodecBuffer)(buffer), (C.int64_t)(time)))
|
||||||
|
}
|
@@ -385,7 +385,7 @@ func AvPacketNewSideData(pkt *AVPacket, _type AVPacketSideDataType, size int32)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AvPacketAddSideData wraps an existing array as a packet side data.
|
// AvPacketAddSideData wraps an existing array as a packet side data.
|
||||||
func AvPacketAddSideData(pkt *AVPacket, _type AVPacketSideDataType, data *uint8, size uint) int32 {
|
func AvPacketAddSideData(pkt *AVPacket, _type AVPacketSideDataType, data *uint8, size uintptr) int32 {
|
||||||
return (int32)(C.av_packet_add_side_data((*C.struct_AVPacket)(pkt),
|
return (int32)(C.av_packet_add_side_data((*C.struct_AVPacket)(pkt),
|
||||||
(C.enum_AVPacketSideDataType)(_type), (*C.uint8_t)(data), (C.size_t)(size)))
|
(C.enum_AVPacketSideDataType)(_type), (*C.uint8_t)(data), (C.size_t)(size)))
|
||||||
}
|
}
|
||||||
|
17
avcodec_qsv.go
Normal file
17
avcodec_qsv.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
//go:build ffmpeg_hw_qsv
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/qsv.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVQSVContext
|
||||||
|
type AVQSVContext = C.struct_AVQSVContext
|
||||||
|
|
||||||
|
// AvQsvAllocContext allocates a new context.
|
||||||
|
// It must be freed by the caller with AvFree().
|
||||||
|
func AvQsvAllocContext() *AVQSVContext {
|
||||||
|
return (*AVQSVContext)(C.av_qsv_alloc_context())
|
||||||
|
}
|
11
avcodec_vaapi.go
Normal file
11
avcodec_vaapi.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
//go:build ffmpeg_hw_vaapi
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/vappi.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// Deprecated: No use
|
||||||
|
type VaapiContext C.struct_vaapi_context
|
42
avcodec_vdpau.go
Normal file
42
avcodec_vdpau.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
//go:build ffmpeg_hw_vdpau
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/vdpau.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *,
|
||||||
|
// const VdpPictureInfo *, uint32_t,
|
||||||
|
// const VdpBitstreamBuffer *);
|
||||||
|
type AVVDPAURenderFunc2 = C.AVVDPAU_Render2
|
||||||
|
|
||||||
|
// AVVDPAUContext
|
||||||
|
type AVVDPAUContext C.struct_AVVDPAUContext
|
||||||
|
|
||||||
|
// AvAllocVdpaucontext allocates AVVDPAUContext.
|
||||||
|
func AvAllocVdpaucontext() *AVVDPAUContext {
|
||||||
|
return (*AVVDPAUContext)(C.av_alloc_vdpaucontext())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvVdpauHwaccelGetRender2
|
||||||
|
func AvVdpauHwaccelGetRender2(ctx *AVVDPAUContext) AVVDPAURenderFunc2 {
|
||||||
|
return (AVVDPAURenderFunc2)(C.av_vdpau_hwaccel_get_render2((*C.struct_AVVDPAUContext)(ctx)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvVdpauHwaccelSetRender2
|
||||||
|
func AvVdpauHwaccelSetRender2(ctx *AVVDPAUContext, f AVVDPAURenderFunc2) {
|
||||||
|
C.av_vdpau_hwaccel_set_render2((*C.struct_AVVDPAUContext)(ctx), (C.AVVDPAU_Render2)(f))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NONEED: av_vdpau_get_surface_parameters
|
||||||
|
|
||||||
|
// NONEED: av_vdpau_get_surface_parameters
|
||||||
|
|
||||||
|
// AvVdpauAllocContext
|
||||||
|
func AvVdpauAllocContext() *AVVDPAUContext {
|
||||||
|
return (*AVVDPAUContext)(C.av_vdpau_alloc_context())
|
||||||
|
}
|
||||||
|
|
||||||
|
// NONEED: av_vdpau_get_profile
|
33
avcodec_videotoolbox.go
Normal file
33
avcodec_videotoolbox.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
//go:build ffmpeg_hw_videotoolbox
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/videotoolbox.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
type AVVideotoolboxContext C.struct_AVVideotoolboxContext
|
||||||
|
|
||||||
|
// AvVideotoolboxAllocContext allocates and initializes a Videotoolbox context.
|
||||||
|
func AvVideotoolboxAllocContext() *AVVideotoolboxContext {
|
||||||
|
return (*AVVideotoolboxContext)(C.av_videotoolbox_alloc_context())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvVideotoolboxDefaultInit creates and sets up the Videotoolbox context using
|
||||||
|
// an internal implementation.
|
||||||
|
func AvVideotoolboxDefaultInit(avctx *AVCodecContext) int32 {
|
||||||
|
return (int32)(C.av_videotoolbox_default_init((*C.struct_AVCodecContext)(avctx)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvVideotoolboxDefaultInit2 creates and sets up the Videotoolbox context using
|
||||||
|
// an internal implementation.
|
||||||
|
func AvVideotoolboxDefaultInit2(avctx *AVCodecContext, vtctx *AVVideotoolboxContext) int32 {
|
||||||
|
return (int32)(C.av_videotoolbox_default_init2((*C.struct_AVCodecContext)(avctx),
|
||||||
|
(*C.struct_AVVideotoolboxContext)(vtctx)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvVideotoolboxDefaultFree frees the Videotoolbox context.
|
||||||
|
func AvVideotoolboxDefaultFree(avctx *AVCodecContext) {
|
||||||
|
C.av_videotoolbox_default_free((*C.struct_AVCodecContext)(avctx))
|
||||||
|
}
|
15
avcodec_xvmc.go
Normal file
15
avcodec_xvmc.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//go:build ffmpeg_hw_xvmc
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavcodec/videotoolbox.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
const (
|
||||||
|
AV_XVMC_ID = C.AV_XVMC_ID
|
||||||
|
)
|
||||||
|
|
||||||
|
// Deprecated: No use
|
||||||
|
type XvmcPixFmt C.struct_xvmc_pix_fmt
|
12
avdevice.go
12
avdevice.go
@@ -146,14 +146,14 @@ const (
|
|||||||
|
|
||||||
// AvDeviceAppToDevControlMessage sends control message from application to device.
|
// AvDeviceAppToDevControlMessage sends control message from application to device.
|
||||||
func AvDeviceAppToDevControlMessage(s *AVFormatContext,
|
func AvDeviceAppToDevControlMessage(s *AVFormatContext,
|
||||||
_type AVAppToDevMessageType, data CVoidPointer, dataSize uint) int32 {
|
_type AVAppToDevMessageType, data CVoidPointer, dataSize uintptr) int32 {
|
||||||
return (int32)(C.avdevice_app_to_dev_control_message((*C.struct_AVFormatContext)(s),
|
return (int32)(C.avdevice_app_to_dev_control_message((*C.struct_AVFormatContext)(s),
|
||||||
(C.enum_AVAppToDevMessageType)(_type), VoidPointer(data), (C.size_t)(dataSize)))
|
(C.enum_AVAppToDevMessageType)(_type), VoidPointer(data), (C.size_t)(dataSize)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// AvDeviceDevToAppControlMessage sends control message from device to application.
|
// AvDeviceDevToAppControlMessage sends control message from device to application.
|
||||||
func AvDeviceDevToAppControlMessage(s *AVFormatContext,
|
func AvDeviceDevToAppControlMessage(s *AVFormatContext,
|
||||||
_type AVDevToAppMessageType, data CVoidPointer, dataSize uint) int32 {
|
_type AVDevToAppMessageType, data CVoidPointer, dataSize uintptr) int32 {
|
||||||
return (int32)(C.avdevice_dev_to_app_control_message((*C.struct_AVFormatContext)(s),
|
return (int32)(C.avdevice_dev_to_app_control_message((*C.struct_AVFormatContext)(s),
|
||||||
(C.enum_AVDevToAppMessageType)(_type), VoidPointer(data), (C.size_t)(dataSize)))
|
(C.enum_AVDevToAppMessageType)(_type), VoidPointer(data), (C.size_t)(dataSize)))
|
||||||
}
|
}
|
||||||
@@ -393,14 +393,6 @@ func (dcl *AVDeviceInfoList) GetDevices() []*AVDeviceInfo {
|
|||||||
return unsafe.Slice((**AVDeviceInfo)(unsafe.Pointer(dcl.devices)), dcl.nb_devices)
|
return unsafe.Slice((**AVDeviceInfo)(unsafe.Pointer(dcl.devices)), dcl.nb_devices)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetDevicesIndex gets `AVDeviceInfoList.devices` index value.
|
|
||||||
func (dcl *AVDeviceInfoList) GetDevicesIdx(idx int) *AVDeviceInfo {
|
|
||||||
if idx >= int(dcl.nb_devices) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVDeviceInfo)(*dcl.devices), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetNbDevices gets `AVDeviceInfoList.nb_devices` value.
|
// Custom: GetNbDevices gets `AVDeviceInfoList.nb_devices` value.
|
||||||
func (dcl *AVDeviceInfoList) GetNbDevices() int32 {
|
func (dcl *AVDeviceInfoList) GetNbDevices() int32 {
|
||||||
return (int32)(dcl.nb_devices)
|
return (int32)(dcl.nb_devices)
|
||||||
|
24
avfilter.go
24
avfilter.go
@@ -207,14 +207,6 @@ func (fltc *AVFilterContext) GetInputsAddr() ***AVFilterLink {
|
|||||||
return (***AVFilterLink)(unsafe.Pointer(&fltc.inputs))
|
return (***AVFilterLink)(unsafe.Pointer(&fltc.inputs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetInputsIdx gets `AVFilterContext.inputs` index value.
|
|
||||||
func (fltc *AVFilterContext) GetInputsIdx(idx int) *AVFilterLink {
|
|
||||||
if idx >= int(fltc.nb_inputs) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVFilterLink)(*fltc.inputs), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetNbInputs gets `AVFilterContext.nb_inputs` value.
|
// Custom: GetNbInputs gets `AVFilterContext.nb_inputs` value.
|
||||||
func (fltc *AVFilterContext) GetNbInputs() uint32 {
|
func (fltc *AVFilterContext) GetNbInputs() uint32 {
|
||||||
return (uint32)(fltc.nb_inputs)
|
return (uint32)(fltc.nb_inputs)
|
||||||
@@ -263,14 +255,6 @@ func (fltc *AVFilterContext) GetOutputsAddr() ***AVFilterLink {
|
|||||||
return (***AVFilterLink)(unsafe.Pointer(&fltc.outputs))
|
return (***AVFilterLink)(unsafe.Pointer(&fltc.outputs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetOutputsIdx gets `AVFilterContext.outputs` index value.
|
|
||||||
func (fltc *AVFilterContext) GetOutputsIdx(idx int) *AVFilterLink {
|
|
||||||
if idx >= int(fltc.nb_outputs) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVFilterLink)(*fltc.outputs), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetNbOutputs gets `AVFilterContext.nb_outputs` value.
|
// Custom: GetNbOutputs gets `AVFilterContext.nb_outputs` value.
|
||||||
func (fltc *AVFilterContext) GetNbOutputs() uint32 {
|
func (fltc *AVFilterContext) GetNbOutputs() uint32 {
|
||||||
return (uint32)(fltc.nb_outputs)
|
return (uint32)(fltc.nb_outputs)
|
||||||
@@ -857,14 +841,6 @@ func (fltg *AVFilterGraph) GetFiltersAddr() ***AVFilterContext {
|
|||||||
return (***AVFilterContext)(unsafe.Pointer(&fltg.filters))
|
return (***AVFilterContext)(unsafe.Pointer(&fltg.filters))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetFiltersIdx gets `AVFilterGraph.filters` index value.
|
|
||||||
func (fltg *AVFilterGraph) GetFiltersIdx(idx int) *AVFilterContext {
|
|
||||||
if idx >= int(fltg.nb_filters) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVFilterContext)(*fltg.filters), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetNbFilters gets `AVFilterGraph.nb_filters` value.
|
// Custom: GetNbFilters gets `AVFilterGraph.nb_filters` value.
|
||||||
func (fltg *AVFilterGraph) GetNbFilters() uint32 {
|
func (fltg *AVFilterGraph) GetNbFilters() uint32 {
|
||||||
return (uint32)(fltg.nb_filters)
|
return (uint32)(fltg.nb_filters)
|
||||||
|
26
avformat.go
26
avformat.go
@@ -1089,14 +1089,6 @@ func (s *AVFormatContext) GetStreamsAddr() ***AVStream {
|
|||||||
return (***AVStream)(unsafe.Pointer(&s.streams))
|
return (***AVStream)(unsafe.Pointer(&s.streams))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetStreamsIdx gets `AVFormatContext.streams` index value.
|
|
||||||
func (s *AVFormatContext) GetStreamsIdx(idx int) *AVStream {
|
|
||||||
if idx >= int(s.nb_streams) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVStream)(*s.streams), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetFilename gets `AVFormatContext.filename` value.
|
// Custom: GetFilename gets `AVFormatContext.filename` value.
|
||||||
func (s *AVFormatContext) GetFilename() string {
|
func (s *AVFormatContext) GetFilename() string {
|
||||||
return C.GoString((*C.char)(&s.filename[0]))
|
return C.GoString((*C.char)(&s.filename[0]))
|
||||||
@@ -1299,14 +1291,6 @@ func (s *AVFormatContext) GetProgramsAddr() ***AVProgram {
|
|||||||
return (***AVProgram)(unsafe.Pointer(&s.programs))
|
return (***AVProgram)(unsafe.Pointer(&s.programs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetProgramsIdx gets `AVFormatContext.programs` index value.
|
|
||||||
func (s *AVFormatContext) GetProgramsIdx(idx int) *AVProgram {
|
|
||||||
if idx >= int(s.nb_programs) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVProgram)(*s.programs), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetVideoCodecId gets `AVFormatContext.video_codec_id` value.
|
// Custom: GetVideoCodecId gets `AVFormatContext.video_codec_id` value.
|
||||||
func (s *AVFormatContext) GetVideoCodecId() AVCodecID {
|
func (s *AVFormatContext) GetVideoCodecId() AVCodecID {
|
||||||
return (AVCodecID)(s.video_codec_id)
|
return (AVCodecID)(s.video_codec_id)
|
||||||
@@ -1415,14 +1399,6 @@ func (s *AVFormatContext) GetChaptersAddr() ***AVChapter {
|
|||||||
return (***AVChapter)(&s.chapters)
|
return (***AVChapter)(&s.chapters)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetChaptersIdx gets `AVFormatContext.chapters` index value.
|
|
||||||
func (s *AVFormatContext) GetChaptersIdx(idx int) *AVChapter {
|
|
||||||
if idx >= int(s.nb_chapters) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVChapter)(*s.chapters), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetMetadata gets `AVFormatContext.metadata` value.
|
// Custom: GetMetadata gets `AVFormatContext.metadata` value.
|
||||||
func (s *AVFormatContext) GetMetadata() *AVDictionary {
|
func (s *AVFormatContext) GetMetadata() *AVDictionary {
|
||||||
return (*AVDictionary)(s.metadata)
|
return (*AVDictionary)(s.metadata)
|
||||||
@@ -2208,7 +2184,7 @@ func AvFormatNewStream(s *AVFormatContext, c *AVCodec) *AVStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AvStreamAddSideData wraps an existing array as stream side data.
|
// AvStreamAddSideData wraps an existing array as stream side data.
|
||||||
func AvStreamAddSideData(st *AVStream, _type AVPacketSideDataType, data *uint8, size uint) int32 {
|
func AvStreamAddSideData(st *AVStream, _type AVPacketSideDataType, data *uint8, size uintptr) int32 {
|
||||||
return (int32)(C.av_stream_add_side_data((*C.struct_AVStream)(st),
|
return (int32)(C.av_stream_add_side_data((*C.struct_AVStream)(st),
|
||||||
(C.enum_AVPacketSideDataType)(_type), (*C.uint8_t)(data), (C.size_t)(size)))
|
(C.enum_AVPacketSideDataType)(_type), (*C.uint8_t)(data), (C.size_t)(size)))
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ func (icb *AVIOInterruptCB) GetOpaqueAddr() *unsafe.Pointer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AVIODirEntryType
|
// AVIODirEntryType
|
||||||
type AVIODirEntryType = C.enum_AVIODirEntryType
|
type AVIODirEntryType = int32 // C.enum_AVIODirEntryType
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AVIO_ENTRY_UNKNOWN = AVIODirEntryType(C.AVIO_ENTRY_UNKNOWN)
|
AVIO_ENTRY_UNKNOWN = AVIODirEntryType(C.AVIO_ENTRY_UNKNOWN)
|
||||||
@@ -1041,10 +1041,8 @@ func AvIOSeekTime(s *AVIOContext, streamIndex int32, timestamp int64, flags int3
|
|||||||
(C.int)(streamIndex), (C.int64_t)(timestamp), (C.int)(flags)))
|
(C.int)(streamIndex), (C.int64_t)(timestamp), (C.int)(flags)))
|
||||||
}
|
}
|
||||||
|
|
||||||
type AVBPrint C.struct_AVBPrint
|
|
||||||
|
|
||||||
// AvIOReadToBprint reads contents of h into print buffer, up to max_size bytes, or up to EOF.
|
// AvIOReadToBprint reads contents of h into print buffer, up to max_size bytes, or up to EOF.
|
||||||
func AvIOReadToBprint(s *AVIOContext, pb *AVBPrint, maxSize uint) int32 {
|
func AvIOReadToBprint(s *AVIOContext, pb *AVBPrint, maxSize uintptr) int32 {
|
||||||
return (int32)(C.avio_read_to_bprint((*C.struct_AVIOContext)(s),
|
return (int32)(C.avio_read_to_bprint((*C.struct_AVIOContext)(s),
|
||||||
(*C.struct_AVBPrint)(pb), (C.size_t)(maxSize)))
|
(*C.struct_AVBPrint)(pb), (C.size_t)(maxSize)))
|
||||||
}
|
}
|
||||||
|
13
avutil_adler32.go
Normal file
13
avutil_adler32.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/adler32.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
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)))
|
||||||
|
}
|
26
avutil_aes.go
Normal file
26
avutil_aes.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/aes.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVAES
|
||||||
|
type AVAES C.struct_AVAES
|
||||||
|
|
||||||
|
// AvAesAlloc allocates an AVAES context.
|
||||||
|
func AvAesAlloc() *AVAES {
|
||||||
|
return (*AVAES)(C.av_aes_alloc())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesInit initializes an AVAES context.
|
||||||
|
func AvAesInit(a *AVAES, key *uint8, keyBits, decrypt int32) int32 {
|
||||||
|
return (int32)(C.av_aes_init((*C.struct_AVAES)(a), (*C.uint8_t)(key),
|
||||||
|
(C.int)(keyBits), (C.int)(decrypt)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesCrypt encrypts or decrypts a buffer using a previously initialized context.
|
||||||
|
func AvAesCrypt(a *AVAES, dst, src *uint8, count int32, iv *uint8, decrypt int32) {
|
||||||
|
C.av_aes_crypt((*C.struct_AVAES)(a), (*C.uint8_t)(dst), (*C.uint8_t)(src),
|
||||||
|
(C.int)(count), (*C.uint8_t)(iv), (C.int)(decrypt))
|
||||||
|
}
|
60
avutil_aes_ctr.go
Normal file
60
avutil_aes_ctr.go
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/aes_ctr.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
const (
|
||||||
|
AES_CTR_KEY_SIZE = C.AES_CTR_KEY_SIZE
|
||||||
|
AES_CTR_IV_SIZE = C.AES_CTR_IV_SIZE
|
||||||
|
)
|
||||||
|
|
||||||
|
// AVAESCTR
|
||||||
|
type AVAESCTR C.struct_AVAESCTR
|
||||||
|
|
||||||
|
// AvAesCtrAlloc allocates an AVAESCTR context.
|
||||||
|
func AvAesCtrAlloc() *AVAESCTR {
|
||||||
|
return (*AVAESCTR)(C.av_aes_ctr_alloc())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesCtrInit initializes an AVAESCTR context.
|
||||||
|
func AvAesCtrInit(a *AVAESCTR, key *uint8) int32 {
|
||||||
|
return (int32)(C.av_aes_ctr_init((*C.struct_AVAESCTR)(a), (*C.uint8_t)(key)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesCtrFree releases an AVAESCTR context.
|
||||||
|
func AvAesCtrFree(a *AVAESCTR) {
|
||||||
|
C.av_aes_ctr_free((*C.struct_AVAESCTR)(a))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesCtrCrypt processes a buffer using a previously initialized context.
|
||||||
|
func AvAesCtrCrypt(a *AVAESCTR, dst, src *uint8, size int32) {
|
||||||
|
C.av_aes_ctr_crypt((*C.struct_AVAESCTR)(a),
|
||||||
|
(*C.uint8_t)(dst), (*C.uint8_t)(src), (C.int)(size))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesCtrGetIv gets the current iv.
|
||||||
|
func AvAesCtrGetIv(a *AVAESCTR) *uint8 {
|
||||||
|
return (*uint8)(C.av_aes_ctr_get_iv((*C.struct_AVAESCTR)(a)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesCtrSetRandomIv generates a random iv.
|
||||||
|
func AvAesCtrSetRandomIv(a *AVAESCTR) {
|
||||||
|
C.av_aes_ctr_set_random_iv((*C.struct_AVAESCTR)(a))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesCtrSetIv changes the 8-byte iv.
|
||||||
|
func AvAesCtrSetIv(a *AVAESCTR, iv *uint8) {
|
||||||
|
C.av_aes_ctr_set_iv((*C.struct_AVAESCTR)(a), (*C.uint8_t)(iv))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesCtrSetFullIv changes the "full" 16-byte iv, including the counter.
|
||||||
|
func AvAesCtrSetFullIv(a *AVAESCTR, iv *uint8) {
|
||||||
|
C.av_aes_ctr_set_full_iv((*C.struct_AVAESCTR)(a), (*C.uint8_t)(iv))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAesCtrIncrementIv increments the top 64 bit of the iv.
|
||||||
|
func AvAesCtrIncrementIv(a *AVAESCTR) {
|
||||||
|
C.av_aes_ctr_increment_iv((*C.struct_AVAESCTR)(a))
|
||||||
|
}
|
19
avutil_assert.go
Normal file
19
avutil_assert.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/avassert.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AvAssert0
|
||||||
|
func AvAssert0(cond bool) {
|
||||||
|
if !cond {
|
||||||
|
AvLog(nil, AV_LOG_PANIC, "Assertion failed\n")
|
||||||
|
panic("AvAssert0 assert failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvAssert0Fpu asserts that floating point operations can be executed.
|
||||||
|
func AvAssert0Fpu() {
|
||||||
|
C.av_assert0_fpu()
|
||||||
|
}
|
6
avutil_attributes.go
Normal file
6
avutil_attributes.go
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/attributes.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
86
avutil_avstring.go
Normal file
86
avutil_avstring.go
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/avstring.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// NONEED: av_strstart
|
||||||
|
|
||||||
|
// NONEED: av_stristart
|
||||||
|
|
||||||
|
// NONEED: av_stristr
|
||||||
|
|
||||||
|
// NONEED: av_strnstr
|
||||||
|
|
||||||
|
// NONEED: av_strlcpy
|
||||||
|
|
||||||
|
// NONEED: av_strlcat
|
||||||
|
|
||||||
|
// NONEED: av_strlcatf
|
||||||
|
|
||||||
|
// NONEED: av_strnlen
|
||||||
|
|
||||||
|
// NONEED: av_asprintf
|
||||||
|
|
||||||
|
// NONEED: av_d2str
|
||||||
|
|
||||||
|
// NONEED: av_get_token
|
||||||
|
|
||||||
|
// NONEED: av_strtok
|
||||||
|
|
||||||
|
// NONEED: av_isgraph
|
||||||
|
|
||||||
|
// NONEED: av_isspace
|
||||||
|
|
||||||
|
// NONEED: av_toupper
|
||||||
|
|
||||||
|
// NONEED: av_tolower
|
||||||
|
|
||||||
|
// NONEED: av_isxdigit
|
||||||
|
|
||||||
|
// NONEED: av_strcasecmp
|
||||||
|
|
||||||
|
// NONEED: av_strncasecmp
|
||||||
|
|
||||||
|
// NONEED: av_strireplace
|
||||||
|
|
||||||
|
// NONEED: av_basename
|
||||||
|
|
||||||
|
// NONEED: av_dirname
|
||||||
|
|
||||||
|
// NONEED: av_match_name
|
||||||
|
|
||||||
|
// NONEED: av_append_path_component
|
||||||
|
|
||||||
|
type AVEscapeMode C.enum_AVEscapeMode
|
||||||
|
|
||||||
|
const (
|
||||||
|
AV_ESCAPE_MODE_AUTO = C.AV_ESCAPE_MODE_AUTO
|
||||||
|
AV_ESCAPE_MODE_BACKSLASH = C.AV_ESCAPE_MODE_BACKSLASH
|
||||||
|
AV_ESCAPE_MODE_QUOTE = C.AV_ESCAPE_MODE_QUOTE
|
||||||
|
AV_ESCAPE_MODE_XML = C.AV_ESCAPE_MODE_XML
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
AV_ESCAPE_FLAG_WHITESPACE = C.AV_ESCAPE_FLAG_WHITESPACE
|
||||||
|
AV_ESCAPE_FLAG_STRICT = C.AV_ESCAPE_FLAG_STRICT
|
||||||
|
AV_ESCAPE_FLAG_XML_SINGLE_QUOTES = C.AV_ESCAPE_FLAG_XML_SINGLE_QUOTES
|
||||||
|
AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES = C.AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES
|
||||||
|
)
|
||||||
|
|
||||||
|
// NONEED: av_escape
|
||||||
|
|
||||||
|
const (
|
||||||
|
AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES = C.AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES
|
||||||
|
AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS = C.AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS
|
||||||
|
AV_UTF8_FLAG_ACCEPT_SURROGATES = C.AV_UTF8_FLAG_ACCEPT_SURROGATES
|
||||||
|
AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES = C.AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES
|
||||||
|
AV_UTF8_FLAG_ACCEPT_ALL = C.AV_UTF8_FLAG_ACCEPT_ALL
|
||||||
|
)
|
||||||
|
|
||||||
|
// NONEED: av_utf8_decode
|
||||||
|
|
||||||
|
// NONEED: av_match_list
|
||||||
|
|
||||||
|
// NONEED: av_sscanf
|
26
avutil_base64.go
Normal file
26
avutil_base64.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/base64.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AvBase64Decode decodes a base64-encoded string.
|
||||||
|
func AvBase64Decode(out *uint8, in *int8, outSize int32) int32 {
|
||||||
|
return (int32)(C.av_base64_decode((*C.uint8_t)(out), (*C.char)(in), (C.int)(outSize)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AV_BASE64_DECODE_SIZE
|
||||||
|
func AV_BASE64_DECODE_SIZE[T HelperInteger](x T) T {
|
||||||
|
return x * 3 / 4
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBase64Encode encodes data to base64 and null-terminate.
|
||||||
|
func AvBase64Encode(out *int8, outSize int32, in *uint8, inSize int32) *int8 {
|
||||||
|
return (*int8)(C.av_base64_encode((*C.char)(out), (C.int)(outSize), (*C.uint8_t)(in), (C.int)(inSize)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AV_BASE64_SIZE
|
||||||
|
func AV_BASE64_SIZE[T HelperInteger](x T) T {
|
||||||
|
return (x+2)/3*4 + 1
|
||||||
|
}
|
87
avutil_blowfish.go
Normal file
87
avutil_blowfish.go
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/blowfish.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
const (
|
||||||
|
AV_BF_ROUNDS = C.AV_BF_ROUNDS
|
||||||
|
)
|
||||||
|
|
||||||
|
type AVBlowfish C.struct_AVBlowfish
|
||||||
|
|
||||||
|
// Custom: GetP gets `AVBlowfish.p` value.
|
||||||
|
func (bf *AVBlowfish) GetP() []uint32 {
|
||||||
|
return unsafe.Slice((*uint32)(&bf.p[0]), AV_BF_ROUNDS+2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetP sets `AVBlowfish.p` value.
|
||||||
|
func (bf *AVBlowfish) SetP(v []uint32) {
|
||||||
|
for i := 0; i < FFMIN(len(v), AV_BF_ROUNDS+2); i++ {
|
||||||
|
bf.p[i] = (C.uint32_t)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetPAddr gets `AVBlowfish.p` address.
|
||||||
|
func (bf *AVBlowfish) GetPAddr() **uint32 {
|
||||||
|
return (**uint32)(unsafe.Pointer(&bf.p))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetS gets `AVBlowfish.s` value.
|
||||||
|
func (bf *AVBlowfish) GetS() []uint32 {
|
||||||
|
return unsafe.Slice((*uint32)(&bf.s[0][0]), 4*256)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetS sets `AVBlowfish.s` value.
|
||||||
|
func (bf *AVBlowfish) SetS(v []uint32) {
|
||||||
|
for i := 0; i < FFMIN(len(v), 4*256); i++ {
|
||||||
|
bf.s[i/256][i%256] = (C.uint32_t)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetSAddr gets `AVBlowfish.s` address.
|
||||||
|
func (bf *AVBlowfish) GetSAddr() **uint32 {
|
||||||
|
return (**uint32)(unsafe.Pointer(&bf.s))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetSIdx gets `AVBlowfish.s` index value.
|
||||||
|
func (bf *AVBlowfish) GetSIdx(x, y int) uint32 {
|
||||||
|
return (uint32)(bf.s[x][y])
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: SetSIdx sets `AVBlowfish.s` index value.
|
||||||
|
func (bf *AVBlowfish) SetSIdx(x, y int, v uint32) {
|
||||||
|
bf.s[x][y] = (C.uint32_t)(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom: GetSIdxAddr gets `AVBlowfish.s` index address.
|
||||||
|
func (bf *AVBlowfish) GetSIdxAddr(x, y int) *uint32 {
|
||||||
|
return (*uint32)(&bf.s[x][y])
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBlowfishAlloc allocates an AVBlowfish context.
|
||||||
|
func AvBlowfishAlloc() *AVBlowfish {
|
||||||
|
return (*AVBlowfish)(C.av_blowfish_alloc())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBlowfishInit initializes an AVBlowfish context.
|
||||||
|
func AvBlowfishInit(ctx *AVBlowfish, key *uint8, keyLen int32) {
|
||||||
|
C.av_blowfish_init((*C.struct_AVBlowfish)(ctx),
|
||||||
|
(*C.uint8_t)(key), (C.int)(keyLen))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBlowfishCryptEcb encrypts or decrypts a buffer using a previously initialized context.
|
||||||
|
func AvBlowfishCryptEcb(ctx *AVBlowfish, xl, xr *uint32, decrypt int32) {
|
||||||
|
C.av_blowfish_crypt_ecb((*C.struct_AVBlowfish)(ctx),
|
||||||
|
(*C.uint32_t)(xl), (*C.uint32_t)(xr), (C.int)(decrypt))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBlowfishCrypt encrypts or decrypts a buffer using a previously initialized context.
|
||||||
|
func AvBlowfishCrypt(ctx *AVBlowfish, dst, src *uint8,
|
||||||
|
count int32, iv *uint8, decrypt int32) {
|
||||||
|
C.av_blowfish_crypt((*C.struct_AVBlowfish)(ctx),
|
||||||
|
(*C.uint8_t)(dst), (*C.uint8_t)(src),
|
||||||
|
(C.int)(count), (*C.uint8_t)(iv), (C.int)(decrypt))
|
||||||
|
}
|
82
avutil_bprint.go
Normal file
82
avutil_bprint.go
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/bprint.h>
|
||||||
|
|
||||||
|
void av_bprintf_wrap(AVBPrint *buf, const char *fmt) {
|
||||||
|
av_bprintf(buf, fmt, NULL);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AVBPrint C.struct_AVBPrint
|
||||||
|
|
||||||
|
const (
|
||||||
|
AV_BPRINT_SIZE_UNLIMITED = C.AV_BPRINT_SIZE_UNLIMITED
|
||||||
|
AV_BPRINT_SIZE_AUTOMATIC = C.AV_BPRINT_SIZE_AUTOMATIC
|
||||||
|
AV_BPRINT_SIZE_COUNT_ONLY = C.AV_BPRINT_SIZE_COUNT_ONLY
|
||||||
|
)
|
||||||
|
|
||||||
|
// AvBprintInit initializes a print buffer.
|
||||||
|
func AvBprintInit(buf *AVBPrint, sizeInit, sizeMax uint32) {
|
||||||
|
C.av_bprint_init((*C.struct_AVBPrint)(buf), (C.uint)(sizeInit), (C.uint)(sizeMax))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBprintInitForBuffer initializes a print buffer using a pre-existing buffer.
|
||||||
|
func AvBprintInitForBuffer(buf *AVBPrint, buffer *int8, size uint32) {
|
||||||
|
C.av_bprint_init_for_buffer((*C.struct_AVBPrint)(buf), (*C.char)(buffer), (C.uint)(size))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBprintf appends a formatted string to a print buffer.
|
||||||
|
func AvBprintf(buf *AVBPrint, _fmt string, va ...any) {
|
||||||
|
strPtr, strFunc := StringCasting(fmt.Sprintf(_fmt, va...))
|
||||||
|
defer strFunc()
|
||||||
|
C.av_bprintf_wrap((*C.struct_AVBPrint)(buf), (*C.char)(strPtr))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NONEED: av_vbprintf
|
||||||
|
|
||||||
|
// AvBprintChars appends char c n times to a print buffer.
|
||||||
|
func AvBprintChars(buf *AVBPrint, c int8, n uint32) {
|
||||||
|
C.av_bprint_chars((*C.struct_AVBPrint)(buf), (C.char)(c), (C.uint)(n))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBprintAppendData appends data to a print buffer.
|
||||||
|
func AvBprintAppendData(buf *AVBPrint, data *int8, size uint32) {
|
||||||
|
C.av_bprint_append_data((*C.struct_AVBPrint)(buf), (*C.char)(data), (C.uint)(size))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NONEED: av_bprint_strftime
|
||||||
|
|
||||||
|
// AvBprintGetBuffer allocates bytes in the buffer for external use.
|
||||||
|
func AvBprintGetBuffer(buf *AVBPrint, size uint32, mem **uint8, actualSize *uint32) {
|
||||||
|
C.av_bprint_get_buffer((*C.struct_AVBPrint)(buf), (C.uint)(size),
|
||||||
|
(**C.uint8_t)(unsafe.Pointer(mem)), (*C.uint)(actualSize))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBprintClear resets the string to "" but keep internal allocated data.
|
||||||
|
func AvBprintClear(buf *AVBPrint) {
|
||||||
|
C.av_bprint_clear((*C.struct_AVBPrint)(buf))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBprintIsComplete tests if the print buffer is complete (not truncated).
|
||||||
|
func AvBprintIsComplete(buf *AVBPrint) int32 {
|
||||||
|
return (int32)(C.av_bprint_is_complete((*C.struct_AVBPrint)(buf)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBprintFinalize finalizes a print buffer.
|
||||||
|
func AvBprintFinalize(buf *AVBPrint, retStr **int8) int32 {
|
||||||
|
return (int32)(C.av_bprint_finalize((*C.struct_AVBPrint)(buf),
|
||||||
|
(**C.char)(unsafe.Pointer(retStr))))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBprintEscape escapes the content in src and append it to dstbuf.
|
||||||
|
func AvBprintEscape(dstbuf *AVBPrint, src, specialChars *int8, mode AVEscapeMode, flags int32) {
|
||||||
|
C.av_bprint_escape((*C.struct_AVBPrint)(dstbuf),
|
||||||
|
(*C.char)(src), (*C.char)(specialChars),
|
||||||
|
(C.enum_AVEscapeMode)(mode), (C.int)(flags))
|
||||||
|
}
|
21
avutil_bswap.go
Normal file
21
avutil_bswap.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/bswap.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AvBswap16
|
||||||
|
func AvBswap16(x uint16) uint16 {
|
||||||
|
return (uint16)(C.av_bswap16((C.uint16_t)(x)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBswap32
|
||||||
|
func AvBswap32(x uint32) uint32 {
|
||||||
|
return (uint32)(C.av_bswap32((C.uint32_t)(x)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvBswap64
|
||||||
|
func AvBswap64(x uint64) uint64 {
|
||||||
|
return (uint64)(C.av_bswap64((C.uint64_t)(x)))
|
||||||
|
}
|
26
avutil_camellia.go
Normal file
26
avutil_camellia.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/camellia.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
type AVCAMELLIA C.struct_AVCAMELLIA
|
||||||
|
|
||||||
|
// AvCamelliaAlloc allocates an AVCAMELLIA context.
|
||||||
|
func AvCamelliaAlloc() *AVCAMELLIA {
|
||||||
|
return (*AVCAMELLIA)(C.av_camellia_alloc())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvCamelliaInit initializes an AVCAMELLIA context.
|
||||||
|
func AvCamelliaInit(ctx *AVCAMELLIA, key *uint8, keyBits int32) int32 {
|
||||||
|
return (int32)(C.av_camellia_init((*C.struct_AVCAMELLIA)(ctx),
|
||||||
|
(*C.uint8_t)(key), (C.int)(keyBits)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvCamelliaCrypt encrypts or decrypts a buffer using a previously initialized context.
|
||||||
|
func AvCamelliaCrypt(ctx *AVCAMELLIA, dst, src *uint8, count int32, iv *uint8, decrypt int32) {
|
||||||
|
C.av_camellia_crypt((*C.struct_AVCAMELLIA)(ctx),
|
||||||
|
(*C.uint8_t)(dst), (*C.uint8_t)(src),
|
||||||
|
(C.int)(count), (*C.uint8_t)(iv), (C.int)(decrypt))
|
||||||
|
}
|
33
avutil_cast5.go
Normal file
33
avutil_cast5.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/cast5.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
type AVCAST5 C.struct_AVCAST5
|
||||||
|
|
||||||
|
// AvCast5Alloc allocates an AVCAST5 context.
|
||||||
|
func AvCast5Alloc() *AVCAST5 {
|
||||||
|
return (*AVCAST5)(C.av_cast5_alloc())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvCast5Init initializes an AVCAST5 context.
|
||||||
|
func AvCast5Init(ctx *AVCAST5, key *uint8, keyBits int32) int32 {
|
||||||
|
return (int32)(C.av_cast5_init((*C.struct_AVCAST5)(ctx),
|
||||||
|
(*C.uint8_t)(key), (C.int)(keyBits)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvCast5Crypt encrypts or decrypts a buffer using a previously initialized context.
|
||||||
|
func AvCast5Crypt(ctx *AVCAST5, dst, src *uint8, count, decrypt int32) {
|
||||||
|
C.av_cast5_crypt((*C.struct_AVCAST5)(ctx),
|
||||||
|
(*C.uint8_t)(dst), (*C.uint8_t)(src),
|
||||||
|
(C.int)(count), (C.int)(decrypt))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvCast5Crypt2 encrypts or decrypts a buffer using a previously initialized context.
|
||||||
|
func AvCast5Crypt2(ctx *AVCAST5, dst, src *uint8, count int32, iv *uint8, decrypt int32) {
|
||||||
|
C.av_cast5_crypt2((*C.struct_AVCAST5)(ctx),
|
||||||
|
(*C.uint8_t)(dst), (*C.uint8_t)(src),
|
||||||
|
(C.int)(count), (*C.uint8_t)(iv), (C.int)(decrypt))
|
||||||
|
}
|
@@ -64,13 +64,13 @@ const (
|
|||||||
// In case of failure the global variable errno is set to indicate the
|
// In case of failure the global variable errno is set to indicate the
|
||||||
// error. Even in case of failure AvStrerror() will print a generic
|
// error. Even in case of failure AvStrerror() will print a generic
|
||||||
// error message indicating the errnum provided to errbuf.
|
// error message indicating the errnum provided to errbuf.
|
||||||
func AvStrerror(errnum int32, errbuf *int8, errbufSize uint) int32 {
|
func AvStrerror(errnum int32, errbuf *int8, errbufSize uintptr) int32 {
|
||||||
return (int32)(C.av_strerror((C.int)(errnum), (*C.char)(errbuf), (C.size_t)(errbufSize)))
|
return (int32)(C.av_strerror((C.int)(errnum), (*C.char)(errbuf), (C.size_t)(errbufSize)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// AvMakeErrorString fills the provided buffer with a string containing an error string
|
// AvMakeErrorString fills the provided buffer with a string containing an error string
|
||||||
// corresponding to the AVERROR code errnum.
|
// corresponding to the AVERROR code errnum.
|
||||||
func AvMakeErrorString(errbuf *int8, errbufSize uint, errnum int32) *int8 {
|
func AvMakeErrorString(errbuf *int8, errbufSize uintptr, errnum int32) *int8 {
|
||||||
return (*int8)(C.av_make_error_string((*C.char)(errbuf), (C.size_t)(errbufSize), (C.int)(errnum)))
|
return (*int8)(C.av_make_error_string((*C.char)(errbuf), (C.size_t)(errbufSize), (C.int)(errnum)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
34
avutil_file.go
Normal file
34
avutil_file.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/file.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// AvFileMap reads the file with name filename, and put its content in a newly
|
||||||
|
// allocated buffer or map it with mmap() when available.
|
||||||
|
func AvFileMap(filename string, bufptr **uint8, size *uintptr, logOffset int32, logCtx CVoidPointer) int32 {
|
||||||
|
filenamePtr, filenameFunc := StringCasting(filename)
|
||||||
|
defer filenameFunc()
|
||||||
|
return (int32)(C.av_file_map((*C.char)(filenamePtr), (**C.uint8_t)(unsafe.Pointer(bufptr)),
|
||||||
|
(*C.size_t)(unsafe.Pointer(size)), (C.int)(logOffset), VoidPointer(logCtx)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvFileUnmap unmaps or frees the buffer bufptr created by AvFileMap().
|
||||||
|
func AvFileUnmap(bufptr *uint8, size uintptr) {
|
||||||
|
C.av_file_unmap((*C.uint8_t)(bufptr), (C.size_t)(size))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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))
|
||||||
|
ret = (int32)(C.av_tempfile((*C.char)(prefixPtr),
|
||||||
|
(**C.char)(unsafe.Pointer(&filenamePtr)),
|
||||||
|
(C.int)(logOffset),
|
||||||
|
VoidPointer(logCtx)))
|
||||||
|
return C.GoString(filenamePtr), ret
|
||||||
|
}
|
148
avutil_frame.go
148
avutil_frame.go
@@ -232,51 +232,35 @@ func (frame *AVFrame) GetData() []*uint8 {
|
|||||||
return unsafe.Slice((**uint8)(unsafe.Pointer(&frame.data[0])), AV_NUM_DATA_POINTERS)
|
return unsafe.Slice((**uint8)(unsafe.Pointer(&frame.data[0])), AV_NUM_DATA_POINTERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom: SetData sets `AVFrame.data` value.
|
||||||
|
func (frame *AVFrame) SetData(v []*uint8) {
|
||||||
|
for i := 0; i < FFMIN(len(v), AV_NUM_DATA_POINTERS); i++ {
|
||||||
|
frame.data[i] = (*C.uint8_t)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Custom: GetDataAddr gets `AVFrame.data` address.
|
// Custom: GetDataAddr gets `AVFrame.data` address.
|
||||||
func (frame *AVFrame) GetDataAddr() ***uint8 {
|
func (frame *AVFrame) GetDataAddr() ***uint8 {
|
||||||
return (***uint8)(unsafe.Pointer(&frame.data))
|
return (***uint8)(unsafe.Pointer(&frame.data))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetDataIdx gets `AVFrame.data` index value.
|
|
||||||
func (frame *AVFrame) GetDataIdx(idx int) *uint8 {
|
|
||||||
return (*uint8)(frame.data[idx])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: SetDataIdx sets `AVFrame.data` index value.
|
|
||||||
func (frame *AVFrame) SetDataIdx(idx int, v *uint8) {
|
|
||||||
frame.data[idx] = (*C.uint8_t)(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetDataIdxAddr gets `AVFrame.data` index address.
|
|
||||||
func (frame *AVFrame) GetDataIdxAddr(idx int) **uint8 {
|
|
||||||
return (**uint8)(unsafe.Pointer(&frame.data[idx]))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetLinesize gets `AVFrame.linesize` value.
|
// Custom: GetLinesize gets `AVFrame.linesize` value.
|
||||||
func (frame *AVFrame) GetLinesize() []int32 {
|
func (frame *AVFrame) GetLinesize() []int32 {
|
||||||
return unsafe.Slice((*int32)(&frame.linesize[0]), AV_NUM_DATA_POINTERS)
|
return unsafe.Slice((*int32)(&frame.linesize[0]), AV_NUM_DATA_POINTERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom: SetLinesize sets `AVFrame.linesize` value.
|
||||||
|
func (frame *AVFrame) SetLinesize(v []int32) {
|
||||||
|
for i := 0; i < FFMIN(len(v), AV_NUM_DATA_POINTERS); i++ {
|
||||||
|
frame.linesize[i] = (C.int)(v[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Custom: GetLinesizeAddr gets `AVFrame.linesize` address.
|
// Custom: GetLinesizeAddr gets `AVFrame.linesize` address.
|
||||||
func (frame *AVFrame) GetLinesizeAddr() **int32 {
|
func (frame *AVFrame) GetLinesizeAddr() **int32 {
|
||||||
return (**int32)(unsafe.Pointer(&frame.linesize))
|
return (**int32)(unsafe.Pointer(&frame.linesize))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetLinesizeIdx gets `AVFrame.linesize` index value.
|
|
||||||
func (frame *AVFrame) GetLinesizeIdx(idx int) int32 {
|
|
||||||
return (int32)(frame.linesize[idx])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: SetLinesizeIdx sets `AVFrame.linesize` index value.
|
|
||||||
func (frame *AVFrame) SetLinesizeIdx(idx int, v int32) {
|
|
||||||
frame.linesize[idx] = (C.int)(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetLinesizeIdxAddr gets `AVFrame.linesize` index address.
|
|
||||||
func (frame *AVFrame) GetLinesizeIdxAddr(idx int) *int32 {
|
|
||||||
return (*int32)(&frame.linesize[idx])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetExtendedData gets `AVFrame.extended_data` value.
|
// Custom: GetExtendedData gets `AVFrame.extended_data` value.
|
||||||
func (frame *AVFrame) GetExtendedData() **uint8 {
|
func (frame *AVFrame) GetExtendedData() **uint8 {
|
||||||
return (**uint8)(unsafe.Pointer(frame.extended_data))
|
return (**uint8)(unsafe.Pointer(frame.extended_data))
|
||||||
@@ -297,7 +281,7 @@ func (frame *AVFrame) GetExtendedDataIdx(idx int) *uint8 {
|
|||||||
if frame.extended_data == nil {
|
if frame.extended_data == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return PointerOffset((*uint8)(*frame.extended_data), idx)
|
return (*uint8)(*PointerOffset(frame.extended_data, idx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetWidth gets `AVFrame.width` value.
|
// Custom: GetWidth gets `AVFrame.width` value.
|
||||||
@@ -495,26 +479,18 @@ func (frame *AVFrame) GetQualityAddr() *int32 {
|
|||||||
return (*int32)(&frame.quality)
|
return (*int32)(&frame.quality)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetIdxError gets `AVFrame.error` index value.
|
|
||||||
func (frame *AVFrame) GetErrorIdx(idx int) uint64 {
|
|
||||||
return (uint64)(frame.error[idx])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: SetIdxError sets `AVFrame.error` index value.
|
|
||||||
func (frame *AVFrame) SetErrorIdx(idx int, v uint64) {
|
|
||||||
frame.error[idx] = (C.uint64_t)(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetErrorIdxAddr gets `AVFrame.error` index address.
|
|
||||||
func (frame *AVFrame) GetErrorIdxAddr(idx int) *uint64 {
|
|
||||||
return (*uint64)(&frame.error[idx])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetError gets `AVFrame.error` value.
|
// Custom: GetError gets `AVFrame.error` value.
|
||||||
func (frame *AVFrame) GetError() []uint64 {
|
func (frame *AVFrame) GetError() []uint64 {
|
||||||
return unsafe.Slice((*uint64)(&frame.error[0]), AV_NUM_DATA_POINTERS)
|
return unsafe.Slice((*uint64)(&frame.error[0]), AV_NUM_DATA_POINTERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom: 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])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Custom: GetErrorAddr gets `AVFrame.error` address.
|
// Custom: GetErrorAddr gets `AVFrame.error` address.
|
||||||
func (frame *AVFrame) GetErrorAddr() **uint64 {
|
func (frame *AVFrame) GetErrorAddr() **uint64 {
|
||||||
return (**uint64)(unsafe.Pointer(&frame.error))
|
return (**uint64)(unsafe.Pointer(&frame.error))
|
||||||
@@ -625,30 +601,16 @@ func (frame *AVFrame) GetChannelLayoutAddr() *uint64 {
|
|||||||
return (*uint64)(&frame.channel_layout)
|
return (*uint64)(&frame.channel_layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetBufIdx gets `AVFrame.buf` value.
|
// Custom: GetBuf gets `AVFrame.buf` value.
|
||||||
func (frame *AVFrame) GetBuf() []*AVBufferRef {
|
func (frame *AVFrame) GetBuf() []*AVBufferRef {
|
||||||
return unsafe.Slice((**AVBufferRef)(unsafe.Pointer(&frame.buf[0])), AV_NUM_DATA_POINTERS)
|
return unsafe.Slice((**AVBufferRef)(unsafe.Pointer(&frame.buf[0])), AV_NUM_DATA_POINTERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetBufIdx gets `AVFrame.buf` value.
|
// Custom: SetBuf sets `AVFrame.buf` value.
|
||||||
func (frame *AVFrame) GetBufIdx(idx int) *AVBufferRef {
|
func (frame *AVFrame) SetBuf(v []*AVBufferRef) {
|
||||||
return (*AVBufferRef)(frame.buf[idx])
|
for i := 0; i < FFMIN(len(v), AV_NUM_DATA_POINTERS); i++ {
|
||||||
}
|
frame.buf[i] = (*C.struct_AVBufferRef)(v[i])
|
||||||
|
|
||||||
// Custom: SetBufIdx sets `AVFrame.buf` value.
|
|
||||||
func (frame *AVFrame) SetBufIdx(idx int, v *AVBufferRef) {
|
|
||||||
if idx > AV_NUM_DATA_POINTERS {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
frame.buf[idx] = (*C.struct_AVBufferRef)(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetBufIdxAddr gets `AVFrame.buf` address.
|
|
||||||
func (frame *AVFrame) GetBufIdxAddr(idx int) **AVBufferRef {
|
|
||||||
if idx > AV_NUM_DATA_POINTERS {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return (**AVBufferRef)(unsafe.Pointer(&frame.buf[idx]))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetBufAddr gets `AVFrame.buf` address.
|
// Custom: GetBufAddr gets `AVFrame.buf` address.
|
||||||
@@ -675,14 +637,6 @@ func (frame *AVFrame) GetExtendedBufAddr() ***AVBufferRef {
|
|||||||
return (***AVBufferRef)(unsafe.Pointer(&frame.extended_buf))
|
return (***AVBufferRef)(unsafe.Pointer(&frame.extended_buf))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetExtendedBufIdx gets `AVFrame.extended_buf` index value.
|
|
||||||
func (frame *AVFrame) GetExtendedBufIdx(idx int) *AVBufferRef {
|
|
||||||
if idx >= int(frame.nb_extended_buf) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVBufferRef)(*frame.extended_buf), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetNbExtendedBuf gets `AVFrame.nb_extended_buf` value.
|
// Custom: GetNbExtendedBuf gets `AVFrame.nb_extended_buf` value.
|
||||||
func (frame *AVFrame) GetNbExtendedBuf() int32 {
|
func (frame *AVFrame) GetNbExtendedBuf() int32 {
|
||||||
return (int32)(frame.nb_extended_buf)
|
return (int32)(frame.nb_extended_buf)
|
||||||
@@ -716,14 +670,6 @@ func (frame *AVFrame) GetSideDataAddr() ***AVFrameSideData {
|
|||||||
return (***AVFrameSideData)(unsafe.Pointer(&frame.side_data))
|
return (***AVFrameSideData)(unsafe.Pointer(&frame.side_data))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetSideDataIdx gets `AVFrame.side_data` index value.
|
|
||||||
func (frame *AVFrame) GetSideDataIdx(idx int) *AVFrameSideData {
|
|
||||||
if idx >= int(frame.nb_side_data) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVFrameSideData)(*frame.side_data), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetNbSideData gets `AVFrame.nb_side_data` value.
|
// Custom: GetNbSideData gets `AVFrame.nb_side_data` value.
|
||||||
func (frame *AVFrame) GetNbSideData() int32 {
|
func (frame *AVFrame) GetNbSideData() int32 {
|
||||||
return (int32)(frame.nb_side_data)
|
return (int32)(frame.nb_side_data)
|
||||||
@@ -1037,63 +983,63 @@ func (frame *AVFrame) GetOpaqueRefAddr() **AVBufferRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCropTop gets `AVFrame.crop_top` value.
|
// Custom: GetCropTop gets `AVFrame.crop_top` value.
|
||||||
func (frame *AVFrame) GetCropTop() uint {
|
func (frame *AVFrame) GetCropTop() uintptr {
|
||||||
return (uint)(frame.crop_top)
|
return (uintptr)(frame.crop_top)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCropTop sets `AVFrame.crop_top` value.
|
// Custom: SetCropTop sets `AVFrame.crop_top` value.
|
||||||
func (frame *AVFrame) SetCropTop(v uint) {
|
func (frame *AVFrame) SetCropTop(v uintptr) {
|
||||||
frame.crop_top = (C.size_t)(v)
|
frame.crop_top = (C.size_t)(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCropTopAddr gets `AVFrame.crop_top` address.
|
// Custom: GetCropTopAddr gets `AVFrame.crop_top` address.
|
||||||
func (frame *AVFrame) GetCropTopAddr() *uint {
|
func (frame *AVFrame) GetCropTopAddr() *uintptr {
|
||||||
return (*uint)(unsafe.Pointer(&frame.crop_top))
|
return (*uintptr)(unsafe.Pointer(&frame.crop_top))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCropBottom gets `AVFrame.crop_bottom` value.
|
// Custom: GetCropBottom gets `AVFrame.crop_bottom` value.
|
||||||
func (frame *AVFrame) GetCropBottom() uint {
|
func (frame *AVFrame) GetCropBottom() uintptr {
|
||||||
return (uint)(frame.crop_bottom)
|
return (uintptr)(frame.crop_bottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCropBottom sets `AVFrame.crop_bottom` value.
|
// Custom: SetCropBottom sets `AVFrame.crop_bottom` value.
|
||||||
func (frame *AVFrame) SetCropBottom(v uint) {
|
func (frame *AVFrame) SetCropBottom(v uintptr) {
|
||||||
frame.crop_bottom = (C.size_t)(v)
|
frame.crop_bottom = (C.size_t)(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCropBottomAddr gets `AVFrame.crop_bottom` address.
|
// Custom: GetCropBottomAddr gets `AVFrame.crop_bottom` address.
|
||||||
func (frame *AVFrame) GetCropBottomAddr() *uint {
|
func (frame *AVFrame) GetCropBottomAddr() *uintptr {
|
||||||
return (*uint)(unsafe.Pointer(&frame.crop_bottom))
|
return (*uintptr)(unsafe.Pointer(&frame.crop_bottom))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCropLeft gets `AVFrame.crop_left` value.
|
// Custom: GetCropLeft gets `AVFrame.crop_left` value.
|
||||||
func (frame *AVFrame) GetCropLeft() uint {
|
func (frame *AVFrame) GetCropLeft() uintptr {
|
||||||
return (uint)(frame.crop_left)
|
return (uintptr)(frame.crop_left)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCropLeft sets `AVFrame.crop_left` value.
|
// Custom: SetCropLeft sets `AVFrame.crop_left` value.
|
||||||
func (frame *AVFrame) SetCropLeft(v uint) {
|
func (frame *AVFrame) SetCropLeft(v uintptr) {
|
||||||
frame.crop_left = (C.size_t)(v)
|
frame.crop_left = (C.size_t)(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCropLeftAddr gets `AVFrame.crop_left` address.
|
// Custom: GetCropLeftAddr gets `AVFrame.crop_left` address.
|
||||||
func (frame *AVFrame) GetCropLeftAddr() *uint {
|
func (frame *AVFrame) GetCropLeftAddr() *uintptr {
|
||||||
return (*uint)(unsafe.Pointer(&frame.crop_left))
|
return (*uintptr)(unsafe.Pointer(&frame.crop_left))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCropRight gets `AVFrame.crop_right` value.
|
// Custom: GetCropRight gets `AVFrame.crop_right` value.
|
||||||
func (frame *AVFrame) GetCropRight() uint {
|
func (frame *AVFrame) GetCropRight() uintptr {
|
||||||
return (uint)(frame.crop_right)
|
return (uintptr)(frame.crop_right)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCropRight sets `AVFrame.crop_right` value.
|
// Custom: SetCropRight sets `AVFrame.crop_right` value.
|
||||||
func (frame *AVFrame) SetCropRight(v uint) {
|
func (frame *AVFrame) SetCropRight(v uintptr) {
|
||||||
frame.crop_right = (C.size_t)(v)
|
frame.crop_right = (C.size_t)(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCropRightAddr gets `AVFrame.crop_right` address.
|
// Custom: GetCropRightAddr gets `AVFrame.crop_right` address.
|
||||||
func (frame *AVFrame) GetCropRightAddr() *uint {
|
func (frame *AVFrame) GetCropRightAddr() *uintptr {
|
||||||
return (*uint)(unsafe.Pointer(&frame.crop_right))
|
return (*uintptr)(unsafe.Pointer(&frame.crop_right))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetPrivateRef gets `AVFrame.private_ref` value.
|
// Custom: GetPrivateRef gets `AVFrame.private_ref` value.
|
||||||
|
15
avutil_hwcontext_cuda.go
Normal file
15
avutil_hwcontext_cuda.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//go:build ffmpeg_hw_cuda
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_cuda.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVCUDADeviceContextInternal
|
||||||
|
type AVCUDADeviceContextInternal C.struct_AVCUDADeviceContextInternal
|
||||||
|
|
||||||
|
const (
|
||||||
|
AV_CUDA_USE_PRIMARY_CONTEXT = C.AV_CUDA_USE_PRIMARY_CONTEXT
|
||||||
|
)
|
17
avutil_hwcontext_d3d11va.go
Normal file
17
avutil_hwcontext_d3d11va.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
//go:build ffmpeg_hw_d3d11va
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_d3d11va.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVD3D11VADeviceContext
|
||||||
|
type AVD3D11VADeviceContext C.struct_AVD3D11VADeviceContext
|
||||||
|
|
||||||
|
// AVD3D11FrameDescriptor
|
||||||
|
type AVD3D11FrameDescriptor C.struct_AVD3D11FrameDescriptor
|
||||||
|
|
||||||
|
// AVD3D11VAFramesContext
|
||||||
|
type AVD3D11VAFramesContext C.struct_AVD3D11VAFramesContext
|
27
avutil_hwcontext_drm.go
Normal file
27
avutil_hwcontext_drm.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
//go:build ffmpeg_hw_drm
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_drm.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
const (
|
||||||
|
AV_DRM_MAX_PLANES = C.AV_DRM_MAX_PLANES
|
||||||
|
)
|
||||||
|
|
||||||
|
// AVDRMObjectDescriptor
|
||||||
|
type AVDRMObjectDescriptor C.struct_AVDRMObjectDescriptor
|
||||||
|
|
||||||
|
// AVDRMPlaneDescriptor
|
||||||
|
type AVDRMPlaneDescriptor C.struct_AVDRMPlaneDescriptor
|
||||||
|
|
||||||
|
// AVDRMLayerDescriptor
|
||||||
|
type AVDRMLayerDescriptor C.struct_AVDRMLayerDescriptor
|
||||||
|
|
||||||
|
// AVDRMFrameDescriptor
|
||||||
|
type AVDRMFrameDescriptor C.struct_AVDRMFrameDescriptor
|
||||||
|
|
||||||
|
// AVDRMDeviceContext
|
||||||
|
type AVDRMDeviceContext C.struct_AVDRMDeviceContext
|
14
avutil_hwcontext_dxva2.go
Normal file
14
avutil_hwcontext_dxva2.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
//go:build ffmpeg_hw_dxva2
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_dxva2.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVDXVA2DeviceContext
|
||||||
|
type AVDXVA2DeviceContext C.struct_AVDXVA2DeviceContext
|
||||||
|
|
||||||
|
// AVDXVA2FramesContext
|
||||||
|
type AVDXVA2FramesContext C.struct_AVDXVA2FramesContext
|
11
avutil_hwcontext_mediacodec.go
Normal file
11
avutil_hwcontext_mediacodec.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
//go:build ffmpeg_hw_mediacodec
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_mediacodec.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVMediaCodecDeviceContext
|
||||||
|
type AVMediaCodecDeviceContext C.struct_AVMediaCodecDeviceContext
|
17
avutil_hwcontext_opencl.go
Normal file
17
avutil_hwcontext_opencl.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
//go:build ffmpeg_hw_opencl
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_opencl.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVOpenCLFrameDescriptor
|
||||||
|
type AVOpenCLFrameDescriptor C.struct_AVOpenCLFrameDescriptor
|
||||||
|
|
||||||
|
// AVOpenCLDeviceContext
|
||||||
|
type AVOpenCLDeviceContext C.struct_AVOpenCLDeviceContext
|
||||||
|
|
||||||
|
// AVOpenCLFramesContext
|
||||||
|
type AVOpenCLFramesContext C.struct_AVOpenCLFramesContext
|
14
avutil_hwcontext_qsv.go
Normal file
14
avutil_hwcontext_qsv.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
//go:build ffmpeg_hw_qsv
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_qsv.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVQSVDeviceContext
|
||||||
|
type AVQSVDeviceContext C.struct_AVQSVDeviceContext
|
||||||
|
|
||||||
|
// AVQSVFramesContext
|
||||||
|
type AVQSVFramesContext C.struct_AVQSVFramesContext
|
24
avutil_hwcontext_vaapi.go
Normal file
24
avutil_hwcontext_vaapi.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//go:build ffmpeg_hw_vaapi
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_vaapi.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
const (
|
||||||
|
AV_VAAPI_DRIVER_QUIRK_USER_SET = C.AV_VAAPI_DRIVER_QUIRK_USER_SET
|
||||||
|
AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = C.AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS
|
||||||
|
AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = C.AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE
|
||||||
|
AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = C.AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES
|
||||||
|
)
|
||||||
|
|
||||||
|
// AVVAAPIDeviceContext
|
||||||
|
type AVVAAPIDeviceContext C.struct_AVVAAPIDeviceContext
|
||||||
|
|
||||||
|
// AVVAAPIFramesContext
|
||||||
|
type AVVAAPIFramesContext C.struct_AVVAAPIFramesContext
|
||||||
|
|
||||||
|
// AVVAAPIHWConfig
|
||||||
|
type AVVAAPIHWConfig C.struct_AVVAAPIHWConfig
|
11
avutil_hwcontext_vdpau.go
Normal file
11
avutil_hwcontext_vdpau.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
//go:build ffmpeg_hw_vdpau
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_vdpau.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVVDPAUDeviceContext
|
||||||
|
type AVVDPAUDeviceContext C.struct_AVVDPAUDeviceContext
|
24
avutil_hwcontext_videotoolbox.go
Normal file
24
avutil_hwcontext_videotoolbox.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//go:build ffmpeg_hw_videotoolbox
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_videotoolbox.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AvMapVideotoolboxFormatToPixfmt converts a VideoToolbox (actually CoreVideo) format to AVPixelFormat.
|
||||||
|
func AvMapVideotoolboxFormatToPixfmt(cvFmt uint32) AVPixelFormat {
|
||||||
|
return (AVPixelFormat)(C.av_map_videotoolbox_format_to_pixfmt((C.uint32_t)(cvFmt)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvMapVideotoolboxFormatFromPixfmt converts an AVPixelFormat to a VideoToolbox (actually CoreVideo) format.
|
||||||
|
func AvMapVideotoolboxFormatFromPixfmt(pixFmt AVPixelFormat) uint32 {
|
||||||
|
return (uint32)(C.av_map_videotoolbox_format_from_pixfmt((C.enum_AVPixelFormat)(pixFmt)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvMapVideotoolboxFormatFromPixfmt2 same as av_map_videotoolbox_format_from_pixfmt function, but can map and
|
||||||
|
// return full range pixel formats via a flag.
|
||||||
|
func AvMapVideotoolboxFormatFromPixfmt2(pixFmt AVPixelFormat, fullRange bool) uint32 {
|
||||||
|
return (uint32)(C.av_map_videotoolbox_format_from_pixfmt2((C.enum_AVPixelFormat)(pixFmt), C.bool(fullRange)))
|
||||||
|
}
|
28
avutil_hwcontext_vulkan.go
Normal file
28
avutil_hwcontext_vulkan.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
//go:build ffmpeg_hw_vulkan
|
||||||
|
|
||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/hwcontext_vulkan.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVVulkanDeviceContext
|
||||||
|
type AVVulkanDeviceContext C.struct_AVVulkanDeviceContext
|
||||||
|
|
||||||
|
// AVVulkanFramesContext
|
||||||
|
type AVVulkanFramesContext C.struct_AVVulkanFramesContext
|
||||||
|
|
||||||
|
// AVVkFrame
|
||||||
|
type AVVkFrame C.struct_AVVkFrame
|
||||||
|
|
||||||
|
// AvVkFrameAlloc allocates a single AVVkFrame and initializes everything as 0.
|
||||||
|
func AvVkFrameAlloc() *AVVkFrame {
|
||||||
|
return (*AVVkFrame)(C.av_vk_frame_alloc())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvVkfmtFromPixfmt returns the format of each image up to the number of planes for a given sw_format.
|
||||||
|
// Returns NULL on unsupported formats.
|
||||||
|
func AvVkfmtFromPixfmt(p AVPixelFormat) *AVVkFrame {
|
||||||
|
return (*AVVkFrame)(C.av_vkfmt_from_pixfmt((C.enum_AVPixelFormat)(p)))
|
||||||
|
}
|
@@ -38,7 +38,7 @@ func AvImageFillLinesizes(linesizes []int32, pixFmt AVPixelFormat, width int32)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AvImageFillPlaneSizes fills plane sizes for an image with pixel format pix_fmt and height height.
|
// AvImageFillPlaneSizes fills plane sizes for an image with pixel format pix_fmt and height height.
|
||||||
func AvImageFillPlaneSizes(size []uint, pixFmt AVPixelFormat, height int32, linesizes []int) int32 {
|
func AvImageFillPlaneSizes(size []uintptr, pixFmt AVPixelFormat, height int32, linesizes []int) int32 {
|
||||||
if len(size) < 4 {
|
if len(size) < 4 {
|
||||||
panic("size len < 4")
|
panic("size len < 4")
|
||||||
}
|
}
|
||||||
|
@@ -281,14 +281,6 @@ func (optrs *AVOptionRanges) GetRange() []*AVOptionRange {
|
|||||||
optrs.nb_components*optrs.nb_ranges)
|
optrs.nb_components*optrs.nb_ranges)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetRangeIdx gets `AVOptionRanges.range` index value.
|
|
||||||
func (optrs *AVOptionRanges) GetRangeIdx(idx int) *AVOptionRange {
|
|
||||||
if idx >= int(optrs.nb_components*optrs.nb_ranges) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return PointerOffset((*AVOptionRange)(*optrs._range), idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetNbRanges gets `AVOptionRanges.nb_ranges` value.
|
// Custom: GetNbRanges gets `AVOptionRanges.nb_ranges` value.
|
||||||
func (optrs *AVOptionRanges) GetNbRanges() int32 {
|
func (optrs *AVOptionRanges) GetNbRanges() int32 {
|
||||||
return (int32)(optrs.nb_ranges)
|
return (int32)(optrs.nb_ranges)
|
||||||
|
@@ -152,23 +152,20 @@ func (pfd *AVPixFmtDescriptor) GetFlagsAddr() *uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetComp gets `AVPixFmtDescriptor.comp` value.
|
// Custom: GetComp gets `AVPixFmtDescriptor.comp` value.
|
||||||
func (pfd *AVPixFmtDescriptor) GetComp(idx int) []AVComponentDescriptor {
|
func (pfd *AVPixFmtDescriptor) GetComp() []AVComponentDescriptor {
|
||||||
return unsafe.Slice((*AVComponentDescriptor)(&pfd.comp[0]), idx)
|
return unsafe.Slice((*AVComponentDescriptor)(&pfd.comp[0]), 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetCompIdx gets `AVPixFmtDescriptor.comp` index value.
|
// Custom: SetComp sets `AVPixFmtDescriptor.comp` value.
|
||||||
func (pfd *AVPixFmtDescriptor) GetCompIdx(idx int) AVComponentDescriptor {
|
func (pfd *AVPixFmtDescriptor) SetComp(v []AVComponentDescriptor) {
|
||||||
return (AVComponentDescriptor)(pfd.comp[idx])
|
for i := 0; i < FFMIN(len(v), 4); i++ {
|
||||||
|
pfd.comp[i] = (C.struct_AVComponentDescriptor)(v[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: SetCompIdx sets `AVPixFmtDescriptor.comp` index value.
|
// Custom: GetCompAddr gets `AVPixFmtDescriptor.comp` address.
|
||||||
func (pfd *AVPixFmtDescriptor) SetCompIdx(idx int, v AVComponentDescriptor) {
|
func (pfd *AVPixFmtDescriptor) GetCompAddr() **AVComponentDescriptor {
|
||||||
pfd.comp[idx] = (C.struct_AVComponentDescriptor)(v)
|
return (**AVComponentDescriptor)(unsafe.Pointer(&pfd.comp))
|
||||||
}
|
|
||||||
|
|
||||||
// Custom: GetCompIdxAddr gets `AVPixFmtDescriptor.comp` index address.
|
|
||||||
func (pfd *AVPixFmtDescriptor) GetCompIdxAddr(idx int) *AVComponentDescriptor {
|
|
||||||
return (*AVComponentDescriptor)(&pfd.comp[idx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom: GetAlias gets `AVPixFmtDescriptor.alias` value.
|
// Custom: GetAlias gets `AVPixFmtDescriptor.alias` value.
|
||||||
|
28
avutil_tea.go
Normal file
28
avutil_tea.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package ffmpeg
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <libavutil/tea.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// AVTEA
|
||||||
|
type AVTEA C.struct_AVTEA
|
||||||
|
|
||||||
|
// AvTeaAlloc allocates an AVTEA context.
|
||||||
|
func AvTeaAlloc() *AVTEA {
|
||||||
|
return (*AVTEA)(C.av_tea_alloc())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvTeaInit initializes an AVTEA context.
|
||||||
|
func AvTeaInit(ctx *AVTEA, key []uint8, rounds int32) {
|
||||||
|
if len(key) < 16 {
|
||||||
|
panic("key len < 16")
|
||||||
|
}
|
||||||
|
C.av_tea_init((*C.struct_AVTEA)(ctx), (*C.uint8_t)(&key[0]), (C.int)(rounds))
|
||||||
|
}
|
||||||
|
|
||||||
|
// AvTeaCrypt encrypts or decrypts a buffer using a previously initialized context.
|
||||||
|
func AvTeaCrypt(ctx *AVTEA, dst, src *uint8, count int32, iv *uint8, decrypt int32) {
|
||||||
|
C.av_tea_crypt((*C.struct_AVTEA)(ctx), (*C.uint8_t)(dst), (*C.uint8_t)(src),
|
||||||
|
(C.int)(count), (*C.uint8_t)(iv), (C.int)(decrypt))
|
||||||
|
}
|
@@ -1,5 +1,113 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
func main() {
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
ffmpeg "github.com/qrtc/ffmpeg-dev-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
func typeString(_type int32) string {
|
||||||
|
switch _type {
|
||||||
|
case ffmpeg.AVIO_ENTRY_DIRECTORY:
|
||||||
|
return "<DIR>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_FILE:
|
||||||
|
return "<FILE>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_BLOCK_DEVICE:
|
||||||
|
return "<BLOCK DEVICE>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_CHARACTER_DEVICE:
|
||||||
|
return "<CHARACTER DEVICE>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_NAMED_PIPE:
|
||||||
|
return "<PIPE>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_SYMBOLIC_LINK:
|
||||||
|
return "<LINK>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_SOCKET:
|
||||||
|
return "<SOCKET>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_SERVER:
|
||||||
|
return "<SERVER>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_SHARE:
|
||||||
|
return "<SHARE>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_WORKGROUP:
|
||||||
|
return "<WORKGROUP>"
|
||||||
|
case ffmpeg.AVIO_ENTRY_UNKNOWN:
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return "<UNKNOWN>"
|
||||||
|
}
|
||||||
|
|
||||||
|
func listOp(inputDir string) int32 {
|
||||||
|
var entry *ffmpeg.AVIODirEntry
|
||||||
|
var ctx *ffmpeg.AVIODirContext
|
||||||
|
var cnt, ret int32
|
||||||
|
var filemode, uidAndGid string
|
||||||
|
|
||||||
|
if ret = ffmpeg.AvIOOpenDir(&ctx, inputDir, nil); ret < 0 {
|
||||||
|
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_ERROR, "Cannot open directory: %s.\n", ffmpeg.AvErr2str(ret))
|
||||||
|
goto fail
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
if ret = ffmpeg.AvIOReadDir(ctx, &entry); ret < 0 {
|
||||||
|
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_ERROR, "Cannot list directory: %s.\n", ffmpeg.AvErr2str(ret))
|
||||||
|
goto fail
|
||||||
|
}
|
||||||
|
if entry == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if entry.GetFilemode() == -1 {
|
||||||
|
filemode = "???"
|
||||||
|
} else {
|
||||||
|
filemode = fmt.Sprintf("%3d", entry.GetFilemode())
|
||||||
|
}
|
||||||
|
uidAndGid = fmt.Sprintf("%d(%d)", entry.GetUserId(), entry.GetGroupId())
|
||||||
|
if cnt == 0 {
|
||||||
|
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_INFO, "%-9s %12s %30s %10s %s %16s %16s %16s\n",
|
||||||
|
"TYPE", "SIZE", "NAME", "UID(GID)", "UGO", "MODIFIED",
|
||||||
|
"ACCESSED", "STATUS_CHANGED")
|
||||||
|
}
|
||||||
|
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_INFO, "%-9s %12d %30s %10s %s %d %d %d\n",
|
||||||
|
typeString(entry.GetType()),
|
||||||
|
entry.GetSize(),
|
||||||
|
entry.GetName(),
|
||||||
|
uidAndGid,
|
||||||
|
filemode,
|
||||||
|
entry.GetModificationTimestamp(),
|
||||||
|
entry.GetAccessTimestamp(),
|
||||||
|
entry.GetStatusChangeTimestamp())
|
||||||
|
ffmpeg.AvIOFreeDirectoryEntry(&entry)
|
||||||
|
cnt++
|
||||||
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
ffmpeg.AvIOCloseDir(&ctx)
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
func usage(programName string) {
|
||||||
|
fmt.Fprintf(os.Stderr, "usage: %s input_dir\n"+
|
||||||
|
"API example program to show how to list files in directory "+
|
||||||
|
"accessed through AVIOContext.\n", programName)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var ret int32
|
||||||
|
|
||||||
|
ffmpeg.AvLogSetLevel(ffmpeg.AV_LOG_DEBUG)
|
||||||
|
|
||||||
|
if len(os.Args) < 2 {
|
||||||
|
usage(os.Args[0])
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
ffmpeg.AvFormatNetworkInit()
|
||||||
|
|
||||||
|
ret = listOp(os.Args[1])
|
||||||
|
|
||||||
|
ffmpeg.AvFormatNetworkDeinit()
|
||||||
|
|
||||||
|
if ret < 0 {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,118 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
func main() {
|
/*
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int readPacket(void* opaque, uint8_t *buf, int bufSize);
|
||||||
|
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"runtime/cgo"
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
ffmpeg "github.com/qrtc/ffmpeg-dev-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
type bufferData struct {
|
||||||
|
ptr *uint8
|
||||||
|
size uintptr
|
||||||
|
}
|
||||||
|
|
||||||
|
//export readPacket
|
||||||
|
func readPacket(opaque unsafe.Pointer, buf *uint8, bufSize int32) int32 {
|
||||||
|
bd := (*(*cgo.Handle)(opaque)).Value().(*bufferData)
|
||||||
|
bufSize = ffmpeg.FFMIN(bufSize, int32(bd.size))
|
||||||
|
|
||||||
|
if bufSize == 0 {
|
||||||
|
return ffmpeg.AVERROR_EOF
|
||||||
|
}
|
||||||
|
fmt.Fprintf(os.Stdout, "ptr:%p size:%d\n", bd.ptr, bd.size)
|
||||||
|
|
||||||
|
// copy internal buffer data to buf
|
||||||
|
bd.ptr = ffmpeg.PointerOffset(bd.ptr, bufSize)
|
||||||
|
bd.size -= uintptr(bufSize)
|
||||||
|
|
||||||
|
return bufSize
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var fmtCtx *ffmpeg.AVFormatContext
|
||||||
|
var avioCtx *ffmpeg.AVIOContext
|
||||||
|
var buffer, avioCtxBuffer *uint8
|
||||||
|
var bufferSize uintptr
|
||||||
|
var avioCtxBufferSize uint = 4096
|
||||||
|
var ret int32
|
||||||
|
var bd bufferData
|
||||||
|
var opaqueHandle cgo.Handle
|
||||||
|
|
||||||
|
if len(os.Args) != 2 {
|
||||||
|
fmt.Fprintf(os.Stderr, "usage: %s input_file\n"+
|
||||||
|
"API example program to show how to read from a custom buffer "+
|
||||||
|
"accessed through AVIOContext.\n", os.Args[0])
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
inputFilename := os.Args[1]
|
||||||
|
|
||||||
|
// slurp file content into buffer
|
||||||
|
if ret = ffmpeg.AvFileMap(inputFilename, &buffer, &bufferSize, 0, nil); ret < 0 {
|
||||||
|
goto end
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill opaque structure used by the AVIOContext read callback
|
||||||
|
bd.ptr = buffer
|
||||||
|
bd.size = bufferSize
|
||||||
|
|
||||||
|
if fmtCtx = ffmpeg.AvFormatAllocContext(); fmtCtx == nil {
|
||||||
|
ret = ffmpeg.AVERROR(syscall.ENOMEM)
|
||||||
|
goto end
|
||||||
|
}
|
||||||
|
|
||||||
|
if avioCtxBuffer = (*uint8)(ffmpeg.AvMalloc(avioCtxBufferSize)); avioCtxBuffer == nil {
|
||||||
|
ret = ffmpeg.AVERROR(syscall.ENOMEM)
|
||||||
|
goto end
|
||||||
|
}
|
||||||
|
|
||||||
|
opaqueHandle = cgo.NewHandle(&bd)
|
||||||
|
if avioCtx = ffmpeg.AvIOAllocContext(avioCtxBuffer, int32(avioCtxBufferSize), 0,
|
||||||
|
&opaqueHandle, (ffmpeg.AVIOContextReadPacketFunc)(C.readPacket), nil, nil); avioCtx == nil {
|
||||||
|
ret = ffmpeg.AVERROR(syscall.ENOMEM)
|
||||||
|
goto end
|
||||||
|
}
|
||||||
|
fmtCtx.SetPb(avioCtx)
|
||||||
|
|
||||||
|
if ret = ffmpeg.AvFormatOpenInput(&fmtCtx, ffmpeg.NIL, nil, nil); ret < 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "Could not open input\n")
|
||||||
|
goto end
|
||||||
|
}
|
||||||
|
|
||||||
|
if ret = ffmpeg.AvFormatFindStreamInfo(fmtCtx, nil); ret < 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "Could not find stream information\n")
|
||||||
|
goto end
|
||||||
|
}
|
||||||
|
|
||||||
|
ffmpeg.AvDumpFormat(fmtCtx, 0, inputFilename, 0)
|
||||||
|
|
||||||
|
end:
|
||||||
|
ffmpeg.AvFormatCloseInput(&fmtCtx)
|
||||||
|
|
||||||
|
if opaqueHandle != 0 {
|
||||||
|
opaqueHandle.Delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
// note: the internal buffer could have changed, and be != avio_ctx_buffer
|
||||||
|
if avioCtx != nil {
|
||||||
|
ffmpeg.AvFreep(avioCtx.GetBufferAddr())
|
||||||
|
}
|
||||||
|
ffmpeg.AvIOContextFree(&avioCtx)
|
||||||
|
|
||||||
|
ffmpeg.AvFileUnmap(buffer, bufferSize)
|
||||||
|
|
||||||
|
if ret < 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error occurred: %s\n", ffmpeg.AvErr2str(ret))
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ func getFormatFromSampleFmt(sampleFmt ffmpeg.AVSampleFormat) (string, int32) {
|
|||||||
|
|
||||||
fmt.Fprintf(os.Stderr, "sample format %s is not supported as output format\n",
|
fmt.Fprintf(os.Stderr, "sample format %s is not supported as output format\n",
|
||||||
ffmpeg.AvGetSampleFmtName(sampleFmt))
|
ffmpeg.AvGetSampleFmtName(sampleFmt))
|
||||||
return "", -1
|
return ffmpeg.NIL, -1
|
||||||
}
|
}
|
||||||
|
|
||||||
func decode(decCtx *ffmpeg.AVCodecContext, pkt *ffmpeg.AVPacket, frame *ffmpeg.AVFrame, outfile *os.File) {
|
func decode(decCtx *ffmpeg.AVCodecContext, pkt *ffmpeg.AVPacket, frame *ffmpeg.AVFrame, outfile *os.File) {
|
||||||
@@ -62,7 +62,7 @@ func decode(decCtx *ffmpeg.AVCodecContext, pkt *ffmpeg.AVPacket, frame *ffmpeg.A
|
|||||||
}
|
}
|
||||||
for i := int32(0); i < frame.GetNbSamples(); i++ {
|
for i := int32(0); i < frame.GetNbSamples(); i++ {
|
||||||
for ch := 0; ch < int(decCtx.GetChannels()); ch++ {
|
for ch := 0; ch < int(decCtx.GetChannels()); ch++ {
|
||||||
outfile.Write(ffmpeg.ByteSliceWithOffset(frame.GetDataIdx(ch), dataSize*i, dataSize))
|
outfile.Write(ffmpeg.ByteSliceWithOffset(frame.GetData()[ch], dataSize*i, dataSize))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ func decode(decCtx *ffmpeg.AVCodecContext, frame *ffmpeg.AVFrame, pkt *ffmpeg.AV
|
|||||||
|
|
||||||
// the picture is allocated by the decoder. no need to free it
|
// the picture is allocated by the decoder. no need to free it
|
||||||
fname := fmt.Sprintf("%s-%d", filename, decCtx.GetFrameNumber())
|
fname := fmt.Sprintf("%s-%d", filename, decCtx.GetFrameNumber())
|
||||||
pgmSave(frame.GetDataIdx(0), frame.GetLinesizeIdx(0), frame.GetWidth(), frame.GetHeight(), fname)
|
pgmSave(frame.GetData()[0], frame.GetLinesize()[0], frame.GetWidth(), frame.GetHeight(), fname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -159,7 +159,7 @@ func main() {
|
|||||||
if ret := ffmpeg.AvFrameMakeWritable(frame); ret < 0 {
|
if ret := ffmpeg.AvFrameMakeWritable(frame); ret < 0 {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
samples := unsafe.Slice((*uint16)(unsafe.Pointer(frame.GetDataIdx(0))), 2*avctx.GetFrameSize()+avctx.GetChannels())
|
samples := unsafe.Slice((*uint16)(unsafe.Pointer(frame.GetData()[0])), avctx.GetFrameSize()*avctx.GetChannels())
|
||||||
|
|
||||||
for j := 0; j < int(avctx.GetFrameSize()); j++ {
|
for j := 0; j < int(avctx.GetFrameSize()); j++ {
|
||||||
samples[2*j] = (uint16)(math.Sin(t) * 10000)
|
samples[2*j] = (uint16)(math.Sin(t) * 10000)
|
||||||
|
@@ -120,20 +120,20 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prepare a dummy image
|
// prepare a dummy image
|
||||||
data0 := unsafe.Slice(frame.GetDataIdx(0), avctx.GetHeight()*frame.GetLinesizeIdx(0)+avctx.GetWidth())
|
data0 := unsafe.Slice(frame.GetData()[0], avctx.GetHeight()*frame.GetLinesize()[0])
|
||||||
data1 := unsafe.Slice(frame.GetDataIdx(1), (avctx.GetHeight()/2)*frame.GetLinesizeIdx(1)+(avctx.GetWidth()/2))
|
data1 := unsafe.Slice(frame.GetData()[1], (avctx.GetHeight()/2)*frame.GetLinesize()[1])
|
||||||
data2 := unsafe.Slice(frame.GetDataIdx(2), (avctx.GetHeight()/2)*frame.GetLinesizeIdx(2)+(avctx.GetWidth()/2))
|
data2 := unsafe.Slice(frame.GetData()[2], (avctx.GetHeight()/2)*frame.GetLinesize()[2])
|
||||||
// Y
|
// Y
|
||||||
for y := 0; y < int(avctx.GetHeight()); y++ {
|
for y := 0; y < int(avctx.GetHeight()); y++ {
|
||||||
for x := 0; x < int(avctx.GetWidth()); x++ {
|
for x := 0; x < int(avctx.GetWidth()); x++ {
|
||||||
data0[y*int(frame.GetLinesizeIdx(0))+x] = uint8(x + y + i*3)
|
data0[y*int(frame.GetLinesize()[0])+x] = uint8(x + y + i*3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cb and Cr
|
// Cb and Cr
|
||||||
for y := 0; y < int(avctx.GetHeight()/2); y++ {
|
for y := 0; y < int(avctx.GetHeight()/2); y++ {
|
||||||
for x := 0; x < int(avctx.GetWidth()/2); x++ {
|
for x := 0; x < int(avctx.GetWidth()/2); x++ {
|
||||||
data1[y*int(frame.GetLinesizeIdx(1))+x] = uint8(128 + y + i*2)
|
data1[y*int(frame.GetLinesize()[1])+x] = uint8(128 + y + i*2)
|
||||||
data2[y*int(frame.GetLinesizeIdx(2))+x] = uint8(64 + x + i*5)
|
data2[y*int(frame.GetLinesize()[2])+x] = uint8(64 + x + i*5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
|
// filter-audio 0.05
|
||||||
|
// plane 0: 0x3A1E227C0C1A0DA59EAA91C35653125C
|
||||||
|
// plane 0: 0xA7922B09261B407E49C545A68B671572
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
@@ -22,7 +22,7 @@ int get_hw_format(struct AVCodecContext *ctx, const int *pix_fmts)
|
|||||||
{
|
{
|
||||||
const int *p;
|
const int *p;
|
||||||
|
|
||||||
fprintf(stderr, "get_hw_format called.\n");
|
fprintf(stderr, "get_hw_format ballback has been invoked.\n");
|
||||||
for (p = pix_fmts; *p != -1; p++) {
|
for (p = pix_fmts; *p != -1; p++) {
|
||||||
if (*p == hw_pix_fmt)
|
if (*p == hw_pix_fmt)
|
||||||
return *p;
|
return *p;
|
||||||
@@ -44,20 +44,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
hwDeviceCtx *ffmpeg.AVBufferRef
|
// Note: Gobal variable as argument pass to C world may be cause panic.
|
||||||
outputFile *os.File
|
// `runtime error: cgo argument has Go pointer to unpinned Go pointer`
|
||||||
)
|
)
|
||||||
|
|
||||||
func hwDecoderInit(ctx *ffmpeg.AVCodecContext, hwType ffmpeg.AVHWDeviceType) (ret int32) {
|
func hwDecoderInit(ctx *ffmpeg.AVCodecContext, hwType ffmpeg.AVHWDeviceType) (hwDeviceCtx *ffmpeg.AVBufferRef, ret int32) {
|
||||||
if ret := ffmpeg.AvHWDeviceCtxCreate(&hwDeviceCtx, hwType, "", nil, 0); ret < 0 {
|
if ret := ffmpeg.AvHWDeviceCtxCreate(&hwDeviceCtx, hwType, ffmpeg.NIL, nil, 0); ret < 0 {
|
||||||
fmt.Fprintf(os.Stderr, "Failed to create specified HW device.\n")
|
fmt.Fprintf(os.Stderr, "Failed to create specified HW device.\n")
|
||||||
return ret
|
return nil, ret
|
||||||
}
|
}
|
||||||
ctx.SetHwDeviceCtx(ffmpeg.AvBufferRef(hwDeviceCtx))
|
ctx.SetHwDeviceCtx(ffmpeg.AvBufferRef(hwDeviceCtx))
|
||||||
return ret
|
return hwDeviceCtx, ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeWrite(avctx *ffmpeg.AVCodecContext, packet *ffmpeg.AVPacket) (ret int32) {
|
func decodeWrite(avctx *ffmpeg.AVCodecContext, packet *ffmpeg.AVPacket, outputFile *os.File) (ret int32) {
|
||||||
var frame, swFrame, tmpFrame *ffmpeg.AVFrame
|
var frame, swFrame, tmpFrame *ffmpeg.AVFrame
|
||||||
var buffer *uint8
|
var buffer *uint8
|
||||||
var size int32
|
var size int32
|
||||||
@@ -129,6 +129,8 @@ func decodeWrite(avctx *ffmpeg.AVCodecContext, packet *ffmpeg.AVPacket) (ret int
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
var outputFile *os.File
|
||||||
|
var hwDeviceCtx *ffmpeg.AVBufferRef
|
||||||
var inputCtx *ffmpeg.AVFormatContext
|
var inputCtx *ffmpeg.AVFormatContext
|
||||||
var videoStream, ret int32
|
var videoStream, ret int32
|
||||||
var video *ffmpeg.AVStream
|
var video *ffmpeg.AVStream
|
||||||
@@ -182,7 +184,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
if (config.GetMethods()&ffmpeg.AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX) != 0 &&
|
if (config.GetMethods()&ffmpeg.AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX) != 0 &&
|
||||||
config.GetDeviceType() == hwType {
|
config.GetDeviceType() == hwType {
|
||||||
fmt.Fprintf(os.Stdout, "Support set_hw_pix_fmt. \n")
|
|
||||||
C.set_hw_pix_fmt((C.int)(config.GetPixFmt()))
|
C.set_hw_pix_fmt((C.int)(config.GetPixFmt()))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -192,14 +193,14 @@ func main() {
|
|||||||
os.Exit(int(ffmpeg.AVERROR(syscall.ENOMEM)))
|
os.Exit(int(ffmpeg.AVERROR(syscall.ENOMEM)))
|
||||||
}
|
}
|
||||||
|
|
||||||
video = inputCtx.GetStreamsIdx(int(videoStream))
|
video = inputCtx.GetStreams()[videoStream]
|
||||||
if ret = ffmpeg.AvCodecParametersToContext(decoderCtx, video.GetCodecpar()); ret < 0 {
|
if ret = ffmpeg.AvCodecParametersToContext(decoderCtx, video.GetCodecpar()); ret < 0 {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
decoderCtx.SetGetFormat((ffmpeg.AVCodecContextGetFormatFunc)(C.get_hw_format))
|
decoderCtx.SetGetFormat((ffmpeg.AVCodecContextGetFormatFunc)(C.get_hw_format))
|
||||||
|
|
||||||
if ret = hwDecoderInit(decoderCtx, hwType); ret < 0 {
|
if hwDeviceCtx, ret = hwDecoderInit(decoderCtx, hwType); ret < 0 {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +218,7 @@ func main() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if videoStream == packet.GetStreamIndex() {
|
if videoStream == packet.GetStreamIndex() {
|
||||||
ret = decodeWrite(decoderCtx, &packet)
|
ret = decodeWrite(decoderCtx, &packet, outputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
ffmpeg.AvPacketUnref(&packet)
|
ffmpeg.AvPacketUnref(&packet)
|
||||||
@@ -226,7 +227,7 @@ func main() {
|
|||||||
// flush the decoder
|
// flush the decoder
|
||||||
packet.SetData(nil)
|
packet.SetData(nil)
|
||||||
packet.SetSize(0)
|
packet.SetSize(0)
|
||||||
ret = decodeWrite(decoderCtx, &packet)
|
ret = decodeWrite(decoderCtx, &packet, outputFile)
|
||||||
ffmpeg.AvPacketUnref(&packet)
|
ffmpeg.AvPacketUnref(&packet)
|
||||||
|
|
||||||
if outputFile != nil {
|
if outputFile != nil {
|
||||||
|
@@ -1,5 +1,40 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
func main() {
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
ffmpeg "github.com/qrtc/ffmpeg-dev-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var fmtCtx *ffmpeg.AVFormatContext
|
||||||
|
var tag *ffmpeg.AVDictionaryEntry
|
||||||
|
var ret int32
|
||||||
|
|
||||||
|
if len(os.Args) != 2 {
|
||||||
|
fmt.Fprintf(os.Stderr, "usage: %s <input_file>\n"+
|
||||||
|
"example program to demonstrate the use of the libavformat metadata API.\n"+
|
||||||
|
"\n", os.Args[0])
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if ret = ffmpeg.AvFormatOpenInput(&fmtCtx, os.Args[1], nil, nil); ret != 0 {
|
||||||
|
os.Exit(int(ret))
|
||||||
|
}
|
||||||
|
|
||||||
|
if ret = ffmpeg.AvFormatFindStreamInfo(fmtCtx, nil); ret < 0 {
|
||||||
|
ffmpeg.AvLog(nil, ffmpeg.AV_LOG_ERROR, "Cannot find stream information\n")
|
||||||
|
os.Exit(int(ret))
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
if tag = ffmpeg.AvDictGet(fmtCtx.GetMetadata(), "", tag, ffmpeg.AV_DICT_IGNORE_SUFFIX); tag == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
fmt.Fprintf(os.Stdout, "%s=%s\n", tag.GetKey(), tag.GetValue())
|
||||||
|
}
|
||||||
|
|
||||||
|
ffmpeg.AvFormatCloseInput(&fmtCtx)
|
||||||
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func fillYuvImage(data [4]*uint8, linesize [4]int32, width, height, frameIndex int32) {
|
func fillYuvImage(data [4]*uint8, linesize [4]int32, width, height, frameIndex int32) {
|
||||||
// Y
|
// Y
|
||||||
data0 := unsafe.Slice(data[0], height*linesize[0]+width)
|
data0 := unsafe.Slice(data[0], height*linesize[0])
|
||||||
for y := int32(0); y < height; y++ {
|
for y := int32(0); y < height; y++ {
|
||||||
for x := int32(0); x < width; x++ {
|
for x := int32(0); x < width; x++ {
|
||||||
data0[y*linesize[0]+x] = (uint8)(x + y + frameIndex*3)
|
data0[y*linesize[0]+x] = (uint8)(x + y + frameIndex*3)
|
||||||
|
@@ -100,7 +100,7 @@ func openOutputFile(filename string, inputCodecContext *ffmpeg.AVCodecContext) (
|
|||||||
outputFormatContext.SetPb(outputIOContext)
|
outputFormatContext.SetPb(outputIOContext)
|
||||||
|
|
||||||
// Guess the desired container format based on the file extension.
|
// Guess the desired container format based on the file extension.
|
||||||
outputFormatContext.SetOformat(ffmpeg.AvGuessFormat("", filename, ""))
|
outputFormatContext.SetOformat(ffmpeg.AvGuessFormat(ffmpeg.NIL, filename, ffmpeg.NIL))
|
||||||
if outputFormatContext.GetOformat() == nil {
|
if outputFormatContext.GetOformat() == nil {
|
||||||
fmt.Fprintf(os.Stderr, "Could not find output file format\n")
|
fmt.Fprintf(os.Stderr, "Could not find output file format\n")
|
||||||
goto cleanup
|
goto cleanup
|
||||||
|
@@ -21,10 +21,12 @@ type HelperUnsingedInteger interface {
|
|||||||
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
|
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const NIL = "\\'nil'\\"
|
||||||
|
|
||||||
// StringCasting casts go string to c world char* with free function
|
// StringCasting casts go string to c world char* with free function
|
||||||
// Note: if input is a empty string will return a nil pointer.
|
// Note: if input is a NIL string will return a nil pointer.
|
||||||
func StringCasting(str string) (allocPtr *C.char, freeFunc func()) {
|
func StringCasting(str string) (allocPtr *C.char, freeFunc func()) {
|
||||||
if len(str) == 0 {
|
if str == NIL {
|
||||||
return nil, func() {}
|
return nil, func() {}
|
||||||
}
|
}
|
||||||
allocPtr = C.CString(str)
|
allocPtr = C.CString(str)
|
||||||
|
Reference in New Issue
Block a user