@@ -819,11 +819,23 @@ func AVCodecPixFmtToCodecTag(pixFmt AVPixelFormat) uint {
819819
820820// --- Function avcodec_find_best_pix_fmt_of_list ---
821821
822- // avcodec_find_best_pix_fmt_of_list skipped due to pixFmtList
822+ // avcodec_find_best_pix_fmt_of_list skipped due to lossPtr
823823
824824// --- Function avcodec_default_get_format ---
825825
826- // avcodec_default_get_format skipped due to fmt
826+ // AVCodecDefaultGetFormat wraps avcodec_default_get_format.
827+ func AVCodecDefaultGetFormat(s *AVCodecContext, fmt *AVPixelFormat) AVPixelFormat {
828+ var tmps *C.AVCodecContext
829+ if s != nil {
830+ tmps = s.ptr
831+ }
832+ var tmpfmt *C.enum_AVPixelFormat
833+ if fmt != nil {
834+ tmpfmt = (*C.enum_AVPixelFormat)(unsafe.Pointer(fmt))
835+ }
836+ ret := C.avcodec_default_get_format(tmps, tmpfmt)
837+ return AVPixelFormat(ret)
838+ }
827839
828840// --- Function avcodec_string ---
829841
@@ -9353,7 +9365,31 @@ func AVCpuMaxAlign() uint64 {
93539365
93549366// --- Function av_crc_init ---
93559367
9356- // av_crc_init skipped due to ctx
9368+ // AVCrcInit wraps av_crc_init.
9369+ /*
9370+ Initialize a CRC table.
9371+ @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
9372+ @param le If 1, the lowest bit represents the coefficient for the highest
9373+ exponent of the corresponding polynomial (both for poly and
9374+ actual CRC).
9375+ If 0, you must swap the CRC parameter and the result of av_crc
9376+ if you need the standard representation (can be simplified in
9377+ most cases to e.g. bswap16):
9378+ av_bswap32(crc << (32-bits))
9379+ @param bits number of bits for the CRC
9380+ @param poly generator polynomial without the x**bits coefficient, in the
9381+ representation as specified by le
9382+ @param ctx_size size of ctx in bytes
9383+ @return <0 on failure
9384+ */
9385+ func AVCrcInit(ctx *AVCRC, le int, bits int, poly uint32, ctxSize int) (int, error) {
9386+ var tmpctx *C.AVCRC
9387+ if ctx != nil {
9388+ tmpctx = (*C.AVCRC)(unsafe.Pointer(ctx))
9389+ }
9390+ ret := C.av_crc_init(tmpctx, C.int(le), C.int(bits), C.uint32_t(poly), C.int(ctxSize))
9391+ return int(ret), WrapErr(int(ret))
9392+ }
93579393
93589394// --- Function av_crc_get_table ---
93599395
@@ -9370,7 +9406,25 @@ func AVCrcGetTable(crcId AVCRCId) *AVCRC {
93709406
93719407// --- Function av_crc ---
93729408
9373- // av_crc skipped due to ctx
9409+ // AVCrc wraps av_crc.
9410+ /*
9411+ Calculate the CRC of a block.
9412+ @param ctx initialized AVCRC array (see av_crc_init())
9413+ @param crc CRC of previous blocks if any or initial value for CRC
9414+ @param buffer buffer whose CRC to calculate
9415+ @param length length of the buffer
9416+ @return CRC updated with the data from the given block
9417+
9418+ @see av_crc_init() "le" parameter
9419+ */
9420+ func AVCrc(ctx *AVCRC, crc uint32, buffer unsafe.Pointer, length uint64) uint32 {
9421+ var tmpctx *C.AVCRC
9422+ if ctx != nil {
9423+ tmpctx = (*C.AVCRC)(unsafe.Pointer(ctx))
9424+ }
9425+ ret := C.av_crc(tmpctx, C.uint32_t(crc), (*C.uint8_t)(buffer), C.size_t(length))
9426+ return uint32(ret)
9427+ }
93749428
93759429// --- Function av_csp_luma_coeffs_from_avcsp ---
93769430
@@ -13977,11 +14031,35 @@ func AVOptSetArray(obj unsafe.Pointer, name *CStr, searchFlags int, startElem ui
1397714031
1397814032// --- Function av_opt_get_pixel_fmt ---
1397914033
13980- // av_opt_get_pixel_fmt skipped due to outFmt
14034+ // AVOptGetPixelFmt wraps av_opt_get_pixel_fmt.
14035+ func AVOptGetPixelFmt(obj unsafe.Pointer, name *CStr, searchFlags int, outFmt *AVPixelFormat) (int, error) {
14036+ var tmpname *C.char
14037+ if name != nil {
14038+ tmpname = name.ptr
14039+ }
14040+ var tmpoutFmt *C.enum_AVPixelFormat
14041+ if outFmt != nil {
14042+ tmpoutFmt = (*C.enum_AVPixelFormat)(unsafe.Pointer(outFmt))
14043+ }
14044+ ret := C.av_opt_get_pixel_fmt(obj, tmpname, C.int(searchFlags), tmpoutFmt)
14045+ return int(ret), WrapErr(int(ret))
14046+ }
1398114047
1398214048// --- Function av_opt_get_sample_fmt ---
1398314049
13984- // av_opt_get_sample_fmt skipped due to outFmt
14050+ // AVOptGetSampleFmt wraps av_opt_get_sample_fmt.
14051+ func AVOptGetSampleFmt(obj unsafe.Pointer, name *CStr, searchFlags int, outFmt *AVSampleFormat) (int, error) {
14052+ var tmpname *C.char
14053+ if name != nil {
14054+ tmpname = name.ptr
14055+ }
14056+ var tmpoutFmt *C.enum_AVSampleFormat
14057+ if outFmt != nil {
14058+ tmpoutFmt = (*C.enum_AVSampleFormat)(unsafe.Pointer(outFmt))
14059+ }
14060+ ret := C.av_opt_get_sample_fmt(obj, tmpname, C.int(searchFlags), tmpoutFmt)
14061+ return int(ret), WrapErr(int(ret))
14062+ }
1398514063
1398614064// --- Function av_opt_get_video_rate ---
1398714065
@@ -14412,11 +14490,11 @@ func AVFindInfoTag(arg *CStr, argSize int, tag1 *CStr, info *CStr) (int, error)
1441214490
1441314491// --- Function av_small_strptime ---
1441414492
14415- // av_small_strptime skipped due to dt
14493+ // av_small_strptime skipped due to dt.
1441614494
1441714495// --- Function av_timegm ---
1441814496
14419- // av_timegm skipped due to tm
14497+ // av_timegm skipped due to tm.
1442014498
1442114499// --- Function av_get_random_seed ---
1442214500
@@ -15934,7 +16012,47 @@ func AVTwofishCrypt(ctx *AVTWOFISH, dst unsafe.Pointer, src unsafe.Pointer, coun
1593416012
1593516013// --- Function av_tx_init ---
1593616014
15937- // av_tx_init skipped due to tx
16015+ // AVTxInit wraps av_tx_init.
16016+ /*
16017+ Initialize a transform context with the given configuration
16018+ (i)MDCTs with an odd length are currently not supported.
16019+
16020+ @param ctx the context to allocate, will be NULL on error
16021+ @param tx pointer to the transform function pointer to set
16022+ @param type type the type of transform
16023+ @param inv whether to do an inverse or a forward transform
16024+ @param len the size of the transform in samples
16025+ @param scale pointer to the value to scale the output if supported by type
16026+ @param flags a bitmask of AVTXFlags or 0
16027+
16028+ @return 0 on success, negative error code on failure
16029+ */
16030+ func AVTxInit(ctx **AVTXContext, tx *AVTxFn, _type AVTXType, inv int, len int, scale unsafe.Pointer, flags uint64) (int, error) {
16031+ var ptrctx **C.AVTXContext
16032+ var tmpctx *C.AVTXContext
16033+ var oldTmpctx *C.AVTXContext
16034+ if ctx != nil {
16035+ innerctx := *ctx
16036+ if innerctx != nil {
16037+ tmpctx = innerctx.ptr
16038+ oldTmpctx = tmpctx
16039+ }
16040+ ptrctx = &tmpctx
16041+ }
16042+ var tmptx *C.av_tx_fn
16043+ if tx != nil {
16044+ tmptx = (*C.av_tx_fn)(unsafe.Pointer(tx))
16045+ }
16046+ ret := C.av_tx_init(ptrctx, tmptx, C.enum_AVTXType(_type), C.int(inv), C.int(len), scale, C.uint64_t(flags))
16047+ if tmpctx != oldTmpctx && ctx != nil {
16048+ if tmpctx != nil {
16049+ *ctx = &AVTXContext{ptr: tmpctx}
16050+ } else {
16051+ *ctx = nil
16052+ }
16053+ }
16054+ return int(ret), WrapErr(int(ret))
16055+ }
1593816056
1593916057// --- Function av_tx_uninit ---
1594016058
0 commit comments