mirror of
https://github.com/qrtc/ffmpeg-dev-go.git
synced 2025-10-05 07:37:20 +08:00
2023-10-19 14:31:46 CST W42D4
This commit is contained in:
@@ -10,12 +10,12 @@ import (
|
||||
|
||||
// AvImageFillMaxPixsteps computes the max pixel step for each plane of an image with a
|
||||
// format described by pixdesc.
|
||||
func AvImageFillMaxPixsteps(maxPixsteps, maxPixstepComps []int32, pixdesc *AvPixFmtDescriptor) {
|
||||
if len(maxPixsteps) != 4 {
|
||||
panic("maxPixsteps need len = 4")
|
||||
func AvImageFillMaxPixsteps(maxPixsteps, maxPixstepComps []int32, pixdesc *AVPixFmtDescriptor) {
|
||||
if len(maxPixsteps) < 4 {
|
||||
panic("maxPixsteps len < 4")
|
||||
}
|
||||
if len(maxPixstepComps) != 4 {
|
||||
panic("maxPixstepComps need len = 4")
|
||||
if len(maxPixstepComps) < 4 {
|
||||
panic("maxPixstepComps len < 4")
|
||||
}
|
||||
C.av_image_fill_max_pixsteps((*C.int)(&maxPixsteps[0]), (*C.int)(&maxPixstepComps[0]),
|
||||
(*C.struct_AVPixFmtDescriptor)(pixdesc))
|
||||
@@ -23,40 +23,40 @@ func AvImageFillMaxPixsteps(maxPixsteps, maxPixstepComps []int32, pixdesc *AvPix
|
||||
|
||||
// AvImageGetLinesize computes the size of an image line with format pix_fmt and width
|
||||
// width for the plane plane.
|
||||
func AvImageGetLinesize(pixFmt AvPixelFormat, width, plane int32) int32 {
|
||||
func AvImageGetLinesize(pixFmt AVPixelFormat, width, plane int32) int32 {
|
||||
return (int32)(C.av_image_get_linesize((C.enum_AVPixelFormat)(pixFmt),
|
||||
(C.int)(width), (C.int)(plane)))
|
||||
}
|
||||
|
||||
// AvImageFillLinesizes fills plane linesizes for an image with pixel format pix_fmt and width width.
|
||||
func AvImageFillLinesizes(linesizes []int32, pixFmt AvPixelFormat, width int32) int32 {
|
||||
if len(linesizes) != 4 {
|
||||
panic("linesizes need len = 4")
|
||||
func AvImageFillLinesizes(linesizes []int32, pixFmt AVPixelFormat, width int32) int32 {
|
||||
if len(linesizes) < 4 {
|
||||
panic("linesizes len < 4")
|
||||
}
|
||||
return (int32)(C.av_image_fill_linesizes((*C.int)(&linesizes[0]),
|
||||
(C.enum_AVPixelFormat)(pixFmt), (C.int)(width)))
|
||||
}
|
||||
|
||||
// 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 {
|
||||
if len(size) != 4 {
|
||||
panic("size need len = 4")
|
||||
func AvImageFillPlaneSizes(size []uint, pixFmt AVPixelFormat, height int32, linesizes []int) int32 {
|
||||
if len(size) < 4 {
|
||||
panic("size len < 4")
|
||||
}
|
||||
if len(linesizes) != 4 {
|
||||
panic("linesizes need len = 4")
|
||||
if len(linesizes) < 4 {
|
||||
panic("linesizes len < 4")
|
||||
}
|
||||
return (int32)(C.av_image_fill_plane_sizes((*C.size_t)(unsafe.Pointer(&size[0])),
|
||||
(C.enum_AVPixelFormat)(pixFmt), (C.int)(height), (*C.ptrdiff_t)(unsafe.Pointer(&linesizes[0]))))
|
||||
}
|
||||
|
||||
// AvImageFillPointers fills plane data pointers for an image with pixel format pix_fmt and height height.
|
||||
func AvImageFillPointers(data []*uint8, pixFmt AvPixelFormat,
|
||||
func AvImageFillPointers(data []*uint8, pixFmt AVPixelFormat,
|
||||
height int32, ptr *uint8, linesizes []int32) int32 {
|
||||
if len(data) != 4 {
|
||||
panic("data need len = 4")
|
||||
if len(data) < 4 {
|
||||
panic("data len < 4")
|
||||
}
|
||||
if len(linesizes) != 4 {
|
||||
panic("linesizes need len = 4")
|
||||
if len(linesizes) < 4 {
|
||||
panic("linesizes len < 4")
|
||||
}
|
||||
return (int32)(C.av_image_fill_pointers((**C.uint8_t)(unsafe.Pointer(&data[0])),
|
||||
(C.enum_AVPixelFormat)(pixFmt), (C.int)(height), (*C.uint8_t)(ptr),
|
||||
@@ -66,12 +66,12 @@ func AvImageFillPointers(data []*uint8, pixFmt AvPixelFormat,
|
||||
// AvImageAlloc allocates an image with size w and h and pixel format pix_fmt, and
|
||||
// fill pointers and linesizes accordingly.
|
||||
func AvImageAlloc(pointers []*uint8, linesizes []int32, w, h int32,
|
||||
pixFmt AvPixelFormat, align int32) int32 {
|
||||
if len(pointers) != 4 {
|
||||
panic("pointers need len = 4")
|
||||
pixFmt AVPixelFormat, align int32) int32 {
|
||||
if len(pointers) < 4 {
|
||||
panic("pointers len < 4")
|
||||
}
|
||||
if len(linesizes) != 4 {
|
||||
panic("linesizes need len = 4")
|
||||
if len(linesizes) < 4 {
|
||||
panic("linesizes len < 4")
|
||||
}
|
||||
return (int32)(C.av_image_alloc((**C.uint8_t)(unsafe.Pointer(&pointers[0])),
|
||||
(*C.int)(&linesizes[0]),
|
||||
@@ -88,18 +88,18 @@ func AvImageCopyPlane(dst *uint8, dstLinesize int32, src *uint8,
|
||||
|
||||
// AvImageCopy copies image in src_data to dst_data.
|
||||
func AvImageCopy(dstData []*uint8, dstLinesizes []int32, srcData []*uint8, srcLinesizes []int32,
|
||||
pixFmt AvPixelFormat, width, height int32) {
|
||||
if len(dstData) != 4 {
|
||||
panic("dstData need len = 4")
|
||||
pixFmt AVPixelFormat, width, height int32) {
|
||||
if len(dstData) < 4 {
|
||||
panic("dstData len < 4")
|
||||
}
|
||||
if len(dstLinesizes) != 4 {
|
||||
panic("dstLinesizes need len = 4")
|
||||
if len(dstLinesizes) < 4 {
|
||||
panic("dstLinesizes len < 4")
|
||||
}
|
||||
if len(srcData) != 4 {
|
||||
panic("srcData need len = 4")
|
||||
if len(srcData) < 4 {
|
||||
panic("srcData len < 4")
|
||||
}
|
||||
if len(srcLinesizes) != 4 {
|
||||
panic("srcLinesizes need len = 4")
|
||||
if len(srcLinesizes) < 4 {
|
||||
panic("srcLinesizes len < 4")
|
||||
}
|
||||
C.av_image_copy((**C.uint8_t)(unsafe.Pointer(&dstData[0])),
|
||||
(*C.int)(&dstLinesizes[0]),
|
||||
@@ -110,18 +110,18 @@ func AvImageCopy(dstData []*uint8, dstLinesizes []int32, srcData []*uint8, srcLi
|
||||
|
||||
// AvImageCopyUcFrom copies image data located in uncacheable (e.g. GPU mapped) memory.
|
||||
func AvImageCopyUcFrom(dstData []*uint8, dstLinesizes []int, srcData []*uint8, srcLinesizes []int,
|
||||
pixFmt AvPixelFormat, width, height int32) {
|
||||
if len(dstData) != 4 {
|
||||
panic("dstData need len = 4")
|
||||
pixFmt AVPixelFormat, width, height int32) {
|
||||
if len(dstData) < 4 {
|
||||
panic("dstData len < 4")
|
||||
}
|
||||
if len(dstLinesizes) != 4 {
|
||||
panic("dstLinesizes need len = 4")
|
||||
if len(dstLinesizes) < 4 {
|
||||
panic("dstLinesizes len < 4")
|
||||
}
|
||||
if len(srcData) != 4 {
|
||||
panic("srcData need len = 4")
|
||||
if len(srcData) < 4 {
|
||||
panic("srcData len < 4")
|
||||
}
|
||||
if len(srcLinesizes) != 4 {
|
||||
panic("srcLinesizes need len = 4")
|
||||
if len(srcLinesizes) < 4 {
|
||||
panic("srcLinesizes len < 4")
|
||||
}
|
||||
C.av_image_copy_uc_from((**C.uint8_t)(unsafe.Pointer(&dstData[0])),
|
||||
(*C.ptrdiff_t)(unsafe.Pointer(&dstLinesizes[0])),
|
||||
@@ -133,12 +133,12 @@ func AvImageCopyUcFrom(dstData []*uint8, dstLinesizes []int, srcData []*uint8, s
|
||||
// AvImageFillArrays setups the data pointers and linesizes based on the specified image
|
||||
// parameters and the provided array.
|
||||
func AvImageFillArrays(dstData []*uint8, dstLinesize []int32, src *uint8,
|
||||
pixFmt AvPixelFormat, width, height, align int32) {
|
||||
if len(dstData) != 4 {
|
||||
panic("dstData need len = 4")
|
||||
pixFmt AVPixelFormat, width, height, align int32) {
|
||||
if len(dstData) < 4 {
|
||||
panic("dstData len < 4")
|
||||
}
|
||||
if len(dstLinesize) != 4 {
|
||||
panic("dstLinesize need len = 4")
|
||||
if len(dstLinesize) < 4 {
|
||||
panic("dstLinesize len < 4")
|
||||
}
|
||||
C.av_image_fill_arrays((**C.uint8_t)(unsafe.Pointer(&dstData[0])),
|
||||
(*C.int)(&dstLinesize[0]),
|
||||
@@ -148,53 +148,53 @@ func AvImageFillArrays(dstData []*uint8, dstLinesize []int32, src *uint8,
|
||||
|
||||
// AvImageGetBufferSize Return the size in bytes of the amount of data required to store an
|
||||
// image with the given parameters.
|
||||
func AvImageGetBufferSize(pixFmt AvPixelFormat, width, height, align int32) int32 {
|
||||
func AvImageGetBufferSize(pixFmt AVPixelFormat, width, height, align int32) int32 {
|
||||
return (int32)(C.av_image_get_buffer_size((C.enum_AVPixelFormat)(pixFmt),
|
||||
(C.int)(width), (C.int)(height), (C.int)(align)))
|
||||
}
|
||||
|
||||
// av_image_copy_to_buffer
|
||||
func av_image_copy_to_buffer(dst *uint8, dstSize int32, srcData []*uint8, srcLinesize []int32,
|
||||
pixFmt AvPixelFormat, width, height, align int32) {
|
||||
if len(srcData) != 4 {
|
||||
panic("srcData need len = 4")
|
||||
// AvImageCopyToBuffer copies image data from an image into a buffer.
|
||||
func AvImageCopyToBuffer(dst *uint8, dstSize int32, srcData []*uint8, srcLinesize []int32,
|
||||
pixFmt AVPixelFormat, width, height, align int32) int32 {
|
||||
if len(srcData) < 4 {
|
||||
panic("srcData len < 4")
|
||||
}
|
||||
if len(srcLinesize) != 4 {
|
||||
panic("srcLinesize need len = 4")
|
||||
if len(srcLinesize) < 4 {
|
||||
panic("srcLinesize len < 4")
|
||||
}
|
||||
C.av_image_copy_to_buffer((*C.uint8_t)(dst), (C.int)(dstSize),
|
||||
return (int32)(C.av_image_copy_to_buffer((*C.uint8_t)(dst), (C.int)(dstSize),
|
||||
(**C.uint8_t)(unsafe.Pointer(&srcData[0])), (*C.int)(&srcLinesize[0]),
|
||||
(C.enum_AVPixelFormat)(pixFmt), (C.int)(width), (C.int)(height), (C.int)(align))
|
||||
(C.enum_AVPixelFormat)(pixFmt), (C.int)(width), (C.int)(height), (C.int)(align)))
|
||||
}
|
||||
|
||||
// AvImageCheckSize checks if the given dimension of an image is valid, meaning that all
|
||||
// bytes of the image can be addressed with a signed int.
|
||||
func AvImageCheckSize(w, h uint32, logOffset int32, logCtx unsafe.Pointer) int32 {
|
||||
return (int32)(C.av_image_check_size((C.uint)(w), (C.uint)(h), (C.int)(logOffset), logCtx))
|
||||
func AvImageCheckSize(w, h uint32, logOffset int32, logCtx CVoidPointer) int32 {
|
||||
return (int32)(C.av_image_check_size((C.uint)(w), (C.uint)(h), (C.int)(logOffset), VoidPointer(logCtx)))
|
||||
}
|
||||
|
||||
// AvImageCheckSize2 checks if the given dimension of an image is valid, meaning that all
|
||||
// bytes of a plane of an image with the specified pix_fmt can be addressed with a signed int.
|
||||
func AvImageCheckSize2(w, h uint32, maxPixels int64, pixFmt AvPixelFormat,
|
||||
logOffset int32, logCtx unsafe.Pointer) int32 {
|
||||
func AvImageCheckSize2(w, h uint32, maxPixels int64, pixFmt AVPixelFormat,
|
||||
logOffset int32, logCtx CVoidPointer) int32 {
|
||||
return (int32)(C.av_image_check_size2((C.uint)(w), (C.uint)(h),
|
||||
(C.int64_t)(maxPixels), (C.enum_AVPixelFormat)(pixFmt),
|
||||
(C.int)(logOffset), logCtx))
|
||||
(C.int)(logOffset), VoidPointer(logCtx)))
|
||||
}
|
||||
|
||||
// AvImageCheckSar checks if the given sample aspect ratio of an image is valid.
|
||||
func AvImageCheckSar(w, h uint32, sar AvRational) int32 {
|
||||
func AvImageCheckSar(w, h uint32, sar AVRational) int32 {
|
||||
return (int32)(C.av_image_check_sar((C.uint)(w), (C.uint)(h), (C.struct_AVRational)(sar)))
|
||||
}
|
||||
|
||||
// AvImageFillBlack overwrites the image data with black.
|
||||
func AvImageFillBlack(dstData []*uint8, dstLinesize []int,
|
||||
pixFmt AvPixelFormat, _range AvColorRange, width, height int32) int32 {
|
||||
if len(dstData) != 4 {
|
||||
panic("dstData need len = 4")
|
||||
pixFmt AVPixelFormat, _range AVColorRange, width, height int32) int32 {
|
||||
if len(dstData) < 4 {
|
||||
panic("dstData len < 4")
|
||||
}
|
||||
if len(dstLinesize) != 4 {
|
||||
panic("dstLinesize need len = 4")
|
||||
if len(dstLinesize) < 4 {
|
||||
panic("dstLinesize len < 4")
|
||||
}
|
||||
return (int32)(C.av_image_fill_black((**C.uint8_t)(unsafe.Pointer(&dstData[0])),
|
||||
(*C.ptrdiff_t)(unsafe.Pointer(&dstLinesize[0])),
|
||||
|
Reference in New Issue
Block a user