Skip to content

Commit 0b6a959

Browse files
committed
feat: add ToAVHWFramesContext for hardware frame context conversion
Adds a new utility function that converts an unsafe.Pointer (typically from AVBufferRef.Data()) to an AVHWFramesContext wrapper. This functionality is essential for configuring hardware frames contexts returned by AVHWFrameCtxAlloc().
1 parent 70da1b7 commit 0b6a959

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

custom.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,13 @@ func (s *AVStreamGroupTileGrid) SetOffsets(value *AVStreamGroupTileGridOffset) {
364364
*(*unsafe.Pointer)(unsafe.Pointer(&s.ptr.offsets)) = nil
365365
}
366366
}
367+
368+
// ToAVHWFramesContext converts an unsafe.Pointer (typically from AVBufferRef.Data())
369+
// to an AVHWFramesContext wrapper. This is needed for configuring hardware frames
370+
// contexts returned by AVHWFrameCtxAlloc().
371+
func ToAVHWFramesContext(ptr unsafe.Pointer) *AVHWFramesContext {
372+
if ptr == nil {
373+
return nil
374+
}
375+
return &AVHWFramesContext{ptr: (*C.AVHWFramesContext)(ptr)}
376+
}

0 commit comments

Comments
 (0)