diff options
author | Aman Karmani <aman@tmm1.net> | 2021-06-29 14:43:16 -0700 |
---|---|---|
committer | Aman Karmani <aman@tmm1.net> | 2021-07-18 12:01:16 -0700 |
commit | 504c60660d3194758823ddd45ceddb86e35d806f (patch) | |
tree | a9db3e34e3712ff064c21e589f38c64017d4e4f1 /libavutil/hwcontext_videotoolbox.h | |
parent | 997f9bdb99de18b27f8f213f381c5e90536a1be9 (diff) | |
download | ffmpeg-504c60660d3194758823ddd45ceddb86e35d806f.tar.gz |
avutil/hwcontext_videotoolbox: implement hwupload to convert AVFrame to CVPixelBuffer
Teach AV_HWDEVICE_TYPE_VIDEOTOOLBOX to be able to create AVFrames of type
AV_PIX_FMT_VIDEOTOOLBOX. This can be used to hwupload a regular AVFrame
into its CVPixelBuffer equivalent.
ffmpeg -init_hw_device videotoolbox -f lavfi -i color=black:640x480 -vf hwupload -c:v h264_videotoolbox -f null -y /dev/null
Signed-off-by: Aman Karmani <aman@tmm1.net>
Diffstat (limited to 'libavutil/hwcontext_videotoolbox.h')
-rw-r--r-- | libavutil/hwcontext_videotoolbox.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavutil/hwcontext_videotoolbox.h b/libavutil/hwcontext_videotoolbox.h index 5074d79e68..62cde07c51 100644 --- a/libavutil/hwcontext_videotoolbox.h +++ b/libavutil/hwcontext_videotoolbox.h @@ -29,11 +29,14 @@ * @file * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. * - * This API currently does not support frame allocation, as the raw VideoToolbox - * API does allocation, and FFmpeg itself never has the need to allocate frames. + * This API supports frame allocation using a native CVPixelBufferPool + * instead of an AVBufferPool. * * If the API user sets a custom pool, AVHWFramesContext.pool must return * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. + * Note that the underlying CVPixelBuffer could be retained by OS frameworks + * depending on application usage, so it is preferable to let CoreVideo manage + * the pool using the default implementation. * * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always * NULL. |